I am using the 'Panels' module to allow my content frame to be divided into areas. When I activate TinyMCE (and add /admin/panels/* to the list of pages on which it will appear) two editor panes appear for each textarea on the page. The code is showing the Javascript which creates the MCE editor twice below the HTML for the textarea. When I collapse the second editor (there are two 'disable rich-text' links) one of the two panes disappears (although the 'disable rich-text' link is still there, unchanged) and I can then enable/disable the remaining box without the second area reappearing. The actual functionality of the module is not affected but it doesn't look too great at the moment. I have seen one other example of a similar problem (http://drupal.org/node/51990) but the option of disabling TinyMCE for this part of the site is not available to me! I have also seen mention of TinyMCE plugins having this effect but I have added no plugins to the TinyMCE install apart from IMCE (and it still happens when that is removed).
Any clues would be most welcome...
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | tinymce.module-88177_2.patch | 1.05 KB | darren oh |
| #8 | tinymce.module-88177_1.patch | 1.16 KB | darren oh |
| #7 | tinymce.module-88177_0.patch | 1.08 KB | darren oh |
| #5 | tinymce.module-88177.patch | 972 bytes | darren oh |
| MCEissue_grab.png | 63.89 KB | weesquirt |
Comments
Comment #1
geme4472 commentedHello,
I've found the same happens with the comments form of one of my apps. The reason, in that case, is because I use mytheme_comment_form() in my template.php file in order to change some form values. Without testing it out, it looks like tinymce essentially "thinks" that you're invoking another form.
I realize that my comment is theme-related and your issue is module-related, but that's all the information I have.
Comment #2
geme4472 commentedForgot to mention. This bug appeared when I moved from 4.7.2 to 4.7.4.
Comment #3
geme4472 commentedOK, my bad. Nothing to do with my phptemplating... except that in that override function I was using drupal_get_form() (er, something), when I should've been using form_render(). I think my use of the drupal_get_form() was essentially a duplicate effort. I have no idea why I wrote it that way originally!?
Comment #4
graham_king commentedThis is because in 'panels.module' method 'panels_edit_form' it calls 'form.inc' method 'form_builder' twice - once via the last call to 'panels_form_builder', once via 'drupal_get_form'.
In 'form_builder' it calls all the registered methods for the form element type. If it's a 'textarea' that means the 'tinymce.module' method 'tinymce_process_textarea'. That is where the javascript for 'tinyMCE.init' is inserted. As the method is called twice the js goes in twice, and creates two editors.
It seems like either:
1.the panels module shouldn't be doing the first call to 'panels_form_builder'. Commenting out this line fixed the problem for me:
panels_form_builder($form['content'][$area][$id]['configuration']);That method does all sorts of other stuff, so I put it back in.
2. Or the tinymce module shouldn't process an element more than once. This is the fix I chose.
In tinymce.module just before the function declaration for tinymce_process_textarea add:
Then inside the function add:
This fixes it for me. I don't know drupal well enough to recommend either solution as a permanent fix.
Graham
Comment #5
darren ohThis problem is caused by a simple coding error. Moving two lines to the run-once-per-request section of
tinymce_process_textarea()fixes it.Comment #6
darren ohComment #7
darren ohOops. Previous patch allowed editor to be loaded for only one text area. The attached patch keeps track of each text area separately.
Comment #8
darren ohAnd then I restored the original problem by incorrectly setting a static variable. I think this patch sets the static variable correctly.
Comment #9
darren ohComment #10
sunIMHO this looks a bit ugly - why not simply:
Comment #11
darren ohUpdated patch.
Comment #12
sunWe should adhere to Drupal Coding Standards:
Comment #13
darren ohI think it's best for a patch to fix just one issue. TinyMCE as a whole does not comply with Drupal coding standards. That should be a separate issue.
Comment #14
matt@antinomia commentedConfirmed the bug and the fix. This should be committed.
Comment #15
sunTinyMCE module is unmaintained. If this bug still exists in Wysiwyg module, please move this issue to its queue.
Comment #16
pomliane commentedThis version of TinyMCE is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.
This issue has been automagically closed by a script.