Skip to content

Commit c06ac59

Browse files
authored
Merge branch 'main' into fix/windows-pty-cmd-shims
2 parents 2cef80a + bdcf501 commit c06ac59

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

‎docs/content/1.guide/7.scoped-context.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Bare names stay typed: `call('get-modules')` resolves to your [RPC registry](/gu
4949

5050
`my.settings` is a persisted key-value store (alongside `my.rpc`), with two scopes:
5151

52-
- **`project`**: per-checkout values, under the `workspace` storage dir.
52+
- **`project`**: per-checkout values, under the `project` storage dir.
5353
- **`global`**: per-user values, under the `global` storage dir.
5454

5555
Both are file-backed and synced to the browser over the shared-state protocol; a `set` propagates to peers, surviving restarts.

‎packages/devframe/src/types/scope.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export interface DevframeSettingsStore<T extends Record<string, any> = Record<st
8282
/**
8383
* The two settings scopes available on a scoped context.
8484
*
85-
* - `project`: per-workspace state, persisted under the host's
86-
* `workspace` storage dir. Project-local settings.
85+
* - `project`: per-checkout state, persisted under the
86+
* `project` storage dir. Project-local settings.
8787
* - `global`: per-user state, persisted under the host's `global`
8888
* storage dir. Machine-wide preferences.
8989
*/

‎packages/hub-ui/src/client/state/keybindings.test.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { DevframeCommandEntry, DevframeCommandKeybinding } from '@devframes/hub'
22
import type { WhenContext } from 'devframe/utils/when'
33
import { describe, expect, it } from 'vitest'
4-
import { collectAllKeybindings, filterCommandsByWhen, findCommandDeep, findKeybindingConflict, getShortcutRows, walkCommands } from './keybindings'
4+
import { collectAllKeybindings, filterCommandsByWhen, findCommandDeep, findKeybindingConflict, getShortcutRows, normalizeKeyEvent, walkCommands } from './keybindings'
55

66
describe('findKeybindingConflict', () => {
77
const commands: DevframeCommandEntry[] = [
@@ -259,3 +259,17 @@ describe('filterCommandsByWhen', () => {
259259
expect(filterCommandsByWhen(withWhen, whenContext)).toEqual([])
260260
})
261261
})
262+
263+
describe('normalizeKeyEvent', () => {
264+
// Chrome's native autofill dispatches `keydown` events without `key`
265+
it('ignores key events without a key, like Chrome autofill', () => {
266+
const event = { ctrlKey: false, metaKey: false, altKey: false, shiftKey: false } as KeyboardEvent
267+
expect(() => normalizeKeyEvent(event)).not.toThrow()
268+
expect(normalizeKeyEvent(event)).toBe('')
269+
})
270+
271+
it('normalizes a regular shortcut', () => {
272+
const event = { key: 'k', ctrlKey: false, metaKey: false, altKey: false, shiftKey: true } as KeyboardEvent
273+
expect(normalizeKeyEvent(event)).toBe('Shift+K')
274+
})
275+
})

‎packages/hub-ui/src/client/state/keybindings.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function normalizeKeyEvent(e: KeyboardEvent): string {
3030
parts.push('Shift')
3131

3232
// Normalize key name
33-
let key = e.key
33+
let key = e.key ?? ''
3434
if (key.length === 1)
3535
key = key.toUpperCase()
3636

0 commit comments

Comments
 (0)