Преглед на файлове

链接末尾加段落号

visuddhinanda преди 2 години
родител
ревизия
c0377b5f48
променени са 1 файла, в които са добавени 15 реда и са изтрити 6 реда
  1. 15 6
      dashboard/src/components/corpus/TocPath.tsx

+ 15 - 6
dashboard/src/components/corpus/TocPath.tsx

@@ -1,7 +1,8 @@
 import { Link } from "react-router-dom";
 import { Link } from "react-router-dom";
-import { Breadcrumb, Popover, Tooltip } from "antd";
+import { Breadcrumb, Popover, Tag, Typography } from "antd";
 import PaliText from "../template/Wbw/PaliText";
 import PaliText from "../template/Wbw/PaliText";
 import React from "react";
 import React from "react";
+import { IChapter } from "./BookViewer";
 
 
 export interface ITocPathNode {
 export interface ITocPathNode {
   book: number;
   book: number;
@@ -35,17 +36,18 @@ const TocPathWidget = ({
     const linkChapter = `/article/chapter/${item.book}-${item.paragraph}${sChannel}`;
     const linkChapter = `/article/chapter/${item.book}-${item.paragraph}${sChannel}`;
     let oneItem = <></>;
     let oneItem = <></>;
     const title = <PaliText text={item.title} />;
     const title = <PaliText text={item.title} />;
+    const eTitle = item.level < 9 ? title : <Tag>{title}</Tag>;
     switch (link) {
     switch (link) {
       case "none":
       case "none":
-        oneItem = <>{title}</>;
+        oneItem = <Typography.Link>{eTitle}</Typography.Link>;
         break;
         break;
       case "self" || "blank":
       case "self" || "blank":
         if (item.book === 0) {
         if (item.book === 0) {
-          oneItem = <>{title}</>;
+          oneItem = <>{eTitle}</>;
         } else {
         } else {
           oneItem = (
           oneItem = (
             <Link to={linkChapter} target={`_${link}`}>
             <Link to={linkChapter} target={`_${link}`}>
-              {title}
+              {eTitle}
             </Link>
             </Link>
           );
           );
         }
         }
@@ -54,9 +56,16 @@ const TocPathWidget = ({
     }
     }
     return (
     return (
       <Breadcrumb.Item
       <Breadcrumb.Item
-        onClick={() => {
+        onClick={(
+          e: React.MouseEvent<HTMLSpanElement | HTMLAnchorElement, MouseEvent>
+        ) => {
           if (typeof onChange !== "undefined") {
           if (typeof onChange !== "undefined") {
-            onChange({ book: item.book, para: item.paragraph });
+            const para: IChapter = {
+              book: item.book,
+              para: item.paragraph,
+              level: item.level,
+            };
+            onChange(para, e);
           }
           }
         }}
         }}
         key={id}
         key={id}