jbt / markdown-editor

Live (Github-flavored) Markdown Editor
http://jbt.github.com/markdown-editor
ISC License
2.83k stars 644 forks source link

Prompt "Are you sure?" on window close #28

Open simontabor opened 9 years ago

simontabor commented 9 years ago

Should help prevent accidental loss of data :(

jbt commented 9 years ago

Saaawry Simon. If you were using jbt.github.io/markdown-editor then you could just Cmd+Shift+T and get everything back because it's all wonderful and still in the url but I'm assuming you were on the S3-backed version which doesn't have autosave, right?

simontabor commented 9 years ago

If you close the entire window (rather than just the tab) would Cmd+Shift+T still work?

I was on the S3 version, luckily it appears to have saved into my history - one solution might be to use pushstate and actually push the saved hash into the history rather than just using a hash.

jbt commented 9 years ago

cmd+shift+t brings back the whole window unless you were in an incognito.

For the everything-in-the-hash version I think pushState would be overkill because then you're creating a new history state for literally every keystroke. I'll add an autosave thing somewer and a onbeforeunload that shouts at you if you've made edits since the last save :)

aero31aero commented 8 years ago

Apparently, all the issues are getting pretty cold right now... I'm adding this one as well, with a button to copy the current URL to clipboard. Pretty small, I know, but then again, this editor is fun to work on.

To test it, check out aero31aero.github.io/markdown-editor by tomorrow. I'm working on the branch bug-fixes in case you decide to pull early on.