Ho to delete entries from replace menu (for connections)

Hello,

would anybody know how to delete entries from the replace menu of connections?

I have added custom entries and want to remove the default ones (default flow and conditional flow):
image
Here you can find the related post to that: How to add custom replace menu entries

My code ruthly looks like this:

class ReplaceProvider {
    constructor(popupMenu) {
        this.modeling = modeling;
        popupMenu.registerProvider("bpmn-replace", this);
    }

    getPopupMenuEntries(element) {
        if (!is(element, "bpmn:SequenceFlow")) {
            return;
        }

        return {
            "entry-1": {
                className: "bpmn-icon-connection",
                label: "Blue Sequence Flow",
                action: () => {
                    this.modeling.setColor(element, {stroke: 'blue'});
                }
            },
            "entry-2": {
                ...
            }, ...
        };
    }
}

Thanks in advance!

Instead of returning additional entries from a replace menu provider you can return a middleware function, too. That one receives the existing entries and returns new entries from them:

const replacingPopupMenuProvider = {
  getPopupMenuEntries(element) {
    return (entries) => {
      const {
        someEntry,
        ...remainingEntries
      } = entries;

      return remainingEntries;
    }
  }
};

popupMenu.registerProvider('myMenuID', replacingPopupMenuProvider);

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.