Skip to content

Commit 50185fd

Browse files
committed
better autocopy ui
1 parent bc163e7 commit 50185fd

1 file changed

Lines changed: 23 additions & 14 deletions

File tree

app/pages/ocr.vue

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ async function copy(wrap_format: string | null = null) {
5858
color: 'success',
5959
duration: 1500
6060
})
61-
} catch {
61+
} catch (err) {
62+
console.log(err)
6263
toast?.add({
6364
title: t('copy_failed'),
65+
description: String(err),
6466
color: 'error',
65-
duration: 1500
67+
duration: 0
6668
})
6769
}
6870
}
@@ -113,13 +115,13 @@ async function onFileChange(newFile: File | null | undefined) {
113115
if (auto_copy_value.value) {
114116
switch (auto_copy_value.value) {
115117
case 'typst':
116-
copyAsTypst()
118+
await copyAsTypst()
117119
break
118120
case 'latex':
119-
copy()
121+
await copy()
120122
break
121123
default:
122-
copy(auto_copy_value.value)
124+
await copy(auto_copy_value.value)
123125
}
124126
}
125127
}
@@ -177,7 +179,7 @@ const handlePaste = async (event: ClipboardEvent) => {
177179
178180
// auto copy
179181
const auto_copy_items = ref(['latex', 'typst', ...wrap_format_options])
180-
const auto_copy_value = ref(undefined)
182+
const auto_copy_value = ref('latex')
181183
182184
let load: (model_config: ModelConfig) => Promise<void>
183185
let runOCR: (imageFile: File) => Promise<void>
@@ -427,14 +429,21 @@ onBeforeUnmount(() => {
427429
</UButton>
428430
</div>
429431
<div class="flex">
430-
<USelect
431-
v-model="auto_copy_value"
432-
:items="auto_copy_items"
433-
:placeholder="t('autoCopy')"
434-
:ui="{
435-
content: 'w-auto'
436-
}"
437-
/>
432+
<UFieldGroup>
433+
<UBadge
434+
color="neutral"
435+
variant="outline"
436+
size="lg"
437+
:label="t('autoCopy')"
438+
/>
439+
<USelect
440+
v-model="auto_copy_value"
441+
:items="auto_copy_items"
442+
:ui="{
443+
content: 'w-auto'
444+
}"
445+
/>
446+
</UFieldGroup>
438447
</div>
439448
</div>
440449
</template>

0 commit comments

Comments
 (0)