refactor(reader): extract closeFind to avoid Prettier multiline handler

This commit is contained in:
neon
2026-01-01 16:00:08 -06:00
parent 4861d59164
commit d99ebb7d64
2 changed files with 11 additions and 12 deletions
@@ -282,7 +282,7 @@ function onKeyDown(e: KeyboardEvent) {
e.preventDefault() e.preventDefault()
showFind.value = true showFind.value = true
} else if (e.key === 'Escape') { } else if (e.key === 'Escape') {
showFind.value = false closeFind()
showZoomMenu.value = false showZoomMenu.value = false
} }
} }
@@ -292,6 +292,11 @@ function rotate() {
rotation.value = ((rotation.value + 90) % 360) as 0 | 90 | 180 | 270 rotation.value = ((rotation.value + 90) % 360) as 0 | 90 | 180 | 270
} }
function closeFind() {
showFind.value = false
findQuery.value = ''
}
// ── Find ────────────────────────────────────────────────────────────────────── // ── Find ──────────────────────────────────────────────────────────────────────
watch(findQuery, (q) => { watch(findQuery, (q) => {
if (!q.trim()) { if (!q.trim()) {
@@ -478,13 +483,7 @@ const progressPct = computed(() => (totalPages.value ? Math.round((currentPage.v
@keydown.escape="showFind = false" @keydown.escape="showFind = false"
/> />
<span v-if="findQuery" class="text-xs text-white/40 tabular-nums shrink-0">{{ findMatches }} match{{ findMatches !== 1 ? 'es' : '' }}</span> <span v-if="findQuery" class="text-xs text-white/40 tabular-nums shrink-0">{{ findMatches }} match{{ findMatches !== 1 ? 'es' : '' }}</span>
<button <button class="pdf-btn w-6 h-6" @click="closeFind">
class="pdf-btn w-6 h-6"
@click="
showFind = false
findQuery = ''
"
>
<X :size="12" /> <X :size="12" />
</button> </button>
</div> </div>
+4 -4
View File
@@ -5,28 +5,28 @@
{ {
"idx": 0, "idx": 0,
"version": "7", "version": "7",
"when": 1767183170461, "when": 1767351466197,
"tag": "0000_init_schema", "tag": "0000_init_schema",
"breakpoints": true "breakpoints": true
}, },
{ {
"idx": 1, "idx": 1,
"version": "7", "version": "7",
"when": 1767183170461, "when": 1767351466197,
"tag": "0001_lethal_pixie", "tag": "0001_lethal_pixie",
"breakpoints": true "breakpoints": true
}, },
{ {
"idx": 2, "idx": 2,
"version": "7", "version": "7",
"when": 1767183170461, "when": 1767351466197,
"tag": "0002_powerful_thundra", "tag": "0002_powerful_thundra",
"breakpoints": true "breakpoints": true
}, },
{ {
"idx": 3, "idx": 3,
"version": "7", "version": "7",
"when": 1767183170461, "when": 1767351466197,
"tag": "0003_reading_progress_by_file", "tag": "0003_reading_progress_by_file",
"breakpoints": true "breakpoints": true
} }