#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@… |
Description
The example attached includes the latest CKeditor version, we've tried the latest nightly one with the same results. We've included WIRIS plugin (http://www.wiris.com/plugins/docs/ckeditor). 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.editable.CKEDITOR.tools.createClass.proto.attachListener ckeditor.js:322 CKEDITOR.editable.CKEDITOR.tools.createClass.proto.setup 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)
Change History (7)
Changed 11 years ago by
Attachment: | ckeditor_issue.PNG added |
---|
Changed 11 years ago by
Attachment: | ckeditor_issue.zip added |
---|
Example to test the issue (running destroy.php)
comment:1 Changed 11 years ago by
Cc: | t.bussmann@… added |
---|
comment:2 Changed 11 years ago by
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, CKEDITOR.tools.createClass.$)
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 11 years ago by
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.
comment:4 Changed 11 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
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 11 years ago by
@j.swiderski Thanks for your reply, we will try your suggested workaround and follow the other issue.
Screenshot of the issue.