浏览代码

Better falsiness.

Ian Rose 6 年之前
父节点
当前提交
85e78948bf
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      packages/notebook-extension/src/index.ts
  2. 1 1
      packages/statusbar/src/defaults/lineCol.tsx

+ 2 - 2
packages/notebook-extension/src/index.ts

@@ -302,7 +302,7 @@ export const commandEditItem: JupyterLabPlugin<void> = {
     // Keep the status item up-to-date with the current notebook.
     tracker.currentChanged.connect(() => {
       const current = tracker.currentWidget;
-      item.model.notebook = current.content;
+      item.model.notebook = current && current.content;
     });
 
     statusBar.registerStatusItem('command-edit-item', item, {
@@ -333,7 +333,7 @@ export const notebookTrustItem: JupyterLabPlugin<void> = {
     // Keep the status item up-to-date with the current notebook.
     tracker.currentChanged.connect(() => {
       const current = tracker.currentWidget;
-      item.model.notebook = current.content;
+      item.model.notebook = current && current.content;
     });
 
     statusBar.registerStatusItem('notebook-trust-item', item, {

+ 1 - 1
packages/statusbar/src/defaults/lineCol.tsx

@@ -303,7 +303,7 @@ export namespace LineCol {
 
       const oldState = this._getAllState();
       this._editor = editor;
-      if (this._editor === null) {
+      if (!this._editor) {
         this._column = 1;
         this._line = 1;
       } else {