Closed Shuunen closed 4 years ago
Thanks for the feedback. I'm glad that you've enjoyed this project. 😀
I've played around with adding persistence via the URL fragment in a feature branch. You can play around with it here:
https://persistence--box-line-text.netlify.app
Here's an example URL with stored data:
Wow nice !
I just looked at url length limitation, everyone agrees on keeping them under 2000 characters to have a good compatibility everywhere.
Your sample has a length of 244.
I tried to create a big BLT of random but in the end it was not persisted in url, I pushed it too far 😛
this is the url I have right now but it's just the beginning of my test
Haha. Cool.
One challenge with just serializing the DOM like I'm doing currently is that any elements added by extensions or userscripts are also stored, so the storage requirements can get very large quickly.
I've pushed a change that uses LZ compression for the URI data. That should also help a lot with the size.
Here's your example art cleaned up a bit.
Ultimately, a proper serializer and deserializer will probably be necessary to make this work efficiently.
any elements added by extensions or userscripts are also stored
damn, indeed my grammar skills have been exposed ^^
I've pushed a change that uses LZ compression for the URI data. That should also help a lot with the size. Here's your example art cleaned up a bit.
cool ! why not use the npm pkg ?
Ultimately, a proper serializer and deserializer will probably be necessary to make this work efficiently.
is this not enough for a first version ?
why not use the npm pkg ?
I'm not currently dependent on Node, so adding the entire Node ecosystem when I only need one JS file seemed a little excessive. I did use the JS file from that project.
is this not enough for a first version ?
I'm not comfortable with this currently. Here are a some of my concerns:
In terms of functionality, though, this does seem to get the job done.
adding the entire Node ecosystem when I only need one JS file seemed a little excessive
I agree, npm independent projects are quite rare these days, and surely faster to use (clone & start)
I need to make sure that URLs keep working in perpetuity
Do you mean no-breaking changes ? Because it's commonly accepted when projects jump from a major version to another major according to SEMVER
I'm not comfortable with the current privacy implications with regard to data created by the user agent being shared with others in a way that is not expected
Maybe a share floating button could display a modal and link with a note below explaining risks of sharing this url (just used as a quick mocking tool, nice ^^)
The current implementation is a textbook XSS attack
Right, maybe not taking the DOM as input would solve this, so this get back to serialization
Do you mean no-breaking changes ? Because it's commonly accepted when projects jump from a major version to another major according to SEMVER
Not necessarily. I just want to minimize breakage as much as possible. I'd want to have versioned URLs between major versions so that users can still access their old data. If I'm storing the entire DOM as data, even a seemingly minor change could require a major version change, creating more work for everyone.
I've pushed a change to serialize the elements more intelligently. This uses less space for most documents than before, obviates the need for a compression step, and should take care of the XSS issue.
Here's your example again.
Hi ! Great project, I love minimal app like this ❤️
It would be great to store the diagram status :
I'm wondering now about the size limit in url address & the way of encoding boxes, lines and text all together in a string.
For the local storage, it should be easier without this string restriction.