prevent double prompt on file drop import
This commit is contained in:
parent
9800cc27c6
commit
47d0faadf2
2 changed files with 5 additions and 0 deletions
|
@ -20,6 +20,10 @@ const PasteInput = {
|
||||||
}, false)
|
}, false)
|
||||||
window.addEventListener('drop', function(e) {
|
window.addEventListener('drop', function(e) {
|
||||||
e = e || window.event
|
e = e || window.event
|
||||||
|
|
||||||
|
// prevent conflict with react-dropzone file uploader
|
||||||
|
if (event.target.id !== 'infovis-canvas') return
|
||||||
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
var coords = Util.pixelsToCoords(Visualize.mGraph, { x: e.clientX, y: e.clientY })
|
var coords = Util.pixelsToCoords(Visualize.mGraph, { x: e.clientX, y: e.clientY })
|
||||||
if (e.dataTransfer.files.length > 0) {
|
if (e.dataTransfer.files.length > 0) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ class ImportDialogBox extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFile = (files, e) => {
|
handleFile = (files, e) => {
|
||||||
|
e.preventDefault() // prevent it from triggering the default drag-drop handler
|
||||||
this.props.onFileAdded(files[0])
|
this.props.onFileAdded(files[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue