mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
refactor(reader): extract closeFind to avoid Prettier multiline handler
This commit is contained in:
@@ -282,7 +282,7 @@ function onKeyDown(e: KeyboardEvent) {
|
||||
e.preventDefault()
|
||||
showFind.value = true
|
||||
} else if (e.key === 'Escape') {
|
||||
showFind.value = false
|
||||
closeFind()
|
||||
showZoomMenu.value = false
|
||||
}
|
||||
}
|
||||
@@ -292,6 +292,11 @@ function rotate() {
|
||||
rotation.value = ((rotation.value + 90) % 360) as 0 | 90 | 180 | 270
|
||||
}
|
||||
|
||||
function closeFind() {
|
||||
showFind.value = false
|
||||
findQuery.value = ''
|
||||
}
|
||||
|
||||
// ── Find ──────────────────────────────────────────────────────────────────────
|
||||
watch(findQuery, (q) => {
|
||||
if (!q.trim()) {
|
||||
@@ -478,13 +483,7 @@ const progressPct = computed(() => (totalPages.value ? Math.round((currentPage.v
|
||||
@keydown.escape="showFind = false"
|
||||
/>
|
||||
<span v-if="findQuery" class="text-xs text-white/40 tabular-nums shrink-0">{{ findMatches }} match{{ findMatches !== 1 ? 'es' : '' }}</span>
|
||||
<button
|
||||
class="pdf-btn w-6 h-6"
|
||||
@click="
|
||||
showFind = false
|
||||
findQuery = ''
|
||||
"
|
||||
>
|
||||
<button class="pdf-btn w-6 h-6" @click="closeFind">
|
||||
<X :size="12" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user