Stringify the JSON to plain text and copy the plain text to the clipboard.
Check if the clipboard has JSON data by trying to
parse
it as JSON.
If it is JSON, check to see if it's what we expect; that it's coming from our application, has a version number we expect, etc. (i.e. check the metadata fields we encoded)
Paste flow
Create a JSON representation of everything in the selection box (serialize it_.
Also add metadata to identify application, version of data format, context around where the user is or what the user is doing in the application (e.g. position on sheet)
Listen on the
paste
event for the document.
If it's JSON from out application, deserialize the data and create the application entities represented by the data.
Allow users to copy notes and connects by pressing
Ctrl + C
when 1+ are in a selection box.
Listen on the
keydown
event for the document.
Copy flow