From f737a3b7642f958686ff4e4b5c56692923740b99 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 17 Jun 2023 00:31:34 +0100 Subject: [PATCH] Revert "test: remove expandCrossbellNote markdown" This reverts commit 2228e3e299a7ac1e02af1995c581bc2d7f5b9180. --- src/components/common/PageContent.tsx | 6 +++--- src/components/site/PostFooter.tsx | 22 +++++++++++----------- src/lib/expand-unit.ts | 7 +++++-- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/components/common/PageContent.tsx b/src/components/common/PageContent.tsx index 06010be2..e73b0188 100644 --- a/src/components/common/PageContent.tsx +++ b/src/components/common/PageContent.tsx @@ -4,8 +4,8 @@ import PostActions from "~/components/site/PostActions" import PostToc from "~/components/site/PostToc" import { ExpandedCharacter, ExpandedNote } from "~/lib/types" import { cn } from "~/lib/utils" +import { renderPageContent } from "~/markdown" -// import { renderPageContent } from "~/markdown" import { PageContentContainer } from "./PageContentContainer" export const PageContent = ({ @@ -27,7 +27,7 @@ export const PageContent = ({ inputRef?: MutableRefObject onScroll?: (scrollTop: number) => void onMouseEnter?: () => void - parsedContent?: any + parsedContent?: ReturnType isComment?: boolean page?: ExpandedNote site?: ExpandedCharacter @@ -37,7 +37,7 @@ export const PageContent = ({ if (parsedContent) { inParsedContent = parsedContent } else if (content) { - // inParsedContent = renderPageContent(content, false, isComment) + inParsedContent = renderPageContent(content, false, isComment) } return ( diff --git a/src/components/site/PostFooter.tsx b/src/components/site/PostFooter.tsx index 236021b4..8020bd64 100644 --- a/src/components/site/PostFooter.tsx +++ b/src/components/site/PostFooter.tsx @@ -1,7 +1,7 @@ "use client" import { useInViewport } from "ahooks" -// import dynamic from "next/dynamic" +import dynamic from "next/dynamic" import { useEffect, useRef, useState } from "react" import { useQuery, useQueryClient } from "@tanstack/react-query" @@ -12,14 +12,14 @@ import { ExpandedCharacter, ExpandedNote } from "~/lib/types" const key = ["PostFooterInView"] -// const DynamicComment = dynamic(() => import("~/components/common/Comment"), { -// // TODO Skeleton -// loading: () => ( -//
-//

Loading comments...

-//
-// ), -// }) +const DynamicComment = dynamic(() => import("~/components/common/Comment"), { + // TODO Skeleton + loading: () => ( +
+

Loading comments...

+
+ ), +}) export const usePostFooterInView = () => { const { data } = useQuery({ @@ -65,13 +65,13 @@ export const PostFooter = ({ page={page} /> - {/* {inited || isInView ? ( + {inited || isInView ? ( ) : (

Loading comments...

- )} */} + )} ) } diff --git a/src/lib/expand-unit.ts b/src/lib/expand-unit.ts index 82db1ef2..c548f44d 100644 --- a/src/lib/expand-unit.ts +++ b/src/lib/expand-unit.ts @@ -31,8 +31,11 @@ export const expandCrossbellNote = async ({ if (expandedNote.metadata?.content) { if (expandedNote.metadata?.content?.content) { - // const { renderPageContent } = await import("~/markdown") - const rendered = {} as any + const { renderPageContent } = await import("~/markdown") + const rendered = renderPageContent( + expandedNote.metadata.content.content, + true, + ) if (keyword) { const position = expandedNote.metadata.content.content .toLowerCase()