From 56724980f80cd613789f77a0eae9da4779308965 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 31 Jul 2015 10:02:21 -0400 Subject: Revert "MM-1706 Changed mention highlighting code to split words on all non-word characters" --- web/react/utils/utils.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'web/react') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index e51f7f3f4..09240bf06 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -416,7 +416,7 @@ module.exports.textToJsx = function(text, options) { var lines = text.split("\n"); for (var i = 0; i < lines.length; i++) { var line = lines[i]; - var words = line.split(/(?=\W)/); + var words = line.split(" "); var highlightSearchClass = ""; for (var z = 0; z < words.length; z++) { var word = words[z]; @@ -444,7 +444,7 @@ module.exports.textToJsx = function(text, options) { highlightSearchClass = " search-highlight"; } - inner.push({prefix}@{name}{suffix}); + inner.push({prefix}@{name}{suffix} ); } else if (testUrlMatch(word).length) { var match = testUrlMatch(word)[0]; var link = match.link; @@ -452,7 +452,7 @@ module.exports.textToJsx = function(text, options) { var prefix = word.substring(0,word.indexOf(match.text)); var suffix = word.substring(word.indexOf(match.text)+match.text.length); - inner.push({prefix}{match.text}{suffix}); + inner.push({prefix}{match.text}{suffix} ); } else if (trimWord.match(hashRegex)) { var suffix = word.match(puncEndRegex); @@ -463,7 +463,7 @@ module.exports.textToJsx = function(text, options) { highlightSearchClass = " search-highlight"; } - inner.push({prefix}{trimWord}{suffix}); + inner.push({prefix}{trimWord}{suffix} ); } else if (implicitKeywords.indexOf(trimWord) !== -1 || implicitKeywords.indexOf(trimWord.toLowerCase()) !== -1) { var suffix = word.match(puncEndRegex); @@ -473,15 +473,15 @@ module.exports.textToJsx = function(text, options) { if (searchTerm === trimWord.substring(1).toLowerCase()) { highlightSearchClass = " search-highlight"; } - inner.push({prefix}{trimWord}{suffix}); + inner.push({prefix}{trimWord}{suffix} ); } else { - inner.push({prefix}{module.exports.replaceHtmlEntities(trimWord)}{suffix}); + inner.push({prefix}{module.exports.replaceHtmlEntities(trimWord)}{suffix} ); } } else if (word === "") { // if word is empty dont include a span } else { - inner.push({module.exports.replaceHtmlEntities(word)}); + inner.push({module.exports.replaceHtmlEntities(word)} ); } highlightSearchClass = ""; } -- cgit v1.2.3-1-g7c22