Skip to content

Commit

Permalink
Match the front end and editor for .alignfull Post Template.
Browse files Browse the repository at this point in the history
Temporary fix for #10.

Also adds padding support to the Post Template block.
  • Loading branch information
justintadlock committed May 11, 2024
1 parent 82330c8 commit a9a83be
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/css/blocks/core/post-template.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '8ebf5ca30ae32b6720d6');
<?php return array('dependencies' => array(), 'version' => '2d8290c8498629f9ac57');
2 changes: 1 addition & 1 deletion public/css/blocks/core/post-template.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions resources/scss/blocks/core/post-template.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
/// The editor gives a negative margin here but not on the front end. Just
/// making sure these match.
///
.wp-block-query.is-layout-constrained > .wp-block-post-template.alignfull,
.editor-styles-wrapper .wp-block-query.is-layout-constrained > .wp-block-post-template.alignfull {
margin-left: auto;
margin-right: auto;
Expand Down
16 changes: 16 additions & 0 deletions src/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ public function setCoreHeadingArgs(array $args, string $name): array
return $args;
}

/**
* Adds spacing support to the Post Template block.
*
* @hook register_block_type_args last
* @since 1.0.0
*/
public function setCorePostTemplateArgs(array $args, string $name): array
{
if ('core/post-template' === $name) {
$args['supports']['spacing'] ??= [];
$args['supports']['spacing']['padding'] ??= true;
}

return $args;
}

/**
* Adds spacing support to the Query Loop block.
*
Expand Down

0 comments on commit a9a83be

Please sign in to comment.