Browse Source

Rationalize tab rank.

Afshin Darian 8 năm trước cách đây
mục cha
commit
c77c071ed9

+ 8 - 2
packages/application/src/shell.ts

@@ -44,6 +44,12 @@ const CURRENT_CLASS = 'jp-mod-current';
 const ACTIVE_CLASS = 'jp-mod-active';
 
 
+/**
+ * The default rank of items added to a sidebar.
+ */
+const DEFAULT_RANK = 500;
+
+
 /**
  * The application shell for JupyterLab.
  */
@@ -252,7 +258,7 @@ class ApplicationShell extends Widget {
       console.error('widgets added to app shell must have unique id property');
       return;
     }
-    let rank = 'rank' in options ? options.rank : 100;
+    let rank = 'rank' in options ? options.rank : DEFAULT_RANK;
     this._leftHandler.addWidget(widget, rank);
     this._save();
   }
@@ -285,7 +291,7 @@ class ApplicationShell extends Widget {
       console.error('widgets added to app shell must have unique id property');
       return;
     }
-    let rank = 'rank' in options ? options.rank : 100;
+    let rank = 'rank' in options ? options.rank : DEFAULT_RANK;
     this._rightHandler.addWidget(widget, rank);
     this._save();
   }

+ 1 - 1
packages/filebrowser-extension/src/index.ts

@@ -191,7 +191,7 @@ function activateFileBrowser(app: JupyterLab, factory: IFileBrowserFactory, mana
   mainMenu.addMenu(menu, { rank: 1 });
 
   fbWidget.title.label = 'Files';
-  app.shell.addToLeftArea(fbWidget, { rank: 40 });
+  app.shell.addToLeftArea(fbWidget, { rank: 100 });
 
   // If the layout is a fresh session without saved data, open file browser.
   app.restored.then(layout => {

+ 1 - 1
packages/running-extension/src/index.ts

@@ -65,5 +65,5 @@ function activate(app: JupyterLab, services: IServiceManager, restorer: ILayoutR
 
   // Rank has been chosen somewhat arbitrarily to give priority to the running
   // sessions widget in the sidebar.
-  app.shell.addToLeftArea(running, { rank: 50 });
+  app.shell.addToLeftArea(running, { rank: 200 });
 }

+ 9 - 1
packages/tabmanager-extension/src/index.ts

@@ -5,6 +5,10 @@ import {
   JupyterLab, JupyterLabPlugin
 } from '@jupyterlab/application';
 
+import {
+  TabBar
+} from '@phosphor/widgets';
+
 
 /**
  * The default tab manager extension.
@@ -12,7 +16,11 @@ import {
 const plugin: JupyterLabPlugin<void> = {
   id: 'jupyter.extensions.tab-manager',
   activate: (app: JupyterLab): void => {
-    console.log('hello world');
+    const tabs = new TabBar({ orientation: 'vertical' });
+
+    tabs.id = 'tab-manager';
+    tabs.title.label = 'Tabs';
+    app.shell.addToLeftArea(tabs, { rank: 600 });
   },
   autoStart: true
 };