restore "unsaved changes" warning on unload

Autosave is triggered at this event, but it seems to fail sometimes (perhaps when it's too slow?).

closes #3475
pull/37/head
MinRK 13 years ago
parent 90e2f601b8
commit 09c7bba2b4

@ -345,9 +345,13 @@ var IPython = (function (IPython) {
if (kill_kernel) {
that.kernel.kill();
}
// if we are autosaving, trigger an autosave on nav-away
if (that.dirty && that.autosave_interval && ! that.read_only) {
that.save_notebook();
// if we are autosaving, trigger an autosave on nav-away.
// still warn, because if we don't the autosave may fail.
if (that.dirty && ! that.read_only) {
if ( that.autosave_interval ) {
setTimeout(function() { that.save_notebook(); }, 0);
}
return "Unsaved changes will be lost.";
};
// Null is the *only* return value that will make the browser not
// pop up the "don't leave" dialog.

Loading…
Cancel
Save