Problem/Motivation
Testing the upgrade from CKEditor 4 to 5 on Drupal 9.3 and with Entity Embed, according to the steps on drupal.org/test-cke-4-to-5.
The site was initially build in Drupal 6 or so, and content got migrated and updated over time.
The text formats were probably touched for the last time when the site got migrated from Drupal 7 to 8, and the ticking and sorting of filters were probably done because "they were always set up like that" and "it's not broken so there's no need to change anything".
The site uses three different buttons to embed three different media types into a text field. Users can choose one of several pre-selected display modes, can choose alignment, and add additional captions.
Testing the upgrade path
I encountered three rounds of error messages before I was able to save the text format configuration again.




I fixed them without knowing whether it would break anything, just so that I would be able to save the configuration. A message that specific errors are to be expected, and that changing the configuration is okay, would be useful.
Also, what happens if the configuration pages are not changed and resaved?
Testing existing content
Everything tested still works and looks as expected.
| Comment | File | Size | Author |
|---|---|---|---|
| full_html-format-after.yml | 2.3 KB | ifrik | |
| full_html-format-before.yml | 1.77 KB | ifrik | |
| full_html-editor-after.yml | 1006 bytes | ifrik | |
| full_html-editor-before.yml | 1.56 KB | ifrik | |
| error-message-html-p-tag.png | 32.25 KB | ifrik |
Comments
Comment #2
cilefen commentedChanging the configuration is not necessarily ok depending on how a given site has been using a text format.
Comment #3
wim leersTHANK YOU!!!!! 🙏🥳
Does CKEditor 5 work as expected?
🥳
Does switching to CKEditor 5 in the admin UI work as expected?
Not quite, clearly. 😓
You got 3 error message:
CKEditor 5 only works with HTML-based text formats. The "Convert line breaks to HTML (i.e. <br> and <p>)" (filter_autop) filter implies this text format is not HTML anymore.The Display embedded entities filter needs to be placed after the following filters: Align images, Caption images.CKEditor 5 only works with HTML-based text formats. The "Convert URLs into links" (filter_url) filter implies this text format is not HTML anymore.This is only happening because the text format was actually not correctly configured to use CKEditor 4 😅🙈
filter_autop) and third (filter_url) enabled text filters, but you happened to never run into problems. With CKEditor 5, we're now explicitly validating this, which is why you're being informed of it.entity_embedfilter (second problem) is a validation error that is coming fromentity_embed_filter_format_edit_form_validate(), not CKEditor 5. It's also been configured incorrectly all this time I'm afraid 😅 You're lucky you haven't run into issues!Conclusion
Maybe we should special case text formats that are already using CKEditor 4 and trigger these kinds of fundamental compatibility errors? But still, that could/will cause problems down the line. So it feels wrong to just ignore it. 😬
But really, there isn't any other way to solve this other than … automatically dropping filters that violate the fundamental compatibility. We have to assume that the existing text format's incompatible filters were already not having any effect. Otherwise we cannot generate a compatible CKEditor 5 configuration. Will create a new issue for that.
Comment #4
ifrikComment #5
ifrikAfter f2f conversation during DevDays:
The configuration for text formats was probably not touched since the site was migrated from D7 to D8, so any validation error would not have been noticed by the sitebuilder.
When trying to resave the configuration for the text format, one of the error messages also appears for CKEditor 4:
The Display embedded entities filter needs to be placed after the following filters: Align images, Caption images.The other two errors about URL conversion and about p and br tags does not appear.
Comment #6
wim leersFollowed through on this: #3273312: Upgrading from CKEditor 4 for a text format that has FilterInterface::TYPE_MARKUP_LANGUAGE filters enabled.
Comment #7
wim leersSince I extracted the concrete work out of this (excellent!) report, I'm recategorizing this as a support request!
Comment #8
wim leersComment #9
wim leers#3273312: Upgrading from CKEditor 4 for a text format that has FilterInterface::TYPE_MARKUP_LANGUAGE filters enabled has been fixed, which removes 2 of the 3 messages shown in the screenshots in the issue summary! 👍
The
entity_embedmessage is unrelated to CKEditor 5, that's provided by the https://www.drupal.org/project/entity_embed module.