Selaa lähdekoodia

Explicitly set the active cell on focus

Steven Silvester 8 vuotta sitten
vanhempi
commit
e1ece045da
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 3 0
      src/notebook/notebook/widget.ts

+ 3 - 0
src/notebook/notebook/widget.ts

@@ -809,6 +809,7 @@ class Notebook extends StaticNotebook {
     let activeCell = this.activeCell;
     // Ensure we have the correct focus.
     if (this._isActive) {
+      console.log(this.mode, activeCell);
       if (this.mode === 'edit' && activeCell) {
         activeCell.editor.activate();
       } else {
@@ -966,6 +967,7 @@ class Notebook extends StaticNotebook {
    */
   private _evtFocus(event: MouseEvent): void {
     this._isActive = true;
+    console.log(event);
     let target = event.target as HTMLElement;
     let i = this._findCell(target);
     if (i !== -1) {
@@ -978,6 +980,7 @@ class Notebook extends StaticNotebook {
       } else {
         this.mode = 'command';
       }
+      this.activeCellIndex = i;
     } else {
       // No cell has focus, ensure command mode.
       this.mode = 'command';