Skip to content

Commit

Permalink
fix(editor): solve editor empty issue on manageProject on initial render
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Sep 26, 2024
1 parent c649c04 commit 9a89965
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/frontend/src/components/common/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,16 @@ const RichTextEditor = ({
},
editable,
});

const clearEditorContent = useAppSelector((state) => state?.project?.clearEditorContent);

// on first render set content to editor if initial content present
useEffect(() => {
if (editor && editorHtmlContent && editor.isEmpty) {
editor.commands.setContent(editorHtmlContent);
}
}, [editorHtmlContent, editor]);

useEffect(() => {
if (editable && clearEditorContent) {
editor?.commands.clearContent(true);
Expand Down

0 comments on commit 9a89965

Please sign in to comment.