diff --git a/src/components/popups/popupNote/component.tsx b/src/components/popups/popupNote/component.tsx index cace1d15..5599a308 100644 --- a/src/components/popups/popupNote/component.tsx +++ b/src/components/popups/popupNote/component.tsx @@ -68,10 +68,12 @@ class PopupNote extends React.Component { let highlightersByChapter = highlighters.filter((item: Note) => { if (this.props.currentBook.format !== "PDF") { return ( - item.chapter === + (item.chapter === this.props.htmlBook.rendition.getChapterDoc()[ this.props.chapterDocIndex - ].label && item.bookKey === this.props.currentBook.key + ].label || + item.chapterIndex === this.props.chapterDocIndex) && + item.bookKey === this.props.currentBook.key ); } else { return ( diff --git a/src/components/popups/popupOption/component.tsx b/src/components/popups/popupOption/component.tsx index 7cb2d83f..5f93c9c5 100644 --- a/src/components/popups/popupOption/component.tsx +++ b/src/components/popups/popupOption/component.tsx @@ -123,14 +123,17 @@ class PopupOption extends React.Component { }; handleHighlight = () => { let highlighters: any = this.props.notes; + console.log(highlighters); if (!highlighters) return; let highlightersByChapter = highlighters.filter((item: Note) => { if (this.props.currentBook.format !== "PDF") { return ( - item.chapter === + (item.chapter === this.props.htmlBook.rendition.getChapterDoc()[ this.props.chapterDocIndex - ].label && item.bookKey === this.props.currentBook.key + ].label || + item.chapterIndex === this.props.chapterDocIndex) && + item.bookKey === this.props.currentBook.key ); } else { return ( @@ -139,7 +142,7 @@ class PopupOption extends React.Component { ); } }); - + console.log(highlightersByChapter); renderHighlighters( highlightersByChapter, this.props.currentBook.format, diff --git a/src/containers/htmlViewer/component.tsx b/src/containers/htmlViewer/component.tsx index 11109d4c..1a586d94 100644 --- a/src/containers/htmlViewer/component.tsx +++ b/src/containers/htmlViewer/component.tsx @@ -82,12 +82,14 @@ class Viewer extends React.Component { }; handleHighlight = (rendition: any) => { let highlighters: any = this.props.notes; + console.log(highlighters); if (!highlighters) return; let highlightersByChapter = highlighters.filter((item: Note) => { if (this.props.currentBook.format !== "PDF") { return ( - item.chapter === - rendition.getChapterDoc()[this.state.chapterDocIndex].label && + (item.chapter === + rendition.getChapterDoc()[this.state.chapterDocIndex].label || + item.chapterIndex === this.state.chapterDocIndex) && item.bookKey === this.props.currentBook.key ); } else { diff --git a/src/utils/serviceUtils/noteUtil.tsx b/src/utils/serviceUtils/noteUtil.tsx index c2b347ca..08545a8c 100644 --- a/src/utils/serviceUtils/noteUtil.tsx +++ b/src/utils/serviceUtils/noteUtil.tsx @@ -17,6 +17,7 @@ export const renderHighlighters = async ( "line-3", ]; clearHighlight(); + console.log(notes); for (let index = 0; index < notes.length; index++) { const item = notes[index]; try {