@wordpress/block-library 7.14.4 → 7.14.6
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/comment-template/edit.js +40 -32
- package/build/comment-template/edit.js.map +1 -1
- package/build/comments-title/edit.js +18 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/group/edit.js +1 -1
- package/build/group/edit.js.map +1 -1
- package/build/list/transforms.js +9 -1
- package/build/list/transforms.js.map +1 -1
- package/build/list-item/edit.js +3 -2
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +5 -21
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/page-list/index.js +1 -5
- package/build/page-list/index.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +38 -30
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +18 -2
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/group/edit.js +1 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/list/transforms.js +9 -1
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +3 -2
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +5 -20
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/page-list/index.js +1 -5
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.js.map +1 -1
- package/package.json +6 -6
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-template/edit.js +47 -34
- package/src/comments-title/edit.js +24 -1
- package/src/group/edit.js +1 -1
- package/src/list/transforms.js +11 -0
- package/src/list-item/edit.js +2 -1
- package/src/list-item/hooks/use-merge.js +4 -23
- package/src/navigation/block.json +0 -1
- package/src/navigation/index.php +0 -3
- package/src/navigation-link/index.php +8 -1
- package/src/navigation-submenu/index.php +8 -1
- package/src/page-list/block.json +1 -5
- package/src/page-list/index.php +8 -6
- package/src/search/edit.js +6 -1
- package/src/search/index.php +16 -8
- package/src/template-part/index.php +4 -0
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useRegistry, useDispatch, useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
|
-
import { getDefaultBlockName, switchToBlockType } from '@wordpress/blocks';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
@@ -12,7 +11,7 @@ import useOutdentListItem from './use-outdent-list-item';
|
|
|
12
11
|
|
|
13
12
|
import { name as listItemName } from '../block.json';
|
|
14
13
|
|
|
15
|
-
export default function useMerge( clientId ) {
|
|
14
|
+
export default function useMerge( clientId, onMerge ) {
|
|
16
15
|
const registry = useRegistry();
|
|
17
16
|
const {
|
|
18
17
|
getPreviousBlockClientId,
|
|
@@ -20,9 +19,8 @@ export default function useMerge( clientId ) {
|
|
|
20
19
|
getBlockOrder,
|
|
21
20
|
getBlockRootClientId,
|
|
22
21
|
getBlockName,
|
|
23
|
-
getBlock,
|
|
24
22
|
} = useSelect( blockEditorStore );
|
|
25
|
-
const { mergeBlocks, moveBlocksToPosition
|
|
23
|
+
const { mergeBlocks, moveBlocksToPosition } =
|
|
26
24
|
useDispatch( blockEditorStore );
|
|
27
25
|
const [ , outdentListItem ] = useOutdentListItem( clientId );
|
|
28
26
|
|
|
@@ -79,29 +77,12 @@ export default function useMerge( clientId ) {
|
|
|
79
77
|
return getBlockOrder( order[ 0 ] )[ 0 ];
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
function switchToDefaultBlockType( forward ) {
|
|
83
|
-
const rootClientId = getBlockRootClientId( clientId );
|
|
84
|
-
const replacement = switchToBlockType(
|
|
85
|
-
getBlock( rootClientId ),
|
|
86
|
-
getDefaultBlockName()
|
|
87
|
-
);
|
|
88
|
-
const indexToSelect = forward ? replacement.length - 1 : 0;
|
|
89
|
-
const initialPosition = forward ? -1 : 0;
|
|
90
|
-
registry.batch( () => {
|
|
91
|
-
replaceBlock( rootClientId, replacement );
|
|
92
|
-
selectBlock(
|
|
93
|
-
replacement[ indexToSelect ].clientId,
|
|
94
|
-
initialPosition
|
|
95
|
-
);
|
|
96
|
-
} );
|
|
97
|
-
}
|
|
98
|
-
|
|
99
80
|
return ( forward ) => {
|
|
100
81
|
if ( forward ) {
|
|
101
82
|
const nextBlockClientId = getNextId( clientId );
|
|
102
83
|
|
|
103
84
|
if ( ! nextBlockClientId ) {
|
|
104
|
-
|
|
85
|
+
onMerge( forward );
|
|
105
86
|
return;
|
|
106
87
|
}
|
|
107
88
|
|
|
@@ -134,7 +115,7 @@ export default function useMerge( clientId ) {
|
|
|
134
115
|
mergeBlocks( trailingId, clientId );
|
|
135
116
|
} );
|
|
136
117
|
} else {
|
|
137
|
-
|
|
118
|
+
onMerge( forward );
|
|
138
119
|
}
|
|
139
120
|
}
|
|
140
121
|
};
|
package/src/navigation/index.php
CHANGED
|
@@ -98,7 +98,14 @@ function block_core_navigation_link_build_css_font_sizes( $context ) {
|
|
|
98
98
|
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
|
|
99
99
|
} elseif ( $has_custom_font_size ) {
|
|
100
100
|
// Add the custom font size inline style.
|
|
101
|
-
$font_sizes['inline_styles'] = sprintf(
|
|
101
|
+
$font_sizes['inline_styles'] = sprintf(
|
|
102
|
+
'font-size: %s;',
|
|
103
|
+
gutenberg_get_typography_font_size_value(
|
|
104
|
+
array(
|
|
105
|
+
'size' => $context['style']['typography']['fontSize'],
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
);
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
return $font_sizes;
|
|
@@ -98,7 +98,14 @@ function block_core_navigation_submenu_build_css_font_sizes( $context ) {
|
|
|
98
98
|
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
|
|
99
99
|
} elseif ( $has_custom_font_size ) {
|
|
100
100
|
// Add the custom font size inline style.
|
|
101
|
-
$font_sizes['inline_styles'] = sprintf(
|
|
101
|
+
$font_sizes['inline_styles'] = sprintf(
|
|
102
|
+
'font-size: %s;',
|
|
103
|
+
gutenberg_get_typography_font_size_value(
|
|
104
|
+
array(
|
|
105
|
+
'size' => $context['style']['typography']['fontSize'],
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
);
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
return $font_sizes;
|
package/src/page-list/block.json
CHANGED
|
@@ -7,11 +7,7 @@
|
|
|
7
7
|
"description": "Display a list of all pages.",
|
|
8
8
|
"keywords": [ "menu", "navigation" ],
|
|
9
9
|
"textdomain": "default",
|
|
10
|
-
"attributes": {
|
|
11
|
-
"__unstableMaxPages": {
|
|
12
|
-
"type": "number"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
10
|
+
"attributes": {},
|
|
15
11
|
"usesContext": [
|
|
16
12
|
"textColor",
|
|
17
13
|
"customTextColor",
|
package/src/page-list/index.php
CHANGED
|
@@ -119,7 +119,14 @@ function block_core_page_list_build_css_font_sizes( $context ) {
|
|
|
119
119
|
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
|
|
120
120
|
} elseif ( $has_custom_font_size ) {
|
|
121
121
|
// Add the custom font size inline style.
|
|
122
|
-
$font_sizes['inline_styles'] = sprintf(
|
|
122
|
+
$font_sizes['inline_styles'] = sprintf(
|
|
123
|
+
'font-size: %s;',
|
|
124
|
+
gutenberg_get_typography_font_size_value(
|
|
125
|
+
array(
|
|
126
|
+
'size' => $context['style']['typography']['fontSize'],
|
|
127
|
+
)
|
|
128
|
+
)
|
|
129
|
+
);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
return $font_sizes;
|
|
@@ -299,11 +306,6 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
299
306
|
|
|
300
307
|
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
|
301
308
|
|
|
302
|
-
// Limit the number of items to be visually displayed.
|
|
303
|
-
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
|
|
304
|
-
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
|
|
305
|
-
}
|
|
306
|
-
|
|
307
309
|
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
|
308
310
|
|
|
309
311
|
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
|
package/src/search/edit.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getTypographyClassesAndStyles as useTypographyProps,
|
|
17
17
|
store as blockEditorStore,
|
|
18
18
|
__experimentalGetElementClassName,
|
|
19
|
+
useSetting,
|
|
19
20
|
} from '@wordpress/block-editor';
|
|
20
21
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
21
22
|
import { useEffect } from '@wordpress/element';
|
|
@@ -113,7 +114,11 @@ export default function SearchEdit( {
|
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
const colorProps = useColorProps( attributes );
|
|
116
|
-
const
|
|
117
|
+
const fluidTypographyEnabled = useSetting( 'typography.fluid' );
|
|
118
|
+
const typographyProps = useTypographyProps(
|
|
119
|
+
attributes,
|
|
120
|
+
fluidTypographyEnabled
|
|
121
|
+
);
|
|
117
122
|
const unitControlInstanceId = useInstanceId( UnitControl );
|
|
118
123
|
const unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;
|
|
119
124
|
const isButtonPositionInside = 'button-inside' === buttonPosition;
|
package/src/search/index.php
CHANGED
|
@@ -381,7 +381,7 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
// Get typography styles to be shared across inner elements.
|
|
384
|
-
$typography_styles = get_typography_styles_for_block_core_search( $attributes );
|
|
384
|
+
$typography_styles = esc_attr( get_typography_styles_for_block_core_search( $attributes ) );
|
|
385
385
|
if ( ! empty( $typography_styles ) ) {
|
|
386
386
|
$label_styles [] = $typography_styles;
|
|
387
387
|
$button_styles[] = $typography_styles;
|
|
@@ -442,31 +442,39 @@ function get_typography_styles_for_block_core_search( $attributes ) {
|
|
|
442
442
|
|
|
443
443
|
// Add typography styles.
|
|
444
444
|
if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) {
|
|
445
|
-
$typography_styles[] = sprintf(
|
|
445
|
+
$typography_styles[] = sprintf(
|
|
446
|
+
'font-size: %s;',
|
|
447
|
+
gutenberg_get_typography_font_size_value(
|
|
448
|
+
array(
|
|
449
|
+
'size' => $attributes['style']['typography']['fontSize'],
|
|
450
|
+
)
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
|
|
446
454
|
}
|
|
447
455
|
|
|
448
456
|
if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) {
|
|
449
|
-
$typography_styles[] = sprintf( 'font-family: %s;',
|
|
457
|
+
$typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] );
|
|
450
458
|
}
|
|
451
459
|
|
|
452
460
|
if ( ! empty( $attributes['style']['typography']['letterSpacing'] ) ) {
|
|
453
|
-
$typography_styles[] = sprintf( 'letter-spacing: %s;',
|
|
461
|
+
$typography_styles[] = sprintf( 'letter-spacing: %s;', $attributes['style']['typography']['letterSpacing'] );
|
|
454
462
|
}
|
|
455
463
|
|
|
456
464
|
if ( ! empty( $attributes['style']['typography']['fontWeight'] ) ) {
|
|
457
|
-
$typography_styles[] = sprintf( 'font-weight: %s;',
|
|
465
|
+
$typography_styles[] = sprintf( 'font-weight: %s;', $attributes['style']['typography']['fontWeight'] );
|
|
458
466
|
}
|
|
459
467
|
|
|
460
468
|
if ( ! empty( $attributes['style']['typography']['fontStyle'] ) ) {
|
|
461
|
-
$typography_styles[] = sprintf( 'font-style: %s;',
|
|
469
|
+
$typography_styles[] = sprintf( 'font-style: %s;', $attributes['style']['typography']['fontStyle'] );
|
|
462
470
|
}
|
|
463
471
|
|
|
464
472
|
if ( ! empty( $attributes['style']['typography']['lineHeight'] ) ) {
|
|
465
|
-
$typography_styles[] = sprintf( 'line-height: %s;',
|
|
473
|
+
$typography_styles[] = sprintf( 'line-height: %s;', $attributes['style']['typography']['lineHeight'] );
|
|
466
474
|
}
|
|
467
475
|
|
|
468
476
|
if ( ! empty( $attributes['style']['typography']['textTransform'] ) ) {
|
|
469
|
-
$typography_styles[] = sprintf( 'text-transform: %s;',
|
|
477
|
+
$typography_styles[] = sprintf( 'text-transform: %s;', $attributes['style']['typography']['textTransform'] );
|
|
470
478
|
}
|
|
471
479
|
|
|
472
480
|
return implode( '', $typography_styles );
|
|
@@ -189,6 +189,10 @@ function build_template_part_block_area_variations() {
|
|
|
189
189
|
* @return array Array containing the block variation objects.
|
|
190
190
|
*/
|
|
191
191
|
function build_template_part_block_instance_variations() {
|
|
192
|
+
// Block themes are unavailable during installation.
|
|
193
|
+
if ( wp_installing() ) {
|
|
194
|
+
return array();
|
|
195
|
+
}
|
|
192
196
|
$variations = array();
|
|
193
197
|
$template_parts = get_block_templates(
|
|
194
198
|
array(
|