diff --git a/CHANGELOG.md b/CHANGELOG.md index 4db9435..595750a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [1.3.0] - 2021-03-02 + +### Added + +- Added `getPlainText` method to `useImperativeHandle` hook in WYSIWYGInput component + ## [1.2.0] - 2021-03-01 ### Added diff --git a/package.json b/package.json index 2c8710d..76ab089 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@perimetre/ui", "description": "A component library made by @perimetre", - "version": "1.2.0", + "version": "1.3.0", "repository": { "type": "git", "url": "git+https://github.com/perimetre/ui.git" diff --git a/src/components/WYSIWYGInput/index.tsx b/src/components/WYSIWYGInput/index.tsx index 6dfbf1e..fbe7d2a 100644 --- a/src/components/WYSIWYGInput/index.tsx +++ b/src/components/WYSIWYGInput/index.tsx @@ -212,7 +212,11 @@ export const WYSIWYGInput = forwardRef( // Ref(HTML part at the end): https://jpuri.github.io/react-draft-wysiwyg/#/docs const htmlData = draftToHtml(convertToRaw(editorState.getCurrentContent())); return DOMPurify.sanitize(htmlData); - } + }, + /** + * Returns a plain text string from the current editor state + */ + getPlainText: () => editorState.getCurrentContent().getPlainText() })); const focus = useCallback(() => {