Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
8931ae9
Block Editor: Add a rotate block support
draganescu Oct 10, 2026
3f97777
Block Editor: Opt wrapperless blocks out of rotation and harden values
draganescu Oct 10, 2026
d203a04
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 10, 2026
2c77b74
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 10, 2026
b7d55c8
Grid: Rotate manual grid items from the canvas
draganescu Oct 10, 2026
cf27943
Block Editor: Allow the hexadecimal string in the rotate support tests
draganescu Oct 10, 2026
8cedd2d
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 10, 2026
e00f4a3
Block Editor: Link the rotate support changelog entries to their PR
draganescu Oct 10, 2026
4f7c582
Grid: Keep the rotate handle on resized blocks, and tidy up Escape
draganescu Oct 10, 2026
47c30b5
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 10, 2026
fbfd9c3
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 10, 2026
45b4cb0
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 10, 2026
98e1f0d
Block Editor: Link the rotate handle changelog entry to its PR
draganescu Oct 10, 2026
2fbf27c
Block Editor: Trim rotation strings before checking they are numeric
draganescu Oct 10, 2026
ad9957b
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 10, 2026
3e76898
Merge remote-tracking branch 'origin/add/image-cover-manual-grid' int…
draganescu Oct 10, 2026
1ad2a35
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 10, 2026
f53f4ad
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 10, 2026
25030f9
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 14, 2026
a1eef6e
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
c075878
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 14, 2026
904888a
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 14, 2026
234e3d7
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
c57991c
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
17f314c
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
6a49abd
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
70dc019
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
fd8b0e4
Grid: Show the cells a rotated block reaches when it is dragged
draganescu Oct 14, 2026
a91c54c
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
3168f53
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 14, 2026
60758e1
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
170e6e8
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
1ded11c
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
6c43b04
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
7cfa97d
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
c9c7f3a
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
2086a9f
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
9d892ce
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
5954721
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
e47a885
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
7d5b421
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
ef9b53f
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 15, 2026
22c6205
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
3396897
Grid: Keep the rotate handle above the grid visualizer
draganescu Oct 16, 2026
a6cf1e9
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
79de658
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
51659a5
Merge remote-tracking branch 'origin/trunk' into add/block-rotate-sup…
draganescu Oct 16, 2026
4f2c4f6
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
b6624ad
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 16, 2026
0e6106b
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 16, 2026
222f801
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 16, 2026
5055b6c
Rotate: Type the viewport setting now that useSettings is typed
draganescu Oct 16, 2026
af1b044
Grid: Make the rotate handle look like a block toolbar button
draganescu Oct 16, 2026
1696fa6
Grid: Keep the rotate handle as wide as a compact button
draganescu Oct 16, 2026
c479118
Grid: Turn a block by as much as the rotate handle turns
draganescu Oct 16, 2026
9a47c9a
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
2008fb8
Grid: Rotate on the first press after a drag in WebKit
draganescu Oct 16, 2026
ecbc368
Grid: Check for the block element when a rotation starts
draganescu Oct 16, 2026
e46f981
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
c756268
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 16, 2026
c3f9321
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 17, 2026
c245bfa
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 17, 2026
8fc2835
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 17, 2026
ee6721b
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 17, 2026
9ed769a
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 17, 2026
06cf950
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 17, 2026
5a37465
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 17, 2026
9442c13
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 18, 2026
7ba10b9
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
Oct 19, 2026
01dbc82
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
Oct 19, 2026
df92af6
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 21, 2026
bc7eb9d
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 21, 2026
ba05038
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 21, 2026
54fac3e
Block Supports: Add the rotate style attribute in the style hook
draganescu Oct 21, 2026
408d6b4
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 21, 2026
5755208
Block Supports: Convert the rotate tests to TypeScript
draganescu Oct 21, 2026
7cd2043
Grid: Convert the rotation helpers and their tests to TypeScript
draganescu Oct 21, 2026
31d9bde
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 21, 2026
26b114b
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 21, 2026
67f9f85
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 21, 2026
f03cfca
Merge remote-tracking branch 'origin/trunk' into add/block-rotate-sup…
draganescu Oct 21, 2026
aa8d5e6
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 21, 2026
94d2616
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 21, 2026
06dfcef
Merge branch 'add/image-cover-manual-grid' into add/grid-rotate-handle
draganescu Oct 21, 2026
24161b5
Block Supports: Only apply rotation with the block rotation experiment
draganescu Oct 21, 2026
d93af25
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 21, 2026
ef6b422
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 21, 2026
168bc80
Add the backport changelog entry for the rotate block support
draganescu Oct 22, 2026
7524abc
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 22, 2026
c03638e
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
1715b68
Grid: Hide the resize handles while a block is rotated
draganescu Oct 22, 2026
bd9834d
Grid: Type the rotate handle mock's optional preview callback
draganescu Oct 22, 2026
f1129ef
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
2840864
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
7d5b2df
Grid: Give the grid item handles the visualizer's z-index again
draganescu Oct 22, 2026
5b444d2
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
6d546fd
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
a172f04
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
f09ca67
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 22, 2026
8a3872d
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
800d8b7
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 23, 2026
23fe581
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
b596579
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
d5cee98
Rotate: Avoid duplicate core rules and keep picker decimals
draganescu Oct 23, 2026
fdd026b
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
41450cf
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 23, 2026
b26406f
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
d1a4899
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
41555a1
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 23, 2026
7ef5fa5
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
a0bd3b2
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
a48973c
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
a623f4b
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 23, 2026
8830256
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
c420390
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
5617881
Block Editor: Move rotation style helpers into utils/rotation
draganescu Oct 23, 2026
d9764b7
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
d872067
Block Editor: Move cleanEmptyObject into utils/object
draganescu Oct 23, 2026
c68bb45
Grid: Address rotation review items
draganescu Oct 23, 2026
8f768ac
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
4341b70
Grid: Memoize the grid visualizer
draganescu Oct 23, 2026
0879988
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 23, 2026
0712bcb
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
3ae0aea
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
7f94fc3
Merge branch 'trunk' into add/block-rotate-support
draganescu Oct 23, 2026
9e0de70
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 23, 2026
abd7c0e
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 23, 2026
7c0b0e7
Block Editor: Add a rotate block support
draganescu Oct 10, 2026
8fedeee
Block Editor: Opt wrapperless blocks out of rotation and harden values
draganescu Oct 10, 2026
99bba4f
Block Editor: Allow the hexadecimal string in the rotate support tests
draganescu Oct 10, 2026
c7086d4
Block Editor: Trim rotation strings before checking they are numeric
draganescu Oct 10, 2026
ba68221
Rotate: Type the viewport setting now that useSettings is typed
draganescu Oct 16, 2026
6a4da83
Block Supports: Add the rotate style attribute in the style hook
draganescu Oct 21, 2026
f165b12
Block Supports: Convert the rotate tests to TypeScript
draganescu Oct 21, 2026
f32ac33
Block Supports: Only apply rotation with the block rotation experiment
draganescu Oct 21, 2026
979ad24
Add the backport changelog entry for the rotate block support
draganescu Oct 22, 2026
fef3ec7
Rotate: Avoid duplicate core rules and keep picker decimals
draganescu Oct 23, 2026
68ee2e8
Block Editor: Move rotation style helpers into utils/rotation
draganescu Oct 23, 2026
41b6a94
Block Editor: Move cleanEmptyObject into utils/object
draganescu Oct 23, 2026
16980b7
add import and fix type errors
tellthemachines Oct 27, 2026
c4923b2
make rotation opt-in, non experimental and under position
tellthemachines Oct 27, 2026
7bdc1b0
add support for group
tellthemachines Oct 27, 2026
11c68c9
Merge remote-tracking branch 'origin/trunk' into add/block-rotate-sup…
draganescu Oct 27, 2026
515a2c9
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Oct 27, 2026
ec34cb1
Merge branch 'add/block-rotate-support' into add/grid-rotate-handle
draganescu Oct 27, 2026
cc4479f
Block supports: Add the transform block support with a rotate feature…
aaronrobertshaw Nov 3, 2026
1057e09
Image: Keep the enlarged lightbox image unrotated
aaronrobertshaw Nov 3, 2026
f75870b
Block supports: Add the Transform panel and editor output for the tra…
aaronrobertshaw Nov 3, 2026
af4b288
Block supports: Add tests and schemas for the transform block support
aaronrobertshaw Nov 3, 2026
fcc95b1
Block supports: Add an e2e test for rotating Image and Button blocks
aaronrobertshaw Nov 3, 2026
425e234
Block supports: Document the transform block support
aaronrobertshaw Nov 3, 2026
a09d074
Add the PR number to the changelog entries
aaronrobertshaw Nov 3, 2026
dc1e173
Block supports: Remove the transform support from the Button block
aaronrobertshaw Nov 3, 2026
915381f
Global Styles: Render transform styles in the editors
aaronrobertshaw Nov 3, 2026
1f27dba
Block supports: Show the rotation in whole degrees
aaronrobertshaw Nov 3, 2026
715fd21
Style engine: Reject an angle with a trailing newline
aaronrobertshaw Nov 3, 2026
86bba91
Update the global styles engine changelog entry
aaronrobertshaw Nov 3, 2026
661a528
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Nov 3, 2026
99f3f97
Merge branch 'add/grid-mobile-stacking' into add/grid-rotate-handle
draganescu Nov 3, 2026
e645535
Add backport changelog entry
aaronrobertshaw Nov 3, 2026
7aeccd0
Schemas: Reject transforms in element state styles
aaronrobertshaw Nov 3, 2026
1eadc31
Merge remote-tracking branch 'origin/add/transform-block-support' int…
draganescu Nov 3, 2026
2b641a1
Grid: Rotate manual grid items through the Transform block support
draganescu Nov 3, 2026
3ce4afd
Grid: Expect the important 0deg stacking rule in the layout hook test
draganescu Nov 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backport-changelog/7.3/15408.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/15408

* https://github.com/WordPress/gutenberg/pull/86240
3 changes: 3 additions & 0 deletions docs/how-to-guides/themes/global-settings-and-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ The settings section has the following structure:
},
"spacingSizes": []
},
"transform": {
"rotate": true
},
"typography": {
"customFontSize": true,
"dropCap": true,
Expand Down
37 changes: 37 additions & 0 deletions docs/reference-guides/block-api/block-supports.md
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,43 @@ supports: {
}
```

## transform

_**Note:** Since WordPress 7.3._

- Type: `Object`
- Default value: `null`
- Subproperties:
- `rotate`: type `boolean`, default value `false`

This value signals that a block supports some of the CSS transform properties. When it does, the block editor shows UI controls for the user to set their values in a Transform panel, if the theme allows it with `settings.transform.rotate`, which is `true` by default.

Each feature is output as its own CSS property, such as `rotate`, and never as the `transform` shorthand. This way a rotation combines with any `transform` a theme or block already applies.

```js
supports: {
transform: {
rotate: true, // Enable the rotation control.
}
}
```

The rotation is applied to the block wrapper. A block can apply it to an inner element instead with a `transform` [feature selector](/docs/reference-guides/block-api/block-selectors.md), for example `.wp-block-image img`. A block that applies the rotation itself can opt out of its output with `__experimentalSkipSerialization`.

When a block declares support for a specific transform property, its attributes definition is extended to include the `style` attribute.

- `style`: an attribute of `object` type with no default assigned. This is added when `rotate` support is declared. It stores the custom values set by the user. A rotation is a single CSS angle, such as `15deg`, `-0.1turn`, `1rad` or `100grad`. For example:

```js
attributes: {
style: {
transform: {
rotate: "15deg",
}
}
}
```

## typography

- Type: `Object`
Expand Down
8 changes: 4 additions & 4 deletions docs/reference-guides/core-blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ Gather blocks in a layout container.

- **Name:** [core/group](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-design/core-block-group/)
- **Category:** [design](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-design/)
- **Supports:** align (full, wide), allowedBlocks, anchor, ariaLabel, background (backgroundImage, backgroundSize, gradient), color (background, button, gradients, heading, link, text), dimensions (minHeight, minWidth), interactivity (clientNavigation), layout (allowSizingOnChildren), position (sticky), shadow, spacing (blockGap, margin, padding), typography (fontSize, lineHeight, textColumns), ~~html~~
- **Supports:** align (full, wide), allowedBlocks, anchor, ariaLabel, background (backgroundImage, backgroundSize, gradient), color (background, button, gradients, heading, link, text), dimensions (minHeight, minWidth), interactivity (clientNavigation), layout (allowSizingOnChildren), position (sticky), shadow, spacing (blockGap, margin, padding), transform (rotate), typography (fontSize, lineHeight, textColumns), ~~html~~
- **Attributes:** tagName, templateLock

## Heading
Expand All @@ -375,7 +375,7 @@ Introduce new sections and organize content to help visitors (and search engines

- **Name:** [core/heading](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-text/core-block-heading/)
- **Category:** [text](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-text/)
- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, background (backgroundClip, backgroundImage, backgroundSize, gradient), className, color (background, gradients, link, text), dimensions (minHeight, minWidth), interactivity (clientNavigation), shadow, spacing (margin, padding), splitting, typography (fitText, fontSize, lineHeight, textAlign, textIndent, textShadow)
- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, background (backgroundClip, backgroundImage, backgroundSize, gradient), className, color (background, gradients, link, text), dimensions (minHeight, minWidth), interactivity (clientNavigation), shadow, spacing (margin, padding), splitting, transform (rotate), typography (fitText, fontSize, lineHeight, textAlign, textIndent, textShadow)
- **Attributes:** content, level, levelOptions, placeholder

## Home Link
Expand Down Expand Up @@ -412,7 +412,7 @@ Insert an image to make a visual statement.

- **Name:** [core/image](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-media/core-block-image/)
- **Category:** [media](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-media/)
- **Supports:** align (center, full, left, right, wide), anchor, color (~~background~~, ~~text~~), filter (duotone), interactivity, shadow, spacing (margin)
- **Supports:** align (center, full, left, right, wide), anchor, color (~~background~~, ~~text~~), filter (duotone), interactivity, shadow, spacing (margin), transform (rotate)
- **Attributes:** alt, aspectRatio, blob, caption, focalPoint, height, href, id, isDecorative, lightbox, linkClass, linkDestination, linkTarget, rel, scale, sizeSlug, title, url, width

## Latest Comments
Expand Down Expand Up @@ -1099,7 +1099,7 @@ Embed a video from your media library or upload a new one.

- **Name:** [core/video](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-media/core-block-video/)
- **Category:** [media](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-media/)
- **Supports:** align, anchor, dimensions (minHeight, minWidth), filter (duotone), interactivity (clientNavigation, interactive), shadow, spacing (margin, padding)
- **Supports:** align, anchor, dimensions (minHeight, minWidth), filter (duotone), interactivity (clientNavigation, interactive), shadow, spacing (margin, padding), transform (rotate)
- **Attributes:** autoplay, blob, caption, controls, height, id, loop, muted, playsInline, poster, preload, src, tracks, width

<!-- END TOKEN Autogenerated - DO NOT EDIT -->
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ New styles options are integrated into theme.json on a regular basis. Knowing th
| `outline.width` | 6.2 | N/A |
| `filter.duotone` | 5.9 | N/A |
| `shadow` | 6.1 | 6.2 |
| `transform.rotate` | 7.3 | 7.3 |
20 changes: 20 additions & 0 deletions docs/reference-guides/theme-json-reference/theme-json-living.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ Settings related to spacing.

---

### transform

Settings related to transforms.

| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| rotate | Allow users to set a rotation. | `boolean` | `true` |

---

### typography

Settings related to typography.
Expand Down Expand Up @@ -349,6 +359,16 @@ Spacing styles.

---

### transform

Transform styles. Only blocks and block style variations support them.

| Property | Description | Type |
| -------- | ----------- | ---- |
| rotate | Sets the `rotate` CSS property. Accepts a single angle, such as `15deg` or `0.25turn`. | `string` |

---

### typography

Typography styles.
Expand Down
29 changes: 19 additions & 10 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -1467,10 +1467,10 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
/*
* Manual placement grids stack their children on mobile, as part of the grid
* interactivity experiment, when they opt in with `stackOnMobile: true`: each
* child becomes full width, in block order, and spans the rows it publishes as
* `--wp--grid-item--row-span`. Stacked rows are as tall as their content, so the span
* doesn't make blocks taller; it keeps the rows numbered like the editor's stacked
* layouts. The selector is repeated so that the rules beat the grid's and each
* child becomes full width, in block order, and unrotated, and spans the rows it
* publishes as `--wp--grid-item--row-span`. Stacked rows are as tall as their content,
* so the span doesn't make blocks taller; it keeps the rows numbered like the editor's
* stacked layouts. The selector is repeated so that the rules beat the grid's and each
* child's own rules, whatever order the stylesheets end up in.
*/
$mobile_media_query = $responsive_media_queries['@mobile'] ?? null;
Expand All @@ -1487,11 +1487,23 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
$has_grid_interactivity
) {
// Stacked blocks are sized by their content again, so their cells are no longer fixed.
$stacking_selector = ".$container_class.$container_class";
/*
* The transform block support rotates blocks with an inline style, and its
* state rules are important, so unrotating the stacked blocks is important too.
*/
$stacked_child_declarations = new WP_Style_Engine_CSS_Declarations_Gutenberg(
array(
'grid-column' => '1 / -1',
'grid-row' => 'span var(--wp--grid-item--row-span, 1)',
)
);
$stacked_child_declarations->add_declaration( 'rotate', '0deg', array( 'important' => true ) );
$stacking_styles = gutenberg_style_engine_get_stylesheet_from_css_rules(
array(
array(
'rules_group' => $mobile_media_query,
'selector' => ".$container_class.$container_class",
'selector' => $stacking_selector,
'declarations' => array(
'aspect-ratio' => 'auto',
'grid-template-rows' => 'none',
Expand All @@ -1501,11 +1513,8 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) {
),
array(
'rules_group' => $mobile_media_query,
'selector' => ".$container_class.$container_class > *",
'declarations' => array(
'grid-column' => '1 / -1',
'grid-row' => 'span var(--wp--grid-item--row-span, 1)',
),
'selector' => "$stacking_selector > *",
'declarations' => $stacked_child_declarations,
),
),
array(
Expand Down
138 changes: 138 additions & 0 deletions lib/block-supports/transform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php
/**
* Transform block support flag.
*
* Each transform feature outputs its own individual CSS property, such as
* `rotate`, never the `transform` shorthand, so features combine with each
* other and with any transform a block already applies.
*
* @package gutenberg
*/

/**
* Registers the style block attribute for block types that support it.
*
* @param WP_Block_Type $block_type Block Type.
*/
function gutenberg_register_transform_support( $block_type ) {
if ( ! $block_type->attributes ) {
$block_type->attributes = array();
}

// Check for existing style attribute definition e.g. from block.json.
if ( array_key_exists( 'style', $block_type->attributes ) ) {
return;
}

if ( block_has_support( $block_type, 'transform', false ) ) {
$block_type->attributes['style'] = array(
'type' => 'object',
);
}
}

/**
* Renders a block's transform styles.
*
* Features are output as inline styles on the block wrapper. When the block
* has a transform feature selector, e.g. `.wp-block-image img`, they are
* output instead to the block supports stylesheet under that selector, so the
* wrapper and anything else in it, such as a caption, are left as they are.
* A feature that skips serialization is left for the block to apply.
*
* State styles, such as `:hover` or `@mobile`, are rendered by the block
* states support.
*
* @param string $block_content Rendered block content.
* @param array $block Block object.
* @return string Filtered block content.
*/
function gutenberg_render_transform_support( $block_content, $block ) {
if ( empty( $block_content ) || empty( $block['blockName'] ) ) {
return $block_content;
}

$transform = $block['attrs']['style']['transform'] ?? null;
if ( empty( $transform ) || ! is_array( $transform ) ) {
return $block_content;
}

$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
if ( ! $block_type || ! block_has_support( $block_type, 'transform', false ) ) {
return $block_content;
}

$inline_styles = array();
$selector_styles = array();

foreach ( array( 'rotate' ) as $feature ) {
if (
! isset( $transform[ $feature ] ) ||
! block_has_support( $block_type, array( 'transform', $feature ), false ) ||
wp_should_skip_block_supports_serialization( $block_type, 'transform', $feature )
) {
continue;
}

$selector = wp_get_block_css_selector( $block_type, array( 'transform', $feature ) ) ?? wp_get_block_css_selector( $block_type, 'transform' );
if ( $selector ) {
$selector_styles[ $selector ][ $feature ] = $transform[ $feature ];
} else {
$inline_styles[ $feature ] = $transform[ $feature ];
}
}

$processor = new WP_HTML_Tag_Processor( $block_content );
if ( ! $processor->next_tag() ) {
return $block_content;
}

$inline_css = gutenberg_style_engine_get_styles( array( 'transform' => $inline_styles ) )['css'] ?? '';
if ( ! empty( $inline_css ) ) {
$existing_style = $processor->get_attribute( 'style' );
$existing_style = is_string( $existing_style ) && '' !== trim( $existing_style ) ? rtrim( trim( $existing_style ), ';' ) . ';' : '';
$processor->set_attribute( 'style', $existing_style . $inline_css );
}

$css_rules = array();
foreach ( $selector_styles as $selector => $styles ) {
$declarations = gutenberg_style_engine_get_styles( array( 'transform' => $styles ) )['declarations'] ?? array();
if ( ! empty( $declarations ) ) {
$css_rules[] = array(
'selector' => $selector,
'declarations' => $declarations,
);
}
}

if ( ! empty( $css_rules ) ) {
$class_name = wp_unique_id_from_values( $css_rules, 'wp-transform-' );
foreach ( $css_rules as $index => $css_rule ) {
$css_rules[ $index ]['selector'] = gutenberg_build_state_selector( ".$class_name", $css_rule['selector'], '', $block['blockName'] );
}

gutenberg_style_engine_get_stylesheet_from_css_rules(
$css_rules,
array(
'context' => 'block-supports',
'prettify' => false,
)
);
$processor->add_class( $class_name );
}

return $processor->get_updated_html();
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'transform',
array(
'register_attribute' => 'gutenberg_register_transform_support',
)
);

if ( function_exists( 'wp_render_transform_support' ) ) {
remove_filter( 'render_block', 'wp_render_transform_support' );
}
add_filter( 'render_block', 'gutenberg_render_transform_support', 10, 2 );
Loading
Loading