This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. Extensions can be found in the GoJS kit under the
extensions (for loading via script tags),
extensionsTS (UMD modules), or
extensionsJSM (ES6 modules) folders. See the Extensions intro page for more information.
This CommandHandler class uses localStorage as the repository for the clipboard, rather than an in-memory global variable. It requires that the Diagram.model be serializable and deserializable using Model.toJson and Model.fromJson.
myDiagram.commandHandler = new LocalStorageCommandHandler();
If you want to experiment with this extension, try the Local Storage Commands sample.
The constructor produces a CommandHandler with the default key bindings.