This is no longer the behaviour on 8.5, though #1459832: Shouldn't CKEditor display a node title instead of a node URL ? fixed it for 7.x. Selecting an entity via Linkit produces inserts # if no link text is selected.

It would be very nice to insert the entity label as seems to have been fixed before.
It would be even nicer if this was not static text that could become outdated if the title changed, but instead something more resilient.

I tried to have a go at fixing it, but I can't even see where the # comes from; there's nothing in 8.x-5.x that seems to offer an easy route to influence what effect Linkit has on the ckeditor text..

Comments

jonathanshaw created an issue. See original summary.

jonathanshaw’s picture

Issue summary: View changes
rajab natshah’s picture

This should not return any text to the CKEditor

anon’s picture

Status: Active » Postponed

This issue is based on the fact that the ckeditor module can't handle this.

  // Use link URL as text with a collapsed cursor.
    if (range.collapsed) {
    // Shorten mailto URLs to just the email address.
    var text = new CKEDITOR.dom.text(returnValues.attributes.href.replace(/^mailto:/, ''), editor.document);
    range.insertNode(text);
    range.selectNodeContents(text);
  }

I know that there is another issue about this for core but I can't find it now.

jonathanshaw’s picture

firewaller’s picture

+1

eelkeblok’s picture

eelkeblok’s picture

sakiland’s picture

mark_fullmer’s picture

Status: Postponed » Closed (works as designed)

For some time now, as indicated by the Linkit project page, the 8.x-5.x branch of Linkit is not undergoing active development. It is also only compatible with unsupported versions of Drupal core (Drupal 8 and Drupal 9).

To help the maintainers of the Linkit module better steward tasks under active development, I'm going to mark this issue as closed. Sites using 8.x-5.x can certainly continue to do so, but should make plans for updating to the latest supported version of Linkit.

Even better: Drupal core will soon provide link autocomplete suggestions in CKEditor similar to what this module does. Sites using or considering using Linkit should follow this core issue to evaluate whether they can use the core solution instead of Linkit. See feature differences below to compare what Linkit includes that will not initially be in Drupal core.

If this issue relates to a problem or feature request that is applicable to the latest supported version of Linkit, please create a new issue, associated with that branch, describing the bug or enhancement.

For participation and information in Linkit's roadmap, see #3345480: LinkIt Release Roadmap and Issue Prioritization.

Thanks, community, for you collaboration and consideration!

klidifia’s picture

Previous approaches no longer work. I updated this issue with some code that will use the entity title (already obtained via Linkit) as the default link text for a brand new inserted link without a selection range: #3388565: Populate displayedText with entity title when left blank