From aef8eabc40d2b3dfff75ef81d6455b47eabb7746 Mon Sep 17 00:00:00 2001 From: indigoxela Date: Thu, 18 Jul 2024 09:14:56 +0200 Subject: [PATCH] Issue #125: Selecting a linked image should activate both buttons --- js/plugins/backdroplink/plugin.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/js/plugins/backdroplink/plugin.js b/js/plugins/backdroplink/plugin.js index 1070fe2..d3fc7b0 100644 --- a/js/plugins/backdroplink/plugin.js +++ b/js/plugins/backdroplink/plugin.js @@ -136,7 +136,7 @@ editor.on('SelectionChange', function () { let node = editor.selection.getNode(); // The anchor plugin marks its links as not editable. - if (node.nodeName === 'A' && node.isContentEditable) { + if (node.isContentEditable && (node.nodeName === 'A' || node.parentNode.nodeName === 'A')) { api.setActive(true); } else { @@ -151,18 +151,6 @@ onAction: function () { editor.execCommand('unlink'); }, - onSetup: function (api) { - api.setEnabled(false); - editor.on('SelectionChange', function () { - let node = editor.selection.getNode(); - if (node.nodeName === 'A' || node.parentNode.nodeName === 'A') { - api.setEnabled(true); - } - else { - api.setEnabled(false); - } - }); - } }); editor.ui.registry.addMenuItem('backdroplink', {