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

  1. Go to any node with CKEditor
  2. Type a string of text, hit enter (to close the paragraph tag)
  3. Triple-click the line of text to select
  4. Add link by clicking the Link button in CKEditor
  5. The Displayed text field is disabled / greyed out
  6. Select or enter a URL
  7. 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.
CommentFileSizeAuthor
#2 ckeditor5.png194.77 KBjannakha

Issue fork linkit-3557993

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.

jannakha’s picture

StatusFileSize
new194.77 KB

Empty 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.

mark_fullmer’s picture

CKEditor selects a whole paragraph and it doesn't put whole paragraph text into Displayed Text field.

To 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.

yonailo’s picture

I can confirm the same issue, I am using linkit 7.0.11 on a Drupal 10.5.6 release

jannakha’s picture

Status: Active » Needs review

the 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.

joe huggans’s picture

I 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.

yonailo’s picture

The merge requests works for me too, thank you !

mark_fullmer’s picture

Status: Needs review » Fixed

Thanks, everyone! Tested and works as advertised!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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

cdupree’s picture