Selaa lähdekoodia

add copy button

visuddhinanda 1 vuosi sitten
vanhempi
sitoutus
e2f3d0d1d2
1 muutettua tiedostoa jossa 14 lisäystä ja 2 poistoa
  1. 14 2
      dashboard/src/components/template/Wbw/RelaGraphic.tsx

+ 14 - 2
dashboard/src/components/template/Wbw/RelaGraphic.tsx

@@ -1,8 +1,12 @@
+import { Button, Tooltip, Typography } from "antd";
+import { CopyOutlined } from "@ant-design/icons";
+
 import Mermaid from "../../general/Mermaid";
 import Mermaid from "../../general/Mermaid";
 import { useAppSelector } from "../../../hooks";
 import { useAppSelector } from "../../../hooks";
 import { getTerm } from "../../../reducers/term-vocabulary";
 import { getTerm } from "../../../reducers/term-vocabulary";
 import { IWbwRelation } from "./WbwDetailRelation";
 import { IWbwRelation } from "./WbwDetailRelation";
 import { IWbw } from "./WbwWord";
 import { IWbw } from "./WbwWord";
+const { Text } = Typography;
 
 
 interface IWidget {
 interface IWidget {
   wbwData?: IWbw[];
   wbwData?: IWbw[];
@@ -41,10 +45,18 @@ const RelaGraphicWidget = ({ wbwData }: IWidget) => {
     console.log("mermaid", mermaid);
     console.log("mermaid", mermaid);
     return mermaid;
     return mermaid;
   }
   }
-
+  const mermaidText = sent_show_rel_map(wbwData);
   return (
   return (
     <div>
     <div>
-      <Mermaid text={sent_show_rel_map(wbwData)} />
+      <div style={{ display: "flex", justifyContent: "space-between" }}>
+        <div>
+          <Text copyable={{ text: mermaidText, tooltips: "复制mermaid代码" }} />
+        </div>
+        <div></div>
+      </div>
+      <div>
+        <Mermaid text={mermaidText} />
+      </div>
     </div>
     </div>
   );
   );
 };
 };