From 6f75ef8f0acb8a32dc27b771d0ca3414c54de6ca Mon Sep 17 00:00:00 2001 From: lyf <1910527151@qq.com> Date: Sat, 10 Aug 2024 12:45:50 +0800 Subject: [PATCH] addcd --- app/components/markdown.tsx | 82 +++++++++++++++++++++++++++---------- app/styles/globals.scss | 15 +++++-- 2 files changed, 72 insertions(+), 25 deletions(-) diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index e011bd5f5..4d7ae7b9c 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -122,20 +122,20 @@ export function PreCode(props: { children: any }) { } }, []); - const [collapsed, setCollapsed] = useState(true); - const [showToggle, setShowToggle] = useState(false); + // const [collapsed, setCollapsed] = useState(true); + // const [showToggle, setShowToggle] = useState(false); - useEffect(() => { - if (ref.current) { - const codeHeight = ref.current.scrollHeight; - setShowToggle(codeHeight > 400); - ref.current.scrollTop = ref.current.scrollHeight; - } - }, [props.children]); + // useEffect(() => { + // if (ref.current) { + // const codeHeight = ref.current.scrollHeight; + // setShowToggle(codeHeight > 400); + // ref.current.scrollTop = ref.current.scrollHeight; + // } + // }, [props.children]); - const toggleCollapsed = () => { - setCollapsed(!collapsed); - }; + // const toggleCollapsed = () => { + // setCollapsed(collapsed=>!collapsed); + // }; return ( <> @@ -143,8 +143,8 @@ export function PreCode(props: { children: any }) {
           
           {props.children}
-          {showToggle && collapsed && (
+          {/* {showToggle && collapsed && (
             
               
             
-          )}
+          )} */}
         
       
       {mermaidCode.length > 0 && (
@@ -191,6 +186,46 @@ export function PreCode(props: { children: any }) {
   );
 }
 
+function CustomCode(props: { children: any }) {
+  const ref = useRef
+        {props.children}
+        {showToggle && collapsed && (
+          
+            
+          
+        )}
+      
+    >
+  );
+}
+
 function escapeDollarNumber(text: string) {
   let escapedText = "";
 
@@ -231,6 +266,8 @@ function _MarkDownContent(props: { content: string }) {
     return escapeBrackets(escapeDollarNumber(props.content));
   }, [props.content]);
 
+  console.log(escapedContent, 11233);
+
   return (