Make idx string type

This commit is contained in:
Hongbo Wu 2022-09-08 11:33:29 +08:00
parent 3d11e9df8e
commit 6350a3d53e
2 changed files with 4 additions and 4 deletions

View file

@ -12,7 +12,7 @@ declare module '@omnivore/text-to-speech-handler' {
}
interface Utterance {
idx: number
idx: string
wordOffset: number
wordCount: number
voice?: string

View file

@ -7,7 +7,7 @@ import { htmlToText } from 'html-to-text'
// frontend code in: useReadingProgressAnchor
export interface Utterance {
idx: number
idx: string
text: string
wordOffset: number
wordCount: number
@ -248,7 +248,7 @@ export const htmlToSsmlItems = (
const htmlToUtterance = (
tokenizer: WordPunctTokenizer,
idx: number,
idx: string,
htmlItems: string[],
wordOffset: number,
voice?: string
@ -289,7 +289,7 @@ export const htmlToSpeechFile = (
const node = parsedNodes[i - 2]
if (TOP_LEVEL_TAGS.includes(node.nodeName) || hasSignificantText(node)) {
const idx = i
const idx = i.toString()
i = emitElement(textItems, node, true)
const utterance = htmlToUtterance(
tokenizer,