- Issue created by @peterwcm
- πΊπΈUnited States mark_fullmer Tucson
Thanks for reporting this. I am able to reproduce. Specifically, using a generic installation of the Standard profile, adding Linkit to the Basic HTML text format:
1. Click the "Link" icon.
2. Enter a "Displayed text" value.
3. Enter the first character of an existing node and use Linkit's autocomplete to choose a result from the dropdown. Confirm that the internal path to the node is populated in the "Link URL" field.
4. Quickly(!) Remove the contents from the "Displayed text" input and quickly enter new text and press "Insert."
5. Link text will not be updated and the console will show theUncaught CKEditorError: Cannot read properties of undefined (reading 'attributes')
error.Additionally, this is something else that doesn't work correctly.
1. Click the "Link" icon.
2. Enter a "Displayed text" value.
3. Enter the first character of an existing node and use Linkit's autocomplete to choose a result from the dropdown. Confirm that the internal path to the node is populated in the "Link URL" field.
4. Now click "Link URL" field again and enter the first character of another node and use Linkit's autocomplete to choose a different result.
5. The link field will NOT correctly populate the internal path to the node but will simply populate the character you entered. - Merge request !116Correctly repopulate URL field input on update β (Merged) created by mark_fullmer
- πΊπΈUnited States mark_fullmer Tucson
I've merged a number of changes related to CKEditor v45 compatibility to reduce the surface area here. The originally reported problem still remains, so this is "Needs work."
- πΊπΈUnited States NicholasS
Also had to disable the "Linkit profile" for Ckeditors after updating core 10.5 due to the error "Cannot convert undefined or null to object" in CKEditor 5 caused by a bug in the Linkit module version 6.1.6. Specifically, in the JavaScript file index.js at line 122, the code attempts to call Object.assign(args[2], values) where args[2] can be undefined or null. This occurs when the CKEditor 5 link command is executed with fewer than 3 arguments, but the code assumes the third argument (index 2) will always be an object.
When title is empty and clicking insert
- π¦πΊAustralia jannakha Brisbane!
@nicholass
when you're updating dependencies, especially when Drupal is updated, run command to check for any major versions of contrib modules:
composer outdated -M -D
composer update usually just updates minor version by default (eg 6.1 to 6.2) if dependency has carrot (^) "drupal/linkit": "^6.0", but not to 7.0
- π©πͺGermany mrshowerman Munich
@mark_fullmer, see my comment in #3534699-14: Refactor plugin for CKEditor5 v45+ β for another bug that is related to CKEditor 45. Not sure if this is the right place to report, but as @jannakha points out in their reply, it likely has to be fixed in Linkit.
Of course, I can also open a separate issue if that is preferred.
- πΊπΈUnited States mark_fullmer Tucson
see my comment in #3534699-14: Refactor plugin for CKEditor5 v45+ for another bug that is related to CKEditor 45...Of course, I can also open a separate issue if that is preferred.
It appears that another community member created a separate issue for that today: π Editing Displayed text generates multiple links Active . I think it makes sense to initially keep that issue and this one tracked separately; if the fix ends up fixing both, fine :)
Thanks!
- πΊπΈUnited States mark_fullmer Tucson
I've created a new target development branch, 7.1.x, for this work, since it will require introducing backwards-compatibility-breaking changes. See https://www.drupal.org/project/linkit/releases/7.1.x-dev β
- π§π·Brazil giancarlorosa
Doing more tests, I found some specific behaviors related to this issue. First, I was using Linkit version 7.0.7, and this issue was happening through internal and external links. Now, I updated to version 7.0.8, and it seems that internal links are working just fine, but for external links, the issue still happens.
I've noticed that this issue tends to happen when, instead of selecting a text and adding a link, I add the link by directly clicking on the Link button from CKEditor. It's like if the created link does not have a reference to the element and can not update the Displyed text value.
Here are the steps to reproduce the issue:
- Go to any node with CKEditor
- Add link by clicking on Link button from CKEditor
- In the Link URL field, set to 'www.youtube.com'
- The Displayed text field must be empty
- Click on insert
- Click on the link and edit it
- The Displayed text field should have the same value as the Link URL field
- Change the Displayed text field
- Click on update
This will generate the following errors on console:
ckeditor5-dll.js?v=45.2.0: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 mi.getChanges (ckeditor5-dll.js?v=45.2.0:5:428639) at html-support.js?v=45.2.0:5:29843 at vi._callPostFixers (ckeditor5-dll.js?v=45.2.0:5:442557) at vi._handleChangeBlock (ckeditor5-dll.js?v=45.2.0:5:441779) at qi._runPendingChanges (ckeditor5-dll.js?v=45.2.0:5:476270) at qi.change (ckeditor5-dll.js?v=45.2.0:5:473265) at Object.<anonymous> (ckeditor5-dll.js?v=45.2.0:5:356839) at Object.fire (ckeditor5-dll.js?v=45.2.0:5:639290) at fe (ckeditor5-dll.js?v=45.2.0:5:219549) at ke.fire (ckeditor5-dll.js?v=45.2.0:5:218940)
Uncaught CKEditorError: document-selection-wrong-position {"range":{"start":{"root":"main","path":[1,18],"stickiness":"toNone"},"end":{"root":"main","path":[1,18],"stickiness":"toNone"}}} Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-document-selection-wrong-position at Co._validateSelectionRanges (ckeditor5-dll.js?v=45.2.0:5:329930) at Co._replaceAllRanges (ckeditor5-dll.js?v=45.2.0:5:329670) at Co._setRanges (ckeditor5-dll.js?v=45.2.0:5:320078) at Co.setTo (ckeditor5-dll.js?v=45.2.0:5:319218) at Co.setTo (ckeditor5-dll.js?v=45.2.0:5:328804) at Ao._setTo (ckeditor5-dll.js?v=45.2.0:5:326266) at Pi.setSelection (ckeditor5-dll.js?v=45.2.0:5:455870) at Object.callback (ckeditor5-dll.js?v=45.2.0:5:356853) at qi._runPendingChanges (ckeditor5-dll.js?v=45.2.0:5:476216) at qi.change (ckeditor5-dll.js?v=45.2.0:5:473265)
If I execute the same process, but instead of adding a link by first clicking on the Link button, I first select a text inside CKEditor, the Linkit works fine.
- π¦πΊAustralia jannakha Brisbane!
use 7.0.7 and MR122 from https://www.drupal.org/project/linkit/issues/3535479 π Refactor Linkit plugin for CKEditor5 v45+ Active (hidden branch)
- πΊπΈUnited States mark_fullmer Tucson
mark_fullmer β changed the visibility of the branch 3535098-ckeditor-v45-cannot to hidden.
- πΊπΈUnited States mark_fullmer Tucson
mark_fullmer β changed the visibility of the branch 3535098-ckeditor-insert-fix to hidden.
- πΊπΈUnited States mark_fullmer Tucson
I've confirmed that changes staged in the merge request for π Editing Displayed text generates multiple links Active do resolve this issue's problem, and would love confirmation of that from someone else: using that branch, confirm that the "Steps to Reproduce" from #16 above result in successfully being able to change link text.
The problem of duplicated links is still present in the merge request for π Editing Displayed text generates multiple links Active , so I'm continuing to work on that...