Skip to content

Commit 4dbf77f

Browse files
committed
MOBILE-1987 text: Replace new lines only if no HTML
1 parent 56fef02 commit 4dbf77f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

www/core/lib/text.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,18 @@ angular.module('mm.core')
151151
* @return {String} Formatted text.
152152
*/
153153
self.formatHtmlLines = function(text) {
154+
var hasHTMLTags = self.hasHTMLTags(text);
154155
if (text.indexOf('<p>') == -1) {
155156
// Wrap the text in <p> tags.
156157
text = '<p>' + text + '</p>';
157158
}
158-
return self.replaceNewLines(text, '<br>');
159+
160+
if (!hasHTMLTags) {
161+
// The text doesn't have HTML, replace new lines for <br>.
162+
return self.replaceNewLines(text, '<br>');
163+
}
164+
165+
return text;
159166
};
160167

161168
/**

0 commit comments

Comments
 (0)