schema-cannot-extend-missing-item js error

Created on 13 September 2023, about 1 year ago
Updated 3 October 2023, about 1 year ago

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.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany rgpublic Düsseldorf 🇩🇪 🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @rgpublic
  • 🇵🇱Poland sebaz

    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.

  • 🇩🇪Germany rgpublic Düsseldorf 🇩🇪 🇪🇺

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

  • Status changed to Needs review about 1 year ago
  • @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.

  • 🇩🇪Germany rgpublic Düsseldorf 🇩🇪 🇪🇺

    @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 opened merge request.
  • @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.

  • 🇩🇪Germany rgpublic Düsseldorf 🇩🇪 🇪🇺

    @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-...
  • Status changed to Fixed about 1 year ago
  • Thanks for checking again @rgpublic, merged this now.

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

Production build 0.71.5 2024