Protect window from accidental closure if the notebook is not empty as it is not saved
This commit is contained in:
parent
301c3fec7e
commit
11e3cd81ce
Binary file not shown.
|
|
@ -177,8 +177,17 @@
|
|||
scrollInterval = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
function handleBeforeUnload(event: BeforeUnloadEvent) {
|
||||
if (inputContent.length > 0) {
|
||||
event.preventDefault();
|
||||
event.returnValue = '';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window onbeforeunload={handleBeforeUnload} />
|
||||
|
||||
<div class="flex h-full flex-col">
|
||||
<header
|
||||
class="flex items-center justify-between border-b border-border/40 bg-background/95 px-6 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/60"
|
||||
|
|
|
|||
Loading…
Reference in New Issue