Disable block gap rendering between root-level blocks.
Top level blocks are post content and header and footer wrapping blocks. Disabling the gap between these blocks prevents rendering a gap between post-content blocks and header and footer. [MAILPOET-6088]
This commit is contained in:
committed by
Jan Lysý
parent
4a04744d1c
commit
e3d5b7a7e0
@@ -176,7 +176,6 @@ export function VisualEditor({
|
|||||||
<BlockList
|
<BlockList
|
||||||
className={classnames(
|
className={classnames(
|
||||||
`is-${deviceType.toLowerCase()}-preview`,
|
`is-${deviceType.toLowerCase()}-preview`,
|
||||||
'wp-site-blocks',
|
|
||||||
'has-global-padding', // Ensures that padding is applied at the top level
|
'has-global-padding', // Ensures that padding is applied at the top level
|
||||||
)}
|
)}
|
||||||
// @ts-expect-error No types for this exist yet.
|
// @ts-expect-error No types for this exist yet.
|
||||||
|
@@ -16,8 +16,13 @@ class SpacingPreprocessor implements Preprocessor {
|
|||||||
foreach ($parsedBlocks as $key => $block) {
|
foreach ($parsedBlocks as $key => $block) {
|
||||||
$parentBlockName = $parentBlock['blockName'] ?? '';
|
$parentBlockName = $parentBlock['blockName'] ?? '';
|
||||||
|
|
||||||
// Do not add a gap to the first child, or if the parent block is a buttons block (where buttons are side by side).
|
/**
|
||||||
if ($key !== 0 && $gap && $parentBlockName !== 'core/buttons') {
|
* Do not add a gap to:
|
||||||
|
* - the top level blocks - they are post-content, and header and footer wrappers and we don't want a gap between those
|
||||||
|
* - first child
|
||||||
|
* - parent block is a buttons block (where buttons are side by side).
|
||||||
|
**/
|
||||||
|
if ($parentBlock && $key !== 0 && $gap && $parentBlockName !== 'core/buttons') {
|
||||||
$block['email_attrs']['margin-top'] = $gap;
|
$block['email_attrs']['margin-top'] = $gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user