From 47d0faadf2dda33610d854804f7b6cee073635bb Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 25 Feb 2017 13:04:00 -0800 Subject: [PATCH] prevent double prompt on file drop import --- frontend/src/Metamaps/PasteInput.js | 4 ++++ frontend/src/components/ImportDialogBox.js | 1 + 2 files changed, 5 insertions(+) diff --git a/frontend/src/Metamaps/PasteInput.js b/frontend/src/Metamaps/PasteInput.js index b72ae545..03a92f86 100644 --- a/frontend/src/Metamaps/PasteInput.js +++ b/frontend/src/Metamaps/PasteInput.js @@ -20,6 +20,10 @@ const PasteInput = { }, false) window.addEventListener('drop', function(e) { e = e || window.event + + // prevent conflict with react-dropzone file uploader + if (event.target.id !== 'infovis-canvas') return + e.preventDefault() var coords = Util.pixelsToCoords(Visualize.mGraph, { x: e.clientX, y: e.clientY }) if (e.dataTransfer.files.length > 0) { diff --git a/frontend/src/components/ImportDialogBox.js b/frontend/src/components/ImportDialogBox.js index 85b3ee67..6c2d7413 100644 --- a/frontend/src/components/ImportDialogBox.js +++ b/frontend/src/components/ImportDialogBox.js @@ -14,6 +14,7 @@ class ImportDialogBox extends Component { } handleFile = (files, e) => { + e.preventDefault() // prevent it from triggering the default drag-drop handler this.props.onFileAdded(files[0]) }