@wordpress/block-library 8.29.0 → 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 (347) hide show
  1. package/CHANGELOG.md +2 -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/block/deprecated.js +71 -11
  7. package/build/block/deprecated.js.map +1 -1
  8. package/build/block/edit.js +49 -24
  9. package/build/block/edit.js.map +1 -1
  10. package/build/button/edit.js +2 -2
  11. package/build/button/edit.js.map +1 -1
  12. package/build/buttons/edit.native.js.map +1 -1
  13. package/build/buttons/transforms.js +16 -2
  14. package/build/buttons/transforms.js.map +1 -1
  15. package/build/code/transforms.js +17 -6
  16. package/build/code/transforms.js.map +1 -1
  17. package/build/columns/edit.js +3 -2
  18. package/build/columns/edit.js.map +1 -1
  19. package/build/comment-author-avatar/edit.js +1 -1
  20. package/build/comment-author-avatar/edit.js.map +1 -1
  21. package/build/cover/edit/block-controls.js +14 -3
  22. package/build/cover/edit/block-controls.js.map +1 -1
  23. package/build/cover/edit/index.js.map +1 -1
  24. package/build/cover/edit/inspector-controls.js.map +1 -1
  25. package/build/cover/edit/resizable-cover-popover.js +0 -6
  26. package/build/cover/edit/resizable-cover-popover.js.map +1 -1
  27. package/build/cover/edit.native.js.map +1 -1
  28. package/build/file/deprecated.js.map +1 -1
  29. package/build/file/edit.js +6 -13
  30. package/build/file/edit.js.map +1 -1
  31. package/build/file/edit.native.js.map +1 -1
  32. package/build/file/save.js.map +1 -1
  33. package/build/form-input/edit.js +1 -1
  34. package/build/form-input/edit.js.map +1 -1
  35. package/build/gallery/edit.js.map +1 -1
  36. package/build/gallery/gallery.native.js.map +1 -1
  37. package/build/gallery/v1/edit.js.map +1 -1
  38. package/build/gallery/v1/gallery.native.js.map +1 -1
  39. package/build/heading/transforms.js +17 -4
  40. package/build/heading/transforms.js.map +1 -1
  41. package/build/image/edit.js +8 -4
  42. package/build/image/edit.js.map +1 -1
  43. package/build/image/edit.native.js.map +1 -1
  44. package/build/image/image.js +22 -8
  45. package/build/image/image.js.map +1 -1
  46. package/build/latest-posts/edit.native.js.map +1 -1
  47. package/build/list/ordered-list-settings.js +1 -1
  48. package/build/list/ordered-list-settings.js.map +1 -1
  49. package/build/list-item/edit.js +1 -3
  50. package/build/list-item/edit.js.map +1 -1
  51. package/build/list-item/edit.native.js.map +1 -1
  52. package/build/list-item/hooks/index.js +0 -7
  53. package/build/list-item/hooks/index.js.map +1 -1
  54. package/build/list-item/hooks/use-indent-list-item.js +1 -0
  55. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  56. package/build/list-item/hooks/use-outdent-list-item.js +1 -0
  57. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  58. package/build/list-item/hooks/use-space.js +16 -7
  59. package/build/list-item/hooks/use-space.js.map +1 -1
  60. package/build/list-item/index.js +4 -1
  61. package/build/list-item/index.js.map +1 -1
  62. package/build/media-text/media-container.native.js +1 -1
  63. package/build/media-text/media-container.native.js.map +1 -1
  64. package/build/navigation/edit/index.js.map +1 -1
  65. package/build/navigation-link/link-ui.js.map +1 -1
  66. package/build/paragraph/edit.native.js.map +1 -1
  67. package/build/pattern/edit.js +11 -0
  68. package/build/pattern/edit.js.map +1 -1
  69. package/build/post-excerpt/edit.js.map +1 -1
  70. package/build/post-featured-image/dimension-controls.js.map +1 -1
  71. package/build/post-featured-image/edit.js +8 -11
  72. package/build/post-featured-image/edit.js.map +1 -1
  73. package/build/post-navigation-link/edit.js.map +1 -1
  74. package/build/post-title/edit.js +2 -2
  75. package/build/post-title/edit.js.map +1 -1
  76. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  77. package/build/query/utils.js +7 -5
  78. package/build/query/utils.js.map +1 -1
  79. package/build/query-pagination-next/edit.js.map +1 -1
  80. package/build/query-pagination-previous/edit.js.map +1 -1
  81. package/build/quote/deprecated.js +111 -12
  82. package/build/quote/deprecated.js.map +1 -1
  83. package/build/quote/edit.js +5 -5
  84. package/build/quote/edit.js.map +1 -1
  85. package/build/quote/index.js +1 -1
  86. package/build/quote/index.js.map +1 -1
  87. package/build/quote/save.js +2 -2
  88. package/build/quote/save.js.map +1 -1
  89. package/build/read-more/edit.js.map +1 -1
  90. package/build/search/edit.js +1 -1
  91. package/build/search/edit.js.map +1 -1
  92. package/build/search/edit.native.js.map +1 -1
  93. package/build/site-logo/edit.js +7 -2
  94. package/build/site-logo/edit.js.map +1 -1
  95. package/build/site-title/{edit/index.js → edit.js} +1 -1
  96. package/build/site-title/edit.js.map +1 -0
  97. package/build/social-link/edit.js.map +1 -1
  98. package/build/social-links/edit.native.js.map +1 -1
  99. package/build/spacer/edit.js.map +1 -1
  100. package/build/table-of-contents/edit.js.map +1 -1
  101. package/build/template-part/edit/index.js +53 -1
  102. package/build/template-part/edit/index.js.map +1 -1
  103. package/build/template-part/edit/selection-modal.js +2 -8
  104. package/build/template-part/edit/selection-modal.js.map +1 -1
  105. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
  106. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  107. package/build/utils/caption.js +15 -5
  108. package/build/utils/caption.js.map +1 -1
  109. package/build/utils/get-transformed-metadata.js +57 -0
  110. package/build/utils/get-transformed-metadata.js.map +1 -0
  111. package/build/utils/hooks.js +55 -4
  112. package/build/utils/hooks.js.map +1 -1
  113. package/build/video/edit-common-settings.js.map +1 -1
  114. package/build/video/edit.js +7 -16
  115. package/build/video/edit.js.map +1 -1
  116. package/build/video/edit.native.js +2 -7
  117. package/build/video/edit.native.js.map +1 -1
  118. package/build-module/audio/edit.js +10 -20
  119. package/build-module/audio/edit.js.map +1 -1
  120. package/build-module/audio/edit.native.js.map +1 -1
  121. package/build-module/avatar/edit.js.map +1 -1
  122. package/build-module/block/deprecated.js +71 -11
  123. package/build-module/block/deprecated.js.map +1 -1
  124. package/build-module/block/edit.js +49 -24
  125. package/build-module/block/edit.js.map +1 -1
  126. package/build-module/button/edit.js +3 -3
  127. package/build-module/button/edit.js.map +1 -1
  128. package/build-module/buttons/edit.native.js.map +1 -1
  129. package/build-module/buttons/transforms.js +16 -2
  130. package/build-module/buttons/transforms.js.map +1 -1
  131. package/build-module/code/transforms.js +17 -6
  132. package/build-module/code/transforms.js.map +1 -1
  133. package/build-module/columns/edit.js +3 -2
  134. package/build-module/columns/edit.js.map +1 -1
  135. package/build-module/comment-author-avatar/edit.js +1 -1
  136. package/build-module/comment-author-avatar/edit.js.map +1 -1
  137. package/build-module/cover/edit/block-controls.js +15 -4
  138. package/build-module/cover/edit/block-controls.js.map +1 -1
  139. package/build-module/cover/edit/index.js.map +1 -1
  140. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  141. package/build-module/cover/edit/resizable-cover-popover.js +1 -7
  142. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
  143. package/build-module/cover/edit.native.js.map +1 -1
  144. package/build-module/file/deprecated.js.map +1 -1
  145. package/build-module/file/edit.js +7 -14
  146. package/build-module/file/edit.js.map +1 -1
  147. package/build-module/file/edit.native.js.map +1 -1
  148. package/build-module/file/save.js.map +1 -1
  149. package/build-module/form-input/edit.js +1 -1
  150. package/build-module/form-input/edit.js.map +1 -1
  151. package/build-module/gallery/edit.js.map +1 -1
  152. package/build-module/gallery/gallery.native.js.map +1 -1
  153. package/build-module/gallery/v1/edit.js.map +1 -1
  154. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  155. package/build-module/heading/transforms.js +17 -4
  156. package/build-module/heading/transforms.js.map +1 -1
  157. package/build-module/image/edit.js +9 -5
  158. package/build-module/image/edit.js.map +1 -1
  159. package/build-module/image/edit.native.js.map +1 -1
  160. package/build-module/image/image.js +23 -9
  161. package/build-module/image/image.js.map +1 -1
  162. package/build-module/latest-posts/edit.native.js.map +1 -1
  163. package/build-module/list/ordered-list-settings.js +1 -1
  164. package/build-module/list/ordered-list-settings.js.map +1 -1
  165. package/build-module/list-item/edit.js +2 -4
  166. package/build-module/list-item/edit.js.map +1 -1
  167. package/build-module/list-item/edit.native.js.map +1 -1
  168. package/build-module/list-item/hooks/index.js +0 -1
  169. package/build-module/list-item/hooks/index.js.map +1 -1
  170. package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
  171. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  172. package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
  173. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  174. package/build-module/list-item/hooks/use-space.js +17 -8
  175. package/build-module/list-item/hooks/use-space.js.map +1 -1
  176. package/build-module/list-item/index.js +4 -1
  177. package/build-module/list-item/index.js.map +1 -1
  178. package/build-module/media-text/media-container.native.js +1 -1
  179. package/build-module/media-text/media-container.native.js.map +1 -1
  180. package/build-module/navigation/edit/index.js.map +1 -1
  181. package/build-module/navigation-link/link-ui.js.map +1 -1
  182. package/build-module/paragraph/edit.native.js.map +1 -1
  183. package/build-module/pattern/edit.js +11 -0
  184. package/build-module/pattern/edit.js.map +1 -1
  185. package/build-module/post-excerpt/edit.js.map +1 -1
  186. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  187. package/build-module/post-featured-image/edit.js +9 -12
  188. package/build-module/post-featured-image/edit.js.map +1 -1
  189. package/build-module/post-navigation-link/edit.js.map +1 -1
  190. package/build-module/post-title/edit.js +2 -2
  191. package/build-module/post-title/edit.js.map +1 -1
  192. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  193. package/build-module/query/utils.js +7 -5
  194. package/build-module/query/utils.js.map +1 -1
  195. package/build-module/query-pagination-next/edit.js.map +1 -1
  196. package/build-module/query-pagination-previous/edit.js.map +1 -1
  197. package/build-module/quote/deprecated.js +112 -13
  198. package/build-module/quote/deprecated.js.map +1 -1
  199. package/build-module/quote/edit.js +5 -5
  200. package/build-module/quote/edit.js.map +1 -1
  201. package/build-module/quote/index.js +1 -1
  202. package/build-module/quote/index.js.map +1 -1
  203. package/build-module/quote/save.js +2 -2
  204. package/build-module/quote/save.js.map +1 -1
  205. package/build-module/read-more/edit.js.map +1 -1
  206. package/build-module/search/edit.js +1 -1
  207. package/build-module/search/edit.js.map +1 -1
  208. package/build-module/search/edit.native.js.map +1 -1
  209. package/build-module/site-logo/edit.js +7 -2
  210. package/build-module/site-logo/edit.js.map +1 -1
  211. package/build-module/site-title/{edit/index.js → edit.js} +1 -1
  212. package/build-module/site-title/edit.js.map +1 -0
  213. package/build-module/social-link/edit.js.map +1 -1
  214. package/build-module/social-links/edit.native.js.map +1 -1
  215. package/build-module/spacer/edit.js.map +1 -1
  216. package/build-module/table-of-contents/edit.js.map +1 -1
  217. package/build-module/template-part/edit/index.js +57 -5
  218. package/build-module/template-part/edit/index.js.map +1 -1
  219. package/build-module/template-part/edit/selection-modal.js +2 -8
  220. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  221. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
  222. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  223. package/build-module/utils/caption.js +13 -3
  224. package/build-module/utils/caption.js.map +1 -1
  225. package/build-module/utils/get-transformed-metadata.js +51 -0
  226. package/build-module/utils/get-transformed-metadata.js.map +1 -0
  227. package/build-module/utils/hooks.js +54 -3
  228. package/build-module/utils/hooks.js.map +1 -1
  229. package/build-module/video/edit-common-settings.js.map +1 -1
  230. package/build-module/video/edit.js +10 -19
  231. package/build-module/video/edit.js.map +1 -1
  232. package/build-module/video/edit.native.js +2 -7
  233. package/build-module/video/edit.native.js.map +1 -1
  234. package/build-style/common-rtl.css +1 -0
  235. package/build-style/common.css +1 -0
  236. package/build-style/cover/style-rtl.css +2 -1
  237. package/build-style/cover/style.css +2 -1
  238. package/build-style/editor-rtl.css +4 -1
  239. package/build-style/editor.css +4 -1
  240. package/build-style/group/editor-rtl.css +1 -1
  241. package/build-style/group/editor.css +1 -1
  242. package/build-style/image/editor-rtl.css +3 -0
  243. package/build-style/image/editor.css +3 -0
  244. package/build-style/search/style-rtl.css +2 -0
  245. package/build-style/search/style.css +2 -0
  246. package/build-style/style-rtl.css +4 -1
  247. package/build-style/style.css +4 -1
  248. package/package.json +34 -34
  249. package/src/audio/edit.js +9 -19
  250. package/src/audio/edit.native.js +3 -3
  251. package/src/avatar/edit.js +1 -1
  252. package/src/block/deprecated.js +76 -11
  253. package/src/block/edit.js +64 -19
  254. package/src/block/index.php +23 -12
  255. package/src/button/edit.js +4 -3
  256. package/src/buttons/edit.native.js +1 -1
  257. package/src/buttons/transforms.js +14 -4
  258. package/src/calendar/index.php +5 -0
  259. package/src/code/transforms.js +20 -5
  260. package/src/columns/edit.js +3 -2
  261. package/src/comment-author-avatar/edit.js +1 -1
  262. package/src/comments/index.php +2 -0
  263. package/src/cover/edit/block-controls.js +16 -2
  264. package/src/cover/edit/index.js +2 -2
  265. package/src/cover/edit/inspector-controls.js +1 -1
  266. package/src/cover/edit/resizable-cover-popover.js +1 -6
  267. package/src/cover/edit.native.js +1 -1
  268. package/src/cover/style.scss +3 -2
  269. package/src/file/deprecated.js +3 -3
  270. package/src/file/edit.js +8 -15
  271. package/src/file/edit.native.js +4 -4
  272. package/src/file/save.js +1 -1
  273. package/src/footnotes/index.php +1 -1
  274. package/src/form-input/edit.js +1 -1
  275. package/src/gallery/edit.js +3 -3
  276. package/src/gallery/gallery.native.js +1 -1
  277. package/src/gallery/test/index.native.js +1 -1
  278. package/src/gallery/v1/edit.js +2 -2
  279. package/src/gallery/v1/gallery.native.js +1 -1
  280. package/src/group/editor.scss +1 -1
  281. package/src/heading/transforms.js +27 -8
  282. package/src/image/edit.js +13 -5
  283. package/src/image/edit.native.js +1 -1
  284. package/src/image/editor.scss +6 -0
  285. package/src/image/image.js +34 -22
  286. package/src/latest-posts/edit.native.js +1 -1
  287. package/src/list/ordered-list-settings.js +1 -1
  288. package/src/list-item/edit.js +1 -2
  289. package/src/list-item/edit.native.js +1 -1
  290. package/src/list-item/hooks/index.js +0 -1
  291. package/src/list-item/hooks/use-indent-list-item.js +2 -0
  292. package/src/list-item/hooks/use-outdent-list-item.js +2 -0
  293. package/src/list-item/hooks/use-space.js +16 -9
  294. package/src/list-item/index.js +3 -0
  295. package/src/media-text/media-container.native.js +5 -3
  296. package/src/media-text/test/edit.native.js +58 -0
  297. package/src/missing/test/edit-integration.native.js +2 -1
  298. package/src/navigation/edit/index.js +1 -1
  299. package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
  300. package/src/navigation/index.php +26 -17
  301. package/src/navigation-link/link-ui.js +2 -2
  302. package/src/paragraph/edit.native.js +1 -1
  303. package/src/paragraph/test/edit.native.js +36 -0
  304. package/src/pattern/edit.js +14 -0
  305. package/src/post-excerpt/edit.js +1 -1
  306. package/src/post-featured-image/dimension-controls.js +4 -4
  307. package/src/post-featured-image/edit.js +10 -12
  308. package/src/post-navigation-link/edit.js +1 -1
  309. package/src/post-template/index.php +2 -0
  310. package/src/post-title/edit.js +49 -43
  311. package/src/query/edit/pattern-selection-modal.js +1 -1
  312. package/src/query/utils.js +6 -4
  313. package/src/query-pagination-next/edit.js +1 -1
  314. package/src/query-pagination-previous/edit.js +1 -1
  315. package/src/quote/block.json +1 -1
  316. package/src/quote/deprecated.js +110 -15
  317. package/src/quote/edit.js +5 -5
  318. package/src/quote/save.js +2 -2
  319. package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
  320. package/src/read-more/edit.js +1 -1
  321. package/src/search/edit.js +1 -1
  322. package/src/search/edit.native.js +4 -4
  323. package/src/search/index.php +1 -1
  324. package/src/search/style.scss +2 -0
  325. package/src/site-logo/edit.js +11 -6
  326. package/src/social-link/edit.js +1 -1
  327. package/src/social-links/edit.native.js +1 -1
  328. package/src/spacer/edit.js +1 -1
  329. package/src/table-of-contents/edit.js +1 -1
  330. package/src/template-part/edit/index.js +91 -4
  331. package/src/template-part/edit/selection-modal.js +4 -8
  332. package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
  333. package/src/utils/caption.js +10 -1
  334. package/src/utils/get-transformed-metadata.js +65 -0
  335. package/src/utils/hooks.js +53 -3
  336. package/src/video/edit-common-settings.js +1 -1
  337. package/src/video/edit.js +10 -18
  338. package/src/video/edit.native.js +5 -8
  339. package/src/video/test/edit.native.js +0 -14
  340. package/build/list-item/hooks/use-copy.js +0 -39
  341. package/build/list-item/hooks/use-copy.js.map +0 -1
  342. package/build/site-title/edit/index.js.map +0 -1
  343. package/build-module/list-item/hooks/use-copy.js +0 -32
  344. package/build-module/list-item/hooks/use-copy.js.map +0 -1
  345. package/build-module/site-title/edit/index.js.map +0 -1
  346. package/src/list-item/hooks/use-copy.js +0 -38
  347. /package/src/site-title/{edit/index.js → edit.js} +0 -0
@@ -288,7 +288,7 @@ describe( 'NavigationMenuSelector', () => {
288
288
  rerender(
289
289
  <NavigationMenuSelector
290
290
  onCreateNew={ handler }
291
- createNavigationMenuIsSuccess={ true }
291
+ createNavigationMenuIsSuccess
292
292
  />
293
293
  );
294
294
 
@@ -475,7 +475,7 @@ describe( 'NavigationMenuSelector', () => {
475
475
  // // Simulate the menu being created and component being re-rendered.
476
476
  rerender(
477
477
  <NavigationMenuSelector
478
- createNavigationMenuIsSuccess={ true } // classic menu import creates a Navigation menu.
478
+ createNavigationMenuIsSuccess // classic menu import creates a Navigation menu.
479
479
  />
480
480
  );
481
481
 
@@ -616,7 +616,7 @@ describe( 'NavigationMenuSelector', () => {
616
616
  // Simulate the menu being created and component being re-rendered.
617
617
  rerender(
618
618
  <NavigationMenuSelector
619
- createNavigationMenuIsSuccess={ true } // classic menu import creates a Navigation menu.
619
+ createNavigationMenuIsSuccess // classic menu import creates a Navigation menu.
620
620
  />
621
621
  );
622
622
 
@@ -544,7 +544,6 @@ class WP_Navigation_Block_Renderer {
544
544
  * Gets the nav element directives.
545
545
  *
546
546
  * @param bool $is_interactive Whether the block is interactive.
547
- * @param array $attributes The block attributes.
548
547
  * @return string the directives for the navigation element.
549
548
  */
550
549
  private static function get_nav_element_directives( $is_interactive ) {
@@ -552,16 +551,20 @@ class WP_Navigation_Block_Renderer {
552
551
  return '';
553
552
  }
554
553
  // When adding to this array be mindful of security concerns.
555
- $nav_element_context = data_wp_context(
554
+ $nav_element_context = wp_interactivity_data_wp_context(
556
555
  array(
557
- 'overlayOpenedBy' => array(),
556
+ 'overlayOpenedBy' => array(
557
+ 'click' => false,
558
+ 'hover' => false,
559
+ 'focus' => false,
560
+ ),
558
561
  'type' => 'overlay',
559
562
  'roleAttribute' => '',
560
563
  'ariaLabel' => __( 'Menu' ),
561
564
  )
562
565
  );
563
566
  $nav_element_directives = '
564
- data-wp-interactive="core/navigation"'
567
+ data-wp-interactive="core/navigation" '
565
568
  . $nav_element_context;
566
569
 
567
570
  return $nav_element_directives;
@@ -764,7 +767,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
764
767
  ) ) {
765
768
  // Add directives to the parent `<li>`.
766
769
  $tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
767
- $tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": {}, "type": "submenu" }' );
770
+ $tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": { "click": false, "hover": false, "focus": false }, "type": "submenu" }' );
768
771
  $tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
769
772
  $tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
770
773
  $tags->set_attribute( 'data-wp-on--keydown', 'actions.handleMenuKeydown' );
@@ -1454,13 +1457,18 @@ function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks
1454
1457
  /**
1455
1458
  * Updates the post meta with the list of ignored hooked blocks when the navigation is created or updated via the REST API.
1456
1459
  *
1457
- * @param WP_Post $post Post object.
1460
+ * @param stdClass $post Post object.
1458
1461
  */
1459
1462
  function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
1460
1463
  // We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
1461
1464
  // all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
1462
1465
  $blocks = parse_blocks( $post->post_content );
1463
- $markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, $post );
1466
+
1467
+ // Block Hooks logic requires a `WP_Post` object (rather than the `stdClass` with the updates that
1468
+ // we're getting from the `rest_pre_insert_wp_navigation` filter) as its second argument (to be
1469
+ // used as context for hooked blocks insertion).
1470
+ // We thus have to look it up from the DB,based on `$post->ID`.
1471
+ $markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, get_post( $post->ID ) );
1464
1472
 
1465
1473
  $root_nav_block = parse_blocks( $markup )[0];
1466
1474
  $ignored_hooked_blocks = isset( $root_nav_block['attrs']['metadata']['ignoredHookedBlocks'] )
@@ -1476,14 +1484,8 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
1476
1484
  update_post_meta( $post->ID, '_wp_ignored_hooked_blocks', json_encode( $ignored_hooked_blocks ) );
1477
1485
  }
1478
1486
 
1479
- $serialized_inner_blocks = block_core_navigation_remove_serialized_parent_block( $markup );
1480
-
1481
- wp_update_post(
1482
- array(
1483
- 'ID' => $post->ID,
1484
- 'post_content' => $serialized_inner_blocks,
1485
- )
1486
- );
1487
+ $post->post_content = block_core_navigation_remove_serialized_parent_block( $markup );
1488
+ return $post;
1487
1489
  }
1488
1490
 
1489
1491
  // Before adding our filter, we verify if it's already added in Core.
@@ -1493,8 +1495,15 @@ $rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ig
1493
1495
 
1494
1496
  // Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
1495
1497
  // that are not present in Gutenberg's WP 6.5 compatibility layer.
1496
- if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1497
- add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
1498
+ if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1499
+ add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10 );
1500
+ }
1501
+
1502
+ // Previous versions of Gutenberg and WordPress 6.5 Betas were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
1503
+ // function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
1504
+ // To avoid collisions, we need to remove the filter from that action if it's present.
1505
+ if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1506
+ remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback, 10 );
1498
1507
  }
1499
1508
 
1500
1509
  /**
@@ -137,7 +137,7 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
137
137
  clientId={ clientId }
138
138
  isAppender={ false }
139
139
  prioritizePatterns={ false }
140
- selectBlockOnInsert={ true }
140
+ selectBlockOnInsert
141
141
  hasSearch={ false }
142
142
  onSelect={ onSelectBlock }
143
143
  />
@@ -247,7 +247,7 @@ export function LinkUI( props ) {
247
247
  hasTextControl
248
248
  hasRichPreviews
249
249
  value={ link }
250
- showInitialSuggestions={ true }
250
+ showInitialSuggestions
251
251
  withCreateSuggestion={ userCanCreate }
252
252
  createSuggestion={ handleCreate }
253
253
  createSuggestionButtonText={ ( searchTerm ) => {
@@ -65,7 +65,7 @@ function ParagraphBlock( {
65
65
  identifier="content"
66
66
  tagName="p"
67
67
  value={ content }
68
- deleteEnter={ true }
68
+ deleteEnter
69
69
  style={ styles }
70
70
  onChange={ ( nextContent ) => {
71
71
  setAttributes( {
@@ -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();
@@ -97,6 +97,20 @@ const PatternEdit = ( { attributes, clientId } ) => {
97
97
  injectThemeAttributeInBlockTemplateContent( block )
98
98
  )
99
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
+ }
100
114
  const rootEditingMode = getBlockEditingMode( rootClientId );
101
115
  registry.batch( () => {
102
116
  // Temporarily set the root block to default mode to allow replacing the pattern.
@@ -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
@@ -24,6 +24,7 @@ import {
24
24
  useBlockProps,
25
25
  store as blockEditorStore,
26
26
  __experimentalUseBorderProps as useBorderProps,
27
+ useBlockEditingMode,
27
28
  } from '@wordpress/block-editor';
28
29
  import { useMemo } from '@wordpress/element';
29
30
  import { __, sprintf } from '@wordpress/i18n';
@@ -143,6 +144,7 @@ export default function PostFeaturedImageEdit( {
143
144
  style: { width, height, aspectRatio },
144
145
  } );
145
146
  const borderProps = useBorderProps( attributes );
147
+ const blockEditingMode = useBlockEditingMode();
146
148
 
147
149
  const placeholder = ( content ) => {
148
150
  return (
@@ -151,7 +153,7 @@ export default function PostFeaturedImageEdit( {
151
153
  'block-editor-media-placeholder',
152
154
  borderProps.className
153
155
  ) }
154
- withIllustration={ true }
156
+ withIllustration
155
157
  style={ {
156
158
  height: !! aspectRatio && '100%',
157
159
  width: !! aspectRatio && '100%',
@@ -174,8 +176,13 @@ export default function PostFeaturedImageEdit( {
174
176
  createErrorNotice( message, { type: 'snackbar' } );
175
177
  };
176
178
 
177
- const controls = (
179
+ const controls = blockEditingMode === 'default' && (
178
180
  <>
181
+ <Overlay
182
+ attributes={ attributes }
183
+ setAttributes={ setAttributes }
184
+ clientId={ clientId }
185
+ />
179
186
  <DimensionControls
180
187
  clientId={ clientId }
181
188
  attributes={ attributes }
@@ -224,6 +231,7 @@ export default function PostFeaturedImageEdit( {
224
231
  </InspectorControls>
225
232
  </>
226
233
  );
234
+
227
235
  let image;
228
236
 
229
237
  /**
@@ -251,11 +259,6 @@ export default function PostFeaturedImageEdit( {
251
259
  ) : (
252
260
  placeholder()
253
261
  ) }
254
- <Overlay
255
- attributes={ attributes }
256
- setAttributes={ setAttributes }
257
- clientId={ clientId }
258
- />
259
262
  </div>
260
263
  </>
261
264
  );
@@ -360,11 +363,6 @@ export default function PostFeaturedImageEdit( {
360
363
  ) : (
361
364
  image
362
365
  ) }
363
- <Overlay
364
- attributes={ attributes }
365
- setAttributes={ setAttributes }
366
- clientId={ clientId }
367
- />
368
366
  </figure>
369
367
  </>
370
368
  );
@@ -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.
@@ -115,53 +115,59 @@ export default function PostTitleEdit( {
115
115
  return (
116
116
  <>
117
117
  { blockEditingMode === 'default' && (
118
- <BlockControls group="block">
119
- <HeadingLevelDropdown
120
- value={ level }
121
- onChange={ ( newLevel ) =>
122
- setAttributes( { level: newLevel } )
123
- }
124
- />
125
- <AlignmentControl
126
- value={ textAlign }
127
- onChange={ ( nextAlign ) => {
128
- setAttributes( { textAlign: nextAlign } );
129
- } }
130
- />
131
- </BlockControls>
132
- ) }
133
- <InspectorControls>
134
- <PanelBody title={ __( 'Settings' ) }>
135
- <ToggleControl
136
- __nextHasNoMarginBottom
137
- label={ __( 'Make title a link' ) }
138
- onChange={ () => setAttributes( { isLink: ! isLink } ) }
139
- checked={ isLink }
140
- />
141
- { isLink && (
142
- <>
118
+ <>
119
+ <BlockControls group="block">
120
+ <HeadingLevelDropdown
121
+ value={ level }
122
+ onChange={ ( newLevel ) =>
123
+ setAttributes( { level: newLevel } )
124
+ }
125
+ />
126
+ <AlignmentControl
127
+ value={ textAlign }
128
+ onChange={ ( nextAlign ) => {
129
+ setAttributes( { textAlign: nextAlign } );
130
+ } }
131
+ />
132
+ </BlockControls>
133
+ <InspectorControls>
134
+ <PanelBody title={ __( 'Settings' ) }>
143
135
  <ToggleControl
144
136
  __nextHasNoMarginBottom
145
- label={ __( 'Open in new tab' ) }
146
- onChange={ ( value ) =>
147
- setAttributes( {
148
- linkTarget: value ? '_blank' : '_self',
149
- } )
137
+ label={ __( 'Make title a link' ) }
138
+ onChange={ () =>
139
+ setAttributes( { isLink: ! isLink } )
150
140
  }
151
- checked={ linkTarget === '_blank' }
141
+ checked={ isLink }
152
142
  />
153
- <TextControl
154
- __nextHasNoMarginBottom
155
- label={ __( 'Link rel' ) }
156
- value={ rel }
157
- onChange={ ( newRel ) =>
158
- setAttributes( { rel: newRel } )
159
- }
160
- />
161
- </>
162
- ) }
163
- </PanelBody>
164
- </InspectorControls>
143
+ { isLink && (
144
+ <>
145
+ <ToggleControl
146
+ __nextHasNoMarginBottom
147
+ label={ __( 'Open in new tab' ) }
148
+ onChange={ ( value ) =>
149
+ setAttributes( {
150
+ linkTarget: value
151
+ ? '_blank'
152
+ : '_self',
153
+ } )
154
+ }
155
+ checked={ linkTarget === '_blank' }
156
+ />
157
+ <TextControl
158
+ __nextHasNoMarginBottom
159
+ label={ __( 'Link rel' ) }
160
+ value={ rel }
161
+ onChange={ ( newRel ) =>
162
+ setAttributes( { rel: newRel } )
163
+ }
164
+ />
165
+ </>
166
+ ) }
167
+ </PanelBody>
168
+ </InspectorControls>
169
+ </>
170
+ ) }
165
171
  { titleElement }
166
172
  </>
167
173
  );
@@ -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
  },