From bcdeff2244a977b70aab2fb622f8dbbe6d942922 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sun, 14 Jul 2019 03:35:51 +0000 Subject: [PATCH] If items are highlighted, 'd' deletes them instead of the selected item --- Editor.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Editor.js b/Editor.js index c875233..624416c 100644 --- a/Editor.js +++ b/Editor.js @@ -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);