Add the command palette, Write formatting keys, and platform labels

Phase 5-2.

- Ctrl+Shift+P opens the command palette: every workbench command with
  its shortcut, then the plugin commands (UI-048).
- In Write, Ctrl+B, Ctrl+I, Ctrl+Shift+X, and Ctrl+Shift+H format the
  selection, and Ctrl+K inserts a Markdown link. The Format menu shows
  these shortcuts.
- Ctrl+\ toggles the side pane. It matches the physical key on every
  keyboard layout. Ctrl+B now belongs to Write.
- Help lists every shortcut in groups, open by default. The list comes
  from the command table.
- src/lib/ui/shortcuts.ts writes shortcut labels for the platform:
  Ctrl+Shift+P on Windows and Linux, and the macOS symbols on a Mac.
  The catalog uses placeholders, so no translation contains "Ctrl".
- 19 new catalog rows, and 10 rows converted to placeholders, in
  French, Japanese, and Simplified Chinese.
- Docs: UI-048, the user guide keyboard tables, and a label rule in
  ui-design.md.

New tests: layout/commands, tests/unit/ui/shortcuts.spec.ts, and new
cases in workbenchKeys.spec.ts. Tests that read the old labels or
pressed Ctrl+B for the side pane now use the new names and Ctrl+\.

The smoke harness raises the resource timing buffer to 5000 entries.
The new modules pushed the CodeMirror language module past the
default 250 entries, so editor/markdownPaste could not find its URL.
This commit is contained in:
Knotty Wyvern
2026-10-28 19:10:25 -07:00
parent b2348d0fe8
commit ebacdb8164
48 changed files with 506 additions and 125 deletions
+4 -2
View File
@@ -10,6 +10,8 @@ import { documentLinkAt } from "./documentLinks";
import { linkMenuItems, type DocumentLinkActions } from "./linkMenu";
import { htmlToMarkdown } from "../workspace/htmlToMarkdown";
import { cellFormats, type TableContextActions } from "./tableCellActions";
import { FORMAT_KEYS, LINK_KEY } from "./formatKeys";
import { keys } from "../ui/shortcuts";
import { formatText, insertBlock, paragraphText, replacement, type MarkdownEdit, type TextSelection, type ParagraphStyle, type InsertBlock } from "./markdownCommands";
export type MarkdownMenuEditor = {
@@ -89,7 +91,7 @@ export function markdownMenu(editor: MarkdownMenuEditor, actions: TableContextAc
}), { separator: true as const }] : []),
...(editor.undo ? historyItems({ canUndo: !!editor.canUndo?.(), canRedo: !!editor.canRedo?.(), undo: () => editor.undo?.(), redo: () => editor.redo?.() }) : []),
{ label: tr("Add link"), icon: "link", run: () => link(false) },
{ label: tr("Add external link"), icon: "external", run: () => link(true) },
{ label: tr("Add external link"), icon: "external", shortcut: keys(LINK_KEY), run: () => link(true) },
{ separator: true },
searchItem(text, actions.onSearch),
{ label: tr("Extract current selection…"), icon: "extract", disabled: !text || !actions.onExtract, run: () => void request(async () => {
@@ -98,7 +100,7 @@ export function markdownMenu(editor: MarkdownMenuEditor, actions: TableContextAc
}) },
{ label: tr("Format"), icon: "format", children: cellFormats.flatMap(([label, kind]) => [
...(kind === "code" || kind === "clear" ? [{ separator: true } as const] : []),
{ label: tr(label), icon: kind, disabled: kind === "clear" && !text, run: () => apply(formatText(source, selection, kind)) },
{ label: tr(label), icon: kind, ...(FORMAT_KEYS[kind] ? { shortcut: keys(FORMAT_KEYS[kind]) } : {}), disabled: kind === "clear" && !text, run: () => apply(formatText(source, selection, kind)) },
]) },
{ label: tr("Paragraph"), icon: "paragraph", children: [
paragraph(tr("Bullet list"), "bullet", "bullet"), paragraph(tr("Numbered list"), "number", "number"), paragraph(tr("Task list"), "task", "task"),