Closed xuhongxu96 closed 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
)
I use Clipboard API. If it is not supported, copied info will be saved in localStorage to simulate copy/paste within browser.
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 withCopy
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.