Skip to content

Commit

Permalink
try alignfull = global padding
Browse files Browse the repository at this point in the history
  • Loading branch information
richtabor committed Apr 29, 2024
1 parent d09bc38 commit 16769a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
if ( empty( $fallback_layout ) ) {
$fallback_layout = $block_type->supports['__experimentalLayout']['default'] ?? array();
}
$used_layout = $block['attrs']['layout'] ?? $fallback_layout;
$used_layout = $block['attrs']['layout'] ?? $fallback_layout;
$used_alignment = $block['attrs']['align'] ?? array();

$class_names = array();
$layout_definitions = gutenberg_get_layout_definitions();
Expand All @@ -732,7 +733,7 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {

$root_padding_aware_alignments = $global_settings['useRootPaddingAwareAlignments'] ?? false;

if ( $root_padding_aware_alignments && isset( $used_layout['type'] ) && 'constrained' === $used_layout['type'] ) {
if ( $root_padding_aware_alignments && isset( $used_layout['type'] ) || 'full' === $used_alignment ) {
$class_names[] = 'has-global-padding';
}

Expand Down
10 changes: 8 additions & 2 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
return (
( usedLayout?.inherit ||
usedLayout?.contentSize ||
usedLayout?.type === 'constrained' ) &&
usedLayout?.type === 'constrained' ||
blockAttributes?.align === 'full' ) &&
select( blockEditorStore ).getSettings().__experimentalFeatures
?.useRootPaddingAwareAlignments
);
},
[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]
[
usedLayout?.contentSize,
usedLayout?.inherit,
usedLayout?.type,
blockAttributes?.align,
]
);

if ( hasGlobalPadding ) {
Expand Down

0 comments on commit 16769a5

Please sign in to comment.