@wordpress/block-library 7.0.1 → 7.1.0-next.e230fbab09.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 (608) hide show
  1. package/README.md +16 -0
  2. package/build/audio/edit.js +4 -4
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/audio/edit.native.js +4 -4
  5. package/build/audio/edit.native.js.map +1 -1
  6. package/build/audio/transforms.js +1 -1
  7. package/build/audio/transforms.js.map +1 -1
  8. package/build/block/edit.js +3 -9
  9. package/build/block/edit.js.map +1 -1
  10. package/build/button/edit.js +3 -2
  11. package/build/button/edit.js.map +1 -1
  12. package/build/button/edit.native.js +4 -4
  13. package/build/button/edit.native.js.map +1 -1
  14. package/build/buttons/transforms.js +8 -8
  15. package/build/buttons/transforms.js.map +1 -1
  16. package/build/categories/edit.js +15 -26
  17. package/build/categories/edit.js.map +1 -1
  18. package/build/code/index.js +0 -1
  19. package/build/code/index.js.map +1 -1
  20. package/build/columns/columnCalculations.native.js +1 -1
  21. package/build/columns/columnCalculations.native.js.map +1 -1
  22. package/build/columns/edit.js +1 -1
  23. package/build/columns/edit.js.map +1 -1
  24. package/build/columns/edit.native.js +3 -3
  25. package/build/columns/edit.native.js.map +1 -1
  26. package/build/columns/index.js +12 -0
  27. package/build/columns/index.js.map +1 -1
  28. package/build/comment-author-avatar/edit.js +17 -4
  29. package/build/comment-author-avatar/edit.js.map +1 -1
  30. package/build/comment-template/edit.js +94 -36
  31. package/build/comment-template/edit.js.map +1 -1
  32. package/build/comment-template/hooks.js +175 -0
  33. package/build/comment-template/hooks.js.map +1 -0
  34. package/build/comment-template/index.js +1 -1
  35. package/build/comment-template/util.js.map +1 -1
  36. package/build/comments-pagination-next/index.js +1 -1
  37. package/build/comments-pagination-numbers/index.js +1 -1
  38. package/build/comments-query-loop/edit/comments-inspector-controls.js +20 -9
  39. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  40. package/build/comments-query-loop/edit.js +1 -19
  41. package/build/comments-query-loop/edit.js.map +1 -1
  42. package/build/comments-query-loop/index.js +5 -0
  43. package/build/comments-query-loop/index.js.map +1 -1
  44. package/build/cover/controls.native.js +5 -5
  45. package/build/cover/controls.native.js.map +1 -1
  46. package/build/cover/deprecated.js +188 -17
  47. package/build/cover/deprecated.js.map +1 -1
  48. package/build/cover/edit.js +29 -33
  49. package/build/cover/edit.js.map +1 -1
  50. package/build/cover/edit.native.js +15 -13
  51. package/build/cover/edit.native.js.map +1 -1
  52. package/build/cover/overlay-color-settings.native.js +7 -6
  53. package/build/cover/overlay-color-settings.native.js.map +1 -1
  54. package/build/cover/save.js +1 -1
  55. package/build/cover/save.js.map +1 -1
  56. package/build/cover/shared.js +2 -2
  57. package/build/cover/shared.js.map +1 -1
  58. package/build/cover/transforms.js +4 -2
  59. package/build/cover/transforms.js.map +1 -1
  60. package/build/embed/edit.js +1 -1
  61. package/build/embed/edit.js.map +1 -1
  62. package/build/embed/edit.native.js +1 -1
  63. package/build/embed/edit.native.js.map +1 -1
  64. package/build/embed/util.js +2 -2
  65. package/build/embed/util.js.map +1 -1
  66. package/build/embed/variations.js +1 -1
  67. package/build/embed/variations.js.map +1 -1
  68. package/build/file/edit.js +20 -17
  69. package/build/file/edit.js.map +1 -1
  70. package/build/file/edit.native.js +1 -1
  71. package/build/file/edit.native.js.map +1 -1
  72. package/build/file/save.js +7 -3
  73. package/build/file/save.js.map +1 -1
  74. package/build/freeform/edit.js +2 -2
  75. package/build/freeform/edit.js.map +1 -1
  76. package/build/gallery/edit.js +1 -1
  77. package/build/gallery/edit.js.map +1 -1
  78. package/build/gallery/gallery.native.js +1 -1
  79. package/build/gallery/gallery.native.js.map +1 -1
  80. package/build/gallery/v1/edit.js +3 -3
  81. package/build/gallery/v1/edit.js.map +1 -1
  82. package/build/gallery/v1/gallery-image.native.js +3 -3
  83. package/build/gallery/v1/gallery-image.native.js.map +1 -1
  84. package/build/gallery/v1/gallery.native.js +2 -2
  85. package/build/gallery/v1/gallery.native.js.map +1 -1
  86. package/build/group/index.js +4 -37
  87. package/build/group/index.js.map +1 -1
  88. package/build/group/transforms.js +45 -0
  89. package/build/group/transforms.js.map +1 -0
  90. package/build/heading/edit.js +14 -2
  91. package/build/heading/edit.js.map +1 -1
  92. package/build/home-link/edit.js +1 -1
  93. package/build/home-link/edit.js.map +1 -1
  94. package/build/image/deprecated.js +89 -5
  95. package/build/image/deprecated.js.map +1 -1
  96. package/build/image/edit.js +7 -6
  97. package/build/image/edit.js.map +1 -1
  98. package/build/image/edit.native.js +25 -10
  99. package/build/image/edit.native.js.map +1 -1
  100. package/build/image/save.js +0 -7
  101. package/build/image/save.js.map +1 -1
  102. package/build/image/transforms.js +1 -1
  103. package/build/image/transforms.js.map +1 -1
  104. package/build/index.js +3 -4
  105. package/build/index.js.map +1 -1
  106. package/build/index.native.js +2 -2
  107. package/build/index.native.js.map +1 -1
  108. package/build/latest-posts/edit.js +1 -0
  109. package/build/latest-posts/edit.js.map +1 -1
  110. package/build/media-text/edit.js +21 -2
  111. package/build/media-text/edit.js.map +1 -1
  112. package/build/media-text/edit.native.js +2 -2
  113. package/build/media-text/edit.native.js.map +1 -1
  114. package/build/media-text/media-container.native.js +1 -1
  115. package/build/media-text/media-container.native.js.map +1 -1
  116. package/build/missing/edit.native.js +1 -1
  117. package/build/missing/edit.native.js.map +1 -1
  118. package/build/more/transforms.js +2 -2
  119. package/build/more/transforms.js.map +1 -1
  120. package/build/navigation/edit/index.js +144 -68
  121. package/build/navigation/edit/index.js.map +1 -1
  122. package/build/navigation/edit/inner-blocks.js +8 -3
  123. package/build/navigation/edit/inner-blocks.js.map +1 -1
  124. package/build/navigation/edit/navigation-menu-selector.js +82 -52
  125. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  126. package/build/navigation/edit/placeholder/index.js +32 -61
  127. package/build/navigation/edit/placeholder/index.js.map +1 -1
  128. package/build/navigation/edit/placeholder/placeholder-preview.js +3 -12
  129. package/build/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
  130. package/build/navigation/edit/unsaved-inner-blocks.js +3 -1
  131. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  132. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +120 -0
  133. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -0
  134. package/build/navigation/edit/use-create-navigation-menu.js +53 -4
  135. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  136. package/build/navigation/edit/use-navigation-notice.js +3 -3
  137. package/build/navigation/edit/use-navigation-notice.js.map +1 -1
  138. package/build/navigation/menu-items-to-blocks.js +1 -1
  139. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  140. package/build/navigation/use-navigation-entities.js +25 -49
  141. package/build/navigation/use-navigation-entities.js.map +1 -1
  142. package/build/navigation/use-navigation-menu.js +8 -6
  143. package/build/navigation/use-navigation-menu.js.map +1 -1
  144. package/build/navigation-link/fallback-variations.js +1 -1
  145. package/build/navigation-link/fallback-variations.js.map +1 -1
  146. package/build/navigation-link/hooks.js +2 -2
  147. package/build/navigation-link/hooks.js.map +1 -1
  148. package/build/navigation-submenu/edit.js +43 -11
  149. package/build/navigation-submenu/edit.js.map +1 -1
  150. package/build/page-list/convert-to-links-modal.js +13 -23
  151. package/build/page-list/convert-to-links-modal.js.map +1 -1
  152. package/build/page-list/edit.js +19 -39
  153. package/build/page-list/edit.js.map +1 -1
  154. package/build/post-author-name/edit.js +2 -1
  155. package/build/post-author-name/edit.js.map +1 -1
  156. package/build/post-comments-form/edit.js +3 -1
  157. package/build/post-comments-form/edit.js.map +1 -1
  158. package/build/post-excerpt/edit.js +7 -4
  159. package/build/post-excerpt/edit.js.map +1 -1
  160. package/build/post-terms/edit.js +3 -1
  161. package/build/post-terms/edit.js.map +1 -1
  162. package/build/query-title/edit.js +0 -1
  163. package/build/query-title/edit.js.map +1 -1
  164. package/build/search/edit.js +4 -1
  165. package/build/search/edit.js.map +1 -1
  166. package/build/search/edit.native.js +1 -1
  167. package/build/search/edit.native.js.map +1 -1
  168. package/build/separator/save.js +4 -4
  169. package/build/separator/save.js.map +1 -1
  170. package/build/separator/separator-settings.native.js +1 -1
  171. package/build/separator/separator-settings.native.js.map +1 -1
  172. package/build/site-logo/edit.js +1 -1
  173. package/build/site-logo/edit.js.map +1 -1
  174. package/build/social-link/edit.native.js +11 -3
  175. package/build/social-link/edit.native.js.map +1 -1
  176. package/build/social-links/deprecated.js +1 -62
  177. package/build/social-links/deprecated.js.map +1 -1
  178. package/build/spacer/controls.js +5 -5
  179. package/build/spacer/controls.js.map +1 -1
  180. package/build/spacer/controls.native.js +5 -5
  181. package/build/spacer/controls.native.js.map +1 -1
  182. package/build/table/edit.js +2 -2
  183. package/build/table/edit.js.map +1 -1
  184. package/build/template-part/edit/index.js +36 -64
  185. package/build/template-part/edit/index.js.map +1 -1
  186. package/build/template-part/edit/placeholder.js +64 -0
  187. package/build/template-part/edit/placeholder.js.map +1 -0
  188. package/build/template-part/edit/selection-modal.js +103 -0
  189. package/build/template-part/edit/selection-modal.js.map +1 -0
  190. package/build/template-part/edit/title-modal.js +54 -0
  191. package/build/template-part/edit/title-modal.js.map +1 -0
  192. package/build/template-part/edit/utils/hooks.js +156 -0
  193. package/build/template-part/edit/utils/hooks.js.map +1 -0
  194. package/build/template-part/index.js +3 -1
  195. package/build/template-part/index.js.map +1 -1
  196. package/build/video/edit.js +4 -4
  197. package/build/video/edit.js.map +1 -1
  198. package/build/video/edit.native.js +3 -3
  199. package/build/video/edit.native.js.map +1 -1
  200. package/build-module/audio/edit.js +4 -4
  201. package/build-module/audio/edit.js.map +1 -1
  202. package/build-module/audio/edit.native.js +4 -4
  203. package/build-module/audio/edit.native.js.map +1 -1
  204. package/build-module/audio/transforms.js +1 -1
  205. package/build-module/audio/transforms.js.map +1 -1
  206. package/build-module/block/edit.js +5 -11
  207. package/build-module/block/edit.js.map +1 -1
  208. package/build-module/button/edit.js +3 -2
  209. package/build-module/button/edit.js.map +1 -1
  210. package/build-module/button/edit.native.js +6 -6
  211. package/build-module/button/edit.native.js.map +1 -1
  212. package/build-module/buttons/transforms.js +8 -8
  213. package/build-module/buttons/transforms.js.map +1 -1
  214. package/build-module/categories/edit.js +15 -25
  215. package/build-module/categories/edit.js.map +1 -1
  216. package/build-module/code/index.js +0 -1
  217. package/build-module/code/index.js.map +1 -1
  218. package/build-module/columns/columnCalculations.native.js +1 -1
  219. package/build-module/columns/columnCalculations.native.js.map +1 -1
  220. package/build-module/columns/edit.js +1 -1
  221. package/build-module/columns/edit.js.map +1 -1
  222. package/build-module/columns/edit.native.js +3 -3
  223. package/build-module/columns/edit.native.js.map +1 -1
  224. package/build-module/columns/index.js +12 -0
  225. package/build-module/columns/index.js.map +1 -1
  226. package/build-module/comment-author-avatar/edit.js +18 -6
  227. package/build-module/comment-author-avatar/edit.js.map +1 -1
  228. package/build-module/comment-template/edit.js +95 -37
  229. package/build-module/comment-template/edit.js.map +1 -1
  230. package/build-module/comment-template/hooks.js +156 -0
  231. package/build-module/comment-template/hooks.js.map +1 -0
  232. package/build-module/comment-template/index.js +1 -1
  233. package/build-module/comment-template/util.js.map +1 -1
  234. package/build-module/comments-pagination-next/index.js +1 -1
  235. package/build-module/comments-pagination-numbers/index.js +1 -1
  236. package/build-module/comments-query-loop/edit/comments-inspector-controls.js +20 -9
  237. package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  238. package/build-module/comments-query-loop/edit.js +2 -19
  239. package/build-module/comments-query-loop/edit.js.map +1 -1
  240. package/build-module/comments-query-loop/index.js +5 -0
  241. package/build-module/comments-query-loop/index.js.map +1 -1
  242. package/build-module/cover/controls.native.js +5 -5
  243. package/build-module/cover/controls.native.js.map +1 -1
  244. package/build-module/cover/deprecated.js +190 -17
  245. package/build-module/cover/deprecated.js.map +1 -1
  246. package/build-module/cover/edit.js +31 -35
  247. package/build-module/cover/edit.js.map +1 -1
  248. package/build-module/cover/edit.native.js +18 -16
  249. package/build-module/cover/edit.native.js.map +1 -1
  250. package/build-module/cover/overlay-color-settings.native.js +7 -7
  251. package/build-module/cover/overlay-color-settings.native.js.map +1 -1
  252. package/build-module/cover/save.js +1 -1
  253. package/build-module/cover/save.js.map +1 -1
  254. package/build-module/cover/shared.js +2 -2
  255. package/build-module/cover/shared.js.map +1 -1
  256. package/build-module/cover/transforms.js +4 -2
  257. package/build-module/cover/transforms.js.map +1 -1
  258. package/build-module/embed/edit.js +1 -1
  259. package/build-module/embed/edit.js.map +1 -1
  260. package/build-module/embed/edit.native.js +1 -1
  261. package/build-module/embed/edit.native.js.map +1 -1
  262. package/build-module/embed/util.js +2 -2
  263. package/build-module/embed/util.js.map +1 -1
  264. package/build-module/embed/variations.js +1 -1
  265. package/build-module/embed/variations.js.map +1 -1
  266. package/build-module/file/edit.js +21 -18
  267. package/build-module/file/edit.js.map +1 -1
  268. package/build-module/file/edit.native.js +1 -1
  269. package/build-module/file/edit.native.js.map +1 -1
  270. package/build-module/file/save.js +7 -3
  271. package/build-module/file/save.js.map +1 -1
  272. package/build-module/freeform/edit.js +2 -2
  273. package/build-module/freeform/edit.js.map +1 -1
  274. package/build-module/gallery/edit.js +1 -1
  275. package/build-module/gallery/edit.js.map +1 -1
  276. package/build-module/gallery/gallery.native.js +1 -1
  277. package/build-module/gallery/gallery.native.js.map +1 -1
  278. package/build-module/gallery/v1/edit.js +3 -3
  279. package/build-module/gallery/v1/edit.js.map +1 -1
  280. package/build-module/gallery/v1/gallery-image.native.js +3 -3
  281. package/build-module/gallery/v1/gallery-image.native.js.map +1 -1
  282. package/build-module/gallery/v1/gallery.native.js +2 -2
  283. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  284. package/build-module/group/index.js +3 -36
  285. package/build-module/group/index.js.map +1 -1
  286. package/build-module/group/transforms.js +36 -0
  287. package/build-module/group/transforms.js.map +1 -0
  288. package/build-module/heading/edit.js +15 -3
  289. package/build-module/heading/edit.js.map +1 -1
  290. package/build-module/home-link/edit.js +1 -1
  291. package/build-module/home-link/edit.js.map +1 -1
  292. package/build-module/image/deprecated.js +90 -7
  293. package/build-module/image/deprecated.js.map +1 -1
  294. package/build-module/image/edit.js +7 -6
  295. package/build-module/image/edit.js.map +1 -1
  296. package/build-module/image/edit.native.js +25 -10
  297. package/build-module/image/edit.native.js.map +1 -1
  298. package/build-module/image/save.js +0 -7
  299. package/build-module/image/save.js.map +1 -1
  300. package/build-module/image/transforms.js +1 -1
  301. package/build-module/image/transforms.js.map +1 -1
  302. package/build-module/index.js +4 -5
  303. package/build-module/index.js.map +1 -1
  304. package/build-module/index.native.js +2 -2
  305. package/build-module/index.native.js.map +1 -1
  306. package/build-module/latest-posts/edit.js +1 -0
  307. package/build-module/latest-posts/edit.js.map +1 -1
  308. package/build-module/media-text/edit.js +20 -2
  309. package/build-module/media-text/edit.js.map +1 -1
  310. package/build-module/media-text/edit.native.js +2 -2
  311. package/build-module/media-text/edit.native.js.map +1 -1
  312. package/build-module/media-text/media-container.native.js +1 -1
  313. package/build-module/media-text/media-container.native.js.map +1 -1
  314. package/build-module/missing/edit.native.js +1 -1
  315. package/build-module/missing/edit.native.js.map +1 -1
  316. package/build-module/more/transforms.js +2 -2
  317. package/build-module/more/transforms.js.map +1 -1
  318. package/build-module/navigation/edit/index.js +138 -68
  319. package/build-module/navigation/edit/index.js.map +1 -1
  320. package/build-module/navigation/edit/inner-blocks.js +8 -3
  321. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  322. package/build-module/navigation/edit/navigation-menu-selector.js +82 -48
  323. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  324. package/build-module/navigation/edit/placeholder/index.js +33 -59
  325. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  326. package/build-module/navigation/edit/placeholder/placeholder-preview.js +3 -9
  327. package/build-module/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
  328. package/build-module/navigation/edit/unsaved-inner-blocks.js +3 -1
  329. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  330. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +100 -0
  331. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -0
  332. package/build-module/navigation/edit/use-create-navigation-menu.js +48 -5
  333. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  334. package/build-module/navigation/edit/use-navigation-notice.js +3 -3
  335. package/build-module/navigation/edit/use-navigation-notice.js.map +1 -1
  336. package/build-module/navigation/menu-items-to-blocks.js +1 -1
  337. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  338. package/build-module/navigation/use-navigation-entities.js +26 -50
  339. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  340. package/build-module/navigation/use-navigation-menu.js +8 -6
  341. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  342. package/build-module/navigation-link/fallback-variations.js +1 -1
  343. package/build-module/navigation-link/fallback-variations.js.map +1 -1
  344. package/build-module/navigation-link/hooks.js +2 -2
  345. package/build-module/navigation-link/hooks.js.map +1 -1
  346. package/build-module/navigation-submenu/edit.js +43 -12
  347. package/build-module/navigation-submenu/edit.js.map +1 -1
  348. package/build-module/page-list/convert-to-links-modal.js +15 -25
  349. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  350. package/build-module/page-list/edit.js +21 -41
  351. package/build-module/page-list/edit.js.map +1 -1
  352. package/build-module/post-author-name/edit.js +2 -1
  353. package/build-module/post-author-name/edit.js.map +1 -1
  354. package/build-module/post-comments-form/edit.js +4 -2
  355. package/build-module/post-comments-form/edit.js.map +1 -1
  356. package/build-module/post-excerpt/edit.js +9 -6
  357. package/build-module/post-excerpt/edit.js.map +1 -1
  358. package/build-module/post-terms/edit.js +2 -1
  359. package/build-module/post-terms/edit.js.map +1 -1
  360. package/build-module/query-title/edit.js +0 -1
  361. package/build-module/query-title/edit.js.map +1 -1
  362. package/build-module/search/edit.js +3 -1
  363. package/build-module/search/edit.js.map +1 -1
  364. package/build-module/search/edit.native.js +1 -1
  365. package/build-module/search/edit.native.js.map +1 -1
  366. package/build-module/separator/save.js +4 -4
  367. package/build-module/separator/save.js.map +1 -1
  368. package/build-module/separator/separator-settings.native.js +1 -1
  369. package/build-module/separator/separator-settings.native.js.map +1 -1
  370. package/build-module/site-logo/edit.js +1 -1
  371. package/build-module/site-logo/edit.js.map +1 -1
  372. package/build-module/social-link/edit.native.js +11 -3
  373. package/build-module/social-link/edit.native.js.map +1 -1
  374. package/build-module/social-links/deprecated.js +1 -62
  375. package/build-module/social-links/deprecated.js.map +1 -1
  376. package/build-module/spacer/controls.js +5 -5
  377. package/build-module/spacer/controls.js.map +1 -1
  378. package/build-module/spacer/controls.native.js +5 -5
  379. package/build-module/spacer/controls.native.js.map +1 -1
  380. package/build-module/table/edit.js +2 -2
  381. package/build-module/table/edit.js.map +1 -1
  382. package/build-module/template-part/edit/index.js +37 -65
  383. package/build-module/template-part/edit/index.js.map +1 -1
  384. package/build-module/template-part/edit/placeholder.js +52 -0
  385. package/build-module/template-part/edit/placeholder.js.map +1 -0
  386. package/build-module/template-part/edit/selection-modal.js +89 -0
  387. package/build-module/template-part/edit/selection-modal.js.map +1 -0
  388. package/build-module/template-part/edit/title-modal.js +46 -0
  389. package/build-module/template-part/edit/title-modal.js.map +1 -0
  390. package/build-module/template-part/edit/utils/hooks.js +135 -0
  391. package/build-module/template-part/edit/utils/hooks.js.map +1 -0
  392. package/build-module/template-part/index.js +2 -1
  393. package/build-module/template-part/index.js.map +1 -1
  394. package/build-module/video/edit.js +4 -4
  395. package/build-module/video/edit.js.map +1 -1
  396. package/build-module/video/edit.native.js +3 -3
  397. package/build-module/video/edit.native.js.map +1 -1
  398. package/build-style/button/editor-rtl.css +0 -3
  399. package/build-style/button/editor.css +0 -3
  400. package/build-style/code/style-rtl.css +2 -1
  401. package/build-style/code/style.css +2 -1
  402. package/build-style/code/theme-rtl.css +0 -3
  403. package/build-style/code/theme.css +0 -3
  404. package/build-style/comment-author-avatar/editor-rtl.css +83 -0
  405. package/build-style/comment-author-avatar/editor.css +83 -0
  406. package/build-style/common-rtl.css +1 -1
  407. package/build-style/common.css +1 -1
  408. package/build-style/cover/style-rtl.css +5 -5
  409. package/build-style/cover/style.css +5 -5
  410. package/build-style/editor-rtl.css +43 -84
  411. package/build-style/editor.css +43 -84
  412. package/build-style/image/editor-rtl.css +0 -16
  413. package/build-style/image/editor.css +0 -16
  414. package/build-style/image/style-rtl.css +4 -1
  415. package/build-style/image/style.css +4 -1
  416. package/build-style/navigation/editor-rtl.css +16 -0
  417. package/build-style/navigation/editor.css +16 -0
  418. package/build-style/navigation/style-rtl.css +14 -3
  419. package/build-style/navigation/style.css +14 -3
  420. package/build-style/page-list/editor-rtl.css +0 -9
  421. package/build-style/page-list/editor.css +0 -9
  422. package/build-style/style-rtl.css +32 -13
  423. package/build-style/style.css +32 -13
  424. package/build-style/tag-cloud/style-rtl.css +6 -2
  425. package/build-style/tag-cloud/style.css +6 -2
  426. package/build-style/template-part/editor-rtl.css +19 -56
  427. package/build-style/template-part/editor.css +19 -56
  428. package/build-style/theme-rtl.css +0 -3
  429. package/build-style/theme.css +0 -3
  430. package/package.json +32 -28
  431. package/src/archives/index.php +1 -1
  432. package/src/audio/edit.js +4 -4
  433. package/src/audio/edit.native.js +4 -4
  434. package/src/audio/transforms.js +1 -1
  435. package/src/block/edit.js +7 -22
  436. package/src/block/test/edit.native.js +9 -9
  437. package/src/button/edit.js +2 -1
  438. package/src/button/edit.native.js +5 -5
  439. package/src/button/editor.scss +0 -5
  440. package/src/buttons/test/edit.native.js +3 -3
  441. package/src/buttons/transforms.js +8 -8
  442. package/src/categories/edit.js +12 -22
  443. package/src/code/block.json +0 -1
  444. package/src/code/style.scss +4 -2
  445. package/src/code/theme.scss +0 -3
  446. package/src/columns/block.json +12 -0
  447. package/src/columns/columnCalculations.native.js +1 -1
  448. package/src/columns/edit.js +1 -1
  449. package/src/columns/edit.native.js +3 -3
  450. package/src/comment-author-avatar/edit.js +13 -8
  451. package/src/comment-author-avatar/editor.scss +7 -0
  452. package/src/comment-template/block.json +7 -1
  453. package/src/comment-template/edit.js +102 -40
  454. package/src/comment-template/hooks.js +151 -0
  455. package/src/comment-template/index.php +8 -0
  456. package/src/comment-template/util.js +1 -0
  457. package/src/comments-pagination-next/block.json +8 -1
  458. package/src/comments-pagination-next/index.php +6 -8
  459. package/src/comments-pagination-numbers/block.json +7 -1
  460. package/src/comments-pagination-numbers/index.php +3 -10
  461. package/src/comments-query-loop/block.json +5 -0
  462. package/src/comments-query-loop/edit/comments-inspector-controls.js +22 -4
  463. package/src/comments-query-loop/edit.js +1 -16
  464. package/src/common.scss +1 -1
  465. package/src/cover/controls.native.js +1 -1
  466. package/src/cover/deprecated.js +214 -1
  467. package/src/cover/edit.js +21 -36
  468. package/src/cover/edit.native.js +23 -15
  469. package/src/cover/overlay-color-settings.native.js +6 -7
  470. package/src/cover/save.js +4 -3
  471. package/src/cover/shared.js +2 -2
  472. package/src/cover/style.scss +5 -3
  473. package/src/cover/test/edit.native.js +39 -39
  474. package/src/cover/transforms.js +2 -0
  475. package/src/editor.scss +1 -0
  476. package/src/embed/edit.js +1 -1
  477. package/src/embed/edit.native.js +1 -1
  478. package/src/embed/test/index.native.js +105 -105
  479. package/src/embed/util.js +2 -2
  480. package/src/embed/variations.js +1 -1
  481. package/src/file/edit.js +19 -17
  482. package/src/file/edit.native.js +1 -1
  483. package/src/file/save.js +9 -3
  484. package/src/file/style.native.scss +1 -0
  485. package/src/freeform/edit.js +2 -2
  486. package/src/gallery/edit.js +1 -1
  487. package/src/gallery/gallery.native.js +1 -1
  488. package/src/gallery/index.php +1 -8
  489. package/src/gallery/test/__snapshots__/index.native.js.snap +164 -0
  490. package/src/gallery/test/helpers.native.js +293 -0
  491. package/src/gallery/test/index.native.js +583 -65
  492. package/src/gallery/v1/edit.js +3 -4
  493. package/src/gallery/v1/gallery-image.native.js +3 -3
  494. package/src/gallery/v1/gallery.native.js +2 -2
  495. package/src/group/block.json +1 -0
  496. package/src/group/index.js +2 -54
  497. package/src/group/transforms.js +52 -0
  498. package/src/heading/edit.js +18 -5
  499. package/src/home-link/edit.js +1 -1
  500. package/src/home-link/index.php +1 -19
  501. package/src/image/deprecated.js +105 -1
  502. package/src/image/edit.js +7 -6
  503. package/src/image/edit.native.js +25 -8
  504. package/src/image/editor.scss +0 -18
  505. package/src/image/save.js +0 -8
  506. package/src/image/style.scss +5 -1
  507. package/src/image/test/edit.native.js +1 -11
  508. package/src/image/transforms.js +1 -1
  509. package/src/index.js +2 -3
  510. package/src/index.native.js +2 -2
  511. package/src/latest-posts/edit.js +1 -0
  512. package/src/latest-posts/index.php +1 -1
  513. package/src/media-text/edit.js +20 -2
  514. package/src/media-text/edit.native.js +2 -2
  515. package/src/media-text/media-container.native.js +1 -1
  516. package/src/media-text/style.native.scss +1 -0
  517. package/src/missing/edit.native.js +1 -1
  518. package/src/missing/test/edit-integration.native.js +4 -4
  519. package/src/missing/test/edit.native.js +2 -2
  520. package/src/more/transforms.js +2 -2
  521. package/src/navigation/edit/index.js +212 -88
  522. package/src/navigation/edit/inner-blocks.js +11 -4
  523. package/src/navigation/edit/navigation-menu-selector.js +121 -58
  524. package/src/navigation/edit/placeholder/index.js +64 -111
  525. package/src/navigation/edit/placeholder/placeholder-preview.js +3 -10
  526. package/src/navigation/edit/unsaved-inner-blocks.js +3 -1
  527. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +137 -0
  528. package/src/navigation/edit/use-create-navigation-menu.js +59 -8
  529. package/src/navigation/edit/use-navigation-notice.js +3 -3
  530. package/src/navigation/editor.scss +23 -1
  531. package/src/navigation/index.php +4 -4
  532. package/src/navigation/menu-items-to-blocks.js +1 -1
  533. package/src/navigation/style.scss +22 -3
  534. package/src/navigation/test/menu-items-to-blocks.js +1 -1
  535. package/src/navigation/use-navigation-entities.js +26 -60
  536. package/src/navigation/use-navigation-menu.js +11 -6
  537. package/src/navigation-link/fallback-variations.js +1 -1
  538. package/src/navigation-link/hooks.js +2 -2
  539. package/src/navigation-link/index.php +3 -22
  540. package/src/navigation-link/test/edit.js +5 -5
  541. package/src/navigation-submenu/edit.js +52 -14
  542. package/src/navigation-submenu/index.php +3 -21
  543. package/src/page-list/convert-to-links-modal.js +17 -31
  544. package/src/page-list/edit.js +35 -48
  545. package/src/page-list/editor.scss +0 -10
  546. package/src/page-list/index.php +4 -4
  547. package/src/post-author-name/edit.js +1 -0
  548. package/src/post-author-name/index.php +1 -1
  549. package/src/post-comments-form/edit.js +7 -3
  550. package/src/post-excerpt/edit.js +9 -12
  551. package/src/post-navigation-link/index.php +3 -3
  552. package/src/post-terms/edit.js +2 -1
  553. package/src/query-title/edit.js +0 -1
  554. package/src/search/edit.js +6 -0
  555. package/src/search/edit.native.js +1 -1
  556. package/src/search/index.php +8 -4
  557. package/src/search/test/edit.native.js +0 -1
  558. package/src/separator/save.js +4 -4
  559. package/src/separator/separator-settings.native.js +1 -1
  560. package/src/site-logo/edit.js +1 -1
  561. package/src/site-logo/index.php +1 -1
  562. package/src/social-link/edit.native.js +17 -8
  563. package/src/social-link/test/index.native.js +138 -0
  564. package/src/social-links/deprecated.js +0 -59
  565. package/src/spacer/controls.js +1 -1
  566. package/src/spacer/controls.native.js +1 -1
  567. package/src/table/edit.js +2 -2
  568. package/src/tag-cloud/style.scss +12 -7
  569. package/src/template-part/edit/index.js +61 -71
  570. package/src/template-part/edit/placeholder.js +78 -0
  571. package/src/template-part/edit/selection-modal.js +115 -0
  572. package/src/template-part/edit/title-modal.js +59 -0
  573. package/src/template-part/edit/utils/hooks.js +158 -0
  574. package/src/template-part/editor.scss +16 -74
  575. package/src/template-part/index.js +4 -1
  576. package/src/video/edit.js +4 -4
  577. package/src/video/edit.native.js +3 -3
  578. package/src/video/style.native.scss +1 -0
  579. package/build/navigation/edit/existing-menus-options.js +0 -62
  580. package/build/navigation/edit/existing-menus-options.js.map +0 -1
  581. package/build/navigation/use-convert-classic-menu.js +0 -59
  582. package/build/navigation/use-convert-classic-menu.js.map +0 -1
  583. package/build/template-part/edit/placeholder/index.js +0 -141
  584. package/build/template-part/edit/placeholder/index.js.map +0 -1
  585. package/build/template-part/edit/placeholder/patterns-setup.js +0 -100
  586. package/build/template-part/edit/placeholder/patterns-setup.js.map +0 -1
  587. package/build/template-part/edit/selection/index.js +0 -45
  588. package/build/template-part/edit/selection/index.js.map +0 -1
  589. package/build/template-part/edit/selection/template-part-previews.js +0 -317
  590. package/build/template-part/edit/selection/template-part-previews.js.map +0 -1
  591. package/build-module/navigation/edit/existing-menus-options.js +0 -53
  592. package/build-module/navigation/edit/existing-menus-options.js.map +0 -1
  593. package/build-module/navigation/use-convert-classic-menu.js +0 -47
  594. package/build-module/navigation/use-convert-classic-menu.js.map +0 -1
  595. package/build-module/template-part/edit/placeholder/index.js +0 -124
  596. package/build-module/template-part/edit/placeholder/index.js.map +0 -1
  597. package/build-module/template-part/edit/placeholder/patterns-setup.js +0 -91
  598. package/build-module/template-part/edit/placeholder/patterns-setup.js.map +0 -1
  599. package/build-module/template-part/edit/selection/index.js +0 -35
  600. package/build-module/template-part/edit/selection/index.js.map +0 -1
  601. package/build-module/template-part/edit/selection/template-part-previews.js +0 -298
  602. package/build-module/template-part/edit/selection/template-part-previews.js.map +0 -1
  603. package/src/navigation/edit/existing-menus-options.js +0 -70
  604. package/src/navigation/use-convert-classic-menu.js +0 -58
  605. package/src/template-part/edit/placeholder/index.js +0 -172
  606. package/src/template-part/edit/placeholder/patterns-setup.js +0 -124
  607. package/src/template-part/edit/selection/index.js +0 -37
  608. package/src/template-part/edit/selection/template-part-previews.js +0 -372
@@ -17,7 +17,6 @@ import {
17
17
  getColorObjectByAttributeValues,
18
18
  getGradientValueBySlug,
19
19
  __experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
20
- useSetting,
21
20
  } from '@wordpress/block-editor';
22
21
  import {
23
22
  PanelBody,
@@ -29,6 +28,7 @@ import {
29
28
  BottomSheetSelectControl,
30
29
  CSS_UNITS,
31
30
  filterUnitsWithSettings,
31
+ useMobileGlobalStylesColors,
32
32
  } from '@wordpress/components';
33
33
  import { link } from '@wordpress/icons';
34
34
  import { store as editPostStore } from '@wordpress/edit-post';
@@ -59,7 +59,7 @@ function WidthPanel( { selectedWidth, setAttributes } ) {
59
59
  if ( newWidth === 'auto' ) {
60
60
  width = undefined;
61
61
  }
62
- // Update attributes
62
+ // Update attributes.
63
63
  setAttributes( { width } );
64
64
  }
65
65
 
@@ -118,8 +118,8 @@ function ButtonEdit( props ) {
118
118
  const [ borderRadiusUnit, setBorderRadiusUnit ] = useState( valueUnit );
119
119
 
120
120
  const richTextRef = useRef();
121
- const colors = useSetting( 'color.palette' ) || [];
122
- const gradients = useSetting( 'color.gradients' ) || [];
121
+ const colors = useMobileGlobalStylesColors();
122
+ const gradients = useMobileGlobalStylesColors( 'gradients' );
123
123
 
124
124
  useEffect( () => {
125
125
  if ( isSelected ) {
@@ -435,7 +435,7 @@ function ButtonEdit( props ) {
435
435
  const buttonBorderRadiusValue =
436
436
  borderRadiusUnit === 'px' || borderRadiusUnit === '%'
437
437
  ? borderRadiusValue
438
- : Math.floor( 14 * borderRadiusValue ); // lets assume that the font size is set to 14px; TO get a nicer preview.
438
+ : Math.floor( 14 * borderRadiusValue ); // Lets assume that the font size is set to 14px; TO get a nicer preview.
439
439
  const outlineBorderRadius =
440
440
  buttonBorderRadiusValue > 0
441
441
  ? buttonBorderRadiusValue + spacing + borderWidth
@@ -13,11 +13,6 @@
13
13
  position: relative;
14
14
  cursor: text;
15
15
 
16
- // Make placeholder text white unless custom colors or outline versions are chosen.
17
- &:not(.has-text-color):not(.is-style-outline) [data-rich-text-placeholder]::after {
18
- color: $white;
19
- }
20
-
21
16
  // Add outline to button on focus to indicate focus-state
22
17
  &:focus {
23
18
  box-shadow: 0 0 0 1px $white, 0 0 0 3px var(--wp-admin-theme-color);
@@ -16,12 +16,12 @@ import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
16
16
  import { registerCoreBlocks } from '@wordpress/block-library';
17
17
 
18
18
  beforeAll( () => {
19
- // Register all core blocks
19
+ // Register all core blocks.
20
20
  registerCoreBlocks();
21
21
  } );
22
22
 
23
23
  afterAll( () => {
24
- // Clean up registered blocks
24
+ // Clean up registered blocks.
25
25
  getBlockTypes().forEach( ( block ) => {
26
26
  unregisterBlockType( block.name );
27
27
  } );
@@ -103,7 +103,7 @@ describe( 'Buttons block', () => {
103
103
  getByA11yLabel( 'Change items justification' )
104
104
  );
105
105
 
106
- // Select alignment option
106
+ // Select alignment option.
107
107
  fireEvent.press(
108
108
  await waitFor( () => getByText( justificationOption ) )
109
109
  );
@@ -16,13 +16,13 @@ const transforms = {
16
16
  isMultiBlock: true,
17
17
  blocks: [ 'core/button' ],
18
18
  transform: ( buttons ) =>
19
- // Creates the buttons block
19
+ // Creates the buttons block.
20
20
  createBlock(
21
21
  name,
22
22
  {},
23
- // Loop the selected buttons
23
+ // Loop the selected buttons.
24
24
  buttons.map( ( attributes ) =>
25
- // Create singular button in the buttons block
25
+ // Create singular button in the buttons block.
26
26
  createBlock( 'core/button', attributes )
27
27
  )
28
28
  ),
@@ -32,22 +32,22 @@ const transforms = {
32
32
  isMultiBlock: true,
33
33
  blocks: [ 'core/paragraph' ],
34
34
  transform: ( buttons ) =>
35
- // Creates the buttons block
35
+ // Creates the buttons block.
36
36
  createBlock(
37
37
  name,
38
38
  {},
39
- // Loop the selected buttons
39
+ // Loop the selected buttons.
40
40
  buttons.map( ( attributes ) => {
41
41
  const element = createElement(
42
42
  document,
43
43
  attributes.content
44
44
  );
45
- // Remove any HTML tags
45
+ // Remove any HTML tags.
46
46
  const text = element.innerText || '';
47
- // Get first url
47
+ // Get first url.
48
48
  const link = element.querySelector( 'a' );
49
49
  const url = link?.getAttribute( 'href' );
50
- // Create singular button in the buttons block
50
+ // Create singular button in the buttons block.
51
51
  return createBlock( 'core/button', {
52
52
  text,
53
53
  url,
@@ -14,11 +14,10 @@ import {
14
14
  VisuallyHidden,
15
15
  } from '@wordpress/components';
16
16
  import { useInstanceId } from '@wordpress/compose';
17
- import { useSelect } from '@wordpress/data';
18
17
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
19
18
  import { __ } from '@wordpress/i18n';
20
19
  import { pin } from '@wordpress/icons';
21
- import { store as coreStore } from '@wordpress/core-data';
20
+ import { __experimentalUseEntityRecords as useEntityRecords } from '@wordpress/core-data';
22
21
 
23
22
  export default function CategoriesEdit( {
24
23
  attributes: {
@@ -30,23 +29,14 @@ export default function CategoriesEdit( {
30
29
  setAttributes,
31
30
  } ) {
32
31
  const selectId = useInstanceId( CategoriesEdit, 'blocks-category-select' );
33
- const { categories, isRequesting } = useSelect(
34
- ( select ) => {
35
- const { getEntityRecords, isResolving } = select( coreStore );
36
- const query = { per_page: -1, hide_empty: true, context: 'view' };
37
- if ( showOnlyTopLevel ) {
38
- query.parent = 0;
39
- }
40
- return {
41
- categories: getEntityRecords( 'taxonomy', 'category', query ),
42
- isRequesting: isResolving( 'getEntityRecords', [
43
- 'taxonomy',
44
- 'category',
45
- query,
46
- ] ),
47
- };
48
- },
49
- [ showOnlyTopLevel ]
32
+ const query = { per_page: -1, hide_empty: true, context: 'view' };
33
+ if ( showOnlyTopLevel ) {
34
+ query.parent = 0;
35
+ }
36
+ const { records: categories, isResolving } = useEntityRecords(
37
+ 'taxonomy',
38
+ 'category',
39
+ query
50
40
  );
51
41
  const getCategoriesList = ( parentId ) => {
52
42
  if ( ! categories?.length ) {
@@ -163,19 +153,19 @@ export default function CategoriesEdit( {
163
153
  ) }
164
154
  </PanelBody>
165
155
  </InspectorControls>
166
- { isRequesting && (
156
+ { isResolving && (
167
157
  <Placeholder icon={ pin } label={ __( 'Categories' ) }>
168
158
  <Spinner />
169
159
  </Placeholder>
170
160
  ) }
171
- { ! isRequesting && categories?.length === 0 && (
161
+ { ! isResolving && categories?.length === 0 && (
172
162
  <p>
173
163
  { __(
174
164
  'Your site does not have any posts, so there is nothing to display here at the moment.'
175
165
  ) }
176
166
  </p>
177
167
  ) }
178
- { ! isRequesting &&
168
+ { ! isResolving &&
179
169
  categories?.length > 0 &&
180
170
  ( displayAsDropdown
181
171
  ? renderCategoryDropdown()
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "supports": {
17
17
  "anchor": true,
18
- "__experimentalSelector": ".wp-block-code > code",
19
18
  "typography": {
20
19
  "fontSize": true,
21
20
  "lineHeight": true,
@@ -1,6 +1,8 @@
1
- // Provide a minimum of overflow handling.
1
+ // Provide a minimum of overflow handling and ensure the code markup inherits
2
+ // the font-family set on pre.
2
3
  .wp-block-code code {
3
4
  display: block;
4
- white-space: pre-wrap;
5
+ font-family: inherit;
5
6
  overflow-wrap: break-word;
7
+ white-space: pre-wrap;
6
8
  }
@@ -1,9 +1,6 @@
1
1
  .wp-block-code {
2
2
  border: 1px solid #ccc;
3
3
  border-radius: 4px;
4
- }
5
-
6
- .wp-block-code > code {
7
4
  font-family: Menlo, Consolas, monaco, monospace;
8
5
  padding: 0.8em 1em;
9
6
  }
@@ -43,6 +43,18 @@
43
43
  "type": "flex",
44
44
  "flexWrap": "nowrap"
45
45
  }
46
+ },
47
+ "__experimentalBorder": {
48
+ "color": true,
49
+ "radius": true,
50
+ "style": true,
51
+ "width": true,
52
+ "__experimentalDefaultControls": {
53
+ "color": true,
54
+ "radius": true,
55
+ "style": true,
56
+ "width": true
57
+ }
46
58
  }
47
59
  },
48
60
  "editorStyle": "wp-block-columns-editor",
@@ -45,7 +45,7 @@ export const getColumnsInRow = ( width, columnCount ) => {
45
45
  MAX_COLUMNS_NUM_IN_ROW
46
46
  );
47
47
  }
48
- // show all Column in one row
48
+ // Show all Column in one row.
49
49
  return columnCount;
50
50
  }
51
51
  };
@@ -141,7 +141,7 @@ const ColumnsEditContainerWrapper = withDispatch(
141
141
  // Update own alignment.
142
142
  setAttributes( { verticalAlignment } );
143
143
 
144
- // Update all child Column Blocks to match
144
+ // Update all child Column Blocks to match.
145
145
  const innerBlockClientIds = getBlockOrder( clientId );
146
146
  innerBlockClientIds.forEach( ( innerBlockClientId ) => {
147
147
  updateBlockAttributes( innerBlockClientId, {
@@ -317,7 +317,7 @@ const ColumnsEditContainerWrapper = withDispatch(
317
317
  // Update own alignment.
318
318
  setAttributes( { verticalAlignment } );
319
319
 
320
- // Update all child Column Blocks to match
320
+ // Update all child Column Blocks to match.
321
321
  const innerBlockClientIds = getBlockOrder( clientId );
322
322
  innerBlockClientIds.forEach( ( innerBlockClientId ) => {
323
323
  updateBlockAttributes( innerBlockClientId, {
@@ -359,7 +359,7 @@ const ColumnsEditContainerWrapper = withDispatch(
359
359
  // Redistribute available width for existing inner blocks.
360
360
  const isAddingColumn = newColumns > previousColumns;
361
361
 
362
- // Get verticalAlignment from Columns block to set the same to new Column
362
+ // Get verticalAlignment from Columns block to set the same to new Column.
363
363
  const { verticalAlignment } = getBlockAttributes( clientId ) || {};
364
364
 
365
365
  if ( isAddingColumn && hasExplicitWidths ) {
@@ -421,7 +421,7 @@ const ColumnsEditContainerWrapper = withDispatch(
421
421
  blockEditorStore
422
422
  );
423
423
 
424
- // Get verticalAlignment from Columns block to set the same to new Column
424
+ // Get verticalAlignment from Columns block to set the same to new Column.
425
425
  const { verticalAlignment } = getBlockAttributes( clientId );
426
426
 
427
427
  const innerBlocks = getBlocks( clientId );
@@ -5,10 +5,12 @@ import {
5
5
  InspectorControls,
6
6
  useBlockProps,
7
7
  __experimentalGetSpacingClassesAndStyles as useSpacingProps,
8
+ store as blockEditorStore,
8
9
  } from '@wordpress/block-editor';
9
10
  import { PanelBody, ResizableBox, RangeControl } from '@wordpress/components';
10
11
  import { useEntityProp } from '@wordpress/core-data';
11
- import { __, _x, isRTL } from '@wordpress/i18n';
12
+ import { useSelect } from '@wordpress/data';
13
+ import { __, isRTL } from '@wordpress/i18n';
12
14
 
13
15
  export default function Edit( {
14
16
  attributes,
@@ -38,6 +40,11 @@ export default function Edit( {
38
40
  const blockProps = useBlockProps();
39
41
  const spacingProps = useSpacingProps( attributes );
40
42
  const maxSizeBuffer = Math.floor( maxSize * 2.5 );
43
+ const { avatarURL } = useSelect( ( select ) => {
44
+ const { getSettings } = select( blockEditorStore );
45
+ const { __experimentalDiscussionSettings } = getSettings();
46
+ return __experimentalDiscussionSettings;
47
+ } );
41
48
 
42
49
  const inspectorControls = (
43
50
  <InspectorControls>
@@ -59,7 +66,7 @@ export default function Edit( {
59
66
  </InspectorControls>
60
67
  );
61
68
 
62
- const displayAvatar = avatarUrls ? (
69
+ const resizableAvatar = (
63
70
  <ResizableBox
64
71
  size={ {
65
72
  width,
@@ -83,21 +90,19 @@ export default function Edit( {
83
90
  maxWidth={ maxSizeBuffer }
84
91
  >
85
92
  <img
86
- src={ avatarUrls[ avatarUrls.length - 1 ] }
93
+ src={
94
+ avatarUrls ? avatarUrls[ avatarUrls.length - 1 ] : avatarURL
95
+ }
87
96
  alt={ `${ authorName } ${ __( 'Avatar' ) }` }
88
97
  { ...blockProps }
89
98
  />
90
99
  </ResizableBox>
91
- ) : (
92
- <p { ...blockProps }>
93
- { _x( 'Comment Author Avatar', 'block title' ) }
94
- </p>
95
100
  );
96
101
 
97
102
  return (
98
103
  <>
99
104
  { inspectorControls }
100
- <div { ...spacingProps }>{ displayAvatar }</div>
105
+ <div { ...spacingProps }>{ resizableAvatar }</div>
101
106
  </>
102
107
  );
103
108
  }
@@ -0,0 +1,7 @@
1
+ .wp-block-comment-author-avatar__placeholder {
2
+ border: currentColor 1px dashed;
3
+ width: 100%;
4
+ height: 100%;
5
+ stroke: currentColor;
6
+ stroke-dasharray: 3;
7
+ }
@@ -7,7 +7,13 @@
7
7
  "parent": [ "core/comments-query-loop" ],
8
8
  "description": "Contains the block elements used to render a comment, like the title, date, author, avatar and more.",
9
9
  "textdomain": "default",
10
- "usesContext": [ "comments/perPage", "postId", "comments/order" ],
10
+ "usesContext": [
11
+ "comments/defaultPage",
12
+ "comments/inherit",
13
+ "comments/order",
14
+ "comments/perPage",
15
+ "postId"
16
+ ],
11
17
  "supports": {
12
18
  "reusable": false,
13
19
  "html": false,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useState, useMemo, memo } from '@wordpress/element';
4
+ import { useState, memo } from '@wordpress/element';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import {
@@ -17,7 +17,7 @@ import { store as coreStore } from '@wordpress/core-data';
17
17
  /**
18
18
  * Internal dependencies
19
19
  */
20
- import { convertToTree } from './util';
20
+ import { useCommentQueryArgs, useCommentTree } from './hooks';
21
21
 
22
22
  const TEMPLATE = [
23
23
  [ 'core/comment-author-avatar' ],
@@ -28,6 +28,56 @@ const TEMPLATE = [
28
28
  [ 'core/comment-edit-link' ],
29
29
  ];
30
30
 
31
+ /**
32
+ * Function that returns a comment structure that will be rendered with default placehoders.
33
+ *
34
+ * @param {Object} settings Discussion Settings.
35
+ * @param {number} [settings.perPage] - Comments per page setting or block attribute.
36
+ * @param {boolean} [settings.threadComments] - Enable threaded (nested) comments setting.
37
+ * @param {number} [settings.threadCommentsDepth] - Level deep of threaded comments.
38
+ *
39
+ * @typedef {{id: null, children: EmptyComment[]}} EmptyComment
40
+ * @return {EmptyComment[]} Inner blocks of the Comment Template
41
+ */
42
+ const getCommentsPlaceholder = ( {
43
+ perPage,
44
+ threadComments,
45
+ threadCommentsDepth,
46
+ } ) => {
47
+ // In case that `threadCommentsDepth` is falsy, we default to a somewhat
48
+ // arbitrary value of 3.
49
+ // In case that the value is set but larger than 3 we truncate it to 3.
50
+ const commentsDepth = Math.min( threadCommentsDepth || 3, 3 );
51
+
52
+ // We set a limit in order not to overload the editor of empty comments.
53
+ const defaultCommentsToShow =
54
+ perPage <= commentsDepth ? perPage : commentsDepth;
55
+ if ( ! threadComments || defaultCommentsToShow === 1 ) {
56
+ // If displaying threaded comments is disabled, we only show one comment
57
+ return [ { commentId: null, children: [] } ];
58
+ } else if ( defaultCommentsToShow === 2 ) {
59
+ return [
60
+ {
61
+ commentId: null,
62
+ children: [ { commentId: null, children: [] } ],
63
+ },
64
+ ];
65
+ }
66
+
67
+ // In case that the value is set but larger than 3 we truncate it to 3.
68
+ return [
69
+ {
70
+ commentId: null,
71
+ children: [
72
+ {
73
+ commentId: null,
74
+ children: [ { commentId: null, children: [] } ],
75
+ },
76
+ ],
77
+ },
78
+ ];
79
+ };
80
+
31
81
  /**
32
82
  * Component which renders the inner blocks of the Comment Template.
33
83
  *
@@ -56,10 +106,10 @@ function CommentTemplateInnerBlocks( {
56
106
  { comment === ( activeComment || firstComment ) ? children : null }
57
107
 
58
108
  { /* To avoid flicker when switching active block contexts, a preview
59
- is ALWAYS rendered and the preview for the active block is hidden.
60
- This ensures that when switching the active block, the component is not
109
+ is ALWAYS rendered and the preview for the active block is hidden.
110
+ This ensures that when switching the active block, the component is not
61
111
  mounted again but rather it only toggles the `isHidden` prop.
62
-
112
+
63
113
  The same strategy is used for preventing the flicker in the Post Template
64
114
  block. */ }
65
115
  <MemoizedCommentTemplatePreview
@@ -140,9 +190,9 @@ const CommentsList = ( {
140
190
  } ) => (
141
191
  <ol { ...blockProps }>
142
192
  { comments &&
143
- comments.map( ( comment ) => (
193
+ comments.map( ( comment, index ) => (
144
194
  <BlockContextProvider
145
- key={ comment.commentId }
195
+ key={ comment.commentId || index }
146
196
  value={ comment }
147
197
  >
148
198
  <CommentTemplateInnerBlocks
@@ -159,54 +209,58 @@ const CommentsList = ( {
159
209
 
160
210
  export default function CommentTemplateEdit( {
161
211
  clientId,
162
- context: { postId, 'comments/perPage': perPage, 'comments/order': order },
212
+ context: {
213
+ postId,
214
+ 'comments/perPage': perPage,
215
+ 'comments/order': order,
216
+ 'comments/defaultPage': defaultPage,
217
+ 'comments/inherit': inherit,
218
+ },
163
219
  } ) {
164
220
  const blockProps = useBlockProps();
165
221
 
166
222
  const [ activeComment, setActiveComment ] = useState();
167
- const { commentOrder, commentsPerPage } = useSelect( ( select ) => {
168
- const { getSettings } = select( blockEditorStore );
169
- return getSettings().__experimentalDiscussionSettings;
223
+ const { commentOrder, threadCommentsDepth, threadComments } = useSelect(
224
+ ( select ) => {
225
+ const { getSettings } = select( blockEditorStore );
226
+ return getSettings().__experimentalDiscussionSettings;
227
+ }
228
+ );
229
+
230
+ const commentQuery = useCommentQueryArgs( {
231
+ postId,
232
+ perPage,
233
+ defaultPage,
234
+ inherit,
170
235
  } );
171
- const { rawComments, blocks } = useSelect(
236
+
237
+ const { topLevelComments, blocks } = useSelect(
172
238
  ( select ) => {
173
239
  const { getEntityRecords } = select( coreStore );
174
240
  const { getBlocks } = select( blockEditorStore );
175
241
 
176
- const commentQuery = {
177
- post: postId,
178
- status: 'approve',
179
- context: 'embed',
180
- order: order || commentOrder,
181
- };
182
-
183
- if ( order ) {
184
- commentQuery.order = order;
185
- }
186
242
  return {
187
- rawComments: getEntityRecords(
188
- 'root',
189
- 'comment',
190
- commentQuery
191
- ),
243
+ // Request only top-level comments. Replies are embedded.
244
+ topLevelComments: commentQuery
245
+ ? getEntityRecords( 'root', 'comment', commentQuery )
246
+ : null,
192
247
  blocks: getBlocks( clientId ),
193
248
  };
194
249
  },
195
- [ postId, clientId, order ]
250
+ [ clientId, commentQuery ]
196
251
  );
197
252
 
198
- // TODO: Replicate the logic used on the server.
199
- perPage = perPage || commentsPerPage;
200
- // We convert the flat list of comments to tree.
201
- // Then, we show only a maximum of `perPage` number of comments.
202
- // This is because passing `per_page` to `getEntityRecords()` does not
203
- // take into account nested comments.
204
- const comments = useMemo(
205
- () => convertToTree( rawComments ).slice( 0, perPage ),
206
- [ rawComments, perPage ]
253
+ order = inherit || ! order ? commentOrder : order;
254
+
255
+ // Generate a tree structure of comment IDs.
256
+ let commentTree = useCommentTree(
257
+ // Reverse the order of top comments if needed.
258
+ order === 'desc' && topLevelComments
259
+ ? [ ...topLevelComments ].reverse()
260
+ : topLevelComments
207
261
  );
208
262
 
209
- if ( ! rawComments ) {
263
+ if ( ! topLevelComments ) {
210
264
  return (
211
265
  <p { ...blockProps }>
212
266
  <Spinner />
@@ -214,13 +268,21 @@ export default function CommentTemplateEdit( {
214
268
  );
215
269
  }
216
270
 
217
- if ( ! comments.length ) {
271
+ if ( ! postId ) {
272
+ commentTree = getCommentsPlaceholder( {
273
+ perPage,
274
+ threadComments,
275
+ threadCommentsDepth,
276
+ } );
277
+ }
278
+
279
+ if ( ! commentTree.length ) {
218
280
  return <p { ...blockProps }> { __( 'No results found.' ) }</p>;
219
281
  }
220
282
 
221
283
  return (
222
284
  <CommentsList
223
- comments={ comments }
285
+ comments={ commentTree }
224
286
  blockProps={ blockProps }
225
287
  blocks={ blocks }
226
288
  activeComment={ activeComment }