- Issue created by @mingsong
- 🇦🇺Australia mingsong 🇦🇺
After debugging the code, I got my head around this issue.
Basically, when migrating from CKEditor 4 to 5, the Drupal\ckeditor5\SmartDefaultSettings::computeSmartDefaultSettings() will work out what CKEditor5 plugins need to enable according to the allowed html tags.
Since the ckeditor5_style plugin provides the configuration for the class attribute on any tags, the Style plugin will be enable if there is a class attribute of any tags specified in the 'Allow HTML tags' settings. Meanwhile, the class attribute will be removed from the 'Allow HTML tags' settings.
The problem with this approach is that the Style plugin won't provide a default settings that apply to all class, instead, you have specify one or more class name explicitly. See the line 76 in /ckeditor5/src/Plugin/CKEditor5Plugin/Style.php
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/ckedi...
In other words, you can not use a wildcard for the class name.
Also the Source Editing Plugin (ckeditor5_sourceEditing) won't add the class attribute into the 'Manually editable HTML tags' neither since another plugin (Style plugin) is supposed to provide that.
This issue affects Drupal 10.1, 10.2 and 11.