每当我调用 checkDirty() 时,我总是会变得真实。运行下面的示例,然后单击销毁按钮。
$(document).ready(function() {
CKEDITOR.config.autoUpdateElement = false;
CKEDITOR.on('contentDom', function (event) {
event.editor.resetDirty();
});
CKEDITOR.on('instanceReady', function (event) {
event.editor.on('contentDomUnload', function (destroyevent) {
alert('isdirty: ' + destroyevent.editor.checkDirty());
});
});
$("#item_ckeditor").ckeditor();
$("#item_docompare").on("click", function (event) {
var $textarea = $("#item_ckeditor"),
editor = $textarea.ckeditorGet();
editor.destroy();
});
});