From 66feb34853b97d5057cbc41869b224f1dea4a7b0 Mon Sep 17 00:00:00 2001 From: sunil25393 Date: Fri, 19 Apr 2024 19:25:29 +0530 Subject: [PATCH 1/4] Add doc for AutosaveMonitor component --- packages/editor/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/editor/README.md b/packages/editor/README.md index 577591c2e7b58..417cbfa7460bd 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -128,7 +128,20 @@ Example: ### AutosaveMonitor -Undocumented declaration. +AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected. + +A check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. The time between the change and the autosave varies but is no larger than `props.interval` seconds. + +_Parameters_ + + _props_ `Object`: The props for the component. + _props_.editsReference `string`: A reference to the edits made in the component. + _props_.disableIntervalChecks `boolean`: Indicates if timer is disabled or not. + _props_.isDirty `boolean`: Indicates if the component is dirty (has unsaved changes). + _props_.isAutosaveable `boolean`: Indicates if autosave functionality is enabled. + _props_.interval `number`: The interval (in seconds) for autosave. + _props_.isAutosaving `boolean`: Indicates if autosaving is currently in progress. + _props_.autosave `Function`: The function to trigger autosave. ### BlockAlignmentToolbar From 86283e3727f2f42cacf46045ce54016ae410c41c Mon Sep 17 00:00:00 2001 From: sunil25393 Date: Fri, 19 Apr 2024 19:52:43 +0530 Subject: [PATCH 2/4] Add doc for CharacterCount component --- packages/editor/README.md | 23 ++++++++----------- .../src/components/character-count/index.js | 5 ++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/editor/README.md b/packages/editor/README.md index 417cbfa7460bd..3cf272dd9055e 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -128,20 +128,13 @@ Example: ### AutosaveMonitor -AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected. +AutosaveMonitor component. Monitors the changes made to the edited post and triggers autosave if necessary. -A check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called. The time between the change and the autosave varies but is no larger than `props.interval` seconds. - -_Parameters_ +_Usage_ - _props_ `Object`: The props for the component. - _props_.editsReference `string`: A reference to the edits made in the component. - _props_.disableIntervalChecks `boolean`: Indicates if timer is disabled or not. - _props_.isDirty `boolean`: Indicates if the component is dirty (has unsaved changes). - _props_.isAutosaveable `boolean`: Indicates if autosave functionality is enabled. - _props_.interval `number`: The interval (in seconds) for autosave. - _props_.isAutosaving `boolean`: Indicates if autosaving is currently in progress. - _props_.autosave `Function`: The function to trigger autosave. +```jsx + +``` ### BlockAlignmentToolbar @@ -201,7 +194,11 @@ _Parameters_ ### CharacterCount -Undocumented declaration. +Component return the character count of the content. + +_Returns_ + +- `number`: Count that represent number of character in content. ### cleanForSlug diff --git a/packages/editor/src/components/character-count/index.js b/packages/editor/src/components/character-count/index.js index e12ff1a3cbce7..e684c1ec7c6c4 100644 --- a/packages/editor/src/components/character-count/index.js +++ b/packages/editor/src/components/character-count/index.js @@ -9,6 +9,11 @@ import { count as characterCount } from '@wordpress/wordcount'; */ import { store as editorStore } from '../../store'; +/** + * Calculates the character count of the content. + * + * @return {number} The character count including spaces. + */ export default function CharacterCount() { const content = useSelect( ( select ) => select( editorStore ).getEditedPostAttribute( 'content' ), From f06ed8a45d469189fb1603ff94649c099d6ebe97 Mon Sep 17 00:00:00 2001 From: sunil25393 Date: Sun, 21 Apr 2024 11:11:25 +0530 Subject: [PATCH 3/4] Fix pipeline --- packages/editor/README.md | 2 +- packages/editor/src/components/character-count/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor/README.md b/packages/editor/README.md index 0c24090bf8814..73b48e8eb0871 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -198,7 +198,7 @@ Component return the character count of the content. _Returns_ -- `number`: Count that represent number of character in content. +- `number`: The character count. ### cleanForSlug diff --git a/packages/editor/src/components/character-count/index.js b/packages/editor/src/components/character-count/index.js index e684c1ec7c6c4..0b2ee508354dd 100644 --- a/packages/editor/src/components/character-count/index.js +++ b/packages/editor/src/components/character-count/index.js @@ -10,9 +10,9 @@ import { count as characterCount } from '@wordpress/wordcount'; import { store as editorStore } from '../../store'; /** - * Calculates the character count of the content. + * Component return the character count of the content. * - * @return {number} The character count including spaces. + * @return {number} The character count. */ export default function CharacterCount() { const content = useSelect( From a9f758ebe89d3486c3b90af7a8d4f3ac60357a69 Mon Sep 17 00:00:00 2001 From: sunil25393 Date: Fri, 26 Apr 2024 13:51:55 +0530 Subject: [PATCH 4/4] Addressed feedback --- packages/editor/README.md | 2 +- packages/editor/src/components/character-count/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/editor/README.md b/packages/editor/README.md index 73b48e8eb0871..1183c41164547 100644 --- a/packages/editor/README.md +++ b/packages/editor/README.md @@ -194,7 +194,7 @@ _Usage_ ### CharacterCount -Component return the character count of the content. +Renders the character count of the post content. _Returns_ diff --git a/packages/editor/src/components/character-count/index.js b/packages/editor/src/components/character-count/index.js index 0b2ee508354dd..2fb165cdc9bad 100644 --- a/packages/editor/src/components/character-count/index.js +++ b/packages/editor/src/components/character-count/index.js @@ -10,7 +10,7 @@ import { count as characterCount } from '@wordpress/wordcount'; import { store as editorStore } from '../../store'; /** - * Component return the character count of the content. + * Renders the character count of the post content. * * @return {number} The character count. */