فهرست منبع

添加debug参数支持

visuddhinanda 2 سال پیش
والد
کامیت
376b395447
1فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  1. 7 0
      dashboard/src/components/article/Article.tsx

+ 7 - 0
dashboard/src/components/article/Article.tsx

@@ -20,6 +20,7 @@ import {
   IRecentResponse,
   IRecentResponse,
 } from "../../pages/studio/recent/list";
 } from "../../pages/studio/recent/list";
 import { ITocPathNode } from "../corpus/TocPath";
 import { ITocPathNode } from "../corpus/TocPath";
+import { useSearchParams } from "react-router-dom";
 
 
 export type ArticleMode = "read" | "edit" | "wbw";
 export type ArticleMode = "read" | "edit" | "wbw";
 export type ArticleType =
 export type ArticleType =
@@ -91,6 +92,7 @@ const ArticleWidget = ({
   const [showSkeleton, setShowSkeleton] = useState(true);
   const [showSkeleton, setShowSkeleton] = useState(true);
   const [unauthorized, setUnauthorized] = useState(false);
   const [unauthorized, setUnauthorized] = useState(false);
   const [remains, setRemains] = useState(false);
   const [remains, setRemains] = useState(false);
+  const [searchParams] = useSearchParams();
 
 
   const channels = channelId?.split("_");
   const channels = channelId?.split("_");
 
 
@@ -135,7 +137,9 @@ const ArticleWidget = ({
     if (!active) {
     if (!active) {
       return;
       return;
     }
     }
+
     if (typeof type !== "undefined") {
     if (typeof type !== "undefined") {
+      const debug = searchParams.get("debug");
       let url = "";
       let url = "";
       switch (type) {
       switch (type) {
         case "chapter":
         case "chapter":
@@ -193,6 +197,9 @@ const ArticleWidget = ({
           }
           }
           break;
           break;
       }
       }
+      if (debug) {
+        url += `&debug=${debug}`;
+      }
       console.log("article url", url);
       console.log("article url", url);
       setShowSkeleton(true);
       setShowSkeleton(true);
       if (typeof articleId !== "undefined") {
       if (typeof articleId !== "undefined") {