fix(plugin): make group menu invisible when leave

This commit is contained in:
austaras
2022-07-28 16:24:46 +08:00
parent 6cd8fe6832
commit e150b7c32a
8 changed files with 69 additions and 59 deletions

View File

@@ -113,19 +113,19 @@ export const AffineBoardWitchContext = ({
workspace,
rootBlockId,
}: AffineBoardProps) => {
const [editor, set_editor] = useState<BlockEditor>();
const [editor, setEditor] = useState<BlockEditor>();
useEffect(() => {
const inner_editor = createEditor(workspace, true);
set_editor(inner_editor);
const innerEditor = createEditor(workspace, rootBlockId, true);
setEditor(innerEditor);
return () => {
inner_editor.dispose();
innerEditor.dispose();
};
}, [workspace]);
}, [workspace, rootBlockId]);
const [page, set_page] = useState<AsyncBlock>();
const [page, setPage] = useState<AsyncBlock>();
useEffect(() => {
editor?.getBlockById(rootBlockId).then(block => {
set_page(block);
setPage(block);
});
}, [editor, rootBlockId]);
return page ? (