From ad8686db0a6e90794a30b22e495e5564dfd16ede Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 17 Aug 2022 18:06:39 +0200 Subject: [PATCH] chore(element-templates): set `bpmn:Group` label in a side-effect free manner We shall rely on bpmn-js behaviors to wire the group element with the diagrams underlying `bpmn:Definitions` object. --- src/provider/element-templates/util/templateUtil.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/provider/element-templates/util/templateUtil.js b/src/provider/element-templates/util/templateUtil.js index 00e4de201..6fe62a158 100644 --- a/src/provider/element-templates/util/templateUtil.js +++ b/src/provider/element-templates/util/templateUtil.js @@ -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'; @@ -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), @@ -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);