@wordpress/block-library 7.4.0 → 7.7.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 (798) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +3 -2
  3. package/babel-plugin.js +154 -0
  4. package/build/audio/edit.js +4 -16
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/block/edit.js +10 -9
  7. package/build/block/edit.js.map +1 -1
  8. package/build/button/deprecated.js +175 -35
  9. package/build/button/deprecated.js.map +1 -1
  10. package/build/button/edit.js +1 -1
  11. package/build/button/edit.js.map +1 -1
  12. package/build/button/edit.native.js +7 -3
  13. package/build/button/edit.native.js.map +1 -1
  14. package/build/button/index.js +1 -0
  15. package/build/button/index.js.map +1 -1
  16. package/build/button/save.js +1 -1
  17. package/build/button/save.js.map +1 -1
  18. package/build/categories/edit.js +1 -1
  19. package/build/categories/edit.js.map +1 -1
  20. package/build/categories/index.js +1 -1
  21. package/build/columns/index.js +3 -1
  22. package/build/columns/index.js.map +1 -1
  23. package/build/comment-author-avatar/index.js +1 -0
  24. package/build/comment-author-avatar/index.js.map +1 -1
  25. package/build/comment-template/edit.js +1 -3
  26. package/build/comment-template/edit.js.map +1 -1
  27. package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  28. package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
  29. package/build/{comments-query-loop → comments}/edit.js +3 -3
  30. package/build/comments/edit.js.map +1 -0
  31. package/build/{comments-query-loop → comments}/index.js +1 -1
  32. package/build/comments/index.js.map +1 -0
  33. package/build/{comments-query-loop → comments}/save.js +2 -2
  34. package/build/comments/save.js.map +1 -0
  35. package/build/comments-title/deprecated.js +110 -0
  36. package/build/comments-title/deprecated.js.map +1 -0
  37. package/build/comments-title/edit.js +35 -35
  38. package/build/comments-title/edit.js.map +1 -1
  39. package/build/comments-title/index.js +5 -8
  40. package/build/comments-title/index.js.map +1 -1
  41. package/build/cover/controls.native.js +2 -3
  42. package/build/cover/controls.native.js.map +1 -1
  43. package/build/cover/deprecated.js +212 -207
  44. package/build/cover/deprecated.js.map +1 -1
  45. package/build/cover/edit/block-controls.js +115 -0
  46. package/build/cover/edit/block-controls.js.map +1 -0
  47. package/build/cover/edit/cover-placeholder.js +49 -0
  48. package/build/cover/edit/cover-placeholder.js.map +1 -0
  49. package/build/cover/edit/index.js +343 -0
  50. package/build/cover/edit/index.js.map +1 -0
  51. package/build/cover/edit/inspector-controls.js +224 -0
  52. package/build/cover/edit/inspector-controls.js.map +1 -0
  53. package/build/cover/edit/resizable-cover.js +67 -0
  54. package/build/cover/edit/resizable-cover.js.map +1 -0
  55. package/build/cover/edit/use-cover-is-dark.js +81 -0
  56. package/build/cover/edit/use-cover-is-dark.js.map +1 -0
  57. package/build/cover/edit.native.js +36 -16
  58. package/build/cover/edit.native.js.map +1 -1
  59. package/build/cover/focal-point-settings-button.native.js.map +1 -1
  60. package/build/cover/save.js +18 -5
  61. package/build/cover/save.js.map +1 -1
  62. package/build/cover/shared.js +15 -9
  63. package/build/cover/shared.js.map +1 -1
  64. package/build/cover/transforms.js +77 -6
  65. package/build/cover/transforms.js.map +1 -1
  66. package/build/cover/use-cover-is-dark.native.js +60 -0
  67. package/build/cover/use-cover-is-dark.native.js.map +1 -0
  68. package/build/embed/embed-preview.js +1 -1
  69. package/build/embed/embed-preview.js.map +1 -1
  70. package/build/file/edit.js +1 -1
  71. package/build/file/edit.js.map +1 -1
  72. package/build/file/edit.native.js +0 -1
  73. package/build/file/edit.native.js.map +1 -1
  74. package/build/file/save.js +9 -1
  75. package/build/file/save.js.map +1 -1
  76. package/build/gallery/edit.js +2 -1
  77. package/build/gallery/edit.js.map +1 -1
  78. package/build/gallery/gallery.js +1 -1
  79. package/build/gallery/gallery.js.map +1 -1
  80. package/build/gallery/gap-styles.js +14 -4
  81. package/build/gallery/gap-styles.js.map +1 -1
  82. package/build/gallery/index.js +1 -1
  83. package/build/gallery/shared.js +2 -2
  84. package/build/gallery/shared.js.map +1 -1
  85. package/build/gallery/use-get-media.js +2 -1
  86. package/build/gallery/use-get-media.js.map +1 -1
  87. package/build/gallery/use-short-code-transform.js +19 -18
  88. package/build/gallery/use-short-code-transform.js.map +1 -1
  89. package/build/gallery/v1/gallery.js +1 -1
  90. package/build/gallery/v1/gallery.js.map +1 -1
  91. package/build/group/index.js +1 -0
  92. package/build/group/index.js.map +1 -1
  93. package/build/heading/edit.js +6 -2
  94. package/build/heading/edit.js.map +1 -1
  95. package/build/heading/index.js +1 -0
  96. package/build/heading/index.js.map +1 -1
  97. package/build/heading/transforms.js +9 -4
  98. package/build/heading/transforms.js.map +1 -1
  99. package/build/image/edit.js +5 -56
  100. package/build/image/edit.js.map +1 -1
  101. package/build/image/edit.native.js +56 -4
  102. package/build/image/edit.native.js.map +1 -1
  103. package/build/image/image.js +4 -14
  104. package/build/image/image.js.map +1 -1
  105. package/build/index.js +48 -14
  106. package/build/index.js.map +1 -1
  107. package/build/is-block-metadata-experimental.js +18 -0
  108. package/build/is-block-metadata-experimental.js.map +1 -0
  109. package/build/latest-posts/edit.js +30 -4
  110. package/build/latest-posts/edit.js.map +1 -1
  111. package/build/latest-posts/edit.native.js +49 -0
  112. package/build/latest-posts/edit.native.js.map +1 -1
  113. package/build/list/transforms.js +6 -0
  114. package/build/list/transforms.js.map +1 -1
  115. package/build/list/v2/edit.js +2 -1
  116. package/build/list/v2/edit.js.map +1 -1
  117. package/build/list/v2/migrate.js +1 -0
  118. package/build/list/v2/migrate.js.map +1 -1
  119. package/build/list/v2/transforms.js +46 -9
  120. package/build/list/v2/transforms.js.map +1 -1
  121. package/build/list-item/edit.js +7 -9
  122. package/build/list-item/edit.js.map +1 -1
  123. package/build/list-item/hooks/index.js +24 -0
  124. package/build/list-item/hooks/index.js.map +1 -1
  125. package/build/list-item/hooks/use-backspace.js +59 -0
  126. package/build/list-item/hooks/use-backspace.js.map +1 -0
  127. package/build/list-item/hooks/use-enter.js +6 -9
  128. package/build/list-item/hooks/use-enter.js.map +1 -1
  129. package/build/list-item/hooks/use-indent-list-item.js +33 -39
  130. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  131. package/build/list-item/hooks/use-space.js +54 -0
  132. package/build/list-item/hooks/use-space.js.map +1 -0
  133. package/build/list-item/hooks/use-split.js +44 -0
  134. package/build/list-item/hooks/use-split.js.map +1 -0
  135. package/build/list-item/index.js +1 -0
  136. package/build/list-item/index.js.map +1 -1
  137. package/build/list-item/utils.js +1 -1
  138. package/build/list-item/utils.js.map +1 -1
  139. package/build/media-text/edit.native.js +2 -1
  140. package/build/media-text/edit.native.js.map +1 -1
  141. package/build/media-text/media-container.native.js +2 -4
  142. package/build/media-text/media-container.native.js.map +1 -1
  143. package/build/media-text/transforms.js +137 -8
  144. package/build/media-text/transforms.js.map +1 -1
  145. package/build/navigation/edit/index.js +91 -109
  146. package/build/navigation/edit/index.js.map +1 -1
  147. package/build/navigation/edit/inner-blocks.js +6 -12
  148. package/build/navigation/edit/inner-blocks.js.map +1 -1
  149. package/build/navigation/index.js +0 -1
  150. package/build/navigation/index.js.map +1 -1
  151. package/build/navigation/use-navigation-entities.js +3 -3
  152. package/build/navigation/use-navigation-entities.js.map +1 -1
  153. package/build/navigation/view-modal.js +25 -0
  154. package/build/navigation/view-modal.js.map +1 -1
  155. package/build/navigation-link/edit.js +60 -35
  156. package/build/navigation-link/edit.js.map +1 -1
  157. package/build/navigation-link/fallback-variations.js +1 -1
  158. package/build/navigation-link/fallback-variations.js.map +1 -1
  159. package/build/navigation-link/hooks.js +1 -1
  160. package/build/navigation-link/hooks.js.map +1 -1
  161. package/build/navigation-submenu/edit.js +14 -14
  162. package/build/navigation-submenu/edit.js.map +1 -1
  163. package/build/page-list/convert-to-links-modal.js +1 -1
  164. package/build/page-list/convert-to-links-modal.js.map +1 -1
  165. package/build/page-list/edit.js +1 -1
  166. package/build/page-list/edit.js.map +1 -1
  167. package/build/paragraph/edit.js +10 -0
  168. package/build/paragraph/edit.js.map +1 -1
  169. package/build/paragraph/use-enter.js +94 -0
  170. package/build/paragraph/use-enter.js.map +1 -0
  171. package/build/post-author/edit.js +1 -1
  172. package/build/post-author/edit.js.map +1 -1
  173. package/build/post-author-name/index.js +4 -0
  174. package/build/post-author-name/index.js.map +1 -1
  175. package/build/post-author-name/transforms.js +41 -0
  176. package/build/post-author-name/transforms.js.map +1 -0
  177. package/build/post-comment/index.js +2 -1
  178. package/build/post-comment/index.js.map +1 -1
  179. package/build/post-comments/edit.js +138 -35
  180. package/build/post-comments/edit.js.map +1 -1
  181. package/build/post-comments/index.js +3 -2
  182. package/build/post-comments/index.js.map +1 -1
  183. package/build/post-comments-count/index.js +1 -0
  184. package/build/post-comments-count/index.js.map +1 -1
  185. package/build/post-comments-form/edit.js +38 -4
  186. package/build/post-comments-form/edit.js.map +1 -1
  187. package/build/post-comments-form/form.js +58 -0
  188. package/build/post-comments-form/form.js.map +1 -0
  189. package/build/post-comments-form/index.js +1 -0
  190. package/build/post-comments-form/index.js.map +1 -1
  191. package/build/post-comments-link/index.js +1 -0
  192. package/build/post-comments-link/index.js.map +1 -1
  193. package/build/post-content/edit.js +1 -1
  194. package/build/post-content/edit.js.map +1 -1
  195. package/build/post-date/edit.js +13 -7
  196. package/build/post-date/edit.js.map +1 -1
  197. package/build/post-excerpt/edit.js +1 -1
  198. package/build/post-excerpt/edit.js.map +1 -1
  199. package/build/post-featured-image/edit.js +1 -1
  200. package/build/post-featured-image/edit.js.map +1 -1
  201. package/build/post-template/edit.js +7 -2
  202. package/build/post-template/edit.js.map +1 -1
  203. package/build/post-terms/edit.js +35 -4
  204. package/build/post-terms/edit.js.map +1 -1
  205. package/build/post-terms/hooks.js +33 -0
  206. package/build/post-terms/hooks.js.map +1 -0
  207. package/build/post-terms/index.js +20 -5
  208. package/build/post-terms/index.js.map +1 -1
  209. package/build/post-title/index.js +1 -1
  210. package/build/post-title/index.js.map +1 -1
  211. package/build/pullquote/edit.js +1 -1
  212. package/build/pullquote/edit.js.map +1 -1
  213. package/build/pullquote/edit.native.js +1 -1
  214. package/build/pullquote/edit.native.js.map +1 -1
  215. package/build/query/edit/inspector-controls/index.js +26 -17
  216. package/build/query/edit/inspector-controls/index.js.map +1 -1
  217. package/build/query/edit/inspector-controls/parent-control.js +148 -0
  218. package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
  219. package/build/query/edit/inspector-controls/sticky-control.js +41 -0
  220. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
  221. package/build/query/index.js +2 -1
  222. package/build/query/index.js.map +1 -1
  223. package/build/query/utils.js +28 -2
  224. package/build/query/utils.js.map +1 -1
  225. package/build/query-no-results/edit.js +1 -1
  226. package/build/query-no-results/edit.js.map +1 -1
  227. package/build/query-title/index.js +1 -1
  228. package/build/query-title/index.js.map +1 -1
  229. package/build/query-title/variations.js +1 -1
  230. package/build/query-title/variations.js.map +1 -1
  231. package/build/quote/edit.js +3 -2
  232. package/build/quote/edit.js.map +1 -1
  233. package/build/quote/index.js +1 -0
  234. package/build/quote/index.js.map +1 -1
  235. package/build/quote/v2/edit.js +1 -1
  236. package/build/quote/v2/edit.js.map +1 -1
  237. package/build/search/edit.js +2 -1
  238. package/build/search/edit.js.map +1 -1
  239. package/build/search/index.js +4 -0
  240. package/build/search/index.js.map +1 -1
  241. package/build/separator/index.js +3 -0
  242. package/build/separator/index.js.map +1 -1
  243. package/build/shortcode/edit.native.js +16 -13
  244. package/build/shortcode/edit.native.js.map +1 -1
  245. package/build/site-logo/edit.js +1 -1
  246. package/build/site-logo/edit.js.map +1 -1
  247. package/build/social-links/edit.js +2 -2
  248. package/build/social-links/edit.js.map +1 -1
  249. package/build/table/edit.js +15 -2
  250. package/build/table/edit.js.map +1 -1
  251. package/build/table-of-contents/edit.js +145 -65
  252. package/build/table-of-contents/edit.js.map +1 -1
  253. package/build/table-of-contents/index.js +13 -3
  254. package/build/table-of-contents/index.js.map +1 -1
  255. package/build/table-of-contents/list.js +16 -9
  256. package/build/table-of-contents/list.js.map +1 -1
  257. package/build/table-of-contents/save.js +40 -0
  258. package/build/table-of-contents/save.js.map +1 -0
  259. package/build/table-of-contents/utils.js +11 -77
  260. package/build/table-of-contents/utils.js.map +1 -1
  261. package/build/template-part/edit/index.js +7 -3
  262. package/build/template-part/edit/index.js.map +1 -1
  263. package/build/template-part/edit/inner-blocks.js +3 -8
  264. package/build/template-part/edit/inner-blocks.js.map +1 -1
  265. package/build/video/edit.js +4 -8
  266. package/build/video/edit.js.map +1 -1
  267. package/build-module/audio/edit.js +5 -17
  268. package/build-module/audio/edit.js.map +1 -1
  269. package/build-module/block/edit.js +11 -10
  270. package/build-module/block/edit.js.map +1 -1
  271. package/build-module/button/deprecated.js +175 -35
  272. package/build-module/button/deprecated.js.map +1 -1
  273. package/build-module/button/edit.js +2 -2
  274. package/build-module/button/edit.js.map +1 -1
  275. package/build-module/button/edit.native.js +7 -3
  276. package/build-module/button/edit.native.js.map +1 -1
  277. package/build-module/button/index.js +1 -0
  278. package/build-module/button/index.js.map +1 -1
  279. package/build-module/button/save.js +2 -2
  280. package/build-module/button/save.js.map +1 -1
  281. package/build-module/categories/edit.js +1 -1
  282. package/build-module/categories/edit.js.map +1 -1
  283. package/build-module/categories/index.js +1 -1
  284. package/build-module/columns/index.js +3 -1
  285. package/build-module/columns/index.js.map +1 -1
  286. package/build-module/comment-author-avatar/index.js +1 -0
  287. package/build-module/comment-author-avatar/index.js.map +1 -1
  288. package/build-module/comment-template/edit.js +1 -3
  289. package/build-module/comment-template/edit.js.map +1 -1
  290. package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  291. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
  292. package/build-module/{comments-query-loop → comments}/edit.js +2 -2
  293. package/build-module/comments/edit.js.map +1 -0
  294. package/build-module/{comments-query-loop → comments}/index.js +1 -1
  295. package/build-module/comments/index.js.map +1 -0
  296. package/build-module/{comments-query-loop → comments}/save.js +1 -1
  297. package/build-module/comments/save.js.map +1 -0
  298. package/build-module/comments-title/deprecated.js +102 -0
  299. package/build-module/comments-title/deprecated.js.map +1 -0
  300. package/build-module/comments-title/edit.js +38 -38
  301. package/build-module/comments-title/edit.js.map +1 -1
  302. package/build-module/comments-title/index.js +4 -8
  303. package/build-module/comments-title/index.js.map +1 -1
  304. package/build-module/cover/controls.native.js +2 -3
  305. package/build-module/cover/controls.native.js.map +1 -1
  306. package/build-module/cover/deprecated.js +206 -198
  307. package/build-module/cover/deprecated.js.map +1 -1
  308. package/build-module/cover/edit/block-controls.js +104 -0
  309. package/build-module/cover/edit/block-controls.js.map +1 -0
  310. package/build-module/cover/edit/cover-placeholder.js +38 -0
  311. package/build-module/cover/edit/cover-placeholder.js.map +1 -0
  312. package/build-module/cover/edit/index.js +317 -0
  313. package/build-module/cover/edit/index.js.map +1 -0
  314. package/build-module/cover/edit/inspector-controls.js +215 -0
  315. package/build-module/cover/edit/inspector-controls.js.map +1 -0
  316. package/build-module/cover/edit/resizable-cover.js +55 -0
  317. package/build-module/cover/edit/resizable-cover.js.map +1 -0
  318. package/build-module/cover/edit/use-cover-is-dark.js +70 -0
  319. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
  320. package/build-module/cover/edit.native.js +35 -17
  321. package/build-module/cover/edit.native.js.map +1 -1
  322. package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
  323. package/build-module/cover/save.js +19 -6
  324. package/build-module/cover/save.js.map +1 -1
  325. package/build-module/cover/shared.js +11 -5
  326. package/build-module/cover/shared.js.map +1 -1
  327. package/build-module/cover/transforms.js +74 -6
  328. package/build-module/cover/transforms.js.map +1 -1
  329. package/build-module/cover/use-cover-is-dark.native.js +51 -0
  330. package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
  331. package/build-module/embed/embed-preview.js +2 -2
  332. package/build-module/embed/embed-preview.js.map +1 -1
  333. package/build-module/file/edit.js +2 -2
  334. package/build-module/file/edit.js.map +1 -1
  335. package/build-module/file/edit.native.js +0 -1
  336. package/build-module/file/edit.native.js.map +1 -1
  337. package/build-module/file/save.js +7 -2
  338. package/build-module/file/save.js.map +1 -1
  339. package/build-module/gallery/edit.js +2 -1
  340. package/build-module/gallery/edit.js.map +1 -1
  341. package/build-module/gallery/gallery.js +2 -2
  342. package/build-module/gallery/gallery.js.map +1 -1
  343. package/build-module/gallery/gap-styles.js +14 -4
  344. package/build-module/gallery/gap-styles.js.map +1 -1
  345. package/build-module/gallery/index.js +1 -1
  346. package/build-module/gallery/shared.js +2 -2
  347. package/build-module/gallery/shared.js.map +1 -1
  348. package/build-module/gallery/use-get-media.js +2 -1
  349. package/build-module/gallery/use-get-media.js.map +1 -1
  350. package/build-module/gallery/use-short-code-transform.js +19 -18
  351. package/build-module/gallery/use-short-code-transform.js.map +1 -1
  352. package/build-module/gallery/v1/gallery.js +2 -2
  353. package/build-module/gallery/v1/gallery.js.map +1 -1
  354. package/build-module/group/index.js +1 -0
  355. package/build-module/group/index.js.map +1 -1
  356. package/build-module/heading/edit.js +6 -2
  357. package/build-module/heading/edit.js.map +1 -1
  358. package/build-module/heading/index.js +1 -0
  359. package/build-module/heading/index.js.map +1 -1
  360. package/build-module/heading/transforms.js +9 -4
  361. package/build-module/heading/transforms.js.map +1 -1
  362. package/build-module/image/edit.js +4 -52
  363. package/build-module/image/edit.js.map +1 -1
  364. package/build-module/image/edit.native.js +57 -6
  365. package/build-module/image/edit.native.js.map +1 -1
  366. package/build-module/image/image.js +6 -16
  367. package/build-module/image/image.js.map +1 -1
  368. package/build-module/index.js +43 -12
  369. package/build-module/index.js.map +1 -1
  370. package/build-module/is-block-metadata-experimental.js +16 -0
  371. package/build-module/is-block-metadata-experimental.js.map +1 -0
  372. package/build-module/latest-posts/edit.js +29 -5
  373. package/build-module/latest-posts/edit.js.map +1 -1
  374. package/build-module/latest-posts/edit.native.js +51 -2
  375. package/build-module/latest-posts/edit.native.js.map +1 -1
  376. package/build-module/list/transforms.js +6 -0
  377. package/build-module/list/transforms.js.map +1 -1
  378. package/build-module/list/v2/edit.js +2 -1
  379. package/build-module/list/v2/edit.js.map +1 -1
  380. package/build-module/list/v2/migrate.js +1 -3
  381. package/build-module/list/v2/migrate.js.map +1 -1
  382. package/build-module/list/v2/transforms.js +46 -9
  383. package/build-module/list/v2/transforms.js.map +1 -1
  384. package/build-module/list-item/edit.js +8 -9
  385. package/build-module/list-item/edit.js.map +1 -1
  386. package/build-module/list-item/hooks/index.js +3 -0
  387. package/build-module/list-item/hooks/index.js.map +1 -1
  388. package/build-module/list-item/hooks/use-backspace.js +44 -0
  389. package/build-module/list-item/hooks/use-backspace.js.map +1 -0
  390. package/build-module/list-item/hooks/use-enter.js +6 -9
  391. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  392. package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
  393. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  394. package/build-module/list-item/hooks/use-space.js +40 -0
  395. package/build-module/list-item/hooks/use-space.js.map +1 -0
  396. package/build-module/list-item/hooks/use-split.js +33 -0
  397. package/build-module/list-item/hooks/use-split.js.map +1 -0
  398. package/build-module/list-item/index.js +1 -0
  399. package/build-module/list-item/index.js.map +1 -1
  400. package/build-module/list-item/utils.js +1 -1
  401. package/build-module/list-item/utils.js.map +1 -1
  402. package/build-module/media-text/edit.native.js +2 -1
  403. package/build-module/media-text/edit.native.js.map +1 -1
  404. package/build-module/media-text/media-container.native.js +2 -4
  405. package/build-module/media-text/media-container.native.js.map +1 -1
  406. package/build-module/media-text/transforms.js +137 -8
  407. package/build-module/media-text/transforms.js.map +1 -1
  408. package/build-module/navigation/edit/index.js +93 -110
  409. package/build-module/navigation/edit/index.js.map +1 -1
  410. package/build-module/navigation/edit/inner-blocks.js +7 -13
  411. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  412. package/build-module/navigation/index.js +0 -1
  413. package/build-module/navigation/index.js.map +1 -1
  414. package/build-module/navigation/use-navigation-entities.js +1 -1
  415. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  416. package/build-module/navigation/view-modal.js +24 -0
  417. package/build-module/navigation/view-modal.js.map +1 -1
  418. package/build-module/navigation-link/edit.js +60 -36
  419. package/build-module/navigation-link/edit.js.map +1 -1
  420. package/build-module/navigation-link/fallback-variations.js +1 -1
  421. package/build-module/navigation-link/fallback-variations.js.map +1 -1
  422. package/build-module/navigation-link/hooks.js +2 -2
  423. package/build-module/navigation-link/hooks.js.map +1 -1
  424. package/build-module/navigation-submenu/edit.js +14 -14
  425. package/build-module/navigation-submenu/edit.js.map +1 -1
  426. package/build-module/page-list/convert-to-links-modal.js +1 -1
  427. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  428. package/build-module/page-list/edit.js +1 -1
  429. package/build-module/page-list/edit.js.map +1 -1
  430. package/build-module/paragraph/edit.js +9 -0
  431. package/build-module/paragraph/edit.js.map +1 -1
  432. package/build-module/paragraph/use-enter.js +81 -0
  433. package/build-module/paragraph/use-enter.js.map +1 -0
  434. package/build-module/post-author/edit.js +1 -1
  435. package/build-module/post-author/edit.js.map +1 -1
  436. package/build-module/post-author-name/index.js +3 -0
  437. package/build-module/post-author-name/index.js.map +1 -1
  438. package/build-module/post-author-name/transforms.js +32 -0
  439. package/build-module/post-author-name/transforms.js.map +1 -0
  440. package/build-module/post-comment/index.js +2 -1
  441. package/build-module/post-comment/index.js.map +1 -1
  442. package/build-module/post-comments/edit.js +139 -37
  443. package/build-module/post-comments/edit.js.map +1 -1
  444. package/build-module/post-comments/index.js +3 -2
  445. package/build-module/post-comments/index.js.map +1 -1
  446. package/build-module/post-comments-count/index.js +1 -0
  447. package/build-module/post-comments-count/index.js.map +1 -1
  448. package/build-module/post-comments-form/edit.js +38 -6
  449. package/build-module/post-comments-form/edit.js.map +1 -1
  450. package/build-module/post-comments-form/form.js +45 -0
  451. package/build-module/post-comments-form/form.js.map +1 -0
  452. package/build-module/post-comments-form/index.js +1 -0
  453. package/build-module/post-comments-form/index.js.map +1 -1
  454. package/build-module/post-comments-link/index.js +1 -0
  455. package/build-module/post-comments-link/index.js.map +1 -1
  456. package/build-module/post-content/edit.js +1 -1
  457. package/build-module/post-content/edit.js.map +1 -1
  458. package/build-module/post-date/edit.js +15 -9
  459. package/build-module/post-date/edit.js.map +1 -1
  460. package/build-module/post-excerpt/edit.js +1 -1
  461. package/build-module/post-excerpt/edit.js.map +1 -1
  462. package/build-module/post-featured-image/edit.js +1 -1
  463. package/build-module/post-featured-image/edit.js.map +1 -1
  464. package/build-module/post-template/edit.js +7 -2
  465. package/build-module/post-template/edit.js.map +1 -1
  466. package/build-module/post-terms/edit.js +35 -6
  467. package/build-module/post-terms/edit.js.map +1 -1
  468. package/build-module/post-terms/hooks.js +25 -0
  469. package/build-module/post-terms/hooks.js.map +1 -0
  470. package/build-module/post-terms/index.js +18 -8
  471. package/build-module/post-terms/index.js.map +1 -1
  472. package/build-module/post-title/index.js +1 -1
  473. package/build-module/post-title/index.js.map +1 -1
  474. package/build-module/pullquote/edit.js +2 -2
  475. package/build-module/pullquote/edit.js.map +1 -1
  476. package/build-module/pullquote/edit.native.js +2 -2
  477. package/build-module/pullquote/edit.native.js.map +1 -1
  478. package/build-module/query/edit/inspector-controls/index.js +24 -17
  479. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  480. package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
  481. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
  482. package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
  483. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
  484. package/build-module/query/index.js +2 -1
  485. package/build-module/query/index.js.map +1 -1
  486. package/build-module/query/utils.js +21 -0
  487. package/build-module/query/utils.js.map +1 -1
  488. package/build-module/query-no-results/edit.js +1 -1
  489. package/build-module/query-no-results/edit.js.map +1 -1
  490. package/build-module/query-title/index.js +1 -1
  491. package/build-module/query-title/index.js.map +1 -1
  492. package/build-module/query-title/variations.js +2 -2
  493. package/build-module/query-title/variations.js.map +1 -1
  494. package/build-module/quote/edit.js +4 -3
  495. package/build-module/quote/edit.js.map +1 -1
  496. package/build-module/quote/index.js +1 -0
  497. package/build-module/quote/index.js.map +1 -1
  498. package/build-module/quote/v2/edit.js +2 -2
  499. package/build-module/quote/v2/edit.js.map +1 -1
  500. package/build-module/search/edit.js +3 -2
  501. package/build-module/search/edit.js.map +1 -1
  502. package/build-module/search/index.js +4 -0
  503. package/build-module/search/index.js.map +1 -1
  504. package/build-module/separator/index.js +3 -0
  505. package/build-module/separator/index.js.map +1 -1
  506. package/build-module/shortcode/edit.native.js +17 -13
  507. package/build-module/shortcode/edit.native.js.map +1 -1
  508. package/build-module/site-logo/edit.js +1 -1
  509. package/build-module/site-logo/edit.js.map +1 -1
  510. package/build-module/social-links/edit.js +2 -2
  511. package/build-module/social-links/edit.js.map +1 -1
  512. package/build-module/table/edit.js +17 -4
  513. package/build-module/table/edit.js.map +1 -1
  514. package/build-module/table-of-contents/edit.js +144 -68
  515. package/build-module/table-of-contents/edit.js.map +1 -1
  516. package/build-module/table-of-contents/index.js +12 -3
  517. package/build-module/table-of-contents/index.js.map +1 -1
  518. package/build-module/table-of-contents/list.js +18 -10
  519. package/build-module/table-of-contents/list.js.map +1 -1
  520. package/build-module/table-of-contents/save.js +28 -0
  521. package/build-module/table-of-contents/save.js.map +1 -0
  522. package/build-module/table-of-contents/utils.js +11 -73
  523. package/build-module/table-of-contents/utils.js.map +1 -1
  524. package/build-module/template-part/edit/index.js +8 -4
  525. package/build-module/template-part/edit/index.js.map +1 -1
  526. package/build-module/template-part/edit/inner-blocks.js +4 -9
  527. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  528. package/build-module/video/edit.js +5 -9
  529. package/build-module/video/edit.js.map +1 -1
  530. package/build-style/comment-content/style-rtl.css +81 -0
  531. package/build-style/comment-content/style.css +81 -0
  532. package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
  533. package/build-style/{comments-query-loop → comments}/editor.css +0 -0
  534. package/build-style/cover/style-rtl.css +32 -27
  535. package/build-style/cover/style.css +32 -27
  536. package/build-style/editor-rtl.css +16 -10
  537. package/build-style/editor.css +16 -10
  538. package/build-style/image/editor-rtl.css +1 -1
  539. package/build-style/image/editor.css +1 -1
  540. package/build-style/latest-posts/style-rtl.css +2 -0
  541. package/build-style/latest-posts/style.css +4 -0
  542. package/build-style/navigation/style-rtl.css +3 -0
  543. package/build-style/navigation/style.css +3 -0
  544. package/build-style/post-comments/editor-rtl.css +79 -0
  545. package/build-style/post-comments/editor.css +79 -0
  546. package/build-style/post-comments/style-rtl.css +27 -3
  547. package/build-style/post-comments/style.css +27 -3
  548. package/build-style/post-comments-form/editor-rtl.css +79 -0
  549. package/build-style/post-comments-form/editor.css +79 -0
  550. package/build-style/post-comments-form/style-rtl.css +1 -3
  551. package/build-style/post-comments-form/style.css +1 -3
  552. package/build-style/separator/editor-rtl.css +1 -0
  553. package/build-style/separator/editor.css +1 -0
  554. package/build-style/site-logo/style-rtl.css +4 -0
  555. package/build-style/site-logo/style.css +4 -0
  556. package/build-style/style-rtl.css +69 -33
  557. package/build-style/style.css +71 -33
  558. package/build-style/video/editor-rtl.css +2 -5
  559. package/build-style/video/editor.css +2 -5
  560. package/build-types/table-of-contents/list.d.ts +12 -0
  561. package/build-types/table-of-contents/list.d.ts.map +1 -0
  562. package/build-types/table-of-contents/utils.d.ts +24 -0
  563. package/build-types/table-of-contents/utils.d.ts.map +1 -0
  564. package/package.json +30 -29
  565. package/src/audio/edit.js +6 -9
  566. package/src/avatar/block.json +0 -1
  567. package/src/avatar/index.php +2 -2
  568. package/src/block/edit.js +39 -42
  569. package/src/block/test/edit.native.js +1 -1
  570. package/src/button/block.json +1 -0
  571. package/src/button/deprecated.js +145 -0
  572. package/src/button/edit.js +3 -1
  573. package/src/button/edit.native.js +6 -3
  574. package/src/button/save.js +3 -1
  575. package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
  576. package/src/buttons/test/edit.native.js +1 -1
  577. package/src/categories/block.json +1 -1
  578. package/src/categories/edit.js +1 -1
  579. package/src/columns/block.json +3 -1
  580. package/src/comment-author-avatar/block.json +1 -0
  581. package/src/comment-author-name/index.php +7 -5
  582. package/src/comment-content/index.php +25 -3
  583. package/src/comment-content/style.scss +5 -0
  584. package/src/comment-edit-link/index.php +1 -4
  585. package/src/comment-reply-link/index.php +1 -4
  586. package/src/comment-template/edit.js +1 -5
  587. package/src/comment-template/index.php +4 -0
  588. package/src/{comments-query-loop → comments}/block.json +1 -1
  589. package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  590. package/src/{comments-query-loop → comments}/edit.js +2 -1
  591. package/src/{comments-query-loop → comments}/editor.scss +0 -0
  592. package/src/{comments-query-loop → comments}/index.js +0 -0
  593. package/src/{comments-query-loop → comments}/save.js +1 -3
  594. package/src/comments-pagination/index.php +4 -0
  595. package/src/comments-title/block.json +0 -6
  596. package/src/comments-title/deprecated.js +34 -0
  597. package/src/comments-title/edit.js +44 -84
  598. package/src/comments-title/index.js +3 -1
  599. package/src/comments-title/index.php +51 -22
  600. package/src/cover/controls.native.js +1 -2
  601. package/src/cover/deprecated.js +230 -183
  602. package/src/cover/edit/block-controls.js +119 -0
  603. package/src/cover/edit/cover-placeholder.js +39 -0
  604. package/src/cover/edit/index.js +393 -0
  605. package/src/cover/edit/inspector-controls.js +286 -0
  606. package/src/cover/edit/resizable-cover.js +55 -0
  607. package/src/cover/edit/use-cover-is-dark.js +71 -0
  608. package/src/cover/edit.native.js +40 -14
  609. package/src/cover/editor.scss +1 -1
  610. package/src/cover/focal-point-settings-button.native.js +1 -1
  611. package/src/cover/index.php +20 -37
  612. package/src/cover/save.js +26 -13
  613. package/src/cover/shared.js +5 -3
  614. package/src/cover/style.native.scss +4 -0
  615. package/src/cover/style.scss +27 -26
  616. package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
  617. package/src/cover/test/block-controls.js +62 -0
  618. package/src/cover/test/transforms.js +301 -0
  619. package/src/cover/transforms.js +112 -7
  620. package/src/cover/use-cover-is-dark.native.js +51 -0
  621. package/src/editor.scss +3 -1
  622. package/src/embed/embed-preview.js +4 -2
  623. package/src/file/edit.js +5 -1
  624. package/src/file/edit.native.js +0 -1
  625. package/src/file/save.js +14 -2
  626. package/src/gallery/block.json +1 -1
  627. package/src/gallery/edit.js +2 -1
  628. package/src/gallery/gallery.js +2 -2
  629. package/src/gallery/gap-styles.js +21 -6
  630. package/src/gallery/index.php +23 -12
  631. package/src/gallery/shared.js +3 -2
  632. package/src/gallery/use-get-media.js +2 -1
  633. package/src/gallery/use-short-code-transform.js +19 -16
  634. package/src/gallery/v1/gallery.js +2 -2
  635. package/src/group/block.json +1 -0
  636. package/src/heading/block.json +1 -0
  637. package/src/heading/edit.js +5 -2
  638. package/src/heading/transforms.js +4 -3
  639. package/src/image/edit.js +0 -44
  640. package/src/image/edit.native.js +65 -4
  641. package/src/image/editor.scss +1 -1
  642. package/src/image/image.js +10 -13
  643. package/src/image/styles.native.scss +11 -0
  644. package/src/image/test/edit.native.js +7 -7
  645. package/src/index.js +53 -33
  646. package/src/is-block-metadata-experimental.js +19 -0
  647. package/src/latest-posts/edit.js +27 -2
  648. package/src/latest-posts/edit.native.js +56 -1
  649. package/src/latest-posts/index.php +12 -6
  650. package/src/latest-posts/style.scss +4 -0
  651. package/src/list/transforms.js +7 -0
  652. package/src/list/v2/edit.js +1 -0
  653. package/src/list/v2/migrate.js +1 -1
  654. package/src/list/v2/transforms.js +35 -0
  655. package/src/list-item/block.json +2 -1
  656. package/src/list-item/edit.js +17 -10
  657. package/src/list-item/hooks/index.js +3 -0
  658. package/src/list-item/hooks/use-backspace.js +52 -0
  659. package/src/list-item/hooks/use-enter.js +9 -16
  660. package/src/list-item/hooks/use-indent-list-item.js +50 -63
  661. package/src/list-item/hooks/use-space.js +48 -0
  662. package/src/list-item/hooks/use-split.js +33 -0
  663. package/src/list-item/utils.js +1 -1
  664. package/src/media-text/edit.native.js +3 -1
  665. package/src/media-text/media-container.native.js +2 -4
  666. package/src/media-text/transforms.js +154 -0
  667. package/src/navigation/block.json +0 -1
  668. package/src/navigation/edit/index.js +181 -205
  669. package/src/navigation/edit/inner-blocks.js +6 -15
  670. package/src/navigation/index.php +40 -0
  671. package/src/navigation/style.scss +3 -0
  672. package/src/navigation/use-navigation-entities.js +1 -1
  673. package/src/navigation/view-modal.js +32 -0
  674. package/src/navigation-link/edit.js +75 -48
  675. package/src/navigation-link/fallback-variations.js +1 -1
  676. package/src/navigation-link/hooks.js +2 -2
  677. package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
  678. package/src/navigation-link/test/edit.js +0 -20
  679. package/src/navigation-submenu/edit.js +13 -17
  680. package/src/page-list/convert-to-links-modal.js +1 -1
  681. package/src/page-list/edit.js +1 -4
  682. package/src/paragraph/edit.js +6 -0
  683. package/src/paragraph/use-enter.js +103 -0
  684. package/src/post-author/edit.js +24 -22
  685. package/src/post-author/index.php +4 -3
  686. package/src/post-author-name/block.json +1 -0
  687. package/src/post-author-name/index.js +2 -0
  688. package/src/post-author-name/index.php +1 -1
  689. package/src/post-author-name/transforms.js +25 -0
  690. package/src/post-comment/block.json +2 -1
  691. package/src/post-comments/block.json +3 -2
  692. package/src/post-comments/edit.js +206 -44
  693. package/src/post-comments/editor.scss +3 -0
  694. package/src/post-comments/index.php +3 -1
  695. package/src/post-comments/style.scss +30 -5
  696. package/src/post-comments-count/block.json +1 -0
  697. package/src/post-comments-form/block.json +1 -0
  698. package/src/post-comments-form/edit.js +52 -23
  699. package/src/post-comments-form/editor.scss +3 -0
  700. package/src/post-comments-form/form.js +50 -0
  701. package/src/post-comments-form/index.php +10 -3
  702. package/src/post-comments-form/style.scss +1 -4
  703. package/src/post-comments-link/block.json +1 -0
  704. package/src/post-content/edit.js +15 -1
  705. package/src/post-date/edit.js +4 -3
  706. package/src/post-excerpt/edit.js +14 -1
  707. package/src/post-featured-image/edit.js +1 -1
  708. package/src/post-template/edit.js +5 -0
  709. package/src/post-template/index.php +30 -0
  710. package/src/post-terms/block.json +8 -0
  711. package/src/post-terms/edit.js +47 -1
  712. package/src/post-terms/hooks.js +27 -0
  713. package/src/post-terms/index.js +14 -7
  714. package/src/post-terms/index.php +50 -2
  715. package/src/post-title/index.js +1 -1
  716. package/src/pullquote/edit.js +2 -2
  717. package/src/pullquote/edit.native.js +2 -2
  718. package/src/query/block.json +2 -1
  719. package/src/query/edit/inspector-controls/index.js +25 -11
  720. package/src/query/edit/inspector-controls/parent-control.js +133 -0
  721. package/src/query/edit/inspector-controls/sticky-control.js +25 -0
  722. package/src/query/utils.js +22 -0
  723. package/src/query-no-results/edit.js +1 -1
  724. package/src/query-pagination/index.php +0 -1
  725. package/src/query-title/index.js +1 -1
  726. package/src/query-title/variations.js +2 -2
  727. package/src/quote/block.json +1 -0
  728. package/src/quote/edit.js +5 -2
  729. package/src/quote/v2/edit.js +4 -2
  730. package/src/search/block.json +4 -0
  731. package/src/search/edit.js +4 -1
  732. package/src/search/index.php +29 -16
  733. package/src/separator/block.json +3 -0
  734. package/src/separator/editor.scss +1 -0
  735. package/src/shortcode/edit.native.js +29 -15
  736. package/src/shortcode/style.native.scss +11 -4
  737. package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
  738. package/src/shortcode/test/edit.native.js +58 -40
  739. package/src/site-logo/edit.js +1 -1
  740. package/src/site-logo/style.scss +6 -0
  741. package/src/social-links/edit.js +11 -10
  742. package/src/table/edit.js +19 -4
  743. package/src/table-of-contents/block.json +9 -2
  744. package/src/table-of-contents/edit.js +170 -77
  745. package/src/table-of-contents/index.js +2 -0
  746. package/src/table-of-contents/list.tsx +46 -0
  747. package/src/table-of-contents/save.js +25 -0
  748. package/src/table-of-contents/utils.ts +71 -0
  749. package/src/tag-cloud/block.json +1 -1
  750. package/src/template-part/edit/index.js +25 -15
  751. package/src/template-part/edit/inner-blocks.js +2 -10
  752. package/src/video/edit.js +7 -6
  753. package/src/video/editor.scss +3 -6
  754. package/test/babel-plugin.js +67 -0
  755. package/tsconfig.json +11 -0
  756. package/tsconfig.tsbuildinfo +1 -0
  757. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
  758. package/build/comments-query-loop/edit.js.map +0 -1
  759. package/build/comments-query-loop/index.js.map +0 -1
  760. package/build/comments-query-loop/save.js.map +0 -1
  761. package/build/cover/edit.js +0 -665
  762. package/build/cover/edit.js.map +0 -1
  763. package/build/navigation-area/edit.js +0 -110
  764. package/build/navigation-area/edit.js.map +0 -1
  765. package/build/navigation-area/index.js +0 -62
  766. package/build/navigation-area/index.js.map +0 -1
  767. package/build/navigation-area/inner-blocks.js +0 -34
  768. package/build/navigation-area/inner-blocks.js.map +0 -1
  769. package/build/navigation-area/save.js +0 -18
  770. package/build/navigation-area/save.js.map +0 -1
  771. package/build/post-terms/variations.js +0 -37
  772. package/build/post-terms/variations.js.map +0 -1
  773. package/build-module/comments-query-loop/edit.js.map +0 -1
  774. package/build-module/comments-query-loop/index.js.map +0 -1
  775. package/build-module/comments-query-loop/save.js.map +0 -1
  776. package/build-module/cover/edit.js +0 -642
  777. package/build-module/cover/edit.js.map +0 -1
  778. package/build-module/navigation-area/edit.js +0 -94
  779. package/build-module/navigation-area/edit.js.map +0 -1
  780. package/build-module/navigation-area/index.js +0 -48
  781. package/build-module/navigation-area/index.js.map +0 -1
  782. package/build-module/navigation-area/inner-blocks.js +0 -26
  783. package/build-module/navigation-area/inner-blocks.js.map +0 -1
  784. package/build-module/navigation-area/save.js +0 -10
  785. package/build-module/navigation-area/save.js.map +0 -1
  786. package/build-module/post-terms/variations.js +0 -27
  787. package/build-module/post-terms/variations.js.map +0 -1
  788. package/src/cover/edit.js +0 -822
  789. package/src/navigation-area/block.json +0 -23
  790. package/src/navigation-area/edit.js +0 -111
  791. package/src/navigation-area/index.js +0 -26
  792. package/src/navigation-area/index.php +0 -22
  793. package/src/navigation-area/inner-blocks.js +0 -24
  794. package/src/navigation-area/save.js +0 -8
  795. package/src/post-terms/variations.js +0 -28
  796. package/src/table-of-contents/index.php +0 -346
  797. package/src/table-of-contents/list.js +0 -28
  798. package/src/table-of-contents/utils.js +0 -126
package/src/index.js CHANGED
@@ -12,6 +12,15 @@ import {
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
+ // When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks
16
+ // are transformed by packages/block-library/src/index.js as follows:
17
+ // import * as experimentalBlock from './experimental-block'
18
+ // becomes
19
+ // const experimentalBlock = null;
20
+ // This enables webpack to eliminate the experimental blocks code from the
21
+ // production build to make the final bundle smaller.
22
+ //
23
+ // See https://github.com/WordPress/gutenberg/pull/40655 for more context.
15
24
  import * as archives from './archives';
16
25
  import * as avatar from './avatar';
17
26
  import * as audio from './audio';
@@ -23,6 +32,7 @@ import * as classic from './freeform';
23
32
  import * as code from './code';
24
33
  import * as column from './column';
25
34
  import * as columns from './columns';
35
+ import * as comments from './comments';
26
36
  import * as commentAuthorAvatar from './comment-author-avatar';
27
37
  import * as commentAuthorName from './comment-author-name';
28
38
  import * as commentContent from './comment-content';
@@ -31,7 +41,6 @@ import * as commentEditLink from './comment-edit-link';
31
41
  import * as commentReplyLink from './comment-reply-link';
32
42
  import * as commentTemplate from './comment-template';
33
43
  import * as commentsPaginationPrevious from './comments-pagination-previous';
34
- import * as commentsQueryLoop from './comments-query-loop';
35
44
  import * as commentsPagination from './comments-pagination';
36
45
  import * as commentsPaginationNext from './comments-pagination-next';
37
46
  import * as commentsPaginationNumbers from './comments-pagination-numbers';
@@ -54,7 +63,6 @@ import * as mediaText from './media-text';
54
63
  import * as missing from './missing';
55
64
  import * as more from './more';
56
65
  import * as navigation from './navigation';
57
- import * as navigationArea from './navigation-area';
58
66
  import * as navigationLink from './navigation-link';
59
67
  import * as navigationSubmenu from './navigation-submenu';
60
68
  import * as nextpage from './nextpage';
@@ -100,6 +108,7 @@ import * as socialLink from './social-link';
100
108
  import * as socialLinks from './social-links';
101
109
  import * as spacer from './spacer';
102
110
  import * as table from './table';
111
+ import * as tableOfContents from './table-of-contents';
103
112
  import * as tagCloud from './tag-cloud';
104
113
  import * as templatePart from './template-part';
105
114
  import * as termDescription from './term-description';
@@ -107,6 +116,8 @@ import * as textColumns from './text-columns';
107
116
  import * as verse from './verse';
108
117
  import * as video from './video';
109
118
 
119
+ import isBlockMetadataExperimental from './is-block-metadata-experimental';
120
+
110
121
  /**
111
122
  * Function to register an individual block.
112
123
  *
@@ -122,16 +133,9 @@ const registerBlock = ( block ) => {
122
133
  };
123
134
 
124
135
  /**
125
- * Function to get all the core blocks in an array.
126
- *
127
- * @example
128
- * ```js
129
- * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';
130
- *
131
- * const coreBlocks = __experimentalGetCoreBlocks();
132
- * ```
136
+ * Function to get all the block-library blocks in an array
133
137
  */
134
- export const __experimentalGetCoreBlocks = () => [
138
+ const getAllBlocks = () => [
135
139
  // Common blocks are grouped at the top to prioritize their display
136
140
  // in various contexts — like the inserter and auto-complete components.
137
141
  paragraph,
@@ -139,6 +143,7 @@ export const __experimentalGetCoreBlocks = () => [
139
143
  heading,
140
144
  gallery,
141
145
  list,
146
+ listItem,
142
147
  quote,
143
148
 
144
149
  // Register all remaining core blocks.
@@ -152,6 +157,7 @@ export const __experimentalGetCoreBlocks = () => [
152
157
  code,
153
158
  column,
154
159
  columns,
160
+ commentAuthorAvatar,
155
161
  cover,
156
162
  embed,
157
163
  file,
@@ -176,7 +182,6 @@ export const __experimentalGetCoreBlocks = () => [
176
182
  socialLinks,
177
183
  spacer,
178
184
  table,
179
- // tableOfContents,
180
185
  tagCloud,
181
186
  textColumns,
182
187
  verse,
@@ -197,6 +202,10 @@ export const __experimentalGetCoreBlocks = () => [
197
202
  postFeaturedImage,
198
203
  postContent,
199
204
  postAuthor,
205
+ postAuthorName,
206
+ postComment,
207
+ postCommentsCount,
208
+ postCommentsLink,
200
209
  postDate,
201
210
  postTerms,
202
211
  postNavigationLink,
@@ -207,6 +216,7 @@ export const __experimentalGetCoreBlocks = () => [
207
216
  queryPaginationPrevious,
208
217
  queryNoResults,
209
218
  readMore,
219
+ comments,
210
220
  commentAuthorName,
211
221
  commentContent,
212
222
  commentDate,
@@ -214,13 +224,13 @@ export const __experimentalGetCoreBlocks = () => [
214
224
  commentReplyLink,
215
225
  commentTemplate,
216
226
  commentsTitle,
217
- commentsQueryLoop,
218
227
  commentsPagination,
219
228
  commentsPaginationNext,
220
229
  commentsPaginationNumbers,
221
230
  commentsPaginationPrevious,
222
-
223
231
  postComments,
232
+ postCommentsForm,
233
+ tableOfContents,
224
234
  homeLink,
225
235
  logInOut,
226
236
  termDescription,
@@ -228,6 +238,21 @@ export const __experimentalGetCoreBlocks = () => [
228
238
  postAuthorBiography,
229
239
  ];
230
240
 
241
+ /**
242
+ * Function to get all the core blocks in an array.
243
+ *
244
+ * @example
245
+ * ```js
246
+ * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';
247
+ *
248
+ * const coreBlocks = __experimentalGetCoreBlocks();
249
+ * ```
250
+ */
251
+ export const __experimentalGetCoreBlocks = () =>
252
+ getAllBlocks().filter(
253
+ ( { metadata } ) => ! isBlockMetadataExperimental( metadata )
254
+ );
255
+
231
256
  /**
232
257
  * Function to register core blocks provided by the block editor.
233
258
  *
@@ -267,24 +292,19 @@ export const registerCoreBlocks = (
267
292
  export const __experimentalRegisterExperimentalCoreBlocks = process.env
268
293
  .IS_GUTENBERG_PLUGIN
269
294
  ? ( { enableFSEBlocks } = {} ) => {
270
- [
271
- // Experimental blocks.
272
- postAuthorName,
273
- ...( window.__experimentalEnableListBlockV2
274
- ? [ listItem ]
275
- : [] ),
276
-
277
- // Full Site Editing blocks.
278
- ...( enableFSEBlocks
279
- ? [
280
- commentAuthorAvatar,
281
- navigationArea,
282
- postComment,
283
- postCommentsCount,
284
- postCommentsForm,
285
- postCommentsLink,
286
- ]
287
- : [] ),
288
- ].forEach( registerBlock );
295
+ const enabledExperiments = [
296
+ window.__experimentalEnableListBlockV2 ? 'list-v2' : null,
297
+ enableFSEBlocks ? 'fse' : null,
298
+ ];
299
+ getAllBlocks()
300
+ .filter( ( { metadata } ) =>
301
+ isBlockMetadataExperimental( metadata )
302
+ )
303
+ .filter(
304
+ ( { metadata: { __experimental } } ) =>
305
+ __experimental === true ||
306
+ enabledExperiments.includes( __experimental )
307
+ )
308
+ .forEach( registerBlock );
289
309
  }
290
310
  : undefined;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Checks if the block is experimental based on the metadata loaded
3
+ * from block.json.
4
+ *
5
+ * This function is in a separate file and uses the older JS syntax so
6
+ * that it can be imported in both:
7
+ * – block-library/src/index.js
8
+ * – block-library/src/babel-plugin.js
9
+ *
10
+ * @param {Object} metadata Parsed block.json metadata.
11
+ * @return {boolean} Is the block experimental?
12
+ */
13
+ module.exports = function isBlockMetadataExperimental( metadata ) {
14
+ return (
15
+ metadata &&
16
+ '__experimental' in metadata &&
17
+ metadata.__experimental !== false
18
+ );
19
+ };
@@ -28,9 +28,11 @@ import {
28
28
  useBlockProps,
29
29
  store as blockEditorStore,
30
30
  } from '@wordpress/block-editor';
31
- import { useSelect } from '@wordpress/data';
31
+ import { useSelect, useDispatch } from '@wordpress/data';
32
32
  import { pin, list, grid } from '@wordpress/icons';
33
33
  import { store as coreStore } from '@wordpress/core-data';
34
+ import { store as noticeStore } from '@wordpress/notices';
35
+ import { useInstanceId } from '@wordpress/compose';
34
36
 
35
37
  /**
36
38
  * Internal dependencies
@@ -66,6 +68,7 @@ function getFeaturedImageDetails( post, size ) {
66
68
  }
67
69
 
68
70
  export default function LatestPostsEdit( { attributes, setAttributes } ) {
71
+ const instanceId = useInstanceId( LatestPostsEdit );
69
72
  const {
70
73
  postsToShow,
71
74
  order,
@@ -148,6 +151,20 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
148
151
  ]
149
152
  );
150
153
 
154
+ // If a user clicks to a link prevent redirection and show a warning.
155
+ const { createWarningNotice, removeNotice } = useDispatch( noticeStore );
156
+ let noticeId;
157
+ const showRedirectionPreventedNotice = ( event ) => {
158
+ event.preventDefault();
159
+ // Remove previous warning if any, to show one at a time per block.
160
+ removeNotice( noticeId );
161
+ noticeId = `block-library/core/latest-posts/redirection-prevented/${ instanceId }`;
162
+ createWarningNotice( __( 'Links are disabled in the editor.' ), {
163
+ id: noticeId,
164
+ type: 'snackbar',
165
+ } );
166
+ };
167
+
151
168
  const imageSizeOptions = imageSizes
152
169
  .filter( ( { slug } ) => slug !== 'full' )
153
170
  .map( ( { name, slug } ) => ( {
@@ -466,7 +483,11 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
466
483
  .join( ' ' ) }
467
484
  { /* translators: excerpt truncation character, default … */ }
468
485
  { __( ' … ' ) }
469
- <a href={ post.link } rel="noopener noreferrer">
486
+ <a
487
+ href={ post.link }
488
+ rel="noopener noreferrer"
489
+ onClick={ showRedirectionPreventedNotice }
490
+ >
470
491
  { __( 'Read more' ) }
471
492
  </a>
472
493
  </>
@@ -483,6 +504,9 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
483
504
  className="wp-block-latest-posts__post-title"
484
505
  href={ post.link }
485
506
  rel="noreferrer noopener"
507
+ onClick={
508
+ showRedirectionPreventedNotice
509
+ }
486
510
  >
487
511
  { featuredImage }
488
512
  </a>
@@ -501,6 +525,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
501
525
  }
502
526
  : undefined
503
527
  }
528
+ onClick={ showRedirectionPreventedNotice }
504
529
  >
505
530
  { ! titleTrimmed ? __( '(no title)' ) : null }
506
531
  </a>
@@ -12,7 +12,10 @@ import { compose, withPreferredColorScheme } from '@wordpress/compose';
12
12
  import { withDispatch, withSelect } from '@wordpress/data';
13
13
  import { __ } from '@wordpress/i18n';
14
14
  import { postList as icon } from '@wordpress/icons';
15
- import { InspectorControls } from '@wordpress/block-editor';
15
+ import {
16
+ InspectorControls,
17
+ BlockAlignmentControl,
18
+ } from '@wordpress/block-editor';
16
19
  import apiFetch from '@wordpress/api-fetch';
17
20
  import {
18
21
  Icon,
@@ -43,6 +46,15 @@ class LatestPostsEdit extends Component {
43
46
  );
44
47
  this.onSetExcerptLength = this.onSetExcerptLength.bind( this );
45
48
  this.onSetDisplayPostDate = this.onSetDisplayPostDate.bind( this );
49
+ this.onSetDisplayFeaturedImage = this.onSetDisplayFeaturedImage.bind(
50
+ this
51
+ );
52
+ this.onSetFeaturedImageAlign = this.onSetFeaturedImageAlign.bind(
53
+ this
54
+ );
55
+ this.onSetAddLinkToFeaturedImage = this.onSetAddLinkToFeaturedImage.bind(
56
+ this
57
+ );
46
58
  this.onSetOrder = this.onSetOrder.bind( this );
47
59
  this.onSetOrderBy = this.onSetOrderBy.bind( this );
48
60
  this.onSetPostsToShow = this.onSetPostsToShow.bind( this );
@@ -95,6 +107,21 @@ class LatestPostsEdit extends Component {
95
107
  setAttributes( { displayPostDate: value } );
96
108
  }
97
109
 
110
+ onSetDisplayFeaturedImage( value ) {
111
+ const { setAttributes } = this.props;
112
+ setAttributes( { displayFeaturedImage: value } );
113
+ }
114
+
115
+ onSetAddLinkToFeaturedImage( value ) {
116
+ const { setAttributes } = this.props;
117
+ setAttributes( { addLinkToFeaturedImage: value } );
118
+ }
119
+
120
+ onSetFeaturedImageAlign( value ) {
121
+ const { setAttributes } = this.props;
122
+ setAttributes( { featuredImageAlign: value } );
123
+ }
124
+
98
125
  onSetOrder( value ) {
99
126
  const { setAttributes } = this.props;
100
127
  setAttributes( { order: value } );
@@ -124,6 +151,9 @@ class LatestPostsEdit extends Component {
124
151
  displayPostContentRadio,
125
152
  excerptLength,
126
153
  displayPostDate,
154
+ displayFeaturedImage,
155
+ featuredImageAlign,
156
+ addLinkToFeaturedImage,
127
157
  order,
128
158
  orderBy,
129
159
  postsToShow,
@@ -166,6 +196,31 @@ class LatestPostsEdit extends Component {
166
196
  onChange={ this.onSetDisplayPostDate }
167
197
  />
168
198
  </PanelBody>
199
+
200
+ <PanelBody title={ __( 'Featured image settings' ) }>
201
+ <ToggleControl
202
+ label={ __( 'Display featured image' ) }
203
+ checked={ displayFeaturedImage }
204
+ onChange={ this.onSetDisplayFeaturedImage }
205
+ />
206
+ { displayFeaturedImage && (
207
+ <>
208
+ <BlockAlignmentControl
209
+ value={ featuredImageAlign }
210
+ onChange={ this.onSetFeaturedImageAlign }
211
+ controls={ [ 'left', 'center', 'right' ] }
212
+ isBottomSheetControl={ true }
213
+ />
214
+ <ToggleControl
215
+ label={ __( 'Add link to featured image' ) }
216
+ checked={ addLinkToFeaturedImage }
217
+ onChange={ this.onSetAddLinkToFeaturedImage }
218
+ separatorType={ 'topFullWidth' }
219
+ />
220
+ </>
221
+ ) }
222
+ </PanelBody>
223
+
169
224
  <PanelBody title={ __( 'Sorting and filtering' ) }>
170
225
  <QueryControls
171
226
  { ...{ order, orderBy } }
@@ -37,11 +37,12 @@ function render_block_core_latest_posts( $attributes ) {
37
37
  global $post, $block_core_latest_posts_excerpt_length;
38
38
 
39
39
  $args = array(
40
- 'posts_per_page' => $attributes['postsToShow'],
41
- 'post_status' => 'publish',
42
- 'order' => $attributes['order'],
43
- 'orderby' => $attributes['orderBy'],
44
- 'suppress_filters' => false,
40
+ 'posts_per_page' => $attributes['postsToShow'],
41
+ 'post_status' => 'publish',
42
+ 'order' => $attributes['order'],
43
+ 'orderby' => $attributes['orderBy'],
44
+ 'ignore_sticky_posts' => true,
45
+ 'no_found_rows' => true,
45
46
  );
46
47
 
47
48
  $block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
@@ -54,7 +55,12 @@ function render_block_core_latest_posts( $attributes ) {
54
55
  $args['author'] = $attributes['selectedAuthor'];
55
56
  }
56
57
 
57
- $recent_posts = get_posts( $args );
58
+ $query = new WP_Query;
59
+ $recent_posts = $query->query( $args );
60
+
61
+ if ( isset( $attributes['displayFeaturedImage'] ) && $attributes['displayFeaturedImage'] ) {
62
+ update_post_thumbnail_cache( $query );
63
+ }
58
64
 
59
65
  $list_items_markup = '';
60
66
 
@@ -63,10 +63,14 @@
63
63
  &.alignleft {
64
64
  /*rtl:ignore*/
65
65
  margin-right: 1em;
66
+ /*rtl:ignore*/
67
+ float: left;
66
68
  }
67
69
  &.alignright {
68
70
  /*rtl:ignore*/
69
71
  margin-left: 1em;
72
+ /*rtl:ignore*/
73
+ float: right;
70
74
  }
71
75
  &.aligncenter {
72
76
  margin-bottom: 1em;
@@ -208,6 +208,13 @@ const transforms = {
208
208
  } );
209
209
  },
210
210
  },
211
+ {
212
+ type: 'block',
213
+ blocks: [ 'core/table-of-contents' ],
214
+ transform: () => {
215
+ return createBlock( 'core/table-of-contents' );
216
+ },
217
+ },
211
218
  ],
212
219
  };
213
220
 
@@ -134,6 +134,7 @@ function Edit( { attributes, setAttributes, clientId } ) {
134
134
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
135
135
  allowedBlocks: [ 'core/list-item' ],
136
136
  template: TEMPLATE,
137
+ templateInsertUpdatesSelection: true,
137
138
  } );
138
139
  useMigrateOnLoad( attributes, clientId );
139
140
  const { ordered, reversed, start } = attributes;
@@ -8,7 +8,7 @@ import { omit } from 'lodash';
8
8
  */
9
9
  import { createBlock } from '@wordpress/blocks';
10
10
 
11
- function createListBlockFromDOMElement( listElement ) {
11
+ export function createListBlockFromDOMElement( listElement ) {
12
12
  const listAttributes = {
13
13
  ordered: 'OL' === listElement.tagName,
14
14
  start: listElement.getAttribute( 'start' )
@@ -9,6 +9,32 @@ import {
9
9
  toHTMLString,
10
10
  } from '@wordpress/rich-text';
11
11
 
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { createListBlockFromDOMElement } from './migrate';
16
+
17
+ function getListContentSchema( { phrasingContentSchema } ) {
18
+ const listContentSchema = {
19
+ ...phrasingContentSchema,
20
+ ul: {},
21
+ ol: { attributes: [ 'type', 'start', 'reversed' ] },
22
+ };
23
+
24
+ // Recursion is needed.
25
+ // Possible: ul > li > ul.
26
+ // Impossible: ul > ul.
27
+ [ 'ul', 'ol' ].forEach( ( tag ) => {
28
+ listContentSchema[ tag ].children = {
29
+ li: {
30
+ children: listContentSchema,
31
+ },
32
+ };
33
+ } );
34
+
35
+ return listContentSchema;
36
+ }
37
+
12
38
  const transforms = {
13
39
  from: [
14
40
  {
@@ -82,6 +108,15 @@ const transforms = {
82
108
  );
83
109
  },
84
110
  } ) ),
111
+ {
112
+ type: 'raw',
113
+ selector: 'ol,ul',
114
+ schema: ( args ) => ( {
115
+ ol: getListContentSchema( args ).ol,
116
+ ul: getListContentSchema( args ).ul,
117
+ } ),
118
+ transform: createListBlockFromDOMElement,
119
+ },
85
120
  ],
86
121
  to: [
87
122
  ...[ 'core/paragraph', 'core/heading' ].map( ( block ) => ( {
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
+ "__experimental": "list-v2",
4
5
  "name": "core/list-item",
5
6
  "title": "List item",
6
7
  "category": "text",
@@ -14,7 +15,7 @@
14
15
  "content": {
15
16
  "type": "string",
16
17
  "source": "html",
17
- "selector": "li",
18
+ "selector": "li",
18
19
  "default": "",
19
20
  "__experimentalRole": "content"
20
21
  }
@@ -8,7 +8,6 @@ import {
8
8
  BlockControls,
9
9
  } from '@wordpress/block-editor';
10
10
  import { isRTL, __ } from '@wordpress/i18n';
11
- import { createBlock } from '@wordpress/blocks';
12
11
  import { ToolbarButton } from '@wordpress/components';
13
12
  import {
14
13
  formatOutdent,
@@ -21,7 +20,14 @@ import { useMergeRefs } from '@wordpress/compose';
21
20
  /**
22
21
  * Internal dependencies
23
22
  */
24
- import { useEnter, useIndentListItem, useOutdentListItem } from './hooks';
23
+ import {
24
+ useEnter,
25
+ useBackspace,
26
+ useSpace,
27
+ useIndentListItem,
28
+ useOutdentListItem,
29
+ useSplit,
30
+ } from './hooks';
25
31
 
26
32
  function IndentUI( { clientId } ) {
27
33
  const [ canIndent, indentListItem ] = useIndentListItem( clientId );
@@ -48,7 +54,6 @@ function IndentUI( { clientId } ) {
48
54
  }
49
55
 
50
56
  export default function ListItemEdit( {
51
- name,
52
57
  attributes,
53
58
  setAttributes,
54
59
  mergeBlocks,
@@ -61,11 +66,18 @@ export default function ListItemEdit( {
61
66
  allowedBlocks: [ 'core/list' ],
62
67
  } );
63
68
  const useEnterRef = useEnter( { content, clientId } );
69
+ const useBackspaceRef = useBackspace( { clientId } );
70
+ const useSpaceRef = useSpace( clientId );
71
+ const onSplit = useSplit( clientId );
64
72
  return (
65
73
  <>
66
74
  <li { ...innerBlocksProps }>
67
75
  <RichText
68
- ref={ useMergeRefs( [ useEnterRef ] ) }
76
+ ref={ useMergeRefs( [
77
+ useEnterRef,
78
+ useBackspaceRef,
79
+ useSpaceRef,
80
+ ] ) }
69
81
  identifier="content"
70
82
  tagName="div"
71
83
  onChange={ ( nextContent ) =>
@@ -74,12 +86,7 @@ export default function ListItemEdit( {
74
86
  value={ content }
75
87
  aria-label={ __( 'List text' ) }
76
88
  placeholder={ placeholder || __( 'List' ) }
77
- onSplit={ ( value ) => {
78
- return createBlock( name, {
79
- ...attributes,
80
- content: value,
81
- } );
82
- } }
89
+ onSplit={ onSplit }
83
90
  onMerge={ mergeBlocks }
84
91
  onReplace={ onReplace }
85
92
  />
@@ -1,3 +1,6 @@
1
1
  export { default as useOutdentListItem } from './use-outdent-list-item';
2
2
  export { default as useIndentListItem } from './use-indent-list-item';
3
3
  export { default as useEnter } from './use-enter';
4
+ export { default as useBackspace } from './use-backspace';
5
+ export { default as useSpace } from './use-space';
6
+ export { default as useSplit } from './use-split';
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useRef } from '@wordpress/element';
5
+ import { useRefEffect } from '@wordpress/compose';
6
+ import { BACKSPACE } from '@wordpress/keycodes';
7
+ import { useSelect } from '@wordpress/data';
8
+ import { store as blockEditorStore } from '@wordpress/block-editor';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import useOutdentListItem from './use-outdent-list-item';
14
+
15
+ export default function useBackspace( props ) {
16
+ const { getSelectionStart, getSelectionEnd } = useSelect(
17
+ blockEditorStore
18
+ );
19
+ const propsRef = useRef( props );
20
+ propsRef.current = props;
21
+ const [ canOutdent, outdentListItem ] = useOutdentListItem(
22
+ propsRef.current.clientId
23
+ );
24
+ return useRefEffect(
25
+ ( element ) => {
26
+ function onKeyDown( event ) {
27
+ if ( event.defaultPrevented || event.keyCode !== BACKSPACE ) {
28
+ return;
29
+ }
30
+ // Handle only if we have a collapsed selection at the
31
+ // start of a list item and we can outdent.
32
+ if (
33
+ ! canOutdent ||
34
+ [
35
+ getSelectionStart().offset,
36
+ getSelectionEnd().offset,
37
+ ].some( ( offset ) => offset !== 0 )
38
+ ) {
39
+ return;
40
+ }
41
+ event.preventDefault();
42
+ outdentListItem();
43
+ }
44
+
45
+ element.addEventListener( 'keydown', onKeyDown );
46
+ return () => {
47
+ element.removeEventListener( 'keydown', onKeyDown );
48
+ };
49
+ },
50
+ [ canOutdent ]
51
+ );
52
+ }