From 8b67536c2313b03d19e28896292d6b81ad90247b Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Wed, 21 Aug 2024 02:04:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E6=9F=A5=E7=9C=8B=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/markdown.tsx | 19 ++++++++----------- app/styles/globals.scss | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index ae05a458b..d592e7a34 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -64,7 +64,6 @@ export function Mermaid(props: { code: string }) { export function PreCode(props: { children: any }) { const ref = useRef(null); - const refText = ref.current?.innerText; const [mermaidCode, setMermaidCode] = useState(""); const [htmlCode, setHtmlCode] = useState(""); const { height } = useWindowSize(); @@ -79,7 +78,7 @@ export function PreCode(props: { children: any }) { setMermaidCode((mermaidDom as HTMLElement).innerText); } const htmlDom = ref.current.querySelector("code.language-html"); - const refText = ref.current?.innerText; + const refText = ref.current.querySelector("code")?.innerText; if (htmlDom) { setHtmlCode((htmlDom as HTMLElement).innerText); } else if (refText?.startsWith(" {props.children} - {showToggle && collapsed && ( -
- -
- )} + {showToggle && collapsed && ( +
+ +
+ )} ); } diff --git a/app/styles/globals.scss b/app/styles/globals.scss index 564875b90..e8c10de3f 100644 --- a/app/styles/globals.scss +++ b/app/styles/globals.scss @@ -304,7 +304,7 @@ pre { } } -code{ +pre { .show-hide-button { border-radius: 10px; position: absolute;