Spaces:
Running
Running
coyotte508
commited on
Commit
ยท
8d0e117
1
Parent(s):
2a48aa5
๐ Scroll text area
Browse files- src/routes/+page.svelte +11 -2
src/routes/+page.svelte
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<script lang="ts">
|
2 |
import { checkDduf } from '$lib/check-dduf';
|
|
|
3 |
|
4 |
let url = 'https://huggingface.co/spaces/coyotte508/dduf-check/resolve/main/file.dduf';
|
5 |
let output = '';
|
@@ -13,12 +14,17 @@
|
|
13 |
try {
|
14 |
for await (const str of checkDduf(url)) {
|
15 |
output += '\n' + str;
|
|
|
|
|
|
|
16 |
}
|
17 |
} catch (e) {
|
18 |
console.error(e);
|
19 |
error = (e as Error).message;
|
20 |
}
|
21 |
}
|
|
|
|
|
22 |
</script>
|
23 |
|
24 |
<div class="flex flex-col gap-4 p-4">
|
@@ -38,8 +44,11 @@
|
|
38 |
|
39 |
<button type="submit" class="self-start rounded-md bg-blue-500 p-2 text-white">Check</button>
|
40 |
|
41 |
-
<textarea
|
42 |
-
|
|
|
|
|
|
|
43 |
>
|
44 |
|
45 |
{#if error}
|
|
|
1 |
<script lang="ts">
|
2 |
import { checkDduf } from '$lib/check-dduf';
|
3 |
+
import { tick } from 'svelte';
|
4 |
|
5 |
let url = 'https://huggingface.co/spaces/coyotte508/dduf-check/resolve/main/file.dduf';
|
6 |
let output = '';
|
|
|
14 |
try {
|
15 |
for await (const str of checkDduf(url)) {
|
16 |
output += '\n' + str;
|
17 |
+
tick().then(() => {
|
18 |
+
textarea.scrollTop = textarea.scrollHeight;
|
19 |
+
});
|
20 |
}
|
21 |
} catch (e) {
|
22 |
console.error(e);
|
23 |
error = (e as Error).message;
|
24 |
}
|
25 |
}
|
26 |
+
|
27 |
+
let textarea: HTMLTextAreaElement;
|
28 |
</script>
|
29 |
|
30 |
<div class="flex flex-col gap-4 p-4">
|
|
|
44 |
|
45 |
<button type="submit" class="self-start rounded-md bg-blue-500 p-2 text-white">Check</button>
|
46 |
|
47 |
+
<textarea
|
48 |
+
bind:this={textarea}
|
49 |
+
class="w-full rounded-md border border-gray-300 p-2"
|
50 |
+
rows="10"
|
51 |
+
readonly>{output}</textarea
|
52 |
>
|
53 |
|
54 |
{#if error}
|