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 due to a JS error:
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-Spun off from #3317769: Add support for linking to entities in CKEditor 5 , comment https://www.drupal.org/project/drupal/issues/3317769#comment-16346732
Steps to reproduce
- Configure a text format filter to use the new "Entity links" filter provided by #3317769: Add support for linking to entities in CKEditor 5
- Create a CKEditor link plugin decorator. Example: https://gist.github.com/markfullmer/0ff75c9b3fdf752e1b4c72951cb08e4e
- Using a rich text instance configured with that text format...
- 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
The issue is created by trying to update display text field when a whole paragraph is selected and display text textbox is actually read only (by CKEditor 5 itself). Add a check if the selection is read only, don't update display text value.
Issue fork drupal-3560141
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 #3
mark_fullmerComment #4
smustgrave commentedPossible to get a JavaScript test for this?