Skip to content

Commit 17aa8d0

Browse files
committed
Fix long labels in toolbar
1 parent f2a7325 commit 17aa8d0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/jupyter_contrib_nbextensions/nbextensions/code_prettify/kernel_exec_on_cell.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,31 @@ define([
182182
});
183183
};
184184

185+
185186
KernelExecOnCells.prototype.add_toolbar_button = function() {
186187
if ($('#' + this.mod_name + '_button').length < 1) {
187188
var button_group_id = this.mod_name + '_button';
188189
var that = this;
189190
Jupyter.toolbar.add_buttons_group([{
190-
label: this.cfg.kbd_shortcut_text + ' selected cell(s) (add shift for all cells)',
191+
label: ' ', //space otherwise add_buttons fails -- This label is inserted as a button description AND bubble help
191192
icon: this.cfg.button_icon,
192193
callback: function(evt) {
193194
that.autoformat_cells(
194195
evt.shiftKey ? Jupyter.notebook.get_cells().map(function (cell, idx) { return idx; }) : undefined
195196
);
196197
},
197198
}], button_group_id);
199+
200+
// Correct add_buttons_group default
201+
// Change title --> inserts bubble help
202+
// redefine icon to remove spurious space
203+
var w = $('#'+ button_group_id +' > .btn')[0];
204+
w.title = this.cfg.kbd_shortcut_text + ' selected cell(s) (add shift for all cells)'
205+
w.innerHTML = '<i class="' + this.cfg.button_icon + ' fa"></i>'
198206
}
199-
};
207+
}
208+
209+
200210

201211
KernelExecOnCells.prototype.add_keyboard_shortcuts = function() {
202212
var new_shortcuts = {};

0 commit comments

Comments
 (0)