xuhongxu96 / editflow

DAG workflow editor
4 stars 0 forks source link

Copy, Cut and Paste #6

Closed xuhongxu96 closed 4 years ago

xuhongxu96 commented 4 years ago

Support copy, cut and paste nodes.

Copy will only copy the selected node info to clipboard. If there are any edges between selected nodes, the edge info should also be copied.

Cut will do the same thing with Copy and also delete the selected nodes.

Paste will add nodes and edges according to the node/edge info saved in clipboard.

We also need to have keyboard shortcuts for these actions.

xuhongxu96 commented 4 years ago

I think we can add reducer actions that generate the node/edge info to be copied and add node/edge according to the passed-in node/edge info thru action parameters, but we shouldn't really read/write the clipboard inside the reducer actions.

We'd better leave the clipboard operations to external/user code (including our built-in Toolbar)

xuhongxu96 commented 4 years ago

I use Clipboard API. If it is not supported, copied info will be saved in localStorage to simulate copy/paste within browser.