File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { Label } from "neetoui";
11
11
import ErrorWrapper from "components/Common/ErrorWrapper" ;
12
12
import useEditorWarnings from "hooks/useEditorWarnings" ;
13
13
import "src/styles/editor/index.scss" ;
14
+ import { removeEmptyTags } from "src/utils" ;
14
15
15
16
import { DEFAULT_EDITOR_OPTIONS } from "./constants" ;
16
17
import CharacterCountWrapper from "./CustomExtensions/CharacterCount" ;
@@ -107,6 +108,14 @@ const Editor = (
107
108
100
108
109
) ;
109
110
111
+ const handleBlur = props => {
112
+ const { editor } = props ;
113
+ const trimmedContent = removeEmptyTags ( editor . getHTML ( ) ) ;
114
+
115
+ onChange ( trimmedContent ) ;
116
+ onBlur ( props ) ;
117
+ } ;
118
+
110
119
const customExtensions = useCustomExtensions ( {
111
120
placeholder,
112
121
extensions,
@@ -169,7 +178,7 @@ const Editor = (
169
178
onCreate : ( { editor } ) => ! autoFocus && setInitialPosition ( editor ) ,
170
179
onUpdate : debouncedOnChangeHandler ,
171
180
onFocus,
172
- onBlur,
181
+ onBlur : handleBlur ,
173
182
} ) ;
174
183
175
184
useEditorState ( {
You can’t perform that action at this time.
0 commit comments