visuddhinanda 2 лет назад
Родитель
Сommit
b96a438f79

+ 8 - 2
dashboard/src/components/article/Article.tsx

@@ -6,6 +6,7 @@ import TypePali from "./TypePali";
 import "./article.css";
 import TypePage from "./TypePage";
 import TypeCSPara from "./TypeCSPara";
+import { ISearchParams } from "../../pages/library/article/show";
 
 export type ArticleMode = "read" | "edit" | "wbw";
 export type ArticleType =
@@ -132,9 +133,14 @@ const ArticleWidget = ({
           book={book}
           para={para}
           focus={focus}
-          onArticleChange={(type: ArticleType, id: string, target: string) => {
+          onArticleChange={(
+            type: ArticleType,
+            id: string,
+            target: string,
+            param: ISearchParams[]
+          ) => {
             if (typeof onArticleChange !== "undefined") {
-              onArticleChange(type, id, target);
+              onArticleChange(type, id, target, param);
             }
           }}
         />

+ 8 - 1
dashboard/src/components/article/TypePali.tsx

@@ -15,6 +15,7 @@ import ErrorResult from "../general/ErrorResult";
 import store from "../../store";
 import { refresh } from "../../reducers/focus";
 import Navigate from "./Navigate";
+import { ISearchParams } from "../../pages/library/article/show";
 
 interface IWidget {
   type?: ArticleType;
@@ -279,8 +280,14 @@ const TypePaliWidget = ({
                 if (event.ctrlKey || event.metaKey) {
                   target = "_blank";
                 }
+                let param: ISearchParams[] = [];
+                if (type === "para" && newId) {
+                  if (newId.split("-").length > 1) {
+                    param = [{ key: "par", value: newId.split("-")[1] }];
+                  }
+                }
                 if (typeof onArticleChange !== "undefined") {
-                  onArticleChange(type, newId, target);
+                  onArticleChange(type, newId, target, param);
                 }
               }}
             />