From 63ae8a4a864a6926f5e3014e517c83749c4dcb6f Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 24 Jan 2024 16:22:01 +0500 Subject: [PATCH] web: reset active block after scroll --- apps/web/src/components/editor/index.tsx | 5 +++++ apps/web/src/stores/editor-store.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx index 6c8ada7a6..b5919ec9e 100644 --- a/apps/web/src/components/editor/index.tsx +++ b/apps/web/src/components/editor/index.tsx @@ -819,6 +819,11 @@ function useScrollToBlock(id: string) { useEffect(() => { if (!blockId) return; scrollIntoViewById(blockId); + useEditorStore + .getState() + .updateSession(id, ["default", "unlocked", "deleted"], { + activeBlockId: undefined + }); }, [blockId]); } diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts index 4d7e66294..08751740a 100644 --- a/apps/web/src/stores/editor-store.ts +++ b/apps/web/src/stores/editor-store.ts @@ -272,7 +272,7 @@ class EditorStore extends BaseStore { if (activeBlockId && session) this.updateSession(session.id, [session.type], { - activeBlockId: activeBlockId + activeBlockId }); };