Explorar o código

Fix code duplication

lyf hai 1 ano
pai
achega
35aa2c7270
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      app/components/markdown.tsx

+ 4 - 2
app/components/markdown.tsx

@@ -128,8 +128,10 @@ export function PreCode(props: { children: any }) {
           className="copy-code-button"
           onClick={() => {
             if (ref.current) {
-              const code = ref.current.innerText;
-              copyToClipboard(code);
+              // const code = ref.current.innerText;
+              copyToClipboard(
+                ref.current.querySelector("code")?.innerText ?? "",
+              );
             }
           }}
         ></span>