From 0a0b3da99b26d7bf2c0e7b45aa198478a0b2158d Mon Sep 17 00:00:00 2001 From: Rishit Gupta <74411873+Rishit30G@users.noreply.github.com> Date: Wed, 1 Jan 2025 08:48:19 +0530 Subject: [PATCH] Add JS Doc --- packages/block-editor/README.md | 23 ++++++++++++++++++ .../src/components/observe-typing/index.js | 24 ++++++++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 8fe2c5f1179dcd..2304cc1953bf91 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -703,10 +703,33 @@ Undocumented declaration. ### ObserveTyping +ObserveTyping component sets and removes the `isTyping` flag based on user actions. + _Related_ - +_Usage_ + +```jsx +function Example(){ + return ( + + + + ); +} +``` + +_Parameters_ + +- _props_ `Object`: +- _props.children_ `JSX.Element`: The children to observe typing on. + +_Returns_ + +- `Element`: The ObserveTyping component. + ### PanelColorSettings Undocumented declaration. diff --git a/packages/block-editor/src/components/observe-typing/index.js b/packages/block-editor/src/components/observe-typing/index.js index 75afc4bbdf0f96..f4b0239fe50246 100644 --- a/packages/block-editor/src/components/observe-typing/index.js +++ b/packages/block-editor/src/components/observe-typing/index.js @@ -248,11 +248,29 @@ export function useTypingObserver() { return useMergeRefs( [ ref1, ref2 ] ); } +/** + * ObserveTyping component sets and removes the `isTyping` flag based on user actions. + * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md + * + * @example + * ```jsx + * function Example(){ + * return ( + * + * + * + * ); + * } + * ``` + * + * @param {Object} props + * @param {JSX.Element} props.children The children to observe typing on. + * + * @return {Element} The ObserveTyping component. + */ function ObserveTyping( { children } ) { return
{ children }
; } -/** - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md - */ export default ObserveTyping;