How can I handle the CTRL + c

Hi Everyone ,

How can I handle the copy.preExecute from event Bus. I think there is no event for that.

commandStack.element.copy.canExecute: {priority: 1000, callback: ƒ, next: null}
commandStack.element.paste.canExecute: {priority: 1000, callback: ƒ, next: null}
commandStack.elements.paste.canExecute: {priority: 1000, callback: ƒ, next: null}
commandStack.elements.paste.postExecute: {priority: 1000, callback: ƒ, next: null}
commandStack.elements.paste.preExecute: {priority: 1500, callback: ƒ, next: null}

Is there another way ?

We want to handle it for copy paste between multiple instances. We did the copy paste process with your example. But we are doing copy paste processes with the buttons. So We need to change it to shortcuts. Please help us

Hi @Huseyin_Buyukdere,

maybe you can give us some more details, e.g. what you already did do achieve what you want to? Some example code or an example test case would be helpful.

I want to copy paste elements between different bpmn-js intances. So I applied this example . It works good. I can copy the elements with the local storage and paste them with BUTTONS. But I want to handle it CTRL - C and CTRL - V.

Now I can use CTRL - C and CTRL - V in editör for copy paste command in ONE INSTANCE(Below code, added keyboard) . I 'm managing the copy paste commands for multiple instances with Buttons. I 'm using local storage for multiple instances. I’m aiming when CTRL - C click , I will add the selected elements to my local storage.
While CTRL - V (commandStack.elements.paste.preExecute) applying I will check the local storage and If ıt is not empty I will take from the local storage and paste it to editor clipboard. After that I will clear the local storage. So the editör while pasting , will use the local clipboard.

I added keyboard like that.

this.designer = new BpmnModeler({
  keyboard: { bindTo: document },
  additionalModules: [

If you do not understand again , I will try to explain it.

Edit : Now I need to commandStack.element.copy.preExecute or CTRL-C preExecute. How can I do it.

Can you please share the repository with your example?