mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fixed bug: Execute cell should scroll to its results (#5861)
This commit is contained in:
@@ -43,7 +43,7 @@ export class OutputComponent extends AngularDisposable implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.renderOutput();
|
this.renderOutput(true);
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
this._register(Event.debounce(this.cellModel.notebookModel.layoutChanged, (l, e) => e, 50, /*leading=*/false)
|
this._register(Event.debounce(this.cellModel.notebookModel.layoutChanged, (l, e) => e, 50, /*leading=*/false)
|
||||||
(() => this.renderOutput()));
|
(() => this.renderOutput()));
|
||||||
@@ -70,11 +70,21 @@ export class OutputComponent extends AngularDisposable implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderOutput() {
|
private renderOutput(focusAndScroll: boolean = false): void {
|
||||||
let options = outputProcessor.getBundleOptions({ value: this.cellOutput, trusted: this.trustedMode });
|
let options = outputProcessor.getBundleOptions({ value: this.cellOutput, trusted: this.trustedMode });
|
||||||
options.themeService = this._themeService;
|
options.themeService = this._themeService;
|
||||||
// TODO handle safe/unsafe mapping
|
// TODO handle safe/unsafe mapping
|
||||||
this.createRenderedMimetype(options, this.outputElement.nativeElement);
|
this.createRenderedMimetype(options, this.outputElement.nativeElement);
|
||||||
|
if (focusAndScroll) {
|
||||||
|
this.setFocusAndScroll(this.outputElement.nativeElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private setFocusAndScroll(node: HTMLElement): void {
|
||||||
|
if (node) {
|
||||||
|
node.focus();
|
||||||
|
node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(): void {
|
public layout(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user