Text edtor embed plugin improvements (#9078)

Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
Victor Ilyushchenko
2025-05-23 22:06:37 +07:00
committed by GitHub
parent 14c7541bd3
commit bd6c8d6758
7 changed files with 336 additions and 143 deletions
@@ -27,6 +27,8 @@
export let drawings: any
export let createDrawing: (data: any) => Promise<any>
export let setLoading: ((loading: boolean) => void) | undefined = undefined
$: originalWidth = metadata?.originalWidth
$: originalHeight = metadata?.originalHeight
$: pixelRatio = metadata?.pixelRatio ?? 1
@@ -38,6 +40,12 @@
$: height = imageHeight != null ? `min(${imageHeight}px, ${fit ? '100%' : '80vh'})` : '100%'
let loading = true
function _setLoading (newState: boolean): void {
loading = newState
setLoading?.(loading)
}
$: if (value !== undefined) _setLoading(true)
</script>
{#await getBlobRef(value, name) then blobRef}
@@ -58,7 +66,7 @@
>
<img
on:load={() => {
loading = false
_setLoading(false)
}}
class="object-contain mx-auto"
style:max-width={width}