fix(markdown): handle unavailable reply quote links

This commit is contained in:
plebeius
2026-03-06 14:55:40 +08:00
parent 9cc6876887
commit 65731ceb3a
6 changed files with 172 additions and 33 deletions
+17
View File
@@ -0,0 +1,17 @@
import type { Comment } from '@bitsocialhq/bitsocial-react-hooks';
export const formatQuoteNumber = (number?: number) => `>>${number ?? '?'}`;
export const isUnavailableQuoteTarget = (comment?: Partial<Pick<Comment, 'deleted' | 'removed'>> | null) => Boolean(comment?.deleted || comment?.removed);
export const shouldShowFloatingQuotePreview = ({
hoveredCid,
outOfViewCid,
quoteCid,
isUnavailable,
}: {
hoveredCid: string | null;
outOfViewCid: string | null;
quoteCid?: string;
isUnavailable?: boolean;
}) => Boolean(quoteCid && !isUnavailable && hoveredCid === quoteCid && outOfViewCid === quoteCid);