update
This commit is contained in:
@@ -553,6 +553,14 @@ export class SioConversationView extends DeesElement {
|
||||
<div class="attachment-image" @click=${() => this.openImage(attachment)}>
|
||||
<img src="${attachment.url}" alt="${attachment.name}" />
|
||||
</div>
|
||||
` : attachment.type?.includes('pdf') || attachment.name?.toLowerCase().endsWith('.pdf') ? html`
|
||||
<div class="attachment-file" @click=${() => this.openImage(attachment)}>
|
||||
<sio-icon icon="file-text" size="16"></sio-icon>
|
||||
<div>
|
||||
<div class="attachment-name">${attachment.name}</div>
|
||||
<div class="attachment-size">${this.formatFileSize(attachment.size)}</div>
|
||||
</div>
|
||||
</div>
|
||||
` : html`
|
||||
<div class="attachment-file" @click=${() => this.downloadFile(attachment)}>
|
||||
<sio-icon icon="file" size="16"></sio-icon>
|
||||
@@ -810,11 +818,20 @@ export class SioConversationView extends DeesElement {
|
||||
}
|
||||
|
||||
private openImage(attachment: IAttachment) {
|
||||
this.dispatchEvent(new CustomEvent('open-image', {
|
||||
detail: { attachment },
|
||||
bubbles: true,
|
||||
composed: true
|
||||
}));
|
||||
// Check if it's actually a PDF
|
||||
if (attachment.type?.includes('pdf') || attachment.name?.toLowerCase().endsWith('.pdf')) {
|
||||
this.dispatchEvent(new CustomEvent('open-file', {
|
||||
detail: { attachment },
|
||||
bubbles: true,
|
||||
composed: true
|
||||
}));
|
||||
} else {
|
||||
this.dispatchEvent(new CustomEvent('open-image', {
|
||||
detail: { attachment },
|
||||
bubbles: true,
|
||||
composed: true
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private downloadFile(attachment: IAttachment) {
|
||||
|
||||
Reference in New Issue
Block a user