Closed (duplicate)
Project:
Drupal core
Version:
10.1.x-dev
Component:
ckeditor.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Jan 2023 at 17:49 UTC
Updated:
28 Mar 2023 at 12:41 UTC
Jump to comment: Most recent
Comments
Comment #2
ericras commentedI don't think there is an issue with Drupal. I think this is a limitation with CKEditor5 itself.
In Drupal and on the CKEditor demo page, it works with block level elements ("Block styles") as you would expect. If you set a rule for
blockquote.my-style|My Blockquote Styleit will only be allowed on blockquote elements.However, with "Text styles" it allows them anywhere AND it creates the element where it didn't exist before. On the CKEditor demo https://ckeditor.com/docs/ckeditor5/latest/features/style.html they have a rule
span.spoiler|Spoilerwhich can be added anywhere, not just to existing span elements, and it will create the span tag. It works the same way with an "a" tag rule: it can be created anywhere and the "a" tag will be added. This is unfortunate.Related issue:
https://github.com/ckeditor/ckeditor5/issues/11709
https://www.drupal.org/project/drupal/issues/3222797#comment-14505686
Comment #3
chrissnyderI created ckeditor_link_styles to overcome this limitation of CKEditor's style dropdown. It uses CKEditor 5 Link plugin's decorator config instead.
Comment #4
wim leersThis is a duplicate of #3326261 — see #3326261-14: [Style] Add tests for inability to apply styles to <div>, <ul>, <ol>, <table> etc. in CKEditor 5 — and <a> allows applying it to all elements. I will credit you all on that issue 😊👍