Skip to content

ENG-1553: Embed canvas in block#988

Merged
sid597 merged 8 commits into
mainfrom
eng-1553-embed-canvas-in-block
May 21, 2026
Merged

ENG-1553: Embed canvas in block#988
sid597 merged 8 commits into
mainfrom
eng-1553-embed-canvas-in-block

Conversation

@sid597

@sid597 sid597 commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

@linear-code

linear-code Bot commented Apr 30, 2026

Copy link
Copy Markdown

@supabase

supabase Bot commented Apr 30, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread apps/roam/src/utils/registerCommandPaletteCommands.ts Outdated
Cast window.roamAlphaAPI.ui to access untyped slashCommand API
with proper type annotation instead of relying on any. Fix void
callback returning null.
@sid597 sid597 requested a review from mdroidian May 2, 2026 06:52
Comment thread apps/roam/src/components/canvas/CanvasEmbed.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbed.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbed.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbed.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbed.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbedDialog.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbedDialog.tsx Outdated
Comment thread apps/roam/src/components/canvas/CanvasEmbedDialog.tsx Outdated
Comment thread apps/roam/src/utils/registerCommandPaletteCommands.ts
Comment thread apps/roam/src/utils/registerCommandPaletteCommands.ts Outdated
- Move slash command out of registerCommandPaletteCommands into new
  registerSlashCommands.ts; wire teardown into index.ts unload
- Replace hand-rolled InputGroup+Menu+keyboard logic in CanvasEmbedDialog
  with roamjs-components AutocompleteInput; add loading + empty states
- Use data.async.fast.q (not the deprecated sync .q) for canvas page lookup
- Extract canvas-page regex into shared helper in isCanvasPage.ts; escape
  regex special chars in user-provided canvasPageFormat
- Convert inline styles to Tailwind in CanvasEmbed and CanvasEmbedDialog

Pending follow-ups (not in this commit):
- Upstream slashCommand type to roamjs-components so the `unknown` cast
  in registerSlashCommands.ts can be dropped
- Dedupe getCanvasPageTargets (conditionToDatalog) and checkForCanvasPage
  (Export.tsx) onto the shared helper
@graphite-app

graphite-app Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

PR size/scope check

This PR is over our review-size guideline.

  • Recommended: ~200 lines changed
  • Acceptable limit: up to 400 lines when well-scoped/self-contained
  • Preferred file count: fewer than 5 files

Please split this into smaller PRs unless there is a clear reason the changes need to land together.

If keeping it as one PR, please add a brief justification covering:

  • What single problem this PR solves
  • Why the files/changes are coupled

sid597 added 2 commits May 20, 2026 14:05
Tailwind isn't compiled in the roam build (config has empty content,
no @tailwind directives in styles/*.css, no PostCSS step in
scripts/compile.ts), so the utility classes added in 08161b0 produced
no CSS and the canvas embed wrapper collapsed to 0x0.

Move the styles to dedicated classes in styles.css (.dg-canvas-embed,
.dg-canvas-embed-placeholder, .dg-canvas-embed-dialog*,
.dg-canvas-embed-source-hidden) to match the existing pattern in that
file. Uses descendant selectors and proper specificity to override
Blueprint dialog defaults and to size the AutocompleteInput inside the
dialog -- neither possible from inline styles.
…-in-block

# Conflicts:
#	apps/roam/src/index.ts
#	apps/roam/src/utils/initializeObserversAndListeners.ts
#	apps/roam/src/utils/isCanvasPage.ts
Comment thread apps/roam/src/components/canvas/CanvasEmbed.tsx Outdated
sid597 added 2 commits May 20, 2026 17:33
Moves the stopPropagation handler from button.parentElement to the
wrapper div. Attaching to the parent overwrote any existing onmousedown
Roam had on the block element and was never cleaned up; attaching to
the wrapper (which renderWithUnmount owns) scopes the handler to the
canvas and removes it on unmount.
The check guarded against a {{dg-canvas: [[X]]}} block living on canvas
page X. But canvas pages hide their block outline (tldrawStyles.ts:4-6),
so users can't author the block via the normal flow on a canvas page.
Removing the dead guard and the getCurrentPageTitle helper that only
served it.
@sid597 sid597 requested a review from mdroidian May 20, 2026 12:29
@mdroidian

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01fc0cf4a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/roam/src/utils/registerSlashCommands.ts
Comment thread apps/roam/src/styles/styles.css Outdated
Comment on lines +195 to +241
.dg-canvas-embed-source-hidden {
display: none;
}

.dg-canvas-embed {
height: 400px;
width: 100%;
overflow: hidden;
border-radius: 6px;
margin: 8px 0;
}

.dg-canvas-embed > .roamjs-tldraw-canvas-container {
height: 100%;
width: 100%;
}

.dg-canvas-embed-placeholder {
display: flex;
align-items: center;
justify-content: center;
height: 100px;
color: #8a9ba8;
font-size: 14px;
border: 1px dashed #d1d5db;
border-radius: 6px;
}

.dg-canvas-embed-dialog.bp3-dialog {
width: 400px;
padding-bottom: 0;
}

.dg-canvas-embed-dialog-body {
padding: 16px;
}

.dg-canvas-embed-dialog-message {
color: #5c7080;
font-size: 14px;
}

.dg-canvas-embed-dialog .roamjs-autocomplete-input-target,
.dg-canvas-embed-dialog .roamjs-autocomplete-input-target .bp3-input-group {
display: block;
width: 100%;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many of these could we move to inline tailwind classes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can move many of these, we need width: 400px; and height: 400px; only in the css because tailwind does not have any equivalent that gets compiled. Here we have all the related styles in style.css but in the new implementation we have both the inline style and in css,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new implementation, if we reuse the existing roamjs-canvas-dialogwhich is used elsewhere in the code, what would need to be in css?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sid597 sid597 merged commit 586955a into main May 21, 2026
9 checks 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.

2 participants