mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #4569 from minrk/persist-celltoolbar
store cell toolbar preset in notebook metadata
This commit is contained in:
commit
2a2a5d5a53
@ -214,7 +214,7 @@ var IPython = (function (IPython) {
|
|||||||
*
|
*
|
||||||
* CellToolbar.activate_preset('foo.foo_preset1');
|
* CellToolbar.activate_preset('foo.foo_preset1');
|
||||||
*/
|
*/
|
||||||
CellToolbar.activate_preset= function(preset_name){
|
CellToolbar.activate_preset = function(preset_name){
|
||||||
var preset = CellToolbar._presets[preset_name];
|
var preset = CellToolbar._presets[preset_name];
|
||||||
|
|
||||||
if(preset != undefined){
|
if(preset != undefined){
|
||||||
|
@ -147,9 +147,11 @@ var IPython = (function (IPython) {
|
|||||||
var val = $(this).val()
|
var val = $(this).val()
|
||||||
if (val =='') {
|
if (val =='') {
|
||||||
IPython.CellToolbar.global_hide();
|
IPython.CellToolbar.global_hide();
|
||||||
|
delete IPython.notebook.metadata.celltoolbar;
|
||||||
} else {
|
} else {
|
||||||
IPython.CellToolbar.global_show();
|
IPython.CellToolbar.global_show();
|
||||||
IPython.CellToolbar.activate_preset(val);
|
IPython.CellToolbar.activate_preset(val);
|
||||||
|
IPython.notebook.metadata.celltoolbar = val;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Setup the currently registered presets.
|
// Setup the currently registered presets.
|
||||||
|
@ -1958,7 +1958,14 @@ var IPython = (function (IPython) {
|
|||||||
this.start_session();
|
this.start_session();
|
||||||
}
|
}
|
||||||
// load our checkpoint list
|
// load our checkpoint list
|
||||||
IPython.notebook.list_checkpoints();
|
this.list_checkpoints();
|
||||||
|
|
||||||
|
// load toolbar state
|
||||||
|
if (this.metadata.celltoolbar) {
|
||||||
|
IPython.CellToolbar.global_show();
|
||||||
|
IPython.CellToolbar.activate_preset(this.metadata.celltoolbar);
|
||||||
|
}
|
||||||
|
|
||||||
$([IPython.events]).trigger('notebook_loaded.Notebook');
|
$([IPython.events]).trigger('notebook_loaded.Notebook');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user