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

  1. Configure a text format filter to use the new "Entity links" filter provided by #3317769: Add support for linking to entities in CKEditor 5
  2. Create a CKEditor link plugin decorator. Example: https://gist.github.com/markfullmer/0ff75c9b3fdf752e1b4c72951cb08e4e
  3. Using a rich text instance configured with that text format...
  4. Type a string of text, hit enter (to close the paragraph tag)
  5. Triple-click the line of text to select
  6. Add link by clicking the Link button in CKEditor
  7. The Displayed text field is disabled / greyed out
  8. Select or enter a URL
  9. 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

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

mark_fullmer created an issue. See original summary.

mark_fullmer’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Possible to get a JavaScript test for this?

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.