-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for LocalAutosaveMonitor and __experimentalUpdateLocalAutosa…
…veInterval (#19915)
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/editor/src/components/local-autosave-monitor/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# LocalAutosaveMonitor | ||
|
||
`LocalAutosaveMonitor` is a component based on `AutosaveMonitor` that ensures that a local copy of the current post is regularly saved in `sessionStorage`. Additionally, it will: | ||
|
||
- attempt to clear the local copy if a copy is successful saved on the server; | ||
- warn the user upon loading a post that there is a local copy that can be loaded; | ||
- defer to remote autosaves, if any is available. | ||
|
||
`LocalAutosaveMonitor` observes a saving interval defined specifically for local autosaves, in contrast with remote (server-side) autosaving. See editor setting `__experimentalLocalAutosaveInterval` and setter `__experimentalUpdateLocalAutosaveInterval`. | ||
|
||
## Example | ||
|
||
```js | ||
const MyLayout = () => ( | ||
<main> | ||
<LocalAutosaveMonitor /> | ||
<MyEditor /> | ||
</main> | ||
); | ||
``` |