Skip to content

Commit

Permalink
hotfix: heading resets when cleared by the user
Browse files Browse the repository at this point in the history
  • Loading branch information
leindfraust committed Nov 8, 2024
1 parent 0982600 commit 6afd940
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/wysiwyg/Tiptap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ export default function Tiptap({
},
});

// temporarily fixes the title and desc heading when cleared by the user, only sets heading again when there is a content
useEffect(() => {
editorTitle?.commands.setHeading({ level: 1 });
editorDescription?.commands.setHeading({ level: 4 });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [editorDescription?.$doc.textContent, editorTitle?.$doc.textContent]);

useEffect(() => {
const savePostDraft = async () => {
if (publishState) return;
Expand Down

0 comments on commit 6afd940

Please sign in to comment.