Conversation
Conditional toolbars replace history controls while code blocks have focus. Exercise history remounts, empty states, editor switches, and the code block browser flow. Guard toolbar availability and verify that undo and redo still change the document.
UndoRedo can mount after history availability commands have already fired. Read the active editor history before subscribing to future availability commands. Restore usable undo and redo controls after conditional toolbar changes.
Issue 654 reports unavailable undo and redo after code block insertion. Add an empty editor with the documented conditional code language toolbar. Provide a small reproducible example for manual and browser verification.
The history regression fixture triggered two strict lint diagnostics. Give the edit helper a block body and narrow paragraph nodes with the Lexical guard. Preserve the same editor updates and assertions without deprecated type casts.
huyanxius
marked this pull request as ready for review
October 3, 2026 05:50
This branch has not been deployed
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.
When the documented
ConditionalContentstoolbar replacesUndoRedowith the code-language selector, returning to a paragraph leaves Undo disabled even though Cmd/Ctrl+Z can undo the inserted code block. Initialize the controls from the active editor's history so toolbar Undo and Redo work as soon as the controls remount.Why
I reproduced this on current main (
122347cff8af5e9e1291b52789d22ed3ba0dc2ba) with React 19.2.1: start with an empty editor, insert a code block, focus its code, then click the paragraph below it. Undo remains disabled; Cmd+Z removes the block and enables Redo. The existing focus-time replay does not resolve this case.CAN_UNDO_COMMANDandCAN_REDO_COMMANDnotify listeners about changes; registering a listener does not replay commands emitted while the component was unmounted.UndoRedopreviously initialized both flags tofalseon every mount.Changes
HistoryExtensionstate when the effect attaches, respecting disabled or absent history, then retain the existing command subscriptions for subsequent updates.bug-654example and a browser regression for the actual code block/paragraph/toolbar undo/redo flow.Verification
17fb56702158bc4d277129d34fec89d87a4c7e70:npm run lintandnpm run typecheckpassed. The full Vitest suite passed with one worker: 126 passed, 1 skipped, 1 todo, including all 15 focused tests acrossundo-redo.test.tsx,toolbar.test.tsx, andextension-composer.test.tsx.uv_interface_addresses, and Chromium startup fails withsocket() failed: Operation not permitted. The isolated Chromium reproduction above is separate from the checked-in Playwright test.git diff --check: passed.Fixes #654
Upstream CI for the current head is
action_required, awaiting approval to run this fork workflow: CI run. The implementation is ready for review; browser CI still needs to run.