@wordpress/block-library 7.12.0 → 7.12.2-next.d6164808d3.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 (626) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/build/archives/index.js +5 -1
  3. package/build/archives/index.js.map +1 -1
  4. package/build/audio/index.js +4 -0
  5. package/build/audio/index.js.map +1 -1
  6. package/build/button/deprecated.js +14 -5
  7. package/build/button/deprecated.js.map +1 -1
  8. package/build/button/index.js +1 -1
  9. package/build/categories/edit.js +3 -1
  10. package/build/categories/edit.js.map +1 -1
  11. package/build/categories/index.js +14 -1
  12. package/build/categories/index.js.map +1 -1
  13. package/build/code/index.js +4 -2
  14. package/build/code/index.js.map +1 -1
  15. package/build/column/index.js +13 -0
  16. package/build/column/index.js.map +1 -1
  17. package/build/columns/deprecated.js +16 -5
  18. package/build/columns/deprecated.js.map +1 -1
  19. package/build/columns/edit.js +6 -2
  20. package/build/columns/edit.js.map +1 -1
  21. package/build/columns/edit.native.js +6 -2
  22. package/build/columns/edit.native.js.map +1 -1
  23. package/build/columns/index.js +13 -0
  24. package/build/columns/index.js.map +1 -1
  25. package/build/comment-author-name/index.js +5 -1
  26. package/build/comment-author-name/index.js.map +1 -1
  27. package/build/comment-content/index.js +5 -1
  28. package/build/comment-content/index.js.map +1 -1
  29. package/build/comment-date/index.js +1 -0
  30. package/build/comment-date/index.js.map +1 -1
  31. package/build/comment-edit-link/index.js +5 -1
  32. package/build/comment-edit-link/index.js.map +1 -1
  33. package/build/comment-reply-link/index.js +5 -1
  34. package/build/comment-reply-link/index.js.map +1 -1
  35. package/build/comment-template/index.js +14 -1
  36. package/build/comment-template/index.js.map +1 -1
  37. package/build/comments/index.js +13 -0
  38. package/build/comments/index.js.map +1 -1
  39. package/build/comments-pagination/index.js +13 -0
  40. package/build/comments-pagination/index.js.map +1 -1
  41. package/build/comments-pagination-next/index.js +4 -2
  42. package/build/comments-pagination-next/index.js.map +1 -1
  43. package/build/comments-pagination-numbers/edit.js +5 -1
  44. package/build/comments-pagination-numbers/edit.js.map +1 -1
  45. package/build/comments-pagination-numbers/index.js +14 -1
  46. package/build/comments-pagination-numbers/index.js.map +1 -1
  47. package/build/comments-pagination-previous/index.js +4 -2
  48. package/build/comments-pagination-previous/index.js.map +1 -1
  49. package/build/comments-title/deprecated.js +4 -2
  50. package/build/comments-title/deprecated.js.map +1 -1
  51. package/build/comments-title/index.js +4 -2
  52. package/build/comments-title/index.js.map +1 -1
  53. package/build/cover/deprecated.js +20 -5
  54. package/build/cover/deprecated.js.map +1 -1
  55. package/build/cover/index.js +13 -0
  56. package/build/cover/index.js.map +1 -1
  57. package/build/cover/shared.js +1 -1
  58. package/build/cover/shared.js.map +1 -1
  59. package/build/embed/icons.js +1 -1
  60. package/build/embed/icons.js.map +1 -1
  61. package/build/gallery/deprecated.js +6 -1
  62. package/build/gallery/deprecated.js.map +1 -1
  63. package/build/gallery/edit.js +15 -2
  64. package/build/gallery/edit.js.map +1 -1
  65. package/build/gallery/index.js +5 -0
  66. package/build/gallery/index.js.map +1 -1
  67. package/build/gallery/transforms.js +20 -7
  68. package/build/gallery/transforms.js.map +1 -1
  69. package/build/gallery/utils.js +7 -6
  70. package/build/gallery/utils.js.map +1 -1
  71. package/build/group/deprecated.js +108 -12
  72. package/build/group/deprecated.js.map +1 -1
  73. package/build/group/edit.js +23 -1
  74. package/build/group/edit.js.map +1 -1
  75. package/build/group/index.js +10 -2
  76. package/build/group/index.js.map +1 -1
  77. package/build/group/variations.js +8 -8
  78. package/build/group/variations.js.map +1 -1
  79. package/build/heading/deprecated.js +5 -3
  80. package/build/heading/deprecated.js.map +1 -1
  81. package/build/heading/index.js +3 -1
  82. package/build/heading/index.js.map +1 -1
  83. package/build/heading/transforms.js +3 -1
  84. package/build/heading/transforms.js.map +1 -1
  85. package/build/home-link/edit.js +8 -4
  86. package/build/home-link/edit.js.map +1 -1
  87. package/build/image/edit.js +13 -1
  88. package/build/image/edit.js.map +1 -1
  89. package/build/image/index.js +13 -7
  90. package/build/image/index.js.map +1 -1
  91. package/build/index.native.js +6 -3
  92. package/build/index.native.js.map +1 -1
  93. package/build/list-item/edit.js +3 -1
  94. package/build/list-item/edit.js.map +1 -1
  95. package/build/list-item/hooks/index.js +8 -0
  96. package/build/list-item/hooks/index.js.map +1 -1
  97. package/build/list-item/hooks/use-copy.js +42 -0
  98. package/build/list-item/hooks/use-copy.js.map +1 -0
  99. package/build/list-item/list-style-type.native.js +4 -1
  100. package/build/list-item/list-style-type.native.js.map +1 -1
  101. package/build/media-text/deprecated.js +5 -1
  102. package/build/media-text/deprecated.js.map +1 -1
  103. package/build/media-text/index.js +13 -0
  104. package/build/media-text/index.js.map +1 -1
  105. package/build/navigation/deprecated.js +6 -1
  106. package/build/navigation/deprecated.js.map +1 -1
  107. package/build/navigation/edit/index.js +119 -38
  108. package/build/navigation/edit/index.js.map +1 -1
  109. package/build/navigation/edit/unsaved-inner-blocks.js +2 -1
  110. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  111. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -7
  112. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  113. package/build/navigation/menu-items-to-blocks.js +1 -7
  114. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  115. package/build/navigation/use-navigation-menu.js +8 -7
  116. package/build/navigation/use-navigation-menu.js.map +1 -1
  117. package/build/navigation-link/edit.js +6 -8
  118. package/build/navigation-link/edit.js.map +1 -1
  119. package/build/navigation-submenu/edit.js +4 -6
  120. package/build/navigation-submenu/edit.js.map +1 -1
  121. package/build/page-list/edit.js +7 -3
  122. package/build/page-list/edit.js.map +1 -1
  123. package/build/paragraph/deprecated.js +18 -10
  124. package/build/paragraph/deprecated.js.map +1 -1
  125. package/build/paragraph/edit.js +1 -0
  126. package/build/paragraph/edit.js.map +1 -1
  127. package/build/paragraph/index.js +5 -0
  128. package/build/paragraph/index.js.map +1 -1
  129. package/build/paragraph/transforms.js +5 -0
  130. package/build/paragraph/transforms.js.map +1 -1
  131. package/build/post-author/index.js +4 -2
  132. package/build/post-author/index.js.map +1 -1
  133. package/build/post-author-biography/index.js +1 -0
  134. package/build/post-author-biography/index.js.map +1 -1
  135. package/build/post-author-name/index.js +5 -1
  136. package/build/post-author-name/index.js.map +1 -1
  137. package/build/post-comments-count/edit.js +11 -1
  138. package/build/post-comments-count/edit.js.map +1 -1
  139. package/build/post-comments-count/index.js +4 -1
  140. package/build/post-comments-count/index.js.map +1 -1
  141. package/build/post-comments-link/index.js +4 -2
  142. package/build/post-comments-link/index.js.map +1 -1
  143. package/build/post-date/edit.js +9 -2
  144. package/build/post-date/edit.js.map +1 -1
  145. package/build/post-date/index.js +9 -0
  146. package/build/post-date/index.js.map +1 -1
  147. package/build/post-featured-image/edit.js +27 -12
  148. package/build/post-featured-image/edit.js.map +1 -1
  149. package/build/post-featured-image/index.js +12 -0
  150. package/build/post-featured-image/index.js.map +1 -1
  151. package/build/post-navigation-link/index.js +3 -2
  152. package/build/post-navigation-link/index.js.map +1 -1
  153. package/build/post-template/edit.js +8 -4
  154. package/build/post-template/edit.js.map +1 -1
  155. package/build/post-template/index.js +14 -1
  156. package/build/post-template/index.js.map +1 -1
  157. package/build/post-terms/index.js +5 -3
  158. package/build/post-terms/index.js.map +1 -1
  159. package/build/post-title/index.js +2 -1
  160. package/build/post-title/index.js.map +1 -1
  161. package/build/preformatted/index.js +4 -2
  162. package/build/preformatted/index.js.map +1 -1
  163. package/build/pullquote/deprecated.js +135 -25
  164. package/build/pullquote/deprecated.js.map +1 -1
  165. package/build/pullquote/edit.js +1 -1
  166. package/build/pullquote/edit.js.map +1 -1
  167. package/build/pullquote/edit.native.js +0 -1
  168. package/build/pullquote/edit.native.js.map +1 -1
  169. package/build/pullquote/index.js +13 -6
  170. package/build/pullquote/index.js.map +1 -1
  171. package/build/pullquote/save.js +2 -2
  172. package/build/pullquote/save.js.map +1 -1
  173. package/build/pullquote/transforms.js +14 -33
  174. package/build/pullquote/transforms.js.map +1 -1
  175. package/build/query/deprecated.js +10 -9
  176. package/build/query/deprecated.js.map +1 -1
  177. package/build/query/edit/index.js +19 -8
  178. package/build/query/edit/index.js.map +1 -1
  179. package/build/query/edit/inspector-controls/taxonomy-controls.js +1 -0
  180. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  181. package/build/query/edit/query-placeholder.js +6 -1
  182. package/build/query/edit/query-placeholder.js.map +1 -1
  183. package/build/query/utils.js +35 -9
  184. package/build/query/utils.js.map +1 -1
  185. package/build/query-no-results/edit.js +1 -1
  186. package/build/query-no-results/edit.js.map +1 -1
  187. package/build/query-title/edit.js +10 -1
  188. package/build/query-title/edit.js.map +1 -1
  189. package/build/query-title/index.js +7 -2
  190. package/build/query-title/index.js.map +1 -1
  191. package/build/quote/deprecated.js +13 -6
  192. package/build/quote/deprecated.js.map +1 -1
  193. package/build/quote/transforms.js +22 -37
  194. package/build/quote/transforms.js.map +1 -1
  195. package/build/separator/deprecated.js +3 -4
  196. package/build/separator/deprecated.js.map +1 -1
  197. package/build/separator/index.js +1 -0
  198. package/build/separator/index.js.map +1 -1
  199. package/build/social-link/icons/reddit.js +1 -1
  200. package/build/social-link/icons/reddit.js.map +1 -1
  201. package/build/social-links/edit.js +2 -1
  202. package/build/social-links/edit.js.map +1 -1
  203. package/build/spacer/index.js +7 -1
  204. package/build/spacer/index.js.map +1 -1
  205. package/build/table/index.js +4 -0
  206. package/build/table/index.js.map +1 -1
  207. package/build/table/state.js +9 -3
  208. package/build/table/state.js.map +1 -1
  209. package/build/table-of-contents/index.js +11 -1
  210. package/build/table-of-contents/index.js.map +1 -1
  211. package/build/tag-cloud/index.js +5 -1
  212. package/build/tag-cloud/index.js.map +1 -1
  213. package/build/template-part/index.js +2 -2
  214. package/build/template-part/index.js.map +1 -1
  215. package/build/term-description/index.js +4 -0
  216. package/build/term-description/index.js.map +1 -1
  217. package/build/text-columns/edit.js +3 -1
  218. package/build/text-columns/edit.js.map +1 -1
  219. package/build/text-columns/save.js +3 -1
  220. package/build/text-columns/save.js.map +1 -1
  221. package/build/verse/index.js +1 -0
  222. package/build/verse/index.js.map +1 -1
  223. package/build/video/index.js +4 -0
  224. package/build/video/index.js.map +1 -1
  225. package/build-module/archives/index.js +5 -1
  226. package/build-module/archives/index.js.map +1 -1
  227. package/build-module/audio/index.js +4 -0
  228. package/build-module/audio/index.js.map +1 -1
  229. package/build-module/button/deprecated.js +14 -4
  230. package/build-module/button/deprecated.js.map +1 -1
  231. package/build-module/button/index.js +1 -1
  232. package/build-module/categories/edit.js +4 -2
  233. package/build-module/categories/edit.js.map +1 -1
  234. package/build-module/categories/index.js +14 -1
  235. package/build-module/categories/index.js.map +1 -1
  236. package/build-module/code/index.js +4 -2
  237. package/build-module/code/index.js.map +1 -1
  238. package/build-module/column/index.js +13 -0
  239. package/build-module/column/index.js.map +1 -1
  240. package/build-module/columns/deprecated.js +16 -4
  241. package/build-module/columns/deprecated.js.map +1 -1
  242. package/build-module/columns/edit.js +7 -3
  243. package/build-module/columns/edit.js.map +1 -1
  244. package/build-module/columns/edit.native.js +7 -3
  245. package/build-module/columns/edit.native.js.map +1 -1
  246. package/build-module/columns/index.js +13 -0
  247. package/build-module/columns/index.js.map +1 -1
  248. package/build-module/comment-author-name/index.js +5 -1
  249. package/build-module/comment-author-name/index.js.map +1 -1
  250. package/build-module/comment-content/index.js +5 -1
  251. package/build-module/comment-content/index.js.map +1 -1
  252. package/build-module/comment-date/index.js +1 -0
  253. package/build-module/comment-date/index.js.map +1 -1
  254. package/build-module/comment-edit-link/index.js +5 -1
  255. package/build-module/comment-edit-link/index.js.map +1 -1
  256. package/build-module/comment-reply-link/index.js +5 -1
  257. package/build-module/comment-reply-link/index.js.map +1 -1
  258. package/build-module/comment-template/index.js +14 -1
  259. package/build-module/comment-template/index.js.map +1 -1
  260. package/build-module/comments/index.js +13 -0
  261. package/build-module/comments/index.js.map +1 -1
  262. package/build-module/comments-pagination/index.js +13 -0
  263. package/build-module/comments-pagination/index.js.map +1 -1
  264. package/build-module/comments-pagination-next/index.js +4 -2
  265. package/build-module/comments-pagination-next/index.js.map +1 -1
  266. package/build-module/comments-pagination-numbers/edit.js +5 -1
  267. package/build-module/comments-pagination-numbers/edit.js.map +1 -1
  268. package/build-module/comments-pagination-numbers/index.js +14 -1
  269. package/build-module/comments-pagination-numbers/index.js.map +1 -1
  270. package/build-module/comments-pagination-previous/index.js +4 -2
  271. package/build-module/comments-pagination-previous/index.js.map +1 -1
  272. package/build-module/comments-title/deprecated.js +4 -2
  273. package/build-module/comments-title/deprecated.js.map +1 -1
  274. package/build-module/comments-title/index.js +4 -2
  275. package/build-module/comments-title/index.js.map +1 -1
  276. package/build-module/cover/deprecated.js +20 -4
  277. package/build-module/cover/deprecated.js.map +1 -1
  278. package/build-module/cover/index.js +13 -0
  279. package/build-module/cover/index.js.map +1 -1
  280. package/build-module/cover/shared.js +1 -1
  281. package/build-module/cover/shared.js.map +1 -1
  282. package/build-module/embed/icons.js +1 -1
  283. package/build-module/embed/icons.js.map +1 -1
  284. package/build-module/gallery/deprecated.js +7 -2
  285. package/build-module/gallery/deprecated.js.map +1 -1
  286. package/build-module/gallery/edit.js +15 -2
  287. package/build-module/gallery/edit.js.map +1 -1
  288. package/build-module/gallery/index.js +5 -0
  289. package/build-module/gallery/index.js.map +1 -1
  290. package/build-module/gallery/transforms.js +20 -7
  291. package/build-module/gallery/transforms.js.map +1 -1
  292. package/build-module/gallery/utils.js +7 -6
  293. package/build-module/gallery/utils.js.map +1 -1
  294. package/build-module/group/deprecated.js +109 -12
  295. package/build-module/group/deprecated.js.map +1 -1
  296. package/build-module/group/edit.js +25 -2
  297. package/build-module/group/edit.js.map +1 -1
  298. package/build-module/group/index.js +10 -2
  299. package/build-module/group/index.js.map +1 -1
  300. package/build-module/group/variations.js +8 -8
  301. package/build-module/group/variations.js.map +1 -1
  302. package/build-module/heading/deprecated.js +5 -2
  303. package/build-module/heading/deprecated.js.map +1 -1
  304. package/build-module/heading/index.js +3 -1
  305. package/build-module/heading/index.js.map +1 -1
  306. package/build-module/heading/transforms.js +3 -1
  307. package/build-module/heading/transforms.js.map +1 -1
  308. package/build-module/home-link/edit.js +10 -6
  309. package/build-module/home-link/edit.js.map +1 -1
  310. package/build-module/image/edit.js +14 -2
  311. package/build-module/image/edit.js.map +1 -1
  312. package/build-module/image/index.js +13 -7
  313. package/build-module/image/index.js.map +1 -1
  314. package/build-module/index.native.js +6 -2
  315. package/build-module/index.native.js.map +1 -1
  316. package/build-module/list-item/edit.js +4 -2
  317. package/build-module/list-item/edit.js.map +1 -1
  318. package/build-module/list-item/hooks/index.js +1 -0
  319. package/build-module/list-item/hooks/index.js.map +1 -1
  320. package/build-module/list-item/hooks/use-copy.js +32 -0
  321. package/build-module/list-item/hooks/use-copy.js.map +1 -0
  322. package/build-module/list-item/list-style-type.native.js +3 -1
  323. package/build-module/list-item/list-style-type.native.js.map +1 -1
  324. package/build-module/media-text/deprecated.js +6 -2
  325. package/build-module/media-text/deprecated.js.map +1 -1
  326. package/build-module/media-text/index.js +13 -0
  327. package/build-module/media-text/index.js.map +1 -1
  328. package/build-module/navigation/deprecated.js +7 -2
  329. package/build-module/navigation/deprecated.js.map +1 -1
  330. package/build-module/navigation/edit/index.js +120 -40
  331. package/build-module/navigation/edit/index.js.map +1 -1
  332. package/build-module/navigation/edit/unsaved-inner-blocks.js +2 -1
  333. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  334. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -7
  335. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  336. package/build-module/navigation/menu-items-to-blocks.js +1 -6
  337. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  338. package/build-module/navigation/use-navigation-menu.js +8 -7
  339. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  340. package/build-module/navigation-link/edit.js +7 -9
  341. package/build-module/navigation-link/edit.js.map +1 -1
  342. package/build-module/navigation-submenu/edit.js +5 -7
  343. package/build-module/navigation-submenu/edit.js.map +1 -1
  344. package/build-module/page-list/edit.js +7 -2
  345. package/build-module/page-list/edit.js.map +1 -1
  346. package/build-module/paragraph/deprecated.js +18 -9
  347. package/build-module/paragraph/deprecated.js.map +1 -1
  348. package/build-module/paragraph/edit.js +1 -0
  349. package/build-module/paragraph/edit.js.map +1 -1
  350. package/build-module/paragraph/index.js +5 -0
  351. package/build-module/paragraph/index.js.map +1 -1
  352. package/build-module/paragraph/transforms.js +5 -0
  353. package/build-module/paragraph/transforms.js.map +1 -1
  354. package/build-module/post-author/index.js +4 -2
  355. package/build-module/post-author/index.js.map +1 -1
  356. package/build-module/post-author-biography/index.js +1 -0
  357. package/build-module/post-author-biography/index.js.map +1 -1
  358. package/build-module/post-author-name/index.js +5 -1
  359. package/build-module/post-author-name/index.js.map +1 -1
  360. package/build-module/post-comments-count/edit.js +10 -1
  361. package/build-module/post-comments-count/edit.js.map +1 -1
  362. package/build-module/post-comments-count/index.js +4 -1
  363. package/build-module/post-comments-count/index.js.map +1 -1
  364. package/build-module/post-comments-link/index.js +4 -2
  365. package/build-module/post-comments-link/index.js.map +1 -1
  366. package/build-module/post-date/edit.js +9 -2
  367. package/build-module/post-date/edit.js.map +1 -1
  368. package/build-module/post-date/index.js +9 -0
  369. package/build-module/post-date/index.js.map +1 -1
  370. package/build-module/post-featured-image/edit.js +28 -13
  371. package/build-module/post-featured-image/edit.js.map +1 -1
  372. package/build-module/post-featured-image/index.js +12 -0
  373. package/build-module/post-featured-image/index.js.map +1 -1
  374. package/build-module/post-navigation-link/index.js +3 -2
  375. package/build-module/post-navigation-link/index.js.map +1 -1
  376. package/build-module/post-template/edit.js +8 -4
  377. package/build-module/post-template/edit.js.map +1 -1
  378. package/build-module/post-template/index.js +14 -1
  379. package/build-module/post-template/index.js.map +1 -1
  380. package/build-module/post-terms/index.js +5 -3
  381. package/build-module/post-terms/index.js.map +1 -1
  382. package/build-module/post-title/index.js +2 -1
  383. package/build-module/post-title/index.js.map +1 -1
  384. package/build-module/preformatted/index.js +4 -2
  385. package/build-module/preformatted/index.js.map +1 -1
  386. package/build-module/pullquote/deprecated.js +134 -25
  387. package/build-module/pullquote/deprecated.js.map +1 -1
  388. package/build-module/pullquote/edit.js +1 -1
  389. package/build-module/pullquote/edit.js.map +1 -1
  390. package/build-module/pullquote/edit.native.js +0 -1
  391. package/build-module/pullquote/edit.native.js.map +1 -1
  392. package/build-module/pullquote/index.js +13 -6
  393. package/build-module/pullquote/index.js.map +1 -1
  394. package/build-module/pullquote/save.js +2 -2
  395. package/build-module/pullquote/save.js.map +1 -1
  396. package/build-module/pullquote/transforms.js +15 -34
  397. package/build-module/pullquote/transforms.js.map +1 -1
  398. package/build-module/query/deprecated.js +10 -8
  399. package/build-module/query/deprecated.js.map +1 -1
  400. package/build-module/query/edit/index.js +23 -12
  401. package/build-module/query/edit/index.js.map +1 -1
  402. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +1 -0
  403. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  404. package/build-module/query/edit/query-placeholder.js +6 -1
  405. package/build-module/query/edit/query-placeholder.js.map +1 -1
  406. package/build-module/query/utils.js +32 -7
  407. package/build-module/query/utils.js.map +1 -1
  408. package/build-module/query-no-results/edit.js +1 -1
  409. package/build-module/query-no-results/edit.js.map +1 -1
  410. package/build-module/query-title/edit.js +10 -1
  411. package/build-module/query-title/edit.js.map +1 -1
  412. package/build-module/query-title/index.js +7 -2
  413. package/build-module/query-title/index.js.map +1 -1
  414. package/build-module/quote/deprecated.js +13 -5
  415. package/build-module/quote/deprecated.js.map +1 -1
  416. package/build-module/quote/transforms.js +23 -38
  417. package/build-module/quote/transforms.js.map +1 -1
  418. package/build-module/separator/deprecated.js +3 -3
  419. package/build-module/separator/deprecated.js.map +1 -1
  420. package/build-module/separator/index.js +1 -0
  421. package/build-module/separator/index.js.map +1 -1
  422. package/build-module/social-link/icons/reddit.js +1 -1
  423. package/build-module/social-link/icons/reddit.js.map +1 -1
  424. package/build-module/social-links/edit.js +2 -1
  425. package/build-module/social-links/edit.js.map +1 -1
  426. package/build-module/spacer/index.js +7 -1
  427. package/build-module/spacer/index.js.map +1 -1
  428. package/build-module/table/index.js +4 -0
  429. package/build-module/table/index.js.map +1 -1
  430. package/build-module/table/state.js +10 -4
  431. package/build-module/table/state.js.map +1 -1
  432. package/build-module/table-of-contents/index.js +11 -1
  433. package/build-module/table-of-contents/index.js.map +1 -1
  434. package/build-module/tag-cloud/index.js +5 -1
  435. package/build-module/tag-cloud/index.js.map +1 -1
  436. package/build-module/template-part/index.js +2 -2
  437. package/build-module/template-part/index.js.map +1 -1
  438. package/build-module/term-description/index.js +4 -0
  439. package/build-module/term-description/index.js.map +1 -1
  440. package/build-module/text-columns/edit.js +4 -2
  441. package/build-module/text-columns/edit.js.map +1 -1
  442. package/build-module/text-columns/save.js +4 -2
  443. package/build-module/text-columns/save.js.map +1 -1
  444. package/build-module/verse/index.js +1 -0
  445. package/build-module/verse/index.js.map +1 -1
  446. package/build-module/video/index.js +4 -0
  447. package/build-module/video/index.js.map +1 -1
  448. package/build-style/audio/style-rtl.css +3 -0
  449. package/build-style/audio/style.css +3 -0
  450. package/build-style/button/style-rtl.css +6 -6
  451. package/build-style/button/style.css +6 -6
  452. package/build-style/editor-rtl.css +105 -122
  453. package/build-style/editor.css +105 -122
  454. package/build-style/group/editor-rtl.css +27 -8
  455. package/build-style/group/editor.css +27 -8
  456. package/build-style/image/editor-rtl.css +21 -2
  457. package/build-style/image/editor.css +21 -2
  458. package/build-style/navigation/editor-rtl.css +8 -4
  459. package/build-style/navigation/editor.css +8 -4
  460. package/build-style/navigation/style-rtl.css +2 -2
  461. package/build-style/navigation/style.css +2 -2
  462. package/build-style/paragraph/editor-rtl.css +1 -1
  463. package/build-style/paragraph/editor.css +1 -1
  464. package/build-style/post-date/style-rtl.css +79 -0
  465. package/build-style/post-date/style.css +79 -0
  466. package/build-style/post-featured-image/editor-rtl.css +45 -43
  467. package/build-style/post-featured-image/editor.css +45 -43
  468. package/build-style/post-featured-image/style-rtl.css +1 -0
  469. package/build-style/post-featured-image/style.css +1 -0
  470. package/build-style/post-title/style-rtl.css +1 -0
  471. package/build-style/post-title/style.css +1 -0
  472. package/build-style/pullquote/editor-rtl.css +0 -12
  473. package/build-style/pullquote/editor.css +0 -12
  474. package/build-style/pullquote/style-rtl.css +1 -8
  475. package/build-style/pullquote/style.css +1 -8
  476. package/build-style/query-title/style-rtl.css +79 -0
  477. package/build-style/query-title/style.css +79 -0
  478. package/build-style/site-logo/editor-rtl.css +3 -52
  479. package/build-style/site-logo/editor.css +3 -52
  480. package/build-style/social-links/style-rtl.css +2 -2
  481. package/build-style/social-links/style.css +2 -2
  482. package/build-style/style-rtl.css +27 -18
  483. package/build-style/style.css +27 -18
  484. package/build-style/video/style-rtl.css +3 -0
  485. package/build-style/video/style.css +3 -0
  486. package/package.json +30 -29
  487. package/src/archives/block.json +5 -1
  488. package/src/audio/block.json +4 -0
  489. package/src/audio/style.scss +2 -0
  490. package/src/button/block.json +1 -1
  491. package/src/button/deprecated.js +21 -22
  492. package/src/button/style.scss +6 -6
  493. package/src/calendar/index.php +2 -2
  494. package/src/categories/block.json +14 -1
  495. package/src/categories/edit.js +2 -2
  496. package/src/code/block.json +4 -2
  497. package/src/column/block.json +13 -0
  498. package/src/columns/block.json +13 -0
  499. package/src/columns/deprecated.js +10 -4
  500. package/src/columns/edit.js +7 -3
  501. package/src/columns/edit.native.js +7 -3
  502. package/src/comment-author-name/block.json +5 -1
  503. package/src/comment-content/block.json +5 -1
  504. package/src/comment-date/block.json +1 -0
  505. package/src/comment-edit-link/block.json +5 -1
  506. package/src/comment-reply-link/block.json +5 -1
  507. package/src/comment-template/block.json +14 -1
  508. package/src/comments/block.json +13 -0
  509. package/src/comments/index.php +6 -5
  510. package/src/comments-pagination/block.json +13 -0
  511. package/src/comments-pagination-next/block.json +4 -2
  512. package/src/comments-pagination-numbers/block.json +14 -1
  513. package/src/comments-pagination-numbers/edit.js +12 -3
  514. package/src/comments-pagination-previous/block.json +4 -2
  515. package/src/comments-title/block.json +4 -2
  516. package/src/cover/block.json +13 -0
  517. package/src/cover/deprecated.js +11 -4
  518. package/src/cover/shared.js +2 -1
  519. package/src/embed/icons.js +1 -1
  520. package/src/gallery/block.json +5 -0
  521. package/src/gallery/deprecated.js +4 -2
  522. package/src/gallery/edit.js +22 -2
  523. package/src/gallery/transforms.js +18 -5
  524. package/src/gallery/utils.js +11 -7
  525. package/src/group/block.json +10 -2
  526. package/src/group/deprecated.js +89 -2
  527. package/src/group/edit.js +15 -2
  528. package/src/group/editor.scss +28 -3
  529. package/src/group/variations.js +4 -3
  530. package/src/heading/block.json +3 -1
  531. package/src/heading/deprecated.js +4 -2
  532. package/src/home-link/edit.js +19 -20
  533. package/src/image/block.json +13 -7
  534. package/src/image/edit.js +19 -1
  535. package/src/image/editor.scss +39 -3
  536. package/src/image/index.php +1 -1
  537. package/src/index.native.js +15 -10
  538. package/src/list-item/edit.js +2 -1
  539. package/src/list-item/hooks/index.js +1 -0
  540. package/src/list-item/hooks/use-copy.js +36 -0
  541. package/src/list-item/list-style-type.native.js +8 -1
  542. package/src/list-item/style.native.scss +4 -0
  543. package/src/media-text/block.json +13 -0
  544. package/src/media-text/deprecated.js +3 -2
  545. package/src/navigation/deprecated.js +4 -2
  546. package/src/navigation/edit/index.js +159 -81
  547. package/src/navigation/edit/unsaved-inner-blocks.js +3 -1
  548. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +31 -37
  549. package/src/navigation/editor.scss +3 -2
  550. package/src/navigation/index.php +11 -16
  551. package/src/navigation/menu-items-to-blocks.js +3 -6
  552. package/src/navigation/style.scss +3 -2
  553. package/src/navigation/use-navigation-menu.js +11 -8
  554. package/src/navigation-link/edit.js +9 -13
  555. package/src/navigation-submenu/edit.js +9 -13
  556. package/src/page-list/edit.js +6 -2
  557. package/src/paragraph/block.json +5 -0
  558. package/src/paragraph/deprecated.js +33 -35
  559. package/src/paragraph/edit.js +1 -0
  560. package/src/paragraph/editor.scss +5 -3
  561. package/src/post-author/block.json +4 -2
  562. package/src/post-author-biography/block.json +1 -0
  563. package/src/post-author-name/block.json +5 -1
  564. package/src/post-comments-count/block.json +4 -1
  565. package/src/post-comments-count/edit.js +10 -2
  566. package/src/post-comments-link/block.json +4 -2
  567. package/src/post-date/block.json +9 -0
  568. package/src/post-date/edit.js +12 -2
  569. package/src/post-date/index.php +10 -2
  570. package/src/post-date/style.scss +4 -0
  571. package/src/post-featured-image/block.json +12 -0
  572. package/src/post-featured-image/edit.js +43 -13
  573. package/src/post-featured-image/editor.scss +44 -53
  574. package/src/post-featured-image/index.php +61 -4
  575. package/src/post-featured-image/style.scss +1 -0
  576. package/src/post-navigation-link/block.json +3 -2
  577. package/src/post-template/block.json +15 -1
  578. package/src/post-template/edit.js +6 -1
  579. package/src/post-template/index.php +7 -4
  580. package/src/post-terms/block.json +5 -3
  581. package/src/post-title/block.json +2 -1
  582. package/src/post-title/style.scss +2 -0
  583. package/src/preformatted/block.json +4 -2
  584. package/src/pullquote/block.json +11 -4
  585. package/src/pullquote/deprecated.js +490 -412
  586. package/src/pullquote/edit.js +1 -1
  587. package/src/pullquote/edit.native.js +0 -1
  588. package/src/pullquote/editor.scss +0 -16
  589. package/src/pullquote/index.js +1 -3
  590. package/src/pullquote/save.js +1 -1
  591. package/src/pullquote/style.scss +0 -11
  592. package/src/pullquote/transforms.js +17 -33
  593. package/src/query/deprecated.js +4 -9
  594. package/src/query/edit/index.js +28 -15
  595. package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -1
  596. package/src/query/edit/query-placeholder.js +17 -2
  597. package/src/query/utils.js +29 -7
  598. package/src/query-no-results/edit.js +1 -1
  599. package/src/query-title/block.json +7 -2
  600. package/src/query-title/edit.js +19 -2
  601. package/src/query-title/index.php +11 -1
  602. package/src/query-title/style.scss +4 -0
  603. package/src/quote/deprecated.js +6 -5
  604. package/src/quote/transforms.js +4 -18
  605. package/src/search/index.php +1 -1
  606. package/src/separator/block.json +1 -0
  607. package/src/separator/deprecated.js +2 -3
  608. package/src/site-logo/editor.scss +8 -66
  609. package/src/social-link/icons/reddit.js +1 -1
  610. package/src/social-link/index.php +1 -1
  611. package/src/social-link/socials-with-bg.scss +1 -1
  612. package/src/social-link/socials-without-bg.scss +1 -1
  613. package/src/social-links/edit.js +1 -0
  614. package/src/spacer/block.json +7 -1
  615. package/src/style.scss +2 -0
  616. package/src/table/block.json +4 -0
  617. package/src/table/state.js +21 -19
  618. package/src/table-of-contents/block.json +11 -1
  619. package/src/tag-cloud/block.json +5 -1
  620. package/src/template-part/index.js +3 -2
  621. package/src/term-description/block.json +4 -0
  622. package/src/text-columns/edit.js +2 -2
  623. package/src/text-columns/save.js +2 -2
  624. package/src/verse/block.json +1 -0
  625. package/src/video/block.json +4 -0
  626. package/src/video/style.scss +2 -0
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { Platform } from 'react-native';
5
- import { sortBy } from 'lodash';
6
5
 
7
6
  /**
8
7
  * WordPress dependencies
@@ -161,16 +160,22 @@ export const registerBlock = ( block ) => {
161
160
  const registerBlockVariations = ( block ) => {
162
161
  const { metadata, settings, name } = block;
163
162
 
164
- sortBy( settings.variations, 'title' ).forEach( ( v ) => {
165
- registerBlockType( `${ name }-${ v.name }`, {
166
- ...metadata,
167
- name: `${ name }-${ v.name }`,
168
- ...settings,
169
- icon: v.icon(),
170
- title: v.title,
171
- variations: [],
163
+ if ( ! settings.variations ) {
164
+ return;
165
+ }
166
+
167
+ [ ...settings.variations ]
168
+ .sort( ( a, b ) => a.title.localeCompare( b.title ) )
169
+ .forEach( ( v ) => {
170
+ registerBlockType( `${ name }-${ v.name }`, {
171
+ ...metadata,
172
+ name: `${ name }-${ v.name }`,
173
+ ...settings,
174
+ icon: v.icon(),
175
+ title: v.title,
176
+ variations: [],
177
+ } );
172
178
  } );
173
- } );
174
179
  };
175
180
 
176
181
  // Only enable code block for development
@@ -27,6 +27,7 @@ import {
27
27
  useOutdentListItem,
28
28
  useSplit,
29
29
  useMerge,
30
+ useCopy,
30
31
  } from './hooks';
31
32
  import { convertToListItems } from './utils';
32
33
 
@@ -61,7 +62,7 @@ export default function ListItemEdit( {
61
62
  clientId,
62
63
  } ) {
63
64
  const { placeholder, content } = attributes;
64
- const blockProps = useBlockProps();
65
+ const blockProps = useBlockProps( { ref: useCopy( clientId ) } );
65
66
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
66
67
  allowedBlocks: [ 'core/list' ],
67
68
  } );
@@ -4,3 +4,4 @@ export { default as useEnter } from './use-enter';
4
4
  export { default as useSpace } from './use-space';
5
5
  export { default as useSplit } from './use-split';
6
6
  export { default as useMerge } from './use-merge';
7
+ export { default as useCopy } from './use-copy';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useRefEffect } from '@wordpress/compose';
5
+ import { store as blockEditorStore } from '@wordpress/block-editor';
6
+ import { useSelect } from '@wordpress/data';
7
+
8
+ export default function useCopy( clientId ) {
9
+ const { getBlockRootClientId, getBlockName, getBlockAttributes } =
10
+ useSelect( blockEditorStore );
11
+
12
+ return useRefEffect( ( node ) => {
13
+ function onCopy( event ) {
14
+ // The event propagates through all nested lists, so don't override
15
+ // when copying nested list items.
16
+ if ( event.clipboardData.getData( '__unstableWrapperBlockName' ) ) {
17
+ return;
18
+ }
19
+
20
+ const rootClientId = getBlockRootClientId( clientId );
21
+ event.clipboardData.setData(
22
+ '__unstableWrapperBlockName',
23
+ getBlockName( rootClientId )
24
+ );
25
+ event.clipboardData.setData(
26
+ '__unstableWrapperBlockAttributes',
27
+ JSON.stringify( getBlockAttributes( rootClientId ) )
28
+ );
29
+ }
30
+
31
+ node.addEventListener( 'copy', onCopy );
32
+ return () => {
33
+ node.removeEventListener( 'copy', onCopy );
34
+ };
35
+ }, [] );
36
+ }
@@ -8,6 +8,7 @@ import { View, Text } from 'react-native';
8
8
  */
9
9
  import { Icon } from '@wordpress/components';
10
10
  import { Platform } from '@wordpress/element';
11
+ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
@@ -109,9 +110,15 @@ export default function ListStyleType( {
109
110
  style?.fontSize ? style.fontSize : defaultFontSize,
110
111
  10
111
112
  );
113
+
114
+ const colorWithPreferredScheme = usePreferredColorSchemeStyle(
115
+ styles[ 'wp-block-list-item__list-item--default' ],
116
+ styles[ 'wp-block-list-item__list-item--default--dark' ]
117
+ );
118
+
112
119
  const defaultColor = style?.baseColors?.color?.text
113
120
  ? style.baseColors.color.text
114
- : styles[ 'wp-block-list-item__list-item--default' ].color;
121
+ : colorWithPreferredScheme.color;
115
122
  const color = style?.color ? style.color : defaultColor;
116
123
 
117
124
  if ( ordered ) {
@@ -28,6 +28,10 @@
28
28
  font-size: $editor-font-size;
29
29
  }
30
30
 
31
+ .wp-block-list-item__list-item--default--dark {
32
+ color: $white;
33
+ }
34
+
31
35
  .wp-block-list-item__list-item-ordered--default {
32
36
  margin-top: 2;
33
37
  }
@@ -97,6 +97,19 @@
97
97
  "background": true,
98
98
  "text": true
99
99
  }
100
+ },
101
+ "typography": {
102
+ "fontSize": true,
103
+ "lineHeight": true,
104
+ "__experimentalFontFamily": true,
105
+ "__experimentalFontWeight": true,
106
+ "__experimentalFontStyle": true,
107
+ "__experimentalTextTransform": true,
108
+ "__experimentalTextDecoration": true,
109
+ "__experimentalLetterSpacing": true,
110
+ "__experimentalDefaultControls": {
111
+ "fontSize": true
112
+ }
100
113
  }
101
114
  },
102
115
  "editorStyle": "wp-block-media-text-editor",
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
- import { isEmpty, omit } from 'lodash';
5
+ import { isEmpty } from 'lodash';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -42,8 +42,9 @@ const migrateCustomColors = ( attributes ) => {
42
42
  background: attributes.customBackgroundColor,
43
43
  },
44
44
  };
45
+ const { customBackgroundColor, ...restAttributes } = attributes;
45
46
  return {
46
- ...omit( attributes, [ 'customBackgroundColor' ] ),
47
+ ...restAttributes,
47
48
  style,
48
49
  };
49
50
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { mapValues, omit } from 'lodash';
4
+ import { mapValues } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -552,8 +552,10 @@ const deprecated = [
552
552
  inserter: true,
553
553
  },
554
554
  migrate: compose( migrateIdToRef, ( attributes ) => {
555
+ const { rgbTextColor, rgbBackgroundColor, ...restAttributes } =
556
+ attributes;
555
557
  return {
556
- ...omit( attributes, [ 'rgbTextColor', 'rgbBackgroundColor' ] ),
558
+ ...restAttributes,
557
559
  customTextColor: attributes.textColor
558
560
  ? undefined
559
561
  : attributes.rgbTextColor,
@@ -6,13 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import {
10
- useState,
11
- useEffect,
12
- useRef,
13
- useCallback,
14
- Platform,
15
- } from '@wordpress/element';
9
+ import { useState, useEffect, useRef, Platform } from '@wordpress/element';
16
10
  import {
17
11
  InspectorControls,
18
12
  BlockControls,
@@ -29,7 +23,7 @@ import {
29
23
  } from '@wordpress/block-editor';
30
24
  import { EntityProvider } from '@wordpress/core-data';
31
25
 
32
- import { useDispatch, useRegistry } from '@wordpress/data';
26
+ import { useDispatch } from '@wordpress/data';
33
27
  import {
34
28
  PanelBody,
35
29
  ToggleControl,
@@ -41,6 +35,7 @@ import {
41
35
  } from '@wordpress/components';
42
36
  import { __, sprintf } from '@wordpress/i18n';
43
37
  import { speak } from '@wordpress/a11y';
38
+ import { createBlock } from '@wordpress/blocks';
44
39
 
45
40
  /**
46
41
  * Internal dependencies
@@ -100,7 +95,6 @@ function Navigation( {
100
95
 
101
96
  const ref = attributes.ref;
102
97
 
103
- const registry = useRegistry();
104
98
  const setRef = ( postId ) => {
105
99
  setAttributes( { ref: postId } );
106
100
  };
@@ -210,19 +204,37 @@ function Navigation( {
210
204
  const navMenuResolvedButMissing =
211
205
  hasResolvedNavigationMenus && isNavigationMenuMissing;
212
206
 
213
- // Attempt to retrieve and prioritize any existing navigation menu unless
214
- // a specific ref is allocated or the user is explicitly creating a new menu. The aim is
215
- // for the block to "just work" from a user perspective using existing data.
207
+ // Attempt to retrieve and prioritize any existing navigation menu unless:
208
+ // - the are uncontrolled inner blocks already present in the block.
209
+ // - the user is creating a new menu.
210
+ // - there are no menus to choose from.
211
+ // This attempts to pick the first menu if there is a single Navigation Post. If more
212
+ // than 1 exists then use the most recent.
213
+ // The aim is for the block to "just work" from a user perspective using existing data.
216
214
  useEffect( () => {
217
215
  if (
216
+ hasUncontrolledInnerBlocks ||
218
217
  isCreatingNavigationMenu ||
219
218
  ref ||
220
- ! navigationMenus?.length ||
221
- navigationMenus?.length > 1
219
+ ! navigationMenus?.length
222
220
  ) {
223
221
  return;
224
222
  }
225
223
 
224
+ navigationMenus.sort( ( menuA, menuB ) => {
225
+ const menuADate = new Date( menuA.date );
226
+ const menuBDate = new Date( menuB.date );
227
+ return menuADate.getTime() < menuBDate.getTime();
228
+ } );
229
+
230
+ /**
231
+ * This fallback displays (both in editor and on front)
232
+ * a list of pages only if no menu (user assigned or
233
+ * automatically picked) is available.
234
+ * The fallback should not request a save (entity dirty state)
235
+ * nor to be undoable, hence why it is marked as non persistent
236
+ */
237
+ __unstableMarkNextChangeAsNotPersistent();
226
238
  setRef( navigationMenus[ 0 ].id );
227
239
  }, [ navigationMenus ] );
228
240
 
@@ -231,10 +243,9 @@ function Navigation( {
231
243
  const isDraftNavigationMenu = navigationMenu?.status === 'draft';
232
244
 
233
245
  const {
234
- convert,
246
+ convert: convertClassicMenu,
235
247
  status: classicMenuConversionStatus,
236
248
  error: classicMenuConversionError,
237
- value: classicMenuConversionResult,
238
249
  } = useConvertClassicToBlockMenu( clientId );
239
250
 
240
251
  const isConvertingClassicMenu =
@@ -255,13 +266,24 @@ function Navigation( {
255
266
  hasResolvedNavigationMenus &&
256
267
  ! hasUncontrolledInnerBlocks;
257
268
 
269
+ if ( isPlaceholder && ! ref ) {
270
+ /**
271
+ * this fallback only displays (both in editor and on front)
272
+ * the list of pages block if no menu is available as a fallback.
273
+ * We don't want the fallback to request a save,
274
+ * nor to be undoable, hence we mark it non persistent.
275
+ */
276
+ __unstableMarkNextChangeAsNotPersistent();
277
+ replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] );
278
+ }
279
+
258
280
  const isEntityAvailable =
259
281
  ! isNavigationMenuMissing && isNavigationMenuResolved;
260
282
 
261
283
  // "loading" state:
262
284
  // - there is a menu creation process in progress.
263
285
  // - there is a classic menu conversion process in progress.
264
- // OR
286
+ // OR:
265
287
  // - there is a ref attribute pointing to a Navigation Post
266
288
  // - the Navigation Post isn't available (hasn't resolved) yet.
267
289
  const isLoading =
@@ -273,38 +295,30 @@ function Navigation( {
273
295
  const textDecoration = attributes.style?.typography?.textDecoration;
274
296
 
275
297
  const hasBlockOverlay = useBlockOverlayActive( clientId );
276
- const blockProps = useBlockProps(
277
- {
278
- ref: navRef,
279
- className: classnames( className, {
280
- 'items-justified-right': justifyContent === 'right',
281
- 'items-justified-space-between':
282
- justifyContent === 'space-between',
283
- 'items-justified-left': justifyContent === 'left',
284
- 'items-justified-center': justifyContent === 'center',
285
- 'is-vertical': orientation === 'vertical',
286
- 'no-wrap': flexWrap === 'nowrap',
287
- 'is-responsive': 'never' !== overlayMenu,
288
- 'has-text-color': !! textColor.color || !! textColor?.class,
289
- [ getColorClassName( 'color', textColor?.slug ) ]:
290
- !! textColor?.slug,
291
- 'has-background':
292
- !! backgroundColor.color || backgroundColor.class,
293
- [ getColorClassName(
294
- 'background-color',
295
- backgroundColor?.slug
296
- ) ]: !! backgroundColor?.slug,
297
- [ `has-text-decoration-${ textDecoration }` ]: textDecoration,
298
- 'block-editor-block-content-overlay': hasBlockOverlay,
299
- } ),
300
- style: {
301
- color: ! textColor?.slug && textColor?.color,
302
- backgroundColor:
303
- ! backgroundColor?.slug && backgroundColor?.color,
304
- },
298
+ const blockProps = useBlockProps( {
299
+ ref: navRef,
300
+ className: classnames( className, {
301
+ 'items-justified-right': justifyContent === 'right',
302
+ 'items-justified-space-between': justifyContent === 'space-between',
303
+ 'items-justified-left': justifyContent === 'left',
304
+ 'items-justified-center': justifyContent === 'center',
305
+ 'is-vertical': orientation === 'vertical',
306
+ 'no-wrap': flexWrap === 'nowrap',
307
+ 'is-responsive': 'never' !== overlayMenu,
308
+ 'has-text-color': !! textColor.color || !! textColor?.class,
309
+ [ getColorClassName( 'color', textColor?.slug ) ]:
310
+ !! textColor?.slug,
311
+ 'has-background': !! backgroundColor.color || backgroundColor.class,
312
+ [ getColorClassName( 'background-color', backgroundColor?.slug ) ]:
313
+ !! backgroundColor?.slug,
314
+ [ `has-text-decoration-${ textDecoration }` ]: textDecoration,
315
+ 'block-editor-block-content-overlay': hasBlockOverlay,
316
+ } ),
317
+ style: {
318
+ color: ! textColor?.slug && textColor?.color,
319
+ backgroundColor: ! backgroundColor?.slug && backgroundColor?.color,
305
320
  },
306
- { __unstableIsDisabled: hasBlockOverlay }
307
- );
321
+ } );
308
322
 
309
323
  // Turn on contrast checker for web only since it's not supported on mobile yet.
310
324
  const enableContrastChecking = Platform.OS === 'web';
@@ -328,11 +342,7 @@ function Navigation( {
328
342
  speak( __( 'Classic menu importing.' ) );
329
343
  }
330
344
 
331
- if (
332
- classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_SUCCESS &&
333
- classicMenuConversionResult
334
- ) {
335
- handleUpdateMenu( classicMenuConversionResult?.id );
345
+ if ( classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_SUCCESS ) {
336
346
  showClassicMenuConversionNotice(
337
347
  __( 'Classic menu imported successfully.' )
338
348
  );
@@ -343,11 +353,7 @@ function Navigation( {
343
353
  __( 'Classic menu import failed.' )
344
354
  );
345
355
  }
346
- }, [
347
- classicMenuConversionStatus,
348
- classicMenuConversionResult,
349
- classicMenuConversionError,
350
- ] );
356
+ }, [ classicMenuConversionStatus, classicMenuConversionError ] );
351
357
 
352
358
  // Spacer block needs orientation from context. This is a patch until
353
359
  // https://github.com/WordPress/gutenberg/issues/36197 is addressed.
@@ -441,17 +447,6 @@ function Navigation( {
441
447
  shouldFocusNavigationSelector,
442
448
  ] );
443
449
 
444
- const resetToEmptyBlock = useCallback( () => {
445
- registry.batch( () => {
446
- setAttributes( {
447
- ref: undefined,
448
- } );
449
- if ( ! ref ) {
450
- replaceInnerBlocks( clientId, [] );
451
- }
452
- } );
453
- }, [ clientId, ref ] );
454
-
455
450
  const isResponsive = 'never' !== overlayMenu;
456
451
 
457
452
  const overlayMenuPreviewClasses = classnames(
@@ -600,6 +595,33 @@ function Navigation( {
600
595
  if ( hasUnsavedBlocks ) {
601
596
  return (
602
597
  <TagName { ...blockProps }>
598
+ <BlockControls>
599
+ <ToolbarGroup className="wp-block-navigation__toolbar-menu-selector">
600
+ <NavigationMenuSelector
601
+ ref={ null }
602
+ currentMenuId={ null }
603
+ clientId={ clientId }
604
+ onSelectNavigationMenu={ ( menuId ) => {
605
+ handleUpdateMenu( menuId );
606
+ setShouldFocusNavigationSelector( true );
607
+ } }
608
+ onSelectClassicMenu={ async ( classicMenu ) => {
609
+ const navMenu = await convertClassicMenu(
610
+ classicMenu.id,
611
+ classicMenu.name
612
+ );
613
+ if ( navMenu ) {
614
+ handleUpdateMenu( navMenu.id );
615
+ setShouldFocusNavigationSelector( true );
616
+ }
617
+ } }
618
+ onCreateNew={ () => createNavigationMenu( '', [] ) }
619
+ /* translators: %s: The name of a menu. */
620
+ actionLabel={ __( "Switch to '%s'" ) }
621
+ showManageActions
622
+ />
623
+ </ToolbarGroup>
624
+ </BlockControls>
603
625
  { stylingInspectorControls }
604
626
  <ResponsiveWrapper
605
627
  id={ clientId }
@@ -639,16 +661,46 @@ function Navigation( {
639
661
  // TODO - the user should be able to select a new one?
640
662
  if ( ref && isNavigationMenuMissing ) {
641
663
  return (
642
- <div { ...blockProps }>
664
+ <TagName { ...blockProps }>
665
+ <BlockControls>
666
+ <ToolbarGroup className="wp-block-navigation__toolbar-menu-selector">
667
+ <NavigationMenuSelector
668
+ ref={ navigationSelectorRef }
669
+ currentMenuId={ ref }
670
+ clientId={ clientId }
671
+ onSelectNavigationMenu={ ( menuId ) => {
672
+ handleUpdateMenu( menuId );
673
+ setShouldFocusNavigationSelector( true );
674
+ } }
675
+ onSelectClassicMenu={ async ( classicMenu ) => {
676
+ const navMenu = await convertClassicMenu(
677
+ classicMenu.id,
678
+ classicMenu.name
679
+ );
680
+ if ( navMenu ) {
681
+ handleUpdateMenu( navMenu.id );
682
+ setShouldFocusNavigationSelector( true );
683
+ }
684
+ } }
685
+ onCreateNew={ () => createNavigationMenu( '', [] ) }
686
+ /* translators: %s: The name of a menu. */
687
+ actionLabel={ __( "Switch to '%s'" ) }
688
+ showManageActions
689
+ />
690
+ </ToolbarGroup>
691
+ </BlockControls>
643
692
  <Warning>
644
693
  { __(
645
694
  'Navigation menu has been deleted or is unavailable. '
646
695
  ) }
647
- <Button onClick={ resetToEmptyBlock } variant="link">
696
+ <Button
697
+ onClick={ () => createNavigationMenu( '', [] ) }
698
+ variant="link"
699
+ >
648
700
  { __( 'Create a new menu?' ) }
649
701
  </Button>
650
702
  </Warning>
651
- </div>
703
+ </TagName>
652
704
  );
653
705
  }
654
706
 
@@ -666,7 +718,17 @@ function Navigation( {
666
718
  ? CustomPlaceholder
667
719
  : Placeholder;
668
720
 
669
- if ( isPlaceholder ) {
721
+ /**
722
+ * Historically the navigation block has supported custom placeholders.
723
+ * Even though the current UX tries as hard as possible not to
724
+ * end up in a placeholder state, the block continues to support
725
+ * this extensibility point, via a CustomPlaceholder.
726
+ * When CustomPlaceholder is present it becomes the default fallback
727
+ * for an empty navigation block, instead of the default fallbacks.
728
+ *
729
+ */
730
+
731
+ if ( isPlaceholder && CustomPlaceholder ) {
670
732
  return (
671
733
  <TagName { ...blockProps }>
672
734
  <PlaceholderComponent
@@ -681,9 +743,15 @@ function Navigation( {
681
743
  handleUpdateMenu( menuId );
682
744
  setShouldFocusNavigationSelector( true );
683
745
  } }
684
- onSelectClassicMenu={ ( classicMenu ) => {
685
- convert( classicMenu.id, classicMenu.name );
686
- setShouldFocusNavigationSelector( true );
746
+ onSelectClassicMenu={ async ( classicMenu ) => {
747
+ const navMenu = await convertClassicMenu(
748
+ classicMenu.id,
749
+ classicMenu.name
750
+ );
751
+ if ( navMenu ) {
752
+ handleUpdateMenu( navMenu.id );
753
+ setShouldFocusNavigationSelector( true );
754
+ }
687
755
  } }
688
756
  onCreateEmpty={ () => createNavigationMenu( '', [] ) }
689
757
  />
@@ -705,11 +773,21 @@ function Navigation( {
705
773
  handleUpdateMenu( menuId );
706
774
  setShouldFocusNavigationSelector( true );
707
775
  } }
708
- onSelectClassicMenu={ ( classicMenu ) => {
709
- convert( classicMenu.id, classicMenu.name );
710
- setShouldFocusNavigationSelector( true );
776
+ onSelectClassicMenu={ async ( classicMenu ) => {
777
+ const navMenu = await convertClassicMenu(
778
+ classicMenu.id,
779
+ classicMenu.name
780
+ );
781
+ if ( navMenu ) {
782
+ handleUpdateMenu( navMenu.id );
783
+ setShouldFocusNavigationSelector(
784
+ true
785
+ );
786
+ }
711
787
  } }
712
- onCreateNew={ resetToEmptyBlock }
788
+ onCreateNew={ () =>
789
+ createNavigationMenu( '', [] )
790
+ }
713
791
  /* translators: %s: The name of a menu. */
714
792
  actionLabel={ __( "Switch to '%s'" ) }
715
793
  showManageActions
@@ -728,7 +806,7 @@ function Navigation( {
728
806
  canUserDeleteNavigationMenu && (
729
807
  <NavigationMenuDeleteControl
730
808
  onDelete={ ( deletedMenuTitle = '' ) => {
731
- resetToEmptyBlock();
809
+ replaceInnerBlocks( clientId, [] );
732
810
  showNavigationMenuStatusNotice(
733
811
  sprintf(
734
812
  // translators: %s: the name of a menu (e.g. Header navigation).
@@ -63,7 +63,9 @@ export default function UnsavedInnerBlocks( {
63
63
  // from the original inner blocks from the post content then the
64
64
  // user has made changes to the inner blocks. At this point the inner
65
65
  // blocks can be considered "dirty".
66
- const innerBlocksAreDirty = blocks !== originalBlocks.current;
66
+ // We also make sure the current innerBlocks had a chance to be set.
67
+ const innerBlocksAreDirty =
68
+ !! originalBlocks.current && blocks !== originalBlocks.current;
67
69
 
68
70
  const shouldDirectInsert = useMemo(
69
71
  () =>
@@ -23,7 +23,6 @@ function useConvertClassicToBlockMenu( clientId ) {
23
23
  const registry = useRegistry();
24
24
 
25
25
  const [ status, setStatus ] = useState( CLASSIC_MENU_CONVERSION_IDLE );
26
- const [ value, setValue ] = useState( null );
27
26
  const [ error, setError ] = useState( null );
28
27
 
29
28
  async function convertClassicMenuToBlockMenu( menuId, menuName ) {
@@ -88,47 +87,42 @@ function useConvertClassicToBlockMenu( clientId ) {
88
87
  return navigationMenu;
89
88
  }
90
89
 
91
- const convert = useCallback(
92
- ( menuId, menuName ) => {
93
- if ( ! menuId || ! menuName ) {
94
- setError( 'Unable to convert menu. Missing menu details.' );
90
+ const convert = useCallback( async ( menuId, menuName ) => {
91
+ if ( ! menuId || ! menuName ) {
92
+ setError( 'Unable to convert menu. Missing menu details.' );
93
+ setStatus( CLASSIC_MENU_CONVERSION_ERROR );
94
+ return;
95
+ }
96
+
97
+ setStatus( CLASSIC_MENU_CONVERSION_PENDING );
98
+ setError( null );
99
+
100
+ return await convertClassicMenuToBlockMenu( menuId, menuName )
101
+ .then( ( navigationMenu ) => {
102
+ setStatus( CLASSIC_MENU_CONVERSION_SUCCESS );
103
+ return navigationMenu;
104
+ } )
105
+ .catch( ( err ) => {
106
+ setError( err?.message );
95
107
  setStatus( CLASSIC_MENU_CONVERSION_ERROR );
96
- return;
97
- }
98
-
99
- setStatus( CLASSIC_MENU_CONVERSION_PENDING );
100
- setValue( null );
101
- setError( null );
102
-
103
- convertClassicMenuToBlockMenu( menuId, menuName )
104
- .then( ( navMenu ) => {
105
- setValue( navMenu );
106
- setStatus( CLASSIC_MENU_CONVERSION_SUCCESS );
107
- } )
108
- .catch( ( err ) => {
109
- setError( err?.message );
110
- setStatus( CLASSIC_MENU_CONVERSION_ERROR );
111
-
112
- // Rethrow error for debugging.
113
- throw new Error(
114
- sprintf(
115
- // translators: %s: the name of a menu (e.g. Header navigation).
116
- __( `Unable to create Navigation Menu "%s".` ),
117
- menuName
118
- ),
119
- {
120
- cause: err,
121
- }
122
- );
123
- } );
124
- },
125
- [ clientId ]
126
- );
108
+
109
+ // Rethrow error for debugging.
110
+ throw new Error(
111
+ sprintf(
112
+ // translators: %s: the name of a menu (e.g. Header navigation).
113
+ __( `Unable to create Navigation Menu "%s".` ),
114
+ menuName
115
+ ),
116
+ {
117
+ cause: err,
118
+ }
119
+ );
120
+ } );
121
+ }, [] );
127
122
 
128
123
  return {
129
124
  convert,
130
125
  status,
131
- value,
132
126
  error,
133
127
  };
134
128
  }