소스 검색

Make sure the active cell exists

Steven Silvester 8 년 전
부모
커밋
189e246203
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  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)) {