CI / Build & Quality Checks (pull_request) Successful in 4m3s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 24s
CI / Playwright smoke (e2e) (pull_request) Successful in 15m52s
The ? dialog showed 7 shortcuts and left out Ctrl+K, ↑ to edit, all composer formatting keys and the push-to-talk / deafen keys. Add them: formatting rows are generated from the editor's INLINE_HOTKEYS / BLOCK_HOTKEYS so they can't drift, and the call keys show the user's own bindings. Fixes #334 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { BlockType, MarkType } from '../../components/editor/types';
|
|
|
|
/** Pure: an is-hotkey string ('mod+b', "mod+'") as keycap labels. */
|
|
export const hotkeyKeys = (hotkey: string, modKey: string): string[] =>
|
|
hotkey.split('+').map((k) => (k === 'mod' ? modKey : k.length === 1 ? k.toUpperCase() : k));
|
|
|
|
/** Pure: a KeyboardEvent.code ('KeyM', 'Digit1', 'Space') as a keycap label. */
|
|
export const keyCodeLabel = (code: string | undefined): string => {
|
|
if (!code) return 'Not set';
|
|
if (/^Key[A-Z]$/.test(code)) return code.slice(3);
|
|
if (/^Digit\d$/.test(code)) return code.slice(5);
|
|
return code;
|
|
};
|
|
|
|
export const MARK_LABELS: Record<MarkType, string> = {
|
|
[MarkType.Bold]: 'Bold',
|
|
[MarkType.Italic]: 'Italic',
|
|
[MarkType.Underline]: 'Underline',
|
|
[MarkType.StrikeThrough]: 'Strikethrough',
|
|
[MarkType.Code]: 'Inline code',
|
|
[MarkType.Spoiler]: 'Spoiler',
|
|
};
|
|
|
|
export const BLOCK_LABELS: Partial<Record<BlockType, string>> = {
|
|
[BlockType.OrderedList]: 'Numbered list',
|
|
[BlockType.UnorderedList]: 'Bulleted list',
|
|
[BlockType.BlockQuote]: 'Quote',
|
|
[BlockType.CodeBlock]: 'Code block',
|
|
};
|