UBERF-8180 Text file preview (#6633)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2024-09-19 17:19:09 +05:00
committed by GitHub
parent 892bbbe8b8
commit e248aec920
5 changed files with 104 additions and 5 deletions
@@ -14,7 +14,14 @@
-->
<script lang="ts">
import { type Blob, type Ref } from '@hcengineering/core'
import { Button, Component, Label, resizeObserver, deviceOptionsStore as deviceInfo } from '@hcengineering/ui'
import {
Button,
Component,
Label,
resizeObserver,
deviceOptionsStore as deviceInfo,
Loading
} from '@hcengineering/ui'
import presentation from '../plugin'
@@ -34,9 +41,11 @@
let minHeight: number | undefined
$: parentHeight = ($deviceInfo.docHeight * 80) / 100
let loading = true
let previewType: FilePreviewExtension | undefined = undefined
$: void getPreviewType(contentType, $previewTypes).then((res) => {
previewType = res
loading = false
})
const updateHeight = (
@@ -91,6 +100,8 @@
</div>
{:else if previewType !== undefined}
<Component is={previewType.component} props={{ value: file, name, contentType, metadata, ...props, fit }} />
{:else if loading}
<Loading />
{:else}
<div class="flex-col items-center flex-gap-3">
<Label label={presentation.string.ContentTypeNotSupported} />