@d-i-t-a/reader 2.1.0-beta.1 → 2.1.0-beta.2
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 +13 -13
- package/dist/esm/index.js.map +2 -2
- package/dist/reader.js +22 -22
- package/dist/reader.js.map +2 -2
- package/dist/types/modules/highlight/TextHighlighter.d.ts +4 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -37421,6 +37421,12 @@ var TextHighlighter = class {
|
|
|
37421
37421
|
constructor(delegate, layerSettings, properties, hasEventListener, options, api) {
|
|
37422
37422
|
this.lastSelectedHighlight = void 0;
|
|
37423
37423
|
this.activeAnnotationMarkerId = void 0;
|
|
37424
|
+
this.showTool = (0, import_debounce2.debounce)((b) => {
|
|
37425
|
+
if (!this.isAndroid()) {
|
|
37426
|
+
this.snapSelectionToWord(b);
|
|
37427
|
+
}
|
|
37428
|
+
this.toolboxShow();
|
|
37429
|
+
}, navigator.userAgent.toLowerCase().indexOf("firefox") > -1 ? 200 : 100);
|
|
37424
37430
|
this.isSelectionMenuOpen = false;
|
|
37425
37431
|
this.selectionMenuOpened = (0, import_debounce2.debounce)(() => {
|
|
37426
37432
|
if (!this.isSelectionMenuOpen) {
|
|
@@ -37907,14 +37913,8 @@ var TextHighlighter = class {
|
|
|
37907
37913
|
toolbox.style.display = "none";
|
|
37908
37914
|
this.selectionMenuClosed();
|
|
37909
37915
|
}
|
|
37910
|
-
toolboxShowDelayed(
|
|
37911
|
-
|
|
37912
|
-
setTimeout(function() {
|
|
37913
|
-
if (!self2.isAndroid()) {
|
|
37914
|
-
self2.snapSelectionToWord(ev.detail === 1);
|
|
37915
|
-
}
|
|
37916
|
-
self2.toolboxShow();
|
|
37917
|
-
}, 100);
|
|
37916
|
+
toolboxShowDelayed(event) {
|
|
37917
|
+
this.showTool(event.detail === 1);
|
|
37918
37918
|
}
|
|
37919
37919
|
snapSelectionToWord(trimmed = false) {
|
|
37920
37920
|
let self2 = this;
|
|
@@ -46426,7 +46426,7 @@ var TTSModule2 = class {
|
|
|
46426
46426
|
var restOfTheText;
|
|
46427
46427
|
if (ttsQueueItem && selectionInfo && selectionInfo.cleanText) {
|
|
46428
46428
|
const sentence = getTtsQueueItemRefText(ttsQueueItem);
|
|
46429
|
-
let startIndex =
|
|
46429
|
+
let startIndex = selectionInfo.rangeInfo.startOffset;
|
|
46430
46430
|
let textToBeSpoken = selectionInfo.cleanText;
|
|
46431
46431
|
if (ttsQueueItemEnd && idx + 1 === idxEnd) {
|
|
46432
46432
|
const sentenceEnd = getTtsQueueItemRefText(ttsQueueItemEnd);
|
|
@@ -46434,20 +46434,20 @@ var TTSModule2 = class {
|
|
|
46434
46434
|
textToBeSpoken = sentence.slice(startIndex, sentence.length);
|
|
46435
46435
|
restOfTheText = selectionInfo.cleanText.replace(textToBeSpoken, "").trim();
|
|
46436
46436
|
} else if (idxEnd > idx) {
|
|
46437
|
-
let
|
|
46437
|
+
let mergedSentences = "";
|
|
46438
46438
|
for (let i = idx + 1; i < idxEnd; i++) {
|
|
46439
46439
|
const ttsQueueItemInBetween = getTtsQueueItemRef(ttsQueue, i);
|
|
46440
46440
|
if (ttsQueueItemInBetween) {
|
|
46441
46441
|
const sentenceInBetween = getTtsQueueItemRefText(ttsQueueItemInBetween);
|
|
46442
|
-
|
|
46442
|
+
mergedSentences += sentenceInBetween;
|
|
46443
46443
|
restOfTheText = selectionInfo.cleanText.replace(sentenceInBetween, "");
|
|
46444
46444
|
}
|
|
46445
46445
|
}
|
|
46446
46446
|
if (ttsQueueItemEnd) {
|
|
46447
46447
|
const sentenceEnd = getTtsQueueItemRefText(ttsQueueItemEnd);
|
|
46448
|
-
|
|
46448
|
+
mergedSentences += " " + sentenceEnd;
|
|
46449
46449
|
}
|
|
46450
|
-
startIndex = (sentence + " " +
|
|
46450
|
+
startIndex = (sentence + " " + mergedSentences).indexOf(selectionInfo.cleanText);
|
|
46451
46451
|
textToBeSpoken = sentence.slice(startIndex, sentence.length);
|
|
46452
46452
|
restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
|
|
46453
46453
|
}
|