diff --git a/src/components/CurrentlyReading.tsx b/src/components/CurrentlyReading.tsx index c413bbc..59a2305 100644 --- a/src/components/CurrentlyReading.tsx +++ b/src/components/CurrentlyReading.tsx @@ -16,22 +16,24 @@ export const CurrentlyReading = ({ currentSentenceIdx: number; sentences: string[]; }) => { + const [headRange, tailRange] = currentWordRange; + const currentWord = sentences.length - ? sentences[currentSentenceIdx].slice( - currentWordRange[0], - currentWordRange[1] - ) + ? sentences[currentSentenceIdx].slice(headRange, tailRange) : ""; const currentSentence = sentences.length ? sentences[currentSentenceIdx] : ""; - const sentenceHead = currentSentence.substring(0, currentWordRange[0]); + const sentenceHead = currentSentence.substring(0, headRange); const sentenceTail = currentSentence.substring( - currentWordRange[1], + tailRange, currentSentence.length ); - const currentContent = `${sentenceHead}${currentWord}${sentenceTail}`; + const currentContent = + currentSentence === currentWord + ? currentSentence + : `${sentenceHead}${currentWord}${sentenceTail}`; return (