fix(defineShortcuts): bring back meta to ctrl convert on non macos platforms

Resolves #3869, resolves #3318

Co-Authored-By: Sylvain Marroufin <marroufin.sylvain@gmail.com>
This commit is contained in:
Benjamin Canac
2025-04-28 11:53:13 +02:00
parent bc0a296f9d
commit f3b8b17dc5
12 changed files with 341 additions and 331 deletions

View File

@@ -19,6 +19,7 @@ defineShortcuts({
</script>
```
- Shortcuts are automatically adjusted for non-macOS platforms, converting `meta` to `ctrl`.
- The composable uses VueUse's [`useEventListener`](https://vueuse.org/core/useEventListener/) to handle keydown events.
- For a complete list of available shortcut keys, refer to the [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values) API documentation. Note that the key should be written in lowercase.
@@ -46,7 +47,7 @@ Shortcuts are defined using the following format:
#### Modifiers
- `meta`: Represents `⌘ Command` on macOS and `⊞ Windows` on Windows
- `meta`: Represents `⌘ Command` on macOS and `Ctrl` on other platforms
- `ctrl`: Represents `Ctrl` on all platforms
- `shift`: Used for alphabetic keys when Shift is required

View File

@@ -32,7 +32,7 @@ props:
---
::
You can pass special keys to the `value` prop that goes through the [`useKbd`](https://github.com/nuxt/ui/blob/v3/src/runtime/composables/useKbd.ts) composable. For example, the `meta` key displays as `⌘` on macOS and `` on other platforms.
You can pass special keys to the `value` prop that goes through the [`useKbd`](https://github.com/nuxt/ui/blob/v3/src/runtime/composables/useKbd.ts) composable. For example, the `meta` key displays as `⌘` on macOS and `Ctrl` on other platforms.
::component-code
---