thoughts on why tinyMCE fails to load when launched inside a colorbox lightbox for a 2nd time on the same page

i currently use TinyMCE-Extended inside my tidypics_plus plugin to allow users to comment on pictures from inside a colorbox lightbox. that all works fine, except that when i close the colorbox and open it a second time, i see a fatal error with tinymce and then after that 2nd time, every subsequent opening of the colorbox results in tinyMCE totally failing to load.

tidypics_plus allows the user to change the image being viewed inside the colorbox by clicking a thumbnail for another image and that process reloads the entire content of the colorbox via ajax. when i do that, there is no problem with tinyMCE, so the issue is not that tinyMCE doesn't like being loaded via AJAX. The issue is somehow related to colorbox being opened and closed. I have found pages on stackOverflow that describe similar issues and some said they solved it by adding JS code to manually remove the old tinyMCE instances before instantiating the new ones, however, that has not worked for me yet.

anyone know what the problem is here? (I will open a thread in the tinyMCE support group too).

  • Well, my previous post was not helpful with regards to your current error. I don't get any errors even with these lines still in place (nevertheless it should be safe/better to remove them).

    With regards to your error: version 4.6.0 contained a faulty jquery.tinymce.min.js that resuted in tinymce not getting loaded at all when loaded via jquery. That has been fixed in 4.6.1. I don't see any such errors on version 4.6.1 (neither had those on 4.5.7 and older). Are you sure that you your custom-updated Extended Tinymce version (as you are testing with tinymce 4.6.1 which I haven't made any release for) is working right? I rather suspect that it's not the tinymce editor package causing the error for you (regardless with version used) but something else. (btw.: I've not made a new release of Extended Tinymce with version 4.6.1 so far intentionally as I've noticed some issue with editor width - right border missing - with the tinymce 4.6.1 version that I need to investigate - though likely a problem introduced by tinymce itself).

  • i am testing with tinymce version 4.6.1, yes. i will try out your suggestions for gallicomments.
    to be clear, the bugs occur after:

    1. opening tidypics popup
    2. writing a comment and submitting it
    3. closing the popup
    4. opening another popup
    5. writing text in the tinymce editor
  • Add

            // when a colorbox starts closing
            $(document).bind('cbox_cleanup', function(){
                if (window.tinymce) {

    in the JS code of Tidypics_plus (above or below the existing $(document).bind('cbox_closed'.... code).

  • genius! that fixed it. i put the gallicomments change in there too, it now works well from what i can see. i have another bug to fix with gallicomments where the river comment button stopped working. once i fix that i'll look at making the new code available.

  • i have fixed the other bug with gallicomments now too. awesome stuff.