Skip to content

Commit

Permalink
Issue #125: Selecting a linked image should activate both buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoxela committed Jul 18, 2024
1 parent 62a8a3e commit aef8eab
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 @@ -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', {
Expand Down

0 comments on commit aef8eab

Please sign in to comment.