summaryrefslogtreecommitdiffstats
path: root/apps/comments/src/commentstabview.js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-04-08 07:22:14 +0200
committernpmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>2020-04-08 06:29:38 +0000
commit05821ab2438b140315e1a64b41234c0b73c19549 (patch)
treeaf115c45ec73e7ebc49b03e270228fbcb2808a91 /apps/comments/src/commentstabview.js
parent8146e1988cc05f452d2a00befb6b538175aeffe5 (diff)
downloadnextcloud-server-05821ab2438b140315e1a64b41234c0b73c19549.tar.gz
nextcloud-server-05821ab2438b140315e1a64b41234c0b73c19549.zip
Clear comment on successful post
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/comments/src/commentstabview.js')
-rw-r--r--apps/comments/src/commentstabview.js41
1 files changed, 22 insertions, 19 deletions
diff --git a/apps/comments/src/commentstabview.js b/apps/comments/src/commentstabview.js
index e7dbc0abba7..89fc65dc7c5 100644
--- a/apps/comments/src/commentstabview.js
+++ b/apps/comments/src/commentstabview.js
@@ -1,5 +1,5 @@
/* eslint-disable */
-/*
+/**
* Copyright (c) 2016
*
* This file is licensed under the Affero General Public License version 3
@@ -264,14 +264,14 @@
},
/**
- * takes care of post-rendering after a new comment was added to the
- * collection
- *
- * @param model
- * @param collection
- * @param options
- * @private
- */
+ * takes care of post-rendering after a new comment was added to the
+ * collection
+ *
+ * @param model
+ * @param collection
+ * @param options
+ * @private
+ */
_onAddModel: function(model, collection, options) {
// we need to render it immediately, to ensure that the right
// order of comments is kept on opening comments tab
@@ -303,11 +303,11 @@
},
/**
- * takes care of post-rendering after a new comment was edited
- *
- * @param model
- * @private
- */
+ * takes care of post-rendering after a new comment was edited
+ *
+ * @param model
+ * @private
+ */
_onChangeModel: function(model) {
if (model.get('message').trim() === model.previous('message').trim()) {
return
@@ -402,9 +402,9 @@
},
/**
- * Convert a message to be displayed in HTML,
- * converts newlines to <br> tags.
- */
+ * Convert a message to be displayed in HTML,
+ * converts newlines to <br> tags.
+ */
_formatMessage: function(message, mentions, editMode) {
message = escapeHTML(message).replace(/\n/g, '<br/>')
@@ -597,9 +597,12 @@
_onSubmitSuccess: function(model, $form) {
var $submit = $form.find('.submit')
var $loading = $form.find('.submitLoading')
+ var $message = $form.find('.message')
$submit.removeClass('hidden')
$loading.addClass('hidden')
+ $message.prop('contenteditable', true)
+ $message.text('')
},
_commentBodyHTML2Plain: function($el) {
@@ -651,7 +654,7 @@
message = this._commentBodyHTML2Plain($commentField)
if (commentId) {
- // edit mode
+ // edit mode
var comment = this.collection.get(commentId)
comment.save({
message: message
@@ -659,7 +662,7 @@
success: function(model) {
self._onSubmitSuccess(model, $form)
if (model.get('message').trim() === model.previous('message').trim()) {
- // model change event doesn't trigger, manually remove the row.
+ // model change event doesn't trigger, manually remove the row.
var $row = $form.closest('.comment')
$row.data('commentEl').removeClass('hidden')
$row.remove()