feat(chat): attachments as preview tiles in the composer - #526
Conversation
Image attachments in the context tray render as 56px thumbnails on their own row (click opens the image, the corner × removes it) instead of a filename chip. Non-image attachments, and images whose file isn't in the vault, keep the chip. Co-Authored-By: Claude <noreply@anthropic.com>
|
…okup A pasted or dropped image is written through the adapter, so the vault may not have indexed it yet when the tray looked it up, leaving a chip that never upgraded. Input already keeps an object URL per image attachment; pass that down instead. Co-Authored-By: Claude <noreply@anthropic.com>
Tiles are 80px on desktop (56px on a phone). PDFs render page 1 through Obsidian's pdfjs with a PDF badge; text files and anything without a preview show a file card (icon, name, extension). Attachment chips are gone, along with their filled-pill styling. Co-Authored-By: Claude <noreply@anthropic.com>
… don't scroll the thread - The card's min-height floor was derived from the card's own height, so when the tray shrank (removing an attachment tile) the floor held it open and only fell ~7px per resize tick: the editor jumped up, then the card slid down. Sum the floor from the tray and action rows instead. - Chromium auto-scrolls a scroller whose edge a drag hovers near, and the thread's bottom edge sits right above the composer, so dragging a file in ran the thread to the bottom. Make it non-user-scrollable while a drag is in progress. - Review: cap the PDF thumbnail canvas at a square; don't store a preview URL once the composer is destroyed. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
What
Attachments in the chat composer show as tiles on their own row above the context chips instead of filename pills. The tiles are 120px on desktop and 56px on a phone:
Clicking a tile opens the file. The corner × removes it; it's always visible because an opacity-0 hover reveal turns into a double tap on mobile. Previews are the object URLs Input already makes when you attach, so a file the vault hasn't indexed yet can't race them. The attachment-chip styling is gone.
Also fixes two things found while testing this:
How I tested it
bun run check,format,lint, andtestpass, and the dev build succeeds. Live in a slot vault (desktop, macOS) using the Obsidian CLI: dropped an image and sampled the card geometry per frame on removal (before: 11 frames of creep; after: the first painted frame is final). Replayed a real file drag over CDPInput.dispatchDragEvent, held at the thread's bottom edge (before: scrollTop 200 → 928; after: stays at 200, and scrolling works again after the drag). Leo will do the hands-on test.AI assistance: Claude Code (Opus) wrote the change from Leo's one-line request ("show attached images as preview instead of the pill", then "bigger on desktop, what about PDFs and other files"); Leo reviews and tests it live.
Checklist
bun run check,bun run format,bun run lint, andbun run testpass locallymanifest.json: I noted that the docs site needs updating (see "Documentation" in CONTRIBUTING.md)