chore(import): make root discovery future proof

Related to https://github.com/bpmn-io/bpmn-js/issues/1546
This commit is contained in:
Nico Rehwaldt 2021-12-10 11:06:09 +01:00 committed by fake-join[bot]
parent a09926c325
commit bb59dd0b61
1 changed files with 6 additions and 3 deletions

View File

@ -77,10 +77,13 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
var mainDiagram = bpmnDiagram || definitions.diagrams[0];
var rootId = mainDiagram.plane.bpmnElement.id;
// we do need to account for different ways we create root elements
// each nested imported <root> do have the `_plane` suffix, while
// the root <root> is found under the business object ID
canvas.setRootElement(
canvas.findRoot(
mainDiagram.plane.bpmnElement.id
)
canvas.findRoot(rootId + '_plane') || canvas.findRoot(rootId)
);
}