Skip to content

Vps 16 add keyboards shortcuts to the editor#403

Open
FridgeProtector1 wants to merge 7 commits into
masterfrom
vps-16-add-keyboards-shortcuts-to-the-editor
Open

Vps 16 add keyboards shortcuts to the editor#403
FridgeProtector1 wants to merge 7 commits into
masterfrom
vps-16-add-keyboards-shortcuts-to-the-editor

Conversation

@FridgeProtector1
Copy link
Copy Markdown
Contributor

@FridgeProtector1 FridgeProtector1 commented May 19, 2026

Issue

The editor needs shortcut handling to respect OS-specific modifier keys so the same shortcut system works correctly on both Mac and Windows.

Solution

Add a centralized keyboard shortcut handling layer that listens for key events and maps them to existing editor actions. The shortcut logic uses a shared shortcut definition structure to match key combinations against the current platform’s primary modifier key, so Cmd/metaKey is used on Mac and Ctrl is used on Windows. This means Ctrl is not treated as the same shortcut on macOS unless it is explicitly bound that way.

When a shortcut is matched, the handler dispatches to the same existing functions used by the editor UI rather than reimplementing the underlying behavior.

Risk

Not too sure but perhaps there could be conflicts with browser specific shortcuts (Didn't notice anything but idk any browser short cuts anyways).

Shortcuts mapped

On Windows/Linux, mod means Ctrl
On macOS, mod means Cmd

Z index commands don't work too well but I believe they weren't working to begin with, but they are mapped too.

Shortcuts
mod+z → Undo
mod+shift+z → Redo
mod+y → Redo
mod+d → Duplicate selected component
Backspace / Delete → Remove selected component
only when not in text mode
mod+ArrowUp → Bring forward one layer
mod+Shift+ArrowUp → Bring to front
mod+ArrowDown → Send backward one layer
mod+Shift+ArrowDown → Send to back
Text mode shortcuts
mod+a → Select all text
mod+b → Toggle bold
mod+i → Toggle italic
mod+u → Toggle underline
Existing non-shortcut keyboard behavior still kept
Arrow keys move selected components by 5px when not in text mode
In text mode, arrow keys / Home / End / typing / Enter / Backspace still use the existing text editor behavior
Platform note

How to add more

Add new shortcuts in frontend/src/features/authoring/handlers/keyboard/shortcuts.ts by defining a new key combination and mapping it to an existing editor action. keyboard.ts already routes global keydown events through handleShortcut(e), so new bindings only need to be added to the shortcut map and matched with the platform-specific primary modifier.

Checklist

  • Acceptance criteria met
  • Wiki documentation is written and up to date
  • Unit tests written and passing
  • Integration tests written and passing
  • Continuous integration build passing

@linear
Copy link
Copy Markdown

linear Bot commented May 19, 2026

VPS-16

It was in the git ignore so I dont know why its still here like its haunting me or smth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant