Problem/Motivation
https://git.drupalcode.org/project/drupal/-/blob/9.4.x/core/modules/cked... triggers violation in the case where a plugin with supported elements superset is available. This could be incorrect in some cases. For example, a CKEditor 5 plugin could only convert <div> with data-foo attribute just by using the CKEditor 5 built in elementToElement conversion helper. The Drupal plugin would have to indicate this as <div data-foo>. The SourceEditingRedundantTagsConstraintValidator would then prevent the user from adding <div> to the source editing editable tags because it thinks that the plugin handling <div data-foo> would be able to handle <div>, even though the plugin would only be able to handle <div> with data-foo attribute.
We also have a pre-existing example of this in core; the codeBlock plugin. It is configured to support <pre> and <code class="language-*">, while it only supports <pre> elements that also contain a <code> element. We work around this by adding support for <pre> using GHS. This might be fine for core, but I assume we don't want all of the custom plugins have to consider all the subsets.
Comments
Comment #2
wim leers#3260857: Expand SourceEditingRedundantTagsConstraintValidator to also check attributes and attribute values introduced that code.
Comment #3
wim leersRelated: #3273983: Do not assume that plugin supporting <tag attr> also supports <tag> in SourceEditingRedundantTags and upgrade path. I've been meaning to get to that one ever since DDD Ghent ended. Just finally updated it with the conclusion @ifrik and I reached.
Please see #3273983-4: Do not assume that plugin supporting <tag attr> also supports <tag> in SourceEditingRedundantTags and upgrade path.
I believe that once that issue is addressed, this becomes a minor issue. I do think that it is the exception, not the rule, that a CKEditor 5 plugin claiming to support
<tag A B>only supports adding attributesAandBwithout supporting<tag>.Comment #4
wim leersPer #3273983-8: Do not assume that plugin supporting <tag attr> also supports <tag> in SourceEditingRedundantTags and upgrade path, untagging this and tagging that other one instead.
Keeping this around to be re-assessed after the other is done.
Comment #6
wim leers#3273983: Do not assume that plugin supporting <tag attr> also supports <tag> in SourceEditingRedundantTags and upgrade path landed ~2 months ago.
Comment #7
wim leersAnd this was indeed also explicitly solved in #3273983: Do not assume that plugin supporting <tag attr> also supports <tag> in SourceEditingRedundantTags and upgrade path, so closing this! 🥳