mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
This commit is contained in:
@@ -760,22 +760,9 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigateToSection(id: string): void {
|
navigateToSection(id: string): void {
|
||||||
id = id.toLowerCase();
|
let section = this.getSectionElements().find(s => s.relativeUri && s.relativeUri.toLowerCase() === id.toLowerCase());
|
||||||
let chromeHeight: number = 0;
|
|
||||||
let elBody: HTMLElement = document.body;
|
|
||||||
let tabBar = elBody.querySelector('.title.tabs') as HTMLElement;
|
|
||||||
let actionBar = elBody.querySelector('.editor-toolbar.actionbar-container') as HTMLElement;
|
|
||||||
let section = this.getSectionElements().find(s => s.relativeUri && s.relativeUri.toLowerCase() === id);
|
|
||||||
if (section) {
|
if (section) {
|
||||||
// Scroll this section to the top of the header instead of just bringing header into view.
|
section.headerEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
if (tabBar && actionBar) {
|
|
||||||
chromeHeight = tabBar.scrollHeight + actionBar.scrollHeight;
|
|
||||||
}
|
|
||||||
let scrollTop: number = section.headerEl.getBoundingClientRect().top - (chromeHeight + 10);
|
|
||||||
(<HTMLElement>this.container.nativeElement).scrollTo({
|
|
||||||
top: scrollTop,
|
|
||||||
behavior: 'smooth'
|
|
||||||
});
|
|
||||||
section.headerEl.focus();
|
section.headerEl.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user