Skip to content

Commit

Permalink
fix: use "⌘" as modifier key name on macOS (#1506)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
shuuji3 authored Jan 29, 2023
1 parent fda85e3 commit e197a1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/command/CommandPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down Expand Up @@ -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>

0 comments on commit e197a1d

Please sign in to comment.