Pārlūkot izejas kodu

文章载入后跳转到锚点

visuddhinanda 2 gadi atpakaļ
vecāks
revīzija
05334ccbdc
1 mainītis faili ar 13 papildinājumiem un 9 dzēšanām
  1. 13 9
      dashboard/src/pages/library/article/show.tsx

+ 13 - 9
dashboard/src/pages/library/article/show.tsx

@@ -38,7 +38,11 @@ import store from "../../../store";
 import { IRecent } from "../../../components/recent/RecentList";
 import { convertToPlain, fullUrl } from "../../../utils";
 import ThemeSelect from "../../../components/general/ThemeSelect";
-import { show } from "../../../reducers/discussion";
+import {
+  IShowDiscussion,
+  show,
+  showAnchor,
+} from "../../../reducers/discussion";
 import { openPanel } from "../../../reducers/right-panel";
 import { TResType } from "../../../components/discussion/DiscussionListCard";
 
@@ -314,14 +318,14 @@ const Widget = () => {
                 const paramComment = searchParams.get("comment");
                 const paramType = searchParams.get("dis_type");
                 if (paramTopic !== null && paramType !== null) {
-                  store.dispatch(
-                    show({
-                      type: "discussion",
-                      topic: paramTopic,
-                      resType: paramType as TResType,
-                      comment: paramComment ? paramComment : undefined,
-                    })
-                  );
+                  const anchorInfo: IShowDiscussion = {
+                    type: "discussion",
+                    topic: paramTopic,
+                    resType: paramType as TResType,
+                    comment: paramComment ? paramComment : undefined,
+                  };
+                  store.dispatch(show(anchorInfo));
+                  store.dispatch(showAnchor(anchorInfo));
                   store.dispatch(openPanel("discussion"));
                 }
               }}