Adding Camunda moddle


#1

Hi, I added Camunda moddle like this,

global.BpmnEditor = require('bpmn-js/lib/Modeler');
global.camundaExtensionModule = require('camunda-bpmn-moddle/lib');

....
            editor.bpmn = new BpmnEditor({
                container: '#bpmn-editor-canvas',
                additionalModules: [
                    { contextPadProvider: ['type', MyPropertiesContextPadProvider]},
                    camundaExtensionModule
                ]
            });

But the xml created does not contain the camunda namespace.

I’ve seen this

but find this method a bit confusing in my case… for example, I don’t have extensionModel object. How do I provide the camunda namespace with what I have - the Modeler class and the Moddle? Probably override the ‘initialDiagram’ from https://github.com/bpmn-io/bpmn-js/blob/master/lib/Modeler.js somehow?


#2

You’re missing the model extension:

var BpmnJS = require('bpmn-js/lib/Modeler'),
    camundaExtensionModule = require('camunda-bpmn-moddle/lib'),
    camundaModdle = require('camunda-bpmn-moddle/resources/camunda');

var modeler = new BpmnJS({
    additionalModules: [
      camundaExtensionModule
    ],
    moddleExtensions: {
      camunda: camundaModdle
    }
});

Refer to this example or the camunda-bpmn-moddle README for more details.


#3

thanks, sorry, missed it. works ok