Browse Source

Clean up handling of code_runner data attribute

Steven Silvester 7 years ago
parent
commit
093ac16a12

+ 5 - 1
packages/notebook/src/widget.ts

@@ -189,7 +189,6 @@ class StaticNotebook extends Widget {
     super();
     this.addClass(NB_CLASS);
     this.node.dataset[KERNEL_USER] = 'true';
-    this.node.dataset[CODE_RUNNER] = 'true';
     this.node.dataset[UNDOER] = 'true';
     this.rendermime = options.rendermime;
     this.layout = new Private.NotebookPanelLayout();
@@ -1830,6 +1829,11 @@ class Notebook extends StaticNotebook {
       // No cell has focus, ensure command mode.
       this.mode = 'command';
     }
+    if (target !== this.node) {
+      delete this.node.dataset[CODE_RUNNER];
+    } else {
+      this.node.dataset[CODE_RUNNER] = 'true';
+    }
   }
 
   /**

+ 1 - 1
packages/shortcuts-extension/schema/plugin.json

@@ -551,7 +551,7 @@
       "properties": {
         "command": { "default": "runmenu:run" },
         "keys": { "default": ["Shift Enter"] },
-        "selector": { "default": "[data-jp-code-runner]:focus" }
+        "selector": { "default": "[data-jp-code-runner]" }
       },
       "type": "object"
     },