Fix chrome document scanning
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Page } from '$lib/types';
|
import type { Page } from '$lib/types';
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import TextBoxes from './TextBoxes.svelte';
|
import TextBoxes from './TextBoxes.svelte';
|
||||||
|
|
||||||
export let page: Page;
|
export let page: Page;
|
||||||
export let src: File;
|
export let src: File;
|
||||||
|
|
||||||
$: url = `url(${URL.createObjectURL(src)})`;
|
$: url = src ? `url(${URL.createObjectURL(src)})` : '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -2,13 +2,17 @@
|
|||||||
import { AccordionItem, Button } from 'flowbite-svelte';
|
import { AccordionItem, Button } from 'flowbite-svelte';
|
||||||
import { db } from '$lib/catalog/db';
|
import { db } from '$lib/catalog/db';
|
||||||
import { promptConfirmation } from '$lib/util';
|
import { promptConfirmation } from '$lib/util';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
function onClear() {
|
function onClear() {
|
||||||
promptConfirmation('Are you sure you want to clear your catalog?', () => db.catalog.clear());
|
promptConfirmation('Are you sure you want to clear your catalog?', () => db.catalog.clear());
|
||||||
|
goto('/');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AccordionItem>
|
<AccordionItem>
|
||||||
<span slot="header">Catalog settings</span>
|
<span slot="header">Catalog settings</span>
|
||||||
|
<div class="flex flex-col">
|
||||||
<Button on:click={onClear} outline color="red">Clear catalog</Button>
|
<Button on:click={onClear} outline color="red">Clear catalog</Button>
|
||||||
|
</div>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ export async function scanFiles(item: FileSystemEntry, files: Promise<File | und
|
|||||||
if (item.isDirectory) {
|
if (item.isDirectory) {
|
||||||
const directoryReader = (item as FileSystemDirectoryEntry).createReader();
|
const directoryReader = (item as FileSystemDirectoryEntry).createReader();
|
||||||
await new Promise<void>((resolve) => {
|
await new Promise<void>((resolve) => {
|
||||||
|
function readEntries() {
|
||||||
directoryReader.readEntries(async (entries) => {
|
directoryReader.readEntries(async (entries) => {
|
||||||
|
if (entries.length > 0) {
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
if (entry.isFile) {
|
if (entry.isFile) {
|
||||||
files.push(getFile(entry as FileSystemFileEntry));
|
files.push(getFile(entry as FileSystemFileEntry));
|
||||||
@@ -72,8 +74,14 @@ export async function scanFiles(item: FileSystemEntry, files: Promise<File | und
|
|||||||
await scanFiles(entry, files);
|
await scanFiles(entry, files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
readEntries()
|
||||||
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
readEntries()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,5 +195,7 @@ export async function processFiles(files: File[]) {
|
|||||||
|
|
||||||
showSnackbar('Catalog updated successfully');
|
showSnackbar('Catalog updated successfully');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
showSnackbar('Missing .mokuro file');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user