Skip to content

Commit

Permalink
Documentation: LocalAutosaveMonitor editor component (WordPress#61951)
Browse files Browse the repository at this point in the history
* Add LocalAutosaveMonitor component editor JSDocs

* Auto-generate editor package docs to add LocalAutosaveMonitor

* Improve JSDocs for LocalAutosaveMonitor editor component

* Auto-generate editor docs for LocalAutosaveMonitor enhancements
  • Loading branch information
colorful-tones authored and patil-vipul committed Jun 17, 2024
1 parent 999fefd commit b42c3a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,14 @@ _Returns_
### LocalAutosaveMonitor

Undocumented declaration.
Monitors local autosaves of a post in the editor. It uses several hooks and functions to manage autosave behavior:

- `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.
- `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.
- `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.
- `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.

The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.

### MediaPlaceholder

Expand Down
12 changes: 12 additions & 0 deletions packages/editor/src/components/local-autosave-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,16 @@ function LocalAutosaveMonitor() {
);
}

/**
* Monitors local autosaves of a post in the editor.
* It uses several hooks and functions to manage autosave behavior:
* - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.
* - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.
* - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.
* - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.
*
* The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.
*
* @module LocalAutosaveMonitor
*/
export default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );

0 comments on commit b42c3a4

Please sign in to comment.