From f17dd0c37e7adc980cbda878cc8a82fa4f43e4da Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 3 Dec 2009 03:53:40 +0000 Subject: [PATCH] BUGFIX: Fix default inclusion of (theme|project)/css/editor.css into the WYSWIWYG editor. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@94350 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- _config.php | 2 -- code/LeftAndMain.php | 13 +++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/_config.php b/_config.php index 962298c6..91ed9372 100644 --- a/_config.php +++ b/_config.php @@ -23,7 +23,6 @@ HtmlEditorConfig::get('cms')->setOptions(array( 'priority' => '50', 'mode' => 'none', 'language' => i18n::get_tinymce_lang(), - 'content_css' => 'cms/css/editor.css, '.(SSViewer::current_theme() ? THEMES_DIR . "/" . SSViewer::current_theme() : project()) . "/css/editor.css", 'body_class' => 'typography', 'document_base_url' => Director::absoluteBaseURL(), @@ -41,7 +40,6 @@ HtmlEditorConfig::get('cms')->setOptions(array( 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]" )); - HtmlEditorConfig::get('cms')->enablePlugins('media', 'fullscreen'); HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => '../../../cms/javascript/tinymce_ssbuttons/editor_plugin_src.js')); diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 91f67406..f95d96e8 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -153,6 +153,19 @@ class LeftAndMain extends Controller { // Set the members html editor config HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS()); + + + // Set default values in the config if missing. These things can't be defined in the config + // file because insufficient information exists when that is being processed + $htmlEditorConfig = HtmlEditorConfig::get_active(); + if(!$htmlEditorConfig->getOption('content_css')) { + $cssFiles = 'cms/css/editor.css'; + if(SSViewer::current_theme()) $cssFiles .= ', ' . THEMES_DIR . "/" . SSViewer::current_theme() . '/css/editor.css'; + else if(project()) $cssFiles .= ', ' . project() . '/css/editor.css'; + + $htmlEditorConfig->setOption('content_css', $cssFiles); + } + Requirements::css(CMS_DIR . '/css/typography.css'); Requirements::css(CMS_DIR . '/css/layout.css');