a tool for shared writing and social publishing

Merge branch 'main' of https://github.com/hyperlink-academy/minilink into update/delete-blocks

+12 -3
-3
components/Blocks/Block.tsx
··· 103 103 104 104 let [areYouSure, setAreYouSure] = useState(false); 105 105 useEffect(() => { 106 - if (selected && rep) { 107 - focusPage(props.parent, rep); 108 - } 109 106 if (!selected) { 110 107 setAreYouSure(false); 111 108 }
+12
components/Blocks/useBlockMouseHandlers.ts
··· 8 8 import { getBlocksWithType } from "src/hooks/queries/useBlocks"; 9 9 import { focusBlock } from "src/utils/focusBlock"; 10 10 import { useIsMobile } from "src/hooks/isMobile"; 11 + import { scrollIntoViewIfNeeded } from "src/utils/scrollIntoViewIfNeeded"; 12 + import { elementId } from "src/utils/elementId"; 11 13 12 14 let debounce: number | null = null; 13 15 export function useBlockMouseHandlers(props: Block) { ··· 39 41 parent: props.parent, 40 42 }); 41 43 useUIState.getState().setSelectedBlock(props); 44 + 45 + // scroll to the page containing the block, if offscreen 46 + let parentPage = elementId.page(props.parent).container; 47 + setTimeout(() => { 48 + scrollIntoViewIfNeeded( 49 + document.getElementById(parentPage), 50 + false, 51 + "smooth", 52 + ); 53 + }, 50); 42 54 } 43 55 }, 44 56 [props, entity_set.permissions.write, isMobile],