From e37e60d90b1819bd2588023912bff55d7616b359 Mon Sep 17 00:00:00 2001 From: adarleyjrr <50996706+adarleyjrr@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:52:41 -0500 Subject: [PATCH 1/2] feat: added method to get plain text from rich text editor --- CHANGELOG.md | 2 ++ src/components/WYSIWYGInput/index.tsx | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4db9435..332b2ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added `getPlainText` method to `useImperativeHandle` hook in WYSIWYGInput component + ### Fixed ## [1.2.0] - 2021-03-01 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(() => { From 5d95652d00def366e8e1d99b82c7dcd98d00c1df Mon Sep 17 00:00:00 2001 From: adarleyjrr <50996706+adarleyjrr@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:56:10 -0500 Subject: [PATCH 2/2] build: bumping version: 1.3.0 --- CHANGELOG.md | 8 ++++++-- package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 332b2ef..595750a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,10 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Added `getPlainText` method to `useImperativeHandle` hook in WYSIWYGInput component - ### 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"