소스 검색

Fix activate flag logic.

Afshin Darian 8 년 전
부모
커밋
fc273a1f48
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;