mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-18 11:55:46 +08:00
Merge pull request #875 from minrk/set_next_input_clear_optional
add clear_output option to set_next_input payload
This commit is contained in:
commit
dc3dae96b6
@ -43,6 +43,7 @@ UI changes:
|
||||
Other improvements:
|
||||
|
||||
- Custom KernelManager methods can be Tornado coroutines, allowing async operations.
|
||||
- Make clearing output optional when rewriting input with ``set_next_input(replace=True)``.
|
||||
- Added support for TLS client authentication via ``--NotebookApp.client-ca``.
|
||||
- Added tags to ``jupyter/notebook`` releases on DockerHub. ``latest`` continues to track the master branch.
|
||||
|
||||
|
@ -385,7 +385,12 @@ define([
|
||||
* @private
|
||||
*/
|
||||
CodeCell.prototype._handle_set_next_input = function (payload) {
|
||||
var data = {'cell': this, 'text': payload.text, replace: payload.replace};
|
||||
var data = {
|
||||
cell: this,
|
||||
text: payload.text,
|
||||
replace: payload.replace,
|
||||
clear_output: payload.clear_output,
|
||||
};
|
||||
this.events.trigger('set_next_input.Notebook', data);
|
||||
};
|
||||
|
||||
|
@ -197,7 +197,10 @@ define(function (require) {
|
||||
this.events.on('set_next_input.Notebook', function (event, data) {
|
||||
if (data.replace) {
|
||||
data.cell.set_text(data.text);
|
||||
data.cell.clear_output();
|
||||
if (data.clear_output !== false) {
|
||||
// default (undefined) is true to preserve prior behavior
|
||||
data.cell.clear_output();
|
||||
}
|
||||
} else {
|
||||
var index = that.find_cell_index(data.cell);
|
||||
var new_cell = that.insert_cell_below('code',index);
|
||||
|
Loading…
Reference in New Issue
Block a user