最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin6PV0评论

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 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?

Share Improve this question asked May 15, 2015 at 21:12 Michael_CloudbustingMichael_Cloudbusting 4331 gold badge4 silver badges9 bronze badges 1
  • @user1273587 I cannot reproduce in the latest CKEditor. gist.github./anonymous/b947d1e5444b7eb6d39ade715ebd0a26 – Alexander O'Mara Commented Apr 29, 2016 at 3:37
Add a ment  | 

2 Answers 2

Reset to default 4

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();

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far