From 64a09d767f796a2cbd68751f093de72e1f6a0c56 2013-11-28 15:06:36 From: Matthias Bussonnier Date: 2013-11-28 15:06:36 Subject: [PATCH] Merge pull request #4569 from minrk/persist-celltoolbar store cell toolbar preset in notebook metadata --- diff --git a/IPython/html/static/notebook/js/celltoolbar.js b/IPython/html/static/notebook/js/celltoolbar.js index 9c43f0d..74186b1 100644 --- a/IPython/html/static/notebook/js/celltoolbar.js +++ b/IPython/html/static/notebook/js/celltoolbar.js @@ -214,7 +214,7 @@ var IPython = (function (IPython) { * * CellToolbar.activate_preset('foo.foo_preset1'); */ - CellToolbar.activate_preset= function(preset_name){ + CellToolbar.activate_preset = function(preset_name){ var preset = CellToolbar._presets[preset_name]; if(preset != undefined){ diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index b266229..b17f04a 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -147,9 +147,11 @@ var IPython = (function (IPython) { var val = $(this).val() if (val =='') { IPython.CellToolbar.global_hide(); + delete IPython.notebook.metadata.celltoolbar; } else { IPython.CellToolbar.global_show(); IPython.CellToolbar.activate_preset(val); + IPython.notebook.metadata.celltoolbar = val; } }); // Setup the currently registered presets. diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 67a27a7..5f53e1b 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1958,7 +1958,14 @@ var IPython = (function (IPython) { this.start_session(); } // 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'); };