@@ -26,7 +26,12 @@ import { Signal } from '@lumino/signaling';
26
26
27
27
import { DrawIOWidget } from './widget' ;
28
28
29
- import { DrawIOToolbarButton } from './toolbar' ;
29
+ import {
30
+ formatPanelIcon ,
31
+ plusIcon
32
+ } from './icons' ;
33
+
34
+ //import { DrawIOToolbarButton } from './toolbar';
30
35
31
36
const DIRTY_CLASS = 'jp-mod-dirty' ;
32
37
@@ -49,7 +54,7 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
49
54
// Add toolbar actions to change the default style of arrows and conections.
50
55
this . _menuView = new JupyterLabMenu ( { commands : this . _commands } ) ;
51
56
this . _menuView . menu . title . caption = 'View (Space+Drag to Scroll)' ;
52
- this . _menuView . menu . title . iconClass = 'geSprite geSprite-formatpanel' ;
57
+ this . _menuView . menu . title . icon = formatPanelIcon ;
53
58
this . _menubar . addMenu ( this . _menuView . menu , { rank : 1 } ) ;
54
59
55
60
this . _menuZoom = new JupyterLabMenu ( { commands : this . _commands } ) ;
@@ -60,7 +65,7 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
60
65
61
66
this . _menuInsert = new JupyterLabMenu ( { commands : this . _commands } ) ;
62
67
this . _menuInsert . menu . title . caption = 'Insert' ;
63
- this . _menuInsert . menu . title . iconClass = 'geSprite geSprite-plus' ;
68
+ this . _menuInsert . menu . title . icon = plusIcon ;
64
69
this . _menubar . addMenu ( this . _menuInsert . menu , { rank : 2 } ) ;
65
70
66
71
this . context . ready . then ( async value => {
@@ -204,13 +209,22 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
204
209
205
210
this . toolbar . addItem ( 'ViewDropdown' , this . _menubar ) ;
206
211
207
- actions [ 'zoomIn' ] . iconCls = 'geSprite geSprite-zoomin' ;
212
+ /* actions['zoomIn'].iconCls = 'geSprite geSprite-zoomin';
208
213
this.toolbar.addItem('zoomIn', new DrawIOToolbarButton(actions['zoomIn']));
209
214
actions['zoomOut'].iconCls = 'geSprite geSprite-zoomout';
210
215
this.toolbar.addItem(
211
216
'zoomOut',
212
217
new DrawIOToolbarButton(actions['zoomOut'])
213
- ) ;
218
+ ); */
219
+ actions [ 'delete' ] . addListener ( 'stateChanged' , ( ) => this . toolbar . update ( ) ) ;
220
+ this . toolbar . addItem ( 'zoomIn' , new CommandToolbarButton ( {
221
+ id : 'drawio:command/zoomIn' ,
222
+ commands : this . _commands
223
+ } ) ) ;
224
+ this . toolbar . addItem ( 'zoomOut' , new CommandToolbarButton ( {
225
+ id : 'drawio:command/zoomOut' ,
226
+ commands : this . _commands
227
+ } ) ) ;
214
228
215
229
this . toolbar . addItem ( 'undo' , new CommandToolbarButton ( {
216
230
id : 'drawio:command/undo' ,
@@ -221,29 +235,32 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
221
235
commands : this . _commands
222
236
} ) ) ;
223
237
224
- actions [ 'delete' ] . iconCls = 'geSprite geSprite-delete' ;
225
- this . toolbar . addItem ( 'delete' , new DrawIOToolbarButton ( actions [ 'delete' ] ) ) ;
238
+ this . toolbar . addItem ( 'delete' , new CommandToolbarButton ( {
239
+ id : 'drawio:command/delete' ,
240
+ commands : this . _commands
241
+ } ) ) ;
226
242
227
- actions [ 'toFront' ] . iconCls = 'geSprite geSprite-tofront' ;
228
- this . toolbar . addItem (
229
- 'toFront' ,
230
- new DrawIOToolbarButton ( actions [ 'toFront' ] )
231
- ) ;
232
- actions [ 'toBack' ] . iconCls = 'geSprite geSprite-toback' ;
233
- this . toolbar . addItem ( 'toBack' , new DrawIOToolbarButton ( actions [ 'toBack' ] ) ) ;
243
+ this . toolbar . addItem ( 'toFront' , new CommandToolbarButton ( {
244
+ id : 'drawio:command/toFront' ,
245
+ commands : this . _commands
246
+ } ) ) ;
247
+ this . toolbar . addItem ( 'toBack' , new CommandToolbarButton ( {
248
+ id : 'drawio:command/toBack' ,
249
+ commands : this . _commands
250
+ } ) ) ;
234
251
235
- actions [ 'fillColor' ] . iconCls = 'geSprite geSprite-fillcolor' ;
236
- this . toolbar . addItem (
237
- 'fillColor' ,
238
- new DrawIOToolbarButton ( actions [ 'fillColor' ] )
239
- ) ;
240
- actions [ 'strokeColor' ] . iconCls = 'geSprite geSprite-strokecolor' ;
241
- this . toolbar . addItem (
242
- 'strokeColor' ,
243
- new DrawIOToolbarButton ( actions [ 'strokeColor' ] )
244
- ) ;
245
- actions [ 'shadow' ] . iconCls = 'geSprite geSprite-shadow' ;
246
- this . toolbar . addItem ( 'shadow' , new DrawIOToolbarButton ( actions [ 'shadow' ] ) ) ;
252
+ this . toolbar . addItem ( 'fillColor' , new CommandToolbarButton ( {
253
+ id : 'drawio:command/fillColor' ,
254
+ commands : this . _commands
255
+ } ) ) ;
256
+ this . toolbar . addItem ( 'strokeColor' , new CommandToolbarButton ( {
257
+ id : 'drawio:command/strokeColor' ,
258
+ commands : this . _commands
259
+ } ) ) ;
260
+ this . toolbar . addItem ( 'shadow' , new CommandToolbarButton ( {
261
+ id : 'drawio:command/shadow' ,
262
+ commands : this . _commands
263
+ } ) ) ;
247
264
}
248
265
249
266
private _commands : CommandRegistry ;
0 commit comments