- Issue created by @weseze
- Status changed to Postponed: needs info
12 months ago 8:46am 15 March 2024 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Have you checked the upstream issue queue? Specifically, https://github.com/ckeditor/ckeditor5/issues/14274 and https://github.com/ckeditor/ckeditor5/labels/package%3Astyle?
- Status changed to Postponed
12 months ago 4:34pm 25 March 2024 - 🇺🇸United States bkosborne New Jersey, USA
Here's the upstream issue: https://github.com/ckeditor/ckeditor5/issues/14206
- 🇧🇪Belgium weseze
Thanks for the feedback.
Seems there are indeed upstream issues that are trying to address this:
https://github.com/ckeditor/ckeditor5/issues/14206 (thanks @bkosborne for finding it)
Also https://github.com/ckeditor/ckeditor5/issues/14946 mentions something very similar.
But all of those seem to be focussed on creating very complex logic for allowing multitple selections, remove classes and so on...The only thing we need (and I guess a lot of users migrating from cke4 also need) is a simple toggle config option to disallow selecting multiple styles.
Is something like that available in cke5/drupal?Would really hate to have to build our own plugin for this...
- 🇧🇪Belgium weseze
For anyone looking for a quick-and-dirty fix to this issue.
Do a replacement in "/core/assets/vendor/ckeditor5/html-support/html-support.js":
find:(t,l,i,"classes",(t=>{for(const o of(0,e.toArray)(r))t.add(o)}))
replace with:
(t,l,i,"classes",(t=>{\/*START-CHANGE*\/t.clear();\/*END-CHANGE*\/for(const o of(0,e.toArray)(r))t.add(o)}))
It's a bit of a mess to maintain on updates, but possible with a composer post instal/update script.
This changes the behaviour for the styles dropdown so any style you select will reset any previously applied style (classes) first.