Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi, I was recently working on typing up a Q/A style post for my site. I was putting each Q in bold and the A's in normal, so I was using Ctrl+B quite a bit to switch between them. Unfortunately I managed to not release Ctrl in time and hit Ctrl+Q by accident, closing my browser window. This meant that all my changes were gone.. Would it be possible to add an auto-save feature to Couch so this won't happen again? This would save me a lot of work from having to type them up again.. The only thing I found when I tried to search for this was a post from 2014 saying that you were going to implement some fixes, but that apparently never happened..
Hi,

I am really sorry to know about that.

One of the changes we made as a result of the thread you mentioned, was displaying an alert box warning of the impending loss of unsaved data in case an attempt is made to close (or navigate away) from a screen containing such data.

One has to explicitly dismiss that alert box before the window can be closed.
While I have no doubts about the superiority of an auto-save system in the background, the alert by itself should have helped in preventing the kind of loss you reported. Wonder why it didn't?
Alternative solution is to save and restore field data to browser's local storage in background. I have played today with https://github.com/simsalabim/sisyphus and https://github.com/guillaumepotier/garlic.js jQuery plugins and made them work for admin form screen.
If interested, I'll post an instruction, it requires some admin theme customizing. I found Sisyphus to work reliably with CKeditor and Niceditm while Garlic can't handle them at all. However Garlic is very nice to offer a clickable informational notice to quickly switch between original page's field value (coming from database, i.e. before user input) and saved value from local storage.
Both need more testing and maybe some merging of functionality. Needless to say it requires some JS knowledge to properly maintain them..
I just tried to make some changes to something and close the tab. What happened was that the tab closed and the prompt to stay or leave looped infinitely if I hit stay.. So at the very least get this function working properly (plus I didn't see it at all when just closing the browser, which is probably caused by the browser, but still subtracts from this solution).

trendoman, your solution seems very interesting. Local-storage would indeed be a very nice and HTML5 way to handle this problem! I would be very interested in seeing how you managed to incorporate this into the Couch admin page and hope that it could be merged into the Couch project as I think it would benefit more people than just me.
PMunch, what browser are you testing? I tried in Chrome and I could not close browser or tab without seeing the popup..
5 posts Page 1 of 1