Skip to content

Commit

Permalink
Merge pull request #118 from d-i-t-a/develop
Browse files Browse the repository at this point in the history
V1.6.4
  • Loading branch information
aferditamuriqi authored Jan 13, 2021
2 parents 753d447 + dfb8037 commit 3c24b18
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 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.6.3",
"version": "1.6.4",
"description": "A viewer application for EPUB files.",
"repository": "https://github.com/d-i-t-a/R2D2BC",
"license": "Apache-2.0",
Expand Down
16 changes: 12 additions & 4 deletions src/modules/highlight/TextHighlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,9 +849,15 @@ export default class TextHighlighter {
underlineIcon.addEventListener("click", commentEvent);
}
} else {
highlightIcon.style.setProperty('display', "none")
underlineIcon.style.setProperty('display', "none")
colorIcon.style.setProperty('display', "none")
if (highlightIcon) {
highlightIcon.style.setProperty('display', "none")
}
if (underlineIcon) {
underlineIcon.style.setProperty('display', "none")
}
if (colorIcon) {
colorIcon.style.setProperty('display', "none")
}
}
if (this.delegate.rights.enableTTS) {
if (speakIcon) {
Expand All @@ -862,7 +868,9 @@ export default class TextHighlighter {
speakIcon.addEventListener("click", speakEvent);
}
} else {
speakIcon.style.setProperty('display', "none")
if (speakIcon) {
speakIcon.style.setProperty('display', "none")
}
}

if (oc(this.config).selectionMenuItems([])) {
Expand Down
23 changes: 13 additions & 10 deletions src/navigator/IFrameNavigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import EventHandler, { addEventListenerOptional, removeEventListenerOptional } f
import * as BrowserUtilities from "../utils/BrowserUtilities";
import * as HTMLUtilities from "../utils/HTMLUtilities";
import { defaultUpLinkTemplate, simpleUpLinkTemplate, readerLoading, readerError } from "../utils/HTMLTemplates";
import { Locator, ReadingPosition, Locations } from "../model/Locator";
import { Locator, ReadingPosition, Locations, Annotation } from "../model/Locator";
import { Sidenav, Collapsible, Dropdown, Tabs } from "materialize-css";
import { UserSettingsUIConfig, UserSettings } from "../model/user-settings/UserSettings";
import BookmarkModule from "../modules/BookmarkModule";
Expand Down Expand Up @@ -885,17 +885,13 @@ export default class IFrameNavigator implements Navigator {
this.reflowable.goToPosition(bookViewPosition);
}, 200);

let currentLocation = this.currentChapterLink.href
setTimeout(() => {
if (this.newElementId) {
const element = (this.iframe.contentDocument as any).getElementById(this.newElementId);
this.reflowable.goToElement(element);
this.newElementId = null;
}
}, 100);

let currentLocation = this.currentChapterLink.href

setTimeout(() => {
this.updatePositionInfo();
}, 200);

Expand Down Expand Up @@ -1623,6 +1619,9 @@ export default class IFrameNavigator implements Navigator {
if (this.chapterPosition) this.chapterPosition.innerHTML = "";
if (this.remainingPositions) this.remainingPositions.innerHTML = "";
}
if (this.annotator) {
this.saveCurrentReadingPosition();
}
}

private handlePreviousChapterClick(event: MouseEvent): void {
Expand Down Expand Up @@ -1720,11 +1719,12 @@ export default class IFrameNavigator implements Navigator {
console.log("is currently loaded")
console.log(locator.href)
console.log(this.currentChapterLink.href)
const elementId = locator.href.slice(locator.href.indexOf("#") + 1);
locator.locations = {
fragment: elementId
if (locator.href.indexOf("#") !== -1) {
const elementId = locator.href.slice(locator.href.indexOf("#") + 1);
locator.locations = {
fragment: elementId
}
}

this.newPosition = locator;
this.currentTOCRawLink = locator.href
if (locator.locations.fragment === undefined) {
Expand All @@ -1738,6 +1738,9 @@ export default class IFrameNavigator implements Navigator {
const element = (this.iframe.contentDocument as any).getElementById(this.newElementId);
this.reflowable.goToElement(element);
this.newElementId = null;
} else {
this.reflowable.goToCssSelector((locator as Annotation).highlight.selectionInfo.rangeInfo.startContainerElementCssSelector)
this.updatePositionInfo()
}

let currentLocation = this.currentChapterLink.href
Expand Down

0 comments on commit 3c24b18

Please sign in to comment.