Skip to content

Commit 555ed17

Browse files
committed
new icons
1 parent 41d923a commit 555ed17

File tree

14 files changed

+394
-32
lines changed

14 files changed

+394
-32
lines changed

src/editor.ts

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ import { Signal } from '@lumino/signaling';
2626

2727
import { 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

3136
const 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;

src/icons.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { LabIcon } from '@jupyterlab/ui-components';
2+
3+
// icon svg import statements
4+
import formatPanel from '../style/icons/formatPanel.svg';
5+
import plus from '../style/icons/plus.svg';
6+
import zoomin from '../style/icons/zoomin.svg';
7+
import zoomout from '../style/icons/zoomout.svg';
8+
import del from '../style/icons/del.svg';
9+
import tofront from '../style/icons/tofront.svg';
10+
import toback from '../style/icons/toback.svg';
11+
import fillColor from '../style/icons/fillColor.svg';
12+
import strokeColor from '../style/icons/strokeColor.svg';
13+
import shadow from '../style/icons/shadow.svg';
14+
15+
export const formatPanelIcon = new LabIcon({
16+
name: 'drawio:icon/formatPanel',
17+
svgstr: formatPanel
18+
});
19+
20+
export const plusIcon = new LabIcon({
21+
name: 'drawio:icon/plus',
22+
svgstr: plus
23+
});
24+
25+
export const zoominIcon = new LabIcon({
26+
name: 'drawio:icon/zoomin',
27+
svgstr: zoomin
28+
});
29+
30+
export const zoomoutIcon = new LabIcon({
31+
name: 'drawio:icon/zoomout',
32+
svgstr: zoomout
33+
});
34+
35+
export const deleteIcon = new LabIcon({
36+
name: 'drawio:icon/delete',
37+
svgstr: del
38+
});
39+
40+
export const toFrontIcon = new LabIcon({
41+
name: 'drawio:icon/toFront',
42+
svgstr: tofront
43+
});
44+
45+
export const toBackIcon = new LabIcon({
46+
name: 'drawio:icon/toBack',
47+
svgstr: toback
48+
});
49+
50+
export const fillColorIcon = new LabIcon({
51+
name: 'drawio:icon/fillColor',
52+
svgstr: fillColor
53+
});
54+
55+
export const strokeColorIcon = new LabIcon({
56+
name: 'drawio:icon/strokeColor',
57+
svgstr: strokeColor
58+
});
59+
60+
export const shadowIcon = new LabIcon({
61+
name: 'drawio:icon/shadow',
62+
svgstr: shadow
63+
});

0 commit comments

Comments
 (0)