core/modules/ckeditor/js/ckeditor.js | 4 ++++ core/modules/ckeditor/js/plugins/drupalimage/plugin.js | 4 ++-- core/modules/ckeditor/js/plugins/drupallink/plugin.js | 4 ++-- .../lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php | 1 - .../lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php | 1 - .../ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php | 2 ++ core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php | 2 -- core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php | 1 + core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php | 2 ++ core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php | 1 + 10 files changed, 14 insertions(+), 8 deletions(-) diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index 9263cdb..3c950f2 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -7,6 +7,10 @@ Drupal.editors.ckeditor = { attach: function (element, format) { this._loadExternalPlugins(format); this._ACF_HACK_to_support_blacklisted_attributes(element, format); + // Also pass settings that are Drupal-specific. + format.editorSettings.drupal = { + format: format.format + }; return !!CKEDITOR.replace(element, format.editorSettings); }, diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js index 23efdea..36f5492 100644 --- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js @@ -11,7 +11,7 @@ CKEDITOR.plugins.add('drupalimage', { init: function (editor) { // Register the image command. editor.addCommand('image', { - allowedContent: 'img[alt,src,width,height,class,id,lang,longdesc,title]', + allowedContent: 'img[alt,src,width,height]', requiredContent: 'img[alt,src,width,height]', modes: { wysiwyg : 1 }, canUndo: true, @@ -73,7 +73,7 @@ CKEDITOR.plugins.add('drupalimage', { }; // Open the dialog for the edit form. - Drupal.ckeditor.openDialog(editor, editor.config.drupalImage_dialogUrl, existingValues, saveCallback, dialogSettings); + Drupal.ckeditor.openDialog(editor, Drupal.url('editor/dialog/image/' + editor.config.drupal.format), existingValues, saveCallback, dialogSettings); } }); diff --git a/core/modules/ckeditor/js/plugins/drupallink/plugin.js b/core/modules/ckeditor/js/plugins/drupallink/plugin.js index 6d3c543..5f591e7 100644 --- a/core/modules/ckeditor/js/plugins/drupallink/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupallink/plugin.js @@ -11,7 +11,7 @@ CKEDITOR.plugins.add('drupallink', { init: function (editor) { // Add the commands for link and unlink. editor.addCommand('link', { - allowedContent: 'a[!href,target,accesskey,charset,dir,id,lang,name,rel,tabindex,title,type]', + allowedContent: 'a[!href,target]', requiredContent: 'a[href]', modes: { wysiwyg : 1 }, canUndo: true, @@ -84,7 +84,7 @@ CKEDITOR.plugins.add('drupallink', { }; // Open the dialog for the edit form. - Drupal.ckeditor.openDialog(editor, editor.config.drupalLink_dialogUrl, existingValues, saveCallback, dialogSettings); + Drupal.ckeditor.openDialog(editor, Drupal.url('editor/dialog/link/' + editor.config.drupal.format), existingValues, saveCallback, dialogSettings); } }); editor.addCommand('unlink', { diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php index 77d6b75..84c31b2 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php @@ -44,7 +44,6 @@ public function getLibraries(Editor $editor) { */ public function getConfig(Editor $editor) { return array( - 'drupalImage_dialogUrl' => url('editor/dialog/image/' . $editor->format), 'drupalImage_dialogTitleAdd' => t('Insert Image'), 'drupalImage_dialogTitleEdit' => t('Edit Image'), ); diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php index 5e08e32..a60314c 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php @@ -44,7 +44,6 @@ public function getLibraries(Editor $editor) { */ public function getConfig(Editor $editor) { return array( - 'drupalLink_dialogUrl' => url('editor/dialog/link/' . $editor->format), 'drupalLink_dialogTitleAdd' => t('Add Link'), 'drupalLink_dialogTitleEdit' => t('Edit Link'), ); diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php index 9eaa08f..6805c6e 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorLoadingTest.php @@ -100,6 +100,7 @@ function testLoading() { $ckeditor_plugin = drupal_container()->get('plugin.manager.editor')->createInstance('ckeditor'); $editor = entity_load('editor', 'filtered_html'); $expected = array('formats' => array('filtered_html' => array( + 'format' => 'filtered_html', 'editor' => 'ckeditor', 'editorSettings' => $ckeditor_plugin->getJSSettings($editor), ))); @@ -125,6 +126,7 @@ function testLoading() { $this->drupalGet('node/add/article'); list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck(); $expected = array('formats' => array('filtered_html' => array( + 'format' => 'filtered_html', 'editor' => 'ckeditor', 'editorSettings' => $ckeditor_plugin->getJSSettings($editor), ))); diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php index a0fd785..978ba4a 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php @@ -79,10 +79,8 @@ function testGetJSSettings() { // Default toolbar. $expected_config = $this->getDefaultInternalConfig() + array( - 'drupalImage_dialogUrl' => url('editor/dialog/image/filtered_html'), 'drupalImage_dialogTitleAdd' => 'Insert Image', 'drupalImage_dialogTitleEdit' => 'Edit Image', - 'drupalLink_dialogUrl' => url('editor/dialog/link/filtered_html'), 'drupalLink_dialogTitleAdd' => 'Add Link', 'drupalLink_dialogTitleEdit' => 'Edit Link', 'allowedContent' => $this->getDefaultAllowedContentConfig(), diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php index 4014d0c..585b19f 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php @@ -76,6 +76,7 @@ public function getAttachments(array $format_ids) { // JavaScript settings. $settings[$format_id] = array( + 'format' => $format_id, 'editor' => $editor->editor, 'editorSettings' => $plugin->getJSSettings($editor), ); diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php index c0731cc..8de3610 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorLoadingTest.php @@ -93,6 +93,7 @@ function testLoading() { $this->drupalGet('node/add/article'); list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck(); $expected = array('formats' => array('full_html' => array( + 'format' => 'full_html', 'editor' => 'unicorn', 'editorSettings' => array('ponyModeEnabled' => TRUE), ))); @@ -119,6 +120,7 @@ function testLoading() { $this->drupalGet('node/add/article'); list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck(); $expected = array('formats' => array('plain_text' => array( + 'format' => 'plain_text', 'editor' => 'unicorn', 'editorSettings' => array('ponyModeEnabled' => TRUE), ))); diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php index cc8e3c0..729c93b 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php @@ -102,6 +102,7 @@ function testManager() { 'type' => 'setting', 'data' => array('editor' => array('formats' => array( 'full_html' => array( + 'format' => 'full_html', 'editor' => 'unicorn', 'editorSettings' => $unicorn_plugin->getJSSettings($editor), )