Repository navigation
feat(web): image previews, line anchors, permalinks and windowed rendering for blobs (D-054, D-055) - #71
Conversation
|
Warning Review limit reachedNext included review available in 47 seconds. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (13)
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 |
3d5139a to
27ebce0
Compare
|
@coderabbitai review 🤖 Posted autonomously by Claude on behalf of pasta. |
|
D-054: PNG, JPEG, GIF, WebP and SVG blobs are previewed through an img of a blob: URL; raster formats must match their magic bytes, and an SVG is never put in the document. Line numbers are #L10 and #L10-L20 anchors (shift-click extends) with highlighting, and Copy permalink pins the commit: blob and tree views now accept a full commit id as ref. D-055: files over 2,000 lines render only the rows near the viewport, so decNumber.c (388 KB) drops from 35,410 DOM elements to about 650. Text over 1 MB offers View raw or Render anyway instead of rendering. Syntax highlighting keeps its existing 512 KB and 20,000-line caps. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
selectBrowseRef replaces the pinned-commit logic that was duplicated in the tree and blob views. Object URLs are now created in an effect, so React StrictMode's effect replay can no longer revoke a URL that is still on screen. The display kinds are handled in a switch, and the unused exports are removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An SVG preview is a data: URL, not a same-origin blob: URL. Opened in a new tab, a blob: SVG loaded as a document on the forge origin and ran its script. SVGs also get a Code view. View raw opens text/plain instead of downloading. Line cells have no vertical padding, so rows are exactly 20 px and #L links land on the line; U+2028 and U+2029 are shown as markers so WebKit keeps them on one line. Only a URL fragment scrolls, not a click; line numbers are not tab stops; a modified click opens a new tab. The render-large choice resets per file. A pinned commit (ref=<full id>) is now part of selectRef, so home, commits, the zip and the trust panel follow a permalink instead of saying the ref does not exist. The trust panel says the commit was opened by id and no ref vouches for it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
27ebce0 to
a8f25fa
Compare
The CLI issue-parity scenario is renumbered 21 (20 is config + storage UX). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Fixes D-054 and D-055: the blob view from QA wave 1.
D-054: image previews, line anchors and permalinks
Image previews
<img>.blob:URL. It is shown from adata:image/svg+xmlURL.blob:SVG opened with "Open image in new tab" loads as a document on the forge origin and runs its script. That was checked in Chromium and Firefox.data:document is opaque-origin, and top-leveldata:navigation is blocked.Line anchors
#L10and#L10-L20are highlighted and scrolled into view on open, or when the fragment is edited. A click selects a line and shift-click extends the selection, without scrolling the page.tdpadding. U+2028 and U+2029 are shown as markers, so WebKit keeps each row to one line and deep links land on the right line.Permalinks
?ref=<full commit id>.selectRefnow treats a full commit id that no branch or tag is named as a pinned commit. So the blob, tree, home, commits and zip views all follow a permalink.D-055: large blobs rendered every line
Windowing
Files over 2,000 lines render only the rows near the viewport, using spacer rows and a rAF-throttled scroll listener.
Live on jq
vendor/decNumber/decNumber.c(388 KB, 8,144 lines):#L8000lands on the line.Large files
text/plain, or Render anyway. The choice resets per file.Tests
Unit tests
blob-view.test.tscovers magic bytes, SVG detection, hash parsing, shift-click, the window math and the 1 MB gate.refs.test.tscovers pinned commits.Playwright (
e2e/blob-view.spec.ts, against moutai on the fd and jq showcase repos)blob:URL and the SVG from adata:URL; the SVG's Code view works.#L10-L20highlights the range, and click and shift-click select without scrolling.#L500of a 561-line file is in the viewport, and a row is exactly 20 px.Regression
v2-reads.spec.tsstill passes, 9 of 9.Not covered live
Evidence:
/Users/pasta/workspace/dash-forge-qa/evidence/impl/fix-web-blob-view/🤖 Generated with Claude Code