Skip to content

CRITICAL: core blocks emit raw 'style' STRING attrs → mass 'unexpected/invalid block content'; map to canonical block style attributes instead #261

Description

@chubes4

Root cause (pervasive)

The transformer emits raw inline CSS as a style STRING attribute on core blocks:

wp:paragraph {"className":"hero-eyebrow","style":"display:flex;align-items:center;..."}
wp:heading   {"style":"font-size:clamp(4rem,11vw,8rem);color:var(--rose-deep)"}
wp:group     {"style":"padding:clamp(...);background:radial-gradient(...)"}

Core blocks expect a structured style OBJECT (style.typography/style.color/style.spacing/style.border) + the layout attribute — NOT a raw CSS string. So the stored <p style="..."> doesn't match the block's save() output → the editor throws "This block contains unexpected or invalid content" for nearly every styled element (a wall of invalid blocks).

Detection vs fix

Ask (generalize #241 to all blocks)

In the Style/ layer (StyleResolutionTrait, post-slice-5) + BlockFactory + the block-emission path, translate resolved CSS into canonical block attributes for ALL emitted blocks:

Generic; no fixture strings. This is the central style-fidelity + block-validity fix — it eliminates the invalid-block wall AND makes imports actually look right. Closes #259 (hidden-state half) too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions