support blob values #211

This commit is contained in:
Jan Prochazka
2022-02-03 14:29:46 +01:00
parent 1d52e02107
commit 7297976843
12 changed files with 112 additions and 42 deletions

View File

@@ -0,0 +1,35 @@
<script lang="ts">
import _ from 'lodash';
import ErrorInfo from '../elements/ErrorInfo.svelte';
export let selection;
function extractPicture(values) {
const value = values;
if (value?.type == 'Buffer' && _.isArray(value?.data)) {
return 'data:image/png;base64, ' + btoa(String.fromCharCode.apply(null, value?.data));
}
return null;
}
$: picture = extractPicture(selection[0]?.value);
</script>
{#if picture}
<div class="wrapper">
<img src={picture} />
</div>
{:else}
<ErrorInfo message="Error showing picture" alignTop />
{/if}
<style>
.wrapper {
overflow: auto;
/* position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0; */
}
</style>