WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.48k stars 4.18k forks source link

Offer to restore any available local post backup (instead of only the most recent one) #23955

Open adamziel opened 4 years ago

adamziel commented 4 years ago

Gutenberg has a "local autosave" feature that ensures your content is stored in the browser storage if at any point the internet connection breaks. Imagine this happens on /wp-admin/post-new.php for a new post that doesn't have an ID assigned yet. If you lose a connection, write a long post, close the browser, and then return later, then you will see the following notice:

Zrzut ekranu 2020-07-15 o 13 11 23

(Note this only works with https://github.com/WordPress/gutenberg/pull/23928 applied).

Clicking the button hydrates the editor with the backed up post content.

Now, let's imagine this happens multiple times or in multiple tabs.

At the moment only a single ID-less (auto-draft) local backup is handled - this means all the other ones are lost. What is the right solution here? I can see a few ways forward:

1) Store multiple local auto-draft backups and then offer all available ones in the notice. This would probably mean there should be a way to delete ones that are no longer needed. 2) Decide that having multiple backups for auto-draft posts isn't very likely and close this issue. 3) ?

CC @mtias @shaunandrews @mcsf @youknowriad

Also relevant, the content-loss issue here: https://github.com/WordPress/gutenberg/issues/23781

shaunandrews commented 4 years ago

Maybe we can use a modal to show local backups, and let people choose one to restore — or discard them all:

image

It might be nice to show a preview when you hover over a local backup:

image
mtias commented 4 years ago

Agreed on trying to show anything that might be locally saved.

paaljoachim commented 3 years ago

Hey @shaunandrews

Let's try it out. It was brought up during a design triage. @kellychoffman and myself talked about it.