Hello,
I am trying to delete an element if it goes in my else statement, but all that the this.modeling.removeElements is doing is deleting the line that connects the actual element.
Anyone have any idea what am I doing wrong?
Any help would be appreciated
eventBus.on('commandStack.connection.create.postExecute', (event: any) => {
console.log('PostExecute:', event);
const connection = event.context.connection;
const sourceElement = connection.source.type;
const targetElement = connection.target.type;
const targetShape = connection.target;
if(targetElement === 'bpmn:Task'){
if (sourceElement === 'bpmn:ExclusiveGateway'){
console.log('GOOD');
} else {
console.log('BAD');
alert("Greska");
this.modeling.removeElements([targetShape]);
console.log('delete good :::connection',);
throw new Error("TargetGateway error")
}
}
});