a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

make toggling fold page specific

+10 -1
+10 -1
components/Blocks/index.tsx
··· 19 19 20 20 export function Blocks(props: { entityID: string }) { 21 21 let rep = useReplicache(); 22 + let isPageFocused = useUIState((s) => { 23 + let focusedElement = s.focusedEntity; 24 + let focusedPageID = 25 + focusedElement?.entityType === "page" 26 + ? focusedElement.entityID 27 + : focusedElement?.parent; 28 + return focusedPageID === props.entityID; 29 + }); 22 30 let entity_set = useEntitySetContext(); 23 31 let blocks = useBlocks(props.entityID); 24 32 let foldedBlocks = useUIState((s) => s.foldedBlocks); 25 33 useEffect(() => { 34 + if (!isPageFocused) return; 26 35 return addShortcut([ 27 36 { 28 37 altKey: true, ··· 68 77 }, 69 78 }, 70 79 ]); 71 - }, [blocks]); 80 + }, [blocks, isPageFocused]); 72 81 73 82 let lastRootBlock = blocks.findLast( 74 83 (f) => !f.listData || f.listData.depth === 1,