forked from bpmn-io/bpmn-js-color-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
46 lines (34 loc) · 855 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import newDiagramXML from './newDiagram.bpmn';
import ColorPickerModule from '..';
import BpmnModeler from 'bpmn-js/lib/Modeler';
const canvas = document.querySelector('#canvas');
const modeler = new BpmnModeler({
container: canvas,
additionalModules: [
ColorPickerModule
],
keyboard: {
bindTo: document
}
});
modeler.importXML(newDiagramXML).then(result => {
const {
warnings = []
} = result;
if (warnings.length) {
console.log('imported with warnings', warnings);
}
}).catch(error => {
console.error('import error', error);
});
// hook up with UI elements
document.querySelector('#export-to-console').addEventListener('click', function(e) {
e.preventDefault();
modeler.saveXML({
format: true
}).then(result => {
console.log(result.xml);
}).catch(err => {
console.error(err);
});
});