@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.
Files changed (53) hide show
  1. package/build/comment-template/edit.js +40 -32
  2. package/build/comment-template/edit.js.map +1 -1
  3. package/build/comments-title/edit.js +18 -1
  4. package/build/comments-title/edit.js.map +1 -1
  5. package/build/group/edit.js +1 -1
  6. package/build/group/edit.js.map +1 -1
  7. package/build/list/transforms.js +9 -1
  8. package/build/list/transforms.js.map +1 -1
  9. package/build/list-item/edit.js +3 -2
  10. package/build/list-item/edit.js.map +1 -1
  11. package/build/list-item/hooks/use-merge.js +5 -21
  12. package/build/list-item/hooks/use-merge.js.map +1 -1
  13. package/build/navigation/index.js +0 -1
  14. package/build/navigation/index.js.map +1 -1
  15. package/build/page-list/index.js +1 -5
  16. package/build/page-list/index.js.map +1 -1
  17. package/build/search/edit.js +2 -1
  18. package/build/search/edit.js.map +1 -1
  19. package/build-module/comment-template/edit.js +38 -30
  20. package/build-module/comment-template/edit.js.map +1 -1
  21. package/build-module/comments-title/edit.js +18 -2
  22. package/build-module/comments-title/edit.js.map +1 -1
  23. package/build-module/group/edit.js +1 -1
  24. package/build-module/group/edit.js.map +1 -1
  25. package/build-module/list/transforms.js +9 -1
  26. package/build-module/list/transforms.js.map +1 -1
  27. package/build-module/list-item/edit.js +3 -2
  28. package/build-module/list-item/edit.js.map +1 -1
  29. package/build-module/list-item/hooks/use-merge.js +5 -20
  30. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  31. package/build-module/navigation/index.js +0 -1
  32. package/build-module/navigation/index.js.map +1 -1
  33. package/build-module/page-list/index.js +1 -5
  34. package/build-module/page-list/index.js.map +1 -1
  35. package/build-module/search/edit.js +3 -2
  36. package/build-module/search/edit.js.map +1 -1
  37. package/package.json +6 -6
  38. package/src/comment-author-name/index.php +1 -1
  39. package/src/comment-template/edit.js +47 -34
  40. package/src/comments-title/edit.js +24 -1
  41. package/src/group/edit.js +1 -1
  42. package/src/list/transforms.js +11 -0
  43. package/src/list-item/edit.js +2 -1
  44. package/src/list-item/hooks/use-merge.js +4 -23
  45. package/src/navigation/block.json +0 -1
  46. package/src/navigation/index.php +0 -3
  47. package/src/navigation-link/index.php +8 -1
  48. package/src/navigation-submenu/index.php +8 -1
  49. package/src/page-list/block.json +1 -5
  50. package/src/page-list/index.php +8 -6
  51. package/src/search/edit.js +6 -1
  52. package/src/search/index.php +16 -8
  53. 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, replaceBlock, selectBlock } =
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
- switchToDefaultBlockType( forward );
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
- switchToDefaultBlockType( forward );
118
+ onMerge( forward );
138
119
  }
139
120
  }
140
121
  };
@@ -88,7 +88,6 @@
88
88
  },
89
89
  "supports": {
90
90
  "align": [ "wide", "full" ],
91
- "anchor": true,
92
91
  "html": false,
93
92
  "inserter": true,
94
93
  "typography": {
@@ -307,9 +307,6 @@ function block_core_navigation_get_fallback_blocks() {
307
307
  $page_list_fallback = array(
308
308
  array(
309
309
  'blockName' => 'core/page-list',
310
- 'attrs' => array(
311
- '__unstableMaxPages' => 4,
312
- ),
313
310
  ),
314
311
  );
315
312
 
@@ -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( 'font-size: %s;', $context['style']['typography']['fontSize'] );
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( 'font-size: %s;', $context['style']['typography']['fontSize'] );
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;
@@ -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",
@@ -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( 'font-size: %s;', $context['style']['typography']['fontSize'] );
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;
@@ -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 typographyProps = useTypographyProps( attributes );
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;
@@ -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( 'font-size: %s;', esc_attr( $attributes['style']['typography']['fontSize'] ) );
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;', esc_attr( $attributes['style']['typography']['fontFamily'] ) );
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;', esc_attr( $attributes['style']['typography']['letterSpacing'] ) );
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;', esc_attr( $attributes['style']['typography']['fontWeight'] ) );
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;', esc_attr( $attributes['style']['typography']['fontStyle'] ) );
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;', esc_attr( $attributes['style']['typography']['lineHeight'] ) );
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;', esc_attr( $attributes['style']['typography']['textTransform'] ) );
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(