Просмотр исходного кода

Merge pull request #1957 from visuddhinanda/agile

add markdown link
visuddhinanda 2 лет назад
Родитель
Сommit
de44f9d7b5
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      dashboard/src/components/attachment/AttachmentList.tsx

+ 13 - 0
dashboard/src/components/attachment/AttachmentList.tsx

@@ -256,6 +256,13 @@ const AttachmentWidget = ({
                   menu={{
                     items: [
                       { label: "链接", key: "link" },
+                      {
+                        label: "Markdown",
+                        key: "markdown",
+                        disabled: row.content_type.includes("image")
+                          ? false
+                          : true,
+                      },
                       { label: "替换", key: "replace" },
                       { label: "引用模版", key: "tpl" },
                       { label: "删除", key: "delete", danger: true },
@@ -269,6 +276,12 @@ const AttachmentWidget = ({
                             message.success("已经拷贝到剪贴板");
                           });
                           break;
+                        case "markdown":
+                          const markdown = `![${row.title}](/attachments/${row.filename})`;
+                          navigator.clipboard.writeText(markdown).then(() => {
+                            message.success("已经拷贝到剪贴板");
+                          });
+                          break;
                         case "replace":
                           setReplaceId(row.id);
                           setImportOpen(true);