Show More
@@ -190,6 +190,22 b' define([' | |||
|
190 | 190 | } |
|
191 | 191 | }; |
|
192 | 192 | |
|
193 | /** | |
|
194 | * unregister the selected preset, | |
|
195 | * | |
|
196 | * return true if preset successfully unregistered | |
|
197 | * false otherwise | |
|
198 | * | |
|
199 | **/ | |
|
200 | CellToolbar.unregister_preset = function(name){ | |
|
201 | if(CellToolbar._presets[name]){ | |
|
202 | delete CellToolbar._presets[name]; | |
|
203 | events.trigger('unregistered_preset.CellToolbar', {name: name}); | |
|
204 | return true | |
|
205 | } | |
|
206 | return false | |
|
207 | } | |
|
208 | ||
|
193 | 209 | |
|
194 | 210 | /** |
|
195 | 211 | * List the names of the presets that are currently registered. |
@@ -134,10 +134,19 b' define([' | |||
|
134 | 134 | var name = data.name; |
|
135 | 135 | select.append($('<option/>').attr('value', name).text(name)); |
|
136 | 136 | }); |
|
137 | this.events.on('unregistered_preset.CellToolbar', function (event, data) { | |
|
138 | if (select.val() === data.name){ | |
|
139 | select.val(''); | |
|
140 | celltoolbar.CellToolbar.global_hide(); | |
|
141 | delete that.notebook.metadata.celltoolbar; | |
|
142 | } | |
|
143 | select.find("option[value='"+name+"']" ).remove(); | |
|
144 | }); | |
|
137 | 145 | // Update select value when a preset is activated. |
|
138 | 146 | this.events.on('preset_activated.CellToolbar', function (event, data) { |
|
139 | if (select.val() !== data.name) | |
|
147 | if (select.val() !== data.name){ | |
|
140 | 148 | select.val(data.name); |
|
149 | } | |
|
141 | 150 | }); |
|
142 | 151 | |
|
143 | 152 | var wrapper = $('<div/>').addClass('btn-group'); |
General Comments 0
You need to be logged in to leave comments.
Login now