@@ -35,8 +35,9 @@ import {
35
35
NotebookApp ,
36
36
NotebookShell ,
37
37
INotebookShell ,
38
- SideBarPanel ,
39
- SideBarHandler
38
+ SidePanel ,
39
+ SidePanelHandler ,
40
+ SidePanelPalette
40
41
} from '@jupyter-notebook/application' ;
41
42
42
43
import { jupyterIcon } from '@jupyter-notebook/ui-components' ;
@@ -51,8 +52,6 @@ import {
51
52
52
53
import { Menu , Widget } from '@lumino/widgets' ;
53
54
54
- import { SideBarPalette } from './sidebarpalette' ;
55
-
56
55
/**
57
56
* A regular expression to match path to notebooks and documents
58
57
*/
@@ -73,7 +72,7 @@ namespace CommandIDs {
73
72
export const toggleTop = 'application:toggle-top' ;
74
73
75
74
/**
76
- * Toggle sidebar visibility
75
+ * Toggle side panel visibility
77
76
*/
78
77
export const togglePanel = 'application:toggle-panel' ;
79
78
@@ -543,10 +542,10 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
543
542
} ;
544
543
545
544
/**
546
- * Plugin to toggle the left or right sidebar 's visibility.
545
+ * Plugin to toggle the left or right side panel 's visibility.
547
546
*/
548
- const sidebarVisibility : JupyterFrontEndPlugin < void > = {
549
- id : '@jupyter-notebook/application-extension:sidebar ' ,
547
+ const sidePanelVisibility : JupyterFrontEndPlugin < void > = {
548
+ id : '@jupyter-notebook/application-extension:sidepanel ' ,
550
549
requires : [ INotebookShell , ITranslator ] ,
551
550
optional : [ IMainMenu , ICommandPalette ] ,
552
551
autoStart : true ,
@@ -562,7 +561,7 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
562
561
/* Arguments for togglePanel command:
563
562
* side, left or right area
564
563
* title, widget title to show in the menu
565
- * id, widget ID to activate in the sidebar
564
+ * id, widget ID to activate in the side panel
566
565
*/
567
566
app . commands . addCommand ( CommandIDs . togglePanel , {
568
567
label : args => args [ 'title' ] as string ,
@@ -643,33 +642,33 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
643
642
}
644
643
} ) ;
645
644
646
- const sideBarMenu : { [ area in SideBarPanel . Area ] : IDisposable | null } = {
645
+ const sidePanelMenu : { [ area in SidePanel . Area ] : IDisposable | null } = {
647
646
left : null ,
648
647
right : null
649
648
} ;
650
649
651
650
/**
652
- * The function which adds entries to the View menu for each widget of a sidebar .
651
+ * The function which adds entries to the View menu for each widget of a side panel .
653
652
*
654
- * @param area - 'left' or 'right', the area of the side bar .
655
- * @param entryLabel - the name of the main entry in the View menu for that sidebar .
653
+ * @param area - 'left' or 'right', the area of the side panel .
654
+ * @param entryLabel - the name of the main entry in the View menu for that side panel .
656
655
* @returns - The disposable menu added to the View menu or null.
657
656
*/
658
- const updateMenu = ( area : SideBarPanel . Area , entryLabel : string ) => {
657
+ const updateMenu = ( area : SidePanel . Area , entryLabel : string ) => {
659
658
if ( menu === null ) {
660
659
return null ;
661
660
}
662
661
663
- // Remove the previous menu entry for this sidebar .
664
- sideBarMenu [ area ] ?. dispose ( ) ;
662
+ // Remove the previous menu entry for this side panel .
663
+ sidePanelMenu [ area ] ?. dispose ( ) ;
665
664
666
- // Creates a new menu entry and populates it with sidebar widgets.
665
+ // Creates a new menu entry and populates it with side panel widgets.
667
666
const newMenu = new Menu ( { commands : app . commands } ) ;
668
667
newMenu . title . label = entryLabel ;
669
668
const widgets = notebookShell . widgets ( area ) ;
670
669
let menuToAdd = false ;
671
670
672
- for ( let widget of widgets ) {
671
+ for ( const widget of widgets ) {
673
672
newMenu . addItem ( {
674
673
command : CommandIDs . togglePanel ,
675
674
args : {
@@ -683,7 +682,7 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
683
682
684
683
// If there are widgets, add the menu to the main menu entry.
685
684
if ( menuToAdd ) {
686
- sideBarMenu [ area ] = menu . viewMenu . addItem ( {
685
+ sidePanelMenu [ area ] = menu . viewMenu . addItem ( {
687
686
type : 'submenu' ,
688
687
submenu : newMenu
689
688
} ) ;
@@ -693,63 +692,65 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
693
692
app . restored . then ( ( ) => {
694
693
// Create menu entries for the left and right panel.
695
694
if ( menu ) {
696
- const getSideBarLabel = ( area : SideBarPanel . Area ) : string => {
695
+ const getSidePanelLabel = ( area : SidePanel . Area ) : string => {
697
696
if ( area === 'left' ) {
698
- return trans . __ ( ` Left Sidebar` ) ;
697
+ return trans . __ ( ' Left Sidebar' ) ;
699
698
} else {
700
- return trans . __ ( ` Right Sidebar` ) ;
699
+ return trans . __ ( ' Right Sidebar' ) ;
701
700
}
702
701
} ;
703
702
const leftArea = notebookShell . leftHandler . area ;
704
- const leftLabel = getSideBarLabel ( leftArea ) ;
703
+ const leftLabel = getSidePanelLabel ( leftArea ) ;
705
704
updateMenu ( leftArea , leftLabel ) ;
706
705
707
706
const rightArea = notebookShell . rightHandler . area ;
708
- const rightLabel = getSideBarLabel ( rightArea ) ;
707
+ const rightLabel = getSidePanelLabel ( rightArea ) ;
709
708
updateMenu ( rightArea , rightLabel ) ;
710
709
711
- const handleSideBarChange = (
712
- sidebar : SideBarHandler ,
710
+ const handleSidePanelChange = (
711
+ sidePanel : SidePanelHandler ,
713
712
widget : Widget
714
713
) => {
715
- const label = getSideBarLabel ( sidebar . area ) ;
716
- updateMenu ( sidebar . area , label ) ;
714
+ const label = getSidePanelLabel ( sidePanel . area ) ;
715
+ updateMenu ( sidePanel . area , label ) ;
717
716
} ;
718
717
719
- notebookShell . leftHandler . widgetAdded . connect ( handleSideBarChange ) ;
720
- notebookShell . leftHandler . widgetRemoved . connect ( handleSideBarChange ) ;
721
- notebookShell . rightHandler . widgetAdded . connect ( handleSideBarChange ) ;
722
- notebookShell . rightHandler . widgetRemoved . connect ( handleSideBarChange ) ;
718
+ notebookShell . leftHandler . widgetAdded . connect ( handleSidePanelChange ) ;
719
+ notebookShell . leftHandler . widgetRemoved . connect ( handleSidePanelChange ) ;
720
+ notebookShell . rightHandler . widgetAdded . connect ( handleSidePanelChange ) ;
721
+ notebookShell . rightHandler . widgetRemoved . connect ( handleSidePanelChange ) ;
723
722
}
724
723
725
724
// Add palette entries for side panels.
726
725
if ( palette ) {
727
- const sideBarPalette = new SideBarPalette ( {
726
+ const sidePanelPalette = new SidePanelPalette ( {
728
727
commandPalette : palette as ICommandPalette ,
729
728
command : CommandIDs . togglePanel
730
729
} ) ;
731
730
732
731
notebookShell . leftHandler . widgets . forEach ( widget => {
733
- sideBarPalette . addItem ( widget , notebookShell . leftHandler . area ) ;
732
+ sidePanelPalette . addItem ( widget , notebookShell . leftHandler . area ) ;
734
733
} ) ;
735
734
736
735
notebookShell . rightHandler . widgets . forEach ( widget => {
737
- sideBarPalette . addItem ( widget , notebookShell . rightHandler . area ) ;
736
+ sidePanelPalette . addItem ( widget , notebookShell . rightHandler . area ) ;
738
737
} ) ;
739
738
740
- // Update menu and palette when widgets are added or removed from sidebars.
741
- notebookShell . leftHandler . widgetAdded . connect ( ( sidebar , widget ) => {
742
- sideBarPalette . addItem ( widget , sidebar . area ) ;
743
- } ) ;
744
- notebookShell . leftHandler . widgetRemoved . connect ( ( sidebar , widget ) => {
745
- sideBarPalette . removeItem ( widget , sidebar . area ) ;
739
+ // Update menu and palette when widgets are added or removed from side panels.
740
+ notebookShell . leftHandler . widgetAdded . connect ( ( sidePanel , widget ) => {
741
+ sidePanelPalette . addItem ( widget , sidePanel . area ) ;
746
742
} ) ;
747
- notebookShell . rightHandler . widgetAdded . connect ( ( sidebar , widget ) => {
748
- sideBarPalette . addItem ( widget , sidebar . area ) ;
743
+ notebookShell . leftHandler . widgetRemoved . connect ( ( sidePanel , widget ) => {
744
+ sidePanelPalette . removeItem ( widget , sidePanel . area ) ;
749
745
} ) ;
750
- notebookShell . rightHandler . widgetRemoved . connect ( ( sidebar , widget ) => {
751
- sideBarPalette . removeItem ( widget , sidebar . area ) ;
746
+ notebookShell . rightHandler . widgetAdded . connect ( ( sidePanel , widget ) => {
747
+ sidePanelPalette . addItem ( widget , sidePanel . area ) ;
752
748
} ) ;
749
+ notebookShell . rightHandler . widgetRemoved . connect (
750
+ ( sidePanel , widget ) => {
751
+ sidePanelPalette . removeItem ( widget , sidePanel . area ) ;
752
+ }
753
+ ) ;
753
754
}
754
755
} ) ;
755
756
}
@@ -908,7 +909,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
908
909
paths ,
909
910
sessionDialogs ,
910
911
shell ,
911
- sidebarVisibility ,
912
+ sidePanelVisibility ,
912
913
status ,
913
914
tabTitle ,
914
915
title ,
0 commit comments