@wordpress/block-library 7.16.0 → 7.18.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 (419) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/build/archives/edit.js +1 -0
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/audio/edit.js +44 -4
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/buttons/edit.native.js +1 -1
  9. package/build/buttons/edit.native.js.map +1 -1
  10. package/build/comment-template/edit.js +40 -32
  11. package/build/comment-template/edit.js.map +1 -1
  12. package/build/comment-template/index.js +6 -2
  13. package/build/comment-template/index.js.map +1 -1
  14. package/build/comments/edit/placeholder.js +1 -4
  15. package/build/comments/edit/placeholder.js.map +1 -1
  16. package/build/comments/index.js +5 -1
  17. package/build/comments/index.js.map +1 -1
  18. package/build/comments-title/edit.js +18 -1
  19. package/build/comments-title/edit.js.map +1 -1
  20. package/build/cover/edit/index.js +2 -2
  21. package/build/cover/edit/index.js.map +1 -1
  22. package/build/cover/edit/inspector-controls.js +3 -7
  23. package/build/cover/edit/inspector-controls.js.map +1 -1
  24. package/build/cover/edit/use-cover-is-dark.js +8 -7
  25. package/build/cover/edit/use-cover-is-dark.js.map +1 -1
  26. package/build/embed/deprecated.js +43 -4
  27. package/build/embed/deprecated.js.map +1 -1
  28. package/build/embed/variations.js +1 -1
  29. package/build/embed/variations.js.map +1 -1
  30. package/build/file/deprecated.js +108 -4
  31. package/build/file/deprecated.js.map +1 -1
  32. package/build/file/transforms.js +3 -9
  33. package/build/file/transforms.js.map +1 -1
  34. package/build/gallery/deprecated.js +148 -23
  35. package/build/gallery/deprecated.js.map +1 -1
  36. package/build/gallery/gallery.js +3 -2
  37. package/build/gallery/gallery.js.map +1 -1
  38. package/build/gallery/transforms.js +3 -3
  39. package/build/gallery/transforms.js.map +1 -1
  40. package/build/gallery/use-image-sizes.js +2 -1
  41. package/build/gallery/use-image-sizes.js.map +1 -1
  42. package/build/gallery/v1/edit.js +3 -2
  43. package/build/gallery/v1/edit.js.map +1 -1
  44. package/build/group/edit.js +7 -3
  45. package/build/group/edit.js.map +1 -1
  46. package/build/image/edit.native.js +1 -1
  47. package/build/image/edit.native.js.map +1 -1
  48. package/build/image/image.js +33 -12
  49. package/build/image/image.js.map +1 -1
  50. package/build/image/transforms.js +1 -7
  51. package/build/image/transforms.js.map +1 -1
  52. package/build/latest-posts/edit.js +1 -1
  53. package/build/latest-posts/edit.js.map +1 -1
  54. package/build/list/transforms.js +9 -1
  55. package/build/list/transforms.js.map +1 -1
  56. package/build/list/utils.js +4 -8
  57. package/build/list/utils.js.map +1 -1
  58. package/build/list-item/edit.js +3 -2
  59. package/build/list-item/edit.js.map +1 -1
  60. package/build/list-item/edit.native.js +3 -2
  61. package/build/list-item/edit.native.js.map +1 -1
  62. package/build/list-item/hooks/use-merge.js +19 -22
  63. package/build/list-item/hooks/use-merge.js.map +1 -1
  64. package/build/list-item/hooks/use-outdent-list-item.js +24 -10
  65. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  66. package/build/list-item/index.js +14 -1
  67. package/build/list-item/index.js.map +1 -1
  68. package/build/list-item/utils.js +14 -1
  69. package/build/list-item/utils.js.map +1 -1
  70. package/build/navigation/edit/index.js +45 -31
  71. package/build/navigation/edit/index.js.map +1 -1
  72. package/build/navigation/edit/inner-blocks.js +3 -5
  73. package/build/navigation/edit/inner-blocks.js.map +1 -1
  74. package/build/navigation/edit/unsaved-inner-blocks.js +3 -1
  75. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  76. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  77. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  78. package/build/navigation/edit/use-create-navigation-menu.js +1 -1
  79. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  80. package/build/navigation/index.js +4 -1
  81. package/build/navigation/index.js.map +1 -1
  82. package/build/navigation-link/edit.js +5 -3
  83. package/build/navigation-link/edit.js.map +1 -1
  84. package/build/navigation-submenu/edit.js +4 -4
  85. package/build/navigation-submenu/edit.js.map +1 -1
  86. package/build/page-list/edit.js +29 -10
  87. package/build/page-list/edit.js.map +1 -1
  88. package/build/page-list/index.js +1 -5
  89. package/build/page-list/index.js.map +1 -1
  90. package/build/paragraph/edit.js +3 -11
  91. package/build/paragraph/edit.js.map +1 -1
  92. package/build/pattern/edit.js +11 -4
  93. package/build/pattern/edit.js.map +1 -1
  94. package/build/post-comments-count/index.js +4 -0
  95. package/build/post-comments-count/index.js.map +1 -1
  96. package/build/post-comments-form/form.js +1 -2
  97. package/build/post-comments-form/form.js.map +1 -1
  98. package/build/post-comments-form/index.js +4 -0
  99. package/build/post-comments-form/index.js.map +1 -1
  100. package/build/post-comments-link/index.js +4 -0
  101. package/build/post-comments-link/index.js.map +1 -1
  102. package/build/post-content/edit.js +14 -6
  103. package/build/post-content/edit.js.map +1 -1
  104. package/build/pullquote/deprecated.js +6 -6
  105. package/build/pullquote/deprecated.js.map +1 -1
  106. package/build/query/edit/inspector-controls/index.js +2 -2
  107. package/build/query/edit/inspector-controls/index.js.map +1 -1
  108. package/build/query/edit/inspector-controls/taxonomy-controls.js +79 -104
  109. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  110. package/build/search/edit.js +3 -4
  111. package/build/search/edit.js.map +1 -1
  112. package/build/site-logo/edit.js +7 -10
  113. package/build/site-logo/edit.js.map +1 -1
  114. package/build/site-tagline/edit.js +21 -9
  115. package/build/site-tagline/edit.js.map +1 -1
  116. package/build/site-title/edit/index.js +20 -8
  117. package/build/site-title/edit/index.js.map +1 -1
  118. package/build/social-link/edit.js +11 -2
  119. package/build/social-link/edit.js.map +1 -1
  120. package/build/social-link/index.js +3 -0
  121. package/build/social-link/index.js.map +1 -1
  122. package/build/spacer/controls.js +3 -7
  123. package/build/spacer/controls.js.map +1 -1
  124. package/build/table/deprecated.js +282 -27
  125. package/build/table/deprecated.js.map +1 -1
  126. package/build/table/state.js +2 -2
  127. package/build/table/state.js.map +1 -1
  128. package/build/table-of-contents/edit.js +1 -4
  129. package/build/table-of-contents/edit.js.map +1 -1
  130. package/build/tag-cloud/edit.js +1 -1
  131. package/build/tag-cloud/edit.js.map +1 -1
  132. package/build/tag-cloud/index.js +8 -0
  133. package/build/tag-cloud/index.js.map +1 -1
  134. package/build/utils/clean-empty-object.js +5 -4
  135. package/build/utils/clean-empty-object.js.map +1 -1
  136. package/build/video/deprecated.js +159 -0
  137. package/build/video/deprecated.js.map +1 -0
  138. package/build/video/edit.js +41 -5
  139. package/build/video/edit.js.map +1 -1
  140. package/build/video/index.js +3 -0
  141. package/build/video/index.js.map +1 -1
  142. package/build/video/tracks-editor.js +3 -28
  143. package/build/video/tracks-editor.js.map +1 -1
  144. package/build-module/archives/edit.js +1 -0
  145. package/build-module/archives/edit.js.map +1 -1
  146. package/build-module/audio/edit.js +46 -7
  147. package/build-module/audio/edit.js.map +1 -1
  148. package/build-module/button/edit.js +1 -1
  149. package/build-module/button/edit.js.map +1 -1
  150. package/build-module/buttons/edit.native.js +1 -1
  151. package/build-module/buttons/edit.native.js.map +1 -1
  152. package/build-module/comment-template/edit.js +38 -30
  153. package/build-module/comment-template/edit.js.map +1 -1
  154. package/build-module/comment-template/index.js +6 -2
  155. package/build-module/comment-template/index.js.map +1 -1
  156. package/build-module/comments/edit/placeholder.js +1 -3
  157. package/build-module/comments/edit/placeholder.js.map +1 -1
  158. package/build-module/comments/index.js +5 -1
  159. package/build-module/comments/index.js.map +1 -1
  160. package/build-module/comments-title/edit.js +18 -2
  161. package/build-module/comments-title/edit.js.map +1 -1
  162. package/build-module/cover/edit/index.js +2 -2
  163. package/build-module/cover/edit/index.js.map +1 -1
  164. package/build-module/cover/edit/inspector-controls.js +4 -8
  165. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  166. package/build-module/cover/edit/use-cover-is-dark.js +7 -7
  167. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
  168. package/build-module/embed/deprecated.js +44 -5
  169. package/build-module/embed/deprecated.js.map +1 -1
  170. package/build-module/embed/variations.js +1 -1
  171. package/build-module/embed/variations.js.map +1 -1
  172. package/build-module/file/deprecated.js +108 -4
  173. package/build-module/file/deprecated.js.map +1 -1
  174. package/build-module/file/transforms.js +3 -8
  175. package/build-module/file/transforms.js.map +1 -1
  176. package/build-module/gallery/deprecated.js +147 -25
  177. package/build-module/gallery/deprecated.js.map +1 -1
  178. package/build-module/gallery/gallery.js +3 -2
  179. package/build-module/gallery/gallery.js.map +1 -1
  180. package/build-module/gallery/transforms.js +4 -4
  181. package/build-module/gallery/transforms.js.map +1 -1
  182. package/build-module/gallery/use-image-sizes.js +3 -2
  183. package/build-module/gallery/use-image-sizes.js.map +1 -1
  184. package/build-module/gallery/v1/edit.js +4 -3
  185. package/build-module/gallery/v1/edit.js.map +1 -1
  186. package/build-module/group/edit.js +7 -3
  187. package/build-module/group/edit.js.map +1 -1
  188. package/build-module/image/edit.native.js +1 -1
  189. package/build-module/image/edit.native.js.map +1 -1
  190. package/build-module/image/image.js +36 -15
  191. package/build-module/image/image.js.map +1 -1
  192. package/build-module/image/transforms.js +1 -6
  193. package/build-module/image/transforms.js.map +1 -1
  194. package/build-module/latest-posts/edit.js +2 -2
  195. package/build-module/latest-posts/edit.js.map +1 -1
  196. package/build-module/list/transforms.js +9 -1
  197. package/build-module/list/transforms.js.map +1 -1
  198. package/build-module/list/utils.js +5 -9
  199. package/build-module/list/utils.js.map +1 -1
  200. package/build-module/list-item/edit.js +3 -2
  201. package/build-module/list-item/edit.js.map +1 -1
  202. package/build-module/list-item/edit.native.js +3 -2
  203. package/build-module/list-item/edit.native.js.map +1 -1
  204. package/build-module/list-item/hooks/use-merge.js +19 -21
  205. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  206. package/build-module/list-item/hooks/use-outdent-list-item.js +24 -9
  207. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  208. package/build-module/list-item/index.js +14 -1
  209. package/build-module/list-item/index.js.map +1 -1
  210. package/build-module/list-item/utils.js +14 -1
  211. package/build-module/list-item/utils.js.map +1 -1
  212. package/build-module/navigation/edit/index.js +45 -31
  213. package/build-module/navigation/edit/index.js.map +1 -1
  214. package/build-module/navigation/edit/inner-blocks.js +3 -5
  215. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  216. package/build-module/navigation/edit/unsaved-inner-blocks.js +3 -1
  217. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  218. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  219. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  220. package/build-module/navigation/edit/use-create-navigation-menu.js +1 -1
  221. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  222. package/build-module/navigation/index.js +4 -1
  223. package/build-module/navigation/index.js.map +1 -1
  224. package/build-module/navigation-link/edit.js +5 -4
  225. package/build-module/navigation-link/edit.js.map +1 -1
  226. package/build-module/navigation-submenu/edit.js +4 -4
  227. package/build-module/navigation-submenu/edit.js.map +1 -1
  228. package/build-module/page-list/edit.js +29 -10
  229. package/build-module/page-list/edit.js.map +1 -1
  230. package/build-module/page-list/index.js +1 -5
  231. package/build-module/page-list/index.js.map +1 -1
  232. package/build-module/paragraph/edit.js +3 -10
  233. package/build-module/paragraph/edit.js.map +1 -1
  234. package/build-module/pattern/edit.js +10 -3
  235. package/build-module/pattern/edit.js.map +1 -1
  236. package/build-module/post-comments-count/index.js +4 -0
  237. package/build-module/post-comments-count/index.js.map +1 -1
  238. package/build-module/post-comments-form/form.js +2 -3
  239. package/build-module/post-comments-form/form.js.map +1 -1
  240. package/build-module/post-comments-form/index.js +4 -0
  241. package/build-module/post-comments-form/index.js.map +1 -1
  242. package/build-module/post-comments-link/index.js +4 -0
  243. package/build-module/post-comments-link/index.js.map +1 -1
  244. package/build-module/post-content/edit.js +14 -6
  245. package/build-module/post-content/edit.js.map +1 -1
  246. package/build-module/pullquote/deprecated.js +7 -7
  247. package/build-module/pullquote/deprecated.js.map +1 -1
  248. package/build-module/query/edit/inspector-controls/index.js +4 -4
  249. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  250. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +81 -102
  251. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  252. package/build-module/search/edit.js +4 -5
  253. package/build-module/search/edit.js.map +1 -1
  254. package/build-module/site-logo/edit.js +8 -11
  255. package/build-module/site-logo/edit.js.map +1 -1
  256. package/build-module/site-tagline/edit.js +23 -11
  257. package/build-module/site-tagline/edit.js.map +1 -1
  258. package/build-module/site-title/edit/index.js +22 -10
  259. package/build-module/site-title/edit/index.js.map +1 -1
  260. package/build-module/social-link/edit.js +11 -2
  261. package/build-module/social-link/edit.js.map +1 -1
  262. package/build-module/social-link/index.js +3 -0
  263. package/build-module/social-link/index.js.map +1 -1
  264. package/build-module/spacer/controls.js +4 -8
  265. package/build-module/spacer/controls.js.map +1 -1
  266. package/build-module/table/deprecated.js +282 -27
  267. package/build-module/table/deprecated.js.map +1 -1
  268. package/build-module/table/state.js +3 -3
  269. package/build-module/table/state.js.map +1 -1
  270. package/build-module/table-of-contents/edit.js +1 -3
  271. package/build-module/table-of-contents/edit.js.map +1 -1
  272. package/build-module/tag-cloud/edit.js +1 -1
  273. package/build-module/tag-cloud/edit.js.map +1 -1
  274. package/build-module/tag-cloud/index.js +8 -0
  275. package/build-module/tag-cloud/index.js.map +1 -1
  276. package/build-module/utils/clean-empty-object.js +5 -5
  277. package/build-module/utils/clean-empty-object.js.map +1 -1
  278. package/build-module/video/deprecated.js +147 -0
  279. package/build-module/video/deprecated.js.map +1 -0
  280. package/build-module/video/edit.js +45 -9
  281. package/build-module/video/edit.js.map +1 -1
  282. package/build-module/video/index.js +2 -0
  283. package/build-module/video/index.js.map +1 -1
  284. package/build-module/video/tracks-editor.js +4 -29
  285. package/build-module/video/tracks-editor.js.map +1 -1
  286. package/build-style/archives/style-rtl.css +4 -0
  287. package/build-style/archives/style.css +4 -0
  288. package/build-style/button/style-rtl.css +1 -0
  289. package/build-style/button/style.css +1 -0
  290. package/build-style/comment-template/style-rtl.css +1 -0
  291. package/build-style/comment-template/style.css +1 -0
  292. package/build-style/comments/editor-rtl.css +1 -0
  293. package/build-style/comments/editor.css +1 -0
  294. package/build-style/comments/style-rtl.css +1 -0
  295. package/build-style/comments/style.css +1 -0
  296. package/build-style/cover/editor-rtl.css +4 -0
  297. package/build-style/cover/editor.css +4 -0
  298. package/build-style/editor-rtl.css +13 -21
  299. package/build-style/editor.css +13 -21
  300. package/build-style/group/editor-rtl.css +1 -0
  301. package/build-style/group/editor.css +1 -0
  302. package/build-style/image/editor-rtl.css +1 -1
  303. package/build-style/image/editor.css +1 -1
  304. package/build-style/navigation/editor-rtl.css +5 -4
  305. package/build-style/navigation/editor.css +5 -4
  306. package/build-style/navigation/style-rtl.css +3 -1
  307. package/build-style/navigation/style.css +3 -1
  308. package/build-style/paragraph/editor-rtl.css +0 -16
  309. package/build-style/paragraph/editor.css +0 -16
  310. package/build-style/post-comments-form/style-rtl.css +3 -0
  311. package/build-style/post-comments-form/style.css +3 -0
  312. package/build-style/site-logo/editor-rtl.css +1 -0
  313. package/build-style/site-logo/editor.css +1 -0
  314. package/build-style/style-rtl.css +16 -1
  315. package/build-style/style.css +16 -1
  316. package/build-style/tag-cloud/style-rtl.css +3 -0
  317. package/build-style/tag-cloud/style.css +3 -0
  318. package/package.json +29 -28
  319. package/src/archives/edit.js +1 -0
  320. package/src/archives/style.scss +5 -0
  321. package/src/audio/edit.js +79 -24
  322. package/src/avatar/index.php +1 -1
  323. package/src/button/edit.js +1 -1
  324. package/src/button/style.scss +2 -0
  325. package/src/buttons/edit.native.js +1 -1
  326. package/src/code/test/__snapshots__/edit.native.js.snap +13 -0
  327. package/src/code/test/edit.native.js +46 -32
  328. package/src/comment-template/block.json +6 -2
  329. package/src/comment-template/edit.js +47 -34
  330. package/src/comment-template/style.scss +2 -0
  331. package/src/comments/block.json +5 -1
  332. package/src/comments/edit/placeholder.js +1 -7
  333. package/src/comments/style.scss +2 -0
  334. package/src/comments-title/edit.js +24 -1
  335. package/src/cover/edit/index.js +2 -7
  336. package/src/cover/edit/inspector-controls.js +11 -13
  337. package/src/cover/edit/use-cover-is-dark.js +11 -11
  338. package/src/cover/editor.scss +7 -0
  339. package/src/embed/deprecated.js +53 -26
  340. package/src/embed/variations.js +1 -1
  341. package/src/file/deprecated.js +130 -2
  342. package/src/file/transforms.js +3 -8
  343. package/src/gallery/deprecated.js +129 -4
  344. package/src/gallery/gallery.js +2 -0
  345. package/src/gallery/index.php +19 -10
  346. package/src/gallery/transforms.js +8 -5
  347. package/src/gallery/use-image-sizes.js +3 -2
  348. package/src/gallery/v1/edit.js +4 -3
  349. package/src/group/edit.js +10 -2
  350. package/src/group/editor.scss +1 -0
  351. package/src/image/edit.native.js +1 -1
  352. package/src/image/editor.scss +4 -1
  353. package/src/image/image.js +75 -33
  354. package/src/image/transforms.js +1 -7
  355. package/src/latest-posts/edit.js +2 -2
  356. package/src/list/test/edit.native.js +102 -3
  357. package/src/list/transforms.js +11 -0
  358. package/src/list/utils.js +3 -11
  359. package/src/list-item/block.json +14 -1
  360. package/src/list-item/edit.js +2 -1
  361. package/src/list-item/edit.native.js +2 -1
  362. package/src/list-item/hooks/use-merge.js +4 -23
  363. package/src/list-item/hooks/use-outdent-list-item.js +9 -8
  364. package/src/navigation/block.json +4 -1
  365. package/src/navigation/edit/index.js +61 -37
  366. package/src/navigation/edit/inner-blocks.js +2 -5
  367. package/src/navigation/edit/unsaved-inner-blocks.js +9 -2
  368. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +32 -5
  369. package/src/navigation/edit/use-create-navigation-menu.js +2 -5
  370. package/src/navigation/editor.scss +5 -4
  371. package/src/navigation/index.php +103 -6
  372. package/src/navigation/style.scss +3 -1
  373. package/src/navigation-link/edit.js +6 -5
  374. package/src/navigation-link/index.php +8 -1
  375. package/src/navigation-submenu/edit.js +7 -5
  376. package/src/navigation-submenu/index.php +8 -1
  377. package/src/page-list/block.json +1 -5
  378. package/src/page-list/edit.js +36 -22
  379. package/src/page-list/index.php +8 -6
  380. package/src/paragraph/edit.js +1 -14
  381. package/src/paragraph/editor.scss +0 -20
  382. package/src/pattern/edit.js +10 -3
  383. package/src/post-comments-count/block.json +4 -0
  384. package/src/post-comments-form/block.json +4 -0
  385. package/src/post-comments-form/form.js +2 -3
  386. package/src/post-comments-form/style.scss +3 -0
  387. package/src/post-comments-link/block.json +4 -0
  388. package/src/post-content/edit.js +8 -4
  389. package/src/pullquote/deprecated.js +7 -7
  390. package/src/query/edit/inspector-controls/index.js +4 -3
  391. package/src/query/edit/inspector-controls/taxonomy-controls.js +82 -87
  392. package/src/rss/index.php +3 -3
  393. package/src/search/edit.js +7 -2
  394. package/src/search/index.php +21 -13
  395. package/src/site-logo/edit.js +12 -10
  396. package/src/site-logo/editor.scss +1 -0
  397. package/src/site-tagline/edit.js +25 -18
  398. package/src/site-title/edit/index.js +26 -12
  399. package/src/social-link/block.json +3 -0
  400. package/src/social-link/edit.js +8 -1
  401. package/src/social-link/index.php +11 -7
  402. package/src/spacer/controls.js +10 -12
  403. package/src/table/deprecated.js +587 -348
  404. package/src/table/state.js +3 -3
  405. package/src/table-of-contents/edit.js +1 -3
  406. package/src/tag-cloud/block.json +8 -0
  407. package/src/tag-cloud/edit.js +1 -1
  408. package/src/tag-cloud/style.scss +3 -0
  409. package/src/template-part/index.php +4 -0
  410. package/src/utils/clean-empty-object.js +5 -6
  411. package/src/video/deprecated.js +57 -0
  412. package/src/video/edit.js +71 -23
  413. package/src/video/index.js +2 -0
  414. package/src/video/tracks-editor.js +12 -28
  415. package/build/paragraph/drop-zone.js +0 -99
  416. package/build/paragraph/drop-zone.js.map +0 -1
  417. package/build-module/paragraph/drop-zone.js +0 -88
  418. package/build-module/paragraph/drop-zone.js.map +0 -1
  419. package/src/paragraph/drop-zone.js +0 -105
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, mapValues, every, pick } from 'lodash';
4
+ import { get, mapValues, pick } from 'lodash';
5
5
 
6
6
  const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];
7
7
 
@@ -281,7 +281,7 @@ export function deleteColumn( state, { columnIndex } ) {
281
281
  }
282
282
 
283
283
  /**
284
- * Toggles the existance of a section.
284
+ * Toggles the existence of a section.
285
285
  *
286
286
  * @param {Object} state Current table state.
287
287
  * @param {string} sectionName Name of the section to toggle.
@@ -309,7 +309,7 @@ export function toggleSection( state, sectionName ) {
309
309
  * @return {boolean} True if the table section is empty, false otherwise.
310
310
  */
311
311
  export function isEmptyTableSection( section ) {
312
- return ! section || ! section.length || every( section, isEmptyRow );
312
+ return ! section || ! section.length || section.every( isEmptyRow );
313
313
  }
314
314
 
315
315
  /**
@@ -21,7 +21,6 @@ import {
21
21
  ToolbarButton,
22
22
  ToolbarGroup,
23
23
  } from '@wordpress/components';
24
- import { useDisabled } from '@wordpress/compose';
25
24
  import { useDispatch, useSelect } from '@wordpress/data';
26
25
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
27
26
  import { renderToString, useEffect } from '@wordpress/element';
@@ -55,7 +54,6 @@ export default function TableOfContentsEdit( {
55
54
  setAttributes,
56
55
  } ) {
57
56
  const blockProps = useBlockProps();
58
- const disabledRef = useDisabled();
59
57
 
60
58
  const canInsertList = useSelect(
61
59
  ( select ) => {
@@ -295,7 +293,7 @@ export default function TableOfContentsEdit( {
295
293
  return (
296
294
  <>
297
295
  <nav { ...blockProps }>
298
- <ol ref={ disabledRef }>
296
+ <ol inert="true">
299
297
  <TableOfContentsList nestedHeadingList={ headingTree } />
300
298
  </ol>
301
299
  </nav>
@@ -40,6 +40,14 @@
40
40
  "spacing": {
41
41
  "margin": true,
42
42
  "padding": true
43
+ },
44
+ "typography": {
45
+ "lineHeight": true,
46
+ "__experimentalFontFamily": true,
47
+ "__experimentalFontWeight": true,
48
+ "__experimentalFontStyle": true,
49
+ "__experimentalTextTransform": true,
50
+ "__experimentalLetterSpacing": true
43
51
  }
44
52
  },
45
53
  "editorStyle": "wp-block-tag-cloud-editor"
@@ -168,7 +168,7 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
168
168
  { inspectorControls }
169
169
  <div { ...useBlockProps() }>
170
170
  <ServerSideRender
171
- key="tag-cloud"
171
+ skipBlockSupportAttributes
172
172
  block="core/tag-cloud"
173
173
  attributes={ attributes }
174
174
  />
@@ -1,4 +1,7 @@
1
1
  .wp-block-tag-cloud {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
4
+
2
5
  &.aligncenter {
3
6
  text-align: center;
4
7
  justify-content: center;
@@ -189,6 +189,10 @@ function build_template_part_block_area_variations() {
189
189
  * @return array Array containing the block variation objects.
190
190
  */
191
191
  function build_template_part_block_instance_variations() {
192
+ // Block themes are unavailable during installation.
193
+ if ( wp_installing() ) {
194
+ return array();
195
+ }
192
196
  $variations = array();
193
197
  $template_parts = get_block_templates(
194
198
  array(
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { isEmpty, mapValues, pickBy } from 'lodash';
5
-
6
- const identity = ( x ) => x;
4
+ import { isEmpty, mapValues } from 'lodash';
7
5
 
8
6
  /**
9
7
  * Removed empty nodes from nested objects.
@@ -19,9 +17,10 @@ const cleanEmptyObject = ( object ) => {
19
17
  ) {
20
18
  return object;
21
19
  }
22
- const cleanedNestedObjects = pickBy(
23
- mapValues( object, cleanEmptyObject ),
24
- identity
20
+ const cleanedNestedObjects = Object.fromEntries(
21
+ Object.entries( mapValues( object, cleanEmptyObject ) ).filter(
22
+ ( [ , value ] ) => Boolean( value )
23
+ )
25
24
  );
26
25
  return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
27
26
  };
@@ -0,0 +1,57 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { RichText, useBlockProps } from '@wordpress/block-editor';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import metadata from './block.json';
10
+ import Tracks from './tracks';
11
+
12
+ const { attributes: blockAttributes } = metadata;
13
+
14
+ // In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
15
+ // to the video figcaption element.
16
+ const v1 = {
17
+ attributes: blockAttributes,
18
+ save( { attributes } ) {
19
+ const {
20
+ autoplay,
21
+ caption,
22
+ controls,
23
+ loop,
24
+ muted,
25
+ poster,
26
+ preload,
27
+ src,
28
+ playsInline,
29
+ tracks,
30
+ } = attributes;
31
+ return (
32
+ <figure { ...useBlockProps.save() }>
33
+ { src && (
34
+ <video
35
+ autoPlay={ autoplay }
36
+ controls={ controls }
37
+ loop={ loop }
38
+ muted={ muted }
39
+ poster={ poster }
40
+ preload={ preload !== 'metadata' ? preload : undefined }
41
+ src={ src }
42
+ playsInline={ playsInline }
43
+ >
44
+ <Tracks tracks={ tracks } />
45
+ </video>
46
+ ) }
47
+ { ! RichText.isEmpty( caption ) && (
48
+ <RichText.Content tagName="figcaption" value={ caption } />
49
+ ) }
50
+ </figure>
51
+ );
52
+ },
53
+ };
54
+
55
+ const deprecated = [ v1 ];
56
+
57
+ export default deprecated;
package/src/video/edit.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  PanelBody,
15
15
  Spinner,
16
16
  Placeholder,
17
+ ToolbarButton,
17
18
  } from '@wordpress/components';
18
19
  import {
19
20
  BlockControls,
@@ -28,11 +29,11 @@ import {
28
29
  store as blockEditorStore,
29
30
  __experimentalGetElementClassName,
30
31
  } from '@wordpress/block-editor';
31
- import { useRef, useEffect } from '@wordpress/element';
32
+ import { useRef, useEffect, useState, useCallback } from '@wordpress/element';
32
33
  import { __, sprintf } from '@wordpress/i18n';
33
- import { useInstanceId } from '@wordpress/compose';
34
+ import { useInstanceId, usePrevious } from '@wordpress/compose';
34
35
  import { useDispatch, useSelect } from '@wordpress/data';
35
- import { video as icon } from '@wordpress/icons';
36
+ import { video as icon, caption as captionIcon } from '@wordpress/icons';
36
37
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
37
38
  import { store as noticesStore } from '@wordpress/notices';
38
39
 
@@ -76,6 +77,8 @@ function VideoEdit( {
76
77
  const videoPlayer = useRef();
77
78
  const posterImageButton = useRef();
78
79
  const { id, caption, controls, poster, src, tracks } = attributes;
80
+ const prevCaption = usePrevious( caption );
81
+ const [ showCaption, setShowCaption ] = useState( !! caption );
79
82
  const isTemporaryVideo = ! id && isBlobURL( src );
80
83
  const mediaUpload = useSelect(
81
84
  ( select ) => select( blockEditorStore ).getSettings().mediaUpload,
@@ -103,6 +106,30 @@ function VideoEdit( {
103
106
  }
104
107
  }, [ poster ] );
105
108
 
109
+ // We need to show the caption when changes come from
110
+ // history navigation(undo/redo).
111
+ useEffect( () => {
112
+ if ( caption && ! prevCaption ) {
113
+ setShowCaption( true );
114
+ }
115
+ }, [ caption, prevCaption ] );
116
+
117
+ // Focus the caption when we click to add one.
118
+ const captionRef = useCallback(
119
+ ( node ) => {
120
+ if ( node && ! caption ) {
121
+ node.focus();
122
+ }
123
+ },
124
+ [ caption ]
125
+ );
126
+
127
+ useEffect( () => {
128
+ if ( ! isSelected && ! caption ) {
129
+ setShowCaption( false );
130
+ }
131
+ }, [ isSelected, caption ] );
132
+
106
133
  function onSelectVideo( media ) {
107
134
  if ( ! media || ! media.url ) {
108
135
  // In this case there was an error
@@ -112,6 +139,7 @@ function VideoEdit( {
112
139
  src: undefined,
113
140
  id: undefined,
114
141
  poster: undefined,
142
+ caption: undefined,
115
143
  } );
116
144
  return;
117
145
  }
@@ -123,6 +151,7 @@ function VideoEdit( {
123
151
  id: media.id,
124
152
  poster:
125
153
  media.image?.src !== media.icon ? media.image?.src : undefined,
154
+ caption: media.caption,
126
155
  } );
127
156
  }
128
157
 
@@ -186,6 +215,23 @@ function VideoEdit( {
186
215
  return (
187
216
  <>
188
217
  <BlockControls group="block">
218
+ <ToolbarButton
219
+ onClick={ () => {
220
+ setShowCaption( ! showCaption );
221
+ if ( showCaption && caption ) {
222
+ setAttributes( { caption: undefined } );
223
+ }
224
+ } }
225
+ icon={ captionIcon }
226
+ isPressed={ showCaption }
227
+ label={
228
+ showCaption
229
+ ? __( 'Remove caption' )
230
+ : __( 'Add caption' )
231
+ }
232
+ />
233
+ </BlockControls>
234
+ <BlockControls>
189
235
  <TracksEditor
190
236
  tracks={ tracks }
191
237
  onChange={ ( newTracks ) => {
@@ -278,26 +324,28 @@ function VideoEdit( {
278
324
  </video>
279
325
  </Disabled>
280
326
  { isTemporaryVideo && <Spinner /> }
281
- { ( ! RichText.isEmpty( caption ) || isSelected ) && (
282
- <RichText
283
- tagName="figcaption"
284
- className={ __experimentalGetElementClassName(
285
- 'caption'
286
- ) }
287
- aria-label={ __( 'Video caption text' ) }
288
- placeholder={ __( 'Add caption' ) }
289
- value={ caption }
290
- onChange={ ( value ) =>
291
- setAttributes( { caption: value } )
292
- }
293
- inlineToolbar
294
- __unstableOnSplitAtEnd={ () =>
295
- insertBlocksAfter(
296
- createBlock( getDefaultBlockName() )
297
- )
298
- }
299
- />
300
- ) }
327
+ { showCaption &&
328
+ ( ! RichText.isEmpty( caption ) || isSelected ) && (
329
+ <RichText
330
+ tagName="figcaption"
331
+ className={ __experimentalGetElementClassName(
332
+ 'caption'
333
+ ) }
334
+ aria-label={ __( 'Video caption text' ) }
335
+ ref={ captionRef }
336
+ placeholder={ __( 'Add caption' ) }
337
+ value={ caption }
338
+ onChange={ ( value ) =>
339
+ setAttributes( { caption: value } )
340
+ }
341
+ inlineToolbar
342
+ __unstableOnSplitAtEnd={ () =>
343
+ insertBlocksAfter(
344
+ createBlock( getDefaultBlockName() )
345
+ )
346
+ }
347
+ />
348
+ ) }
301
349
  </figure>
302
350
  </>
303
351
  );
@@ -8,6 +8,7 @@ import { video as icon } from '@wordpress/icons';
8
8
  * Internal dependencies
9
9
  */
10
10
  import initBlock from '../utils/init-block';
11
+ import deprecated from './deprecated';
11
12
  import edit from './edit';
12
13
  import metadata from './block.json';
13
14
  import save from './save';
@@ -27,6 +28,7 @@ export const settings = {
27
28
  },
28
29
  },
29
30
  transforms,
31
+ deprecated,
30
32
  edit,
31
33
  save,
32
34
  };
@@ -7,11 +7,9 @@ import {
7
7
  MenuItem,
8
8
  FormFileUpload,
9
9
  MenuGroup,
10
+ ToolbarGroup,
10
11
  ToolbarButton,
11
12
  Dropdown,
12
- SVG,
13
- Rect,
14
- Path,
15
13
  Button,
16
14
  TextControl,
17
15
  SelectControl,
@@ -38,23 +36,6 @@ const KIND_OPTIONS = [
38
36
  { label: __( 'Metadata' ), value: 'metadata' },
39
37
  ];
40
38
 
41
- const captionIcon = (
42
- <SVG width="18" height="14" viewBox="0 0 18 14" role="img" fill="none">
43
- <Rect
44
- x="0.75"
45
- y="0.75"
46
- width="16.5"
47
- height="12.5"
48
- rx="1.25"
49
- stroke="black"
50
- strokeWidth="1.5"
51
- fill="none"
52
- />
53
- <Path d="M3 7H15" stroke="black" strokeWidth="1.5" />
54
- <Path d="M3 10L15 10" stroke="black" strokeWidth="1.5" />
55
- </SVG>
56
- );
57
-
58
39
  function TrackList( { tracks, onEditPress } ) {
59
40
  let content;
60
41
  if ( tracks.length === 0 ) {
@@ -200,14 +181,17 @@ export default function TracksEditor( { tracks = [], onChange } ) {
200
181
  <Dropdown
201
182
  contentClassName="block-library-video-tracks-editor"
202
183
  renderToggle={ ( { isOpen, onToggle } ) => (
203
- <ToolbarButton
204
- label={ __( 'Text tracks' ) }
205
- showTooltip
206
- aria-expanded={ isOpen }
207
- aria-haspopup="true"
208
- onClick={ onToggle }
209
- icon={ captionIcon }
210
- />
184
+ <ToolbarGroup>
185
+ <ToolbarButton
186
+ label={ __( 'Text tracks' ) }
187
+ showTooltip
188
+ aria-expanded={ isOpen }
189
+ aria-haspopup="true"
190
+ onClick={ onToggle }
191
+ >
192
+ { __( 'Text tracks' ) }
193
+ </ToolbarButton>
194
+ </ToolbarGroup>
211
195
  ) }
212
196
  renderContent={ () => {
213
197
  if ( trackBeingEdited !== null ) {
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = DropZone;
7
-
8
- var _element = require("@wordpress/element");
9
-
10
- var _data = require("@wordpress/data");
11
-
12
- var _blockEditor = require("@wordpress/block-editor");
13
-
14
- var _compose = require("@wordpress/compose");
15
-
16
- var _components = require("@wordpress/components");
17
-
18
- /**
19
- * WordPress dependencies
20
- */
21
- const animateVariants = {
22
- hide: {
23
- opacity: 0,
24
- scaleY: 0.75
25
- },
26
- show: {
27
- opacity: 1,
28
- scaleY: 1
29
- },
30
- exit: {
31
- opacity: 0,
32
- scaleY: 0.9
33
- }
34
- };
35
-
36
- function DropZone(_ref) {
37
- let {
38
- paragraphElement,
39
- clientId
40
- } = _ref;
41
- const {
42
- rootClientId,
43
- blockIndex
44
- } = (0, _data.useSelect)(select => {
45
- const selectors = select(_blockEditor.store);
46
- return {
47
- rootClientId: selectors.getBlockRootClientId(clientId),
48
- blockIndex: selectors.getBlockIndex(clientId)
49
- };
50
- }, [clientId]);
51
- const onBlockDrop = (0, _blockEditor.__experimentalUseOnBlockDrop)(rootClientId, blockIndex, {
52
- action: 'replace'
53
- });
54
- const [isDragging, setIsDragging] = (0, _element.useState)(false);
55
- const [isVisible, setIsVisible] = (0, _element.useState)(false);
56
- const popoverRef = (0, _compose.__experimentalUseDropZone)({
57
- onDragStart: () => {
58
- setIsDragging(true);
59
- },
60
- onDragEnd: () => {
61
- setIsDragging(false);
62
- }
63
- });
64
- const dropZoneRef = (0, _compose.__experimentalUseDropZone)({
65
- onDrop: onBlockDrop,
66
- onDragEnter: () => {
67
- setIsVisible(true);
68
- },
69
- onDragLeave: () => {
70
- setIsVisible(false);
71
- }
72
- });
73
- const reducedMotion = (0, _compose.useReducedMotion)();
74
- return (0, _element.createElement)(_components.Popover, {
75
- anchor: paragraphElement,
76
- animate: false,
77
- placement: "top-start",
78
- focusOnMount: false,
79
- flip: false,
80
- resize: false,
81
- className: "wp-block-paragraph__drop-zone",
82
- ref: popoverRef
83
- }, isDragging ? (0, _element.createElement)("div", {
84
- className: "wp-block-paragraph__drop-zone-backdrop",
85
- ref: dropZoneRef,
86
- style: {
87
- width: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetWidth,
88
- height: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetHeight
89
- }
90
- }, (0, _element.createElement)(_components.__unstableAnimatePresence, null, isVisible ? (0, _element.createElement)(_components.__unstableMotion.div, {
91
- key: "drop-zone-foreground",
92
- "data-testid": "empty-paragraph-drop-zone",
93
- initial: reducedMotion ? animateVariants.show : animateVariants.hide,
94
- animate: animateVariants.show,
95
- exit: reducedMotion ? animateVariants.show : animateVariants.exit,
96
- className: "wp-block-paragraph__drop-zone-foreground"
97
- }) : null)) : null);
98
- }
99
- //# sourceMappingURL=drop-zone.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/paragraph/drop-zone.js"],"names":["animateVariants","hide","opacity","scaleY","show","exit","DropZone","paragraphElement","clientId","rootClientId","blockIndex","select","selectors","blockEditorStore","getBlockRootClientId","getBlockIndex","onBlockDrop","action","isDragging","setIsDragging","isVisible","setIsVisible","popoverRef","onDragStart","onDragEnd","dropZoneRef","onDrop","onDragEnter","onDragLeave","reducedMotion","width","offsetWidth","height","offsetHeight"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseOnBlockDrop as useOnBlockDrop,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\nimport {\n\tPopover,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nexport default function DropZone( { paragraphElement, clientId } ) {\n\tconst { rootClientId, blockIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectors = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\trootClientId: selectors.getBlockRootClientId( clientId ),\n\t\t\t\tblockIndex: selectors.getBlockIndex( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {\n\t\taction: 'replace',\n\t} );\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\tconst popoverRef = useDropZone( {\n\t\tonDragStart: () => {\n\t\t\tsetIsDragging( true );\n\t\t},\n\t\tonDragEnd: () => {\n\t\t\tsetIsDragging( false );\n\t\t},\n\t} );\n\tconst dropZoneRef = useDropZone( {\n\t\tonDrop: onBlockDrop,\n\t\tonDragEnter: () => {\n\t\t\tsetIsVisible( true );\n\t\t},\n\t\tonDragLeave: () => {\n\t\t\tsetIsVisible( false );\n\t\t},\n\t} );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<Popover\n\t\t\tanchor={ paragraphElement }\n\t\t\tanimate={ false }\n\t\t\tplacement=\"top-start\"\n\t\t\tfocusOnMount={ false }\n\t\t\tflip={ false }\n\t\t\tresize={ false }\n\t\t\tclassName=\"wp-block-paragraph__drop-zone\"\n\t\t\tref={ popoverRef }\n\t\t>\n\t\t\t{ isDragging ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-backdrop\"\n\t\t\t\t\tref={ dropZoneRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: paragraphElement?.offsetWidth,\n\t\t\t\t\t\theight: paragraphElement?.offsetHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t{ isVisible ? (\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tkey=\"drop-zone-foreground\"\n\t\t\t\t\t\t\t\tdata-testid=\"empty-paragraph-drop-zone\"\n\t\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.hide\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.exit\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-foreground\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</div>\n\t\t\t) : null }\n\t\t</Popover>\n\t);\n}\n"]}
@@ -1,88 +0,0 @@
1
- import { createElement } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { useState } from '@wordpress/element';
7
- import { useSelect } from '@wordpress/data';
8
- import { __experimentalUseOnBlockDrop as useOnBlockDrop, store as blockEditorStore } from '@wordpress/block-editor';
9
- import { __experimentalUseDropZone as useDropZone, useReducedMotion } from '@wordpress/compose';
10
- import { Popover, __unstableMotion as motion, __unstableAnimatePresence as AnimatePresence } from '@wordpress/components';
11
- const animateVariants = {
12
- hide: {
13
- opacity: 0,
14
- scaleY: 0.75
15
- },
16
- show: {
17
- opacity: 1,
18
- scaleY: 1
19
- },
20
- exit: {
21
- opacity: 0,
22
- scaleY: 0.9
23
- }
24
- };
25
- export default function DropZone(_ref) {
26
- let {
27
- paragraphElement,
28
- clientId
29
- } = _ref;
30
- const {
31
- rootClientId,
32
- blockIndex
33
- } = useSelect(select => {
34
- const selectors = select(blockEditorStore);
35
- return {
36
- rootClientId: selectors.getBlockRootClientId(clientId),
37
- blockIndex: selectors.getBlockIndex(clientId)
38
- };
39
- }, [clientId]);
40
- const onBlockDrop = useOnBlockDrop(rootClientId, blockIndex, {
41
- action: 'replace'
42
- });
43
- const [isDragging, setIsDragging] = useState(false);
44
- const [isVisible, setIsVisible] = useState(false);
45
- const popoverRef = useDropZone({
46
- onDragStart: () => {
47
- setIsDragging(true);
48
- },
49
- onDragEnd: () => {
50
- setIsDragging(false);
51
- }
52
- });
53
- const dropZoneRef = useDropZone({
54
- onDrop: onBlockDrop,
55
- onDragEnter: () => {
56
- setIsVisible(true);
57
- },
58
- onDragLeave: () => {
59
- setIsVisible(false);
60
- }
61
- });
62
- const reducedMotion = useReducedMotion();
63
- return createElement(Popover, {
64
- anchor: paragraphElement,
65
- animate: false,
66
- placement: "top-start",
67
- focusOnMount: false,
68
- flip: false,
69
- resize: false,
70
- className: "wp-block-paragraph__drop-zone",
71
- ref: popoverRef
72
- }, isDragging ? createElement("div", {
73
- className: "wp-block-paragraph__drop-zone-backdrop",
74
- ref: dropZoneRef,
75
- style: {
76
- width: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetWidth,
77
- height: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetHeight
78
- }
79
- }, createElement(AnimatePresence, null, isVisible ? createElement(motion.div, {
80
- key: "drop-zone-foreground",
81
- "data-testid": "empty-paragraph-drop-zone",
82
- initial: reducedMotion ? animateVariants.show : animateVariants.hide,
83
- animate: animateVariants.show,
84
- exit: reducedMotion ? animateVariants.show : animateVariants.exit,
85
- className: "wp-block-paragraph__drop-zone-foreground"
86
- }) : null)) : null);
87
- }
88
- //# sourceMappingURL=drop-zone.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/paragraph/drop-zone.js"],"names":["useState","useSelect","__experimentalUseOnBlockDrop","useOnBlockDrop","store","blockEditorStore","__experimentalUseDropZone","useDropZone","useReducedMotion","Popover","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","animateVariants","hide","opacity","scaleY","show","exit","DropZone","paragraphElement","clientId","rootClientId","blockIndex","select","selectors","getBlockRootClientId","getBlockIndex","onBlockDrop","action","isDragging","setIsDragging","isVisible","setIsVisible","popoverRef","onDragStart","onDragEnd","dropZoneRef","onDrop","onDragEnter","onDragLeave","reducedMotion","width","offsetWidth","height","offsetHeight"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseOnBlockDrop as useOnBlockDrop,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\nimport {\n\tPopover,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nexport default function DropZone( { paragraphElement, clientId } ) {\n\tconst { rootClientId, blockIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectors = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\trootClientId: selectors.getBlockRootClientId( clientId ),\n\t\t\t\tblockIndex: selectors.getBlockIndex( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {\n\t\taction: 'replace',\n\t} );\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\tconst popoverRef = useDropZone( {\n\t\tonDragStart: () => {\n\t\t\tsetIsDragging( true );\n\t\t},\n\t\tonDragEnd: () => {\n\t\t\tsetIsDragging( false );\n\t\t},\n\t} );\n\tconst dropZoneRef = useDropZone( {\n\t\tonDrop: onBlockDrop,\n\t\tonDragEnter: () => {\n\t\t\tsetIsVisible( true );\n\t\t},\n\t\tonDragLeave: () => {\n\t\t\tsetIsVisible( false );\n\t\t},\n\t} );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<Popover\n\t\t\tanchor={ paragraphElement }\n\t\t\tanimate={ false }\n\t\t\tplacement=\"top-start\"\n\t\t\tfocusOnMount={ false }\n\t\t\tflip={ false }\n\t\t\tresize={ false }\n\t\t\tclassName=\"wp-block-paragraph__drop-zone\"\n\t\t\tref={ popoverRef }\n\t\t>\n\t\t\t{ isDragging ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-backdrop\"\n\t\t\t\t\tref={ dropZoneRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: paragraphElement?.offsetWidth,\n\t\t\t\t\t\theight: paragraphElement?.offsetHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t{ isVisible ? (\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tkey=\"drop-zone-foreground\"\n\t\t\t\t\t\t\t\tdata-testid=\"empty-paragraph-drop-zone\"\n\t\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.hide\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.exit\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-foreground\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</div>\n\t\t\t) : null }\n\t\t</Popover>\n\t);\n}\n"]}