feat(editor): add undo/redo buttons to viewer toolbar - #648
Open
rkolpakov-sudo wants to merge 2 commits into
Open
feat(editor): add undo/redo buttons to viewer toolbar#648rkolpakov-sudo wants to merge 2 commits into
rkolpakov-sudo wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds Undo/Redo buttons to the viewer toolbar (top-left, next to the collapse and view-mode controls). The buttons subscribe to the history store via
subscribeHistoryCommandStateand dispatch throughrunUndo/runRedo, which respect the collaborative history delegate and fall back to standalone Zundo when no controller is installed. Buttons disable when nothing can be undone/redone.Keyboard shortcuts were already wired (Ctrl/Cmd+Z undo, Ctrl/Cmd+Shift+Z redo) and command palette entries already existed; this PR adds the visible toolbar affordance and the CHANGELOG entry.
How to test
bun devand open the editor at http://localhost:3002Screenshots / screen recording
N/A — visual change; a screen recording will be added if requested.
Checklist
bun devbun checkto verify)mainbranchNote
Low Risk
UI-only addition that reuses existing history APIs; no changes to undo/redo or scene mutation logic.
Overview
Adds Undo and Redo controls to the top-left community viewer toolbar (between sidebar collapse and 3D/2D/split view mode).
A new
HistoryControlsblock subscribes tosubscribeHistoryCommandState, readscanUndo/canRedoviagetHistoryCommandState, and invokesrunUndo/runRedoso behavior matches the command palette and keyboard shortcuts (including collaborative history when a delegate is set). Buttons use the same toolbar styling as other controls and are visually disabled when history is empty. CHANGELOG documents the feature under Unreleased → Features.Reviewed by Cursor Bugbot for commit 55a63b6. Bugbot is set up for automated code reviews on this repo. Configure here.