Skip to content

Optional ILayoutRestorer #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ const PLUGIN_ID = '@jupyterlab/github:drive';
*/
const fileBrowserPlugin: JupyterFrontEndPlugin<void> = {
id: PLUGIN_ID,
requires: [
IDocumentManager,
IFileBrowserFactory,
ILayoutRestorer,
ISettingRegistry
],
requires: [IDocumentManager, IFileBrowserFactory, ISettingRegistry],
optional: [ILayoutRestorer],
activate: activateFileBrowser,
autoStart: true
};
Expand All @@ -51,8 +47,8 @@ function activateFileBrowser(
app: JupyterFrontEnd,
manager: IDocumentManager,
factory: IFileBrowserFactory,
restorer: ILayoutRestorer,
settingRegistry: ISettingRegistry
settingRegistry: ISettingRegistry,
restorer: ILayoutRestorer | null
): void {
// Add the GitHub backend to the contents manager.
const drive = new GitHubDrive(app.docRegistry);
Expand All @@ -75,7 +71,9 @@ function activateFileBrowser(
gitHubBrowser.id = 'github-file-browser';

// Add the file browser widget to the application restorer.
restorer.add(gitHubBrowser, NAMESPACE);
if (restorer) {
restorer.add(gitHubBrowser, NAMESPACE);
}
app.shell.add(gitHubBrowser, 'left', { rank: 102 });

let shouldWarn = false;
Expand Down