@wordpress/block-library 8.28.5 → 8.30.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 (289) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/audio/edit.js +7 -17
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/audio/edit.native.js.map +1 -1
  5. package/build/avatar/edit.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/buttons/edit.js +1 -6
  9. package/build/buttons/edit.js.map +1 -1
  10. package/build/buttons/edit.native.js +1 -7
  11. package/build/buttons/edit.native.js.map +1 -1
  12. package/build/columns/edit.js +8 -2
  13. package/build/columns/edit.js.map +1 -1
  14. package/build/comment-author-avatar/edit.js +1 -1
  15. package/build/comment-author-avatar/edit.js.map +1 -1
  16. package/build/cover/edit/index.js.map +1 -1
  17. package/build/cover/edit/inspector-controls.js.map +1 -1
  18. package/build/cover/edit/resizable-cover-popover.js +0 -6
  19. package/build/cover/edit/resizable-cover-popover.js.map +1 -1
  20. package/build/cover/edit.native.js.map +1 -1
  21. package/build/details/index.js +1 -0
  22. package/build/details/index.js.map +1 -1
  23. package/build/file/deprecated.js.map +1 -1
  24. package/build/file/edit.js +6 -13
  25. package/build/file/edit.js.map +1 -1
  26. package/build/file/edit.native.js.map +1 -1
  27. package/build/file/save.js.map +1 -1
  28. package/build/form-input/edit.js +1 -1
  29. package/build/form-input/edit.js.map +1 -1
  30. package/build/gallery/edit.js +5 -5
  31. package/build/gallery/edit.js.map +1 -1
  32. package/build/gallery/gallery.native.js.map +1 -1
  33. package/build/gallery/v1/edit.js.map +1 -1
  34. package/build/gallery/v1/gallery.native.js.map +1 -1
  35. package/build/group/variations.js +12 -15
  36. package/build/group/variations.js.map +1 -1
  37. package/build/image/edit.js.map +1 -1
  38. package/build/image/edit.native.js.map +1 -1
  39. package/build/image/image.js.map +1 -1
  40. package/build/latest-posts/edit.native.js.map +1 -1
  41. package/build/list/edit.js +5 -0
  42. package/build/list/edit.js.map +1 -1
  43. package/build/list/ordered-list-settings.js +1 -1
  44. package/build/list/ordered-list-settings.js.map +1 -1
  45. package/build/list-item/edit.native.js.map +1 -1
  46. package/build/list-item/hooks/use-indent-list-item.js +1 -0
  47. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  48. package/build/list-item/hooks/use-outdent-list-item.js +1 -0
  49. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  50. package/build/list-item/hooks/use-space.js +16 -7
  51. package/build/list-item/hooks/use-space.js.map +1 -1
  52. package/build/media-text/media-container.native.js +1 -1
  53. package/build/media-text/media-container.native.js.map +1 -1
  54. package/build/navigation/edit/index.js.map +1 -1
  55. package/build/navigation-link/link-ui.js.map +1 -1
  56. package/build/paragraph/edit.native.js.map +1 -1
  57. package/build/pattern/edit.js +23 -9
  58. package/build/pattern/edit.js.map +1 -1
  59. package/build/post-excerpt/edit.js.map +1 -1
  60. package/build/post-featured-image/dimension-controls.js.map +1 -1
  61. package/build/post-featured-image/edit.js.map +1 -1
  62. package/build/post-navigation-link/edit.js.map +1 -1
  63. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  64. package/build/query/utils.js +7 -5
  65. package/build/query/utils.js.map +1 -1
  66. package/build/query-pagination-next/edit.js.map +1 -1
  67. package/build/query-pagination-previous/edit.js.map +1 -1
  68. package/build/quote/deprecated.js +111 -12
  69. package/build/quote/deprecated.js.map +1 -1
  70. package/build/quote/edit.js +5 -5
  71. package/build/quote/edit.js.map +1 -1
  72. package/build/quote/index.js +1 -1
  73. package/build/quote/index.js.map +1 -1
  74. package/build/quote/save.js +2 -2
  75. package/build/quote/save.js.map +1 -1
  76. package/build/read-more/edit.js.map +1 -1
  77. package/build/search/edit.js +1 -1
  78. package/build/search/edit.js.map +1 -1
  79. package/build/search/edit.native.js.map +1 -1
  80. package/build/site-logo/edit.js.map +1 -1
  81. package/build/site-title/{edit/index.js → edit.js} +1 -1
  82. package/build/site-title/edit.js.map +1 -0
  83. package/build/social-link/edit.js.map +1 -1
  84. package/build/social-links/edit.native.js.map +1 -1
  85. package/build/spacer/edit.js.map +1 -1
  86. package/build/table-of-contents/edit.js.map +1 -1
  87. package/build/template-part/edit/index.js +53 -1
  88. package/build/template-part/edit/index.js.map +1 -1
  89. package/build/template-part/edit/selection-modal.js +2 -8
  90. package/build/template-part/edit/selection-modal.js.map +1 -1
  91. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
  92. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  93. package/build/utils/hooks.js +55 -4
  94. package/build/utils/hooks.js.map +1 -1
  95. package/build/video/edit-common-settings.js.map +1 -1
  96. package/build/video/edit.js +7 -16
  97. package/build/video/edit.js.map +1 -1
  98. package/build/video/edit.native.js +2 -7
  99. package/build/video/edit.native.js.map +1 -1
  100. package/build-module/audio/edit.js +10 -20
  101. package/build-module/audio/edit.js.map +1 -1
  102. package/build-module/audio/edit.native.js.map +1 -1
  103. package/build-module/avatar/edit.js.map +1 -1
  104. package/build-module/button/edit.js +1 -1
  105. package/build-module/button/edit.js.map +1 -1
  106. package/build-module/buttons/edit.js +2 -7
  107. package/build-module/buttons/edit.js.map +1 -1
  108. package/build-module/buttons/edit.native.js +1 -7
  109. package/build-module/buttons/edit.native.js.map +1 -1
  110. package/build-module/columns/edit.js +8 -2
  111. package/build-module/columns/edit.js.map +1 -1
  112. package/build-module/comment-author-avatar/edit.js +1 -1
  113. package/build-module/comment-author-avatar/edit.js.map +1 -1
  114. package/build-module/cover/edit/index.js.map +1 -1
  115. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  116. package/build-module/cover/edit/resizable-cover-popover.js +1 -7
  117. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
  118. package/build-module/cover/edit.native.js.map +1 -1
  119. package/build-module/details/index.js +1 -0
  120. package/build-module/details/index.js.map +1 -1
  121. package/build-module/file/deprecated.js.map +1 -1
  122. package/build-module/file/edit.js +7 -14
  123. package/build-module/file/edit.js.map +1 -1
  124. package/build-module/file/edit.native.js.map +1 -1
  125. package/build-module/file/save.js.map +1 -1
  126. package/build-module/form-input/edit.js +1 -1
  127. package/build-module/form-input/edit.js.map +1 -1
  128. package/build-module/gallery/edit.js +5 -5
  129. package/build-module/gallery/edit.js.map +1 -1
  130. package/build-module/gallery/gallery.native.js.map +1 -1
  131. package/build-module/gallery/v1/edit.js.map +1 -1
  132. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  133. package/build-module/group/variations.js +12 -15
  134. package/build-module/group/variations.js.map +1 -1
  135. package/build-module/image/edit.js.map +1 -1
  136. package/build-module/image/edit.native.js.map +1 -1
  137. package/build-module/image/image.js.map +1 -1
  138. package/build-module/latest-posts/edit.native.js.map +1 -1
  139. package/build-module/list/edit.js +5 -0
  140. package/build-module/list/edit.js.map +1 -1
  141. package/build-module/list/ordered-list-settings.js +1 -1
  142. package/build-module/list/ordered-list-settings.js.map +1 -1
  143. package/build-module/list-item/edit.native.js.map +1 -1
  144. package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
  145. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  146. package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
  147. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  148. package/build-module/list-item/hooks/use-space.js +17 -8
  149. package/build-module/list-item/hooks/use-space.js.map +1 -1
  150. package/build-module/media-text/media-container.native.js +1 -1
  151. package/build-module/media-text/media-container.native.js.map +1 -1
  152. package/build-module/navigation/edit/index.js.map +1 -1
  153. package/build-module/navigation-link/link-ui.js.map +1 -1
  154. package/build-module/paragraph/edit.native.js.map +1 -1
  155. package/build-module/pattern/edit.js +24 -10
  156. package/build-module/pattern/edit.js.map +1 -1
  157. package/build-module/post-excerpt/edit.js.map +1 -1
  158. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  159. package/build-module/post-featured-image/edit.js.map +1 -1
  160. package/build-module/post-navigation-link/edit.js.map +1 -1
  161. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  162. package/build-module/query/utils.js +7 -5
  163. package/build-module/query/utils.js.map +1 -1
  164. package/build-module/query-pagination-next/edit.js.map +1 -1
  165. package/build-module/query-pagination-previous/edit.js.map +1 -1
  166. package/build-module/quote/deprecated.js +112 -13
  167. package/build-module/quote/deprecated.js.map +1 -1
  168. package/build-module/quote/edit.js +5 -5
  169. package/build-module/quote/edit.js.map +1 -1
  170. package/build-module/quote/index.js +1 -1
  171. package/build-module/quote/index.js.map +1 -1
  172. package/build-module/quote/save.js +2 -2
  173. package/build-module/quote/save.js.map +1 -1
  174. package/build-module/read-more/edit.js.map +1 -1
  175. package/build-module/search/edit.js +1 -1
  176. package/build-module/search/edit.js.map +1 -1
  177. package/build-module/search/edit.native.js.map +1 -1
  178. package/build-module/site-logo/edit.js.map +1 -1
  179. package/build-module/site-title/{edit/index.js → edit.js} +1 -1
  180. package/build-module/site-title/edit.js.map +1 -0
  181. package/build-module/social-link/edit.js.map +1 -1
  182. package/build-module/social-links/edit.native.js.map +1 -1
  183. package/build-module/spacer/edit.js.map +1 -1
  184. package/build-module/table-of-contents/edit.js.map +1 -1
  185. package/build-module/template-part/edit/index.js +57 -5
  186. package/build-module/template-part/edit/index.js.map +1 -1
  187. package/build-module/template-part/edit/selection-modal.js +2 -8
  188. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  189. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
  190. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  191. package/build-module/utils/hooks.js +54 -3
  192. package/build-module/utils/hooks.js.map +1 -1
  193. package/build-module/video/edit-common-settings.js.map +1 -1
  194. package/build-module/video/edit.js +10 -19
  195. package/build-module/video/edit.js.map +1 -1
  196. package/build-module/video/edit.native.js +2 -7
  197. package/build-module/video/edit.native.js.map +1 -1
  198. package/build-style/editor-rtl.css +4 -1
  199. package/build-style/editor.css +4 -1
  200. package/build-style/group/editor-rtl.css +1 -1
  201. package/build-style/group/editor.css +1 -1
  202. package/build-style/image/editor-rtl.css +3 -0
  203. package/build-style/image/editor.css +3 -0
  204. package/package.json +34 -34
  205. package/src/audio/edit.js +9 -19
  206. package/src/audio/edit.native.js +3 -3
  207. package/src/avatar/edit.js +1 -1
  208. package/src/avatar/index.php +12 -1
  209. package/src/block/index.php +2 -0
  210. package/src/button/edit.js +2 -2
  211. package/src/buttons/edit.js +3 -16
  212. package/src/buttons/edit.native.js +2 -18
  213. package/src/calendar/index.php +5 -0
  214. package/src/columns/edit.js +9 -2
  215. package/src/comment-author-avatar/edit.js +1 -1
  216. package/src/comments/index.php +2 -0
  217. package/src/cover/edit/index.js +2 -2
  218. package/src/cover/edit/inspector-controls.js +1 -1
  219. package/src/cover/edit/resizable-cover-popover.js +1 -6
  220. package/src/cover/edit.native.js +1 -1
  221. package/src/details/block.json +1 -0
  222. package/src/file/deprecated.js +3 -3
  223. package/src/file/edit.js +8 -15
  224. package/src/file/edit.native.js +4 -4
  225. package/src/file/save.js +1 -1
  226. package/src/form-input/edit.js +1 -1
  227. package/src/gallery/edit.js +6 -12
  228. package/src/gallery/gallery.native.js +1 -1
  229. package/src/gallery/test/index.native.js +1 -1
  230. package/src/gallery/v1/edit.js +2 -2
  231. package/src/gallery/v1/gallery.native.js +1 -1
  232. package/src/group/editor.scss +1 -1
  233. package/src/group/variations.js +3 -6
  234. package/src/image/edit.js +1 -1
  235. package/src/image/edit.native.js +1 -1
  236. package/src/image/editor.scss +6 -0
  237. package/src/image/image.js +2 -2
  238. package/src/latest-posts/edit.native.js +1 -1
  239. package/src/list/edit.js +5 -0
  240. package/src/list/ordered-list-settings.js +1 -1
  241. package/src/list-item/edit.native.js +1 -1
  242. package/src/list-item/hooks/use-indent-list-item.js +2 -0
  243. package/src/list-item/hooks/use-outdent-list-item.js +2 -0
  244. package/src/list-item/hooks/use-space.js +16 -9
  245. package/src/media-text/media-container.native.js +5 -3
  246. package/src/media-text/test/edit.native.js +58 -0
  247. package/src/missing/test/edit-integration.native.js +2 -1
  248. package/src/navigation/edit/index.js +1 -1
  249. package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
  250. package/src/navigation/index.php +18 -13
  251. package/src/navigation-link/link-ui.js +2 -2
  252. package/src/paragraph/edit.native.js +1 -1
  253. package/src/paragraph/test/edit.native.js +36 -0
  254. package/src/pattern/edit.js +27 -10
  255. package/src/post-author-biography/index.php +4 -3
  256. package/src/post-author-name/index.php +4 -3
  257. package/src/post-excerpt/edit.js +1 -1
  258. package/src/post-featured-image/dimension-controls.js +4 -4
  259. package/src/post-featured-image/edit.js +1 -1
  260. package/src/post-navigation-link/edit.js +1 -1
  261. package/src/post-template/index.php +2 -0
  262. package/src/query/edit/pattern-selection-modal.js +1 -1
  263. package/src/query/utils.js +6 -4
  264. package/src/query-pagination-next/edit.js +1 -1
  265. package/src/query-pagination-previous/edit.js +1 -1
  266. package/src/quote/block.json +1 -1
  267. package/src/quote/deprecated.js +110 -15
  268. package/src/quote/edit.js +5 -5
  269. package/src/quote/save.js +2 -2
  270. package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
  271. package/src/read-more/edit.js +1 -1
  272. package/src/search/edit.js +1 -1
  273. package/src/search/edit.native.js +4 -4
  274. package/src/site-logo/edit.js +1 -1
  275. package/src/social-link/edit.js +1 -1
  276. package/src/social-links/edit.native.js +1 -1
  277. package/src/spacer/edit.js +1 -1
  278. package/src/table-of-contents/edit.js +1 -1
  279. package/src/template-part/edit/index.js +91 -4
  280. package/src/template-part/edit/selection-modal.js +4 -8
  281. package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
  282. package/src/utils/hooks.js +53 -3
  283. package/src/video/edit-common-settings.js +1 -1
  284. package/src/video/edit.js +10 -18
  285. package/src/video/edit.native.js +5 -8
  286. package/src/video/test/edit.native.js +0 -14
  287. package/build/site-title/edit/index.js.map +0 -1
  288. package/build-module/site-title/edit/index.js.map +0 -1
  289. /package/src/site-title/{edit/index.js → edit.js} +0 -0
@@ -12,6 +12,7 @@ import {
12
12
  initializeEditor,
13
13
  render,
14
14
  setupCoreBlocks,
15
+ triggerBlockListLayout,
15
16
  waitFor,
16
17
  within,
17
18
  withFakeTimers,
@@ -213,6 +214,41 @@ describe( 'Paragraph block', () => {
213
214
  ` );
214
215
  } );
215
216
 
217
+ it( 'should inherit parent alignment', async () => {
218
+ // Arrange
219
+ const screen = await initializeEditor();
220
+ await addBlock( screen, 'Quote' );
221
+ await triggerBlockListLayout( getBlock( screen, 'Quote' ) );
222
+
223
+ // Act
224
+ const paragraphBlock = getBlock( screen, 'Paragraph' );
225
+ fireEvent.press( paragraphBlock );
226
+ const paragraphTextInput =
227
+ within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
228
+ typeInRichText(
229
+ paragraphTextInput,
230
+ 'A quick brown fox jumps over the lazy dog.'
231
+ );
232
+ fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
233
+ fireEvent.press( screen.getByLabelText( 'Align text' ) );
234
+ fireEvent.press( screen.getByLabelText( 'Align text right' ) );
235
+
236
+ // Assert
237
+ // This not an ideal assertion, as it relies implementation details of the
238
+ // component: prop names. However, the only aspect we can assert is the prop
239
+ // passed to Aztec, the native module controlling visual alignment. A less
240
+ // brittle alternative might be snapshotting, but RNTL does not yet support
241
+ // focused snapshots, which means the snapshot would be huge.
242
+ // https://github.com/facebook/react/pull/25329
243
+ expect(
244
+ screen.UNSAFE_queryAllByProps( {
245
+ value: '<p>A quick brown fox jumps over the lazy dog.</p>',
246
+ placeholder: 'Start writing…',
247
+ textAlign: 'right',
248
+ } ).length
249
+ ).toBe( 2 ); // One for Aztec mock, one for the TextInput.
250
+ } );
251
+
216
252
  it( 'should preserve alignment when split', async () => {
217
253
  // Arrange
218
254
  const screen = await initializeEditor();
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { cloneBlock } from '@wordpress/blocks';
5
- import { useSelect, useDispatch } from '@wordpress/data';
5
+ import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
6
6
  import { useState, useEffect } from '@wordpress/element';
7
7
  import {
8
8
  Warning,
@@ -18,6 +18,7 @@ import { __, sprintf } from '@wordpress/i18n';
18
18
  import { useParsePatternDependencies } from './recursion-detector';
19
19
 
20
20
  const PatternEdit = ( { attributes, clientId } ) => {
21
+ const registry = useRegistry();
21
22
  const selectedPattern = useSelect(
22
23
  ( select ) =>
23
24
  select( blockEditorStore ).__experimentalGetParsedPattern(
@@ -96,16 +97,32 @@ const PatternEdit = ( { attributes, clientId } ) => {
96
97
  injectThemeAttributeInBlockTemplateContent( block )
97
98
  )
98
99
  );
100
+ // If the pattern has a single block and categories, we should add the
101
+ // categories of the pattern to the block's metadata.
102
+ if (
103
+ clonedBlocks.length === 1 &&
104
+ selectedPattern.categories?.length > 0
105
+ ) {
106
+ clonedBlocks[ 0 ].attributes = {
107
+ ...clonedBlocks[ 0 ].attributes,
108
+ metadata: {
109
+ ...clonedBlocks[ 0 ].attributes.metadata,
110
+ categories: selectedPattern.categories,
111
+ },
112
+ };
113
+ }
99
114
  const rootEditingMode = getBlockEditingMode( rootClientId );
100
- // Temporarily set the root block to default mode to allow replacing the pattern.
101
- // This could happen when the page is disabling edits of non-content blocks.
102
- __unstableMarkNextChangeAsNotPersistent();
103
- setBlockEditingMode( rootClientId, 'default' );
104
- __unstableMarkNextChangeAsNotPersistent();
105
- replaceBlocks( clientId, clonedBlocks );
106
- // Restore the root block's original mode.
107
- __unstableMarkNextChangeAsNotPersistent();
108
- setBlockEditingMode( rootClientId, rootEditingMode );
115
+ registry.batch( () => {
116
+ // Temporarily set the root block to default mode to allow replacing the pattern.
117
+ // This could happen when the page is disabling edits of non-content blocks.
118
+ __unstableMarkNextChangeAsNotPersistent();
119
+ setBlockEditingMode( rootClientId, 'default' );
120
+ __unstableMarkNextChangeAsNotPersistent();
121
+ replaceBlocks( clientId, clonedBlocks );
122
+ // Restore the root block's original mode.
123
+ __unstableMarkNextChangeAsNotPersistent();
124
+ setBlockEditingMode( rootClientId, rootEditingMode );
125
+ } );
109
126
  } );
110
127
  }
111
128
  }, [
@@ -14,11 +14,12 @@
14
14
  * @return string Returns the rendered post author biography block.
15
15
  */
16
16
  function render_block_core_post_author_biography( $attributes, $content, $block ) {
17
- if ( ! isset( $block->context['postId'] ) ) {
18
- return '';
17
+ if ( isset( $block->context['postId'] ) ) {
18
+ $author_id = get_post_field( 'post_author', $block->context['postId'] );
19
+ } else {
20
+ $author_id = get_query_var( 'author' );
19
21
  }
20
22
 
21
- $author_id = get_post_field( 'post_author', $block->context['postId'] );
22
23
  if ( empty( $author_id ) ) {
23
24
  return '';
24
25
  }
@@ -14,11 +14,12 @@
14
14
  * @return string Returns the rendered post author name block.
15
15
  */
16
16
  function render_block_core_post_author_name( $attributes, $content, $block ) {
17
- if ( ! isset( $block->context['postId'] ) ) {
18
- return '';
17
+ if ( isset( $block->context['postId'] ) ) {
18
+ $author_id = get_post_field( 'post_author', $block->context['postId'] );
19
+ } else {
20
+ $author_id = get_query_var( 'author' );
19
21
  }
20
22
 
21
- $author_id = get_post_field( 'post_author', $block->context['postId'] );
22
23
  if ( empty( $author_id ) ) {
23
24
  return '';
24
25
  }
@@ -135,7 +135,7 @@ export default function PostExcerptEditor( {
135
135
  onChange={ ( newMoreText ) =>
136
136
  setAttributes( { moreText: newMoreText } )
137
137
  }
138
- withoutInteractiveFormatting={ true }
138
+ withoutInteractiveFormatting
139
139
  />
140
140
  );
141
141
  const excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {
@@ -83,7 +83,7 @@ const DimensionControls = ( {
83
83
  resetAllFilter={ () => ( {
84
84
  aspectRatio: undefined,
85
85
  } ) }
86
- isShownByDefault={ true }
86
+ isShownByDefault
87
87
  panelId={ clientId }
88
88
  >
89
89
  <SelectControl
@@ -138,7 +138,7 @@ const DimensionControls = ( {
138
138
  resetAllFilter={ () => ( {
139
139
  height: undefined,
140
140
  } ) }
141
- isShownByDefault={ true }
141
+ isShownByDefault
142
142
  panelId={ clientId }
143
143
  >
144
144
  <UnitControl
@@ -160,7 +160,7 @@ const DimensionControls = ( {
160
160
  resetAllFilter={ () => ( {
161
161
  width: undefined,
162
162
  } ) }
163
- isShownByDefault={ true }
163
+ isShownByDefault
164
164
  panelId={ clientId }
165
165
  >
166
166
  <UnitControl
@@ -186,7 +186,7 @@ const DimensionControls = ( {
186
186
  resetAllFilter={ () => ( {
187
187
  scale: DEFAULT_SCALE,
188
188
  } ) }
189
- isShownByDefault={ true }
189
+ isShownByDefault
190
190
  panelId={ clientId }
191
191
  >
192
192
  <ToggleGroupControl
@@ -153,7 +153,7 @@ export default function PostFeaturedImageEdit( {
153
153
  'block-editor-media-placeholder',
154
154
  borderProps.className
155
155
  ) }
156
- withIllustration={ true }
156
+ withIllustration
157
157
  style={ {
158
158
  height: !! aspectRatio && '100%',
159
159
  width: !! aspectRatio && '100%',
@@ -207,7 +207,7 @@ export default function PostNavigationLinkEdit( {
207
207
  { isNext && displayArrow && (
208
208
  <span
209
209
  className={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }
210
- aria-hidden={ true }
210
+ aria-hidden
211
211
  >
212
212
  { displayArrow }
213
213
  </span>
@@ -36,6 +36,8 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
36
36
  *
37
37
  * @since 6.3.0 Changed render_block_context priority to `1`.
38
38
  *
39
+ * @global WP_Query $wp_query WordPress Query object.
40
+ *
39
41
  * @param array $attributes Block attributes.
40
42
  * @param string $content Block default content.
41
43
  * @param WP_Block $block Block instance.
@@ -62,7 +62,7 @@ export default function PatternSelectionModal( {
62
62
  overlayClassName="block-library-query-pattern__selection-modal"
63
63
  title={ __( 'Choose a pattern' ) }
64
64
  onRequestClose={ () => setIsPatternSelectionModalOpen( false ) }
65
- isFullScreen={ true }
65
+ isFullScreen
66
66
  >
67
67
  <div className="block-library-query-pattern__selection-content">
68
68
  <div className="block-library-query-pattern__selection-search">
@@ -131,16 +131,18 @@ export const useTaxonomies = ( postType ) => {
131
131
  const taxonomies = useSelect(
132
132
  ( select ) => {
133
133
  const { getTaxonomies } = select( coreStore );
134
- const filteredTaxonomies = getTaxonomies( {
134
+ return getTaxonomies( {
135
135
  type: postType,
136
136
  per_page: -1,
137
- context: 'view',
138
137
  } );
139
- return filteredTaxonomies;
140
138
  },
141
139
  [ postType ]
142
140
  );
143
- return taxonomies;
141
+ return useMemo( () => {
142
+ return taxonomies?.filter(
143
+ ( { visibility } ) => !! visibility?.publicly_queryable
144
+ );
145
+ }, [ taxonomies ] );
144
146
  };
145
147
 
146
148
  /**
@@ -37,7 +37,7 @@ export default function QueryPaginationNextEdit( {
37
37
  { displayArrow && (
38
38
  <span
39
39
  className={ `wp-block-query-pagination-next-arrow is-arrow-${ paginationArrow }` }
40
- aria-hidden={ true }
40
+ aria-hidden
41
41
  >
42
42
  { displayArrow }
43
43
  </span>
@@ -25,7 +25,7 @@ export default function QueryPaginationPreviousEdit( {
25
25
  { displayArrow && (
26
26
  <span
27
27
  className={ `wp-block-query-pagination-previous-arrow is-arrow-${ paginationArrow }` }
28
- aria-hidden={ true }
28
+ aria-hidden
29
29
  >
30
30
  { displayArrow }
31
31
  </span>
@@ -22,7 +22,7 @@
22
22
  "selector": "cite",
23
23
  "__experimentalRole": "content"
24
24
  },
25
- "align": {
25
+ "textAlign": {
26
26
  "type": "string"
27
27
  }
28
28
  },
@@ -7,7 +7,7 @@ import classnames from 'classnames';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { createBlock, parseWithAttributeSchema } from '@wordpress/blocks';
10
- import { RichText, useBlockProps } from '@wordpress/block-editor';
10
+ import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
11
11
 
12
12
  export const migrateToQuoteV2 = ( attributes ) => {
13
13
  const { value, ...restAttributes } = attributes;
@@ -34,6 +34,102 @@ export const migrateToQuoteV2 = ( attributes ) => {
34
34
  ];
35
35
  };
36
36
 
37
+ const TEXT_ALIGN_OPTIONS = [ 'left', 'right', 'center' ];
38
+
39
+ // Migrate existing text alignment settings to the renamed attribute.
40
+ const migrateTextAlign = ( attributes, innerBlocks ) => {
41
+ const { align, ...rest } = attributes;
42
+ // Check if there are valid alignments stored in the old attribute
43
+ // and assign them to the new attribute name.
44
+ const migratedAttributes = TEXT_ALIGN_OPTIONS.includes( align )
45
+ ? { ...rest, textAlign: align }
46
+ : attributes;
47
+
48
+ return [ migratedAttributes, innerBlocks ];
49
+ };
50
+
51
+ // Migrate the v2 blocks with style === `2`;
52
+ const migrateLargeStyle = ( attributes, innerBlocks ) => {
53
+ return [
54
+ {
55
+ ...attributes,
56
+ className: attributes.className
57
+ ? attributes.className + ' is-style-large'
58
+ : 'is-style-large',
59
+ },
60
+ innerBlocks,
61
+ ];
62
+ };
63
+
64
+ // Version before the 'align' attribute was replaced with 'textAlign'.
65
+ const v4 = {
66
+ attributes: {
67
+ value: {
68
+ type: 'string',
69
+ source: 'html',
70
+ selector: 'blockquote',
71
+ multiline: 'p',
72
+ default: '',
73
+ __experimentalRole: 'content',
74
+ },
75
+ citation: {
76
+ type: 'string',
77
+ source: 'html',
78
+ selector: 'cite',
79
+ default: '',
80
+ __experimentalRole: 'content',
81
+ },
82
+ align: {
83
+ type: 'string',
84
+ },
85
+ },
86
+ supports: {
87
+ anchor: true,
88
+ html: false,
89
+ __experimentalOnEnter: true,
90
+ __experimentalOnMerge: true,
91
+ typography: {
92
+ fontSize: true,
93
+ lineHeight: true,
94
+ __experimentalFontFamily: true,
95
+ __experimentalFontWeight: true,
96
+ __experimentalFontStyle: true,
97
+ __experimentalTextTransform: true,
98
+ __experimentalTextDecoration: true,
99
+ __experimentalLetterSpacing: true,
100
+ __experimentalDefaultControls: {
101
+ fontSize: true,
102
+ fontAppearance: true,
103
+ },
104
+ },
105
+ color: {
106
+ gradients: true,
107
+ heading: true,
108
+ link: true,
109
+ __experimentalDefaultControls: {
110
+ background: true,
111
+ text: true,
112
+ },
113
+ },
114
+ },
115
+ isEligible: ( { align } ) => TEXT_ALIGN_OPTIONS.includes( align ),
116
+ save( { attributes } ) {
117
+ const { align, citation } = attributes;
118
+ const className = classnames( {
119
+ [ `has-text-align-${ align }` ]: align,
120
+ } );
121
+ return (
122
+ <blockquote { ...useBlockProps.save( { className } ) }>
123
+ <InnerBlocks.Content />
124
+ { ! RichText.isEmpty( citation ) && (
125
+ <RichText.Content tagName="cite" value={ citation } />
126
+ ) }
127
+ </blockquote>
128
+ );
129
+ },
130
+ migrate: migrateTextAlign,
131
+ };
132
+
37
133
  const v3 = {
38
134
  attributes: {
39
135
  value: {
@@ -87,7 +183,9 @@ const v3 = {
87
183
  </blockquote>
88
184
  );
89
185
  },
90
- migrate: migrateToQuoteV2,
186
+ migrate( attributes ) {
187
+ return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
188
+ },
91
189
  };
92
190
 
93
191
  const v2 = {
@@ -109,7 +207,9 @@ const v2 = {
109
207
  type: 'string',
110
208
  },
111
209
  },
112
- migrate: migrateToQuoteV2,
210
+ migrate( attributes ) {
211
+ return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
212
+ },
113
213
  save( { attributes } ) {
114
214
  const { align, value, citation } = attributes;
115
215
 
@@ -151,15 +251,12 @@ const v1 = {
151
251
  migrate( attributes ) {
152
252
  if ( attributes.style === 2 ) {
153
253
  const { style, ...restAttributes } = attributes;
154
- return migrateToQuoteV2( {
155
- ...restAttributes,
156
- className: attributes.className
157
- ? attributes.className + ' is-style-large'
158
- : 'is-style-large',
159
- } );
254
+ return migrateTextAlign(
255
+ ...migrateLargeStyle( ...migrateToQuoteV2( restAttributes ) )
256
+ );
160
257
  }
161
258
 
162
- return migrateToQuoteV2( attributes );
259
+ return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
163
260
  },
164
261
 
165
262
  save( { attributes } ) {
@@ -206,12 +303,10 @@ const v0 = {
206
303
  migrate( attributes ) {
207
304
  if ( ! isNaN( parseInt( attributes.style ) ) ) {
208
305
  const { style, ...restAttributes } = attributes;
209
- return migrateToQuoteV2( {
210
- ...restAttributes,
211
- } );
306
+ return migrateTextAlign( ...migrateToQuoteV2( restAttributes ) );
212
307
  }
213
308
 
214
- return migrateToQuoteV2( attributes );
309
+ return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
215
310
  },
216
311
 
217
312
  save( { attributes } ) {
@@ -239,4 +334,4 @@ const v0 = {
239
334
  *
240
335
  * See block-deprecation.md
241
336
  */
242
- export default [ v3, v2, v1, v0 ];
337
+ export default [ v4, v3, v2, v1, v0 ];
package/src/quote/edit.js CHANGED
@@ -74,7 +74,7 @@ export default function QuoteEdit( {
74
74
  className,
75
75
  style,
76
76
  } ) {
77
- const { align, citation } = attributes;
77
+ const { textAlign, citation } = attributes;
78
78
 
79
79
  useMigrateOnLoad( attributes, clientId );
80
80
 
@@ -86,7 +86,7 @@ export default function QuoteEdit( {
86
86
 
87
87
  const blockProps = useBlockProps( {
88
88
  className: classNames( className, {
89
- [ `has-text-align-${ align }` ]: align,
89
+ [ `has-text-align-${ textAlign }` ]: textAlign,
90
90
  } ),
91
91
  ...( ! isWebPlatform && { style } ),
92
92
  } );
@@ -100,9 +100,9 @@ export default function QuoteEdit( {
100
100
  <>
101
101
  <BlockControls group="block">
102
102
  <AlignmentControl
103
- value={ align }
103
+ value={ textAlign }
104
104
  onChange={ ( nextAlign ) => {
105
- setAttributes( { align: nextAlign } );
105
+ setAttributes( { textAlign: nextAlign } );
106
106
  } }
107
107
  />
108
108
  </BlockControls>
@@ -132,7 +132,7 @@ export default function QuoteEdit( {
132
132
  createBlock( getDefaultBlockName() )
133
133
  )
134
134
  }
135
- { ...( ! isWebPlatform ? { textAlign: align } : {} ) }
135
+ { ...( ! isWebPlatform ? { textAlign } : {} ) }
136
136
  />
137
137
  ) }
138
138
  </BlockQuotation>
package/src/quote/save.js CHANGED
@@ -9,10 +9,10 @@ import classNames from 'classnames';
9
9
  import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
10
10
 
11
11
  export default function save( { attributes } ) {
12
- const { align, citation } = attributes;
12
+ const { textAlign, citation } = attributes;
13
13
 
14
14
  const className = classNames( {
15
- [ `has-text-align-${ align }` ]: align,
15
+ [ `has-text-align-${ textAlign }` ]: textAlign,
16
16
  } );
17
17
 
18
18
  return (
@@ -3,7 +3,7 @@
3
3
  exports[`Quote block transforms to Columns block 1`] = `
4
4
  "<!-- wp:columns -->
5
5
  <div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
6
- <div class="wp-block-column" style="flex-basis:100%"><!-- wp:quote {"align":"left","className":"is-style-large"} -->
6
+ <div class="wp-block-column" style="flex-basis:100%"><!-- wp:quote {"textAlign":"left","className":"is-style-large"} -->
7
7
  <blockquote class="wp-block-quote has-text-align-left is-style-large"><!-- wp:paragraph -->
8
8
  <p>"This will make running your own blog a viable alternative again."</p>
9
9
  <!-- /wp:paragraph --><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote>
@@ -14,7 +14,7 @@ exports[`Quote block transforms to Columns block 1`] = `
14
14
 
15
15
  exports[`Quote block transforms to Group block 1`] = `
16
16
  "<!-- wp:group {"layout":{"type":"constrained"}} -->
17
- <div class="wp-block-group"><!-- wp:quote {"align":"left","className":"is-style-large"} -->
17
+ <div class="wp-block-group"><!-- wp:quote {"textAlign":"left","className":"is-style-large"} -->
18
18
  <blockquote class="wp-block-quote has-text-align-left is-style-large"><!-- wp:paragraph -->
19
19
  <p>"This will make running your own blog a viable alternative again."</p>
20
20
  <!-- /wp:paragraph --><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote>
@@ -43,7 +43,7 @@ export default function ReadMore( {
43
43
  __unstableOnSplitAtEnd={ () =>
44
44
  insertBlocksAfter( createBlock( getDefaultBlockName() ) )
45
45
  }
46
- withoutInteractiveFormatting={ true }
46
+ withoutInteractiveFormatting
47
47
  { ...blockProps }
48
48
  />
49
49
  </>
@@ -400,7 +400,7 @@ export default function SearchEdit( {
400
400
  </BlockControls>
401
401
 
402
402
  <InspectorControls>
403
- <PanelBody title={ __( 'Display Settings' ) }>
403
+ <PanelBody title={ __( 'Settings' ) }>
404
404
  <BaseControl
405
405
  label={ __( 'Width' ) }
406
406
  id={ unitControlInputId }
@@ -192,7 +192,7 @@ export default function SearchEdit( {
192
192
  } );
193
193
  } }
194
194
  options={ BUTTON_OPTIONS }
195
- hideCancelButton={ true }
195
+ hideCancelButton
196
196
  />
197
197
  { buttonPosition !== 'no-button' && (
198
198
  <ToggleControl
@@ -294,7 +294,7 @@ export default function SearchEdit( {
294
294
  return (
295
295
  <View
296
296
  style={ styles.searchInputContainer }
297
- accessible={ true }
297
+ accessible
298
298
  accessibilityRole="none"
299
299
  accessibilityHint={
300
300
  isScreenReaderEnabled
@@ -383,7 +383,7 @@ export default function SearchEdit( {
383
383
 
384
384
  { ! buttonUseIcon && (
385
385
  <View
386
- accessible={ true }
386
+ accessible
387
387
  accessibilityRole="none"
388
388
  accessibilityHint={
389
389
  isScreenReaderEnabled
@@ -438,7 +438,7 @@ export default function SearchEdit( {
438
438
 
439
439
  { showLabel && (
440
440
  <View
441
- accessible={ true }
441
+ accessible
442
442
  accessibilityRole="none"
443
443
  accessibilityHint={
444
444
  isScreenReaderEnabled
@@ -574,7 +574,7 @@ export default function LogoEdit( {
574
574
  <Placeholder
575
575
  className={ placeholderClassName }
576
576
  preview={ logoImage }
577
- withIllustration={ true }
577
+ withIllustration
578
578
  style={ {
579
579
  width,
580
580
  } }
@@ -59,7 +59,7 @@ const SocialLinkURLPopover = ( {
59
59
  setAttributes( { url: nextURL } )
60
60
  }
61
61
  placeholder={ __( 'Enter address' ) }
62
- disableSuggestions={ true }
62
+ disableSuggestions
63
63
  onKeyDown={ ( event ) => {
64
64
  if (
65
65
  !! url ||
@@ -53,7 +53,7 @@ function SocialLinksEdit( {
53
53
 
54
54
  const renderFooterAppender = useRef( () => (
55
55
  <View style={ styles.footerAppenderContainer }>
56
- <InnerBlocks.ButtonBlockAppender isFloating={ true } />
56
+ <InnerBlocks.ButtonBlockAppender isFloating />
57
57
  </View>
58
58
  ) );
59
59
 
@@ -67,7 +67,7 @@ const ResizableSpacer = ( {
67
67
  onResizeStop( `${ nextVal }px` );
68
68
  setIsResizing( false );
69
69
  } }
70
- __experimentalShowTooltip={ true }
70
+ __experimentalShowTooltip
71
71
  __experimentalTooltipProps={ {
72
72
  axis: orientation === 'horizontal' ? 'x' : 'y',
73
73
  position: 'corner',
@@ -160,7 +160,7 @@ export default function TableOfContentsEdit( {
160
160
  <ol>
161
161
  <TableOfContentsList
162
162
  nestedHeadingList={ headingTree }
163
- disableLinkActivation={ true }
163
+ disableLinkActivation
164
164
  onClick={ showRedirectionPreventedNotice }
165
165
  />
166
166
  </ol>