Former-commit-id: 885dd2b4f72c3a667c5d4fc949ec738f70aa9fac
This commit is contained in:
troyeguo
2023-09-23 13:15:12 +08:00
parent d8c2b72e8b
commit 373501b478
4 changed files with 15 additions and 7 deletions

View File

@@ -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 (

View File

@@ -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 (
@@ -139,7 +142,7 @@ class PopupOption extends React.Component<PopupOptionProps> {
);
}
});
console.log(highlightersByChapter);
renderHighlighters(
highlightersByChapter,
this.props.currentBook.format,

View File

@@ -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 {

View File

@@ -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 {