fix(editor): even out nested list item spacing

ZE
2d ago
+38-4

Problem

The email theming's default listItem style splits its spacing into paddingTop: 0.3em and paddingBottom: 0.3em. A nested list lives inside its parent item, after the parent's paragraph, so the paddings stack unevenly around it. At a 14px body size:

GapBeforeAfter
item → item8.4px8.4px
parent item → first nested item4.2px8.4px
last nested item → next top-level item12.6px8.4px

The 12.6px gap after a nested list is the "weird space" reported in the Resend broadcast editor.

Fix

In RESET_BASIC (which RESET_MINIMAL reuses for lists, so both themes change):

  • listItem: paddingTop: 0.6em, paddingBottom: 0 (all item spacing on top)
  • list: paddingBottom from 1em to 1.3em, so the space below a list stays the same (the last item used to add 0.3em)
  • nestedList: unchanged (paddingBottom: 0)

Every gap, including deeper nesting, is now 0.6em. This was checked in the live editor DOM before opening the PR.

This changes both the editor preview (injectThemeCss) and the sent email (the serializer inlines the same styles through getResolvedNodeStyles).

Side effect: each top-level list gets 0.3em more space above its first item.

Tests

  • Added a list spacing test in email-theming/extension.spec.ts that resolves the basic and minimal themes through stylesToCss and checks that the item → item, parent → nested and nested → next gaps are equal. It fails on the old values.
  • No existing specs or snapshots asserted the old values.

🤖 Generated with Claude Code


Summary by cubic

Fixes uneven spacing around nested list items in the email theming. List items previously spread their spacing across 0.3em top and bottom padding; since a nested list sits inside its parent item, this produced a 4.2px gap into the nested list and a 12.6px gap out of it at 14px body size. Items now carry all their spacing on top (0.6em), so the gap into a nested list, out of it, and between regular items is equal.

  • Applies to both the basic and minimal themes and shows up in the editor preview and serialized emails.
  • The list bottom padding grows by 0.3em so the space below a list stays the same.
  • Top-level lists now get 0.3em more space above their first item.