|
@@ -30,7 +30,6 @@ interface IWidget {
|
|
|
hideInteractive?: boolean;
|
|
hideInteractive?: boolean;
|
|
|
hideTitle?: boolean;
|
|
hideTitle?: boolean;
|
|
|
onArticleChange?: Function;
|
|
onArticleChange?: Function;
|
|
|
- onFinal?: Function;
|
|
|
|
|
onLoad?: Function;
|
|
onLoad?: Function;
|
|
|
onAnthologySelect?: Function;
|
|
onAnthologySelect?: Function;
|
|
|
onEdit?: Function;
|
|
onEdit?: Function;
|
|
@@ -44,7 +43,7 @@ const TypeArticleReaderWidget = ({
|
|
|
active = false,
|
|
active = false,
|
|
|
hideInteractive = false,
|
|
hideInteractive = false,
|
|
|
hideTitle = false,
|
|
hideTitle = false,
|
|
|
- onFinal,
|
|
|
|
|
|
|
+ onArticleChange,
|
|
|
onLoad,
|
|
onLoad,
|
|
|
onAnthologySelect,
|
|
onAnthologySelect,
|
|
|
onEdit,
|
|
onEdit,
|
|
@@ -142,8 +141,10 @@ const TypeArticleReaderWidget = ({
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
const url = `/v2/nav-article/${articleId}_${anthologyId}`;
|
|
const url = `/v2/nav-article/${articleId}_${anthologyId}`;
|
|
|
|
|
+ console.info("api request", url);
|
|
|
get<IArticleNavResponse>(url)
|
|
get<IArticleNavResponse>(url)
|
|
|
.then((json) => {
|
|
.then((json) => {
|
|
|
|
|
+ console.debug("api response", json);
|
|
|
if (json.ok) {
|
|
if (json.ok) {
|
|
|
setNav(json.data);
|
|
setNav(json.data);
|
|
|
}
|
|
}
|
|
@@ -162,9 +163,21 @@ const TypeArticleReaderWidget = ({
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const title = articleData?.title_text
|
|
|
|
|
- ? articleData?.title_text
|
|
|
|
|
- : articleData?.title;
|
|
|
|
|
|
|
+ const title = articleData?.title_text ?? articleData?.title;
|
|
|
|
|
+
|
|
|
|
|
+ let endOfChapter = false;
|
|
|
|
|
+ if (nav?.curr && nav?.next) {
|
|
|
|
|
+ if (nav?.curr?.level > nav?.next?.level) {
|
|
|
|
|
+ endOfChapter = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let topOfChapter = false;
|
|
|
|
|
+ if (nav?.curr && nav?.prev) {
|
|
|
|
|
+ if (nav?.curr?.level > nav?.prev?.level) {
|
|
|
|
|
+ topOfChapter = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
@@ -234,6 +247,8 @@ const TypeArticleReaderWidget = ({
|
|
|
<NavigateButton
|
|
<NavigateButton
|
|
|
prevTitle={nav?.prev?.title}
|
|
prevTitle={nav?.prev?.title}
|
|
|
nextTitle={nav?.next?.title}
|
|
nextTitle={nav?.next?.title}
|
|
|
|
|
+ topOfChapter={topOfChapter}
|
|
|
|
|
+ endOfChapter={endOfChapter}
|
|
|
path={currPath}
|
|
path={currPath}
|
|
|
onNext={() => {
|
|
onNext={() => {
|
|
|
if (typeof onArticleChange !== "undefined") {
|
|
if (typeof onArticleChange !== "undefined") {
|