Skip to content

Commit efe57e5

Browse files
Merge branch 'WordPress:trunk' into trunk
2 parents b81e6ff + 9e03973 commit efe57e5

File tree

65 files changed

+629
-436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+629
-436
lines changed

.github/workflows/rnmobile-android-runner.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: ./.github/setup-node
3838

3939
- name: Restore tests setup cache
40-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
40+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
4141
with:
4242
path: |
4343
~/.appium
@@ -52,7 +52,7 @@ jobs:
5252
# AVD cache disabled as it caused emulator termination to hang indefinitely.
5353
# https://github.com/ReactiveCircus/android-emulator-runner/issues/385
5454
# - name: AVD cache
55-
# uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
55+
# uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
5656
# id: avd-cache
5757
# with:
5858
# path: |

.github/workflows/rnmobile-ios-runner.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
uses: ./.github/setup-node
4343

4444
- name: Restore tests setup cache
45-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
45+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
4646
with:
4747
path: |
4848
~/.appium
@@ -55,15 +55,15 @@ jobs:
5555
run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt
5656

5757
- name: Restore build cache
58-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
58+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
5959
with:
6060
path: |
6161
packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app
6262
packages/react-native-editor/ios/build/WDA
6363
key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ matrix.device }}-${{ hashFiles('ios-checksums.txt') }}
6464

6565
- name: Restore pods cache
66-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
66+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
6767
with:
6868
path: |
6969
packages/react-native-editor/ios/Pods

.github/workflows/unit-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ jobs:
296296
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
297297

298298
- name: Cache PHPCS scan cache
299-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
299+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
300300
with:
301301
path: .cache/phpcs.json
302302
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}

backport-changelog/6.8/7976.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
https://github.com/WordPress/wordpress-develop/pull/7976
2+
3+
* https://github.com/WordPress/gutenberg/pull/67716

lib/class-wp-theme-json-gutenberg.php

+2
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,8 @@ public function get_settings() {
13191319
* - `variables`: only the CSS Custom Properties for presets & custom ones.
13201320
* - `styles`: only the styles section in theme.json.
13211321
* - `presets`: only the classes for the presets.
1322+
* - `base-layout-styles`: only the base layout styles.
1323+
* - `custom-css`: only the custom CSS.
13221324
* @param array $origins A list of origins to include. By default it includes VALID_ORIGINS.
13231325
* @param array $options An array of options for now used for internal purposes only (may change without notice).
13241326
* The options currently supported are:

lib/global-styles-and-settings.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Returns the stylesheet resulting of merging core, theme, and user data.
1010
*
1111
* @param array $types Types of styles to load. Optional.
12-
* It accepts as values: 'variables', 'presets', 'styles', 'base-layout-styles.
12+
* See {@see 'WP_Theme_JSON::get_stylesheet'} for all valid types.
1313
* If empty, it'll load the following:
1414
* - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'.
1515
* - for themes with theme.json: 'variables', 'presets', 'styles'.
@@ -142,6 +142,8 @@ function gutenberg_get_global_settings( $path = array(), $context = array() ) {
142142
/**
143143
* Gets the global styles custom css from theme.json.
144144
*
145+
* @deprecated Gutenberg 18.6.0 Use {@see 'gutenberg_get_global_stylesheet'} instead for top-level custom CSS, or {@see 'WP_Theme_JSON_Gutenberg::get_styles_for_block'} for block-level custom CSS.
146+
*
145147
* @return string
146148
*/
147149
function gutenberg_get_global_styles_custom_css() {

packages/block-editor/src/components/block-lock/modal.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
9999
>
100100
<fieldset className="block-editor-block-lock-modal__options">
101101
<legend>
102-
{ __(
103-
'Choose specific attributes to restrict or lock all available options.'
104-
) }
102+
{ __( 'Select the features you want to lock' ) }
105103
</legend>
106104
{ /*
107105
* Disable reason: The `list` ARIA role is redundant but
@@ -137,7 +135,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
137135
<li className="block-editor-block-lock-modal__checklist-item">
138136
<CheckboxControl
139137
__nextHasNoMarginBottom
140-
label={ __( 'Restrict editing' ) }
138+
label={ __( 'Lock editing' ) }
141139
checked={ !! lock.edit }
142140
onChange={ ( edit ) =>
143141
setLock( ( prevLock ) => ( {
@@ -159,7 +157,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
159157
<li className="block-editor-block-lock-modal__checklist-item">
160158
<CheckboxControl
161159
__nextHasNoMarginBottom
162-
label={ __( 'Disable movement' ) }
160+
label={ __( 'Lock movement' ) }
163161
checked={ lock.move }
164162
onChange={ ( move ) =>
165163
setLock( ( prevLock ) => ( {
@@ -178,7 +176,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
178176
<li className="block-editor-block-lock-modal__checklist-item">
179177
<CheckboxControl
180178
__nextHasNoMarginBottom
181-
label={ __( 'Prevent removal' ) }
179+
label={ __( 'Lock removal' ) }
182180
checked={ lock.remove }
183181
onChange={ ( remove ) =>
184182
setLock( ( prevLock ) => ( {

packages/block-editor/src/components/block-patterns-list/stories/fixtures.js

+1
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ export default [
530530
background: '#000000',
531531
},
532532
},
533+
tagName: 'hr',
533534
},
534535
innerBlocks: [],
535536
originalContent:

packages/block-editor/src/components/spacing-sizes-control/style.scss

-29
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,11 @@
44
margin-bottom: 0;
55
}
66

7-
.is-marked {
8-
.components-range-control__track {
9-
transition: width ease 0.1s;
10-
@include reduce-motion("transition");
11-
}
12-
13-
.components-range-control__thumb-wrapper {
14-
transition: left ease 0.1s;
15-
@include reduce-motion("transition");
16-
}
17-
}
18-
197
.spacing-sizes-control__range-control,
208
.spacing-sizes-control__custom-value-range {
219
flex: 1;
2210
margin-bottom: 0; // Needed for some instances of the range control, such as the Spacer block.
2311
}
24-
25-
.components-range-control__mark {
26-
transform: translateX(-50%);
27-
height: $grid-unit-05;
28-
width: math.div($grid-unit-05, 2);
29-
background-color: $white;
30-
z-index: 1;
31-
top: -#{$grid-unit-05};
32-
}
33-
34-
.components-range-control__marks {
35-
margin-top: 17px;
36-
}
37-
38-
.components-range-control__thumb-wrapper {
39-
z-index: 3;
40-
}
4112
}
4213

4314
.spacing-sizes-control__header {

packages/block-editor/src/components/warning/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import clsx from 'clsx';
66
/**
77
* WordPress dependencies
88
*/
9-
import { Children } from '@wordpress/element';
109
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
1110
import { __ } from '@wordpress/i18n';
1211
import { moreVertical } from '@wordpress/icons';
@@ -20,10 +19,10 @@ function Warning( { className, actions, children, secondaryActions } ) {
2019
{ children }
2120
</p>
2221

23-
{ ( Children.count( actions ) > 0 || secondaryActions ) && (
22+
{ ( actions?.length > 0 || secondaryActions ) && (
2423
<div className="block-editor-warning__actions">
25-
{ Children.count( actions ) > 0 &&
26-
Children.map( actions, ( action, i ) => (
24+
{ actions?.length > 0 &&
25+
actions.map( ( action, i ) => (
2726
<span
2827
key={ i }
2928
className="block-editor-warning__action"

packages/block-editor/src/components/warning/test/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ describe( 'Warning', () => {
1818

1919
it( 'should show primary actions', () => {
2020
render(
21-
<Warning actions={ <button>Click me</button> }>Message</Warning>
21+
<Warning actions={ [ <button key="test">Click me</button> ] }>
22+
Message
23+
</Warning>
2224
);
2325

2426
expect(

packages/block-editor/src/hooks/use-zoom-out.js

+48-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* WordPress dependencies
33
*/
44
import { useSelect, useDispatch } from '@wordpress/data';
5-
import { useEffect } from '@wordpress/element';
5+
import { useEffect, useRef } from '@wordpress/element';
66

77
/**
88
* Internal dependencies
@@ -12,32 +12,64 @@ import { unlock } from '../lock-unlock';
1212

1313
/**
1414
* A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.
15+
* Concepts:
16+
* - If we most recently changed the zoom level for them (in or out), we always resetZoomLevel() level when unmounting.
17+
* - If the user most recently changed the zoom level (manually toggling), we do nothing when unmounting.
1518
*
16-
* @param {boolean} zoomOut If we should enter into zoomOut mode or not
19+
* @param {boolean} enabled If we should enter into zoomOut mode or not
1720
*/
18-
export function useZoomOut( zoomOut = true ) {
21+
export function useZoomOut( enabled = true ) {
1922
const { setZoomLevel, resetZoomLevel } = unlock(
2023
useDispatch( blockEditorStore )
2124
);
22-
const { isZoomOut } = unlock( useSelect( blockEditorStore ) );
2325

26+
/**
27+
* We need access to both the value and the function. The value is to trigger a useEffect hook
28+
* and the function is to check zoom out within another hook without triggering a re-render.
29+
*/
30+
const { isZoomedOut, isZoomOut } = useSelect( ( select ) => {
31+
const { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );
32+
return {
33+
isZoomedOut: _isZoomOut(),
34+
isZoomOut: _isZoomOut,
35+
};
36+
}, [] );
37+
38+
const controlZoomLevelRef = useRef( false );
39+
const isEnabledRef = useRef( enabled );
40+
41+
/**
42+
* This hook tracks if the zoom state was changed manually by the user via clicking
43+
* the zoom out button. We only want this to run when isZoomedOut changes, so we use
44+
* a ref to track the enabled state.
45+
*/
2446
useEffect( () => {
25-
const isZoomOutOnMount = isZoomOut();
47+
// If the zoom state changed (isZoomOut) and it does not match the requested zoom
48+
// state (zoomOut), then it means the user manually changed the zoom state while
49+
// this hook was mounted, and we should no longer control the zoom state.
50+
if ( isZoomedOut !== isEnabledRef.current ) {
51+
controlZoomLevelRef.current = false;
52+
}
53+
}, [ isZoomedOut ] );
2654

27-
return () => {
28-
if ( isZoomOutOnMount ) {
55+
useEffect( () => {
56+
isEnabledRef.current = enabled;
57+
58+
if ( enabled !== isZoomOut() ) {
59+
controlZoomLevelRef.current = true;
60+
61+
if ( enabled ) {
2962
setZoomLevel( 'auto-scaled' );
3063
} else {
3164
resetZoomLevel();
3265
}
33-
};
34-
}, [] );
35-
36-
useEffect( () => {
37-
if ( zoomOut ) {
38-
setZoomLevel( 'auto-scaled' );
39-
} else {
40-
resetZoomLevel();
4166
}
42-
}, [ zoomOut, setZoomLevel, resetZoomLevel ] );
67+
68+
return () => {
69+
// If we are controlling zoom level and are zoomed out, reset the zoom level.
70+
if ( controlZoomLevelRef.current && isZoomOut() ) {
71+
resetZoomLevel();
72+
}
73+
};
74+
}, [ enabled, isZoomOut, resetZoomLevel, setZoomLevel ] );
4375
}

packages/components/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- `GradientPicker`: Add `enableAlpha` prop ([#66974](https://github.com/WordPress/gutenberg/pull/66974))
1212
- `CustomGradientPicker`: Add `enableAlpha` prop ([#66974](https://github.com/WordPress/gutenberg/pull/66974))
13+
- `RangeControl`: Update the design of the range control marks ([#67611](https://github.com/WordPress/gutenberg/pull/67611))
1314

1415
### Deprecations
1516

packages/components/src/date-time/stories/date-time.story.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const Template: StoryFn< typeof DateTimePicker > = ( {
5151
};
5252

5353
export const Default: StoryFn< typeof DateTimePicker > = Template.bind( {} );
54+
Default.args = {
55+
currentDate: new Date(),
56+
};
5457

5558
export const WithEvents: StoryFn< typeof DateTimePicker > = Template.bind( {} );
5659
WithEvents.args = {

packages/components/src/date-time/stories/date.story.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const Template: StoryFn< typeof DatePicker > = ( {
5151
};
5252

5353
export const Default: StoryFn< typeof DatePicker > = Template.bind( {} );
54+
Default.args = {
55+
currentDate: new Date(),
56+
};
5457

5558
export const WithEvents: StoryFn< typeof DatePicker > = Template.bind( {} );
5659
WithEvents.args = {

packages/components/src/date-time/stories/time.story.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ const Template: StoryFn< typeof TimePicker > = ( {
5252
};
5353

5454
export const Default: StoryFn< typeof TimePicker > = Template.bind( {} );
55+
Default.args = {
56+
currentTime: new Date(),
57+
};
5558

5659
const TimeInputTemplate: StoryFn< typeof TimePicker.TimeInput > = ( args ) => {
5760
return <TimePicker.TimeInput { ...args } />;

packages/components/src/disabled/stories/index.story.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Default.args = {
8282
export const ContentEditable: StoryFn< typeof Disabled > = ( args ) => {
8383
return (
8484
<Disabled { ...args }>
85-
<div contentEditable tabIndex={ 0 }>
85+
<div contentEditable tabIndex={ 0 } suppressContentEditableWarning>
8686
contentEditable
8787
</div>
8888
</Disabled>

packages/components/src/popover/stories/index.story.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ const meta: Meta< typeof Popover > = {
5858
export default meta;
5959

6060
const PopoverWithAnchor = ( args: PopoverProps ) => {
61-
const anchorRef = useRef( null );
61+
const [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(
62+
null
63+
);
6264

6365
return (
6466
<div
@@ -71,11 +73,11 @@ const PopoverWithAnchor = ( args: PopoverProps ) => {
7173
>
7274
<p
7375
style={ { padding: '8px', background: 'salmon' } }
74-
ref={ anchorRef }
76+
ref={ setPopoverAnchor }
7577
>
7678
Popover&apos;s anchor
7779
</p>
78-
<Popover { ...args } anchorRef={ anchorRef } />
80+
<Popover { ...args } anchor={ popoverAnchor } />
7981
</div>
8082
);
8183
};

packages/components/src/range-control/mark.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export default function RangeMark(
3838
{ ...otherProps }
3939
aria-hidden="true"
4040
className={ classes }
41-
isFilled={ isFilled }
4241
style={ style }
4342
/>
4443
{ label && (

0 commit comments

Comments
 (0)