浏览代码

Move top-level logo to application-extension

Jason Grout 4 年之前
父节点
当前提交
cf90c368b8

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

@@ -39,7 +39,7 @@ import { IStateDB } from '@jupyterlab/statedb';
 
 import { ITranslator, TranslationBundle } from '@jupyterlab/translation';
 
-import { buildIcon, Switch } from '@jupyterlab/ui-components';
+import { buildIcon, jupyterIcon, Switch } from '@jupyterlab/ui-components';
 
 import { each, iter, toArray } from '@lumino/algorithm';
 
@@ -942,6 +942,23 @@ const propertyInspector: JupyterFrontEndPlugin<IPropertyInspectorProvider> = {
   }
 };
 
+const JupyterLogo: JupyterFrontEndPlugin<void> = {
+  id: '@jupyterlab/application-extension:logo',
+  requires: [ILabShell],
+  activate: (app: JupyterFrontEnd, shell: ILabShell) => {
+    const logo = new Widget();
+    jupyterIcon.element({
+      container: logo.node,
+      elementPosition: 'center',
+      margin: '2px 2px 2px 8px',
+      height: 'auto',
+      width: '16px'
+    });
+    logo.id = 'jp-MainLogo';
+    shell.add(logo, 'top', { rank: 0 });
+  }
+};
+
 /**
  * The single-document mode switch in the top area.
  */
@@ -1011,6 +1028,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
   info,
   paths,
   propertyInspector,
+  JupyterLogo,
   modeSwitch
 ];
 

+ 4 - 0
packages/application-extension/style/base.css

@@ -3,3 +3,7 @@
 |
 | Distributed under the terms of the Modified BSD License.
 |----------------------------------------------------------------------------*/
+
+#jp-MainLogo {
+  width: calc(var(--jp-private-sidebar-tab-width) + var(--jp-border-width));
+}

+ 1 - 17
packages/application/src/shell.ts

@@ -3,12 +3,7 @@
 
 import { DocumentRegistry, DocumentWidget } from '@jupyterlab/docregistry';
 
-import {
-  classes,
-  DockPanelSvg,
-  LabIcon,
-  jupyterIcon
-} from '@jupyterlab/ui-components';
+import { classes, DockPanelSvg, LabIcon } from '@jupyterlab/ui-components';
 
 import { ArrayExt, find, IIterator, iter, toArray } from '@lumino/algorithm';
 
@@ -303,17 +298,6 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
       rootLayout.insertWidget(2, this._menuHandler.panel);
     }
 
-    const logo = new Widget();
-    jupyterIcon.element({
-      container: logo.node,
-      elementPosition: 'center',
-      margin: '2px 2px 2px 8px',
-      height: 'auto',
-      width: '16px'
-    });
-    logo.id = 'jp-MainLogo';
-    this._topHandler.addWidget(logo, 0);
-
     // Wire up signals to update the title panel of the single document mode to
     // follow the title of this.currentWidget
     this.currentChanged.connect((sender, args) => {

+ 0 - 4
packages/application/style/base.css

@@ -71,10 +71,6 @@ body {
   );
 }
 
-#jp-MainLogo {
-  width: calc(var(--jp-private-sidebar-tab-width) + var(--jp-border-width));
-}
-
 #jp-bottom-panel {
   background: var(--jp-layout-color1);
   display: flex;