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

Merge remote-tracking branch 'origin/master'

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