Automatically jumps to the next photo when deleting while previewing.

This commit is contained in:
chief 2020-11-04 21:13:45 -05:00
parent d562d1a60d
commit c984771de7
5 changed files with 16 additions and 3 deletions

View File

@ -135,7 +135,7 @@ export default {
to: this.url + this.req.items[i].name, to: this.url + this.req.items[i].name,
name: this.req.items[i].name name: this.req.items[i].name
}) })
} }
let base = el.querySelector('.name').innerHTML + '/' let base = el.querySelector('.name').innerHTML + '/'
let path = this.$route.path + base let path = this.$route.path + base

View File

@ -147,6 +147,7 @@ export default {
methods: { methods: {
back () { back () {
this.$store.commit('setPreviewMode', false) this.$store.commit('setPreviewMode', false)
this.$store.commit('postDeleteLink', null)
let uri = url.removeLastDir(this.$route.path) + '/' let uri = url.removeLastDir(this.$route.path) + '/'
this.$router.push({ path: uri }) this.$router.push({ path: uri })
}, },
@ -205,6 +206,7 @@ export default {
for (let j = i + 1; j < this.listing.length; j++) { for (let j = i + 1; j < this.listing.length; j++) {
if (mediaTypes.includes(this.listing[j].type)) { if (mediaTypes.includes(this.listing[j].type)) {
this.nextLink = this.listing[j].url this.nextLink = this.listing[j].url
this.$store.commit('postDeleteLink', this.nextLink);
break break
} }
} }

View File

@ -39,7 +39,14 @@ export default {
if (!this.isListing) { if (!this.isListing) {
await api.remove(this.$route.path) await api.remove(this.$route.path)
buttons.success('delete') buttons.success('delete')
this.$router.push({ path: url.removeLastDir(this.$route.path) + '/' }) let path = url.removeLastDir(this.$route.path) + '/'
if (this.$store.state.postDeleteLink != null) {
path = this.$store.state.postDeleteLink;
this.$store.commit('postDeleteLink', null);
}
this.$router.push({ path: path })
return return
} }

View File

@ -24,7 +24,8 @@ const state = {
showShell: false, showShell: false,
showMessage: null, showMessage: null,
showConfirm: null, showConfirm: null,
previewMode: false previewMode: false,
postDeleteLink: null
} }
export default new Vuex.Store({ export default new Vuex.Store({

View File

@ -86,6 +86,9 @@ const mutations = {
}, },
setPreviewMode(state, value) { setPreviewMode(state, value) {
state.previewMode = value state.previewMode = value
},
postDeleteLink: (state, value) => {
state.postDeleteLink = value
} }
} }