diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js index 9e6a8e6..330c600 100644 --- a/core/modules/ckeditor/js/ckeditor.admin.js +++ b/core/modules/ckeditor/js/ckeditor.admin.js @@ -362,7 +362,7 @@ Drupal.behaviors.ckeditorAdmin = { } if ($ckeditorToolbar.length) { - var $textareaWrapper = $ckeditorToolbar.find('.form-item-editor-settings-toolbar-buttons').hide(); + var $textareaWrapper = $ckeditorToolbar.find('.form-item-editor-settings-toolbar-button-groups').hide(); var $textarea = $textareaWrapper.find('textarea'); var $toolbarAdmin = $(drupalSettings.ckeditor.toolbarAdmin); var sortableSettings = { diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index ee0a21f..1945536 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -148,10 +148,11 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit ), '#attributes' => array('class' => array('ckeditor-toolbar-configuration')), ); - $form['toolbar']['buttons'] = array( + + $form['toolbar']['button_groups'] = array( '#type' => 'textarea', '#title' => t('Toolbar buttons'), - '#default_value' => json_encode($editor->settings['toolbar']), + '#default_value' => json_encode($editor->settings['toolbar']['rows']), '#attributes' => array('class' => array('ckeditor-toolbar-textarea')), ); @@ -225,7 +226,10 @@ public function settingsFormSubmit(array $form, array &$form_state) { // editor_form_filter_admin_format_submit(). $toolbar_settings = &$form_state['values']['editor']['settings']['toolbar']; - $toolbar_settings = json_decode($toolbar_settings['buttons'], FALSE); + // The rows key is not built into the form structure, so decode the button + // groups data into this new key and remove the button_groups key. + $toolbar_settings['rows'] = json_decode($toolbar_settings['button_groups'], FALSE); + unset($toolbar_settings['button_groups']); // Remove the plugin settings' vertical tabs state; no need to save that. if (isset($form_state['values']['editor']['settings']['plugins'])) { diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php index 22e9311..b375d03 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorAdminTest.php @@ -115,7 +115,7 @@ function testAdmin() { // Ensure the toolbar buttons configuration value is initialized to the // expected default value. $expected_buttons_value = json_encode($expected_default_settings['toolbar']['rows']); - $this->assertFieldByName('editor[settings][toolbar][rows]', $expected_buttons_value); + $this->assertFieldByName('editor[settings][toolbar][button_groups]', $expected_buttons_value); // Ensure the styles textarea exists and is initialized empty. $styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]'); @@ -147,12 +147,13 @@ function testAdmin() { // done via drag and drop, but here we can only emulate the end result of // that interaction). Test multiple toolbar rows and a divider within a row. $this->drupalGet('admin/config/content/formats/manage/filtered_html'); - $expected_settings['toolbar']['rows'][0][0] = array( - array('Undo', '|', 'Redo'), - array('JustifyCenter'), + $expected_settings['toolbar']['rows'][0][] = array( + 'name' => 'Action history', + 'items' => array('Undo', '|', 'Redo'), + array('JustifyCenter') ); $edit = array( - 'editor[settings][toolbar][rows]' => json_encode($expected_settings['toolbar']['rows']), + 'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']), ); $this->drupalPost(NULL, $edit, t('Save configuration')); $editor = entity_load('editor', 'filtered_html'); diff --git a/core/profiles/standard/config/editor.editor.basic_html.yml b/core/profiles/standard/config/editor.editor.basic_html.yml index 89f42b5..e321d30 100644 --- a/core/profiles/standard/config/editor.editor.basic_html.yml +++ b/core/profiles/standard/config/editor.editor.basic_html.yml @@ -2,7 +2,7 @@ format: basic_html editor: ckeditor settings: toolbar: - buttons: + rows: - - name: Formatting