Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
troyeguo committed Sep 23, 2023
1 parent 28ded12 commit 885dd2b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/components/popups/popupNote/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ class PopupNote extends React.Component<PopupNoteProps, PopupNoteState> {
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 (
Expand Down
9 changes: 6 additions & 3 deletions src/components/popups/popupOption/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,17 @@ class PopupOption extends React.Component<PopupOptionProps> {
};
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 (
Expand All @@ -139,7 +142,7 @@ class PopupOption extends React.Component<PopupOptionProps> {
);
}
});

console.log(highlightersByChapter);
renderHighlighters(
highlightersByChapter,
this.props.currentBook.format,
Expand Down
6 changes: 4 additions & 2 deletions src/containers/htmlViewer/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ class Viewer extends React.Component<ViewerProps, ViewerState> {
};
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 {
Expand Down
1 change: 1 addition & 0 deletions src/utils/serviceUtils/noteUtil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 885dd2b

Please sign in to comment.