@@ -26,10 +26,7 @@ import { Signal } from '@lumino/signaling';
2626
2727import { DrawIOWidget } from './widget' ;
2828
29- import {
30- formatPanelIcon ,
31- plusIcon
32- } from './icons' ;
29+ import { formatPanelIcon , plusIcon } from './icons' ;
3330
3431//import { DrawIOToolbarButton } from './toolbar';
3532
@@ -216,51 +213,86 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
216213 'zoomOut',
217214 new DrawIOToolbarButton(actions['zoomOut'])
218215 ); */
219- actions [ 'delete' ] . addListener ( 'stateChanged' , ( ) => this . toolbar . update ( ) ) ;
220- this . toolbar . addItem ( 'zoomIn' , new CommandToolbarButton ( {
216+
217+ const button = new CommandToolbarButton ( {
221218 id : 'drawio:command/zoomIn' ,
222219 commands : this . _commands
223- } ) ) ;
224- this . toolbar . addItem ( 'zoomOut' , new CommandToolbarButton ( {
225- id : 'drawio:command/zoomOut' ,
226- commands : this . _commands
227- } ) ) ;
228-
229- this . toolbar . addItem ( 'undo' , new CommandToolbarButton ( {
230- id : 'drawio:command/undo' ,
231- commands : this . _commands
232- } ) ) ;
233- this . toolbar . addItem ( 'redo' , new CommandToolbarButton ( {
234- id : 'drawio:command/redo' ,
235- commands : this . _commands
236- } ) ) ;
220+ } ) ;
221+ actions [ 'zoomIn' ] . addListener ( 'stateChanged' , ( ) => button . update ( ) ) ;
222+ this . toolbar . addItem ( 'zoomIn' , button ) ;
223+ this . toolbar . addItem (
224+ 'zoomOut' ,
225+ new CommandToolbarButton ( {
226+ id : 'drawio:command/zoomOut' ,
227+ commands : this . _commands
228+ } )
229+ ) ;
237230
238- this . toolbar . addItem ( 'delete' , new CommandToolbarButton ( {
239- id : 'drawio:command/delete' ,
240- commands : this . _commands
241- } ) ) ;
231+ this . toolbar . addItem (
232+ 'undo' ,
233+ new CommandToolbarButton ( {
234+ id : 'drawio:command/undo' ,
235+ commands : this . _commands
236+ } )
237+ ) ;
238+ this . toolbar . addItem (
239+ 'redo' ,
240+ new CommandToolbarButton ( {
241+ id : 'drawio:command/redo' ,
242+ commands : this . _commands
243+ } )
244+ ) ;
242245
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- } ) ) ;
246+ this . toolbar . addItem (
247+ 'delete' ,
248+ new CommandToolbarButton ( {
249+ id : 'drawio:command/delete' ,
250+ commands : this . _commands
251+ } )
252+ ) ;
251253
252- this . toolbar . addItem ( 'fillColor' , new CommandToolbarButton ( {
254+ this . toolbar . addItem (
255+ 'toFront' ,
256+ new CommandToolbarButton ( {
257+ id : 'drawio:command/toFront' ,
258+ commands : this . _commands
259+ } )
260+ ) ;
261+ this . toolbar . addItem (
262+ 'toBack' ,
263+ new CommandToolbarButton ( {
264+ id : 'drawio:command/toBack' ,
265+ commands : this . _commands
266+ } )
267+ ) ;
268+
269+ const buttonFillColor = new CommandToolbarButton ( {
253270 id : 'drawio:command/fillColor' ,
254271 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' ,
272+ } ) ;
273+ console . debug ( actions [ 'fillColor' ] ) ;
274+ actions [ 'fillColor' ] . addListener ( 'stateChanged' , ( ) =>
275+ buttonFillColor . update ( )
276+ ) ;
277+ this . toolbar . addItem ( 'fillColor' , buttonFillColor ) ;
278+ /* this.toolbar.addItem('fillColor', new CommandToolbarButton({
279+ id: 'drawio:command/fillColor',
262280 commands: this._commands
263- } ) ) ;
281+ })); */
282+ this . toolbar . addItem (
283+ 'strokeColor' ,
284+ new CommandToolbarButton ( {
285+ id : 'drawio:command/strokeColor' ,
286+ commands : this . _commands
287+ } )
288+ ) ;
289+ this . toolbar . addItem (
290+ 'shadow' ,
291+ new CommandToolbarButton ( {
292+ id : 'drawio:command/shadow' ,
293+ commands : this . _commands
294+ } )
295+ ) ;
264296 }
265297
266298 private _commands : CommandRegistry ;
0 commit comments