diff -urpN ../editors_old/ckeditor.inc ./ckeditor.inc --- ../editors_old/ckeditor.inc 2010-02-14 01:03:28.000000000 +0100 +++ ./ckeditor.inc 2010-04-19 09:30:52.348360100 +0200 @@ -169,9 +169,21 @@ function wysiwyg_ckeditor_settings($edit else { if ($config['css_setting'] == 'theme') { $settings['contentsCss'] = wysiwyg_get_css(); + + // @todo also parse the css when no classes are defined + if($config['css_classes']) { + $settings['customStylesName'] = "custom_styles"; + $settings['stylesCss'] = _wysiwyg_ckeditor_get_stylesCss($config['css_classes']); + } } elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) { $settings['contentsCss'] = explode(',', strtr($config['css_path'], array('%b' => base_path(), '%t' => path_to_theme()))); + + // @todo also parse the css when no classes are defined + if($config['css_classes']) { + $settings['customStylesName'] = "custom_styles"; + $settings['stylesCss'] = _wysiwyg_ckeditor_get_stylesCss($config['css_classes']); + } } } } @@ -323,3 +335,24 @@ function wysiwyg_ckeditor_plugins($edito return $plugins; } + +/** + * helper function to parse the css + */ + +function _wysiwyg_ckeditor_get_stylesCss($css_classes) { + + $lines = explode("\n", $css_classes); + foreach ($lines as $line) { + $l = explode("=", $line); + $lc = explode(".", $l[1]); + + $style['name'] = $l[0]; + $style['element'] = $lc[0]; + $style['attributes']['class'] = $lc[1]; + + $css_styles[] = $style; + } + + return $css_styles; +} \ No newline at end of file diff -urpN ../editors_old/js/ckeditor-3.0.js ./js/ckeditor-3.0.js --- ../editors_old/js/ckeditor-3.0.js 2009-11-17 16:31:33.000000000 +0100 +++ ./js/ckeditor-3.0.js 2010-04-16 16:43:35.191297500 +0200 @@ -24,7 +24,12 @@ Drupal.wysiwyg.editor.init.ckeditor = fu } } } + // register Font styles + var wysiwygSettings = Drupal.settings.wysiwyg.configs.ckeditor[format]; + CKEDITOR.stylesSet.add(wysiwygSettings.customStylesName, wysiwygSettings.stylesCss); } + // + }; @@ -110,7 +115,10 @@ Drupal.wysiwyg.editor.attach.ckeditor = Drupal.wysiwyg.activeId = ev.editor.name; } }; - + + // Add the Font styles to this instance + if(settings.customStylesName) CKEDITOR.config.stylesCombo_stylesSet = settings.customStylesName; + // Attach editor. CKEDITOR.replace(params.field, settings); };