Problem/Motivation

<drupal-media data-caption="..."> wrapped with <a data-foo> results in <a data-foo><drupal-media data-caption="<a>...</a>"></a> when data-foo support is added by GHS.

Steps to reproduce

  1. Create text format that has media library, media embed, image captioning and source editing enabled.
  2. Add <a data-foo> to the source editing supported elements
  3. Create content using the newly created text format and use media library to embed media
  4. Add caption for the embedded media
  5. Use source editing to wrap the <drupal-media> element with <a href="http://example/llama" data-foo></a>
  6. Go back to editing and see that the caption now has a link
  7. Go back to source editing and confirm that there's a <a> inside the data-caption attribute.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lauriii created an issue. See original summary.

lauriii’s picture

Wim Leers’s picture

Wim Leers’s picture

Title: [drupalMedia|drupalImage] <a> with GHS allowed attributes downcast wraps data-caption with <a> » [upstream] [drupalMedia|drupalImage] <a> with GHS allowed attributes downcast wraps data-caption with <a>
Status: Active » Postponed

@lauriii confirmed it is upstream and provided a failing test: https://github.com/ckeditor/ckeditor5/issues/11447 🚀

lauriii’s picture

lauriii’s picture

Title: [upstream] [drupalMedia|drupalImage] <a> with GHS allowed attributes downcast wraps data-caption with <a> » [drupalMedia|drupalImage] <a> with GHS allowed attributes downcast wraps data-caption with <a>
Status: Postponed » Active
lauriii’s picture

The patch in #5 should still fail. Here are patches with the changes that are needed on our side.

The last submitted patch, 7: 3268318-7-d10.patch, failed testing. View results

The last submitted patch, 7: 3268318-7-d94.patch, failed testing. View results

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

@lauriii linked me to https://ckeditor.com/docs/ckeditor5/latest/api/module_engine_conversion_... which helped me understand this change. And the test coverage looks good. Thanks!

lauriii’s picture

Title: [drupalMedia|drupalImage] <a> with GHS allowed attributes downcast wraps data-caption with <a> » [drupalMedia] <a> with GHS allowed attributes downcast wraps data-caption with <a>
Issue summary: View changes

This issue won't be fixed for drupalImage so retitling and updating the issue summary. This problem for images should be handled in #3247634: [upstream] [drupalImage] Unlinking linked inline images while GHS is enabled: wrapping <a> is impossible to remove.

  • bnjmnm committed c4197f1 on 10.0.x
    Issue #3268318 by lauriii, Wim Leers, tim.plunkett: [drupalMedia] <a>...

  • bnjmnm committed 417d64d on 9.4.x
    Issue #3268318 by lauriii, Wim Leers, tim.plunkett: [drupalMedia] <a>...

  • bnjmnm committed 2aa87a9 on 9.3.x
    Issue #3268318 by lauriii, Wim Leers, tim.plunkett: [drupalMedia] <a>...
bnjmnm’s picture

Version: 9.4.x-dev » 9.3.x-dev
Status: Reviewed & tested by the community » Fixed

Quite a journey to identify the problem and have it addressed with a one line fix (not gonna count the build of course.

Committed to 10.0.x and 9.4.x. Backported since CKEditor5 is experimental and this is a nice bugfix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.