Allow styles to be saved as empty so that other contrib modules can provide styles

Created on 27 July 2023, about 1 year ago
Updated 14 March 2024, 6 months ago

Problem/Motivation

We want to enable the CKEditor5 styles plugin, but it *requires* styles to be input. We provide styles via a module and the editor settings alter hook, so we do not require users to enter styles. This is how it worked in Drupal 9 and I propose it should be allowed to be empty in D10.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

💬 Support request
Status

Fixed

Version

11.0 🔥

Component
CKEditor 5 

Last updated 2 days ago

Created by

🇺🇸United States Dave Reid Nebraska 🇺🇸

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

Comments & Activities

  • Issue created by @Dave Reid
  • Status changed to Postponed: needs info about 1 year ago
  • 🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺

    Interesting question! 😊

    The module that alters in those styles is the one that is responsible for ensuring things are correct, because it means parts of the editor.editor.*.yml config no longer live in that config, but in that module's hook_editor_js_settings_alter().

    Therefore I think you'd want something like:

    /**
     * Implements hook_config_schema_info_alter().
     */
    function MYMODULE_config_schema_info_alter(&$definitions) {
      // This module alters in the styles for the `ckeditor5_style` plugin, so adjust the config schema's validation constraints.
      unset($definitions['ckeditor5.plugin.ckeditor5_style']['mapping']['styles']['constraints']['NotBlank']);
    }
    

    That single line would allow you to do what you want in your custom module on that particular project, but allow Drupal core to ensure a reliable, consistent UX when using CKEditor 5.

    Curious about your thoughts! 😊

  • Status changed to Fixed 6 months ago
  • 🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024