Problem/Motivation
Selecting an embedded paragraph in CKEditor 5 throws a JavaScript error and the widget's balloon toolbar — the one carrying the Edit button — never renders. Editors can insert a paragraph, but cannot edit it again from within the editor.
CKEditorError: unexpected-error Original error: TypeError: Cannot read properties of undefined (reading 'pencil') at Object.callback (entity_embed/js/build/drupalentity.js) at ao.create (ckeditor5-dll.js?v=47.6.2) at R._buildItemsFromConfig (ckeditor5-dll.js?v=47.6.2) at R.fillFromConfig (ckeditor5-dll.js?v=47.6.2) at le._showToolbar (ckeditor5-dll.js?v=47.6.2)
Reproduced on Drupal 10.6.15 and Drupal 11.4.5.
This is not a bug in this module
The cause is in Entity Embed's CKEditor 5 plugin, js/ckeditor5_plugins/drupalentity/src/toolbar.js, which reads icons.pencil off an export that CKEditor 5 removed in v45. It affects any embedded entity, not just paragraphs. It is already reported upstream, with a fix awaiting review:
- Entity Embed #3575503 — "Widget toolbar broken in CKEditor 5 v45+ - icons.pencil and icons.cog removed from core exports". MR !69 is the current fix; it also covers
icons.cogand a LinkUI method rename from CKEditor 5 v43. - Entity Embed #3531672 — "Drupal 10.5/11.2 Compatibility (tooltip broken, cannot edit embedded entities)". Related, referenced from the issue above.
This issue stays open only to track that work, so that anyone who hits the console error while using this module finds an explanation here instead of filing a duplicate.
Verified that the upstream fix resolves it
Tested using the FunctionalJavascript coverage added in #3040507, which drives the whole embed flow in a real browser, with its assertion tightened to allow no JavaScript console error at all:
- Without Entity Embed MR !69 — the embed test fails on the
pencilTypeError. - With MR !69 applied and nothing else changed — both tests pass and the console is clean.
- Reverting the MR brings the failure straight back, so the result is attributable to the MR rather than to the environment.
Also checked, since the upstream thread had a question about it: MR !69 inlines the pencil and cog SVGs, and both paths appear verbatim in the ckeditor5-dll.js that Drupal 11.4.5 ships, so it is using the canonical artwork rather than a lookalike.
Impact while waiting
Embedding still works — the paragraph is inserted, saved and rendered correctly. What is lost is the pencil button on the widget balloon, so an editor has to delete and re-add a paragraph rather than edit it in place. The console error itself is harmless but alarming, which is why it is now written up in the module's troubleshooting section, added in #3619188.
Remaining tasks
- Wait for Entity Embed #3575503 to be committed and released.
- Then drop the known-error exemption in
ParagraphsIEFEmbedTest::discardKnownUpstreamJsErrors(), so the test fails on any console error again. - Remove the troubleshooting entry from the README, and from the help page it now feeds.
- Close this issue.
Comments
Comment #2
marcelovaniComment #3
marcelovaniComment #4
marcelovani