autoUpdateElement, для которого установлено значение false, по-прежнему обновляет текстовое поле

Я пытаюсь настроить ckeditor так, чтобы НИЧЕГО не менялось в исходном элементе (текстовое поле), если пользователь явно не внес изменения после загрузки редактора. Я установил для autoUpdateElement значение false, но после запуска события instanceReady текстовое поле уже было изменено.

например: Если у меня есть, а затем загрузить ckeditor, он автоматически изменил элементы на нижний регистр ().

Я знаю, что визуально это не имеет значения, но я пытаюсь настроить его так, чтобы весь исходный контент полностью не менялся.

Пример JSFiddle

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 &nbsp; * This will remove &nbsp; from <p>&nbsp;</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());

    });

person jnoreiga    schedule 11.03.2015    source источник


Ответы (1)


Единственный способ сделать то, что я хотел, - это сохранить исходную информацию самостоятельно (.data("originalvalue")). Я надеюсь, что кто-то все еще может ответить, почему свойство autoupdateelement по-прежнему автоматически обновляет элемент, когда для него установлено значение false.

    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 &nbsp; * This will remove &nbsp; from <p>&nbsp;</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").data("originalvalue", $("#item_ckeditor").val()).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();
            }
            else
                $textarea.val($textarea.data("originalvalue"));

            editor.destroy();
            alert($textarea.val());

        });
person jnoreiga    schedule 11.03.2015