Add callback to fileUploading drag-n-drop
This commit is contained in:
parent
b496ce2ab2
commit
ccc24b93ad
@ -6,7 +6,7 @@ class FileView{
|
|||||||
* @param {Function} doubleClickCallback
|
* @param {Function} doubleClickCallback
|
||||||
* @param {Function} rightClickCallback
|
* @param {Function} rightClickCallback
|
||||||
*/
|
*/
|
||||||
constructor(fileViewElem, doubleClickCallback, rightClickCallback){
|
constructor(fileViewElem, doubleClickCallback, rightClickCallback, fileUploadCallback){
|
||||||
//TODO check all params
|
//TODO check all params
|
||||||
this.parentElem = fileViewElem
|
this.parentElem = fileViewElem
|
||||||
|
|
||||||
@ -33,6 +33,23 @@ class FileView{
|
|||||||
this.Select([event.target])
|
this.Select([event.target])
|
||||||
rightClickCallback(event)
|
rightClickCallback(event)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (fileUploadCallback !== undefined) {
|
||||||
|
fileViewElem.addEventListener('dragenter', function(event) {
|
||||||
|
// console.log("start")
|
||||||
|
})
|
||||||
|
|
||||||
|
fileViewElem.addEventListener('dragover', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
// console.log("over")
|
||||||
|
})
|
||||||
|
|
||||||
|
fileViewElem.addEventListener("drop", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
// console.log(event.dataTransfer.items[0])
|
||||||
|
fileUploadCallback(event.dataTransfer.items)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user