mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Notebook Deep Link to Section (#13795)
* Notebook deep link to section * fragment wip
This commit is contained in:
@@ -294,7 +294,6 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
this.setViewInErrorState(localize('displayFailed', "Could not display contents: {0}", getErrorMessage(error)));
|
||||
this.setLoading(false);
|
||||
this._modelReadyDeferred.reject(error);
|
||||
|
||||
this.notebookService.addNotebookEditor(this);
|
||||
}
|
||||
}
|
||||
@@ -342,6 +341,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
this._model = this._register(model);
|
||||
await this._model.loadContents(trusted);
|
||||
this.setLoading(false);
|
||||
// Check if URI fragment is present; if it is, navigate to section by default
|
||||
this.navigateToSectionIfURIFragmentExists();
|
||||
this.updateToolbarComponents();
|
||||
this.detectChanges();
|
||||
}
|
||||
@@ -759,6 +760,12 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
return headers;
|
||||
}
|
||||
|
||||
private navigateToSectionIfURIFragmentExists(): void {
|
||||
if (this.notebookParams.notebookUri?.fragment) {
|
||||
this.navigateToSection(this.notebookParams.notebookUri.fragment);
|
||||
}
|
||||
}
|
||||
|
||||
navigateToSection(id: string): void {
|
||||
id = id.toLowerCase();
|
||||
let chromeHeight: number = 0;
|
||||
|
||||
Reference in New Issue
Block a user