From 62edf2c29d45694d6f177c2f439d59941217e6b3 Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Tue, 23 Nov 2021 21:30:17 +0100 Subject: [PATCH] Open images in internal viewer Signed-off-by: Andrey Platov --- .../src/components/AttachmentPresenter.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/chunter-resources/src/components/AttachmentPresenter.svelte b/plugins/chunter-resources/src/components/AttachmentPresenter.svelte index e47495f80b..eb89dfb30b 100644 --- a/plugins/chunter-resources/src/components/AttachmentPresenter.svelte +++ b/plugins/chunter-resources/src/components/AttachmentPresenter.svelte @@ -32,16 +32,20 @@ const ext = parts[parts.length - 1] return ext.substring(0, 4).toUpperCase() } + + function openEmbedded(contentType: string) { + return contentType.includes('application/pdf') || contentType.startsWith('image/') + }
- {#if value.type.includes('application/pdf')} + {#if openEmbedded(value.type)}
{ closeTooltip(); showPopup(PDFViewer, { file: value.file }, 'right') }}>{iconLabel(value.name)}
{:else}
{iconLabel(value.name)}
{/if}
- {#if value.type.includes('application/pdf') || value.type.startsWith('image/')} + {#if openEmbedded(value.type)}
{ closeTooltip(); showPopup(PDFViewer, { file: value.file }, 'right') }}>{trimFilename(value.name)}
{:else}