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

feat(dashboard-v6): 巴利原文面包屑更多菜单新增「在新标签页中打开」

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 7 часов назад
Родитель
Сommit
8035967f60
1 измененных файлов с 16 добавлено и 0 удалено
  1. 16 0
      dashboard-v6/src/components/article/TypePali.tsx

+ 16 - 0
dashboard-v6/src/components/article/TypePali.tsx

@@ -28,6 +28,7 @@ import type { TTarget } from "../../types";
 import TocPath from "../tipitaka/TocPath";
 import ParagraphNode from "../tipitaka/ParagraphNode";
 import "./article.css";
+import { articlePath, fullUrl } from "../../utils";
 
 import { useIntl } from "react-intl";
 
@@ -189,6 +190,10 @@ const TypePali = ({
                   key: "library",
                   label: intl.formatMessage({ id: "buttons.open.in.library" }),
                 },
+                {
+                  key: "open_in_tab",
+                  label: intl.formatMessage({ id: "buttons.open.in.tab" }),
+                },
               ],
               onClick: ({ key }) => {
                 if (key === "task") setTaskBuilderModalOpen(true);
@@ -200,6 +205,17 @@ const TypePali = ({
                     "_blank",
                   );
                 }
+                if (key === "open_in_tab" && type && id) {
+                  // 按 props 拼地址而不是复制 location:本组件也会嵌在弹层/模板里
+                  const query = new URLSearchParams();
+                  if (mode) query.set("mode", mode);
+                  if (channelId) query.set("channel", channelId);
+                  const qs = query.toString();
+                  window.open(
+                    fullUrl(articlePath(type, id)) + (qs ? `?${qs}` : ""),
+                    "_blank",
+                  );
+                }
               },
             }}
             placement="bottomRight"