@@ -18,6 +18,8 @@ import { MainMenu, JupyterLabMenu } from '@jupyterlab/mainmenu';
18
18
19
19
import { IChangedArgs , PathExt } from '@jupyterlab/coreutils' ;
20
20
21
+ import { undoIcon , redoIcon } from '@jupyterlab/ui-components' ;
22
+
21
23
import { CommandRegistry } from '@lumino/commands' ;
22
24
23
25
import { Signal } from '@lumino/signaling' ;
@@ -26,6 +28,19 @@ import { DrawIOWidget } from './widget';
26
28
27
29
import { DrawIOToolbarButton } from './toolbar' ;
28
30
31
+ import {
32
+ formatPanelIcon ,
33
+ plusIcon ,
34
+ zoominIcon ,
35
+ zoomoutIcon ,
36
+ deleteIcon ,
37
+ toFrontIcon ,
38
+ toBackIcon ,
39
+ fillColorIcon ,
40
+ strokeColorIcon ,
41
+ shadowIcon
42
+ } from './icons' ;
43
+
29
44
const DIRTY_CLASS = 'jp-mod-dirty' ;
30
45
31
46
export class DrawIODocumentWidget extends DocumentWidget < DrawIOWidget > {
@@ -41,12 +56,13 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
41
56
this . _menubar = new MainMenu ( this . _commands ) ;
42
57
43
58
this . _menubar . clearMenus ( ) ;
59
+ this . toolbar . addClass ( 'dio-toolbar' ) ;
44
60
45
61
//TODO:
46
62
// Add toolbar actions to change the default style of arrows and conections.
47
63
this . _menuView = new JupyterLabMenu ( { commands : this . _commands } ) ;
48
64
this . _menuView . menu . title . caption = 'View (Space+Drag to Scroll)' ;
49
- this . _menuView . menu . title . iconClass = 'geSprite geSprite-formatpanel' ;
65
+ this . _menuView . menu . title . icon = formatPanelIcon ;
50
66
this . _menubar . addMenu ( this . _menuView . menu , { rank : 1 } ) ;
51
67
52
68
this . _menuZoom = new JupyterLabMenu ( { commands : this . _commands } ) ;
@@ -57,7 +73,7 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
57
73
58
74
this . _menuInsert = new JupyterLabMenu ( { commands : this . _commands } ) ;
59
75
this . _menuInsert . menu . title . caption = 'Insert' ;
60
- this . _menuInsert . menu . title . iconClass = 'geSprite geSprite-plus' ;
76
+ this . _menuInsert . menu . title . icon = plusIcon ;
61
77
this . _menubar . addMenu ( this . _menuInsert . menu , { rank : 2 } ) ;
62
78
63
79
this . context . ready . then ( async value => {
@@ -201,41 +217,56 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
201
217
202
218
this . toolbar . addItem ( 'ViewDropdown' , this . _menubar ) ;
203
219
204
- actions [ 'zoomIn' ] . iconCls = 'geSprite geSprite-zoomin' ;
220
+ actions [ 'zoomIn' ] . icon = zoominIcon ;
221
+ actions [ 'zoomIn' ] . tooltip = 'Zoom In (Ctrl+(Numpad)/Alt+Mousewheel)' ;
205
222
this . toolbar . addItem ( 'zoomIn' , new DrawIOToolbarButton ( actions [ 'zoomIn' ] ) ) ;
206
- actions [ 'zoomOut' ] . iconCls = 'geSprite geSprite-zoomout' ;
223
+
224
+ actions [ 'zoomOut' ] . icon = zoomoutIcon ;
225
+ actions [ 'zoomOut' ] . tooltip = 'Zoom Out (Ctrl-(Numpad)/Alt+Mousewheel)' ;
207
226
this . toolbar . addItem (
208
227
'zoomOut' ,
209
228
new DrawIOToolbarButton ( actions [ 'zoomOut' ] )
210
229
) ;
211
230
212
- actions [ 'undo' ] . iconCls = 'geSprite geSprite-undo' ;
231
+ actions [ 'undo' ] . icon = undoIcon ;
232
+ actions [ 'fillColor' ] . tooltip = 'Undo (Ctrl+Z)' ;
213
233
this . toolbar . addItem ( 'undo' , new DrawIOToolbarButton ( actions [ 'undo' ] ) ) ;
214
- actions [ 'redo' ] . iconCls = 'geSprite geSprite-redo' ;
234
+
235
+ actions [ 'redo' ] . icon = redoIcon ;
236
+ actions [ 'redo' ] . tooltip = 'Redo (Ctrl+Shift+Z)' ;
215
237
this . toolbar . addItem ( 'redo' , new DrawIOToolbarButton ( actions [ 'redo' ] ) ) ;
216
238
217
- actions [ 'delete' ] . iconCls = 'geSprite geSprite-delete' ;
239
+ actions [ 'delete' ] . icon = deleteIcon ;
240
+ actions [ 'delete' ] . tooltip = 'Delete' ;
218
241
this . toolbar . addItem ( 'delete' , new DrawIOToolbarButton ( actions [ 'delete' ] ) ) ;
219
242
220
- actions [ 'toFront' ] . iconCls = 'geSprite geSprite-tofront' ;
243
+ actions [ 'toFront' ] . icon = toFrontIcon ;
244
+ actions [ 'toFront' ] . tooltip = 'To Front (Ctrl+Shift+F)' ;
221
245
this . toolbar . addItem (
222
246
'toFront' ,
223
247
new DrawIOToolbarButton ( actions [ 'toFront' ] )
224
248
) ;
225
- actions [ 'toBack' ] . iconCls = 'geSprite geSprite-toback' ;
249
+
250
+ actions [ 'toBack' ] . icon = toBackIcon ;
251
+ actions [ 'toBack' ] . tooltip = 'To Back (Ctrl+Shift+B)' ;
226
252
this . toolbar . addItem ( 'toBack' , new DrawIOToolbarButton ( actions [ 'toBack' ] ) ) ;
227
253
228
- actions [ 'fillColor' ] . iconCls = 'geSprite geSprite-fillcolor' ;
254
+ actions [ 'fillColor' ] . icon = fillColorIcon ;
255
+ actions [ 'fillColor' ] . tooltip = 'Fill Color' ;
229
256
this . toolbar . addItem (
230
257
'fillColor' ,
231
258
new DrawIOToolbarButton ( actions [ 'fillColor' ] )
232
259
) ;
233
- actions [ 'strokeColor' ] . iconCls = 'geSprite geSprite-strokecolor' ;
260
+
261
+ actions [ 'strokeColor' ] . icon = strokeColorIcon ;
262
+ actions [ 'strokeColor' ] . tooltip = 'Fill Stroke Color' ;
234
263
this . toolbar . addItem (
235
264
'strokeColor' ,
236
265
new DrawIOToolbarButton ( actions [ 'strokeColor' ] )
237
266
) ;
238
- actions [ 'shadow' ] . iconCls = 'geSprite geSprite-shadow' ;
267
+
268
+ actions [ 'shadow' ] . icon = shadowIcon ;
269
+ actions [ 'shadow' ] . tooltip = 'Shadow' ;
239
270
this . toolbar . addItem ( 'shadow' , new DrawIOToolbarButton ( actions [ 'shadow' ] ) ) ;
240
271
}
241
272
0 commit comments