After enabling the module, the CKEditor doesn't initialize and I only get this error in the JS console:

CKEditorError: schema-cannot-extend-missing-item {"itemName":"drupalMedia"}

Really weird, because drupalMedia is explicitly marked as a dependency in ckeditor_media_resize.ckeditor5.yml under conditions... I haven't so far been able to figure out why it doesn't work. Without this module, drupalMedia works without any problem.

Command icon 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

rgpublic created an issue. See original summary.

sebaz’s picture

Are you trying to use it with CKEditor 5? Have you read instruction especially:

4. Enable the filters Limit allowed HTML tags and correct faulty HTML, Resize media images and Embed media. The Resize media images filter needs to run before the Embed media filter.

5. Configure the Embed media filter to allow at least the Image media bundle to be inserted. Resizing for other media bundles is not supported at this point.

rgpublic’s picture

StatusFileSize
new111.88 KB
new34.91 KB
new87.26 KB

Yes, I'm trying to use CKE5. I guess I setup everything correctly. See attached screenshots. Might be wrong though, of course.

s_leu’s picture

Status: Active » Needs review

@rgpublic Can you check if your site is sending a Content Security Policy header? If yes, please try updating the module and check if the problem persists.

rgpublic’s picture

@s_leu: Yes, my site had the csp module installed and a Content Security Policy header. BUT: Usually if there's a violation against a CSP rule it should show up in the browser console. There was no violation. Just to be sure I uninstalled the module and checked that there's no CSP header now. As expected, this didn't help. The problem persists.

The error message "schema-cannot-extend-missing-item {"itemName":"drupalMedia"}" sounds as if it might be a loading order problem. Could it be this plugin here is loaded before the drupalMedia plugin? I found this here:

https://github.com/ckeditor/ckeditor5/issues/12199

There doesn't seem to be a real dependency mechanism in CKE5 between plugins. But the last comment suggest using afterInit() for such purposes. Perhaps you might want to try to move any schema extensions in the afterInit() method? Just a thought...

s_leu’s picture

@rgpublic I finally ran into this too when I disabled another plugin in one of my text format configs. Moving schema and converter registration into the afterInit() hook did the trick. Please check and confirm if it solves your issue too.

rgpublic’s picture

@s_leu: Yes, it works now with the branch. Wonderful. Thank you so much! Would be great if you could release a new version. (I still think CKE5 should one day have a better way to define those dependencies so I'll live a comment there).

  • s_leu committed 33306582 on 1.0.x
    Issue #3387079 by s_leu, rgpublic, SebaZ: schema-cannot-extend-missing-...
s_leu’s picture

Status: Needs review » Fixed

Thanks for checking again @rgpublic, merged this now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.