Problem
The Design Mode shows a hint "⌘/^ + Drag to screenshot area" but this feature is not implemented. Users cannot capture specific regions of the preview to share with the agent or save for documentation.
Goal
Implement a screenshot capture feature that allows users to select a rectangular area in the preview and capture it as an image.
Acceptance Criteria
Files to modify / create
New files
lib/workspace/screenshot.ts # Screenshot capture logic (html2canvas or native API)
components/workspace/screenshot-tool.tsx # Selection overlay component
app/api/workspace/screenshot/route.ts # POST to save screenshot, GET to list
components/workspace/screenshot-gallery.tsx # Gallery of captured screenshots
Files to modify
public/design-mode-agent.js # Add ⌘+Drag handler for selection rectangle
components/workspace/design-panel.tsx # Show screenshot gallery in inspector or sidebar
components/workspace/preview-panel.tsx # Capture selection area from iframe
Technical Notes
- Two approaches:
- html2canvas inside the preview iframe (simple, but limited by CORS)
- Native browser API (e.g.,
chrome extension API or getDisplayMedia) — more complex
- The selection rectangle should be drawn with a
<div> overlay in the preview iframe
- The
design-mode-agent.js should handle the drag selection and send the coordinates to the parent
- The parent captures the iframe content using
html2canvas or canvas API with the selected coordinates
- Store screenshots in
.sin-webui/screenshots/{timestamp}.png
- Maintain a
.sin-webui/screenshots.json index file with metadata
Related
- public/design-mode-agent.js: Already shows "⌘/^ + Drag to screenshot area" hint
- components/workspace/design-panel.tsx: Inspector panel where screenshot gallery could live
Problem
The Design Mode shows a hint "⌘/^ + Drag to screenshot area" but this feature is not implemented. Users cannot capture specific regions of the preview to share with the agent or save for documentation.
Goal
Implement a screenshot capture feature that allows users to select a rectangular area in the preview and capture it as an image.
Acceptance Criteria
.sin-webui/screenshots/with timestampFiles to modify / create
New files
Files to modify
Technical Notes
chromeextension API orgetDisplayMedia) — more complex<div>overlay in the preview iframedesign-mode-agent.jsshould handle the drag selection and send the coordinates to the parenthtml2canvasorcanvasAPI with the selected coordinates.sin-webui/screenshots/{timestamp}.png.sin-webui/screenshots.jsonindex file with metadataRelated