|
|
@@ -6,6 +6,7 @@ import TocPath, { ITocPathNode } from "../corpus/TocPath";
|
|
|
import PaliChapterChannelList from "../corpus/PaliChapterChannelList";
|
|
|
import { ArticleType } from "./Article";
|
|
|
import VisibleObserver from "../general/VisibleObserver";
|
|
|
+import { useEffect, useState } from "react";
|
|
|
|
|
|
const { Paragraph, Title, Text } = Typography;
|
|
|
export interface IFirstAnthology {
|
|
|
@@ -52,6 +53,10 @@ const ArticleViewWidget = ({
|
|
|
onPathChange,
|
|
|
onAnthologySelect,
|
|
|
}: IWidgetArticleData) => {
|
|
|
+ const [currPath, setCurrPath] = useState(path);
|
|
|
+
|
|
|
+ useEffect(() => setCurrPath(path), [path]);
|
|
|
+
|
|
|
let currChannelList = <></>;
|
|
|
switch (type) {
|
|
|
case "chapter":
|
|
|
@@ -86,25 +91,8 @@ const ArticleViewWidget = ({
|
|
|
</div>
|
|
|
|
|
|
<Space direction="vertical">
|
|
|
- <Text>
|
|
|
- {path.length === 0 && anthology ? (
|
|
|
- <>
|
|
|
- <Text>{"文集:"}</Text>
|
|
|
- <Button
|
|
|
- type="link"
|
|
|
- onClick={() => {
|
|
|
- if (typeof onAnthologySelect !== "undefined") {
|
|
|
- onAnthologySelect(anthology.id);
|
|
|
- }
|
|
|
- }}
|
|
|
- >
|
|
|
- {anthology.title}
|
|
|
- </Button>
|
|
|
- </>
|
|
|
- ) : undefined}
|
|
|
- </Text>
|
|
|
<TocPath
|
|
|
- data={path}
|
|
|
+ data={currPath}
|
|
|
channel={channels}
|
|
|
onChange={(
|
|
|
node: ITocPathNode,
|