Skip to content

Commit 9dfcc37

Browse files
committed
Move cell type menus to the settings
1 parent 4b889ff commit 9dfcc37

File tree

2 files changed

+32
-41
lines changed

2 files changed

+32
-41
lines changed

packages/application-extension/schema/menus.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,37 @@
1515
"rank": 20
1616
}
1717
]
18+
},
19+
{
20+
"id": "jp-mainmenu-run",
21+
"items": [
22+
{
23+
"type": "separator",
24+
"rank": 1000
25+
},
26+
{
27+
"type": "submenu",
28+
"rank": 1010,
29+
"submenu": {
30+
"id": "jp-runmenu-change-cell-type",
31+
"label": "Cell Type",
32+
"items": [
33+
{
34+
"command": "notebook:change-cell-to-code",
35+
"rank": 0
36+
},
37+
{
38+
"command": "notebook:change-cell-to-markdown",
39+
"rank": 0
40+
},
41+
{
42+
"command": "notebook:change-cell-to-raw",
43+
"rank": 0
44+
}
45+
]
46+
}
47+
}
48+
]
1849
}
1950
]
2051
},

packages/notebook-extension/src/index.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import { Text, Time } from '@jupyterlab/coreutils';
1414

1515
import { IDocumentManager } from '@jupyterlab/docmanager';
1616

17-
import { IMainMenu } from '@jupyterlab/mainmenu';
18-
1917
import { NotebookPanel, INotebookTracker } from '@jupyterlab/notebook';
2018

2119
import { ISettingRegistry } from '@jupyterlab/settingregistry';
@@ -26,7 +24,7 @@ import { INotebookShell } from '@jupyter-notebook/application';
2624

2725
import { Poll } from '@lumino/polling';
2826

29-
import { Menu, Widget } from '@lumino/widgets';
27+
import { Widget } from '@lumino/widgets';
3028

3129
/**
3230
* The class for kernel status errors.
@@ -225,43 +223,6 @@ const kernelStatus: JupyterFrontEndPlugin<void> = {
225223
}
226224
};
227225

228-
/**
229-
* A plugin to customize notebook related menu entries
230-
* TODO: switch to settings define menus when fixed upstream: https://github.com/jupyterlab/jupyterlab/issues/11754
231-
*/
232-
const menuPlugin: JupyterFrontEndPlugin<void> = {
233-
id: '@jupyter-notebook/notebook-extension:menu-plugin',
234-
autoStart: true,
235-
requires: [IMainMenu, ITranslator],
236-
activate: (
237-
app: JupyterFrontEnd,
238-
mainMenu: IMainMenu,
239-
translator: ITranslator
240-
) => {
241-
const { commands } = app;
242-
const trans = translator.load('notebook');
243-
244-
const cellTypeSubmenu = new Menu({ commands });
245-
cellTypeSubmenu.title.label = trans._p('menu', 'Cell Type');
246-
[
247-
'notebook:change-cell-to-code',
248-
'notebook:change-cell-to-markdown',
249-
'notebook:change-cell-to-raw'
250-
].forEach(command => {
251-
cellTypeSubmenu.addItem({
252-
command
253-
});
254-
});
255-
256-
mainMenu.runMenu.addItem({ type: 'separator', rank: 1000 });
257-
mainMenu.runMenu.addItem({
258-
type: 'submenu',
259-
submenu: cellTypeSubmenu,
260-
rank: 1010
261-
});
262-
}
263-
};
264-
265226
/**
266227
* A plugin to enable scrolling for outputs by default.
267228
* Mimic the logic from the classic notebook, as found here:
@@ -358,7 +319,6 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
358319
checkpoints,
359320
kernelLogo,
360321
kernelStatus,
361-
menuPlugin,
362322
scrollOutput
363323
];
364324

0 commit comments

Comments
 (0)