Problem/Motivation
Postponed on #3271057: Move Media Library CKEditor 4 integrations from Media into CKEditor.
The Media module integrates with both CKEditor 4 and CKEditor 5. CKEditor 4 will be deprecated and removed from core in Drupal 10, so Media's integrations should be owned by the CKEditor module instead of the Media module.
Proposed resolution
- Move Media CKEditor integrations into the CKEditor namespace, including:
- Updating references in
core/modules/media/tests/modules/media_test_embed/media_test_embed.module
,core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
, andcore/modules/media/media.module
to refer to text editors generally, not CKEditor specifically. core/modules/media/css/plugins/drupalmedia/ckeditor.drupalmedia.css
core/modules/media/js/plugins/drupalmedia/plugin.es6.js
core/modules/media/js/plugins/drupalmedia/plugin.js
core/modules/media/src/Plugin/CKEditorPlugin/DrupalMedia.php
core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
- Move
media_embed_ckeditor_theme
asset library to CKEditor. - Update references to plugin CSS in
core/.stylelintrc.json
for new paths.
Relevant commits: f17478 and 1150087da (these only remove references, rather than moving them to new namespaces).
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
To prepare for the removal of the CKEditor 4 module from core, CKEditor's Media integrations have been moved out of the Media module, into the CKEditor module. This changes the locations of several asset libraries, so modules that integrate with CKEditor and Media may need to update their library definitions.
Comment | File | Size | Author |
---|---|---|---|
#26 | 3271094-26-10x.patch | 15.61 KB | lauriii |
|
Issue fork drupal-3271094
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
Wim LeersQuoting
Drupal\media\Plugin\CKEditorPlugin\DrupalMedia
:👍
Also, AFAICT this actually is not blocked on #3271057: Move Media Library CKEditor 4 integrations from Media into CKEditor. Let's see if I'm right 🤓
Comment #6
Wim LeersNext step: the
media/media_embed_ckeditor_theme
asset library.@lauriii provided guidance on how to approach that:
media/media_embed_ckeditor_theme
andclassy/media_embed_ckeditor_theme
librariesclassy/media_embed_ckeditor_theme
tockeditor
and load instead ofmedia/media_embed_ckeditor_theme
classy/css/components/media-embed-error.css
tockeditor
and load by default with media integrationComment #7
Wim LeersThe commits that d.o/GitLab are displaying between #5 and #6 actually all happened after #6. This is very confusing 😬
Pinged the Drupal Association about this: https://drupal.slack.com/archives/CGKLP028K/p1655226648791499 — apparently #1374090: Editing a comment still changes creation date is related.
Comment #8
Wim LeersThis deprecation error is causing a number of test failures.
Clearly the deprecation message is wrong. I debugged it, and it's actually the
classy
theme that is causing this. 🙃Looks like that is caused by the 5th step not having been done yet. So … trying that now!
Comment #9
Wim LeersNow I definitely need guidance from @lauriii 🤓
Comment #10
lauriiiI added few comment to the MR. On top of that, we need to add some overrides to
rupal\KernelTests\Core\Theme\ConfirmClassyCopiesTest
get rid of the failures caused by the deprecated library.Comment #11
Wim LeersComment #12
Wim LeersHopefully that was the last round of this game of whack-a-mole 😬
(Turns out there was a bug in
StableLibraryOverrideTest
😅)Comment #13
Wim Leers@lauriii made the right call.
We should not be changing the
media_embed_error
templates. Those should remain unchanged because they're used not by the CKEditor 4 module but by\Drupal\media\Plugin\Filter\MediaEmbed::renderMissingMediaIndicator()
.Comment #14
Wim LeersI dug in.
CKE4
The crucial bit is this in
core/modules/ckeditor/js/plugins/drupalmedia/plugin.es6.js
:→
Drupal.theme.mediaEmbedPreviewError()
is only relevant for client-side preview errors. In other words: network connectivity issues.CKE5
Same thing in CKEditor 5's equivalent at
core/modules/ckeditor5/js/ckeditor5_plugins/drupalMedia/src/drupalmediaediting.js
:with
Conclusion
mediaEmbedPreviewError
would've been a lot clearer if it were namedmediaEmbedPreviewClientError
… the "preview" was thought to imply it probably, but clearly it was not adequateComment #15
Wim LeersPushed 5 commits that undo many of the changes and picks for a much more targeted approach.
Comment #17
Wim Leers@bnjmnm Thanks, I just pushed the same thing, only to see after the fact you did the same 😅 The difference in line endings was caused by
git
😬Comment #18
Wim LeersImplemented solution for that last hurdle 🤞
Comment #19
lauriiiThe code itself looks good. 👍 Thank you for your patience on this @Wim Leers. 🙏
I think the code itself would be RTBC, but a critical piece of this issue is still to write a CR + release note for the fact that
Drupal.theme.mediaEmbedEditButton
is now in CKEditor 4.Comment #20
Wim LeersYay!
On it 😄
Comment #21
Wim LeersDone. CR: https://www.drupal.org/node/3292250. Release note added to issue summary.
Comment #22
Wim LeersImproved as requested in chat!
Comment #23
lauriiiThank you!
Comment #24
catchA bit more involved than a straight move because media was mixing generic editor integration with ckeditor4-specific stuff, but it all looks OK to me. I opened #3293741: Rename media_embed_ckeditor_theme to something more generic for a follow-up.
However, this needs a 10.1.x MR/patch, doesn't apply there.
Comment #25
xjmComment #26
lauriiiComment #27
lauriiiMoving back to RTBC since #26 is green and it was just a simple reroll.
Comment #29
catchCommitted/pushed the respective patches to 10.1.x/10.0.x and 9.5.x, thanks!
Comment #31
xjmSimplifying the CR a bit -- module developers can read the details in the CR, and site owners don't need to understand which libraries have been moved where.
Comment #32
xjmComment #33
xjmJust noted this was not actually backported to 9.4.x. Should it be backported to 9.4.x?
Comment #34
catchIf we're only going to deprecate ckeditor module in 9.5.x, I'm not sure it's worth backporting. But, also not opposed if there's a good reason.
Comment #35
xjm@bnjmnm also agreed on not backporting it, so retagging accordingly.