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

Allow only a subset of the media library to be exposed to CKEditor

$
0
0

Problem/Motivation

Allow configuring the allowed media types that appear in the media library when embedding media in the CKEditor.

In reviewing #2994699: Create a CKEditor plugin to select and embed a media item from the Media Library, I noticed that we expose all available media types in the media library when it is opened by CKEditor. I pushed back on this in #2994699-59: Create a CKEditor plugin to select and embed a media item from the Media Library, but agreed to open a follow-up to discuss further.

@Wim Leers felt that such a setting would be best represented as a setting of the media_embed filter plugin:

If we want this, then it must be configuration for the media_embed filter, not for the CKEditor integration. Just like we already added a default_view_mode setting, we should then add a allowed_media_types setting. Then the CKEditor integration (but also a similar implementation for any other text editor) can just read that configuration.

After #3074608: Optionally allow choosing a view mode for embedded media in EditorMediaDialog, which adds a similar UI-level setting to the media_embed filter, that seems reasonable.

To be very clear, this feature would NOT influence the filter's business logic. Embedded media items will still be rendered regardless of their type, just as they are now (and as they have been since day one). This setting would only influence the vertical tabs that appear in the media library when opened via CKEditor.

The approach would be similar to the "allowed view modes" setting introduced by #3074608: Optionally allow choosing a view mode for embedded media in EditorMediaDialog -- you can still render a media item in any view mode by setting the data-view-mode attribute on the drupal-media tag, but only certain view modes are exposed in the UI shown to editors when they are embedding media.

Only local images are allowed.

Proposed resolution

Add the setting to the media_embed filter, and test coverage.

Remaining tasks

Do that!

User interface changes

There will be a new setting available to site builders when configuring the Media Embed text filter, and the vertical tabs presented in the media library when it is opened via CKEditor will vary according to that setting.

API changes

None.

Data model changes

None.

Release notes snippet

TBD


Viewing all articles
Browse latest Browse all 295150

Trending Articles



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