summaryrefslogtreecommitdiffstats
path: root/apps/comments/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-01-02 11:20:15 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-01-03 13:11:20 +0100
commit282567fcedf34d2b7043f90cd5b7ce18d4753720 (patch)
tree210d8c24fd4b691913ea2de8e24a2e536f5c5fbe /apps/comments/js
parent02b092f35830b916c4fc61413600f5ca86d1630a (diff)
downloadnextcloud-server-282567fcedf34d2b7043f90cd5b7ce18d4753720.tar.gz
nextcloud-server-282567fcedf34d2b7043f90cd5b7ce18d4753720.zip
format links in comments
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/comments/js')
-rw-r--r--apps/comments/js/commentstabview.js10
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);