Browse Source

默认链接本地打开

visuddhinanda 2 years ago
parent
commit
fba2aa1c05
1 changed files with 13 additions and 11 deletions
  1. 13 11
      dashboard/src/components/corpus/TocPath.tsx

+ 13 - 11
dashboard/src/components/corpus/TocPath.tsx

@@ -1,5 +1,5 @@
 import { Link } from "react-router-dom";
-import { Breadcrumb, Tooltip } from "antd";
+import { Breadcrumb, Popover, Tooltip } from "antd";
 import PaliText from "../template/Wbw/PaliText";
 import React from "react";
 
@@ -23,7 +23,7 @@ interface IWidgetTocPath {
 const TocPathWidget = ({
   data = [],
   trigger,
-  link = "blank",
+  link = "self",
   channel,
   onChange,
 }: IWidgetTocPath): JSX.Element => {
@@ -39,15 +39,17 @@ const TocPathWidget = ({
       case "none":
         oneItem = <>{title}</>;
         break;
-      case "blank":
-        oneItem = (
-          <Link to={linkChapter} target="_blank">
-            {title}
-          </Link>
-        );
-        break;
-      case "self":
-        oneItem = <Link to={linkChapter}>{title}</Link>;
+      case "self" || "blank":
+        if (item.book === 0) {
+          oneItem = <>{title}</>;
+        } else {
+          oneItem = (
+            <Link to={linkChapter} target={`_${link}`}>
+              {title}
+            </Link>
+          );
+        }
+
         break;
     }
     return (