Skip to content

Commit dd6633d

Browse files
authored
Issue #125: Selecting a linked image should activate both buttons (#126)
1 parent 62a8a3e commit dd6633d

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

js/plugins/backdroplink/plugin.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
editor.on('SelectionChange', function () {
137137
let node = editor.selection.getNode();
138138
// The anchor plugin marks its links as not editable.
139-
if (node.nodeName === 'A' && node.isContentEditable) {
139+
if (node.isContentEditable && (node.nodeName === 'A' || node.parentNode.nodeName === 'A')) {
140140
api.setActive(true);
141141
}
142142
else {
@@ -150,18 +150,6 @@
150150
tooltip: 'Remove link',
151151
onAction: function () {
152152
editor.execCommand('unlink');
153-
},
154-
onSetup: function (api) {
155-
api.setEnabled(false);
156-
editor.on('SelectionChange', function () {
157-
let node = editor.selection.getNode();
158-
if (node.nodeName === 'A' || node.parentNode.nodeName === 'A') {
159-
api.setEnabled(true);
160-
}
161-
else {
162-
api.setEnabled(false);
163-
}
164-
});
165153
}
166154
});
167155

0 commit comments

Comments
 (0)