diff --git a/mailpoet/assets/js/src/email-editor/engine/components/block-editor/visual-editor/visual-editor.tsx b/mailpoet/assets/js/src/email-editor/engine/components/block-editor/visual-editor/visual-editor.tsx index 1d064b8e13..0199358574 100644 --- a/mailpoet/assets/js/src/email-editor/engine/components/block-editor/visual-editor/visual-editor.tsx +++ b/mailpoet/assets/js/src/email-editor/engine/components/block-editor/visual-editor/visual-editor.tsx @@ -176,7 +176,6 @@ export function VisualEditor({ $block) { $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; }