Преглед на файлове

文章载入后跳转到锚点

visuddhinanda преди 2 години
родител
ревизия
05334ccbdc
променени са 1 файла, в които са добавени 13 реда и са изтрити 9 реда
  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 { IRecent } from "../../../components/recent/RecentList";
 import { convertToPlain, fullUrl } from "../../../utils";
 import { convertToPlain, fullUrl } from "../../../utils";
 import ThemeSelect from "../../../components/general/ThemeSelect";
 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 { openPanel } from "../../../reducers/right-panel";
 import { TResType } from "../../../components/discussion/DiscussionListCard";
 import { TResType } from "../../../components/discussion/DiscussionListCard";
 
 
@@ -314,14 +318,14 @@ const Widget = () => {
                 const paramComment = searchParams.get("comment");
                 const paramComment = searchParams.get("comment");
                 const paramType = searchParams.get("dis_type");
                 const paramType = searchParams.get("dis_type");
                 if (paramTopic !== null && paramType !== null) {
                 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"));
                   store.dispatch(openPanel("discussion"));
                 }
                 }
               }}
               }}