From b22df5dd46ccfd84b1fed31416a12d0ae6784971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20PAILHAREY?= <rpailharey@grandlyon.com> Date: Thu, 18 Aug 2022 07:14:08 +0000 Subject: [PATCH] fix: titre par defaut sur la newsletter --- src/components/Editing/CustomEditor.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Editing/CustomEditor.tsx b/src/components/Editing/CustomEditor.tsx index 9d842295..1c174d85 100644 --- a/src/components/Editing/CustomEditor.tsx +++ b/src/components/Editing/CustomEditor.tsx @@ -41,10 +41,14 @@ const CustomEditor: React.FC<CustomEditorProps> = ({ const handleStateChange = useCallback( (state: EditorState) => { setEditorState(state) - handleChange( - stateToHTML(state.getCurrentContent(), { entityStyleFn }), - editorType - ) + if (state.getCurrentContent().hasText()) { + handleChange( + stateToHTML(state.getCurrentContent(), { entityStyleFn }), + editorType + ) + } else { + handleChange('', editorType) + } }, [editorType, handleChange, entityStyleFn] ) -- GitLab