Skip to content

Commit

Permalink
chore(element-templates): set bpmn:Group label in a side-effect fre…
Browse files Browse the repository at this point in the history
…e manner

We shall rely on bpmn-js behaviors to wire the group element with the
diagrams underlying `bpmn:Definitions` object.
  • Loading branch information
nikku committed Aug 17, 2022
1 parent 6561d59 commit ad8686d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/provider/element-templates/util/templateUtil.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getLabel, setLabel } from 'bpmn-js/lib/features/label-editing/LabelUtil';
import { createCategoryValue } from 'bpmn-js/lib/features/modeling/behavior/util/CategoryUtil';
import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';

import { isUndefined } from 'min-dash';
Expand Down Expand Up @@ -111,8 +110,7 @@ function leftPad(string, length, character) {
}

function createBlankBusinessObject(element, injector) {
const bpmnFactory = injector.get('bpmnFactory'),
bpmnJs = injector.get('bpmnjs');
const bpmnFactory = injector.get('bpmnFactory');

const bo = getBusinessObject(element),
newBo = bpmnFactory.create(bo.$type),
Expand All @@ -123,10 +121,7 @@ function createBlankBusinessObject(element, injector) {
}

if (is(element, 'bpmn:Group')) {
const definitions = bpmnJs.getDefinitions();
const categoryValue = createCategoryValue(definitions, bpmnFactory);

newBo.categoryValueRef = categoryValue;
newBo.categoryValueRef = bpmnFactory.create('bpmn:CategoryValue');
}

setLabel({ businessObject: newBo }, label);
Expand Down

0 comments on commit ad8686d

Please sign in to comment.