feat: add options to customize the style of highlighted text of current sentence of TTS (#2358)

This commit is contained in:
Huang Xin
2025-10-29 17:17:36 +08:00
committed by GitHub
parent c7ba44a91e
commit 1d87dcdb7f
41 changed files with 887 additions and 301 deletions
@@ -323,7 +323,7 @@ const TTSControl: React.FC<TTSControlProps> = ({ bookKey, gridInsets }) => {
setShowIndicator(true);
const ttsController = new TTSController(appService, view);
await ttsController.init();
await ttsController.initViewTTS();
await ttsController.initViewTTS(viewSettings.ttsHighlightOptions);
const ssml = view.tts?.from(ttsFromRange);
if (ssml) {
const lang = parseSSMLLang(ssml, primaryLang) || 'en';
@@ -625,6 +625,13 @@ const TTSControl: React.FC<TTSControlProps> = ({ bookKey, gridInsets }) => {
};
}, [hoveredBookKey]);
useEffect(() => {
const ttsHighlightOptions = viewSettings?.ttsHighlightOptions;
if (ttsControllerRef.current && ttsHighlightOptions) {
ttsControllerRef.current.initViewTTS(ttsHighlightOptions);
}
}, [viewSettings?.ttsHighlightOptions]);
return (
<>
{showPanel && <Overlay onDismiss={handleDismissPopup} />}