diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index e7014bee0..13b1f61f8 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -3,9 +3,14 @@ import { getUploadActionUrl, getUrl } from 'educoder'; import '../../courses/css/Courses.css' import './css/TPMchallengesnew.css'; +require('codemirror/lib/codemirror.css'); + +let path = '/editormd/lib/' +path = getUrl("/editormd/lib/") const $ = window.$; + // 保存数据 function md_add_data(k, mdu, d) { window.sessionStorage.setItem(k + mdu, d); @@ -36,6 +41,7 @@ function md_elocalStorage(editor, mdu, id) { if (window.sessionStorage) { var oc = window.sessionStorage.getItem('content' + mdu); if (oc !== null && oc != editor.getValue()) { + console.log("#e_tips_" + id) $("#e_tips_" + id).data('editor', editor); var h = '您上次有已保存的数据,是否恢复 ? / 不恢复'; $("#e_tips_" + id).html(h); @@ -55,6 +61,7 @@ function md_elocalStorage(editor, mdu, id) { var textStart = " 数据已于 " var text = textStart + h + ':' + m + ':' + s + " 保存 "; + // 占位符 var oldHtml = $(id2).html(); if (oldHtml && oldHtml != ' ' && oldHtml.startsWith(textStart) == false) { $(id2).html(oldHtml.split(' (')[0] + ` (${text})`); @@ -184,9 +191,16 @@ export default class TPMMDEditor extends Component { initValue: '' } } + componentDidUpdate(prevProps, prevState) { + // 不能加,影响了试卷填空题 + // if (this.props.initValue != prevProps.initValue) { + // this.answers_editormd.setValue(this.props.initValue) + // } + } + // react_mdEditor_ componentDidMount = () => { - const { mdID, initValue, placeholder } = this.props; + const { mdID, initValue, placeholder, showNullButton } = this.props; let _id = `mdEditor_${mdID}` this.contentChanged = false;