File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -283,6 +283,7 @@ onDeactivated(() => {
283
283
flex max-w-full
284
284
:class =" shouldExpanded ? 'min-h-30 md:max-h-[calc(100vh-200px)] sm:max-h-[calc(100vh-400px)] max-h-35 of-y-auto overscroll-contain' : ''"
285
285
@keydown =" stopQuestionMarkPropagation"
286
+ @keydown.esc.prevent =" editor?.commands.blur()"
286
287
/>
287
288
</div >
288
289
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ function activate() {
82
82
placeholder-text-secondary
83
83
@keydown.down.prevent =" shift(1)"
84
84
@keydown.up.prevent =" shift(-1)"
85
+ @keydown.esc.prevent =" input?.blur()"
85
86
@keypress.enter =" activate"
86
87
>
87
88
<button v-if =" query.length" btn-action-icon text-secondary @click =" query = ''; input?.focus()" >
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
+ const keys = useMagicKeys ()
2
3
const { t } = useI18n ()
4
+
3
5
useHydratedHead ({
4
6
title : () => t (' nav.search' ),
5
7
})
6
8
7
9
const search = ref <{ input? : HTMLInputElement }>()
10
+
8
11
watchEffect (() => {
9
12
if (search .value ?.input )
10
13
search .value ?.input ?.focus ()
11
14
})
12
- onActivated (() =>
13
- search .value ?.input ?.focus (),
14
- )
15
+ onActivated (() => search .value ?.input ?.focus ())
15
16
onDeactivated (() => search .value ?.input ?.blur ())
17
+
18
+ watch (keys [' /' ], (v ) => {
19
+ // focus on input when '/' is up to avoid '/' being typed
20
+ if (! v )
21
+ search .value ?.input ?.focus ()
22
+ })
16
23
</script >
17
24
18
25
<template >
You can’t perform that action at this time.
0 commit comments