From 2953d10a4dac852463c6770a241bca6fe47ca1fe Mon Sep 17 00:00:00 2001 From: Abilash Sajeev Date: Wed, 26 Mar 2025 22:30:48 +0530 Subject: [PATCH] Skips onChange calls in OnBlur if there are no leading or trailing whitespaces --- src/components/Editor/index.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Editor/index.jsx b/src/components/Editor/index.jsx index 282419a9..31c11307 100644 --- a/src/components/Editor/index.jsx +++ b/src/components/Editor/index.jsx @@ -110,9 +110,10 @@ const Editor = ( const handleBlur = props => { const { editor } = props; - const trimmedContent = removeEmptyTags(editor.getHTML()); + const content = editor.getHTML(); + const trimmedContent = removeEmptyTags(content); - onChange(trimmedContent); + if (content !== trimmedContent) onChange(trimmedContent); onBlur(props); };