Skip to content

Commit 0d4a92a

Browse files
authored
Add optional highlight function when initializing TTS (johnfactotum#82)
1 parent b26cde2 commit 0d4a92a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

view.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,12 @@ export class View extends HTMLElement {
577577
for (const item of list) this.deleteAnnotation(item)
578578
this.#searchResults.clear()
579579
}
580-
async initTTS(granularity = 'word') {
580+
async initTTS(granularity = 'word', highlight) {
581581
const doc = this.renderer.getContents()[0].doc
582582
if (this.tts && this.tts.doc === doc) return
583583
const { TTS } = await import('./tts.js')
584-
this.tts = new TTS(doc, textWalker, range =>
585-
this.renderer.scrollToAnchor(range, true), granularity)
584+
this.tts = new TTS(doc, textWalker, highlight || (range =>
585+
this.renderer.scrollToAnchor(range, true)), granularity)
586586
}
587587
startMediaOverlay() {
588588
const { index } = this.renderer.getContents()[0]

0 commit comments

Comments
 (0)