Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: reset active block after scroll

Abdullah Attadbda1eff8209
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<EditorStore> {
if (activeBlockId && session)
this.updateSession(session.id, [session.type], {
- activeBlockId: activeBlockId
+ activeBlockId
});
};