@wordpress/block-library 7.1.0 → 7.3.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 (634) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/build/archives/edit.js +21 -1
  4. package/build/archives/edit.js.map +1 -1
  5. package/build/archives/index.js +5 -1
  6. package/build/archives/index.js.map +1 -1
  7. package/build/audio/edit.native.js +0 -5
  8. package/build/audio/edit.native.js.map +1 -1
  9. package/build/avatar/edit.js +211 -0
  10. package/build/avatar/edit.js.map +1 -0
  11. package/build/avatar/hooks.js +111 -0
  12. package/build/avatar/hooks.js.map +1 -0
  13. package/build/avatar/index.js +83 -0
  14. package/build/avatar/index.js.map +1 -0
  15. package/build/avatar/user-control.js +63 -0
  16. package/build/avatar/user-control.js.map +1 -0
  17. package/build/block/edit.js +2 -1
  18. package/build/block/edit.js.map +1 -1
  19. package/build/column/index.js +3 -1
  20. package/build/column/index.js.map +1 -1
  21. package/build/comment-author-avatar/index.js +4 -3
  22. package/build/comment-author-avatar/index.js.map +1 -1
  23. package/build/comment-author-name/index.js +7 -3
  24. package/build/comment-author-name/index.js.map +1 -1
  25. package/build/comment-content/index.js +1 -1
  26. package/build/comment-date/edit.js +10 -25
  27. package/build/comment-date/edit.js.map +1 -1
  28. package/build/comment-date/index.js +7 -3
  29. package/build/comment-date/index.js.map +1 -1
  30. package/build/comment-edit-link/index.js +5 -1
  31. package/build/comment-edit-link/index.js.map +1 -1
  32. package/build/comment-reply-link/index.js +5 -1
  33. package/build/comment-reply-link/index.js.map +1 -1
  34. package/build/comment-template/edit.js +86 -66
  35. package/build/comment-template/edit.js.map +1 -1
  36. package/build/comment-template/hooks.js +7 -23
  37. package/build/comment-template/hooks.js.map +1 -1
  38. package/build/comment-template/index.js +2 -2
  39. package/build/comments-pagination-next/index.js +2 -2
  40. package/build/comments-pagination-numbers/index.js +1 -1
  41. package/build/comments-pagination-previous/index.js +1 -1
  42. package/build/comments-query-loop/edit/comments-inspector-controls.js +2 -69
  43. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  44. package/build/comments-query-loop/edit.js +22 -1
  45. package/build/comments-query-loop/edit.js.map +1 -1
  46. package/build/comments-query-loop/index.js +1 -23
  47. package/build/comments-query-loop/index.js.map +1 -1
  48. package/build/cover/edit.js +58 -39
  49. package/build/cover/edit.js.map +1 -1
  50. package/build/cover/index.js +5 -0
  51. package/build/cover/index.js.map +1 -1
  52. package/build/cover/save.js +3 -2
  53. package/build/cover/save.js.map +1 -1
  54. package/build/embed/variations.js +2 -2
  55. package/build/embed/variations.js.map +1 -1
  56. package/build/gallery/edit.js +18 -5
  57. package/build/gallery/edit.js.map +1 -1
  58. package/build/gallery/gallery.js +1 -1
  59. package/build/gallery/gallery.js.map +1 -1
  60. package/build/gallery/gap-styles.js +35 -0
  61. package/build/gallery/gap-styles.js.map +1 -0
  62. package/build/gallery/index.js +18 -1
  63. package/build/gallery/index.js.map +1 -1
  64. package/build/group/edit.js +3 -1
  65. package/build/group/edit.js.map +1 -1
  66. package/build/group/index.js +1 -1
  67. package/build/group/variations.js +30 -9
  68. package/build/group/variations.js.map +1 -1
  69. package/build/heading/edit.js +1 -1
  70. package/build/heading/edit.js.map +1 -1
  71. package/build/html/edit.js +3 -2
  72. package/build/html/edit.js.map +1 -1
  73. package/build/image/edit.native.js +8 -10
  74. package/build/image/edit.native.js.map +1 -1
  75. package/build/image/image.js +3 -1
  76. package/build/image/image.js.map +1 -1
  77. package/build/index.js +10 -4
  78. package/build/index.js.map +1 -1
  79. package/build/list/deprecated.js +2 -2
  80. package/build/list/deprecated.js.map +1 -1
  81. package/build/list/index.js +5 -7
  82. package/build/list/index.js.map +1 -1
  83. package/build/list/v2/deprecated.js +117 -0
  84. package/build/list/v2/deprecated.js.map +1 -0
  85. package/build/list/v2/edit.js +188 -0
  86. package/build/list/v2/edit.js.map +1 -0
  87. package/build/list/v2/index.js +36 -0
  88. package/build/list/v2/index.js.map +1 -0
  89. package/build/list/v2/migrate.js +85 -0
  90. package/build/list/v2/migrate.js.map +1 -0
  91. package/build/list/v2/save.js +34 -0
  92. package/build/list/v2/save.js.map +1 -0
  93. package/build/list/v2/transforms.js +121 -0
  94. package/build/list/v2/transforms.js.map +1 -0
  95. package/build/list-item/edit.js +96 -0
  96. package/build/list-item/edit.js.map +1 -0
  97. package/build/list-item/hooks/index.js +32 -0
  98. package/build/list-item/hooks/index.js.map +1 -0
  99. package/build/list-item/hooks/use-enter.js +93 -0
  100. package/build/list-item/hooks/use-enter.js.map +1 -0
  101. package/build/list-item/hooks/use-indent-list-item.js +74 -0
  102. package/build/list-item/hooks/use-indent-list-item.js.map +1 -0
  103. package/build/list-item/hooks/use-outdent-list-item.js +77 -0
  104. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -0
  105. package/build/list-item/index.js +67 -0
  106. package/build/list-item/index.js.map +1 -0
  107. package/build/list-item/save.js +23 -0
  108. package/build/list-item/save.js.map +1 -0
  109. package/build/list-item/utils.js +16 -0
  110. package/build/list-item/utils.js.map +1 -0
  111. package/build/media-text/edit.js +3 -1
  112. package/build/media-text/edit.js.map +1 -1
  113. package/build/media-text/media-container.native.js +1 -16
  114. package/build/media-text/media-container.native.js.map +1 -1
  115. package/build/navigation/edit/index.js +36 -17
  116. package/build/navigation/edit/index.js.map +1 -1
  117. package/build/navigation/edit/navigation-menu-delete-control.js +1 -1
  118. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  119. package/build/navigation/edit/unsaved-inner-blocks.js +34 -7
  120. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  121. package/build/navigation/index.js +9 -1
  122. package/build/navigation/index.js.map +1 -1
  123. package/build/navigation/use-navigation-entities.js +26 -54
  124. package/build/navigation/use-navigation-entities.js.map +1 -1
  125. package/build/navigation/use-navigation-menu.js +1 -0
  126. package/build/navigation/use-navigation-menu.js.map +1 -1
  127. package/build/navigation-link/edit.js +95 -37
  128. package/build/navigation-link/edit.js.map +1 -1
  129. package/build/navigation-link/index.js +1 -1
  130. package/build/navigation-submenu/edit.js +5 -9
  131. package/build/navigation-submenu/edit.js.map +1 -1
  132. package/build/navigation-submenu/index.js +1 -1
  133. package/build/post-comment/edit.js +2 -2
  134. package/build/post-comment/edit.js.map +1 -1
  135. package/build/post-comments-form/edit.js +3 -2
  136. package/build/post-comments-form/edit.js.map +1 -1
  137. package/build/post-date/edit.js +31 -37
  138. package/build/post-date/edit.js.map +1 -1
  139. package/build/post-featured-image/edit.js +2 -1
  140. package/build/post-featured-image/edit.js.map +1 -1
  141. package/build/post-featured-image/index.js +1 -1
  142. package/build/post-template/edit.js +7 -2
  143. package/build/post-template/edit.js.map +1 -1
  144. package/build/post-terms/edit.js +3 -1
  145. package/build/post-terms/edit.js.map +1 -1
  146. package/build/post-terms/variations.js +1 -1
  147. package/build/post-terms/variations.js.map +1 -1
  148. package/build/pullquote/edit.js +5 -3
  149. package/build/pullquote/edit.js.map +1 -1
  150. package/build/query/variations.js +4 -4
  151. package/build/query/variations.js.map +1 -1
  152. package/build/query-no-results/edit.js +28 -0
  153. package/build/query-no-results/edit.js.map +1 -0
  154. package/build/query-no-results/index.js +54 -0
  155. package/build/query-no-results/index.js.map +1 -0
  156. package/build/query-no-results/save.js +18 -0
  157. package/build/query-no-results/save.js.map +1 -0
  158. package/build/query-pagination/edit.js +1 -1
  159. package/build/query-pagination/edit.js.map +1 -1
  160. package/build/query-pagination-numbers/index.js +19 -1
  161. package/build/query-pagination-numbers/index.js.map +1 -1
  162. package/build/quote/index.js +15 -8
  163. package/build/quote/index.js.map +1 -1
  164. package/build/quote/v2/deprecated.js +133 -0
  165. package/build/quote/v2/deprecated.js.map +1 -0
  166. package/build/quote/v2/edit.js +131 -0
  167. package/build/quote/v2/edit.js.map +1 -0
  168. package/build/quote/v2/index.js +49 -0
  169. package/build/quote/v2/index.js.map +1 -0
  170. package/build/quote/v2/save.js +43 -0
  171. package/build/quote/v2/save.js.map +1 -0
  172. package/build/quote/v2/transforms.js +156 -0
  173. package/build/quote/v2/transforms.js.map +1 -0
  174. package/build/read-more/index.js +1 -1
  175. package/build/rss/edit.js +6 -1
  176. package/build/rss/edit.js.map +1 -1
  177. package/build/search/edit.js +2 -3
  178. package/build/search/edit.js.map +1 -1
  179. package/build/separator/deprecated.js +83 -0
  180. package/build/separator/deprecated.js.map +1 -0
  181. package/build/separator/edit.js +31 -23
  182. package/build/separator/edit.js.map +1 -1
  183. package/build/separator/index.js +17 -7
  184. package/build/separator/index.js.map +1 -1
  185. package/build/separator/save.js +18 -13
  186. package/build/separator/save.js.map +1 -1
  187. package/build/separator/use-deprecated-opacity.js +39 -0
  188. package/build/separator/use-deprecated-opacity.js.map +1 -0
  189. package/build/site-logo/edit.js +3 -2
  190. package/build/site-logo/edit.js.map +1 -1
  191. package/build/site-logo/index.js +1 -1
  192. package/build/social-links/edit.js +14 -3
  193. package/build/social-links/edit.js.map +1 -1
  194. package/build/social-links/index.js +2 -1
  195. package/build/social-links/index.js.map +1 -1
  196. package/build/spacer/controls.js +6 -16
  197. package/build/spacer/controls.js.map +1 -1
  198. package/build/spacer/controls.native.js +3 -1
  199. package/build/spacer/controls.native.js.map +1 -1
  200. package/build/spacer/edit.js +4 -5
  201. package/build/spacer/edit.js.map +1 -1
  202. package/build/table/deprecated.js +1 -1
  203. package/build/table/deprecated.js.map +1 -1
  204. package/build/tag-cloud/edit.js +58 -2
  205. package/build/tag-cloud/edit.js.map +1 -1
  206. package/build/tag-cloud/index.js +8 -0
  207. package/build/tag-cloud/index.js.map +1 -1
  208. package/build/template-part/edit/utils/hooks.js +5 -2
  209. package/build/template-part/edit/utils/hooks.js.map +1 -1
  210. package/build-module/archives/edit.js +22 -2
  211. package/build-module/archives/edit.js.map +1 -1
  212. package/build-module/archives/index.js +5 -1
  213. package/build-module/archives/index.js.map +1 -1
  214. package/build-module/audio/edit.native.js +0 -5
  215. package/build-module/audio/edit.native.js.map +1 -1
  216. package/build-module/avatar/edit.js +195 -0
  217. package/build-module/avatar/edit.js.map +1 -0
  218. package/build-module/avatar/hooks.js +99 -0
  219. package/build-module/avatar/hooks.js.map +1 -0
  220. package/build-module/avatar/index.js +70 -0
  221. package/build-module/avatar/index.js.map +1 -0
  222. package/build-module/avatar/user-control.js +52 -0
  223. package/build-module/avatar/user-control.js.map +1 -0
  224. package/build-module/block/edit.js +4 -3
  225. package/build-module/block/edit.js.map +1 -1
  226. package/build-module/column/index.js +3 -1
  227. package/build-module/column/index.js.map +1 -1
  228. package/build-module/comment-author-avatar/index.js +4 -3
  229. package/build-module/comment-author-avatar/index.js.map +1 -1
  230. package/build-module/comment-author-name/index.js +7 -3
  231. package/build-module/comment-author-name/index.js.map +1 -1
  232. package/build-module/comment-content/index.js +1 -1
  233. package/build-module/comment-date/edit.js +13 -30
  234. package/build-module/comment-date/edit.js.map +1 -1
  235. package/build-module/comment-date/index.js +7 -3
  236. package/build-module/comment-date/index.js.map +1 -1
  237. package/build-module/comment-edit-link/index.js +5 -1
  238. package/build-module/comment-edit-link/index.js.map +1 -1
  239. package/build-module/comment-reply-link/index.js +5 -1
  240. package/build-module/comment-reply-link/index.js.map +1 -1
  241. package/build-module/comment-template/edit.js +86 -66
  242. package/build-module/comment-template/edit.js.map +1 -1
  243. package/build-module/comment-template/hooks.js +7 -23
  244. package/build-module/comment-template/hooks.js.map +1 -1
  245. package/build-module/comment-template/index.js +2 -2
  246. package/build-module/comments-pagination-next/index.js +2 -2
  247. package/build-module/comments-pagination-numbers/index.js +1 -1
  248. package/build-module/comments-pagination-previous/index.js +1 -1
  249. package/build-module/comments-query-loop/edit/comments-inspector-controls.js +4 -70
  250. package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  251. package/build-module/comments-query-loop/edit.js +22 -1
  252. package/build-module/comments-query-loop/edit.js.map +1 -1
  253. package/build-module/comments-query-loop/index.js +1 -23
  254. package/build-module/comments-query-loop/index.js.map +1 -1
  255. package/build-module/cover/edit.js +58 -41
  256. package/build-module/cover/edit.js.map +1 -1
  257. package/build-module/cover/index.js +5 -0
  258. package/build-module/cover/index.js.map +1 -1
  259. package/build-module/cover/save.js +3 -2
  260. package/build-module/cover/save.js.map +1 -1
  261. package/build-module/embed/variations.js +2 -2
  262. package/build-module/embed/variations.js.map +1 -1
  263. package/build-module/gallery/edit.js +17 -5
  264. package/build-module/gallery/edit.js.map +1 -1
  265. package/build-module/gallery/gallery.js +1 -1
  266. package/build-module/gallery/gallery.js.map +1 -1
  267. package/build-module/gallery/gap-styles.js +28 -0
  268. package/build-module/gallery/gap-styles.js.map +1 -0
  269. package/build-module/gallery/index.js +18 -1
  270. package/build-module/gallery/index.js.map +1 -1
  271. package/build-module/group/edit.js +3 -1
  272. package/build-module/group/edit.js.map +1 -1
  273. package/build-module/group/index.js +1 -1
  274. package/build-module/group/variations.js +29 -9
  275. package/build-module/group/variations.js.map +1 -1
  276. package/build-module/heading/edit.js +1 -1
  277. package/build-module/heading/edit.js.map +1 -1
  278. package/build-module/html/edit.js +4 -3
  279. package/build-module/html/edit.js.map +1 -1
  280. package/build-module/image/edit.native.js +8 -10
  281. package/build-module/image/edit.native.js.map +1 -1
  282. package/build-module/image/image.js +3 -1
  283. package/build-module/image/image.js.map +1 -1
  284. package/build-module/index.js +7 -4
  285. package/build-module/index.js.map +1 -1
  286. package/build-module/list/deprecated.js +2 -2
  287. package/build-module/list/deprecated.js.map +1 -1
  288. package/build-module/list/index.js +5 -1
  289. package/build-module/list/index.js.map +1 -1
  290. package/build-module/list/v2/deprecated.js +104 -0
  291. package/build-module/list/v2/deprecated.js.map +1 -0
  292. package/build-module/list/v2/edit.js +168 -0
  293. package/build-module/list/v2/edit.js.map +1 -0
  294. package/build-module/list/v2/index.js +21 -0
  295. package/build-module/list/v2/index.js.map +1 -0
  296. package/build-module/list/v2/migrate.js +77 -0
  297. package/build-module/list/v2/migrate.js.map +1 -0
  298. package/build-module/list/v2/save.js +23 -0
  299. package/build-module/list/v2/save.js.map +1 -0
  300. package/build-module/list/v2/transforms.js +111 -0
  301. package/build-module/list/v2/transforms.js.map +1 -0
  302. package/build-module/list-item/edit.js +83 -0
  303. package/build-module/list-item/edit.js.map +1 -0
  304. package/build-module/list-item/hooks/index.js +4 -0
  305. package/build-module/list-item/hooks/index.js.map +1 -0
  306. package/build-module/list-item/hooks/use-enter.js +77 -0
  307. package/build-module/list-item/hooks/use-enter.js.map +1 -0
  308. package/build-module/list-item/hooks/use-indent-list-item.js +62 -0
  309. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -0
  310. package/build-module/list-item/hooks/use-outdent-list-item.js +66 -0
  311. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -0
  312. package/build-module/list-item/index.js +53 -0
  313. package/build-module/list-item/index.js.map +1 -0
  314. package/build-module/list-item/save.js +15 -0
  315. package/build-module/list-item/save.js.map +1 -0
  316. package/build-module/list-item/utils.js +8 -0
  317. package/build-module/list-item/utils.js.map +1 -0
  318. package/build-module/media-text/edit.js +3 -1
  319. package/build-module/media-text/edit.js.map +1 -1
  320. package/build-module/media-text/media-container.native.js +1 -14
  321. package/build-module/media-text/media-container.native.js.map +1 -1
  322. package/build-module/navigation/edit/index.js +37 -17
  323. package/build-module/navigation/edit/index.js.map +1 -1
  324. package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -1
  325. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  326. package/build-module/navigation/edit/unsaved-inner-blocks.js +35 -8
  327. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  328. package/build-module/navigation/index.js +9 -1
  329. package/build-module/navigation/index.js.map +1 -1
  330. package/build-module/navigation/use-navigation-entities.js +27 -54
  331. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  332. package/build-module/navigation/use-navigation-menu.js +1 -0
  333. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  334. package/build-module/navigation-link/edit.js +95 -36
  335. package/build-module/navigation-link/edit.js.map +1 -1
  336. package/build-module/navigation-link/index.js +1 -1
  337. package/build-module/navigation-submenu/edit.js +6 -10
  338. package/build-module/navigation-submenu/edit.js.map +1 -1
  339. package/build-module/navigation-submenu/index.js +1 -1
  340. package/build-module/post-comment/edit.js +2 -2
  341. package/build-module/post-comment/edit.js.map +1 -1
  342. package/build-module/post-comments-form/edit.js +3 -2
  343. package/build-module/post-comments-form/edit.js.map +1 -1
  344. package/build-module/post-date/edit.js +32 -43
  345. package/build-module/post-date/edit.js.map +1 -1
  346. package/build-module/post-featured-image/edit.js +2 -1
  347. package/build-module/post-featured-image/edit.js.map +1 -1
  348. package/build-module/post-featured-image/index.js +1 -1
  349. package/build-module/post-template/edit.js +7 -2
  350. package/build-module/post-template/edit.js.map +1 -1
  351. package/build-module/post-terms/edit.js +4 -2
  352. package/build-module/post-terms/edit.js.map +1 -1
  353. package/build-module/post-terms/variations.js +3 -3
  354. package/build-module/post-terms/variations.js.map +1 -1
  355. package/build-module/pullquote/edit.js +6 -3
  356. package/build-module/pullquote/edit.js.map +1 -1
  357. package/build-module/query/variations.js +4 -4
  358. package/build-module/query/variations.js.map +1 -1
  359. package/build-module/query-no-results/edit.js +18 -0
  360. package/build-module/query-no-results/edit.js.map +1 -0
  361. package/build-module/query-no-results/index.js +40 -0
  362. package/build-module/query-no-results/index.js.map +1 -0
  363. package/build-module/query-no-results/save.js +10 -0
  364. package/build-module/query-no-results/save.js.map +1 -0
  365. package/build-module/query-pagination/edit.js +1 -1
  366. package/build-module/query-pagination/edit.js.map +1 -1
  367. package/build-module/query-pagination-numbers/index.js +19 -1
  368. package/build-module/query-pagination-numbers/index.js.map +1 -1
  369. package/build-module/quote/index.js +13 -1
  370. package/build-module/quote/index.js.map +1 -1
  371. package/build-module/quote/v2/deprecated.js +116 -0
  372. package/build-module/quote/v2/deprecated.js.map +1 -0
  373. package/build-module/quote/v2/edit.js +115 -0
  374. package/build-module/quote/v2/edit.js.map +1 -0
  375. package/build-module/quote/v2/index.js +33 -0
  376. package/build-module/quote/v2/index.js.map +1 -0
  377. package/build-module/quote/v2/save.js +30 -0
  378. package/build-module/quote/v2/save.js.map +1 -0
  379. package/build-module/quote/v2/transforms.js +147 -0
  380. package/build-module/quote/v2/transforms.js.map +1 -0
  381. package/build-module/read-more/index.js +1 -1
  382. package/build-module/rss/edit.js +5 -1
  383. package/build-module/rss/edit.js.map +1 -1
  384. package/build-module/search/edit.js +2 -3
  385. package/build-module/search/edit.js.map +1 -1
  386. package/build-module/separator/deprecated.js +70 -0
  387. package/build-module/separator/deprecated.js.map +1 -0
  388. package/build-module/separator/edit.js +31 -22
  389. package/build-module/separator/edit.js.map +1 -1
  390. package/build-module/separator/index.js +16 -7
  391. package/build-module/separator/index.js.map +1 -1
  392. package/build-module/separator/save.js +19 -14
  393. package/build-module/separator/save.js.map +1 -1
  394. package/build-module/separator/use-deprecated-opacity.js +30 -0
  395. package/build-module/separator/use-deprecated-opacity.js.map +1 -0
  396. package/build-module/site-logo/edit.js +3 -2
  397. package/build-module/site-logo/edit.js.map +1 -1
  398. package/build-module/site-logo/index.js +1 -1
  399. package/build-module/social-links/edit.js +15 -4
  400. package/build-module/social-links/edit.js.map +1 -1
  401. package/build-module/social-links/index.js +2 -1
  402. package/build-module/social-links/index.js.map +1 -1
  403. package/build-module/spacer/controls.js +8 -19
  404. package/build-module/spacer/controls.js.map +1 -1
  405. package/build-module/spacer/controls.native.js +2 -1
  406. package/build-module/spacer/controls.native.js.map +1 -1
  407. package/build-module/spacer/edit.js +3 -3
  408. package/build-module/spacer/edit.js.map +1 -1
  409. package/build-module/table/deprecated.js +1 -1
  410. package/build-module/table/deprecated.js.map +1 -1
  411. package/build-module/tag-cloud/edit.js +60 -4
  412. package/build-module/tag-cloud/edit.js.map +1 -1
  413. package/build-module/tag-cloud/index.js +8 -0
  414. package/build-module/tag-cloud/index.js.map +1 -1
  415. package/build-module/template-part/edit/utils/hooks.js +5 -2
  416. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  417. package/build-style/avatar/editor-rtl.css +83 -0
  418. package/build-style/avatar/editor.css +83 -0
  419. package/build-style/avatar/style-rtl.css +79 -0
  420. package/build-style/avatar/style.css +79 -0
  421. package/build-style/editor-rtl.css +53 -11
  422. package/build-style/editor.css +53 -11
  423. package/build-style/gallery/editor-rtl.css +0 -1
  424. package/build-style/gallery/editor.css +0 -1
  425. package/build-style/gallery/style-rtl.css +102 -169
  426. package/build-style/gallery/style.css +102 -169
  427. package/build-style/group/editor-rtl.css +26 -0
  428. package/build-style/group/editor.css +26 -0
  429. package/build-style/heading/style-rtl.css +0 -8
  430. package/build-style/heading/style.css +0 -8
  431. package/build-style/image/style-rtl.css +2 -0
  432. package/build-style/image/style.css +2 -0
  433. package/build-style/list/style-rtl.css +1 -1
  434. package/build-style/list/style.css +1 -1
  435. package/build-style/navigation/style-rtl.css +11 -9
  436. package/build-style/navigation/style.css +11 -9
  437. package/build-style/navigation-link/editor-rtl.css +13 -0
  438. package/build-style/navigation-link/editor.css +13 -0
  439. package/build-style/navigation-link/style-rtl.css +3 -0
  440. package/build-style/navigation-link/style.css +3 -0
  441. package/build-style/paragraph/style-rtl.css +0 -4
  442. package/build-style/paragraph/style.css +0 -4
  443. package/build-style/pullquote/style-rtl.css +0 -4
  444. package/build-style/pullquote/style.css +0 -4
  445. package/build-style/quote/style-rtl.css +1 -0
  446. package/build-style/quote/style.css +1 -0
  447. package/build-style/reset-rtl.css +1 -1
  448. package/build-style/reset.css +1 -1
  449. package/build-style/separator/editor-rtl.css +3 -0
  450. package/build-style/separator/editor.css +3 -0
  451. package/build-style/separator/theme-rtl.css +7 -1
  452. package/build-style/separator/theme.css +7 -1
  453. package/build-style/site-logo/editor-rtl.css +3 -1
  454. package/build-style/site-logo/editor.css +3 -1
  455. package/build-style/style-rtl.css +124 -195
  456. package/build-style/style.css +124 -195
  457. package/build-style/template-part/editor-rtl.css +0 -9
  458. package/build-style/template-part/editor.css +0 -9
  459. package/build-style/theme-rtl.css +7 -1
  460. package/build-style/theme.css +7 -1
  461. package/package.json +28 -28
  462. package/src/archives/block.json +5 -1
  463. package/src/archives/edit.js +20 -2
  464. package/src/archives/index.php +4 -4
  465. package/src/audio/edit.native.js +0 -5
  466. package/src/avatar/block.json +53 -0
  467. package/src/avatar/edit.js +230 -0
  468. package/src/avatar/editor.scss +9 -0
  469. package/src/avatar/hooks.js +96 -0
  470. package/src/avatar/index.js +18 -0
  471. package/src/avatar/index.php +146 -0
  472. package/src/avatar/style.scss +5 -0
  473. package/src/avatar/user-control.js +56 -0
  474. package/src/block/edit.js +21 -11
  475. package/src/column/block.json +3 -1
  476. package/src/comment-author-avatar/block.json +4 -3
  477. package/src/comment-author-name/block.json +7 -3
  478. package/src/comment-author-name/index.php +3 -0
  479. package/src/comment-content/block.json +1 -1
  480. package/src/comment-date/block.json +7 -3
  481. package/src/comment-date/edit.js +20 -30
  482. package/src/comment-date/index.php +6 -1
  483. package/src/comment-edit-link/block.json +5 -1
  484. package/src/comment-edit-link/index.php +3 -0
  485. package/src/comment-reply-link/block.json +5 -1
  486. package/src/comment-reply-link/index.php +4 -1
  487. package/src/comment-template/block.json +2 -8
  488. package/src/comment-template/edit.js +77 -64
  489. package/src/comment-template/hooks.js +8 -24
  490. package/src/comment-template/index.php +1 -3
  491. package/src/comments-pagination-next/block.json +2 -9
  492. package/src/comments-pagination-numbers/block.json +2 -8
  493. package/src/comments-pagination-previous/block.json +2 -2
  494. package/src/comments-query-loop/block.json +1 -23
  495. package/src/comments-query-loop/edit/comments-inspector-controls.js +2 -83
  496. package/src/comments-query-loop/edit.js +54 -1
  497. package/src/cover/block.json +5 -0
  498. package/src/cover/edit.js +103 -60
  499. package/src/cover/index.php +85 -0
  500. package/src/cover/save.js +18 -14
  501. package/src/editor.scss +1 -0
  502. package/src/embed/variations.js +2 -2
  503. package/src/gallery/block.json +18 -1
  504. package/src/gallery/deprecated.scss +2 -2
  505. package/src/gallery/edit.js +15 -8
  506. package/src/gallery/editor.scss +0 -1
  507. package/src/gallery/gallery.js +8 -7
  508. package/src/gallery/gap-styles.js +26 -0
  509. package/src/gallery/index.php +43 -1
  510. package/src/gallery/style.scss +11 -44
  511. package/src/group/block.json +1 -1
  512. package/src/group/edit.js +4 -1
  513. package/src/group/editor.scss +31 -0
  514. package/src/group/variations.js +21 -4
  515. package/src/heading/edit.js +1 -1
  516. package/src/heading/style.scss +0 -3
  517. package/src/html/edit.js +22 -30
  518. package/src/image/edit.native.js +7 -11
  519. package/src/image/image.js +4 -1
  520. package/src/image/style.scss +3 -0
  521. package/src/index.js +19 -14
  522. package/src/list/deprecated.js +2 -2
  523. package/src/list/index.js +6 -1
  524. package/src/list/style.scss +1 -2
  525. package/src/list/test/migrate.js +159 -0
  526. package/src/list/v2/deprecated.js +89 -0
  527. package/src/list/v2/edit.js +186 -0
  528. package/src/list/v2/index.js +22 -0
  529. package/src/list/v2/migrate.js +87 -0
  530. package/src/list/v2/save.js +18 -0
  531. package/src/list/v2/transforms.js +116 -0
  532. package/src/list-item/block.json +26 -0
  533. package/src/list-item/edit.js +93 -0
  534. package/src/list-item/hooks/index.js +3 -0
  535. package/src/list-item/hooks/use-enter.js +94 -0
  536. package/src/list-item/hooks/use-indent-list-item.js +89 -0
  537. package/src/list-item/hooks/use-outdent-list-item.js +95 -0
  538. package/src/list-item/index.js +27 -0
  539. package/src/list-item/save.js +13 -0
  540. package/src/list-item/utils.js +14 -0
  541. package/src/media-text/edit.js +1 -1
  542. package/src/media-text/media-container.native.js +1 -14
  543. package/src/navigation/block.json +9 -1
  544. package/src/navigation/edit/index.js +50 -14
  545. package/src/navigation/edit/navigation-menu-delete-control.js +1 -1
  546. package/src/navigation/edit/unsaved-inner-blocks.js +57 -8
  547. package/src/navigation/index.php +28 -3
  548. package/src/navigation/style.scss +15 -13
  549. package/src/navigation/use-navigation-entities.js +37 -73
  550. package/src/navigation/use-navigation-menu.js +4 -0
  551. package/src/navigation-link/block.json +1 -0
  552. package/src/navigation-link/edit.js +156 -64
  553. package/src/navigation-link/editor.scss +11 -0
  554. package/src/navigation-link/index.php +8 -0
  555. package/src/navigation-link/style.scss +6 -0
  556. package/src/navigation-submenu/block.json +1 -0
  557. package/src/navigation-submenu/edit.js +7 -9
  558. package/src/paragraph/style.scss +0 -5
  559. package/src/post-author/index.php +0 -1
  560. package/src/post-comment/edit.js +2 -2
  561. package/src/post-comments-form/edit.js +6 -3
  562. package/src/post-date/edit.js +63 -52
  563. package/src/post-date/index.php +1 -1
  564. package/src/post-date/test/edit.js +17 -0
  565. package/src/post-featured-image/block.json +1 -1
  566. package/src/post-featured-image/edit.js +9 -1
  567. package/src/post-featured-image/index.php +2 -1
  568. package/src/post-template/edit.js +7 -1
  569. package/src/post-terms/edit.js +4 -1
  570. package/src/post-terms/variations.js +3 -3
  571. package/src/pullquote/edit.js +4 -3
  572. package/src/pullquote/style.scss +0 -5
  573. package/src/query/variations.js +4 -0
  574. package/src/query-no-results/block.json +20 -0
  575. package/src/query-no-results/edit.js +28 -0
  576. package/src/query-no-results/index.js +20 -0
  577. package/src/query-no-results/index.php +59 -0
  578. package/src/query-no-results/save.js +8 -0
  579. package/src/query-pagination/edit.js +1 -1
  580. package/src/query-pagination/index.php +9 -2
  581. package/src/query-pagination-numbers/block.json +19 -1
  582. package/src/quote/block.json +8 -0
  583. package/src/quote/index.js +6 -1
  584. package/src/quote/style.scss +1 -0
  585. package/src/quote/v2/deprecated.js +107 -0
  586. package/src/quote/v2/edit.js +136 -0
  587. package/src/quote/v2/index.js +36 -0
  588. package/src/quote/v2/save.js +26 -0
  589. package/src/quote/v2/test/migrate.js +92 -0
  590. package/src/quote/v2/transforms.js +155 -0
  591. package/src/read-more/block.json +1 -1
  592. package/src/reset.scss +1 -1
  593. package/src/rss/edit.js +3 -1
  594. package/src/rss/index.php +14 -1
  595. package/src/search/edit.js +1 -2
  596. package/src/separator/block.json +13 -6
  597. package/src/separator/deprecated.js +57 -0
  598. package/src/separator/deprecated.scss +6 -0
  599. package/src/separator/edit.js +36 -14
  600. package/src/separator/editor.scss +6 -0
  601. package/src/separator/index.js +2 -0
  602. package/src/separator/save.js +22 -14
  603. package/src/separator/test/edit.js +113 -0
  604. package/src/separator/theme.scss +7 -1
  605. package/src/separator/use-deprecated-opacity.js +41 -0
  606. package/src/site-logo/block.json +1 -1
  607. package/src/site-logo/edit.js +2 -1
  608. package/src/site-logo/editor.scss +3 -1
  609. package/src/site-logo/index.php +0 -4
  610. package/src/social-link/index.php +1 -2
  611. package/src/social-links/block.json +2 -1
  612. package/src/social-links/edit.js +15 -5
  613. package/src/spacer/controls.js +12 -18
  614. package/src/spacer/controls.native.js +2 -1
  615. package/src/spacer/edit.js +3 -6
  616. package/src/spacer/test/__snapshots__/index.native.js.snap +31 -0
  617. package/src/spacer/test/index.native.js +180 -0
  618. package/src/style.scss +1 -0
  619. package/src/table/deprecated.js +5 -1
  620. package/src/tag-cloud/block.json +8 -0
  621. package/src/tag-cloud/edit.js +82 -2
  622. package/src/tag-cloud/index.php +6 -0
  623. package/src/template-part/edit/utils/hooks.js +6 -1
  624. package/src/template-part/editor.scss +0 -10
  625. package/build/navigation/edit/use-list-view-modal.js +0 -73
  626. package/build/navigation/edit/use-list-view-modal.js.map +0 -1
  627. package/build/separator/separator-settings.js +0 -36
  628. package/build/separator/separator-settings.js.map +0 -1
  629. package/build-module/navigation/edit/use-list-view-modal.js +0 -63
  630. package/build-module/navigation/edit/use-list-view-modal.js.map +0 -1
  631. package/build-module/separator/separator-settings.js +0 -27
  632. package/build-module/separator/separator-settings.js.map +0 -1
  633. package/src/navigation/edit/use-list-view-modal.js +0 -72
  634. package/src/separator/separator-settings.js +0 -24
@@ -0,0 +1,93 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ RichText,
6
+ useBlockProps,
7
+ useInnerBlocksProps,
8
+ BlockControls,
9
+ } from '@wordpress/block-editor';
10
+ import { isRTL, __ } from '@wordpress/i18n';
11
+ import { createBlock } from '@wordpress/blocks';
12
+ import { ToolbarButton } from '@wordpress/components';
13
+ import {
14
+ formatOutdent,
15
+ formatOutdentRTL,
16
+ formatIndentRTL,
17
+ formatIndent,
18
+ } from '@wordpress/icons';
19
+ import { useMergeRefs } from '@wordpress/compose';
20
+
21
+ /**
22
+ * Internal dependencies
23
+ */
24
+ import { useEnter, useIndentListItem, useOutdentListItem } from './hooks';
25
+
26
+ function IndentUI( { clientId } ) {
27
+ const [ canIndent, indentListItem ] = useIndentListItem( clientId );
28
+ const [ canOutdent, outdentListItem ] = useOutdentListItem( clientId );
29
+
30
+ return (
31
+ <>
32
+ <ToolbarButton
33
+ icon={ isRTL() ? formatOutdentRTL : formatOutdent }
34
+ title={ __( 'Outdent' ) }
35
+ describedBy={ __( 'Outdent list item' ) }
36
+ disabled={ ! canOutdent }
37
+ onClick={ outdentListItem }
38
+ />
39
+ <ToolbarButton
40
+ icon={ isRTL() ? formatIndentRTL : formatIndent }
41
+ title={ __( 'Indent' ) }
42
+ describedBy={ __( 'Indent list item' ) }
43
+ isDisabled={ ! canIndent }
44
+ onClick={ indentListItem }
45
+ />
46
+ </>
47
+ );
48
+ }
49
+
50
+ export default function ListItemEdit( {
51
+ name,
52
+ attributes,
53
+ setAttributes,
54
+ mergeBlocks,
55
+ onReplace,
56
+ clientId,
57
+ } ) {
58
+ const { placeholder, content } = attributes;
59
+ const blockProps = useBlockProps();
60
+ const innerBlocksProps = useInnerBlocksProps( blockProps, {
61
+ allowedBlocks: [ 'core/list' ],
62
+ } );
63
+ const useEnterRef = useEnter( { content, clientId } );
64
+ return (
65
+ <>
66
+ <li { ...innerBlocksProps }>
67
+ <RichText
68
+ ref={ useMergeRefs( [ useEnterRef ] ) }
69
+ identifier="content"
70
+ tagName="div"
71
+ onChange={ ( nextContent ) =>
72
+ setAttributes( { content: nextContent } )
73
+ }
74
+ value={ content }
75
+ aria-label={ __( 'List text' ) }
76
+ placeholder={ placeholder || __( 'List' ) }
77
+ onSplit={ ( value ) => {
78
+ return createBlock( name, {
79
+ ...attributes,
80
+ content: value,
81
+ } );
82
+ } }
83
+ onMerge={ mergeBlocks }
84
+ onReplace={ onReplace }
85
+ />
86
+ { innerBlocksProps.children }
87
+ </li>
88
+ <BlockControls group="block">
89
+ <IndentUI clientId={ clientId } />
90
+ </BlockControls>
91
+ </>
92
+ );
93
+ }
@@ -0,0 +1,3 @@
1
+ export { default as useOutdentListItem } from './use-outdent-list-item';
2
+ export { default as useIndentListItem } from './use-indent-list-item';
3
+ export { default as useEnter } from './use-enter';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ createBlock,
6
+ getDefaultBlockName,
7
+ cloneBlock,
8
+ } from '@wordpress/blocks';
9
+ import { useRef } from '@wordpress/element';
10
+ import { useRefEffect } from '@wordpress/compose';
11
+ import { ENTER } from '@wordpress/keycodes';
12
+ import { useSelect, useDispatch } from '@wordpress/data';
13
+ import { store as blockEditorStore } from '@wordpress/block-editor';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import useIndentListItem from './use-indent-list-item';
19
+
20
+ export default function useEnter( props ) {
21
+ const { replaceBlocks } = useDispatch( blockEditorStore );
22
+ const {
23
+ getBlock,
24
+ getBlockRootClientId,
25
+ getBlockParents,
26
+ getBlockIndex,
27
+ } = useSelect( blockEditorStore );
28
+ const propsRef = useRef( props );
29
+ propsRef.current = props;
30
+ const [ canIndent, indentListItem ] = useIndentListItem(
31
+ propsRef.current.clientId
32
+ );
33
+ return useRefEffect(
34
+ ( element ) => {
35
+ function onKeyDown( event ) {
36
+ if ( event.defaultPrevented || event.keyCode !== ENTER ) {
37
+ return;
38
+ }
39
+ const { content, clientId } = propsRef.current;
40
+ if ( content.length ) {
41
+ return;
42
+ }
43
+ event.preventDefault();
44
+ if ( canIndent ) {
45
+ indentListItem();
46
+ return;
47
+ }
48
+ // Here we are in top level list so we need to split.
49
+ const blockRootClientId = getBlockRootClientId( clientId );
50
+ const blockParents = getBlockParents( clientId );
51
+ const topParentListBlockClientId = blockParents[ 0 ];
52
+ const topParentListBlock = getBlock(
53
+ topParentListBlockClientId
54
+ );
55
+ const blockIndex = getBlockIndex( clientId );
56
+ const head = cloneBlock( {
57
+ ...topParentListBlock,
58
+ innerBlocks: topParentListBlock.innerBlocks.slice(
59
+ 0,
60
+ blockIndex
61
+ ),
62
+ } );
63
+ const middle = createBlock( getDefaultBlockName() );
64
+ // Last list item might contain a `list` block innerBlock
65
+ // In that case append remaining innerBlocks blocks.
66
+ const after = [
67
+ ...( topParentListBlock.innerBlocks[ blockIndex ]
68
+ .innerBlocks[ 0 ]?.innerBlocks || [] ),
69
+ ...topParentListBlock.innerBlocks.slice( blockIndex + 1 ),
70
+ ];
71
+ const tail = after.length
72
+ ? [
73
+ cloneBlock( {
74
+ ...topParentListBlock,
75
+ innerBlocks: after,
76
+ } ),
77
+ ]
78
+ : [];
79
+ replaceBlocks(
80
+ blockRootClientId,
81
+ [ head, middle, ...tail ],
82
+ 1,
83
+ 0
84
+ );
85
+ }
86
+
87
+ element.addEventListener( 'keydown', onKeyDown );
88
+ return () => {
89
+ element.removeEventListener( 'keydown', onKeyDown );
90
+ };
91
+ },
92
+ [ canIndent ]
93
+ );
94
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { first } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useCallback } from '@wordpress/element';
10
+ import { useSelect, useDispatch } from '@wordpress/data';
11
+ import { store as blockEditorStore } from '@wordpress/block-editor';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import { createListItem } from '../utils';
17
+
18
+ export default function useIndentListItem( clientId ) {
19
+ const { canIndent } = useSelect(
20
+ ( innerSelect ) => {
21
+ const { getBlockIndex } = innerSelect( blockEditorStore );
22
+ return {
23
+ canIndent: getBlockIndex( clientId ) > 0,
24
+ };
25
+ },
26
+ [ clientId ]
27
+ );
28
+ const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );
29
+ const {
30
+ getBlockRootClientId,
31
+ getBlock,
32
+ getBlockOrder,
33
+ getSelectionStart,
34
+ getSelectionEnd,
35
+ getBlockIndex,
36
+ } = useSelect( blockEditorStore );
37
+
38
+ return [
39
+ canIndent,
40
+ useCallback( () => {
41
+ const selectionStart = getSelectionStart();
42
+ const selectionEnd = getSelectionEnd();
43
+
44
+ const parentId = getBlockRootClientId( clientId );
45
+ const previousSiblingId = getBlockOrder( parentId )[
46
+ getBlockIndex( clientId ) - 1
47
+ ];
48
+ const previousSibling = getBlock( previousSiblingId );
49
+ const previousSiblingChildren =
50
+ first( previousSibling.innerBlocks )?.innerBlocks || [];
51
+ const previousSiblingListAttributes =
52
+ first( previousSibling.innerBlocks )?.attributes || {};
53
+ const block = getBlock( clientId );
54
+
55
+ const childListAttributes = first( block.innerBlocks )?.attributes;
56
+ const childItemBlocks =
57
+ first( block.innerBlocks )?.innerBlocks || [];
58
+
59
+ const newBlock = createListItem(
60
+ block.attributes,
61
+ childListAttributes,
62
+ childItemBlocks
63
+ );
64
+ // Replace the previous sibling of the block being indented and the indented block,
65
+ // with a new block whose attributes are equal to the ones of the previous sibling and
66
+ // whose descendants are the children of the previous sibling, followed by the indented block.
67
+ replaceBlocks(
68
+ [ previousSiblingId, clientId ],
69
+ [
70
+ createListItem(
71
+ previousSibling.attributes,
72
+ previousSiblingListAttributes,
73
+ [ ...previousSiblingChildren, newBlock ]
74
+ ),
75
+ ]
76
+ );
77
+
78
+ // Restore the selection state.
79
+ selectionChange(
80
+ newBlock.clientId,
81
+ selectionEnd.attributeKey,
82
+ selectionEnd.clientId === selectionStart.clientId
83
+ ? selectionStart.offset
84
+ : selectionEnd.offset,
85
+ selectionEnd.offset
86
+ );
87
+ }, [ clientId ] ),
88
+ ];
89
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useCallback } from '@wordpress/element';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { store as blockEditorStore } from '@wordpress/block-editor';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { createListItem } from '../utils';
12
+
13
+ export default function useOutdentListItem( clientId ) {
14
+ const { canOutdent } = useSelect(
15
+ ( innerSelect ) => {
16
+ const { getBlockRootClientId } = innerSelect( blockEditorStore );
17
+ const grandParentId = getBlockRootClientId(
18
+ getBlockRootClientId( clientId )
19
+ );
20
+ return {
21
+ canOutdent: !! grandParentId,
22
+ };
23
+ },
24
+ [ clientId ]
25
+ );
26
+ const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );
27
+ const {
28
+ getBlockRootClientId,
29
+ getBlockAttributes,
30
+ getBlock,
31
+ getBlockIndex,
32
+ getSelectionStart,
33
+ getSelectionEnd,
34
+ } = useSelect( blockEditorStore );
35
+
36
+ return [
37
+ canOutdent,
38
+ useCallback( () => {
39
+ const selectionStart = getSelectionStart();
40
+ const selectionEnd = getSelectionEnd();
41
+
42
+ const listParentId = getBlockRootClientId( clientId );
43
+ const listAttributes = getBlockAttributes( listParentId );
44
+ const listItemParentId = getBlockRootClientId( listParentId );
45
+ const listItemParentAttributes = getBlockAttributes(
46
+ listItemParentId
47
+ );
48
+
49
+ const index = getBlockIndex( clientId );
50
+ const siblingBlocks = getBlock( listParentId ).innerBlocks;
51
+ const previousSiblings = siblingBlocks.slice( 0, index );
52
+ const afterSiblings = siblingBlocks.slice( index + 1 );
53
+
54
+ // Create a new parent list item block with just the siblings
55
+ // that existed before the child item being outdent.
56
+ const newListItemParent = createListItem(
57
+ listItemParentAttributes,
58
+ listAttributes,
59
+ previousSiblings
60
+ );
61
+
62
+ const block = getBlock( clientId );
63
+ const childList = block.innerBlocks[ 0 ];
64
+ const childItems = childList?.innerBlocks || [];
65
+ const hasChildItems = !! childItems.length;
66
+
67
+ // Create a new list item block whose attributes are equal to the
68
+ // block being outdent and whose children are the children that it had (if any)
69
+ // followed by the siblings that existed after it.
70
+ const newItem = createListItem(
71
+ block.attributes,
72
+ hasChildItems ? childList.attributes : listAttributes,
73
+ [ ...childItems, ...afterSiblings ]
74
+ );
75
+
76
+ // Replace the parent list item block, with a new block containing
77
+ // the previous siblings, followed by another block containing after siblings
78
+ // in relation to the block being outdent.
79
+ replaceBlocks(
80
+ [ listItemParentId ],
81
+ [ newListItemParent, newItem ]
82
+ );
83
+
84
+ // Restore the selection state.
85
+ selectionChange(
86
+ newItem.clientId,
87
+ selectionEnd.attributeKey,
88
+ selectionEnd.clientId === selectionStart.clientId
89
+ ? selectionStart.offset
90
+ : selectionEnd.offset,
91
+ selectionEnd.offset
92
+ );
93
+ }, [ clientId ] ),
94
+ ];
95
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { listItem as icon } from '@wordpress/icons';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import metadata from './block.json';
10
+ import edit from './edit';
11
+ import save from './save';
12
+
13
+ const { name } = metadata;
14
+
15
+ export { metadata, name };
16
+
17
+ export const settings = {
18
+ icon,
19
+ edit,
20
+ save,
21
+ merge( attributes, attributesToMerge ) {
22
+ return {
23
+ ...attributes,
24
+ content: attributes.content + attributesToMerge.content,
25
+ };
26
+ },
27
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
5
+
6
+ export default function save( { attributes } ) {
7
+ return (
8
+ <li { ...useBlockProps.save() }>
9
+ <RichText.Content value={ attributes.content } />
10
+ <InnerBlocks.Content />
11
+ </li>
12
+ );
13
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createBlock } from '@wordpress/blocks';
5
+
6
+ export function createListItem( listItemAttributes, listAttributes, children ) {
7
+ return createBlock(
8
+ 'core/list-item',
9
+ listItemAttributes,
10
+ ! children || ! children.length
11
+ ? []
12
+ : [ createBlock( 'core/list', listAttributes, children ) ]
13
+ );
14
+ }
@@ -161,7 +161,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
161
161
  const image = useSelect(
162
162
  ( select ) =>
163
163
  mediaId && isSelected
164
- ? select( coreStore ).getMedia( mediaId )
164
+ ? select( coreStore ).getMedia( mediaId, { context: 'view' } )
165
165
  : null,
166
166
  [ isSelected, mediaId ]
167
167
  );
@@ -26,8 +26,6 @@ import { Component } from '@wordpress/element';
26
26
  import { __ } from '@wordpress/i18n';
27
27
  import { isURL, getProtocol } from '@wordpress/url';
28
28
  import { compose, withPreferredColorScheme } from '@wordpress/compose';
29
- import { withDispatch } from '@wordpress/data';
30
- import { store as noticesStore } from '@wordpress/notices';
31
29
 
32
30
  /**
33
31
  * Internal dependencies
@@ -152,10 +150,6 @@ class MediaContainer extends Component {
152
150
  }
153
151
 
154
152
  finishMediaUploadWithFailure() {
155
- const { createErrorNotice } = this.props;
156
-
157
- createErrorNotice( __( 'Failed to insert media.' ) );
158
-
159
153
  this.setState( { isUploadInProgress: false } );
160
154
  }
161
155
 
@@ -381,11 +375,4 @@ class MediaContainer extends Component {
381
375
  }
382
376
  }
383
377
 
384
- export default compose( [
385
- withDispatch( ( dispatch ) => {
386
- const { createErrorNotice } = dispatch( noticesStore );
387
-
388
- return { createErrorNotice };
389
- } ),
390
- withPreferredColorScheme,
391
- ] )( MediaContainer );
378
+ export default compose( [ withPreferredColorScheme ] )( MediaContainer );
@@ -59,6 +59,10 @@
59
59
  },
60
60
  "customOverlayTextColor": {
61
61
  "type": "string"
62
+ },
63
+ "maxNestingLevel": {
64
+ "type": "number",
65
+ "default": 5
62
66
  }
63
67
  },
64
68
  "usesContext": [ "navigationArea" ],
@@ -76,7 +80,8 @@
76
80
  "showSubmenuIcon": "showSubmenuIcon",
77
81
  "openSubmenusOnClick": "openSubmenusOnClick",
78
82
  "style": "style",
79
- "orientation": "orientation"
83
+ "orientation": "orientation",
84
+ "maxNestingLevel": "maxNestingLevel"
80
85
  },
81
86
  "supports": {
82
87
  "align": [ "wide", "full" ],
@@ -90,6 +95,8 @@
90
95
  "__experimentalFontWeight": true,
91
96
  "__experimentalTextTransform": true,
92
97
  "__experimentalFontFamily": true,
98
+ "__experimentalTextDecoration": true,
99
+ "__experimentalSkipSerialization": [ "textDecoration" ],
93
100
  "__experimentalDefaultControls": {
94
101
  "fontSize": true
95
102
  }
@@ -104,6 +111,7 @@
104
111
  "__experimentalLayout": {
105
112
  "allowSwitching": false,
106
113
  "allowInheriting": false,
114
+ "allowVerticalAlignment": false,
107
115
  "default": {
108
116
  "type": "flex"
109
117
  }
@@ -38,13 +38,12 @@ import {
38
38
  Button,
39
39
  Spinner,
40
40
  } from '@wordpress/components';
41
- import { __ } from '@wordpress/i18n';
41
+ import { __, sprintf } from '@wordpress/i18n';
42
42
  import { speak } from '@wordpress/a11y';
43
43
 
44
44
  /**
45
45
  * Internal dependencies
46
46
  */
47
- import useListViewModal from './use-list-view-modal';
48
47
  import useNavigationMenu from '../use-navigation-menu';
49
48
  import useNavigationEntities from '../use-navigation-entities';
50
49
  import Placeholder from './placeholder';
@@ -167,6 +166,10 @@ function Navigation( {
167
166
  // the Select Menu dropdown.
168
167
  useNavigationEntities();
169
168
 
169
+ const [ showNavigationMenuDeleteNotice ] = useNavigationNotice( {
170
+ name: 'block-library/core/navigation/delete',
171
+ } );
172
+
170
173
  const [
171
174
  showNavigationMenuCreateNotice,
172
175
  hideNavigationMenuCreateNotice,
@@ -267,6 +270,7 @@ function Navigation( {
267
270
  const [ overlayMenuPreview, setOverlayMenuPreview ] = useState( false );
268
271
 
269
272
  const {
273
+ hasResolvedNavigationMenus,
270
274
  isNavigationMenuResolved,
271
275
  isNavigationMenuMissing,
272
276
  navigationMenus,
@@ -280,12 +284,25 @@ function Navigation( {
280
284
  hasResolvedCanUserCreateNavigationMenu,
281
285
  } = useNavigationMenu( ref );
282
286
 
287
+ // Attempt to retrieve and prioritize any existing navigation menu unless
288
+ // a specific ref is allocated or the user is explicitly creating a new menu. The aim is
289
+ // for the block to "just work" from a user perspective using existing data.
290
+ useEffect( () => {
291
+ if (
292
+ isCreatingNavigationMenu ||
293
+ ref ||
294
+ ! navigationMenus?.length ||
295
+ navigationMenus?.length > 1
296
+ ) {
297
+ return;
298
+ }
299
+
300
+ setRef( navigationMenus[ 0 ].id );
301
+ }, [ navigationMenus ] );
302
+
283
303
  const navRef = useRef();
284
- const isDraftNavigationMenu = navigationMenu?.status === 'draft';
285
304
 
286
- const { listViewToolbarButton, listViewModal } = useListViewModal(
287
- clientId
288
- );
305
+ const isDraftNavigationMenu = navigationMenu?.status === 'draft';
289
306
 
290
307
  const {
291
308
  convert,
@@ -310,6 +327,7 @@ function Navigation( {
310
327
  ! ref &&
311
328
  ! isCreatingNavigationMenu &&
312
329
  ! isConvertingClassicMenu &&
330
+ hasResolvedNavigationMenus &&
313
331
  ( ! hasUncontrolledInnerBlocks || isWithinUnassignedArea );
314
332
 
315
333
  const isEntityAvailable =
@@ -322,10 +340,13 @@ function Navigation( {
322
340
  // - there is a ref attribute pointing to a Navigation Post
323
341
  // - the Navigation Post isn't available (hasn't resolved) yet.
324
342
  const isLoading =
343
+ ! hasResolvedNavigationMenus ||
325
344
  isCreatingNavigationMenu ||
326
345
  isConvertingClassicMenu ||
327
346
  !! ( ref && ! isEntityAvailable && ! isConvertingClassicMenu );
328
347
 
348
+ const textDecoration = attributes.style?.typography?.textDecoration;
349
+
329
350
  const blockProps = useBlockProps( {
330
351
  ref: navRef,
331
352
  className: classnames( className, {
@@ -346,6 +367,7 @@ function Navigation( {
346
367
  'background-color',
347
368
  backgroundColor?.slug
348
369
  ) ]: !! backgroundColor?.slug,
370
+ [ `has-text-decoration-${ textDecoration }` ]: textDecoration,
349
371
  } ),
350
372
  style: {
351
373
  color: ! textColor?.slug && textColor?.color,
@@ -534,11 +556,12 @@ function Navigation( {
534
556
  } );
535
557
  }, [ clientId, ref ] );
536
558
 
537
- // If the block has inner blocks, but no menu id, this was an older
538
- // navigation block added before the block used a wp_navigation entity.
539
- // Either this block was saved in the content or inserted by a pattern.
540
- // Consider this 'unsaved'. Offer an uncontrolled version of inner blocks,
541
- // that automatically saves the menu.
559
+ // If the block has inner blocks, but no menu id, then these blocks are either:
560
+ // - inserted via a pattern.
561
+ // - inserted directly via Code View (or otherwise).
562
+ // - from an older version of navigation block added before the block used a wp_navigation entity.
563
+ // Consider this state as 'unsaved' and offer an uncontrolled version of inner blocks,
564
+ // that automatically saves the menu as an entity when changes are made to the inner blocks.
542
565
  const hasUnsavedBlocks = hasUncontrolledInnerBlocks && ! isEntityAvailable;
543
566
  if ( hasUnsavedBlocks ) {
544
567
  return (
@@ -566,6 +589,10 @@ function Navigation( {
566
589
  setHasSavedUnsavedInnerBlocks( true );
567
590
  // Switch to using the wp_navigation entity.
568
591
  setRef( post.id );
592
+
593
+ showNavigationMenuCreateNotice(
594
+ __( `New Navigation Menu created.` )
595
+ );
569
596
  } }
570
597
  />
571
598
  </ResponsiveWrapper>
@@ -646,9 +673,7 @@ function Navigation( {
646
673
  />
647
674
  </ToolbarGroup>
648
675
  ) }
649
- <ToolbarGroup>{ listViewToolbarButton }</ToolbarGroup>
650
676
  </BlockControls>
651
- { listViewModal }
652
677
  <InspectorControls>
653
678
  { hasSubmenuIndicatorSetting && (
654
679
  <PanelBody title={ __( 'Display' ) }>
@@ -794,7 +819,18 @@ function Navigation( {
794
819
  { hasResolvedCanUserDeleteNavigationMenu &&
795
820
  canUserDeleteNavigationMenu && (
796
821
  <NavigationMenuDeleteControl
797
- onDelete={ resetToEmptyBlock }
822
+ onDelete={ ( deletedMenuTitle = '' ) => {
823
+ resetToEmptyBlock();
824
+ showNavigationMenuDeleteNotice(
825
+ sprintf(
826
+ // translators: %s: the name of a menu (e.g. Header navigation).
827
+ __(
828
+ 'Navigation menu %s successfully deleted.'
829
+ ),
830
+ deletedMenuTitle
831
+ )
832
+ );
833
+ } }
798
834
  />
799
835
  ) }
800
836
  </InspectorControls>
@@ -67,7 +67,7 @@ export default function NavigationMenuDeleteControl( { onDelete } ) {
67
67
  id,
68
68
  { force: true }
69
69
  );
70
- onDelete();
70
+ onDelete( title );
71
71
  } }
72
72
  >
73
73
  { __( 'Confirm' ) }