diff --git a/components/publish/PublishAttachment.vue b/components/publish/PublishAttachment.vue index 1e82c07a..91475622 100644 --- a/components/publish/PublishAttachment.vue +++ b/components/publish/PublishAttachment.vue @@ -17,8 +17,14 @@ defineEmits<{ diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index b6e4bdf7..07d2a1a0 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -35,21 +35,23 @@ async function handlePaste(evt: ClipboardEvent) { if (!files) return + evt.preventDefault() await uploadAttachments(Array.from(files)) } async function pickAttachments() { if (!globalThis.showOpenFilePicker) - // TODO: Safari don't support it. + // TODO: FireFox & Safari don't support it. return const handles = await showOpenFilePicker({ multiple: true, - // TODO: add more kinds of files: videos, audios types: [{ - description: 'Images', + description: 'Attachments', accept: { - 'image/*': ['.png', '.gif', '.jpeg', '.jpg', '.webp', '.avif', '.heic'], + 'image/*': ['.png', '.gif', '.jpeg', '.jpg', '.webp', '.avif', '.heic', '.heif'], + 'video/*': ['.webm', '.mp4', '.m4v', '.mov', '.ogv', '.3gp'], + 'audio/*': ['.mp3', '.ogg', '.oga', '.wav', '.flac', '.opus', '.aac', '.m4a', '.3gp', '.wma'], }, }], }) @@ -68,7 +70,7 @@ async function uploadAttachments(files: File[]) { isUploading = false } -async function removeAttachment(index: number) { +function removeAttachment(index: number) { attachments.splice(index, 1) } diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index d55e5523..21dc011f 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -22,7 +22,7 @@ const aspectRatio = computed(() => {