diff --git a/app/views/request_for_comments/show.html.slim b/app/views/request_for_comments/show.html.slim index 0afd1055..18d632b5 100644 --- a/app/views/request_for_comments/show.html.slim +++ b/app/views/request_for_comments/show.html.slim @@ -168,6 +168,11 @@ javascript: return commentText.replace(/\n/g, '
'); } + function replaceNewlineTags(commentText) { + // display original line breaks as \n: + return commentText.replace(/
/g, '\n'); + } + function generateCommentHtmlContent(comments) { var htmlContent = ''; comments.forEach(function(comment, index) { @@ -182,14 +187,14 @@ javascript:
' + comment.date + '
\
\ \ - #{{ t('request_for_comments.comment_edited') }} \ + #{{ t(';request_for_comments.comment_edited;') }} \
\ \
' + commentText + '
\ \
\ - \ - \ + \ + \
\ '; }); @@ -202,7 +207,7 @@ javascript: var htmlContent = generateCommentHtmlContent(comments.reverse().slice(0, maxComments)); if (comments.length > maxComments) { // add a hint that there are more comments than shown here - htmlContent += '' + htmlContent += '' .replace('${numComments}', String(comments.length - maxComments)); } where.popover({ @@ -391,7 +396,7 @@ javascript: var commentId = parent.data('comment-id'); deleteComment(commentId, editor, fileid, function () { - parent.html('
#{ t('comments.deleted') }
'); + parent.html('
#{ t(';comments.deleted;') }
';) }); }); @@ -411,7 +416,7 @@ javascript: updateComment(commentId, commentEditor.val(), editor, fileid, function () { button.text("#{ t('shared.edit') }"); button.data('editing', false); - commentContent.text(commentEditor.val()); + commentContent.html(preprocess(commentEditor.val())); deleteButton.show(); commentContent.show(); commentEditor.hide(); @@ -422,6 +427,7 @@ javascript: button.data('editing', true); deleteButton.hide(); commentContent.hide(); + commentEditor.val(replaceNewlineTags(commentEditor.val())); commentEditor.show(); } });