Copy-paste and keyboard events


Sorry I think it is a lame question but,
I build bpmn-js 0.15.2 with
npm install

and created BpmnJS instance by using
var bpmnModeler = new BpmnJS({
container: ‘#canvas
The modeler works fine but keyboard events like undo (Ctrl + z) or copy-paste (Ctrl + c and v) or any other events not working on my Firefox or Chrome browsers.
Do I need to import some additional module when instantiate BpmnJS or do some other magic to make it work?
Could you post a little code snippet how should I achieve this?

Thank you for your kind help in advance!

Hey @romero83,

please look into this post: Hotkeys like the demo?

Hope that helps! :slight_smile:

Thank you very much! It works!

But I really confused because in the builded bpmn-modeler.js file there is some kind of function object named BpmnKeyBindings where in there is some code regarding to keyboard binding. I thought it is just needs activated via some options or something…

Should I follow similar steps if I want to include other features like the keyboard support?

To give you a bit more insight: The code for default key bindings is actually located in diagram-js (there you can find the key bindings for undo/redo). What you found in the bpmn-modeler.js are the bpmn specific keybindings. Their listeners also get added to the keyboard object from diagram-js.

The binding of all these keys to a DOM element happens during diagram.init. It looks for a bindTo attribute which you provide during your BpmnJS instantiation.