needRecreate

dev_forum
hjm 6 years ago
parent 340c4ec12a
commit 4f3161fe68

@ -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(() => {
console.log('timeout', __editorName.id)
if (that.props.needRecreate == true) {
__editorName.recreate()
} else {
__editorName.resize()
}
console.log('timeout', __editorName.id)
__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

@ -38,7 +38,7 @@ export default class TpmQuestionEdit extends Component {
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<TPMMDEditor ref={this.props.neweditanswerRef} placeholder="请输入选择题的题干内容" mdID={'editquestioMDid'} refreshTimeout={1500}
watch={true} className="courseMessageMD" initValue={this.props.neweditanswerRefval}></TPMMDEditor>
needRecreate={true} watch={true} className="courseMessageMD" initValue={this.props.neweditanswerRefval}></TPMMDEditor>
</div>

Loading…
Cancel
Save