diff --git a/src/components/comment-content/comment-content.tsx b/src/components/comment-content/comment-content.tsx
index 25e1736c..d0d58f8d 100644
--- a/src/components/comment-content/comment-content.tsx
+++ b/src/components/comment-content/comment-content.tsx
@@ -147,7 +147,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
)
) : (
<>
- {!showOriginal && }
+ {!showOriginal && }
{pendingApproval && (
<>
@@ -182,7 +182,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
)}
{edit && original?.content !== content && (
- {showOriginal && }
+ {showOriginal && }
{
- const cid = usePostNumberStore((state) => state.numberToCid[number]);
+const NumberQuoteLink = ({ number, threadPostCid, subplebbitAddress }: { number: number; threadPostCid?: string; subplebbitAddress?: string }) => {
+ const cid = usePostNumberStore((state) => (subplebbitAddress ? state.numberToCid[subplebbitAddress]?.[number] : undefined));
const commentFromStore = useSubplebbitsPagesStore((state) => (cid ? state.comments[cid] : undefined));
const commentFromHook = useComment({ commentCid: cid, onlyIfCached: true });
const comment = commentFromHook?.number !== undefined ? commentFromHook : commentFromStore;
@@ -204,7 +205,7 @@ const NumberQuoteLink = ({ number, threadPostCid }: { number: number; threadPost
return ;
};
-const renderAnchorLink = (children: React.ReactNode, href: string, threadPostCid?: string) => {
+const renderAnchorLink = (children: React.ReactNode, href: string, threadPostCid?: string, subplebbitAddress?: string) => {
if (!href) {
return {children};
}
@@ -214,7 +215,7 @@ const renderAnchorLink = (children: React.ReactNode, href: string, threadPostCid
const number = parseInt(numberQuoteMatch[1], 10);
return (
-
+
);
}
@@ -268,7 +269,7 @@ const renderAnchorLink = (children: React.ReactNode, href: string, threadPostCid
);
};
-const Markdown = ({ content, title, postCid }: MarkdownProps) => {
+const Markdown = ({ content, title, postCid, subplebbitAddress }: MarkdownProps) => {
const remarkPlugins = useMemo(() => {
const plugins: any[] = [[supersub]];
@@ -338,13 +339,13 @@ const Markdown = ({ content, title, postCid }: MarkdownProps) => {
console.debug('Invalid URL:', href);
}
- return renderAnchorLink(children, href, postCid);
+ return renderAnchorLink(children, href, postCid, subplebbitAddress);
}
- return renderAnchorLink(children, href || '', postCid);
+ return renderAnchorLink(children, href || '', postCid, subplebbitAddress);
},
}) as ExtendedComponents,
- [isInCatalogView, postCid],
+ [isInCatalogView, postCid, subplebbitAddress],
);
return (
diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx
index d8db269a..6ab2fba8 100644
--- a/src/components/post-desktop/post-desktop.tsx
+++ b/src/components/post-desktop/post-desktop.tsx
@@ -849,7 +849,7 @@ const PostDesktop = ({
return map;
})();
- const quotedByMap = useQuotedByMap(filteredReplies);
+ const quotedByMap = useQuotedByMap(filteredReplies, subplebbitAddress);
const visibleReplies = useProgressiveRender(filteredReplies, {
batchSize: 50,
diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx
index 3c219084..86a9b539 100644
--- a/src/components/post-mobile/post-mobile.tsx
+++ b/src/components/post-mobile/post-mobile.tsx
@@ -606,7 +606,7 @@ const PostMobile = ({
return map;
})();
- const quotedByMap = useQuotedByMap(filteredReplies);
+ const quotedByMap = useQuotedByMap(filteredReplies, subplebbitAddress);
const visibleReplies = useProgressiveRender(filteredReplies, {
batchSize: 50,
diff --git a/src/components/reply-quote-preview/reply-quote-preview.tsx b/src/components/reply-quote-preview/reply-quote-preview.tsx
index 19932b00..ea7df6bb 100644
--- a/src/components/reply-quote-preview/reply-quote-preview.tsx
+++ b/src/components/reply-quote-preview/reply-quote-preview.tsx
@@ -131,8 +131,12 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i
if (cid && subplebbitAddress) {
const boardPath = getBoardPath(subplebbitAddress, directories);
const threadRoute = `/${boardPath}/thread/${cid}`;
- if (isOpQuote && location.pathname === threadRoute) {
- scrollToThreadCardTop(cid);
+ if (isOpQuote) {
+ if (location.pathname === threadRoute) {
+ scrollToThreadCardTop(cid);
+ } else {
+ navigate(threadRoute);
+ }
return;
}
if (scrollToReplyOnPage(cid)) return;
@@ -248,8 +252,12 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is
if (cid && subplebbitAddress) {
const boardPath = getBoardPath(subplebbitAddress, directories);
const threadRoute = `/${boardPath}/thread/${cid}`;
- if (isOpQuote && location.pathname === threadRoute) {
- scrollToThreadCardTop(cid);
+ if (isOpQuote) {
+ if (location.pathname === threadRoute) {
+ scrollToThreadCardTop(cid);
+ } else {
+ navigate(threadRoute);
+ }
return;
}
if (scrollToReplyOnPage(cid)) return;
diff --git a/src/hooks/use-publish-reply.ts b/src/hooks/use-publish-reply.ts
index 229421a1..c04aef8c 100644
--- a/src/hooks/use-publish-reply.ts
+++ b/src/hooks/use-publish-reply.ts
@@ -56,8 +56,8 @@ const usePublishReply = ({ cid, subplebbitAddress, postCid }: { cid: string; sub
const resetPublishReplyOptions = useCallback(() => resetPublishReplyStore(parentCid), [parentCid, resetPublishReplyStore]);
- const numberToCid = usePostNumberStore((state) => state.numberToCid);
- const quotedCids = useMemo(() => getQuotedCidsFromContent(content, numberToCid), [content, numberToCid]);
+ const scopedNumberToCid = usePostNumberStore((state) => (subplebbitAddress ? state.numberToCid[subplebbitAddress] : undefined));
+ const quotedCids = useMemo(() => getQuotedCidsFromContent(content, scopedNumberToCid), [content, scopedNumberToCid]);
const publishOptions = useMemo(() => mergeQuotedCids(publishCommentOptions, quotedCids), [publishCommentOptions, quotedCids]);
diff --git a/src/hooks/use-quoted-by-map.ts b/src/hooks/use-quoted-by-map.ts
index a6e9da25..2f622756 100644
--- a/src/hooks/use-quoted-by-map.ts
+++ b/src/hooks/use-quoted-by-map.ts
@@ -61,32 +61,40 @@ const extractReplyQuoteTargets = (replies: Comment[]) => {
};
};
-const useQuotedByMap = (replies: Comment[] = []) => {
+const useQuotedByMap = (replies: Comment[] = [], subplebbitAddress?: string) => {
const stableQuotedByMapRef = useRef