After updating to latest Drupal 10.0.6 (which introduces a new release of ckeditor5) ckeditor5 doesn't work anymore when the linkit plugin is enabled.

The error logged on the browser console is:

TypeError: i is null
    _enableLinkAutocomplete https://example.ddev.site/modules/contrib/linkit/js/build/linkit.js?v=10.0.6:1
    init https://example.ddev.site/modules/contrib/linkit/js/build/linkit.js?v=10.0.6:1
    promise callback*./packages/ckeditor5-core/src/index.ts/init/p/< https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
    p https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
    init https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
    initPlugins https://example.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=36.0.1:5
    create https://example.ddev.site/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=36.0.1:4
    create https://example.ddev.site/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=36.0.1:4
    attach https://example.ddev.site/core/modules/ckeditor5/js/ckeditor5.js?rs17v0:371
    editorAttach https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:300
    success https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:57
    jQuery 6
    filterXssWhenSwitching https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:44
    changeTextEditor https://example.ddev.site/core/modules/editor/js/editor.js?v=10.0.6:93

Comments

FiNeX created an issue. See original summary.

finex’s picture

Title: Linkit broke Ckeditor5 after update to Drupal 10.0.6 » Linkit breaks Ckeditor5 after update to Drupal 10.0.6
wim leers’s picture

mark_fullmer’s picture

Thanks for logging this and marking as critical. Looks like we ran across the same issue in https://www.drupal.org/project/linkit/issues/3350223#comment-14982955

I suppose we'll need to test for backwards compatibility, or otherwise, set a version requirement in this module's composer.json to indicate that the next release is only compatible with Drupal ^10.0.6...

catch’s picture

This was a whoops, have released https://www.drupal.org/project/drupal/releases/9.5.7 and https://www.drupal.org/project/drupal/releases/10.0.7 which reverts the ckeditor5 update.

The update is still in 10.1.x though, so might want to keep this issue open for any changes needed for 10.1 compatibility?

If you've already updated to 10.0.6, just try updating to 10.0.7 and it should fix itself.

mark_fullmer’s picture

Title: Linkit breaks Ckeditor5 after update to Drupal 10.0.6 » Drupal 10.1.x version of CKEditor 5 (v36) is incompatible with Linkit

The update is still in 10.1.x though, so might want to keep this issue open for any changes needed for 10.1 compatibility?

Thanks, will do. I've updated the issue title accordingly.

mark_fullmer’s picture

For reference in resolving, here's another implementer dealing with the API change on the formView: https://github.com/ckeditor/ckeditor5/issues/4836#issuecomment-1422740830

rajeshreeputra’s picture

Updating to 10.0.7 fixes this issue.

finex’s picture

Thank you very much!

wim leers’s picture

Title: Drupal 10.1.x version of CKEditor 5 (v36) is incompatible with Linkit » LinkIt requires new minor version for Drupal 10.1.x, since CKEditor 5 got a major version update (v35 → v36)
Category: Bug report » Task

This is not a bug, but a normal thing for CKEditor 5 plugins! Clarifying 😊

mark_fullmer’s picture

Version: 6.0.x-dev » 6.1.x-dev

I've created the 6.1.x branch of Linkit for work on a CKEditor v36-compatible release. I think this should remain as priority "Critical," since we want this to be available on or before the release date of Drupal 110.1.0-alpha1, week of 24 April 2023.

Next steps:
1. Peg the 6.0.x branch's Composer compatibility at drupal/core:^10.0.0. So that sites updating to Drupal 10.1.0 cannot use 6.0.x
2. Peg the 6.1.x branch's Composer compatibility at drupal/core:^10.1.0. So that sites running 10.0.x cannot use 6.1.x
3. Make the API change in the 6.1.x branch to work with CKEditor 5 v36.

mark_fullmer’s picture

Note: Wim Leers found a temporary workaround to address this issue. Linkit can follow suit for the time being.

mark_fullmer’s picture

The attached patch follows the workaround referenced in #12, but is only compatible with CKEditor 5 v36, due to the use of the createViews() method, so the patch also updates the drupal/core requirement as follows:

-    "drupal/core": "^9.4 || ^10"
+    "drupal/core": "^10.1.0"

This is unfortunate, as it will require maintaining the 6.0.x branch for Drupal 9.5.x and < 10.0.x concurrently, but I don't see any good alternative.

mark_fullmer’s picture

Status: Active » Needs review
StatusFileSize
new767 bytes
new16.39 KB

Actually, I think the new requirement for the 6.1.x branch can be ^10.1 since there's no reason (yet) to exclude updates to Drupal 10.2 and above.

The attached patch for 6.1.x makes that single change, and I'm also adding a patch for 6.0.x that sets its compatibility at ^9.4 || ^10.0.0 so that a site running Drupal 10.1+ cannot use that version.

wim leers’s picture

#13: there is no way around different minor versions of CKEditor 5 plugin-providing modules for each different Drupal core minor version, at least if the CKEditor 5 major version that shipped in the next minor introduced BC breaks that affect the plugin it provides.

Agreed with #14 that it can be ^10.1 👍

One remark:

+++ b/composer.json
@@ -16,7 +16,7 @@
   "require" : {
-    "drupal/core": "^9.4 || ^10"
+    "drupal/core": "^9.4 || ^10.0.0"
   },

An alternative could be:

    "conflict": {
        "drupal/core": ">=10.1"
    },

P.S.: requiring Drupal 10.1 means that PHP 8.1 is required, which means various clean-ups and simplifications become possible! 🤓

  • mark_fullmer committed 9349cfbd on 6.1.x
    Issue #3350252 by mark_fullmer, FiNeX, Wim Leers, catch, Rajeshreeputra...

  • mark_fullmer committed c9523b12 on 6.0.x
    Issue #3350252 by mark_fullmer, FiNeX, Wim Leers, catch, Rajeshreeputra...
mark_fullmer’s picture

Status: Needs review » Fixed
hmdnawaz’s picture

I'm using Drupal 9.5.6. and linkit `drupal/linkit:^6.0@RC`.

I'm getting the same error.

Is there any fix for the 6.0@RC version and still on Durpal 9.5?

mark_fullmer’s picture

I'm getting the same error.

Hi! Can you clarify? Are you referring to the problem reported in #3353484: Module compatibility being incorrectly reported, or are you getting the Javascript error reported in this issue?

hmdnawaz’s picture

I'm getting the javascript error reported in this issue.

mark_fullmer’s picture

Hi @hmdnawaz. Hrm, I tested this again manually and am unable to reproduce the problem you're referring to. Using Drupal 9.5.7 with Linkit 6.0.0-rc1 on a standard installation without anything else, using Linkit with the CKEditor 5 toolbar, everything works as expected.

Can you think of anything different in your setup that may account for this?

hmdnawaz’s picture

The issue was with Drupal 9.5.6, Upgrading the Drupal core to 9.5.7 fixes the issue.

Status: Fixed » Closed (fixed)

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

MattBrigade’s picture

Here is a patch created for Drupal 9.5.x. This patch will fix the issue in Drupal 9.5.x with CKEditor v36^.

MattBrigade’s picture

The last patch didn't work. Here is our updated patch for Drupal 9.5.x. This patch should fix the issue in Drupal 9.5.x with CKEditor v36^.

mark_fullmer’s picture

The last patch didn't work. Here is our updated patch for Drupal 9.5.x. This patch should fix the issue in Drupal 9.5.x with CKEditor v36^.

Can you clarify which release of the 9.5.x branch is this intended to work with? My understanding is that 9.5.x is going to stay on CKEditor v35. That is the current state, as can be seen in https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/core.librari...

Drupal 9.5.6 incorrectly updated to CKEditor v36, but 9.5.7 reverted that change: https://www.drupal.org/project/drupal/releases/9.5.7