TTS: fix error & nodes getting skipped

Fixes #115
This commit is contained in:
John Factotum
2026-04-09 05:22:49 +08:00
parent 6e13f240f7
commit 5ba02c71c9
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ export const textWalker = function* (x, func, filterFunc) {
const walker = document.createTreeWalker(root, filter, { acceptNode: filterFunc || acceptNode })
const walk = x.commonAncestorContainer ? walkRange : walkDocument
const nodes = walk(x, walker)
const strs = nodes.map(node => node.nodeValue)
const strs = nodes.map(node => node.nodeValue ?? '')
const makeRange = (startIndex, startOffset, endIndex, endOffset) => {
const range = document.createRange()
range.setStart(nodes[startIndex], startOffset)