diff --git a/code/CMSMain.php b/code/CMSMain.php index 6242d15f..fe99fd9c 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -110,15 +110,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $spellcheckSpec = array(); foreach($spellcheckLangs as $lang => $title) $spellcheckSpec[] = "{$title}={$lang}"; + // Set custom options for TinyMCE specific to CMSMain HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', '+' . implode(',', $spellcheckSpec)); - - // @todo Do we need this - I'm pretty sure not, since HtmlEditorField#Field() will include it on being called. - // The only time you might need it is if you are creating an textarea.htmlfield yourself, in which case bad things are going to happen now we've moved configuration - // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment - if(!Director::is_ajax()) { - Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); - } - + Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js'); Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js'); Requirements::javascript(CMS_DIR . '/javascript/CMSMain_right.js'); diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index e78a8bcf..cab190ea 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -883,6 +883,9 @@ JS; } public function EditForm() { + // Include JavaScript to ensure HtmlEditorField works. + HtmlEditorField::include_js(); + $record = $this->currentPage(); if(!$record) return false; diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index 0355ee43..5c3b9eeb 100755 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -29,13 +29,9 @@ class ReportAdmin extends LeftAndMain { Requirements::css(CMS_DIR . '/css/ReportAdmin.css'); - // We don't want this showing up in every ajax-response, it should - // always be present in a CMS environment - if(!Director::is_ajax()) { - Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); - HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css'); - HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang()); - } + // Set custom options for TinyMCE specific to ReportAdmin + HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css'); + HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang()); // Always block the HtmlEditorField.js otherwise it will be sent with an ajax request Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js');