diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-01-03 16:59:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-03 16:59:08 +0100 |
commit | 62d71158a9ee8b17a61c852da952f5c757e0d17c (patch) | |
tree | 77fc23b34f35f1f0c8fe5d17d1045f4f3efffb3f /apps | |
parent | 722097f7a0ddd97b7d931be4bc304f39ba9244cc (diff) | |
parent | b4a473869ec26f35bd679f34306ccf0d1cbb702d (diff) | |
download | nextcloud-server-62d71158a9ee8b17a61c852da952f5c757e0d17c.tar.gz nextcloud-server-62d71158a9ee8b17a61c852da952f5c757e0d17c.zip |
Merge pull request #7680 from nextcloud/fix-7609
format links in comments
Diffstat (limited to 'apps')
-rw-r--r-- | apps/comments/js/commentstabview.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index bd89c8bbb49..0ad49163508 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -422,7 +422,7 @@ * Convert a message to be displayed in HTML, * converts newlines to <br> tags. */ - _formatMessage: function(message, mentions) { + _formatMessage: function(message, mentions, editMode) { message = escapeHTML(message).replace(/\n/g, '<br/>'); for(var i in mentions) { @@ -445,6 +445,9 @@ } ); } + if(editMode !== true) { + message = OCP.Comments.plainToRich(message); + } return message; }, @@ -495,7 +498,7 @@ var $message = $formRow.find('.message'); $message - .html(this._formatMessage(commentToEdit.get('message'), commentToEdit.get('mentions'))) + .html(this._formatMessage(commentToEdit.get('message'), commentToEdit.get('mentions'), true)) .find('.avatar') .each(function () { $(this).avatar(); }); var editionMode = true; @@ -620,13 +623,14 @@ $inserted.html('@' + $this.find('.avatar').data('username')); }); + $comment.html(OCP.Comments.richToPlain($comment.html())); + var oldHtml; var html = $comment.html(); do { // replace works one by one oldHtml = html; html = oldHtml.replace("<br>", "\n"); // preserve line breaks - console.warn(html) } while(oldHtml !== html); $comment.html(html); |