fix, wip: don't show preview for non-image fragments
This commit is contained in:
parent
ddb7af116b
commit
ee2c1fde94
1 changed files with 18 additions and 11 deletions
|
@ -12,8 +12,13 @@
|
||||||
|
|
||||||
$: objectAddress = String($entity?.get("ANNOTATES") || "");
|
$: objectAddress = String($entity?.get("ANNOTATES") || "");
|
||||||
|
|
||||||
|
$: imageFragment = ["x=", "y=", "w=", "h="].every((q) =>
|
||||||
|
String($entity?.get("W3C_FRAGMENT_SELECTOR")).includes(q)
|
||||||
|
);
|
||||||
|
|
||||||
let imageLoaded = false;
|
let imageLoaded = false;
|
||||||
$: imageLoaded && dispatch("loaded");
|
$: imageLoaded && dispatch("loaded");
|
||||||
|
$: if ($entity && !imageFragment) imageLoaded = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="fragment-viewer">
|
<div class="fragment-viewer">
|
||||||
|
@ -21,17 +26,19 @@
|
||||||
<Spinner />
|
<Spinner />
|
||||||
{/if}
|
{/if}
|
||||||
{#if $entity}
|
{#if $entity}
|
||||||
<img
|
{#if imageFragment}
|
||||||
class="preview-image"
|
<img
|
||||||
class:imageLoaded
|
class="preview-image"
|
||||||
src="{API_URL}/{detail ? 'raw' : 'thumb'}/{objectAddress}#{$entity?.get(
|
class:imageLoaded
|
||||||
'W3C_FRAGMENT_SELECTOR'
|
src="{API_URL}/{detail ? 'raw' : 'thumb'}/{objectAddress}#{$entity?.get(
|
||||||
)}"
|
'W3C_FRAGMENT_SELECTOR'
|
||||||
use:xywh
|
)}"
|
||||||
alt={address}
|
use:xywh
|
||||||
on:load={() => (imageLoaded = true)}
|
alt={address}
|
||||||
draggable="false"
|
on:load={() => (imageLoaded = true)}
|
||||||
/>
|
draggable="false"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue