feat: implement attachment preview

Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
2026-08-29 16:21:18 -04:00
parent 704e01fece
commit 74d3654515
3 changed files with 22 additions and 2 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ const handleAttachmentClick = (attachment: MessagePartInterface, index: number):
const handleViewerRetrieve = (item: AttachmentItem): Promise<Blob> => {
if (!props.entity) return Promise.reject(new Error('No message selected'))
return mailUiStore.attachmentBlob(props.entity, item.meta.attachment)
return mailUiStore.attachmentPreviewBlob(props.entity, item.meta.attachment)
}
// Format date for display
+15
View File
@@ -640,6 +640,20 @@ export const useMailOperationsStore = defineStore('mailOperationsStore', () => {
return blob
}
async function attachmentPreviewBlob(entity: EntityObject, part: MessagePartInterface): Promise<Blob> {
return entitiesStore.preview({
target: entity.identifier,
part: {
blobId: part.blobId ?? undefined,
partId: part.partId ?? undefined,
cid: part.cid ?? undefined,
type: part.type || 'application/octet-stream',
size: part.size ?? null,
},
variant: 'popover',
})
}
// ── Exports ───────────────────────────────────────────────────────────────
return {
@@ -681,6 +695,7 @@ export const useMailOperationsStore = defineStore('mailOperationsStore', () => {
moveMessages,
downloadMessage,
attachmentBlob,
attachmentPreviewBlob,
moveFolder,
renameFolder,
isServiceFolderLoading,
+6 -1
View File
@@ -714,6 +714,10 @@ export const useMailUiStore = defineStore('mailUiStore', () => {
return mailOperationsStore.attachmentBlob(entity, part)
}
function attachmentPreviewBlob(entity: EntityObject, part: Parameters<typeof mailOperationsStore.attachmentPreviewBlob>[1]) {
return mailOperationsStore.attachmentPreviewBlob(entity, part)
}
return {
sidebarVisible,
settingsDialogVisible,
@@ -763,6 +767,7 @@ export const useMailUiStore = defineStore('mailUiStore', () => {
moveMessages,
downloadMessage,
attachmentBlob,
attachmentPreviewBlob,
messageSelectionModeActivate,
messageSelectionModeDeactivate,
messageSelectionToggleOne,
@@ -788,4 +793,4 @@ export const useMailUiStore = defineStore('mailUiStore', () => {
confirmDeleteFolder,
flagSelectedMessages,
}
})
})