Repository navigation
feat(canvas): action registry with ⌘K palette, main menu and editor shortcuts - #448
Conversation
…hortcuts One registry of canvas commands drives the keyboard, the ⌘K action palette, the main menu off the Doop mark and the ⌃⇧? shortcuts sheet. Adds arrange (align, distribute, tidy up, pack), group / ungroup, auto layout, flip and rotate, copy and paste properties, paste over / replace, find and replace across frames, links, text alignment, case and size, outline mode, comment pin and cursor toggles, and frame and page stepping. The agent composer moves from ⌘K to ⌘/ (and / outside fields). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
[Medium impact] The changes reach the canvas editor's main command and editing workflows. Fix grouping for direct body children before merging; it can rearrange the selected layers. FindingsSummaryThe PR puts canvas commands in one registry for keyboard shortcuts, the action palette, menus, and the shortcuts sheet.
|
- Arranged layers move to the computed frame-space spots (`move` takes frame px, not parent-relative). - Paste to replace keeps a frame until all its replacements land, takes back partial ones, and records create + delete as one ordered undo step. - Grouping carries a flex parent's flow onto the wrapper; grid children are refused rather than rearranged. - Remove auto layout writes an explicit block display, so class-supplied flex or grid goes too. - Find and replace leaves text in locked layers alone, numbering intact. - Select inverse of everything clears the selection. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…st edits - Each replacement is recorded as a transfer (creates, then the delete): undo restores the original before removing its replacement and stops, retryable, if that fails. - Copies a failed replacement could not take back stay in the undo step. - Grouping and auto layout refuse to write when the frame changed while its layout was being read, since positional layer paths may have moved. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Record the whole replacement as one transfer (every create, then every delete), so undo restores all originals before removing any replacement and keeps the rest on the stack when a restore fails. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adopts main's persistent view options (pixel grid, cursors, comment pins) in place of this branch's session toggles: their chords (⇧', ⇧C, ⌘⌥\) now live in the action registry, with a Pixel grid action in View, and Stage's own key handler is gone. Stage-only test fixtures install the registry's key dispatch through tests/fixtures/actionKeys.ts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…le replacements - Auto layout on a box clears only the margins between its children; the first child's leading and the last one's trailing margin stay. - Create link wraps an image (or SVG and other contentless elements) in the link instead of appending an empty link inside it, and unlinks it. - Find and replace matches with a case-insensitive regular expression on the original text, so offsets hold where lower-casing changes length. - A paste to replace that lands after the canvas or history changed takes its replacements back instead of entering another canvas's history. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…by identity - Off a Mac, either Ctrl or the Meta key is the mod key, as the canvas always read it; the strict Ctrl match broke ⌘-driven keys on Linux CI. - Create link resolves every picked element before changing the document and returns their final paths, so wrapping one image cannot move the link onto an unpicked sibling. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Elements are linked outermost first; a picked child already inside its parent's new link retargets that link instead of adding its own, and a content wrap lifts the links it would otherwise enclose. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…linked A link wrapped around a box's content turns the links inside it into spans that keep every attribute but the link-only ones, and a picked inner link is followed to its span. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A link inside SVG artwork becomes a `g` with its attributes, not an HTML span the parser would move out of the SVG. Also pins a drawing-move test assertion to the old scope's quoted value, so a random fresh scope that happens to contain "old" cannot fail it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Google's Inter and Geist Mono drop ⌘ ⌥ ⇧ ⌃, so mono shortcut hints fell
back to SF Mono's undersized glyphs. A 5 KB subset of the full Inter
('Doop Keys') now supplies the key symbols in every font stack, and the
main menu's hints use the UI font like the zoom menu. Menu separators get
6px either side, matching the menu padding.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The page sends File, Edit, View, Object, Text, Arrange and Help (labels in its language, chords as key equivalents) and keeps enabled/checked state in step; the shell keeps the app menu, Close Tab, the system edit items, Full Screen and Window. Picks come back as app-menu events and keys keep the canvas keyboard's rules. Older shells keep their fixed View menu. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…action # Conflicts: # .context/RELEASE.md # desktop/src-tauri-chromium/Cargo.lock # desktop/src-tauri/Cargo.lock # desktop/src-tauri/src/main.rs
… on replace, keep ⌘A claimed Hide other layers, select inverse and grouping read a layer's parent off its path, which stops at an #id, so a nested layer like #title counted as a root: hiding hid the containers holding it. They now walk the layer tree. Paste to replace rechecks each target once its replacements exist: one a teammate edited meanwhile stays (its copies go), one deleted meanwhile leaves plain copies, and the delete carries the checked updatedAt so the server refuses a stale one, which then drops out of the undo step. ⌘A with everything already selected no longer falls through to the browser's select-all. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
| const parent = placeOf(buildLayerTree(p.frame.html), p.selectors[0]!)?.parent | ||
| const style = await inheritedLayout(p.frame.id, parent?.selector ?? null) |
There was a problem hiding this comment.
groupKeepingLayout now misses the real parent of layers directly inside body. buildLayerTree starts at the body's children, so placeOf returns no parent and inheritedLayout skips the layout read.
Grouping two direct children of a flex row puts them in an unstyled div, stacking them instead of keeping them side by side. Grid children also bypass the refusal. Use the actual body as the parent for these layout checks.
| const now = live.get(target.id) | ||
| if (!now) leftovers.push(...created) | ||
| else if (now.updatedAt === target.updatedAt) done.push({ target: now, created }) | ||
| else for (const f of created) api.deleteFrame(f.id).catch(console.error) |
There was a problem hiding this comment.
When a teammate edits the target while copies are being created, this new branch deletes those copies with only catch(console.error) and leaves them out of done and leftovers. If a cleanup delete fails, the extra frames stay but Undo cannot remove them. The user must find and delete them by hand.
Await cleanup and add failed deletions to leftovers, as the partial-creation branch already does.
…cleanups undoable Grouping layers directly inside body read no parent once parents came from the layer tree, so a flex body's row was lost and grid bodies skipped the refusal; the body is now their parent. Copies of a target a teammate edited are now deleted before the undo step is recorded, and any that cannot be stay in it, so Undo still removes them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
As a separate file, the font was one more request a page's load event waited on once a hint drew a ⌘, and drawing browser tests timed out in page.goto. A 5 KB woff2 rides in styles.css as a data URL instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Resolves the conflicts with the action registry (doop-design#448): ⌘X stays with the native cut event, which the registry does not bind, and copy keeps going through copySelection in elementClipboard.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
One registry of canvas commands (
src/lib/actions/registry.ts) now drives four surfaces, so a command, its name and its key binding are written once:dispatchActionKey, called first by the canvas page's keydown handler. ⌫, Esc, ↩/Tab and the arrow nudge keep their own handler.CommandPalette.tsx, oncmdk): searchable commands grouped by menu, each with its chord. Text that matches no command can go to the agent's composer as a prompt.MainMenu.tsx): File, Edit, View, Object, Text, Arrange, Help, with checks on toggles and greyed-out items when there's nothing to act on.ShortcutsSheet.tsx), searchable.The agent composer moves from ⌘K to ⌘/ (works from inside fields) and to bare / outside fields.
New commands
divand unwrap).gapand their margins along the flow are dropped, so nothing moves. Remove auto layout ⌥⇧A.]/[for front/back.Notes
actionRegistry.test.tsfails if any binding is used twice on either platform, or clashes with a tool key.Testing
actionRegistry,actionChords,arrange,groupLayers,findText. Full suite passes locally.🤖 Generated with Claude Code