Attempt to stop navigation when there is an edit in progress. This fixes #16

This commit is contained in:
Magnus Hoff 2017-10-28 15:26:50 +02:00
parent 6d56ad0001
commit 3ca84dbb4e

View file

@ -103,6 +103,13 @@ function openEditor() {
form.reset(); form.reset();
} }
}); });
window.addEventListener("beforeunload", function (ev) {
if (isEdited(form)) {
ev.preventDefault();
return ev.returnValue = "Discard changes?";
}
});
} }
document document