瀏覽代碼

Fix property panel restore and initialization

Steven Silvester 5 年之前
父節點
當前提交
3e8db7bee5
共有 2 個文件被更改,包括 10 次插入1 次删除
  1. 9 1
      packages/application-extension/src/index.tsx
  2. 1 0
      packages/property-inspector/src/index.ts

+ 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();
   }
 
   /**