@@ -16,19 +16,30 @@ import { DocumentRegistry, DocumentWidget } from '@jupyterlab/docregistry';
1616
1717import { MainMenu , JupyterLabMenu } from '@jupyterlab/mainmenu' ;
1818
19- import { CommandToolbarButton } from '@jupyterlab/apputils' ;
20-
2119import { IChangedArgs , PathExt } from '@jupyterlab/coreutils' ;
2220
21+ import { undoIcon , redoIcon } from '@jupyterlab/ui-components' ;
22+
2323import { CommandRegistry } from '@lumino/commands' ;
2424
2525import { Signal } from '@lumino/signaling' ;
2626
2727import { DrawIOWidget } from './widget' ;
2828
29- import { formatPanelIcon , plusIcon } from './icons' ;
30-
31- //import { DrawIOToolbarButton } from './toolbar';
29+ import { DrawIOToolbarButton } from './toolbar' ;
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' ;
3243
3344const DIRTY_CLASS = 'jp-mod-dirty' ;
3445
@@ -206,93 +217,45 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
206217
207218 this . toolbar . addItem ( 'ViewDropdown' , this . _menubar ) ;
208219
209- /* actions['zoomIn'].iconCls = 'geSprite geSprite-zoomin';
220+ actions [ 'zoomIn' ] . icon = zoominIcon ;
221+ actions [ 'zoomIn' ] . tooltip = 'Zoom In (Ctrl+(Numpad)/Alt+Mousewheel)' ;
210222 this . toolbar . addItem ( 'zoomIn' , new DrawIOToolbarButton ( actions [ 'zoomIn' ] ) ) ;
211- actions['zoomOut'].iconCls = 'geSprite geSprite-zoomout';
212- this.toolbar.addItem(
213- 'zoomOut',
214- new DrawIOToolbarButton(actions['zoomOut'])
215- ); */
216-
217- const button = new CommandToolbarButton ( {
218- id : 'drawio:command/zoomIn' ,
219- commands : this . _commands
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- ) ;
230-
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- ) ;
245-
246- this . toolbar . addItem (
247- 'delete' ,
248- new CommandToolbarButton ( {
249- id : 'drawio:command/delete' ,
250- commands : this . _commands
251- } )
252- ) ;
253-
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 ( {
270- id : 'drawio:command/fillColor' ,
271- commands : this . _commands
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',
280- commands: this._commands
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- ) ;
223+
224+ actions [ 'zoomOut' ] . icon = zoomoutIcon ;
225+ actions [ 'zoomOut' ] . tooltip = 'Zoom Out (Ctrl-(Numpad)/Alt+Mousewheel)' ;
226+ this . toolbar . addItem ( 'zoomOut' , new DrawIOToolbarButton ( actions [ 'zoomOut' ] ) ) ;
227+
228+ actions [ 'undo' ] . icon = undoIcon ;
229+ actions [ 'fillColor' ] . tooltip = 'Undo (Ctrl+Z)' ;
230+ this . toolbar . addItem ( 'undo' , new DrawIOToolbarButton ( actions [ 'undo' ] ) ) ;
231+
232+ actions [ 'redo' ] . icon = redoIcon ;
233+ actions [ 'redo' ] . tooltip = 'Redo (Ctrl+Shift+Z)' ;
234+ this . toolbar . addItem ( 'redo' , new DrawIOToolbarButton ( actions [ 'redo' ] ) ) ;
235+
236+ actions [ 'delete' ] . icon = deleteIcon ;
237+ actions [ 'delete' ] . tooltip = 'Delete' ;
238+ this . toolbar . addItem ( 'delete' , new DrawIOToolbarButton ( actions [ 'delete' ] ) ) ;
239+
240+ actions [ 'toFront' ] . icon = toFrontIcon ;
241+ actions [ 'toFront' ] . tooltip = 'To Front (Ctrl+Shift+F)' ;
242+ this . toolbar . addItem ( 'toFront' , new DrawIOToolbarButton ( actions [ 'toFront' ] ) ) ;
243+
244+ actions [ 'toBack' ] . icon = toBackIcon ;
245+ actions [ 'toBack' ] . tooltip = 'To Back (Ctrl+Shift+B)' ;
246+ this . toolbar . addItem ( 'toBack' , new DrawIOToolbarButton ( actions [ 'toBack' ] ) ) ;
247+
248+ actions [ 'fillColor' ] . icon = fillColorIcon ;
249+ actions [ 'fillColor' ] . tooltip = 'Fill Color' ;
250+ this . toolbar . addItem ( 'fillColor' , new DrawIOToolbarButton ( actions [ 'fillColor' ] ) ) ;
251+
252+ actions [ 'strokeColor' ] . icon = strokeColorIcon ;
253+ actions [ 'strokeColor' ] . tooltip = 'Fill Stroke Color' ;
254+ this . toolbar . addItem ( 'strokeColor' , new DrawIOToolbarButton ( actions [ 'strokeColor' ] ) ) ;
255+
256+ actions [ 'shadow' ] . icon = shadowIcon ;
257+ actions [ 'shadow' ] . tooltip = 'Shadow' ;
258+ this . toolbar . addItem ( 'shadow' , new DrawIOToolbarButton ( actions [ 'shadow' ] ) ) ;
296259 }
297260
298261 private _commands : CommandRegistry ;
0 commit comments