2
0
visuddhinanda 2 жил өмнө
parent
commit
6f7158168a

+ 14 - 0
dashboard/src/components/discussion/DiscussionShow.tsx

@@ -147,6 +147,12 @@ const DiscussionShowWidget = ({
           message.success("链接地址已经拷贝到剪贴板");
         });
         break;
+      case "copy-tpl":
+        const tpl = `{{qa|id=${data.id}|style=collapse}}`;
+        navigator.clipboard.writeText(tpl).then(() => {
+          notification.success({ message: "链接地址已经拷贝到剪贴板" });
+        });
+        break;
       case "edit":
         if (typeof onEdit !== "undefined") {
           onEdit();
@@ -185,6 +191,14 @@ const DiscussionShowWidget = ({
       }),
       icon: <LinkOutlined />,
     },
+    {
+      key: "copy-tpl",
+      label: intl.formatMessage({
+        id: "buttons.copy.tpl",
+      }),
+      icon: <LinkOutlined />,
+      disabled: data.type !== "qa",
+    },
     {
       type: "divider",
     },