Prevent deletion of End/Start event label

How to prevent deletion of an End/start event label;
I tried that code but that is not working with me :

  eventBus.on('commandStack.shape.delete.preExecute', function(evt) {
    const element = evt?.context?.shape;
    if (element && isLabelOfStartOrEndEvent(element)) {
      console.log('Deletion prevented at preExecute stage for Start/End event:', element);

To modify modeling behavior, you can use Rules. Check out the example here:

Instead of shape.create rule, you can add a shape.delete rule

1 Like

thank you, I well try.