Add leave confirmation to upload widget
This commit is contained in:
@@ -96,8 +96,19 @@ const finish_upload = (e) => {
|
|||||||
start_upload()
|
start_upload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const leave_confirmation = e => {
|
||||||
|
if (state === "uploading") {
|
||||||
|
e.preventDefault()
|
||||||
|
e.returnValue = "If you close this page your files will stop uploading. Do you want to continue?"
|
||||||
|
return e.returnValue
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window on:beforeunload={leave_confirmation} />
|
||||||
|
|
||||||
<input
|
<input
|
||||||
bind:this={file_input_field}
|
bind:this={file_input_field}
|
||||||
on:change={file_input_change}
|
on:change={file_input_change}
|
||||||
|
Reference in New Issue
Block a user