Я пытаюсь настроить ckeditor так, чтобы НИЧЕГО не менялось в исходном элементе (текстовое поле), если пользователь явно не внес изменения после загрузки редактора. Я установил для autoUpdateElement значение false, но после запуска события instanceReady текстовое поле уже было изменено.
например: Если у меня есть, а затем загрузить ckeditor, он автоматически изменил элементы на нижний регистр ().
Я знаю, что визуально это не имеет значения, но я пытаюсь настроить его так, чтобы весь исходный контент полностью не менялся.
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR; // don't wrap everything with p tags
CKEDITOR.config.ignoreEmptyParagraph = false; // output an empty value ('') if its content only consists of an empty paragraph.
CKEDITOR.config.allowedContent = true; // turn off advanced content filtering
CKEDITOR.config.fillEmptyBlocks = false; // don't add * This will remove from <p> </p>; set to true and it will ALWAY ADD
CKEDITOR.config.autoUpdateElement = false; // still updating?
CKEDITOR.on('instanceReady', function (event) {
alert($("#item_ckeditor").val());
// normalize has been done and the contents has been made dirty. reset to we can determine user changes
event.editor.resetDirty();
event.editor.execCommand('source');
});
$("#item_ckeditor").ckeditor();
$("#item_docompare").on("click", function (event) {
var $textarea = $("#item_ckeditor"),
editor = $textarea.ckeditorGet();
alert($textarea.val());
if (editor.checkDirty()) // only update the textarea if something was changed
{
alert('updating');
editor.updateElement();
}
editor.destroy();
alert($textarea.val());
});