|
@@ -16,6 +16,7 @@ interface IWidgetQuoteLinkCtl {
|
|
|
para?: number;
|
|
para?: number;
|
|
|
term?: IWidgetTermCtl;
|
|
term?: IWidgetTermCtl;
|
|
|
title?: string;
|
|
title?: string;
|
|
|
|
|
+ chapter?: string;
|
|
|
found: boolean;
|
|
found: boolean;
|
|
|
}
|
|
}
|
|
|
const QuoteLinkCtl = ({
|
|
const QuoteLinkCtl = ({
|
|
@@ -28,12 +29,21 @@ const QuoteLinkCtl = ({
|
|
|
para,
|
|
para,
|
|
|
term,
|
|
term,
|
|
|
title,
|
|
title,
|
|
|
|
|
+ chapter,
|
|
|
found,
|
|
found,
|
|
|
}: IWidgetQuoteLinkCtl) => {
|
|
}: IWidgetQuoteLinkCtl) => {
|
|
|
- const [validPage, setValidPage] = useState(false);
|
|
|
|
|
const [tpl, setTpl] = useState<string>();
|
|
const [tpl, setTpl] = useState<string>();
|
|
|
let textShow = volume === 0 ? page : ` ${volume}.${page}`;
|
|
let textShow = volume === 0 ? page : ` ${volume}.${page}`;
|
|
|
|
|
+ if (type === "c") {
|
|
|
|
|
+ textShow = ` ${chapter}`;
|
|
|
|
|
+ }
|
|
|
console.debug("found", found);
|
|
console.debug("found", found);
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (type === "c") {
|
|
|
|
|
+ setTpl(`{{ql|type=${type}|book=${book}|para=${para}}}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [book, para, type]);
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (
|
|
if (
|
|
|
typeof type !== "undefined" &&
|
|
typeof type !== "undefined" &&
|
|
@@ -41,7 +51,6 @@ const QuoteLinkCtl = ({
|
|
|
typeof volume !== "undefined" &&
|
|
typeof volume !== "undefined" &&
|
|
|
typeof page !== "undefined"
|
|
typeof page !== "undefined"
|
|
|
) {
|
|
) {
|
|
|
- setValidPage(found);
|
|
|
|
|
setTpl(
|
|
setTpl(
|
|
|
`{{ql|type=${type}|bookname=${bookName}|volume=${volume}|page=${page}}}`
|
|
`{{ql|type=${type}|bookname=${bookName}|volume=${volume}|page=${page}}}`
|
|
|
);
|
|
);
|
|
@@ -50,8 +59,10 @@ const QuoteLinkCtl = ({
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
- {validPage ? (
|
|
|
|
|
|
|
+ {found ? (
|
|
|
<ArticleCtl
|
|
<ArticleCtl
|
|
|
|
|
+ book={book?.toString()}
|
|
|
|
|
+ paragraphs={para?.toString()}
|
|
|
title={
|
|
title={
|
|
|
title ? (
|
|
title ? (
|
|
|
title
|
|
title
|
|
@@ -62,9 +73,13 @@ const QuoteLinkCtl = ({
|
|
|
</>
|
|
</>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- type={"page"}
|
|
|
|
|
|
|
+ type={type === "c" ? "para" : "page"}
|
|
|
focus={book && para ? `${book}-${para}` : undefined}
|
|
focus={book && para ? `${book}-${para}` : undefined}
|
|
|
- id={`${type}_${bookName}_${volume}_${page}`}
|
|
|
|
|
|
|
+ id={
|
|
|
|
|
+ type === "c"
|
|
|
|
|
+ ? `${book}-${para}`
|
|
|
|
|
+ : `${type}_${bookName}_${volume}_${page}`
|
|
|
|
|
+ }
|
|
|
style={style}
|
|
style={style}
|
|
|
modalExtra={
|
|
modalExtra={
|
|
|
<Text style={{ marginRight: 8 }} copyable={{ text: tpl }}>
|
|
<Text style={{ marginRight: 8 }} copyable={{ text: tpl }}>
|