Fix voice playback: stale service worker code, button visibility, autoplay priming

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-16 12:37:46 +02:00
parent 7050cb1ac6
commit bb6bd8bc78
10 changed files with 156 additions and 67 deletions
+19 -2
View File
@@ -54,12 +54,29 @@ export class NotebookView {
if (image) {
children.push(el('img', { src: image, alt: '' }));
}
if (voice && this.#onSpeak && this.#canSpeak()) {
children.push(el('button', { type: 'button', class: 'btn', text: this.#i18n.t('voice.listen'), onclick: () => this.#onSpeak(text, step) }));
if (voice && this.#onSpeak) {
// Toujours rendu, affiché ou non selon le réglage (voir refreshVoiceButtons).
children.push(
el('button', {
type: 'button',
class: 'btn voice-button',
hidden: !this.#canSpeak(),
text: this.#i18n.t('voice.listen'),
onclick: () => this.#onSpeak(text, step),
}),
);
}
return this.add(el('section', { class: 'explain', tabindex: '-1' }, ...children));
}
/** Réaffiche ou masque les boutons « Écouter » existants (réglage de la voix modifié). */
refreshVoiceButtons() {
const visible = this.#canSpeak();
for (const button of this.#root.querySelectorAll('.voice-button')) {
button.hidden = !visible;
}
}
/** Bouton « Continuer » ou équivalent ; retiré du DOM une fois cliqué. */
addAction(label, onClick) {
const button = el('button', {