mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
feat: allow to disable preventUnload in dev (#9319)
All checks were successful
Tests / test (push) Successful in 4m36s
All checks were successful
Tests / test (push) Successful in 4m36s
* feat: allow to disable preventUnload in dev * add template
This commit is contained in:
parent
d797c2e210
commit
f2e8404c7b
3 changed files with 17 additions and 2 deletions
|
@ -48,3 +48,6 @@ UNWEjuqNMi/lwAErS9fFa2oJlWyT8U7zzv/5kQREkxZI6y9v0AF3qcbsy2731FnD
|
||||||
s9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot
|
s9ChJvOUW9toIab2gsIdrKW8ZNpu084ZFVKb6LNjvIXI1Se4oMTHeszXzNptzlot
|
||||||
kdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS
|
kdxxjOoaQMAyfljFSot1F1FlU6MQlag7UnFGvFjRHN1JI5q4K+n3a67DX+TMyRqS
|
||||||
HQIDAQAB'
|
HQIDAQAB'
|
||||||
|
|
||||||
|
# set to true in .env.development.local to disable the prevent unload dialog
|
||||||
|
VITE_APP_DISABLE_PREVENT_UNLOAD=
|
||||||
|
|
|
@ -608,7 +608,13 @@ const ExcalidrawWrapper = () => {
|
||||||
excalidrawAPI.getSceneElements(),
|
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);
|
window.addEventListener(EVENT.BEFORE_UNLOAD, unloadHandler);
|
||||||
|
|
|
@ -301,7 +301,13 @@ class Collab extends PureComponent<CollabProps, CollabState> {
|
||||||
// the purpose is to run in immediately after user decides to stay
|
// the purpose is to run in immediately after user decides to stay
|
||||||
this.saveCollabRoomToFirebase(syncableElements);
|
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)",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue