Repository navigation
Mark up screenshots with pins, drawing and crop before sending them to the agent (#460) - #1663
Conversation
#460) Clicking an image chip's thumbnail opens a markup editor: numbered pins with optional notes, freehand strokes and a crop region. Save flattens the markup into a PNG that replaces the chip, so every provider sees it, and appends the pin notes to the draft as text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b242f8456
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /** The flattened PNG replaces its chip; pin notes go into the draft. */ | ||
| const saveMarkup = (dataUrl: string, notes: string) => { | ||
| const source = markup?.attachment; | ||
| setMarkup(null); |
There was a problem hiding this comment.
Preserve markup until image persistence succeeds
When onSaveAttachmentImage rejects or returns null—for example, electron/attachments.js rejects PNGs over its 20 MB limit or a disk write fails—this immediately destroys the editor and all strokes, crop, and notes before the outcome is known. The failure handlers only display an error, so the user cannot retry without recreating the markup; while the promise is pending, an existing prompt can also be sent with the unmodified attachment. Keep the editor open in a saving state and close it only after the replacement succeeds.
Useful? React with 👍 / 👎.
| if (e.key === "Enter") { | ||
| e.preventDefault(); | ||
| save(); |
There was a problem hiding this comment.
Ignore Enter while a pin note is composing
For users entering a pin note through an IME, Enter is used to commit the current composition and arrives with nativeEvent.isComposing. This handler treats that event as Save, closing the dialog before the composed text is committed and potentially omitting or truncating the note. Guard the shortcut with !e.nativeEvent.isComposing, as the main composer already does.
Useful? React with 👍 / 👎.
| disabled={marks.length === 0} | ||
| onClick={() => setMarks((prev) => prev.slice(0, -1))} |
There was a problem hiding this comment.
Include crop changes in the undo history
When the latest edit is a crop, Undo only removes the last mark; if the crop is the only edit it is disabled entirely, and if strokes or pins exist it undoes an older action instead of the crop. Track crop changes alongside marks or explicitly restore the previous crop before slicing the mark list so Undo reverses the most recent visible edit.
Useful? React with 👍 / 👎.
"The padding on this card is wrong" is quicker to show with a circle on a screenshot than to describe in a paragraph. Clicking an attached image's thumbnail in the composer now opens a markup editor. What you mark gets drawn into the image, so every provider sees it. Closes #460.
Changes
Markup on shot.png (numbered red pins):\n1. Title should be 24px.Verification
npm run typecheckpasses,npx vite buildpasses, and all 231 tests intest/composer*.test.tsxpass after rebasing onto current main.Image/canvas faked): drop a pin, type a note, save. It then checks the uploaded data URL, that the chip was swapped in place, and the exact prompt text. Plus a unit test for crop-rect normalization.Notes for reviewers
onMouseDownpreventDefault on the canvas is load-bearing. Without it, clicking the canvas moves focus to the dialog, so a new pin's note field loses focus and typed notes are lost. jsdom doesn't reproduce this; only the real browser run caught it.claude-opus-5-5 via Claude Code
🤖 Generated with Claude Code