Keyboard nav: 1/2/3 globally toggle table ordering. Esc closes search, slash also toggles search like Ctrl/Cmd+F does.
This commit is contained in:
parent
c5c65d136a
commit
520a9dff47
|
@ -51,6 +51,7 @@ const globalShortcutHandler = (event: KeyboardEvent) => {
|
||||||
const fileExplorer = store.fileExplorer as any
|
const fileExplorer = store.fileExplorer as any
|
||||||
if (!fileExplorer) return
|
if (!fileExplorer) return
|
||||||
const c = fileExplorer.isCursor()
|
const c = fileExplorer.isCursor()
|
||||||
|
const input = (event.target as HTMLElement).tagName === 'INPUT'
|
||||||
const keyup = event.type === 'keyup'
|
const keyup = event.type === 'keyup'
|
||||||
if (event.repeat) {
|
if (event.repeat) {
|
||||||
if (
|
if (
|
||||||
|
@ -70,13 +71,21 @@ const globalShortcutHandler = (event: KeyboardEvent) => {
|
||||||
else if (!keyup && event.key === 'f' && (event.ctrlKey || event.metaKey)) {
|
else if (!keyup && event.key === 'f' && (event.ctrlKey || event.metaKey)) {
|
||||||
headerMain.value!.toggleSearchInput()
|
headerMain.value!.toggleSearchInput()
|
||||||
}
|
}
|
||||||
|
// Search also on / (UNIX style)
|
||||||
|
else if (keyup && !input && event.key === '/') {
|
||||||
|
headerMain.value!.toggleSearchInput()
|
||||||
|
}
|
||||||
|
// Globally close search on Escape
|
||||||
|
else if (keyup && event.key === 'Escape') {
|
||||||
|
headerMain.value!.closeSearch(event)
|
||||||
|
}
|
||||||
// Select all (toggle); keydown to prevent builtin
|
// Select all (toggle); keydown to prevent builtin
|
||||||
else if (!keyup && event.key === 'a' && (event.ctrlKey || event.metaKey)) {
|
else if (!keyup && event.key === 'a' && (event.ctrlKey || event.metaKey)) {
|
||||||
fileExplorer.toggleSelectAll()
|
fileExplorer.toggleSelectAll()
|
||||||
}
|
}
|
||||||
// Keys 1-3 to sort columns
|
// Keys 1-3 to sort columns
|
||||||
else if (
|
else if (
|
||||||
c &&
|
!input &&
|
||||||
keyup &&
|
keyup &&
|
||||||
(event.key === '1' || event.key === '2' || event.key === '3')
|
(event.key === '1' || event.key === '2' || event.key === '3')
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
@input="updateSearch"
|
@input="updateSearch"
|
||||||
placeholder="Search words"
|
placeholder="Search words"
|
||||||
class="margin-input"
|
class="margin-input"
|
||||||
@keyup.escape="closeSearch"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<SvgButton ref="searchButton" name="find" @click.prevent="toggleSearchInput" />
|
<SvgButton ref="searchButton" name="find" @click.prevent="toggleSearchInput" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user