react-text-to-speech
Advanced tools
Comparing version 0.19.1 to 0.19.2
export declare const desktopChunkSize = 1000; | ||
export declare const minChunkSize = 50; | ||
export declare const mobileChunkSize = 250; | ||
export declare const specialSymbol = "\u200E"; | ||
export declare const specialSymbol = "\u00A0"; | ||
export declare const symbolMapping: { | ||
@@ -6,0 +6,0 @@ "<": string; |
export const desktopChunkSize = 1000; | ||
export const minChunkSize = 50; | ||
export const mobileChunkSize = 250; | ||
export const specialSymbol = "\u200E"; | ||
export const specialSymbol = "\u00A0"; | ||
export const symbolMapping = { "<": "lessthan", ">": "greaterthan" }; | ||
@@ -6,0 +6,0 @@ const utteranceProperties = ["lang", "voice", "volume", "rate", "pitch"]; |
@@ -95,3 +95,3 @@ import React, { cloneElement, isValidElement, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; | ||
setSpeakingWord(null); | ||
else if (utterance.text[charIndex] === specialSymbol) { | ||
else if (utterance.text[charIndex + charLength] === specialSymbol) { | ||
setSpeakingWord({ index: findCharIndex(words, offset + charIndex - 1), length: 1 }); | ||
@@ -98,0 +98,0 @@ offset -= charLength + 1; |
@@ -85,2 +85,2 @@ import { isValidElement } from "react"; | ||
} | ||
export const sanitize = (text) => text.replace(/[<>]|(&[^\s;]+);/g, (match, group) => (group ? group + ")" : ` ${specialSymbol}${symbolMapping[match]} `)); | ||
export const sanitize = (text) => text.replace(/[<>]|(&[^\s;]+);/g, (match, group) => (group ? group + ")" : ` ${symbolMapping[match]}${specialSymbol}`)); |
{ | ||
"name": "react-text-to-speech", | ||
"version": "0.19.1", | ||
"version": "0.19.2", | ||
"description": "An easy-to-use React.js component that leverages the Web Speech API to convert text to speech.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
30984