Problem/Motivation
CKEditor appears to be throwing an error for something that it could be forgiving of. Specifically, if I add a module that adds a tag that has already been added, it throws an error. I believe it could throw an informational message instead and not block adding the module, and just not duplicated the work that has already been done.
That is, if a given tag is added by both a CKEditor 5 toolbar plugin and the Manually Editable HTML Tags field, don't error, only warn. Otherwise, the wording needs to be improved. See also
🐛
Inconsistent use of language regarding plugins
Active
.
Steps to reproduce
1. Go to simplytest.me
2. Choose Drupal core 10.3.2 as the project
3. Expand Advanced
4. Add project CKEditor Accordion 2.1.0
5. Click Create
6. Log in
7. Manage > Configuration > Text Formats and Editors
8. On the row for Basic HTML, click Configure
9. Drag the accordion icon into the Active toolbar
Expected result: Drupal accepts my action. It does not add the duplicate tag. It might throw a warning or notice.
'The following tag(s) are already supported by enabled plugins and will not be re-added to the Source Editing "Manually editable HTML tags" field: accordion (<dl>
).'
Actual result: Drupal gives the error
'The following tag(s) are already supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: accordion (<dl>
).'
I note the instructions under Source Editing read:
A list of HTML tags that can be used while editing source. It is only necessary to add tags that are not already supported by other enabled plugins. For example, if "Bold" is enabled, it is not necessary to add the <strong>
tag, but it may be necessary to add <dl><dt><dd>
in a format that does not have a definition list plugin, but requires definition list markup
Specifically with regard to
It is only necessary
, that implies it is permitted but not necessary to add such tags. However, the current behavior is that it is forbidden to add such tags.
If this issue is not implemented, then that wording would best be changed to (updated Sept. 18, 2024):
This plugin adds a list of HTML tags that can be used while editing source. Remove or do not add tags that are supported by other enabled plugins. For example, if "Bold" is enabled in the toolbar, do not add the <strong>
tag here. If another plugin throws an error because it requires a tag but does not supply it, you will need to add that tag here.
"Remove" is needed because the tag may already be there. In fact, the wording
It may be necessary to add <dl><dt><dd>
is confusing because those tags are already there by default, so why would I need to add them? This probably also needs to be wordsmithed, although I'm not sure how.
Proposed resolution
Don't error on listed tags that are also enabled by plugins.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet