@wordpress/block-library 7.18.0 → 7.19.0

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 (188) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/deprecated.js +16 -2
  3. package/build/button/deprecated.js.map +1 -1
  4. package/build/button/edit.js +13 -7
  5. package/build/button/edit.js.map +1 -1
  6. package/build/button/index.js +4 -1
  7. package/build/button/index.js.map +1 -1
  8. package/build/button/save.js +2 -0
  9. package/build/button/save.js.map +1 -1
  10. package/build/columns/transforms.js +5 -0
  11. package/build/columns/transforms.js.map +1 -1
  12. package/build/cover/edit/index.js +3 -1
  13. package/build/cover/edit/index.js.map +1 -1
  14. package/build/gallery/v1/edit.js +4 -2
  15. package/build/gallery/v1/edit.js.map +1 -1
  16. package/build/group/edit.js +98 -45
  17. package/build/group/edit.js.map +1 -1
  18. package/build/group/index.js +3 -0
  19. package/build/group/index.js.map +1 -1
  20. package/build/group/placeholder.js +168 -0
  21. package/build/group/placeholder.js.map +1 -0
  22. package/build/group/variations.js +3 -3
  23. package/build/group/variations.js.map +1 -1
  24. package/build/latest-comments/edit.js +2 -1
  25. package/build/latest-comments/edit.js.map +1 -1
  26. package/build/latest-comments/index.js +5 -1
  27. package/build/latest-comments/index.js.map +1 -1
  28. package/build/latest-posts/deprecated.js +13 -0
  29. package/build/latest-posts/deprecated.js.map +1 -1
  30. package/build/latest-posts/index.js +13 -0
  31. package/build/latest-posts/index.js.map +1 -1
  32. package/build/list-item/edit.js +2 -1
  33. package/build/list-item/edit.js.map +1 -1
  34. package/build/navigation/edit/index.js +82 -92
  35. package/build/navigation/edit/index.js.map +1 -1
  36. package/build/navigation/edit/manage-menus-button.js +36 -0
  37. package/build/navigation/edit/manage-menus-button.js.map +1 -0
  38. package/build/navigation/edit/navigation-menu-selector.js +12 -5
  39. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  40. package/build/navigation/edit/responsive-wrapper.js +2 -6
  41. package/build/navigation/edit/responsive-wrapper.js.map +1 -1
  42. package/build/navigation/edit/unsaved-inner-blocks.js +5 -19
  43. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  44. package/build/navigation-link/edit.js +10 -1
  45. package/build/navigation-link/edit.js.map +1 -1
  46. package/build/post-author/edit.js +35 -20
  47. package/build/post-author/edit.js.map +1 -1
  48. package/build/post-content/index.js +3 -0
  49. package/build/post-content/index.js.map +1 -1
  50. package/build/site-logo/edit.js +1 -1
  51. package/build/site-logo/edit.js.map +1 -1
  52. package/build/template-part/variations.js +5 -0
  53. package/build/template-part/variations.js.map +1 -1
  54. package/build-module/button/deprecated.js +16 -2
  55. package/build-module/button/deprecated.js.map +1 -1
  56. package/build-module/button/edit.js +15 -9
  57. package/build-module/button/edit.js.map +1 -1
  58. package/build-module/button/index.js +4 -1
  59. package/build-module/button/index.js.map +1 -1
  60. package/build-module/button/save.js +2 -0
  61. package/build-module/button/save.js.map +1 -1
  62. package/build-module/columns/transforms.js +5 -0
  63. package/build-module/columns/transforms.js.map +1 -1
  64. package/build-module/cover/edit/index.js +3 -1
  65. package/build-module/cover/edit/index.js.map +1 -1
  66. package/build-module/gallery/v1/edit.js +5 -3
  67. package/build-module/gallery/v1/edit.js.map +1 -1
  68. package/build-module/group/edit.js +94 -45
  69. package/build-module/group/edit.js.map +1 -1
  70. package/build-module/group/index.js +3 -0
  71. package/build-module/group/index.js.map +1 -1
  72. package/build-module/group/placeholder.js +154 -0
  73. package/build-module/group/placeholder.js.map +1 -0
  74. package/build-module/group/variations.js +3 -3
  75. package/build-module/group/variations.js.map +1 -1
  76. package/build-module/latest-comments/edit.js +2 -1
  77. package/build-module/latest-comments/edit.js.map +1 -1
  78. package/build-module/latest-comments/index.js +5 -1
  79. package/build-module/latest-comments/index.js.map +1 -1
  80. package/build-module/latest-posts/deprecated.js +13 -0
  81. package/build-module/latest-posts/deprecated.js.map +1 -1
  82. package/build-module/latest-posts/index.js +13 -0
  83. package/build-module/latest-posts/index.js.map +1 -1
  84. package/build-module/list-item/edit.js +2 -1
  85. package/build-module/list-item/edit.js.map +1 -1
  86. package/build-module/navigation/edit/index.js +84 -94
  87. package/build-module/navigation/edit/index.js.map +1 -1
  88. package/build-module/navigation/edit/manage-menus-button.js +26 -0
  89. package/build-module/navigation/edit/manage-menus-button.js.map +1 -0
  90. package/build-module/navigation/edit/navigation-menu-selector.js +13 -6
  91. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  92. package/build-module/navigation/edit/responsive-wrapper.js +2 -6
  93. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
  94. package/build-module/navigation/edit/unsaved-inner-blocks.js +7 -20
  95. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  96. package/build-module/navigation-link/edit.js +10 -1
  97. package/build-module/navigation-link/edit.js.map +1 -1
  98. package/build-module/post-author/edit.js +35 -21
  99. package/build-module/post-author/edit.js.map +1 -1
  100. package/build-module/post-content/index.js +3 -0
  101. package/build-module/post-content/index.js.map +1 -1
  102. package/build-module/site-logo/edit.js +1 -1
  103. package/build-module/site-logo/edit.js.map +1 -1
  104. package/build-module/template-part/variations.js +5 -0
  105. package/build-module/template-part/variations.js.map +1 -1
  106. package/build-style/editor-rtl.css +76 -1
  107. package/build-style/editor.css +76 -1
  108. package/build-style/group/editor-rtl.css +44 -0
  109. package/build-style/group/editor.css +44 -0
  110. package/build-style/latest-comments/style-rtl.css +1 -0
  111. package/build-style/latest-comments/style.css +1 -0
  112. package/build-style/latest-posts/style-rtl.css +3 -0
  113. package/build-style/latest-posts/style.css +3 -0
  114. package/build-style/navigation/editor-rtl.css +23 -0
  115. package/build-style/navigation/editor.css +23 -0
  116. package/build-style/navigation/style-rtl.css +10 -0
  117. package/build-style/navigation/style.css +10 -0
  118. package/build-style/navigation-link/editor-rtl.css +8 -1
  119. package/build-style/navigation-link/editor.css +8 -1
  120. package/build-style/query/editor-rtl.css +1 -1
  121. package/build-style/query/editor.css +1 -1
  122. package/build-style/query-pagination/style-rtl.css +1 -1
  123. package/build-style/query-pagination/style.css +1 -1
  124. package/build-style/style-rtl.css +20 -1
  125. package/build-style/style.css +20 -1
  126. package/build-style/table/editor-rtl.css +1 -0
  127. package/build-style/table/editor.css +1 -0
  128. package/build-style/table/style-rtl.css +5 -0
  129. package/build-style/table/style.css +5 -0
  130. package/build-style/table/theme-rtl.css +1 -3
  131. package/build-style/table/theme.css +1 -3
  132. package/build-style/theme-rtl.css +1 -3
  133. package/build-style/theme.css +1 -3
  134. package/package.json +28 -28
  135. package/src/avatar/index.php +1 -1
  136. package/src/block/test/edit.native.js +8 -8
  137. package/src/button/block.json +4 -1
  138. package/src/button/deprecated.js +18 -2
  139. package/src/button/edit.js +11 -9
  140. package/src/button/save.js +12 -2
  141. package/src/buttons/test/edit.native.js +19 -19
  142. package/src/columns/test/edit.native.js +32 -32
  143. package/src/columns/transforms.js +8 -0
  144. package/src/cover/edit/index.js +3 -1
  145. package/src/cover/test/edit.native.js +26 -26
  146. package/src/embed/test/index.native.js +43 -43
  147. package/src/gallery/test/index.native.js +11 -11
  148. package/src/gallery/v1/edit.js +19 -24
  149. package/src/group/block.json +3 -0
  150. package/src/group/edit.js +95 -44
  151. package/src/group/editor.scss +48 -0
  152. package/src/group/placeholder.js +187 -0
  153. package/src/group/test/edit.native.js +3 -3
  154. package/src/group/test/placeholder.js +78 -0
  155. package/src/group/variations.js +3 -3
  156. package/src/image/test/edit.native.js +17 -17
  157. package/src/latest-comments/block.json +5 -1
  158. package/src/latest-comments/edit.js +1 -0
  159. package/src/latest-comments/style.scss +3 -0
  160. package/src/latest-posts/block.json +13 -0
  161. package/src/latest-posts/style.scss +3 -0
  162. package/src/list/test/edit.native.js +36 -36
  163. package/src/list-item/edit.js +1 -0
  164. package/src/missing/test/edit-integration.native.js +5 -5
  165. package/src/navigation/edit/index.js +173 -146
  166. package/src/navigation/edit/manage-menus-button.js +21 -0
  167. package/src/navigation/edit/navigation-menu-selector.js +20 -5
  168. package/src/navigation/edit/responsive-wrapper.js +2 -10
  169. package/src/navigation/edit/unsaved-inner-blocks.js +5 -29
  170. package/src/navigation/editor.scss +25 -0
  171. package/src/navigation/style.scss +16 -0
  172. package/src/navigation-link/edit.js +8 -0
  173. package/src/navigation-link/editor.scss +8 -0
  174. package/src/post-author/edit.js +44 -20
  175. package/src/post-content/block.json +3 -0
  176. package/src/query/editor.scss +1 -1
  177. package/src/query-pagination/style.scss +1 -1
  178. package/src/read-more/index.php +9 -2
  179. package/src/shortcode/test/edit.native.js +5 -5
  180. package/src/site-logo/edit.js +1 -1
  181. package/src/social-link/test/index.native.js +10 -10
  182. package/src/social-links/test/edit.native.js +4 -4
  183. package/src/spacer/test/index.native.js +17 -17
  184. package/src/table/editor.scss +1 -0
  185. package/src/table/style.scss +7 -0
  186. package/src/table/theme.scss +1 -3
  187. package/src/template-part/index.php +5 -0
  188. package/src/template-part/variations.js +4 -0
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Appender
3
+ */
4
+
5
+ .wp-block-navigation .block-list-appender {
6
+ position: relative;
7
+ }
8
+
1
9
  /**
2
10
  * Submenus.
3
11
  */
@@ -13,11 +13,23 @@ import {
13
13
  RichText,
14
14
  useBlockProps,
15
15
  } from '@wordpress/block-editor';
16
- import { PanelBody, SelectControl, ToggleControl } from '@wordpress/components';
16
+ import {
17
+ ComboboxControl,
18
+ PanelBody,
19
+ SelectControl,
20
+ ToggleControl,
21
+ } from '@wordpress/components';
17
22
  import { useSelect, useDispatch } from '@wordpress/data';
18
23
  import { __ } from '@wordpress/i18n';
19
24
  import { store as coreStore } from '@wordpress/core-data';
20
25
 
26
+ const minimumUsersForCombobox = 25;
27
+
28
+ const AUTHORS_QUERY = {
29
+ who: 'authors',
30
+ per_page: 100,
31
+ };
32
+
21
33
  function PostAuthorEdit( {
22
34
  isSelected,
23
35
  context: { postType, postId, queryId },
@@ -38,7 +50,7 @@ function PostAuthorEdit( {
38
50
  return {
39
51
  authorId: _authorId,
40
52
  authorDetails: _authorId ? getUser( _authorId ) : null,
41
- authors: getUsers( { who: 'authors' } ),
53
+ authors: getUsers( AUTHORS_QUERY ),
42
54
  };
43
55
  },
44
56
  [ postType, postId ]
@@ -65,34 +77,46 @@ function PostAuthorEdit( {
65
77
  } ),
66
78
  } );
67
79
 
80
+ const authorOptions = authors?.length
81
+ ? authors.map( ( { id, name } ) => {
82
+ return {
83
+ value: id,
84
+ label: name,
85
+ };
86
+ } )
87
+ : [];
88
+
89
+ const handleSelect = ( nextAuthorId ) => {
90
+ editEntityRecord( 'postType', postType, postId, {
91
+ author: nextAuthorId,
92
+ } );
93
+ };
94
+
95
+ const showCombobox = authorOptions.length >= minimumUsersForCombobox;
96
+
68
97
  return (
69
98
  <>
70
99
  <InspectorControls>
71
100
  <PanelBody title={ __( 'Settings' ) }>
72
101
  { !! postId &&
73
102
  ! isDescendentOfQueryLoop &&
74
- !! authors?.length && (
103
+ authorOptions.length &&
104
+ ( ( showCombobox && (
105
+ <ComboboxControl
106
+ label={ __( 'Author' ) }
107
+ options={ authorOptions }
108
+ value={ authorId }
109
+ onChange={ handleSelect }
110
+ allowReset={ false }
111
+ />
112
+ ) ) || (
75
113
  <SelectControl
76
114
  label={ __( 'Author' ) }
77
115
  value={ authorId }
78
- options={ authors.map( ( { id, name } ) => {
79
- return {
80
- value: id,
81
- label: name,
82
- };
83
- } ) }
84
- onChange={ ( nextAuthorId ) => {
85
- editEntityRecord(
86
- 'postType',
87
- postType,
88
- postId,
89
- {
90
- author: nextAuthorId,
91
- }
92
- );
93
- } }
116
+ options={ authorOptions }
117
+ onChange={ handleSelect }
94
118
  />
95
- ) }
119
+ ) ) }
96
120
  <ToggleControl
97
121
  label={ __( 'Show avatar' ) }
98
122
  checked={ showAvatar }
@@ -11,6 +11,9 @@
11
11
  "align": [ "wide", "full" ],
12
12
  "html": false,
13
13
  "__experimentalLayout": true,
14
+ "dimensions": {
15
+ "minHeight": true
16
+ },
14
17
  "typography": {
15
18
  "fontSize": true,
16
19
  "lineHeight": true,
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .wp-block-query__create-new-link {
6
- padding: 0 $grid-unit-20 $grid-unit-20 56px;
6
+ padding: 0 $grid-unit-20 $grid-unit-20 52px;
7
7
  }
8
8
 
9
9
  .block-library-query__pattern-selection-content .block-editor-block-patterns-list {
@@ -18,7 +18,7 @@ $pagination-margin: 0.5em;
18
18
  // which is important when it's the only block displayed
19
19
  // and the block has a "space-between" justification.
20
20
  &.is-content-justification-space-between {
21
- > .wp-block-query-pagination-next:last-child {
21
+ > .wp-block-query-pagination-next:last-of-type {
22
22
  margin-inline-start: auto;
23
23
  }
24
24
  > .wp-block-query-pagination-previous:first-child {
@@ -19,15 +19,22 @@ function render_block_core_read_more( $attributes, $content, $block ) {
19
19
  }
20
20
 
21
21
  $post_ID = $block->context['postId'];
22
+ $post_title = get_the_title( $post_ID );
23
+ $screen_reader_text = sprintf(
24
+ /* translators: %s is either the post title or post ID to describe the link for screen readers. */
25
+ __( ': %s' ),
26
+ '' !== $post_title ? $post_title : __( 'untitled post ' ) . $post_ID
27
+ );
22
28
  $justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
23
29
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );
24
30
  $more_text = ! empty( $attributes['content'] ) ? wp_kses_post( $attributes['content'] ) : __( 'Read more' );
25
31
  return sprintf(
26
- '<a %1s href="%2s" target="%3s">%4s</a>',
32
+ '<a %1s href="%2s" target="%3s">%4s<span class="screen-reader-text">%5s</span></a>',
27
33
  $wrapper_attributes,
28
34
  get_the_permalink( $post_ID ),
29
35
  esc_attr( $attributes['linkTarget'] ),
30
- $more_text
36
+ $more_text,
37
+ $screen_reader_text
31
38
  );
32
39
  }
33
40
 
@@ -28,10 +28,10 @@ afterAll( () => {
28
28
 
29
29
  describe( 'Shortcode block', () => {
30
30
  it( 'inserts block', async () => {
31
- const { getByA11yLabel, getByTestId, getByText } =
31
+ const { getByLabelText, getByTestId, getByText } =
32
32
  await initializeEditor();
33
33
 
34
- fireEvent.press( getByA11yLabel( 'Add block' ) );
34
+ fireEvent.press( getByLabelText( 'Add block' ) );
35
35
 
36
36
  const blockList = getByTestId( 'InserterUI-Blocks' );
37
37
  // onScroll event used to force the FlatList to render all items
@@ -45,17 +45,17 @@ describe( 'Shortcode block', () => {
45
45
 
46
46
  fireEvent.press( await waitFor( () => getByText( 'Shortcode' ) ) );
47
47
 
48
- expect( getByA11yLabel( /Shortcode Block\. Row 1/ ) ).toBeVisible();
48
+ expect( getByLabelText( /Shortcode Block\. Row 1/ ) ).toBeVisible();
49
49
  expect( getEditorHtml() ).toMatchSnapshot();
50
50
  } );
51
51
 
52
52
  it( 'edits content', async () => {
53
- const { getByA11yLabel, getByPlaceholderText } = await initializeEditor(
53
+ const { getByLabelText, getByPlaceholderText } = await initializeEditor(
54
54
  {
55
55
  initialHtml: '<!-- wp:shortcode /-->',
56
56
  }
57
57
  );
58
- const shortcodeBlock = getByA11yLabel( /Shortcode Block\. Row 1/ );
58
+ const shortcodeBlock = getByLabelText( /Shortcode Block\. Row 1/ );
59
59
  fireEvent.press( shortcodeBlock );
60
60
 
61
61
  const textField = getByPlaceholderText( 'Add a shortcode…' );
@@ -394,7 +394,7 @@ export default function LogoEdit( {
394
394
  return {
395
395
  siteLogoId: _siteLogoId,
396
396
  canUserEdit: _canUserEdit,
397
- url: siteData?.url,
397
+ url: siteData?.home,
398
398
  mediaItemData: mediaItem,
399
399
  isRequestingMediaItem: _isRequestingMediaItem,
400
400
  siteIconId: _siteIconId,
@@ -33,7 +33,7 @@ describe( '<SocialLinkEdit/>', () => {
33
33
 
34
34
  // Act
35
35
  fireEvent.press(
36
- await waitFor( () => subject.getByA11yLabel( 'Add block' ) )
36
+ await waitFor( () => subject.getByLabelText( 'Add block' ) )
37
37
  );
38
38
  fireEvent.changeText(
39
39
  await waitFor( () =>
@@ -43,13 +43,13 @@ describe( '<SocialLinkEdit/>', () => {
43
43
  );
44
44
  fireEvent.press(
45
45
  await waitFor( () =>
46
- subject.getByA11yLabel( 'Social Icons block' )
46
+ subject.getByLabelText( 'Social Icons block' )
47
47
  )
48
48
  );
49
49
  fireEvent(
50
50
  await waitFor( () =>
51
51
  within(
52
- subject.getByA11yLabel( /Social Icons Block. Row 1/ )
52
+ subject.getByLabelText( /Social Icons Block. Row 1/ )
53
53
  ).getByTestId( 'block-list-wrapper' )
54
54
  ),
55
55
  'layout',
@@ -59,22 +59,22 @@ describe( '<SocialLinkEdit/>', () => {
59
59
  // Assert
60
60
  expect(
61
61
  await waitFor( () =>
62
- subject.getByA11yLabel( /WordPress social icon/ )
62
+ subject.getByLabelText( /WordPress social icon/ )
63
63
  )
64
64
  ).toBeDefined();
65
65
  expect(
66
66
  await waitFor( () =>
67
- subject.getByA11yLabel( /Facebook social icon/ )
67
+ subject.getByLabelText( /Facebook social icon/ )
68
68
  )
69
69
  ).toBeDefined();
70
70
  expect(
71
71
  await waitFor( () =>
72
- subject.getByA11yLabel( /Twitter social icon/ )
72
+ subject.getByLabelText( /Twitter social icon/ )
73
73
  )
74
74
  ).toBeDefined();
75
75
  expect(
76
76
  await waitFor( () =>
77
- subject.getByA11yLabel( /Instagram social icon/ )
77
+ subject.getByLabelText( /Instagram social icon/ )
78
78
  )
79
79
  ).toBeDefined();
80
80
  } );
@@ -90,7 +90,7 @@ describe( '<SocialLinkEdit/>', () => {
90
90
 
91
91
  // Act
92
92
  fireEvent.press(
93
- await waitFor( () => subject.getByA11yLabel( 'Add block' ) )
93
+ await waitFor( () => subject.getByLabelText( 'Add block' ) )
94
94
  );
95
95
  fireEvent.changeText(
96
96
  await waitFor( () =>
@@ -100,13 +100,13 @@ describe( '<SocialLinkEdit/>', () => {
100
100
  );
101
101
  fireEvent.press(
102
102
  await waitFor( () =>
103
- subject.getByA11yLabel( 'Social Icons block' )
103
+ subject.getByLabelText( 'Social Icons block' )
104
104
  )
105
105
  );
106
106
  fireEvent(
107
107
  await waitFor( () =>
108
108
  within(
109
- subject.getByA11yLabel( /Social Icons Block. Row 1/ )
109
+ subject.getByLabelText( /Social Icons Block. Row 1/ )
110
110
  ).getByTestId( 'block-list-wrapper' )
111
111
  ),
112
112
  'layout',
@@ -88,7 +88,7 @@ describe( 'Social links block', () => {
88
88
 
89
89
  // Check there's only one active social link
90
90
  const socialLinks =
91
- within( socialLinksBlock ).getAllByA11yLabel( / social icon/ );
91
+ within( socialLinksBlock ).getAllByLabelText( / social icon/ );
92
92
  expect( socialLinks.length ).toBe( 1 );
93
93
 
94
94
  // Check the WordPress link is shown when unselected
@@ -153,7 +153,7 @@ describe( 'Social links block', () => {
153
153
 
154
154
  it( 'shows the ghost placeholder when no icon is active', async () => {
155
155
  const screen = await initializeEditor();
156
- const { getByA11yLabel } = screen;
156
+ const { getByLabelText } = screen;
157
157
 
158
158
  // Add block
159
159
  await addBlock( screen, 'Social Icons' );
@@ -178,11 +178,11 @@ describe( 'Social links block', () => {
178
178
  fireEvent.press( firstLinkBlock );
179
179
 
180
180
  // Open block actions menu
181
- const blockActionsButton = getByA11yLabel( /Open Block Actions Menu/ );
181
+ const blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
182
182
  fireEvent.press( blockActionsButton );
183
183
 
184
184
  // Delete the social link
185
- const deleteButton = getByA11yLabel( /Remove block/ );
185
+ const deleteButton = getByLabelText( /Remove block/ );
186
186
  fireEvent.press( deleteButton );
187
187
 
188
188
  // Add Paragraph block
@@ -28,10 +28,10 @@ afterAll( () => {
28
28
 
29
29
  describe( 'Spacer block', () => {
30
30
  it( 'inserts block', async () => {
31
- const { getByA11yLabel, getByTestId, getByText } =
31
+ const { getByLabelText, getByTestId, getByText } =
32
32
  await initializeEditor();
33
33
 
34
- fireEvent.press( getByA11yLabel( 'Add block' ) );
34
+ fireEvent.press( getByLabelText( 'Add block' ) );
35
35
 
36
36
  const blockList = getByTestId( 'InserterUI-Blocks' );
37
37
  // onScroll event used to force the FlatList to render all items
@@ -45,7 +45,7 @@ describe( 'Spacer block', () => {
45
45
 
46
46
  fireEvent.press( await waitFor( () => getByText( 'Spacer' ) ) );
47
47
 
48
- expect( getByA11yLabel( /Spacer Block\. Row 1/ ) ).toBeVisible();
48
+ expect( getByLabelText( /Spacer Block\. Row 1/ ) ).toBeVisible();
49
49
  expect( getEditorHtml() ).toMatchSnapshot();
50
50
  } );
51
51
 
@@ -53,17 +53,17 @@ describe( 'Spacer block', () => {
53
53
  const initialHtml = `<!-- wp:spacer -->
54
54
  <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
55
55
  <!-- /wp:spacer -->`;
56
- const { getByA11yLabel, getByDisplayValue, getByTestId, getByText } =
56
+ const { getByLabelText, getByDisplayValue, getByTestId, getByText } =
57
57
  await initializeEditor( {
58
58
  initialHtml,
59
59
  } );
60
60
 
61
61
  // Select Spacer block
62
- const spacerBlock = getByA11yLabel( /Spacer Block\. Row 1/ );
62
+ const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
63
63
  fireEvent.press( spacerBlock );
64
64
 
65
65
  // Open block settings
66
- fireEvent.press( getByA11yLabel( 'Open Settings' ) );
66
+ fireEvent.press( getByLabelText( 'Open Settings' ) );
67
67
  await waitFor(
68
68
  () => getByTestId( 'block-settings-modal' ).props.isVisible
69
69
  );
@@ -80,17 +80,17 @@ describe( 'Spacer block', () => {
80
80
  const initialHtml = `<!-- wp:spacer -->
81
81
  <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
82
82
  <!-- /wp:spacer -->`;
83
- const { getByA11yLabel, getByDisplayValue, getByTestId, getByText } =
83
+ const { getByLabelText, getByDisplayValue, getByTestId, getByText } =
84
84
  await initializeEditor( {
85
85
  initialHtml,
86
86
  } );
87
87
 
88
88
  // Select Spacer block
89
- const spacerBlock = getByA11yLabel( /Spacer Block\. Row 1/ );
89
+ const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
90
90
  fireEvent.press( spacerBlock );
91
91
 
92
92
  // Open block settings
93
- fireEvent.press( getByA11yLabel( 'Open Settings' ) );
93
+ fireEvent.press( getByLabelText( 'Open Settings' ) );
94
94
  await waitFor(
95
95
  () => getByTestId( 'block-settings-modal' ).props.isVisible
96
96
  );
@@ -111,23 +111,23 @@ describe( 'Spacer block', () => {
111
111
  const initialHtml = `<!-- wp:spacer -->
112
112
  <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
113
113
  <!-- /wp:spacer -->`;
114
- const { getByA11yLabel, getByTestId } = await initializeEditor( {
114
+ const { getByLabelText, getByTestId } = await initializeEditor( {
115
115
  initialHtml,
116
116
  } );
117
117
 
118
118
  // Select Spacer block
119
- const spacerBlock = getByA11yLabel( /Spacer Block\. Row 1/ );
119
+ const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
120
120
  fireEvent.press( spacerBlock );
121
121
 
122
122
  // Open block settings
123
- fireEvent.press( getByA11yLabel( 'Open Settings' ) );
123
+ fireEvent.press( getByLabelText( 'Open Settings' ) );
124
124
  await waitFor(
125
125
  () => getByTestId( 'block-settings-modal' ).props.isVisible
126
126
  );
127
127
 
128
128
  // Increment height
129
129
  fireEvent(
130
- getByA11yLabel( /Height\. Value is 100 Pixels \(px\)/ ),
130
+ getByLabelText( /Height\. Value is 100 Pixels \(px\)/ ),
131
131
  'accessibilityAction',
132
132
  {
133
133
  nativeEvent: { actionName: 'increment' },
@@ -141,23 +141,23 @@ describe( 'Spacer block', () => {
141
141
  const initialHtml = `<!-- wp:spacer -->
142
142
  <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
143
143
  <!-- /wp:spacer -->`;
144
- const { getByA11yLabel, getByTestId } = await initializeEditor( {
144
+ const { getByLabelText, getByTestId } = await initializeEditor( {
145
145
  initialHtml,
146
146
  } );
147
147
 
148
148
  // Select Spacer block
149
- const spacerBlock = getByA11yLabel( /Spacer Block\. Row 1/ );
149
+ const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
150
150
  fireEvent.press( spacerBlock );
151
151
 
152
152
  // Open block settings
153
- fireEvent.press( getByA11yLabel( 'Open Settings' ) );
153
+ fireEvent.press( getByLabelText( 'Open Settings' ) );
154
154
  await waitFor(
155
155
  () => getByTestId( 'block-settings-modal' ).props.isVisible
156
156
  );
157
157
 
158
158
  // Increment height
159
159
  fireEvent(
160
- getByA11yLabel( /Height\. Value is 100 Pixels \(px\)/ ),
160
+ getByLabelText( /Height\. Value is 100 Pixels \(px\)/ ),
161
161
  'accessibilityAction',
162
162
  {
163
163
  nativeEvent: { actionName: 'decrement' },
@@ -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;
@@ -1,5 +1,5 @@
1
1
  .wp-block-table {
2
- margin: "0 0 1em 0";
2
+ margin: 0 0 1em 0;
3
3
 
4
4
  thead {
5
5
  border-bottom: 3px solid;
@@ -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(
@@ -40,6 +40,10 @@ export function enhanceTemplatePartVariations( settings, name ) {
40
40
  'wp_template_part',
41
41
  `${ theme }//${ slug }`
42
42
  );
43
+
44
+ if ( entity?.slug ) {
45
+ return entity.slug === variationAttributes.slug;
46
+ }
43
47
  return entity?.area === variationAttributes.area;
44
48
  };
45
49