.../Drupal/ckeditor/Plugin/ckeditor/plugin/StylesCombo.php | 10 ++-------- .../lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php | 6 ++++++ .../ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php | 9 +-------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/ckeditor/plugin/StylesCombo.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/ckeditor/plugin/StylesCombo.php index 09bafc0..a787676 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/ckeditor/plugin/StylesCombo.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/ckeditor/plugin/StylesCombo.php @@ -45,14 +45,8 @@ public function getFile() { */ public function getConfig(Editor $editor) { $config = array(); - - // Next, add the stylesSet setting, if its button is enabled. - $toolbar_buttons = array_unique(NestedArray::mergeDeepArray($editor->settings['toolbar']['buttons'])); - if (in_array('Styles', $toolbar_buttons)) { - $styles = $editor->settings['plugins']['stylescombo']['styles']; - $config['stylesSet'] = $this->generateStylesSetSetting($styles); - } - + $styles = $editor->settings['plugins']['stylescombo']['styles']; + $config['stylesSet'] = $this->generateStylesSetSetting($styles); return $config; } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php index b62429f..57b857d 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php @@ -125,6 +125,12 @@ public function getJSSettings(Editor $editor) { 'contentsCss' => $this->buildContentsCssJSSetting($editor), 'extraPlugins' => implode(',', array_keys($external_plugins)), 'language' => $language_interface->langcode, + // Configure CKEditor to not load styles.js. The StylesCombo plugin will + // set stylesSet according to the user's settings, if the "Styles" button + // is enabled. We cannot get rid of this until CKEditor will stop loading + // styles.js by default. + // See http://dev.ckeditor.com/ticket/9992#comment:9. + 'stylesSet' => FALSE, ); // Finally, set Drupal-specific CKEditor settings. diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php index fbfb93b..db4dbec 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php @@ -80,6 +80,7 @@ function testGetJSSettings() { 'contentsCss' => $this->getDefaultContentsCssConfig(), 'extraPlugins' => '', 'language' => 'en', + 'stylesSet' => FALSE, 'drupalExternalPlugins' => array(), ); $this->assertIdentical($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for default configuration.'); @@ -181,10 +182,6 @@ function testStylesComboGetConfig() { $manager = drupal_container()->get('plugin.manager.ckeditor.plugin'); $stylescombo_plugin = $manager->createInstance('stylescombo'); - // Default toolbar. - $expected = $this->getDefaultStylesComboConfig(); - $this->assertIdentical($expected, $stylescombo_plugin->getConfig($editor), '"StylesCombo" plugin configuration built correctly for default toolbar.'); - // Styles dropdown/button enabled: new setting should be present. $editor->settings['toolbar']['buttons'][0][] = 'Styles'; $editor->settings['plugins']['stylescombo']['styles'] = ''; @@ -233,10 +230,6 @@ protected function getDefaultInternalConfig() { ); } - protected function getDefaultStylesComboConfig() { - return array(); - } - protected function getDefaultToolbarConfig() { return array( 0 => array('items' => array('Bold', 'Italic')),