Hacker News new | ask | show | jobs
by sharikone 1788 days ago
Not to pressure but having open/save buttons (implementable either as upload/download Javascript shims) would be interesting. They can also be quine-like (I.e. you save the HTML and Javascript of the editor itself together with the content). I did once that for Suneditor but did not publish it, alas.
2 comments

No pressure at all! I could just... not think about it if I didn't want to. :p

I took another stab at it and this is what I ended up with: https://gist.github.com/honmanyau/5680d1c7b823d454122a0275ba...

It's now a Gist because I only realised later that the original note will be deleted after 24 hours.

There are now two mechanisms that persist data between sessions:

1. Auto-saving to localStorage every 5000 ms (adjustable as per the instructions). 2. Manual data saving/download implemented using an anchor element that triggers a download. We can now restore markdown by loading a downloaded file (in principle this should work for any plain text file).

One important thing to note here is that localStorage doesn't work in private browsing mode and its behaviour is not entirely consistent between browsers. So I wouldn't rely too much on it!

That's pretty neat! You actually gave me an idea - it'd probably be neat to be able to export a note in HTML/MD.
I love having the document and the app being the same file. No app to find or version skew between app and data.