Problem/Motivation
The DrupalMedia plugin, added in 8.8.0, does not allow for CKEditor styles to applied to <drupal-media>
elements.
Steps to reproduce
- Install with 'Standard' install profile.
- Enable Media and Media Library modules.
- Set default view mode for 'Image' media bundle to render an image element with no label.
- Add 'Insert from Media Library' and 'Styles' buttons to 'Basic HTML' toolbar.
- Add the following dropdown style: 'drupal-media.test-class|Test'.
- Save the filter format.
- Upload an image to the Media library and insert into a Basic Page node.
- Observe the only class on the
<drupal-media>
element is 'cke_widget_element'. - Select the media element and use the Styles dropdown to add the 'test-class' class.
- Observe the only class on the
<drupal-media>
element remains 'cke_widget_element'. - Switch to CKEditor’s source mode.
- Observe no class attributes.
- Manually add a 'test-class' class.
- Switch out of source mode.
- Observe the only class on the
<drupal-media>
element is 'cke_widget_element'. - Switch back to source mode and observe the class has been removed.
Proposed resolution
Update the DrupalMedia plugin to allow for <drupal-media>
elements to be assigned classes by the StylesCombo plugin.
Remaining tasks
- Write patch
- Update tests
- Community review
User interface changes
<drupal-media>
elements can now be assigned classes by the StylesCombo plugin.
API changes
None.
Data model changes
None.
Release notes snippet
TBD.