diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-09-18 11:29:52 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-09-19 10:08:59 -0400 |
commit | 208bf914b8a5efb3f4474361e4d247826b25788c (patch) | |
tree | 1ab3869c8cd0469287c62b70050f41d990a171f8 /web/react/utils/text_formatting.jsx | |
parent | 06f8b8bfb4bd6f70a2e68964052ec20adfc82f51 (diff) | |
download | chat-208bf914b8a5efb3f4474361e4d247826b25788c.tar.gz chat-208bf914b8a5efb3f4474361e4d247826b25788c.tar.bz2 chat-208bf914b8a5efb3f4474361e4d247826b25788c.zip |
Removed unnecessary conversion of newlines to html line breaks
Diffstat (limited to 'web/react/utils/text_formatting.jsx')
-rw-r--r-- | web/react/utils/text_formatting.jsx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index 54d010dbf..5bf3ca52c 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -33,7 +33,9 @@ export function formatText(text, options = {}) { output = replaceTokens(output, tokens); // replace newlines with html line breaks - output = replaceNewlines(output, options.singleline); + if (options.singleline) { + output = replaceNewlines(output); + } return output; } @@ -246,11 +248,7 @@ function replaceTokens(text, tokens) { return output; } -function replaceNewlines(text, singleline) { - if (!singleline) { - return text.replace(/\n/g, '<br />'); - } - +function replaceNewlines(text) { return text.replace(/\n/g, ' '); } |