TMP: fix: change search shortcut not working as expected yet
This commit is contained in:
parent
bd8cfc7b57
commit
7ac81d55e9
@ -13,7 +13,7 @@ interface ShortcutDef {
|
|||||||
|
|
||||||
interface ShortcutItem {
|
interface ShortcutItem {
|
||||||
description: string
|
description: string
|
||||||
shortcut: ShortcutDef
|
shortcuts: ShortcutDef[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ShortcutItemGroup {
|
interface ShortcutItemGroup {
|
||||||
@ -30,63 +30,63 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.shortcut_help'),
|
description: t('magic_keys.groups.navigation.shortcut_help'),
|
||||||
shortcut: { keys: ['?'], isSequence: false },
|
shortcuts: [{ keys: ['?'], isSequence: false }],
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// description: t('magic_keys.groups.navigation.next_status'),
|
// description: t('magic_keys.groups.navigation.next_status'),
|
||||||
// shortcut: { keys: ['j'], isSequence: false },
|
// shortcuts: [{ keys: ['j'], isSequence: false }],
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// description: t('magic_keys.groups.navigation.previous_status'),
|
// description: t('magic_keys.groups.navigation.previous_status'),
|
||||||
// shortcut: { keys: ['k'], isSequence: false },
|
// shortcuts: [{ keys: ['k'], isSequence: false }],
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_search'),
|
description: t('magic_keys.groups.navigation.go_to_search'),
|
||||||
shortcut: { keys: ['/'], isSequence: false },
|
shortcuts: [{ keys: ['g', '/'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_home'),
|
description: t('magic_keys.groups.navigation.go_to_home'),
|
||||||
shortcut: { keys: ['g', 'h'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'h'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
||||||
shortcut: { keys: ['g', 'n'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'n'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_conversations'),
|
description: t('magic_keys.groups.navigation.go_to_conversations'),
|
||||||
shortcut: { keys: ['g', 'c'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'c'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_favourites'),
|
description: t('magic_keys.groups.navigation.go_to_favourites'),
|
||||||
shortcut: { keys: ['g', 'f'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'f'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_bookmarks'),
|
description: t('magic_keys.groups.navigation.go_to_bookmarks'),
|
||||||
shortcut: { keys: ['g', 'b'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'b'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_explore'),
|
description: t('magic_keys.groups.navigation.go_to_explore'),
|
||||||
shortcut: { keys: ['g', 'e'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'e'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_local'),
|
description: t('magic_keys.groups.navigation.go_to_local'),
|
||||||
shortcut: { keys: ['g', 'l'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'l'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_federated'),
|
description: t('magic_keys.groups.navigation.go_to_federated'),
|
||||||
shortcut: { keys: ['g', 't'], isSequence: true },
|
shortcuts: [{ keys: ['g', 't'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_lists'),
|
description: t('magic_keys.groups.navigation.go_to_lists'),
|
||||||
shortcut: { keys: ['g', 'i'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'i'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_settings'),
|
description: t('magic_keys.groups.navigation.go_to_settings'),
|
||||||
shortcut: { keys: ['g', 's'], isSequence: true },
|
shortcuts: [{ keys: ['g', 's'], isSequence: true }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.navigation.go_to_profile'),
|
description: t('magic_keys.groups.navigation.go_to_profile'),
|
||||||
shortcut: { keys: ['g', 'p'], isSequence: true },
|
shortcuts: [{ keys: ['g', 'p'], isSequence: true }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -95,34 +95,34 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.search'),
|
description: t('magic_keys.groups.actions.search'),
|
||||||
shortcut: { keys: [modifierKeyName.value, 'k'], isSequence: false },
|
shortcuts: [{ keys: [modifierKeyName.value, 'k'], isSequence: false }, { keys: ['/'], isSequence: false }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.command_mode'),
|
description: t('magic_keys.groups.actions.command_mode'),
|
||||||
shortcut: { keys: [modifierKeyName.value, '/'], isSequence: false },
|
shortcuts: [{ keys: [modifierKeyName.value, '/'], isSequence: false }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.compose'),
|
description: t('magic_keys.groups.actions.compose'),
|
||||||
shortcut: { keys: ['c'], isSequence: false },
|
shortcuts: [{ keys: ['c'], isSequence: false }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.show_new_items'),
|
description: t('magic_keys.groups.actions.show_new_items'),
|
||||||
shortcut: { keys: ['.'], isSequence: false },
|
shortcuts: [{ keys: ['.'], isSequence: false }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.favourite'),
|
description: t('magic_keys.groups.actions.favourite'),
|
||||||
shortcut: { keys: ['f'], isSequence: false },
|
shortcuts: [{ keys: ['f'], isSequence: false }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.boost'),
|
description: t('magic_keys.groups.actions.boost'),
|
||||||
shortcut: { keys: ['b'], isSequence: false },
|
shortcuts: [{ keys: ['b'], isSequence: false }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: t('magic_keys.groups.media.title'),
|
// name: t('magic_keys.groups.media.title'),
|
||||||
items: [],
|
// items: [],
|
||||||
},
|
// },
|
||||||
])
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -151,13 +151,16 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
|||||||
{{ item.description }}
|
{{ item.description }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<span v-for="(shortcut, shortcutIndex) in item.shortcuts" :key="shortcutIndex">
|
||||||
<template
|
<template
|
||||||
v-for="(key, idx) in item.shortcut.keys"
|
v-for="(key, idx) in shortcut.keys"
|
||||||
:key="idx"
|
:key="idx"
|
||||||
>
|
>
|
||||||
<span v-if="idx !== 0" mx1 text-sm op80>{{ item.shortcut.isSequence ? $t('magic_keys.sequence_then') : '+' }}</span>
|
<span v-if="shortcutIndex !== 0">, </span>
|
||||||
|
<span v-if="idx !== 0" mx1 text-sm op80>{{ shortcut.isSequence ? $t('magic_keys.sequence_then') : '+' }}</span>
|
||||||
<code class="px2 md:px1.5 lg:px2 lg:px2 py0 lg:py-0.5" rounded bg-code border="px $c-border-code" shadow-sm my1 font-mono font-600>{{ key }}</code>
|
<code class="px2 md:px1.5 lg:px2 lg:px2 py0 lg:py-0.5" rounded bg-code border="px $c-border-code" shadow-sm my1 font-mono font-600>{{ key }}</code>
|
||||||
</template>
|
</template>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import type { RouteLocationRaw } from 'vue-router'
|
import type { RouteLocationRaw } from 'vue-router'
|
||||||
import { useMagicSequence } from '~/composables/magickeys'
|
import { useMagicSequence } from '~/composables/magickeys'
|
||||||
import { currentUser, getInstanceDomain } from '~/composables/users'
|
import { currentUser, getInstanceDomain } from '~/composables/users'
|
||||||
|
import { openCommandPanel } from '~/composables/dialog'
|
||||||
|
|
||||||
export default defineNuxtPlugin(({ $scrollToTop }) => {
|
export default defineNuxtPlugin(({ $scrollToTop }) => {
|
||||||
const keys = useMagicKeys()
|
const keys = useMagicKeys()
|
||||||
@ -34,7 +35,7 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
|
|||||||
openPublishDialog('dialog', getDefaultDraftItem())
|
openPublishDialog('dialog', getDefaultDraftItem())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
whenever(logicAnd(isAuthenticated, notUsingInput, keys.c), defaultPublishDialog)
|
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['c'])), defaultPublishDialog)
|
||||||
|
|
||||||
const instanceDomain = currentInstance.value ? getInstanceDomain(currentInstance.value) : 'm.webtoo.ls'
|
const instanceDomain = currentInstance.value ? getInstanceDomain(currentInstance.value) : 'm.webtoo.ls'
|
||||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 'h'])), () => navigateTo('/home'))
|
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 'h'])), () => navigateTo('/home'))
|
||||||
@ -49,7 +50,8 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
|
|||||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'i'])), () => navigateTo('/lists'))
|
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'i'])), () => navigateTo('/lists'))
|
||||||
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 's'])), () => navigateTo('/settings'))
|
whenever(logicAnd(notUsingInput, useMagicSequence(['g', 's'])), () => navigateTo('/settings'))
|
||||||
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'p'])), () => navigateTo(`/${instanceDomain}/@${currentUser.value?.account.username}`))
|
whenever(logicAnd(isAuthenticated, notUsingInput, useMagicSequence(['g', 'p'])), () => navigateTo(`/${instanceDomain}/@${currentUser.value?.account.username}`))
|
||||||
whenever(logicAnd(notUsingInput, computed(() => keys.current.size === 1), keys['/']), () => navigateTo('/search'))
|
whenever(logicAnd(notUsingInput, useMagicSequence(['g', '/'])), () => navigateTo('/search'))
|
||||||
|
whenever(logicAnd(notUsingInput, useMagicSequence(['/'])), () => openCommandPanel())
|
||||||
|
|
||||||
const toggleFavouriteActiveStatus = () => {
|
const toggleFavouriteActiveStatus = () => {
|
||||||
// TODO: find a better solution than clicking buttons...
|
// TODO: find a better solution than clicking buttons...
|
||||||
|
Loading…
Reference in New Issue
Block a user