瀏覽代碼

点路径发消息

visuddhinanda 2 年之前
父節點
當前提交
a4d8fa5281
共有 1 個文件被更改,包括 27 次插入1 次删除
  1. 27 1
      dashboard/src/components/corpus/RelatedPara.tsx

+ 27 - 1
dashboard/src/components/corpus/RelatedPara.tsx

@@ -4,6 +4,8 @@ import { Badge, Card, List, message, Modal, Skeleton } from "antd";
 import { get } from "../../request";
 import { get } from "../../request";
 import { useEffect, useState } from "react";
 import { useEffect, useState } from "react";
 import TocPath, { ITocPathNode } from "./TocPath";
 import TocPath, { ITocPathNode } from "./TocPath";
+import store from "../../store";
+import { change } from "../../reducers/para-change";
 
 
 interface ITag {
 interface ITag {
   id?: string;
   id?: string;
@@ -122,7 +124,31 @@ const RelatedParaWidget = ({ book, para, trigger, onSelect }: IWidget) => {
                       }
                       }
                       size="small"
                       size="small"
                     >
                     >
-                      <TocPath data={item.path} />
+                      <TocPath
+                        data={item.path}
+                        onChange={(
+                          node: ITocPathNode,
+                          e: React.MouseEvent<
+                            HTMLSpanElement | HTMLAnchorElement,
+                            MouseEvent
+                          >
+                        ) => {
+                          if (node.book && node.paragraph) {
+                            const type = node.level
+                              ? node.level < 8
+                                ? "chapter"
+                                : "para"
+                              : "para";
+                            store.dispatch(
+                              change({
+                                book: node.book,
+                                para: node.paragraph,
+                                type: type,
+                              })
+                            );
+                          }
+                        }}
+                      />
                     </Card>
                     </Card>
                   </Badge.Ribbon>
                   </Badge.Ribbon>
                 </List.Item>
                 </List.Item>