Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11747 closed Bug (duplicate)

Javascript error when removing a CKeditor instance (including extra plugins) before its content is fully loaded

Reported by: WIRIS math Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc: t.bussmann@…


The example attached includes the latest CKeditor version, we've tried the latest nightly one with the same results. We've included WIRIS plugin ( In the attached .zip you need to open destroy.php

We've experienced this issue using Chrome. Steps to reproduce it:

1.- Create a page with a button to create and another to destroy a CKeditor instance (destroy.php in the example attached). 2.- Load CKeditor with some content 2.- Open the page and hit alternatively create and remove buttons 3.- Whenever you remove a CKeditor instance before its content is loaded this error shows in Chrome console:

Uncaught TypeError: Cannot read property 'on' of undefined ckeditor.js:322 ckeditor.js:322 ckeditor.js:328
k ckeditor.js:716
(anonymous function) ckeditor.js:24

This doesn't happen if we comment the line where the custom plugin is added in config.js.

config.extraPlugins += (config.extraPlugins.length == 0 ? '' : ',') + 'ckeditor_wiris';

The issue can be reproduced with an empty CKeditor too but the create-remove buttons would need to be clicked faster to trigger the error. The error is in ckeditor.js file, so that's why we believe it's a CKeditor issue.

Attachments (2)

ckeditor_issue.PNG (69.4 KB) - added by WIRIS math 10 years ago.
Screenshot of the issue. (1.4 MB) - added by WIRIS math 10 years ago.
Example to test the issue (running destroy.php)

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by WIRIS math

Attachment: ckeditor_issue.PNG added

Screenshot of the issue.

Changed 10 years ago by WIRIS math

Attachment: added

Example to test the issue (running destroy.php)

comment:1 Changed 10 years ago by Tobias Bussmann

Cc: t.bussmann@… added

comment:2 Changed 10 years ago by Gadi Cohen

Not sure if this is the same issue I'm experiencing, which relates to calling destroy() on an editor setup with the jQuery adaptor (on an instance that *is* fully loaded).

It seems that after calling destroy(), attachListener(undefined, "beforeGetData", fn,$) is being called. The first argument is undefined instead of the expected object, presumably because the editor is in the process of being destroyed. Not quite sure why this only affects instances setup with the jQuery adaptor.

comment:3 Changed 10 years ago by Gadi Cohen

Ok in my case at least (in case this helps anyone), $(el).val(value) was being called just before the destroy. So the promise was returning after the editor was destroyed, hence the error. (It related back to the overridden jQuery val() and how setData() is called).

Last edited 10 years ago by Gadi Cohen (previous) (diff)

comment:4 Changed 10 years ago by Jakub Ś

Resolution: duplicate
Status: newclosed
Version: 4.3.4

@wirismath we can't debug custom plugins behaviour. This is author's plugin job.

Issue you describe however is CKEditor problem and was described here: #11502 (please also see other linked duplicates).

Unfortunately change mentioned in #11502 is not something we can easily do and will most likely be fixed in CKEditor 5. The only workaround I can recommend right now is calling destroy() method after editor is fully loaded (instanceReady event can be used for this case).

comment:5 Changed 10 years ago by WIRIS math

@j.swiderski Thanks for your reply, we will try your suggested workaround and follow the other issue.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy