If items are highlighted, 'd' deletes them instead of the selected item

This commit is contained in:
Ian Gulliver
2019-07-14 03:35:51 +00:00
parent 5f0d7750d4
commit bcdeff2244

View File

@@ -60,6 +60,19 @@ class Editor extends List {
return this.getEntries(type).length > limits[0];
}
deleteSelected() {
let highlight = this.queryEntries('.highlight', EditorNode);
if (highlight.length == 0) {
return super.deleteSelected();
}
for (let obj of highlight) {
if (this.mayDelete(obj.constructor)) {
obj.remove();
}
}
}
addNodeAfter(...rest) {
if (this.mayAdd(EditorNode)) {
return EditorNode.addAfter(this.container_, this.getSelected(), ...rest);