简体   繁体   中英

CKEDITOR destroy() throws Uncaught TypeError: Cannot read property 'checkFeature' of undefined

I am using the following code to destroy an instance of CKEDITOR (version 4.4.7):

var ck = CKEDITOR.inline(iElm[0],options);
ck.on("blur",function() {
    this.destroy(true);
});

The code runs fine, the instance is removed from the DOM, but the following error is reported:

Uncaught TypeError: Cannot read property 'checkFeature' of  undefined
checkAllowed @ ckeditor.js:178
refresh @ ckeditor.js:177
c @ ckeditor.js:920
j @ ckeditor.js:10
CKEDITOR.event.CKEDITOR.event.fire @ ckeditor.js:12
CKEDITOR.editor.CKEDITOR.editor.fire @ ckeditor.js:13
f @ ckeditor.js:215
(anonymous function) @ ckeditor.js:215
(anonymous function) @ ckeditor.js:25

Any idea what I am doing incorrectly?

I found that the following eliminated the error message:

var ck = CKEDITOR.inline(iElm[0],options);
   ck.on("blur",function() {
   var editor=ck.name;
   $timeout(function() {
       CKEDITOR.instances[editor].destroy();
   },0);
});

Well, the editor has just the empty div element that we use to hold the editor. So, is it batter to do:

CKEDITOR.instances.editor.removeAllListeners();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM