@wordpress/block-library 8.3.1 → 8.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.3.1",
3
+ "version": "8.3.2",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -35,7 +35,7 @@
35
35
  "@wordpress/api-fetch": "^6.23.1",
36
36
  "@wordpress/autop": "^3.26.1",
37
37
  "@wordpress/blob": "^3.26.1",
38
- "@wordpress/block-editor": "^11.3.1",
38
+ "@wordpress/block-editor": "^11.3.2",
39
39
  "@wordpress/blocks": "^12.3.1",
40
40
  "@wordpress/components": "^23.3.1",
41
41
  "@wordpress/compose": "^6.3.1",
@@ -54,7 +54,7 @@
54
54
  "@wordpress/keycodes": "^3.26.1",
55
55
  "@wordpress/notices": "^3.26.1",
56
56
  "@wordpress/primitives": "^3.24.1",
57
- "@wordpress/reusable-blocks": "^4.3.1",
57
+ "@wordpress/reusable-blocks": "^4.3.2",
58
58
  "@wordpress/rich-text": "^6.3.1",
59
59
  "@wordpress/server-side-render": "^4.3.1",
60
60
  "@wordpress/url": "^3.27.1",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "e9ff92d836928aba65dde94d9d193bc401a934d7"
80
+ "gitHead": "3eb2c536278d5a17f698b9c378fe3db746a89622"
81
81
  }
@@ -99,12 +99,13 @@ function block_core_gallery_render( $attributes, $content ) {
99
99
  }
100
100
 
101
101
  // Set the CSS variable to the column value, and the `gap` property to the combined gap value.
102
- $gallery_styles = array();
103
- $gallery_styles[] = array(
104
- 'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
105
- 'declarations' => array(
106
- '--wp--style--unstable-gallery-gap' => $gap_column,
107
- 'gap' => $gap_value,
102
+ $gallery_styles = array(
103
+ array(
104
+ 'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
105
+ 'declarations' => array(
106
+ '--wp--style--unstable-gallery-gap' => $gap_column,
107
+ 'gap' => $gap_value,
108
+ ),
108
109
  ),
109
110
  );
110
111
 
@@ -65,58 +65,58 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
65
65
 
66
66
  return $menu_items_by_parent_id;
67
67
  }
68
+ }
68
69
 
69
- /**
70
- * Turns menu item data into a nested array of parsed blocks
71
- *
72
- * @param array $menu_items An array of menu items that represent
73
- * an individual level of a menu.
74
- * @param array $menu_items_by_parent_id An array keyed by the id of the
75
- * parent menu where each element is an
76
- * array of menu items that belong to
77
- * that parent.
78
- * @return array An array of parsed block data.
79
- */
80
- function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
81
- if ( empty( $menu_items ) ) {
82
- return array();
83
- }
70
+ /**
71
+ * Turns menu item data into a nested array of parsed blocks
72
+ *
73
+ * @param array $menu_items An array of menu items that represent
74
+ * an individual level of a menu.
75
+ * @param array $menu_items_by_parent_id An array keyed by the id of the
76
+ * parent menu where each element is an
77
+ * array of menu items that belong to
78
+ * that parent.
79
+ * @return array An array of parsed block data.
80
+ */
81
+ function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
82
+ if ( empty( $menu_items ) ) {
83
+ return array();
84
+ }
85
+
86
+ $blocks = array();
87
+
88
+ foreach ( $menu_items as $menu_item ) {
89
+ $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
90
+ $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
91
+ $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
92
+ $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
93
+ $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
94
+
95
+ $block = array(
96
+ 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
97
+ 'attrs' => array(
98
+ 'className' => $class_name,
99
+ 'description' => $menu_item->description,
100
+ 'id' => $id,
101
+ 'kind' => $kind,
102
+ 'label' => $menu_item->title,
103
+ 'opensInNewTab' => $opens_in_new_tab,
104
+ 'rel' => $rel,
105
+ 'title' => $menu_item->attr_title,
106
+ 'type' => $menu_item->object,
107
+ 'url' => $menu_item->url,
108
+ ),
109
+ );
84
110
 
85
- $blocks = array();
86
-
87
- foreach ( $menu_items as $menu_item ) {
88
- $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
89
- $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
90
- $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
91
- $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
92
- $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
93
-
94
- $block = array(
95
- 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
96
- 'attrs' => array(
97
- 'className' => $class_name,
98
- 'description' => $menu_item->description,
99
- 'id' => $id,
100
- 'kind' => $kind,
101
- 'label' => $menu_item->title,
102
- 'opensInNewTab' => $opens_in_new_tab,
103
- 'rel' => $rel,
104
- 'title' => $menu_item->attr_title,
105
- 'type' => $menu_item->object,
106
- 'url' => $menu_item->url,
107
- ),
108
- );
109
-
110
- $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] )
111
- ? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id )
112
- : array();
113
- $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
114
-
115
- $blocks[] = $block;
116
- }
111
+ $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] )
112
+ ? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id )
113
+ : array();
114
+ $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
117
115
 
118
- return $blocks;
116
+ $blocks[] = $block;
119
117
  }
118
+
119
+ return $blocks;
120
120
  }
121
121
 
122
122
  /**
@@ -874,35 +874,3 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl
874
874
  }
875
875
 
876
876
  add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );
877
-
878
- /**
879
- * Enables animation of the block inspector for the Navigation block.
880
- *
881
- * See:
882
- * - https://github.com/WordPress/gutenberg/pull/46342
883
- * - https://github.com/WordPress/gutenberg/issues/45884
884
- *
885
- * @param array $settings Default editor settings.
886
- * @return array Filtered editor settings.
887
- */
888
- function block_core_navigation_enable_inspector_animation( $settings ) {
889
- $current_animation_settings = _wp_array_get(
890
- $settings,
891
- array( '__experimentalBlockInspectorAnimation' ),
892
- array()
893
- );
894
-
895
- $settings['__experimentalBlockInspectorAnimation'] = array_merge(
896
- $current_animation_settings,
897
- array(
898
- 'core/navigation' =>
899
- array(
900
- 'enterDirection' => 'leftToRight',
901
- ),
902
- )
903
- );
904
-
905
- return $settings;
906
- }
907
-
908
- add_filter( 'block_editor_settings_all', 'block_core_navigation_enable_inspector_animation' );
@@ -371,35 +371,3 @@ function register_block_core_navigation_link() {
371
371
  );
372
372
  }
373
373
  add_action( 'init', 'register_block_core_navigation_link' );
374
-
375
- /**
376
- * Enables animation of the block inspector for the Navigation Link block.
377
- *
378
- * See:
379
- * - https://github.com/WordPress/gutenberg/pull/46342
380
- * - https://github.com/WordPress/gutenberg/issues/45884
381
- *
382
- * @param array $settings Default editor settings.
383
- * @return array Filtered editor settings.
384
- */
385
- function block_core_navigation_link_enable_inspector_animation( $settings ) {
386
- $current_animation_settings = _wp_array_get(
387
- $settings,
388
- array( '__experimentalBlockInspectorAnimation' ),
389
- array()
390
- );
391
-
392
- $settings['__experimentalBlockInspectorAnimation'] = array_merge(
393
- $current_animation_settings,
394
- array(
395
- 'core/navigation-link' =>
396
- array(
397
- 'enterDirection' => 'rightToLeft',
398
- ),
399
- )
400
- );
401
-
402
- return $settings;
403
- }
404
-
405
- add_filter( 'block_editor_settings_all', 'block_core_navigation_link_enable_inspector_animation' );
@@ -289,35 +289,3 @@ function register_block_core_navigation_submenu() {
289
289
  );
290
290
  }
291
291
  add_action( 'init', 'register_block_core_navigation_submenu' );
292
-
293
- /**
294
- * Enables animation of the block inspector for the Navigation Submenu block.
295
- *
296
- * See:
297
- * - https://github.com/WordPress/gutenberg/pull/46342
298
- * - https://github.com/WordPress/gutenberg/issues/45884
299
- *
300
- * @param array $settings Default editor settings.
301
- * @return array Filtered editor settings.
302
- */
303
- function block_core_navigation_submenu_enable_inspector_animation( $settings ) {
304
- $current_animation_settings = _wp_array_get(
305
- $settings,
306
- array( '__experimentalBlockInspectorAnimation' ),
307
- array()
308
- );
309
-
310
- $settings['__experimentalBlockInspectorAnimation'] = array_merge(
311
- $current_animation_settings,
312
- array(
313
- 'core/navigation-submenu' =>
314
- array(
315
- 'enterDirection' => 'rightToLeft',
316
- ),
317
- )
318
- );
319
-
320
- return $settings;
321
- }
322
-
323
- add_filter( 'block_editor_settings_all', 'block_core_navigation_submenu_enable_inspector_animation' );
@@ -18,12 +18,19 @@ function render_block_core_read_more( $attributes, $content, $block ) {
18
18
  return '';
19
19
  }
20
20
 
21
- $post_ID = $block->context['postId'];
22
- $post_title = get_the_title( $post_ID );
21
+ $post_ID = $block->context['postId'];
22
+ $post_title = get_the_title( $post_ID );
23
+ if ( '' === $post_title ) {
24
+ $post_title = sprintf(
25
+ /* translators: %s is post ID to describe the link for screen readers. */
26
+ __( 'untitled post %s' ),
27
+ $post_ID
28
+ );
29
+ }
23
30
  $screen_reader_text = sprintf(
24
31
  /* translators: %s is either the post title or post ID to describe the link for screen readers. */
25
32
  __( ': %s' ),
26
- '' !== $post_title ? $post_title : __( 'untitled post ' ) . $post_ID
33
+ $post_title
27
34
  );
28
35
  $justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
29
36
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );