markdown-editor icon indicating copy to clipboard operation
markdown-editor copied to clipboard

Prompt "Are you sure?" on window close

Open simontabor opened this issue 10 years ago • 4 comments

Should help prevent accidental loss of data :(

simontabor avatar May 18 '15 14:05 simontabor

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?

jbt avatar May 18 '15 14:05 jbt

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.

simontabor avatar May 18 '15 14:05 simontabor

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 :)

jbt avatar May 18 '15 14:05 jbt

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.

aero31aero avatar Jun 24 '16 18:06 aero31aero