Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
Problem/Motivation
It seems like GHS enabled markup is not supported in data-caption and leads to completely crashing CKEditor 5.
Steps to reproduce
- Create Full HTML text format with media embed, media library, source editing and image captioning enabled.
- Embed any media to content using the text format
- Link the embedded media
- Edit
<drupal-media>
in source editing to includedata-caption
with<a>
element with GHS enabled attributes - Return from source editing and confirm that CKEditor crashes
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#14 | 3268311-14.patch | 2.96 KB | lauriii |
#12 | 3268311-12-test-only.patch | 2.31 KB | lauriii |
#11 | 3268311-test-only.patch | 2.31 KB | lauriii |
Comments
Comment #2
lauriiiComment #3
wim leersI think that means this falls under the
drupalMedia
plugin?Comment #4
wim leersAdded to roadmap: #3238333-54: Roadmap to CKEditor 5 stable in Drupal 9.
Comment #5
lauriiiUpdated the testing steps. This could be another side effect of #3268311: [upstream] [drupalMedia] GHS-enabled markup in data-caption crashes CKEditor 5.
Comment #6
lauriiiFound a simple way to reproduce this without
<drupal-media>
. Reported upstream: https://github.com/ckeditor/ckeditor5/issues/11450.Comment #7
wim leersComment #8
wim leersThis has been fixed upstream 6 hours ago: https://github.com/ckeditor/ckeditor5/pull/11488 🚀
Now we are just waiting for a new CKEditor 5 release to update to 🥳
@lauriii: Do we need explicit test coverage on our end? If so, this is unblocked.
Comment #9
wim leersCircling back … it's probably more productive to do both pieces at the same time. Let's wait for this to land upstream.
Comment #10
wim leersThere should be a new CKEditor 5 release tomorrow. That means we should already start writing a test.
Comment #11
lauriiiHere's a try on a failing test 🤞
Comment #12
lauriiiComment #14
lauriiiI'm actually not sure there is a valid way to trigger this with
<drupal-media>
because all of the use cases would require nesting elements in an invalid way. This was simply happening because of #3268318: [drupalMedia] <a> with GHS allowed attributes downcast wraps data-caption with <a> was duplicating the elements first and then as a result causing this issue. All of the other use cases where that could be triggered would be testing exactly what is already being tested upstream.Comment #15
wim leersOh, yay! Removed this from #3238333: Roadmap to CKEditor 5 stable in Drupal 9 :) Glad to see #3274767: Update to CKEditor 5 v34.0.0 fixed this!