diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolbar.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolbar.tsx index 0f1e2086..b9c66473 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolbar.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteToolbar.tsx @@ -2,27 +2,29 @@ import '@blocknote/mantine/style.css'; import { FormattingToolbar, FormattingToolbarController, + FormattingToolbarProps, getFormattingToolbarItems, } from '@blocknote/react'; -import React from 'react'; +import React, { useCallback } from 'react'; import { AIGroupButton } from './AIButton'; import { MarkdownButton } from './MarkdownButton'; export const BlockNoteToolbar = () => { - return ( - ( - - {getFormattingToolbarItems(blockTypeSelectItems)} + const formattingToolbar = useCallback( + ({ blockTypeSelectItems }: FormattingToolbarProps) => ( + + {getFormattingToolbarItems(blockTypeSelectItems)} - {/* Extra button to do some AI powered actions */} - + {/* Extra button to do some AI powered actions */} + - {/* Extra button to convert from markdown to json */} - - - )} - /> + {/* Extra button to convert from markdown to json */} + + + ), + [], ); + + return ; }; diff --git a/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx b/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx index 92410f8e..a51c2bca 100644 --- a/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx +++ b/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx @@ -65,10 +65,6 @@ const DocPage = ({ id }: DocProps) => { setDoc(docQuery); setCurrentDoc(docQuery); - - return () => { - setCurrentDoc(undefined); - }; }, [docQuery, setCurrentDoc]); useEffect(() => {