Problem/motivation

The CKEditor v45 release creates a breaking change for the linkit decorator and additional attribute logic. When the link form is submitted, it now passes an additional displayedText argument with the submit arguments. Linkit has logic based on the length of the arguments object. Specifically, Linkit attempts to access or modify the decorators object, assuming it's the last item, which is now the displayedText argument, not the decorators object.

See the CKEditor5 LinkCommand docs for more details: https://ckeditor.com/docs/ckeditor5/latest/api/module_link_linkcommand-L...

Currently, you would need to manually update to CKEditor v45 to reproduce this, but the added bookmarks functionality is a great win, and v45 offers an improved link experience.

Steps to reproduce

  1. Update to v45 of CKEditor (in my use case, this was done by using the Premium features plugin pack > after I ad-hoc patched in v45 as an option.)
  2. Create/Edit content that uses the editor and add try to create a link
  3. Observe a console warning `Object.assign requires that input parameter not be null or undefined` which (in version 6.x) corresponds to the ` linkCommand.once('execute', (evt, args) => {...}` in `index.js::_handleExtraFormFieldSubmit`
  4. and also to `linkediting.js::_addExtraAttributesOnLinkCommandExecute`

Proposed resolution

In future releases, the affected logic should be updated to specifically reference the execute arguments link decorator object instead of using object length-derived solutions.

This module uses Gitlab CI for automated testing of proposed code changes. To contribute code changes, create a merge request. Patch files will not trigger automated testing and are not sufficient for review.

Issue fork linkit-3522476

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

eadamse created an issue. See original summary.

eadamse changed the visibility of the branch 3522476-future-compatibility-fix to hidden.

eadamse changed the visibility of the branch 3522476-future-compatibility-fix to active.

eadamse’s picture

Status: Active » Needs review
idebr’s picture

Title: Future compatibility fix for v45 of CKEditor5 » Compatibility fix for v45 of CKEditor5
Version: 6.1.x-dev » 7.x-dev
Related issues: +#3522476: Compatibility fix for v45 of CKEditor5
idebr’s picture

mark_fullmer made their first commit to this issue’s fork.

mark_fullmer’s picture

Priority: Normal » Major
Status: Needs review » Needs work

This change does avoid the initial error upon attempted creation of a link using linkit, but multiple tests are failing against both Drupal 10 and Drupal 11. Notably:

There were 3 failures:
1) Drupal\Tests\linkit\FunctionalJavascript\LinkFieldTest::testLinkFieldWidgetAndFormatter
Failed asserting that false is true.
/builds/project/linkit/tests/src/FunctionalJavascript/LinkFieldTest.php:135
2) Drupal\Tests\linkit\FunctionalJavascript\LinkitDialogCKEditor5Test::testLinkDialog
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'entity_test_mul'
+'true'
/builds/project/linkit/tests/src/FunctionalJavascript/LinkitDialogCKEditor5Test.php:179
3) Drupal\Tests\linkit\FunctionalJavascript\LinkitFormatAdminTest::testToggleLinkitFilter
Failed asserting that '' [ASCII](length: 0) contains "<a href hreflang data-entity-substitution data-entity-type data-entity-uuid title>" [ASCII](length: 82).
/builds/project/linkit/tests/src/FunctionalJavascript/LinkitFormatAdminTest.php:56

  • mark_fullmer committed 9ea950da on 7.x
    Issue #3522476 by mark_fullmer, eadamse, idebr: Compatibility fix for...
mark_fullmer’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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

pameeela’s picture

Will this fix be backported to 6.x? If not, then 6.x should be updated to require <10.5.

mark_fullmer’s picture

Will this fix be backported to 6.x? If not, then 6.x should be updated to require <10.5

Thanks. This will not be backported to 6.1.x. I've reflected this in the 6.1.8 core version compatibility: https://www.drupal.org/project/linkit/releases/6.1.8

pameeela’s picture

Thank you, that's helpful!

charlliequadros’s picture

Hi, I’ve created a patch to be applied to version 6, in case it’s not possible to update to version 7.

dmundra’s picture

StatusFileSize
new16.59 KB

Hi @charlliequadros,

Note that patch did not work (it might be using a version older than the current 6.1.x version) for us so here is a new patch just in case someone finds (sorry to update a closed ticket).