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 }"
:style="{ width: outerWidth }"
@fullscreenchange="fullscreenChange"
@keydown="keydown"
>
<ImageEditor
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 */
async deleteCurrent() {
let idx = this.photoswipe.currIndex - this.globalAnchor;