Skip to content

Commit c74a098

Browse files
committed
Add Diagram menu
1 parent 41af2fc commit c74a098

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

src/drawio/modulated.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90857,7 +90857,7 @@ EditorUi.compactUi = true;
9085790857
EditorUi.prototype.splitSize = (mxClient.IS_TOUCH || mxClient.IS_POINTER) ? 12 : 8;
9085890858

9085990859
/**
90860-
* Specifies the height of the menubar. Default is 34. MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
90860+
* Specifies the height of the menubar. Default is 34.
9086190861
*/
9086290862
EditorUi.prototype.menubarHeight = 0;
9086390863

@@ -90872,12 +90872,12 @@ EditorUi.prototype.formatEnabled = true;
9087290872
EditorUi.prototype.formatWidth = 240;
9087390873

9087490874
/**
90875-
* Specifies the height of the toolbar. Default is 36. MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
90875+
* Specifies the height of the toolbar. Default is 36.
9087690876
*/
9087790877
EditorUi.prototype.toolbarHeight = 0;
9087890878

9087990879
/**
90880-
* Specifies the height of the footer. Default is 28. MMMMMMMMMMMMMMMMM
90880+
* Specifies the height of the footer. Default is 28.
9088190881
*/
9088290882
EditorUi.prototype.footerHeight = 0;
9088390883

src/index.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,22 @@ function addMenus(
185185
menu: IMainMenu,
186186
tracker: IDrawioTracker
187187
): void {
188+
const diagram = new JupyterLabMenu({ commands });
189+
diagram.menu.title.label = 'Diagram';
190+
188191
// FILE MENU
189192
// Add new text file creation to the file menu.
190193
menu.fileMenu.newMenu.addGroup([{ command: 'drawio:create-new' }], 40);
191-
menu.fileMenu.addGroup(
194+
const fileMenu = new JupyterLabMenu({ commands });
195+
fileMenu.menu.title.label = 'File';
196+
fileMenu.addGroup([{ command: 'drawio:create-new' }], 0);
197+
fileMenu.addGroup(
192198
[
193199
{ command: 'drawio:export-svg' },
194200
{ command: 'drawio:command/pageSetup' },
195201
{ command: 'drawio:command/print' }
196202
],
197-
40
203+
1
198204
);
199205

200206
// Edit MENU
@@ -203,9 +209,9 @@ function addMenus(
203209
undo: (widget: any) => widget.execute('undo'),
204210
redo: (widget: any) => widget.execute('redo')
205211
} as any);
206-
212+
207213
const editMenu = new JupyterLabMenu({ commands });
208-
editMenu.menu.title.label = 'Diagram Edit';
214+
editMenu.menu.title.label = 'Edit';
209215
editMenu.addGroup(
210216
[{ command: 'drawio:command/undo' }, { command: 'drawio:command/redo' }],
211217
0
@@ -246,11 +252,10 @@ function addMenus(
246252
6
247253
);
248254
editMenu.addGroup([{ command: 'drawio:command/lockUnlock' }], 7);
249-
menu.addMenu(editMenu.menu, { rank: 20 });
250255

251256
// View MENU
252257
const viewMenu = new JupyterLabMenu({ commands });
253-
viewMenu.menu.title.label = 'Diagram View';
258+
viewMenu.menu.title.label = 'View';
254259
viewMenu.addGroup(
255260
[
256261
{ command: 'drawio:command/formatPanel' },
@@ -292,11 +297,10 @@ function addMenus(
292297
],
293298
5
294299
);
295-
menu.addMenu(viewMenu.menu, { rank: 20 });
296300

297301
// Arrange MENU
298302
const arrangeMenu = new JupyterLabMenu({ commands });
299-
arrangeMenu.menu.title.label = 'Diagram Arrange';
303+
arrangeMenu.menu.title.label = 'Arrange';
300304
arrangeMenu.addGroup(
301305
[
302306
{ command: 'drawio:command/toFront' },
@@ -435,11 +439,9 @@ function addMenus(
435439
5
436440
);
437441

438-
menu.addMenu(arrangeMenu.menu, { rank: 60 });
439-
440442
// Extras MENU
441443
const extrasMenu = new JupyterLabMenu({ commands });
442-
extrasMenu.menu.title.label = 'Diagram Extras';
444+
extrasMenu.menu.title.label = 'Extras';
443445
extrasMenu.addGroup(
444446
[
445447
{ command: 'drawio:command/copyConnect' },
@@ -448,8 +450,17 @@ function addMenus(
448450
0
449451
);
450452
extrasMenu.addGroup([{ command: 'drawio:command/editDiagram' }], 1);
451-
menu.addMenu(extrasMenu.menu, { rank: 70 });
452453

453454
// Help MENU
454-
menu.helpMenu.addGroup([{ command: 'drawio:command/about' }], 77);
455+
//menu.helpMenu.addGroup([{ command: 'drawio:command/about' }], 77);
456+
457+
diagram.addGroup([
458+
{ type: 'submenu', submenu: fileMenu.menu },
459+
{ type: 'submenu', submenu: editMenu.menu },
460+
{ type: 'submenu', submenu: viewMenu.menu },
461+
{ type: 'submenu', submenu: arrangeMenu.menu },
462+
{ type: 'submenu', submenu: extrasMenu.menu },
463+
{ command: 'drawio:command/about' }
464+
], 0);
465+
menu.addMenu(diagram.menu, { rank: 60 });
455466
}

0 commit comments

Comments
 (0)