Skip to content

Commit 4b587b7

Browse files
Fix injecting user menu bar in top bar. (#149)
* Fix injecting user menu bar in top bar. * Automatic application of license header --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent d1d1140 commit 4b587b7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/collaboration-extension/src/collaboration.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
JupyterFrontEnd,
1010
JupyterFrontEndPlugin
1111
} from '@jupyterlab/application';
12-
import { DOMUtils } from '@jupyterlab/apputils';
12+
import { DOMUtils, IToolbarWidgetRegistry } from '@jupyterlab/apputils';
1313
import {
1414
EditorExtensionRegistry,
1515
IEditorExtensionRegistry
@@ -54,12 +54,15 @@ export const userMenuPlugin: JupyterFrontEndPlugin<IUserMenu> = {
5454
* Jupyter plugin adding the IUserMenu to the menu bar if collaborative flag enabled.
5555
*/
5656
export const menuBarPlugin: JupyterFrontEndPlugin<void> = {
57-
id: '@jupyter/collaboration-extension:userMenuBar',
57+
id: '@jupyter/collaboration-extension:user-menu-bar',
5858
description: 'Add user menu to the interface.',
5959
autoStart: true,
60-
requires: [IUserMenu],
61-
activate: async (app: JupyterFrontEnd, menu: IUserMenu): Promise<void> => {
62-
const { shell } = app;
60+
requires: [IUserMenu, IToolbarWidgetRegistry],
61+
activate: async (
62+
app: JupyterFrontEnd,
63+
menu: IUserMenu,
64+
toolbarRegistry: IToolbarWidgetRegistry
65+
): Promise<void> => {
6366
const { user } = app.serviceManager;
6467

6568
const menuBar = new MenuBar({
@@ -72,7 +75,8 @@ export const menuBarPlugin: JupyterFrontEndPlugin<void> = {
7275
menuBar.id = 'jp-UserMenu';
7376
user.userChanged.connect(() => menuBar.update());
7477
menuBar.addMenu(menu as Menu);
75-
shell.add(menuBar, 'top', { rank: 1000 });
78+
79+
toolbarRegistry.addFactory('TopBar', 'user-menu', () => menuBar);
7680
}
7781
};
7882

0 commit comments

Comments
 (0)