Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
1. Open a panel in admin mode
2. Open "Add content" dialog on a pane
3. Select "New custom content". Window with CKEditor loaded appears:
4. Close the window using either "Close window" control or by pressing "Cancel" button.
5. Repeat adding custom content. Now the window lacks CKEditor:
and error message appears in js console:
I use jQuery 1.8 provided by latest jQuery Update dev
Comment | File | Size | Author |
---|---|---|---|
#6 | ckeditor-1967990-ctools-modal-6.patch | 614 bytes | jcisio |
#5 | ckeditor-1967990-ctools-modal.patch | 1012 bytes | jcisio |
#4 | ckeditor-1967990-4.patch | 1.15 KB | OnkelTem |
Screenshot from 2013-04-11 21:27:29.png | 2.22 KB | OnkelTem | |
Screenshot from 2013-04-11 21:26:50.png | 32 KB | OnkelTem |
Comments
Comment #1
OnkelTem CreditAttribution: OnkelTem commentedAfter digging in CKEditor 3.6.6.1 sources I found location where this error is triggered:
$ variable has iframe object. But $.contentWindow is NULL. I have no idea why this happens.
Comment #2
jcisio CreditAttribution: jcisio commentedComment #3
OnkelTem CreditAttribution: OnkelTem commentedI found the reason. Making a patch atm.
Comment #4
OnkelTem CreditAttribution: OnkelTem commentedThis patch adds reaction on the 'CToolsDetachBehaviors' which is triggered when you close Ctools modal form (where Custom content appears). It finds and kills appropriate CKEdtior instance and now it can be relaunched correctly many times.
But this event triggered only when you close modal form using "Close Window" control button (in the upper right corner of the window). When you press "Cancel" button, this even isn't triggered and instead — standard Drupal detach behavior hook is called which doesn't kill the instance when "trigger" parameter equals to "serialize" (which is the case when you click "Cancel" button).
As far as I understand the correct behavior would be to kill CKEditor instance if Cancel is pressed. But I haven't find the way to get the information whether a form was submitted using "Save" or "Cancel" button — it just not available in a detach handler (even if having form object in context parameter). So this vulgar patch most likely is wrong:
Comment #5
jcisio CreditAttribution: jcisio commentedI think the attached patch is a proper fix.
Comment #6
jcisio CreditAttribution: jcisio commented$().trigger is blocking, so this one remote the unnecessary part.
Comment #7
OnkelTem CreditAttribution: OnkelTem commented#5 doesn't work for me.
1) Add custom content
2) Close using Cancel
3) Add again —> no CKEditor loaded.
UPDATED. #6 won't work either.
Comment #8
jcisio CreditAttribution: jcisio commentedDid you clear cache?
Comment #9
OnkelTem CreditAttribution: OnkelTem commentedYes, I did.
Comment #10
jcisio CreditAttribution: jcisio commentedAny error? Could it be reproduced with a vanilla Drupal + CKEditor + Panels install?
I tested #6 and had different confirmations that it worked, but custom content pane edition, and with custom CTools modal. So I think you have another problem.
Comment #11
OnkelTem CreditAttribution: OnkelTem commentedI have no clean setup, as and I'm on Drupal + CKEditor + Panels git verions.
I believe the reason why #6 doesn't work — it doesn't resolve the issue "trigger = serialize" as I described in #4.
Comment #12
jcisio CreditAttribution: jcisio commentedIt's difficult to debug if we don't have your specific environment. I think I'll commit #6 BTW. The "serialize" event is not a problem, CKEditor is removed on the "unload" event.
Comment #13
OnkelTem CreditAttribution: OnkelTem commentedHow comes its not a problem if CKeditor gets detach with trigger = serialize and not removing its instance? It is not unloaded. Or what is unload event?
Have you tried adding custom content, canceling it, then adding again without closing Add content dialog?
Comment #14
jcisio CreditAttribution: jcisio commentedAh ok. I only closed the modal then open it again, and it worked. I didn't try the Cancel button. I think it is a bug in CTools Page Manager not to fire an appropriate event. We can't remove the editor in the "serialize" event, to avoid reinitialisation of another editor. Try to file an issue in CTools queue. Because in fact, when you press Cancel, even the modal is not closed, its content is replaced with a different one via an AJAX request, so it should fire an event.
In wysiwyg module, the same thing happens http://drupalcode.org/project/wysiwyg.git/blob/refs/heads/7.x-2.x:/wysiw.... I'm marking this issue as fixed then (patch #6, which is a simplified version of your patch #4, has been committed as it fixes the Close button).
Comment #15.0
(not verified) CreditAttribution: commentedUpdated issue summary.