Browse Source

Make sure the active cell exists

Steven Silvester 8 năm trước cách đây
mục cha
commit
189e246203
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      src/notebook/widget.ts

+ 4 - 1
src/notebook/widget.ts

@@ -1043,9 +1043,12 @@ class Notebook extends StaticNotebook {
    */
   private _ensureFocus(force=false): void {
     let activeCell = this.activeCell;
+    if (!activeCell) {
+      this.mode = 'command';
+    }
     if (this.mode === 'edit') {
       activeCell.editor.focus();
-    } else {
+    } else if (activeCell) {
       activeCell.editor.blur();
     }
     if (force && !this.node.contains(document.activeElement)) {