我按照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。