silexlabs / Silex

Silex is an online tool for visually creating static sites with dynamic data. With the free/libre spirit of internet, together.
https://www.silex.me
GNU Affero General Public License v3.0
2.34k stars 586 forks source link

Implement an Auto-Save option #945

Closed ghost closed 2 years ago

ghost commented 5 years ago

With the editor being based in the browser, if the computer or browser crash or hang, all work that hasn't been saved is lost. Having a configurable option to either save every xx minutes or never would mitigate frustration if one had done a lot of work.

lexoyo commented 5 years ago

What do you think @ceubri ? You have worked on big websites, do you think it could also be a problem? Like when you don't want to save and need undo...

ceubri commented 5 years ago

I agree with you lexoyo.

ghost commented 5 years ago

On 21/06/2019, at 8:04 PM, ceubri notifications@github.com wrote:

I agree with you lexoyo.

In any case, if there is an autosave process, it as to save in a repository "autosave-bak" and not over current working-file

How about not calling it auto-save at all but simply write a recovery file periodically and delete it when a manual save is issued or the current user or session is logged out.

When starting silex, if the checkpoint file exists, give the user the option of loading that instead of the site they selected.

e.g.

editable.html -> editable.$$$

If editable.$$$ exists the session did not terminate in a ’nice’ way and the user MAY want to recover some of their work. This is how some Word processors work and it has saved me a lot of extra work in the past when things have gone pear shaped on my computer.

Glen.

lexoyo commented 5 years ago

That's a good idea

Maybe we should just do as everybody else in this field (including GitHub issues) and store the current website state (and even undo/redo?) to the local storage

In any case, how to let the user choose if he wants to start over or use the backup

ghost commented 5 years ago

On 23/06/2019, at 3:49 AM, Alex Hoyau notifications@github.com wrote:

That's a good idea

Maybe we should just do as everybody else in this field (including GitHub issues) and store the current website state (and even undo/redo?) to the local storage

This may still be corrupted in the case of a computer or browser crash. Is saving to the users choice of storage backend too expensive ? In any case, how to let the user choose if he wants to start over or use the backup

The way LibreOffice does it is to check for a recovery file on startup. If one exists the user is given the option to recover and continue with that file or to discard. When a document is saved explicitly, the recovery file is deleted.

If using remote storage, the test could be made when the user goes to open a site.

Glen

lexoyo commented 5 years ago

I see your point Glen but

1- it is far more simple - and more efficient too, to use the local storage as there is already a "hook" in Silex which extracts the site HTML and store it for undo/redo

2- in case of a computer or browser crash I believe the local storage would still be in a clean state... worst case scenario would be you would loose your last action, e.g. a text change or a drag/drop

So if we take the best of both world:

[ ] * store the last state (the one stored for undo/redo) in the local storage, with the user login and website as the key, with a "version" store in the backup and the website

[ ] * when a user is loggedin and opens a website which has this "backup" in local storage, and the version is different as the one opened, ask the user "There is a version of this website in your backups, do you want to restore it?"

Would that be satisfactory for everyone?

ghost commented 5 years ago

On 25/06/2019, at 3:31 AM, Alex Hoyau notifications@github.com wrote:

Would that be satisfactory for everyone?

Yes. :-)

Glen