From 1a357bbd6acd8c77ef1dc92780047d1e6ed2cfdb Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Wed, 30 Sep 2026 22:43:05 +0530 Subject: [PATCH] feat(flowchart): keyboard shortcuts overlay (C19) After 17 commits of feature work the standalone window had a lot of hidden keyboard shortcuts (Cmd+Z, Cmd+C/V/D, Delete, Alt+drag, etc.) that no user could discover. This adds: - 'Shortcuts (?)' toolbar button next to Export Visio. - '?' key (or Shift+/) toggles the overlay; Esc closes it. - A read-only modal that lists every canvas-relevant shortcut in a 2-column table (Action / Shortcut) with tags for the key combos, styled to look like physical keys. - Click on the dimmed overlay backdrop also closes it. - Reuses the existing .fc-modal fade + scale-in animation. The overlay sits inside #fc-left so it overlays the canvas, not the side panel. Hidden by default via the HTML hidden attribute. Implementation: btnHelp / shortcutsModal / shortcutsOverlay / shortcutsClose are added to the bundle's els bag. A small showShortcutsOverlay / hideShortcutsOverlay pair toggles their .hidden. The keydown handler gets two new branches at the top: - Esc: close the overlay if open. - ? (computed from ev.key === '?' or 'Shift+/', no modifier keys held): toggle the overlay. Both branches return early so the existing Cmd+Z / Cmd+C / etc. handlers below them still work. Tests: 3 new (1386 total) covering the toolbar toggle, the ? + Esc keyboard flow, and that every shortcut the user can trigger is listed in the modal. Amit Haridas --- src/flowchart-generator.html | 125 +++++++++++++++++++++++++++++ src/renderer/flowchart-bundle.js | 43 +++++++++- tests/flowchart-controller.test.js | 47 +++++++++++ 3 files changed, 214 insertions(+), 1 deletion(-) diff --git a/src/flowchart-generator.html b/src/flowchart-generator.html index 7684cba..30d226f 100644 --- a/src/flowchart-generator.html +++ b/src/flowchart-generator.html @@ -256,6 +256,50 @@ opacity: 1; } } + /* v4.13.0 — keyboard shortcuts modal + kbd tags. The modal + reuses the existing .fc-modal animation; the table lays + out Action / Shortcut columns, with tags for the + key combos styled to look like physical keys. */ + .fc-shortcuts-modal { + max-width: 460px; + width: 90vw; + } + .fc-shortcuts-table { + width: 100%; + border-collapse: collapse; + margin: 12px 0 16px; + font-size: 0.9rem; + } + .fc-shortcuts-table th { + text-align: left; + font-weight: 600; + padding: 4px 0; + border-bottom: 1px solid var(--fc-border, #d1d5db); + color: #4b5563; + font-size: 0.75rem; + text-transform: uppercase; + letter-spacing: 0.05em; + } + .fc-shortcuts-table td { + padding: 6px 8px; + border-bottom: 1px solid #f3f4f6; + } + .fc-shortcuts-table td:last-child { + text-align: right; + white-space: nowrap; + } + kbd { + display: inline-block; + padding: 1px 6px; + font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace; + font-size: 0.78rem; + background: #f3f4f6; + border: 1px solid #d1d5db; + border-bottom-width: 2px; + border-radius: 3px; + color: #1f2937; + margin: 0 1px; + } /* v4.10.0 — preview-render info card explaining the layout */ .fc-preview-render-note { font-size: 0.75rem; @@ -394,6 +438,80 @@
+ + +