From ef53686e0a642d9e903f7b2e2781c61540104821 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 12 Aug 2023 00:13:17 +0300 Subject: [PATCH] added delete on key press... Signed-off-by: Alex A. Naanou --- grid-n-view.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grid-n-view.js b/grid-n-view.js index a769020..441c8ba 100644 --- a/grid-n-view.js +++ b/grid-n-view.js @@ -171,6 +171,14 @@ var keyboard = { : gallery.unmark_current ? (gallery.current = null) : null }, + Delete: function(evt){ + if(gallery.current){ + var remove = gallery.current + gallery.next() + // XXX this is a bit crude... + gallery.current === remove + && gallery.prev() + gallery.remove(remove) } }, // selection... ' ': function(evt){ gallery.current @@ -728,7 +736,7 @@ var Gallery = { typeof(img) == 'number' ? this.images.at(img)?.remove() : img instanceof Element ? - (this.images.contains(img) + (this.images.includes(img) && img.remove()) : null } return this