Hi,
Is there a way to copy-paste elements (descriptions) between multiple BpmnJs instances?
Thank you for your help in advance.
Best regards,
Rómeó Nagy
Hi,
Is there a way to copy-paste elements (descriptions) between multiple BpmnJs instances?
Thank you for your help in advance.
Best regards,
Rómeó Nagy
Hey @romero83,
you can do the following:
var BpmnJS = require('bpmn-js/lib/Modeler);
var Clipboard = require('diagram-js/lib/features/clipboard/Clipboard');
var clipboard = new Clipboard();
var modeler = new BpmnJS({
container: document.querySelector("canvas"),
position: 'absolute',
additionalModules: [
{ clipboard: [ 'value', clipboard ] }
]
});
Basically, we’re instantiating ourselves the clipboard module so we have one instance that we can pass around to every bpmn-js instance that we create.
Cheers,
Ricardo
Thank you very much.
@romero83 @ricardomatias
I tried the above clipboard method to copy elements between two instances, but its not working, here is what i am doing:
Instance1:
import Clipboard from ‘diagram-js/lib/features/clipboard/Clipboard’;
let clipboard = new Clipboard();
const modeler = new BpmnJS({
container: “#canvas”,
position: ‘absolute’,
keyboard: {
bindTo: window,
},
additionalModules: [
{ clipboard: [ ‘value’, clipboard ] }
]
});
Instance2:(in diff file)
import Clipboard from ‘diagram-js/lib/features/clipboard/Clipboard’;
let clipboard = new Clipboard();
const modeler2 = new BpmnJS({
container: “#temp-canvas”,
position: ‘absolute’,
keyboard: {
bindTo: window,
},
additionalModules: [
{ clipboard: [ ‘value’, clipboard ] }
]
});
I have two questions here:
PS: First i created Instance1, then later on Instance2 and i want to copy elements from instance2 to instance1.
Any help is appreciated. Thanks.
My bad
I was passing different instances of clipboard module, but by passing the initial instance to all bpmn instances, it worked