浏览代码

Add comments

Steven Silvester 8 年之前
父节点
当前提交
a2f4d730f3
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/notebook/notebook/widget.ts

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

@@ -930,9 +930,11 @@ class Notebook extends StaticNotebook {
     let i = this._findCell(target);
     let i = this._findCell(target);
     if (i !== -1) {
     if (i !== -1) {
       let widget = this.childAt(i);
       let widget = this.childAt(i);
+      // Event is on a cell but not in its editor, switch to command mode.
       if (!widget.editor.node.contains(target)) {
       if (!widget.editor.node.contains(target)) {
         this.mode = 'command';
         this.mode = 'command';
       }
       }
+      // Set the cell as the active one.
       this.activeCellIndex = i;
       this.activeCellIndex = i;
     }
     }
     this.update();
     this.update();
@@ -946,12 +948,16 @@ class Notebook extends StaticNotebook {
     let i = this._findCell(target);
     let i = this._findCell(target);
     if (i !== -1) {
     if (i !== -1) {
       let widget = this.childAt(i);
       let widget = this.childAt(i);
+      // If the editor has focus, ensure edit mode.
       if (widget.editor.node.contains(target)) {
       if (widget.editor.node.contains(target)) {
         this.mode = 'edit';
         this.mode = 'edit';
+      // Otherwise, another control within the cell has focus,
+      // ensure command mode.
       } else {
       } else {
         this.mode = 'command';
         this.mode = 'command';
       }
       }
     } else {
     } else {
+      // No cell has focus, ensure command mode.
       this.mode = 'command';
       this.mode = 'command';
     }
     }
     this.update();
     this.update();