diff --git a/packages/web/src/impexp/ImportExportConfigurator.svelte b/packages/web/src/impexp/ImportExportConfigurator.svelte index daa58a33..2c161072 100644 --- a/packages/web/src/impexp/ImportExportConfigurator.svelte +++ b/packages/web/src/impexp/ImportExportConfigurator.svelte @@ -68,8 +68,8 @@ import SourceTargetConfig from './SourceTargetConfig.svelte'; - export let uploadedFile = undefined; - export let openedFile = undefined; + // export let uploadedFile = undefined; + // export let openedFile = undefined; export let previewReaderStore; const { values, setFieldValue } = getFormContext(); @@ -98,7 +98,7 @@ } }; - const handleUpload = file => { + export function addUploadedFile(file) { addFilesToSourceList( $extensions, [ @@ -116,26 +116,26 @@ }; onMount(() => { - setUploadListener(handleUpload); - if (uploadedFile) { - handleUpload(uploadedFile); - } - if (openedFile) { - handleUpload(openedFile); - // addFilesToSourceList( - // $extensions, - // [ - // { - // fileName: openedFile.filePath, - // shortName: openedFile.shortName, - // }, - // ], - // $values, - // values, - // !sourceList || sourceList.length == 0 ? openedFile.storageType : null, - // previewSource.set - // ); - } + setUploadListener(addUploadedFile); + // if (uploadedFile) { + // handleUpload(uploadedFile); + // } + // if (openedFile) { + // handleUpload(openedFile); + // // addFilesToSourceList( + // // $extensions, + // // [ + // // { + // // fileName: openedFile.filePath, + // // shortName: openedFile.shortName, + // // }, + // // ], + // // $values, + // // values, + // // !sourceList || sourceList.length == 0 ? openedFile.storageType : null, + // // previewSource.set + // // ); + // } return () => { setUploadListener(null); diff --git a/packages/web/src/tabs/ImportExportTab.svelte b/packages/web/src/tabs/ImportExportTab.svelte index 286b2714..9bccc6be 100644 --- a/packages/web/src/tabs/ImportExportTab.svelte +++ b/packages/web/src/tabs/ImportExportTab.svelte @@ -42,22 +42,42 @@ const refreshArchiveFolderRef = createRef(null); - const formValues = writable({ - sourceStorageType: 'database', - targetStorageType: getDefaultFileFormat($extensions).storageType, - targetArchiveFolder: $currentArchive, - sourceArchiveFolder: $currentArchive, - ...detectCurrentTarget(), - ...initialValues, - }); + const formValues = writable({}); + + let domConfigurator; + + // const formValues = writable({ + // sourceStorageType: 'database', + // targetStorageType: getDefaultFileFormat($extensions).storageType, + // targetArchiveFolder: $currentArchive, + // sourceArchiveFolder: $currentArchive, + // ...detectCurrentTarget(), + // ...initialValues, + // }); const { editorState, editorValue, setEditorData } = useEditorData({ tabid, onInitialData: value => { - $formValues = value; + $formValues = { + sourceStorageType: 'database', + targetStorageType: getDefaultFileFormat($extensions).storageType, + targetArchiveFolder: $currentArchive, + sourceArchiveFolder: $currentArchive, + ...detectCurrentTarget(), + ...value, + }; + + if (uploadedFile) { + domConfigurator.addUploadedFile(uploadedFile); + } + if (openedFile) { + domConfigurator.addUploadedFile(openedFile); + } }, }); + // $: console.log('formValues', $formValues); + $: setEditorData($formValues); function detectCurrentTarget() { @@ -111,7 +131,7 @@ }; const handleGenerateScript = async e => { - const values = $formValues; + const values = $formValues as any; const code = await createImpExpScript($extensions, values, undefined, true); openNewTab( { @@ -125,7 +145,7 @@ const handleExecute = async e => { if (busy) return; - const values = $formValues; + const values = $formValues as any; busy = true; const script = await createImpExpScript($extensions, values); executeNumber += 1; @@ -152,7 +172,7 @@
- + {#if busy} diff --git a/packages/web/src/utility/importExportTools.ts b/packages/web/src/utility/importExportTools.ts index c7fa89da..bed2b20d 100644 --- a/packages/web/src/utility/importExportTools.ts +++ b/packages/web/src/utility/importExportTools.ts @@ -6,7 +6,7 @@ export function openImportExportTab(editorProps, additionalProps = {}) { tabComponent: 'ImportExportTab', title: 'Import/Export', icon: 'img export', - ...additionalProps, + props: additionalProps, }, { editor: editorProps,