add keyboard shortcuts and guide
- User
add keyboard shortcuts and guide
Assistant
add keyboard shortcuts and guide
Let me first understand the current keyboard handling and then build a comprehensive shortcut system with a visual guide.
Now let me see the full Editor return to know where to add the shortcut overlay toggle and the bottom bar:
Now let me look at the bottom bar:
Now I have a full picture. I'll:
? or Ctrl+/Now replace the entire keyboard handler with the comprehensive version:
I need to add the zoomToFit function. Let me add it right after redo:
Now add the shortcut guide overlay and the toggle in the bottom bar. First, let me add the ShortcutsGuide component and insert it into the Editor render. Let me find where the bottom bar and file input are rendered:
Now update BottomStatusBar to accept onShowShortcuts:
Now create the ShortcutsGuide component. Let me add it right before the final export default App line:
Now let me add the scroll style and keyboard hint to the info banner. Let me update the CSS for the custom scroll class and ensure the canvas-grid is still correct:
Now update the canvas info banner to show the shortcut hint:
Now update index.html title:
Let me also verify the createFrame function is referenced properly inside the shortcut handler — let me check it compiled without the dependency warning:
Build is clean. Let me also quickly verify the locked-layer second case (text element) rendered correctly:
I see the text element lock badge still uses -inset-1 and -top-6 (the old overflow approach). Let me fix that one to match the shape approach:
Build successful. Here's everything that was added:
General
| Shortcut | Action |
|---|---|
? or Ctrl / | Toggle shortcuts guide |
Escape | Deselect / close panel / exit text editing |
Tab | Cycle to next layer |
Shift Tab | Cycle to previous layer |
Ctrl Shift T | Toggle dark / light theme |
Canvas & Zoom
| Shortcut | Action |
|---|---|
Scroll wheel | Zoom in/out |
Shift + drag / Middle-mouse drag | Pan canvas |
Ctrl + / Ctrl − | Zoom in / out |
Ctrl 0 | Zoom to 100% |
Ctrl 1 | Zoom to fit all content |
Ctrl ' or Ctrl G | Toggle smart alignment guides |
Quick Create (single key)
| Key | Creates |
|---|---|
R | Rounded rectangle |
O | Circle |
L | Line |
T | Text box |
F | New frame (1200×800) |
Selection & Editing
| Shortcut | Action |
|---|---|
Enter | Edit selected text inline |
Arrow keys | Nudge 1px |
Shift + Arrow | Nudge 10px |
Ctrl C/V/D | Copy / Paste / Duplicate |
Delete / Backspace | Delete (respects lock) |
Ctrl V (image) | Paste clipboard image into shape |
Layers & Locking
| Shortcut | Action |
|---|---|
Ctrl L | Lock / unlock selected |
Ctrl H | Hide / show selected |
] / [ | Move layer up / down |
Shift ] / Shift [ | Bring to front / send to back |
kbd rendering? key, Ctrl /, canvas button, or bottom status bar button?, Escape, or clicking outsideR O L T F = quick shapes and a ? Shortcuts button? Shortcuts buttonFiles built: src/App.tsx, src/index.css, index.html