Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 290950

[10.2 regression] CKEditor 5 breaks when "Source"/Source editing button is added and "Manually editable HTML tags" are specified

$
0
0

Problem/Motivation

The change in validation introduced in #3396628: Fix <ol start> → native CKEditor 5 functionality and fix bug in SourceEditingRedundantTagsConstraintValidator that allowed it to slip by triggers validation errors for previously valid config when "Source" / Source editing button is added and "Manually editable HTML tags" are specified.

The intent of the validation was that because a plugin supported <ol start> that tests should have failed when trying to manually configure source editing to allow start <ol start> on the basis that the UX for source editing is worse that the UX of a plugin.

There are several use cases where this has caused frustration, a lot related to the fact you can no longer allow the class attribute in source editing as it expects you to use the style plugin.

Several use cases were raised where the old behavior is preferred, such as:

  • Adding classes that are not supported by the style plugin, e.g. classes can not be added to img elements through the style plugin, but should be able to through manual source editing
  • Making classes available through CKEditor templates but not intending them to be selectable via the ckeditor style drop down
  • Frameworks such as bootstrap or tailwind which contain utility classes, which can be used by exerienced editors but are not appropriate to all be selected in the dropdown
  • Support for classes related to legacy styles or content, which need to be retained but not necessarily "promoted" to the styles plugin to be used

Steps to reproduce

1. Install using the Standard installation profile on Drupal 10.2.3
2. Create a new text format, setting the editor to "CKEditor 5" and adding the following toolbar items: Blockquote, Styles, and Source editor.
3. Configure one style for the dropdown, p.fancy|Fancy Paragraph
4. Add the "Limit allowed HTML tags and correct faulty HTML" text format filter.
5. Save the form. Everything should be fine.
6. Edit the text format. Under "Source editing"> "Manually editable tags", add <blockquote class>, indicating that you want content editors to manually add the `class` attribute to the `blockquote` tag, which is allowed on the CKEditor toolbar.
7. Attempt to save the form. A validation check will prevent the form save: The following attribute(s) can optionally be supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: Style (<blockquote class>).

Proposed resolution

Allow source editing to define what can be edited in source regardless of other plugins that might also allow the change.

At the very least, an option to ignore the error and save anyway would be preferable. There are many use cases for arbitrary-but-allowed source editing including migrations and upgrades for existing Drupal installations with these patterns in place since the allowed HTML feature was converted to source editing with the CKEditor 4 to 5 upgrade.

Remaining tasks

TBC

User interface changes

TBC

API changes

TBC

Data model changes

TBC

Release notes snippet

TBC


Viewing all articles
Browse latest Browse all 290950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>