Problem/Motivation
Discovered while reviewing #3245720: [drupalMedia] Support choosing a view mode for <drupal-media>.
#3245720: [drupalMedia] Support choosing a view mode for <drupal-media> made <drupal-media data-view-mode>
an essential part of the media integration.
But in the issue where the MediaEmbed
filter was introduced #2940029-97: Add an input filter to display embedded Media entities.
This also explains why SmartDefaultSettingsTest
was failing in https://git.drupalcode.org/project/drupal/-/merge_requests/1796/diffs?co... because it did not expect the data-view-mode
attribute to be added to the result of the CKEditor 4 → 5 upgrade path.
Proposed resolution
- Make
<drupal-media data-view-mode>
a separate array value inmedia_media
'sdrupal.elements
- Add a configuration UI for the CKEditor 5 media plugin: a checkbox that indicates whether content creators are allowed to override the default view mode
- Implement
\Drupal\ckeditor5\Plugin\CKEditor5PluginElementsSubsetInterface
, to respect the configuration added in step 2, and hence unset the<drupal-media data-view-mode>
when that checkbox is not checked - Add a case for
media_media
to\Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Core::computeCKEditor5PluginSubsetConfiguration()
, to generate the correct configuration during the upgrade path. - Add an extra test case to
SmartDefaultSettingsTest
, to test a variation of$basic_html_format_with_media_embed
: one that has<drupal-media data-view-mode>
allowed as well. - Add a validation constraint (see #7) to ensure that the
media_embed
'sallowed_view_modes
setting is in sync with themedia_media
CKE5 plugin's new setting.
Remaining tasks
See proposed resolution.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A