a tool for shared writing and social publishing
0
fork

Configure Feed

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

don't pass onMouseDown to long press and don't add id in preview

+7 -9
+5 -2
components/Blocks/Block.tsx
··· 27 27 import { Media } from "components/Media"; 28 28 import { useIsMobile } from "src/hooks/isMobile"; 29 29 import { DateTimeBlock } from "./DateTimeBlock"; 30 + import { elementId } from "src/utils/elementId"; 30 31 31 32 export type Block = { 32 33 factID: string; ··· 68 69 { type: "start" }, 69 70 ); 70 71 } 71 - }, mouseHandlers.onMouseDown); 72 + }); 72 73 73 74 let selected = useUIState( 74 75 (s) => !!s.selectedBlocks.find((b) => b.value === props.entityID), ··· 87 88 return ( 88 89 <div 89 90 {...(!props.preview ? { ...mouseHandlers, ...handlers } : {})} 90 - id={`block/${props.entityID}/container`} 91 + id={ 92 + !props.preview ? elementId.block(props.entityID).container : undefined 93 + } 91 94 className={` 92 95 blockWrapper relative 93 96 flex flex-row gap-2
+2 -7
src/hooks/useLongPress.ts
··· 1 1 import { useRef, useEffect, useState, useCallback, useMemo } from "react"; 2 2 3 - export const useLongPress = ( 4 - cb: () => void, 5 - propsOnMouseDown?: (e: React.MouseEvent) => void, 6 - cancel?: boolean, 7 - ) => { 3 + export const useLongPress = (cb: () => void, cancel?: boolean) => { 8 4 let longPressTimer = useRef<number>(); 9 5 let isLongPress = useRef(false); 10 6 let [startPosition, setStartPosition] = useState<{ ··· 14 10 15 11 let onPointerDown = useCallback( 16 12 (e: React.MouseEvent) => { 17 - propsOnMouseDown?.(e); 18 13 if (e.button === 2) { 19 14 return; 20 15 } ··· 26 21 cb(); 27 22 }, 500); 28 23 }, 29 - [propsOnMouseDown, cb], 24 + [cb], 30 25 ); 31 26 32 27 let end = useCallback(() => {