From 05821ab2438b140315e1a64b41234c0b73c19549 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Wed, 8 Apr 2020 07:22:14 +0200 Subject: Clear comment on successful post MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) Signed-off-by: npmbuildbot[bot] --- apps/comments/src/commentstabview.js | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'apps/comments/src/commentstabview.js') 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
tags. - */ + * Convert a message to be displayed in HTML, + * converts newlines to
tags. + */ _formatMessage: function(message, mentions, editMode) { message = escapeHTML(message).replace(/\n/g, '
') @@ -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() -- cgit v1.2.3