@wordpress/block-library 7.14.10 → 7.14.12

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 (46) hide show
  1. package/build/cover/edit/index.js +3 -1
  2. package/build/cover/edit/index.js.map +1 -1
  3. package/build/list/utils.js +4 -8
  4. package/build/list/utils.js.map +1 -1
  5. package/build/list-item/edit.js +2 -1
  6. package/build/list-item/edit.js.map +1 -1
  7. package/build/page-list/edit.js +29 -10
  8. package/build/page-list/edit.js.map +1 -1
  9. package/build-module/cover/edit/index.js +3 -1
  10. package/build-module/cover/edit/index.js.map +1 -1
  11. package/build-module/list/utils.js +5 -9
  12. package/build-module/list/utils.js.map +1 -1
  13. package/build-module/list-item/edit.js +2 -1
  14. package/build-module/list-item/edit.js.map +1 -1
  15. package/build-module/page-list/edit.js +29 -10
  16. package/build-module/page-list/edit.js.map +1 -1
  17. package/build-style/common-rtl.css +3 -1
  18. package/build-style/common.css +3 -1
  19. package/build-style/cover/style-rtl.css +2 -1
  20. package/build-style/cover/style.css +2 -1
  21. package/build-style/editor-rtl.css +1 -0
  22. package/build-style/editor.css +1 -0
  23. package/build-style/gallery/style-rtl.css +4 -2
  24. package/build-style/gallery/style.css +4 -2
  25. package/build-style/style-rtl.css +16 -5
  26. package/build-style/style.css +16 -5
  27. package/build-style/table/editor-rtl.css +1 -0
  28. package/build-style/table/editor.css +1 -0
  29. package/build-style/table/style-rtl.css +5 -0
  30. package/build-style/table/style.css +5 -0
  31. package/build-style/table/theme-rtl.css +0 -2
  32. package/build-style/table/theme.css +0 -2
  33. package/build-style/theme-rtl.css +0 -2
  34. package/build-style/theme.css +0 -2
  35. package/build-style/video/style-rtl.css +2 -1
  36. package/build-style/video/style.css +2 -1
  37. package/package.json +6 -6
  38. package/src/cover/edit/index.js +3 -1
  39. package/src/list/utils.js +3 -11
  40. package/src/list-item/edit.js +1 -0
  41. package/src/page-list/edit.js +36 -22
  42. package/src/post-featured-image/index.php +17 -18
  43. package/src/table/editor.scss +1 -0
  44. package/src/table/style.scss +7 -0
  45. package/src/table/theme.scss +0 -2
  46. package/src/template-part/index.php +5 -0
@@ -19,6 +19,12 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
19
19
  }
20
20
  $post_ID = $block->context['postId'];
21
21
 
22
+ // Check is needed for backward compatibility with third-party plugins
23
+ // that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
24
+ if ( ! in_the_loop() && have_posts() ) {
25
+ the_post();
26
+ }
27
+
22
28
  $is_link = isset( $attributes['isLink'] ) && $attributes['isLink'];
23
29
  $size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail';
24
30
  $post_title = trim( strip_tags( get_the_title( $post_ID ) ) );
@@ -29,11 +35,18 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
29
35
  $attr['alt'] = $post_title;
30
36
  }
31
37
 
38
+ if ( ! empty( $attributes['height'] ) ) {
39
+ $extra_styles = "height:{$attributes['height']};";
40
+ if ( ! empty( $attributes['scale'] ) ) {
41
+ $extra_styles .= "object-fit:{$attributes['scale']};";
42
+ }
43
+ $attr['style'] = empty( $attr['style'] ) ? $extra_styles : $attr['style'] . $extra_styles;
44
+ }
45
+
32
46
  $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
33
47
  if ( ! $featured_image ) {
34
48
  return '';
35
49
  }
36
- $wrapper_attributes = get_block_wrapper_attributes();
37
50
  if ( $is_link ) {
38
51
  $link_target = $attributes['linkTarget'];
39
52
  $rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
@@ -49,23 +62,9 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
49
62
  $featured_image = $featured_image . $overlay_markup;
50
63
  }
51
64
 
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( '<img ', '<img style="' . esc_attr( safecss_filter_attr( $image_styles ) ) . '" ', $featured_image );
68
- }
65
+ $wrapper_attributes = empty( $attributes['width'] )
66
+ ? get_block_wrapper_attributes()
67
+ : get_block_wrapper_attributes( array( 'style' => "width:{$attributes['width']};" ) );
69
68
 
70
69
  return "<figure {$wrapper_attributes}>{$featured_image}</figure>";
71
70
  }
@@ -31,6 +31,7 @@
31
31
  td,
32
32
  th {
33
33
  border: $border-width solid;
34
+ padding: 0.5em;
34
35
  }
35
36
 
36
37
  td.is-selected,
@@ -11,6 +11,13 @@
11
11
  width: 100%;
12
12
  }
13
13
 
14
+ // Match default border style to default style in editor
15
+ td,
16
+ th {
17
+ border: $border-width solid;
18
+ padding: 0.5em;
19
+ }
20
+
14
21
  // Fixed layout toggle
15
22
  .has-fixed-layout {
16
23
  table-layout: fixed;
@@ -11,8 +11,6 @@
11
11
 
12
12
  td,
13
13
  th {
14
- padding: 0.5em;
15
- border: 1px solid;
16
14
  word-break: normal;
17
15
  }
18
16
 
@@ -193,6 +193,11 @@ function build_template_part_block_instance_variations() {
193
193
  if ( wp_installing() ) {
194
194
  return array();
195
195
  }
196
+
197
+ if ( ! current_theme_supports( 'block-templates' ) && ! current_theme_supports( 'block-template-parts' ) ) {
198
+ return array();
199
+ }
200
+
196
201
  $variations = array();
197
202
  $template_parts = get_block_templates(
198
203
  array(