Hi, great app. I'd love to understand how you are maintaining state behind that short url and see if there are ways (sans server) to at least partially recreate state from the exported ascii.
Having an Import from clipboard would truly make this a remarkable app.
After uploading cascii.html to deepseek.com and promptCoding with it, I saw that you had the json representaion in localStorage.
I tried generating the json from the ascii exported to the clipboard but see why this could get very tricky. So, I added an Export (JSON) to file and Import (JSON) from file and placed them in a More Popup component in which I put the existing export button, so the menu bar does not get too crowded. (for code see (1)) -
This now allows me to save the json and import/edit it at a later time - no short url needed and the data stays private.
Your code was well laid out and deepseek was able to make all the changes error-free.
Nice! Yea it should be easy to use the internal layerManager.import and .encodeAll
This might break state for the online version, but I can do some tweaks and get it merged if you open the PR.
to be clear, the short url feature is useful in that other people can easily edit / update diagrams they see referenced in code comments. If privacy is a concern and you're not distributing the diagram, then indeed exporting JSON is a good way to go.
I have thought about this a lot. I was going to do some stuff with gzip, but fundementally, I came to the conclusion that the most elegant solution (no hidden chars / extra encoded data coupled with export) might actually be training a neural net to do it. Also, this would mean being able to import diagrams that weren't even made on Cascii. Training data can be self-generated too.
Perhaps a good middle ground would just be offering the gzip dump.
Having an Import from clipboard would truly make this a remarkable app.