Add page notes: paste or drop a screenshot into the panel - #1
Merged
Merged
Conversation
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.
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.
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:
Cmd/Ctrl + Vanywhere. On macOSCmd + Ctrl + Shift + 4puts a screenshot straight on the clipboard, so this is the fast path and the one most people will use.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.
kindis now'pin'or'note'; a note carriesnullfor all four coordinates, an id prefixednote-, and athumbnailholding a whole screenshot instead of a crop. Anything already in storage without akindreads 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
onPinAddlike everything else, a backend already receiving pins receives notes with no change beyond readingkind.Re-encoding
A retina screenshot is routinely several megabytes, which the backend on the other end of
onPinAddwill usually refuse. Every note image is re-encoded before it is stored: the long edge is capped atnoteMaxEdgeand the result written as JPEG atnoteQuality, shedding quality and then dimensions until it fitsnoteMaxBytes. 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, soscreenshot: falsedoes not disable them —notes: falsedoes.Also fixed
_savePinre-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 --checkandnpm pack --dry-runpass.