CKEditor SetData回调不会触发?

时间:2016-05-29 19:40:07

标签: jquery ckeditor ckeditor4.x

我按照CKE documentation调用CKEditor函数SetData,但回调没有被触发。

HTML

<p><textarea id="CKEditorTextArea">original editor data</textarea>
</p>

JS

function tempCallBack(){
  alert('test');
  CKEDITOR.instances.CKEditorTextArea.setData( '<p>Callback was fired.</p>');
}

$(document).ready(function ()
{   
    CKEDITOR.replace('CKEditorTextArea');

    CKEDITOR.instances.CKEditorTextArea.setData( '<p>This data is placed into the editor, but the callback doesn\'t fire.</p>', {
            callback: function() {
                tempCallBack();
                this.checkDirty(); // true
            }
        } );
});

这不奇怪吗?不应该回拨火吗?

证明此异常的CodePen为here

0 个答案:

没有答案