added delete on key press...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-08-12 00:13:17 +03:00
parent e061166600
commit ef53686e0a

View File

@ -171,6 +171,14 @@ var keyboard = {
: gallery.unmark_current ? : gallery.unmark_current ?
(gallery.current = null) (gallery.current = null)
: 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... // selection...
' ': function(evt){ ' ': function(evt){
gallery.current gallery.current
@ -728,7 +736,7 @@ var Gallery = {
typeof(img) == 'number' ? typeof(img) == 'number' ?
this.images.at(img)?.remove() this.images.at(img)?.remove()
: img instanceof Element ? : img instanceof Element ?
(this.images.contains(img) (this.images.includes(img)
&& img.remove()) && img.remove())
: null } : null }
return this return this