perf: support `F5`/`Cmd+R` to refresh selected key in key tree view
This commit is contained in:
parent
78bfaf6e16
commit
3c43f960c3
|
@ -135,7 +135,7 @@ const onKeyShortcut = (e) => {
|
|||
return
|
||||
|
||||
case 'd':
|
||||
if (e.metaKey) {
|
||||
if (e.metaKey && isMacOS()) {
|
||||
onDelete()
|
||||
}
|
||||
return
|
||||
|
|
|
@ -26,6 +26,7 @@ import RedisTypeTag from '@/components/common/RedisTypeTag.vue'
|
|||
import usePreferencesStore from 'stores/preferences.js'
|
||||
import { typesIconStyle } from '@/consts/support_redis_type.js'
|
||||
import { nativeRedisKey } from '@/utils/key_convert.js'
|
||||
import { isMacOS } from '@/utils/platform.js'
|
||||
|
||||
const props = defineProps({
|
||||
server: String,
|
||||
|
@ -332,6 +333,44 @@ const handleKeyCopy = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const onKeyShortcut = (e) => {
|
||||
switch (e.key) {
|
||||
case 'ArrowUp':
|
||||
handleKeyUp()
|
||||
break
|
||||
case 'ArrowDown':
|
||||
handleKeyDown()
|
||||
break
|
||||
case 'ArrowLeft':
|
||||
handleKeyLeft()
|
||||
break
|
||||
case 'ArrowRight':
|
||||
handleKeyRight()
|
||||
break
|
||||
case 'c':
|
||||
if (e.metaKey) {
|
||||
handleKeyCopy()
|
||||
}
|
||||
break
|
||||
case 'Delete':
|
||||
handleKeyDelete()
|
||||
break
|
||||
case 'd':
|
||||
if (e.metaKey && isMacOS()) {
|
||||
handleKeyDelete()
|
||||
}
|
||||
break
|
||||
case 'F5':
|
||||
handleSelectContextMenu('value_reload')
|
||||
break
|
||||
case 'r':
|
||||
if (e.metaKey && isMacOS()) {
|
||||
handleSelectContextMenu('value_reload')
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const handleSelectContextMenu = (action) => {
|
||||
contextMenuParam.show = false
|
||||
const selectedKey = get(selectedKeys.value, 0)
|
||||
|
@ -804,12 +843,7 @@ defineExpose({
|
|||
class="fill-height"
|
||||
virtual-scroll
|
||||
:keyboard="false"
|
||||
@keydown.up="handleKeyUp"
|
||||
@keydown.down="handleKeyDown"
|
||||
@keydown.left="handleKeyLeft"
|
||||
@keydown.right="handleKeyRight"
|
||||
@keydown.delete="handleKeyDelete"
|
||||
@keydown.meta.c="handleKeyCopy"
|
||||
@keydown="onKeyShortcut"
|
||||
@update:selected-keys="onUpdateSelectedKeys"
|
||||
@update:expanded-keys="onUpdateExpanded"
|
||||
@update:checked-keys="onUpdateCheckedKeys">
|
||||
|
|
Loading…
Reference in New Issue