diff --git a/static/js/TextRange.jsx b/static/js/TextRange.jsx index 825b78cac5..85ab4f83ce 100644 --- a/static/js/TextRange.jsx +++ b/static/js/TextRange.jsx @@ -319,8 +319,12 @@ class TextRange extends Component { ); } } - segment.he = strip_vowels_re ? segment.he.replace(strip_vowels_re, "") : segment.he; - segment.he = strip_punctuation_re ? segment.he.replace(strip_punctuation_re, "") : segment.he; + for (const pattern of [strip_vowels_re, strip_punctuation_re]) { + if (pattern) { + segment.he = segment.he.replace(pattern, ""); + segment.en = segment.en?.replace(pattern, ""); + } + } return (