diff --git a/assets/src/components/Header.vue b/assets/src/components/Header.vue
index aa30a5d5..9f9b2a77 100644
--- a/assets/src/components/Header.vue
+++ b/assets/src/components/Header.vue
@@ -38,6 +38,7 @@
+
@@ -88,6 +90,7 @@ import UploadButton from './buttons/Upload'
import DownloadButton from './buttons/Download'
import SwitchButton from './buttons/SwitchView'
import MoveButton from './buttons/Move'
+import CopyButton from './buttons/Copy'
import {mapGetters, mapState} from 'vuex'
import api from '@/utils/api'
import buttons from '@/utils/buttons'
@@ -100,6 +103,7 @@ export default {
DeleteButton,
RenameButton,
DownloadButton,
+ CopyButton,
UploadButton,
SwitchButton,
MoveButton
diff --git a/assets/src/components/Listing.vue b/assets/src/components/Listing.vue
index 1f7158ae..c2d69e24 100644
--- a/assets/src/components/Listing.vue
+++ b/assets/src/components/Listing.vue
@@ -82,7 +82,7 @@ export default {
name: 'listing',
components: { Item },
computed: {
- ...mapState(['req']),
+ ...mapState(['req', 'selected']),
nameSorted () {
return (this.req.sort === 'name')
},
@@ -130,17 +130,69 @@ export default {
return
}
- if (String.fromCharCode(event.which).toLowerCase() !== 'f') {
- return
- }
+ let key = String.fromCharCode(event.which).toLowerCase()
- event.preventDefault()
- this.$store.commit('showHover', 'search')
+ switch (key) {
+ case 'f':
+ event.preventDefault()
+ this.$store.commit('showHover', 'search')
+ break
+ case 'c':
+ case 'x':
+ this.copyCut(event, key)
+ break
+ case 'v':
+ this.paste(event)
+ break
+ }
},
preventDefault (event) {
// Wrapper around prevent default.
event.preventDefault()
},
+ copyCut (event, key) {
+ event.preventDefault()
+ let items = []
+
+ for (let i of this.selected) {
+ items.push({
+ from: this.req.items[i].url,
+ name: encodeURIComponent(this.req.items[i].name)
+ })
+ }
+
+ this.$store.commit('updateClipboard', {
+ key: key,
+ items: items
+ })
+ },
+ paste (event) {
+ event.preventDefault()
+
+ let items = []
+
+ for (let item of this.$store.state.clipboard.items) {
+ items.push({
+ from: item.from,
+ to: this.$route.path + item.name
+ })
+ }
+
+ if (this.$store.state.clipboard.key === 'x') {
+ api.move(items).then(() => {
+ this.$store.commit('setReload', true)
+ }).catch(error => {
+ this.$store.commit('showError', error)
+ })
+ return
+ }
+
+ api.copy(items).then(() => {
+ this.$store.commit('setReload', true)
+ }).catch(error => {
+ this.$store.commit('showError', error)
+ })
+ },
resizeEvent () {
// Update the columns size based on the window width.
let columns = Math.floor(document.querySelector('main').offsetWidth / 300)
diff --git a/assets/src/components/ListingItem.vue b/assets/src/components/ListingItem.vue
index 52f05444..20f13db2 100644
--- a/assets/src/components/ListingItem.vue
+++ b/assets/src/components/ListingItem.vue
@@ -92,16 +92,16 @@ export default {
if (this.selectedCount === 0) return
- let promises = []
+ let items = []
for (let i of this.selected) {
- let url = this.req.items[i].url
- let name = this.req.items[i].name
-
- promises.push(api.move(url, this.url + encodeURIComponent(name)))
+ items.push({
+ from: this.req.items[i].url,
+ to: this.url + encodeURIComponent(this.req.items[i].name)
+ })
}
- Promise.all(promises)
+ api.move(items)
.then(() => {
this.$store.commit('setReload', true)
})
diff --git a/assets/src/components/buttons/Copy.vue b/assets/src/components/buttons/Copy.vue
new file mode 100644
index 00000000..9ee554a4
--- /dev/null
+++ b/assets/src/components/buttons/Copy.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
diff --git a/assets/src/components/prompts/Copy.vue b/assets/src/components/prompts/Copy.vue
new file mode 100644
index 00000000..184182f6
--- /dev/null
+++ b/assets/src/components/prompts/Copy.vue
@@ -0,0 +1,58 @@
+
+
+
Copy
+
Choose the place to copy your files:
+
+
dest = val">
+
+
+
+
+
+
+
+
+
diff --git a/assets/src/components/prompts/FileList.vue b/assets/src/components/prompts/FileList.vue
new file mode 100644
index 00000000..52864096
--- /dev/null
+++ b/assets/src/components/prompts/FileList.vue
@@ -0,0 +1,137 @@
+
+
+
+
+
Currently navigating on: {{ nav }}
.
+
+
+
+
diff --git a/assets/src/components/prompts/Move.vue b/assets/src/components/prompts/Move.vue
index 122b0d4e..ebfb7ad2 100644
--- a/assets/src/components/prompts/Move.vue
+++ b/assets/src/components/prompts/Move.vue
@@ -3,16 +3,7 @@
Move
Choose new house for your file(s)/folder(s):
-
-
-
Currently navigating on: {{ current }}
.
+
dest = val">
@@ -23,145 +14,46 @@