From d811e3c2fc819f397d652f944ce00a803d82d80e Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Mon, 19 May 2025 15:08:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20table=20of=20content?= =?UTF-8?q?=20disappearing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The table of content was disappearing when the user was looking the version history then came back to the main document. This commit fixes this issue. --- CHANGELOG.md | 5 +++++ .../docs/doc-editor/components/BlockNoteEditor.tsx | 10 ---------- .../src/features/docs/doc-editor/hook/useHeadings.tsx | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e085f692..470cfa52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ and this project adheres to - 🧑‍💻(docker): add .next to .dockerignore #1055 +### Fixed + +🐛(frontend) table of content disappearing #982 + + ## [3.3.0] - 2025-05-06 ### Added diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx index 7ed06af1..9a486b58 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx @@ -178,7 +178,6 @@ export const BlockNoteEditorVersion = ({ initialContent, }: BlockNoteEditorVersionProps) => { const readOnly = true; - const { setEditor } = useEditorStore(); const editor = useCreateBlockNote( { collaboration: { @@ -193,15 +192,6 @@ export const BlockNoteEditorVersion = ({ }, [initialContent], ); - useHeadings(editor); - - useEffect(() => { - setEditor(editor); - - return () => { - setEditor(undefined); - }; - }, [setEditor, editor]); return ( diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx index 8b88eb3d..2fbad06c 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx @@ -9,7 +9,7 @@ export const useHeadings = (editor: DocsBlockNoteEditor) => { useEffect(() => { setHeadings(editor); - editor?.onEditorContentChange(() => { + editor?.onChange(() => { setHeadings(editor); });