Steps to reproduce:
- Open configuration page for some text format, i.e. Full HTML
- Drag and drop Style button to active toolbar
- Select Style tab under CKEditor5 plugin settings
- Put samle value "h1.title|Title" from the textarea description
- Sumbit the form
The following error message appears.
Enable at least one style, otherwise disable the Style plugin.
Furthermore, the Style tab disappears from the "CKEditor5 plugin settings" widget.

| Comment | File | Size | Author |
|---|---|---|---|
| #15 | drupal-3309585-15.patch | 923 bytes | mingsong |
| #2 | Screen Shot 2022-09-14 at 10.08.59 AM.png | 574.32 KB | wim leers |
Issue fork drupal-3309585
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
wim leersI cannot reproduce this. 😔
Are you sure that step 4 () should be in the steps to reproduce?
If I skip that one step, I see this:
→ the validation error you mentioned, but the Style tab still is present.
Comment #3
wim leersComment #4
drupgirl commentedTry deselecting "Limit allowed HTML tags and correct faulty HTML" and then adding the styles.
Comment #5
wim leersAfter trying several more times, I was now able to reproduce this.
The root cause is that the JS
changeevent does not get triggered for the<textarea>that contains the Style configuration if you immediately click the button. If you click anywhere else in the UI, it works fine.I'd swear we have test coverage for pretty much exactly this 😬
Comment #7
wim leersThanks @bnjmnm for pointing out in chat that we did in fact work on this ~6 months ago: #3265626: Changes to "Manually editable HTML tags" lost if form is submitted without triggering AJAX.
We even have explicit tests for it.
But … it looks like we may need to generalize that solution to a generic one — that solved it specifically for
SourceEditing.I think that we should just add an event handler to the button that forces the event to be triggered if something did just change, and if so, disable that button, wait for the AJAX response, and then retrigger the button. 🙈
Comment #9
mingsongI came across this issue too.
The work around suggested in #5 did not work in my case. Even I click anywhere else in the UI before clicking the save button, it still did not work.
The reason is that I have a contribute module called 'Events Log Track' installed which adds a submit handler function to every single form including the format config form. This causes following code at line 686 in Drupal\ckeditor5\Plugin\Editor::CKEditor5 failed to recognise it is a special AJAX updates.
If I change that line to:
then it works.
Comment #10
mingsongComment #12
mingsongComment #13
wim leersThat seems like a reasonable change!
Thanks for tracking that down 😊👏
Comment #14
mingsongThe patch from the MR. In case anyone need it to test with your site.
Comment #15
mingsongSorry the #14 patch is failed to apply to 10.0.x branch.
Here is the new patch.
Comment #16
mingsongComment #21
lauriiiCommitted fc024f3 and pushed to 11.x. Thanks! Cherry-picked all the way to 9.5.x since this is a non-disruptive bug fix.
Comment #23
Augusto182 commentedHello. I'm reopening this issue because I'm facing a issue that seems related.
Core: 10.1.2 (also in 10.0.9 )
Steps to reproduce:
1. Open configuration page for some text format, i.e. Full HTML
2. Drag and drop Style button to active toolbar
Expected result:
- Show up a "Select Style tab" under CKEditor5 plugin settings, to be able to edit such styles.
Current result:
Nothing happen. "Select Style tab" missing.
Also, if configuration is summited, show up this error: "Enable at least one style, otherwise disable the Style plugin. "
Not sure if this could be addressed here, or a new issue should be created.
Comment #24
mably commentedFacing same problem on Drupal 10.2.1. Any solution?
EDIT: as specified in a previous comment, you just need to disable the "Limit allowed HTML tags and correct incorrect HTML" setting. You can re-enable it after defining your styles.
Comment #25
dehacker commentedSame as #24 in 10.2, but I had to disable all filters in order to add styles.
Comment #26
drupaldope commentedSame problem in 10.2.5
Re-opening this.
Comment #27
drupaldope commentedComment #28
juc1 commentedI am having the same problem in 11.1 😒
Disabling other filters does not help.
Comment #29
markwittens commentedI just had this issue in 11.1.3, it seems to be related to the "Heading" dropdown.
The workaround that worked for me was to place the Style dropdown behind the Heading dropdown in the toolbar, and then save it. Once saved successfully it can be moved wherever without further issues.
Comment #30
bnjmnmI noticed there is activity from several people on this issue after a fix was committed and the issue closed.
If anyone above are hoping their comments result in additional changes to Drupal core, the chances of that happening are infinitely higher if it's reported in a new issue.
It is very rare that an issue is truly "reopened", and in those rare instances it's pretty much always within a few days of it being closed.
Comment #31
tripodcreative commentedThis error is still persisting. No matter what you place in the "Styles" option, saving it both hides the styles entry element and an error message appears "Enable at least one style, otherwise disable the Style plugin."
As it exists, there is no way to make styles work with CKEditor5. On Drupal 11.2