@@ -25,7 +25,9 @@ define(['jquery', 'require'], function ($, require) {
25
25
use_shortcuts : true ,
26
26
shortcuts : {
27
27
collapse : 'left' ,
28
+ collapse_all : 'ctrl-shift-left' ,
28
29
uncollapse : 'right' ,
30
+ uncollapse_all : 'ctrl-shift-right' ,
29
31
select : 'shift-right' ,
30
32
insert_above : 'shift-a' ,
31
33
insert_below : 'shift-b' ,
@@ -644,6 +646,27 @@ define(['jquery', 'require'], function ($, require) {
644
646
'collapse_heading' , mod_name
645
647
) ;
646
648
649
+ action_names . collapse_all = Jupyter . keyboard_manager . actions . register ( {
650
+ handler : function ( env ) {
651
+ env . notebook . get_cells ( ) . forEach ( function ( c , idx , arr ) {
652
+ toggle_heading ( c , true ) ;
653
+ } ) ;
654
+ var cell = env . notebook . get_selected_cell ( ) ;
655
+ if ( cell . element . is ( ':hidden' ) ) {
656
+ cell = find_header_cell ( cell , function ( c ) { return c . element . is ( ':visible' ) ; } ) ;
657
+ if ( cell !== undefined ) {
658
+ Jupyter . notebook . select ( Jupyter . notebook . find_cell_index ( cell ) ) ;
659
+ cell . focus_cell ( ) ;
660
+ }
661
+ }
662
+ } ,
663
+ help : "Collapse all heading cells' sections" ,
664
+ icon : params . toggle_closed_icon ,
665
+ help_index : 'c2'
666
+ } ,
667
+ 'collapse_all_headings' , mod_name
668
+ ) ;
669
+
647
670
action_names . uncollapse = Jupyter . keyboard_manager . actions . register ( {
648
671
handler : function ( env ) {
649
672
var cell = env . notebook . get_selected_cell ( ) ;
@@ -664,11 +687,25 @@ define(['jquery', 'require'], function ($, require) {
664
687
} ,
665
688
help : "Un-collapse (expand) the selected heading cell's section" ,
666
689
icon : params . toggle_open_icon ,
667
- help_index : 'c2 '
690
+ help_index : 'c3 '
668
691
} ,
669
692
'uncollapse_heading' , mod_name
670
693
) ;
671
694
695
+ action_names . uncollapse_all = Jupyter . keyboard_manager . actions . register ( {
696
+ handler : function ( env ) {
697
+ env . notebook . get_cells ( ) . forEach ( function ( c , idx , arr ) {
698
+ toggle_heading ( c , false ) ;
699
+ } ) ;
700
+ env . notebook . get_selected_cell ( ) . focus_cell ( ) ;
701
+ } ,
702
+ help : "Un-collapse (expand) all heading cells' sections" ,
703
+ icon : params . toggle_open_icon ,
704
+ help_index : 'c4'
705
+ } ,
706
+ 'uncollapse_all_headings' , mod_name
707
+ ) ;
708
+
672
709
action_names . select = Jupyter . keyboard_manager . actions . register ( {
673
710
handler : function ( env ) {
674
711
var cell = env . notebook . get_selected_cell ( ) ;
0 commit comments