##// END OF EJS Templates
Hide the cell toolbar if there are no ui controls in it.
Raffaele De Feo -
Show More
@@ -37,7 +37,6 b' var IPython = (function (IPython) {'
37 37 this.inner_element = $('<div/>').addClass('celltoolbar')
38 38 this.element = $('<div/>').addClass('ctb_hideshow')
39 39 .append(this.inner_element);
40 this.show();
41 40 };
42 41
43 42
@@ -250,6 +249,7 b' var IPython = (function (IPython) {'
250 249 // which is probably inner_element
251 250 // or this.element.
252 251 this.inner_element.empty();
252 this.ui_controls_list = [];
253 253
254 254 var callbacks = CellToolbar._callback_dict;
255 255 var preset = CellToolbar._ui_controls_list;
@@ -267,6 +267,7 b' var IPython = (function (IPython) {'
267 267 var local_div = $('<div/>').addClass('button_container');
268 268 try {
269 269 callback(local_div, this.cell, this);
270 this.ui_controls_list.push(key);
270 271 } catch (e) {
271 272 console.log("Error in cell toolbar callback " + key, e);
272 273 continue;
@@ -274,6 +275,13 b' var IPython = (function (IPython) {'
274 275 // only append if callback succeeded.
275 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