Skip to content

Commit

Permalink
Issue #125: Selecting a linked image should activate both buttons (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoxela authored Jul 18, 2024
1 parent 62a8a3e commit dd6633d
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions js/plugins/backdroplink/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -150,18 +150,6 @@
tooltip: 'Remove link',
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);
}
});
}
});

Expand Down

0 comments on commit dd6633d

Please sign in to comment.