viewer: delete with Del key (fix #313)

pull/363/head
Varun Patil 2023-01-15 15:45:57 -08:00
parent b9e65aa2e3
commit 6b9f50ab31
1 changed files with 13 additions and 1 deletions

View File

@ -5,6 +5,7 @@
:class="{ fullyOpened, slideshowTimer }" :class="{ fullyOpened, slideshowTimer }"
:style="{ width: outerWidth }" :style="{ width: outerWidth }"
@fullscreenchange="fullscreenChange" @fullscreenchange="fullscreenChange"
@keydown="keydown"
> >
<ImageEditor <ImageEditor
v-if="editorOpen" v-if="editorOpen"
@ -905,6 +906,17 @@ export default defineComponent({
} }
}, },
/** Key press events */
keydown(e: KeyboardEvent) {
if (
e.key === "Delete" &&
!this.routeIsPublic &&
confirm(this.t("memories", "Are you sure you want to delete?"))
) {
this.deleteCurrent();
}
},
/** Delete this photo and refresh */ /** Delete this photo and refresh */
async deleteCurrent() { async deleteCurrent() {
let idx = this.photoswipe.currIndex - this.globalAnchor; let idx = this.photoswipe.currIndex - this.globalAnchor;