Repository navigation
fix(web-ui): fix composer undo, sent large pastes, and bubble collapse - #3745
Merged
bobleer merged 4 commits intoNov 5, 2026
Merged
Conversation
- Own the composer undo history: WebKit coalesces a typing run, including IME commits, into one native undo step, so a single Cmd+Z cleared the whole draft. Steps now break at words, pauses, IME commits, edit-kind changes, and programmatic capsule inserts; capsules, contexts, and large pastes are restored on undo/redo. - Keep large paste bodies in user message metadata (`largePastes`) so the sent placeholder opens a read-only viewer, and copy, edit, rollback, and fill-to-input use the real text. Older builds ignore the key. - Expand same-length paste placeholders longest-first so `[... N] #2` is no longer corrupted by the `[... N]` prefix. - Stop collapsing an expanded user message on outside mousedown, which moved the copy/edit actions before the click landed.
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.
Summary
Fixes three chat composer / sent-message issues in the Web UI:
[Pasted content N chars]; the model always received the full text, but the sent bubble only kept the placeholder, and copy copied the placeholder. Paste bodies are now stored in user message metadata (largePastes). The placeholder renders as a borderless capsule that opens a read-only viewer with copy, and message copy, edit, rollback, and fill-to-input all use the real text (restored composer drafts get their paste capsules back).12345+ IME你好+ Cmd+Z cleared everything. The composer now owns its undo history: steps break at words, 1s pauses, IME commits, insert/delete changes, and programmatic capsule inserts. Cmd/Ctrl+Z, Cmd+Shift+Z, Ctrl+Y, and Edit-menuhistoryUndo/historyRedoare handled; capsules, contexts, and large pastes are restored. The existing image-paste undo still takes precedence.Also fixes a latent expansion bug: two pastes of the same length produce
[... N]and[... N] #2, and expanding in insertion order corrupted the#2paste. Expansion is now longest-match-first.Type and Areas
Type: bug fix, UI/UX
Areas: web UI
Motivation / Impact
Verification
pnpm --dir src/web-ui run type-check: passpnpm --dir src/web-ui run test:run src/flow_chat/components src/flow_chat/hooks src/flow_chat/utils: 252 files / 2625 tests pass. New tests:richTextInputHistory.test.ts: grouping rules, including the IME commit caseRichTextInput.test.tsx: typing + IME commit, then undo/redo through the real editor; large paste capsule restoreUserMessageItem.test.tsx: stays expanded on outside mousedown; paste capsule opens viewer; copy expands pastelargePasteMetadata.test.ts: same-length placeholders, no body rescan, tolerant metadata parsinguseMessageSender.test.tsx:largePastesmetadata is sentpnpm run theme:color-audit:all: pass. The MiniApp chat style projection was regenerated (only the new viewer rule).pnpm run check:web(type-check + Appearance/theme gates): pass.git diff --check: pass.Review follow-up
check:webgate; no audit baselines were loosened.Reviewer Notes
largePastesmetadata key, not a newcomposerPresentationsegment kind, because the Rust turn-rail parser drops presentations with unknown segment kinds. Older builds, mobile web, and IM bots ignore the key and keep showing the placeholder as before. Malformed metadata is ignored.onclickhandlers that clones would lose. External value syncs (send, history navigation, draft restore) reset the history baseline.Checklist
input.largePaste*keys; no new strings.)