🐛(frontend) table of content disappearing

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.
This commit is contained in:
Anthony LC
2025-05-19 15:08:20 +02:00
parent fe5fda5d73
commit d811e3c2fc
3 changed files with 6 additions and 11 deletions

View File

@@ -16,6 +16,11 @@ and this project adheres to
- 🧑‍💻(docker): add .next to .dockerignore #1055 - 🧑‍💻(docker): add .next to .dockerignore #1055
### Fixed
🐛(frontend) table of content disappearing #982
## [3.3.0] - 2025-05-06 ## [3.3.0] - 2025-05-06
### Added ### Added

View File

@@ -178,7 +178,6 @@ export const BlockNoteEditorVersion = ({
initialContent, initialContent,
}: BlockNoteEditorVersionProps) => { }: BlockNoteEditorVersionProps) => {
const readOnly = true; const readOnly = true;
const { setEditor } = useEditorStore();
const editor = useCreateBlockNote( const editor = useCreateBlockNote(
{ {
collaboration: { collaboration: {
@@ -193,15 +192,6 @@ export const BlockNoteEditorVersion = ({
}, },
[initialContent], [initialContent],
); );
useHeadings(editor);
useEffect(() => {
setEditor(editor);
return () => {
setEditor(undefined);
};
}, [setEditor, editor]);
return ( return (
<Box $css={cssEditor(readOnly)} className="--docs--editor-container"> <Box $css={cssEditor(readOnly)} className="--docs--editor-container">

View File

@@ -9,7 +9,7 @@ export const useHeadings = (editor: DocsBlockNoteEditor) => {
useEffect(() => { useEffect(() => {
setHeadings(editor); setHeadings(editor);
editor?.onEditorContentChange(() => { editor?.onChange(() => {
setHeadings(editor); setHeadings(editor);
}); });