diff options
Diffstat (limited to 'app/assets/javascripts/notes/components/comment_form.vue')
-rw-r--r-- | app/assets/javascripts/notes/components/comment_form.vue | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index c6e7117cf2e..4f7256d0b0e 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -28,6 +28,7 @@ import CommentTypeDropdown from './comment_type_dropdown.vue'; import DiscussionLockedWidget from './discussion_locked_widget.vue'; import NoteSignedOutWidget from './note_signed_out_widget.vue'; +const ATTACHMENT_REGEXP = /!?\[.*?\]\(\/uploads\/[0-9a-f]{32}\/.*?\)/; export default { name: 'CommentForm', i18n: COMMENT_FORM, @@ -176,6 +177,9 @@ export default { disableSubmitButton() { return this.note.length === 0 || this.isSubmitting; }, + containsLink() { + return ATTACHMENT_REGEXP.test(this.note); + }, }, mounted() { // jQuery is needed here because it is a custom event being dispatched with jQuery. @@ -356,6 +360,7 @@ export default { :noteable-data="getNoteableData" :is-internal-note="noteIsInternal" :noteable-type="noteableType" + :contains-link="containsLink" > <markdown-field ref="markdownField" |