fix(ui): preserve composer paste undo history - #3787
Open
Sun-GLiang wants to merge 3 commits into
Open
Conversation
Astro-Han
reviewed
Aug 25, 2026
Astro-Han
left a comment
Contributor
There was a problem hiding this comment.
I reviewed this head and found no blocking issues.
The paste now uses execCommand('insertHTML') on a textContent-escaped <br> conversion to make plain-text paste a separate undo transaction, correctly leaving file/reference/IME paths unchanged.
Minor note: execCommand is deprecated but the only remaining transactional insertion primitive in this composer — consider annotating a future migration path.
No P0-P2. Checks on 7afde75d95 are blocked by base execution-host-queue failure unrelated to this change.
简体中文
该头未发现阻断,execCommand 废弃为轻度可维护性观察。
M4n5ter
force-pushed
the
fix/3786-composer-paste-undo
branch
2 times, most recently
from
August 26, 2026 09:48
7a130ef to
f28a37f
Compare
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
M4n5ter
force-pushed
the
fix/3786-composer-paste-undo
branch
from
August 26, 2026 09:55
f28a37f to
50ab1d7
Compare
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
ChatComposerInput.onPasteseaminsertHTMLbrowser transaction so paste is undone separately from immediately preceding keyboard inputFixes #3786
Before / after evidence
Both corrected recordings run the same real Electron flow with the same minimal input: type
x→ paste ordinary multiline text → press undo three times. Each step displays the current composer text.Before —
upstream/main@7235069adThe first undo removes
xwhile leaving the pasted text. The second and third undo still leave the pasted text, reproducing #3786.page@c2ccde11c524db300d1090fd7f645c92.webm
After —
f547283a8The first undo removes only the pasted text and leaves
x; the second removesx; the third remains empty without reinsertion or duplication.page@7da85ab9fe494f70134e34b1ff7e7118.webm
Verification
Passed locally:
npm --workspace @maka/desktop run e2e -- composer-undo.spec.tsnpm run lintnpm run format:checknpm run typechecknpm run check:asf-headersnpx knip --workspace packages/uinpx knip --workspace apps/desktopnpm run buildThe full local
npm testcommand reached two unrelated failures in unchanged workspaces:@maka/runtime: an environment-sensitive assertion expects/usr/localat executable-root index 1 even though the current Node executable already makes it the deduplicated index 0 root.@maka/runtime-host: cleanup of the shared~/Library/Caches/Maka/runtime-hostsdirectory raced with a locally running Host and failed withENOTEMPTY.Current CI status
The PR CI build is currently blocked by the same regression already failing on its base commit
main@689a4515f:mainCI failureBoth fail while building unchanged
packages/runtime-host/src/__tests__/execution-host-queue.test.ts, whereRuntimeHostConnectionno longer exposesqueryTurn,stopTurn, orstartTurn. Neitherpackages/runtime-hostnorpackages/runtimediffers frommainin this PR. Re-running the PR workflow beforemainis repaired will reproduce the same failure.AI use
Select exactly one:
Tool(s) and scope: Codex implemented the focused composer change, added the Electron regression test, ran verification, and performed code review. The commit includes the required
Generated-bytrailer.Checklist
Does this PR entail a change in behavior?