Making Notebook to scroll to output area only when Notebook command is executed (#5893)

This commit is contained in:
Gene Lee
2019-06-05 12:07:31 -07:00
committed by GitHub
parent da164cec0a
commit a518c4a529
5 changed files with 36 additions and 24 deletions

View File

@@ -33,14 +33,24 @@ export class OutputAreaComponent extends AngularDisposable implements OnInit {
this._register(this.themeService.onDidColorThemeChange(this.updateTheme, this));
this.updateTheme(this.themeService.getColorTheme());
if (this.cellModel) {
this._register(this.cellModel.onOutputsChanged(() => {
this._register(this.cellModel.onOutputsChanged(e => {
if (!(this._changeRef['destroyed'])) {
this._changeRef.detectChanges();
if (e && e.shouldScroll) {
this.setFocusAndScroll(this.outputArea.nativeElement);
}
}
}));
}
}
private setFocusAndScroll(node: HTMLElement): void {
if (node) {
node.focus();
node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
}
@Input() set activeCellId(value: string) {
this._activeCellId = value;
}