Add localContentManger and dummy sessionManager (#3130)

* - keyboard binding to arrow keys
- toggle markdown editor by double click

* Added localContentManger and dummpy sessionManager
This commit is contained in:
Yurong He
2018-11-05 17:55:13 -08:00
committed by GitHub
parent 3c785ae7d8
commit 5da89ac05b
7 changed files with 152 additions and 6 deletions

View File

@@ -89,4 +89,28 @@ export class NotebookComponent extends AngularDisposable implements OnInit {
this._changeRef.detectChanges();
}
}
public onKeyDown(event) {
switch (event.key) {
case 'ArrowDown':
case 'ArrowRight':
let nextIndex = (this.findCellIndex(this._activeCell) + 1)%this.cells.length;
this.selectCell(this.cells[nextIndex]);
break;
case 'ArrowUp':
case 'ArrowLeft':
let index = this.findCellIndex(this._activeCell);
if (index === 0) {
index = this.cells.length;
}
this.selectCell(this.cells[--index]);
break;
default:
break;
}
}
findCellIndex(cellModel: ICellModel): number {
return this.cells.findIndex((cell) => cell.id === cellModel.id);
}
}