1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 23:40:07 +00:00

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
This commit is contained in:
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

View file

@ -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>