Keyboard sort by 1-2-3 supplemented by the key left of them for default sort.
This commit is contained in:
parent
e20b04189f
commit
07c2ff4c15
|
@ -21,6 +21,7 @@ import { useMainStore } from '@/stores/main'
|
||||||
|
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import Router from '@/router/index'
|
import Router from '@/router/index'
|
||||||
|
import type { SortOrder } from './utils/docsort'
|
||||||
|
|
||||||
interface Path {
|
interface Path {
|
||||||
path: string
|
path: string
|
||||||
|
@ -102,9 +103,9 @@ const globalShortcutHandler = (event: KeyboardEvent) => {
|
||||||
else if (
|
else if (
|
||||||
!input &&
|
!input &&
|
||||||
keyup &&
|
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
|
// Rename
|
||||||
else if (c && keyup && !event.ctrlKey && (event.key === 'F2' || event.key === 'r')) {
|
else if (c && keyup && !event.ctrlKey && (event.key === 'F2' || event.key === 'r')) {
|
||||||
|
|
|
@ -79,6 +79,10 @@ export const useMainStore = defineStore({
|
||||||
if (this.query) this.prefs.sortFiltered = this.prefs.sortFiltered === name ? '' : name
|
if (this.query) this.prefs.sortFiltered = this.prefs.sortFiltered === name ? '' : name
|
||||||
else this.prefs.sortListing = this.prefs.sortListing === 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: {
|
getters: {
|
||||||
sortOrder(): SortOrder { return this.query ? this.prefs.sortFiltered : this.prefs.sortListing },
|
sortOrder(): SortOrder { return this.query ? this.prefs.sortFiltered : this.prefs.sortListing },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user