Merge branch 'rrt/dev' into dev

This commit is contained in:
Aaron Louie 2020-05-23 14:46:57 -04:00
commit 6ae42b761b
2 changed files with 17 additions and 5 deletions

View File

@ -57,6 +57,7 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
}
onChange(newValue: string, svgValue: string) {
console.log('DiagramComponent default onChange');
}
onTouched() {
@ -123,13 +124,20 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
}
saveDiagram() {
this.modeler.saveSVG((svgErr, svg) => {
this.svg = svg;
if (this.modeler && this.modeler.saveSVG) {
this.modeler.saveSVG((svgErr, svg) => {
this.svg = svg;
this.modeler.saveXML({format: true}, (xmlErr, xml) => {
this.xml = xml;
this.writeValue(xml);
});
});
} else {
this.modeler.saveXML({format: true}, (xmlErr, xml) => {
this.xml = xml;
this.writeValue(xml);
});
});
}
}
saveXML() {
@ -208,14 +216,17 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
moddleExtensions: dmnModelerConfig.moddleExtensions,
});
this.modeler.on('commandStack.changed', () => this.saveDiagram());
this.modeler.on('commandStack.changed', () => {
this.saveDiagram();
});
this.modeler.on('views.changed', () => {
this.saveDiagram();
const viewer = this.modeler.getActiveViewer();
if (viewer) {
viewer.get('eventBus').on('commandStack.changed', () => this.saveDiagram());
}
this.saveDiagram();
});
this.modeler.on('import.done', ({error}) => {

View File

@ -69,6 +69,7 @@ export class ModelerComponent implements AfterViewInit {
ngAfterViewInit(): void {
this.diagramComponent.registerOnChange((newXmlValue: string, newSvgValue: string) => {
console.log('ModelerComponent > DiagramComponent > onChange');
this.draftXml = newXmlValue;
this.svg = newSvgValue;
});