@wordpress/block-library 9.30.1-next.836ecdcae.0 → 9.30.1-next.a730c9c8c.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 (209) hide show
  1. package/build/button/edit.js +6 -1
  2. package/build/button/edit.js.map +1 -1
  3. package/build/button/edit.native.js +1 -1
  4. package/build/button/edit.native.js.map +1 -1
  5. package/build/buttons/index.js +2 -1
  6. package/build/buttons/index.js.map +1 -1
  7. package/build/categories/edit.js +3 -1
  8. package/build/categories/edit.js.map +1 -1
  9. package/build/image/edit.native.js +1 -1
  10. package/build/image/edit.native.js.map +1 -1
  11. package/build/image/image.js +5 -8
  12. package/build/image/image.js.map +1 -1
  13. package/build/image/save.js +6 -2
  14. package/build/image/save.js.map +1 -1
  15. package/build/index.js +4 -0
  16. package/build/index.js.map +1 -1
  17. package/build/navigation/edit/index.js +0 -1
  18. package/build/navigation/edit/index.js.map +1 -1
  19. package/build/navigation-link/block-inserter.js +69 -0
  20. package/build/navigation-link/block-inserter.js.map +1 -0
  21. package/build/navigation-link/dialog-wrapper.js +80 -0
  22. package/build/navigation-link/dialog-wrapper.js.map +1 -0
  23. package/build/navigation-link/link-ui.js +34 -82
  24. package/build/navigation-link/link-ui.js.map +1 -1
  25. package/build/navigation-link/page-creator.js +12 -18
  26. package/build/navigation-link/page-creator.js.map +1 -1
  27. package/build/post-date/edit.js +2 -1
  28. package/build/post-date/edit.js.map +1 -1
  29. package/build/post-featured-image/edit.js +7 -2
  30. package/build/post-featured-image/edit.js.map +1 -1
  31. package/build/post-title/edit.js +8 -2
  32. package/build/post-title/edit.js.map +1 -1
  33. package/build/query/edit/pattern-selection.js +9 -1
  34. package/build/query/edit/pattern-selection.js.map +1 -1
  35. package/build/query/index.js +2 -1
  36. package/build/query/index.js.map +1 -1
  37. package/build/rss/edit.js +6 -1
  38. package/build/rss/edit.js.map +1 -1
  39. package/build/site-tagline/index.js +1 -0
  40. package/build/site-tagline/index.js.map +1 -1
  41. package/build/social-link/edit.js +6 -1
  42. package/build/social-link/edit.js.map +1 -1
  43. package/build/social-links/index.js +2 -1
  44. package/build/social-links/index.js.map +1 -1
  45. package/build/spacer/edit.js +2 -1
  46. package/build/spacer/edit.js.map +1 -1
  47. package/build/table-of-contents/edit.js +33 -9
  48. package/build/table-of-contents/edit.js.map +1 -1
  49. package/build/table-of-contents/index.js +4 -0
  50. package/build/table-of-contents/index.js.map +1 -1
  51. package/build/table-of-contents/list.js +6 -3
  52. package/build/table-of-contents/list.js.map +1 -1
  53. package/build/table-of-contents/save.js +6 -3
  54. package/build/table-of-contents/save.js.map +1 -1
  55. package/build/term-template/edit.js +318 -0
  56. package/build/term-template/edit.js.map +1 -0
  57. package/build/term-template/index.js +109 -0
  58. package/build/term-template/index.js.map +1 -0
  59. package/build/term-template/save.js +16 -0
  60. package/build/term-template/save.js.map +1 -0
  61. package/build/term-template/variations.js +83 -0
  62. package/build/term-template/variations.js.map +1 -0
  63. package/build/terms-query/edit.js +20 -0
  64. package/build/terms-query/edit.js.map +1 -0
  65. package/build/terms-query/index.js +83 -0
  66. package/build/terms-query/index.js.map +1 -0
  67. package/build/terms-query/inspector-controls.js +231 -0
  68. package/build/terms-query/inspector-controls.js.map +1 -0
  69. package/build/terms-query/save.js +24 -0
  70. package/build/terms-query/save.js.map +1 -0
  71. package/build/terms-query/terms-query-content.js +71 -0
  72. package/build/terms-query/terms-query-content.js.map +1 -0
  73. package/build/utils/hooks.js +3 -0
  74. package/build/utils/hooks.js.map +1 -1
  75. package/build-module/button/edit.js +7 -2
  76. package/build-module/button/edit.js.map +1 -1
  77. package/build-module/button/edit.native.js +1 -1
  78. package/build-module/button/edit.native.js.map +1 -1
  79. package/build-module/buttons/index.js +2 -1
  80. package/build-module/buttons/index.js.map +1 -1
  81. package/build-module/categories/edit.js +3 -1
  82. package/build-module/categories/edit.js.map +1 -1
  83. package/build-module/image/edit.native.js +1 -1
  84. package/build-module/image/edit.native.js.map +1 -1
  85. package/build-module/image/image.js +5 -8
  86. package/build-module/image/image.js.map +1 -1
  87. package/build-module/image/save.js +6 -2
  88. package/build-module/image/save.js.map +1 -1
  89. package/build-module/index.js +4 -0
  90. package/build-module/index.js.map +1 -1
  91. package/build-module/navigation/edit/index.js +0 -1
  92. package/build-module/navigation/edit/index.js.map +1 -1
  93. package/build-module/navigation-link/block-inserter.js +61 -0
  94. package/build-module/navigation-link/block-inserter.js.map +1 -0
  95. package/build-module/navigation-link/dialog-wrapper.js +75 -0
  96. package/build-module/navigation-link/dialog-wrapper.js.map +1 -0
  97. package/build-module/navigation-link/link-ui.js +37 -85
  98. package/build-module/navigation-link/link-ui.js.map +1 -1
  99. package/build-module/navigation-link/page-creator.js +12 -19
  100. package/build-module/navigation-link/page-creator.js.map +1 -1
  101. package/build-module/post-date/edit.js +3 -2
  102. package/build-module/post-date/edit.js.map +1 -1
  103. package/build-module/post-featured-image/edit.js +9 -4
  104. package/build-module/post-featured-image/edit.js.map +1 -1
  105. package/build-module/post-title/edit.js +9 -3
  106. package/build-module/post-title/edit.js.map +1 -1
  107. package/build-module/query/edit/pattern-selection.js +9 -1
  108. package/build-module/query/edit/pattern-selection.js.map +1 -1
  109. package/build-module/query/index.js +2 -1
  110. package/build-module/query/index.js.map +1 -1
  111. package/build-module/rss/edit.js +8 -3
  112. package/build-module/rss/edit.js.map +1 -1
  113. package/build-module/site-tagline/index.js +1 -0
  114. package/build-module/site-tagline/index.js.map +1 -1
  115. package/build-module/social-link/edit.js +8 -3
  116. package/build-module/social-link/edit.js.map +1 -1
  117. package/build-module/social-links/index.js +2 -1
  118. package/build-module/social-links/index.js.map +1 -1
  119. package/build-module/spacer/edit.js +3 -2
  120. package/build-module/spacer/edit.js.map +1 -1
  121. package/build-module/table-of-contents/edit.js +35 -11
  122. package/build-module/table-of-contents/edit.js.map +1 -1
  123. package/build-module/table-of-contents/index.js +4 -0
  124. package/build-module/table-of-contents/index.js.map +1 -1
  125. package/build-module/table-of-contents/list.js +6 -3
  126. package/build-module/table-of-contents/list.js.map +1 -1
  127. package/build-module/table-of-contents/save.js +6 -3
  128. package/build-module/table-of-contents/save.js.map +1 -1
  129. package/build-module/term-template/edit.js +310 -0
  130. package/build-module/term-template/edit.js.map +1 -0
  131. package/build-module/term-template/index.js +102 -0
  132. package/build-module/term-template/index.js.map +1 -0
  133. package/build-module/term-template/save.js +9 -0
  134. package/build-module/term-template/save.js.map +1 -0
  135. package/build-module/term-template/variations.js +76 -0
  136. package/build-module/term-template/variations.js.map +1 -0
  137. package/build-module/terms-query/edit.js +12 -0
  138. package/build-module/terms-query/edit.js.map +1 -0
  139. package/build-module/terms-query/index.js +76 -0
  140. package/build-module/terms-query/index.js.map +1 -0
  141. package/build-module/terms-query/inspector-controls.js +224 -0
  142. package/build-module/terms-query/inspector-controls.js.map +1 -0
  143. package/build-module/terms-query/save.js +17 -0
  144. package/build-module/terms-query/save.js.map +1 -0
  145. package/build-module/terms-query/terms-query-content.js +63 -0
  146. package/build-module/terms-query/terms-query-content.js.map +1 -0
  147. package/build-module/utils/hooks.js +3 -0
  148. package/build-module/utils/hooks.js.map +1 -1
  149. package/build-style/editor-rtl.css +24 -0
  150. package/build-style/editor.css +24 -0
  151. package/build-style/style-rtl.css +16 -0
  152. package/build-style/style.css +16 -0
  153. package/build-style/term-template/editor-rtl.css +160 -0
  154. package/build-style/term-template/editor.css +160 -0
  155. package/build-style/term-template/style-rtl.css +146 -0
  156. package/build-style/term-template/style.css +146 -0
  157. package/build-style/terms-query/style-rtl.css +140 -0
  158. package/build-style/terms-query/style.css +140 -0
  159. package/build-types/table-of-contents/list.d.ts +2 -1
  160. package/build-types/table-of-contents/list.d.ts.map +1 -1
  161. package/package.json +35 -35
  162. package/src/button/edit.js +12 -1
  163. package/src/button/edit.native.js +1 -1
  164. package/src/buttons/block.json +2 -1
  165. package/src/categories/edit.js +2 -1
  166. package/src/editor.scss +1 -0
  167. package/src/image/edit.native.js +1 -1
  168. package/src/image/image.js +5 -8
  169. package/src/image/save.js +7 -1
  170. package/src/index.js +4 -0
  171. package/src/navigation/edit/index.js +0 -1
  172. package/src/navigation-link/block-inserter.js +65 -0
  173. package/src/navigation-link/dialog-wrapper.js +74 -0
  174. package/src/navigation-link/link-ui.js +32 -95
  175. package/src/navigation-link/page-creator.js +13 -20
  176. package/src/post-date/edit.js +64 -53
  177. package/src/post-date/index.php +5 -13
  178. package/src/post-featured-image/edit.js +19 -3
  179. package/src/post-title/edit.js +14 -2
  180. package/src/query/block.json +2 -1
  181. package/src/query/edit/pattern-selection.js +10 -1
  182. package/src/rss/edit.js +13 -2
  183. package/src/site-tagline/block.json +1 -0
  184. package/src/social-link/edit.js +13 -2
  185. package/src/social-links/block.json +2 -1
  186. package/src/spacer/edit.js +5 -1
  187. package/src/style.scss +2 -0
  188. package/src/table-of-contents/block.json +4 -0
  189. package/src/table-of-contents/edit.js +58 -21
  190. package/src/table-of-contents/list.tsx +7 -2
  191. package/src/table-of-contents/save.js +7 -3
  192. package/src/term-template/block.json +73 -0
  193. package/src/term-template/edit.js +391 -0
  194. package/src/term-template/editor.scss +26 -0
  195. package/src/term-template/index.js +26 -0
  196. package/src/term-template/index.php +224 -0
  197. package/src/term-template/save.js +8 -0
  198. package/src/term-template/style.scss +12 -0
  199. package/src/term-template/variations.js +87 -0
  200. package/src/terms-query/block.json +49 -0
  201. package/src/terms-query/edit.js +10 -0
  202. package/src/terms-query/index.js +24 -0
  203. package/src/terms-query/index.php +44 -0
  204. package/src/terms-query/inspector-controls.js +239 -0
  205. package/src/terms-query/save.js +10 -0
  206. package/src/terms-query/style.scss +6 -0
  207. package/src/terms-query/terms-query-content.js +74 -0
  208. package/src/utils/hooks.js +4 -0
  209. package/tsconfig.tsbuildinfo +1 -1
@@ -9,13 +9,16 @@ import {
9
9
  __experimentalVStack as VStack,
10
10
  __experimentalHStack as HStack,
11
11
  } from '@wordpress/components';
12
- import { __, isRTL } from '@wordpress/i18n';
12
+ import { __ } from '@wordpress/i18n';
13
13
  import { useSelect, useDispatch } from '@wordpress/data';
14
14
  import { store as coreStore } from '@wordpress/core-data';
15
15
  import { decodeEntities } from '@wordpress/html-entities';
16
16
  import { useState } from '@wordpress/element';
17
- import { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';
18
- import { useFocusOnMount } from '@wordpress/compose';
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+ import DialogWrapper from './dialog-wrapper';
19
22
 
20
23
  /**
21
24
  * Component for creating new pages within the Navigation Link UI.
@@ -35,9 +38,6 @@ export function LinkUIPageCreator( {
35
38
  const [ title, setTitle ] = useState( initialTitle );
36
39
  const [ shouldPublish, setShouldPublish ] = useState( false );
37
40
 
38
- // Focus the first element when the component mounts
39
- const focusOnMountRef = useFocusOnMount( 'firstElement' );
40
-
41
41
  // Check if the title is valid for submission
42
42
  const isTitleValid = title.trim().length > 0;
43
43
 
@@ -95,19 +95,12 @@ export function LinkUIPageCreator( {
95
95
  const isSubmitDisabled = isSaving || ! isTitleValid;
96
96
 
97
97
  return (
98
- <div className="link-ui-page-creator" ref={ focusOnMountRef }>
99
- <Button
100
- className="link-ui-page-creator__back"
101
- icon={ isRTL() ? chevronRightSmall : chevronLeftSmall }
102
- onClick={ ( e ) => {
103
- e.preventDefault();
104
- onBack();
105
- } }
106
- size="small"
107
- >
108
- { __( 'Back' ) }
109
- </Button>
110
-
98
+ <DialogWrapper
99
+ className="link-ui-page-creator"
100
+ title={ __( 'Create page' ) }
101
+ description={ __( 'Create a new page to add to your Navigation.' ) }
102
+ onBack={ onBack }
103
+ >
111
104
  <VStack className="link-ui-page-creator__inner" spacing={ 4 }>
112
105
  <form onSubmit={ createPage }>
113
106
  <VStack spacing={ 4 }>
@@ -159,6 +152,6 @@ export function LinkUIPageCreator( {
159
152
  </VStack>
160
153
  </form>
161
154
  </VStack>
162
- </div>
155
+ </DialogWrapper>
163
156
  );
164
157
  }
@@ -19,6 +19,7 @@ import {
19
19
  InspectorControls,
20
20
  store as blockEditorStore,
21
21
  useBlockProps,
22
+ useBlockEditingMode,
22
23
  __experimentalDateFormatPicker as DateFormatPicker,
23
24
  __experimentalPublishDateTimePicker as PublishDateTimePicker,
24
25
  } from '@wordpress/block-editor';
@@ -99,6 +100,8 @@ export default function PostDateEdit( {
99
100
  [ postTypeSlug ]
100
101
  );
101
102
 
103
+ const blockEditingMode = useBlockEditingMode();
104
+
102
105
  let postDate = (
103
106
  <time dateTime={ dateI18n( 'c', datetime ) } ref={ setPopoverAnchor }>
104
107
  { format === 'human-diff'
@@ -120,61 +123,69 @@ export default function PostDateEdit( {
120
123
 
121
124
  return (
122
125
  <>
123
- <BlockControls group="block">
124
- <AlignmentControl
125
- value={ textAlign }
126
- onChange={ ( nextAlign ) => {
127
- setAttributes( { textAlign: nextAlign } );
128
- } }
129
- />
130
- { displayType !== 'modified' && ! isDescendentOfQueryLoop && (
131
- <ToolbarGroup>
132
- <Dropdown
133
- popoverProps={ popoverProps }
134
- renderContent={ ( { onClose } ) => (
135
- <PublishDateTimePicker
136
- title={
137
- displayType === 'date'
138
- ? __( 'Publish Date' )
139
- : __( 'Date' )
140
- }
141
- currentDate={ datetime }
142
- onChange={ ( newDatetime ) =>
143
- setAttributes( {
144
- datetime: newDatetime,
145
- } )
146
- }
147
- is12Hour={ is12HourFormat(
148
- siteTimeFormat
126
+ { ( blockEditingMode === 'default' ||
127
+ ! isDescendentOfQueryLoop ) && (
128
+ <BlockControls group="block">
129
+ <AlignmentControl
130
+ value={ textAlign }
131
+ onChange={ ( nextAlign ) => {
132
+ setAttributes( { textAlign: nextAlign } );
133
+ } }
134
+ />
135
+
136
+ { displayType !== 'modified' &&
137
+ ! isDescendentOfQueryLoop && (
138
+ <ToolbarGroup>
139
+ <Dropdown
140
+ popoverProps={ popoverProps }
141
+ renderContent={ ( { onClose } ) => (
142
+ <PublishDateTimePicker
143
+ title={
144
+ displayType === 'date'
145
+ ? __( 'Publish Date' )
146
+ : __( 'Date' )
147
+ }
148
+ currentDate={ datetime }
149
+ onChange={ ( newDatetime ) =>
150
+ setAttributes( {
151
+ datetime: newDatetime,
152
+ } )
153
+ }
154
+ is12Hour={ is12HourFormat(
155
+ siteTimeFormat
156
+ ) }
157
+ onClose={ onClose }
158
+ dateOrder={
159
+ /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
160
+ _x( 'dmy', 'date order' )
161
+ }
162
+ />
149
163
  ) }
150
- onClose={ onClose }
151
- dateOrder={
152
- /* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
153
- _x( 'dmy', 'date order' )
154
- }
164
+ renderToggle={ ( { isOpen, onToggle } ) => {
165
+ const openOnArrowDown = ( event ) => {
166
+ if (
167
+ ! isOpen &&
168
+ event.keyCode === DOWN
169
+ ) {
170
+ event.preventDefault();
171
+ onToggle();
172
+ }
173
+ };
174
+ return (
175
+ <ToolbarButton
176
+ aria-expanded={ isOpen }
177
+ icon={ edit }
178
+ title={ __( 'Change Date' ) }
179
+ onClick={ onToggle }
180
+ onKeyDown={ openOnArrowDown }
181
+ />
182
+ );
183
+ } }
155
184
  />
156
- ) }
157
- renderToggle={ ( { isOpen, onToggle } ) => {
158
- const openOnArrowDown = ( event ) => {
159
- if ( ! isOpen && event.keyCode === DOWN ) {
160
- event.preventDefault();
161
- onToggle();
162
- }
163
- };
164
- return (
165
- <ToolbarButton
166
- aria-expanded={ isOpen }
167
- icon={ edit }
168
- title={ __( 'Change Date' ) }
169
- onClick={ onToggle }
170
- onKeyDown={ openOnArrowDown }
171
- />
172
- );
173
- } }
174
- />
175
- </ToolbarGroup>
176
- ) }
177
- </BlockControls>
185
+ </ToolbarGroup>
186
+ ) }
187
+ </BlockControls>
188
+ ) }
178
189
 
179
190
  <InspectorControls>
180
191
  <ToolsPanel
@@ -20,19 +20,11 @@ function render_block_core_post_date( $attributes, $content, $block ) {
20
20
  $classes = array();
21
21
 
22
22
  if (
23
- isset( $attributes['metadata']['bindings']['datetime']['source'] ) &&
24
- isset( $attributes['metadata']['bindings']['datetime']['args'] )
23
+ ! isset( $attributes['datetime'] ) && ! (
24
+ isset( $attributes['metadata']['bindings']['datetime']['source'] ) &&
25
+ isset( $attributes['metadata']['bindings']['datetime']['args'] )
26
+ )
25
27
  ) {
26
- /*
27
- * We might be running on a version of WordPress that doesn't support binding the block's `datetime` attribute
28
- * to a Block Bindings source. In this case, we need to manually set the `datetime` attribute to its correct value.
29
- * This branch can be removed once the minimum required WordPress version is 6.9 or newer.
30
- */
31
- $source = get_block_bindings_source( $attributes['metadata']['bindings']['datetime']['source'] );
32
- $source_args = $attributes['metadata']['bindings']['datetime']['args'];
33
-
34
- $attributes['datetime'] = $source->get_value( $source_args, $block, 'datetime' );
35
- } elseif ( ! isset( $attributes['datetime'] ) ) {
36
28
  /*
37
29
  * This is the legacy version of the block that didn't have the `datetime` attribute.
38
30
  * This branch needs to be kept for backward compatibility.
@@ -61,7 +53,7 @@ function render_block_core_post_date( $attributes, $content, $block ) {
61
53
  // (See https://github.com/WordPress/gutenberg/pull/46839 where this logic was originally
62
54
  // implemented.)
63
55
  // In this case, we have to respect and return the empty value.
64
- return $attributes['datetime'];
56
+ return '';
65
57
  }
66
58
 
67
59
  $unformatted_date = $attributes['datetime'];
@@ -15,6 +15,7 @@ import {
15
15
  Button,
16
16
  Spinner,
17
17
  TextControl,
18
+ ExternalLink,
18
19
  __experimentalToolsPanel as ToolsPanel,
19
20
  __experimentalToolsPanelItem as ToolsPanelItem,
20
21
  } from '@wordpress/components';
@@ -30,7 +31,12 @@ import {
30
31
  privateApis as blockEditorPrivateApis,
31
32
  store as blockEditorStore,
32
33
  } from '@wordpress/block-editor';
33
- import { useMemo, useEffect, useState } from '@wordpress/element';
34
+ import {
35
+ useMemo,
36
+ useEffect,
37
+ useState,
38
+ createInterpolateElement,
39
+ } from '@wordpress/element';
34
40
  import { __, sprintf } from '@wordpress/i18n';
35
41
  import { upload } from '@wordpress/icons';
36
42
  import { store as noticesStore } from '@wordpress/notices';
@@ -316,7 +322,7 @@ export default function PostFeaturedImageEdit( {
316
322
  ) }
317
323
  { isLink && (
318
324
  <ToolsPanelItem
319
- label={ __( 'Link rel' ) }
325
+ label={ __( 'Link relation' ) }
320
326
  isShownByDefault
321
327
  hasValue={ () => !! rel }
322
328
  onDeselect={ () =>
@@ -328,7 +334,17 @@ export default function PostFeaturedImageEdit( {
328
334
  <TextControl
329
335
  __next40pxDefaultSize
330
336
  __nextHasNoMarginBottom
331
- label={ __( 'Link rel' ) }
337
+ label={ __( 'Link relation' ) }
338
+ help={ createInterpolateElement(
339
+ __(
340
+ 'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
341
+ ),
342
+ {
343
+ a: (
344
+ <ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
345
+ ),
346
+ }
347
+ ) }
332
348
  value={ rel }
333
349
  onChange={ ( newRel ) =>
334
350
  setAttributes( { rel: newRel } )
@@ -18,6 +18,7 @@ import {
18
18
  import {
19
19
  ToggleControl,
20
20
  TextControl,
21
+ ExternalLink,
21
22
  __experimentalToolsPanel as ToolsPanel,
22
23
  __experimentalToolsPanelItem as ToolsPanelItem,
23
24
  } from '@wordpress/components';
@@ -25,6 +26,7 @@ import { __ } from '@wordpress/i18n';
25
26
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
26
27
  import { useEntityProp, store as coreStore } from '@wordpress/core-data';
27
28
  import { useSelect } from '@wordpress/data';
29
+ import { createInterpolateElement } from '@wordpress/element';
28
30
 
29
31
  /**
30
32
  * Internal dependencies
@@ -205,7 +207,7 @@ export default function PostTitleEdit( {
205
207
  />
206
208
  </ToolsPanelItem>
207
209
  <ToolsPanelItem
208
- label={ __( 'Link rel' ) }
210
+ label={ __( 'Link relation' ) }
209
211
  isShownByDefault
210
212
  hasValue={ () => !! rel }
211
213
  onDeselect={ () =>
@@ -215,7 +217,17 @@ export default function PostTitleEdit( {
215
217
  <TextControl
216
218
  __next40pxDefaultSize
217
219
  __nextHasNoMarginBottom
218
- label={ __( 'Link rel' ) }
220
+ label={ __( 'Link relation' ) }
221
+ help={ createInterpolateElement(
222
+ __(
223
+ 'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
224
+ ),
225
+ {
226
+ a: (
227
+ <ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
228
+ ),
229
+ }
230
+ ) }
219
231
  value={ rel }
220
232
  onChange={ ( newRel ) =>
221
233
  setAttributes( { rel: newRel } )
@@ -53,7 +53,8 @@
53
53
  "align": [ "wide", "full" ],
54
54
  "html": false,
55
55
  "layout": true,
56
- "interactivity": true
56
+ "interactivity": true,
57
+ "contentRole": true
57
58
  },
58
59
  "editorStyle": "wp-block-query-editor"
59
60
  }
@@ -43,7 +43,16 @@ export function useBlockPatterns( clientId, attributes ) {
43
43
  clientId,
44
44
  attributes
45
45
  );
46
- return usePatterns( clientId, blockNameForPatterns );
46
+ const allPatterns = usePatterns( clientId, blockNameForPatterns );
47
+ // Filter out any patterns that don't have Query as their root block
48
+ // so that a Query block is always replaced by another Query block.
49
+ const rootBlockPatterns = useMemo( () => {
50
+ return allPatterns.filter( ( pattern ) => {
51
+ return pattern.blocks?.[ 0 ]?.name === blockNameForPatterns;
52
+ } );
53
+ }, [ allPatterns, blockNameForPatterns ] );
54
+
55
+ return rootBlockPatterns;
47
56
  }
48
57
 
49
58
  export default function PatternSelection( {
package/src/rss/edit.js CHANGED
@@ -14,11 +14,12 @@ import {
14
14
  ToggleControl,
15
15
  ToolbarGroup,
16
16
  TextControl,
17
+ ExternalLink,
17
18
  __experimentalInputControl as InputControl,
18
19
  __experimentalToolsPanel as ToolsPanel,
19
20
  __experimentalToolsPanelItem as ToolsPanelItem,
20
21
  } from '@wordpress/components';
21
- import { useState } from '@wordpress/element';
22
+ import { createInterpolateElement, useState } from '@wordpress/element';
22
23
  import { grid, list, edit, rss } from '@wordpress/icons';
23
24
  import { __, _x } from '@wordpress/i18n';
24
25
  import { prependHTTP } from '@wordpress/url';
@@ -301,7 +302,17 @@ export default function RSSEdit( { attributes, setAttributes } ) {
301
302
  <TextControl
302
303
  __next40pxDefaultSize
303
304
  __nextHasNoMarginBottom
304
- label={ __( 'Link rel' ) }
305
+ label={ __( 'Link relation' ) }
306
+ help={ createInterpolateElement(
307
+ __(
308
+ 'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
309
+ ),
310
+ {
311
+ a: (
312
+ <ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
313
+ ),
314
+ }
315
+ ) }
305
316
  value={ rel || '' }
306
317
  onChange={ ( value ) => setAttributes( { rel: value } ) }
307
318
  />
@@ -36,6 +36,7 @@
36
36
  "text": true
37
37
  }
38
38
  },
39
+ "contentRole": true,
39
40
  "spacing": {
40
41
  "margin": true,
41
42
  "padding": true,
@@ -17,13 +17,14 @@ import {
17
17
  useBlockProps,
18
18
  store as blockEditorStore,
19
19
  } from '@wordpress/block-editor';
20
- import { useState, useRef } from '@wordpress/element';
20
+ import { useState, useRef, createInterpolateElement } from '@wordpress/element';
21
21
  import {
22
22
  Icon,
23
23
  Button,
24
24
  Dropdown,
25
25
  TextControl,
26
26
  ToolbarButton,
27
+ ExternalLink,
27
28
  __experimentalToolsPanel as ToolsPanel,
28
29
  __experimentalToolsPanelItem as ToolsPanelItem,
29
30
  __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
@@ -243,7 +244,17 @@ const SocialLinkEdit = ( {
243
244
  <TextControl
244
245
  __next40pxDefaultSize
245
246
  __nextHasNoMarginBottom
246
- label={ __( 'Link rel' ) }
247
+ label={ __( 'Link relation' ) }
248
+ help={ createInterpolateElement(
249
+ __(
250
+ 'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
251
+ ),
252
+ {
253
+ a: (
254
+ <ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
255
+ ),
256
+ }
257
+ ) }
247
258
  value={ rel || '' }
248
259
  onChange={ ( value ) => setAttributes( { rel: value } ) }
249
260
  />
@@ -94,7 +94,8 @@
94
94
  "width": true,
95
95
  "style": true
96
96
  }
97
- }
97
+ },
98
+ "contentRole": true
98
99
  },
99
100
  "styles": [
100
101
  { "name": "default", "label": "Default", "isDefault": true },
@@ -12,6 +12,7 @@ import {
12
12
  getSpacingPresetCssVar,
13
13
  store as blockEditorStore,
14
14
  privateApis as blockEditorPrivateApis,
15
+ useBlockEditingMode,
15
16
  } from '@wordpress/block-editor';
16
17
  import { ResizableBox } from '@wordpress/components';
17
18
  import { useState, useEffect } from '@wordpress/element';
@@ -346,6 +347,8 @@ const SpacerEdit = ( {
346
347
  __unstableMarkNextChangeAsNotPersistent,
347
348
  ] );
348
349
 
350
+ const blockEditingMode = useBlockEditingMode();
351
+
349
352
  return (
350
353
  <>
351
354
  <View
@@ -356,7 +359,8 @@ const SpacerEdit = ( {
356
359
  } ),
357
360
  } ) }
358
361
  >
359
- { resizableBoxWithOrientation( inheritedOrientation ) }
362
+ { blockEditingMode === 'default' &&
363
+ resizableBoxWithOrientation( inheritedOrientation ) }
360
364
  </View>
361
365
  { ! isFlexLayout && (
362
366
  <SpacerControls
package/src/style.scss CHANGED
@@ -68,6 +68,8 @@
68
68
  @import "./table/style.scss";
69
69
  @import "./table-of-contents/style.scss";
70
70
  @import "./term-description/style.scss";
71
+ @import "./term-template/style.scss";
72
+ @import "./terms-query/style.scss";
71
73
  @import "./text-columns/style.scss";
72
74
  @import "./verse/style.scss";
73
75
  @import "./video/style.scss";
@@ -22,6 +22,10 @@
22
22
  },
23
23
  "maxLevel": {
24
24
  "type": "number"
25
+ },
26
+ "ordered": {
27
+ "type": "boolean",
28
+ "default": true
25
29
  }
26
30
  },
27
31
  "supports": {
@@ -20,10 +20,16 @@ import {
20
20
  } from '@wordpress/components';
21
21
  import { useDispatch, useSelect } from '@wordpress/data';
22
22
  import { renderToString } from '@wordpress/element';
23
- import { __ } from '@wordpress/i18n';
23
+ import { __, isRTL } from '@wordpress/i18n';
24
24
  import { useInstanceId } from '@wordpress/compose';
25
25
  import { store as noticeStore } from '@wordpress/notices';
26
- import { tableOfContents as icon } from '@wordpress/icons';
26
+ import {
27
+ tableOfContents as icon,
28
+ formatListBullets,
29
+ formatListBulletsRTL,
30
+ formatListNumbered,
31
+ formatListNumberedRTL,
32
+ } from '@wordpress/icons';
27
33
 
28
34
  /**
29
35
  * Internal dependencies
@@ -43,13 +49,19 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
43
49
  * @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.
44
50
  * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).
45
51
  * @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.
52
+ * @param {boolean} props.attributes.ordered Whether to display as an ordered list (true) or unordered list (false).
46
53
  * @param {string} props.clientId The client id.
47
54
  * @param {(attributes: Object) => void} props.setAttributes The set attributes function.
48
55
  *
49
56
  * @return {Component} The component.
50
57
  */
51
58
  export default function TableOfContentsEdit( {
52
- attributes: { headings = [], onlyIncludeCurrentPage, maxLevel },
59
+ attributes: {
60
+ headings = [],
61
+ onlyIncludeCurrentPage,
62
+ maxLevel,
63
+ ordered = true,
64
+ },
53
65
  clientId,
54
66
  setAttributes,
55
67
  } ) {
@@ -86,27 +98,48 @@ export default function TableOfContentsEdit( {
86
98
  const dropdownMenuProps = useToolsPanelDropdownMenuProps();
87
99
  const headingTree = linearToNestedHeadingList( headings );
88
100
 
89
- const toolbarControls = canInsertList && (
101
+ const toolbarControls = (
90
102
  <BlockControls>
91
103
  <ToolbarGroup>
92
104
  <ToolbarButton
93
- onClick={ () =>
94
- replaceBlocks(
95
- clientId,
96
- createBlock( 'core/list', {
97
- ordered: true,
98
- values: renderToString(
99
- <TableOfContentsList
100
- nestedHeadingList={ headingTree }
101
- />
102
- ),
103
- } )
104
- )
105
+ icon={ isRTL() ? formatListBulletsRTL : formatListBullets }
106
+ title={ __( 'Unordered' ) }
107
+ description={ __( 'Convert to unordered list' ) }
108
+ onClick={ () => setAttributes( { ordered: false } ) }
109
+ isActive={ ordered === false }
110
+ />
111
+ <ToolbarButton
112
+ icon={
113
+ isRTL() ? formatListNumberedRTL : formatListNumbered
105
114
  }
106
- >
107
- { __( 'Convert to static list' ) }
108
- </ToolbarButton>
115
+ title={ __( 'Ordered' ) }
116
+ description={ __( 'Convert to ordered list' ) }
117
+ onClick={ () => setAttributes( { ordered: true } ) }
118
+ isActive={ ordered === true }
119
+ />
109
120
  </ToolbarGroup>
121
+ { canInsertList && (
122
+ <ToolbarGroup>
123
+ <ToolbarButton
124
+ onClick={ () =>
125
+ replaceBlocks(
126
+ clientId,
127
+ createBlock( 'core/list', {
128
+ ordered,
129
+ values: renderToString(
130
+ <TableOfContentsList
131
+ nestedHeadingList={ headingTree }
132
+ ordered={ ordered }
133
+ />
134
+ ),
135
+ } )
136
+ )
137
+ }
138
+ >
139
+ { __( 'Convert to static list' ) }
140
+ </ToolbarButton>
141
+ </ToolbarGroup>
142
+ ) }
110
143
  </BlockControls>
111
144
  );
112
145
 
@@ -118,6 +151,7 @@ export default function TableOfContentsEdit( {
118
151
  setAttributes( {
119
152
  onlyIncludeCurrentPage: false,
120
153
  maxLevel: undefined,
154
+ ordered: true,
121
155
  } );
122
156
  } }
123
157
  dropdownMenuProps={ dropdownMenuProps }
@@ -210,16 +244,19 @@ export default function TableOfContentsEdit( {
210
244
  );
211
245
  }
212
246
 
247
+ const ListTag = ordered ? 'ol' : 'ul';
248
+
213
249
  return (
214
250
  <>
215
251
  <nav { ...blockProps }>
216
- <ol>
252
+ <ListTag>
217
253
  <TableOfContentsList
218
254
  nestedHeadingList={ headingTree }
219
255
  disableLinkActivation
220
256
  onClick={ showRedirectionPreventedNotice }
257
+ ordered={ ordered }
221
258
  />
222
- </ol>
259
+ </ListTag>
223
260
  </nav>
224
261
  { toolbarControls }
225
262
  { inspectorControls }
@@ -14,10 +14,12 @@ export default function TableOfContentsList( {
14
14
  nestedHeadingList,
15
15
  disableLinkActivation,
16
16
  onClick,
17
+ ordered = true,
17
18
  }: {
18
19
  nestedHeadingList: NestedHeadingData[];
19
20
  disableLinkActivation?: boolean;
20
21
  onClick?: ( event: MouseEvent< HTMLAnchorElement > ) => void;
22
+ ordered?: boolean;
21
23
  } ): ReactElement {
22
24
  return (
23
25
  <>
@@ -42,11 +44,13 @@ export default function TableOfContentsList( {
42
44
  <span className={ ENTRY_CLASS_NAME }>{ content }</span>
43
45
  );
44
46
 
47
+ const NestedListTag = ordered ? 'ol' : 'ul';
48
+
45
49
  return (
46
50
  <li key={ index }>
47
51
  { entry }
48
52
  { node.children ? (
49
- <ol>
53
+ <NestedListTag>
50
54
  <TableOfContentsList
51
55
  nestedHeadingList={ node.children }
52
56
  disableLinkActivation={
@@ -58,8 +62,9 @@ export default function TableOfContentsList( {
58
62
  ? onClick
59
63
  : undefined
60
64
  }
65
+ ordered={ ordered }
61
66
  />
62
- </ol>
67
+ </NestedListTag>
63
68
  ) : null }
64
69
  </li>
65
70
  );