Quellcode durchsuchen

Clean up mousedown and activate behavior

Steven Silvester vor 8 Jahren
Ursprung
Commit
774b85b384
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. 4 5
      src/notebook/notebook/widget.ts

+ 4 - 5
src/notebook/notebook/widget.ts

@@ -784,11 +784,7 @@ class Notebook extends StaticNotebook {
    * Handle `'activate-request'` messages.
    */
   protected onActivateRequest(msg: Message): void {
-    if (this.mode === 'command') {
-      this.node.focus();
-    } else {
-      this.activeCell.activate();
-    }
+    this.node.focus();
     this.update();
   }
 
@@ -926,6 +922,9 @@ class Notebook extends StaticNotebook {
    * Handle `mousedown` events for the widget.
    */
   private _evtMouseDown(event: MouseEvent): void {
+    if (!this.model || this.model.readOnly) {
+      return;
+    }
     let target = event.target as HTMLElement;
     let i = this._findCell(target);
     if (i !== -1) {