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

Disappearing edit button and caption on media embed when using dialog

$
0
0

Problem/Motivation

When drupal-media is embedded with data-caption="", opening the dialog and changing the alignment causes the edit button to disappear.

<drupal-media data-align="right" data-caption="" data-entity-type="media" data-entity-uuid="5cc07365-5fde-47a5-83b7-3302da0f0f2b" data-view-mode="wee"></drupal-media>

Video:
https://www.drupal.org/files/issues/2019-09-18/disappearing-edit-button.mov

The problem is that the code for the edit button blows up if the caption isn't properly initialized, due to this code:

          // Find the actual embedded media in the DOM.
          const embeddedMediaContainer = this.data.hasCaption
            ? this.element.findOne('figure')
            : this.element;

Proposed resolution

Assure that if this.data.hasCaption is true, that a figure actually exists.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 295769


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