Skip to content

Commit

Permalink
Merge pull request #89 from aleevas/DS-1605
Browse files Browse the repository at this point in the history
feat: [DS-1605] - Add styles for table
  • Loading branch information
podarok authored Sep 30, 2024
2 parents d15a6a9 + e464d08 commit ca52b62
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"open-y-subprojects/openy_demo_content": "^2.0",
"open-y-subprojects/openy_node_alert": "^2.3.1",
"ycloudyusa/yusaopeny": "*",
"ycloudyusa/y_lb": ">=3.8.2",
"ynorth-projects/openy_node_session": "^2.0"
},
"extra": {
Expand Down
36 changes: 36 additions & 0 deletions openy_editor/config/install/editor.editor.full_html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,42 @@ settings:
-
label: Highlighted
element: '<span class="highlighted">'
-
label: 'Plain Table'
element: '<table class="table">'
-
label: 'Dark Plain Table'
element: '<table class="table table-dark">'
-
label: 'Striped Table'
element: '<table class="table table-striped">'
-
label: 'Dark Striped Table'
element: '<table class="table table-striped table-dark">'
-
label: 'Bordered Table'
element: '<table class="table table-bordered">'
-
label: 'Dark Bordered Table'
element: '<table class="table table-bordered table-dark">'
-
label: 'Borderless Table'
element: '<table class="table table-borderless">'
-
label: 'Dark Borderless Table'
element: '<table class="table table-borderless table-dark">'
-
label: 'Hover Table'
element: '<table class="table table-hover">'
-
label: 'Dark Hover Table'
element: '<table class="table table-hover table-dark">'
-
label: 'Small Table'
element: '<table class="table table-sm">'
-
label: 'Dark Small Table'
element: '<table class="table table-sm table-dark">'
ckeditor5_sourceEditing:
allowed_tags: { }
ckeditor5_list:
Expand Down
73 changes: 73 additions & 0 deletions openy_editor/openy_editor.install
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,76 @@ function openy_editor_update_91002() {
$active_config->set('settings', $settings);
$active_config->save(TRUE);
}

/**
* Update editor settings to add styles for table.
*/
function openy_editor_update_91003() {
$active_config = \Drupal::configFactory()->getEditable('editor.editor.full_html');
$settings = $active_config->get('settings');
if (empty($settings['toolbar']['items'])) {
return;
}

// Add the "Highlighted" style.
$default_plugin_settings = [
'styles' => [
[
'label' => 'Highlighted',
'element' => '<span class="highlighted">',
],
[
'label' => 'Plain Table',
'element' => '<table class="table">',
],
[
'label' => 'Dark Plain Table',
'element' => '<table class="table table-dark">',
],
[
'label' => 'Dark Striped Table',
'element' => '<table class="table table-striped">',
],
[
'label' => 'Dark Striped Table',
'element' => '<table class="table table-striped table-dark">',
],
[
'label' => 'Bordered Table',
'element' => '<table class="table table-bordered">',
],
[
'label' => 'Dark Bordered Table',
'element' => '<table class="table table-bordered table-dark">',
],
[
'label' => 'Borderless Table',
'element' => '<table class="table table-borderless">',
],
[
'label' => 'Dark Borderless Table',
'element' => '<table class="table table-borderless table-dark">',
],
[
'label' => 'Hover Table',
'element' => '<table class="table table-hover">',
],
[
'label' => 'Dark Hover Table',
'element' => '<table class="table table-hover table-dark">',
],
[
'label' => 'Small Table',
'element' => '<table class="table table-sm">',
],
[
'label' => 'Dark Small Table',
'element' => '<table class="table table-sm table-dark">',
],
],
];

$settings['plugins']['ckeditor5_style'] = $default_plugin_settings;
$active_config->set('settings', $settings);
$active_config->save(TRUE);
}

0 comments on commit ca52b62

Please sign in to comment.