Skip to content

Commit 2953d10

Browse files
Skips onChange calls in OnBlur if there are no leading or trailing whitespaces
1 parent d3c7dcc commit 2953d10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/components/Editor/index.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ const Editor = (
110110

111111
const handleBlur = props => {
112112
const { editor } = props;
113-
const trimmedContent = removeEmptyTags(editor.getHTML());
113+
const content = editor.getHTML();
114+
const trimmedContent = removeEmptyTags(content);
114115

115-
onChange(trimmedContent);
116+
if (content !== trimmedContent) onChange(trimmedContent);
116117
onBlur(props);
117118
};
118119

0 commit comments

Comments
 (0)