mirror of
https://github.com/excalidraw/excalidraw.git
synced 2024-11-02 03:25:53 +01:00
feat: enable drop event on the whole component (#3406)
Co-authored-by: Thang Vu <thang.huu.vu@mgm-tp.com>
This commit is contained in:
parent
c2b40dff92
commit
a0899966ff
@ -409,7 +409,6 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
onPointerUp={this.removePointer}
|
onPointerUp={this.removePointer}
|
||||||
onPointerCancel={this.removePointer}
|
onPointerCancel={this.removePointer}
|
||||||
onTouchMove={this.handleTouchMove}
|
onTouchMove={this.handleTouchMove}
|
||||||
onDrop={this.handleCanvasOnDrop}
|
|
||||||
>
|
>
|
||||||
{t("labels.drawingCanvas")}
|
{t("labels.drawingCanvas")}
|
||||||
</canvas>
|
</canvas>
|
||||||
@ -440,6 +439,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
"excalidraw--view-mode": viewModeEnabled,
|
"excalidraw--view-mode": viewModeEnabled,
|
||||||
})}
|
})}
|
||||||
ref={this.excalidrawContainerRef}
|
ref={this.excalidrawContainerRef}
|
||||||
|
onDrop={this.handleAppOnDrop}
|
||||||
>
|
>
|
||||||
<LayerUI
|
<LayerUI
|
||||||
canvas={this.canvas}
|
canvas={this.canvas}
|
||||||
@ -3584,9 +3584,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleCanvasOnDrop = async (
|
private handleAppOnDrop = async (event: React.DragEvent<HTMLDivElement>) => {
|
||||||
event: React.DragEvent<HTMLCanvasElement>,
|
|
||||||
) => {
|
|
||||||
try {
|
try {
|
||||||
const file = event.dataTransfer.files[0];
|
const file = event.dataTransfer.files[0];
|
||||||
if (file?.type === "image/png" || file?.type === "image/svg+xml") {
|
if (file?.type === "image/png" || file?.type === "image/svg+xml") {
|
||||||
|
Loading…
Reference in New Issue
Block a user