Linkit dialog sometimes returns '#' for the link text instead of the content title. I haven't figured out what triggers it (see attached GIF).

CommentFileSizeAuthor
linkit.gif149.04 KBdrupalninja99
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupalninja99 created an issue. See original summary.

drupalninja99’s picture

Now I am seeing this console error

Uncaught TypeError: Cannot read property 'collapsed' of undefined
    at Object.saveCallback (/core/modules/ckeditor/js/plugins/drupallink/plugin.js?t=oldd75:121)
    at eval (eval at globalEval (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:1), <anonymous>:265:23)
    at dispatch (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:3)
    at r.handle (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:3)
    at Object.trigger (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:4)
    at js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:4
    at Function.each (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:2)
    at n.fn.init.each (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:2)
    at n.fn.init.trigger (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:4)
    at Drupal.AjaxCommands.editorDialogSave (eval at globalEval (js_44lkRVvuH9nKpxrDaK6PKTK73F-5D0tIyW0rieWWmbs.js:1), <anonymous>:31:15)
drupalninja99’s picture

I think the above error is actually when you try to insert a link with empty results.

anon’s picture

Status: Active » Closed (duplicate)

I don't know about the error, but Linkit is inserting # as a placeholder for the href attribute.

Linkit is adding some data attributes to the <a> tag and is then "calculating" the href in run-time using the data attributes.
I didn't know what to do with the href, so I put it to # all the time as the link plugin needs a href attribute in order to add links.

This is currently being under re-work with #2844466: Insert external link on form submit.

I will close this issue as a duplicate. Please feel free to reopen it again if applicable.

anon’s picture

The default behaviour is that the if no text is selected, the href will be used as the content.

There is also another issue for this: please see #2827151: Insert node title instead of # when no link text is selected