Problem/Motivation
In #2994699-71: Create a CKEditor plugin to select and embed a media item from the Media Library, @webchick said:
It would be good when we know what the final icon [for the CKEditor media library button] will be ... by default, people are going to end up with two buttons that do almost the same thing, at least until their site administrator has configured some stuff differently. (If we don't already, we should maybe spin off a follow-up to talk about what we want the upgrade path to be here, esp. once Media Library is part of Standard profile.)
This is that follow-up.
Proposed resolution
Figure out how to make it easy for site builders to set up their CKEditor-aware text formats so that the existing Image button can either peacefully coexist with the new Media Library button added by #2994699: Create a CKEditor plugin to select and embed a media item from the Media Library, or be replaced by it.
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 3073901-19.patch | 16.98 KB | oknate |
| #19 | 3073901--interdiff-17-19.txt | 461 bytes | oknate |
| #17 | 3073901-17.patch | 16.53 KB | oknate |
| #14 | 3073901-16.patch | 12.32 KB | oknate |
| #14 | 3073901--interdiff-11-16.txt | 1.92 KB | oknate |
Comments
Comment #2
wim leersMy perspective: Standard should remove
DrupalImageand stop allowing<img>, and addDrupalMediaLibrary, themedia_embedfilter and allow<drupal-media>.Comment #3
alisonAwesome! I got here from #2994699: Create a CKEditor plugin to select and embed a media item from the Media Library -- MUCH EXCITE.
One "concern or something", only because it's just come up for us in the last few weeks (so it seems EXTREMELY IMPORTANT ;-) ) -- if the recommendation ends up being to remove the "old" button (having two image buttons would indeed be confusing), just want to make sure folks with existing sites (and folks migrating content from D7 to D8 who might have simple
<img>tags all over the place _raises hand_) still get to experience Media library + WYSIWYG Joy, without excessive (and maybe preventable?) pain....and/or maybe this is more about a desire for a path to convert
<img>tags to<drupal-media>tags...? I'm not sure -- but if this "concern or something" belongs elsewhere (or nowhere), just say the word.Thanks!
(EDIT: oops, used html tags in my comment)
Comment #4
wim leersThey'd continue to have the old button but also get the new button.
A mitigation I can think of is to allow the "old" button (
DrupalImage) to become configurable: we can make it only show up if and only if an<img>is already present. I think that would get us the best possible experience without making it impossible to edit existing content's non-media images.We've at least historically never done such update paths in Drupal core because it's possible that a single Drupal site has millions of pieces of contents with tens of millions of revisions. Drupal's update system is not built for that!
Perhaps we can automate it as long as the amount of content is small enough. But then it's going to be one hell of a bikeshed to agree on where that limit lies. Plus, it depends on how powerful the server is how long each conversion would take. Which is exactly why we've never done such update paths in the past.
Plus, not every site will even want to update!
I know, it's a less-than-ideal answer. 😔
Comment #5
aaronmchaleI think there's some good progress happening here towards a reasonable solution.
That sounds like a sensible idea, although within the context of manipulating an existing image, would it be necessary, I mean generally to manipulate an existing image you would right click on it and use that context menu to access the properties, would you still get that with the button not present?
Comment #6
wim leersI'm glad you asked precisely that!
Let me start by ensuring we have the same understanding. Today, it's possible to edit an
<img>(i.e. triggerEditorImageDialog) in three ways:I recently found out that two very smart, long-time Drupal contributors and users both knew only about two of the three. And they each didn't know about a different one.
Which then leads to the question: what if a person only knows about the third one and is a mouse user? We'd break their workflow.
Comment #7
wim leersComment #8
aaronmchaleThat's very clear and indeed a valid concern, thanks for explaining that :)
Comment #9
xjmThis is potentially a big important deal (and is a tricky problem space).
Comment #10
oknateWim Leers had previously written on this issue:
I discussed this approach with @wim-leers and @phenaproxima on Slack:
I wrote: "Sounds very easy. It would be easy to land that in 8.8, if we can reach consensus. This would only affect new installs."
But then @phenaproxima explained that this is a long way off.
So, it looks like for now, implementing an upgrade path is blocked (but not determining the eventual upgrade path). It's blocked until it's possible to add Media and Media Library to the Standard profile.
So perhaps a sub-issue to add documentation or some other interim solution should be added?
And we'll leave this open to discuss the eventual plan?
Comment #11
oknateHere's an initial patch and test coverage.
It just enables media_library and media by default and replaces the drupalimage with druplamedialibrary, and enables the media embed filter. I left
imgin the allowed_html, for BC purposes.Comment #13
oknateWhen I was testing, I had removed those 'allowed_media_types', which are from #3073535-15: Allow only a subset of the media library to be exposed to CKEditor. Here's a combined patch with #11 and #3073535-15: Allow only a subset of the media library to be exposed to CKEditor. Let's see what fails!
Comment #14
oknateIf for some reason #3073535: Allow only a subset of the media library to be exposed to CKEditor never goes in, here's a version without the config it adds ('allowed_media_types').
Comment #17
oknateFixing tests
Comment #19
oknateFixing tests
Comment #20
wim leersMarking postponed per
… but I can't even point to an issue, because there's no issue listed in #2834729: [META] Roadmap to stabilize Media Library to enable
media_library.moduleby default in Standard!Patch review:
🤓 Nit: why such super high weights? The existing weights are significantly lower.
Comment #21
oknateThe answer to why I used super high weights: I didn't even think about it. I was cutting and pasting. I will correct those.
Also, I think I might have some changes to demo_umami in there, and they should come out, as that would be a separate issue and will probably land sooner.
Comment #23
shaalre: #21, I made a working patch #3086965: Allow embedding media in CKEditor in Umami
Comment #27
wim leersIdeally we'd figure this out before Drupal 10, because Drupal 10 will drop support for CKEditor 4. See #3231364: Add CKEditor 5 module to Drupal core.
The CKEditor 5 module already has the infrastructure it needs for this: it can provide an automatic upgrade path.
Up until now, this issue has been saying we need the
mediaandmedia_librarymodules to be enabled. But … we could also just do that conditionally as a first step:media/media_librarythat switch to CKEditor 5media/media_librarythat switch to CKEditor 5This seems like a golden opportunity to at least move a big chunk of Drupal sites in the right direction!?
Thoughts? 🤓
Comment #29
nikunj.shah commented