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
- 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.)
- Create/Edit content that uses the editor and add try to create a link
- 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`
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.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 3522476-compatibility-fix-for-v45-ckeditor5.patch | 16.59 KB | dmundra |
Issue fork linkit-3522476
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
Comment #5
eadamse commentedComment #6
idebr commentedComment #7
idebr commentedComment #9
mark_fullmerThis 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:
Comment #12
mark_fullmerComment #14
pameeela commentedWill this fix be backported to 6.x? If not, then 6.x should be updated to require <10.5.
Comment #15
mark_fullmerThanks. 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
Comment #16
pameeela commentedThank you, that's helpful!
Comment #17
charlliequadros commentedHi, I’ve created a patch to be applied to version 6, in case it’s not possible to update to version 7.
Comment #18
dmundraHi @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).