提交 acd74c99 authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

......@@ -64,7 +64,7 @@ export default class DraftEditor extends React.Component {
constructor(props) {
super(props);
const value = props.value || {};
const editorState = changeToDraftState2(blocks)
this.state = {
editorState: value.editorState,
......
差异被折叠。
......@@ -71,7 +71,7 @@ import { Base16Encode } from '../Base16/index';
import { getToken } from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList';
import FilePreview from '../filePreview';
import DraftEditor from '../App/DraftEditor';
import DraftEditorCom from '../App/DraftEditorCom';
const Item = MobileList.Item;
const Brief = Item.Brief;
function getBase64(value) {
......@@ -2877,12 +2877,12 @@ export default class tableCom extends Component {
break;
case 'RichText':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: { editorState: changeToDraftState(initValue) },
initialValue: initValue,
rules:
json.vlds && json.vlds.length > 0
? json.vlds
: [{ required: required, message: '请输入' }],
})(<DraftEditor placeholder={json.placeholder} />);
})(<DraftEditorCom placeholder={json.placeholder} />);
if (get === 'mobile' && json.isLabel && title) {
cm = (
<Form.Item
......
......@@ -80,6 +80,7 @@ export function changeToDraftState2(blocks) {
return EditorState.createWithContent(b, decorator)
}
export function changeFromDraftState2(editorState) {
if(editorState==null) return;
const x = editorState.getCurrentContent()
const blocks = convertToRaw(x)
......@@ -104,10 +105,7 @@ export function preHandle(values) {
} else {
if (values[key] != null) {
if (values[key].editorState) {
values[key] = changeFromDraftState(values[key].editorState).blocks
}else if (values[key] instanceof moment) {
if (values[key] instanceof moment) {
values[key] = values[key].valueOf()
}else if (values[key] instanceof Date) {
values[key] = values[key].valueOf()
......@@ -122,10 +120,7 @@ export function preHandle(values) {
let childObj = objValues[k];
for(let j in childObj){
if(childObj[j]!=null){
if (childObj[j].editorState) {
values[key][k][j]= changeFromDraftState(values[key][k][j].editorState).blocks
}else if (childObj[j] instanceof moment) {
if (childObj[j] instanceof moment) {
values[key][k][j] = values[key][k][j].valueOf()
}else if (childObj[j] instanceof Date) {
values[key][k][j] = values[key][k][j].valueOf()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论