Reimplement NW.js escape to close fullscreen without overriding the global escape key

This commit is contained in:
Thomas Weber committed 2021-06-24 22:21:03 -05:00
1 parent a771a39eb5
commit e3a55e5c8b
1 file changed
+5 -4
+5 -4
View File
@@ -582,10 +582,11 @@ class Packager extends EventTarget {
policy.ignore();
nw.Shell.openExternal(url);
});
nw.App.registerGlobalHotKey(new nw.Shortcut({
key: "Escape",
active: () => win.leaveFullscreen()
}));
document.addEventListener("keydown", (e) => {
if (e.key === "Escape" && document.fullscreenElement) {
document.exitFullscreen();
}
});
}
</script>
<script>