Populate drupalmedia wrapper attributes to allow more accurate previews

Created on 20 February 2023, almost 2 years ago
Updated 14 March 2023, almost 2 years ago

Problem/Motivation

When using the drupalmedia plugin to insert a media in the editor, the <drupal-media> element is wrapped in a div.cke_widget_wrapper on which no attributes are copied. When using the view mode or the alignment selectors, data attributes are added to the <drupal-media> element but not on its wrapper so it's not possible to add styles to preview how the media will be rendered in front.

Steps to reproduce

  1. Enable media embed plugin
  2. Enable media alignment
  3. Add a media in the content
  4. Edit the media, select a left or right alignment

The media should be aligned but it's not because its wrapper is a div taking the whole width.

Proposed resolution

Copy attributes to the wrapper so it can be styled according to the choices made in the editor.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇫🇷France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @duaelfr
  • @duaelfr opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇫🇷France duaelfr Montpellier, France
  • 🇫🇷France duaelfr Montpellier, France

    Added one commit to handle the deletion of some attributes (ie. when removing the alignment).
    Tests cannot pass because Classy has been removed from Drupal 10.1.
    The failure is unrelated to this issue.

Production build 0.71.5 2024