Hi everyone!
I’m facing an issue with a custom copy/paste functionality.
I’m using Bpmn JS version 16.4.0. I added the detailed functionality in this link for copy and paste:
Specifically, the error is occurring on the copyPaste.paste() line:
var clipboard = modeler.get('clipboard'),
copyPaste = modeler.get('copyPaste'),
elementRegistry = modeler.get('elementRegistry'),
moddle = modeler.get('moddle');
// retrieve from local storage
var serializedCopy = localStorage.getItem('bpmnClipboard');
// parse tree, reinstantiating contained objects
var parsedCopy = JSON.parse(serializedCopy, createReviver(moddle));
// put into clipboard
clipboard.set(parsedCopy);
// alternatively paste using two-step pasting
copyPaste.paste();
The error only occurs when I try to paste nodes and flows. If I try to paste only nodes, everything works fine.
This is the error:
Cannot read properties of null (reading 'cursor')
TypeError: Cannot read properties of null (reading 'cursor')
at move (http://localhost:8080/workflowweb/js/chunk-vendors.js:125459:19)
at Dragging.init (http://localhost:8080/workflowweb/js/chunk-vendors.js:125761:7)
at Create.start (http://localhost:8080/workflowweb/js/chunk-vendors.js:124990:14)
at push../node_modules/diagram-js/lib/features/copy-paste/CopyPaste.js.CopyPaste.paste
how can it be solved?