bpmn-js-native-copy-paste
v0.2.0
Published
Adding native (cross-browser and application) copy and paste to bpmn-js
Readme
bpmn-js-native-copy-paste
Copy and paste for bpmn-js implemented using the native operating system clipboard. As a result, copy and paste works across browser tabs, windows and applications that build on top of the web platform.
Features
- copy and paste using the system clipboard
- works between different BPMN modeler instances
- works across browser windows
- works in modern browsers
- disables built-in
clipboard
Usage
import NativeCopyPaste from 'bpmn-js-native-copy-paste';
const modeler = new BpmnModeler({
additionalModules: [
NativeCopyPasteModule
]
});
await modeler.importXML(require('./ticket-booking.bpmn'));How it Works
We use the clipboard API to read from and write to the operating system clipboard.
During copy we serialize the copy tree to JSON, when re-creating the tree from JSON we use a reviver to re-construct the model types.
The standard paste mechanics implemented by bpmn-js discard BPMN moddle extensions unknown in the target context. This is by design, to prevent polution of users diagrams.
Build and Run
# install dependencies
npm install
# run development setup
npm run devOpen multiple instances of the test site and copy/paste across.
License
MIT
:heart:
