Revert "test: remove expandCrossbellNote markdown"

This reverts commit 2228e3e299.
This commit is contained in:
DIYgod
2023-06-17 00:31:34 +01:00
parent 1a48c05ba5
commit f737a3b764
3 changed files with 19 additions and 16 deletions
+3 -3
View File
@@ -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<HTMLDivElement | null>
onScroll?: (scrollTop: number) => void
onMouseEnter?: () => void
parsedContent?: any
parsedContent?: ReturnType<typeof renderPageContent>
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 (
+11 -11
View File
@@ -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: () => (
// <div className="xlog-comment comment" id="comments" data-hide-print>
// <p>Loading comments...</p>
// </div>
// ),
// })
const DynamicComment = dynamic(() => import("~/components/common/Comment"), {
// TODO Skeleton
loading: () => (
<div className="xlog-comment comment" id="comments" data-hide-print>
<p>Loading comments...</p>
</div>
),
})
export const usePostFooterInView = () => {
const { data } = useQuery<boolean>({
@@ -65,13 +65,13 @@ export const PostFooter = ({
page={page}
/>
</div>
{/* {inited || isInView ? (
{inited || isInView ? (
<DynamicComment page={page} />
) : (
<div className="xlog-comment comment" id="comments" data-hide-print>
<p>Loading comments...</p>
</div>
)} */}
)}
</>
)
}
+5 -2
View File
@@ -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()