@@ -26,7 +26,12 @@ import { Signal } from '@lumino/signaling';
2626
2727import { DrawIOWidget } from './widget' ;
2828
29- import { DrawIOToolbarButton } from './toolbar' ;
29+ import {
30+ formatPanelIcon ,
31+ plusIcon
32+ } from './icons' ;
33+
34+ //import { DrawIOToolbarButton } from './toolbar';
3035
3136const DIRTY_CLASS = 'jp-mod-dirty' ;
3237
@@ -49,7 +54,7 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
4954 // Add toolbar actions to change the default style of arrows and conections.
5055 this . _menuView = new JupyterLabMenu ( { commands : this . _commands } ) ;
5156 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 ;
5358 this . _menubar . addMenu ( this . _menuView . menu , { rank : 1 } ) ;
5459
5560 this . _menuZoom = new JupyterLabMenu ( { commands : this . _commands } ) ;
@@ -60,7 +65,7 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
6065
6166 this . _menuInsert = new JupyterLabMenu ( { commands : this . _commands } ) ;
6267 this . _menuInsert . menu . title . caption = 'Insert' ;
63- this . _menuInsert . menu . title . iconClass = 'geSprite geSprite-plus' ;
68+ this . _menuInsert . menu . title . icon = plusIcon ;
6469 this . _menubar . addMenu ( this . _menuInsert . menu , { rank : 2 } ) ;
6570
6671 this . context . ready . then ( async value => {
@@ -204,13 +209,22 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
204209
205210 this . toolbar . addItem ( 'ViewDropdown' , this . _menubar ) ;
206211
207- actions [ 'zoomIn' ] . iconCls = 'geSprite geSprite-zoomin' ;
212+ /* actions['zoomIn'].iconCls = 'geSprite geSprite-zoomin';
208213 this.toolbar.addItem('zoomIn', new DrawIOToolbarButton(actions['zoomIn']));
209214 actions['zoomOut'].iconCls = 'geSprite geSprite-zoomout';
210215 this.toolbar.addItem(
211216 'zoomOut',
212217 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+ } ) ) ;
214228
215229 this . toolbar . addItem ( 'undo' , new CommandToolbarButton ( {
216230 id : 'drawio:command/undo' ,
@@ -221,29 +235,32 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
221235 commands : this . _commands
222236 } ) ) ;
223237
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+ } ) ) ;
226242
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+ } ) ) ;
234251
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+ } ) ) ;
247264 }
248265
249266 private _commands : CommandRegistry ;
0 commit comments