created this patch just a few changes to the patch mr-63 to allow only edit link in toolbar

Problem/Motivation

Recent changes to the version of CKEditor that ships with Drupal core 10.5/11.2 have caused a broken tooltip for embedded entities such that you can no longer edit them. The following Javascript error is reported in the console:

Uncaught CKEditorError: Cannot read properties of undefined (reading 'pencil')
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Cannot read properties of undefined (reading 'pencil')

Steps to reproduce

  • Find a form using CKEditor configured with entity embed.
  • Embed a new entity or edit content with an existing embed.
  • Click the embedded entity in the editor

Expected results

The tooltip displays with buttons for edit, Link entity embed, and Edit the embedded entity, eg.

Screenshot of tooltip working correctly

Actual results

Proposed resolution

The tooltip does not show up. There is no option to edit the embedded entity.

Remaining tasks

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

ericgsmith created an issue. See original summary.

ericgsmith’s picture

Issue summary: View changes
ericgsmith’s picture

Priority: Normal » Critical

ericgsmith’s picture

Status: Active » Needs review

Fixed - pretty sure I've got the right link icon. It was removed from the way this plugin was loading it (see https://github.com/ckeditor/ckeditor5/issues/17304) and I saw there was a `IconLink` in the main package now so using that.

Core version req - If we don't bump this then people on 10.4 could update before they go to 10.5 or 11.2 and the plugin it would break for them.

Quick test of the syntax I used:

drush php:eval "var_dump(\Composer\Semver\Semver::satisfies('10.4.7', '>=10.5 <11.0 || ^11.2'))"
bool(false)
drush php:eval "var_dump(\Composer\Semver\Semver::satisfies('10.5.0', '>=10.5 <11.0 || ^11.2'))"
bool(true)
drush php:eval "var_dump(\Composer\Semver\Semver::satisfies('10.6.0', '>=10.5 <11.0 || ^11.2'))" 
bool(true)
drush php:eval "var_dump(\Composer\Semver\Semver::satisfies('11.0.0', '>=10.5 <11.0 || ^11.2'))"
bool(false)
drush php:eval "var_dump(\Composer\Semver\Semver::satisfies('11.1.0', '>=10.5 <11.0 || ^11.2'))" 
bool(false)
drush php:eval "var_dump(\Composer\Semver\Semver::satisfies('11.2.0', '>=10.5 <11.0 || ^11.2'))"
bool(true)
ericgsmith’s picture

Tests failing - current major still set to 11.1?

ericgsmith’s picture

Title: Drupal 10.5/11.2 compatability » Drupal 10.5/11.2 compatability (tooltip broken, cannot edit embedded entities)
Issue summary: View changes
jayemel’s picture

Thanks for this. Any update when this will be merged and released? It is site breaking for us.

ericgsmith’s picture

If somebody can review / test so that it can be moved to RTBC, I'm happy to reach out to maintainers to ask them to get it committed - but I think its fair to wait till the status is RTBC before doing this.

rajab natshah’s picture

Facing the same issue. thank you for the MR

rajab natshah’s picture

rajab natshah’s picture

Attached a static entity_embed--2025-06-30--3531672--mr-62.patch file, to this point of MR62.
To be used with Composer Patches

rford’s picture

The patch fixes the issue for me. Thanks!

rajab natshah’s picture

Thanks to Eric for MR62, the patch file is only a static point of the plain diff

tlo405’s picture

Status: Needs review » Reviewed & tested by the community

Patch is working for me as well. Thanks!

jmagunia’s picture

There's a yarn.lock file in the MR.

jayemel’s picture

When will the maintainers give this some attention? This essential module is broken on current versions of Drupal.

ericgsmith’s picture

Re #16 - yes I didn't realise this wasn't already committed. It wasn't present but also isn't it the gitignore so not clear here. It's pretty common to commit the yarn.lock file as it can ensure dependency versions aren't changed until it's intentional

ericgsmith’s picture

Status: Reviewed & tested by the community » Needs work

Tests are still failing and it's not clear it it's related to this change or not, would be good to get a green pipeline.

Phpunit on previous minor is expected to fail as it's not compatible, but the current job is now testing on 11.2 and there is 2 failures there.

rford’s picture

I have several sites that are currently unable to be updated to Drupal 10.5 due to this issue. Any updates on when this issue will be resolved?

smustgrave’s picture

May have found a valid bug, when you add a link to an embedded entity you can't go back and edit that link. The icon just doesn't work.

Uncaught CKEditorError: r._addActionsView is not a function

smustgrave’s picture

Believe I got that correct replacing _addActionsView with _addToolbarView

hamza_niazi’s picture

this patch mr-62 resolved my issue thanks.

hamza_niazi’s picture

Issue summary: View changes
StatusFileSize
new39.06 KB

created this patch just a few changes to the patch mr-62 to allow only edit link in toolbar

jennypanighetti’s picture

Not sure what I'm doing wrong, but MR-62 applied via composer (on 10.5.1) did not resolve my issue. I still see no way to edit embedded media items, though at least the white arrow is gone.

ericgsmith’s picture

Thanks @smustgrave!

Confirming your change in d130db37 looks correct as per this change - https://github.com/ckeditor/ckeditor5/commit/4a595753940ab2087db7901922b...

Still have some unexplained test failures here - not really sure I'll have time to dig further into these

ericgsmith’s picture

Ok - did end up trying to investigate these.

The last CI run shows the following tests failing:

58.307s Drupal\Tests\entity_embed\FunctionalJavascript\EntityEmbedDialogTest      0 passed, 1 failed, 1 log(s)
209.891s Drupal\Tests\entity_embed\FunctionalJavascript\ButtonAdminTest            3 passed, 1 failed, 1 log(s)
177.661s …upal\Tests\entity_embed\FunctionalJavascript\CKEditor5IntegrationTest    0 passed, 2 failed, 16 errored, 1 log(s)

I ran these locally on 11.2.2 with same phpunit version. The first 2 pass (with deprecations):

$ phpunit -c app/core/phpunit.xml app/modules/contrib/entity_embed/tests/src/FunctionalJavascript/EntityEmbedDialogTest.php 
PHPUnit 11.5.27 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.23
Configuration: /data/app/core/phpunit.xml

.                                                                   1 / 1 (100%)

Time: 00:38.220, Memory: 12.00 MB

OK, but there were issues!
Tests: 1, Assertions: 6, PHPUnit Deprecations: 5.


$ phpunit -c app/core/phpunit.xml app/modules/contrib/entity_embed/tests/src/FunctionalJavascript/ButtonAdminTest.php 
PHPUnit 11.5.27 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.23
Configuration: /data/app/core/phpunit.xml

....                                                                4 / 4 (100%)

Time: 03:09.833, Memory: 12.00 MB

OK, but there were issues!
Tests: 4, Assertions: 32, PHPUnit Deprecations: 16.

The last one CKEditor5IntegrationTest.php does indeed fail multiple times.

RuntimeException: The autoloader expected class "Drupal\embed\Plugin\CKEditor5Plugin\EmbedCKEditor5PluginBase" to be defined in file "/data/app/modules/contrib/embed/src/Plugin/CKEditor5Plugin/EmbedCKEditor5PluginBase.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

Looks like in the embed module that class is using the wrong namespace - it has Drupal\entity_embed\Plugin\CKEditor5Plugin

But this module doesn't appear to be extended that - what even is that class

ericgsmith’s picture

Adding #3517882: The namespace of EmbedCKEditor5PluginBase does not respect PSR4 as a related issue - that will need to land first for the tests to go green.

m4olivei’s picture

Thanks for the patch friends!

I had a bit of trouble finding this issue. Making adjustments to the Issue Summary to help other folks find it.

I'm also attaching a patch that leaves out yarn.lock just b/c its large, and maintainers haven't piped in yet on whether thats desireable. IMO its a good idea (also noted in #18) for the module going forward, however it might be out of scope and makes the patch big.

m4olivei’s picture

Issue summary: View changes
StatusFileSize
new1014.45 KB
jatingupta40’s picture

As soon as i have updated the Drupal version from 10.4.8 to 10.5.0, i got this same issue.
Patch on #29 resolves the issue.

Thanks.

jatingupta40’s picture

StatusFileSize
new243.98 KB
new4.67 KB

In the newer CKEditor version, the styling and layout of the edit toolbar/balloon have changed.
new toolbar
However, with the applied patch, the toolbar/balloon still appears with the older styling and layout.
old

We may need to update the MR to align with the new CKEditor styling.

butterwise’s picture

Patch in #29 worked for me when going from 10.4.8 to 10.5.2. I am now seeing the old toolbar which is better than none.

jatingupta40’s picture

bkosborne’s picture

Category: Task » Bug report
bkosborne’s picture

Status: Needs work » Reviewed & tested by the community

This works as expected and restores the original toolbar. RE: #32, I think it's best that be handled in a follow up so we can restore this critical functionality.

liam morland’s picture

Status: Reviewed & tested by the community » Needs work

Tests are not passing.

Is it the goal that version 2.0.x will be only for 10.5+ and 11.2+?

trackleft2’s picture

What would you like to see happen here, @liam.morland?

For my projects, requiring Drupal 10.5+ is fine. Are you suggesting we maintain two release branches? For example:
• 2.0.x – supporting the previous CKEditor in Drupal 10 before 10.5
• 2.1.x – requiring 10.5+

smustgrave’s picture

Probably going to have and do that as the changes her May break <10.5 or 11.2

Think that’s what the other contrib ckeditor modules had to do unfortunately

ericgsmith’s picture

Issue summary: View changes

ericgsmith changed the visibility of the branch 3531672--drupal-10.511.2-test-with-embed-fix to hidden.

ericgsmith changed the visibility of the branch 3531672--drupal-10.511.2-test-with-embed-fix to hidden.

ericgsmith’s picture

Re #37 - tests are also failing on 2.0.x branch for the previous minor which is not affected by the CKeditor version change - I'm not sure how much effort is due here vs a separate issue. Edit, my mistake, I see prev minor actually passes on 2.0.x.

Previous minor tests on this branch - well we kind of expect them to fail now, the JS is now dependent on a CKEditor version only available in 10.5 and 11.2 - given 10.6 and 11.3 will be out at some point, it makes sense to keep the tests running on prev minors? Maybe one for the maintainers to give input here.

Other tests - I'm not convinced anything is broken. I already investigated in #27. I added a new branch with the patch committed in #3517882 which was responsible for some of the failures. We can see here with that in place that the tests are passing https://git.drupalcode.org/issue/entity_embed-3531672/-/jobs/6389586 (except for CKEditor5Integration)

A quick win to reduce confusion here would be to please tag a new version of embed so that we can stop being distracted by this unrelated failure.

Then its just the CKEditor5Integration failure to address.

The CKEditor5Integration fails with:

"Test was run in child process and ended unexpectedly"

This test passes for me locally - if somebody wants to do battle with gitlab to figure out what / why the pipeline is crashing go for it - but I think I still have confidence the test failure is not related to this change and that the work everybody has done here is good.

liam morland’s picture

Instead of two branches, it might be possible to do something like IconPencil || icons.pencil.

The merge request (identical to the patch in #29) is working for us on Drupal 10.5.

finaukaufusi’s picture

I'm on D10.5.2 - Applied the patch #29 locally using composer and it works on my lando dev. However, when deploy to cloud docker container, it didn't work for some reasons. I inspected the composer install command is running the same as my local. It's blocked me from upgrade to D10.5.2 I have to continue on D10.4.8

finaukaufusi’s picture

I've use the composer package from this link, it works for me - https://github.com/northernco/ckeditor5-anchor-drupal/pull/17
I have to remove the existing package I used in composer.json and replace with this one.

composer require vardot/ckeditor5-anchor-drupal:~2.0

rossb89’s picture

MR-62 does the trick to restore the functionality, even if the style of the tooltip is the older style.

Agreed that comment 32 should be handled as a follow up. As it stands, with 10.5+ the ability to edit previously embedded media is completely broken without the changes present here.

If the changes here are only compatible with D10.5+ then a new version should be cut with that as marked compatibility.

jedgar1mx’s picture

StatusFileSize
new35.25 KB

I created a patch using the MR-62 and it seems to do the trick for me.

karenann’s picture

Updating comment because of my own error.

I am running 10.6.3 and just attempted to apply mr!62 and it successfully applied. Uploaded the fix and it resolves the issue and the pencil and cog (and link) appear as needed.

divya.lakshman’s picture

The Patch on #29 fails to apply on 10.5.6
entity_embed:1.6.0

joseph.olstad’s picture

@divya.lakshman , please upgrade to entity_embed 1.7.0 , the patch #48 applies to version 1.7.0
Save yourself the trouble and upgrade entity_embed and then patch 48 will apply cleanly.

jannakha’s picture

StatusFileSize
new598.02 KB
new565.64 KB

Applied patch from MR 62 to v1.7, Drupal 10.6

Works as required (user can modify display mode, layout, link to entity, create link on entity)
Here's screenshots:
screenshot 1
screenshot 2

Note: Linking whole entity doesn't work if entity is rendered with divs and other (which creates invalid html structure). I think there's an issue for it somewhere.

divya.lakshman’s picture

Thanks @joseph.olstad the patch #48 applies to version 1.7.0.

p-neyens’s picture

I am running 10.6.5 and just attempted to apply mr!62 and it successfully applied. Uploaded the fix and it resolves the issue and the pencil and cog (and link) appear as needed.

mikelutz’s picture

Title: Drupal 10.5/11.2 compatability (tooltip broken, cannot edit embedded entities) » Drupal 10.5/11.2 Compatibility (tooltip broken, cannot edit embedded entities)