fix: use "⌘" as modifier key name on macOS (#1506)

* fix: use 'Command' as modifier key name on macOS

* fix: use more reliable `useIsMac()` instead of `userAgentData`

* refactor: apply suggestion from @userquin

* fix: use `⌘` as Command key symbol
pull/1514/head
TAKAHASHI Shuuji 2023-01-29 16:41:42 +09:00 zatwierdzone przez GitHub
rodzic fda85e31bc
commit e197a1dbe9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -64,6 +64,9 @@ const result = $computed<QueryResult>(() => commandMode
: searchResult,
)
const isMac = useIsMac()
const modifierKeyName = $computed(() => isMac.value ? '⌘' : 'Ctrl')
let active = $ref(0)
watch($$(result), (n, o) => {
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
@ -233,8 +236,8 @@ const onKeyDown = (e: KeyboardEvent) => {
<!-- Footer -->
<div class="flex items-center px-3 py-1 text-xs">
<div i-ri:lightbulb-flash-line /> Tip: Use
<CommandKey name="Ctrl+K" /> to search,
<CommandKey name="Ctrl+/" /> to activate command mode.
<CommandKey :name="`${modifierKeyName}+K`" /> to search,
<CommandKey :name="`${modifierKeyName}+/`" /> to activate command mode.
</div>
</div>
</template>