Sfoglia il codice sorgente

段落链接跳转章节需要修改type #1584

visuddhinanda 2 anni fa
parent
commit
fd4e113717
1 ha cambiato i file con 10 aggiunte e 3 eliminazioni
  1. 10 3
      dashboard/src/pages/library/article/show.tsx

+ 10 - 3
dashboard/src/pages/library/article/show.tsx

@@ -294,10 +294,17 @@ const Widget = () => {
                   anthologyId={searchParams.get("anthology")}
                   onSelect={(key: Key) => {
                     console.log("toc click", key);
-                    let url = `/article/${type}/${key}?`;
+                    const newType = type === "para" ? "chapter" : type;
+                    let url = `/article/${newType}/${key}?`;
                     let param: string[] = [];
-                    searchParams.forEach((value, key) => {
-                      param.push(`${key}=${value}`);
+                    searchParams.forEach((value, searchKey) => {
+                      if (type !== "para") {
+                        param.push(`${searchKey}=${value}`);
+                      } else {
+                        if (searchKey !== "book" && searchKey !== "par") {
+                          param.push(`${searchKey}=${value}`);
+                        }
+                      }
                     });
                     navigate(url + param.join("&"));
                     scrollToTop();