diff options
| author | Henry Jameson <me@hjkos.com> | 2021-08-15 21:04:49 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2021-08-15 21:04:49 +0300 |
| commit | 0507eb6550830f7b76910d51200675de0aa9b1de (patch) | |
| tree | 856b2507598d884229f5d2461a0e190f830788d4 /src/components/post_status_form | |
| parent | 830a03a0d13738ed1677d364fdf03821fbc507ab (diff) | |
ability to move attachments around when making a new post
Diffstat (limited to 'src/components/post_status_form')
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 13 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.vue | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 1a12db9c..fe07309f 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -391,9 +391,20 @@ const PostStatusForm = { this.$emit('resize') }, editAttachment (fileInfo, newText) { - console.log(fileInfo, newText) this.newStatus.mediaDescriptions[fileInfo.id] = newText }, + shiftUpMediaFile (fileInfo) { + const { files } = this.newStatus + const index = this.newStatus.files.indexOf(fileInfo) + files.splice(index, 1) + files.splice(index - 1, 0, fileInfo) + }, + shiftDnMediaFile (fileInfo) { + const { files } = this.newStatus + const index = this.newStatus.files.indexOf(fileInfo) + files.splice(index, 1) + files.splice(index + 1, 0, fileInfo) + }, uploadFailed (errString, templateArgs) { templateArgs = templateArgs || {} this.error = this.$t('upload.error.base') + ' ' + this.$t('upload.error.' + errString, templateArgs) diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 87e6d2ab..2e0980a2 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -298,6 +298,8 @@ :editable="true" :edit-attachment="editAttachment" :remove-attachment="removeMediaFile" + :shift-up-attachment="newStatus.files.length > 1 && shiftUpMediaFile" + :shift-dn-attachment="newStatus.files.length > 1 && shiftDnMediaFile" @play="$emit('mediaplay', attachment.id)" @pause="$emit('mediapause', attachment.id)" /> |
