Copy and pasting between browser tabs

Hi, I suspect this isn’t possible but just wanted to confirm it. We would like to be able to copy and paste between diagrams in different browser tabs. From the docs it sounds like copying and pasting between diagrams should be possible but I presume this means diagrams on the same page?

The default behavior for CommandHandler.copyToClipboard and CommandHandler.pasteFromClipboard just puts and gets a copy of the selected part data in a “global” variable, as documented.

You could override those methods to use local storage or another mechanism. Perhaps we should make that a standard option.

It would be great if you did add it. In the mean time, if I try to override these methods, I’m guessing the easiest approach would be to call the standard copyToClipboard then grab the data from your clipboard, put that in local storage then when pasting, grab the data from local storage and put it back into your clipboard then call the standard pasteFromClipboard? The only issue is I can’t find the clipboard static variable. Is this available via the API?

No, it is intentionally not accessible via the API.

Thanks, I got this working after a bit of playing around

Version 1.6 will include an extension, LocalStorageCommandHandler, which implements overrides of the three relevant CommandHandler methods.

http://gojs.net/beta/extensions/LocalStorageCommandHandler.js