I just committed a feature to CTools to allow the modal to trigger an event when it is closed, which should allow wysiwyg.module to respond to this and properly detach. The commit is here: http://drupal.org/cvs?commit=439216

A patch for wysiwyg is forthcoming, but I'm not sure if it's right. It works for my tests, but I am concerned that it will detach all wysiwyg editors rather than just the ones that were in the modal, so I'm not sure this is right. Still, I think this should be enough for someone who really understands wysiwyg to fix this up properly.

Patch forthcoming.


merlinofchaos’s picture

Status: Active » Needs review
764 bytes
jcfiala’s picture

I'm having a related problem with Drupal Commons editing panels where we were seeing the error "Error: uncaught exception: [CKEDITOR.editor] The instance "edit-body" already exists."

So far, the patch that merlinofchaos gives here seems to be working for us.

TwoD’s picture

Hmm, yes that makes sense. Without the patch, the editor won't be properly detached when modals etc close, so its instance data will still exist when it's to be recreated later.

I'm just getting back to dealing with Wysiwyg issues and things have been piling up so it'll take a while before I can confirm this patch does the trick, but so far it seems good.

ailgm’s picture

The patch works, to an extent, for us. The basic editor field appears and is usable. But now we're hitting a secondary issue ... the fields in pop-ups (e.g. image or link properties) aren't enterable. These secondary dialogs appear, and buttons like Browse work, but the text fields can't be typed into.

Any ideas?

mradcliffe’s picture

#8 seems unrelated.

I ran into this issue in wysiwyg-7.x-2.x. The patch actually applies fairly cleanly, and works as intended.

I have re-rolled the patch for 6.x-2.x, 7.x-2.x, and 7.x-aloha. This seems like more of a bug report than a feature request.

weri’s picture

The patch from #1 is working.

Kars-T’s picture

Currently I can't review every version but 7.x-2.x in #9 works for me.

Kars-T’s picture

Status: Needs review » Needs work

Well this patch works too good. If I open a ctools modal dialog with a ckeditor in it everything runs fine. But if I close the dialog any ckeditor that was on the page before the dialog is removed as well. I can get it back by clicking "deactivate richtext..." and than "activate richtext..." but this is not a great solution.

Please enhance the patch.

zhangtaihao’s picture

@Kars-T: It's highly likely the issue you're facing is being resolved at #356480: Lazy-load editors.

Kars-T’s picture

I am aware of the issue and we are using the patch. Sadly this doesn't seem to fix the issue. If I open up my own ctools modale ckeditor would crash if I didn't add the patch. I will check this again but my last test did show I need both patches.

zhangtaihao’s picture

Your observation is reflected in my update in #356480-168: Lazy-load editors.

Let's see if we can't RTBC the patches.

arrrgh’s picture

Status: Needs work » Needs review

I've tried the combined patch at #356480-168: Lazy-load editors which includes the patch at #1 in this queue. Seems to address the modal window problem, as well as render WYSIWYG editors in custom pane windows. All seems fine with IPE too.

Link for combined patch: http://drupal.org/files/lazy_wysiwyg-356480-168-with-ctools.patch

Kars-T’s picture

Status: Needs review » Needs work


the latest patch by merlin is in #9. And the statement "// Do we have to test to see if the instance is actually within the context?" is still true. Any editor on the load page will be closed not only the one in the modal popup.

zhangtaihao’s picture

Status: Needs work » Needs review
407 bytes

Technically the logic should've worked, but the CToolsDetachBehaviors handler needs an "event" before "context".

This patch emulates how Drupal would've detached WYSIWYG.

zhangtaihao’s picture

Status: Needs review » Reviewed & tested by the community

Based on #173, #179, & #180 from #356480: Lazy-load editors, marking this as RTBC.

Please change back if anyone disagrees.

Kars-T’s picture

Works like a charm!!! :D


sun’s picture

Component: Miscellaneous » Code
Category: feature » task
Status: Reviewed & tested by the community » Fixed

Thanks for reporting, reviewing, and testing! Committed to 7.x-2.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

TwoD’s picture

I have committed a backport of this patch to 6.x-2.x.