diff --git a/docs/design-decisions.md b/docs/design-decisions.md index e906475..a55e432 100644 --- a/docs/design-decisions.md +++ b/docs/design-decisions.md @@ -903,3 +903,18 @@ Native shell, background image, and desktop acceptance remain open. - Evidence: `tests/smoke/appearance/themeEditor.smoke.mjs` and `tests/unit/theme/themeEditor.spec.ts`. Screenshots are in `output/phase-5a/5a-5/` in the main checkout. - Replaces / replaced by: The theme choice in the action menu rule of "Choice lists and pickers". Other short choices stay in the action menu. - Limits: The editor changes colors, not fonts. Browser checks use desktop service mocks. Native desktop acceptance remains open. + +### UI-048 — Command palette, formatting shortcuts, and platform labels + +- Type: Rule change +- Date: 2026-10-28 +- Status: Implemented for user review +- Decision source: Owner decisions 2, 7 (shortcut labels), and 10 of 2026-10-27 (interface review issues 2, 15, and 22), stage 5-2. +- Previous rule: Ctrl+B toggled the sidebar, so Writer had no Ctrl+B, Ctrl+I, or Ctrl+K. Formatting needed the context menu. Interface text wrote "Ctrl" in three styles ("Ctrl T", "Ctrl+T", "Ctrl N"). Help listed 6 shortcuts in a closed section, and no command list existed. +- New rule: In Writer, 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+\ (the physical key on every layout) toggles the sidebar. Ctrl+Shift+P opens the command palette: every workbench command with its shortcut, then the plugin commands. Help lists every shortcut in groups, open by default. `src/lib/ui/shortcuts.ts` writes each shortcut label for the platform, and the catalog uses placeholders. +- Reason: A writing app needs the common formatting keys. A shortcut that a user cannot find does not help. +- Scope: The workbench, Writer, Help, the menus, the tooltips, and the catalog. +- Shared implementation: `workbenchKeys.ts` (labels, `commandShortcut`, and the Help list), `shortcuts.ts`, `CommandPalette.svelte`, `formatKeys.ts`, and `SettingsDialog.svelte`. +- Evidence: `tests/smoke/layout/commands.smoke.mjs`, `tests/unit/ui/shortcuts.spec.ts`, and `tests/unit/layout/workbenchKeys.spec.ts`. +- Replaces / replaced by: The Ctrl+B sidebar shortcut in the user guide. +- Limits: The macOS labels are tested as unit cases, not on a Mac. Browser checks use desktop service mocks. diff --git a/docs/ui-design.md b/docs/ui-design.md index 1d39887..e780a63 100644 --- a/docs/ui-design.md +++ b/docs/ui-design.md @@ -105,6 +105,7 @@ Use one menu design for context menus, action menus, and their submenus in the h - A menu with only text choices omits the icon column. A mixed menu reserves the icon column on every row. - Shortcut text and submenu arrows use separate trailing columns. - A common text action has the same label, icon, and shortcut in every menu. Build Undo, Redo, the clipboard rows, and the search row with `menuItems.ts`. +- Write shortcut labels with `src/lib/ui/shortcuts.ts`: `keys("Mod+Shift+P")` gives Ctrl+Shift+P on Windows and Linux and ⇧⌘P on macOS. A workbench command takes its label from `commandShortcut()` in `workbenchKeys.ts`. Do not write "Ctrl" in interface text or in the catalog. Use a placeholder. - Use inset separators between related groups. - Enabled rows share one hover fill and one keyboard focus fill. - Disabled rows stay readable. Keyboard navigation skips them, and they do not run. diff --git a/docs/user-guide.md b/docs/user-guide.md index dced578..3a00254 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -42,7 +42,8 @@ To show workspace settings and plugin data in the navigator, turn on **Settings | Find a file by path | Press Ctrl+P. | | Search all files | Press Ctrl+Shift+F. | | Find in the document | Press Ctrl+F. | -| Show or hide the sidebar | Press Ctrl+B. | +| Show or hide the sidebar | Press Ctrl+\. | +| Find a command | Press Ctrl+Shift+P, type part of the command name, and press Enter. The list also shows each shortcut and the plugin commands. | | Rename | Select an item in the navigator and press F2. RuneStone selects the name without the extension. | | Move | Drag files between folders. | | Bookmark | Right-click a file and choose **Bookmark**. The Bookmarks pane lists it. | @@ -103,6 +104,14 @@ Right-click Markdown text, or press Shift+F10, to open the context menu. Use the | Menu | Actions | | --- | --- | | Format | Bold, italic, strikethrough, highlight, code, math, comment, and clear formatting | + +In Writer, these shortcuts format the selected text: + +| Format | Shortcut | +| --- | --- | +| Bold / Italic | Ctrl+B / Ctrl+I | +| Strikethrough / Highlight | Ctrl+Shift+X / Ctrl+Shift+H | +| Link (`[text]()`, with the cursor in the address) | Ctrl+K | | Paragraph | Bulleted and numbered lists, tasks, headings 1–6, body text, and quotes | | Insert | Footnotes, tables, callouts, horizontal rules, code blocks, and math blocks | @@ -200,10 +209,11 @@ To open web links from your documents in your system browser instead, turn off * ## Keyboard reference -This table lists the Windows and Linux keys. +This table lists the Windows and Linux keys. On macOS, Cmd replaces Ctrl, and RuneStone shows the macOS symbols, such as ⇧⌘P. Help lists every shortcut. | Action | Shortcut | | --- | --- | +| Find a command | Ctrl+Shift+P | | Open a workspace | Ctrl+O | | Find a file / New file | Ctrl+P / Ctrl+N | | New tab / Close tab | Ctrl+T / Ctrl+W | @@ -213,7 +223,9 @@ This table lists the Windows and Linux keys. | Find in document / Search workspace | Ctrl+F / Ctrl+Shift+F | | Switch Writer and IDE | Ctrl+E | | Nest a list item / Move it up | Tab / Shift+Tab | -| Show or hide the sidebar | Ctrl+B | +| Bold / Italic / Link (Writer) | Ctrl+B / Ctrl+I / Ctrl+K | +| Strikethrough / Highlight (Writer) | Ctrl+Shift+X / Ctrl+Shift+H | +| Show or hide the sidebar | Ctrl+\ | | Rename | F2 | | Delete to the trash / Delete permanently | Delete / Shift+Delete | | Context menu | Shift+F10 | @@ -230,6 +242,6 @@ The [Terminal guide](guides/terminal.md) lists the terminal shortcuts. ## Get help -Press F1, or select the question mark at the bottom of the sidebar, for **Help and about**. It shows the app version, basic steps, and shortcuts. +Press F1, or select the question mark at the bottom of the sidebar, for **Help and about**. It shows the app version, basic steps, and every shortcut. When you report a problem, include the app version, operating system, steps, expected result, and error text. diff --git a/src/lib/browser/Browser.svelte b/src/lib/browser/Browser.svelte index 2acecdb..2a864e1 100644 --- a/src/lib/browser/Browser.svelte +++ b/src/lib/browser/Browser.svelte @@ -1,5 +1,6 @@ + + + + { + const bounds = dialog.getBoundingClientRect(); + if (event.target === dialog && (event.clientX < bounds.left || event.clientX > bounds.right || event.clientY < bounds.top || event.clientY > bounds.bottom)) onClose(); +}} oncancel={onClose}> + selected = 0} aria-label={$t("Find a command")} placeholder={$t("Find a command…")} + aria-controls="command-results" aria-activedescendant={matches.length ? `command-${selected}` : undefined} onkeydown={(event) => { + if (event.key === "ArrowDown" || event.key === "ArrowUp") { + event.preventDefault(); selected = Math.max(0, Math.min(matches.length - 1, selected + (event.key === "ArrowDown" ? 1 : -1))); + dialog.querySelector(`[data-index="${selected}"]`)?.scrollIntoView({ block: "nearest" }); + } + if (event.key === "Enter") { event.preventDefault(); pick(matches[selected]); } + }} /> +
+ {#each matches as command, index (command.id)} + + {/each} + {#if !matches.length}

{$t("No matching commands.")}

{/if} +
+ +
+ + diff --git a/src/lib/layout/EditorPane.svelte b/src/lib/layout/EditorPane.svelte index 04150aa..b2a9302 100644 --- a/src/lib/layout/EditorPane.svelte +++ b/src/lib/layout/EditorPane.svelte @@ -1,5 +1,6 @@