[codex] Add copy button for rendered code blocks#619
Merged
tlongwell-block merged 3 commits intoMay 20, 2026
Conversation
Signed-off-by: Mat Balez <60949391+matbalez@users.noreply.github.com>
Signed-off-by: Mat Balez <60949391+matbalez@users.noreply.github.com>
c76d1ff to
a749f72
Compare
tlongwell-block
approved these changes
May 20, 2026
Collaborator
|
Thanks, @matbalez! This lgtm |
The code-block copy/paste round-trip in this PR adds ~44 lines to MessageComposer.tsx (a dedicated Sprout-marker paste branch that inserts a literal codeBlock instead of letting Markdown reshape the content, plus a scroll-to-bottom helper for multi-line pastes). That pushes the file to 747 lines, over the existing 710 override. The new logic is tightly coupled to the editor ref and the paste handler's preventDefault flow; extracting it cleanly would mean threading the editor and scroll ref through a helper and is out of scope for this PR. Bump the override to 760 (leaving small headroom) and document the new responsibility in the comment. Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
This was referenced May 28, 2026
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
Adds an icon-only copy button to rendered Markdown code blocks in the desktop client. The button appears on hover/focus in the upper-right corner of the code block.
The copy path writes both plain text and Sprout-marked HTML to the clipboard. Plain text keeps external paste behavior simple, while Sprout can recognize its own marked payload and paste it back into the message composer as a real TipTap code block. This preserves code contents that Markdown parsing would otherwise reinterpret, such as headings, indentation, or fence-like text.
Also fixes the tested long-code-block paste UX: after pasting a long copied code block into the message composer, the input scrolls to the bottom so the cursor/trailing paragraph stays visible.
Screenshot
Validation
Mat verified the change manually in desktop dev mode.
Automated checks run on the rebased branch:
Playwright smoke result: 21 passed.
Notes
The branch is rebased onto current
block/sprout:mainand both commits include DCO sign-offs.Scout reviewed the final local change and approved for final test, with no blockers or change requests before merge. One follow-up nit remains out of scope: forum composer has a similar long-paste scroll surface and could get a separate ticket.