diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-06-18 17:39:12 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-06-18 17:39:12 -0400 |
commit | 31a265ddf5a832215d2bafb01bf84a334919c80c (patch) | |
tree | 0e2a6b6c253966bedcdb933c69eeb74bdcd63220 | |
parent | a1ae2abaf95dc1d41edeea863d2bf1ad039741ec (diff) | |
download | chat-31a265ddf5a832215d2bafb01bf84a334919c80c.tar.gz chat-31a265ddf5a832215d2bafb01bf84a334919c80c.tar.bz2 chat-31a265ddf5a832215d2bafb01bf84a334919c80c.zip |
fixes br tags causing new lines
-rw-r--r-- | web/react/components/create_post.jsx | 4 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 5 |
2 files changed, 2 insertions, 7 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index 191be9bf8..a534e495d 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -31,9 +31,7 @@ module.exports = React.createClass({ post.message = this.state.messageText; - var repRegex = new RegExp("<br>", "g"); - if (post.message.replace(repRegex, " ").trim().length === 0 - && this.state.previews.length === 0) { + if (post.message.trim().length === 0 && this.state.previews.length === 0) { return; } diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index e57088614..fb4f3a34e 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -366,9 +366,6 @@ module.exports.textToJsx = function(text, options) { if (options && options['singleline']) { var repRegex = new RegExp("\n", "g"); text = text.replace(repRegex, " "); - } else { - var repRegex = new RegExp("\n", "g"); - text = text.replace(repRegex, "<br>"); } var searchTerm = "" @@ -392,7 +389,7 @@ module.exports.textToJsx = function(text, options) { implicitKeywords[keywordArray[i]] = true; } - var lines = text.split("<br>"); + var lines = text.split("\n"); var urlMatcher = new LinkifyIt(); for (var i = 0; i < lines.length; i++) { var line = lines[i]; |