Skip to content

Commit

Permalink
Handle parsing of pm blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjacornelius committed Aug 8, 2023
1 parent 53a4c46 commit 8c652ad
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/modeler/Modeler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ export default {
: [pmBlockNode.bpmnType];
types.forEach(bpmnType => {
if (!this.parsers[bpmnType]) {
this.parsers[bpmnType] = { custom: [], implementation: [], default: []};
}
if (customParser) {
this.parsers[bpmnType].custom.push(customParser);
return;
Expand Down Expand Up @@ -839,14 +843,19 @@ export default {
const diagram = this.planeElements.find(diagram => diagram.bpmnElement.id === definition.id);
const bpmnType = definition.$type;
const parser = this.getCustomParser(definition);
const config = definition.config ? JSON.parse(definition.config) : null;
if (!parser) {
this.handleUnsupportedElement(bpmnType, flowElements, definition, artifacts, diagram);
return;
}
this.removeUnsupportedElementAttributes(definition);
const type = parser(definition, this.moddle);
let type = parser(definition, this.moddle);
if (config?.processKey) {
type = config.processKey;
}
const unnamedElements = ['bpmn:TextAnnotation', 'bpmn:Association', 'bpmn:DataOutputAssociation', 'bpmn:DataInputAssociation'];
const requireName = unnamedElements.indexOf(bpmnType) === -1;
Expand Down Expand Up @@ -963,7 +972,6 @@ export default {
const { x, y } = this.paperManager.clientToGridPoint(clientX, clientY);
diagram.bounds.x = x;
diagram.bounds.y = y;
const newNode = this.createNode(control.type, definition, diagram);
if (newNode.isBpmnType('bpmn:BoundaryEvent')) {
Expand Down Expand Up @@ -1318,6 +1326,7 @@ export default {
*/
window.ProcessMaker.EventBus.$emit('modeler-before-init', {
registerComponentMixin: this.registerComponentMixin,
registerPmBlock: this.registerPmBlock,
});
this.registerNode(Process);
Expand All @@ -1327,7 +1336,6 @@ export default {
registerBpmnExtension: this.registerBpmnExtension,
registerNode: this.registerNode,
registerStatusBar: this.registerStatusBar,
registerPmBlock: this.registerPmBlock,
});
this.moddle = new BpmnModdle(this.extensions);
Expand Down

0 comments on commit 8c652ad

Please sign in to comment.