diff --git a/frontend/src/components/files/Preview.vue b/frontend/src/components/files/Preview.vue index 1a8435b0..f72ad38b 100644 --- a/frontend/src/components/files/Preview.vue +++ b/frontend/src/components/files/Preview.vue @@ -133,16 +133,29 @@ export default { } }, async mounted () { - window.addEventListener('keyup', this.key) + window.addEventListener('keydown', this.key) this.$store.commit('setPreviewMode', true) this.listing = this.oldReq.items + this.$root.$on('preview-deleted', this.deleted) this.updatePreview() }, beforeDestroy () { - window.removeEventListener('keyup', this.key) + window.removeEventListener('keydown', this.key) this.$store.commit('setPreviewMode', false) + this.$root.$off('preview-deleted', this.deleted) }, methods: { + deleted () { + this.listing = this.listing.filter(item => item.name !== this.name) + + if (this.hasNext) { + this.next() + } else if (!this.hasPrevious && !this.hasNext) { + this.back() + } else { + this.prev() + } + }, back () { this.$store.commit('setPreviewMode', false) let uri = url.removeLastDir(this.$route.path) + '/' @@ -155,7 +168,6 @@ export default { this.$router.push({ path: this.nextLink }) }, key (event) { - event.preventDefault() if (this.show !== null) { return diff --git a/frontend/src/components/prompts/Delete.vue b/frontend/src/components/prompts/Delete.vue index 96ec85ad..67cbb33e 100644 --- a/frontend/src/components/prompts/Delete.vue +++ b/frontend/src/components/prompts/Delete.vue @@ -20,7 +20,6 @@