Confirm when the browser window is closed and there is unsaved work (#397)

* - browser confirmation on page exit
- prompt to save a document when closed will only trigger when unsaved

* add back select document for close prompt

* - name -> displayname
- add preventPropigation to middle click
This commit is contained in:
mfish33
2021-12-04 16:49:52 -08:00
committed by Keavon Chambers
parent fc0b951ab6
commit 27da663d83
6 changed files with 56 additions and 12 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
import { createApp } from "vue";
import { fullscreenModeChanged } from "@/utilities/fullscreen";
import { onKeyUp, onKeyDown, onMouseMove, onMouseDown, onMouseUp, onMouseScroll, onWindowResize } from "@/utilities/input";
import { onKeyUp, onKeyDown, onMouseMove, onMouseDown, onMouseUp, onMouseScroll, onWindowResize, onBeforeUnload } from "@/utilities/input";
import "@/utilities/errors";
import App from "@/App.vue";
import { panicProxy } from "@/utilities/panic-proxy";
@@ -21,6 +21,8 @@ const wasm = import("@/../wasm/pkg").then(panicProxy);
window.addEventListener("resize", onWindowResize);
onWindowResize();
window.addEventListener("beforeunload", onBeforeUnload);
document.addEventListener("contextmenu", (e) => e.preventDefault());
document.addEventListener("fullscreenchange", () => fullscreenModeChanged());