private _registerCell()

in src/overlay/cell-listener.ts [37:65]


  private _registerCell(cell: ICellModel) {
    if (cell.type !== "code") {
      return;
    }
    /*
     * A cell will be considered edited whenever any of its contents changed, including
     * execution count, metadata, outputs, text, etc.
     */
    cell.stateChanged.connect((changedCell, cellStateChange) => {
      if (
        cellStateChange.name === "executionCount" &&
        cellStateChange.newValue !== undefined &&
        cellStateChange.newValue !== null
      ) {
        let labCell = new LabCell(changedCell as ICodeCellModel);
        /*
         * Annotate the cell before reporting to the model that it was executed, because
         * the model's listeners will need these annotations.
         */
        this._annotateCellWithExecutionInformation(labCell);
        this._gatherModel.lastExecutedCell = labCell;
      }
    });
    cell.contentChanged.connect((changedCell, _) => {
      if (changedCell instanceof CodeCellModel) {
        this._gatherModel.lastEditedCell = new LabCell(changedCell);
      }
    });
  }