@wordpress/block-library 8.24.1 → 8.25.1-next.79a6196f.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 (509) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/audio/edit.js +15 -62
  4. package/build/audio/edit.js.map +1 -1
  5. package/build/audio/edit.native.js +1 -1
  6. package/build/audio/edit.native.js.map +1 -1
  7. package/build/audio/index.js +2 -2
  8. package/build/block/edit.js +157 -19
  9. package/build/block/edit.js.map +1 -1
  10. package/build/block/index.js +3 -2
  11. package/build/block/index.js.map +1 -1
  12. package/build/block/v1/edit.js +116 -0
  13. package/build/block/v1/edit.js.map +1 -0
  14. package/build/block/{edit.native.js → v1/edit.native.js} +2 -2
  15. package/build/block/v1/edit.native.js.map +1 -0
  16. package/build/button/index.js +2 -2
  17. package/build/button/save.js +1 -1
  18. package/build/button/save.js.map +1 -1
  19. package/build/code/edit.native.js +13 -14
  20. package/build/code/edit.native.js.map +1 -1
  21. package/build/code/index.js +2 -2
  22. package/build/code/save.js +6 -2
  23. package/build/code/save.js.map +1 -1
  24. package/build/comments-title/deprecated.js +1 -1
  25. package/build/comments-title/index.js +1 -1
  26. package/build/cover/edit/inspector-controls.js +1 -1
  27. package/build/cover/edit/inspector-controls.js.map +1 -1
  28. package/build/cover/edit.native.js +1 -0
  29. package/build/cover/edit.native.js.map +1 -1
  30. package/build/details/index.js +2 -2
  31. package/build/embed/deprecated.js +2 -2
  32. package/build/embed/embed-preview.native.js +1 -1
  33. package/build/embed/embed-preview.native.js.map +1 -1
  34. package/build/embed/icons.js +1 -1
  35. package/build/embed/icons.js.map +1 -1
  36. package/build/embed/index.js +2 -2
  37. package/build/embed/transforms.js +2 -2
  38. package/build/embed/util.js +6 -6
  39. package/build/embed/util.js.map +1 -1
  40. package/build/file/edit.js +20 -28
  41. package/build/file/edit.js.map +1 -1
  42. package/build/file/edit.native.js +1 -1
  43. package/build/file/edit.native.js.map +1 -1
  44. package/build/file/index.js +4 -4
  45. package/build/file/save.js +4 -1
  46. package/build/file/save.js.map +1 -1
  47. package/build/form-input/deprecated.js +147 -0
  48. package/build/form-input/deprecated.js.map +1 -0
  49. package/build/form-input/edit.js +1 -1
  50. package/build/form-input/edit.js.map +1 -1
  51. package/build/form-input/index.js +4 -2
  52. package/build/form-input/index.js.map +1 -1
  53. package/build/form-input/save.js +7 -9
  54. package/build/form-input/save.js.map +1 -1
  55. package/build/gallery/edit.js +38 -58
  56. package/build/gallery/edit.js.map +1 -1
  57. package/build/gallery/gallery.js +19 -24
  58. package/build/gallery/gallery.js.map +1 -1
  59. package/build/gallery/gallery.native.js +1 -1
  60. package/build/gallery/gallery.native.js.map +1 -1
  61. package/build/gallery/index.js +8 -4
  62. package/build/gallery/index.js.map +1 -1
  63. package/build/gallery/transforms.js +4 -68
  64. package/build/gallery/transforms.js.map +1 -1
  65. package/build/gallery/v1/gallery.native.js +1 -1
  66. package/build/gallery/v1/gallery.native.js.map +1 -1
  67. package/build/group/edit.js +6 -1
  68. package/build/group/edit.js.map +1 -1
  69. package/build/group/index.js +5 -1
  70. package/build/group/index.js.map +1 -1
  71. package/build/heading/index.js +3 -6
  72. package/build/heading/index.js.map +1 -1
  73. package/build/image/deprecated.js +11 -0
  74. package/build/image/deprecated.js.map +1 -1
  75. package/build/image/edit.native.js +4 -1
  76. package/build/image/edit.native.js.map +1 -1
  77. package/build/image/image.js +35 -71
  78. package/build/image/image.js.map +1 -1
  79. package/build/image/index.js +2 -2
  80. package/build/image/save.js +3 -1
  81. package/build/image/save.js.map +1 -1
  82. package/build/image/view.js +7 -1
  83. package/build/image/view.js.map +1 -1
  84. package/build/list/edit.js +10 -15
  85. package/build/list/edit.js.map +1 -1
  86. package/build/list-item/edit.js +17 -2
  87. package/build/list-item/edit.js.map +1 -1
  88. package/build/list-item/hooks/use-enter.js +5 -3
  89. package/build/list-item/hooks/use-enter.js.map +1 -1
  90. package/build/list-item/hooks/use-enter.native.js +4 -3
  91. package/build/list-item/hooks/use-enter.native.js.map +1 -1
  92. package/build/list-item/hooks/use-indent-list-item.js +2 -3
  93. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  94. package/build/list-item/hooks/use-merge.js +1 -1
  95. package/build/list-item/hooks/use-merge.js.map +1 -1
  96. package/build/list-item/hooks/use-outdent-list-item.js +3 -17
  97. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  98. package/build/list-item/hooks/use-space.js +8 -4
  99. package/build/list-item/hooks/use-space.js.map +1 -1
  100. package/build/list-item/index.js +10 -3
  101. package/build/list-item/index.js.map +1 -1
  102. package/build/media-text/media-container.native.js +3 -0
  103. package/build/media-text/media-container.native.js.map +1 -1
  104. package/build/navigation/constants.js +3 -1
  105. package/build/navigation/constants.js.map +1 -1
  106. package/build/navigation/edit/index.js +5 -1
  107. package/build/navigation/edit/index.js.map +1 -1
  108. package/build/navigation/view.js +25 -1
  109. package/build/navigation/view.js.map +1 -1
  110. package/build/page-list/convert-to-links-modal.js +2 -2
  111. package/build/page-list/convert-to-links-modal.js.map +1 -1
  112. package/build/paragraph/edit.js +54 -32
  113. package/build/paragraph/edit.js.map +1 -1
  114. package/build/paragraph/index.js +2 -4
  115. package/build/paragraph/index.js.map +1 -1
  116. package/build/paragraph/transforms.js +2 -4
  117. package/build/paragraph/transforms.js.map +1 -1
  118. package/build/pattern/edit.js +24 -2
  119. package/build/pattern/edit.js.map +1 -1
  120. package/build/pattern/recursion-detector.js +147 -0
  121. package/build/pattern/recursion-detector.js.map +1 -0
  122. package/build/post-featured-image/edit.js +19 -2
  123. package/build/post-featured-image/edit.js.map +1 -1
  124. package/build/post-featured-image/index.js +4 -0
  125. package/build/post-featured-image/index.js.map +1 -1
  126. package/build/post-title/index.js +1 -3
  127. package/build/post-title/index.js.map +1 -1
  128. package/build/preformatted/index.js +2 -3
  129. package/build/preformatted/index.js.map +1 -1
  130. package/build/pullquote/index.js +5 -7
  131. package/build/pullquote/index.js.map +1 -1
  132. package/build/query/edit/inspector-controls/index.js +3 -1
  133. package/build/query/edit/inspector-controls/index.js.map +1 -1
  134. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -0
  135. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  136. package/build/query-pagination-numbers/index.js +1 -1
  137. package/build/query-title/index.js +1 -3
  138. package/build/query-title/index.js.map +1 -1
  139. package/build/quote/index.js +3 -5
  140. package/build/quote/index.js.map +1 -1
  141. package/build/quote/transforms.js +7 -6
  142. package/build/quote/transforms.js.map +1 -1
  143. package/build/search/edit.js +3 -5
  144. package/build/search/edit.js.map +1 -1
  145. package/build/search/index.js +0 -4
  146. package/build/search/index.js.map +1 -1
  147. package/build/site-logo/edit.js +7 -6
  148. package/build/site-logo/edit.js.map +1 -1
  149. package/build/site-title/index.js +1 -5
  150. package/build/site-title/index.js.map +1 -1
  151. package/build/social-link/icons/gravatar.js +22 -0
  152. package/build/social-link/icons/gravatar.js.map +1 -0
  153. package/build/social-link/icons/index.js +11 -0
  154. package/build/social-link/icons/index.js.map +1 -1
  155. package/build/social-link/variations.js +7 -0
  156. package/build/social-link/variations.js.map +1 -1
  157. package/build/spacer/edit.native.js +2 -2
  158. package/build/spacer/edit.native.js.map +1 -1
  159. package/build/table/edit.js +3 -1
  160. package/build/table/edit.js.map +1 -1
  161. package/build/table/index.js +9 -10
  162. package/build/table/index.js.map +1 -1
  163. package/build/table-of-contents/edit.js +2 -2
  164. package/build/table-of-contents/edit.js.map +1 -1
  165. package/build/table-of-contents/index.js +5 -2
  166. package/build/table-of-contents/index.js.map +1 -1
  167. package/build/tag-cloud/edit.js +5 -9
  168. package/build/tag-cloud/edit.js.map +1 -1
  169. package/build/utils/caption.js +90 -0
  170. package/build/utils/caption.js.map +1 -0
  171. package/build/utils/constants.js +16 -0
  172. package/build/utils/constants.js.map +1 -0
  173. package/build/utils/remove-anchor-tag.js +2 -1
  174. package/build/utils/remove-anchor-tag.js.map +1 -1
  175. package/build/verse/index.js +3 -5
  176. package/build/verse/index.js.map +1 -1
  177. package/build/video/deprecated.js +2 -2
  178. package/build/video/edit.js +16 -57
  179. package/build/video/edit.js.map +1 -1
  180. package/build/video/edit.native.js +1 -1
  181. package/build/video/edit.native.js.map +1 -1
  182. package/build/video/index.js +2 -2
  183. package/build-module/audio/edit.js +19 -66
  184. package/build-module/audio/edit.js.map +1 -1
  185. package/build-module/audio/edit.native.js +2 -2
  186. package/build-module/audio/edit.native.js.map +1 -1
  187. package/build-module/audio/index.js +2 -2
  188. package/build-module/block/edit.js +160 -22
  189. package/build-module/block/edit.js.map +1 -1
  190. package/build-module/block/index.js +3 -2
  191. package/build-module/block/index.js.map +1 -1
  192. package/build-module/block/v1/edit.js +108 -0
  193. package/build-module/block/v1/edit.js.map +1 -0
  194. package/build-module/block/{edit.native.js → v1/edit.native.js} +2 -2
  195. package/build-module/block/v1/edit.native.js.map +1 -0
  196. package/build-module/button/index.js +2 -2
  197. package/build-module/button/save.js +1 -1
  198. package/build-module/button/save.js.map +1 -1
  199. package/build-module/code/edit.native.js +14 -16
  200. package/build-module/code/edit.native.js.map +1 -1
  201. package/build-module/code/index.js +2 -2
  202. package/build-module/code/save.js +6 -2
  203. package/build-module/code/save.js.map +1 -1
  204. package/build-module/comments-title/deprecated.js +1 -1
  205. package/build-module/comments-title/index.js +1 -1
  206. package/build-module/cover/edit/inspector-controls.js +1 -1
  207. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  208. package/build-module/cover/edit.native.js +1 -0
  209. package/build-module/cover/edit.native.js.map +1 -1
  210. package/build-module/details/index.js +2 -2
  211. package/build-module/embed/deprecated.js +2 -2
  212. package/build-module/embed/embed-preview.native.js +2 -2
  213. package/build-module/embed/embed-preview.native.js.map +1 -1
  214. package/build-module/embed/icons.js +1 -1
  215. package/build-module/embed/icons.js.map +1 -1
  216. package/build-module/embed/index.js +2 -2
  217. package/build-module/embed/transforms.js +2 -2
  218. package/build-module/embed/util.js +6 -6
  219. package/build-module/embed/util.js.map +1 -1
  220. package/build-module/file/edit.js +20 -28
  221. package/build-module/file/edit.js.map +1 -1
  222. package/build-module/file/edit.native.js +1 -1
  223. package/build-module/file/edit.native.js.map +1 -1
  224. package/build-module/file/index.js +4 -4
  225. package/build-module/file/save.js +4 -1
  226. package/build-module/file/save.js.map +1 -1
  227. package/build-module/form-input/deprecated.js +138 -0
  228. package/build-module/form-input/deprecated.js.map +1 -0
  229. package/build-module/form-input/edit.js +1 -1
  230. package/build-module/form-input/edit.js.map +1 -1
  231. package/build-module/form-input/index.js +4 -2
  232. package/build-module/form-input/index.js.map +1 -1
  233. package/build-module/form-input/save.js +8 -10
  234. package/build-module/form-input/save.js.map +1 -1
  235. package/build-module/gallery/edit.js +41 -61
  236. package/build-module/gallery/edit.js.map +1 -1
  237. package/build-module/gallery/gallery.js +18 -21
  238. package/build-module/gallery/gallery.js.map +1 -1
  239. package/build-module/gallery/gallery.native.js +2 -2
  240. package/build-module/gallery/gallery.native.js.map +1 -1
  241. package/build-module/gallery/index.js +8 -4
  242. package/build-module/gallery/index.js.map +1 -1
  243. package/build-module/gallery/transforms.js +4 -68
  244. package/build-module/gallery/transforms.js.map +1 -1
  245. package/build-module/gallery/v1/gallery.native.js +2 -2
  246. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  247. package/build-module/group/edit.js +6 -1
  248. package/build-module/group/edit.js.map +1 -1
  249. package/build-module/group/index.js +5 -1
  250. package/build-module/group/index.js.map +1 -1
  251. package/build-module/heading/index.js +3 -6
  252. package/build-module/heading/index.js.map +1 -1
  253. package/build-module/image/deprecated.js +11 -0
  254. package/build-module/image/deprecated.js.map +1 -1
  255. package/build-module/image/edit.native.js +5 -2
  256. package/build-module/image/edit.native.js.map +1 -1
  257. package/build-module/image/image.js +35 -71
  258. package/build-module/image/image.js.map +1 -1
  259. package/build-module/image/index.js +2 -2
  260. package/build-module/image/save.js +3 -1
  261. package/build-module/image/save.js.map +1 -1
  262. package/build-module/image/view.js +7 -1
  263. package/build-module/image/view.js.map +1 -1
  264. package/build-module/list/edit.js +10 -15
  265. package/build-module/list/edit.js.map +1 -1
  266. package/build-module/list-item/edit.js +18 -3
  267. package/build-module/list-item/edit.js.map +1 -1
  268. package/build-module/list-item/hooks/use-enter.js +5 -3
  269. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  270. package/build-module/list-item/hooks/use-enter.native.js +4 -3
  271. package/build-module/list-item/hooks/use-enter.native.js.map +1 -1
  272. package/build-module/list-item/hooks/use-indent-list-item.js +2 -3
  273. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  274. package/build-module/list-item/hooks/use-merge.js +1 -1
  275. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  276. package/build-module/list-item/hooks/use-outdent-list-item.js +3 -17
  277. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  278. package/build-module/list-item/hooks/use-space.js +8 -4
  279. package/build-module/list-item/hooks/use-space.js.map +1 -1
  280. package/build-module/list-item/index.js +10 -3
  281. package/build-module/list-item/index.js.map +1 -1
  282. package/build-module/media-text/media-container.native.js +3 -0
  283. package/build-module/media-text/media-container.native.js.map +1 -1
  284. package/build-module/navigation/constants.js +1 -0
  285. package/build-module/navigation/constants.js.map +1 -1
  286. package/build-module/navigation/edit/index.js +7 -3
  287. package/build-module/navigation/edit/index.js.map +1 -1
  288. package/build-module/navigation/view.js +25 -1
  289. package/build-module/navigation/view.js.map +1 -1
  290. package/build-module/page-list/convert-to-links-modal.js +2 -2
  291. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  292. package/build-module/paragraph/edit.js +54 -32
  293. package/build-module/paragraph/edit.js.map +1 -1
  294. package/build-module/paragraph/index.js +2 -4
  295. package/build-module/paragraph/index.js.map +1 -1
  296. package/build-module/paragraph/transforms.js +2 -4
  297. package/build-module/paragraph/transforms.js.map +1 -1
  298. package/build-module/pattern/edit.js +26 -4
  299. package/build-module/pattern/edit.js.map +1 -1
  300. package/build-module/pattern/recursion-detector.js +139 -0
  301. package/build-module/pattern/recursion-detector.js.map +1 -0
  302. package/build-module/post-featured-image/edit.js +19 -2
  303. package/build-module/post-featured-image/edit.js.map +1 -1
  304. package/build-module/post-featured-image/index.js +4 -0
  305. package/build-module/post-featured-image/index.js.map +1 -1
  306. package/build-module/post-title/index.js +1 -3
  307. package/build-module/post-title/index.js.map +1 -1
  308. package/build-module/preformatted/index.js +2 -3
  309. package/build-module/preformatted/index.js.map +1 -1
  310. package/build-module/pullquote/index.js +5 -7
  311. package/build-module/pullquote/index.js.map +1 -1
  312. package/build-module/query/edit/inspector-controls/index.js +3 -1
  313. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  314. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -0
  315. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  316. package/build-module/query-pagination-numbers/index.js +1 -1
  317. package/build-module/query-title/index.js +1 -3
  318. package/build-module/query-title/index.js.map +1 -1
  319. package/build-module/quote/index.js +3 -5
  320. package/build-module/quote/index.js.map +1 -1
  321. package/build-module/quote/transforms.js +7 -6
  322. package/build-module/quote/transforms.js.map +1 -1
  323. package/build-module/search/edit.js +3 -5
  324. package/build-module/search/edit.js.map +1 -1
  325. package/build-module/search/index.js +0 -4
  326. package/build-module/search/index.js.map +1 -1
  327. package/build-module/site-logo/edit.js +7 -6
  328. package/build-module/site-logo/edit.js.map +1 -1
  329. package/build-module/site-title/index.js +1 -5
  330. package/build-module/site-title/index.js.map +1 -1
  331. package/build-module/social-link/icons/gravatar.js +14 -0
  332. package/build-module/social-link/icons/gravatar.js.map +1 -0
  333. package/build-module/social-link/icons/index.js +1 -0
  334. package/build-module/social-link/icons/index.js.map +1 -1
  335. package/build-module/social-link/variations.js +8 -1
  336. package/build-module/social-link/variations.js.map +1 -1
  337. package/build-module/spacer/edit.native.js +2 -2
  338. package/build-module/spacer/edit.native.js.map +1 -1
  339. package/build-module/table/edit.js +3 -1
  340. package/build-module/table/edit.js.map +1 -1
  341. package/build-module/table/index.js +9 -10
  342. package/build-module/table/index.js.map +1 -1
  343. package/build-module/table-of-contents/edit.js +1 -1
  344. package/build-module/table-of-contents/edit.js.map +1 -1
  345. package/build-module/table-of-contents/index.js +5 -1
  346. package/build-module/table-of-contents/index.js.map +1 -1
  347. package/build-module/tag-cloud/edit.js +6 -10
  348. package/build-module/tag-cloud/edit.js.map +1 -1
  349. package/build-module/utils/caption.js +82 -0
  350. package/build-module/utils/caption.js.map +1 -0
  351. package/build-module/utils/constants.js +9 -0
  352. package/build-module/utils/constants.js.map +1 -0
  353. package/build-module/utils/remove-anchor-tag.js +2 -1
  354. package/build-module/utils/remove-anchor-tag.js.map +1 -1
  355. package/build-module/verse/index.js +3 -5
  356. package/build-module/verse/index.js.map +1 -1
  357. package/build-module/video/deprecated.js +2 -2
  358. package/build-module/video/edit.js +21 -62
  359. package/build-module/video/edit.js.map +1 -1
  360. package/build-module/video/edit.native.js +2 -2
  361. package/build-module/video/edit.native.js.map +1 -1
  362. package/build-module/video/index.js +2 -2
  363. package/build-style/button/editor-rtl.css +0 -37
  364. package/build-style/button/editor.css +0 -37
  365. package/build-style/button/style-rtl.css +6 -6
  366. package/build-style/button/style.css +6 -6
  367. package/build-style/editor-rtl.css +3 -55
  368. package/build-style/editor.css +3 -55
  369. package/build-style/navigation/editor-rtl.css +2 -4
  370. package/build-style/navigation/editor.css +2 -4
  371. package/build-style/navigation/style-rtl.css +14 -18
  372. package/build-style/navigation/style.css +14 -18
  373. package/build-style/search/style-rtl.css +26 -27
  374. package/build-style/search/style.css +26 -27
  375. package/build-style/social-links/style-rtl.css +14 -2
  376. package/build-style/social-links/style.css +14 -2
  377. package/build-style/style-rtl.css +60 -53
  378. package/build-style/style.css +60 -53
  379. package/build-style/table/editor-rtl.css +1 -14
  380. package/build-style/table/editor.css +1 -14
  381. package/package.json +32 -32
  382. package/src/audio/block.json +2 -2
  383. package/src/audio/edit.js +29 -92
  384. package/src/audio/edit.native.js +2 -1
  385. package/src/audio/test/__snapshots__/edit.native.js.snap +12 -0
  386. package/src/audio/test/edit.native.js +29 -0
  387. package/src/block/edit.js +218 -37
  388. package/src/block/index.js +3 -2
  389. package/src/block/index.php +48 -0
  390. package/src/block/v1/edit.js +163 -0
  391. package/src/block/{edit.native.js → v1/edit.native.js} +2 -2
  392. package/src/button/block.json +2 -2
  393. package/src/button/editor.scss +0 -43
  394. package/src/button/save.js +1 -1
  395. package/src/button/style.scss +6 -6
  396. package/src/buttons/test/__snapshots__/edit.native.js.snap +6 -0
  397. package/src/buttons/test/edit.native.js +49 -0
  398. package/src/code/block.json +2 -2
  399. package/src/code/edit.native.js +11 -13
  400. package/src/code/save.js +4 -1
  401. package/src/code/test/edit.native.js +2 -2
  402. package/src/comments-title/block.json +1 -1
  403. package/src/cover/edit/inspector-controls.js +1 -1
  404. package/src/cover/edit.native.js +1 -0
  405. package/src/cover/test/edit.native.js +7 -1
  406. package/src/details/block.json +2 -2
  407. package/src/embed/block.json +2 -2
  408. package/src/embed/embed-preview.native.js +2 -1
  409. package/src/embed/icons.js +1 -1
  410. package/src/embed/util.js +2 -2
  411. package/src/file/block.json +4 -4
  412. package/src/file/edit.js +18 -25
  413. package/src/file/edit.native.js +1 -1
  414. package/src/file/save.js +5 -1
  415. package/src/form-input/block.json +2 -2
  416. package/src/form-input/deprecated.js +142 -0
  417. package/src/form-input/edit.js +1 -1
  418. package/src/form-input/index.js +2 -0
  419. package/src/form-input/save.js +27 -24
  420. package/src/gallery/block.json +8 -4
  421. package/src/gallery/edit.js +70 -98
  422. package/src/gallery/gallery.js +22 -36
  423. package/src/gallery/gallery.native.js +6 -2
  424. package/src/gallery/index.php +15 -0
  425. package/src/gallery/transforms.js +2 -55
  426. package/src/gallery/v1/gallery.native.js +2 -1
  427. package/src/group/block.json +5 -1
  428. package/src/group/edit.js +4 -1
  429. package/src/heading/block.json +3 -6
  430. package/src/image/block.json +2 -2
  431. package/src/image/deprecated.js +8 -0
  432. package/src/image/edit.native.js +5 -3
  433. package/src/image/image.js +77 -127
  434. package/src/image/index.php +1 -6
  435. package/src/image/save.js +3 -1
  436. package/src/image/view.js +5 -2
  437. package/src/list/edit.js +27 -35
  438. package/src/list-item/block.json +10 -3
  439. package/src/list-item/edit.js +18 -2
  440. package/src/list-item/hooks/use-enter.js +63 -62
  441. package/src/list-item/hooks/use-enter.native.js +9 -5
  442. package/src/list-item/hooks/use-indent-list-item.js +43 -53
  443. package/src/list-item/hooks/use-merge.js +1 -1
  444. package/src/list-item/hooks/use-outdent-list-item.js +50 -69
  445. package/src/list-item/hooks/use-space.js +7 -4
  446. package/src/media-text/media-container.native.js +3 -1
  447. package/src/navigation/constants.js +2 -0
  448. package/src/navigation/edit/index.js +18 -3
  449. package/src/navigation/editor.scss +1 -1
  450. package/src/navigation/index.php +1 -1
  451. package/src/navigation/style.scss +18 -16
  452. package/src/navigation/view.js +29 -3
  453. package/src/navigation-link/test/__snapshots__/hooks.js.snap +6 -3
  454. package/src/page-list/convert-to-links-modal.js +2 -2
  455. package/src/paragraph/block.json +2 -4
  456. package/src/paragraph/edit.js +53 -40
  457. package/src/paragraph/test/__snapshots__/edit.native.js.snap +12 -0
  458. package/src/paragraph/test/edit.native.js +114 -0
  459. package/src/pattern/edit.js +35 -3
  460. package/src/pattern/index.php +16 -0
  461. package/src/pattern/recursion-detector.js +145 -0
  462. package/src/pattern/test/index.js +74 -0
  463. package/src/post-featured-image/block.json +4 -0
  464. package/src/post-featured-image/edit.js +32 -1
  465. package/src/post-featured-image/index.php +31 -0
  466. package/src/post-title/block.json +1 -3
  467. package/src/preformatted/block.json +2 -3
  468. package/src/pullquote/block.json +5 -7
  469. package/src/query/edit/inspector-controls/index.js +2 -0
  470. package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -0
  471. package/src/query-pagination-numbers/block.json +1 -1
  472. package/src/query-title/block.json +1 -3
  473. package/src/quote/block.json +3 -5
  474. package/src/quote/transforms.js +12 -11
  475. package/src/search/block.json +0 -4
  476. package/src/search/edit.js +2 -8
  477. package/src/search/index.php +3 -7
  478. package/src/search/style.scss +27 -29
  479. package/src/site-logo/edit.js +3 -4
  480. package/src/site-title/block.json +1 -5
  481. package/src/social-link/icons/gravatar.js +10 -0
  482. package/src/social-link/icons/index.js +1 -0
  483. package/src/social-link/index.php +5 -1
  484. package/src/social-link/socials-with-bg.scss +5 -0
  485. package/src/social-link/socials-without-bg.scss +4 -0
  486. package/src/social-link/variations.js +7 -0
  487. package/src/social-links/style.scss +14 -8
  488. package/src/spacer/edit.native.js +4 -2
  489. package/src/table/block.json +9 -10
  490. package/src/table/edit.js +3 -1
  491. package/src/table/editor.scss +1 -17
  492. package/src/table-of-contents/edit.js +1 -1
  493. package/src/table-of-contents/index.js +5 -1
  494. package/src/tag-cloud/edit.js +7 -7
  495. package/src/template-part/index.php +6 -0
  496. package/src/utils/caption.js +108 -0
  497. package/src/utils/constants.js +8 -0
  498. package/src/utils/remove-anchor-tag.js +2 -1
  499. package/src/verse/block.json +3 -5
  500. package/src/video/block.json +2 -2
  501. package/src/video/edit.js +40 -100
  502. package/src/video/edit.native.js +2 -1
  503. package/build/block/edit.native.js.map +0 -1
  504. package/build/table-of-contents/icon.js +0 -22
  505. package/build/table-of-contents/icon.js.map +0 -1
  506. package/build-module/block/edit.native.js.map +0 -1
  507. package/build-module/table-of-contents/icon.js +0 -15
  508. package/build-module/table-of-contents/icon.js.map +0 -1
  509. package/src/table-of-contents/icon.js +0 -18
package/src/file/edit.js CHANGED
@@ -63,7 +63,6 @@ function ClipboardToolbarButton( { text, disabled } ) {
63
63
  function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
64
64
  const {
65
65
  id,
66
- fileId,
67
66
  fileName,
68
67
  href,
69
68
  textLinkHref,
@@ -73,27 +72,26 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
73
72
  displayPreview,
74
73
  previewHeight,
75
74
  } = attributes;
76
- const { media, mediaUpload } = useSelect(
75
+ const { getSettings } = useSelect( blockEditorStore );
76
+ const { media } = useSelect(
77
77
  ( select ) => ( {
78
78
  media:
79
79
  id === undefined
80
80
  ? undefined
81
81
  : select( coreStore ).getMedia( id ),
82
- mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
83
82
  } ),
84
83
  [ id ]
85
84
  );
86
85
 
87
86
  const { createErrorNotice } = useDispatch( noticesStore );
88
- const { toggleSelection, __unstableMarkNextChangeAsNotPersistent } =
89
- useDispatch( blockEditorStore );
87
+ const { toggleSelection } = useDispatch( blockEditorStore );
90
88
 
91
89
  useEffect( () => {
92
90
  // Upload a file drag-and-dropped into the editor.
93
91
  if ( isBlobURL( href ) ) {
94
92
  const file = getBlobByURL( href );
95
93
 
96
- mediaUpload( {
94
+ getSettings().mediaUpload( {
97
95
  filesList: [ file ],
98
96
  onFileChange: ( [ newMedia ] ) => onSelectFile( newMedia ),
99
97
  onError: onUploadError,
@@ -102,33 +100,28 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
102
100
  revokeBlobURL( href );
103
101
  }
104
102
 
105
- if ( downloadButtonText === undefined ) {
103
+ if ( RichText.isEmpty( downloadButtonText ) ) {
106
104
  setAttributes( {
107
105
  downloadButtonText: _x( 'Download', 'button label' ),
108
106
  } );
109
107
  }
110
108
  }, [] );
111
109
 
112
- useEffect( () => {
113
- if ( ! fileId && href ) {
114
- // Add a unique fileId to each file block.
115
- __unstableMarkNextChangeAsNotPersistent();
116
- setAttributes( { fileId: `wp-block-file--media-${ clientId }` } );
117
- }
118
- }, [ href, fileId, clientId ] );
119
-
120
110
  function onSelectFile( newMedia ) {
121
- if ( newMedia && newMedia.url ) {
122
- const isPdf = newMedia.url.endsWith( '.pdf' );
123
- setAttributes( {
124
- href: newMedia.url,
125
- fileName: newMedia.title,
126
- textLinkHref: newMedia.url,
127
- id: newMedia.id,
128
- displayPreview: isPdf ? true : undefined,
129
- previewHeight: isPdf ? 600 : undefined,
130
- } );
111
+ if ( ! newMedia || ! newMedia.url ) {
112
+ return;
131
113
  }
114
+
115
+ const isPdf = newMedia.url.endsWith( '.pdf' );
116
+ setAttributes( {
117
+ href: newMedia.url,
118
+ fileName: newMedia.title,
119
+ textLinkHref: newMedia.url,
120
+ id: newMedia.id,
121
+ displayPreview: isPdf ? true : undefined,
122
+ previewHeight: isPdf ? 600 : undefined,
123
+ fileId: `wp-block-file--media-${ clientId }`,
124
+ } );
132
125
  }
133
126
 
134
127
  function onUploadError( message ) {
@@ -97,7 +97,7 @@ export class FileEdit extends Component {
97
97
  const { attributes, setAttributes } = this.props;
98
98
  const { downloadButtonText } = attributes;
99
99
 
100
- if ( downloadButtonText === undefined || downloadButtonText === '' ) {
100
+ if ( RichText.isEmpty( downloadButtonText ) ) {
101
101
  setAttributes( {
102
102
  downloadButtonText: _x( 'Download', 'button label' ),
103
103
  } );
package/src/file/save.js CHANGED
@@ -25,7 +25,11 @@ export default function save( { attributes } ) {
25
25
  previewHeight,
26
26
  } = attributes;
27
27
 
28
- const pdfEmbedLabel = RichText.isEmpty( fileName ) ? 'PDF embed' : fileName;
28
+ const pdfEmbedLabel = RichText.isEmpty( fileName )
29
+ ? 'PDF embed'
30
+ : // To do: use toPlainText, but we need ensure it's RichTextData. See
31
+ // https://github.com/WordPress/gutenberg/pull/56710.
32
+ fileName.toString();
29
33
 
30
34
  const hasFilename = ! RichText.isEmpty( fileName );
31
35
 
@@ -19,10 +19,10 @@
19
19
  "type": "string"
20
20
  },
21
21
  "label": {
22
- "type": "string",
22
+ "type": "rich-text",
23
23
  "default": "Label",
24
24
  "selector": ".wp-block-form-input__label-content",
25
- "source": "html",
25
+ "source": "rich-text",
26
26
  "__experimentalRole": "content"
27
27
  },
28
28
  "inlineLabel": {
@@ -0,0 +1,142 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classNames from 'classnames';
5
+ import removeAccents from 'remove-accents';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import {
11
+ RichText,
12
+ __experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
13
+ __experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
14
+ } from '@wordpress/block-editor';
15
+ import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
16
+
17
+ const getNameFromLabelV1 = ( content ) => {
18
+ return (
19
+ removeAccents( stripHTML( content ) )
20
+ // Convert anything that's not a letter or number to a hyphen.
21
+ .replace( /[^\p{L}\p{N}]+/gu, '-' )
22
+ // Convert to lowercase
23
+ .toLowerCase()
24
+ // Remove any remaining leading or trailing hyphens.
25
+ .replace( /(^-+)|(-+$)/g, '' )
26
+ );
27
+ };
28
+
29
+ // Version without wrapper div in saved markup
30
+ // See: https://github.com/WordPress/gutenberg/pull/56507
31
+ const v1 = {
32
+ attributes: {
33
+ type: {
34
+ type: 'string',
35
+ default: 'text',
36
+ },
37
+ name: {
38
+ type: 'string',
39
+ },
40
+ label: {
41
+ type: 'string',
42
+ default: 'Label',
43
+ selector: '.wp-block-form-input__label-content',
44
+ source: 'html',
45
+ __experimentalRole: 'content',
46
+ },
47
+ inlineLabel: {
48
+ type: 'boolean',
49
+ default: false,
50
+ },
51
+ required: {
52
+ type: 'boolean',
53
+ default: false,
54
+ selector: '.wp-block-form-input__input',
55
+ source: 'attribute',
56
+ attribute: 'required',
57
+ },
58
+ placeholder: {
59
+ type: 'string',
60
+ selector: '.wp-block-form-input__input',
61
+ source: 'attribute',
62
+ attribute: 'placeholder',
63
+ __experimentalRole: 'content',
64
+ },
65
+ value: {
66
+ type: 'string',
67
+ default: '',
68
+ selector: 'input',
69
+ source: 'attribute',
70
+ attribute: 'value',
71
+ },
72
+ visibilityPermissions: {
73
+ type: 'string',
74
+ default: 'all',
75
+ },
76
+ },
77
+ supports: {
78
+ className: false,
79
+ anchor: true,
80
+ reusable: false,
81
+ spacing: {
82
+ margin: [ 'top', 'bottom' ],
83
+ },
84
+ __experimentalBorder: {
85
+ radius: true,
86
+ __experimentalSkipSerialization: true,
87
+ __experimentalDefaultControls: {
88
+ radius: true,
89
+ },
90
+ },
91
+ },
92
+ save( { attributes } ) {
93
+ const { type, name, label, inlineLabel, required, placeholder, value } =
94
+ attributes;
95
+
96
+ const borderProps = getBorderClassesAndStyles( attributes );
97
+ const colorProps = getColorClassesAndStyles( attributes );
98
+
99
+ const inputStyle = {
100
+ ...borderProps.style,
101
+ ...colorProps.style,
102
+ };
103
+
104
+ const inputClasses = classNames(
105
+ 'wp-block-form-input__input',
106
+ colorProps.className,
107
+ borderProps.className
108
+ );
109
+ const TagName = type === 'textarea' ? 'textarea' : 'input';
110
+
111
+ if ( 'hidden' === type ) {
112
+ return <input type={ type } name={ name } value={ value } />;
113
+ }
114
+
115
+ /* eslint-disable jsx-a11y/label-has-associated-control */
116
+ return (
117
+ <label
118
+ className={ classNames( 'wp-block-form-input__label', {
119
+ 'is-label-inline': inlineLabel,
120
+ } ) }
121
+ >
122
+ <span className="wp-block-form-input__label-content">
123
+ <RichText.Content value={ label } />
124
+ </span>
125
+ <TagName
126
+ className={ inputClasses }
127
+ type={ 'textarea' === type ? undefined : type }
128
+ name={ name || getNameFromLabelV1( label ) }
129
+ required={ required }
130
+ aria-required={ required }
131
+ placeholder={ placeholder || undefined }
132
+ style={ inputStyle }
133
+ />
134
+ </label>
135
+ );
136
+ /* eslint-enable jsx-a11y/label-has-associated-control */
137
+ },
138
+ };
139
+
140
+ const deprecated = [ v1 ];
141
+
142
+ export default deprecated;
@@ -59,7 +59,7 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
59
59
  </PanelBody>
60
60
  </InspectorControls>
61
61
  ) }
62
- <InspectorControls __experimentalGroup="advanced">
62
+ <InspectorControls group="advanced">
63
63
  <TextControl
64
64
  autoComplete="off"
65
65
  label={ __( 'Name' ) }
@@ -2,6 +2,7 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import initBlock from '../utils/init-block';
5
+ import deprecated from './deprecated';
5
6
  import edit from './edit';
6
7
  import metadata from './block.json';
7
8
  import save from './save';
@@ -12,6 +13,7 @@ const { name } = metadata;
12
13
  export { metadata, name };
13
14
 
14
15
  export const settings = {
16
+ deprecated,
15
17
  edit,
16
18
  save,
17
19
  variations,
@@ -9,9 +9,11 @@ import removeAccents from 'remove-accents';
9
9
  */
10
10
  import {
11
11
  RichText,
12
+ useBlockProps,
12
13
  __experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
13
14
  __experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
14
15
  } from '@wordpress/block-editor';
16
+ import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
15
17
 
16
18
  /**
17
19
  * Get the name attribute from a content string.
@@ -21,11 +23,8 @@ import {
21
23
  * @return {string} Returns the slug.
22
24
  */
23
25
  const getNameFromLabel = ( content ) => {
24
- const dummyElement = document.createElement( 'div' );
25
- dummyElement.innerHTML = content;
26
- // Get the slug.
27
26
  return (
28
- removeAccents( dummyElement.innerText )
27
+ removeAccents( stripHTML( content ) )
29
28
  // Convert anything that's not a letter or number to a hyphen.
30
29
  .replace( /[^\p{L}\p{N}]+/gu, '-' )
31
30
  // Convert to lowercase
@@ -54,30 +53,34 @@ export default function save( { attributes } ) {
54
53
  );
55
54
  const TagName = type === 'textarea' ? 'textarea' : 'input';
56
55
 
56
+ const blockProps = useBlockProps.save();
57
+
57
58
  if ( 'hidden' === type ) {
58
59
  return <input type={ type } name={ name } value={ value } />;
59
60
  }
60
61
 
61
- /* eslint-disable jsx-a11y/label-has-associated-control */
62
62
  return (
63
- <label
64
- className={ classNames( 'wp-block-form-input__label', {
65
- 'is-label-inline': inlineLabel,
66
- } ) }
67
- >
68
- <span className="wp-block-form-input__label-content">
69
- <RichText.Content value={ label } />
70
- </span>
71
- <TagName
72
- className={ inputClasses }
73
- type={ 'textarea' === type ? undefined : type }
74
- name={ name || getNameFromLabel( label ) }
75
- required={ required }
76
- aria-required={ required }
77
- placeholder={ placeholder || undefined }
78
- style={ inputStyle }
79
- />
80
- </label>
63
+ <div { ...blockProps }>
64
+ { /* eslint-disable jsx-a11y/label-has-associated-control */ }
65
+ <label
66
+ className={ classNames( 'wp-block-form-input__label', {
67
+ 'is-label-inline': inlineLabel,
68
+ } ) }
69
+ >
70
+ <span className="wp-block-form-input__label-content">
71
+ <RichText.Content value={ label } />
72
+ </span>
73
+ <TagName
74
+ className={ inputClasses }
75
+ type={ 'textarea' === type ? undefined : type }
76
+ name={ name || getNameFromLabel( label ) }
77
+ required={ required }
78
+ aria-required={ required }
79
+ placeholder={ placeholder || undefined }
80
+ style={ inputStyle }
81
+ />
82
+ </label>
83
+ { /* eslint-enable jsx-a11y/label-has-associated-control */ }
84
+ </div>
81
85
  );
82
- /* eslint-enable jsx-a11y/label-has-associated-control */
83
86
  }
@@ -46,8 +46,8 @@
46
46
  "attribute": "data-id"
47
47
  },
48
48
  "caption": {
49
- "type": "string",
50
- "source": "html",
49
+ "type": "rich-text",
50
+ "source": "rich-text",
51
51
  "selector": ".blocks-gallery-item__caption"
52
52
  }
53
53
  }
@@ -72,14 +72,18 @@
72
72
  "maximum": 8
73
73
  },
74
74
  "caption": {
75
- "type": "string",
76
- "source": "html",
75
+ "type": "rich-text",
76
+ "source": "rich-text",
77
77
  "selector": ".blocks-gallery-caption"
78
78
  },
79
79
  "imageCrop": {
80
80
  "type": "boolean",
81
81
  "default": true
82
82
  },
83
+ "randomOrder": {
84
+ "type": "boolean",
85
+ "default": false
86
+ },
83
87
  "fixedHeight": {
84
88
  "type": "boolean",
85
89
  "default": true
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { compose, usePrevious } from '@wordpress/compose';
9
+ import { compose } from '@wordpress/compose';
10
10
  import {
11
11
  BaseControl,
12
12
  PanelBody,
@@ -14,7 +14,6 @@ import {
14
14
  ToggleControl,
15
15
  RangeControl,
16
16
  Spinner,
17
- ToolbarButton,
18
17
  } from '@wordpress/components';
19
18
  import {
20
19
  store as blockEditorStore,
@@ -25,13 +24,7 @@ import {
25
24
  BlockControls,
26
25
  MediaReplaceFlow,
27
26
  } from '@wordpress/block-editor';
28
- import {
29
- Platform,
30
- useCallback,
31
- useEffect,
32
- useState,
33
- useMemo,
34
- } from '@wordpress/element';
27
+ import { Platform, useEffect, useMemo } from '@wordpress/element';
35
28
  import { __, _x, sprintf } from '@wordpress/i18n';
36
29
  import { useSelect, useDispatch } from '@wordpress/data';
37
30
  import { withViewportMatch } from '@wordpress/viewport';
@@ -39,7 +32,6 @@ import { View } from '@wordpress/primitives';
39
32
  import { createBlock } from '@wordpress/blocks';
40
33
  import { createBlobURL } from '@wordpress/blob';
41
34
  import { store as noticesStore } from '@wordpress/notices';
42
- import { caption as captionIcon } from '@wordpress/icons';
43
35
 
44
36
  /**
45
37
  * Internal dependencies
@@ -82,6 +74,8 @@ const MOBILE_CONTROL_PROPS_RANGE_CONTROL = Platform.isNative
82
74
  ? { type: 'stepper' }
83
75
  : {};
84
76
 
77
+ const EMPTY_ARRAY = [];
78
+
85
79
  function GalleryEdit( props ) {
86
80
  const {
87
81
  setAttributes,
@@ -94,34 +88,8 @@ function GalleryEdit( props ) {
94
88
  onFocus,
95
89
  } = props;
96
90
 
97
- const { columns, imageCrop, linkTarget, linkTo, sizeSlug, caption } =
91
+ const { columns, imageCrop, randomOrder, linkTarget, linkTo, sizeSlug } =
98
92
  attributes;
99
- const [ showCaption, setShowCaption ] = useState( !! caption );
100
- const prevCaption = usePrevious( caption );
101
-
102
- // We need to show the caption when changes come from
103
- // history navigation(undo/redo).
104
- useEffect( () => {
105
- if ( caption && ! prevCaption ) {
106
- setShowCaption( true );
107
- }
108
- }, [ caption, prevCaption ] );
109
-
110
- useEffect( () => {
111
- if ( ! isSelected && ! caption ) {
112
- setShowCaption( false );
113
- }
114
- }, [ isSelected, caption ] );
115
-
116
- // Focus the caption when we click to add one.
117
- const captionRef = useCallback(
118
- ( node ) => {
119
- if ( node && ! caption ) {
120
- node.focus();
121
- }
122
- },
123
- [ caption ]
124
- );
125
93
 
126
94
  const {
127
95
  __unstableMarkNextChangeAsNotPersistent,
@@ -132,33 +100,44 @@ function GalleryEdit( props ) {
132
100
  const { createSuccessNotice, createErrorNotice } =
133
101
  useDispatch( noticesStore );
134
102
 
135
- const { getBlock, getSettings, preferredStyle } = useSelect( ( select ) => {
136
- const settings = select( blockEditorStore ).getSettings();
137
- const preferredStyleVariations =
138
- settings.__experimentalPreferredStyleVariations;
139
- return {
140
- getBlock: select( blockEditorStore ).getBlock,
141
- getSettings: select( blockEditorStore ).getSettings,
142
- preferredStyle: preferredStyleVariations?.value?.[ 'core/image' ],
143
- };
144
- }, [] );
145
-
146
- const innerBlockImages = useSelect(
147
- ( select ) => {
148
- const innerBlocks =
149
- select( blockEditorStore ).getBlock( clientId )?.innerBlocks ??
150
- [];
151
- return innerBlocks;
152
- },
153
- [ clientId ]
154
- );
155
-
156
- const wasBlockJustInserted = useSelect(
103
+ const {
104
+ getBlock,
105
+ getSettings,
106
+ preferredStyle,
107
+ innerBlockImages,
108
+ blockWasJustInserted,
109
+ multiGallerySelection,
110
+ } = useSelect(
157
111
  ( select ) => {
158
- return select( blockEditorStore ).wasBlockJustInserted(
159
- clientId,
160
- 'inserter_menu'
161
- );
112
+ const {
113
+ getBlockName,
114
+ getMultiSelectedBlockClientIds,
115
+ getSettings: _getSettings,
116
+ getBlock: _getBlock,
117
+ wasBlockJustInserted,
118
+ } = select( blockEditorStore );
119
+ const preferredStyleVariations =
120
+ _getSettings().__experimentalPreferredStyleVariations;
121
+ const multiSelectedClientIds = getMultiSelectedBlockClientIds();
122
+
123
+ return {
124
+ getBlock: _getBlock,
125
+ getSettings: _getSettings,
126
+ preferredStyle:
127
+ preferredStyleVariations?.value?.[ 'core/image' ],
128
+ innerBlockImages:
129
+ _getBlock( clientId )?.innerBlocks ?? EMPTY_ARRAY,
130
+ blockWasJustInserted: wasBlockJustInserted(
131
+ clientId,
132
+ 'inserter_menu'
133
+ ),
134
+ multiGallerySelection:
135
+ multiSelectedClientIds.length &&
136
+ multiSelectedClientIds.every(
137
+ ( _clientId ) =>
138
+ getBlockName( _clientId ) === 'core/gallery'
139
+ ),
140
+ };
162
141
  },
163
142
  [ clientId ]
164
143
  );
@@ -410,6 +389,10 @@ function GalleryEdit( props ) {
410
389
  : __( 'Thumbnails are not cropped.' );
411
390
  }
412
391
 
392
+ function toggleRandomOrder() {
393
+ setAttributes( { randomOrder: ! randomOrder } );
394
+ }
395
+
413
396
  function toggleOpenInNewTab( openInNewTab ) {
414
397
  const newLinkTarget = openInNewTab ? '_blank' : undefined;
415
398
  setAttributes( { linkTarget: newLinkTarget } );
@@ -498,7 +481,7 @@ function GalleryEdit( props ) {
498
481
  ( hasImages && ! isSelected ) || imagesUploading,
499
482
  value: hasImageIds ? images : {},
500
483
  autoOpenMediaUpload:
501
- ! hasImages && isSelected && wasBlockJustInserted,
484
+ ! hasImages && isSelected && blockWasJustInserted,
502
485
  onFocus,
503
486
  },
504
487
  } );
@@ -574,6 +557,12 @@ function GalleryEdit( props ) {
574
557
  onChange={ toggleImageCrop }
575
558
  help={ getImageCropHelp }
576
559
  />
560
+ <ToggleControl
561
+ __nextHasNoMarginBottom
562
+ label={ __( 'Random order' ) }
563
+ checked={ !! randomOrder }
564
+ onChange={ toggleRandomOrder }
565
+ />
577
566
  <SelectControl
578
567
  __nextHasNoMarginBottom
579
568
  label={ __( 'Link to' ) }
@@ -620,39 +609,22 @@ function GalleryEdit( props ) {
620
609
  </InspectorControls>
621
610
  { Platform.isWeb && (
622
611
  <>
623
- <BlockControls group="block">
624
- { ! isContentLocked && (
625
- <ToolbarButton
626
- onClick={ () => {
627
- setShowCaption( ! showCaption );
628
- if ( showCaption && caption ) {
629
- setAttributes( { caption: undefined } );
630
- }
631
- } }
632
- icon={ captionIcon }
633
- isPressed={ showCaption }
634
- label={
635
- showCaption
636
- ? __( 'Remove caption' )
637
- : __( 'Add caption' )
638
- }
612
+ { ! multiGallerySelection && (
613
+ <BlockControls group="other">
614
+ <MediaReplaceFlow
615
+ allowedTypes={ ALLOWED_MEDIA_TYPES }
616
+ accept="image/*"
617
+ handleUpload={ false }
618
+ onSelect={ updateImages }
619
+ name={ __( 'Add' ) }
620
+ multiple={ true }
621
+ mediaIds={ images
622
+ .filter( ( image ) => image.id )
623
+ .map( ( image ) => image.id ) }
624
+ addToGallery={ hasImageIds }
639
625
  />
640
- ) }
641
- </BlockControls>
642
- <BlockControls group="other">
643
- <MediaReplaceFlow
644
- allowedTypes={ ALLOWED_MEDIA_TYPES }
645
- accept="image/*"
646
- handleUpload={ false }
647
- onSelect={ updateImages }
648
- name={ __( 'Add' ) }
649
- multiple={ true }
650
- mediaIds={ images
651
- .filter( ( image ) => image.id )
652
- .map( ( image ) => image.id ) }
653
- addToGallery={ hasImageIds }
654
- />
655
- </BlockControls>
626
+ </BlockControls>
627
+ ) }
656
628
  <GapStyles
657
629
  blockGap={ attributes.style?.spacing?.blockGap }
658
630
  clientId={ clientId }
@@ -661,8 +633,7 @@ function GalleryEdit( props ) {
661
633
  ) }
662
634
  <Gallery
663
635
  { ...props }
664
- showCaption={ showCaption }
665
- ref={ Platform.isWeb ? captionRef : undefined }
636
+ isContentLocked={ isContentLocked }
666
637
  images={ images }
667
638
  mediaPlaceholder={
668
639
  ! hasImages || Platform.isNative
@@ -671,6 +642,7 @@ function GalleryEdit( props ) {
671
642
  }
672
643
  blockProps={ innerBlocksProps }
673
644
  insertBlocksAfter={ insertBlocksAfter }
645
+ multiGallerySelection={ multiGallerySelection }
674
646
  />
675
647
  </>
676
648
  );