@wordpress/block-library 8.21.0 → 8.21.1-next.f8d8eceb.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/avatar/index.js +5 -1
- package/build/avatar/index.js.map +1 -1
- package/build/block/edit-title.native.js +11 -3
- package/build/block/edit-title.native.js.map +1 -1
- package/build/column/edit.js +2 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +2 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/edit.native.js +2 -1
- package/build/columns/edit.native.js.map +1 -1
- package/build/cover/controls.native.js +2 -1
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/edit/index.js +2 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/file/view.js +1 -1
- package/build/file/view.js.map +1 -1
- package/build/form/edit.js +1 -1
- package/build/form/edit.js.map +1 -1
- package/build/form/variations.js +1 -1
- package/build/form/variations.js.map +1 -1
- package/build/form-input/index.js +1 -1
- package/build/form-input/variations.js +7 -7
- package/build/form-input/variations.js.map +1 -1
- package/build/form-submission-notification/variations.js +4 -4
- package/build/form-submission-notification/variations.js.map +1 -1
- package/build/form-submit-button/index.js +1 -1
- package/build/group/edit.js +2 -11
- package/build/group/edit.js.map +1 -1
- package/build/html/preview.js +2 -4
- package/build/html/preview.js.map +1 -1
- package/build/image/image.js +11 -5
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +10 -20
- package/build/image/view.js.map +1 -1
- package/build/missing/edit.native.js +46 -8
- package/build/missing/edit.native.js.map +1 -1
- package/build/paragraph/edit.js +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +2 -2
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +27 -13
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +15 -12
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/utils.js +29 -8
- package/build/query/utils.js.map +1 -1
- package/build/query/view.js +4 -2
- package/build/query/view.js.map +1 -1
- package/build/search/edit.js +1 -2
- package/build/search/edit.js.map +1 -1
- package/build/social-link/edit.native.js +7 -19
- package/build/social-link/edit.native.js.map +1 -1
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +1 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/edit.native.js +5 -1
- package/build/spacer/edit.native.js.map +1 -1
- package/build/tag-cloud/edit.js +2 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +2 -2
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/term-description/index.js +0 -1
- package/build/term-description/index.js.map +1 -1
- package/build-module/avatar/index.js +5 -1
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/block/edit-title.native.js +12 -4
- package/build-module/block/edit-title.native.js.map +1 -1
- package/build-module/column/edit.js +3 -2
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +3 -2
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/edit.native.js +3 -2
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/cover/controls.native.js +3 -2
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/edit/index.js +3 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +3 -2
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/file/view.js +2 -2
- package/build-module/file/view.js.map +1 -1
- package/build-module/form/edit.js +1 -1
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form/variations.js +1 -1
- package/build-module/form/variations.js.map +1 -1
- package/build-module/form-input/index.js +1 -1
- package/build-module/form-input/variations.js +7 -7
- package/build-module/form-input/variations.js.map +1 -1
- package/build-module/form-submission-notification/variations.js +4 -4
- package/build-module/form-submission-notification/variations.js.map +1 -1
- package/build-module/form-submit-button/index.js +1 -1
- package/build-module/group/edit.js +3 -12
- package/build-module/group/edit.js.map +1 -1
- package/build-module/html/preview.js +2 -4
- package/build-module/html/preview.js.map +1 -1
- package/build-module/image/image.js +12 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +10 -20
- package/build-module/image/view.js.map +1 -1
- package/build-module/missing/edit.native.js +47 -9
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/paragraph/edit.js +2 -2
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +3 -3
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +28 -14
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +17 -14
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/utils.js +27 -5
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query/view.js +4 -2
- package/build-module/query/view.js.map +1 -1
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +8 -20
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js +4 -4
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +3 -2
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +2 -2
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/edit.native.js +6 -2
- package/build-module/spacer/edit.native.js.map +1 -1
- package/build-module/tag-cloud/edit.js +3 -2
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +3 -3
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/term-description/index.js +0 -1
- package/build-module/term-description/index.js.map +1 -1
- package/build-style/file/style-rtl.css +0 -5
- package/build-style/file/style.css +0 -5
- package/build-style/navigation/style-rtl.css +5 -0
- package/build-style/navigation/style.css +5 -0
- package/build-style/style-rtl.css +5 -5
- package/build-style/style.css +5 -5
- package/package.json +32 -32
- package/src/avatar/block.json +5 -1
- package/src/block/edit-title.native.js +16 -13
- package/src/calendar/index.php +2 -6
- package/src/column/edit.js +3 -8
- package/src/column/edit.native.js +3 -8
- package/src/columns/edit.native.js +3 -8
- package/src/comment-author-avatar/index.php +1 -1
- package/src/cover/controls.native.js +3 -8
- package/src/cover/edit/index.js +3 -2
- package/src/cover/edit/inspector-controls.js +3 -8
- package/src/file/index.php +2 -1
- package/src/file/style.scss +0 -6
- package/src/file/view.js +2 -2
- package/src/form/edit.js +1 -1
- package/src/form/variations.js +1 -1
- package/src/form-input/block.json +1 -1
- package/src/form-input/variations.js +7 -7
- package/src/form-submission-notification/variations.js +4 -4
- package/src/form-submit-button/block.json +1 -1
- package/src/freeform/test/__snapshots__/index.native.js.snap +7 -0
- package/src/freeform/test/index.native.js +57 -0
- package/src/group/edit.js +2 -7
- package/src/html/preview.js +9 -4
- package/src/image/image.js +17 -6
- package/src/image/index.php +5 -6
- package/src/image/view.js +13 -19
- package/src/missing/edit.native.js +43 -6
- package/src/navigation/index.php +1 -1
- package/src/navigation/style.scss +6 -1
- package/src/paragraph/edit.js +2 -2
- package/src/post-featured-image/dimension-controls.js +3 -3
- package/src/query/edit/enhanced-pagination-modal.js +37 -21
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +18 -22
- package/src/query/index.php +97 -8
- package/src/query/utils.js +29 -8
- package/src/query/view.js +11 -2
- package/src/query-pagination-next/index.php +1 -1
- package/src/query-pagination-previous/index.php +1 -1
- package/src/search/edit.js +5 -3
- package/src/social-link/edit.native.js +12 -26
- package/src/social-link/editor.native.scss +0 -9
- package/src/social-link/index.php +2 -2
- package/src/spacer/controls.js +9 -12
- package/src/spacer/controls.native.js +3 -8
- package/src/spacer/edit.js +2 -2
- package/src/spacer/edit.native.js +6 -5
- package/src/tag-cloud/edit.js +3 -7
- package/src/template-part/edit/inner-blocks.js +3 -3
- package/src/term-description/block.json +0 -1
package/src/query/utils.js
CHANGED
|
@@ -346,22 +346,43 @@ export const usePatterns = ( clientId, name ) => {
|
|
|
346
346
|
};
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
350
|
-
*
|
|
349
|
+
* The object returned by useUnsupportedBlocks with info about the type of
|
|
350
|
+
* unsupported blocks present inside the Query block.
|
|
351
|
+
*
|
|
352
|
+
* @typedef {Object} UnsupportedBlocksInfo
|
|
353
|
+
* @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.
|
|
354
|
+
* @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.
|
|
355
|
+
* @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Hook that returns an object with information about the unsupported blocks
|
|
360
|
+
* present inside a Query Loop with the given `clientId`. The returned object
|
|
361
|
+
* contains props that are true when a certain type of unsupported block is
|
|
362
|
+
* present.
|
|
351
363
|
*
|
|
352
364
|
* @param {string} clientId The block's client ID.
|
|
353
|
-
* @return {
|
|
365
|
+
* @return {UnsupportedBlocksInfo} The object containing the information.
|
|
354
366
|
*/
|
|
355
|
-
export const
|
|
367
|
+
export const useUnsupportedBlocks = ( clientId ) => {
|
|
356
368
|
return useSelect(
|
|
357
369
|
( select ) => {
|
|
358
370
|
const { getClientIdsOfDescendants, getBlockName } =
|
|
359
371
|
select( blockEditorStore );
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
( descendantClientId ) =>
|
|
363
|
-
|
|
372
|
+
const blocks = {};
|
|
373
|
+
getClientIdsOfDescendants( clientId ).forEach(
|
|
374
|
+
( descendantClientId ) => {
|
|
375
|
+
const blockName = getBlockName( descendantClientId );
|
|
376
|
+
if ( ! blockName.startsWith( 'core/' ) ) {
|
|
377
|
+
blocks.hasBlocksFromPlugins = true;
|
|
378
|
+
} else if ( blockName === 'core/post-content' ) {
|
|
379
|
+
blocks.hasPostContentBlock = true;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
364
382
|
);
|
|
383
|
+
blocks.hasUnsupportedBlocks =
|
|
384
|
+
blocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;
|
|
385
|
+
return blocks;
|
|
365
386
|
},
|
|
366
387
|
[ clientId ]
|
|
367
388
|
);
|
package/src/query/view.js
CHANGED
|
@@ -33,7 +33,14 @@ store( {
|
|
|
33
33
|
core: {
|
|
34
34
|
query: {
|
|
35
35
|
navigate: async ( { event, ref, context } ) => {
|
|
36
|
-
|
|
36
|
+
const isDisabled = ref.closest( '[data-wp-navigation-id]' )
|
|
37
|
+
?.dataset.wpNavigationDisabled;
|
|
38
|
+
|
|
39
|
+
if (
|
|
40
|
+
isValidLink( ref ) &&
|
|
41
|
+
isValidEvent( event ) &&
|
|
42
|
+
! isDisabled
|
|
43
|
+
) {
|
|
37
44
|
event.preventDefault();
|
|
38
45
|
|
|
39
46
|
const id = ref.closest( '[data-wp-navigation-id]' )
|
|
@@ -70,7 +77,9 @@ store( {
|
|
|
70
77
|
}
|
|
71
78
|
},
|
|
72
79
|
prefetch: async ( { ref } ) => {
|
|
73
|
-
|
|
80
|
+
const isDisabled = ref.closest( '[data-wp-navigation-id]' )
|
|
81
|
+
?.dataset.wpNavigationDisabled;
|
|
82
|
+
if ( isValidLink( ref ) && ! isDisabled ) {
|
|
74
83
|
await prefetch( ref.href );
|
|
75
84
|
}
|
|
76
85
|
},
|
|
@@ -63,7 +63,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
|
|
|
63
63
|
wp_reset_postdata(); // Restore original Post Data.
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if ( $enhanced_pagination ) {
|
|
66
|
+
if ( $enhanced_pagination && isset( $content ) ) {
|
|
67
67
|
$p = new WP_HTML_Tag_Processor( $content );
|
|
68
68
|
if ( $p->next_tag(
|
|
69
69
|
array(
|
|
@@ -51,7 +51,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if ( $enhanced_pagination ) {
|
|
54
|
+
if ( $enhanced_pagination && isset( $content ) ) {
|
|
55
55
|
$p = new WP_HTML_Tag_Processor( $content );
|
|
56
56
|
if ( $p->next_tag(
|
|
57
57
|
array(
|
package/src/search/edit.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
getTypographyClassesAndStyles as useTypographyProps,
|
|
17
17
|
store as blockEditorStore,
|
|
18
18
|
__experimentalGetElementClassName,
|
|
19
|
-
|
|
19
|
+
useSettings,
|
|
20
20
|
} from '@wordpress/block-editor';
|
|
21
21
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
22
22
|
import { useEffect, useRef } from '@wordpress/element';
|
|
@@ -125,8 +125,10 @@ export default function SearchEdit( {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
const colorProps = useColorProps( attributes );
|
|
128
|
-
const fluidTypographySettings =
|
|
129
|
-
|
|
128
|
+
const [ fluidTypographySettings, layout ] = useSettings(
|
|
129
|
+
'typography.fluid',
|
|
130
|
+
'layout'
|
|
131
|
+
);
|
|
130
132
|
const typographyProps = useTypographyProps( attributes, {
|
|
131
133
|
typography: {
|
|
132
134
|
fluid: fluidTypographySettings,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
ToolbarButton,
|
|
17
17
|
LinkSettingsNavigation,
|
|
18
18
|
} from '@wordpress/components';
|
|
19
|
-
import { compose
|
|
19
|
+
import { compose } from '@wordpress/compose';
|
|
20
20
|
import { __, sprintf } from '@wordpress/i18n';
|
|
21
21
|
import { link, Icon } from '@wordpress/icons';
|
|
22
22
|
import { withSelect } from '@wordpress/data';
|
|
@@ -30,10 +30,6 @@ const DEFAULT_ACTIVE_ICON_STYLES = {
|
|
|
30
30
|
backgroundColor: '#f0f0f0',
|
|
31
31
|
color: '#444',
|
|
32
32
|
};
|
|
33
|
-
const DEFAULT_INACTIVE_ICON_STYLES = {
|
|
34
|
-
backgroundColor: '#0000003f',
|
|
35
|
-
color: '#fff',
|
|
36
|
-
};
|
|
37
33
|
const ANIMATION_DELAY = 300;
|
|
38
34
|
const ANIMATION_DURATION = 400;
|
|
39
35
|
|
|
@@ -66,12 +62,6 @@ const SocialLinkEdit = ( {
|
|
|
66
62
|
styles[ `wp-social-link-${ service }` ] ||
|
|
67
63
|
styles[ `wp-social-link` ] ||
|
|
68
64
|
DEFAULT_ACTIVE_ICON_STYLES;
|
|
69
|
-
const inactiveIcon =
|
|
70
|
-
usePreferredColorSchemeStyle(
|
|
71
|
-
styles.inactiveIcon,
|
|
72
|
-
styles.inactiveIconDark
|
|
73
|
-
) || DEFAULT_INACTIVE_ICON_STYLES;
|
|
74
|
-
|
|
75
65
|
const animatedValue = useRef( new Animated.Value( 0 ) ).current;
|
|
76
66
|
|
|
77
67
|
const IconComponent = getIconBySite( service )();
|
|
@@ -94,23 +84,13 @@ const SocialLinkEdit = ( {
|
|
|
94
84
|
}, [ url ] );
|
|
95
85
|
|
|
96
86
|
const interpolationColors = {
|
|
97
|
-
|
|
98
|
-
inputRange: [ 0, 1 ],
|
|
99
|
-
outputRange: [
|
|
100
|
-
inactiveIcon.backgroundColor,
|
|
101
|
-
activeIcon.backgroundColor,
|
|
102
|
-
],
|
|
103
|
-
} ),
|
|
104
|
-
color: animatedValue.interpolate( {
|
|
87
|
+
opacity: animatedValue.interpolate( {
|
|
105
88
|
inputRange: [ 0, 1 ],
|
|
106
|
-
outputRange: [
|
|
89
|
+
outputRange: [ 0.3, 1 ],
|
|
107
90
|
} ),
|
|
108
|
-
stroke: '',
|
|
109
91
|
};
|
|
110
92
|
|
|
111
|
-
const {
|
|
112
|
-
? activeIcon
|
|
113
|
-
: interpolationColors;
|
|
93
|
+
const { opacity } = hasUrl ? activeIcon : interpolationColors;
|
|
114
94
|
|
|
115
95
|
function animateColors() {
|
|
116
96
|
Animated.sequence( [
|
|
@@ -200,12 +180,18 @@ const SocialLinkEdit = ( {
|
|
|
200
180
|
accessibilityHint={ accessibilityHint }
|
|
201
181
|
>
|
|
202
182
|
<Animated.View
|
|
203
|
-
style={ [
|
|
183
|
+
style={ [
|
|
184
|
+
styles.iconContainer,
|
|
185
|
+
{
|
|
186
|
+
backgroundColor: activeIcon.backgroundColor,
|
|
187
|
+
opacity,
|
|
188
|
+
},
|
|
189
|
+
] }
|
|
204
190
|
>
|
|
205
191
|
<Icon
|
|
206
192
|
animated
|
|
207
193
|
icon={ IconComponent }
|
|
208
|
-
style={ {
|
|
194
|
+
style={ { color: activeIcon.color } }
|
|
209
195
|
/>
|
|
210
196
|
</Animated.View>
|
|
211
197
|
</TouchableWithoutFeedback>
|
|
@@ -13,15 +13,6 @@
|
|
|
13
13
|
justify-content: center;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.inactiveIcon {
|
|
17
|
-
background-color: $light-quaternary;
|
|
18
|
-
color: $white;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.inactiveIconDark {
|
|
22
|
-
background-color: $dark-quaternary;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
16
|
.container {
|
|
26
17
|
margin: $block-selected-margin;
|
|
27
18
|
}
|
|
@@ -62,10 +62,10 @@ function render_block_core_social_link( $attributes, $content, $block ) {
|
|
|
62
62
|
$processor = new WP_HTML_Tag_Processor( $link );
|
|
63
63
|
$processor->next_tag( 'a' );
|
|
64
64
|
if ( $open_in_new_tab ) {
|
|
65
|
-
$processor->set_attribute( 'rel',
|
|
65
|
+
$processor->set_attribute( 'rel', trim( $rel . ' noopener nofollow' ) );
|
|
66
66
|
$processor->set_attribute( 'target', '_blank' );
|
|
67
67
|
} elseif ( '' !== $rel ) {
|
|
68
|
-
$processor->set_attribute( 'rel',
|
|
68
|
+
$processor->set_attribute( 'rel', trim( $rel ) );
|
|
69
69
|
}
|
|
70
70
|
return $processor->get_updated_html();
|
|
71
71
|
}
|
package/src/spacer/controls.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
InspectorControls,
|
|
7
|
-
|
|
7
|
+
useSettings,
|
|
8
8
|
__experimentalSpacingSizesControl as SpacingSizesControl,
|
|
9
9
|
isValueSpacingPreset,
|
|
10
10
|
} from '@wordpress/block-editor';
|
|
@@ -25,22 +25,19 @@ import { MIN_SPACER_SIZE } from './constants';
|
|
|
25
25
|
|
|
26
26
|
function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
27
27
|
const inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );
|
|
28
|
-
const spacingSizes =
|
|
28
|
+
const [ spacingSizes, spacingUnits ] = useSettings(
|
|
29
|
+
'spacing.spacingSizes',
|
|
30
|
+
'spacing.units'
|
|
31
|
+
);
|
|
29
32
|
// In most contexts the spacer size cannot meaningfully be set to a
|
|
30
33
|
// percentage, since this is relative to the parent container. This
|
|
31
34
|
// unit is disabled from the UI.
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const availableUnits = spacingUnits
|
|
36
|
+
? spacingUnits.filter( ( unit ) => unit !== '%' )
|
|
37
|
+
: [ 'px', 'em', 'rem', 'vw', 'vh' ];
|
|
35
38
|
|
|
36
39
|
const units = useCustomUnits( {
|
|
37
|
-
availableUnits
|
|
38
|
-
'px',
|
|
39
|
-
'em',
|
|
40
|
-
'rem',
|
|
41
|
-
'vw',
|
|
42
|
-
'vh',
|
|
43
|
-
],
|
|
40
|
+
availableUnits,
|
|
44
41
|
defaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 },
|
|
45
42
|
} );
|
|
46
43
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { useCallback } from '@wordpress/element';
|
|
11
|
-
import {
|
|
11
|
+
import { useSettings } from '@wordpress/block-editor';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -59,14 +59,9 @@ function Controls( {
|
|
|
59
59
|
[ height, width ]
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
+
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
62
63
|
const units = useCustomUnits( {
|
|
63
|
-
availableUnits:
|
|
64
|
-
'px',
|
|
65
|
-
'em',
|
|
66
|
-
'rem',
|
|
67
|
-
'vw',
|
|
68
|
-
'vh',
|
|
69
|
-
],
|
|
64
|
+
availableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],
|
|
70
65
|
defaultValues: DEFAULT_VALUES,
|
|
71
66
|
} );
|
|
72
67
|
|
package/src/spacer/edit.js
CHANGED
|
@@ -8,7 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
10
|
useBlockProps,
|
|
11
|
-
|
|
11
|
+
useSettings,
|
|
12
12
|
getCustomValueFromPreset,
|
|
13
13
|
getSpacingPresetCssVar,
|
|
14
14
|
store as blockEditorStore,
|
|
@@ -107,7 +107,7 @@ const SpacerEdit = ( {
|
|
|
107
107
|
const { layout = {} } = blockStyle;
|
|
108
108
|
const { selfStretch, flexSize } = layout;
|
|
109
109
|
|
|
110
|
-
const spacingSizes =
|
|
110
|
+
const [ spacingSizes ] = useSettings( 'spacing.spacingSizes' );
|
|
111
111
|
|
|
112
112
|
const [ isResizing, setIsResizing ] = useState( false );
|
|
113
113
|
const [ temporaryHeight, setTemporaryHeight ] = useState( null );
|
|
@@ -11,7 +11,7 @@ import { withPreferredColorScheme } from '@wordpress/compose';
|
|
|
11
11
|
import {
|
|
12
12
|
InspectorControls,
|
|
13
13
|
isValueSpacingPreset,
|
|
14
|
-
|
|
14
|
+
useSettings,
|
|
15
15
|
getCustomValueFromPreset,
|
|
16
16
|
getPxFromCssUnit,
|
|
17
17
|
} from '@wordpress/block-editor';
|
|
@@ -39,10 +39,11 @@ const Spacer = ( {
|
|
|
39
39
|
fontSize: DEFAULT_FONT_SIZE,
|
|
40
40
|
};
|
|
41
41
|
const { height, width } = attributes;
|
|
42
|
-
const spacingSizes = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const spacingSizes = [ { name: 0, slug: '0', size: 0 } ];
|
|
43
|
+
const [ settingsSizes ] = useSettings( 'spacing.spacingSizes' );
|
|
44
|
+
if ( settingsSizes ) {
|
|
45
|
+
spacingSizes.push( ...settingsSizes );
|
|
46
|
+
}
|
|
46
47
|
const { orientation } = context;
|
|
47
48
|
const defaultStyle = getStylesFromColorScheme(
|
|
48
49
|
styles.staticSpacer,
|
package/src/tag-cloud/edit.js
CHANGED
|
@@ -18,7 +18,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
18
18
|
import {
|
|
19
19
|
InspectorControls,
|
|
20
20
|
useBlockProps,
|
|
21
|
-
|
|
21
|
+
useSettings,
|
|
22
22
|
} from '@wordpress/block-editor';
|
|
23
23
|
import ServerSideRender from '@wordpress/server-side-render';
|
|
24
24
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -49,13 +49,9 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
|
|
|
49
49
|
largestFontSize,
|
|
50
50
|
} = attributes;
|
|
51
51
|
|
|
52
|
+
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
52
53
|
const units = useCustomUnits( {
|
|
53
|
-
availableUnits:
|
|
54
|
-
'%',
|
|
55
|
-
'px',
|
|
56
|
-
'em',
|
|
57
|
-
'rem',
|
|
58
|
-
],
|
|
54
|
+
availableUnits: availableUnits || [ '%', 'px', 'em', 'rem' ],
|
|
59
55
|
} );
|
|
60
56
|
|
|
61
57
|
const getTaxonomyOptions = () => {
|
|
@@ -5,7 +5,7 @@ import { useEntityBlockEditor } from '@wordpress/core-data';
|
|
|
5
5
|
import {
|
|
6
6
|
InnerBlocks,
|
|
7
7
|
useInnerBlocksProps,
|
|
8
|
-
|
|
8
|
+
useSettings,
|
|
9
9
|
store as blockEditorStore,
|
|
10
10
|
} from '@wordpress/block-editor';
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
@@ -21,8 +21,8 @@ export default function TemplatePartInnerBlocks( {
|
|
|
21
21
|
const { getSettings } = select( blockEditorStore );
|
|
22
22
|
return getSettings()?.supportsLayout;
|
|
23
23
|
}, [] );
|
|
24
|
-
const defaultLayout =
|
|
25
|
-
const usedLayout =
|
|
24
|
+
const [ defaultLayout ] = useSettings( 'layout' );
|
|
25
|
+
const usedLayout = layout?.inherit ? defaultLayout || {} : layout;
|
|
26
26
|
|
|
27
27
|
const [ blocks, onInput, onChange ] = useEntityBlockEditor(
|
|
28
28
|
'postType',
|