Editing Displayed text generates multiple links

Created on 7 August 2025, 10 days ago

Problem/motivation

During our tests for the Linkit version 7.0.x, we've noticed that if the user edits the link and changes the Displayed text value, Linkit will generate multiple links.

The way that it generates the links is random and will add the same URL address to the different parts of the new Displayed text value.

Drupal 10.5.1
Linkit 7.0.8
<p>
    <a href="/node/2519">Test Co</a><a href="/node/2519" data-entity-type="node" data-entity-uuid="adcf4651-4d96-4eea-8a58-8d56f233b1b5" data-entity-substitution="canonical">n</a><a href="/node/2519">t</a><a href="/node/2519" data-entity-type="node" data-entity-uuid="adcf4651-4d96-4eea-8a58-8d56f233b1b5" data-entity-substitution="canonical">ent</a>
</p>
<p>
    <a href="/node/2519">T</a><a href="/node/2519" title="Title" data-entity-type="node" data-entity-uuid="adcf4651-4d96-4eea-8a58-8d56f233b1b5" data-entity-substitution="canonical">e</a><a href="/node/2519" data-entity-type="node" data-entity-uuid="adcf4651-4d96-4eea-8a58-8d56f233b1b5" data-entity-substitution="canonical">st</a>
</p>

Steps to reproduce

It's important to note that this issue seems to happen when we don't select the entire link text before editing it, but I was able to reproduce the same issue by selecting a link text, but it's harder to happen.

  1. Go to any node that has a CKEditor
  2. Select a text inside the CKEditor (optional step)
  3. Click on the Link button
  4. Add a Link URL (can be an internal link or an external)
  5. Click on Insert
  6. Now click on the created link (do not select all link text, just click on it)
  7. Click on Edit link
  8. Change the Displayed text input (on my tests, I set it to 'Text Content')
  9. Click on Update
  10. Verify if the new Displayed text does not have multiple links
πŸ› Bug report
Status

Active

Version

7.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil giancarlorosa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024