Problem/motivation
When an entire line is selected, i.e. when triple-clicking to select, attempting to submit a link via the CKEditor Link balloon with Linkit enabled generate the following errors in the console, and afterwards the user is unable to click elsewhere in the editor / the editor freezes:
ckeditor5-dll.js?v=45.2.2:5 Uncaught CKEditorError: Cannot read properties of undefined (reading 'attributes')
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Cannot read properties of undefined (reading 'attributes')
at li.getChanges (ckeditor5-dll.js?v=45.2.2:5:426292)
at js_eSj03_QezNeDw_7PCho9Mo5MeyL4yFBuG3FX3eShEGY.js?scope=footer&delta=3&language=en&theme=claro&include=eJyNVFtu4zAMvJBif_UALdB-
Steps to reproduce
- Go to any node with CKEditor
- Type a string of text, hit enter (to close the paragraph tag)
- Triple-click the line of text to select
- Add link by clicking the Link button in CKEditor
- The Displayed text field is disabled / greyed out
- Select or enter a URL
- Click Insert
Proposed resolution
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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | ckeditor5.png | 194.77 KB | jannakha |
Issue fork linkit-3557993
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 #2
jannakha commentedEmpty Display Text this is not an issue of linkit.
Empty Display Text is CKEditor5 itself (see screenshot) when you triple-click, CKEditor selects a whole paragraph and it doesn't put whole paragraph text into Displayed Text field.
Comment #3
mark_fullmerTo clarify, this bug report is not about the insertion of content into the Displayed Text field, or lack thereof. It is about how, on pressing "Insert," JS from Linkit throws a JavaScript error that results in the CKEditor window becoming unusable.
Comment #4
yonailoI can confirm the same issue, I am using linkit 7.0.11 on a Drupal 10.5.6 release
Comment #6
jannakha commentedthe issue is created by linkit trying to update display text field when a whole paragraph is selected and display text textbox is actually read only (by CKEditor 5 itself)
Added check if field is read only, don't update display text value.
Comment #7
joe huggansI was able to replicate this issue, it doesn't happen for me when entering a full URL or a relative path, it only happens when you search then select a node from the list.
Tested the MR150 and it successfully corrects the issue, no more errors in console and the ckeditor field is still editable after adding the link.
Comment #8
yonailoThe merge requests works for me too, thank you !
Comment #9
mark_fullmerThanks, everyone! Tested and works as advertised!
Comment #13
cdupree