From ddbd7aa4fad6c90137f6fe38b6395ef2a6037667 Mon Sep 17 00:00:00 2001 From: Bussonnier Matthias Date: Tue, 16 Dec 2014 17:25:24 +0100 Subject: [PATCH] add ability to unregister a preset fix #7218 --- IPython/html/static/notebook/js/celltoolbar.js | 16 ++++++++++++++++ IPython/html/static/notebook/js/maintoolbar.js | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/IPython/html/static/notebook/js/celltoolbar.js b/IPython/html/static/notebook/js/celltoolbar.js index 03910b2bd..23c8d20da 100644 --- a/IPython/html/static/notebook/js/celltoolbar.js +++ b/IPython/html/static/notebook/js/celltoolbar.js @@ -190,6 +190,22 @@ define([ } }; + /** + * unregister the selected preset, + * + * return true if preset successfully unregistered + * false otherwise + * + **/ + CellToolbar.unregister_preset = function(name){ + if(CellToolbar._presets[name]){ + delete CellToolbar._presets[name]; + events.trigger('unregistered_preset.CellToolbar', {name: name}); + return true + } + return false + } + /** * List the names of the presets that are currently registered. diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index d4d500a70..0d4ae3e2f 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -134,10 +134,19 @@ define([ var name = data.name; select.append($('