From e1928e0872e12bdace181acb519725ab6ffb8738 Mon Sep 17 00:00:00 2001 From: QiShaoXuan Date: Tue, 13 Dec 2022 17:57:05 +0800 Subject: [PATCH] fix: fit new version of blocksuite --- .../src/components/edgeless-toolbar/index.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/app/src/components/edgeless-toolbar/index.tsx b/packages/app/src/components/edgeless-toolbar/index.tsx index 1625f44398..e5f0db27d9 100644 --- a/packages/app/src/components/edgeless-toolbar/index.tsx +++ b/packages/app/src/components/edgeless-toolbar/index.tsx @@ -75,16 +75,18 @@ const toolbarList2 = [ const UndoRedo = () => { const [canUndo, setCanUndo] = useState(false); const [canRedo, setCanRedo] = useState(false); - const { editor } = useEditor(); + const { currentPage } = useEditor(); useEffect(() => { - if (!editor) return; - const { space } = editor; + if (!currentPage) return; - space.signals.historyUpdated.on(() => { - setCanUndo(space.canUndo); - setCanRedo(space.canRedo); + currentPage.signals.historyUpdated.on(() => { + setCanUndo(currentPage.canUndo); + setCanRedo(currentPage.canRedo); }); - }, [editor]); + return () => { + currentPage.signals.historyUpdated.dispose(); + }; + }, [currentPage]); return ( @@ -92,7 +94,7 @@ const UndoRedo = () => { { - editor?.space?.undo(); + currentPage?.undo(); }} > @@ -102,7 +104,7 @@ const UndoRedo = () => { { - editor?.space?.redo(); + currentPage?.redo(); }} >