Repository navigation
feat: Insert panel, quick connect, presenting, and precise GitHub errors - #7
Merged
Merged
Conversation
Groundwork for inserting libraries, logos, photos, stickers, diagrams and uploads from one panel: - canvas-insert-geometry.ts: pure helpers that centre an insert on the view and scale it to one consistent size, remapping ids while keeping groups, containers and arrow bindings intact. - canvas-insert.ts: insertElements and insertImage, each one undo step, plus SVG and raster helpers that downscale embedded photos. - InsertPanel with six tabs (placeholders for now), wired into the editor in place of the library panel, plus mount points for quick-connect handles and presentation mode.
…errors Insert panel (replaces the library drawer), every source inserting at the centre of the view at one consistent size, cascading when the spot is taken: - Libraries: community packs open to a grid of item thumbnails; opened packs are remembered per browser instead of per sketch. - Diagrams: nine starter diagrams with bound arrows, plus paste Mermaid. - Logos: Simple Icons, searched from a version-pinned index. - Photos: Unsplash through server routes that keep the key private, with attribution, download tracking, caching and per-visitor rate limits. - Stickers: curated Noto Emoji set. Upload: local SVG and raster images, sanitised and downscaled, never sent to a server. Quick connect: "+" handles on a selected shape add a connected shape, with the same elbow arrow Excalidraw's own Ctrl/Cmd+Arrow creates. Presentation mode: frames become slides with keyboard navigation. GitHub reliability: requests send a User-Agent, failed reads retry once, and failures are classified (expired sign-in, missing scope, rate limit, access denied, not found, unavailable). Only sign-in problems show the reconnect card; everything else gets a specific notice. Fixes photos rendering as colour negatives on the dark canvas.
Data loss: switching to Notes (or previewing an old version) and back remounted the canvas from the scene as it was at page load, then saved that over the newer work. The next mount now gets the current scene. Editor: - Insert, quick connect and Present only act on the canvas that is on screen; Present can no longer get stuck on, and opening Insert leaves a version preview. - "Try again" on a failed save now repeats the save. - Removes the leftover library-install bookkeeping. Insert panel: - Each tab keeps its own search text, so typing for logos never spends a photo search. - Consecutive inserts cascade instead of stacking; the tab row wraps. - SVGs get an explicit size so every browser draws them. Photos (after security review): - Only uncached searches count against new hourly limits, per visitor and per server instance, and a stale result is served when a limit or Unsplash itself refuses. - Download tracking requires a server-signed token for a photo the server returned, is de-duplicated per photo, and has its own budget. - Search refuses cross-site requests. Also guards a malformed rate-limit header, adds browser tests for the Insert panel, quick connect, presenting and the remount regression, and documents the new tools in the help page.
Bun shares module mocks between test files in one run and patches an already-loaded module in place, and the file order differs by platform. On Linux the API tests' mock of the auth factory reached the real sign-in flow tests. The mock now stands in only for the API tests' own client id and hands every other caller the real implementation, captured by value before the mock is installed.
2 of 3 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.
What changes for users
Fixes
maintoday.New
How it works
src/lib/canvas-insert.tsandcanvas-insert-geometry.tsare the single path every insert takes: one undo step, fresh ids, groups and arrow bindings preserved./api/unsplash/search,/api/unsplash/download) so the key stays on the server. Only uncached searches count against hourly limits; download tracking needs a server-signed token.User-Agent, failed reads retry once, and failures are classified insrc/lib/github-errors.ts.Setup
UNSPLASH_ACCESS_KEY. Without it the Photos tab says photo search is not set up; everything else works.Known limits
Test plan
bun run test), typecheck, lint with no new warnings, production buildbun run test:e2e), including: an inserted diagram and an uploaded image are stored in the sketch and survive a reload; consecutive inserts do not stack; a "+" handle adds a bound shape; presenting opens and exits; a drawing survives switching to Notes and back