Skip to content

Add page notes: paste or drop a screenshot into the panel - #1

Merged
morganjlopes merged 2 commits into
mainfrom
feature/screenshot-notes
Sep 3, 2026
Merged

morganjlopes merged 2 commits into
mainfrom
feature/screenshot-notes

Conversation

@morganjlopes

Copy link
Copy Markdown
Member

Some feedback is about the whole screen, not a point on it. Today the only way to say that is to pin it to an arbitrary spot and hope the comment carries the distinction. This adds a Page note zone to the panel.

What it does

With the panel open, the zone accepts an image three ways:

  • Paste — Cmd/Ctrl + V anywhere. On macOS Cmd + Ctrl + Shift + 4 puts a screenshot straight on the clipboard, so this is the fast path and the one most people will use.
  • Drop — drag an image file onto the zone.
  • Click — opens a file picker.

From there it's the normal composer: type a comment, save with the button or Cmd/Ctrl + Enter.

Shape

Notes reuse the pin object rather than introducing a second one. kind is now 'pin' or 'note'; a note carries null for all four coordinates, an id prefixed note-, and a thumbnail holding a whole screenshot instead of a crop. Anything already in storage without a kind reads as a pin.

Notes render no page marker and list in the panel with a thumbnail glyph where a pin shows its number. Numbering stays global, so a marker's number still matches its row in the list — a note just leaves a gap, which is honest about what happened.

Because notes flow through onPinAdd like everything else, a backend already receiving pins receives notes with no change beyond reading kind.

Re-encoding

A retina screenshot is routinely several megabytes, which the backend on the other end of onPinAdd will usually refuse. Every note image is re-encoded before it is stored: the long edge is capped at noteMaxEdge and the result written as JPEG at noteQuality, shedding quality and then dimensions until it fits noteMaxBytes. If it can't fit, the drop is refused with an inline message rather than failing silently.

Verified against a real capture: a 3.4 MB PNG came out at 36 KB. A deliberately tight 120 KB budget produced 114 KB; an impossible 2 KB budget refused cleanly instead of looping.

New options: notes, noteMaxEdge, noteQuality, noteMaxBytes. Page notes don't touch html2canvas, so screenshot: false does not disable them — notes: false does.

Also fixed

_savePin re-rendered the page markers but never the panel, so a pin dropped with the panel open never appeared in the list (and the count never moved) until the panel was closed and reopened. This predates the PR and affects plain pins; it surfaced because the new drop zone sits directly above the list it feeds.

Testing

Exercised in the demo page across both themes: paste, drag-drop, and file-picker paths; note details opening from the panel without scrolling; a non-image file reporting an inline error; paste going inert once the panel closes; and the budget loop at both extremes. node --check and npm pack --dry-run pass.

Some feedback is about the whole screen, not a point on it, and pinning it
to an arbitrary spot loses that distinction. The panel gains a Page note
zone that takes an image three ways — paste, drop, or file picker — and
opens the usual composer for a comment.

Notes reuse the pin object rather than introducing a second shape: kind is
now 'pin' or 'note', a note carries null coordinates and renders no page
marker, and the panel lists it with a thumbnail glyph where a pin shows its
number. Numbering stays global, so a marker's number still matches its row.
Pins stored before this field existed have no kind and read as pins.

Images are re-encoded before becoming a note: the long edge is capped at
noteMaxEdge and the result written as JPEG at noteQuality, shedding quality
and then dimensions until it fits noteMaxBytes. A retina screenshot is
routinely several megabytes, which a backend on the other end of onPinAdd
will usually refuse.

Also fixes the panel list going stale after a save — _savePin re-rendered
the markers but never the panel, so a pin dropped with the panel open never
appeared in the list until it was closed and reopened.
@morganjlopes
morganjlopes merged commit 159ecb6 into main Sep 3, 2026
1 check passed
@morganjlopes
morganjlopes deleted the feature/screenshot-notes branch September 4, 2026 16:51
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