How to add a custom color palette for tableCellProperties ?

Created on 29 April 2024, 8 months ago

Problem/Motivation

Hi ! Is there any documentation how to add a custom color palette for table cell properties (border/background color) in Ckeditor 5 (Drupal 10) ?

Thanks

💬 Support request
Status

Active

Version

10.3

Component
CKEditor 5 

Last updated 1 day ago

Created by

🇫🇷France kate.k

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kate.k
  • Hi, using a hook (in a .module file):

    function your_module_ckeditor5_plugin_info_alter(array &$plugin_definitions) {
      if (isset($plugin_definitions['ckeditor5_table'])) {
        $tableDefinition = $plugin_definitions['ckeditor5_table']->toArray();
        $bgColors = [
          '#0a2a3d',
        ];
        $borderColors = ['#eff0f2'];
        $tableDefinition['ckeditor5']['config']['table']['tableProperties'] = [
          'backgroundColors' => $bgColors,
          'borderColors' => $borderColors,
        ];
        $tableDefinition['ckeditor5']['config']['table']['tableCellProperties'] = [
          'backgroundColors' => $bgColors,
          'borderColors' => $borderColors,
        ];
    
        $plugin_definitions['ckeditor5_table'] = new CKEditor5PluginDefinition($tableDefinition);
      }
    }
    
Production build 0.71.5 2024