@wordpress/block-library 7.4.0 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (798) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +3 -2
  3. package/babel-plugin.js +154 -0
  4. package/build/audio/edit.js +4 -16
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/block/edit.js +10 -9
  7. package/build/block/edit.js.map +1 -1
  8. package/build/button/deprecated.js +175 -35
  9. package/build/button/deprecated.js.map +1 -1
  10. package/build/button/edit.js +1 -1
  11. package/build/button/edit.js.map +1 -1
  12. package/build/button/edit.native.js +7 -3
  13. package/build/button/edit.native.js.map +1 -1
  14. package/build/button/index.js +1 -0
  15. package/build/button/index.js.map +1 -1
  16. package/build/button/save.js +1 -1
  17. package/build/button/save.js.map +1 -1
  18. package/build/categories/edit.js +1 -1
  19. package/build/categories/edit.js.map +1 -1
  20. package/build/categories/index.js +1 -1
  21. package/build/columns/index.js +3 -1
  22. package/build/columns/index.js.map +1 -1
  23. package/build/comment-author-avatar/index.js +1 -0
  24. package/build/comment-author-avatar/index.js.map +1 -1
  25. package/build/comment-template/edit.js +1 -3
  26. package/build/comment-template/edit.js.map +1 -1
  27. package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  28. package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
  29. package/build/{comments-query-loop → comments}/edit.js +3 -3
  30. package/build/comments/edit.js.map +1 -0
  31. package/build/{comments-query-loop → comments}/index.js +1 -1
  32. package/build/comments/index.js.map +1 -0
  33. package/build/{comments-query-loop → comments}/save.js +2 -2
  34. package/build/comments/save.js.map +1 -0
  35. package/build/comments-title/deprecated.js +110 -0
  36. package/build/comments-title/deprecated.js.map +1 -0
  37. package/build/comments-title/edit.js +35 -35
  38. package/build/comments-title/edit.js.map +1 -1
  39. package/build/comments-title/index.js +5 -8
  40. package/build/comments-title/index.js.map +1 -1
  41. package/build/cover/controls.native.js +2 -3
  42. package/build/cover/controls.native.js.map +1 -1
  43. package/build/cover/deprecated.js +212 -207
  44. package/build/cover/deprecated.js.map +1 -1
  45. package/build/cover/edit/block-controls.js +115 -0
  46. package/build/cover/edit/block-controls.js.map +1 -0
  47. package/build/cover/edit/cover-placeholder.js +49 -0
  48. package/build/cover/edit/cover-placeholder.js.map +1 -0
  49. package/build/cover/edit/index.js +343 -0
  50. package/build/cover/edit/index.js.map +1 -0
  51. package/build/cover/edit/inspector-controls.js +224 -0
  52. package/build/cover/edit/inspector-controls.js.map +1 -0
  53. package/build/cover/edit/resizable-cover.js +67 -0
  54. package/build/cover/edit/resizable-cover.js.map +1 -0
  55. package/build/cover/edit/use-cover-is-dark.js +81 -0
  56. package/build/cover/edit/use-cover-is-dark.js.map +1 -0
  57. package/build/cover/edit.native.js +36 -16
  58. package/build/cover/edit.native.js.map +1 -1
  59. package/build/cover/focal-point-settings-button.native.js.map +1 -1
  60. package/build/cover/save.js +18 -5
  61. package/build/cover/save.js.map +1 -1
  62. package/build/cover/shared.js +15 -9
  63. package/build/cover/shared.js.map +1 -1
  64. package/build/cover/transforms.js +77 -6
  65. package/build/cover/transforms.js.map +1 -1
  66. package/build/cover/use-cover-is-dark.native.js +60 -0
  67. package/build/cover/use-cover-is-dark.native.js.map +1 -0
  68. package/build/embed/embed-preview.js +1 -1
  69. package/build/embed/embed-preview.js.map +1 -1
  70. package/build/file/edit.js +1 -1
  71. package/build/file/edit.js.map +1 -1
  72. package/build/file/edit.native.js +0 -1
  73. package/build/file/edit.native.js.map +1 -1
  74. package/build/file/save.js +9 -1
  75. package/build/file/save.js.map +1 -1
  76. package/build/gallery/edit.js +2 -1
  77. package/build/gallery/edit.js.map +1 -1
  78. package/build/gallery/gallery.js +1 -1
  79. package/build/gallery/gallery.js.map +1 -1
  80. package/build/gallery/gap-styles.js +14 -4
  81. package/build/gallery/gap-styles.js.map +1 -1
  82. package/build/gallery/index.js +1 -1
  83. package/build/gallery/shared.js +2 -2
  84. package/build/gallery/shared.js.map +1 -1
  85. package/build/gallery/use-get-media.js +2 -1
  86. package/build/gallery/use-get-media.js.map +1 -1
  87. package/build/gallery/use-short-code-transform.js +19 -18
  88. package/build/gallery/use-short-code-transform.js.map +1 -1
  89. package/build/gallery/v1/gallery.js +1 -1
  90. package/build/gallery/v1/gallery.js.map +1 -1
  91. package/build/group/index.js +1 -0
  92. package/build/group/index.js.map +1 -1
  93. package/build/heading/edit.js +6 -2
  94. package/build/heading/edit.js.map +1 -1
  95. package/build/heading/index.js +1 -0
  96. package/build/heading/index.js.map +1 -1
  97. package/build/heading/transforms.js +9 -4
  98. package/build/heading/transforms.js.map +1 -1
  99. package/build/image/edit.js +5 -56
  100. package/build/image/edit.js.map +1 -1
  101. package/build/image/edit.native.js +56 -4
  102. package/build/image/edit.native.js.map +1 -1
  103. package/build/image/image.js +4 -14
  104. package/build/image/image.js.map +1 -1
  105. package/build/index.js +48 -14
  106. package/build/index.js.map +1 -1
  107. package/build/is-block-metadata-experimental.js +18 -0
  108. package/build/is-block-metadata-experimental.js.map +1 -0
  109. package/build/latest-posts/edit.js +30 -4
  110. package/build/latest-posts/edit.js.map +1 -1
  111. package/build/latest-posts/edit.native.js +49 -0
  112. package/build/latest-posts/edit.native.js.map +1 -1
  113. package/build/list/transforms.js +6 -0
  114. package/build/list/transforms.js.map +1 -1
  115. package/build/list/v2/edit.js +2 -1
  116. package/build/list/v2/edit.js.map +1 -1
  117. package/build/list/v2/migrate.js +1 -0
  118. package/build/list/v2/migrate.js.map +1 -1
  119. package/build/list/v2/transforms.js +46 -9
  120. package/build/list/v2/transforms.js.map +1 -1
  121. package/build/list-item/edit.js +7 -9
  122. package/build/list-item/edit.js.map +1 -1
  123. package/build/list-item/hooks/index.js +24 -0
  124. package/build/list-item/hooks/index.js.map +1 -1
  125. package/build/list-item/hooks/use-backspace.js +59 -0
  126. package/build/list-item/hooks/use-backspace.js.map +1 -0
  127. package/build/list-item/hooks/use-enter.js +6 -9
  128. package/build/list-item/hooks/use-enter.js.map +1 -1
  129. package/build/list-item/hooks/use-indent-list-item.js +33 -39
  130. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  131. package/build/list-item/hooks/use-space.js +54 -0
  132. package/build/list-item/hooks/use-space.js.map +1 -0
  133. package/build/list-item/hooks/use-split.js +44 -0
  134. package/build/list-item/hooks/use-split.js.map +1 -0
  135. package/build/list-item/index.js +1 -0
  136. package/build/list-item/index.js.map +1 -1
  137. package/build/list-item/utils.js +1 -1
  138. package/build/list-item/utils.js.map +1 -1
  139. package/build/media-text/edit.native.js +2 -1
  140. package/build/media-text/edit.native.js.map +1 -1
  141. package/build/media-text/media-container.native.js +2 -4
  142. package/build/media-text/media-container.native.js.map +1 -1
  143. package/build/media-text/transforms.js +137 -8
  144. package/build/media-text/transforms.js.map +1 -1
  145. package/build/navigation/edit/index.js +91 -109
  146. package/build/navigation/edit/index.js.map +1 -1
  147. package/build/navigation/edit/inner-blocks.js +6 -12
  148. package/build/navigation/edit/inner-blocks.js.map +1 -1
  149. package/build/navigation/index.js +0 -1
  150. package/build/navigation/index.js.map +1 -1
  151. package/build/navigation/use-navigation-entities.js +3 -3
  152. package/build/navigation/use-navigation-entities.js.map +1 -1
  153. package/build/navigation/view-modal.js +25 -0
  154. package/build/navigation/view-modal.js.map +1 -1
  155. package/build/navigation-link/edit.js +60 -35
  156. package/build/navigation-link/edit.js.map +1 -1
  157. package/build/navigation-link/fallback-variations.js +1 -1
  158. package/build/navigation-link/fallback-variations.js.map +1 -1
  159. package/build/navigation-link/hooks.js +1 -1
  160. package/build/navigation-link/hooks.js.map +1 -1
  161. package/build/navigation-submenu/edit.js +14 -14
  162. package/build/navigation-submenu/edit.js.map +1 -1
  163. package/build/page-list/convert-to-links-modal.js +1 -1
  164. package/build/page-list/convert-to-links-modal.js.map +1 -1
  165. package/build/page-list/edit.js +1 -1
  166. package/build/page-list/edit.js.map +1 -1
  167. package/build/paragraph/edit.js +10 -0
  168. package/build/paragraph/edit.js.map +1 -1
  169. package/build/paragraph/use-enter.js +94 -0
  170. package/build/paragraph/use-enter.js.map +1 -0
  171. package/build/post-author/edit.js +1 -1
  172. package/build/post-author/edit.js.map +1 -1
  173. package/build/post-author-name/index.js +4 -0
  174. package/build/post-author-name/index.js.map +1 -1
  175. package/build/post-author-name/transforms.js +41 -0
  176. package/build/post-author-name/transforms.js.map +1 -0
  177. package/build/post-comment/index.js +2 -1
  178. package/build/post-comment/index.js.map +1 -1
  179. package/build/post-comments/edit.js +138 -35
  180. package/build/post-comments/edit.js.map +1 -1
  181. package/build/post-comments/index.js +3 -2
  182. package/build/post-comments/index.js.map +1 -1
  183. package/build/post-comments-count/index.js +1 -0
  184. package/build/post-comments-count/index.js.map +1 -1
  185. package/build/post-comments-form/edit.js +38 -4
  186. package/build/post-comments-form/edit.js.map +1 -1
  187. package/build/post-comments-form/form.js +58 -0
  188. package/build/post-comments-form/form.js.map +1 -0
  189. package/build/post-comments-form/index.js +1 -0
  190. package/build/post-comments-form/index.js.map +1 -1
  191. package/build/post-comments-link/index.js +1 -0
  192. package/build/post-comments-link/index.js.map +1 -1
  193. package/build/post-content/edit.js +1 -1
  194. package/build/post-content/edit.js.map +1 -1
  195. package/build/post-date/edit.js +13 -7
  196. package/build/post-date/edit.js.map +1 -1
  197. package/build/post-excerpt/edit.js +1 -1
  198. package/build/post-excerpt/edit.js.map +1 -1
  199. package/build/post-featured-image/edit.js +1 -1
  200. package/build/post-featured-image/edit.js.map +1 -1
  201. package/build/post-template/edit.js +7 -2
  202. package/build/post-template/edit.js.map +1 -1
  203. package/build/post-terms/edit.js +35 -4
  204. package/build/post-terms/edit.js.map +1 -1
  205. package/build/post-terms/hooks.js +33 -0
  206. package/build/post-terms/hooks.js.map +1 -0
  207. package/build/post-terms/index.js +20 -5
  208. package/build/post-terms/index.js.map +1 -1
  209. package/build/post-title/index.js +1 -1
  210. package/build/post-title/index.js.map +1 -1
  211. package/build/pullquote/edit.js +1 -1
  212. package/build/pullquote/edit.js.map +1 -1
  213. package/build/pullquote/edit.native.js +1 -1
  214. package/build/pullquote/edit.native.js.map +1 -1
  215. package/build/query/edit/inspector-controls/index.js +26 -17
  216. package/build/query/edit/inspector-controls/index.js.map +1 -1
  217. package/build/query/edit/inspector-controls/parent-control.js +148 -0
  218. package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
  219. package/build/query/edit/inspector-controls/sticky-control.js +41 -0
  220. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
  221. package/build/query/index.js +2 -1
  222. package/build/query/index.js.map +1 -1
  223. package/build/query/utils.js +28 -2
  224. package/build/query/utils.js.map +1 -1
  225. package/build/query-no-results/edit.js +1 -1
  226. package/build/query-no-results/edit.js.map +1 -1
  227. package/build/query-title/index.js +1 -1
  228. package/build/query-title/index.js.map +1 -1
  229. package/build/query-title/variations.js +1 -1
  230. package/build/query-title/variations.js.map +1 -1
  231. package/build/quote/edit.js +3 -2
  232. package/build/quote/edit.js.map +1 -1
  233. package/build/quote/index.js +1 -0
  234. package/build/quote/index.js.map +1 -1
  235. package/build/quote/v2/edit.js +1 -1
  236. package/build/quote/v2/edit.js.map +1 -1
  237. package/build/search/edit.js +2 -1
  238. package/build/search/edit.js.map +1 -1
  239. package/build/search/index.js +4 -0
  240. package/build/search/index.js.map +1 -1
  241. package/build/separator/index.js +3 -0
  242. package/build/separator/index.js.map +1 -1
  243. package/build/shortcode/edit.native.js +16 -13
  244. package/build/shortcode/edit.native.js.map +1 -1
  245. package/build/site-logo/edit.js +1 -1
  246. package/build/site-logo/edit.js.map +1 -1
  247. package/build/social-links/edit.js +2 -2
  248. package/build/social-links/edit.js.map +1 -1
  249. package/build/table/edit.js +15 -2
  250. package/build/table/edit.js.map +1 -1
  251. package/build/table-of-contents/edit.js +145 -65
  252. package/build/table-of-contents/edit.js.map +1 -1
  253. package/build/table-of-contents/index.js +13 -3
  254. package/build/table-of-contents/index.js.map +1 -1
  255. package/build/table-of-contents/list.js +16 -9
  256. package/build/table-of-contents/list.js.map +1 -1
  257. package/build/table-of-contents/save.js +40 -0
  258. package/build/table-of-contents/save.js.map +1 -0
  259. package/build/table-of-contents/utils.js +11 -77
  260. package/build/table-of-contents/utils.js.map +1 -1
  261. package/build/template-part/edit/index.js +7 -3
  262. package/build/template-part/edit/index.js.map +1 -1
  263. package/build/template-part/edit/inner-blocks.js +3 -8
  264. package/build/template-part/edit/inner-blocks.js.map +1 -1
  265. package/build/video/edit.js +4 -8
  266. package/build/video/edit.js.map +1 -1
  267. package/build-module/audio/edit.js +5 -17
  268. package/build-module/audio/edit.js.map +1 -1
  269. package/build-module/block/edit.js +11 -10
  270. package/build-module/block/edit.js.map +1 -1
  271. package/build-module/button/deprecated.js +175 -35
  272. package/build-module/button/deprecated.js.map +1 -1
  273. package/build-module/button/edit.js +2 -2
  274. package/build-module/button/edit.js.map +1 -1
  275. package/build-module/button/edit.native.js +7 -3
  276. package/build-module/button/edit.native.js.map +1 -1
  277. package/build-module/button/index.js +1 -0
  278. package/build-module/button/index.js.map +1 -1
  279. package/build-module/button/save.js +2 -2
  280. package/build-module/button/save.js.map +1 -1
  281. package/build-module/categories/edit.js +1 -1
  282. package/build-module/categories/edit.js.map +1 -1
  283. package/build-module/categories/index.js +1 -1
  284. package/build-module/columns/index.js +3 -1
  285. package/build-module/columns/index.js.map +1 -1
  286. package/build-module/comment-author-avatar/index.js +1 -0
  287. package/build-module/comment-author-avatar/index.js.map +1 -1
  288. package/build-module/comment-template/edit.js +1 -3
  289. package/build-module/comment-template/edit.js.map +1 -1
  290. package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  291. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
  292. package/build-module/{comments-query-loop → comments}/edit.js +2 -2
  293. package/build-module/comments/edit.js.map +1 -0
  294. package/build-module/{comments-query-loop → comments}/index.js +1 -1
  295. package/build-module/comments/index.js.map +1 -0
  296. package/build-module/{comments-query-loop → comments}/save.js +1 -1
  297. package/build-module/comments/save.js.map +1 -0
  298. package/build-module/comments-title/deprecated.js +102 -0
  299. package/build-module/comments-title/deprecated.js.map +1 -0
  300. package/build-module/comments-title/edit.js +38 -38
  301. package/build-module/comments-title/edit.js.map +1 -1
  302. package/build-module/comments-title/index.js +4 -8
  303. package/build-module/comments-title/index.js.map +1 -1
  304. package/build-module/cover/controls.native.js +2 -3
  305. package/build-module/cover/controls.native.js.map +1 -1
  306. package/build-module/cover/deprecated.js +206 -198
  307. package/build-module/cover/deprecated.js.map +1 -1
  308. package/build-module/cover/edit/block-controls.js +104 -0
  309. package/build-module/cover/edit/block-controls.js.map +1 -0
  310. package/build-module/cover/edit/cover-placeholder.js +38 -0
  311. package/build-module/cover/edit/cover-placeholder.js.map +1 -0
  312. package/build-module/cover/edit/index.js +317 -0
  313. package/build-module/cover/edit/index.js.map +1 -0
  314. package/build-module/cover/edit/inspector-controls.js +215 -0
  315. package/build-module/cover/edit/inspector-controls.js.map +1 -0
  316. package/build-module/cover/edit/resizable-cover.js +55 -0
  317. package/build-module/cover/edit/resizable-cover.js.map +1 -0
  318. package/build-module/cover/edit/use-cover-is-dark.js +70 -0
  319. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
  320. package/build-module/cover/edit.native.js +35 -17
  321. package/build-module/cover/edit.native.js.map +1 -1
  322. package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
  323. package/build-module/cover/save.js +19 -6
  324. package/build-module/cover/save.js.map +1 -1
  325. package/build-module/cover/shared.js +11 -5
  326. package/build-module/cover/shared.js.map +1 -1
  327. package/build-module/cover/transforms.js +74 -6
  328. package/build-module/cover/transforms.js.map +1 -1
  329. package/build-module/cover/use-cover-is-dark.native.js +51 -0
  330. package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
  331. package/build-module/embed/embed-preview.js +2 -2
  332. package/build-module/embed/embed-preview.js.map +1 -1
  333. package/build-module/file/edit.js +2 -2
  334. package/build-module/file/edit.js.map +1 -1
  335. package/build-module/file/edit.native.js +0 -1
  336. package/build-module/file/edit.native.js.map +1 -1
  337. package/build-module/file/save.js +7 -2
  338. package/build-module/file/save.js.map +1 -1
  339. package/build-module/gallery/edit.js +2 -1
  340. package/build-module/gallery/edit.js.map +1 -1
  341. package/build-module/gallery/gallery.js +2 -2
  342. package/build-module/gallery/gallery.js.map +1 -1
  343. package/build-module/gallery/gap-styles.js +14 -4
  344. package/build-module/gallery/gap-styles.js.map +1 -1
  345. package/build-module/gallery/index.js +1 -1
  346. package/build-module/gallery/shared.js +2 -2
  347. package/build-module/gallery/shared.js.map +1 -1
  348. package/build-module/gallery/use-get-media.js +2 -1
  349. package/build-module/gallery/use-get-media.js.map +1 -1
  350. package/build-module/gallery/use-short-code-transform.js +19 -18
  351. package/build-module/gallery/use-short-code-transform.js.map +1 -1
  352. package/build-module/gallery/v1/gallery.js +2 -2
  353. package/build-module/gallery/v1/gallery.js.map +1 -1
  354. package/build-module/group/index.js +1 -0
  355. package/build-module/group/index.js.map +1 -1
  356. package/build-module/heading/edit.js +6 -2
  357. package/build-module/heading/edit.js.map +1 -1
  358. package/build-module/heading/index.js +1 -0
  359. package/build-module/heading/index.js.map +1 -1
  360. package/build-module/heading/transforms.js +9 -4
  361. package/build-module/heading/transforms.js.map +1 -1
  362. package/build-module/image/edit.js +4 -52
  363. package/build-module/image/edit.js.map +1 -1
  364. package/build-module/image/edit.native.js +57 -6
  365. package/build-module/image/edit.native.js.map +1 -1
  366. package/build-module/image/image.js +6 -16
  367. package/build-module/image/image.js.map +1 -1
  368. package/build-module/index.js +43 -12
  369. package/build-module/index.js.map +1 -1
  370. package/build-module/is-block-metadata-experimental.js +16 -0
  371. package/build-module/is-block-metadata-experimental.js.map +1 -0
  372. package/build-module/latest-posts/edit.js +29 -5
  373. package/build-module/latest-posts/edit.js.map +1 -1
  374. package/build-module/latest-posts/edit.native.js +51 -2
  375. package/build-module/latest-posts/edit.native.js.map +1 -1
  376. package/build-module/list/transforms.js +6 -0
  377. package/build-module/list/transforms.js.map +1 -1
  378. package/build-module/list/v2/edit.js +2 -1
  379. package/build-module/list/v2/edit.js.map +1 -1
  380. package/build-module/list/v2/migrate.js +1 -3
  381. package/build-module/list/v2/migrate.js.map +1 -1
  382. package/build-module/list/v2/transforms.js +46 -9
  383. package/build-module/list/v2/transforms.js.map +1 -1
  384. package/build-module/list-item/edit.js +8 -9
  385. package/build-module/list-item/edit.js.map +1 -1
  386. package/build-module/list-item/hooks/index.js +3 -0
  387. package/build-module/list-item/hooks/index.js.map +1 -1
  388. package/build-module/list-item/hooks/use-backspace.js +44 -0
  389. package/build-module/list-item/hooks/use-backspace.js.map +1 -0
  390. package/build-module/list-item/hooks/use-enter.js +6 -9
  391. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  392. package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
  393. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  394. package/build-module/list-item/hooks/use-space.js +40 -0
  395. package/build-module/list-item/hooks/use-space.js.map +1 -0
  396. package/build-module/list-item/hooks/use-split.js +33 -0
  397. package/build-module/list-item/hooks/use-split.js.map +1 -0
  398. package/build-module/list-item/index.js +1 -0
  399. package/build-module/list-item/index.js.map +1 -1
  400. package/build-module/list-item/utils.js +1 -1
  401. package/build-module/list-item/utils.js.map +1 -1
  402. package/build-module/media-text/edit.native.js +2 -1
  403. package/build-module/media-text/edit.native.js.map +1 -1
  404. package/build-module/media-text/media-container.native.js +2 -4
  405. package/build-module/media-text/media-container.native.js.map +1 -1
  406. package/build-module/media-text/transforms.js +137 -8
  407. package/build-module/media-text/transforms.js.map +1 -1
  408. package/build-module/navigation/edit/index.js +93 -110
  409. package/build-module/navigation/edit/index.js.map +1 -1
  410. package/build-module/navigation/edit/inner-blocks.js +7 -13
  411. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  412. package/build-module/navigation/index.js +0 -1
  413. package/build-module/navigation/index.js.map +1 -1
  414. package/build-module/navigation/use-navigation-entities.js +1 -1
  415. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  416. package/build-module/navigation/view-modal.js +24 -0
  417. package/build-module/navigation/view-modal.js.map +1 -1
  418. package/build-module/navigation-link/edit.js +60 -36
  419. package/build-module/navigation-link/edit.js.map +1 -1
  420. package/build-module/navigation-link/fallback-variations.js +1 -1
  421. package/build-module/navigation-link/fallback-variations.js.map +1 -1
  422. package/build-module/navigation-link/hooks.js +2 -2
  423. package/build-module/navigation-link/hooks.js.map +1 -1
  424. package/build-module/navigation-submenu/edit.js +14 -14
  425. package/build-module/navigation-submenu/edit.js.map +1 -1
  426. package/build-module/page-list/convert-to-links-modal.js +1 -1
  427. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  428. package/build-module/page-list/edit.js +1 -1
  429. package/build-module/page-list/edit.js.map +1 -1
  430. package/build-module/paragraph/edit.js +9 -0
  431. package/build-module/paragraph/edit.js.map +1 -1
  432. package/build-module/paragraph/use-enter.js +81 -0
  433. package/build-module/paragraph/use-enter.js.map +1 -0
  434. package/build-module/post-author/edit.js +1 -1
  435. package/build-module/post-author/edit.js.map +1 -1
  436. package/build-module/post-author-name/index.js +3 -0
  437. package/build-module/post-author-name/index.js.map +1 -1
  438. package/build-module/post-author-name/transforms.js +32 -0
  439. package/build-module/post-author-name/transforms.js.map +1 -0
  440. package/build-module/post-comment/index.js +2 -1
  441. package/build-module/post-comment/index.js.map +1 -1
  442. package/build-module/post-comments/edit.js +139 -37
  443. package/build-module/post-comments/edit.js.map +1 -1
  444. package/build-module/post-comments/index.js +3 -2
  445. package/build-module/post-comments/index.js.map +1 -1
  446. package/build-module/post-comments-count/index.js +1 -0
  447. package/build-module/post-comments-count/index.js.map +1 -1
  448. package/build-module/post-comments-form/edit.js +38 -6
  449. package/build-module/post-comments-form/edit.js.map +1 -1
  450. package/build-module/post-comments-form/form.js +45 -0
  451. package/build-module/post-comments-form/form.js.map +1 -0
  452. package/build-module/post-comments-form/index.js +1 -0
  453. package/build-module/post-comments-form/index.js.map +1 -1
  454. package/build-module/post-comments-link/index.js +1 -0
  455. package/build-module/post-comments-link/index.js.map +1 -1
  456. package/build-module/post-content/edit.js +1 -1
  457. package/build-module/post-content/edit.js.map +1 -1
  458. package/build-module/post-date/edit.js +15 -9
  459. package/build-module/post-date/edit.js.map +1 -1
  460. package/build-module/post-excerpt/edit.js +1 -1
  461. package/build-module/post-excerpt/edit.js.map +1 -1
  462. package/build-module/post-featured-image/edit.js +1 -1
  463. package/build-module/post-featured-image/edit.js.map +1 -1
  464. package/build-module/post-template/edit.js +7 -2
  465. package/build-module/post-template/edit.js.map +1 -1
  466. package/build-module/post-terms/edit.js +35 -6
  467. package/build-module/post-terms/edit.js.map +1 -1
  468. package/build-module/post-terms/hooks.js +25 -0
  469. package/build-module/post-terms/hooks.js.map +1 -0
  470. package/build-module/post-terms/index.js +18 -8
  471. package/build-module/post-terms/index.js.map +1 -1
  472. package/build-module/post-title/index.js +1 -1
  473. package/build-module/post-title/index.js.map +1 -1
  474. package/build-module/pullquote/edit.js +2 -2
  475. package/build-module/pullquote/edit.js.map +1 -1
  476. package/build-module/pullquote/edit.native.js +2 -2
  477. package/build-module/pullquote/edit.native.js.map +1 -1
  478. package/build-module/query/edit/inspector-controls/index.js +24 -17
  479. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  480. package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
  481. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
  482. package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
  483. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
  484. package/build-module/query/index.js +2 -1
  485. package/build-module/query/index.js.map +1 -1
  486. package/build-module/query/utils.js +21 -0
  487. package/build-module/query/utils.js.map +1 -1
  488. package/build-module/query-no-results/edit.js +1 -1
  489. package/build-module/query-no-results/edit.js.map +1 -1
  490. package/build-module/query-title/index.js +1 -1
  491. package/build-module/query-title/index.js.map +1 -1
  492. package/build-module/query-title/variations.js +2 -2
  493. package/build-module/query-title/variations.js.map +1 -1
  494. package/build-module/quote/edit.js +4 -3
  495. package/build-module/quote/edit.js.map +1 -1
  496. package/build-module/quote/index.js +1 -0
  497. package/build-module/quote/index.js.map +1 -1
  498. package/build-module/quote/v2/edit.js +2 -2
  499. package/build-module/quote/v2/edit.js.map +1 -1
  500. package/build-module/search/edit.js +3 -2
  501. package/build-module/search/edit.js.map +1 -1
  502. package/build-module/search/index.js +4 -0
  503. package/build-module/search/index.js.map +1 -1
  504. package/build-module/separator/index.js +3 -0
  505. package/build-module/separator/index.js.map +1 -1
  506. package/build-module/shortcode/edit.native.js +17 -13
  507. package/build-module/shortcode/edit.native.js.map +1 -1
  508. package/build-module/site-logo/edit.js +1 -1
  509. package/build-module/site-logo/edit.js.map +1 -1
  510. package/build-module/social-links/edit.js +2 -2
  511. package/build-module/social-links/edit.js.map +1 -1
  512. package/build-module/table/edit.js +17 -4
  513. package/build-module/table/edit.js.map +1 -1
  514. package/build-module/table-of-contents/edit.js +144 -68
  515. package/build-module/table-of-contents/edit.js.map +1 -1
  516. package/build-module/table-of-contents/index.js +12 -3
  517. package/build-module/table-of-contents/index.js.map +1 -1
  518. package/build-module/table-of-contents/list.js +18 -10
  519. package/build-module/table-of-contents/list.js.map +1 -1
  520. package/build-module/table-of-contents/save.js +28 -0
  521. package/build-module/table-of-contents/save.js.map +1 -0
  522. package/build-module/table-of-contents/utils.js +11 -73
  523. package/build-module/table-of-contents/utils.js.map +1 -1
  524. package/build-module/template-part/edit/index.js +8 -4
  525. package/build-module/template-part/edit/index.js.map +1 -1
  526. package/build-module/template-part/edit/inner-blocks.js +4 -9
  527. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  528. package/build-module/video/edit.js +5 -9
  529. package/build-module/video/edit.js.map +1 -1
  530. package/build-style/comment-content/style-rtl.css +81 -0
  531. package/build-style/comment-content/style.css +81 -0
  532. package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
  533. package/build-style/{comments-query-loop → comments}/editor.css +0 -0
  534. package/build-style/cover/style-rtl.css +32 -27
  535. package/build-style/cover/style.css +32 -27
  536. package/build-style/editor-rtl.css +16 -10
  537. package/build-style/editor.css +16 -10
  538. package/build-style/image/editor-rtl.css +1 -1
  539. package/build-style/image/editor.css +1 -1
  540. package/build-style/latest-posts/style-rtl.css +2 -0
  541. package/build-style/latest-posts/style.css +4 -0
  542. package/build-style/navigation/style-rtl.css +3 -0
  543. package/build-style/navigation/style.css +3 -0
  544. package/build-style/post-comments/editor-rtl.css +79 -0
  545. package/build-style/post-comments/editor.css +79 -0
  546. package/build-style/post-comments/style-rtl.css +27 -3
  547. package/build-style/post-comments/style.css +27 -3
  548. package/build-style/post-comments-form/editor-rtl.css +79 -0
  549. package/build-style/post-comments-form/editor.css +79 -0
  550. package/build-style/post-comments-form/style-rtl.css +1 -3
  551. package/build-style/post-comments-form/style.css +1 -3
  552. package/build-style/separator/editor-rtl.css +1 -0
  553. package/build-style/separator/editor.css +1 -0
  554. package/build-style/site-logo/style-rtl.css +4 -0
  555. package/build-style/site-logo/style.css +4 -0
  556. package/build-style/style-rtl.css +69 -33
  557. package/build-style/style.css +71 -33
  558. package/build-style/video/editor-rtl.css +2 -5
  559. package/build-style/video/editor.css +2 -5
  560. package/build-types/table-of-contents/list.d.ts +12 -0
  561. package/build-types/table-of-contents/list.d.ts.map +1 -0
  562. package/build-types/table-of-contents/utils.d.ts +24 -0
  563. package/build-types/table-of-contents/utils.d.ts.map +1 -0
  564. package/package.json +30 -29
  565. package/src/audio/edit.js +6 -9
  566. package/src/avatar/block.json +0 -1
  567. package/src/avatar/index.php +2 -2
  568. package/src/block/edit.js +39 -42
  569. package/src/block/test/edit.native.js +1 -1
  570. package/src/button/block.json +1 -0
  571. package/src/button/deprecated.js +145 -0
  572. package/src/button/edit.js +3 -1
  573. package/src/button/edit.native.js +6 -3
  574. package/src/button/save.js +3 -1
  575. package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
  576. package/src/buttons/test/edit.native.js +1 -1
  577. package/src/categories/block.json +1 -1
  578. package/src/categories/edit.js +1 -1
  579. package/src/columns/block.json +3 -1
  580. package/src/comment-author-avatar/block.json +1 -0
  581. package/src/comment-author-name/index.php +7 -5
  582. package/src/comment-content/index.php +25 -3
  583. package/src/comment-content/style.scss +5 -0
  584. package/src/comment-edit-link/index.php +1 -4
  585. package/src/comment-reply-link/index.php +1 -4
  586. package/src/comment-template/edit.js +1 -5
  587. package/src/comment-template/index.php +4 -0
  588. package/src/{comments-query-loop → comments}/block.json +1 -1
  589. package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
  590. package/src/{comments-query-loop → comments}/edit.js +2 -1
  591. package/src/{comments-query-loop → comments}/editor.scss +0 -0
  592. package/src/{comments-query-loop → comments}/index.js +0 -0
  593. package/src/{comments-query-loop → comments}/save.js +1 -3
  594. package/src/comments-pagination/index.php +4 -0
  595. package/src/comments-title/block.json +0 -6
  596. package/src/comments-title/deprecated.js +34 -0
  597. package/src/comments-title/edit.js +44 -84
  598. package/src/comments-title/index.js +3 -1
  599. package/src/comments-title/index.php +51 -22
  600. package/src/cover/controls.native.js +1 -2
  601. package/src/cover/deprecated.js +230 -183
  602. package/src/cover/edit/block-controls.js +119 -0
  603. package/src/cover/edit/cover-placeholder.js +39 -0
  604. package/src/cover/edit/index.js +393 -0
  605. package/src/cover/edit/inspector-controls.js +286 -0
  606. package/src/cover/edit/resizable-cover.js +55 -0
  607. package/src/cover/edit/use-cover-is-dark.js +71 -0
  608. package/src/cover/edit.native.js +40 -14
  609. package/src/cover/editor.scss +1 -1
  610. package/src/cover/focal-point-settings-button.native.js +1 -1
  611. package/src/cover/index.php +20 -37
  612. package/src/cover/save.js +26 -13
  613. package/src/cover/shared.js +5 -3
  614. package/src/cover/style.native.scss +4 -0
  615. package/src/cover/style.scss +27 -26
  616. package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
  617. package/src/cover/test/block-controls.js +62 -0
  618. package/src/cover/test/transforms.js +301 -0
  619. package/src/cover/transforms.js +112 -7
  620. package/src/cover/use-cover-is-dark.native.js +51 -0
  621. package/src/editor.scss +3 -1
  622. package/src/embed/embed-preview.js +4 -2
  623. package/src/file/edit.js +5 -1
  624. package/src/file/edit.native.js +0 -1
  625. package/src/file/save.js +14 -2
  626. package/src/gallery/block.json +1 -1
  627. package/src/gallery/edit.js +2 -1
  628. package/src/gallery/gallery.js +2 -2
  629. package/src/gallery/gap-styles.js +21 -6
  630. package/src/gallery/index.php +23 -12
  631. package/src/gallery/shared.js +3 -2
  632. package/src/gallery/use-get-media.js +2 -1
  633. package/src/gallery/use-short-code-transform.js +19 -16
  634. package/src/gallery/v1/gallery.js +2 -2
  635. package/src/group/block.json +1 -0
  636. package/src/heading/block.json +1 -0
  637. package/src/heading/edit.js +5 -2
  638. package/src/heading/transforms.js +4 -3
  639. package/src/image/edit.js +0 -44
  640. package/src/image/edit.native.js +65 -4
  641. package/src/image/editor.scss +1 -1
  642. package/src/image/image.js +10 -13
  643. package/src/image/styles.native.scss +11 -0
  644. package/src/image/test/edit.native.js +7 -7
  645. package/src/index.js +53 -33
  646. package/src/is-block-metadata-experimental.js +19 -0
  647. package/src/latest-posts/edit.js +27 -2
  648. package/src/latest-posts/edit.native.js +56 -1
  649. package/src/latest-posts/index.php +12 -6
  650. package/src/latest-posts/style.scss +4 -0
  651. package/src/list/transforms.js +7 -0
  652. package/src/list/v2/edit.js +1 -0
  653. package/src/list/v2/migrate.js +1 -1
  654. package/src/list/v2/transforms.js +35 -0
  655. package/src/list-item/block.json +2 -1
  656. package/src/list-item/edit.js +17 -10
  657. package/src/list-item/hooks/index.js +3 -0
  658. package/src/list-item/hooks/use-backspace.js +52 -0
  659. package/src/list-item/hooks/use-enter.js +9 -16
  660. package/src/list-item/hooks/use-indent-list-item.js +50 -63
  661. package/src/list-item/hooks/use-space.js +48 -0
  662. package/src/list-item/hooks/use-split.js +33 -0
  663. package/src/list-item/utils.js +1 -1
  664. package/src/media-text/edit.native.js +3 -1
  665. package/src/media-text/media-container.native.js +2 -4
  666. package/src/media-text/transforms.js +154 -0
  667. package/src/navigation/block.json +0 -1
  668. package/src/navigation/edit/index.js +181 -205
  669. package/src/navigation/edit/inner-blocks.js +6 -15
  670. package/src/navigation/index.php +40 -0
  671. package/src/navigation/style.scss +3 -0
  672. package/src/navigation/use-navigation-entities.js +1 -1
  673. package/src/navigation/view-modal.js +32 -0
  674. package/src/navigation-link/edit.js +75 -48
  675. package/src/navigation-link/fallback-variations.js +1 -1
  676. package/src/navigation-link/hooks.js +2 -2
  677. package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
  678. package/src/navigation-link/test/edit.js +0 -20
  679. package/src/navigation-submenu/edit.js +13 -17
  680. package/src/page-list/convert-to-links-modal.js +1 -1
  681. package/src/page-list/edit.js +1 -4
  682. package/src/paragraph/edit.js +6 -0
  683. package/src/paragraph/use-enter.js +103 -0
  684. package/src/post-author/edit.js +24 -22
  685. package/src/post-author/index.php +4 -3
  686. package/src/post-author-name/block.json +1 -0
  687. package/src/post-author-name/index.js +2 -0
  688. package/src/post-author-name/index.php +1 -1
  689. package/src/post-author-name/transforms.js +25 -0
  690. package/src/post-comment/block.json +2 -1
  691. package/src/post-comments/block.json +3 -2
  692. package/src/post-comments/edit.js +206 -44
  693. package/src/post-comments/editor.scss +3 -0
  694. package/src/post-comments/index.php +3 -1
  695. package/src/post-comments/style.scss +30 -5
  696. package/src/post-comments-count/block.json +1 -0
  697. package/src/post-comments-form/block.json +1 -0
  698. package/src/post-comments-form/edit.js +52 -23
  699. package/src/post-comments-form/editor.scss +3 -0
  700. package/src/post-comments-form/form.js +50 -0
  701. package/src/post-comments-form/index.php +10 -3
  702. package/src/post-comments-form/style.scss +1 -4
  703. package/src/post-comments-link/block.json +1 -0
  704. package/src/post-content/edit.js +15 -1
  705. package/src/post-date/edit.js +4 -3
  706. package/src/post-excerpt/edit.js +14 -1
  707. package/src/post-featured-image/edit.js +1 -1
  708. package/src/post-template/edit.js +5 -0
  709. package/src/post-template/index.php +30 -0
  710. package/src/post-terms/block.json +8 -0
  711. package/src/post-terms/edit.js +47 -1
  712. package/src/post-terms/hooks.js +27 -0
  713. package/src/post-terms/index.js +14 -7
  714. package/src/post-terms/index.php +50 -2
  715. package/src/post-title/index.js +1 -1
  716. package/src/pullquote/edit.js +2 -2
  717. package/src/pullquote/edit.native.js +2 -2
  718. package/src/query/block.json +2 -1
  719. package/src/query/edit/inspector-controls/index.js +25 -11
  720. package/src/query/edit/inspector-controls/parent-control.js +133 -0
  721. package/src/query/edit/inspector-controls/sticky-control.js +25 -0
  722. package/src/query/utils.js +22 -0
  723. package/src/query-no-results/edit.js +1 -1
  724. package/src/query-pagination/index.php +0 -1
  725. package/src/query-title/index.js +1 -1
  726. package/src/query-title/variations.js +2 -2
  727. package/src/quote/block.json +1 -0
  728. package/src/quote/edit.js +5 -2
  729. package/src/quote/v2/edit.js +4 -2
  730. package/src/search/block.json +4 -0
  731. package/src/search/edit.js +4 -1
  732. package/src/search/index.php +29 -16
  733. package/src/separator/block.json +3 -0
  734. package/src/separator/editor.scss +1 -0
  735. package/src/shortcode/edit.native.js +29 -15
  736. package/src/shortcode/style.native.scss +11 -4
  737. package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
  738. package/src/shortcode/test/edit.native.js +58 -40
  739. package/src/site-logo/edit.js +1 -1
  740. package/src/site-logo/style.scss +6 -0
  741. package/src/social-links/edit.js +11 -10
  742. package/src/table/edit.js +19 -4
  743. package/src/table-of-contents/block.json +9 -2
  744. package/src/table-of-contents/edit.js +170 -77
  745. package/src/table-of-contents/index.js +2 -0
  746. package/src/table-of-contents/list.tsx +46 -0
  747. package/src/table-of-contents/save.js +25 -0
  748. package/src/table-of-contents/utils.ts +71 -0
  749. package/src/tag-cloud/block.json +1 -1
  750. package/src/template-part/edit/index.js +25 -15
  751. package/src/template-part/edit/inner-blocks.js +2 -10
  752. package/src/video/edit.js +7 -6
  753. package/src/video/editor.scss +3 -6
  754. package/test/babel-plugin.js +67 -0
  755. package/tsconfig.json +11 -0
  756. package/tsconfig.tsbuildinfo +1 -0
  757. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
  758. package/build/comments-query-loop/edit.js.map +0 -1
  759. package/build/comments-query-loop/index.js.map +0 -1
  760. package/build/comments-query-loop/save.js.map +0 -1
  761. package/build/cover/edit.js +0 -665
  762. package/build/cover/edit.js.map +0 -1
  763. package/build/navigation-area/edit.js +0 -110
  764. package/build/navigation-area/edit.js.map +0 -1
  765. package/build/navigation-area/index.js +0 -62
  766. package/build/navigation-area/index.js.map +0 -1
  767. package/build/navigation-area/inner-blocks.js +0 -34
  768. package/build/navigation-area/inner-blocks.js.map +0 -1
  769. package/build/navigation-area/save.js +0 -18
  770. package/build/navigation-area/save.js.map +0 -1
  771. package/build/post-terms/variations.js +0 -37
  772. package/build/post-terms/variations.js.map +0 -1
  773. package/build-module/comments-query-loop/edit.js.map +0 -1
  774. package/build-module/comments-query-loop/index.js.map +0 -1
  775. package/build-module/comments-query-loop/save.js.map +0 -1
  776. package/build-module/cover/edit.js +0 -642
  777. package/build-module/cover/edit.js.map +0 -1
  778. package/build-module/navigation-area/edit.js +0 -94
  779. package/build-module/navigation-area/edit.js.map +0 -1
  780. package/build-module/navigation-area/index.js +0 -48
  781. package/build-module/navigation-area/index.js.map +0 -1
  782. package/build-module/navigation-area/inner-blocks.js +0 -26
  783. package/build-module/navigation-area/inner-blocks.js.map +0 -1
  784. package/build-module/navigation-area/save.js +0 -10
  785. package/build-module/navigation-area/save.js.map +0 -1
  786. package/build-module/post-terms/variations.js +0 -27
  787. package/build-module/post-terms/variations.js.map +0 -1
  788. package/src/cover/edit.js +0 -822
  789. package/src/navigation-area/block.json +0 -23
  790. package/src/navigation-area/edit.js +0 -111
  791. package/src/navigation-area/index.js +0 -26
  792. package/src/navigation-area/index.php +0 -22
  793. package/src/navigation-area/inner-blocks.js +0 -24
  794. package/src/navigation-area/save.js +0 -8
  795. package/src/post-terms/variations.js +0 -28
  796. package/src/table-of-contents/index.php +0 -346
  797. package/src/table-of-contents/list.js +0 -28
  798. package/src/table-of-contents/utils.js +0 -126
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/shared.js"],"names":["POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","backgroundImageStyles","url","backgroundImage","ALLOWED_MEDIA_TYPES","dimRatioToClass","ratio","undefined","Math","round","attributesFromMedia","setAttributes","dimRatio","media","id","type","mediaType","media_type","alt","backgroundType","focalPoint","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName"],"mappings":";;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG;AAC3B,cAAY,sBADe;AAE3B,gBAAc,wBAFa;AAG3B,eAAa,uBAHc;AAI3B,iBAAe,yBAJY;AAK3B,mBAAiB,2BALU;AAM3BC,EAAAA,MAAM,EAAE,2BANmB;AAO3B,kBAAgB,0BAPW;AAQ3B,iBAAe,yBARY;AAS3B,mBAAiB,2BATU;AAU3B,kBAAgB;AAVW,CAA5B;AAaO,MAAMC,qBAAqB,GAAG,OAA9B;;AACA,MAAMC,qBAAqB,GAAG,OAA9B;;AACA,MAAMC,gBAAgB,GAAG,EAAzB;;AACA,MAAMC,gBAAgB,GAAG,IAAzB;;AACA,MAAMC,oBAAoB,GAAG,GAA7B;;;AACA,SAASC,qBAAT,CAAgCC,GAAhC,EAAsC;AAC5C,SAAOA,GAAG,GAAG;AAAEC,IAAAA,eAAe,EAAG,OAAOD,GAAK;AAAhC,GAAH,GAA0C,EAApD;AACA;;AACM,MAAME,mBAAmB,GAAG,CAAE,OAAF,EAAW,OAAX,CAA5B;;;AAEA,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,SAAOA,KAAK,KAAK,EAAV,IAAgB,CAAEA,KAAF,KAAYC,SAA5B,GACJ,IADI,GAEJ,wBAAwB,KAAKC,IAAI,CAACC,KAAL,CAA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QAAAA,WAAW,EAAEd;AAAtC,OADE,GAEF,EAFH;AANc,KAAF,CAAb;AAUA,GAzCD;AA0CA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASe,uBAAT,CAAkCC,eAAlC,EAAoD;AAC1D,SACC,CAAEA,eAAF,IACAA,eAAe,KAAK,eADpB,IAEAA,eAAe,KAAK,QAHrB;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,oBAAT,CAA+BD,eAA/B,EAAiD;AACvD;AACD;AACA;AACC,MAAKD,uBAAuB,CAAEC,eAAF,CAA5B,EAAkD,OAAO,EAAP;AAElD,SAAO7B,mBAAmB,CAAE6B,eAAF,CAA1B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport function backgroundImageStyles( url ) {\n\treturn url ? { backgroundImage: `url(${ url })` } : {};\n}\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ! ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( setAttributes, dimRatio ) {\n\treturn ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( { url: undefined, id: undefined } );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tmedia.type = getBlobTypeByURL( media.url );\n\t\t}\n\n\t\tlet mediaType;\n\t\t// For media selections originated from a file upload.\n\t\tif ( media.media_type ) {\n\t\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t\t} else {\n\t\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t\t}\n\t\t} else {\n\t\t\t// For media selections originated from existing files in the media library.\n\t\t\tif (\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmediaType = media.type;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\turl: media.url,\n\t\t\tid: media.id,\n\t\t\talt: media?.alt,\n\t\t\tbackgroundType: mediaType,\n\t\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t\t? { focalPoint: undefined, hasParallax: undefined }\n\t\t\t\t: {} ),\n\t\t} );\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) return '';\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/shared.js"],"names":["POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","DEFAULT_FOCAL_POINT","x","y","ALLOWED_MEDIA_TYPES","mediaPosition","Math","round","dimRatioToClass","ratio","undefined","attributesFromMedia","setAttributes","dimRatio","media","url","id","type","mediaType","media_type","alt","backgroundType","focalPoint","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName"],"mappings":";;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG;AAC3B,cAAY,sBADe;AAE3B,gBAAc,wBAFa;AAG3B,eAAa,uBAHc;AAI3B,iBAAe,yBAJY;AAK3B,mBAAiB,2BALU;AAM3BC,EAAAA,MAAM,EAAE,2BANmB;AAO3B,kBAAgB,0BAPW;AAQ3B,iBAAe,yBARY;AAS3B,mBAAiB,2BATU;AAU3B,kBAAgB;AAVW,CAA5B;AAaO,MAAMC,qBAAqB,GAAG,OAA9B;;AACA,MAAMC,qBAAqB,GAAG,OAA9B;;AACA,MAAMC,gBAAgB,GAAG,EAAzB;;AACA,MAAMC,gBAAgB,GAAG,IAAzB;;AACA,MAAMC,oBAAoB,GAAG,GAA7B;;AACA,MAAMC,mBAAmB,GAAG;AAAEC,EAAAA,CAAC,EAAE,GAAL;AAAUC,EAAAA,CAAC,EAAE;AAAb,CAA5B;;AACA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,EAAW,OAAX,CAA5B;;;AAEA,SAASC,aAAT,GAAyD;AAAA,MAAjC;AAAEH,IAAAA,CAAF;AAAKC,IAAAA;AAAL,GAAiC,uEAAtBF,mBAAsB;AAC/D,SAAQ,GAAGK,IAAI,CAACC,KAAL,CA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AA,GAAG,EAAED,KAAK,CAACC,GAFG;AAGdC,MAAAA,EAAE,EAAEF,KAAK,CAACE,EAHI;AAIdI,MAAAA,GAAG,EAAEN,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEM,GAJE;AAKdC,MAAAA,cAAc,EAAEH,SALF;AAMd,UAAKA,SAAS,KAAKrB,qBAAd,GACF;AAAEyB,QAAAA,UAAU,EAAEZ,SAAd;AAAyBa,QAAAA,WAAW,EAAEb;AAAtC,OADE,GAEF,EAFH;AANc,KAAF,CAAb;AAUA,GAzCD;AA0CA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASc,uBAAT,CAAkCC,eAAlC,EAAoD;AAC1D,SACC,CAAEA,eAAF,IACAA,eAAe,KAAK,eADpB,IAEAA,eAAe,KAAK,QAHrB;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,oBAAT,CAA+BD,eAA/B,EAAiD;AACvD;AACD;AACA;AACC,MAAKD,uBAAuB,CAAEC,eAAF,CAA5B,EAAkD,OAAO,EAAP;AAElD,SAAO/B,mBAAmB,CAAE+B,eAAF,CAA1B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ! ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( setAttributes, dimRatio ) {\n\treturn ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( { url: undefined, id: undefined } );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tmedia.type = getBlobTypeByURL( media.url );\n\t\t}\n\n\t\tlet mediaType;\n\t\t// For media selections originated from a file upload.\n\t\tif ( media.media_type ) {\n\t\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t\t} else {\n\t\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t\t}\n\t\t} else {\n\t\t\t// For media selections originated from existing files in the media library.\n\t\t\tif (\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tmediaType = media.type;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\turl: media.url,\n\t\t\tid: media.id,\n\t\t\talt: media?.alt,\n\t\t\tbackgroundType: mediaType,\n\t\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t\t? { focalPoint: undefined, hasParallax: undefined }\n\t\t\t\t: {} ),\n\t\t} );\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) return '';\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,6 +11,8 @@ var _blocks = require("@wordpress/blocks");
9
11
 
10
12
  var _shared = require("./shared");
11
13
 
14
+ var _cleanEmptyObject = _interopRequireDefault(require("../utils/clean-empty-object"));
15
+
12
16
  /**
13
17
  * WordPress dependencies
14
18
  */
@@ -78,7 +82,7 @@ const transforms = {
78
82
  type: 'block',
79
83
  blocks: ['core/group'],
80
84
  transform: (attributes, innerBlocks) => {
81
- var _style$color2, _style$color3, _style$color4, _style$color5, _attributes$style;
85
+ var _innerBlocks$, _style$color2, _style$color3, _style$color4, _style$color5;
82
86
 
83
87
  const {
84
88
  align,
@@ -86,10 +90,16 @@ const transforms = {
86
90
  backgroundColor,
87
91
  gradient,
88
92
  style
89
- } = attributes; // If no background or gradient color is provided, default to 50% opacity.
93
+ } = attributes; // If the Group block being transformed has a Cover block as its
94
+ // only child return that Cover block.
95
+
96
+ if ((innerBlocks === null || innerBlocks === void 0 ? void 0 : innerBlocks.length) === 1 && ((_innerBlocks$ = innerBlocks[0]) === null || _innerBlocks$ === void 0 ? void 0 : _innerBlocks$.name) === 'core/cover') {
97
+ return (0, _blocks.createBlock)('core/cover', innerBlocks[0].attributes, innerBlocks[0].innerBlocks);
98
+ } // If no background or gradient color is provided, default to 50% opacity.
90
99
  // This matches the styling of a Cover block with a background image,
91
100
  // in the state where a background image has been removed.
92
101
 
102
+
93
103
  const dimRatio = backgroundColor || gradient || style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background || style !== null && style !== void 0 && (_style$color3 = style.color) !== null && _style$color3 !== void 0 && _style$color3.gradient ? undefined : 50; // Move the background or gradient color to the parent Cover block.
94
104
 
95
105
  const parentAttributes = {
@@ -104,12 +114,12 @@ const transforms = {
104
114
  const attributesWithoutBackgroundColors = { ...attributes,
105
115
  backgroundColor: undefined,
106
116
  gradient: undefined,
107
- style: { ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
108
- color: { ...(attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.color),
117
+ style: (0, _cleanEmptyObject.default)({ ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
118
+ color: style !== null && style !== void 0 && style.color ? { ...(style === null || style === void 0 ? void 0 : style.color),
109
119
  background: undefined,
110
120
  gradient: undefined
111
- }
112
- }
121
+ } : undefined
122
+ })
113
123
  }; // Preserve the block by nesting it within the Cover block,
114
124
  // instead of converting the Group block directly to the Cover block.
115
125
 
@@ -200,6 +210,67 @@ const transforms = {
200
210
  anchor
201
211
  });
202
212
  }
213
+ }, {
214
+ type: 'block',
215
+ blocks: ['core/group'],
216
+ isMatch: _ref7 => {
217
+ let {
218
+ url
219
+ } = _ref7;
220
+
221
+ // If the Cover block uses background media, skip this transform,
222
+ // and instead use the Group block's default transform.
223
+ if (url) {
224
+ return false;
225
+ }
226
+
227
+ return true;
228
+ },
229
+ transform: (attributes, innerBlocks) => {
230
+ var _attributes$style, _attributes$style2, _innerBlocks$2;
231
+
232
+ // Convert Cover overlay colors to comparable Group background colors.
233
+ const transformedColorAttributes = {
234
+ backgroundColor: attributes === null || attributes === void 0 ? void 0 : attributes.overlayColor,
235
+ gradient: attributes === null || attributes === void 0 ? void 0 : attributes.gradient,
236
+ style: (0, _cleanEmptyObject.default)({ ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
237
+ color: attributes !== null && attributes !== void 0 && attributes.customOverlayColor || attributes !== null && attributes !== void 0 && attributes.customGradient || attributes !== null && attributes !== void 0 && (_attributes$style = attributes.style) !== null && _attributes$style !== void 0 && _attributes$style.color ? {
238
+ background: attributes === null || attributes === void 0 ? void 0 : attributes.customOverlayColor,
239
+ gradient: attributes === null || attributes === void 0 ? void 0 : attributes.customGradient,
240
+ ...(attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : _attributes$style2.color)
241
+ } : undefined
242
+ })
243
+ }; // If the Cover block contains only a single Group block as a direct child,
244
+ // then attempt to merge the Cover's background colors with the child Group block,
245
+ // and remove the Cover block as the wrapper.
246
+
247
+ if ((innerBlocks === null || innerBlocks === void 0 ? void 0 : innerBlocks.length) === 1 && ((_innerBlocks$2 = innerBlocks[0]) === null || _innerBlocks$2 === void 0 ? void 0 : _innerBlocks$2.name) === 'core/group') {
248
+ var _groupAttributes$styl, _groupAttributes$styl2, _groupAttributes$styl3, _groupAttributes$styl4, _transformedColorAttr, _groupAttributes$styl5, _transformedColorAttr2, _groupAttributes$styl6, _innerBlocks$4;
249
+
250
+ const groupAttributes = (0, _cleanEmptyObject.default)(innerBlocks[0].attributes || {}); // If the Group block contains any kind of background color or gradient,
251
+ // skip merging Cover background colors, and preserve the Group block's colors.
252
+
253
+ if (groupAttributes !== null && groupAttributes !== void 0 && groupAttributes.backgroundColor || groupAttributes !== null && groupAttributes !== void 0 && groupAttributes.gradient || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl = groupAttributes.style) !== null && _groupAttributes$styl !== void 0 && (_groupAttributes$styl2 = _groupAttributes$styl.color) !== null && _groupAttributes$styl2 !== void 0 && _groupAttributes$styl2.background || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl3 = groupAttributes.style) !== null && _groupAttributes$styl3 !== void 0 && (_groupAttributes$styl4 = _groupAttributes$styl3.color) !== null && _groupAttributes$styl4 !== void 0 && _groupAttributes$styl4.gradient) {
254
+ var _innerBlocks$3;
255
+
256
+ return (0, _blocks.createBlock)('core/group', groupAttributes, (_innerBlocks$3 = innerBlocks[0]) === null || _innerBlocks$3 === void 0 ? void 0 : _innerBlocks$3.innerBlocks);
257
+ }
258
+
259
+ return (0, _blocks.createBlock)('core/group', { ...transformedColorAttributes,
260
+ ...groupAttributes,
261
+ style: (0, _cleanEmptyObject.default)({ ...(groupAttributes === null || groupAttributes === void 0 ? void 0 : groupAttributes.style),
262
+ color: transformedColorAttributes !== null && transformedColorAttributes !== void 0 && (_transformedColorAttr = transformedColorAttributes.style) !== null && _transformedColorAttr !== void 0 && _transformedColorAttr.color || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl5 = groupAttributes.style) !== null && _groupAttributes$styl5 !== void 0 && _groupAttributes$styl5.color ? { ...(transformedColorAttributes === null || transformedColorAttributes === void 0 ? void 0 : (_transformedColorAttr2 = transformedColorAttributes.style) === null || _transformedColorAttr2 === void 0 ? void 0 : _transformedColorAttr2.color),
263
+ ...(groupAttributes === null || groupAttributes === void 0 ? void 0 : (_groupAttributes$styl6 = groupAttributes.style) === null || _groupAttributes$styl6 === void 0 ? void 0 : _groupAttributes$styl6.color)
264
+ } : undefined
265
+ })
266
+ }, (_innerBlocks$4 = innerBlocks[0]) === null || _innerBlocks$4 === void 0 ? void 0 : _innerBlocks$4.innerBlocks);
267
+ } // In all other cases, transform the Cover block directly to a Group block.
268
+
269
+
270
+ return (0, _blocks.createBlock)('core/group', { ...attributes,
271
+ ...transformedColorAttributes
272
+ }, innerBlocks);
273
+ }
203
274
  }]
204
275
  };
205
276
  var _default = transforms;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/transforms.js"],"names":["transforms","from","type","blocks","transform","caption","url","alt","align","id","anchor","style","dimRatio","color","duotone","content","fontSize","src","backgroundType","VIDEO_BACKGROUND_TYPE","attributes","innerBlocks","backgroundColor","gradient","background","undefined","parentAttributes","overlayColor","customOverlayColor","customGradient","attributesWithoutBackgroundColors","to","isMatch","IMAGE_BACKGROUND_TYPE","title"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA;;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,GAAX;AAAgBC,QAAAA,GAAhB;AAAqBC,QAAAA,KAArB;AAA4BC,QAAAA,EAA5B;AAAgCC,QAAAA,MAAhC;AAAwCC,QAAAA;AAAxC,OAAF;AAAA,aACV,yBACC,YADD,EAEC;AACCC,QAAAA,QAAQ,EAAE,EADX;AAECN,QAAAA,GAFD;AAGCC,QAAAA,GAHD;AAICC,QAAAA,KAJD;AAKCC,QAAAA,EALD;AAMCC,QAAAA,MAND;AAOCC,QAAAA,KAAK,EAAE;AACNE,UAAAA,KAAK,EAAE;AACNC,YAAAA,OAAO,EAAEH,KAAF,aAAEA,KAAF,uCAAEA,KAAK,CAAEE,KAAT,iDAAE,aAAcC;AADjB;AADD;AAPR,OAFD,EAeC,CACC,yBAAa,gBAAb,EAA+B;AAC9BC,QAAAA,OAAO,EAAEV,OADqB;AAE9BW,QAAAA,QAAQ,EAAE,OAFoB;AAG9BR,QAAAA,KAAK,EAAE;AAHuB,OAA/B,CADD,CAfD,CADU;AAAA;AAHZ,GADK,EA6BL;AACCN,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CA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1BjB,QAAAA,GAAG,EAAEX,GAFqB;AAG1BG,QAAAA,EAH0B;AAI1BD,QAAAA,KAJ0B;AAK1BE,QAAAA;AAL0B,OAA3B,CADU;AAAA;AAvBZ,GAvCG;AAjHc,CAAnB;eA2LeV,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { caption, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( { caption, src, align, id, anchor } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl: src,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tbackgroundType: VIDEO_BACKGROUND_TYPE,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tgradient,\n\t\t\t\t\tstyle,\n\t\t\t\t} = attributes;\n\n\t\t\t\t// If no background or gradient color is provided, default to 50% opacity.\n\t\t\t\t// This matches the styling of a Cover block with a background image,\n\t\t\t\t// in the state where a background image has been removed.\n\t\t\t\tconst dimRatio =\n\t\t\t\t\tbackgroundColor ||\n\t\t\t\t\tgradient ||\n\t\t\t\t\tstyle?.color?.background ||\n\t\t\t\t\tstyle?.color?.gradient\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: 50;\n\n\t\t\t\t// Move the background or gradient color to the parent Cover block.\n\t\t\t\tconst parentAttributes = {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tdimRatio,\n\t\t\t\t\toverlayColor: backgroundColor,\n\t\t\t\t\tcustomOverlayColor: style?.color?.background,\n\t\t\t\t\tgradient,\n\t\t\t\t\tcustomGradient: style?.color?.gradient,\n\t\t\t\t};\n\n\t\t\t\tconst attributesWithoutBackgroundColors = {\n\t\t\t\t\t...attributes,\n\t\t\t\t\tbackgroundColor: undefined,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...attributes?.style?.color,\n\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\t// Preserve the block by nesting it within the Cover block,\n\t\t\t\t// instead of converting the Group block directly to the Cover block.\n\t\t\t\treturn createBlock( 'core/cover', parentAttributes, [\n\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\tattributesWithoutBackgroundColors,\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents an image background.\n\t\t\t\t\treturn backgroundType === IMAGE_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\turl,\n\t\t\t\t\talt,\n\t\t\t\t\talign,\n\t\t\t\t\tid,\n\t\t\t\t\tanchor,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents a video background.\n\t\t\t\t\treturn backgroundType === VIDEO_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, align, id, anchor } ) =>\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\tsrc: url,\n\t\t\t\t\tid,\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t} ),\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/transforms.js"],"names":["transforms","from","type","blocks","transform","caption","url","alt","align","id","anchor","style","dimRatio","color","duotone","content","fontSize","src","backgroundType","VIDEO_BACKGROUND_TYPE","attributes","innerBlocks","backgroundColor","gradient","length","name","background","undefined","parentAttributes","overlayColor","customOverlayColor","customGradient","attributesWithoutBackgroundColors","to","isMatch","IMAGE_BACKGROUND_TYPE","title","transformedColorAttributes","groupAttributes"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA;;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,GAAX;AAAgBC,QAAAA,GAAhB;AA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OApEwC,CAsEzC;;;AACA,aAAO,yBACN,YADM,EAEN,EAAE,GAAGD,UAAL;AAAiB,WAAGiB;AAApB,OAFM,EAGNhB,WAHM,CAAP;AAKA;AAvFF,GAvEG;AAhIc,CAAnB;eAmSerB,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';\nimport cleanEmptyObject from '../utils/clean-empty-object';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { caption, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( { caption, src, align, id, anchor } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl: src,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tbackgroundType: VIDEO_BACKGROUND_TYPE,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tgradient,\n\t\t\t\t\tstyle,\n\t\t\t\t} = attributes;\n\n\t\t\t\t// If the Group block being transformed has a Cover block as its\n\t\t\t\t// only child return that Cover block.\n\t\t\t\tif (\n\t\t\t\t\tinnerBlocks?.length === 1 &&\n\t\t\t\t\tinnerBlocks[ 0 ]?.name === 'core/cover'\n\t\t\t\t) {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\tinnerBlocks[ 0 ].attributes,\n\t\t\t\t\t\tinnerBlocks[ 0 ].innerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// If no background or gradient color is provided, default to 50% opacity.\n\t\t\t\t// This matches the styling of a Cover block with a background image,\n\t\t\t\t// in the state where a background image has been removed.\n\t\t\t\tconst dimRatio =\n\t\t\t\t\tbackgroundColor ||\n\t\t\t\t\tgradient ||\n\t\t\t\t\tstyle?.color?.background ||\n\t\t\t\t\tstyle?.color?.gradient\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: 50;\n\n\t\t\t\t// Move the background or gradient color to the parent Cover block.\n\t\t\t\tconst parentAttributes = {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tdimRatio,\n\t\t\t\t\toverlayColor: backgroundColor,\n\t\t\t\t\tcustomOverlayColor: style?.color?.background,\n\t\t\t\t\tgradient,\n\t\t\t\t\tcustomGradient: style?.color?.gradient,\n\t\t\t\t};\n\n\t\t\t\tconst attributesWithoutBackgroundColors = {\n\t\t\t\t\t...attributes,\n\t\t\t\t\tbackgroundColor: undefined,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor: style?.color\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\n\t\t\t\t// Preserve the block by nesting it within the Cover block,\n\t\t\t\t// instead of converting the Group block directly to the Cover block.\n\t\t\t\treturn createBlock( 'core/cover', parentAttributes, [\n\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\tattributesWithoutBackgroundColors,\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents an image background.\n\t\t\t\t\treturn backgroundType === IMAGE_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\turl,\n\t\t\t\t\talt,\n\t\t\t\t\talign,\n\t\t\t\t\tid,\n\t\t\t\t\tanchor,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents a video background.\n\t\t\t\t\treturn backgroundType === VIDEO_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, align, id, anchor } ) =>\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\tsrc: url,\n\t\t\t\t\tid,\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\tisMatch: ( { url } ) => {\n\t\t\t\t// If the Cover block uses background media, skip this transform,\n\t\t\t\t// and instead use the Group block's default transform.\n\t\t\t\tif ( url ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\t// Convert Cover overlay colors to comparable Group background colors.\n\t\t\t\tconst transformedColorAttributes = {\n\t\t\t\t\tbackgroundColor: attributes?.overlayColor,\n\t\t\t\t\tgradient: attributes?.gradient,\n\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tattributes?.customOverlayColor ||\n\t\t\t\t\t\t\tattributes?.customGradient ||\n\t\t\t\t\t\t\tattributes?.style?.color\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\tattributes?.customOverlayColor,\n\t\t\t\t\t\t\t\t\t\tgradient: attributes?.customGradient,\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.color,\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\n\t\t\t\t// If the Cover block contains only a single Group block as a direct child,\n\t\t\t\t// then attempt to merge the Cover's background colors with the child Group block,\n\t\t\t\t// and remove the Cover block as the wrapper.\n\t\t\t\tif (\n\t\t\t\t\tinnerBlocks?.length === 1 &&\n\t\t\t\t\tinnerBlocks[ 0 ]?.name === 'core/group'\n\t\t\t\t) {\n\t\t\t\t\tconst groupAttributes = cleanEmptyObject(\n\t\t\t\t\t\tinnerBlocks[ 0 ].attributes || {}\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the Group block contains any kind of background color or gradient,\n\t\t\t\t\t// skip merging Cover background colors, and preserve the Group block's colors.\n\t\t\t\t\tif (\n\t\t\t\t\t\tgroupAttributes?.backgroundColor ||\n\t\t\t\t\t\tgroupAttributes?.gradient ||\n\t\t\t\t\t\tgroupAttributes?.style?.color?.background ||\n\t\t\t\t\t\tgroupAttributes?.style?.color?.gradient\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\tgroupAttributes,\n\t\t\t\t\t\t\tinnerBlocks[ 0 ]?.innerBlocks\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...transformedColorAttributes,\n\t\t\t\t\t\t\t...groupAttributes,\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...groupAttributes?.style,\n\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\ttransformedColorAttributes?.style?.color ||\n\t\t\t\t\t\t\t\t\tgroupAttributes?.style?.color\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t...transformedColorAttributes\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.style?.color,\n\t\t\t\t\t\t\t\t\t\t\t\t...groupAttributes?.style\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.color,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerBlocks[ 0 ]?.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// In all other cases, transform the Cover block directly to a Group block.\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ ...attributes, ...transformedColorAttributes },\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useCoverIsDark;
7
+
8
+ var _colord = require("colord");
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ /**
13
+ * External dependencies
14
+ */
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * useCoverIsDark is a hook that returns a boolean variable specifying if the cover
22
+ * background is dark or not.
23
+ *
24
+ * @param {?boolean} initialValue Initial value.
25
+ * @param {?string} url Url of the media background.
26
+ * @param {?number} dimRatio Transparency of the overlay color. If an image and
27
+ * color are set, dimRatio is used to decide what is used
28
+ * for background darkness checking purposes.
29
+ * @param {?string} overlayColor String containing the overlay color value if one exists.
30
+ *
31
+ * @return {boolean} True if the cover background is considered "dark" and false otherwise.
32
+ */
33
+ function useCoverIsDark() {
34
+ let initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
35
+ let url = arguments.length > 1 ? arguments[1] : undefined;
36
+ let dimRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
37
+ let overlayColor = arguments.length > 3 ? arguments[3] : undefined;
38
+ const [isDark, setIsDark] = (0, _element.useState)(initialValue);
39
+ (0, _element.useEffect)(() => {
40
+ // If opacity is greater than 50 the dominant color is the overlay color,
41
+ // so use that color for the dark mode computation.
42
+ if (dimRatio > 50 || !url) {
43
+ if (!overlayColor) {
44
+ // If no overlay color exists the overlay color is black (isDark )
45
+ setIsDark(true);
46
+ return;
47
+ }
48
+
49
+ setIsDark((0, _colord.colord)(overlayColor).isDark());
50
+ }
51
+ }, [overlayColor, dimRatio > 50 || !url, setIsDark]);
52
+ (0, _element.useEffect)(() => {
53
+ if (!url && !overlayColor) {
54
+ // Reset isDark.
55
+ setIsDark(false);
56
+ }
57
+ }, [!url && !overlayColor, setIsDark]);
58
+ return isDark;
59
+ }
60
+ //# sourceMappingURL=use-cover-is-dark.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/use-cover-is-dark.native.js"],"names":["useCoverIsDark","initialValue","url","dimRatio","overlayColor","isDark","setIsDark"],"mappings":";;;;;;;AAIA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,GAKb;AAAA,MAJDC,YAIC,uEAJc,KAId;AAAA,MAHDC,GAGC;AAAA,MAFDC,QAEC,uEAFU,EAEV;AAAA,MADDC,YACC;AACD,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAUL,YAAV,CAA9B;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKE,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAxB,EAA8B;AAC7B,UAAK,CAAEE,YAAP,EAAsB;AACrB;AACAE,QAAAA,SAAS,CAAE,IAAF,CAAT;AACA;AACA;;AACDA,MAAAA,SAAS,CAAE,oBAAQF,YAAR,EAAuBC,MAAvB,EAAF,CAAT;AACA;AACD,GAXD,EAWG,CAAED,YAAF,EAAgBD,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAnC,EAAwCI,SAAxC,CAXH;AAYA,0BAAW,MAAM;AAChB,QAAK,CAAEJ,GAAF,IAAS,CAAEE,YAAhB,EAA+B;AAC9B;AACAE,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GALD,EAKG,CAAE,CAAEJ,GAAF,IAAS,CAAEE,YAAb,EAA2BE,SAA3B,CALH;AAMA,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\n\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * useCoverIsDark is a hook that returns a boolean variable specifying if the cover\n * background is dark or not.\n *\n * @param {?boolean} initialValue Initial value.\n * @param {?string} url Url of the media background.\n * @param {?number} dimRatio Transparency of the overlay color. If an image and\n * color are set, dimRatio is used to decide what is used\n * for background darkness checking purposes.\n * @param {?string} overlayColor String containing the overlay color value if one exists.\n *\n * @return {boolean} True if the cover background is considered \"dark\" and false otherwise.\n */\nexport default function useCoverIsDark(\n\tinitialValue = false,\n\turl,\n\tdimRatio = 50,\n\toverlayColor\n) {\n\tconst [ isDark, setIsDark ] = useState( initialValue );\n\tuseEffect( () => {\n\t\t// If opacity is greater than 50 the dominant color is the overlay color,\n\t\t// so use that color for the dark mode computation.\n\t\tif ( dimRatio > 50 || ! url ) {\n\t\t\tif ( ! overlayColor ) {\n\t\t\t\t// If no overlay color exists the overlay color is black (isDark )\n\t\t\t\tsetIsDark( true );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsDark( colord( overlayColor ).isDark() );\n\t\t}\n\t}, [ overlayColor, dimRatio > 50 || ! url, setIsDark ] );\n\tuseEffect( () => {\n\t\tif ( ! url && ! overlayColor ) {\n\t\t\t// Reset isDark.\n\t\t\tsetIsDark( false );\n\t\t}\n\t}, [ ! url && ! overlayColor, setIsDark ] );\n\treturn isDark;\n}\n"]}
@@ -142,7 +142,7 @@ class EmbedPreview extends _element.Component {
142
142
  value: caption,
143
143
  onChange: onCaptionChange,
144
144
  inlineToolbar: true,
145
- __unstableOnSplitAtEnd: () => insertBlocksAfter((0, _blocks.createBlock)('core/paragraph'))
145
+ __unstableOnSplitAtEnd: () => insertBlocksAfter((0, _blocks.createBlock)((0, _blocks.getDefaultBlockName)()))
146
146
  }));
147
147
  }
148
148
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"names":["EmbedPreview","Component","constructor","arguments","hideOverlay","bind","state","interactive","getDerivedStateFromProps","nextProps","isSelected","setState","render","preview","previewable","url","type","caption","onCaptionChange","className","icon","label","insertBlocksAfter","props","scripts","html","parsedHost","URL","host","split","parsedHostBaseUrl","splice","length","join","iframeTitle","sandboxClassnames","embedWrapper","RichText","isEmpty"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGA,MAAMA,YAAN,SAA2BC,kBAA3B,CAAqC;AACpCC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,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A,WAAW,EAAG,cAAI,aAAJ,CAFf;AAGC,MAAA,KAAK,EAAGO,OAHT;AAIC,MAAA,QAAQ,EAAGC,eAJZ;AAKC,MAAA,aAAa,MALd;AAMC,MAAA,sBAAsB,EAAG,MACxBI,iBAAiB,CAAE,yBAAa,gBAAb,CAAF;AAPnB,MA3BF,CADD;AAyCA;;AAjImC;;eAoItBtB,Y","sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { RichText, BlockIcon } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\n\nclass EmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.hideOverlay = this.hideOverlay.bind( this );\n\t\tthis.state = {\n\t\t\tinteractive: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromProps( nextProps, state ) {\n\t\tif ( ! nextProps.isSelected && state.interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\treturn { interactive: false };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thideOverlay() {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tthis.setState( { interactive: true } );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tpreview,\n\t\t\tpreviewable,\n\t\t\turl,\n\t\t\ttype,\n\t\t\tcaption,\n\t\t\tonCaptionChange,\n\t\t\tisSelected,\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tlabel,\n\t\t\tinsertBlocksAfter,\n\t\t} = this.props;\n\t\tconst { scripts } = preview;\n\t\tconst { interactive } = this.state;\n\n\t\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\t\tconst parsedHost = new URL( url ).host.split( '.' );\n\t\tconst parsedHostBaseUrl = parsedHost\n\t\t\t.splice( parsedHost.length - 2, parsedHost.length - 1 )\n\t\t\t.join( '.' );\n\t\tconst iframeTitle = sprintf(\n\t\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t\t__( 'Embedded content from %s' ),\n\t\t\tparsedHostBaseUrl\n\t\t);\n\t\tconst sandboxClassnames = classnames(\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\t'wp-block-embed__wrapper'\n\t\t);\n\n\t\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t\t// as far as the user is concerned. We're just catching the first click so that\n\t\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tconst embedWrapper =\n\t\t\t'wp-embed' === type ? (\n\t\t\t\t<WpEmbedPreview html={ html } />\n\t\t\t) : (\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<SandBox\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tonFocus={ this.hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! interactive && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\t\tonMouseUp={ this.hideOverlay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\tclassName={ classnames( className, 'wp-block-embed', {\n\t\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tparsedHostBaseUrl\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ onCaptionChange }\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t);\n\t}\n}\n\nexport default EmbedPreview;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/embed/embed-preview.js"],"names":["EmbedPreview","Component","constructor","arguments","hideOverlay","bind","state","interactive","getDerivedStateFromProps","nextProps","isSelected","setState","render","preview","previewable","url","type","caption","onCaptionChange","className","icon","label","insertBlocksAfter","props","scripts","html","parsedHost","URL","host","split","parsedHostBaseUrl","splice","length","join","iframeTitle","sandboxClassnames","embedWrapper","RichText","isEmpty"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AAKA;;AACA;;AACA;;AAEA;;AAKA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGA,MAAMA,YAAN,SAA2BC,kBAA3B,CAAqC;AACpCC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,WAAL,GAAmB,KAAKA,WAAL,CAAiBC,IAAjB,CAAuB,IAAvB,CAAnB;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,WAAW,EAAE;AADD,KAAb;AAGA;;AAE8B,SAAxBC,wBAAwB,CAAEC,SAAF,EAAaH,KAAb,EAAqB;AACnD,QAAK,CAAEG,SAAS,CAACC,UAAZ,IAA0BJ,KAAK,CAACC,WAArC,EAAmD;AAClD;AACA;AACA;AACA,aAAO;AAAEA,QAAAA,WAAW,EAAE;AAAf,OAAP;AACA;;AAED,WAAO,IAAP;AACA;;AAEDH,EAAAA,WAAW,GAAG;AACb;AACA;AACA;AACA;AACA;AACA,SAAKO,QAAL,CAAe;AAAEJ,MAAAA,WAAW,EAAE;AAAf,KAAf;AACA;;AAEDK,EAAAA,MAAM,GAAG;AACR,UAAM;AACLC,MAAAA,OADK;AAELC,MAAAA,WAFK;AAGLC,MAAAA,GAHK;AAILC,MAAAA,IAJK;AAKLC,MAAAA,OALK;AAMLC,MAAAA,eANK;AAOLR,MAAAA,UAPK;AAQLS,MAAAA,SARK;AASLC,MAAAA,IATK;AAULC,MAAAA,KAVK;AAWLC,MAAAA;AAXK,QAYF,KAAKC,KAZT;AAaA,UAAM;AAAEC,MAAAA;AAAF,QAAcX,OAApB;AACA,UAAM;AAAEN,MAAAA;A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,IAAlB;AAAyB,QAAA,UAAU;AAAnC,QADR;AAEC,MAAA,KAAK,EAAGC;AAFT,OAIC;AAAG,MAAA,SAAS,EAAC;AAAb,OACC;AAAG,MAAA,IAAI,EAAGN;AAAV,OAAkBA,GAAlB,CADD,CAJD,EAOC;AAAG,MAAA,SAAS,EAAC;AAAb,OACG;AACD;AACA,kBACC,4DADD,CAFC,EAKDe,iBALC,CADH,CAPD,CARF,EA0BG,CAAE,CAAEO,sBAASC,OAAT,CAAkBrB,OAAlB,CAAF,IAAiCP,UAAnC,KACD,4BAAC,qBAAD;AACC,MAAA,OAAO,EAAC,YADT;AAEC,MAAA,WAAW,EAAG,cAAI,aAAJ,CAFf;AAGC,MAAA,KAAK,EAAGO,OAHT;AAIC,MAAA,QAAQ,EAAGC,eAJZ;AAKC,MAAA,aAAa,MALd;AAMC,MAAA,sBAAsB,EAAG,MACxBI,iBAAiB,CAChB,yBAAa,kCAAb,CADgB;AAPnB,MA3BF,CADD;AA2CA;;AAnImC;;eAsItBtB,Y","sourcesContent":["/**\n * Internal dependencies\n */\nimport { getPhotoHtml } from './util';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, SandBox } from '@wordpress/components';\nimport { RichText, BlockIcon } from '@wordpress/block-editor';\nimport { Component } from '@wordpress/element';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport WpEmbedPreview from './wp-embed-preview';\n\nclass EmbedPreview extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.hideOverlay = this.hideOverlay.bind( this );\n\t\tthis.state = {\n\t\t\tinteractive: false,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromProps( nextProps, state ) {\n\t\tif ( ! nextProps.isSelected && state.interactive ) {\n\t\t\t// We only want to change this when the block is not selected, because changing it when\n\t\t\t// the block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\t\t// happens on mouseup when the overlay is clicked.\n\t\t\treturn { interactive: false };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thideOverlay() {\n\t\t// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t\t// changing, because that happens on mouse down, and the overlay immediately disappears,\n\t\t// and the mouse event can end up in the preview content. We can't use onClick on\n\t\t// the overlay to hide it either, because then the editor misses the mouseup event, and\n\t\t// thinks we're multi-selecting blocks.\n\t\tthis.setState( { interactive: true } );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tpreview,\n\t\t\tpreviewable,\n\t\t\turl,\n\t\t\ttype,\n\t\t\tcaption,\n\t\t\tonCaptionChange,\n\t\t\tisSelected,\n\t\t\tclassName,\n\t\t\ticon,\n\t\t\tlabel,\n\t\t\tinsertBlocksAfter,\n\t\t} = this.props;\n\t\tconst { scripts } = preview;\n\t\tconst { interactive } = this.state;\n\n\t\tconst html = 'photo' === type ? getPhotoHtml( preview ) : preview.html;\n\t\tconst parsedHost = new URL( url ).host.split( '.' );\n\t\tconst parsedHostBaseUrl = parsedHost\n\t\t\t.splice( parsedHost.length - 2, parsedHost.length - 1 )\n\t\t\t.join( '.' );\n\t\tconst iframeTitle = sprintf(\n\t\t\t// translators: %s: host providing embed content e.g: www.youtube.com\n\t\t\t__( 'Embedded content from %s' ),\n\t\t\tparsedHostBaseUrl\n\t\t);\n\t\tconst sandboxClassnames = classnames(\n\t\t\ttype,\n\t\t\tclassName,\n\t\t\t'wp-block-embed__wrapper'\n\t\t);\n\n\t\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t\t// as far as the user is concerned. We're just catching the first click so that\n\t\t// the block can be selected without interacting with the embed preview that the overlay covers.\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tconst embedWrapper =\n\t\t\t'wp-embed' === type ? (\n\t\t\t\t<WpEmbedPreview html={ html } />\n\t\t\t) : (\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<SandBox\n\t\t\t\t\t\thtml={ html }\n\t\t\t\t\t\tscripts={ scripts }\n\t\t\t\t\t\ttitle={ iframeTitle }\n\t\t\t\t\t\ttype={ sandboxClassnames }\n\t\t\t\t\t\tonFocus={ this.hideOverlay }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! interactive && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-library-embed__interactive-overlay\"\n\t\t\t\t\t\t\tonMouseUp={ this.hideOverlay }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\tclassName={ classnames( className, 'wp-block-embed', {\n\t\t\t\t\t'is-type-video': 'video' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ previewable ? (\n\t\t\t\t\tembedWrapper\n\t\t\t\t) : (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t<a href={ url }>{ url }</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: host providing embed content e.g: www.youtube.com */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\"Embedded content from %s can't be previewed in the editor.\"\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tparsedHostBaseUrl\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</Placeholder>\n\t\t\t\t) }\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ onCaptionChange }\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t);\n\t}\n}\n\nexport default EmbedPreview;\n"]}
@@ -298,7 +298,7 @@ function FileEdit(_ref2) {
298
298
  tagName: "div" // Must be block-level or else cursor disappears.
299
299
  ,
300
300
  "aria-label": (0, _i18n.__)('Download button text'),
301
- className: 'wp-block-file__button',
301
+ className: (0, _classnames.default)('wp-block-file__button', _blockEditor.__experimentalElementButtonClassName),
302
302
  value: downloadButtonText,
303
303
  withoutInteractiveFormatting: true,
304
304
  placeholder: (0, _i18n.__)('Add text…'),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/file/edit.js"],"names":["MIN_PREVIEW_HEIGHT","MAX_PREVIEW_HEIGHT","ClipboardToolbarButton","text","disabled","createNotice","noticesStore","ref","isDismissible","type","FileEdit","attributes","isSelected","setAttributes","noticeUI","noticeOperations","clientId","id","fileId","fileName","href","textLinkHref","textLinkTarget","showDownloadButton","downloadButtonText","displayPreview","previewHeight","media","mediaUpload","select","undefined","coreStore","getMedia","blockEditorStore","getSettings","toggleSelection","__unstableMarkNextChangeAsNotPersistent","file","filesList","onFileChange","newMedia","onSelectFile","onError","onUploadError","changeDownloadButtonText","url","isPdf","endsWith","title","message","removeAllNotices","createErrorNotice","changeLinkDestinationOption","newHref","changeOpenInNewWindow","newValue","changeShowDownloadButton","replace","changeDisplayPreview","handleOnResizeStop","event","direction","elt","delta","newHeight","parseInt","height","changePreviewHeight","Math","max","attachmentPage","link","blockProps","className","displayPreviewInEditor","icon","instructions","openInNew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eAEc,6BAAaO,QAAb,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\twithNotices,\n\tResizableBox,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport FileBlockInspector from './inspector';\nimport { browserSupportsPdfs } from './utils';\n\nexport const MIN_PREVIEW_HEIGHT = 200;\nexport const MAX_PREVIEW_HEIGHT = 2000;\n\nfunction ClipboardToolbarButton( { text, disabled } ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tclassName=\"components-clipboard-toolbar-button\"\n\t\t\tref={ ref }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ __( 'Copy URL' ) }\n\t\t</ToolbarButton>\n\t);\n}\n\nfunction FileEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tnoticeUI,\n\tnoticeOperations,\n\tclientId,\n} ) {\n\tconst {\n\t\tid,\n\t\tfileId,\n\t\tfileName,\n\t\thref,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\tconst { media, mediaUpload } = useSelect(\n\t\t( select ) => ( {\n\t\t\tmedia:\n\t\t\t\tid === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: select( coreStore ).getMedia( id ),\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\n\t\t} ),\n\t\t[ id ]\n\t);\n\n\tconst {\n\t\ttoggleSelection,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Upload a file drag-and-dropped into the editor.\n\t\tif ( isBlobURL( href ) ) {\n\t\t\tconst file = getBlobByURL( href );\n\n\t\t\tmediaUpload( {\n\t\t\t\tfilesList: [ file ],\n\t\t\t\tonFileChange: ( [ newMedia ] ) => onSelectFile( newMedia ),\n\t\t\t\tonError: onUploadError,\n\t\t\t} );\n\n\t\t\trevokeBlobURL( href );\n\t\t}\n\n\t\tif ( downloadButtonText === undefined ) {\n\t\t\tchangeDownloadButtonText( _x( 'Download', 'button label' ) );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! fileId && href ) {\n\t\t\t// Add a unique fileId to each file block.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { fileId: `wp-block-file--media-${ clientId }` } );\n\t\t}\n\t}, [ href, fileId, clientId ] );\n\n\tfunction onSelectFile( newMedia ) {\n\t\tif ( newMedia && newMedia.url ) {\n\t\t\tconst isPdf = newMedia.url.endsWith( '.pdf' );\n\t\t\tsetAttributes( {\n\t\t\t\thref: newMedia.url,\n\t\t\t\tfileName: newMedia.title,\n\t\t\t\ttextLinkHref: newMedia.url,\n\t\t\t\tid: newMedia.id,\n\t\t\t\tdisplayPreview: isPdf ? true : undefined,\n\t\t\t\tpreviewHeight: isPdf ? 600 : undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tsetAttributes( { href: undefined } );\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t}\n\n\tfunction changeLinkDestinationOption( newHref ) {\n\t\t// Choose Media File or Attachment Page (when file is in Media Library).\n\t\tsetAttributes( { textLinkHref: newHref } );\n\t}\n\n\tfunction changeOpenInNewWindow( newValue ) {\n\t\tsetAttributes( {\n\t\t\ttextLinkTarget: newValue ? '_blank' : false,\n\t\t} );\n\t}\n\n\tfunction changeShowDownloadButton( newValue ) {\n\t\tsetAttributes( { showDownloadButton: newValue } );\n\t}\n\n\tfunction changeDownloadButtonText( newValue ) {\n\t\t// Remove anchor tags from button text content.\n\t\tsetAttributes( {\n\t\t\tdownloadButtonText: newValue.replace( /<\\/?a[^>]*>/g, '' ),\n\t\t} );\n\t}\n\n\tfunction changeDisplayPreview( newValue ) {\n\t\tsetAttributes( { displayPreview: newValue } );\n\t}\n\n\tfunction handleOnResizeStop( event, direction, elt, delta ) {\n\t\ttoggleSelection( true );\n\n\t\tconst newHeight = parseInt( previewHeight + delta.height, 10 );\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tfunction changePreviewHeight( newValue ) {\n\t\tconst newHeight = Math.max(\n\t\t\tparseInt( newValue, 10 ),\n\t\t\tMIN_PREVIEW_HEIGHT\n\t\t);\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tconst attachmentPage = media && media.link;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\tisBlobURL( href ) && getAnimateClassName( { type: 'loading' } ),\n\t\t\t{\n\t\t\t\t'is-transient': isBlobURL( href ),\n\t\t\t}\n\t\t),\n\t} );\n\n\tconst displayPreviewInEditor = browserSupportsPdfs() && displayPreview;\n\n\tif ( ! href ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'File' ),\n\t\t\t\t\t\tinstructions: __(\n\t\t\t\t\t\t\t'Upload a file or pick one from your media library.'\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tnotices={ noticeUI }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FileBlockInspector\n\t\t\t\threfs={ { href, textLinkHref, attachmentPage } }\n\t\t\t\t{ ...{\n\t\t\t\t\topenInNewWindow: !! textLinkTarget,\n\t\t\t\t\tshowDownloadButton,\n\t\t\t\t\tchangeLinkDestinationOption,\n\t\t\t\t\tchangeOpenInNewWindow,\n\t\t\t\t\tchangeShowDownloadButton,\n\t\t\t\t\tdisplayPreview,\n\t\t\t\t\tchangeDisplayPreview,\n\t\t\t\t\tpreviewHeight,\n\t\t\t\t\tchangePreviewHeight,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ href }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t\t<ClipboardToolbarButton\n\t\t\t\t\ttext={ href }\n\t\t\t\t\tdisabled={ isBlobURL( href ) }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ displayPreviewInEditor && (\n\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\tsize={ { height: previewHeight } }\n\t\t\t\t\t\tminHeight={ MIN_PREVIEW_HEIGHT }\n\t\t\t\t\t\tmaxHeight={ MAX_PREVIEW_HEIGHT }\n\t\t\t\t\t\tminWidth=\"100%\"\n\t\t\t\t\t\tgrid={ [ 10, 10 ] }\n\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\tright: false,\n\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStart={ () => toggleSelection( false ) }\n\t\t\t\t\t\tonResizeStop={ handleOnResizeStop }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__preview\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'Embed of the selected PDF file.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isSelected && (\n\t\t\t\t\t\t\t<div className=\"wp-block-file__preview-overlay\" />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ResizableBox>\n\t\t\t\t) }\n\t\t\t\t<div className={ 'wp-block-file__content-wrapper' }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\tvalue={ fileName }\n\t\t\t\t\t\tplaceholder={ __( 'Write file name…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\tsetAttributes( { fileName: text } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'wp-block-file__button-richtext-wrapper'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ /* Using RichText here instead of PlainText so that it can be styled like a button. */ }\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName=\"div\" // Must be block-level or else cursor disappears.\n\t\t\t\t\t\t\t\taria-label={ __( 'Download button text' ) }\n\t\t\t\t\t\t\t\tclassName={ 'wp-block-file__button' }\n\t\t\t\t\t\t\t\tvalue={ downloadButtonText }\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Add text…' ) }\n\t\t\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\t\t\tchangeDownloadButtonText( text )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default withNotices( FileEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/file/edit.js"],"names":["MIN_PREVIEW_HEIGHT","MAX_PREVIEW_HEIGHT","ClipboardToolbarButton","text","disabled","createNotice","noticesStore","ref","isDismissible","type","FileEdit","attributes","isSelected","setAttributes","noticeUI","noticeOperations","clientId","id","fileId","fileName","href","textLinkHref","textLinkTarget","showDownloadButton","downloadButtonText","displayPreview","previewHeight","media","mediaUpload","select","undefined","coreStore","getMedia","blockEditorStore","getSettings","toggleSelection","__unstableMarkNextChangeAsNotPersistent","file","filesList","onFileChange","newMedia","onSelectFile","onError","onUploadError","changeDownloadButtonText","url","isPdf","endsWith","title","message","removeAllNotices","createErrorNotice","changeLinkDestinationOption","newHref","changeOpenInNewWindow","newValue","changeShowDownloadButton","replace","changeDisplayPreview","handleOnResizeStop","event","direction","elt","delta","newHeight","parseInt","height","changePreviewHeight","Math","max","attachmentPage","link","blockProps","className","displayPreviewInEditor","icon","instructions","openInNewWindow","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","__experimentalElementButtonClassName"],"mappings":";;;;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ent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\twithNotices,\n\tResizableBox,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalElementButtonClassName,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport FileBlockInspector from './inspector';\nimport { browserSupportsPdfs } from './utils';\n\nexport const MIN_PREVIEW_HEIGHT = 200;\nexport const MAX_PREVIEW_HEIGHT = 2000;\n\nfunction ClipboardToolbarButton( { text, disabled } ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tclassName=\"components-clipboard-toolbar-button\"\n\t\t\tref={ ref }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ __( 'Copy URL' ) }\n\t\t</ToolbarButton>\n\t);\n}\n\nfunction FileEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tnoticeUI,\n\tnoticeOperations,\n\tclientId,\n} ) {\n\tconst {\n\t\tid,\n\t\tfileId,\n\t\tfileName,\n\t\thref,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\tconst { media, mediaUpload } = useSelect(\n\t\t( select ) => ( {\n\t\t\tmedia:\n\t\t\t\tid === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: select( coreStore ).getMedia( id ),\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\n\t\t} ),\n\t\t[ id ]\n\t);\n\n\tconst {\n\t\ttoggleSelection,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Upload a file drag-and-dropped into the editor.\n\t\tif ( isBlobURL( href ) ) {\n\t\t\tconst file = getBlobByURL( href );\n\n\t\t\tmediaUpload( {\n\t\t\t\tfilesList: [ file ],\n\t\t\t\tonFileChange: ( [ newMedia ] ) => onSelectFile( newMedia ),\n\t\t\t\tonError: onUploadError,\n\t\t\t} );\n\n\t\t\trevokeBlobURL( href );\n\t\t}\n\n\t\tif ( downloadButtonText === undefined ) {\n\t\t\tchangeDownloadButtonText( _x( 'Download', 'button label' ) );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! fileId && href ) {\n\t\t\t// Add a unique fileId to each file block.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { fileId: `wp-block-file--media-${ clientId }` } );\n\t\t}\n\t}, [ href, fileId, clientId ] );\n\n\tfunction onSelectFile( newMedia ) {\n\t\tif ( newMedia && newMedia.url ) {\n\t\t\tconst isPdf = newMedia.url.endsWith( '.pdf' );\n\t\t\tsetAttributes( {\n\t\t\t\thref: newMedia.url,\n\t\t\t\tfileName: newMedia.title,\n\t\t\t\ttextLinkHref: newMedia.url,\n\t\t\t\tid: newMedia.id,\n\t\t\t\tdisplayPreview: isPdf ? true : undefined,\n\t\t\t\tpreviewHeight: isPdf ? 600 : undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tsetAttributes( { href: undefined } );\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t}\n\n\tfunction changeLinkDestinationOption( newHref ) {\n\t\t// Choose Media File or Attachment Page (when file is in Media Library).\n\t\tsetAttributes( { textLinkHref: newHref } );\n\t}\n\n\tfunction changeOpenInNewWindow( newValue ) {\n\t\tsetAttributes( {\n\t\t\ttextLinkTarget: newValue ? '_blank' : false,\n\t\t} );\n\t}\n\n\tfunction changeShowDownloadButton( newValue ) {\n\t\tsetAttributes( { showDownloadButton: newValue } );\n\t}\n\n\tfunction changeDownloadButtonText( newValue ) {\n\t\t// Remove anchor tags from button text content.\n\t\tsetAttributes( {\n\t\t\tdownloadButtonText: newValue.replace( /<\\/?a[^>]*>/g, '' ),\n\t\t} );\n\t}\n\n\tfunction changeDisplayPreview( newValue ) {\n\t\tsetAttributes( { displayPreview: newValue } );\n\t}\n\n\tfunction handleOnResizeStop( event, direction, elt, delta ) {\n\t\ttoggleSelection( true );\n\n\t\tconst newHeight = parseInt( previewHeight + delta.height, 10 );\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tfunction changePreviewHeight( newValue ) {\n\t\tconst newHeight = Math.max(\n\t\t\tparseInt( newValue, 10 ),\n\t\t\tMIN_PREVIEW_HEIGHT\n\t\t);\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tconst attachmentPage = media && media.link;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\tisBlobURL( href ) && getAnimateClassName( { type: 'loading' } ),\n\t\t\t{\n\t\t\t\t'is-transient': isBlobURL( href ),\n\t\t\t}\n\t\t),\n\t} );\n\n\tconst displayPreviewInEditor = browserSupportsPdfs() && displayPreview;\n\n\tif ( ! href ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'File' ),\n\t\t\t\t\t\tinstructions: __(\n\t\t\t\t\t\t\t'Upload a file or pick one from your media library.'\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tnotices={ noticeUI }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FileBlockInspector\n\t\t\t\threfs={ { href, textLinkHref, attachmentPage } }\n\t\t\t\t{ ...{\n\t\t\t\t\topenInNewWindow: !! textLinkTarget,\n\t\t\t\t\tshowDownloadButton,\n\t\t\t\t\tchangeLinkDestinationOption,\n\t\t\t\t\tchangeOpenInNewWindow,\n\t\t\t\t\tchangeShowDownloadButton,\n\t\t\t\t\tdisplayPreview,\n\t\t\t\t\tchangeDisplayPreview,\n\t\t\t\t\tpreviewHeight,\n\t\t\t\t\tchangePreviewHeight,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ href }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t\t<ClipboardToolbarButton\n\t\t\t\t\ttext={ href }\n\t\t\t\t\tdisabled={ isBlobURL( href ) }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ displayPreviewInEditor && (\n\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\tsize={ { height: previewHeight } }\n\t\t\t\t\t\tminHeight={ MIN_PREVIEW_HEIGHT }\n\t\t\t\t\t\tmaxHeight={ MAX_PREVIEW_HEIGHT }\n\t\t\t\t\t\tminWidth=\"100%\"\n\t\t\t\t\t\tgrid={ [ 10, 10 ] }\n\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\tright: false,\n\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStart={ () => toggleSelection( false ) }\n\t\t\t\t\t\tonResizeStop={ handleOnResizeStop }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__preview\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'Embed of the selected PDF file.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isSelected && (\n\t\t\t\t\t\t\t<div className=\"wp-block-file__preview-overlay\" />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ResizableBox>\n\t\t\t\t) }\n\t\t\t\t<div className={ 'wp-block-file__content-wrapper' }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\tvalue={ fileName }\n\t\t\t\t\t\tplaceholder={ __( 'Write file name…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\tsetAttributes( { fileName: text } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'wp-block-file__button-richtext-wrapper'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ /* Using RichText here instead of PlainText so that it can be styled like a button. */ }\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName=\"div\" // Must be block-level or else cursor disappears.\n\t\t\t\t\t\t\t\taria-label={ __( 'Download button text' ) }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'wp-block-file__button',\n\t\t\t\t\t\t\t\t\t__experimentalElementButtonClassName\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvalue={ downloadButtonText }\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Add text…' ) }\n\t\t\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\t\t\tchangeDownloadButtonText( text )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default withNotices( FileEdit );\n"]}
@@ -420,7 +420,6 @@ class FileEdit extends _element.Component {
420
420
  return (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
421
421
  accessible: !isSelected,
422
422
  onPress: this.onFilePressed,
423
- onLongPress: openMediaOptions,
424
423
  disabled: !isSelected
425
424
  }, (0, _element.createElement)(_reactNative.View, {
426
425
  onLayout: this.onLayout,