When using Linkit alongside Drupal Link, we get duplicate Edit Link entries in CKEditor's context menu - one is for LinkIt, the other is for Drupal Link. This causes inconsistencies when using CKEditor for modifying links as we want Linkit to be the only option when editing links.

The only way to remove the duplicate menu items is to remove Drupal Link entirely from CKEditor, which causes the Unlink functionality to be removed. Ideally we want the best of both worlds - Linkit with unlinking functionality available.

This patch adds the unlink functionality into LinkIt, so we can remove Drupal Link altogether and avoid the duplicate CKEditor menu entries.

Comments
Comment #2
dave.mikolaj commentedAdding patch
Comment #3
dave.mikolaj commentedComment #5
anonThe new version (8.x-5.x) will not have this issue as its extends the default Drupal Link plugin.
I will not update 4.x anymore so I will close this.
Comment #6
realityloop commentedRerolled patch to properly include unlink icon
note: if you have the anchor_link module enabled you will still get the double menu items.
Comment #7
rootworkI upgraded to 5.x and I'm still seeing this issue.
Comment #8
anon@rootwork - I need more information if you still got the issue.
It shouldn't be there as from now on, Linkit extends the default Drupal Link plugin (which were the duplicate before).
Also, I tried this on a fresh install, and I couldn't reproduce it.
Comment #9
seanpclark commented@anon I've also tested linkit-8.x-5.0-beta5 and it appears to be resolved.
Comment #10
anonComment #11
realityloop commentedI can confirm if you are using other link related icons anchor_link for instance that you will get duplicate popups when double clicking a link.
Comment #12
anonMove this to anchor_link instead.
The issue exists as of the poor naming of the plugin. Its named "link", exact the same as the original link module. That is causing this error.
Comment #13
rajab natshahNot sure why this issue were pushed from Linkit to Anchor link.
Anchor link were developed to help you if you want to manage Anchor links in the CKEditor
No need to use link as you could keep the [Drupal core link] or user other module
Drupal core link is not using the better plug-in
http://ckeditor.com/addon/link
About the Double click .. Its another issue
Default CKEditor command for double click on critical HTML Tags to edit in CKEditor
https://www.drupal.org/node/2832883
This issue could happen with any HTML tag. as if we add 2 CKEditor plugins to the same error, and they handle the img tag. they will have the same issue.
The best way to fix conflicts of "Default CKEditor command for double click" issues. is to have a custom CKEditor filter module. it could be "Default CKEditor command for a tag" or "Default CKEditor right click edit for a tag"
Interesting issue, I wish to have the Default CKEditor command in Drupal core. not in selected modules.
Comment #14
rajab natshahComment #15
dragos-dumi commentedI think the anchor plugin should be separated from the better link plugin.
In my case for example, I enabled the Anchor plugin (button) but I haven't replaced the link buttons with those ones from this module. So I would expect not to interfere with (any chosen) link plugin. I just create an anchor and add #anchor_name using my chosen link plugin.
I see that in this module there's just one plugin with all 3 buttons (anchor, link, unlink) sharing the same plugin.js file, so enabling only the anchor plugin I also get the link widget.
Comment #16
rajab natshahI do agree with Dragos.
Comment #17
basvanderheijden commentedI have confirmed that this problem occurs if you only use the anchor button in your CKEditor. For instance: we use Linkit for the link/unlink buttons and not anchor_link. I've supplied a patch that, for the time being, fixes the problem.
What it does it remove both the context menu (right click) invocation and the doubleclick handler of anchor_link.
Comment #18
basvanderheijden commentedAnd this time also with the plugin link removed.
Comment #19
rajab natshahComment #20
rajab natshahCommitted :)
Comment #21
rajab natshahComment #22
rajab natshahComment #23
rajab natshah