P2-02: Highlight tool + Annotations tab - #22
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 23, 2026
This was referenced Aug 11, 2026
dkritarth
force-pushed
the
p2-01-notes
branch
from
September 12, 2026 15:10
6290285 to
ab0dcd2
Compare
Select text in the reader with the highlight tool, pick a color, and the
highlight is anchored on the pdf.js text layer, persisted, and listed in
the right-panel Annotations tab. Clicking an annotation jumps the reader
to that highlight and flashes it; each can be deleted.
Storage: migration 4 adds a `highlights` table (synthetic id, paper_slug
FK ON DELETE CASCADE, page/color/quote/anchor/created_at) plus an index
on paper_slug. `core/highlights/repo.ts` = createHighlight / listHighlights
(page then created_at order) / deleteHighlight, with colocated tests.
Seam: three IPC channels vellum:highlights-{create,list,delete}; main
validates slug/page/strings and stamps id (randomUUID) + createdAt so the
renderer never supplies them. Renderer reaches them only via window.vellum.
Anchor: opaque JSON `{start,end}` character offsets into the page's text
layer, computed from the DOM Range (survives zoom, layout-independent);
a stale anchor that no longer resolves is skipped rather than crashing.
UI: highlight tool + color swatches in ReaderToolbar (was a stub); overlay
rects painted over selected text in Reader; AnnotationsPanel lists/jumps/
deletes; wired into RightPanel's Annotations tab (was "coming soon"). Jump
seam lifted to App as typed state (page + highlightId + nonce), no event bus.
Acceptance ([P2-02]):
- highlight persists, anchored on the text layer ✓
- annotations list + click-to-jump ✓
- delete ✓
- tests ✓ (repo CRUD+cascade, anchor round-trip, Reader capture + jump/
flash, AnnotationsPanel list/jump/delete, RightPanel wiring)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dkritarth
force-pushed
the
p2-02-annotations
branch
from
September 12, 2026 15:12
9ff7326 to
f73054c
Compare
8 tasks
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.
User outcome
Users can select text inside the PDF reader and apply highlights in 4 colors (yellow, green, blue, pink). Created highlights persist across app restarts in SQLite, appear in the "Annotations" tab on the right panel, allow clicking to jump to the highlighted page with a visual pulse/flash, and support deletion.
Acceptance criteria
Automated verification
core/highlights/repo.test.ts(7/7 tests passing)src/app/AnnotationsPanel.test.tsx(6/6 tests passing)src/app/Reader.test.tsx(20/20 tests passing)npm run buildsucceeds without bundle errors.Live Electron verification
Visual and console evidence
Limitations and follow-ups
Independent review
Highlights storage uses SQLite
highlightstable with paper foreign key cascade, preserving the storage split.Closes #30