diff --git a/src/components/App.tsx b/src/components/App.tsx index a9d50b48..83d7b480 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -3570,7 +3570,9 @@ class App extends React.Component { } }; - private handleCanvasOnDrop = (event: React.DragEvent) => { + private handleCanvasOnDrop = async ( + event: React.DragEvent, + ) => { const libraryShapes = event.dataTransfer.getData( "application/vnd.excalidrawlib+json", ); @@ -3589,6 +3591,19 @@ class App extends React.Component { file?.name.endsWith(".excalidraw") ) { this.setState({ isLoading: true }); + if ( + "chooseFileSystemEntries" in window || + "showOpenFilePicker" in window + ) { + try { + // This will only work as of Chrome 86, + // but can be safely ignored on older releases. + const item = event.dataTransfer.items[0]; + (window as any).handle = await (item as any).getAsFileSystemHandle(); + } catch (error) { + console.warn(error.name, error.message); + } + } loadFromBlob(file, this.state) .then(({ elements, appState }) => this.syncActionResult({