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:
@@ -14,6 +14,15 @@
|
||||
import { DEFAULT_SETTINGS, MIN_AUTOSAVE_SECONDS, MAX_AUTOSAVE_SECONDS, validAutosaveSeconds, type AppSettings } from "$lib/workspace/settings";
|
||||
import { license } from "../../../package.json";
|
||||
import { appVersion as version } from "../appVersion";
|
||||
import { COMMAND_LABELS, OTHER_SHORTCUTS, commandShortcut, shortcutKeys, type WorkbenchCommand } from "./workbenchKeys";
|
||||
import { isMac } from "$lib/ui/shortcuts";
|
||||
// Help lists every shortcut: the workbench commands, then the editor and file tree shortcuts.
|
||||
const shortcutSections = (() => {
|
||||
const general = (Object.keys(COMMAND_LABELS) as WorkbenchCommand[]).map(command => ({ label: COMMAND_LABELS[command], keys: commandShortcut(command) })).filter(item => item.keys);
|
||||
const others = new Map<string, { label: string; keys: string }[]>();
|
||||
for (const item of OTHER_SHORTCUTS) others.set(item.section, [...(others.get(item.section) ?? []), { label: item.label, keys: shortcutKeys(isMac() && item.macKeys ? item.macKeys : item.keys) }]);
|
||||
return [{ name: "General", items: general }, ...[...others].map(([name, items]) => ({ name, items }))];
|
||||
})();
|
||||
|
||||
let { settings, help = false, standalone = false, windowError = "", windowControls, onSave, onClose }: {
|
||||
settings: AppSettings;
|
||||
@@ -151,7 +160,7 @@
|
||||
<div class="interval"><input id="autosave-seconds" type="number" min={MIN_AUTOSAVE_SECONDS} max={MAX_AUTOSAVE_SECONDS} step="1" required disabled={!settings.autosaveEnabled} aria-describedby="interval-description" aria-invalid={!!error} bind:value={seconds} onchange={changeInterval} /><span>{$t("seconds")}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="note">{settings.autosaveEnabled ? $t("Only changed files are saved.") : $t("Auto-save is off. Use Ctrl+S to save your changes.")} {$t("Disk conflicts keep your edits for review.")}</p>
|
||||
<p class="note">{settings.autosaveEnabled ? $t("Only changed files are saved.") : $t("Auto-save is off. Use {shortcut} to save your changes.", { shortcut: commandShortcut("save") })} {$t("Disk conflicts keep your edits for review.")}</p>
|
||||
<div class="section-footer"><button class="text-button" onclick={() => { seconds = DEFAULT_SETTINGS.autosaveSeconds; apply({ ...DEFAULT_SETTINGS }); }}>{$t("Restore defaults")}</button><span>{$t("Default: every 5 seconds")}</span></div>
|
||||
{#if error}<p class="error" role="alert">{error}</p>{/if}
|
||||
<p class="saved" role="status">{message}</p>
|
||||
@@ -166,9 +175,14 @@
|
||||
{:else}
|
||||
<div class="brand"><img src="/runestone.svg" alt="" width="88" height="88" /><h2>RuneStone</h2><p>{$t("Version {version}", { version })}</p></div>
|
||||
<div class="card help-card">
|
||||
<details><summary><Icon icon="book-open" /> {$t("Get started")}</summary><div class="help-copy"><p>{$t("Use the folder button to open a workspace or create one. Your notes and scripts stay as ordinary files on disk.")}</p><p>{$t("Use the + beside the tabs for a new tab. Press Ctrl+N to create a file, or Ctrl+P to find one.")}</p><p>{$t("Press Ctrl+E to switch between writing and source editing. Use the terminal button to work with a shell beside your files.")}</p></div></details>
|
||||
<details><summary><Icon icon="save" /> {$t("Save your work")}</summary><div class="help-copy"><p>{$t("Auto-save saves changed files at the interval in Settings → General. Ctrl+S saves the active file immediately.")}</p><p>{$t("If another app changes a file, RuneStone keeps your edits and offers both versions for review.")}</p></div></details>
|
||||
<details><summary><Icon icon="code" /> {$t("Keyboard shortcuts")}</summary><dl><div><dt>{$t("Open a workspace")}</dt><dd><kbd>Ctrl+O</kbd></dd></div><div><dt>{$t("Find a file")}</dt><dd><kbd>Ctrl+P</kbd></dd></div><div><dt>{$t("Save the active file")}</dt><dd><kbd>Ctrl+S</kbd></dd></div><div><dt>{$t("Search the workspace")}</dt><dd><kbd>Ctrl+Shift+F</kbd></dd></div><div><dt>{$t("Open settings")}</dt><dd><kbd>Ctrl+,</kbd></dd></div><div><dt>{$t("Help and about")}</dt><dd><kbd>F1</kbd></dd></div></dl></details>
|
||||
<details><summary><Icon icon="book-open" /> {$t("Get started")}</summary><div class="help-copy"><p>{$t("Use the folder button to open a workspace or create one. Your notes and scripts stay as ordinary files on disk.")}</p><p>{$t("Use the + beside the tabs for a new tab. Press {newFile} to create a file, or {quickOpen} to find one.", { newFile: commandShortcut("new-file"), quickOpen: commandShortcut("quick-open") })}</p><p>{$t("Press {shortcut} to switch between writing and source editing. Use the terminal button to work with a shell beside your files.", { shortcut: commandShortcut("toggle-layout") })}</p></div></details>
|
||||
<details><summary><Icon icon="save" /> {$t("Save your work")}</summary><div class="help-copy"><p>{$t("Auto-save saves changed files at the interval in Settings → General. {shortcut} saves the active file immediately.", { shortcut: commandShortcut("save") })}</p><p>{$t("If another app changes a file, RuneStone keeps your edits and offers both versions for review.")}</p></div></details>
|
||||
<details open><summary><Icon icon="code" /> {$t("Keyboard shortcuts")}</summary>
|
||||
{#each shortcutSections as section (section.name)}
|
||||
<h3 class="shortcut-section">{$t(section.name)}</h3>
|
||||
<dl>{#each section.items as item (item.label)}<div><dt>{$t(item.label)}</dt><dd><kbd>{item.keys}</kbd></dd></div>{/each}</dl>
|
||||
{/each}
|
||||
</details>
|
||||
</div>
|
||||
<p class="about-note">{$t("RuneStone is under development. Maintained by kwyvern-gh.")}</p>
|
||||
{/if}
|
||||
@@ -233,6 +247,7 @@
|
||||
.help-copy p:first-child { margin-top: 0; }
|
||||
dl div { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0; }
|
||||
dd { margin: 0; }
|
||||
.shortcut-section { margin: 4px 0 0 28px; font-size: 12px; color: var(--rs-text-dim); text-transform: none; }
|
||||
kbd { font-family: var(--rs-font-mono); color: var(--rs-text-dim); }
|
||||
.about-note { text-align: center; margin: 20px 0 0; }
|
||||
@media (max-width: 660px) {
|
||||
|
||||
Reference in New Issue
Block a user