From 6ef38d4dfe81dcdeda6dd3287587b80ad58e4c6c Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Wed, 18 Feb 2015 16:41:51 -0200 Subject: Using line breaks instead of paragraphs to format text plain mails on the mail view --- web-ui/app/js/helpers/view_helper.js | 5 ++--- web-ui/test/spec/helpers/view_helper.spec.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'web-ui') diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js index 22ab1324..9c9cacfd 100644 --- a/web-ui/app/js/helpers/view_helper.js +++ b/web-ui/app/js/helpers/view_helper.js @@ -32,7 +32,7 @@ define( } function addParagraphsToPlainText(textPlainBody) { - return textPlainBody.replace(/^(.*?)$/mg, '

$1

'); + return textPlainBody.replace(/^(.*?)$/mg, '$1
'); } function escapeHtmlTags(body) { @@ -44,7 +44,6 @@ define( '"': '"', '\'':''', '/': '/' - }; return body.replace(/["'<>\/&]/g, function(char){ @@ -62,7 +61,7 @@ define( var body = mail.htmlBodyPart ? htmlWhitelister.sanitize(mail.htmlBody, htmlWhitelister.tagPolicy) : escapeHtmlAndAddParagraphs(mail.textPlainBody); - return $(body); + return $('
' + body + '
'); } function moveCaretToEnd(el) { diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js index d84cb4ac..7b5b960b 100644 --- a/web-ui/test/spec/helpers/view_helper.spec.js +++ b/web-ui/test/spec/helpers/view_helper.spec.js @@ -56,7 +56,7 @@ define(['helpers/view_helper'], function (viewHelper) { it('each line of plain text mail gets a new paragraph', function () { var formattedMail = $('
'); formattedMail.html(viewHelper.formatMailBody(testData.parsedMail.simpleTextPlain)); - expect(formattedMail).toContainHtml('

Hello Everyone

'); + expect(formattedMail).toContainHtml('
Hello Everyone
'); }); -- cgit v1.2.3