I want to extend the custom element inside the definitions element on the process, just like signal.
Here is my code:
1、First,I defined a json file。
{
"name": "Ext",
"uri": "http://ext.org/schema/1.0/bpmn",
"prefix": "ext",
"xml": {
"tagAlias": "lowerCase"
},
"associations": [],
"types": [
{
"name": "Shareniu",
"superClass": [
"RootElement"
],
"properties": [
{
"name": "name",
"isAttr": true,
"type": "String"
},
{
"name": "operations",
"type": "Operation",
"isMany": true
},
{
"name": "implementationRef",
"type": "String",
"isAttr": true
}
]
},
{
"name": "ColoredShape",
"extends": [ "bpmn:Process" ],
"properties": [
{
"name": "stroke",
"isAttr": true,
"type": "String"
},
{
"name": "fill",
"isAttr": true,
"type": "String"
}
]
},
{
"name": "Cc",
"superClass": [ "Element" ],
"meta": {
"allowedIn": [ "*" ]
},
"properties": [
{
"name": "expression",
"isAttr": true,
"type": "String"
},
{
"name": "class",
"isAttr": true,
"type": "String"
},
{
"name": "delegateExpression",
"isAttr": true,
"type": "String"
},
{
"name": "event",
"isAttr": true,
"type": "String"
},
{
"name": "script",
"type": "Script"
},
{
"name": "fields",
"type": "Field",
"isMany": true
}
]
}
],
"emumerations": [ ]
}
2、I used the following code to update the element properties.
var _bpmnDefinitions = bpmnModeler.get('elementRegistry').get('Process_1').businessObject.$parent;
var modeling = bpmnModeler.get('modeling');
console.log(modeling);
var shareniuExtensionElements = elementHelper.createElement('ext:Cc', { event: 'start',
class: '111'}, _bpmnDefinitions, bpmnFactory);
_bpmnDefinitions.rootElements.push(shareniuExtensionElements);
3、After I exported the xml, he worked very well.
<ext:cc class="111" event="start" />
4、When I import the xml generated above, the custom element is missing.(<ext:cc class=“111” event=“start” />)