close
Skip to content

Block API: add blockGap support when skipping spacing serialization#70327

Open
DarkMatter-999 wants to merge 2 commits intoWordPress:trunkfrom
DarkMatter-999:try/blockgap-on-spacing-skipserialization
Open

Block API: add blockGap support when skipping spacing serialization#70327
DarkMatter-999 wants to merge 2 commits intoWordPress:trunkfrom
DarkMatter-999:try/blockgap-on-spacing-skipserialization

Conversation

@DarkMatter-999
Copy link
Copy Markdown

What?

Closes #63163

This PR adds support for blockGap when using supports.spacing.__experimentalSkipSerialisation in the block.json.

Why?

Currently there exists support for margin and padding but blockGap is not supported. This PR adds support for that.

How?

This PR adds gap.ts at packages/style-engine/src/styles/spacing/gap.ts.
The implementation is similar to the implementation for the padding and margin.

Testing Instructions

Create/edit a block.

  1. In block.json, set supports.spacing.__experimentalSkipSerialisation to true.
"supports": {
	"spacing": {
		"__experimentalSkipSerialization": true,
		"padding": true,
                 "margin": true,
		"blockGap": true
	}
}
  1. In Edit import { __experimentalGetSpacingClassesAndStyles as useSpacingProps } from '@wordpress/block-editor';.
  2. In Edit const spacingProps = useSpacingProps( attributes );
import {
	__experimentalGetSpacingClassesAndStyles as useSpacingProps,
} from '@wordpress/block-editor';

export default function ( { attributes } ) {
	const spacingProps = useSpacingProps( attributes );
	console.log( spacingProps );
}

Screenshots or screencast

Before:

Screen.Recording.2025-06-05.at.11.11.42.AM.mov

After:

Screen.Recording.2025-06-05.at.11.12.41.AM.mov

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 5, 2025

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @DarkMatter-999! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jun 5, 2025
@DarkMatter-999 DarkMatter-999 marked this pull request as ready for review June 5, 2025 06:33
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 5, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: DarkMatter-999 <lakshyajeet@git.wordpress.org>
Co-authored-by: inc2734 <inc2734@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Block API API that allows to express the block paradigm. labels Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block API API that allows to express the block paradigm. First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot get blockGap when skipping supports.spacing serialisation.

2 participants