feat: implement attachment preview
Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
@@ -61,7 +61,7 @@ const handleAttachmentClick = (attachment: MessagePartInterface, index: number):
|
|||||||
|
|
||||||
const handleViewerRetrieve = (item: AttachmentItem): Promise<Blob> => {
|
const handleViewerRetrieve = (item: AttachmentItem): Promise<Blob> => {
|
||||||
if (!props.entity) return Promise.reject(new Error('No message selected'))
|
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
|
// Format date for display
|
||||||
|
|||||||
@@ -640,6 +640,20 @@ export const useMailOperationsStore = defineStore('mailOperationsStore', () => {
|
|||||||
return blob
|
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 ───────────────────────────────────────────────────────────────
|
// ── Exports ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -681,6 +695,7 @@ export const useMailOperationsStore = defineStore('mailOperationsStore', () => {
|
|||||||
moveMessages,
|
moveMessages,
|
||||||
downloadMessage,
|
downloadMessage,
|
||||||
attachmentBlob,
|
attachmentBlob,
|
||||||
|
attachmentPreviewBlob,
|
||||||
moveFolder,
|
moveFolder,
|
||||||
renameFolder,
|
renameFolder,
|
||||||
isServiceFolderLoading,
|
isServiceFolderLoading,
|
||||||
|
|||||||
@@ -714,6 +714,10 @@ export const useMailUiStore = defineStore('mailUiStore', () => {
|
|||||||
return mailOperationsStore.attachmentBlob(entity, part)
|
return mailOperationsStore.attachmentBlob(entity, part)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function attachmentPreviewBlob(entity: EntityObject, part: Parameters<typeof mailOperationsStore.attachmentPreviewBlob>[1]) {
|
||||||
|
return mailOperationsStore.attachmentPreviewBlob(entity, part)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sidebarVisible,
|
sidebarVisible,
|
||||||
settingsDialogVisible,
|
settingsDialogVisible,
|
||||||
@@ -763,6 +767,7 @@ export const useMailUiStore = defineStore('mailUiStore', () => {
|
|||||||
moveMessages,
|
moveMessages,
|
||||||
downloadMessage,
|
downloadMessage,
|
||||||
attachmentBlob,
|
attachmentBlob,
|
||||||
|
attachmentPreviewBlob,
|
||||||
messageSelectionModeActivate,
|
messageSelectionModeActivate,
|
||||||
messageSelectionModeDeactivate,
|
messageSelectionModeDeactivate,
|
||||||
messageSelectionToggleOne,
|
messageSelectionToggleOne,
|
||||||
|
|||||||
Reference in New Issue
Block a user