TinyMCE Module Fails when Optimizing JavaScript in Drupal 6.x
spiffyd - October 13, 2008 - 21:37
| Project: | TinyMCE WYSIWYG Editor |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | spiffyd |
| Status: | needs review |
Jump to:
Description
When the optimizing feature is selected, TinyMCE does not load properly. Firebug shows thte following 2 errors:
1) "tinyMCE is undefined" and
tinyMCE is undefined
[Break on this error] tinyMCE.init({
2) "u" is undefined whatever this means!
u is undefined
[Break on this error] ;var tinymce={majorVersion:'3',minorVers....js,v 1.2 2007/11/19 10:05:48 goba Exp $

#1
Just the confirm, I ran into the same problem :/
#2
ditto.
FWIW, I tried changing between the minified and the source js files but the problem remains.
Also tried stripping carriage-returns. No joy.
#3
If it's anything like older issues I think it has something to do with the load order. Meaning that Tiny loads in the incorrect order relative to everything else. Haven't looked into it deeper but it's my guess from previous issues i've had in the 5 branch.
#4
Don't have time to throw this into a formal patch but i've been able to get it to be compatible. It's simple...force all drupal_add_js files to be excluded from the aggregation function drupal has :) That way it optimizes everything else and still lets tiny work :)
I don't have time for a formal patch but here's the code you need to change over to. Basically, find every drupal_add_js line and add this to the end ,'module','header',FALSE,TRUE,FALSE . The last FALSE will tell it NOT to be included in the optimization. Also, if you see lines that are inserted with the 'inline' string then don't include 'module'.
if (is_dir($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/plugins/imagemanager/') && user_access('access tinymce imagemanager') ) {
// if tinymce imagemanager is installed
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/plugins/imagemanager/jscripts/mcimagemanager.js','module','header',FALSE,TRUE,FALSE);
}
if (is_dir($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/plugins/filemanager/') && user_access('access tinymce filemanager') ) {
// if tinymce filemanager is installed
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/plugins/filemanager/jscripts/mcfilemanager.js','module','header',FALSE,TRUE,FALSE);
}
// TinyMCE Compressor 1.0.9 and greater
if (file_exists($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js')) {
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js','module','header',FALSE,TRUE,FALSE);
drupal_add_js($tinymce_gz_invoke, 'inline','header',FALSE,TRUE,FALSE);
}
// TinyMCE Compressor (versions < 1.0.9)
elseif (file_exists($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php')) {
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php','module','header',FALSE,TRUE,FALSE);
}
else {
// For some crazy reason IE will only load this JS file if the absolute reference is given to it.
drupal_add_js($tinymce_mod_path .'/tinymce/jscripts/tiny_mce/tiny_mce.js','module','header',FALSE,TRUE,FALSE);
}
drupal_add_js($js_toggle, 'inline','header',FALSE,TRUE,FALSE);
// We have to do this becuase of some unfocused CSS in certain themes. See http://drupal.org/node/18879 for details
drupal_set_html_head('.mceEditor img { display: inline; }');
}
// Load a TinyMCE init for each textarea.
if ($init) drupal_add_js($tinymce_invoke, 'inline','header',FALSE,TRUE,FALSE);
#5
It'll be great if someone can roll this into a patch - I actually never done patches before but I'll try to roll out a tarball some time early January after all this holiday huzzah~... Happy Holidays everyone!
#6
i have the same problem, but i can not find the above strings in the source code. perhaps i use the latest wysiwyg (new api)
@spiffyd what do you mean with: "When the optimizing feature is selected"?
Where can i enable/disalbe this
#7
It's under admin/settings/performance in Drupal 6. There's a setting to Compress CSS and another to Compress JavaScript. If you turn off the compress JavaScript part then this module works just fine. If you want it turned on (huge performance savings) then modify the code I wrote above.
#8
I have this problem and #4 solves it for me.
#9
Same problem but #4 didn´t solve it.