How to add a custom color palette for tableCellProperties ?

Created on 29 April 2024, about 1 year 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 about 9 hours 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);
      }
    }
    
  • Status changed to Closed: works as designed 5 months ago
  • 🇳🇿New Zealand quietone

    @davisa, thanks for responding.

    Since this has been answered, I am closing the issue.

Production build 0.71.5 2024