|
1 | 1 | /* eslint-disable */ |
2 | | -/* |
| 2 | +/** |
3 | 3 | * Copyright (c) 2016 |
4 | 4 | * |
5 | 5 | * This file is licensed under the Affero General Public License version 3 |
|
264 | 264 | }, |
265 | 265 |
|
266 | 266 | /** |
267 | | - * takes care of post-rendering after a new comment was added to the |
268 | | - * collection |
269 | | - * |
270 | | - * @param model |
271 | | - * @param collection |
272 | | - * @param options |
273 | | - * @private |
274 | | - */ |
| 267 | + * takes care of post-rendering after a new comment was added to the |
| 268 | + * collection |
| 269 | + * |
| 270 | + * @param model |
| 271 | + * @param collection |
| 272 | + * @param options |
| 273 | + * @private |
| 274 | + */ |
275 | 275 | _onAddModel: function(model, collection, options) { |
276 | 276 | // we need to render it immediately, to ensure that the right |
277 | 277 | // order of comments is kept on opening comments tab |
|
303 | 303 | }, |
304 | 304 |
|
305 | 305 | /** |
306 | | - * takes care of post-rendering after a new comment was edited |
307 | | - * |
308 | | - * @param model |
309 | | - * @private |
310 | | - */ |
| 306 | + * takes care of post-rendering after a new comment was edited |
| 307 | + * |
| 308 | + * @param model |
| 309 | + * @private |
| 310 | + */ |
311 | 311 | _onChangeModel: function(model) { |
312 | 312 | if (model.get('message').trim() === model.previous('message').trim()) { |
313 | 313 | return |
|
402 | 402 | }, |
403 | 403 |
|
404 | 404 | /** |
405 | | - * Convert a message to be displayed in HTML, |
406 | | - * converts newlines to <br> tags. |
407 | | - */ |
| 405 | + * Convert a message to be displayed in HTML, |
| 406 | + * converts newlines to <br> tags. |
| 407 | + */ |
408 | 408 | _formatMessage: function(message, mentions, editMode) { |
409 | 409 | message = escapeHTML(message).replace(/\n/g, '<br/>') |
410 | 410 |
|
|
597 | 597 | _onSubmitSuccess: function(model, $form) { |
598 | 598 | var $submit = $form.find('.submit') |
599 | 599 | var $loading = $form.find('.submitLoading') |
| 600 | + var $message = $form.find('.message') |
600 | 601 |
|
601 | 602 | $submit.removeClass('hidden') |
602 | 603 | $loading.addClass('hidden') |
| 604 | + $message.prop('contenteditable', true) |
| 605 | + $message.text('') |
603 | 606 | }, |
604 | 607 |
|
605 | 608 | _commentBodyHTML2Plain: function($el) { |
|
651 | 654 |
|
652 | 655 | message = this._commentBodyHTML2Plain($commentField) |
653 | 656 | if (commentId) { |
654 | | - // edit mode |
| 657 | + // edit mode |
655 | 658 | var comment = this.collection.get(commentId) |
656 | 659 | comment.save({ |
657 | 660 | message: message |
658 | 661 | }, { |
659 | 662 | success: function(model) { |
660 | 663 | self._onSubmitSuccess(model, $form) |
661 | 664 | if (model.get('message').trim() === model.previous('message').trim()) { |
662 | | - // model change event doesn't trigger, manually remove the row. |
| 665 | + // model change event doesn't trigger, manually remove the row. |
663 | 666 | var $row = $form.closest('.comment') |
664 | 667 | $row.data('commentEl').removeClass('hidden') |
665 | 668 | $row.remove() |
|
0 commit comments