twentytwentythree icon indicating copy to clipboard operation
twentytwentythree copied to clipboard

Spacing: replace var() format with var:preset|spacing|value

Open carolinan opened this issue 3 years ago • 1 comments

Across the templates, the format var(--wp--preset--spacing--90) is used inside the JSON block comment. For the code in the template to match the code of new blocks added in the block editor, this format should be used: var:preset|spacing|numeric-value See https://github.com/WordPress/twentytwentythree/pull/55#discussion_r952127903

carolinan avatar Aug 23 '22 04:08 carolinan

Updating it for the spacer block did not work:

<!-- wp:spacer {"height":"var:preset|spacing|40"} -->
<div style="height:var(--wp--preset--spacing--40)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
Block validation failed for `core/spacer` (Object).
Content generated by `save` function:
<div style="height:var:preset|spacing|40" aria-hidden="true" class="wp-block-spacer"></div>
Content retrieved from post body:
<div style="height:var(--wp--preset--spacing--40)" aria-hidden="true" class="wp-block-spacer"></div>

carolinan avatar Aug 23 '22 11:08 carolinan

It looks like we've replaced all the possible spacing presets with the correct format across the templates.

The only ones left are the spacer blocks, but it looks like this currently isn't possible as the spacing presets are not valid height settings. I've opened up an issue for this: https://github.com/WordPress/gutenberg/issues/43816

mikachan avatar Sep 02 '22 12:09 mikachan