Skip to content

Port EmailBuilder MUI sample canvas into post-kit-editor #139

Description

@patoperpetua

Parent: #138

Goal

Replace the skinny hand-rolled EmailBuilder canvas in @singleton-sd/post-kit-editor with a vendored/adapted port of the official EmailBuilder.js MUI sample (examples/vite-emailbuilder-mui) so the visual editor matches https://usewaypoint.github.io/email-builder-js (inspector drawer, samples drawer, template panel).

Scope

Dependencies

Add as runtime dependencies of packages/post-kit-editor (aligned with the sample; React stays peer):

  • @mui/material ^5.15.10
  • @mui/icons-material ^5.15.10
  • @emotion/react ^11.11.3
  • @emotion/styled ^11.11.0
  • zustand ^4.5.1
  • react-colorful ^5.6.1

Pin @usewaypoint/email-builder and block packages to the versions already used by the compiler/editor.

Vendor / adapt

  • Add src/email-builder-ui/ adapted from usewaypoint/email-builder-js examples/vite-emailbuilder-mui (MIT — keep attribution).
  • Include: InspectorDrawer + per-block input panels, SamplesDrawer (starter documents; strip Waypoint marketing chrome), TemplatePanel canvas/editor surface, sample editor state (zustand EditorContext pattern).
  • Controlled bridge: document changes update PostKit workingFiles.templateJson (and accept document from props when the host template changes).

Wire as default canvas

  • EmailTemplateEditor (and later EmailTemplateAdmin) use this surface as the default visual editor path.
  • Hand-rolled src/canvas/ + Add block UX is no longer the primary path (may remain temporarily for tests until superseded).

Tests

  • SSR-safe smoke that the new canvas mounts with a fixture document.
  • Existing serialization / validate / save helper tests still pass.

Constraints

  • EmailBuilder.js JSON remains the editable source of truth.
  • Do not accept API keys or perform network/filesystem I/O.
  • Do not implement EmailTemplateAdmin list shell here (next issue).
  • Strip Waypoint marketing / external promo links from Samples drawer; keep useful starter templates.

Acceptance criteria

  • MUI/emotion/zustand/react-colorful are runtime deps of post-kit-editor.
  • src/email-builder-ui/ provides inspector + samples + editable canvas comparable to the official playground.
  • Editing the canvas updates the editor working templateJson.
  • pnpm --filter @singleton-sd/post-kit-editor test passes.
  • Package builds successfully.

Agent implementation notes

Read packages/post-kit-editor/src/canvas/ and the upstream sample at https://github.com/usewaypoint/email-builder-js/tree/main/examples/vite-emailbuilder-mui. Branch: feat/<N>-email-builder-mui-canvas.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyMeets every criterion in docs/github-source-of-truth.md, section 4 — safe for an agent to claimenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions