mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Added close and halt to the action menu and exposed function
This commit is contained in:
parent
e250b0b7bf
commit
6162ca9570
@ -694,6 +694,13 @@ define([
|
|||||||
// Execute a CM command
|
// Execute a CM command
|
||||||
selected_cell.code_mirror.execCommand('indentAuto');
|
selected_cell.code_mirror.execCommand('indentAuto');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'close-and-halt': {
|
||||||
|
cmd: i18n.msg._('shutdown kernel and close window'),
|
||||||
|
help : i18n.msg._('shutdown kernel and close window'),
|
||||||
|
handler : function(env) {
|
||||||
|
env.notebook.close_and_halt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -232,15 +232,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.element.find('#kill_and_exit').click(function () {
|
this.element.find('#kill_and_exit').click(function () {
|
||||||
var close_window = function () {
|
that.notebook.close_and_halt();
|
||||||
/**
|
|
||||||
* allow closing of new tabs in Chromium, impossible in FF
|
|
||||||
*/
|
|
||||||
window.open('', '_self', '');
|
|
||||||
window.close();
|
|
||||||
};
|
|
||||||
// finish with close on success or failure
|
|
||||||
that.notebook.session.delete(close_window, close_window);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// View
|
// View
|
||||||
@ -252,7 +244,7 @@ define([
|
|||||||
notebook: that.notebook,
|
notebook: that.notebook,
|
||||||
keyboard_manager: that.notebook.keyboard_manager});
|
keyboard_manager: that.notebook.keyboard_manager});
|
||||||
});
|
});
|
||||||
|
|
||||||
var id_actions_dict = {
|
var id_actions_dict = {
|
||||||
'#trust_notebook' : 'trust-notebook',
|
'#trust_notebook' : 'trust-notebook',
|
||||||
'#rename_notebook' : 'rename-notebook',
|
'#rename_notebook' : 'rename-notebook',
|
||||||
|
@ -2392,13 +2392,29 @@ define([
|
|||||||
button.click = function () {
|
button.click = function () {
|
||||||
promise.then(click);
|
promise.then(click);
|
||||||
do_kernel_action();
|
do_kernel_action();
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
options.dialog.buttons = buttons;
|
options.dialog.buttons = buttons;
|
||||||
dialog.modal(options.dialog);
|
dialog.modal(options.dialog);
|
||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Halt the kernel and close the notebook window
|
||||||
|
*/
|
||||||
|
Notebook.prototype.close_and_halt = function () {
|
||||||
|
var close_window = function () {
|
||||||
|
/**
|
||||||
|
* allow closing of new tabs in Chromium, impossible in FF
|
||||||
|
*/
|
||||||
|
window.open('', '_self', '');
|
||||||
|
window.close();
|
||||||
|
};
|
||||||
|
// finish with close on success or failure
|
||||||
|
this.session.delete(close_window, close_window);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute cells corresponding to the given indices.
|
* Execute cells corresponding to the given indices.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user