Open images in internal viewer

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-11-23 21:30:17 +01:00
parent 15e365ec6e
commit 62edf2c29d
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0

View File

@ -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/')
}
</script>
<div class="flex-row-center">
{#if value.type.includes('application/pdf')}
{#if openEmbedded(value.type)}
<div class="flex-center icon" on:click={()=> { closeTooltip(); showPopup(PDFViewer, { file: value.file }, 'right') }}>{iconLabel(value.name)}</div>
{:else}
<a class="no-line" href={getFileUrl(value.file)} download={value.name}><div class="flex-center icon">{iconLabel(value.name)}</div></a>
{/if}
<div class="flex-col info">
{#if value.type.includes('application/pdf') || value.type.startsWith('image/')}
{#if openEmbedded(value.type)}
<div class="name" on:click={()=> { closeTooltip(); showPopup(PDFViewer, { file: value.file }, 'right') }}>{trimFilename(value.name)}</div>
{:else}
<div class="name"><a href={getFileUrl(value.file)} download={value.name}>{trimFilename(value.name)}</a></div>