diff -Naur wysiwyg-orig/editors/ckeditor.inc wysiwyg/editors/ckeditor.inc --- wysiwyg-orig/editors/ckeditor.inc 2011-05-31 12:49:36.000000000 +0200 +++ wysiwyg/editors/ckeditor.inc 2011-05-31 14:58:51.000000000 +0200 @@ -180,6 +180,14 @@ } } + // Get font styles, supported in ckeditor versions 3.2.1 and above + if (!empty($config['css_classes'])) { + $styles = wysiwyg_ckeditor_get_styles_set($config['css_classes']); + if (!empty($styles)) { + $settings['stylesSet'] = $styles; + } + } + if (isset($config['language'])) { $settings['language'] = $config['language']; } @@ -331,3 +339,26 @@ return $plugins; } +/** + * Return an array for JS of custom Font styles + * note: only checking for correct format of each line, no error logging/hinting, should be done on the settings form + */ +function wysiwyg_ckeditor_get_styles_set($css_classes) { + $css_styles = array(); + $lines = explode("\n", $css_classes); + foreach ($lines as $line) { + if (!empty($line)) { + $l = explode("=", $line); + if (count($l) === 2) { + $lc = explode(".", $l[1]); + if (count($lc) === 2) { + $style['name'] = trim($l[0]); + $style['element'] = trim($lc[0]); + $style['attributes']['class'] = trim($lc[1]); + $css_styles[] = $style; + } + } + } + } + return $css_styles; +} diff -Naur wysiwyg-orig/editors/js/ckeditor-3.0.js wysiwyg/editors/js/ckeditor-3.0.js --- wysiwyg-orig/editors/js/ckeditor-3.0.js 2011-05-31 12:49:36.000000000 +0200 +++ wysiwyg/editors/js/ckeditor-3.0.js 2011-05-31 15:18:27.000000000 +0200 @@ -23,6 +23,10 @@ } } } + // Register Font styles (versions 3.2.1 and above). + if (CKEDITOR.stylesSet && Drupal.settings.wysiwyg.configs.ckeditor[format].stylesSet) { + CKEDITOR.stylesSet.add(format, Drupal.settings.wysiwyg.configs.ckeditor[format].stylesSet); + } } }; @@ -110,9 +114,8 @@ }, selectionChange: function (event) { - var pluginSettings = Drupal.settings.wysiwyg.plugins[params.format]; - if (pluginSettings && pluginSettings.drupal) { - $.each(pluginSettings.drupal, function (name) { + if (Drupal.settings.wysiwyg.plugins[params.format]) { + $.each(Drupal.settings.wysiwyg.plugins[params.format].drupal, function (name) { var plugin = Drupal.wysiwyg.plugins[name]; if ($.isFunction(plugin.isNode)) { var node = event.data.selection.getSelectedElement();