Browse Source

Fix property panel restore and initialization

Steven Silvester 5 years ago
parent
commit
3e8db7bee5

+ 9 - 1
packages/application-extension/src/index.tsx

@@ -822,13 +822,21 @@ const propertyInspector: JupyterFrontEndPlugin<IPropertyInspectorProvider> = {
   id: '@jupyterlab/application-extension:property-inspector',
   autoStart: true,
   requires: [ILabShell],
+  optional: [ILayoutRestorer],
   provides: IPropertyInspectorProvider,
-  activate: (app: JupyterFrontEnd, labshell: ILabShell) => {
+  activate: (
+    app: JupyterFrontEnd,
+    labshell: ILabShell,
+    restorer: ILayoutRestorer | null
+  ) => {
     const widget = new SideBarPropertyInspectorProvider(labshell);
     widget.title.icon = buildIcon;
     widget.title.caption = 'Property Inspector';
     widget.id = 'jp-property-inspector';
     labshell.add(widget, 'left');
+    if (restorer) {
+      restorer.add(widget, 'jp-property-inspector');
+    }
     return widget;
   }
 };

+ 1 - 0
packages/property-inspector/src/index.ts

@@ -164,6 +164,7 @@ export class SideBarPropertyInspectorProvider extends PropertyInspectorProvider
     }
     layout.widget = this._placeholder;
     labshell.currentChanged.connect(this._onShellCurrentChanged, this);
+    this._onShellCurrentChanged();
   }
 
   /**