Problem/Motivation
Drupal 10.5.x/11.2.x includes an updated version of CKEditor.
This causes some errors in the browser console:
Uncaught TypeError: Cannot read properties of undefined (reading 'objectSizeSmall')
at mediaResize.js?sy5jsh:1:8512
at mediaResize.js?sy5jsh:1:13436
at mediaResize.js?sy5jsh:1:13452
at mediaResize.js?sy5jsh:1:236
at mediaResize.js?sy5jsh:1:241
When JavaScript aggregation is turned off, the following error appears:
CKEditorError: plugincollection-plugin-not-found {"plugin":null}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-plugincollection-plugin-not-found
at ckeditor5-dll.js?v=45.2.0:5:160418
at ckeditor5-dll.js?v=45.2.0:5:160477
at Array.forEach (<anonymous>)
at u (ckeditor5-dll.js?v=45.2.0:5:160279)
at l.init (ckeditor5-dll.js?v=45.2.0:5:158767)
at w.initPlugins (ckeditor5-dll.js?v=45.2.0:5:172181)
at editor-classic.js?v=45.2.0:4:11082
at new Promise (<anonymous>)
at w.create (editor-classic.js?v=45.2.0:4:11039)
at Object.attach (ckeditor5.js?sy5jsh:373:21)
Steps to reproduce
- Enable CKEditor Media Resize plugin in Drupal Core 10.5.x or 11.x
- Attempt to load CK Editor
- Editor fails to load with console errors
Proposed resolution
Update icon compatibility per https://www.drupal.org/node/3528806
Remaining tasks
- Understand whether this MR then breaks older sites e.g. 10.4
- Based on that decide if new release version is needed e.g. 2.0.0 and locking 1.0.0 to earlier 11x and 10x versions of core
User interface changes
No change
API changes
N/A
Data model changes
N/A
Comments
Comment #2
rodetrev commentedHi Sebastian, I am getting the same issue in Drupal 10.5.0. It looks like the file ckeditor_media_resize/js/ckeditor5_plugins/mediaResize/src/mediaresizebuttons.js is importing icons from 'ckeditor5/src/core' and this export does not exist. Thanks.
Comment #3
ruslan piskarovNot sure, nut maybe related https://www.drupal.org/node/3528806.
Comment #5
scott_euser commentedThanks for the tip Ruslan, was exactly that!
Comment #7
scott_euser commentedComment #8
scott_euser commentedComment #9
damienmckennaThis resolves the problem with 10.5.0.
I think we should create a new minor branch (1.1.x) for this fix, then update 1.0.x to limit its compatibility to <10.5 and <11.2, then the new 1.1.x branch requires 10.5 or 11.2.
Comment #10
scott_euser commentedBranching strategy sounds good. And thanks for reviewing!
Comment #11
rajab natshahAttached a static ckeditor_media_resize--2025-06-28--3531299--mr-16.patch file, for this point of MR16.
To be used with Composer Patches.
Comment #12
davedg629 commentedI can't get the patch in #11 to apply while also applying the patch from this issue: https://www.drupal.org/project/ckeditor_media_resize/issues/3401311.
Comment #13
lamp5HI @davedg629, the problem is with build so after you applied the patch, you need to rebuild a module and then your conflict will be resolved. Attached the patch that can be applied after:
https://www.drupal.org/files/issues/2024-10-03/3401311_no_html_filter_required.patchfrom #3401311: Allow this module to work without "Limit allowed HTML tags and correct faulty HTML" filter
Comment #14
davedg629 commented@lamp5 - Thank you! Patch in #13 works great.
Comment #15
ericgsmith commentedChange works and fixes the bug - just a minor in that most of the plugins I've seen have moved to using what is exposed by the icon plugin rather than directly referencing the icon path. Its a minor, but it could potentially save effort in the future if the icons are moved around within the plugin.
Comment #16
scott_euser commentedSure go for it, sounds good IMO. As long as it still fixes the issue if that's what the documentation recommends... Thanks!
Comment #17
ericgsmith commentedTa, end of day for me here so I'll test it tomorrow
Comment #18
ericgsmith commentedMade the following changes
- Bumped the Ckeditor version requirement in package.json to match the version of core 10.5.x / 11.2.x
- Bumped the Drupal core version requirement in the info file to ^10.5 / ^11.2
- Import from the publicly exposed constants instead of the source files
Sorry for knocking it back to needs review from RTBC - have tested on a project and is still working for me
Comment #19
tderego commentedMR!16 tested in Drupal 11.2.2, works great!
Comment #20
florianboehmeMR!16 tested in 10.5.1 and works. But the image has no size?
//editted: Sorry, my fault. It was because: "Limit allowed HTML tags and correct faulty HTML". When activated, no image appears. When I deactivate it, images are back.
Comment #21
anybodyAny chance to merge this and tag a new release because of the "Major" status (broken projects)?
Thanks!
Comment #22
anybodyStatic patch from MR!22 current state attached
Comment #23
roshanibhangale commentedHi
I have tested this on drupal 10 and 11.x and followed the below steps:
Steps to reproduce
After applying patch successfully, observed that on editor load no error is displayed. Also while resize the image no error is presnet in console.
Hence this can be moved to RTBC+1. Attaching the screenshot for the reference
Comment #24
jeffschulerThis indeed broke CKEditor and CKEditor-enabled text fields on our site after upgrading to core 10.5.
Patch from latest MR!16 fixed the issue, with 1.0.0 of this module and Drupal core 10.5.4.
RTBC++
Comment #25
andysipple commentedCan confirm Patch from latest MR!16 works!
Our cypress test kept on failing when interacting with a ckeditor.
Comment #26
carma03 commentedConfirming MR!16 worked successfully on D11.2.4.
Thank you all!
Comment #27
anybodyMaybe someone could try contacting the maintainers to merge this? Thanks!
Comment #28
damienmckennaComment #29
damienmckennaComment #32
damienmckennaCommitted, thanks everyone!
This will be in the 1.1.0 release.