Skip to content

feat(image): honor alignment + surface display size for migrated images (#1404)#1406

Open
SailingGreg wants to merge 8 commits into
emdash-cms:mainfrom
SailingGreg:fix/image-work
Open

feat(image): honor alignment + surface display size for migrated images (#1404)#1406
SailingGreg wants to merge 8 commits into
emdash-cms:mainfrom
SailingGreg:fix/image-work

Conversation

@SailingGreg

@SailingGreg SailingGreg commented Jun 11, 2026

Copy link
Copy Markdown

What does this PR do?

The Gutenberg to Portable Text importer captures WordPress image alignment on the image node, but it was dropped at render and not editable. This wires it through end to end and surfaces the existing display-size controls for migrated images.

  • Render (packages/core/src/components/Image.astro): emit emdash-image--align-{left,right,center,wide,full} from the nodes alignment`, with default CSS (left/right float and wrap text; center centers; wide/full span the column).
  • Editor (packages/admin): thread alignment through the PortableText/TipTap serializer (both directions) and the TipTap image node; add an Alignment selector to ImageDetailPanel; reflect alignment in the image NodeView so the editor preview matches the published output.
  • Display size: relax the gate from width && height to src so WordPress-imported images (which carry only displayWidth/displayHeight, no originals) are resizable; the aspect-ratio lock and reset-to-original degrade gracefully when originals are unknown.

Validated end to end on a real WordPress-migrated site: editor -> save -> published page all agree on the canonical alignment field.

Closes #1404

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable)
  • I have added a changeset (this PR changes published packages)
  • New features link to an approved Discussion

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.8 (via Claude Code)

Screenshots / test output

Container-render repro asserts the alignment class is emitted (default render and via a delegating component override); validated end to end on a live WordPress-migrated site (editor -> save -> published render).

…-cms#1404 render follow-up)

Renders the real RAFYC image node through astro-portabletext via the production
dispatch (type.image -> Image.astro), default vs delegating override vs no-locals.
All three emit a valid src: the override receives the full node intact and
delegation to <Image> does NOT render empty. Confirms alignment is dropped.
…d images (emdash-cms#1404)

Renderer (core/Image.astro): add alignment to the PT image node props and
emit an emdash-image--align-{left,right,center,wide,full} figure class with
default CSS (floats wrap text; wide/full span the column).

Editor (admin): thread alignment through the PortableText<->TipTap serializer
(both directions), the TipTap image node attribute/commands, and add an
alignment selector to ImageDetailPanel. Also relax the Display Size gate from
(width && height) to (src) so migrated WordPress images, which carry only
displayWidth/displayHeight and no original dims, can still be resized; the
aspect-ratio lock and reset-to-original now degrade gracefully when originals
are unknown.

Repro test asserts the renderer now emits the alignment class.
Float left/right (text wraps) and size center/wide/full in the TipTap image
NodeView so the editor preview matches the published <Image> output.
@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a260b73

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@SailingGreg

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 11, 2026
Add a max-width:640px media query so left/right-aligned images drop to
full-width blocks on phones instead of staying floated and cramped.
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

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

Labels

area/admin area/core bot:review Trigger an emdashbot code review on this PR cla: signed overlap review/needs-review No maintainer or bot review yet size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image alignment from WordPress import is dropped at render and not editable in the admin editor

2 participants