Skip to content

Paste clipboard images into annotation comments#47

Open
sacrezm wants to merge 2 commits into
breschio:mainfrom
sacrezm:feat/paste-clipboard-images
Open

Paste clipboard images into annotation comments#47
sacrezm wants to merge 2 commits into
breschio:mainfrom
sacrezm:feat/paste-clipboard-images

Conversation

@sacrezm

@sacrezm sacrezm commented Jun 22, 2026

Copy link
Copy Markdown

What

The annotation comment box only accepted text. This adds clipboard image paste to both comment boxes (element annotations via C, and freeform rectangles via R).

How it works

  • A paste listener on the comment textarea captures image/* clipboard items (e.g. a screenshot or a design reference). Text paste is untouched — we only intercept when the clipboard actually carries an image.
  • Pasted images show up as removable thumbnails in the comment box.
  • On submit, each image is written next to the auto-captured screenshot at .moat/screenshots/<id>-paste-N.<ext>, and its path is appended to the task comment (plus an attachments array on the task) so the agent reading moat-tasks-detail.json / running /bridge picks them up.
  • Submitting with only an image (no typed text) is now allowed.

Scope

  • chrome-extension/content_script.js — paste handler, image persistence, image-only submit, wiring through the existing addToQueue funnel.
  • chrome-extension/moat.css — thumbnail strip styles.

No new dependencies, no build step. Tested manually in Chrome; the data-URL → file parse path (PNG/JPEG/SVG, extension mapping, non-image rejection) verified with a small standalone check.

sacrezm added 2 commits June 22, 2026 11:14
The annotation comment box only accepted text. You can now paste an image
from the clipboard (a screenshot, a design reference, etc.) into both the
element and freeform-rectangle comment boxes.

Pasted images are saved next to the auto-captured screenshot under
.moat/screenshots/<id>-paste-N.<ext>, shown as removable thumbnails in the
comment box, and their paths are appended to the task comment (plus an
`attachments` array on the task) so the agent processing /bridge picks them
up. Submitting with only an image and no text is now allowed. Normal text
paste is unaffected (we only intercept when the clipboard carries an image).
…them

Pasted reference images were only referenced in the task comment text, so
whether the processing agent looked at them depended on it noticing the path.
Make it reliable:

- convertAnnotationToTask / createTaskObject now persist an `attachments`
  array (the ./screenshots/<id>-paste-N paths) as a first-class task field in
  moat-tasks-detail.json, so the data is structured rather than buried in prose.
- The bridge + workflow rule templates now instruct the agent to open every
  image in `attachments` before implementing, the same way it views
  `screenshotPath`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant