Skip to content

Commit 4b889ff

Browse files
committed
Move some menu items to the settings
1 parent 15ea7f0 commit 4b889ff

File tree

4 files changed

+62
-23
lines changed

4 files changed

+62
-23
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"title": "Jupyter Notebook Pages",
3+
"description": "Jupyter Notebook Pages",
4+
"jupyter.lab.menus": {
5+
"main": [
6+
{
7+
"id": "jp-mainmenu-view",
8+
"items": [
9+
{
10+
"command": "application:open-lab",
11+
"rank": 2
12+
},
13+
{
14+
"command": "application:open-tree",
15+
"rank": 2
16+
}
17+
]
18+
}
19+
]
20+
},
21+
"properties": {},
22+
"additionalProperties": false,
23+
"type": "object"
24+
}

packages/application-extension/schema/top.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
"jupyter.lab.setting-icon-label": "Jupyter Notebook Top Area",
44
"title": "Jupyter Notebook Top Area",
55
"description": "Jupyter Notebook Top Area settings",
6+
"jupyter.lab.menus": {
7+
"main": [
8+
{
9+
"id": "jp-mainmenu-view",
10+
"items": [
11+
{
12+
"command": "application:toggle-top",
13+
"rank": 2
14+
}
15+
]
16+
}
17+
]
18+
},
619
"properties": {
720
"visible": {
821
"type": "boolean",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"title": "Jupyter Notebook Zen Mode",
3+
"description": "Jupyter Notebook Zen Mode",
4+
"jupyter.lab.menus": {
5+
"main": [
6+
{
7+
"id": "jp-mainmenu-view",
8+
"items": [
9+
{
10+
"command": "application:toggle-zen",
11+
"rank": 3
12+
}
13+
]
14+
}
15+
]
16+
},
17+
"properties": {},
18+
"additionalProperties": false,
19+
"type": "object"
20+
}

packages/application-extension/src/index.ts

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,11 @@ const pages: JupyterFrontEndPlugin<void> = {
236236
id: '@jupyter-notebook/application-extension:pages',
237237
autoStart: true,
238238
requires: [ITranslator],
239-
optional: [ICommandPalette, IMainMenu],
239+
optional: [ICommandPalette],
240240
activate: (
241241
app: JupyterFrontEnd,
242242
translator: ITranslator,
243-
palette: ICommandPalette | null,
244-
menu: IMainMenu | null
243+
palette: ICommandPalette | null
245244
): void => {
246245
const trans = translator.load('notebook');
247246
const baseUrl = PageConfig.getBaseUrl();
@@ -265,13 +264,6 @@ const pages: JupyterFrontEndPlugin<void> = {
265264
palette.addItem({ command, category: 'View' });
266265
});
267266
}
268-
269-
if (menu) {
270-
menu.viewMenu.addGroup(
271-
[{ command: CommandIDs.openLab }, { command: CommandIDs.openTree }],
272-
0
273-
);
274-
}
275267
}
276268
};
277269

@@ -489,12 +481,11 @@ const title: JupyterFrontEndPlugin<void> = {
489481
const topVisibility: JupyterFrontEndPlugin<void> = {
490482
id: '@jupyter-notebook/application-extension:top',
491483
requires: [INotebookShell, ITranslator],
492-
optional: [IMainMenu, ISettingRegistry],
484+
optional: [ISettingRegistry],
493485
activate: (
494486
app: JupyterFrontEnd<JupyterFrontEnd.IShell>,
495487
notebookShell: INotebookShell,
496488
translator: ITranslator,
497-
menu: IMainMenu | null,
498489
settingRegistry: ISettingRegistry | null
499490
) => {
500491
const trans = translator.load('notebook');
@@ -512,10 +503,6 @@ const topVisibility: JupyterFrontEndPlugin<void> = {
512503
isToggled: () => top.isVisible
513504
});
514505

515-
if (menu) {
516-
menu.viewMenu.addGroup([{ command: CommandIDs.toggleTop }], 2);
517-
}
518-
519506
let settingsOverride = false;
520507

521508
if (settingRegistry) {
@@ -648,13 +635,12 @@ const zen: JupyterFrontEndPlugin<void> = {
648635
id: '@jupyter-notebook/application-extension:zen',
649636
autoStart: true,
650637
requires: [ITranslator],
651-
optional: [ICommandPalette, INotebookShell, IMainMenu],
638+
optional: [ICommandPalette, INotebookShell],
652639
activate: (
653640
app: JupyterFrontEnd,
654641
translator: ITranslator,
655642
palette: ICommandPalette | null,
656-
notebookShell: INotebookShell | null,
657-
menu: IMainMenu | null
643+
notebookShell: INotebookShell | null
658644
): void => {
659645
const { commands } = app;
660646
const elem = document.documentElement;
@@ -695,10 +681,6 @@ const zen: JupyterFrontEndPlugin<void> = {
695681
if (palette) {
696682
palette.addItem({ command: CommandIDs.toggleZen, category: 'Mode' });
697683
}
698-
699-
if (menu) {
700-
menu.viewMenu.addGroup([{ command: CommandIDs.toggleZen }], 3);
701-
}
702684
}
703685
};
704686

0 commit comments

Comments
 (0)