Skip to content

Commit

Permalink
fixed white space between tags in splitter
Browse files Browse the repository at this point in the history
  • Loading branch information
aferditamuriqi committed Sep 20, 2020
1 parent ef02260 commit e435739
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/modules/TTS/splitting.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,17 @@ function splitText(el, key, splitOn, includePrevious, preserveWhitespace) {
// Get the text to split, trimming out the whitespace
/** @type {string} */
var wholeText = next.wholeText || '';
var contents = wholeText.trim();
var contentsTrimmed = wholeText.trim();
// var contents = wholeText;

// If there's no text left after trimming whitespace, continue the loop
if (contents.length) {
if (contentsTrimmed.length) {
// insert leading space if there was one
if (wholeText[0] === ' ') {
allElements.push(createText(' '));
}
// Concatenate the split text children back into the full array
each(contents.split(splitOn), function(splitText, i) {
each(contentsTrimmed.split(splitOn), function(splitText, i) {
if (i && preserveWhitespace) {
allElements.push(createElement(F, "whitespace", " ", preserveWhitespace));
}
Expand All @@ -252,6 +252,8 @@ function splitText(el, key, splitOn, includePrevious, preserveWhitespace) {
if (wholeText[wholeText.length - 1] === ' ') {
allElements.push(createText(' '));
}
} else {
allElements.push(createElement(F, "whitespace", " ", preserveWhitespace));
}
});

Expand Down

0 comments on commit e435739

Please sign in to comment.