Skip to content

Add inline Figma and Loom embeds in the editor #12

@hrescak

Description

@hrescak

Summary

The editor currently recognizes Figma and Loom URLs and renders them as link cards that open in a new tab. It would be a much better experience to render them as inline embeds (iframes) directly in the post, so readers can preview Figma designs and watch Loom recordings without leaving Draftboard.

Current behavior

  • Figma attachments render as a styled card with the Figma logo, filename, and an external-link icon.
  • Loom attachments render as a styled card with a play icon, filename, and an external-link icon.
  • Both open the original URL in a new browser tab on click.

Relevant code: src/components/editor/nodes/AttachmentNode.tsx (the FIGMA and LOOM branches of AttachmentComponent).

Proposed behavior

  • Figma: Render an <iframe> using Figma's embed URL format (https://www.figma.com/embed?embed_host=draftboard&url=<encoded-url>). Show the interactive Figma preview inline in the post.
  • Loom: Render an <iframe> using Loom's embed URL format (https://www.loom.com/embed/<video-id>). Show the Loom video player inline in the post.
  • Both embeds should be responsive (e.g. 16:9 aspect ratio) and respect the editor's max width.
  • Keep the external-link icon / "Open in Figma/Loom" affordance as a small overlay or caption for users who want the full experience.
  • In edit mode, consider showing a placeholder or reduced-interactivity version to avoid iframe focus conflicts with the editor.

Implementation notes

  • The AttachmentNode already has the FIGMA and LOOM types and the original URL — the main work is in the render function of AttachmentComponent.
  • URL parsing helpers (isFigmaUrl, isLoomUrl) already exist in src/lib/utils.ts.
  • May need a helper to extract the Loom video ID from share URLs and convert Figma URLs to embed format.
  • Consider CSP (frame-src) implications if a Content-Security-Policy header is set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions