feat: use new variant type
Signed-off-by: Sebastian <krupinski01@gmail.com>
This commit is contained in:
@@ -159,7 +159,7 @@ const handlePreview = (index: number) => {
|
|||||||
|
|
||||||
const handleViewerRetrieve = (item: MediaViewerItem): Promise<Blob> => {
|
const handleViewerRetrieve = (item: MediaViewerItem): 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, 'fullscreen')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleViewerDownload = (item: MediaViewerItem) => {
|
const handleViewerDownload = (item: MediaViewerItem) => {
|
||||||
|
|||||||
@@ -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.attachmentPreviewBlob(props.entity, item.meta.attachment)
|
return mailUiStore.attachmentPreviewBlob(props.entity, item.meta.attachment, 'inline')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format date for display
|
// Format date for display
|
||||||
|
|||||||
@@ -640,7 +640,11 @@ export const useMailOperationsStore = defineStore('mailOperationsStore', () => {
|
|||||||
return blob
|
return blob
|
||||||
}
|
}
|
||||||
|
|
||||||
async function attachmentPreviewBlob(entity: EntityObject, part: MessagePartInterface): Promise<Blob> {
|
async function attachmentPreviewBlob(
|
||||||
|
entity: EntityObject,
|
||||||
|
part: MessagePartInterface,
|
||||||
|
variant: 'inline' | 'fullscreen' = 'inline',
|
||||||
|
): Promise<Blob> {
|
||||||
return entitiesStore.preview({
|
return entitiesStore.preview({
|
||||||
target: entity.identifier,
|
target: entity.identifier,
|
||||||
part: {
|
part: {
|
||||||
@@ -650,7 +654,7 @@ export const useMailOperationsStore = defineStore('mailOperationsStore', () => {
|
|||||||
type: part.type || 'application/octet-stream',
|
type: part.type || 'application/octet-stream',
|
||||||
size: part.size ?? null,
|
size: part.size ?? null,
|
||||||
},
|
},
|
||||||
variant: 'popover',
|
variant,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -714,8 +714,12 @@ 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]) {
|
function attachmentPreviewBlob(
|
||||||
return mailOperationsStore.attachmentPreviewBlob(entity, part)
|
entity: EntityObject,
|
||||||
|
part: Parameters<typeof mailOperationsStore.attachmentPreviewBlob>[1],
|
||||||
|
variant: 'inline' | 'fullscreen' = 'inline',
|
||||||
|
) {
|
||||||
|
return mailOperationsStore.attachmentPreviewBlob(entity, part, variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user