瀏覽代碼

Support dock panel insert options in shell. Use tab-before for adding landing page to main area.

Afshin Darian 8 年之前
父節點
當前提交
6b06e1e5d8
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 2 2
      src/application/shell.ts
  2. 4 4
      src/landing/plugin.ts

+ 2 - 2
src/application/shell.ts

@@ -228,12 +228,12 @@ class ApplicationShell extends Widget {
    * #### Notes
    * Widgets must have a unique `id` property, which will be used as the DOM id.
    */
-  addToMainArea(widget: Widget): void {
+  addToMainArea(widget: Widget, options: DockPanel.IAddOptions = { mode: 'tab-after' }): void {
     if (!widget.id) {
       console.error('widgets added to app shell must have unique id property');
       return;
     }
-    this._dockPanel.addWidget(widget, { mode: 'tab-after' });
+    this._dockPanel.addWidget(widget, options);
   }
 
   /**

+ 4 - 4
src/landing/plugin.ts

@@ -84,14 +84,14 @@ function activateLanding(app: JupyterLab, pathTracker: IPathTracker, palette: IC
   app.commands.addCommand(command, {
     label: 'Show Landing',
     execute: (args) => {
+      let inactive = args && args['inactive'] as boolean;
       if (!widget || widget.isDisposed) {
         widget = newWidget();
-        app.shell.addToMainArea(widget);
+        app.shell.addToMainArea(widget, { mode: 'tab-before' });
       }
-      if (args && args['inactive'] as boolean) {
-        return;
+      if (!inactive) {
+        app.shell.activateMain(widget.id);
       }
-      app.shell.activateMain(widget.id);
     }
   });