Procházet zdrojové kódy

Open attached consoles below

Steven Silvester před 7 roky
rodič
revize
0def6987c4

+ 16 - 3
packages/console-extension/src/index.ts

@@ -45,6 +45,10 @@ import {
   ReadonlyJSONObject
 } from '@phosphor/coreutils';
 
+import {
+  DockLayout
+} from '@phosphor/widgets';
+
 
 /**
  * The command IDs used by the console plugin.
@@ -184,22 +188,31 @@ function activateConsole(app: JupyterLab, mainMenu: IMainMenu, palette: ICommand
     });
   }
 
+  interface ICreateOptions extends Partial<ConsolePanel.IOptions> {
+    ref?: string,
+    insertMode?: DockLayout.InsertMode
+  }
+
   /**
    * Create a console for a given path.
    */
-  function createConsole(options: Partial<ConsolePanel.IOptions>): Promise<ConsolePanel> {
+  function createConsole(options: ICreateOptions): Promise<ConsolePanel> {
     return manager.ready.then(() => {
       let panel = new ConsolePanel({
         manager,
         contentFactory,
         mimeTypeService: editorServices.mimeTypeService,
         rendermime,
-        ...options
+        ...options as Partial<ConsolePanel.IOptions>
       });
 
       // Add the console panel to the tracker.
       tracker.add(panel);
-      shell.addToMainArea(panel);
+      shell.addToMainArea(
+        panel, { 
+          ref: options.ref || null, mode: options.insertMode || 'tab-after' 
+        }
+      );
       shell.activateById(panel.id);
       return panel;
     });

+ 3 - 1
packages/fileeditor-extension/src/index.ts

@@ -280,7 +280,9 @@ function activate(app: JupyterLab, editorServices: IEditorServices, browserFacto
       return commands.execute('console:create', {
         activate: args['activate'],
         path: widget.context.path,
-        preferredLanguage: widget.context.model.defaultKernelLanguage
+        preferredLanguage: widget.context.model.defaultKernelLanguage,
+        ref: widget.id,
+        insertMode: 'split-bottom'
       });
     },
     isEnabled,

+ 3 - 1
packages/notebook-extension/src/index.ts

@@ -1183,7 +1183,9 @@ function addCommands(app: JupyterLab, services: ServiceManager, tracker: Noteboo
       const options: ReadonlyJSONObject = {
         path: widget.context.path,
         preferredLanguage: widget.context.model.defaultKernelLanguage,
-        activate: args['activate']
+        activate: args['activate'],
+        ref: current.id,
+        insertMode: 'split-bottom'
       };
 
       return commands.execute('console:create', options);