Skip to content

feat: Insert panel, quick connect, presenting, and precise GitHub errors - #7

Merged
playlikeboy merged 4 commits into
mainfrom
feat/insert-panel-and-github-reliability
Nov 12, 2026
Merged

playlikeboy merged 4 commits into
mainfrom
feat/insert-panel-and-github-reliability

Conversation

@playlikeboy

Copy link
Copy Markdown
Owner

What changes for users

Fixes

  • Drawings are no longer lost when you switch to Notes and back. The canvas used to remount from the scene as it was at page load and save that over newer work. This bug is on main today.
  • The app stops asking to reconnect GitHub for problems reconnecting cannot fix. Rate limits, a renamed or removed repository, blocked access and outages each get their own message. Only an expired sign-in or a missing permission shows the reconnect card.
  • Library shapes no longer arrive at unpredictable sizes, and opened libraries are remembered across sketches.
  • Photos keep their real colours on the dark canvas (they rendered as colour negatives).

New

  • Insert panel in the editor: shape libraries (items shown as thumbnails), nine starter diagrams, pasted Mermaid, company logos (Simple Icons), Unsplash photos, stickers, and uploads. Everything lands centred at one consistent size and cascades when the spot is taken.
  • Quick connect: "+" handles on a selected rectangle, diamond or ellipse add a connected shape, using the same elbow arrow as Excalidraw's Ctrl/Cmd+Arrow.
  • Present: frames become slides, with keyboard navigation.

How it works

  • src/lib/canvas-insert.ts and canvas-insert-geometry.ts are the single path every insert takes: one undo step, fresh ids, groups and arrow bindings preserved.
  • Logos and stickers are fetched on demand from jsDelivr pinned to an exact version or commit; nothing is vendored.
  • Photos go through two new public routes (/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.
  • GitHub requests send a User-Agent, failed reads retry once, and failures are classified in src/lib/github-errors.ts.
  • No database changes.

Setup

  • New optional secret UNSPLASH_ACCESS_KEY. Without it the Photos tab says photo search is not set up; everything else works.

Known limits

  • Simple Icons no longer ships some brands (Adobe, AWS, Slack, LinkedIn, OpenAI, Oracle, Microsoft); they were withdrawn upstream.
  • Unsplash's demo tier allows 50 requests an hour for the whole app. The limits are per server instance, so several instances can together exceed it; applying for Unsplash production access is the real fix.
  • Exporting a PNG from Excalidraw's own menu with its dark-mode option on shows photos inverted.
  • Quick-connect handles are hidden on rotated shapes and on touch devices.
  • Presenting falls back to the window when the browser refuses full screen.

Test plan

  • 543 unit tests (bun run test), typecheck, lint with no new warnings, production build
  • 21 browser tests (bun 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
  • Manual browser pass in dark and light themes over every Insert tab, quick connect and presenting, with real Unsplash and CDN requests and no console errors
  • Security review of the new routes and an integration review of the editor; findings fixed in the last commit
  • After deploy: sign in on production, insert a photo, and trigger a save

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.
@playlikeboy
playlikeboy merged commit e5a267b into main Nov 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant