@wordpress/block-library 7.14.7 → 7.14.9

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 (56) hide show
  1. package/build/embed/deprecated.js +43 -4
  2. package/build/embed/deprecated.js.map +1 -1
  3. package/build/embed/variations.js +1 -1
  4. package/build/embed/variations.js.map +1 -1
  5. package/build/file/deprecated.js +108 -4
  6. package/build/file/deprecated.js.map +1 -1
  7. package/build/gallery/deprecated.js +147 -22
  8. package/build/gallery/deprecated.js.map +1 -1
  9. package/build/list-item/hooks/use-outdent-list-item.js +5 -2
  10. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  11. package/build/page-list/edit.js +29 -10
  12. package/build/page-list/edit.js.map +1 -1
  13. package/build/table/deprecated.js +282 -27
  14. package/build/table/deprecated.js.map +1 -1
  15. package/build/video/deprecated.js +159 -0
  16. package/build/video/deprecated.js.map +1 -0
  17. package/build/video/index.js +3 -0
  18. package/build/video/index.js.map +1 -1
  19. package/build-module/embed/deprecated.js +44 -5
  20. package/build-module/embed/deprecated.js.map +1 -1
  21. package/build-module/embed/variations.js +1 -1
  22. package/build-module/embed/variations.js.map +1 -1
  23. package/build-module/file/deprecated.js +108 -4
  24. package/build-module/file/deprecated.js.map +1 -1
  25. package/build-module/gallery/deprecated.js +145 -23
  26. package/build-module/gallery/deprecated.js.map +1 -1
  27. package/build-module/list-item/hooks/use-outdent-list-item.js +5 -2
  28. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  29. package/build-module/page-list/edit.js +29 -10
  30. package/build-module/page-list/edit.js.map +1 -1
  31. package/build-module/table/deprecated.js +282 -27
  32. package/build-module/table/deprecated.js.map +1 -1
  33. package/build-module/video/deprecated.js +147 -0
  34. package/build-module/video/deprecated.js.map +1 -0
  35. package/build-module/video/index.js +2 -0
  36. package/build-module/video/index.js.map +1 -1
  37. package/build-style/button/style-rtl.css +1 -0
  38. package/build-style/button/style.css +1 -0
  39. package/build-style/style-rtl.css +1 -0
  40. package/build-style/style.css +1 -0
  41. package/package.json +6 -6
  42. package/src/avatar/index.php +1 -1
  43. package/src/button/style.scss +2 -0
  44. package/src/embed/deprecated.js +53 -26
  45. package/src/embed/variations.js +1 -1
  46. package/src/file/deprecated.js +130 -2
  47. package/src/gallery/deprecated.js +127 -2
  48. package/src/list-item/hooks/use-outdent-list-item.js +6 -2
  49. package/src/navigation/index.php +1 -1
  50. package/src/page-list/edit.js +36 -22
  51. package/src/post-featured-image/index.php +11 -18
  52. package/src/rss/index.php +3 -3
  53. package/src/search/index.php +5 -5
  54. package/src/table/deprecated.js +587 -348
  55. package/src/video/deprecated.js +57 -0
  56. package/src/video/index.js +2 -0
@@ -20,12 +20,16 @@ export default function useOutdentListItem( clientId ) {
20
20
  const registry = useRegistry();
21
21
  const { canOutdent } = useSelect(
22
22
  ( innerSelect ) => {
23
- const { getBlockRootClientId } = innerSelect( blockEditorStore );
23
+ const { getBlockRootClientId, getBlockName } =
24
+ innerSelect( blockEditorStore );
24
25
  const grandParentId = getBlockRootClientId(
25
26
  getBlockRootClientId( clientId )
26
27
  );
28
+ const grandParentName = getBlockName( grandParentId );
29
+ const isListItem = grandParentName === listItemName;
30
+
27
31
  return {
28
- canOutdent: !! grandParentId,
32
+ canOutdent: isListItem,
29
33
  };
30
34
  },
31
35
  [ clientId ]
@@ -646,7 +646,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
646
646
  $toggle_aria_label_close,
647
647
  esc_attr( implode( ' ', $responsive_container_classes ) ),
648
648
  esc_attr( implode( ' ', $open_button_classes ) ),
649
- safecss_filter_attr( $colors['overlay_inline_styles'] ),
649
+ esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
650
650
  __( 'Menu' ),
651
651
  $toggle_button_content,
652
652
  $toggle_close_button_content
@@ -52,50 +52,64 @@ export default function PageListEdit( { context, clientId } ) {
52
52
  style: { ...context.style?.color },
53
53
  } );
54
54
 
55
- return (
56
- <>
57
- { allowConvertToLinks && (
58
- <BlockControls group="other">
59
- <ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
60
- { __( 'Edit' ) }
61
- </ToolbarButton>
62
- </BlockControls>
63
- ) }
64
- { allowConvertToLinks && isOpen && (
65
- <ConvertToLinksModal
66
- onClose={ closeModal }
67
- clientId={ clientId }
68
- />
69
- ) }
70
- { ! hasResolvedPages && (
55
+ const getBlockContent = () => {
56
+ if ( ! hasResolvedPages ) {
57
+ return (
71
58
  <div { ...blockProps }>
72
59
  <Spinner />
73
60
  </div>
74
- ) }
61
+ );
62
+ }
75
63
 
76
- { hasResolvedPages && totalPages === null && (
64
+ if ( totalPages === null ) {
65
+ return (
77
66
  <div { ...blockProps }>
78
67
  <Notice status={ 'warning' } isDismissible={ false }>
79
68
  { __( 'Page List: Cannot retrieve Pages.' ) }
80
69
  </Notice>
81
70
  </div>
82
- ) }
71
+ );
72
+ }
83
73
 
84
- { totalPages === 0 && (
74
+ if ( totalPages === 0 ) {
75
+ return (
85
76
  <div { ...blockProps }>
86
77
  <Notice status={ 'info' } isDismissible={ false }>
87
78
  { __( 'Page List: Cannot retrieve Pages.' ) }
88
79
  </Notice>
89
80
  </div>
90
- ) }
91
- { totalPages > 0 && (
81
+ );
82
+ }
83
+
84
+ if ( totalPages > 0 ) {
85
+ return (
92
86
  <ul { ...blockProps }>
93
87
  <PageItems
94
88
  context={ context }
95
89
  pagesByParentId={ pagesByParentId }
96
90
  />
97
91
  </ul>
92
+ );
93
+ }
94
+ };
95
+
96
+ return (
97
+ <>
98
+ { allowConvertToLinks && (
99
+ <BlockControls group="other">
100
+ <ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>
101
+ { __( 'Edit' ) }
102
+ </ToolbarButton>
103
+ </BlockControls>
98
104
  ) }
105
+ { allowConvertToLinks && isOpen && (
106
+ <ConvertToLinksModal
107
+ onClose={ closeModal }
108
+ clientId={ clientId }
109
+ />
110
+ ) }
111
+
112
+ { getBlockContent() }
99
113
  </>
100
114
  );
101
115
  }
@@ -29,11 +29,18 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
29
29
  $attr['alt'] = $post_title;
30
30
  }
31
31
 
32
+ if ( ! empty( $attributes['height'] ) ) {
33
+ $extra_styles = "height:{$attributes['height']};";
34
+ if ( ! empty( $attributes['scale'] ) ) {
35
+ $extra_styles .= "object-fit:{$attributes['scale']};";
36
+ }
37
+ $attr['style'] = empty( $attr['style'] ) ? $extra_styles : $attr['style'] . $extra_styles;
38
+ }
39
+
32
40
  $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
33
41
  if ( ! $featured_image ) {
34
42
  return '';
35
43
  }
36
- $wrapper_attributes = get_block_wrapper_attributes();
37
44
  if ( $is_link ) {
38
45
  $link_target = $attributes['linkTarget'];
39
46
  $rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
@@ -49,23 +56,9 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
49
56
  $featured_image = $featured_image . $overlay_markup;
50
57
  }
51
58
 
52
- $has_width = ! empty( $attributes['width'] );
53
- $has_height = ! empty( $attributes['height'] );
54
- if ( ! $has_height && ! $has_width ) {
55
- return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
56
- }
57
-
58
- if ( $has_width ) {
59
- $wrapper_attributes = get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
60
- }
61
-
62
- if ( $has_height ) {
63
- $image_styles = "height:{$attributes['height']};";
64
- if ( ! empty( $attributes['scale'] ) ) {
65
- $image_styles .= "object-fit:{$attributes['scale']};";
66
- }
67
- $featured_image = str_replace( 'src=', 'style="' . esc_attr( $image_styles ) . '" src=', $featured_image );
68
- }
59
+ $wrapper_attributes = empty( $attributes['width'] )
60
+ ? get_block_wrapper_attributes()
61
+ : get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
69
62
 
70
63
  return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
71
64
  }
package/src/rss/index.php CHANGED
@@ -20,7 +20,7 @@ function render_block_core_rss( $attributes ) {
20
20
  $rss = fetch_feed( $attributes['feedURL'] );
21
21
 
22
22
  if ( is_wp_error( $rss ) ) {
23
- return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</div></div>';
23
+ return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
24
24
  }
25
25
 
26
26
  if ( ! $rss->get_item_quantity() ) {
@@ -48,8 +48,8 @@ function render_block_core_rss( $attributes ) {
48
48
  if ( $date ) {
49
49
  $date = sprintf(
50
50
  '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
51
- date_i18n( get_option( 'c' ), $date ),
52
- date_i18n( get_option( 'date_format' ), $date )
51
+ esc_attr( date_i18n( get_option( 'c' ), $date ) ),
52
+ esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
53
53
  );
54
54
  }
55
55
  }
@@ -367,12 +367,12 @@ function styles_for_block_core_search( $attributes ) {
367
367
  // Add color styles.
368
368
  $has_text_color = ! empty( $attributes['style']['color']['text'] );
369
369
  if ( $has_text_color ) {
370
- $button_styles[] = sprintf( 'color: %s;', esc_attr( $attributes['style']['color']['text'] ) );
370
+ $button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
371
371
  }
372
372
 
373
373
  $has_background_color = ! empty( $attributes['style']['color']['background'] );
374
374
  if ( $has_background_color ) {
375
- $button_styles[] = sprintf( 'background-color: %s;', esc_attr( $attributes['style']['color']['background'] ) );
375
+ $button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
376
376
  }
377
377
 
378
378
  $has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
@@ -399,9 +399,9 @@ function styles_for_block_core_search( $attributes ) {
399
399
  }
400
400
 
401
401
  return array(
402
- 'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
403
- 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
404
- 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
402
+ 'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '',
403
+ 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '',
404
+ 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '',
405
405
  'label' => ! empty( $label_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $label_styles ) ) ) ) : '',
406
406
  );
407
407
  }