File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
src/jupyter_contrib_nbextensions/nbextensions/code_prettify Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -185,8 +185,16 @@ define([
185
185
KernelExecOnCells . prototype . add_toolbar_button = function ( ) {
186
186
if ( $ ( '#' + this . mod_name + '_button' ) . length < 1 ) {
187
187
var button_group_id = this . mod_name + '_button' ;
188
- Jupyter . toolbar . add_buttons_group (
189
- [ this . cfg . actions . process_selected . name ] , button_group_id ) ;
188
+ var that = this ;
189
+ Jupyter . toolbar . add_buttons_group ( [ {
190
+ label : this . cfg . kbd_shortcut_text + ' selected cell(s) (add shift for all cells)' ,
191
+ icon : this . cfg . button_icon ,
192
+ callback : function ( evt ) {
193
+ that . autoformat_cells (
194
+ evt . shiftKey ? Jupyter . notebook . get_cells ( ) . map ( function ( cell , idx ) { return idx ; } ) : undefined
195
+ ) ;
196
+ } ,
197
+ } ] , button_group_id ) ;
190
198
}
191
199
} ;
192
200
@@ -224,12 +232,7 @@ define([
224
232
help_index : 'yf' ,
225
233
icon : that . cfg . button_icon ,
226
234
handler : function ( evt ) {
227
- var indices = [ ] ,
228
- N = Jupyter . notebook . ncells ( ) ;
229
- for ( var i = 0 ; i < N ; i ++ ) {
230
- indices . push ( i ) ;
231
- }
232
- that . autoformat_cells ( indices ) ;
235
+ that . autoformat_cells ( Jupyter . notebook . get_cells ( ) . map ( function ( cell , idx ) { return idx ; } ) ) ;
233
236
} ,
234
237
} ;
235
238
You can’t perform that action at this time.
0 commit comments