feat(editor): expose imperative undo/redo history control - #149
Draft
seonghobae wants to merge 22 commits into
Draft
feat(editor): expose imperative undo/redo history control#149seonghobae wants to merge 22 commits into
seonghobae wants to merge 22 commits into
Conversation
📝 WalkthroughWalkthrough
ChangesUndo/Redo Handle API
Estimated code review effort: 3 (보통) | ~20분 Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
seonghobae
marked this pull request as ready for review
August 10, 2026 15:13
seonghobae
marked this pull request as draft
August 10, 2026 18:01
Contributor
Author
|
@coderabbitai review |
|
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.
Purpose
Implement #148 as a bounded host-control surface for the same undo/redo commands already owned by Inkspan's toolbar/editor history extensions, while making retained host handles consistently fail closed once the underlying TipTap editor has been destroyed and keeping user-facing history commands inert while the editor is read-only.
Test-first lineage
main@50ac98cfa0ad9e8dd75f93ca437a5679fed4d804.1d08f70210e5abdd68e2d83f4096117eab389973proved the stable handle lackedcanUndo/undo/canRedo/redowhile the editor already owned history commands.2fc4d9f83c1405697b23402689546d4a48e880c2, CI31414556067, build/test93540362772, proved a retained destroyed-editor handle still returned stale document state.554140d40035d5af4f006ad123d3bcdb5b55d261, CI31415215254, build/test93542500162, proved revision/evidence/restore paths still retained stale editor authority after destruction.836a72220ca66f390f660fb3eb71eebfaa84b621, CI31418632930, build/test93553758656, failed the strict packed TypeScript consumer because it did not exercise the four new public history operations.d7ead2540d91cfbb0b64319946e554eab1119b44, CI31422150835, build/test93565228497, reproduced a real accessibility/behavior defect: after a real edit followed byeditable={false},handle.canUndo()incorrectly remainedtrueand user-facing imperative history could still mutate the document.e752891647cfd2341f362a70dcfbc029f8294e4fgates only the four user-facing history operations through an active-and-editable editor; trusted host-control mutators keep their existing programmatic authority.819415422e1bc67edbf75ece767d3b39f737d7d1records the read-only/history authority boundary as active-PR truth.e6278289c47a54f97d450e7dad857f1397ebbe7badds the non-documentation handoff proof that read-only history is not consumed: after editability is restored, the same undo remains available and succeeds.Implemented boundary
canUndo,undo,canRedo, andredothrough the currently registered TipTap history commands;falsefrom all four operations whileeditable={false}without consuming history, then expose the preserved history again when editability returns;getEditor()returnsnullonce the editor is destroyed;Exact-head proof
For unchanged exact head
e6278289c47a54f97d450e7dad857f1397ebbe7b:31422683181: success;31422683243: success;31422683184: success;src/components/useEditorHandle.ts;The build/test log also surfaced the pre-existing collaborative native-form reset React
act(...)warning in unchanged test code. It is isolated in Draft PR #153 from protectedmainas a test-harness quality lane rather than being folded into this feature branch. That diagnostic did not fail this exact-head product test/coverage/package gate.Automated/model status is not represented as qualifying independent formal approval. Any subsequent head movement invalidates this proof and must be revalidated.
Integration dependency
The implementation is exact-head gate-clean, but protected
main@50ac98cfa0ad9e8dd75f93ca437a5679fed4d804remains the exact 0.6.0 stable release candidate tracked by #118. Keep this PR Draft and do not merge while that registry operational-acceptance boundary remains unresolved, because advancing protectedmainwould invalidate the release workflow's recorded stable-candidate identity. Revalidate live main, release/tag state, exact head, review state, and live policy immediately before any eventual readiness or merge transition.