From a0899966ff489a2aaaa8ed2cf20b186d05867de8 Mon Sep 17 00:00:00 2001 From: Thang Vu <31528554+ThangHuuVu@users.noreply.github.com> Date: Tue, 6 Apr 2021 22:17:00 +0700 Subject: [PATCH] feat: enable drop event on the whole component (#3406) Co-authored-by: Thang Vu --- src/components/App.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 5bb8d1c1..a2118d91 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -409,7 +409,6 @@ class App extends React.Component { onPointerUp={this.removePointer} onPointerCancel={this.removePointer} onTouchMove={this.handleTouchMove} - onDrop={this.handleCanvasOnDrop} > {t("labels.drawingCanvas")} @@ -440,6 +439,7 @@ class App extends React.Component { "excalidraw--view-mode": viewModeEnabled, })} ref={this.excalidrawContainerRef} + onDrop={this.handleAppOnDrop} > { } }; - private handleCanvasOnDrop = async ( - event: React.DragEvent, - ) => { + private handleAppOnDrop = async (event: React.DragEvent) => { try { const file = event.dataTransfer.files[0]; if (file?.type === "image/png" || file?.type === "image/svg+xml") {