Better fix for EditorContext.clearGraph() text and graph sync

This commit is contained in:
BoykoAlex
2018-05-03 23:14:50 -04:00
parent a8558e2c8a
commit 8113fb9c05

View File

@@ -194,10 +194,18 @@ export class EditorComponent implements OnInit, OnDestroy {
clearGraph() {
self.selection = undefined;
self.graphToTextSync = true;
self.graph.clear();
if (self.metamodel && self.metamodel.load && self.editor && self.editor.setDefaultContent) {
return self.metamodel.load().then(data => self.editor.setDefaultContent(this, data));
return self.metamodel.load().then(data => {
self.editor.setDefaultContent(this, data);
if (!self.graphToTextSync) {
self.updateTextRepresentation();
}
});
} else {
if (!self.graphToTextSync) {
self.updateTextRepresentation();
}
}
}