Disabling space replacer for now - a performance nightmare with (probably) small benefit

This commit is contained in:
Sebastian Wolf 2020-11-15 10:05:27 +01:00
parent 6666cf494a
commit 6f9a0a672a

View file

@ -298,15 +298,15 @@ function enhanceMessageText(formattedText) {
messageText = messageText.replace(new RegExp("\r?\n", "g"), "<br>");
var spaceRegex = /\s{2,}/g;
function spaceReplacer(match, p1, offset, string) {
var replaceString = "";
for (var i = 0; i < match.length; i++) {
replaceString += "&nbsp;";
}
return replaceString;
}
messageText = messageText.replace(spaceRegex, spaceReplacer);
// var spaceRegex = /\s{2,}/g;
// function spaceReplacer(match, p1, offset, string) {
// var replaceString = "";
// for (var i = 0; i < match.length; i++) {
// replaceString += "&nbsp;";
// }
// return replaceString;
// }
// messageText = messageText.replace(spaceRegex, spaceReplacer);
return messageText;