diff --git a/.env.development b/.env.development index 5f69de1469..387ab6204d 100644 --- a/.env.development +++ b/.env.development @@ -48,3 +48,6 @@ UNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD s9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot kdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS HQIDAQAB' + +# set to true in .env.development.local to disable the prevent unload dialog +VITE_APP_DISABLE_PREVENT_UNLOAD= diff --git a/excalidraw-app/App.tsx b/excalidraw-app/App.tsx index 60e9b30083..bb62a0e96c 100644 --- a/excalidraw-app/App.tsx +++ b/excalidraw-app/App.tsx @@ -608,7 +608,13 @@ const ExcalidrawWrapper = () => { excalidrawAPI.getSceneElements(), ) ) { - preventUnload(event); + if (import.meta.env.VITE_APP_DISABLE_PREVENT_UNLOAD !== "true") { + preventUnload(event); + } else { + console.warn( + "preventing unload disabled (VITE_APP_DISABLE_PREVENT_UNLOAD)", + ); + } } }; window.addEventListener(EVENT.BEFORE_UNLOAD, unloadHandler); diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx index f6f7630412..98c66e4257 100644 --- a/excalidraw-app/collab/Collab.tsx +++ b/excalidraw-app/collab/Collab.tsx @@ -301,7 +301,13 @@ class Collab extends PureComponent { // the purpose is to run in immediately after user decides to stay this.saveCollabRoomToFirebase(syncableElements); - preventUnload(event); + if (import.meta.env.VITE_APP_DISABLE_PREVENT_UNLOAD !== "true") { + preventUnload(event); + } else { + console.warn( + "preventing unload disabled (VITE_APP_DISABLE_PREVENT_UNLOAD)", + ); + } } });