diff --git a/www/js/channel/chatPreprocessor.js b/www/js/channel/chatPreprocessor.js index e435dd7..b434fcd 100644 --- a/www/js/channel/chatPreprocessor.js +++ b/www/js/channel/chatPreprocessor.js @@ -53,11 +53,23 @@ class chatPreprocessor{ addWhitespace(){ //for each word object in the body - this.bodyArray.forEach((wordObj, index) => { + this.bodyArray.forEach((wordObj, wordIndex) => { //if the word object hasn't been pre-processed elsewhere if(wordObj.type == "word"){ + var wordArray = []; //Add invisible whitespace in-between characters to keep it from breaking page layout - this.bodyArray[index].string = wordObj.string.split("").join("ㅤ"); + //this.bodyArray[index].string = wordObj.string.split("").join("ㅤ"); + this.bodyArray[wordIndex].string.split("").forEach((char, charIndex) => { + wordArray.push(char); + //Every eight characters + if(charIndex != 0 && charIndex % 8 == 0){ + //Push an invisible line-break character + wordArray.push("ㅤ"); + } + + }); + + this.bodyArray[wordIndex].string = wordArray.join(""); } }); }