fix(replies): prevent inline quote links from forcing line breaks

This commit is contained in:
plebeius
2026-02-12 16:17:44 +08:00
parent 9dc3686cf2
commit 378242cdde
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ const NumberQuoteLink = ({ number, threadPostCid }: { number: number; threadPost
return <span>{`>>${number}`}</span>; return <span>{`>>${number}`}</span>;
} }
return <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={comment} isOP={isOP} />; return <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={comment} isOP={isOP} showTrailingBreak={false} />;
}; };
const renderAnchorLink = (children: React.ReactNode, href: string, threadPostCid?: string) => { const renderAnchorLink = (children: React.ReactNode, href: string, threadPostCid?: string) => {
@@ -15,6 +15,7 @@ interface ReplyQuotePreviewProps {
isQuotelinkReply?: boolean; isQuotelinkReply?: boolean;
quotelinkReply?: Comment; quotelinkReply?: Comment;
isOP?: boolean; isOP?: boolean;
showTrailingBreak?: boolean;
} }
const handleQuoteHover = (cid: string, onElementOutOfView: () => void) => { const handleQuoteHover = (cid: string, onElementOutOfView: () => void) => {
@@ -70,7 +71,7 @@ const scrollToThreadCardTop = (threadCid: string) => {
return true; return true;
}; };
const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, isQuotelinkReply, isOP }: ReplyQuotePreviewProps) => { const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, isQuotelinkReply, isOP, showTrailingBreak = true }: ReplyQuotePreviewProps) => {
const [hoveredCid, setHoveredCid] = useState<string | null>(null); const [hoveredCid, setHoveredCid] = useState<string | null>(null);
const [outOfViewCid, setOutOfViewCid] = useState<string | null>(null); const [outOfViewCid, setOutOfViewCid] = useState<string | null>(null);
const placementRef = useRef<Placement>('right'); const placementRef = useRef<Placement>('right');
@@ -194,7 +195,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i
{isOP && ' (OP)'} {isOP && ' (OP)'}
{quotelinkReply?.author?.address === account?.author?.address && ' (You)'} {quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
</Link> </Link>
<br /> {showTrailingBreak && <br />}
{hoveredCid === quotelinkReply?.cid && {hoveredCid === quotelinkReply?.cid &&
outOfViewCid === quotelinkReply?.cid && outOfViewCid === quotelinkReply?.cid &&
createPortal( createPortal(
@@ -339,7 +340,7 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is
return isBacklinkReply ? replyBacklink : isQuotelinkReply && replyQuotelink; return isBacklinkReply ? replyBacklink : isQuotelinkReply && replyQuotelink;
}; };
const ReplyQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, isQuotelinkReply, isOP }: ReplyQuotePreviewProps) => { const ReplyQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, isQuotelinkReply, isOP, showTrailingBreak }: ReplyQuotePreviewProps) => {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
return isMobile ? ( return isMobile ? (
@@ -351,6 +352,7 @@ const ReplyQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, isQ
isBacklinkReply={isBacklinkReply} isBacklinkReply={isBacklinkReply}
isQuotelinkReply={isQuotelinkReply} isQuotelinkReply={isQuotelinkReply}
isOP={isOP} isOP={isOP}
showTrailingBreak={showTrailingBreak}
/> />
); );
}; };