@d-i-t-a/reader 2.1.0-beta.6 → 2.1.0-beta.7
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 +24 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/reader.js +19 -19
- package/dist/reader.js.map +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -46412,6 +46412,26 @@ var TTSModule2 = class {
|
|
|
46412
46412
|
restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
|
|
46413
46413
|
}
|
|
46414
46414
|
utterance = new SpeechSynthesisUtterance(textToBeSpoken);
|
|
46415
|
+
import_loglevel19.default.log(selectionInfo);
|
|
46416
|
+
import_loglevel19.default.log(textToBeSpoken, selectionInfo.range?.commonAncestorContainer.textContent);
|
|
46417
|
+
import_loglevel19.default.log(ttsQueueItem);
|
|
46418
|
+
import_loglevel19.default.log(ttsQueueItem.item.textNodes);
|
|
46419
|
+
import_loglevel19.default.log(startIndex);
|
|
46420
|
+
import_loglevel19.default.log(ttsQueueItem.item.combinedText);
|
|
46421
|
+
if (!ttsQueueItem.item.combinedText?.startsWith(textToBeSpoken)) {
|
|
46422
|
+
for (let i = 0; i < ttsQueueItem.item.textNodes.length; i++) {
|
|
46423
|
+
let node2 = ttsQueueItem.item.textNodes[i];
|
|
46424
|
+
if (node2 === selectionInfo.range?.commonAncestorContainer) {
|
|
46425
|
+
break;
|
|
46426
|
+
}
|
|
46427
|
+
import_loglevel19.default.log(node2.length);
|
|
46428
|
+
startIndex += node2.length;
|
|
46429
|
+
}
|
|
46430
|
+
}
|
|
46431
|
+
let node = ttsQueueItem.item.textNodes.filter((node2) => {
|
|
46432
|
+
return node2 === selectionInfo.range?.commonAncestorContainer;
|
|
46433
|
+
})[0];
|
|
46434
|
+
import_loglevel19.default.log(node);
|
|
46415
46435
|
utterance.onboundary = (ev) => {
|
|
46416
46436
|
this.updateTTSInfo(ttsQueueItem, ev.charIndex + startIndex, ev.charLength, utterance.text);
|
|
46417
46437
|
};
|
|
@@ -46921,6 +46941,7 @@ var TTSModule2 = class {
|
|
|
46921
46941
|
if (!ttsQueueItem) {
|
|
46922
46942
|
return void 0;
|
|
46923
46943
|
}
|
|
46944
|
+
import_loglevel19.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
|
|
46924
46945
|
const ttsQueueItemText = utteranceText ? utteranceText : getTtsQueueItemRefText(ttsQueueItem);
|
|
46925
46946
|
if (charIndex >= 0 && utteranceText) {
|
|
46926
46947
|
const start = utteranceText.slice(0, charIndex + 1).search(/\S+$/);
|
|
@@ -46939,6 +46960,9 @@ var TTSModule2 = class {
|
|
|
46939
46960
|
return ttsQueueItemText;
|
|
46940
46961
|
}
|
|
46941
46962
|
wrapHighlightWord(ttsQueueItemRef, utteranceText, charIndex, charLength, word, start, end) {
|
|
46963
|
+
import_loglevel19.default.log(ttsQueueItemRef);
|
|
46964
|
+
import_loglevel19.default.log(utteranceText);
|
|
46965
|
+
import_loglevel19.default.log(charIndex, charLength, word, start, end);
|
|
46942
46966
|
if (this._ttsQueueItemHighlightsWord) {
|
|
46943
46967
|
this.delegate.highlighter?.destroyHighlights(HighlightType.ReadAloud);
|
|
46944
46968
|
this._ttsQueueItemHighlightsWord = void 0;
|