This commit is contained in:
Jan Prochazka
2021-03-25 13:50:23 +01:00
parent bc9e8a2ea6
commit 2afa7a5f58
2 changed files with 6 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
import CheckboxField from './CheckboxField.svelte';
export let name;
export let defaultValue;
const { values, setFieldValue } = getFormContext();
function handleChange(e) {
@@ -10,4 +11,4 @@
}
</script>
<CheckboxField {...$$restProps} checked={$values[name]} on:change={handleChange} />
<CheckboxField {...$$restProps} checked={$values[name] ?? defaultValue} on:change={handleChange} />

View File

@@ -74,10 +74,12 @@
$: supportsPreview =
!!findFileFormat($extensions, $values.sourceStorageType) || $values.sourceStorageType == 'archive';
$: handleChangePreviewSource($previewSource);
$: {
$values;
handleChangePreviewSource($previewSource);
}
const handleChangePreviewSource = async source => {
console.log('SOURCE', source);
if (source && supportsPreview) {
const reader = await createPreviewReader($extensions, $values, source);
if (previewReaderStore) previewReaderStore.set(reader);