Make drag&drop work on more browsers/platforms, make the Upload button accept drops as well.
This commit is contained in:
parent
ca71722c1e
commit
6c385ae80a
4 changed files with 19 additions and 2 deletions
|
@ -33,6 +33,20 @@ const mediaUpload = {
|
|||
self.$emit('upload-failed')
|
||||
self.uploading = false
|
||||
})
|
||||
},
|
||||
fileDrop (e) {
|
||||
if(e.dataTransfer.files.length > 0) {
|
||||
e.preventDefault() // allow dropping text like before
|
||||
this.uploadFile(e.dataTransfer.files[0])
|
||||
}
|
||||
},
|
||||
fileDrag (e) {
|
||||
let types = e.dataTransfer.types
|
||||
if(types.contains('Files')) {
|
||||
e.dataTransfer.dropEffect = 'copy'
|
||||
} else {
|
||||
e.dataTransfer.dropEffect = 'none'
|
||||
}
|
||||
}
|
||||
},
|
||||
props: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue