Commit 4ad43795 authored by sun's avatar sun

Fixed JavaScript errors when JS aggregation/compression is enabled.

parent d2322f86
......@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 6.x-x.x, xxxx-xx-xx
---------------------------
by sun: Fixed JavaScript errors when JS aggregation/compression is enabled.
#268562 by sun: Code clean-up; changed format for custom defined CSS classes
and removed error-prone auto-layout of buttons in favor of aligning them in
one row with a stylesheet; may break existing profiles.
......
......@@ -7,6 +7,12 @@
* calling tinyMCE.init() after the page is loaded breaks in IE 6.
*/
Drupal.wysiwygEditorInit = function () {
// If JS compression is enabled, TinyMCE is unable to find its own base path
// and exec mode, hence we need to define it manually.
tinyMCE.baseURL = Drupal.settings.wysiwygEditor.editorBasePath;
tinyMCE.srcMode = (Drupal.settings.wysiwygEditor.execMode == 'src' ? '_src' : '');
tinyMCE.gzipMode = (Drupal.settings.wysiwygEditor.execMode == 'gzip');
for (var theme in Drupal.settings.wysiwygEditor.configs) {
// Clone so we are not passing by reference. Otherwise the
// settings will get overwritten.
......
......@@ -113,15 +113,19 @@ function wysiwyg_editor_load() {
// TinyMCE Compressor >= 1.0.9
if (file_exists($path_editor .'/tiny_mce_gzip.js')) {
drupal_add_js($path_editor .'/tiny_mce_gzip.js', 'module', 'header', FALSE, FALSE, FALSE);
$exec_mode = 'gzip';
}
// TinyMCE Compressor < 1.0.9
elseif (file_exists($path_editor .'/tiny_mce_gzip.php')) {
drupal_add_js($path_editor .'/tiny_mce_gzip.php', 'module', 'header', FALSE, FALSE, FALSE);
$exec_mode = 'gzip';
}
else {
// @todo Turn this into a module setting.
drupal_add_js($path_editor .'/tiny_mce.js', 'module', 'header', FALSE, FALSE);
$exec_mode = '';
// drupal_add_js($path_editor .'/tiny_mce_src.js', 'module', 'header', FALSE, FALSE);
// $exec_mode = 'src';
}
// Add wysiwyg_editor.js to the footer to ensure it's executed after the
// Drupal.settings array has been rendered and populated.
......@@ -133,6 +137,10 @@ function wysiwyg_editor_load() {
'enable' => $enable,
'noWysiwyg' => $no_wysiwyg,
'status' => $status,
// If JS compression is enabled, at least TinyMCE is unable to determine
// its own base path and exec mode since it can't find the script name.
'editorBasePath' => $GLOBALS['base_url'] . base_path() . $path_editor,
'execMode' => $exec_mode,
)), 'setting');
// Add our stylesheet to stack editor buttons into one row.
drupal_add_css($path_wysiwyg .'/wysiwyg_editor.css');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment