Explorar o código

Merge pull request #1797 from afshin/activate-bugfix

Fix activate flag logic.
Steven Silvester %!s(int64=8) %!d(string=hai) anos
pai
achega
4a106a70a3
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  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;