Re-initializes the modeler when a new file is selected

This commit is contained in:
Aaron Louie 2020-01-24 12:31:21 -05:00
parent a59d5120a1
commit b00486251a

View File

@ -1,5 +1,5 @@
import {HttpErrorResponse} from '@angular/common/http';
import {AfterViewInit, Component, ElementRef, EventEmitter, NgZone, Output, ViewChild} from '@angular/core';
import {AfterViewInit, Component, ElementRef, EventEmitter, NgZone, Output, Renderer2, ViewChild} from '@angular/core';
import {ControlValueAccessor} from '@angular/forms';
import * as bpmnPropertiesPanelModule from 'bpmn-js-properties-panel';
import * as bpmnPropertiesProviderModule from 'bpmn-js-properties-panel/lib/provider/camunda';
@ -56,6 +56,8 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
}
initializeModeler(diagramType) {
this.clearElements();
if (diagramType === 'dmn') {
this.initializeDMNModeler();
} else {
@ -201,4 +203,11 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
}
});
}
private clearElements() {
const els: HTMLElement[] = [this.containerRef.nativeElement, this.propertiesRef.nativeElement];
els.forEach(e => {
e.innerHTML = '';
});
}
}