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
zio/stable
TAKAHASHI Shuuji 2023-01-29 16:41:42 +09:00 committed by GitHub
parent fda85e31bc
commit e197a1dbe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

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