- Issue created by @dabley
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
The same limitation existed in CKEditor 4: #2642808: [upstream] CKEditor Style for not working because it is an "image" widget → . That's why it was not a blocker for #3222797: Upgrade path from CKEditor 4's StylesCombo to CKEditor 5's Style → .
Note the sibling issue ✨ [PP-1] [upstream] Consider allowing styles for non-HTML5 tags Postponed for CKEditor 5 and ✨ [upstream] Allow CKEditor styles for Postponed for Drupal core's Media module.
It would be helpful if the Styles Plugin could warn users when they attempt to define a style for an tag that this will not be effective.
💯 — this is a great action to take today!
Let's do that here! I'll ask in the upcoming CKEditor 5 meeting later today how we can get a reliable list of elements that the current
Style
plugin actually supports. - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Just discussed with @Reinmar & Witek. Witek indicates that list of tags that are supported by
Style
is actually one of the things their customers are missing in their official docs. So: 2 birds, 1 stone — they'll work on getting us this list soonish so that we can add the necessary validation and ship that to users in9.5.x
and10.0.x
🤓👍 @Wim-Leers, thanks for your input on this. My comment about warning about the use of an unsupported style tag was really just an aside, and not the main point of the issue I raised. (It did occur to me that perhaps I should not create confusion by mentioning this.) Your change to the title rather shifts attention away from my main concern.
Thanks for pointing out the related issues. It is sad to see that despite 7 years of effort, there are no solutions, only partially successful workarounds. Nobody seems to have given much consideration to customising the image widget so as to include a styles dropdown. I wonder if that's because it is just too difficult?
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
@witeksocha from CKSource investigated this: https://github.com/ckeditor/ckeditor5/issues/13763
I think this should be implemented as validation? OTOH, doing so could cause existing configuration to be treated as invalid, even if in the future it will work, but for now it won't, until the upstream bugs are fixed … tricky 🤔
- 🇫🇮Finland lauriii Finland
Could we implement it just as a warning in the UI instead of schema validation that prevents saving?
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Yes, but how?
- A confirmation form if we detect that you added new styles that are known to not work?
- Or simply always a confirmation form if any of the styles are known to not work?
- Or something else? 😅
- Assigned to lauriii
- Status changed to Needs review
about 1 year ago 9:56am 3 October 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
🐛 [Style] Add tests for inability to apply styles to , , , etc. in CKEditor 5 — and allows applying it to all elements Fixed proves that one of the examples in the issue summary now does work:
a.special-offer|Special Offer
. Butimg.feature|Featured Image
indeed does not yet work (upstream issue: https://github.com/ckeditor/ckeditor5/issues/13778), nor doesdrupal-media.features|Features media
( #3117172-34: [upstream] Allow CKEditor styles for→ ). So I think this is still relevant.
@lauriii, what do you think about limiting the scope of this issue to
<img>
and<drupal-media>
for now? And perhaps showing a warning message that links to the relevant upstream issue, asking the site builder to go and vote on those issues 🤓 - 🇺🇸United States smustgrave
Just my 2 cents but I think any warnings that core can do around ckeditor would be extremely useful.
- Issue was unassigned.
- Status changed to Needs work
about 1 year ago 3:38pm 2 November 2023 - 🇫🇮Finland lauriii Finland
The proposal seems fine 👍 We can expand the scope of the warning if we discover other use cases that are not compatible.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Just closed 🐛 CKEditor 5 - styles for Images not picking up Active as a duplicate of this. This is clearly becoming increasingly important!
- @wim-leers opened merge request.
- Status changed to Needs review
about 1 year ago 9:54am 13 November 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Now passing tests 👍
P.S.: please vote on https://github.com/ckeditor/ckeditor5/issues/13778 — that's how they prioritize things: based on demand!
- Status changed to RTBC
about 1 year ago 2:30pm 13 November 2023 - 🇺🇸United States smustgrave
Ran the test-only feature and got
1) Drupal\Tests\ckeditor5\Kernel\ValidatorsTest::test with data set "INVALID: Style plugin configured to add class to plugin-supported tag known to not work with Style … yet" (array(array(array('drupalInsertImage', 'style')), array(array(false), array(array(array('Featured image', '<img class="featured">'), array('Fancy linebreak', '<br class="fancy">'))))), array('Unfortunately, the <code><...lugin.', 'Unfortunately, the <code><...lugin.')) Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 ( - 'settings.plugins.ckeditor5_style.styles.0.element' => 'Unfortunately, the <code><img>
tag is not yet supported by the Style plugin.'
- 'settings.plugins.ckeditor5_style.styles.1.element' => 'Unfortunately, the<br>
tag is not yet supported by the Style plugin.'
-)
+Array &0 ()
Tested manually following the steps in the issue summary and am now seeing the warning message.
Think this will be very helpful for many people
- Status changed to Fixed
about 1 year ago 11:25am 17 November 2023 Automatically closed - issue fixed for 2 weeks with no activity.