diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 47d57cb..c34510e 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -21,6 +21,7 @@ import { useMainStore } from '@/stores/main' import { computed } from 'vue' import Router from '@/router/index' +import type { SortOrder } from './utils/docsort' interface Path { path: string @@ -102,9 +103,9 @@ const globalShortcutHandler = (event: KeyboardEvent) => { else if ( !input && keyup && - (event.key === '1' || event.key === '2' || event.key === '3') + (event.code === 'Backquote' || event.key === '1' || event.key === '2' || event.key === '3') ) { - fileExplorer.toggleSortColumn(+event.key) + store.sort(['', 'name', 'modified', 'size'][+event.key || 0] as SortOrder) } // Rename else if (c && keyup && !event.ctrlKey && (event.key === 'F2' || event.key === 'r')) { diff --git a/frontend/src/stores/main.ts b/frontend/src/stores/main.ts index 2fa29d6..5dcc671 100644 --- a/frontend/src/stores/main.ts +++ b/frontend/src/stores/main.ts @@ -79,6 +79,10 @@ export const useMainStore = defineStore({ if (this.query) this.prefs.sortFiltered = this.prefs.sortFiltered === name ? '' : name else this.prefs.sortListing = this.prefs.sortListing === name ? '' : name }, + sort(name: SortOrder | '') { + if (this.query) this.prefs.sortFiltered = name + else this.prefs.sortListing = name + }, }, getters: { sortOrder(): SortOrder { return this.query ? this.prefs.sortFiltered : this.prefs.sortListing },