visuddhinanda 2 лет назад
Родитель
Сommit
4137142e30

+ 18 - 0
dashboard/src/components/template/WbwSent.tsx

@@ -526,6 +526,15 @@ export const WbwSentCtl = ({
               key: "wbw-dict-publish-all",
               label: "发布全部单词",
             },
+            {
+              type: "divider",
+            },
+            {
+              key: "copy-text",
+              label: intl.formatMessage({
+                id: "buttons.copy.pali.text",
+              }),
+            },
           ],
           onClick: ({ key }) => {
             console.log(`Click on item ${key}`);
@@ -537,6 +546,15 @@ export const WbwSentCtl = ({
               case "wbw-dict-publish-all":
                 wbwPublish(wordData);
                 break;
+              case "copy-text":
+                const paliText = wordData
+                  .filter((value) => value.type?.value !== ".ctl.")
+                  .map((item) => item.word.value)
+                  .join(" ");
+                navigator.clipboard.writeText(paliText).then(() => {
+                  message.success("已经拷贝到剪贴板");
+                });
+                break;
             }
           },
         }}

+ 2 - 0
dashboard/src/locales/zh-Hans/buttons.ts

@@ -26,6 +26,8 @@ const items = {
   "buttons.ok": "确定",
   "buttons.close": "关闭",
   "buttons.copy.to": "复制到",
+  "buttons.copy.text": "复制文本",
+  "buttons.copy.pali.text": "复制巴利语文本",
   "buttons.basic.information": "基本信息",
   "buttons.share": "分享",
   "buttons.yes": "是",