mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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.setViewInErrorState(localize('displayFailed', "Could not display contents: {0}", getErrorMessage(error)));
|
||||||
this.setLoading(false);
|
this.setLoading(false);
|
||||||
this._modelReadyDeferred.reject(error);
|
this._modelReadyDeferred.reject(error);
|
||||||
|
|
||||||
this.notebookService.addNotebookEditor(this);
|
this.notebookService.addNotebookEditor(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,6 +341,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
this._model = this._register(model);
|
this._model = this._register(model);
|
||||||
await this._model.loadContents(trusted);
|
await this._model.loadContents(trusted);
|
||||||
this.setLoading(false);
|
this.setLoading(false);
|
||||||
|
// Check if URI fragment is present; if it is, navigate to section by default
|
||||||
|
this.navigateToSectionIfURIFragmentExists();
|
||||||
this.updateToolbarComponents();
|
this.updateToolbarComponents();
|
||||||
this.detectChanges();
|
this.detectChanges();
|
||||||
}
|
}
|
||||||
@@ -759,6 +760,12 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private navigateToSectionIfURIFragmentExists(): void {
|
||||||
|
if (this.notebookParams.notebookUri?.fragment) {
|
||||||
|
this.navigateToSection(this.notebookParams.notebookUri.fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
navigateToSection(id: string): void {
|
navigateToSection(id: string): void {
|
||||||
id = id.toLowerCase();
|
id = id.toLowerCase();
|
||||||
let chromeHeight: number = 0;
|
let chromeHeight: number = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user