@wordpress/block-library 9.21.0 → 9.23.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 (201) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/calendar/index.js +1 -0
  3. package/build/calendar/index.js.map +1 -1
  4. package/build/comments/edit/comments-inspector-controls.js +13 -13
  5. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  6. package/build/comments/edit/index.js +4 -2
  7. package/build/comments/edit/index.js.map +1 -1
  8. package/build/cover/edit/inspector-controls.js +9 -12
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/cover/index.js +1 -1
  11. package/build/cover/index.js.map +1 -1
  12. package/build/details/edit.js +1 -5
  13. package/build/details/edit.js.map +1 -1
  14. package/build/details/index.js +1 -1
  15. package/build/details/index.js.map +1 -1
  16. package/build/group/edit.js +17 -13
  17. package/build/group/edit.js.map +1 -1
  18. package/build/image/edit.js +0 -6
  19. package/build/image/edit.js.map +1 -1
  20. package/build/latest-posts/edit.js +100 -54
  21. package/build/latest-posts/edit.js.map +1 -1
  22. package/build/navigation/view.js +2 -1
  23. package/build/navigation/view.js.map +1 -1
  24. package/build/navigation-link/edit.js +0 -21
  25. package/build/navigation-link/edit.js.map +1 -1
  26. package/build/navigation-link/index.js +0 -3
  27. package/build/navigation-link/index.js.map +1 -1
  28. package/build/navigation-link/transforms.js +0 -2
  29. package/build/navigation-link/transforms.js.map +1 -1
  30. package/build/navigation-link/update-attributes.js +0 -1
  31. package/build/navigation-link/update-attributes.js.map +1 -1
  32. package/build/navigation-submenu/edit.js +1 -24
  33. package/build/navigation-submenu/edit.js.map +1 -1
  34. package/build/navigation-submenu/index.js +0 -3
  35. package/build/navigation-submenu/index.js.map +1 -1
  36. package/build/post-comments-count/index.js +0 -1
  37. package/build/post-comments-count/index.js.map +1 -1
  38. package/build/post-comments-link/index.js +0 -1
  39. package/build/post-comments-link/index.js.map +1 -1
  40. package/build/post-featured-image/edit.js +15 -5
  41. package/build/post-featured-image/edit.js.map +1 -1
  42. package/build/query/edit/inspector-controls/index.js +47 -59
  43. package/build/query/edit/inspector-controls/index.js.map +1 -1
  44. package/build/query/edit/inspector-controls/parent-control.js +2 -2
  45. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  46. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  47. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  48. package/build/query/edit/query-content.js +15 -29
  49. package/build/query/edit/query-content.js.map +1 -1
  50. package/build/quote/index.js +1 -1
  51. package/build/quote/index.js.map +1 -1
  52. package/build/separator/edit.js +13 -12
  53. package/build/separator/edit.js.map +1 -1
  54. package/build/social-links/edit.js +29 -31
  55. package/build/social-links/edit.js.map +1 -1
  56. package/build/table/index.js +3 -3
  57. package/build/table/index.js.map +1 -1
  58. package/build/table/transforms.js +11 -3
  59. package/build/table/transforms.js.map +1 -1
  60. package/build/table-of-contents/edit.js +1 -1
  61. package/build/table-of-contents/edit.js.map +1 -1
  62. package/build/table-of-contents/hooks.js +6 -3
  63. package/build/table-of-contents/hooks.js.map +1 -1
  64. package/build/template-part/edit/advanced-controls.js +14 -12
  65. package/build/template-part/edit/advanced-controls.js.map +1 -1
  66. package/build/template-part/edit/index.js +2 -1
  67. package/build/template-part/edit/index.js.map +1 -1
  68. package/build-module/calendar/index.js +1 -0
  69. package/build-module/calendar/index.js.map +1 -1
  70. package/build-module/comments/edit/comments-inspector-controls.js +14 -14
  71. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  72. package/build-module/comments/edit/index.js +4 -2
  73. package/build-module/comments/edit/index.js.map +1 -1
  74. package/build-module/cover/edit/inspector-controls.js +10 -13
  75. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  76. package/build-module/cover/index.js +1 -1
  77. package/build-module/cover/index.js.map +1 -1
  78. package/build-module/details/edit.js +1 -5
  79. package/build-module/details/edit.js.map +1 -1
  80. package/build-module/details/index.js +1 -1
  81. package/build-module/details/index.js.map +1 -1
  82. package/build-module/group/edit.js +16 -14
  83. package/build-module/group/edit.js.map +1 -1
  84. package/build-module/image/edit.js +0 -6
  85. package/build-module/image/edit.js.map +1 -1
  86. package/build-module/latest-posts/edit.js +100 -54
  87. package/build-module/latest-posts/edit.js.map +1 -1
  88. package/build-module/navigation/view.js +2 -1
  89. package/build-module/navigation/view.js.map +1 -1
  90. package/build-module/navigation-link/edit.js +0 -21
  91. package/build-module/navigation-link/edit.js.map +1 -1
  92. package/build-module/navigation-link/index.js +0 -3
  93. package/build-module/navigation-link/index.js.map +1 -1
  94. package/build-module/navigation-link/transforms.js +0 -2
  95. package/build-module/navigation-link/transforms.js.map +1 -1
  96. package/build-module/navigation-link/update-attributes.js +0 -1
  97. package/build-module/navigation-link/update-attributes.js.map +1 -1
  98. package/build-module/navigation-submenu/edit.js +1 -24
  99. package/build-module/navigation-submenu/edit.js.map +1 -1
  100. package/build-module/navigation-submenu/index.js +0 -3
  101. package/build-module/navigation-submenu/index.js.map +1 -1
  102. package/build-module/post-comments-count/index.js +0 -1
  103. package/build-module/post-comments-count/index.js.map +1 -1
  104. package/build-module/post-comments-link/index.js +0 -1
  105. package/build-module/post-comments-link/index.js.map +1 -1
  106. package/build-module/post-featured-image/edit.js +15 -5
  107. package/build-module/post-featured-image/edit.js.map +1 -1
  108. package/build-module/query/edit/inspector-controls/index.js +49 -61
  109. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  110. package/build-module/query/edit/inspector-controls/parent-control.js +2 -2
  111. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  112. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  113. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  114. package/build-module/query/edit/query-content.js +16 -30
  115. package/build-module/query/edit/query-content.js.map +1 -1
  116. package/build-module/quote/index.js +1 -1
  117. package/build-module/quote/index.js.map +1 -1
  118. package/build-module/separator/edit.js +15 -14
  119. package/build-module/separator/edit.js.map +1 -1
  120. package/build-module/social-links/edit.js +30 -32
  121. package/build-module/social-links/edit.js.map +1 -1
  122. package/build-module/table/index.js +3 -3
  123. package/build-module/table/index.js.map +1 -1
  124. package/build-module/table/transforms.js +11 -3
  125. package/build-module/table/transforms.js.map +1 -1
  126. package/build-module/table-of-contents/edit.js +1 -1
  127. package/build-module/table-of-contents/edit.js.map +1 -1
  128. package/build-module/table-of-contents/hooks.js +6 -3
  129. package/build-module/table-of-contents/hooks.js.map +1 -1
  130. package/build-module/template-part/edit/advanced-controls.js +14 -12
  131. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  132. package/build-module/template-part/edit/index.js +2 -1
  133. package/build-module/template-part/edit/index.js.map +1 -1
  134. package/build-style/editor-rtl.css +1 -50
  135. package/build-style/editor.css +1 -50
  136. package/build-style/media-text/style-rtl.css +0 -2
  137. package/build-style/media-text/style.css +0 -2
  138. package/build-style/search/style-rtl.css +1 -0
  139. package/build-style/search/style.css +1 -0
  140. package/build-style/social-links/editor-rtl.css +1 -50
  141. package/build-style/social-links/editor.css +1 -50
  142. package/build-style/style-rtl.css +1 -6
  143. package/build-style/style.css +1 -6
  144. package/build-style/tag-cloud/style-rtl.css +0 -4
  145. package/build-style/tag-cloud/style.css +0 -4
  146. package/package.json +35 -35
  147. package/src/button/index.php +2 -3
  148. package/src/calendar/block.json +1 -0
  149. package/src/comments/edit/comments-inspector-controls.js +14 -12
  150. package/src/comments/edit/index.js +2 -1
  151. package/src/cover/edit/inspector-controls.js +9 -12
  152. package/src/cover/index.js +1 -1
  153. package/src/details/edit.js +6 -8
  154. package/src/details/index.js +1 -1
  155. package/src/file/index.php +2 -3
  156. package/src/group/edit.js +11 -10
  157. package/src/image/edit.js +0 -4
  158. package/src/latest-comments/index.php +1 -1
  159. package/src/latest-posts/edit.js +113 -81
  160. package/src/latest-posts/index.php +3 -0
  161. package/src/loginout/index.php +5 -1
  162. package/src/media-text/style.scss +0 -2
  163. package/src/navigation/index.php +1 -2
  164. package/src/navigation/view.js +2 -1
  165. package/src/navigation-link/block.json +0 -3
  166. package/src/navigation-link/edit.js +1 -22
  167. package/src/navigation-link/index.php +2 -6
  168. package/src/navigation-link/transforms.js +1 -2
  169. package/src/navigation-link/update-attributes.js +0 -1
  170. package/src/navigation-submenu/block.json +0 -3
  171. package/src/navigation-submenu/edit.js +1 -24
  172. package/src/navigation-submenu/index.php +1 -5
  173. package/src/post-author/index.php +1 -1
  174. package/src/post-author-name/index.php +1 -1
  175. package/src/post-comments-count/block.json +0 -1
  176. package/src/post-comments-count/index.php +4 -0
  177. package/src/post-comments-link/block.json +0 -1
  178. package/src/post-comments-link/index.php +4 -0
  179. package/src/post-featured-image/edit.js +94 -77
  180. package/src/query/edit/inspector-controls/index.js +66 -91
  181. package/src/query/edit/inspector-controls/parent-control.js +2 -2
  182. package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -2
  183. package/src/query/edit/query-content.js +17 -27
  184. package/src/quote/index.js +1 -1
  185. package/src/search/index.php +12 -9
  186. package/src/search/style.scss +1 -0
  187. package/src/separator/edit.js +16 -12
  188. package/src/social-links/edit.js +29 -30
  189. package/src/social-links/editor.scss +1 -59
  190. package/src/table/index.js +3 -3
  191. package/src/table/transforms.js +14 -2
  192. package/src/table-of-contents/edit.js +1 -1
  193. package/src/table-of-contents/hooks.js +5 -2
  194. package/src/tag-cloud/style.scss +0 -5
  195. package/src/template-part/edit/advanced-controls.js +9 -8
  196. package/src/template-part/edit/index.js +1 -0
  197. package/build/utils/messages.js +0 -22
  198. package/build/utils/messages.js.map +0 -1
  199. package/build-module/utils/messages.js +0 -15
  200. package/build-module/utils/messages.js.map +0 -1
  201. package/src/utils/messages.js +0 -31
@@ -6,12 +6,13 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { HorizontalRule, SelectControl } from '@wordpress/components';
9
+ import { HorizontalRule } from '@wordpress/components';
10
10
  import {
11
11
  useBlockProps,
12
12
  getColorClassName,
13
13
  __experimentalUseColorProps as useColorProps,
14
14
  InspectorControls,
15
+ privateApis as blockEditorPrivateApis,
15
16
  } from '@wordpress/block-editor';
16
17
  import { __ } from '@wordpress/i18n';
17
18
 
@@ -19,9 +20,15 @@ import { __ } from '@wordpress/i18n';
19
20
  * Internal dependencies
20
21
  */
21
22
  import useDeprecatedOpacity from './use-deprecated-opacity';
22
- import { htmlElementMessages } from '../utils/messages';
23
+ import { unlock } from '../lock-unlock';
23
24
 
24
- export default function SeparatorEdit( { attributes, setAttributes } ) {
25
+ const { HTMLElementControl } = unlock( blockEditorPrivateApis );
26
+
27
+ export default function SeparatorEdit( {
28
+ attributes,
29
+ setAttributes,
30
+ clientId,
31
+ } ) {
25
32
  const { backgroundColor, opacity, style, tagName } = attributes;
26
33
  const colorProps = useColorProps( attributes );
27
34
  const currentColor = colorProps?.style?.backgroundColor;
@@ -52,19 +59,16 @@ export default function SeparatorEdit( { attributes, setAttributes } ) {
52
59
  return (
53
60
  <>
54
61
  <InspectorControls group="advanced">
55
- <SelectControl
56
- __nextHasNoMarginBottom
57
- __next40pxDefaultSize
58
- label={ __( 'HTML element' ) }
62
+ <HTMLElementControl
63
+ tagName={ tagName }
64
+ onChange={ ( value ) =>
65
+ setAttributes( { tagName: value } )
66
+ }
67
+ clientId={ clientId }
59
68
  options={ [
60
69
  { label: __( 'Default (<hr>)' ), value: 'hr' },
61
70
  { label: '<div>', value: 'div' },
62
71
  ] }
63
- value={ tagName }
64
- onChange={ ( value ) =>
65
- setAttributes( { tagName: value } )
66
- }
67
- help={ htmlElementMessages[ tagName ] }
68
72
  />
69
73
  </InspectorControls>
70
74
  <Wrapper
@@ -6,7 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useEffect, useRef } from '@wordpress/element';
9
+ import { useEffect } from '@wordpress/element';
10
10
  import {
11
11
  BlockControls,
12
12
  useInnerBlocksProps,
@@ -57,16 +57,21 @@ export function SocialLinksEdit( props ) {
57
57
 
58
58
  const {
59
59
  iconBackgroundColorValue,
60
- customIconBackgroundColor,
61
60
  iconColorValue,
62
61
  openInNewTab,
63
62
  showLabels,
64
63
  size,
65
64
  } = attributes;
66
65
 
67
- const hasSelectedChild = useSelect(
68
- ( select ) =>
69
- select( blockEditorStore ).hasSelectedInnerBlock( clientId ),
66
+ const { hasSocialIcons, hasSelectedChild } = useSelect(
67
+ ( select ) => {
68
+ const { getBlockCount, hasSelectedInnerBlock } =
69
+ select( blockEditorStore );
70
+ return {
71
+ hasSocialIcons: getBlockCount( clientId ) > 0,
72
+ hasSelectedChild: hasSelectedInnerBlock( clientId ),
73
+ };
74
+ },
70
75
  [ clientId ]
71
76
  );
72
77
 
@@ -78,33 +83,25 @@ export function SocialLinksEdit( props ) {
78
83
 
79
84
  // Remove icon background color when logos only style is selected or
80
85
  // restore it when any other style is selected.
81
- const backgroundBackupRef = useRef( {} );
82
86
  useEffect( () => {
83
87
  if ( logosOnly ) {
84
- backgroundBackupRef.current = {
85
- iconBackgroundColor,
86
- iconBackgroundColorValue,
87
- customIconBackgroundColor,
88
- };
89
- setAttributes( {
90
- iconBackgroundColor: undefined,
91
- customIconBackgroundColor: undefined,
92
- iconBackgroundColorValue: undefined,
88
+ let restore;
89
+ setAttributes( ( prev ) => {
90
+ restore = {
91
+ iconBackgroundColor: prev.iconBackgroundColor,
92
+ iconBackgroundColorValue: prev.iconBackgroundColorValue,
93
+ customIconBackgroundColor: prev.customIconBackgroundColor,
94
+ };
95
+ return {
96
+ iconBackgroundColor: undefined,
97
+ iconBackgroundColorValue: undefined,
98
+ customIconBackgroundColor: undefined,
99
+ };
93
100
  } );
94
- } else {
95
- setAttributes( { ...backgroundBackupRef.current } );
96
- }
97
- }, [ logosOnly ] );
98
101
 
99
- const SocialPlaceholder = (
100
- <li className="wp-block-social-links__social-placeholder">
101
- <div className="wp-block-social-links__social-placeholder-icons">
102
- <div className="wp-social-link wp-social-link-twitter"></div>
103
- <div className="wp-social-link wp-social-link-facebook"></div>
104
- <div className="wp-social-link wp-social-link-instagram"></div>
105
- </div>
106
- </li>
107
- );
102
+ return () => setAttributes( { ...restore } );
103
+ }
104
+ }, [ logosOnly, setAttributes ] );
108
105
 
109
106
  // Fallback color values are used maintain selections in case switching
110
107
  // themes and named colors in palette do not match.
@@ -117,11 +114,13 @@ export function SocialLinksEdit( props ) {
117
114
 
118
115
  const blockProps = useBlockProps( { className } );
119
116
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
120
- placeholder: ! isSelected && SocialPlaceholder,
121
117
  templateLock: false,
122
118
  orientation: attributes.layout?.orientation ?? 'horizontal',
123
119
  __experimentalAppenderTagName: 'li',
124
- renderAppender: hasAnySelected && InnerBlocks.ButtonBlockAppender,
120
+ renderAppender:
121
+ ! hasSocialIcons || hasAnySelected
122
+ ? InnerBlocks.ButtonBlockAppender
123
+ : undefined,
125
124
  } );
126
125
 
127
126
  const POPOVER_PROPS = {
@@ -12,67 +12,9 @@
12
12
 
13
13
  // Specificity for the following styles are fixed at 0-1-0 to match and be
14
14
  // overridable by global styles.
15
- :root :where(.wp-block-social-links),
16
- :root :where(.wp-block-social-links.is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link) {
15
+ :root :where(.wp-block-social-links) {
17
16
  padding: 0;
18
17
  }
19
- :root :where(.wp-block-social-links__social-placeholder .wp-social-link) {
20
- padding: 0.25em;
21
- }
22
- :root :where(.wp-block-social-links.is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link) {
23
- padding-left: calc((2/3) * 1em);
24
- padding-right: calc((2/3) * 1em);
25
- }
26
-
27
- // Placeholder/setup state.
28
- .wp-block-social-links__social-placeholder {
29
- display: flex;
30
- opacity: 0.8;
31
- list-style: none;
32
-
33
- // Use the first link to set the height.
34
- > .wp-social-link {
35
- // Use !important to keep the selector simple.
36
- padding-left: 0 !important;
37
- margin-left: 0 !important;
38
- padding-right: 0 !important;
39
- margin-right: 0 !important;
40
- width: 0 !important;
41
- visibility: hidden;
42
- }
43
-
44
- // Wrap the remaining placeholders in a container so the plus can overlap.
45
- > .wp-block-social-links__social-placeholder-icons {
46
- display: flex;
47
- }
48
-
49
- .wp-social-link::before {
50
- content: "";
51
- display: block;
52
- width: 1em;
53
- height: 1em;
54
- border-radius: $radius-round;
55
-
56
- .is-style-logos-only & {
57
- background: currentColor;
58
- }
59
- }
60
- }
61
-
62
- // Selected placeholder state.
63
- .wp-block-social-links .wp-block-social-links__social-prompt {
64
- min-height: $button-size-small;
65
- list-style: none;
66
-
67
- // Show as block UI.
68
- font-family: $default-font;
69
- font-size: $default-font-size;
70
- line-height: $button-size-small;
71
- margin-top: auto;
72
- margin-bottom: auto;
73
- cursor: default;
74
- padding-right: $grid-unit-10;
75
- }
76
18
 
77
19
  // Center flex items. This has an equivalent in style.scss.
78
20
  .wp-block[data-align="center"] > .wp-block-social-links,
@@ -48,7 +48,7 @@ export const settings = {
48
48
  tag: 'td',
49
49
  },
50
50
  {
51
- content: 'Jaco Pastorius',
51
+ content: __( 'Jaco Pastorius' ),
52
52
  tag: 'td',
53
53
  },
54
54
  {
@@ -64,7 +64,7 @@ export const settings = {
64
64
  tag: 'td',
65
65
  },
66
66
  {
67
- content: 'Betty Carter',
67
+ content: __( 'Betty Carter' ),
68
68
  tag: 'td',
69
69
  },
70
70
  {
@@ -80,7 +80,7 @@ export const settings = {
80
80
  tag: 'td',
81
81
  },
82
82
  {
83
- content: 'Bebo Valdés',
83
+ content: __( 'Bebo Valdés' ),
84
84
  tag: 'td',
85
85
  },
86
86
  {
@@ -15,12 +15,12 @@ const tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {
15
15
  th: {
16
16
  allowEmpty: true,
17
17
  children: phrasingContentSchema,
18
- attributes: [ 'scope', 'colspan', 'rowspan' ],
18
+ attributes: [ 'scope', 'colspan', 'rowspan', 'style' ],
19
19
  },
20
20
  td: {
21
21
  allowEmpty: true,
22
22
  children: phrasingContentSchema,
23
- attributes: [ 'colspan', 'rowspan' ],
23
+ attributes: [ 'colspan', 'rowspan', 'style' ],
24
24
  },
25
25
  },
26
26
  },
@@ -79,11 +79,23 @@ const transforms = {
79
79
  col.getAttribute( 'colspan' )
80
80
  );
81
81
 
82
+ const { textAlign } = col.style || {};
83
+
84
+ let align;
85
+ if (
86
+ textAlign === 'left' ||
87
+ textAlign === 'center' ||
88
+ textAlign === 'right'
89
+ ) {
90
+ align = textAlign;
91
+ }
92
+
82
93
  colAcc.push( {
83
94
  tag: col.nodeName.toLowerCase(),
84
95
  content: col.innerHTML,
85
96
  rowspan,
86
97
  colspan,
98
+ align,
87
99
  } );
88
100
 
89
101
  return colAcc;
@@ -176,7 +176,7 @@ export default function TableOfContentsEdit( {
176
176
  } )
177
177
  }
178
178
  help={
179
- maxLevel
179
+ ! maxLevel
180
180
  ? __(
181
181
  'Including all heading levels in the table of contents.'
182
182
  )
@@ -148,8 +148,11 @@ function observeCallback( select, dispatch, clientId ) {
148
148
 
149
149
  const headings = getLatestHeadings( select, clientId );
150
150
  if ( ! fastDeepEqual( headings, attributes.headings ) ) {
151
- __unstableMarkNextChangeAsNotPersistent();
152
- updateBlockAttributes( clientId, { headings } );
151
+ // Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.
152
+ window.queueMicrotask( () => {
153
+ __unstableMarkNextChangeAsNotPersistent();
154
+ updateBlockAttributes( clientId, { headings } );
155
+ } );
153
156
  }
154
157
  }
155
158
 
@@ -7,11 +7,6 @@
7
7
  justify-content: center;
8
8
  }
9
9
 
10
- &.alignfull {
11
- padding-left: 1em;
12
- padding-right: 1em;
13
- }
14
-
15
10
  a {
16
11
  display: inline-block;
17
12
  margin-right: 5px;
@@ -5,12 +5,15 @@ import { useEntityProp, store as coreStore } from '@wordpress/core-data';
5
5
  import { SelectControl, TextControl } from '@wordpress/components';
6
6
  import { sprintf, __ } from '@wordpress/i18n';
7
7
  import { useSelect } from '@wordpress/data';
8
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
12
13
  import { TemplatePartImportControls } from './import-controls';
13
- import { htmlElementMessages } from '../../utils/messages';
14
+ import { unlock } from '../../lock-unlock';
15
+
16
+ const { HTMLElementControl } = unlock( blockEditorPrivateApis );
14
17
 
15
18
  export function TemplatePartAdvancedControls( {
16
19
  tagName,
@@ -19,6 +22,7 @@ export function TemplatePartAdvancedControls( {
19
22
  templatePartId,
20
23
  defaultWrapper,
21
24
  hasInnerBlocks,
25
+ clientId,
22
26
  } ) {
23
27
  const [ area, setArea ] = useEntityProp(
24
28
  'postType',
@@ -73,10 +77,10 @@ export function TemplatePartAdvancedControls( {
73
77
  />
74
78
  </>
75
79
  ) }
76
- <SelectControl
77
- __nextHasNoMarginBottom
78
- __next40pxDefaultSize
79
- label={ __( 'HTML element' ) }
80
+ <HTMLElementControl
81
+ tagName={ tagName || '' }
82
+ onChange={ ( value ) => setAttributes( { tagName: value } ) }
83
+ clientId={ clientId }
80
84
  options={ [
81
85
  {
82
86
  label: sprintf(
@@ -94,9 +98,6 @@ export function TemplatePartAdvancedControls( {
94
98
  { label: '<footer>', value: 'footer' },
95
99
  { label: '<div>', value: 'div' },
96
100
  ] }
97
- value={ tagName || '' }
98
- onChange={ ( value ) => setAttributes( { tagName: value } ) }
99
- help={ htmlElementMessages[ tagName ] }
100
101
  />
101
102
  { ! hasInnerBlocks && (
102
103
  <TemplatePartImportControls
@@ -260,6 +260,7 @@ export default function TemplatePartEdit( {
260
260
  templatePartId={ templatePartId }
261
261
  defaultWrapper={ areaObject.tagName }
262
262
  hasInnerBlocks={ hasInnerBlocks }
263
+ clientId={ clientId }
263
264
  />
264
265
  </InspectorControls>
265
266
  ) }
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.htmlElementMessages = void 0;
7
- var _i18n = require("@wordpress/i18n");
8
- /**
9
- * WordPress dependencies
10
- */
11
-
12
- const htmlElementMessages = exports.htmlElementMessages = {
13
- article: (0, _i18n.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
14
- aside: (0, _i18n.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
15
- div: (0, _i18n.__)('The <div> element should only be used if the block is a design element with no semantic meaning.'),
16
- footer: (0, _i18n.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'),
17
- header: (0, _i18n.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
18
- main: (0, _i18n.__)('The <main> element should be used for the primary content of your document only.'),
19
- nav: (0, _i18n.__)('The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'),
20
- section: (0, _i18n.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element.")
21
- };
22
- //# sourceMappingURL=messages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_i18n","require","htmlElementMessages","exports","article","__","aside","div","footer","header","main","nav","section"],"sources":["@wordpress/block-library/src/utils/messages.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const htmlElementMessages = {\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tdiv: __(\n\t\t'The <div> element should only be used if the block is a design element with no semantic meaning.'\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tnav: __(\n\t\t'The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EAClCE,OAAO,EAAE,IAAAC,QAAE,EACV,gGACD,CAAC;EACDC,KAAK,EAAE,IAAAD,QAAE,EACR,uIACD,CAAC;EACDE,GAAG,EAAE,IAAAF,QAAE,EACN,kGACD,CAAC;EACDG,MAAM,EAAE,IAAAH,QAAE,EACT,8HACD,CAAC;EACDI,MAAM,EAAE,IAAAJ,QAAE,EACT,qHACD,CAAC;EACDK,IAAI,EAAE,IAAAL,QAAE,EACP,kFACD,CAAC;EACDM,GAAG,EAAE,IAAAN,QAAE,EACN,mIACD,CAAC;EACDO,OAAO,EAAE,IAAAP,QAAE,EACV,kIACD;AACD,CAAC","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- export const htmlElementMessages = {
6
- article: __('The <article> element should represent a self-contained, syndicatable portion of the document.'),
7
- aside: __("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
8
- div: __('The <div> element should only be used if the block is a design element with no semantic meaning.'),
9
- footer: __('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'),
10
- header: __('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
11
- main: __('The <main> element should be used for the primary content of your document only.'),
12
- nav: __('The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'),
13
- section: __("The <section> element should represent a standalone portion of the document that can't be better represented by another element.")
14
- };
15
- //# sourceMappingURL=messages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__","htmlElementMessages","article","aside","div","footer","header","main","nav","section"],"sources":["@wordpress/block-library/src/utils/messages.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const htmlElementMessages = {\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tdiv: __(\n\t\t'The <div> element should only be used if the block is a design element with no semantic meaning.'\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tnav: __(\n\t\t'The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,OAAO,MAAMC,mBAAmB,GAAG;EAClCC,OAAO,EAAEF,EAAE,CACV,gGACD,CAAC;EACDG,KAAK,EAAEH,EAAE,CACR,uIACD,CAAC;EACDI,GAAG,EAAEJ,EAAE,CACN,kGACD,CAAC;EACDK,MAAM,EAAEL,EAAE,CACT,8HACD,CAAC;EACDM,MAAM,EAAEN,EAAE,CACT,qHACD,CAAC;EACDO,IAAI,EAAEP,EAAE,CACP,kFACD,CAAC;EACDQ,GAAG,EAAER,EAAE,CACN,mIACD,CAAC;EACDS,OAAO,EAAET,EAAE,CACV,kIACD;AACD,CAAC","ignoreList":[]}
@@ -1,31 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
-
6
- export const htmlElementMessages = {
7
- article: __(
8
- 'The <article> element should represent a self-contained, syndicatable portion of the document.'
9
- ),
10
- aside: __(
11
- "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
12
- ),
13
- div: __(
14
- 'The <div> element should only be used if the block is a design element with no semantic meaning.'
15
- ),
16
- footer: __(
17
- 'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'
18
- ),
19
- header: __(
20
- 'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'
21
- ),
22
- main: __(
23
- 'The <main> element should be used for the primary content of your document only.'
24
- ),
25
- nav: __(
26
- 'The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'
27
- ),
28
- section: __(
29
- "The <section> element should represent a standalone portion of the document that can't be better represented by another element."
30
- ),
31
- };