@d-i-t-a/reader 2.0.0-beta.19 → 2.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +15 -11
- package/dist/esm/index.js.map +2 -2
- package/dist/injectables/style/style.css +0 -1
- package/dist/reader.css +1 -0
- package/dist/reader.js +15 -15
- package/dist/reader.js.map +2 -2
- package/dist/reader.map.css +1 -1
- package/dist/types/modules/TTS/TTSModule.d.ts +1 -1
- package/dist/types/utils/EventHandler.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -46697,7 +46697,7 @@ var EventHandler = class {
|
|
|
46697
46697
|
this.linkInPublication = (readingOrder, clickedHref) => readingOrder.some((link) => {
|
|
46698
46698
|
return !link.Rel?.includes("external") && this.navigator.publication.getRelativeHref(clickedHref).includes(link.Href);
|
|
46699
46699
|
});
|
|
46700
|
-
this.
|
|
46700
|
+
this.isReadingOrderInternal = (clickedLink) => {
|
|
46701
46701
|
if (IS_DEV)
|
|
46702
46702
|
console.log("clickedLink: ", clickedLink);
|
|
46703
46703
|
const isEpubInternal = this.linkInPublication(this.navigator.publication.readingOrder, clickedLink.href);
|
|
@@ -46715,7 +46715,7 @@ var EventHandler = class {
|
|
|
46715
46715
|
const link = this.checkForLink(event);
|
|
46716
46716
|
if (link) {
|
|
46717
46717
|
const isSameOrigin = window.location.protocol === link.protocol && window.location.port === link.port && window.location.hostname === link.hostname;
|
|
46718
|
-
const isEpubInternal = this.
|
|
46718
|
+
const isEpubInternal = this.isReadingOrderInternal(link);
|
|
46719
46719
|
const isResourceInternal = this.isResourceInternal(link);
|
|
46720
46720
|
if (!isResourceInternal) {
|
|
46721
46721
|
await this.popup.hidePopover();
|
|
@@ -46733,7 +46733,7 @@ var EventHandler = class {
|
|
|
46733
46733
|
const attribute = link2.getAttribute("epub:type") === "noteref";
|
|
46734
46734
|
if (attribute) {
|
|
46735
46735
|
await this.popup.handleFootnote(link2, event);
|
|
46736
|
-
} else if (isResourceInternal) {
|
|
46736
|
+
} else if (isResourceInternal && !isEpubInternal) {
|
|
46737
46737
|
await this.popup.showPopover(link2, event);
|
|
46738
46738
|
} else {
|
|
46739
46739
|
this.onInternalLink(event);
|
|
@@ -49267,7 +49267,7 @@ var _blacklistIdClassForCssSelectors = [
|
|
|
49267
49267
|
];
|
|
49268
49268
|
var lastMouseDownX = -1;
|
|
49269
49269
|
var lastMouseDownY = -1;
|
|
49270
|
-
var
|
|
49270
|
+
var bodyEventListeners = [];
|
|
49271
49271
|
var TextHighlighter = class {
|
|
49272
49272
|
constructor(delegate, layerSettings, properties, hasEventListener, options, api) {
|
|
49273
49273
|
this.lastSelectedHighlight = void 0;
|
|
@@ -49332,7 +49332,7 @@ var TextHighlighter = class {
|
|
|
49332
49332
|
this.initializeToolbox();
|
|
49333
49333
|
lastMouseDownX = -1;
|
|
49334
49334
|
lastMouseDownY = -1;
|
|
49335
|
-
|
|
49335
|
+
bodyEventListeners = [];
|
|
49336
49336
|
let self2 = this;
|
|
49337
49337
|
async function unselect() {
|
|
49338
49338
|
if (self2.lastSelectedHighlight === void 0) {
|
|
@@ -50774,6 +50774,7 @@ var TextHighlighter = class {
|
|
|
50774
50774
|
popup.showPopup(foundElement.dataset.definition, ev);
|
|
50775
50775
|
}
|
|
50776
50776
|
let result = this.delegate.definitionsModule?.properties?.definitions?.filter((el) => el.order === Number(foundElement?.dataset.order))[0];
|
|
50777
|
+
console.log(result);
|
|
50777
50778
|
if (this.delegate.definitionsModule?.api?.click) {
|
|
50778
50779
|
this.delegate.definitionsModule.api?.click(lodash.omit(result, "callbacks"), lodash.omit(foundHighlight, "definition"));
|
|
50779
50780
|
this.delegate.emit("definition.click", result, foundHighlight);
|
|
@@ -50791,8 +50792,8 @@ var TextHighlighter = class {
|
|
|
50791
50792
|
const doc = win.document;
|
|
50792
50793
|
let self2 = this;
|
|
50793
50794
|
if (!doc.getElementById(id2)) {
|
|
50794
|
-
if (!
|
|
50795
|
-
|
|
50795
|
+
if (!bodyEventListeners[id2]) {
|
|
50796
|
+
bodyEventListeners[id2] = true;
|
|
50796
50797
|
async function mousedown(ev) {
|
|
50797
50798
|
lastMouseDownX = ev.clientX;
|
|
50798
50799
|
lastMouseDownY = ev.clientY;
|
|
@@ -58443,9 +58444,12 @@ var TTSModule = class {
|
|
|
58443
58444
|
}
|
|
58444
58445
|
});
|
|
58445
58446
|
}
|
|
58446
|
-
cancel() {
|
|
58447
|
-
if (
|
|
58448
|
-
this.api?.stopped
|
|
58447
|
+
cancel(api = true) {
|
|
58448
|
+
if (api) {
|
|
58449
|
+
if (this.api?.stopped)
|
|
58450
|
+
this.api?.stopped();
|
|
58451
|
+
this.delegate.emit("readaloud.stopped", "stopped");
|
|
58452
|
+
}
|
|
58449
58453
|
this.userScrolled = false;
|
|
58450
58454
|
window.speechSynthesis.cancel();
|
|
58451
58455
|
if (this.splittingResult && this.delegate.tts?.enableSplitter) {
|
|
@@ -58474,7 +58478,7 @@ var TTSModule = class {
|
|
|
58474
58478
|
this.api?.started();
|
|
58475
58479
|
var self2 = this;
|
|
58476
58480
|
this.userScrolled = false;
|
|
58477
|
-
this.cancel();
|
|
58481
|
+
this.cancel(false);
|
|
58478
58482
|
if (this.delegate.tts?.enableSplitter) {
|
|
58479
58483
|
if (partial) {
|
|
58480
58484
|
var allWords = self2.body.querySelectorAll("[data-word]");
|