判断内容Dirty

This commit is contained in:
life
2017-01-20 15:00:15 +08:00
parent 21f5306f79
commit 2ea0816ef4
4 changed files with 85 additions and 58 deletions

View File

@@ -361,6 +361,12 @@ function setEditorContent(content, isMarkdown, preview, callback) {
_setEditorContent(content, isMarkdown, preview, callback);
// });
}
function setEditorIsDirty(isDirty) {
tinymce.activeEditor.isNotDirty = !isDirty; // isDirty = false
}
function editorIsDirty() {
return !LEA.readOnly && tinymce.activeEditor.isDirty();
}
function _setEditorContent(content, isMarkdown, preview, callback) {
if(!content) {
content = "";
@@ -387,6 +393,8 @@ function _setEditorContent(content, isMarkdown, preview, callback) {
if(typeof tinymce != "undefined" && tinymce.activeEditor) {
var editor = tinymce.activeEditor;
editor.setContent(content);
setEditorIsDirty(false);
// editor.isNotDirty = true; // isDirty = false
callback && callback(); // Note.toggleReadOnly();