Skip to content

Commit

Permalink
version bump to 1.4.0-beta.1 - added api to clear search
Browse files Browse the repository at this point in the history
  • Loading branch information
aferditamuriqi committed Nov 19, 2020
1 parent 683c4aa commit 4c050d0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 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": "1.4.0-alpha.8",
"version": "1.4.0-beta.1",
"description": "A viewer application for EPUB files.",
"repository": "https://github.com/d-i-t-a/R2D2BC",
"license": "Apache-2.0",
Expand Down
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ export async function goToSearchID(href, index, current) {
await SearchModuleInstance.goToSearchID(href, index, current)
}
}
export async function clearSearch() {
if (oc(R2Navigator.rights).enableSearch(false)) {
if (IS_DEV) { console.log("clearSearch") }
await SearchModuleInstance.clearSearch()
}
}

export function currentResource() {
if (IS_DEV) { console.log("currentResource") }
Expand Down Expand Up @@ -489,4 +495,7 @@ exports.goToSearchIndex = function (href, index, current) {
}
exports.goToSearchID = function (href, index, current) {
goToSearchID(href, index, current)
}
exports.clearSearch = function () {
clearSearch()
}
6 changes: 5 additions & 1 deletion src/modules/search/SearchModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ export default class SearchModule implements ReaderModule {
}
clearSearch() {
this.currentChapterSearchResult = [];
this.currentHighlights = []
this.currentHighlights = [];
this.highlighter.destroyAllhighlights(this.delegate.iframe.contentDocument)
if(oc(this.delegate.rights).enableAnnotations(false)){
this.delegate.annotationModule.drawHighlights()
}
}
async search(term: any, current: boolean): Promise<any> {
this.currentChapterSearchResult = [];
Expand Down
1 change: 1 addition & 0 deletions viewer/index_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<button onclick="javascript:D2Reader.goToSearchID('OEBPS/Text/intro.xhtml', 11, false)">go to uuid 11 in chapter OEBPS/Text/intro.xhtml</button><br>
<button onclick="javascript:D2Reader.goToSearchID('OEBPS/Text/intro.xhtml', 2, false)">go to uuid 2 in chapter OEBPS/Text/intro.xhtml</button><br>
<button onclick="javascript:D2Reader.goToSearchID('OEBPS/Text/intro.xhtml', 3, false)">go to uuid 3 in chapter OEBPS/Text/intro.xhtml</button><br>
<button onclick="javascript:D2Reader.clearSearch()">clear search</button><br>

<button onclick="javascript:D2Reader.startReadAloud()">read aloud from top</button><br>
<button onclick="javascript:D2Reader.stopReadAloud()">stop read aloud from top</button><br>
Expand Down

0 comments on commit 4c050d0

Please sign in to comment.