mcschwa
September 4, 2025, 12:16pm
1
On this page:
Which then leads to;
https://gojs.net/latest/samples/LocalStorageCommandHandler.js
Which is a broken url.
Not sure if I should’ve contacted support or post it here, for future issues regarding API and extensions documentation I’ll refer to what is prefered.
mcschwa
September 4, 2025, 12:17pm
2
All the while you have both TS and JS source code on your github.
/*
* Copyright 1998-2025 by Northwoods Software Corporation. All Rights Reserved.
*/
/*
* This is an extension and not part of the main GoJS library.
* The source code for this is at extensionsJSM/LocalStorageCommandHandler.ts.
* Note that the API for this class may change with any version, even point releases.
* 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 or extensionsJSM folders.
* See the Extensions intro page (https://gojs.net/latest/intro/extensions.html) for more information.
*/
import * as go from 'gojs';
/**
* This CommandHandler class uses localStorage as the repository for the clipboard,
* rather than an in-memory global variable.
* It requires that the {@link go.Diagram.model} be serializable and deserializable using {@link go.Model.toJson} and {@link go.Model.fromJson}.
*
* The {@link copyToClipboard} and {@link pasteFromClipboard} functions fall back to using the standard definitions
* if there are any errors calling `Storage.getItem` or `Storage.setItem`.
*
This file has been truncated. show original
and
/*
* Copyright 1998-2025 by Northwoods Software Corporation. All Rights Reserved.
*/
/*
* This is an extension and not part of the main GoJS library.
* The source code for this is at extensionsJSM/LocalStorageCommandHandler.ts.
* Note that the API for this class may change with any version, even point releases.
* 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 or extensionsJSM folders.
* See the Extensions intro page (https://gojs.net/latest/intro/extensions.html) for more information.
*/
import * as go from 'gojs';
/**
* This CommandHandler class uses localStorage as the repository for the clipboard,
* rather than an in-memory global variable.
* It requires that the {@link go.Diagram.model} be serializable and deserializable using {@link go.Model.toJson} and {@link go.Model.fromJson}.
*
This file has been truncated. show original
simon
September 4, 2025, 12:43pm
3
Sorry, as you might guess from the github URL, the correct URL is: https://gojs.net/latest/extensionsJSM/LocalStorageCommandHandler.js
We will fix this
mcschwa
September 4, 2025, 1:38pm
4
fret not, just so you know! Thanks.
Edit: Now thinking about it, I don’t know how realistic it is to achieve this, considering these urls are most definitely automatically generated, but I’d say why not link to the github file directly? It’s a lot more user friendly.
simon
September 4, 2025, 1:53pm
5
It’s not a bad idea, but every version of the library links to that version of the file, so for example:
https://gojs.net/2.2.2/extensions/LocalStorageCommandHandler.html
links to
https://gojs.net/2.2.2/extensions/LocalStorageCommandHandler.js
So that older users of the library can get version-appropriate extension code. Doing that with Github would be trickier.
walter
September 4, 2025, 2:38pm
6
Also, for this particular feature, the functionality has been built into the standard CommandHandler in version 3.1, so that extension will no longer be needed.
mcschwa
September 5, 2025, 8:08am
7
no kidding? I just took GoJS/extensionsJSM/LocalStorageCommandHandler.ts at master · NorthwoodsSoftware/GoJS · GitHub and made it work to our likings, the only issue I ran into is that the the extension doesn’t hold Node and Link templates in mind.
Oh, well. Ha-ha
simon
September 5, 2025, 12:14pm
8
You can start using the 3.1 Beta today if you wish:
gojs.net/beta
npm i gojs@beta