Hi there,
I am looking to extend the modeler for personal fun, but actually do not know how to inject the BpmnModeler and the associated ElementRegistry from the bpmnjs injection. Please see the following code snippet:
var CamundaPropertiesProvider = require('bpmn-js-properties-panel/lib/provider/camunda/CamundaPropertiesProvider');
function GeneratedFormPreviewPluginProvider(injector, bpmnjs) {
var camunda = new CamundaPropertiesProvider(...CamundaPropertiesProvider.$inject.map(dependency => injector.get(dependency)));
console.log(bpmnjs);
}
GeneratedFormPreviewPlugin.$inject = ['injector', 'bpmnjs'];
function GeneratedFormPreviewPlugin() {
};
module.exports = {
__init__: ['generatedFormPreviewPlugin'],
propertiesProvider: ['type', GeneratedFormPreviewPluginProvider],
generatedFormPreviewPlugin: ['type', GeneratedFormPreviewPlugin]
};
In the Camunda Modeler environment, this gives me the following in the console:
Particularly, I am interested in using the data that can be found below “injector/_instances/canvas”:
In case I am not mistaken, inside the location “injector/_instances/canvas” I can find the ElementRegistry and the Container for the BpmnModeler. However, how can I access those with the help of my bpmnjs injection and assign them to a new BpmnModeler instance and, subsequently, to a new ElementRegistry instance?
What I already tried is to initialize the BpmnModeler in above’s code snippet preambel, like the following:
var BpmnModeler = require('bpmn-js/lib/Modeler').default;
const bpmnModeler = new BpmnModeler({
container: document.querySelector('#canvas'),
});
const moddle = bpmnModeler.get('moddle'),
modeling = bpmnModeler.get('modeling');
var CamundaPropertiesProvider = require('bpmn-js-properties-panel/lib/provider/camunda/CamundaPropertiesProvider');
function GeneratedFormPreviewPluginProvider(injector, bpmnjs) {
var camunda = new CamundaPropertiesProvider(...CamundaPropertiesProvider.$inject.map(dependency => injector.get(dependency)));
console.log(bpmnjs);
}
GeneratedFormPreviewPlugin.$inject = ['injector', 'bpmnjs'];
function GeneratedFormPreviewPlugin() {
};
module.exports = {
__init__: ['generatedFormPreviewPlugin'],
propertiesProvider: ['type', GeneratedFormPreviewPluginProvider],
generatedFormPreviewPlugin: ['type', GeneratedFormPreviewPlugin]
};
However, in this case, the BpmnModeler and the ElementRegistry remain empty.
Probably this is a really nooby question, but I spent a couple of hours and looked into several examples, so far without success.
Any kind of help is greatly appreciated.
Thank you in advance!