feat: basic alt text edit

This commit is contained in:
patak 2022-12-15 00:30:54 +01:00
parent 0f438b80cd
commit 2f8085fa86
2 changed files with 36 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import type { CreateStatusParams, StatusVisibility } from 'masto'
import type { Attachment, CreateStatusParams, StatusVisibility } from 'masto'
import { fileOpen } from 'browser-fs-access'
import { useDropZone } from '@vueuse/core'
import { EditorContent } from '@tiptap/vue-3'
@ -99,6 +99,11 @@ async function uploadAttachments(files: File[]) {
isUploading = false
}
async function setDescription(att: Attachment, description: string) {
att.description = description
await useMasto().mediaAttachments.update(att.id, { description: att.description })
}
function removeAttachment(index: number) {
draft.attachments.splice(index, 1)
}
@ -213,6 +218,7 @@ defineExpose({
v-for="(att, idx) in draft.attachments" :key="att.id"
:attachment="att"
@remove="removeAttachment(idx)"
@set-description="setDescription(att, $event)"
/>
</div>
</div>