File tree Expand file tree Collapse file tree
shared/types/renderer/composable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,6 +187,13 @@ const fileMenu: MenuItemConstructorOptions[] = [
187187 click : ( ) => {
188188 BrowserWindow . getFocusedWindow ( ) ?. webContents . send ( 'main-menu:new-folder' )
189189 }
190+ } ,
191+ {
192+ label : 'Find' ,
193+ accelerator : 'CommandOrControl+F' ,
194+ click : ( ) => {
195+ BrowserWindow . getFocusedWindow ( ) ?. webContents . send ( 'main-menu:search' )
196+ }
190197 }
191198]
192199
Original file line number Diff line number Diff line change @@ -127,6 +127,10 @@ ipc.on('main-menu:copy-snippet', () => {
127127ipc .on (' main-menu:format-snippet' , () => {
128128 emitter .emit (' snippet:format' , true )
129129})
130+
131+ ipc .on (' main-menu:search' , () => {
132+ emitter .emit (' search:focus' , true )
133+ })
130134 </script >
131135
132136<style lang="scss">
Original file line number Diff line number Diff line change 22 <div class =" action" >
33 <UniconsSearch />
44 <input
5+ ref =" inputRef"
56 v-model =" query"
67 placeholder =" Search..."
78 >
2324</template >
2425
2526<script setup lang="ts">
26- import { onAddNewSnippet } from ' @/composable'
27+ import { emitter , onAddNewSnippet } from ' @/composable'
2728import { useSnippetStore } from ' @/store/snippets'
2829import { useDebounceFn } from ' @vueuse/core'
29- import { computed } from ' vue'
30+ import { computed , ref } from ' vue'
3031import { track } from ' @/electron'
3132
3233const snippetStore = useSnippetStore ()
3334
35+ const inputRef = ref <HTMLInputElement >()
36+
3437const query = computed ({
3538 get : () => snippetStore .searchQuery ,
3639 set: useDebounceFn (v => {
@@ -45,6 +48,10 @@ const onReset = () => {
4548 snippetStore .searchQuery = undefined
4649 snippetStore .setSnippetsByAlias (' all' )
4750}
51+
52+ emitter .on (' search:focus' , () => {
53+ inputRef .value ?.focus ()
54+ })
4855 </script >
4956
5057<style lang="scss" scoped>
@@ -62,6 +69,7 @@ const onReset = () => {
6269 padding : 0 var (--spacing-xs );
6370 height : 24px ;
6471 background-color : var (--color-snippet-list );
72+ color : var (--color-text );
6573 }
6674 :deep (svg ) {
6775 flex-shrink : 0 ;
Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ export type EmitterEvents = {
44 'folder:click' : any
55 'folder:rename' : string
66 'scroll-to:folder' : string
7+ 'search:focus' : boolean
78}
You can’t perform that action at this time.
0 commit comments