Explorar el Código

Merge pull request #3631 from jasongrout/sidebar

Sidebar focus and title fixes
Ian Rose hace 7 años
padre
commit
f5057ba46b
Se han modificado 1 ficheros con 8 adiciones y 4 borrados
  1. 8 4
      packages/application-extension/src/index.ts

+ 8 - 4
packages/application-extension/src/index.ts

@@ -254,33 +254,37 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
 
   command = CommandIDs.toggleLeftArea;
   app.commands.addCommand(command, {
-    label: 'Show Left Area',
+    label: args => args['isPalette'] ?
+    'Toggle Left Area' : 'Show Left Area',
     execute: () => {
       if (app.shell.leftCollapsed) {
         app.shell.expandLeft();
       } else {
         app.shell.collapseLeft();
+        app.shell.activateById(app.shell.currentWidget.id);
       }
     },
     isToggled: () => !app.shell.leftCollapsed,
     isVisible: () => !app.shell.isEmpty('left')
   });
-  palette.addItem({ command, category });
+  palette.addItem({ command, category, args: { 'isPalette': true } });
 
   command = CommandIDs.toggleRightArea;
   app.commands.addCommand(command, {
-    label: 'Show Right Area',
+    label: args => args['isPalette'] ?
+    'Toggle Right Area' : 'Show Right Area',
     execute: () => {
       if (app.shell.rightCollapsed) {
         app.shell.expandRight();
       } else {
         app.shell.collapseRight();
+        app.shell.activateById(app.shell.currentWidget.id);
       }
     },
     isToggled: () => !app.shell.rightCollapsed,
     isVisible: () => !app.shell.isEmpty('right')
   });
-  palette.addItem({ command, category });
+  palette.addItem({ command, category, args: { 'isPalette': true } });
 
   command = CommandIDs.togglePresentationMode;
   app.commands.addCommand(command, {