Skip to content

Commit

Permalink
feat: Add function to get text area value in external hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Sep 13, 2024
1 parent bf8610b commit 0a68f61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hooks/useTextArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export const useTextArea = () => {
}
}, [textAreaDisabled]);

/**
* Retrieves text area value.
*/
const getTextAreaValue = useCallback(() => {
return inputRef.current?.value;
}, [inputRef.current]);

/**
* Toggles text area disabled.
*/
Expand All @@ -46,6 +53,7 @@ export const useTextArea = () => {
toggleTextAreaDisabled,
textAreaSensitiveMode,
toggleTextAreaSensitiveMode,
getTextAreaValue,
setTextAreaValue,
focusTextArea
};
Expand Down

0 comments on commit 0a68f61

Please sign in to comment.