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