@wordpress/block-library 7.5.0 → 7.6.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 (527) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +3 -2
  3. package/babel-plugin.js +154 -0
  4. package/build/audio/edit.js +1 -1
  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/index.js +1 -0
  9. package/build/button/index.js.map +1 -1
  10. package/build/categories/edit.js +1 -1
  11. package/build/categories/edit.js.map +1 -1
  12. package/build/categories/index.js +1 -1
  13. package/build/comment-author-avatar/index.js +1 -0
  14. package/build/comment-author-avatar/index.js.map +1 -1
  15. package/build/comments-title/deprecated.js +110 -0
  16. package/build/comments-title/deprecated.js.map +1 -0
  17. package/build/comments-title/edit.js +35 -37
  18. package/build/comments-title/edit.js.map +1 -1
  19. package/build/comments-title/index.js +5 -8
  20. package/build/comments-title/index.js.map +1 -1
  21. package/build/cover/controls.native.js +2 -3
  22. package/build/cover/controls.native.js.map +1 -1
  23. package/build/cover/edit/block-controls.js +115 -0
  24. package/build/cover/edit/block-controls.js.map +1 -0
  25. package/build/cover/edit/cover-placeholder.js +49 -0
  26. package/build/cover/edit/cover-placeholder.js.map +1 -0
  27. package/build/cover/edit/index.js +333 -0
  28. package/build/cover/edit/index.js.map +1 -0
  29. package/build/cover/edit/inspector-controls.js +224 -0
  30. package/build/cover/edit/inspector-controls.js.map +1 -0
  31. package/build/cover/edit/resizable-cover.js +67 -0
  32. package/build/cover/edit/resizable-cover.js.map +1 -0
  33. package/build/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
  34. package/build/cover/edit/use-cover-is-dark.js.map +1 -0
  35. package/build/cover/edit.native.js +0 -1
  36. package/build/cover/edit.native.js.map +1 -1
  37. package/build/cover/focal-point-settings-button.native.js.map +1 -1
  38. package/build/cover/shared.js +9 -0
  39. package/build/cover/shared.js.map +1 -1
  40. package/build/embed/embed-preview.js +1 -1
  41. package/build/embed/embed-preview.js.map +1 -1
  42. package/build/file/edit.native.js +0 -1
  43. package/build/file/edit.native.js.map +1 -1
  44. package/build/gallery/edit.js +2 -1
  45. package/build/gallery/edit.js.map +1 -1
  46. package/build/gallery/gallery.js +1 -1
  47. package/build/gallery/gallery.js.map +1 -1
  48. package/build/gallery/shared.js +2 -2
  49. package/build/gallery/shared.js.map +1 -1
  50. package/build/gallery/use-get-media.js +2 -1
  51. package/build/gallery/use-get-media.js.map +1 -1
  52. package/build/gallery/use-short-code-transform.js +19 -18
  53. package/build/gallery/use-short-code-transform.js.map +1 -1
  54. package/build/gallery/v1/gallery.js +1 -1
  55. package/build/gallery/v1/gallery.js.map +1 -1
  56. package/build/heading/edit.js +6 -2
  57. package/build/heading/edit.js.map +1 -1
  58. package/build/heading/index.js +1 -0
  59. package/build/heading/index.js.map +1 -1
  60. package/build/heading/transforms.js +1 -0
  61. package/build/heading/transforms.js.map +1 -1
  62. package/build/image/edit.js +5 -2
  63. package/build/image/edit.js.map +1 -1
  64. package/build/image/edit.native.js +0 -1
  65. package/build/image/edit.native.js.map +1 -1
  66. package/build/image/image.js +1 -1
  67. package/build/image/image.js.map +1 -1
  68. package/build/index.js +46 -10
  69. package/build/index.js.map +1 -1
  70. package/build/is-block-metadata-experimental.js +18 -0
  71. package/build/is-block-metadata-experimental.js.map +1 -0
  72. package/build/latest-posts/edit.js +30 -4
  73. package/build/latest-posts/edit.js.map +1 -1
  74. package/build/list/transforms.js +6 -0
  75. package/build/list/transforms.js.map +1 -1
  76. package/build/list/v2/edit.js +2 -1
  77. package/build/list/v2/edit.js.map +1 -1
  78. package/build/list/v2/migrate.js +1 -0
  79. package/build/list/v2/migrate.js.map +1 -1
  80. package/build/list/v2/transforms.js +46 -9
  81. package/build/list/v2/transforms.js.map +1 -1
  82. package/build/list-item/edit.js +7 -9
  83. package/build/list-item/edit.js.map +1 -1
  84. package/build/list-item/hooks/index.js +24 -0
  85. package/build/list-item/hooks/index.js.map +1 -1
  86. package/build/list-item/hooks/use-backspace.js +59 -0
  87. package/build/list-item/hooks/use-backspace.js.map +1 -0
  88. package/build/list-item/hooks/use-enter.js +6 -9
  89. package/build/list-item/hooks/use-enter.js.map +1 -1
  90. package/build/list-item/hooks/use-indent-list-item.js +33 -39
  91. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  92. package/build/list-item/hooks/use-space.js +54 -0
  93. package/build/list-item/hooks/use-space.js.map +1 -0
  94. package/build/list-item/hooks/use-split.js +30 -0
  95. package/build/list-item/hooks/use-split.js.map +1 -0
  96. package/build/list-item/index.js +1 -0
  97. package/build/list-item/index.js.map +1 -1
  98. package/build/list-item/utils.js +1 -1
  99. package/build/list-item/utils.js.map +1 -1
  100. package/build/media-text/edit.native.js +2 -1
  101. package/build/media-text/edit.native.js.map +1 -1
  102. package/build/media-text/media-container.native.js +2 -4
  103. package/build/media-text/media-container.native.js.map +1 -1
  104. package/build/media-text/transforms.js +137 -8
  105. package/build/media-text/transforms.js.map +1 -1
  106. package/build/navigation/edit/index.js +86 -81
  107. package/build/navigation/edit/index.js.map +1 -1
  108. package/build/navigation/edit/inner-blocks.js +1 -5
  109. package/build/navigation/edit/inner-blocks.js.map +1 -1
  110. package/build/navigation/use-navigation-entities.js +3 -3
  111. package/build/navigation/use-navigation-entities.js.map +1 -1
  112. package/build/navigation-link/fallback-variations.js +1 -1
  113. package/build/navigation-link/fallback-variations.js.map +1 -1
  114. package/build/navigation-link/hooks.js +1 -1
  115. package/build/navigation-link/hooks.js.map +1 -1
  116. package/build/page-list/convert-to-links-modal.js +1 -1
  117. package/build/page-list/convert-to-links-modal.js.map +1 -1
  118. package/build/page-list/edit.js +1 -1
  119. package/build/page-list/edit.js.map +1 -1
  120. package/build/post-author/edit.js +1 -1
  121. package/build/post-author/edit.js.map +1 -1
  122. package/build/post-author-name/index.js +1 -0
  123. package/build/post-author-name/index.js.map +1 -1
  124. package/build/post-comment/index.js +1 -0
  125. package/build/post-comment/index.js.map +1 -1
  126. package/build/post-comments/edit.js +34 -16
  127. package/build/post-comments/edit.js.map +1 -1
  128. package/build/post-comments-count/index.js +1 -0
  129. package/build/post-comments-count/index.js.map +1 -1
  130. package/build/post-comments-form/form.js +1 -1
  131. package/build/post-comments-form/form.js.map +1 -1
  132. package/build/post-comments-link/index.js +1 -0
  133. package/build/post-comments-link/index.js.map +1 -1
  134. package/build/post-featured-image/edit.js +1 -1
  135. package/build/post-featured-image/edit.js.map +1 -1
  136. package/build/post-template/edit.js +7 -2
  137. package/build/post-template/edit.js.map +1 -1
  138. package/build/post-terms/edit.js +11 -2
  139. package/build/post-terms/edit.js.map +1 -1
  140. package/build/post-terms/hooks.js +33 -0
  141. package/build/post-terms/hooks.js.map +1 -0
  142. package/build/post-terms/index.js +12 -5
  143. package/build/post-terms/index.js.map +1 -1
  144. package/build/post-title/index.js +1 -1
  145. package/build/post-title/index.js.map +1 -1
  146. package/build/pullquote/edit.js +1 -1
  147. package/build/pullquote/edit.js.map +1 -1
  148. package/build/pullquote/edit.native.js +1 -1
  149. package/build/pullquote/edit.native.js.map +1 -1
  150. package/build/query/edit/inspector-controls/index.js +26 -17
  151. package/build/query/edit/inspector-controls/index.js.map +1 -1
  152. package/build/query/edit/inspector-controls/parent-control.js +148 -0
  153. package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
  154. package/build/query/edit/inspector-controls/sticky-control.js +41 -0
  155. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
  156. package/build/query/index.js +2 -1
  157. package/build/query/index.js.map +1 -1
  158. package/build/query/utils.js +28 -2
  159. package/build/query/utils.js.map +1 -1
  160. package/build/query-title/index.js +1 -1
  161. package/build/query-title/index.js.map +1 -1
  162. package/build/query-title/variations.js +1 -1
  163. package/build/query-title/variations.js.map +1 -1
  164. package/build/quote/edit.js +3 -2
  165. package/build/quote/edit.js.map +1 -1
  166. package/build/quote/v2/edit.js +1 -1
  167. package/build/quote/v2/edit.js.map +1 -1
  168. package/build/search/edit.js +1 -0
  169. package/build/search/edit.js.map +1 -1
  170. package/build/site-logo/edit.js +1 -1
  171. package/build/site-logo/edit.js.map +1 -1
  172. package/build/table/edit.js +15 -2
  173. package/build/table/edit.js.map +1 -1
  174. package/build/table-of-contents/edit.js +138 -66
  175. package/build/table-of-contents/edit.js.map +1 -1
  176. package/build/table-of-contents/index.js +13 -3
  177. package/build/table-of-contents/index.js.map +1 -1
  178. package/build/table-of-contents/list.js +16 -9
  179. package/build/table-of-contents/list.js.map +1 -1
  180. package/build/table-of-contents/save.js +40 -0
  181. package/build/table-of-contents/save.js.map +1 -0
  182. package/build/table-of-contents/utils.js +11 -77
  183. package/build/table-of-contents/utils.js.map +1 -1
  184. package/build/template-part/edit/index.js +7 -3
  185. package/build/template-part/edit/index.js.map +1 -1
  186. package/build/template-part/edit/inner-blocks.js +3 -8
  187. package/build/template-part/edit/inner-blocks.js.map +1 -1
  188. package/build/video/edit.js +1 -1
  189. package/build/video/edit.js.map +1 -1
  190. package/build-module/audio/edit.js +2 -2
  191. package/build-module/audio/edit.js.map +1 -1
  192. package/build-module/block/edit.js +11 -10
  193. package/build-module/block/edit.js.map +1 -1
  194. package/build-module/button/index.js +1 -0
  195. package/build-module/button/index.js.map +1 -1
  196. package/build-module/categories/edit.js +1 -1
  197. package/build-module/categories/edit.js.map +1 -1
  198. package/build-module/categories/index.js +1 -1
  199. package/build-module/comment-author-avatar/index.js +1 -0
  200. package/build-module/comment-author-avatar/index.js.map +1 -1
  201. package/build-module/comments-title/deprecated.js +102 -0
  202. package/build-module/comments-title/deprecated.js.map +1 -0
  203. package/build-module/comments-title/edit.js +38 -40
  204. package/build-module/comments-title/edit.js.map +1 -1
  205. package/build-module/comments-title/index.js +4 -8
  206. package/build-module/comments-title/index.js.map +1 -1
  207. package/build-module/cover/controls.native.js +2 -3
  208. package/build-module/cover/controls.native.js.map +1 -1
  209. package/build-module/cover/edit/block-controls.js +104 -0
  210. package/build-module/cover/edit/block-controls.js.map +1 -0
  211. package/build-module/cover/edit/cover-placeholder.js +38 -0
  212. package/build-module/cover/edit/cover-placeholder.js.map +1 -0
  213. package/build-module/cover/edit/index.js +307 -0
  214. package/build-module/cover/edit/index.js.map +1 -0
  215. package/build-module/cover/edit/inspector-controls.js +215 -0
  216. package/build-module/cover/edit/inspector-controls.js.map +1 -0
  217. package/build-module/cover/edit/resizable-cover.js +55 -0
  218. package/build-module/cover/edit/resizable-cover.js.map +1 -0
  219. package/build-module/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
  220. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
  221. package/build-module/cover/edit.native.js +0 -1
  222. package/build-module/cover/edit.native.js.map +1 -1
  223. package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
  224. package/build-module/cover/shared.js +7 -0
  225. package/build-module/cover/shared.js.map +1 -1
  226. package/build-module/embed/embed-preview.js +2 -2
  227. package/build-module/embed/embed-preview.js.map +1 -1
  228. package/build-module/file/edit.native.js +0 -1
  229. package/build-module/file/edit.native.js.map +1 -1
  230. package/build-module/gallery/edit.js +2 -1
  231. package/build-module/gallery/edit.js.map +1 -1
  232. package/build-module/gallery/gallery.js +2 -2
  233. package/build-module/gallery/gallery.js.map +1 -1
  234. package/build-module/gallery/shared.js +2 -2
  235. package/build-module/gallery/shared.js.map +1 -1
  236. package/build-module/gallery/use-get-media.js +2 -1
  237. package/build-module/gallery/use-get-media.js.map +1 -1
  238. package/build-module/gallery/use-short-code-transform.js +19 -18
  239. package/build-module/gallery/use-short-code-transform.js.map +1 -1
  240. package/build-module/gallery/v1/gallery.js +2 -2
  241. package/build-module/gallery/v1/gallery.js.map +1 -1
  242. package/build-module/heading/edit.js +6 -2
  243. package/build-module/heading/edit.js.map +1 -1
  244. package/build-module/heading/index.js +1 -0
  245. package/build-module/heading/index.js.map +1 -1
  246. package/build-module/heading/transforms.js +1 -0
  247. package/build-module/heading/transforms.js.map +1 -1
  248. package/build-module/image/edit.js +6 -3
  249. package/build-module/image/edit.js.map +1 -1
  250. package/build-module/image/edit.native.js +0 -1
  251. package/build-module/image/edit.native.js.map +1 -1
  252. package/build-module/image/image.js +2 -2
  253. package/build-module/image/image.js.map +1 -1
  254. package/build-module/index.js +42 -10
  255. package/build-module/index.js.map +1 -1
  256. package/build-module/is-block-metadata-experimental.js +16 -0
  257. package/build-module/is-block-metadata-experimental.js.map +1 -0
  258. package/build-module/latest-posts/edit.js +29 -5
  259. package/build-module/latest-posts/edit.js.map +1 -1
  260. package/build-module/list/transforms.js +6 -0
  261. package/build-module/list/transforms.js.map +1 -1
  262. package/build-module/list/v2/edit.js +2 -1
  263. package/build-module/list/v2/edit.js.map +1 -1
  264. package/build-module/list/v2/migrate.js +1 -3
  265. package/build-module/list/v2/migrate.js.map +1 -1
  266. package/build-module/list/v2/transforms.js +46 -9
  267. package/build-module/list/v2/transforms.js.map +1 -1
  268. package/build-module/list-item/edit.js +8 -9
  269. package/build-module/list-item/edit.js.map +1 -1
  270. package/build-module/list-item/hooks/index.js +3 -0
  271. package/build-module/list-item/hooks/index.js.map +1 -1
  272. package/build-module/list-item/hooks/use-backspace.js +44 -0
  273. package/build-module/list-item/hooks/use-backspace.js.map +1 -0
  274. package/build-module/list-item/hooks/use-enter.js +6 -9
  275. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  276. package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
  277. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  278. package/build-module/list-item/hooks/use-space.js +40 -0
  279. package/build-module/list-item/hooks/use-space.js.map +1 -0
  280. package/build-module/list-item/hooks/use-split.js +19 -0
  281. package/build-module/list-item/hooks/use-split.js.map +1 -0
  282. package/build-module/list-item/index.js +1 -0
  283. package/build-module/list-item/index.js.map +1 -1
  284. package/build-module/list-item/utils.js +1 -1
  285. package/build-module/list-item/utils.js.map +1 -1
  286. package/build-module/media-text/edit.native.js +2 -1
  287. package/build-module/media-text/edit.native.js.map +1 -1
  288. package/build-module/media-text/media-container.native.js +2 -4
  289. package/build-module/media-text/media-container.native.js.map +1 -1
  290. package/build-module/media-text/transforms.js +137 -8
  291. package/build-module/media-text/transforms.js.map +1 -1
  292. package/build-module/navigation/edit/index.js +87 -82
  293. package/build-module/navigation/edit/index.js.map +1 -1
  294. package/build-module/navigation/edit/inner-blocks.js +2 -6
  295. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  296. package/build-module/navigation/use-navigation-entities.js +1 -1
  297. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  298. package/build-module/navigation-link/fallback-variations.js +1 -1
  299. package/build-module/navigation-link/fallback-variations.js.map +1 -1
  300. package/build-module/navigation-link/hooks.js +2 -2
  301. package/build-module/navigation-link/hooks.js.map +1 -1
  302. package/build-module/page-list/convert-to-links-modal.js +1 -1
  303. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  304. package/build-module/page-list/edit.js +1 -1
  305. package/build-module/page-list/edit.js.map +1 -1
  306. package/build-module/post-author/edit.js +1 -1
  307. package/build-module/post-author/edit.js.map +1 -1
  308. package/build-module/post-author-name/index.js +1 -0
  309. package/build-module/post-author-name/index.js.map +1 -1
  310. package/build-module/post-comment/index.js +1 -0
  311. package/build-module/post-comment/index.js.map +1 -1
  312. package/build-module/post-comments/edit.js +35 -16
  313. package/build-module/post-comments/edit.js.map +1 -1
  314. package/build-module/post-comments-count/index.js +1 -0
  315. package/build-module/post-comments-count/index.js.map +1 -1
  316. package/build-module/post-comments-form/form.js +1 -1
  317. package/build-module/post-comments-form/form.js.map +1 -1
  318. package/build-module/post-comments-link/index.js +1 -0
  319. package/build-module/post-comments-link/index.js.map +1 -1
  320. package/build-module/post-featured-image/edit.js +1 -1
  321. package/build-module/post-featured-image/edit.js.map +1 -1
  322. package/build-module/post-template/edit.js +7 -2
  323. package/build-module/post-template/edit.js.map +1 -1
  324. package/build-module/post-terms/edit.js +10 -3
  325. package/build-module/post-terms/edit.js.map +1 -1
  326. package/build-module/post-terms/hooks.js +25 -0
  327. package/build-module/post-terms/hooks.js.map +1 -0
  328. package/build-module/post-terms/index.js +10 -8
  329. package/build-module/post-terms/index.js.map +1 -1
  330. package/build-module/post-title/index.js +1 -1
  331. package/build-module/post-title/index.js.map +1 -1
  332. package/build-module/pullquote/edit.js +2 -2
  333. package/build-module/pullquote/edit.js.map +1 -1
  334. package/build-module/pullquote/edit.native.js +2 -2
  335. package/build-module/pullquote/edit.native.js.map +1 -1
  336. package/build-module/query/edit/inspector-controls/index.js +24 -17
  337. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  338. package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
  339. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
  340. package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
  341. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
  342. package/build-module/query/index.js +2 -1
  343. package/build-module/query/index.js.map +1 -1
  344. package/build-module/query/utils.js +21 -0
  345. package/build-module/query/utils.js.map +1 -1
  346. package/build-module/query-title/index.js +1 -1
  347. package/build-module/query-title/index.js.map +1 -1
  348. package/build-module/query-title/variations.js +2 -2
  349. package/build-module/query-title/variations.js.map +1 -1
  350. package/build-module/quote/edit.js +4 -3
  351. package/build-module/quote/edit.js.map +1 -1
  352. package/build-module/quote/v2/edit.js +2 -2
  353. package/build-module/quote/v2/edit.js.map +1 -1
  354. package/build-module/search/edit.js +1 -0
  355. package/build-module/search/edit.js.map +1 -1
  356. package/build-module/site-logo/edit.js +1 -1
  357. package/build-module/site-logo/edit.js.map +1 -1
  358. package/build-module/table/edit.js +17 -4
  359. package/build-module/table/edit.js.map +1 -1
  360. package/build-module/table-of-contents/edit.js +136 -68
  361. package/build-module/table-of-contents/edit.js.map +1 -1
  362. package/build-module/table-of-contents/index.js +12 -3
  363. package/build-module/table-of-contents/index.js.map +1 -1
  364. package/build-module/table-of-contents/list.js +18 -10
  365. package/build-module/table-of-contents/list.js.map +1 -1
  366. package/build-module/table-of-contents/save.js +28 -0
  367. package/build-module/table-of-contents/save.js.map +1 -0
  368. package/build-module/table-of-contents/utils.js +11 -73
  369. package/build-module/table-of-contents/utils.js.map +1 -1
  370. package/build-module/template-part/edit/index.js +8 -4
  371. package/build-module/template-part/edit/index.js.map +1 -1
  372. package/build-module/template-part/edit/inner-blocks.js +4 -9
  373. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  374. package/build-module/video/edit.js +2 -2
  375. package/build-module/video/edit.js.map +1 -1
  376. package/build-style/editor-rtl.css +4 -6
  377. package/build-style/editor.css +4 -6
  378. package/build-style/image/editor-rtl.css +1 -1
  379. package/build-style/image/editor.css +1 -1
  380. package/build-style/post-comments/style-rtl.css +22 -0
  381. package/build-style/post-comments/style.css +22 -0
  382. package/build-style/post-comments-form/style-rtl.css +1 -3
  383. package/build-style/post-comments-form/style.css +1 -3
  384. package/build-style/separator/editor-rtl.css +1 -0
  385. package/build-style/separator/editor.css +1 -0
  386. package/build-style/style-rtl.css +23 -3
  387. package/build-style/style.css +23 -3
  388. package/build-style/video/editor-rtl.css +2 -5
  389. package/build-style/video/editor.css +2 -5
  390. package/build-types/table-of-contents/list.d.ts +12 -0
  391. package/build-types/table-of-contents/list.d.ts.map +1 -0
  392. package/build-types/table-of-contents/utils.d.ts +24 -0
  393. package/build-types/table-of-contents/utils.d.ts.map +1 -0
  394. package/package.json +30 -29
  395. package/src/audio/edit.js +4 -2
  396. package/src/avatar/block.json +0 -1
  397. package/src/avatar/index.php +2 -2
  398. package/src/block/edit.js +39 -42
  399. package/src/block/test/edit.native.js +1 -1
  400. package/src/button/block.json +1 -0
  401. package/src/categories/block.json +1 -1
  402. package/src/categories/edit.js +1 -1
  403. package/src/comment-author-avatar/block.json +1 -0
  404. package/src/comments-title/block.json +0 -6
  405. package/src/comments-title/deprecated.js +34 -0
  406. package/src/comments-title/edit.js +44 -100
  407. package/src/comments-title/index.js +3 -1
  408. package/src/comments-title/index.php +41 -23
  409. package/src/cover/controls.native.js +1 -2
  410. package/src/cover/edit/block-controls.js +119 -0
  411. package/src/cover/edit/cover-placeholder.js +39 -0
  412. package/src/cover/edit/index.js +381 -0
  413. package/src/cover/edit/inspector-controls.js +286 -0
  414. package/src/cover/edit/resizable-cover.js +55 -0
  415. package/src/cover/{use-cover-is-dark.js → edit/use-cover-is-dark.js} +0 -0
  416. package/src/cover/edit.native.js +0 -1
  417. package/src/cover/editor.scss +1 -1
  418. package/src/cover/focal-point-settings-button.native.js +1 -1
  419. package/src/cover/index.php +20 -37
  420. package/src/cover/shared.js +4 -0
  421. package/src/cover/test/block-controls.js +62 -0
  422. package/src/embed/embed-preview.js +4 -2
  423. package/src/file/edit.native.js +0 -1
  424. package/src/gallery/edit.js +2 -1
  425. package/src/gallery/gallery.js +2 -2
  426. package/src/gallery/shared.js +3 -2
  427. package/src/gallery/use-get-media.js +2 -1
  428. package/src/gallery/use-short-code-transform.js +19 -16
  429. package/src/gallery/v1/gallery.js +2 -2
  430. package/src/heading/block.json +1 -0
  431. package/src/heading/edit.js +5 -2
  432. package/src/image/edit.js +9 -1
  433. package/src/image/edit.native.js +0 -1
  434. package/src/image/editor.scss +1 -1
  435. package/src/image/image.js +8 -2
  436. package/src/image/test/edit.native.js +7 -7
  437. package/src/index.js +50 -27
  438. package/src/is-block-metadata-experimental.js +19 -0
  439. package/src/latest-posts/edit.js +27 -2
  440. package/src/latest-posts/index.php +12 -6
  441. package/src/list/transforms.js +7 -0
  442. package/src/list/v2/edit.js +1 -0
  443. package/src/list/v2/migrate.js +1 -1
  444. package/src/list/v2/transforms.js +35 -0
  445. package/src/list-item/block.json +2 -1
  446. package/src/list-item/edit.js +17 -10
  447. package/src/list-item/hooks/index.js +3 -0
  448. package/src/list-item/hooks/use-backspace.js +52 -0
  449. package/src/list-item/hooks/use-enter.js +9 -16
  450. package/src/list-item/hooks/use-indent-list-item.js +50 -63
  451. package/src/list-item/hooks/use-space.js +48 -0
  452. package/src/list-item/hooks/use-split.js +24 -0
  453. package/src/list-item/utils.js +1 -1
  454. package/src/media-text/edit.native.js +3 -1
  455. package/src/media-text/media-container.native.js +2 -4
  456. package/src/media-text/transforms.js +154 -0
  457. package/src/navigation/edit/index.js +175 -169
  458. package/src/navigation/edit/inner-blocks.js +1 -8
  459. package/src/navigation/index.php +40 -0
  460. package/src/navigation/use-navigation-entities.js +1 -1
  461. package/src/navigation-link/fallback-variations.js +1 -1
  462. package/src/navigation-link/hooks.js +2 -2
  463. package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
  464. package/src/page-list/convert-to-links-modal.js +1 -1
  465. package/src/page-list/edit.js +1 -4
  466. package/src/post-author/edit.js +24 -22
  467. package/src/post-author-name/block.json +1 -0
  468. package/src/post-comment/block.json +1 -0
  469. package/src/post-comments/edit.js +54 -22
  470. package/src/post-comments/style.scss +26 -0
  471. package/src/post-comments-count/block.json +1 -0
  472. package/src/post-comments-form/form.js +1 -4
  473. package/src/post-comments-form/style.scss +1 -4
  474. package/src/post-comments-link/block.json +1 -0
  475. package/src/post-featured-image/edit.js +1 -1
  476. package/src/post-template/edit.js +5 -0
  477. package/src/post-template/index.php +30 -0
  478. package/src/post-terms/edit.js +19 -0
  479. package/src/post-terms/hooks.js +27 -0
  480. package/src/post-terms/index.js +14 -7
  481. package/src/post-terms/index.php +40 -2
  482. package/src/post-title/index.js +1 -1
  483. package/src/pullquote/edit.js +2 -2
  484. package/src/pullquote/edit.native.js +2 -2
  485. package/src/query/block.json +2 -1
  486. package/src/query/edit/inspector-controls/index.js +25 -11
  487. package/src/query/edit/inspector-controls/parent-control.js +133 -0
  488. package/src/query/edit/inspector-controls/sticky-control.js +25 -0
  489. package/src/query/utils.js +22 -0
  490. package/src/query-title/index.js +1 -1
  491. package/src/query-title/variations.js +2 -2
  492. package/src/quote/edit.js +5 -2
  493. package/src/quote/v2/edit.js +4 -2
  494. package/src/search/edit.js +1 -0
  495. package/src/search/index.php +1 -1
  496. package/src/separator/editor.scss +1 -0
  497. package/src/site-logo/edit.js +1 -1
  498. package/src/table/edit.js +19 -4
  499. package/src/table-of-contents/block.json +9 -2
  500. package/src/table-of-contents/edit.js +155 -75
  501. package/src/table-of-contents/index.js +2 -0
  502. package/src/table-of-contents/list.tsx +46 -0
  503. package/src/table-of-contents/save.js +25 -0
  504. package/src/table-of-contents/utils.ts +71 -0
  505. package/src/tag-cloud/block.json +1 -1
  506. package/src/template-part/edit/index.js +25 -15
  507. package/src/template-part/edit/inner-blocks.js +2 -10
  508. package/src/video/edit.js +4 -2
  509. package/src/video/editor.scss +3 -6
  510. package/test/babel-plugin.js +67 -0
  511. package/tsconfig.json +11 -0
  512. package/tsconfig.tsbuildinfo +1 -0
  513. package/build/cover/edit.js +0 -598
  514. package/build/cover/edit.js.map +0 -1
  515. package/build/cover/use-cover-is-dark.js.map +0 -1
  516. package/build/post-terms/variations.js +0 -37
  517. package/build/post-terms/variations.js.map +0 -1
  518. package/build-module/cover/edit.js +0 -575
  519. package/build-module/cover/edit.js.map +0 -1
  520. package/build-module/cover/use-cover-is-dark.js.map +0 -1
  521. package/build-module/post-terms/variations.js +0 -27
  522. package/build-module/post-terms/variations.js.map +0 -1
  523. package/src/cover/edit.js +0 -757
  524. package/src/post-terms/variations.js +0 -28
  525. package/src/table-of-contents/index.php +0 -346
  526. package/src/table-of-contents/list.js +0 -28
  527. package/src/table-of-contents/utils.js +0 -126
@@ -0,0 +1,286 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Fragment, useMemo } from '@wordpress/element';
5
+ import {
6
+ BaseControl,
7
+ Button,
8
+ ExternalLink,
9
+ FocalPointPicker,
10
+ PanelBody,
11
+ PanelRow,
12
+ RangeControl,
13
+ TextareaControl,
14
+ ToggleControl,
15
+ __experimentalUseCustomUnits as useCustomUnits,
16
+ __experimentalToolsPanelItem as ToolsPanelItem,
17
+ __experimentalUnitControl as UnitControl,
18
+ __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
19
+ } from '@wordpress/components';
20
+ import { useInstanceId } from '@wordpress/compose';
21
+ import {
22
+ InspectorControls,
23
+ useSetting,
24
+ __experimentalUseGradient,
25
+ __experimentalPanelColorGradientSettings as PanelColorGradientSettings,
26
+ } from '@wordpress/block-editor';
27
+ import { __ } from '@wordpress/i18n';
28
+
29
+ /**
30
+ * Internal dependencies
31
+ */
32
+ import { COVER_MIN_HEIGHT, mediaPosition } from '../shared';
33
+
34
+ function CoverHeightInput( {
35
+ onChange,
36
+ onUnitChange,
37
+ unit = 'px',
38
+ value = '',
39
+ } ) {
40
+ const instanceId = useInstanceId( UnitControl );
41
+ const inputId = `block-cover-height-input-${ instanceId }`;
42
+ const isPx = unit === 'px';
43
+
44
+ const units = useCustomUnits( {
45
+ availableUnits: useSetting( 'spacing.units' ) || [
46
+ 'px',
47
+ 'em',
48
+ 'rem',
49
+ 'vw',
50
+ 'vh',
51
+ ],
52
+ defaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },
53
+ } );
54
+
55
+ const handleOnChange = ( unprocessedValue ) => {
56
+ const inputValue =
57
+ unprocessedValue !== ''
58
+ ? parseFloat( unprocessedValue )
59
+ : undefined;
60
+
61
+ if ( isNaN( inputValue ) && inputValue !== undefined ) {
62
+ return;
63
+ }
64
+ onChange( inputValue );
65
+ };
66
+
67
+ const computedValue = useMemo( () => {
68
+ const [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );
69
+ return [ parsedQuantity, unit ].join( '' );
70
+ }, [ unit, value ] );
71
+
72
+ const min = isPx ? COVER_MIN_HEIGHT : 0;
73
+
74
+ return (
75
+ <BaseControl label={ __( 'Minimum height of cover' ) } id={ inputId }>
76
+ <UnitControl
77
+ id={ inputId }
78
+ isResetValueOnUnitChange
79
+ min={ min }
80
+ onChange={ handleOnChange }
81
+ onUnitChange={ onUnitChange }
82
+ style={ { maxWidth: 80 } }
83
+ units={ units }
84
+ value={ computedValue }
85
+ />
86
+ </BaseControl>
87
+ );
88
+ }
89
+ export default function CoverInspectorControls( {
90
+ attributes,
91
+ setAttributes,
92
+ clientId,
93
+ setOverlayColor,
94
+ coverRef,
95
+ currentSettings,
96
+ } ) {
97
+ const {
98
+ useFeaturedImage,
99
+ dimRatio,
100
+ focalPoint,
101
+ hasParallax,
102
+ isRepeated,
103
+ minHeight,
104
+ minHeightUnit,
105
+ alt,
106
+ } = attributes;
107
+ const {
108
+ isVideoBackground,
109
+ isImageBackground,
110
+ mediaElement,
111
+ url,
112
+ isImgElement,
113
+ overlayColor,
114
+ } = currentSettings;
115
+
116
+ const { gradientValue, setGradient } = __experimentalUseGradient();
117
+
118
+ const toggleParallax = () => {
119
+ setAttributes( {
120
+ hasParallax: ! hasParallax,
121
+ ...( ! hasParallax ? { focalPoint: undefined } : {} ),
122
+ } );
123
+ };
124
+
125
+ const toggleIsRepeated = () => {
126
+ setAttributes( {
127
+ isRepeated: ! isRepeated,
128
+ } );
129
+ };
130
+
131
+ const showFocalPointPicker =
132
+ isVideoBackground ||
133
+ ( isImageBackground && ( ! hasParallax || isRepeated ) );
134
+
135
+ const imperativeFocalPointPreview = ( value ) => {
136
+ const [ styleOfRef, property ] = mediaElement.current
137
+ ? [ mediaElement.current.style, 'objectPosition' ]
138
+ : [ coverRef.current.style, 'backgroundPosition' ];
139
+ styleOfRef[ property ] = mediaPosition( value );
140
+ };
141
+ return (
142
+ <>
143
+ <InspectorControls>
144
+ { !! url && (
145
+ <PanelBody title={ __( 'Media settings' ) }>
146
+ { isImageBackground && (
147
+ <Fragment>
148
+ <ToggleControl
149
+ label={ __( 'Fixed background' ) }
150
+ checked={ hasParallax }
151
+ onChange={ toggleParallax }
152
+ />
153
+
154
+ <ToggleControl
155
+ label={ __( 'Repeated background' ) }
156
+ checked={ isRepeated }
157
+ onChange={ toggleIsRepeated }
158
+ />
159
+ </Fragment>
160
+ ) }
161
+ { showFocalPointPicker && (
162
+ <FocalPointPicker
163
+ label={ __( 'Focal point picker' ) }
164
+ url={ url }
165
+ value={ focalPoint }
166
+ onDragStart={ imperativeFocalPointPreview }
167
+ onDrag={ imperativeFocalPointPreview }
168
+ onChange={ ( newFocalPoint ) =>
169
+ setAttributes( {
170
+ focalPoint: newFocalPoint,
171
+ } )
172
+ }
173
+ />
174
+ ) }
175
+ { ! useFeaturedImage &&
176
+ url &&
177
+ isImageBackground &&
178
+ isImgElement && (
179
+ <TextareaControl
180
+ label={ __(
181
+ 'Alt text (alternative text)'
182
+ ) }
183
+ value={ alt }
184
+ onChange={ ( newAlt ) =>
185
+ setAttributes( { alt: newAlt } )
186
+ }
187
+ help={
188
+ <>
189
+ <ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
190
+ { __(
191
+ 'Describe the purpose of the image'
192
+ ) }
193
+ </ExternalLink>
194
+ { __(
195
+ 'Leave empty if the image is purely decorative.'
196
+ ) }
197
+ </>
198
+ }
199
+ />
200
+ ) }
201
+ <PanelRow>
202
+ <Button
203
+ variant="secondary"
204
+ isSmall
205
+ className="block-library-cover__reset-button"
206
+ onClick={ () =>
207
+ setAttributes( {
208
+ url: undefined,
209
+ id: undefined,
210
+ backgroundType: undefined,
211
+ focalPoint: undefined,
212
+ hasParallax: undefined,
213
+ isRepeated: undefined,
214
+ useFeaturedImage: false,
215
+ } )
216
+ }
217
+ >
218
+ { __( 'Clear Media' ) }
219
+ </Button>
220
+ </PanelRow>
221
+ </PanelBody>
222
+ ) }
223
+ <PanelColorGradientSettings
224
+ __experimentalHasMultipleOrigins
225
+ __experimentalIsRenderedInSidebar
226
+ title={ __( 'Overlay' ) }
227
+ initialOpen={ true }
228
+ settings={ [
229
+ {
230
+ colorValue: overlayColor.color,
231
+ gradientValue,
232
+ onColorChange: setOverlayColor,
233
+ onGradientChange: setGradient,
234
+ label: __( 'Color' ),
235
+ },
236
+ ] }
237
+ >
238
+ <RangeControl
239
+ label={ __( 'Opacity' ) }
240
+ value={ dimRatio }
241
+ onChange={ ( newDimRation ) =>
242
+ setAttributes( {
243
+ dimRatio: newDimRation,
244
+ } )
245
+ }
246
+ min={ 0 }
247
+ max={ 100 }
248
+ step={ 10 }
249
+ required
250
+ />
251
+ </PanelColorGradientSettings>
252
+ </InspectorControls>
253
+ <InspectorControls __experimentalGroup="dimensions">
254
+ <ToolsPanelItem
255
+ hasValue={ () => !! minHeight }
256
+ label={ __( 'Minimum height' ) }
257
+ onDeselect={ () =>
258
+ setAttributes( {
259
+ minHeight: undefined,
260
+ minHeightUnit: undefined,
261
+ } )
262
+ }
263
+ resetAllFilter={ () => ( {
264
+ minHeight: undefined,
265
+ minHeightUnit: undefined,
266
+ } ) }
267
+ isShownByDefault={ true }
268
+ panelId={ clientId }
269
+ >
270
+ <CoverHeightInput
271
+ value={ minHeight }
272
+ unit={ minHeightUnit }
273
+ onChange={ ( newMinHeight ) =>
274
+ setAttributes( { minHeight: newMinHeight } )
275
+ }
276
+ onUnitChange={ ( nextUnit ) =>
277
+ setAttributes( {
278
+ minHeightUnit: nextUnit,
279
+ } )
280
+ }
281
+ />
282
+ </ToolsPanelItem>
283
+ </InspectorControls>
284
+ </>
285
+ );
286
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useState } from '@wordpress/element';
10
+ import { ResizableBox } from '@wordpress/components';
11
+
12
+ const RESIZABLE_BOX_ENABLE_OPTION = {
13
+ top: false,
14
+ right: false,
15
+ bottom: true,
16
+ left: false,
17
+ topRight: false,
18
+ bottomRight: false,
19
+ bottomLeft: false,
20
+ topLeft: false,
21
+ };
22
+
23
+ export default function ResizableCover( {
24
+ className,
25
+ onResizeStart,
26
+ onResize,
27
+ onResizeStop,
28
+ ...props
29
+ } ) {
30
+ const [ isResizing, setIsResizing ] = useState( false );
31
+
32
+ return (
33
+ <ResizableBox
34
+ className={ classnames( className, {
35
+ 'is-resizing': isResizing,
36
+ } ) }
37
+ enable={ RESIZABLE_BOX_ENABLE_OPTION }
38
+ onResizeStart={ ( _event, _direction, elt ) => {
39
+ onResizeStart( elt.clientHeight );
40
+ onResize( elt.clientHeight );
41
+ } }
42
+ onResize={ ( _event, _direction, elt ) => {
43
+ onResize( elt.clientHeight );
44
+ if ( ! isResizing ) {
45
+ setIsResizing( true );
46
+ }
47
+ } }
48
+ onResizeStop={ ( _event, _direction, elt ) => {
49
+ onResizeStop( elt.clientHeight );
50
+ setIsResizing( false );
51
+ } }
52
+ { ...props }
53
+ />
54
+ );
55
+ }
@@ -402,7 +402,6 @@ const Cover = ( {
402
402
  <TouchableWithoutFeedback
403
403
  accessible={ ! isParentSelected }
404
404
  onPress={ onMediaPressed }
405
- onLongPress={ openMediaOptionsRef.current }
406
405
  disabled={ ! isParentSelected }
407
406
  >
408
407
  <View style={ [ styles.background, backgroundColor ] }>
@@ -10,7 +10,7 @@
10
10
  min-height: auto !important;
11
11
  padding: 0 !important;
12
12
 
13
- // Resizeable placeholder for placeholder.
13
+ // Resizable placeholder for placeholder.
14
14
  .block-library-cover__resize-container {
15
15
  display: none;
16
16
  }
@@ -41,7 +41,7 @@ function FocalPointSettingsButton( {
41
41
  >
42
42
  { /*
43
43
  * Wrapper View element used around Icon as workaround for SVG opacity
44
- * issue: https://git.io/JtuXD
44
+ * issue: https://github.com/react-native-svg/react-native-svg/issues/1345
45
45
  */ }
46
46
  <View style={ disabled && styles.dimmedActionButton }>
47
47
  <Icon icon={ chevronRight } />
@@ -14,51 +14,23 @@
14
14
  * @return string Returns the cover block markup, if useFeaturedImage is true.
15
15
  */
16
16
  function render_block_core_cover( $attributes, $content ) {
17
- if ( false === $attributes['useFeaturedImage'] ) {
17
+ if ( 'image' !== $attributes['backgroundType'] || false === $attributes['useFeaturedImage'] ) {
18
18
  return $content;
19
19
  }
20
20
 
21
- $current_featured_image = get_the_post_thumbnail_url();
22
-
23
- if ( false === $current_featured_image ) {
24
- return $content;
25
- }
26
-
27
- $is_img_element = ! ( $attributes['hasParallax'] || $attributes['isRepeated'] );
28
- $is_image_background = 'image' === $attributes['backgroundType'];
29
-
30
- if ( $is_image_background && ! $is_img_element ) {
31
- $content = preg_replace(
32
- '/class=\".*?\"/',
33
- '${0} style="background-image:url(' . esc_url( $current_featured_image ) . ')"',
34
- $content,
35
- 1
21
+ if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) {
22
+ $attr = array(
23
+ 'class' => 'wp-block-cover__image-background',
24
+ 'data-object-fit' => 'cover',
36
25
  );
37
- }
38
26
 
39
- if ( $is_image_background && $is_img_element ) {
40
- $object_position = '';
41
27
  if ( isset( $attributes['focalPoint'] ) ) {
42
- $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' .
43
- round( $attributes['focalPoint']['y'] * 100 ) . '%';
28
+ $object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' . round( $attributes['focalPoint']['y'] * 100 ) . '%';
29
+ $attr['data-object-position'] = $object_position;
30
+ $attr['style'] = 'object-position: ' . $object_position;
44
31
  }
45
32
 
46
- $image_template = '<img
47
- class="wp-block-cover__image-background"
48
- alt="%s"
49
- src="%s"
50
- style="object-position: %s"
51
- data-object-fit="cover"
52
- data-object-position="%s"
53
- />';
54
-
55
- $image = sprintf(
56
- $image_template,
57
- esc_attr( get_the_post_thumbnail_caption() ),
58
- esc_url( $current_featured_image ),
59
- esc_attr( $object_position ),
60
- esc_attr( $object_position )
61
- );
33
+ $image = get_the_post_thumbnail( null, 'post-thumbnail', $attr );
62
34
 
63
35
  $content = str_replace(
64
36
  '</span><div',
@@ -66,6 +38,17 @@ function render_block_core_cover( $attributes, $content ) {
66
38
  $content
67
39
  );
68
40
 
41
+ } else {
42
+ if ( in_the_loop() ) {
43
+ update_post_thumbnail_cache();
44
+ }
45
+ $current_featured_image = get_the_post_thumbnail_url();
46
+ $content = preg_replace(
47
+ '/class=\".*?\"/',
48
+ '${0} style="background-image:url(' . esc_url( $current_featured_image ) . ')"',
49
+ $content,
50
+ 1
51
+ );
69
52
  }
70
53
 
71
54
  return $content;
@@ -106,3 +106,7 @@ export function getPositionClassName( contentPosition ) {
106
106
 
107
107
  return POSITION_CLASSNAMES[ contentPosition ];
108
108
  }
109
+
110
+ export function mediaPosition( { x, y } ) {
111
+ return `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;
112
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen, fireEvent } from '@testing-library/react';
5
+
6
+ // Need to mock the BlockControls wrapper as this requires a slot to run
7
+ // so can't be easily unit tested.
8
+ jest.mock( '@wordpress/block-editor', () => ( {
9
+ ...jest.requireActual( '@wordpress/block-editor' ),
10
+ BlockControls: ( { children } ) => <div>{ children }</div>,
11
+ } ) );
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import CoverBlockControls from '../edit/block-controls';
17
+
18
+ const setAttributes = jest.fn();
19
+ const onSelectMedia = jest.fn();
20
+
21
+ const currentSettings = { hasInnerBlocks: true, url: undefined };
22
+ const defaultAttributes = {
23
+ contentPosition: undefined,
24
+ id: 1,
25
+ useFeaturedImage: false,
26
+ dimRatio: 50,
27
+ minHeight: 300,
28
+ minHeightUnit: 'px',
29
+ };
30
+ const defaultProps = {
31
+ attributes: defaultAttributes,
32
+ currentSettings,
33
+ setAttributes,
34
+ onSelectMedia,
35
+ };
36
+
37
+ beforeEach( () => {
38
+ setAttributes.mockClear();
39
+ onSelectMedia.mockClear();
40
+ } );
41
+
42
+ describe( 'Cover block controls', () => {
43
+ describe( 'Full height toggle', () => {
44
+ test( 'displays toggle full height button toggled off if minHeight not 100vh', () => {
45
+ render( <CoverBlockControls { ...defaultProps } /> );
46
+ expect(
47
+ screen.getByRole( 'button', {
48
+ pressed: false,
49
+ name: 'Toggle full height',
50
+ } )
51
+ ).toBeInTheDocument();
52
+ } );
53
+ test( 'sets minHeight attributes to 100vh when clicked', () => {
54
+ render( <CoverBlockControls { ...defaultProps } /> );
55
+ fireEvent.click( screen.getByLabelText( 'Toggle full height' ) );
56
+ expect( setAttributes ).toHaveBeenCalledWith( {
57
+ minHeight: 100,
58
+ minHeightUnit: 'vh',
59
+ } );
60
+ } );
61
+ } );
62
+ } );
@@ -15,7 +15,7 @@ import { __, sprintf } from '@wordpress/i18n';
15
15
  import { Placeholder, SandBox } from '@wordpress/components';
16
16
  import { RichText, BlockIcon } from '@wordpress/block-editor';
17
17
  import { Component } from '@wordpress/element';
18
- import { createBlock } from '@wordpress/blocks';
18
+ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
19
19
 
20
20
  /**
21
21
  * Internal dependencies
@@ -145,7 +145,9 @@ class EmbedPreview extends Component {
145
145
  onChange={ onCaptionChange }
146
146
  inlineToolbar
147
147
  __unstableOnSplitAtEnd={ () =>
148
- insertBlocksAfter( createBlock( 'core/paragraph' ) )
148
+ insertBlocksAfter(
149
+ createBlock( getDefaultBlockName() )
150
+ )
149
151
  }
150
152
  />
151
153
  ) }
@@ -452,7 +452,6 @@ export class FileEdit extends Component {
452
452
  <TouchableWithoutFeedback
453
453
  accessible={ ! isSelected }
454
454
  onPress={ this.onFilePressed }
455
- onLongPress={ openMediaOptions }
456
455
  disabled={ ! isSelected }
457
456
  >
458
457
  <View
@@ -204,10 +204,11 @@ function GalleryEdit( props ) {
204
204
  : undefined;
205
205
  }
206
206
  return {
207
- ...pickRelevantMediaFiles( imageAttributes, sizeSlug ),
207
+ ...pickRelevantMediaFiles( image, sizeSlug ),
208
208
  ...getHrefAndDestination( image, linkTo ),
209
209
  ...getUpdatedLinkTargetSettings( linkTarget, attributes ),
210
210
  className: newClassName,
211
+ caption: imageAttributes.caption,
211
212
  sizeSlug,
212
213
  };
213
214
  }
@@ -10,7 +10,7 @@ import { RichText, useInnerBlocksProps } from '@wordpress/block-editor';
10
10
  import { VisuallyHidden } from '@wordpress/components';
11
11
  import { useState, useEffect } from '@wordpress/element';
12
12
  import { __ } from '@wordpress/i18n';
13
- import { createBlock } from '@wordpress/blocks';
13
+ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
14
14
  import { View } from '@wordpress/primitives';
15
15
 
16
16
  const allowedBlocks = [ 'core/image' ];
@@ -89,7 +89,7 @@ export const Gallery = ( props ) => {
89
89
  onChange={ ( value ) => setAttributes( { caption: value } ) }
90
90
  inlineToolbar
91
91
  __unstableOnSplitAtEnd={ () =>
92
- insertBlocksAfter( createBlock( 'core/paragraph' ) )
92
+ insertBlocksAfter( createBlock( getDefaultBlockName() ) )
93
93
  }
94
94
  />
95
95
  </figure>
@@ -8,11 +8,12 @@ export function defaultColumnsNumber( imageCount ) {
8
8
  }
9
9
 
10
10
  export const pickRelevantMediaFiles = ( image, sizeSlug = 'large' ) => {
11
- const imageProps = pick( image, [ 'alt', 'id', 'link', 'caption' ] );
11
+ const imageProps = pick( image, [ 'alt', 'id', 'link' ] );
12
12
  imageProps.url =
13
13
  get( image, [ 'sizes', sizeSlug, 'url' ] ) ||
14
14
  get( image, [ 'media_details', 'sizes', sizeSlug, 'source_url' ] ) ||
15
- image.url;
15
+ image.url ||
16
+ image.source_url;
16
17
  const fullUrl =
17
18
  get( image, [ 'sizes', 'full', 'url' ] ) ||
18
19
  get( image, [ 'media_details', 'sizes', 'full', 'source_url' ] );
@@ -32,7 +32,8 @@ export default function useGetMedia( innerBlockImages ) {
32
32
 
33
33
  return select( coreStore ).getMediaItems( {
34
34
  include: imageIds.join( ',' ),
35
- per_page: -1,
35
+ per_page: imageIds.length,
36
+ orderby: 'include',
36
37
  } );
37
38
  },
38
39
  [ innerBlockImages ]
@@ -23,20 +23,13 @@ export default function useShortCodeTransform( shortCodeTransforms ) {
23
23
  if ( ! shortCodeTransforms || shortCodeTransforms.length === 0 ) {
24
24
  return;
25
25
  }
26
- const getMedia = select( coreStore ).getMedia;
27
- return shortCodeTransforms.map( ( image ) => {
28
- const imageData = getMedia( image.id );
29
- if ( imageData ) {
30
- return {
31
- id: imageData.id,
32
- type: 'image',
33
- url: imageData.source_url,
34
- mime: imageData.mime_type,
35
- alt: imageData.alt_text,
36
- link: imageData.link,
37
- };
38
- }
39
- return undefined;
26
+
27
+ const imageIds = shortCodeTransforms.map( ( image ) => image.id );
28
+
29
+ return select( coreStore ).getMediaItems( {
30
+ include: imageIds.join( ',' ),
31
+ per_page: imageIds.length,
32
+ orderby: 'include',
40
33
  } );
41
34
  },
42
35
  [ shortCodeTransforms ]
@@ -46,7 +39,17 @@ export default function useShortCodeTransform( shortCodeTransforms ) {
46
39
  return;
47
40
  }
48
41
 
49
- if ( every( newImageData, ( img ) => img && img.url ) ) {
50
- return newImageData;
42
+ if ( every( newImageData, ( img ) => img && img.source_url ) ) {
43
+ return newImageData.map( ( imageData ) => {
44
+ return {
45
+ id: imageData.id,
46
+ type: 'image',
47
+ url: imageData.source_url,
48
+ mime: imageData.mime_type,
49
+ alt: imageData.alt_text,
50
+ link: imageData.link,
51
+ caption: imageData?.caption?.raw,
52
+ };
53
+ } );
51
54
  }
52
55
  }
@@ -9,7 +9,7 @@ import classnames from 'classnames';
9
9
  import { RichText } from '@wordpress/block-editor';
10
10
  import { VisuallyHidden } from '@wordpress/components';
11
11
  import { __, sprintf } from '@wordpress/i18n';
12
- import { createBlock } from '@wordpress/blocks';
12
+ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
@@ -101,7 +101,7 @@ export const Gallery = ( props ) => {
101
101
  onChange={ ( value ) => setAttributes( { caption: value } ) }
102
102
  inlineToolbar
103
103
  __unstableOnSplitAtEnd={ () =>
104
- insertBlocksAfter( createBlock( 'core/paragraph' ) )
104
+ insertBlocksAfter( createBlock( getDefaultBlockName() ) )
105
105
  }
106
106
  />
107
107
  </figure>
@@ -43,6 +43,7 @@
43
43
  "typography": {
44
44
  "fontSize": true,
45
45
  "lineHeight": true,
46
+ "__experimentalFontFamily": true,
46
47
  "__experimentalFontStyle": true,
47
48
  "__experimentalFontWeight": true,
48
49
  "__experimentalLetterSpacing": true,