mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(replies): prevent inline quote links from forcing line breaks
This commit is contained in:
@@ -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}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user