ソースを参照

Merge pull request #1797 from afshin/activate-bugfix

Fix activate flag logic.
Steven Silvester 8 年 前
コミット
4a106a70a3
2 ファイル変更4 行追加2 行削除
  1. 2 1
      src/console/plugin.ts
  2. 2 1
      src/notebook/plugin.ts

+ 2 - 1
src/console/plugin.ts

@@ -202,7 +202,8 @@ function activateConsole(app: JupyterLab, services: IServiceManager, rendermime:
   // Get the current widget and activate unless the args specify otherwise.
   function getCurrent(args: JSONObject): ConsolePanel | null {
     let widget = tracker.currentWidget;
-    if (widget && (args['activate'] !== false)) {
+    let activate = !args || args && args['activate'] !== false;
+    if (activate && widget) {
       widget.activate();
     }
     return widget;

+ 2 - 1
src/notebook/plugin.ts

@@ -235,7 +235,8 @@ function addCommands(app: JupyterLab, services: IServiceManager, tracker: Notebo
   // Get the current widget and activate unless the args specify otherwise.
   function getCurrent(args: JSONObject): NotebookPanel | null {
     let widget = tracker.currentWidget;
-    if (widget && (args['activate'] !== false)) {
+    let activate = !args || args && args['activate'] !== false;
+    if (activate && widget) {
       widget.activate();
     }
     return widget;