Changing an existing embedded media's alignment or alt data attributes does not get saved with CKEditor5

Created on 19 December 2019, about 5 years ago
Updated 5 February 2024, 11 months ago

Steps to reproduce:

  1. Fresh install with Standard install profile, enable the media_library module
  2. Enable the embedded media filter for a text format and add the Media Library button to the CKEditor configuration.
  3. Use layout builder to create a new custom "Basic block" with an embedded media, without making any changes to the media. The default alignment should be "center."
  4. Edit the newly created inline block, edit the embedded media and change the alignment from "Center" to "Right" but do not change anything else. Save the block.

Expected Results

That the textarea field submits with the changed attribute.

<textarea class="js-text-full text-full form-textarea resize-vertical" data-media-embed-host-entity-langcode="en" data-drupal-selector="edit-settings-block-form-body-0-value" data-editor-value-is-changed="false" data-editor-value-original="<drupal-media data-align=&quot;right&quot; data-entity-type=&quot;media&quot; data-entity-uuid=&quot;3ded04c3-64c6-4125-9144-7073c7ecd2a5&quot; data-view-mode=&quot;&quot;></drupal-media>
" id="edit-settings-block-form-body-0-value--RScU9kHtPt0" name="settings[block_form][body][0][value]" rows="9" cols="60" placeholder="" data-editor-active-text-format="full_html" style="visibility: hidden; display: none;" tc-textcontent="true" data-tc-id="0.5266607481983859">&lt;drupal-media data-align="right" data-entity-type="media" data-entity-uuid="3ded04c3-64c6-4125-9144-7073c7ecd2a5" data-view-mode=""&gt;&lt;/drupal-media&gt;
</textarea>

Actual Results

That the textarea field submits with unchanged data attribute.

<textarea class="js-text-full text-full form-textarea resize-vertical" data-media-embed-host-entity-langcode="en" data-drupal-selector="edit-settings-block-form-body-0-value" data-editor-value-is-changed="false" data-editor-value-original="<drupal-media data-align=&quot;center&quot; data-entity-type=&quot;media&quot; data-entity-uuid=&quot;3ded04c3-64c6-4125-9144-7073c7ecd2a5&quot; data-view-mode=&quot;&quot;></drupal-media>
" id="edit-settings-block-form-body-0-value--RScU9kHtPt0" name="settings[block_form][body][0][value]" rows="9" cols="60" placeholder="" data-editor-active-text-format="full_html" style="visibility: hidden; display: none;" tc-textcontent="true" data-tc-id="0.5266607481983859">&lt;drupal-media data-align="center" data-entity-type="media" data-entity-uuid="3ded04c3-64c6-4125-9144-7073c7ecd2a5" data-view-mode=""&gt;&lt;/drupal-media&gt;
</textarea>

Note the data-editor-value-is-changed attribute on the textarea is still false in this case, and the contents of the textarea have not been updated.

I am trying to figure out if this is a layout builder bug, or a general CKEditor-embedded-in-a-modal bug.

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Mediaย  โ†’

Last updated about 18 hours ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States dave reid Nebraska USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • JavaScript

    Affects the content, performance, or handling of Javascript.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024