feat: duplicate files in the same directory

pull/1026/head
Ramires Viana 2020-07-16 19:50:00 +00:00
parent 2636f876ab
commit 43526d9d1a
3 changed files with 23 additions and 2 deletions

View File

@ -248,7 +248,8 @@ export default {
this.$store.commit('updateClipboard', {
key: key,
items: items
items: items,
path: this.$route.path
})
},
paste (event) {
@ -282,6 +283,12 @@ export default {
}
}
if (this.$store.state.clipboard.path == this.$route.path) {
action(false, true)
return
}
let conflict = upload.checkConflict(items, this.req.items)
let overwrite = false

View File

@ -16,7 +16,6 @@
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
<button class="button button--flat"
@click="copy"
:disabled="$route.path === dest"
:aria-label="$t('buttons.copy')"
:title="$t('buttons.copy')">{{ $t('buttons.copy') }}</button>
</div>
@ -59,6 +58,13 @@ export default {
await api.copy(items, overwrite, rename).then(() => {
buttons.success('copy')
if (this.$route.path === this.dest) {
this.$store.commit('setReload', true)
return
}
this.$router.push({ path: this.dest })
}).catch((e) => {
buttons.done('copy')
@ -66,6 +72,13 @@ export default {
})
}
if (this.$route.path === this.dest) {
this.$store.commit('closeHovers')
action(false, true)
return
}
let dstItems = (await api.fetch(this.dest)).items
let conflict = upload.checkConflict(items, dstItems)

View File

@ -78,6 +78,7 @@ const mutations = {
updateClipboard: (state, value) => {
state.clipboard.key = value.key
state.clipboard.items = value.items
state.clipboard.path = value.path
},
resetClipboard: (state) => {
state.clipboard.key = ''