Skip to content

Commit

Permalink
Merge pull request #49 from aleevas/DS-724
Browse files Browse the repository at this point in the history
feat: [DS-724] Add color font and background color buttons to the CKEditor 5 panel
  • Loading branch information
podarok authored Jun 1, 2023
2 parents aa827cf + 2d2c47d commit 57c9bf8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
"drupal/core": "^9.5 || ^10",
"drupal/rabbit_hole": "^1.0@beta || ^1.0",
"drupal/ctools": ">=3.13",
"drupal/ckeditor5_font": "^1.1@beta",
"drupal/google_analytics": "^4.0.2"
},
"extra": {
"patches": {
"drupal/ckeditor5_font": {
"Issue #3350333: TypeError: array_filter(): Argument #1 ($array) must be of type array.": "https://www.drupal.org/files/issues/2023-04-21/3350333-5.patch"
}
}
},
"license": "GPL-2.0+",
"minimum-stability": "dev"
}
2 changes: 2 additions & 0 deletions openy_editor/config/install/editor.editor.full_html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ settings:
- underline
- strikethrough
- alignment
- fontColor
- fontBackgroundColor
- outdent
- indent
- heading
Expand Down
1 change: 1 addition & 0 deletions openy_editor/openy_editor.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- colorbutton:colorbutton
- ckeditor_bootstrap_buttons:ckeditor_bootstrap_buttons
- drupal:ckeditor5
- drupal:ckeditor5_font
- drupal:editor
- ckeditor_font:ckeditor_font
- drupal:filter
Expand Down
17 changes: 17 additions & 0 deletions openy_editor/openy_editor.install
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,20 @@ function openy_editor_update_8004() {
$active_config->set('settings.plugins', $active_config->get('settings.plugins'));
$active_config->save(TRUE);
}

/**
* Add the fontColor and the fontBackgroundColor buttons for CKEditor 5.
*/
function openy_editor_update_8005() {
$active_config = \Drupal::configFactory()->getEditable('editor.editor.full_html');
$settings = $active_config->get('settings');
if (empty($settings['toolbar']['rows'])) {
return;
}
// Place these buttons in a specific place.
array_splice($settings['toolbar']['items'], 3, 0, 'fontColor');
array_splice($settings['toolbar']['items'], 4, 0, 'fontBackgroundColor');
$active_config->set('settings', $settings);
$active_config->set('settings.plugins', $active_config->get('settings.plugins'));
$active_config->save(TRUE);
}

0 comments on commit 57c9bf8

Please sign in to comment.