Hello, i have been trying to add the Camunda Moddle to my custom modeler, bundled by the rollup.js.
I use the example project from github:
and using the properties panel example to know how to add the camundaModdle and provider:
I ended with this “custom-modeler.js” file:
import inherits from 'inherits';
import Modeler from 'bpmn-js/lib/Modeler';
import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll';
import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas';
import TokenSimulationModule from 'bpmn-js-token-simulation/lib/viewer';
import SimulationSupportModule from 'bpmn-js-token-simulation/lib/simulation-support';
import LogModule from 'bpmn-js-token-simulation/lib/features/log';
import {
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
CamundaPlatformPropertiesProviderModule} from 'bpmn-js-properties-panel';
import CamundaBpmnModdle from 'camunda-bpmn-moddle/resources/camunda.json'
/**
* A viewer that includes mouse navigation and other goodies.
*
* @param {Object} options
*/
export default function CustomModeler(options) {
Modeler.call(this, options);
}
inherits(CustomModeler, Modeler);
CustomModeler.prototype._customModules = [
ZoomScrollModule,
MoveCanvasModule,
LogModule,
TokenSimulationModule,
SimulationSupportModule,
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
CamundaPlatformPropertiesProviderModule
];
CustomModeler.prototype._modules = [].concat(
Modeler.prototype._modules,
CustomModeler.prototype._customModules
);
CustomModeler.prototype.GetCustomModdleExtensions = function () {
return CamundaBpmnModdle;
};
// CustomModeler.prototype.moddleExtensions = {
// camunda: CamundaBpmnModdle,
// };
Noticed that the moddleExtesions prototype is comented cause for some reason the CamundaBpmnModdle ends up not configured in the bundled version, so every time i try to use it in my AngularJS applciation, i got a error saying that “<camundaBpmn…> not regonized” os something like that.
The solution by now was exposing the “CamundaBpmnModdle” through a prototype call “CustomModeler.prototype.GetCustomModdleExtensions” and them pass it to the front end component this way:
if (that.bpmnJS == undefined) {
that.bpmnJS = new modeler({
container: element,
propertiesPanel: {
parent: '#properties-panel'
},
keyboard: {
bindTo: document
},
moddleExtensions: {
camunda: modeler.prototype.GetCustomModdleExtensions()
},
additionalModules: [
customTranslate
]
});
}
I would like to ask for a better way to configure the camunda, cause the way that a manage to make it work seens pretty messed up.
Thanks o/