Show More
@@ -37,7 +37,6 var IPython = (function (IPython) { | |||||
37 | this.inner_element = $('<div/>').addClass('celltoolbar') |
|
37 | this.inner_element = $('<div/>').addClass('celltoolbar') | |
38 | this.element = $('<div/>').addClass('ctb_hideshow') |
|
38 | this.element = $('<div/>').addClass('ctb_hideshow') | |
39 | .append(this.inner_element); |
|
39 | .append(this.inner_element); | |
40 | this.show(); |
|
|||
41 | }; |
|
40 | }; | |
42 |
|
41 | |||
43 |
|
42 | |||
@@ -250,6 +249,7 var IPython = (function (IPython) { | |||||
250 | // which is probably inner_element |
|
249 | // which is probably inner_element | |
251 | // or this.element. |
|
250 | // or this.element. | |
252 | this.inner_element.empty(); |
|
251 | this.inner_element.empty(); | |
|
252 | this.ui_controls_list = []; | |||
253 |
|
253 | |||
254 | var callbacks = CellToolbar._callback_dict; |
|
254 | var callbacks = CellToolbar._callback_dict; | |
255 | var preset = CellToolbar._ui_controls_list; |
|
255 | var preset = CellToolbar._ui_controls_list; | |
@@ -267,6 +267,7 var IPython = (function (IPython) { | |||||
267 | var local_div = $('<div/>').addClass('button_container'); |
|
267 | var local_div = $('<div/>').addClass('button_container'); | |
268 | try { |
|
268 | try { | |
269 | callback(local_div, this.cell, this); |
|
269 | callback(local_div, this.cell, this); | |
|
270 | this.ui_controls_list.push(key); | |||
270 | } catch (e) { |
|
271 | } catch (e) { | |
271 | console.log("Error in cell toolbar callback " + key, e); |
|
272 | console.log("Error in cell toolbar callback " + key, e); | |
272 | continue; |
|
273 | continue; | |
@@ -274,6 +275,13 var IPython = (function (IPython) { | |||||
274 | // only append if callback succeeded. |
|
275 | // only append if callback succeeded. | |
275 | this.inner_element.append(local_div); |
|
276 | this.inner_element.append(local_div); | |
276 | } |
|
277 | } | |
|
278 | ||||
|
279 | // If there are no controls hide the toolbar. | |||
|
280 | if (this.ui_controls_list.length) { | |||
|
281 | this.show(); | |||
|
282 | } else { | |||
|
283 | this.hide(); | |||
|
284 | } | |||
277 | }; |
|
285 | }; | |
278 |
|
286 | |||
279 |
|
287 |
General Comments 0
You need to be logged in to leave comments.
Login now