diff options
Diffstat (limited to 'app/assets/javascripts/notes/components/issue_comment_form.vue')
-rw-r--r-- | app/assets/javascripts/notes/components/issue_comment_form.vue | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index 16f4e22aa9b..fa7ac994058 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -2,6 +2,7 @@ /* global Flash, Autosave */ import { mapActions, mapGetters } from 'vuex'; import _ from 'underscore'; + import autosize from 'vendor/autosize'; import '../../autosave'; import TaskList from '../../task_list'; import * as constants from '../constants'; @@ -96,6 +97,8 @@ methods: { ...mapActions([ 'saveNote', + 'stopPolling', + 'restartPolling', 'removePlaceholderNotes', ]), setIsSubmitButtonDisabled(note, isSubmitting) { @@ -124,10 +127,14 @@ } this.isSubmitting = true; this.note = ''; // Empty textarea while being requested. Repopulate in catch + this.resizeTextarea(); + this.stopPolling(); this.saveNote(noteData) .then((res) => { this.isSubmitting = false; + this.restartPolling(); + if (res.errors) { if (res.errors.commands_only) { this.discard(); @@ -174,6 +181,8 @@ if (shouldClear) { this.note = ''; + this.resizeTextarea(); + this.$refs.markdownField.previewMarkdown = false; } // reset autostave @@ -205,6 +214,11 @@ selector: '.notes', }); }, + resizeTextarea() { + this.$nextTick(() => { + autosize.update(this.$refs.textarea); + }); + }, }, mounted() { // jQuery is needed here because it is a custom event being dispatched with jQuery. @@ -247,7 +261,8 @@ :markdown-docs-path="markdownDocsPath" :quick-actions-docs-path="quickActionsDocsPath" :add-spacing-classes="false" - :is-confidential-issue="isConfidentialIssue"> + :is-confidential-issue="isConfidentialIssue" + ref="markdownField"> <textarea id="note-body" name="note[note]" |