diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index 93f50d704..19d819afe 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -229,13 +229,18 @@ export default class TPMMDEditor extends Component { // 创建editorMd let react_id = `react_${_id}`; window[react_id] = this - const answers_editormd = create_editorMD(_id, '100%', this.props.height, _placeholder, imageUrl, (__editorName) => { + const answers_editormd = create_editorMD(_id, '100%', this.props.height, _placeholder, imageUrl, (_editorName) => { + const __editorName = _editorName; react_id = `react_${__editorName.id}`; const that = window[react_id] setTimeout(() => { + if (that.props.needRecreate == true) { + __editorName.recreate() + } else { + __editorName.resize() + } console.log('timeout', __editorName.id) - __editorName.resize() __editorName.cm && __editorName.cm.refresh() }, that.props.refreshTimeout || 500) if (that.props.initValue != undefined && that.props.initValue != '') { @@ -258,7 +263,7 @@ export default class TPMMDEditor extends Component { that.props.onCMBeforeChange(cm,change) }) that.answers_editormd = __editorName; - window[_id] = __editorName; + window[__editorName.id+'_'] = __editorName; }, initValue, this.onEditorChange,this.props.watch, { noStorage: this.props.noStorage, showNullButton: this.props.showNullButton diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js index a037e62dc..99abbfafa 100644 --- a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js @@ -38,7 +38,7 @@ export default class TpmQuestionEdit extends Component { *
+ needRecreate={true} watch={true} className="courseMessageMD" initValue={this.props.neweditanswerRefval}>