Custom Components running in a different scope

Hy,

if you just want to add only one or more tools to the context menu, just register a “CustomContextProvider” like below:

 var modeler = new BpmnJS({
    container: '#modelerCanvas'
});
var contextPad = modeler.get('contextPad');
function CustomContextPadProvider(contextPad) {
        contextPad.registerProvider(this);
        this.getContextPadEntries = function (element) {
            //Every object variable is a new "action"
            return {
                'editServer' : {
                    group : "edit",
                    className : "bpmn-icon-sequential-mi-marker",
                    title: "Configuration",
                    action : {
                        click : function () {
                           //Do your logic here
                            contextPad.close();
                        }
                    }
                }
            };
        };
    }
new CustomContextPadProvider(contextPad);
1 Like