diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2cd509512b7a2f7a1a2d2913122b134fbe49c4f2..f93776888231826c8e3598000e75d4d7d90a4bbe 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx Wysiwyg 6.x-2.x, xxxx-xx-xx --------------------------- +#610132 by TwoD: Updated CKEditor 3.0.1, stylesheets and version check. #620858 by quicksketch: Fixed focus event not firing for CKeditor. #462146 by TwoD, et al: Added support for CKeditor. #489156 by sun: Removed orphan global 'showToggle' JS setting. diff --git a/editors/ckeditor.inc b/editors/ckeditor.inc index 7d17524cd4d52d9b0ef4f94b22c4213b764c8dbc..a510262ffc77eb010409d96f2aeb5f48332ddb92 100644 --- a/editors/ckeditor.inc +++ b/editors/ckeditor.inc @@ -41,7 +41,7 @@ function wysiwyg_ckeditor_editor() { ), 'proxy plugin settings callback' => 'wysiwyg_ckeditor_proxy_plugin_settings', 'versions' => array( - '3.0.3665' => array( + '3.0.0.3665' => array( 'js files' => array('ckeditor-3.0.js'), ), ), @@ -65,8 +65,11 @@ function wysiwyg_ckeditor_version($editor) { while ($max_lines && $line = fgets($library, 140)) { // version:'CKEditor 3.0 SVN',revision:'3665' // version:'3.0 RC',revision:'3753' + // version:'3.0.1',revision:'4391' if (preg_match('@version:\'(?:CKEditor )?([\d\.]+)(?:.+revision:\'([\d]+))?@', $line, $version)) { fclose($library); + // Version numbers need to have three parts since 3.0.1. + $version[1] = preg_replace('/^(\d+)\.(\d+)$/', '${1}.${2}.0', $version[1]); return $version[1] . '.' . $version[2]; } $max_lines--; @@ -140,12 +143,22 @@ function wysiwyg_ckeditor_settings($editor, $config, $theme) { } if (isset($config['css_setting'])) { - if ($config['css_setting'] == 'theme') { - // CKeditor only supports one CSS file currently. - $settings['contentsCss'] = reset(wysiwyg_get_css()); + // Versions below 3.0.1 could only handle one stylesheet. + if (version_compare($editor['installed version'], '3.0.1.4391', '<')) { + if ($config['css_setting'] == 'theme') { + $settings['contentsCss'] = reset(wysiwyg_get_css()); + } + elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { + $settings['contentsCss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); + } } - elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { - $settings['contentsCss'] = strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme())); + else { + if ($config['css_setting'] == 'theme') { + $settings['contentsCss'] = wysiwyg_get_css(); + } + elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { + $settings['contentsCss'] = explode(',', strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()))); + } } } diff --git a/editors/js/ckeditor-3.0.js b/editors/js/ckeditor-3.0.js index adbae69aaa52c099f1f85106b58363fca069053a..992fa850c8608c2855ba31ba704ff155e7a3ab71 100644 --- a/editors/js/ckeditor-3.0.js +++ b/editors/js/ckeditor-3.0.js @@ -92,12 +92,13 @@ Drupal.wysiwyg.editor.attach.ckeditor = function(context, params, settings) { editor.dataProcessor.toDataFormat = CKEDITOR.tools.override(editor.dataProcessor.toDataFormat, function(originalToDataFormat) { // Convert WYSIWYG mode content to raw data. return function(data, fixForBody) { + data = originalToDataFormat.call(this, data, fixForBody); for (var plugin in Drupal.settings.wysiwyg.plugins[params.format].drupal) { if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') { data = Drupal.wysiwyg.plugins[plugin].detach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], editor.name); } } - return originalToDataFormat.call(this, data, fixForBody); + return data; }; }); }