From fee5fdae93061d350fb3be7aefe251cd3fe42b63 Mon Sep 17 00:00:00 2001 From: Daniel Weck Date: Sat, 30 Nov 2024 22:06:34 +0000 Subject: [PATCH] fix(TTS, MO): disable popup foonotes so that they can be played inline as intended by content creators, see https://github.com/edrlab/thorium-reader/discussions/2679 --- src/renderer/reader/components/Reader.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/renderer/reader/components/Reader.tsx b/src/renderer/reader/components/Reader.tsx index 2c8c21dcb..1f9a86ac1 100644 --- a/src/renderer/reader/components/Reader.tsx +++ b/src/renderer/reader/components/Reader.tsx @@ -2671,7 +2671,16 @@ class Reader extends React.Component { private handleTTSPlay() { ttsClickEnable(true); - ttsPlay(parseFloat(this.props.ttsPlaybackRate), this.props.ttsVoice); + let delay = 0; + if (!this.props.readerConfig?.noFootnotes) { + delay = 100; + // console.log("TTS PLAY ==> NO_FOOTNOTES MUST BE TRUE (POPUP DISABLED), SWITCHING..."); + this.props.setConfig({ noFootnotes: true }); + // TODO: skippability should be disabled when user explicitly "requests" a skippable item, such as when clicking on a note reference hyperlink, or even on a skippable element itself(?) + } + setTimeout(() => { + ttsPlay(parseFloat(this.props.ttsPlaybackRate), this.props.ttsVoice); + }, delay); } private handleTTSPause() { ttsPause(); @@ -2710,7 +2719,16 @@ class Reader extends React.Component { private handleMediaOverlaysPlay() { mediaOverlaysClickEnable(true); - mediaOverlaysPlay(parseFloat(this.props.mediaOverlaysPlaybackRate)); + let delay = 0; + if (!this.props.readerConfig?.noFootnotes) { + delay = 100; + // console.log("MO PLAY ==> NO_FOOTNOTES MUST BE TRUE (POPUP DISABLED), SWITCHING..."); + this.props.setConfig({ noFootnotes: true }); + // TODO: skippability should be disabled when user explicitly "requests" a skippable item, such as when clicking on a note reference hyperlink, or even on a skippable element itself(?) + } + setTimeout(() => { + mediaOverlaysPlay(parseFloat(this.props.mediaOverlaysPlaybackRate)); + }, delay); } private handleMediaOverlaysPause() { mediaOverlaysPause();