ENG-1792: Add edit block button to rendered dg-canvas#1203
Conversation
Overlay Button on the embedded canvas that focuses the underlying
{{dg-canvas}} block via setBlockFocusAndSelection, using the same
getUids/.roam-block idiom as the ResultsView Edit Block action so it
works in the right sidebar too.
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Review follow-up: getUids accepts a null element and returns empty ids, so use the closest() generic instead of a non-null assertion.
|
The crash claim is incorrect: getUids (roamjs-components/dom/getUids) accepts a null element and returns { blockUid: "", windowId: "" }, so a missing .roam-block ancestor makes the edit button a no-op, not a render crash — same failure mode as the identical idiom in ResultsView. The cast was misleading about nullability though, so d53a010 switches to the closest() generic, which types the lookup as nullable with no assertion. On the button hit area over the canvas: acknowledged — it mirrors the existing bottom-right sync-icon overlay, and the top-right corner sits outside tldraw's own toolbar zones. Will verify interaction in the demo recording. |
Top right overlaps the tldraw style panel; bottom right is the corner the plugin already uses for its cloud sync icon, offset left so both fit.
https://www.loom.com/share/5a61fddb73824341865e254fb3431243
Adds a minimal Blueprint edit button overlaid top-right on the embedded canvas that focuses the underlying {{dg-canvas}} block via setBlockFocusAndSelection, using the same getUids/.roam-block idiom as the ResultsView Edit Block action so it also works for canvases in the right sidebar.
Fixes ENG-1792