Skip to content

Commit

Permalink
Merge pull request #419 from d-i-t-a/develop
Browse files Browse the repository at this point in the history
2.1.7
  • Loading branch information
aferditamuriqi authored Dec 14, 2022
2 parents 72e08f9 + 6a9070d commit 49d3585
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@d-i-t-a/reader",
"version": "2.1.6",
"version": "2.1.7",
"description": "A viewer application for EPUB files.",
"repository": "https://github.com/d-i-t-a/R2D2BC",
"license": "Apache-2.0",
Expand Down
25 changes: 13 additions & 12 deletions src/modules/search/SearchModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ import {
removeEventListenerOptional,
} from "../../utils/EventHandler";
import { AnnotationMarker, Locations, Locator } from "../../model/Locator";
import { DEFAULT_BACKGROUND_COLOR } from "../highlight/TextHighlighter";
import {
DEFAULT_BACKGROUND_COLOR,
TextHighlighter,
} from "../highlight/TextHighlighter";
import { HighlightType, IHighlight } from "../highlight/common/highlight";
import { ISelectionInfo } from "../highlight/common/selection";
import { SHA256 } from "jscrypto";
import { searchDocDomSeek, reset } from "./searchWithDomSeek";
import { TextHighlighter } from "../highlight/TextHighlighter";
import { reset, searchDocDomSeek } from "./searchWithDomSeek";
import log from "loglevel";

export interface SearchModuleAPI {}
Expand Down Expand Up @@ -400,17 +402,16 @@ export class SearchModule implements ReaderModule {
this.currentChapterSearchResult = [];
this.currentSearchHighlights = [];
this.bookSearchResult = [];
reset();

this.searchAndPaintChapter(term, 0, async () => {});

var chapter = this.searchChapter(term);
var book = this.searchBook(term);
reset();
await this.searchAndPaintChapter(term, 0, async () => {});

if (current) {
return chapter;
await this.searchBook(term);
return await this.searchChapter(term);
} else {
return book;
await this.searchChapter(term);
return await this.searchBook(term);
}
}
async goToSearchID(href: string, index: number, current: boolean) {
Expand Down Expand Up @@ -718,7 +719,7 @@ export class SearchModule implements ReaderModule {
if (tocItem) {
let href = this.publication.getAbsoluteHref(tocItem.Href);
if (this.delegate.api?.getContent) {
this.delegate.api?.getContent(href).then((content) => {
await this.delegate.api?.getContent(href).then((content) => {
let parser = new DOMParser();
let doc = parser.parseFromString(
this.delegate.requestConfig?.encoded
Expand Down Expand Up @@ -793,7 +794,7 @@ export class SearchModule implements ReaderModule {
if (tocItem) {
let href = this.publication.getAbsoluteHref(tocItem.Href);
if (this.delegate.api?.getContent) {
this.delegate.api?.getContent(href).then((content) => {
await this.delegate.api?.getContent(href).then((content) => {
let parser = new DOMParser();
let doc = parser.parseFromString(
this.delegate.requestConfig?.encoded
Expand Down

0 comments on commit 49d3585

Please sign in to comment.