@wordpress/block-library 9.18.0 → 9.19.1

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 (133) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/cover/edit/index.js +3 -1
  3. package/build/cover/edit/index.js.map +1 -1
  4. package/build/form/edit.js +4 -2
  5. package/build/form/edit.js.map +1 -1
  6. package/build/image/view.js +4 -4
  7. package/build/image/view.js.map +1 -1
  8. package/build/latest-posts/edit.js +2 -1
  9. package/build/latest-posts/edit.js.map +1 -1
  10. package/build/navigation/use-template-part-area-label.js +7 -6
  11. package/build/navigation/use-template-part-area-label.js.map +1 -1
  12. package/build/navigation/view.js +2 -2
  13. package/build/navigation/view.js.map +1 -1
  14. package/build/navigation-link/edit.js +2 -1
  15. package/build/navigation-link/edit.js.map +1 -1
  16. package/build/navigation-submenu/edit.js +2 -1
  17. package/build/navigation-submenu/edit.js.map +1 -1
  18. package/build/post-author/edit.js +1 -1
  19. package/build/post-author/edit.js.map +1 -1
  20. package/build/post-author-name/edit.js +2 -2
  21. package/build/post-author-name/edit.js.map +1 -1
  22. package/build/post-comments-count/index.js +8 -1
  23. package/build/post-comments-count/index.js.map +1 -1
  24. package/build/post-navigation-link/edit.js +1 -1
  25. package/build/post-navigation-link/edit.js.map +1 -1
  26. package/build/query/edit/inspector-controls/index.js +2 -0
  27. package/build/query/edit/inspector-controls/index.js.map +1 -1
  28. package/build/query/edit/inspector-controls/order-control.js +3 -2
  29. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  30. package/build/query/utils.js +45 -0
  31. package/build/query/utils.js.map +1 -1
  32. package/build/query/view.js +2 -2
  33. package/build/query/view.js.map +1 -1
  34. package/build/query-total/index.js +2 -2
  35. package/build/query-total/index.js.map +1 -1
  36. package/build/search/view.js +2 -2
  37. package/build/search/view.js.map +1 -1
  38. package/build/site-logo/edit.js +2 -5
  39. package/build/site-logo/edit.js.map +1 -1
  40. package/build/template-part/edit/advanced-controls.js +1 -1
  41. package/build/template-part/edit/advanced-controls.js.map +1 -1
  42. package/build/template-part/edit/utils/hooks.js +1 -1
  43. package/build/template-part/edit/utils/hooks.js.map +1 -1
  44. package/build/video/edit-common-settings.js +10 -3
  45. package/build/video/edit-common-settings.js.map +1 -1
  46. package/build-module/cover/edit/index.js +3 -1
  47. package/build-module/cover/edit/index.js.map +1 -1
  48. package/build-module/form/edit.js +4 -2
  49. package/build-module/form/edit.js.map +1 -1
  50. package/build-module/image/view.js +5 -5
  51. package/build-module/image/view.js.map +1 -1
  52. package/build-module/latest-posts/edit.js +2 -1
  53. package/build-module/latest-posts/edit.js.map +1 -1
  54. package/build-module/navigation/use-template-part-area-label.js +7 -6
  55. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  56. package/build-module/navigation/view.js +3 -3
  57. package/build-module/navigation/view.js.map +1 -1
  58. package/build-module/navigation-link/edit.js +2 -1
  59. package/build-module/navigation-link/edit.js.map +1 -1
  60. package/build-module/navigation-submenu/edit.js +2 -1
  61. package/build-module/navigation-submenu/edit.js.map +1 -1
  62. package/build-module/post-author/edit.js +1 -1
  63. package/build-module/post-author/edit.js.map +1 -1
  64. package/build-module/post-author-name/edit.js +2 -2
  65. package/build-module/post-author-name/edit.js.map +1 -1
  66. package/build-module/post-comments-count/index.js +8 -1
  67. package/build-module/post-comments-count/index.js.map +1 -1
  68. package/build-module/post-navigation-link/edit.js +1 -1
  69. package/build-module/post-navigation-link/edit.js.map +1 -1
  70. package/build-module/query/edit/inspector-controls/index.js +3 -1
  71. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  72. package/build-module/query/edit/inspector-controls/order-control.js +3 -2
  73. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  74. package/build-module/query/utils.js +44 -0
  75. package/build-module/query/utils.js.map +1 -1
  76. package/build-module/query/view.js +3 -3
  77. package/build-module/query/view.js.map +1 -1
  78. package/build-module/query-total/index.js +2 -2
  79. package/build-module/query-total/index.js.map +1 -1
  80. package/build-module/search/view.js +3 -3
  81. package/build-module/search/view.js.map +1 -1
  82. package/build-module/site-logo/edit.js +2 -5
  83. package/build-module/site-logo/edit.js.map +1 -1
  84. package/build-module/template-part/edit/advanced-controls.js +1 -1
  85. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  86. package/build-module/template-part/edit/utils/hooks.js +1 -1
  87. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  88. package/build-module/video/edit-common-settings.js +10 -3
  89. package/build-module/video/edit-common-settings.js.map +1 -1
  90. package/build-style/editor-rtl.css +6 -9
  91. package/build-style/editor.css +6 -9
  92. package/build-style/navigation-link/editor-rtl.css +5 -9
  93. package/build-style/navigation-link/editor.css +5 -9
  94. package/build-style/post-comments-count/style-rtl.css +103 -0
  95. package/build-style/post-comments-count/style.css +103 -0
  96. package/build-style/pullquote/style-rtl.css +4 -0
  97. package/build-style/pullquote/style.css +4 -0
  98. package/build-style/social-link/editor-rtl.css +1 -0
  99. package/build-style/social-link/editor.css +1 -0
  100. package/build-style/style-rtl.css +8 -0
  101. package/build-style/style.css +8 -0
  102. package/package.json +35 -35
  103. package/src/cover/edit/index.js +2 -0
  104. package/src/cover/test/edit.js +6 -6
  105. package/src/form/edit.js +2 -0
  106. package/src/image/view.js +10 -5
  107. package/src/latest-posts/edit.js +1 -0
  108. package/src/navigation/use-template-part-area-label.js +6 -6
  109. package/src/navigation/view.js +8 -3
  110. package/src/navigation-link/edit.js +1 -0
  111. package/src/navigation-link/editor.scss +3 -24
  112. package/src/navigation-submenu/edit.js +1 -0
  113. package/src/post-author/edit.js +1 -1
  114. package/src/post-author-name/edit.js +4 -4
  115. package/src/post-comments-count/block.json +8 -1
  116. package/src/post-comments-count/style.scss +4 -0
  117. package/src/post-navigation-link/edit.js +1 -1
  118. package/src/pullquote/style.scss +4 -0
  119. package/src/query/edit/inspector-controls/index.js +3 -1
  120. package/src/query/edit/inspector-controls/order-control.js +9 -3
  121. package/src/query/utils.js +58 -0
  122. package/src/query/view.js +8 -3
  123. package/src/query-total/block.json +2 -2
  124. package/src/query-total/index.php +4 -2
  125. package/src/search/view.js +8 -3
  126. package/src/site-logo/edit.js +1 -5
  127. package/src/site-title/index.php +1 -1
  128. package/src/social-link/editor.scss +1 -0
  129. package/src/style.scss +1 -0
  130. package/src/template-part/edit/advanced-controls.js +1 -1
  131. package/src/template-part/edit/utils/hooks.js +1 -1
  132. package/src/template-part/index.php +3 -1
  133. package/src/video/edit-common-settings.js +11 -2
@@ -82,30 +82,9 @@
82
82
  // Draw a wavy underline.
83
83
  .wp-block-navigation-link__placeholder-text {
84
84
  span {
85
- $blur: 10%;
86
- $width: 6%;
87
- $stop1: 30%;
88
- $stop2: 64%;
89
-
90
- --wp-underline-color: var(--wp-admin-theme-color);
91
-
92
- background-image:
93
- linear-gradient(45deg, transparent ($stop1 - $blur), var(--wp-underline-color) $stop1, var(--wp-underline-color) ($stop1 + $width), transparent ($stop1 + $width + $blur)),
94
- linear-gradient(135deg, transparent ($stop2 - $blur), var(--wp-underline-color) $stop2, var(--wp-underline-color) ($stop2 + $width), transparent ($stop2 + $width + $blur));
95
- background-position: 0 100%;
96
- background-size: 6px 3px;
97
- background-repeat: repeat-x;
98
-
99
- // Since applied to a span, it doesn't change the footprint of the item,
100
- // but it does vertically shift the underline to better align.
101
- padding-bottom: 0.1em;
102
- }
103
-
104
- &.is-invalid,
105
- &.is-draft {
106
- span {
107
- --wp-underline-color: #{$alert-red};
108
- }
85
+ text-decoration: wavy underline;
86
+ text-decoration-skip-ink: none;
87
+ text-underline-offset: 0.25rem;
109
88
  }
110
89
  }
111
90
 
@@ -431,6 +431,7 @@ export default function NavigationSubmenuEdit( {
431
431
  } }
432
432
  label={ __( 'Link' ) }
433
433
  autoComplete="off"
434
+ type="url"
434
435
  />
435
436
  </ToolsPanelItem>
436
437
 
@@ -99,7 +99,7 @@ function PostAuthorEdit( {
99
99
  const showAuthorControl =
100
100
  !! postId && ! isDescendentOfQueryLoop && authorOptions.length > 0;
101
101
 
102
- if ( ! supportsAuthor ) {
102
+ if ( ! supportsAuthor && postType !== undefined ) {
103
103
  return (
104
104
  <div { ...blockProps }>
105
105
  { sprintf(
@@ -132,15 +132,15 @@ function PostAuthorNameEdit( {
132
132
  </ToolsPanel>
133
133
  </InspectorControls>
134
134
  <div { ...blockProps }>
135
- { supportsAuthor
136
- ? displayAuthor
137
- : sprintf(
135
+ { ! supportsAuthor && postType !== undefined
136
+ ? sprintf(
138
137
  // translators: %s: Name of the post type e.g: "post".
139
138
  __(
140
139
  'This post type (%s) does not support the author.'
141
140
  ),
142
141
  postType
143
- ) }
142
+ )
143
+ : displayAuthor }
144
144
  </div>
145
145
  </>
146
146
  );
@@ -39,8 +39,15 @@
39
39
  "fontSize": true
40
40
  }
41
41
  },
42
+ "__experimentalBorder": {
43
+ "radius": true,
44
+ "color": true,
45
+ "width": true,
46
+ "style": true
47
+ },
42
48
  "interactivity": {
43
49
  "clientNavigation": true
44
50
  }
45
- }
51
+ },
52
+ "style": "wp-block-post-comments-count"
46
53
  }
@@ -0,0 +1,4 @@
1
+ .wp-block-post-comments-count {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
4
+ }
@@ -198,7 +198,7 @@ export default function PostNavigationLinkEdit( {
198
198
  aria-label={ ariaLabel }
199
199
  placeholder={ placeholder }
200
200
  value={ label }
201
- allowedFormats={ [ 'core/bold', 'core/italic' ] }
201
+ withoutInteractiveFormatting
202
202
  onChange={ ( newLabel ) =>
203
203
  setAttributes( { label: newLabel } )
204
204
  }
@@ -46,6 +46,10 @@
46
46
  .wp-block-pullquote.has-text-align-right blockquote {
47
47
  text-align: right;
48
48
  }
49
+ // Ensure that we are reasonably specific to override theme defaults.
50
+ .wp-block-pullquote.has-text-align-center blockquote {
51
+ text-align: center;
52
+ }
49
53
 
50
54
  // .is-style-solid-color is deprecated.
51
55
  // This selector has not been scoped with `:root :where`, as global styles
@@ -35,6 +35,7 @@ import {
35
35
  useAllowedControls,
36
36
  isControlAllowed,
37
37
  useTaxonomies,
38
+ useOrderByOptions,
38
39
  } from '../../utils';
39
40
  import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
40
41
 
@@ -111,6 +112,7 @@ export default function QueryInspectorControls( props ) {
111
112
  return onChangeDebounced.cancel;
112
113
  }, [ querySearch, onChangeDebounced ] );
113
114
 
115
+ const orderByOptions = useOrderByOptions( postType );
114
116
  const showInheritControl =
115
117
  ! isSingular && isControlAllowed( allowedControls, 'inherit' );
116
118
  const showPostTypeControl =
@@ -329,7 +331,7 @@ export default function QueryInspectorControls( props ) {
329
331
  isShownByDefault
330
332
  >
331
333
  <OrderControl
332
- { ...{ order, orderBy } }
334
+ { ...{ order, orderBy, orderByOptions } }
333
335
  onChange={ setQuery }
334
336
  />
335
337
  </ToolsPanelItem>
@@ -4,7 +4,7 @@
4
4
  import { SelectControl } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
- const orderOptions = [
7
+ const defaultOrderByOptions = [
8
8
  {
9
9
  label: __( 'Newest to oldest' ),
10
10
  value: 'date/desc',
@@ -24,14 +24,20 @@ const orderOptions = [
24
24
  value: 'title/desc',
25
25
  },
26
26
  ];
27
- function OrderControl( { order, orderBy, onChange } ) {
27
+
28
+ function OrderControl( {
29
+ order,
30
+ orderBy,
31
+ orderByOptions = defaultOrderByOptions,
32
+ onChange,
33
+ } ) {
28
34
  return (
29
35
  <SelectControl
30
36
  __nextHasNoMarginBottom
31
37
  __next40pxDefaultSize
32
38
  label={ __( 'Order by' ) }
33
39
  value={ `${ orderBy }/${ order }` }
34
- options={ orderOptions }
40
+ options={ orderByOptions }
35
41
  onChange={ ( value ) => {
36
42
  const [ newOrderBy, newOrder ] = value.split( '/' );
37
43
  onChange( { order: newOrder, orderBy: newOrderBy } );
@@ -6,6 +6,7 @@ import { useMemo } from '@wordpress/element';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
7
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
8
  import { decodeEntities } from '@wordpress/html-entities';
9
+ import { __ } from '@wordpress/i18n';
9
10
  import {
10
11
  cloneBlock,
11
12
  getBlockSupport,
@@ -13,6 +14,7 @@ import {
13
14
  } from '@wordpress/blocks';
14
15
 
15
16
  /** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
17
+ /** @typedef {import('@wordpress/components/build-types/query-controls/types').OrderByOption} OrderByOption */
16
18
 
17
19
  /**
18
20
  * @typedef IHasNameAndId
@@ -186,6 +188,62 @@ export function useIsPostTypeHierarchical( postType ) {
186
188
  );
187
189
  }
188
190
 
191
+ /**
192
+ * List of avaiable options to order by.
193
+ *
194
+ * @param {string} postType The post type to check.
195
+ * @return {OrderByOption[]} List of order options.
196
+ */
197
+ export function useOrderByOptions( postType ) {
198
+ const supportsCustomOrder = useSelect(
199
+ ( select ) => {
200
+ const type = select( coreStore ).getPostType( postType );
201
+ return !! type?.supports?.[ 'page-attributes' ];
202
+ },
203
+ [ postType ]
204
+ );
205
+
206
+ return useMemo( () => {
207
+ const orderByOptions = [
208
+ {
209
+ label: __( 'Newest to oldest' ),
210
+ value: 'date/desc',
211
+ },
212
+ {
213
+ label: __( 'Oldest to newest' ),
214
+ value: 'date/asc',
215
+ },
216
+ {
217
+ /* translators: Label for ordering posts by title in ascending order. */
218
+ label: __( 'A → Z' ),
219
+ value: 'title/asc',
220
+ },
221
+ {
222
+ /* translators: Label for ordering posts by title in descending order. */
223
+ label: __( 'Z → A' ),
224
+ value: 'title/desc',
225
+ },
226
+ ];
227
+
228
+ if ( supportsCustomOrder ) {
229
+ orderByOptions.push(
230
+ {
231
+ /* translators: Label for ordering posts by ascending menu order. */
232
+ label: __( 'Ascending by order' ),
233
+ value: 'menu_order/asc',
234
+ },
235
+ {
236
+ /* translators: Label for ordering posts by descending menu order. */
237
+ label: __( 'Descending by order' ),
238
+ value: 'menu_order/desc',
239
+ }
240
+ );
241
+ }
242
+
243
+ return orderByOptions;
244
+ }, [ supportsCustomOrder ] );
245
+ }
246
+
189
247
  /**
190
248
  * Hook that returns the query properties' names defined by the active
191
249
  * block variation, to determine which block's filters to show.
package/src/query/view.js CHANGED
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { store, getContext, getElement } from '@wordpress/interactivity';
4
+ import {
5
+ store,
6
+ getContext,
7
+ getElement,
8
+ withSyncEvent,
9
+ } from '@wordpress/interactivity';
5
10
 
6
11
  const isValidLink = ( ref ) =>
7
12
  ref &&
@@ -22,7 +27,7 @@ store(
22
27
  'core/query',
23
28
  {
24
29
  actions: {
25
- *navigate( event ) {
30
+ navigate: withSyncEvent( function* ( event ) {
26
31
  const ctx = getContext();
27
32
  const { ref } = getElement();
28
33
  const queryRef = ref.closest(
@@ -42,7 +47,7 @@ store(
42
47
  const firstAnchor = `.wp-block-post-template a[href]`;
43
48
  queryRef.querySelector( firstAnchor )?.focus();
44
49
  }
45
- },
50
+ } ),
46
51
  *prefetch() {
47
52
  const { ref } = getElement();
48
53
  if ( isValidLink( ref ) ) {
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "color": {
25
25
  "gradients": true,
26
- "text": true,
27
26
  "__experimentalDefaultControls": {
28
- "background": true
27
+ "background": true,
28
+ "text": true
29
29
  }
30
30
  },
31
31
  "typography": {
@@ -10,6 +10,8 @@
10
10
  *
11
11
  * @since 6.8.0
12
12
  *
13
+ * @global WP_Query $wp_query WordPress Query object.
14
+ *
13
15
  * @param array $attributes Block attributes.
14
16
  * @param string $content Block default content.
15
17
  * @param WP_Block $block Block instance.
@@ -21,7 +23,7 @@ function render_block_core_query_total( $attributes, $content, $block ) {
21
23
  $wrapper_attributes = get_block_wrapper_attributes();
22
24
  if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
23
25
  $query_to_use = $wp_query;
24
- $current_page = max( 1, get_query_var( 'paged', 1 ) );
26
+ $current_page = max( 1, (int) get_query_var( 'paged', 1 ) );
25
27
  } else {
26
28
  $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
27
29
  $current_page = isset( $_GET[ $page_key ] ) ? (int) $_GET[ $page_key ] : 1;
@@ -29,7 +31,7 @@ function render_block_core_query_total( $attributes, $content, $block ) {
29
31
  }
30
32
 
31
33
  $max_rows = $query_to_use->found_posts;
32
- $posts_per_page = $query_to_use->get( 'posts_per_page' );
34
+ $posts_per_page = (int) $query_to_use->get( 'posts_per_page' );
33
35
 
34
36
  // Calculate the range of posts being displayed.
35
37
  $start = ( $current_page - 1 ) * $posts_per_page + 1;
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { store, getContext, getElement } from '@wordpress/interactivity';
4
+ import {
5
+ store,
6
+ getContext,
7
+ getElement,
8
+ withSyncEvent,
9
+ } from '@wordpress/interactivity';
5
10
 
6
11
  const { actions } = store(
7
12
  'core/search',
@@ -31,7 +36,7 @@ const { actions } = store(
31
36
  },
32
37
  },
33
38
  actions: {
34
- openSearchInput( event ) {
39
+ openSearchInput: withSyncEvent( ( event ) => {
35
40
  const ctx = getContext();
36
41
  const { ref } = getElement();
37
42
  if ( ! ctx.isSearchInputVisible ) {
@@ -39,7 +44,7 @@ const { actions } = store(
39
44
  ctx.isSearchInputVisible = true;
40
45
  ref.parentElement.querySelector( 'input' ).focus();
41
46
  }
42
- },
47
+ } ),
43
48
  closeSearchInput() {
44
49
  const ctx = getContext();
45
50
  ctx.isSearchInputVisible = false;
@@ -499,11 +499,6 @@ export default function LogoEdit( {
499
499
  };
500
500
 
501
501
  const onFilesDrop = ( filesList ) => {
502
- if ( filesList?.length > 1 ) {
503
- onUploadError( __( 'Only one image can be used as a site logo.' ) );
504
- return;
505
- }
506
-
507
502
  getSettings().mediaUpload( {
508
503
  allowedTypes: ALLOWED_MEDIA_TYPES,
509
504
  filesList,
@@ -515,6 +510,7 @@ export default function LogoEdit( {
515
510
  onInitialSelectLogo( image );
516
511
  },
517
512
  onError: onUploadError,
513
+ multiple: false,
518
514
  } );
519
515
  };
520
516
 
@@ -31,7 +31,7 @@ function render_block_core_site_title( $attributes ) {
31
31
  }
32
32
 
33
33
  if ( $attributes['isLink'] ) {
34
- $aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';
34
+ $aria_current = ! is_paged() && ( is_front_page() || is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ? ' aria-current="page"' : '';
35
35
  $link_target = ! empty( $attributes['linkTarget'] ) ? $attributes['linkTarget'] : '_self';
36
36
 
37
37
  $site_title = sprintf(
@@ -16,6 +16,7 @@
16
16
  height: auto;
17
17
  font-weight: inherit;
18
18
  font-family: inherit;
19
+ margin: 0;
19
20
 
20
21
  // This rule ensures social link buttons display correctly in template parts.
21
22
  opacity: 1;
package/src/style.scss CHANGED
@@ -36,6 +36,7 @@
36
36
  @import "./post-author/style.scss";
37
37
  @import "./post-author-biography/style.scss";
38
38
  @import "./post-comments-form/style.scss";
39
+ @import "./post-comments-count/style.scss";
39
40
  @import "./post-content/style.scss";
40
41
  @import "./post-comments-link/style.scss";
41
42
  @import "./post-date/style.scss";
@@ -36,7 +36,7 @@ export function TemplatePartAdvancedControls( {
36
36
 
37
37
  const defaultTemplatePartAreas = useSelect(
38
38
  ( select ) =>
39
- select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
39
+ select( coreStore ).getCurrentTheme()
40
40
  ?.default_template_part_areas || [],
41
41
  []
42
42
  );
@@ -137,7 +137,7 @@ export function useTemplatePartArea( area ) {
137
137
  return useSelect(
138
138
  ( select ) => {
139
139
  const definedAreas =
140
- select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
140
+ select( coreStore ).getCurrentTheme()
141
141
  ?.default_template_part_areas || [];
142
142
 
143
143
  const selectedArea = definedAreas.find(
@@ -70,7 +70,9 @@ function render_block_core_template_part( $attributes ) {
70
70
  if ( 0 === validate_file( $attributes['slug'] ) ) {
71
71
  $block_template = get_block_file_template( $template_part_id, 'wp_template_part' );
72
72
 
73
- $content = $block_template->content;
73
+ if ( isset( $block_template->content ) ) {
74
+ $content = $block_template->content;
75
+ }
74
76
  if ( isset( $block_template->area ) ) {
75
77
  $area = $block_template->area;
76
78
  }
@@ -22,6 +22,7 @@ const VideoSettings = ( { setAttributes, attributes } ) => {
22
22
  const autoPlayHelpText = __(
23
23
  'Autoplay may cause usability issues for some users.'
24
24
  );
25
+
25
26
  const getAutoplayHelp = Platform.select( {
26
27
  web: useCallback( ( checked ) => {
27
28
  return checked ? autoPlayHelpText : null;
@@ -32,7 +33,11 @@ const VideoSettings = ( { setAttributes, attributes } ) => {
32
33
  const toggleFactory = useMemo( () => {
33
34
  const toggleAttribute = ( attribute ) => {
34
35
  return ( newValue ) => {
35
- setAttributes( { [ attribute ]: newValue } );
36
+ setAttributes( {
37
+ [ attribute ]: newValue,
38
+ // Set muted when autoplay changes
39
+ ...( attribute === 'autoplay' && { muted: newValue } ),
40
+ } );
36
41
  };
37
42
  };
38
43
 
@@ -56,7 +61,7 @@ const VideoSettings = ( { setAttributes, attributes } ) => {
56
61
  isShownByDefault
57
62
  hasValue={ () => !! autoplay }
58
63
  onDeselect={ () => {
59
- setAttributes( { autoplay: false } );
64
+ setAttributes( { autoplay: false, muted: false } );
60
65
  } }
61
66
  >
62
67
  <ToggleControl
@@ -95,6 +100,10 @@ const VideoSettings = ( { setAttributes, attributes } ) => {
95
100
  label={ __( 'Muted' ) }
96
101
  onChange={ toggleFactory.muted }
97
102
  checked={ !! muted }
103
+ disabled={ autoplay }
104
+ help={
105
+ autoplay ? __( 'Muted because of Autoplay.' ) : null
106
+ }
98
107
  />
99
108
  </ToolsPanelItem>
100
109
  <ToolsPanelItem