@wordpress/block-library 10.1.1-next.v.202607070741.0 → 10.3.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 (580) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/build/accordion/block.json +1 -0
  3. package/build/accordion-panel/block.json +1 -0
  4. package/build/button/edit.cjs +18 -8
  5. package/build/button/edit.cjs.map +2 -2
  6. package/build/code/edit.cjs +3 -1
  7. package/build/code/edit.cjs.map +2 -2
  8. package/build/cover/block.json +12 -0
  9. package/build/cover/edit/block-controls.cjs +14 -5
  10. package/build/cover/edit/block-controls.cjs.map +2 -2
  11. package/build/cover/edit/embed-video-url-input.cjs +5 -3
  12. package/build/cover/edit/embed-video-url-input.cjs.map +3 -3
  13. package/build/cover/edit/index.cjs +76 -32
  14. package/build/cover/edit/index.cjs.map +2 -2
  15. package/build/cover/embed-video-utils.cjs +17 -7
  16. package/build/cover/embed-video-utils.cjs.map +2 -2
  17. package/build/details/transforms.cjs +1 -3
  18. package/build/details/transforms.cjs.map +2 -2
  19. package/build/embed/edit.cjs +1 -1
  20. package/build/embed/edit.cjs.map +2 -2
  21. package/build/embed/embed-placeholder.cjs +1 -2
  22. package/build/embed/embed-placeholder.cjs.map +2 -2
  23. package/build/file/edit.cjs +4 -3
  24. package/build/file/edit.cjs.map +2 -2
  25. package/build/file/transforms.cjs +25 -60
  26. package/build/file/transforms.cjs.map +2 -2
  27. package/build/gallery/block.json +4 -2
  28. package/build/gallery/dynamic-gallery.cjs +104 -61
  29. package/build/gallery/dynamic-gallery.cjs.map +3 -3
  30. package/build/gallery/edit.cjs +1 -1
  31. package/build/gallery/edit.cjs.map +3 -3
  32. package/build/gallery/gap-styles.cjs +49 -13
  33. package/build/gallery/gap-styles.cjs.map +3 -3
  34. package/build/gallery/use-dynamic-gallery.cjs +15 -8
  35. package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
  36. package/build/group/transforms.cjs +1 -1
  37. package/build/group/transforms.cjs.map +2 -2
  38. package/build/heading/edit.cjs +1 -1
  39. package/build/heading/edit.cjs.map +2 -2
  40. package/build/html/modal.cjs +63 -54
  41. package/build/html/modal.cjs.map +3 -3
  42. package/build/icon/block.json +5 -3
  43. package/build/icon/components/custom-inserter/icon-grid.cjs +25 -12
  44. package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
  45. package/build/icon/components/custom-inserter/index.cjs +100 -31
  46. package/build/icon/components/custom-inserter/index.cjs.map +3 -3
  47. package/build/icon/edit.cjs +11 -12
  48. package/build/icon/edit.cjs.map +2 -2
  49. package/build/image/block.json +1 -1
  50. package/build/image/edit.cjs +1 -35
  51. package/build/image/edit.cjs.map +2 -2
  52. package/build/image/image.cjs +23 -18
  53. package/build/image/image.cjs.map +3 -3
  54. package/build/image/transforms.cjs +78 -0
  55. package/build/image/transforms.cjs.map +3 -3
  56. package/build/image/use-open-image-media-editor-modal.cjs +6 -2
  57. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  58. package/build/index.cjs +18 -8
  59. package/build/index.cjs.map +2 -2
  60. package/build/latest-posts/edit.cjs +5 -8
  61. package/build/latest-posts/edit.cjs.map +2 -2
  62. package/build/list-item/edit.cjs +1 -1
  63. package/build/list-item/edit.cjs.map +2 -2
  64. package/build/list-item/hooks/use-enter.cjs +14 -17
  65. package/build/list-item/hooks/use-enter.cjs.map +3 -3
  66. package/build/list-item/hooks/use-indent-list-item.cjs +10 -2
  67. package/build/list-item/hooks/use-indent-list-item.cjs.map +2 -2
  68. package/build/list-item/hooks/use-space.cjs +3 -2
  69. package/build/list-item/hooks/use-space.cjs.map +3 -3
  70. package/build/math/edit.cjs +39 -56
  71. package/build/math/edit.cjs.map +3 -3
  72. package/build/media-text/edit.cjs +2 -1
  73. package/build/media-text/edit.cjs.map +2 -2
  74. package/build/more/edit.cjs +2 -2
  75. package/build/more/edit.cjs.map +2 -2
  76. package/build/navigation/edit/index.cjs +30 -16
  77. package/build/navigation/edit/index.cjs.map +3 -3
  78. package/build/navigation/edit/use-layout-custom-properties.cjs +72 -0
  79. package/build/navigation/edit/use-layout-custom-properties.cjs.map +7 -0
  80. package/build/navigation/view.cjs +9 -6
  81. package/build/navigation/view.cjs.map +2 -2
  82. package/build/navigation-link/edit.cjs +3 -3
  83. package/build/navigation-link/edit.cjs.map +2 -2
  84. package/build/navigation-link/link-ui/index.cjs +2 -2
  85. package/build/navigation-link/link-ui/index.cjs.map +2 -2
  86. package/build/paragraph/edit.cjs +5 -2
  87. package/build/paragraph/edit.cjs.map +3 -3
  88. package/build/paragraph/index.cjs +4 -1
  89. package/build/paragraph/index.cjs.map +2 -2
  90. package/build/paragraph/use-enter.cjs +3 -7
  91. package/build/paragraph/use-enter.cjs.map +3 -3
  92. package/build/playlist/block.json +29 -10
  93. package/build/playlist/context.cjs +2 -1
  94. package/build/playlist/context.cjs.map +2 -2
  95. package/build/playlist/edit.cjs +328 -39
  96. package/build/playlist/edit.cjs.map +3 -3
  97. package/build/playlist/index.cjs +1 -1
  98. package/build/playlist/index.cjs.map +2 -2
  99. package/build/playlist/utils.cjs +37 -8
  100. package/build/playlist/utils.cjs.map +2 -2
  101. package/build/playlist/view.cjs +83 -13
  102. package/build/playlist/view.cjs.map +2 -2
  103. package/build/playlist-track/block.json +4 -2
  104. package/build/playlist-track/edit.cjs +115 -70
  105. package/build/playlist-track/edit.cjs.map +2 -2
  106. package/build/post-content/block.json +1 -0
  107. package/build/post-content/edit.cjs +36 -15
  108. package/build/post-content/edit.cjs.map +2 -2
  109. package/build/post-featured-image/edit.cjs +3 -2
  110. package/build/post-featured-image/edit.cjs.map +2 -2
  111. package/build/post-template/block.json +2 -1
  112. package/build/post-template/edit.cjs +10 -1
  113. package/build/post-template/edit.cjs.map +2 -2
  114. package/build/post-terms/edit.cjs +2 -2
  115. package/build/post-terms/edit.cjs.map +2 -2
  116. package/build/post-title/edit.cjs +2 -2
  117. package/build/post-title/edit.cjs.map +2 -2
  118. package/build/preformatted/edit.cjs +3 -1
  119. package/build/preformatted/edit.cjs.map +2 -2
  120. package/build/pullquote/block.json +3 -1
  121. package/build/pullquote/edit.cjs +5 -3
  122. package/build/pullquote/edit.cjs.map +2 -2
  123. package/build/query/block.json +3 -2
  124. package/build/query/edit/inspector-controls/index.cjs +42 -5
  125. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  126. package/build/query/edit/inspector-controls/offset-controls.cjs +1 -2
  127. package/build/query/edit/inspector-controls/offset-controls.cjs.map +2 -2
  128. package/build/query/edit/inspector-controls/pages-control.cjs +0 -1
  129. package/build/query/edit/inspector-controls/pages-control.cjs.map +2 -2
  130. package/build/query/edit/query-content.cjs +10 -3
  131. package/build/query/edit/query-content.cjs.map +2 -2
  132. package/build/query/index.cjs +2 -1
  133. package/build/query/index.cjs.map +2 -2
  134. package/build/quote/block.json +3 -1
  135. package/build/quote/transforms.cjs +1 -3
  136. package/build/quote/transforms.cjs.map +2 -2
  137. package/build/read-more/edit.cjs +3 -1
  138. package/build/read-more/edit.cjs.map +2 -2
  139. package/build/rss/edit.cjs +0 -1
  140. package/build/rss/edit.cjs.map +2 -2
  141. package/build/site-tagline/edit.cjs +3 -1
  142. package/build/site-tagline/edit.cjs.map +2 -2
  143. package/build/site-title/edit.cjs +3 -1
  144. package/build/site-title/edit.cjs.map +2 -2
  145. package/build/social-links/edit.cjs +11 -4
  146. package/build/social-links/edit.cjs.map +2 -2
  147. package/build/tab-list/block.json +4 -3
  148. package/build/tab-list/edit.cjs +67 -11
  149. package/build/tab-list/edit.cjs.map +3 -3
  150. package/build/tab-list/tab-movers.cjs +87 -0
  151. package/build/tab-list/tab-movers.cjs.map +7 -0
  152. package/build/tab-panel/block.json +1 -6
  153. package/build/tab-panel/edit.cjs +16 -24
  154. package/build/tab-panel/edit.cjs.map +2 -2
  155. package/build/tab-panels/block.json +0 -1
  156. package/build/table/edit.cjs +1 -1
  157. package/build/table/edit.cjs.map +2 -2
  158. package/build/tabs/block.json +0 -5
  159. package/build/tabs/edit.cjs +4 -39
  160. package/build/tabs/edit.cjs.map +3 -3
  161. package/build/tabs/use-tab-actions.cjs +23 -1
  162. package/build/tabs/use-tab-actions.cjs.map +2 -2
  163. package/build/tabs/use-tab-list-items-sync.cjs +19 -1
  164. package/build/tabs/use-tab-list-items-sync.cjs.map +2 -2
  165. package/build/term-name/block.json +1 -3
  166. package/build/term-name/deprecated.cjs +105 -0
  167. package/build/term-name/deprecated.cjs.map +7 -0
  168. package/build/term-name/edit.cjs +11 -37
  169. package/build/term-name/edit.cjs.map +3 -3
  170. package/build/term-name/index.cjs +3 -1
  171. package/build/term-name/index.cjs.map +3 -3
  172. package/build/utils/caption.cjs +2 -2
  173. package/build/utils/caption.cjs.map +2 -2
  174. package/build/utils/waveform-player.cjs +138 -22
  175. package/build/utils/waveform-player.cjs.map +2 -2
  176. package/build/utils/waveform-utils.cjs +315 -17
  177. package/build/utils/waveform-utils.cjs.map +2 -2
  178. package/build/verse/edit.cjs +3 -1
  179. package/build/verse/edit.cjs.map +2 -2
  180. package/build/video/edit.cjs +2 -11
  181. package/build/video/edit.cjs.map +3 -3
  182. package/build/video/tracks-editor.cjs +0 -1
  183. package/build/video/tracks-editor.cjs.map +2 -2
  184. package/build-module/accordion/block.json +1 -0
  185. package/build-module/accordion-panel/block.json +1 -0
  186. package/build-module/button/edit.mjs +19 -14
  187. package/build-module/button/edit.mjs.map +2 -2
  188. package/build-module/code/edit.mjs +3 -1
  189. package/build-module/code/edit.mjs.map +2 -2
  190. package/build-module/cover/block.json +12 -0
  191. package/build-module/cover/edit/block-controls.mjs +14 -5
  192. package/build-module/cover/edit/block-controls.mjs.map +2 -2
  193. package/build-module/cover/edit/embed-video-url-input.mjs +5 -4
  194. package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
  195. package/build-module/cover/edit/index.mjs +79 -35
  196. package/build-module/cover/edit/index.mjs.map +2 -2
  197. package/build-module/cover/embed-video-utils.mjs +16 -7
  198. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  199. package/build-module/details/transforms.mjs +2 -7
  200. package/build-module/details/transforms.mjs.map +2 -2
  201. package/build-module/embed/edit.mjs +1 -1
  202. package/build-module/embed/edit.mjs.map +2 -2
  203. package/build-module/embed/embed-placeholder.mjs +1 -2
  204. package/build-module/embed/embed-placeholder.mjs.map +2 -2
  205. package/build-module/file/edit.mjs +4 -3
  206. package/build-module/file/edit.mjs.map +2 -2
  207. package/build-module/file/transforms.mjs +25 -60
  208. package/build-module/file/transforms.mjs.map +2 -2
  209. package/build-module/gallery/block.json +4 -2
  210. package/build-module/gallery/dynamic-gallery.mjs +104 -61
  211. package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
  212. package/build-module/gallery/edit.mjs +3 -3
  213. package/build-module/gallery/edit.mjs.map +2 -2
  214. package/build-module/gallery/gap-styles.mjs +53 -14
  215. package/build-module/gallery/gap-styles.mjs.map +2 -2
  216. package/build-module/gallery/use-dynamic-gallery.mjs +16 -9
  217. package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
  218. package/build-module/group/transforms.mjs +2 -5
  219. package/build-module/group/transforms.mjs.map +2 -2
  220. package/build-module/heading/edit.mjs +1 -1
  221. package/build-module/heading/edit.mjs.map +2 -2
  222. package/build-module/html/modal.mjs +68 -55
  223. package/build-module/html/modal.mjs.map +2 -2
  224. package/build-module/icon/block.json +5 -3
  225. package/build-module/icon/components/custom-inserter/icon-grid.mjs +25 -12
  226. package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
  227. package/build-module/icon/components/custom-inserter/index.mjs +102 -33
  228. package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
  229. package/build-module/icon/edit.mjs +11 -12
  230. package/build-module/icon/edit.mjs.map +2 -2
  231. package/build-module/image/block.json +1 -1
  232. package/build-module/image/edit.mjs +1 -35
  233. package/build-module/image/edit.mjs.map +2 -2
  234. package/build-module/image/image.mjs +23 -18
  235. package/build-module/image/image.mjs.map +2 -2
  236. package/build-module/image/transforms.mjs +78 -0
  237. package/build-module/image/transforms.mjs.map +2 -2
  238. package/build-module/image/use-open-image-media-editor-modal.mjs +6 -2
  239. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  240. package/build-module/index.mjs +18 -8
  241. package/build-module/index.mjs.map +2 -2
  242. package/build-module/latest-posts/edit.mjs +5 -8
  243. package/build-module/latest-posts/edit.mjs.map +2 -2
  244. package/build-module/list-item/edit.mjs +1 -1
  245. package/build-module/list-item/edit.mjs.map +2 -2
  246. package/build-module/list-item/hooks/use-enter.mjs +15 -21
  247. package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
  248. package/build-module/list-item/hooks/use-indent-list-item.mjs +10 -2
  249. package/build-module/list-item/hooks/use-indent-list-item.mjs.map +2 -2
  250. package/build-module/list-item/hooks/use-space.mjs +4 -6
  251. package/build-module/list-item/hooks/use-space.mjs.map +2 -2
  252. package/build-module/math/edit.mjs +41 -60
  253. package/build-module/math/edit.mjs.map +2 -2
  254. package/build-module/media-text/edit.mjs +2 -1
  255. package/build-module/media-text/edit.mjs.map +2 -2
  256. package/build-module/more/edit.mjs +2 -2
  257. package/build-module/more/edit.mjs.map +2 -2
  258. package/build-module/navigation/edit/index.mjs +30 -16
  259. package/build-module/navigation/edit/index.mjs.map +2 -2
  260. package/build-module/navigation/edit/use-layout-custom-properties.mjs +51 -0
  261. package/build-module/navigation/edit/use-layout-custom-properties.mjs.map +7 -0
  262. package/build-module/navigation/view.mjs +9 -6
  263. package/build-module/navigation/view.mjs.map +2 -2
  264. package/build-module/navigation-link/edit.mjs +3 -3
  265. package/build-module/navigation-link/edit.mjs.map +2 -2
  266. package/build-module/navigation-link/link-ui/index.mjs +2 -2
  267. package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
  268. package/build-module/paragraph/edit.mjs +6 -2
  269. package/build-module/paragraph/edit.mjs.map +2 -2
  270. package/build-module/paragraph/index.mjs +4 -1
  271. package/build-module/paragraph/index.mjs.map +2 -2
  272. package/build-module/paragraph/use-enter.mjs +4 -11
  273. package/build-module/paragraph/use-enter.mjs.map +2 -2
  274. package/build-module/playlist/block.json +29 -10
  275. package/build-module/playlist/context.mjs +2 -1
  276. package/build-module/playlist/context.mjs.map +2 -2
  277. package/build-module/playlist/edit.mjs +331 -41
  278. package/build-module/playlist/edit.mjs.map +2 -2
  279. package/build-module/playlist/index.mjs +1 -1
  280. package/build-module/playlist/index.mjs.map +2 -2
  281. package/build-module/playlist/utils.mjs +35 -7
  282. package/build-module/playlist/utils.mjs.map +2 -2
  283. package/build-module/playlist/view.mjs +89 -14
  284. package/build-module/playlist/view.mjs.map +2 -2
  285. package/build-module/playlist-track/block.json +4 -2
  286. package/build-module/playlist-track/edit.mjs +117 -71
  287. package/build-module/playlist-track/edit.mjs.map +2 -2
  288. package/build-module/post-content/block.json +1 -0
  289. package/build-module/post-content/edit.mjs +37 -15
  290. package/build-module/post-content/edit.mjs.map +2 -2
  291. package/build-module/post-featured-image/edit.mjs +3 -2
  292. package/build-module/post-featured-image/edit.mjs.map +2 -2
  293. package/build-module/post-template/block.json +2 -1
  294. package/build-module/post-template/edit.mjs +10 -1
  295. package/build-module/post-template/edit.mjs.map +2 -2
  296. package/build-module/post-terms/edit.mjs +2 -2
  297. package/build-module/post-terms/edit.mjs.map +2 -2
  298. package/build-module/post-title/edit.mjs +2 -2
  299. package/build-module/post-title/edit.mjs.map +2 -2
  300. package/build-module/preformatted/edit.mjs +3 -1
  301. package/build-module/preformatted/edit.mjs.map +2 -2
  302. package/build-module/pullquote/block.json +3 -1
  303. package/build-module/pullquote/edit.mjs +5 -3
  304. package/build-module/pullquote/edit.mjs.map +2 -2
  305. package/build-module/query/block.json +3 -2
  306. package/build-module/query/edit/inspector-controls/index.mjs +44 -6
  307. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  308. package/build-module/query/edit/inspector-controls/offset-controls.mjs +2 -3
  309. package/build-module/query/edit/inspector-controls/offset-controls.mjs.map +2 -2
  310. package/build-module/query/edit/inspector-controls/pages-control.mjs +0 -1
  311. package/build-module/query/edit/inspector-controls/pages-control.mjs.map +2 -2
  312. package/build-module/query/edit/query-content.mjs +10 -3
  313. package/build-module/query/edit/query-content.mjs.map +2 -2
  314. package/build-module/query/index.mjs +2 -1
  315. package/build-module/query/index.mjs.map +2 -2
  316. package/build-module/quote/block.json +3 -1
  317. package/build-module/quote/transforms.mjs +2 -4
  318. package/build-module/quote/transforms.mjs.map +2 -2
  319. package/build-module/read-more/edit.mjs +3 -1
  320. package/build-module/read-more/edit.mjs.map +2 -2
  321. package/build-module/rss/edit.mjs +0 -1
  322. package/build-module/rss/edit.mjs.map +2 -2
  323. package/build-module/site-tagline/edit.mjs +3 -1
  324. package/build-module/site-tagline/edit.mjs.map +2 -2
  325. package/build-module/site-title/edit.mjs +3 -1
  326. package/build-module/site-title/edit.mjs.map +2 -2
  327. package/build-module/social-links/edit.mjs +11 -4
  328. package/build-module/social-links/edit.mjs.map +2 -2
  329. package/build-module/tab-list/block.json +4 -3
  330. package/build-module/tab-list/edit.mjs +74 -13
  331. package/build-module/tab-list/edit.mjs.map +2 -2
  332. package/build-module/tab-list/tab-movers.mjs +59 -0
  333. package/build-module/tab-list/tab-movers.mjs.map +7 -0
  334. package/build-module/tab-panel/block.json +1 -6
  335. package/build-module/tab-panel/edit.mjs +17 -25
  336. package/build-module/tab-panel/edit.mjs.map +2 -2
  337. package/build-module/tab-panels/block.json +0 -1
  338. package/build-module/table/edit.mjs +1 -1
  339. package/build-module/table/edit.mjs.map +2 -2
  340. package/build-module/tabs/block.json +0 -5
  341. package/build-module/tabs/edit.mjs +5 -45
  342. package/build-module/tabs/edit.mjs.map +2 -2
  343. package/build-module/tabs/use-tab-actions.mjs +23 -1
  344. package/build-module/tabs/use-tab-actions.mjs.map +2 -2
  345. package/build-module/tabs/use-tab-list-items-sync.mjs +19 -1
  346. package/build-module/tabs/use-tab-list-items-sync.mjs.map +2 -2
  347. package/build-module/term-name/block.json +1 -3
  348. package/build-module/term-name/deprecated.mjs +74 -0
  349. package/build-module/term-name/deprecated.mjs.map +7 -0
  350. package/build-module/term-name/edit.mjs +11 -28
  351. package/build-module/term-name/edit.mjs.map +2 -2
  352. package/build-module/term-name/index.mjs +3 -1
  353. package/build-module/term-name/index.mjs.map +2 -2
  354. package/build-module/utils/caption.mjs +2 -2
  355. package/build-module/utils/caption.mjs.map +2 -2
  356. package/build-module/utils/waveform-player.mjs +144 -23
  357. package/build-module/utils/waveform-player.mjs.map +2 -2
  358. package/build-module/utils/waveform-utils.mjs +310 -16
  359. package/build-module/utils/waveform-utils.mjs.map +2 -2
  360. package/build-module/verse/edit.mjs +3 -1
  361. package/build-module/verse/edit.mjs.map +2 -2
  362. package/build-module/video/edit.mjs +2 -11
  363. package/build-module/video/edit.mjs.map +2 -2
  364. package/build-module/video/tracks-editor.mjs +0 -1
  365. package/build-module/video/tracks-editor.mjs.map +2 -2
  366. package/build-style/cover/editor-rtl.css +3 -0
  367. package/build-style/cover/editor.css +3 -0
  368. package/build-style/editor-rtl.css +61 -59
  369. package/build-style/editor.css +61 -59
  370. package/build-style/icon/editor-rtl.css +80 -10
  371. package/build-style/icon/editor.css +80 -10
  372. package/build-style/image/editor-rtl.css +3 -32
  373. package/build-style/image/editor.css +3 -32
  374. package/build-style/more/editor-rtl.css +2 -2
  375. package/build-style/more/editor.css +2 -2
  376. package/build-style/navigation/editor-rtl.css +3 -4
  377. package/build-style/navigation/editor.css +3 -4
  378. package/build-style/navigation-link/editor-rtl.css +1 -1
  379. package/build-style/navigation-link/editor.css +1 -1
  380. package/build-style/nextpage/editor-rtl.css +2 -2
  381. package/build-style/nextpage/editor.css +2 -2
  382. package/build-style/playlist/editor-rtl.css +4 -3
  383. package/build-style/playlist/editor.css +4 -3
  384. package/build-style/playlist/style-rtl.css +81 -5
  385. package/build-style/playlist/style.css +81 -5
  386. package/build-style/playlist-track/style-rtl.css +10 -0
  387. package/build-style/playlist-track/style.css +10 -0
  388. package/build-style/pullquote/editor-rtl.css +4 -0
  389. package/build-style/pullquote/editor.css +4 -0
  390. package/build-style/style-rtl.css +91 -5
  391. package/build-style/style.css +91 -5
  392. package/build-style/tab-list/editor-rtl.css +101 -0
  393. package/build-style/tab-list/editor.css +101 -0
  394. package/build-style/video/editor-rtl.css +1 -1
  395. package/build-style/video/editor.css +1 -1
  396. package/build-types/table-of-contents/list.d.ts +1 -1
  397. package/build-types/table-of-contents/list.d.ts.map +1 -1
  398. package/package.json +47 -45
  399. package/src/accordion/README.md +1 -0
  400. package/src/accordion/block.json +1 -0
  401. package/src/accordion-panel/block.json +1 -0
  402. package/src/breadcrumbs/index.php +3 -1
  403. package/src/button/edit.js +21 -15
  404. package/src/button/index.php +1 -1
  405. package/src/code/edit.js +7 -2
  406. package/src/cover/README.md +60 -0
  407. package/src/cover/block.json +12 -0
  408. package/src/cover/edit/block-controls.js +26 -11
  409. package/src/cover/edit/embed-video-url-input.js +5 -4
  410. package/src/cover/edit/index.js +109 -46
  411. package/src/cover/editor.scss +6 -0
  412. package/src/cover/embed-video-utils.js +38 -13
  413. package/src/cover/index.php +9 -2
  414. package/src/details/transforms.js +2 -7
  415. package/src/editor.scss +1 -0
  416. package/src/embed/edit.js +3 -1
  417. package/src/embed/embed-placeholder.js +9 -8
  418. package/src/file/edit.js +8 -8
  419. package/src/file/transforms.js +28 -60
  420. package/src/form/index.php +6 -4
  421. package/src/gallery/README.md +1 -1
  422. package/src/gallery/block.json +4 -2
  423. package/src/gallery/dynamic-gallery.js +133 -74
  424. package/src/gallery/edit.js +3 -3
  425. package/src/gallery/gap-styles.js +79 -20
  426. package/src/gallery/index.php +103 -43
  427. package/src/gallery/use-dynamic-gallery.js +27 -12
  428. package/src/group/transforms.js +2 -5
  429. package/src/heading/edit.js +1 -1
  430. package/src/html/modal.js +13 -2
  431. package/src/icon/README.md +1 -3
  432. package/src/icon/block.json +5 -3
  433. package/src/icon/components/custom-inserter/icon-grid.js +40 -11
  434. package/src/icon/components/custom-inserter/index.js +98 -25
  435. package/src/icon/edit.js +11 -17
  436. package/src/icon/editor.scss +33 -11
  437. package/src/image/README.md +1 -1
  438. package/src/image/block.json +1 -1
  439. package/src/image/edit.js +1 -57
  440. package/src/image/editor.scss +6 -44
  441. package/src/image/image.js +56 -27
  442. package/src/image/test/use-open-image-media-editor-modal.js +37 -1
  443. package/src/image/transforms.js +128 -0
  444. package/src/image/use-open-image-media-editor-modal.js +8 -1
  445. package/src/index.js +19 -7
  446. package/src/latest-posts/edit.js +5 -8
  447. package/src/latest-posts/index.php +49 -18
  448. package/src/list-item/edit.js +1 -1
  449. package/src/list-item/hooks/use-enter.js +15 -22
  450. package/src/list-item/hooks/use-indent-list-item.js +10 -1
  451. package/src/list-item/hooks/use-space.js +4 -6
  452. package/src/math/edit.js +42 -59
  453. package/src/media-text/edit.js +1 -0
  454. package/src/media-text/editor.scss +1 -0
  455. package/src/media-text/index.php +11 -2
  456. package/src/more/edit.js +7 -4
  457. package/src/more/editor.scss +1 -1
  458. package/src/navigation/edit/index.js +52 -36
  459. package/src/navigation/edit/test/layout-custom-properties.js +138 -0
  460. package/src/navigation/edit/use-layout-custom-properties.js +84 -0
  461. package/src/navigation/editor.scss +1 -2
  462. package/src/navigation/index.php +123 -12
  463. package/src/navigation/test/view.js +51 -0
  464. package/src/navigation/view.js +15 -14
  465. package/src/navigation-link/edit.js +11 -7
  466. package/src/navigation-link/editor.scss +1 -1
  467. package/src/navigation-link/index.php +70 -3
  468. package/src/navigation-link/link-ui/index.js +2 -1
  469. package/src/navigation-link/test/__snapshots__/hooks.js.snap +1 -1
  470. package/src/navigation-submenu/index.php +6 -3
  471. package/src/nextpage/editor.scss +1 -1
  472. package/src/page-list/index.php +4 -3
  473. package/src/paragraph/edit.js +9 -2
  474. package/src/paragraph/index.js +4 -1
  475. package/src/paragraph/use-enter.js +4 -11
  476. package/src/pattern/index.php +5 -5
  477. package/src/playlist/README.md +17 -18
  478. package/src/playlist/block.json +29 -10
  479. package/src/playlist/context.js +1 -0
  480. package/src/playlist/edit.js +395 -59
  481. package/src/playlist/editor.scss +4 -5
  482. package/src/playlist/index.js +1 -1
  483. package/src/playlist/index.php +71 -22
  484. package/src/playlist/style.scss +54 -1
  485. package/src/playlist/test/edit-component.js +139 -0
  486. package/src/playlist/test/edit.js +43 -2
  487. package/src/playlist/utils.js +49 -10
  488. package/src/playlist/view.js +97 -16
  489. package/src/playlist-track/README.md +3 -3
  490. package/src/playlist-track/block.json +4 -2
  491. package/src/playlist-track/edit.js +116 -75
  492. package/src/playlist-track/index.php +26 -11
  493. package/src/playlist-track/style.scss +10 -0
  494. package/src/playlist-track/test/edit.js +253 -0
  495. package/src/post-content/README.md +1 -0
  496. package/src/post-content/block.json +1 -0
  497. package/src/post-content/edit.js +45 -16
  498. package/src/post-excerpt/index.php +4 -1
  499. package/src/post-featured-image/edit.js +3 -2
  500. package/src/post-featured-image/index.php +4 -1
  501. package/src/post-template/README.md +1 -0
  502. package/src/post-template/block.json +2 -1
  503. package/src/post-template/edit.js +9 -0
  504. package/src/post-terms/edit.js +7 -4
  505. package/src/post-title/edit.js +5 -3
  506. package/src/preformatted/edit.js +7 -2
  507. package/src/pullquote/README.md +1 -0
  508. package/src/pullquote/block.json +3 -1
  509. package/src/pullquote/edit.js +9 -4
  510. package/src/pullquote/editor.scss +6 -0
  511. package/src/query/README.md +2 -1
  512. package/src/query/block.json +3 -2
  513. package/src/query/edit/inspector-controls/index.js +47 -4
  514. package/src/query/edit/inspector-controls/offset-controls.js +2 -3
  515. package/src/query/edit/inspector-controls/pages-control.js +0 -1
  516. package/src/query/edit/query-content.js +19 -3
  517. package/src/query/index.js +1 -0
  518. package/src/quote/README.md +1 -0
  519. package/src/quote/block.json +3 -1
  520. package/src/quote/transforms.js +2 -4
  521. package/src/read-more/edit.js +7 -2
  522. package/src/rss/edit.js +0 -1
  523. package/src/rss/index.php +10 -4
  524. package/src/site-tagline/edit.js +7 -2
  525. package/src/site-title/edit.js +7 -2
  526. package/src/social-link/index.php +19 -9
  527. package/src/social-links/edit.js +21 -12
  528. package/src/tab-list/README.md +4 -5
  529. package/src/tab-list/block.json +4 -3
  530. package/src/tab-list/edit.js +92 -28
  531. package/src/tab-list/editor.scss +9 -0
  532. package/src/tab-list/index.php +9 -4
  533. package/src/tab-list/tab-movers.js +72 -0
  534. package/src/tab-panel/README.md +4 -6
  535. package/src/tab-panel/block.json +1 -6
  536. package/src/tab-panel/edit.js +20 -33
  537. package/src/tab-panels/README.md +5 -3
  538. package/src/tab-panels/block.json +0 -1
  539. package/src/table/edit.js +1 -1
  540. package/src/table-of-contents/index.php +386 -1
  541. package/src/tabs/README.md +18 -9
  542. package/src/tabs/block.json +0 -5
  543. package/src/tabs/edit.js +7 -64
  544. package/src/tabs/use-tab-actions.js +32 -3
  545. package/src/tabs/use-tab-list-items-sync.js +24 -4
  546. package/src/tag-cloud/index.php +3 -2
  547. package/src/template-part/index.php +3 -17
  548. package/src/term-name/README.md +1 -1
  549. package/src/term-name/block.json +1 -3
  550. package/src/term-name/deprecated.js +74 -0
  551. package/src/term-name/edit.js +2 -18
  552. package/src/term-name/index.js +2 -0
  553. package/src/utils/caption.js +7 -4
  554. package/src/utils/media-control.scss +1 -5
  555. package/src/utils/test/waveform-player.js +297 -34
  556. package/src/utils/test/waveform-utils.js +473 -5
  557. package/src/utils/waveform-player.js +189 -59
  558. package/src/utils/waveform-utils.js +443 -40
  559. package/src/verse/edit.js +7 -2
  560. package/src/video/edit.js +0 -8
  561. package/src/video/editor.scss +1 -1
  562. package/src/video/index.php +2 -2
  563. package/src/video/tracks-editor.js +0 -1
  564. package/build/image/animated-gif-convert-control.cjs +0 -105
  565. package/build/image/animated-gif-convert-control.cjs.map +0 -7
  566. package/build/utils/gif-conversion-attributes.cjs +0 -40
  567. package/build/utils/gif-conversion-attributes.cjs.map +0 -7
  568. package/build/video/gif-restore-control.cjs +0 -73
  569. package/build/video/gif-restore-control.cjs.map +0 -7
  570. package/build-module/image/animated-gif-convert-control.mjs +0 -87
  571. package/build-module/image/animated-gif-convert-control.mjs.map +0 -7
  572. package/build-module/utils/gif-conversion-attributes.mjs +0 -15
  573. package/build-module/utils/gif-conversion-attributes.mjs.map +0 -7
  574. package/build-module/video/gif-restore-control.mjs +0 -55
  575. package/build-module/video/gif-restore-control.mjs.map +0 -7
  576. package/src/image/animated-gif-convert-control.js +0 -135
  577. package/src/image/test/animated-gif-convert-control.js +0 -276
  578. package/src/utils/gif-conversion-attributes.js +0 -30
  579. package/src/utils/test/gif-conversion-attributes.js +0 -60
  580. package/src/video/gif-restore-control.js +0 -92
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/icon/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tflipHorizontal as flipHorizontalIcon,\n\tflipVertical as flipVerticalIcon,\n\trotateRight,\n} from '@wordpress/icons';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes } ) {\n\tconst { icon, ariaLabel, flipHorizontal, flipVertical, rotation } =\n\t\tattributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst { selectedIcon, allIcons = [] } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreDataStore );\n\t\t\treturn {\n\t\t\t\tselectedIcon: icon\n\t\t\t\t\t? getEntityRecord( 'root', 'icon', icon )\n\t\t\t\t\t: null,\n\t\t\t\tallIcons: isInserterOpen\n\t\t\t\t\t? getEntityRecords( 'root', 'icon' )\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ isInserterOpen, icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst flipClasses = {\n\t\t'is-flip-horizontal': flipHorizontal,\n\t\t'is-flip-vertical': flipVertical,\n\t};\n\n\tconst rotationStyle = rotation ? { rotate: `${ rotation }deg` } : {};\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t{ icon && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ flipHorizontalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip horizontal' ) }\n\t\t\t\t\t\tisPressed={ flipHorizontal }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipHorizontal: ! flipHorizontal,\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<ToolbarButton\n\t\t\t\t\t\ticon={ flipVerticalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip vertical' ) }\n\t\t\t\t\t\tisPressed={ flipVertical }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipVertical: ! flipVertical,\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<ToolbarButton\n\t\t\t\t\t\ticon={ rotateRight }\n\t\t\t\t\t\tlabel={ __( 'Rotate' ) }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\trotation: ( ( rotation || 0 ) + 90 ) % 360,\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</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ icon ? __( 'Replace' ) : __( 'Choose icon' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t\t// to edit these attributes.\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: ToolbarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tariaLabel: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ icon ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t\t...rotationStyle,\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\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\ticons={ allIcons }\n\t\t\t\t\tsetInserterOpen={ setInserterOpen }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,wBAMO;AACP,mBAIO;AACP,0BASO;AACP,qBAAyB;AACzB,wBAAgC;AAChC,kBAA0B;AAC1B,uBAAuC;AAKvC,mBAA+C;AAC/C,2BAAyB;AACzB,IAAAA,qBAAoC;AAGnC;AADD,IAAM,kBAAkB,CAAE,EAAE,WAAW,MAAM,MAC5C;AAAA,EAAC;AAAA;AAAA,IACA,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,qBAAoB;AAAA,IACpB,MAAK;AAAA,IACL,eAAY;AAAA,IACZ,eAAY,YAAAC,SAAM,8BAA8B,SAAU;AAAA,IAC1D;AAAA,IAEA;AAAA,kDAAC,0BAAK,OAAM,MAAK,QAAO,MAAK,MAAK,gBAAe,aAAc,KAAM;AAAA,MACrE;AAAA,QAAC;AAAA;AAAA,UACA,cAAa;AAAA,UACb,QAAO;AAAA,UACP,eAAgB;AAAA,UAChB,GAAE;AAAA;AAAA,MACH;AAAA;AAAA;AACD;AAGM,SAAS,KA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\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tTextControl,\n\tToolbarButton,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tflipHorizontal as flipHorizontalIcon,\n\tflipVertical as flipVerticalIcon,\n\trotateRight,\n} from '@wordpress/icons';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tgetDimensionsClassesAndStyles as useDimensionsProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { SVG, Rect, Path } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\nimport { CustomInserterModal } from './components';\n\nconst IconPlaceholder = ( { className, style } ) => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t\tfill=\"none\"\n\t\taria-hidden=\"true\"\n\t\tclassName={ clsx( 'wp-block-icon__placeholder', className ) }\n\t\tstyle={ style }\n\t>\n\t\t<Rect width=\"60\" height=\"60\" fill=\"currentColor\" fillOpacity={ 0.1 } />\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeOpacity={ 0.25 }\n\t\t\td=\"M60 60 0 0\"\n\t\t/>\n\t</SVG>\n);\n\nexport function Edit( { attributes, setAttributes } ) {\n\tconst { icon, ariaLabel, flipHorizontal, flipVertical, rotation } =\n\t\tattributes;\n\n\tconst [ isInserterOpen, setInserterOpen ] = useState( false );\n\n\tconst isContentOnlyMode = useBlockEditingMode() === 'contentOnly';\n\n\tconst colorProps = useColorProps( attributes );\n\tconst spacingProps = useSpacingProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst dimensionsProps = useDimensionsProps( attributes );\n\n\tconst selectedIcon = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\t\treturn icon ? getEntityRecord( 'root', 'icon', icon ) : null;\n\t\t},\n\t\t[ icon ]\n\t);\n\n\tconst iconToDisplay = selectedIcon?.content || '';\n\n\tconst flipClasses = {\n\t\t'is-flip-horizontal': flipHorizontal,\n\t\t'is-flip-vertical': flipVertical,\n\t};\n\n\tconst rotationStyle = rotation ? { rotate: `${ rotation }deg` } : {};\n\n\tconst blockControls = (\n\t\t<>\n\t\t\t{ icon && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ flipHorizontalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip horizontal' ) }\n\t\t\t\t\t\tisPressed={ flipHorizontal }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipHorizontal: ! flipHorizontal,\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<ToolbarButton\n\t\t\t\t\t\ticon={ flipVerticalIcon }\n\t\t\t\t\t\tlabel={ __( 'Flip vertical' ) }\n\t\t\t\t\t\tisPressed={ flipVertical }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tflipVertical: ! flipVertical,\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<ToolbarButton\n\t\t\t\t\t\ticon={ rotateRight }\n\t\t\t\t\t\tlabel={ __( 'Rotate' ) }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\trotation: ( ( rotation || 0 ) + 90 ) % 360,\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</BlockControls>\n\t\t\t) }\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetInserterOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ icon ? __( 'Replace' ) : __( 'Choose icon' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t\t{ isContentOnlyMode && icon && (\n\t\t\t\t\t// Add some extra controls for content attributes when content only mode is active.\n\t\t\t\t\t// With content only mode active, the inspector is hidden, so users need another way\n\t\t\t\t\t// to edit these attributes.\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon=\"\"\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: ToolbarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tclassName: 'is-alternate',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttext={ __( 'Label' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tclassName=\"wp-block-icon__toolbar-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tariaLabel: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst inspectorControls = icon && (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the icon to help screen reader users. Leave blank for decorative icons.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { ariaLabel: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t{ iconToDisplay ? (\n\t\t\t\t\t<HtmlRenderer\n\t\t\t\t\t\thtml={ iconToDisplay }\n\t\t\t\t\t\twrapperProps={ {\n\t\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t\t...rotationStyle,\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\t\t<IconPlaceholder\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t\tspacingProps.className,\n\t\t\t\t\t\t\tdimensionsProps.className,\n\t\t\t\t\t\t\tflipClasses\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t\t...spacingProps.style,\n\t\t\t\t\t\t\t...dimensionsProps.style,\n\t\t\t\t\t\t\t...rotationStyle,\n\t\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isInserterOpen && (\n\t\t\t\t<CustomInserterModal\n\t\t\t\t\tonClose={ () => setInserterOpen( false ) }\n\t\t\t\t\tvalue={ attributes.icon }\n\t\t\t\t\tonChange={ ( name ) => {\n\t\t\t\t\t\tsetAttributes( { icon: name } );\n\t\t\t\t\t\tsetInserterOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
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GAAG,WAAW;AAAA,YACd,GAAG,YAAY;AAAA,YACf,GAAG,aAAa;AAAA,YAChB,GAAG,gBAAgB;AAAA,YACnB,GAAG;AAAA,UACJ;AAAA,QACD;AAAA;AAAA,IACD,IAEA;AAAA,MAAC;AAAA;AAAA,QACA,eAAY,YAAAA;AAAA,UACX,YAAY;AAAA,UACZ,aAAa;AAAA,UACb,gBAAgB;AAAA,UAChB;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,UACP,GAAG,YAAY;AAAA,UACf,GAAG,aAAa;AAAA,UAChB,GAAG,gBAAgB;AAAA,UACnB,GAAG;AAAA,UACH,QAAQ;AAAA,QACT;AAAA;AAAA,IACD,GAEF;AAAA,IACE,kBACD;AAAA,MAAC;AAAA;AAAA,QACA,SAAU,MAAM,gBAAiB,KAAM;AAAA,QACvC,OAAQ,WAAW;AAAA,QACnB,UAAW,CAAE,SAAU;AACtB,wBAAe,EAAE,MAAM,KAAK,CAAE;AAC9B,0BAAiB,KAAM;AAAA,QACxB;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEA,IAAO,eAAQ;",
6
6
  "names": ["import_components", "clsx", "useColorProps", "useSpacingProps", "useBorderProps", "useDimensionsProps", "coreDataStore", "flipHorizontalIcon", "flipVerticalIcon", "ToolsPanel", "ToolsPanelItem", "HtmlRenderer"]
7
7
  }
@@ -141,7 +141,7 @@
141
141
  }
142
142
  },
143
143
  "selectors": {
144
- "dimensions": ".wp-block-image img",
144
+ "dimensions": ".wp-block-image img, .wp-block-image .components-placeholder",
145
145
  "border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
146
146
  "shadow": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
147
147
  "filter": {
@@ -50,7 +50,6 @@ var import_compose = require("@wordpress/compose");
50
50
  var import_url = require("@wordpress/url");
51
51
  var import_upload_media = require("@wordpress/upload-media");
52
52
  var import_hooks = require("../utils/hooks.cjs");
53
- var import_gif_conversion_attributes = require("../utils/gif-conversion-attributes.cjs");
54
53
  var import_image = __toESM(require("./image.cjs"));
55
54
  var import_utils = require("./utils.cjs");
56
55
  var import_use_max_width_observer = require("./use-max-width-observer.cjs");
@@ -187,39 +186,6 @@ function ImageEdit({
187
186
  setTemporaryURL(media.url);
188
187
  return;
189
188
  }
190
- const rootClientId = getBlockRootClientId(clientId);
191
- const isInGallery = !!rootClientId && getBlockName(rootClientId) === "core/gallery";
192
- if (!isInGallery && media.media_details?.animated_video && media.url) {
193
- const dir = media.url.slice(0, media.url.lastIndexOf("/") + 1);
194
- const poster = media.media_details.animated_video_poster;
195
- __unstableMarkNextChangeAsNotPersistent();
196
- replaceBlock(
197
- clientId,
198
- (0, import_blocks.createBlock)("core/video", {
199
- ...(0, import_gif_conversion_attributes.getCarriedGifConversionAttributes)(attributes),
200
- id: media.id,
201
- src: dir + media.media_details.animated_video,
202
- poster: poster ? dir + poster : void 0,
203
- caption: media.caption?.raw ?? media.caption,
204
- controls: false,
205
- loop: true,
206
- autoplay: true,
207
- muted: true,
208
- playsInline: true,
209
- /*
210
- * Carry the GIF's intrinsic dimensions so the <video> keeps
211
- * its aspect ratio from the first paint. Without them the
212
- * element collapses to the browser-default size and then
213
- * jumps once the poster/metadata load, which shows up as a
214
- * brief duplicated image during the swap.
215
- */
216
- width: media.media_details.width,
217
- height: media.media_details.height
218
- })
219
- );
220
- setTemporaryURL();
221
- return;
222
- }
223
189
  const { imageDefaultSize } = getSettings();
224
190
  let newSize = import_constants.DEFAULT_MEDIA_SIZE_SLUG;
225
191
  if (sizeSlug && hasSize(media, sizeSlug)) {
@@ -303,7 +269,7 @@ function ImageEdit({
303
269
  const src = isExternal ? url : void 0;
304
270
  const isSideloading = (0, import_data.useSelect)(
305
271
  (select) => {
306
- if (!window.__clientSideMediaProcessing && !window.__heicUploadSupport || !id) {
272
+ if (!window.__clientSideMediaProcessing || !id) {
307
273
  return false;
308
274
  }
309
275
  return select(import_upload_media.store).isUploadingById(id);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/image/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL, createBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockBindingsSource } from '@wordpress/blocks';\nimport { Placeholder } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tBlockIcon,\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tstore as blockEditorStore,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { image as icon, plugins as pluginsIcon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { getProtocol, prependHTTPS } from '@wordpress/url';\nimport { store as uploadStore } from '@wordpress/upload-media';\n\n/**\n * Internal dependencies\n */\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\nimport { getCarriedGifConversionAttributes } from '../utils/gif-conversion-attributes';\nimport Image from './image';\nimport { isValidFileType } from './utils';\nimport { useMaxWidthObserver } from './use-max-width-observer';\n\n/**\n * Module constants\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_CUSTOM,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tALLOWED_MEDIA_TYPES,\n\tDEFAULT_MEDIA_SIZE_SLUG,\n} from './constants';\n\nexport const pickRelevantMediaFiles = ( image, size ) => {\n\tconst imageProps = Object.fromEntries(\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\n\t\t)\n\t);\n\n\timageProps.url =\n\t\timage?.sizes?.[ size ]?.url ||\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\n\t\timage.url;\n\treturn imageProps;\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no\n * id and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\n/**\n * Checks if WP generated the specified image size. Size generation is skipped\n * when the image is smaller than the said size.\n *\n * @param {Object} image\n * @param {string} size\n *\n * @return {boolean} Whether or not it has default image size.\n */\nfunction hasSize( image, size ) {\n\treturn (\n\t\t'url' in ( image?.sizes?.[ size ] ?? {} ) ||\n\t\t'source_url' in ( image?.media_details?.sizes?.[ size ] ?? {} )\n\t);\n}\n\nexport function ImageEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected: isSingleSelected,\n\tclassName,\n\tinsertBlocksAfter,\n\tonReplace,\n\tcontext,\n\tclientId,\n\t__unstableParentLayout: parentLayout,\n} ) {\n\tconst {\n\t\turl = '',\n\t\tcaption,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tsizeSlug,\n\t\taspectRatio,\n\t\tscale,\n\t\talign,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\n\tconst containerRef = useRef();\n\t// Only observe the max width from the parent container when the parent layout is not flex nor grid.\n\t// This won't work for them because the container width changes with the image.\n\t// TODO: Find a way to observe the container width for flex and grid layouts.\n\tconst layoutType = parentLayout?.type || parentLayout?.default?.type;\n\tconst isMaxWidthContainerWidth =\n\t\t! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );\n\tconst [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();\n\n\tconst [ placeholderResizeListener, { width: placeholderWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst isSmallContainer = placeholderWidth && placeholderWidth < 160;\n\n\tconst captionRef = useRef();\n\tuseEffect( () => {\n\t\tcaptionRef.current = caption;\n\t}, [ caption ] );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( [ 'wide', 'full' ].includes( align ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ __unstableMarkNextChangeAsNotPersistent, align, setAttributes ] );\n\n\tconst {\n\t\tgetSettings,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t\tsetAttributes( {\n\t\t\tsrc: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tblob: undefined,\n\t\t} );\n\t}\n\n\tfunction onFilesPreUpload( files ) {\n\t\tif ( files.length === 1 ) {\n\t\t\tsetTemporaryURL( createBlobURL( files[ 0 ] ) );\n\t\t}\n\t}\n\n\tfunction onSelectImagesList( images ) {\n\t\tconst win = containerRef.current?.ownerDocument.defaultView;\n\n\t\tif ( images.every( ( file ) => file instanceof win.File ) ) {\n\t\t\t/** @type {File[]} */\n\t\t\tconst files = images;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif ( files.some( ( file ) => ! isValidFileType( file ) ) ) {\n\t\t\t\t// Copied from the same notice in the gallery block.\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'If uploading to a gallery all files need to be image formats'\n\t\t\t\t\t),\n\t\t\t\t\t{ id: 'gallery-upload-invalid-file', type: 'snackbar' }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst imageBlocks = files\n\t\t\t\t.filter( ( file ) => isValidFileType( file ) )\n\t\t\t\t.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\tif ( getBlockName( rootClientId ) === 'core/gallery' ) {\n\t\t\t\treplaceBlock( clientId, imageBlocks );\n\t\t\t} else if ( canInsertBlockType( 'core/gallery', rootClientId ) ) {\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{},\n\t\t\t\t\timageBlocks\n\t\t\t\t);\n\n\t\t\t\treplaceBlock( clientId, galleryBlock );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onSelectImage( media ) {\n\t\tif ( Array.isArray( media ) ) {\n\t\t\tonSelectImagesList( media );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\ttitle: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\t// Switch to a converted GIF video block when the selected media is\n\t\t// an animated GIF whose sideloaded video companion is available.\n\t\t// Triggering off the upload's onChange (rather than watching the\n\t\t// attachment record) means already-saved image blocks are left\n\t\t// alone on page load - the explicit \"Display as video\" toolbar\n\t\t// button is the path for converting those. `animated_video` is\n\t\t// only ever set on GIF image attachments, so its presence is a\n\t\t// sufficient signal that this swap applies.\n\t\t//\n\t\t// A gallery only accepts `core/image` children, so the swap is\n\t\t// skipped there; the converted video is still sideloaded and\n\t\t// stored for use elsewhere.\n\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\tconst isInGallery =\n\t\t\t!! rootClientId && getBlockName( rootClientId ) === 'core/gallery';\n\t\tif (\n\t\t\t! isInGallery &&\n\t\t\tmedia.media_details?.animated_video &&\n\t\t\tmedia.url\n\t\t) {\n\t\t\tconst dir = media.url.slice( 0, media.url.lastIndexOf( '/' ) + 1 );\n\t\t\tconst poster = media.media_details.animated_video_poster;\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceBlock(\n\t\t\t\tclientId,\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\t...getCarriedGifConversionAttributes( attributes ),\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsrc: dir + media.media_details.animated_video,\n\t\t\t\t\tposter: poster ? dir + poster : undefined,\n\t\t\t\t\tcaption: media.caption?.raw ?? media.caption,\n\t\t\t\t\tcontrols: false,\n\t\t\t\t\tloop: true,\n\t\t\t\t\tautoplay: true,\n\t\t\t\t\tmuted: true,\n\t\t\t\t\tplaysInline: true,\n\t\t\t\t\t/*\n\t\t\t\t\t * Carry the GIF's intrinsic dimensions so the <video> keeps\n\t\t\t\t\t * its aspect ratio from the first paint. Without them the\n\t\t\t\t\t * element collapses to the browser-default size and then\n\t\t\t\t\t * jumps once the poster/metadata load, which shows up as a\n\t\t\t\t\t * brief duplicated image during the swap.\n\t\t\t\t\t */\n\t\t\t\t\twidth: media.media_details.width,\n\t\t\t\t\theight: media.media_details.height,\n\t\t\t\t} )\n\t\t\t);\n\t\t\tsetTemporaryURL();\n\t\t\treturn;\n\t\t}\n\n\t\tconst { imageDefaultSize } = getSettings();\n\n\t\t// Try to use the previous selected image size if its available\n\t\t// otherwise try the default image size or fallback to \"full\"\n\t\tlet newSize = DEFAULT_MEDIA_SIZE_SLUG;\n\t\tif ( sizeSlug && hasSize( media, sizeSlug ) ) {\n\t\t\tnewSize = sizeSlug;\n\t\t} else if ( hasSize( media, imageDefaultSize ) ) {\n\t\t\tnewSize = imageDefaultSize;\n\t\t}\n\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, newSize );\n\n\t\t// Normalize newline characters in caption to <br />\n\t\t// to preserve line breaks in both editor and frontend.\n\t\tif (\n\t\t\ttypeof mediaAttributes.caption === 'string' &&\n\t\t\tmediaAttributes.caption.includes( '\\n' )\n\t\t) {\n\t\t\tmediaAttributes.caption = mediaAttributes.caption.replace(\n\t\t\t\t/\\n/g,\n\t\t\t\t'<br>'\n\t\t\t);\n\t\t}\n\n\t\t// If a caption text was meanwhile written by the user,\n\t\t// make sure the text is not overwritten by empty captions.\n\t\tif ( captionRef.current && ! mediaAttributes.caption ) {\n\t\t\tconst { caption: omittedCaption, ...restMediaAttributes } =\n\t\t\t\tmediaAttributes;\n\t\t\tmediaAttributes = restMediaAttributes;\n\t\t}\n\n\t\tlet additionalAttributes;\n\t\t// Reset the dimension attributes if changing to a different image.\n\t\tif ( ! media.id || media.id !== id ) {\n\t\t\tadditionalAttributes = {\n\t\t\t\tsizeSlug: newSize,\n\t\t\t};\n\t\t}\n\n\t\t// Check if default link setting should be used.\n\t\tlet linkDestination = attributes.linkDestination;\n\t\tif ( ! linkDestination ) {\n\t\t\t// Use the WordPress option to determine the proper default.\n\t\t\t// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.\n\t\t\tswitch (\n\t\t\t\twindow?.wp?.media?.view?.settings?.defaultProps?.link ||\n\t\t\t\tLINK_DESTINATION_NONE\n\t\t\t) {\n\t\t\t\tcase 'file':\n\t\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_MEDIA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_CUSTOM:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_CUSTOM;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_NONE:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_NONE;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Check if the image is linked to it's media.\n\t\tlet href;\n\t\tswitch ( linkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\thref = media.url;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\thref = media.link;\n\t\t\t\tbreak;\n\t\t}\n\t\tmediaAttributes.href = href;\n\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\t...mediaAttributes,\n\t\t\t...additionalAttributes,\n\t\t\tlinkDestination,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tfunction onSelectURL( newURL ) {\n\t\t// Handle URLs without protocol.\n\t\tconst normalizedNewURL = getProtocol( newURL )\n\t\t\t? newURL\n\t\t\t: prependHTTPS( newURL );\n\t\tif ( normalizedNewURL !== url ) {\n\t\t\tsetAttributes( {\n\t\t\t\tblob: undefined,\n\t\t\t\turl: normalizedNewURL,\n\t\t\t\tid: undefined,\n\t\t\t\tsizeSlug: getSettings().imageDefaultSize,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectImage,\n\t\tonError: onUploadError,\n\t} );\n\n\tconst isExternal = isExternalImage( id, url );\n\tconst src = isExternal ? url : undefined;\n\n\tconst isSideloading = useSelect(\n\t\t( select ) => {\n\t\t\tif (\n\t\t\t\t( ! window.__clientSideMediaProcessing &&\n\t\t\t\t\t! window.__heicUploadSupport ) ||\n\t\t\t\t! id\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( uploadStore ).isUploadingById( id );\n\t\t},\n\t\t[ id ]\n\t);\n\n\tconst mediaPreview = !! url && (\n\t\t<img\n\t\t\talt={ __( 'Edit image' ) }\n\t\t\ttitle={ __( 'Edit image' ) }\n\t\t\tclassName=\"edit-image-preview\"\n\t\t\tsrc={ url }\n\t\t/>\n\t);\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL || isSideloading,\n\t\t'is-resized': !! width || !! height,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t'has-custom-border':\n\t\t\t!! borderProps.className ||\n\t\t\t( borderProps.style &&\n\t\t\t\tObject.keys( borderProps.style ).length > 0 ),\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: containerRef,\n\t\tclassName: classes,\n\t} );\n\n\t// Much of this description is duplicated from MediaPlaceholder.\n\tconst { lockUrlControls = false, lockUrlControlsMessage } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockUrlControlsMessage: blockBindingsSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\tblockBindingsSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSingleSelected, metadata?.bindings?.url ]\n\t);\n\t// `height: 'auto'` is not a pinned dimension (it lets the height follow the\n\t// aspect ratio, e.g. for an image pasted with both width and height). Treat\n\t// it as absent so the placeholder box keeps its aspect ratio and pinned\n\t// width instead of collapsing to a 100%×100% fill.\n\tconst pinnedHeight = height === 'auto' ? undefined : height;\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx( 'block-editor-media-placeholder', {\n\t\t\t\t\t[ borderProps.className ]:\n\t\t\t\t\t\t!! borderProps.className && ! isSingleSelected,\n\t\t\t\t} ) }\n\t\t\t\ticon={\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t( lockUrlControls ? pluginsIcon : icon )\n\t\t\t\t}\n\t\t\t\twithIllustration={ ! isSingleSelected || isSmallContainer }\n\t\t\t\tlabel={ ! isSmallContainer && __( 'Image' ) }\n\t\t\t\tinstructions={\n\t\t\t\t\t! lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! ( width && pinnedHeight ) && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\twidth: pinnedHeight && aspectRatio ? '100%' : width,\n\t\t\t\t\theight: width && aspectRatio ? '100%' : pinnedHeight,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\tlockUrlControlsMessage }\n\n\t\t\t\t{ ! lockUrlControls && ! isSmallContainer && content }\n\t\t\t\t{ placeholderResizeListener }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t<Image\n\t\t\t\t\ttemporaryURL={ temporaryURL }\n\t\t\t\t\tisSideloading={ isSideloading }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSingleSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonSelectImage={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonUploadError={ onUploadError }\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\t\tparentLayoutType={ layoutType }\n\t\t\t\t\tmaxContentWidth={ maxContentWidth }\n\t\t\t\t/>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonFilesPreUpload={ onFilesPreUpload }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\thandleUpload={ ( files ) => files.length === 1 }\n\t\t\t\t\tvalue={ { id, src } }\n\t\t\t\t\tmediaPreview={ mediaPreview }\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t\t{\n\t\t\t\t// The listener cannot be placed as the first element as it will break the in-between inserter.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/blob/71134165868298fc15e22896d0c28b41b3755ff7/packages/block-editor/src/components/block-list/use-in-between-inserter.js#L120\n\t\t\t\tisSingleSelected && isMaxWidthContainerWidth && maxWidthObserver\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default ImageEdit;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AA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A,IAAO,eAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL, createBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockBindingsSource } from '@wordpress/blocks';\nimport { Placeholder } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tBlockIcon,\n\tuseBlockProps,\n\tMediaPlaceholder,\n\tstore as blockEditorStore,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { image as icon, plugins as pluginsIcon } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { getProtocol, prependHTTPS } from '@wordpress/url';\nimport { store as uploadStore } from '@wordpress/upload-media';\n\n/**\n * Internal dependencies\n */\nimport { useUploadMediaFromBlobURL } from '../utils/hooks';\nimport Image from './image';\nimport { isValidFileType } from './utils';\nimport { useMaxWidthObserver } from './use-max-width-observer';\n\n/**\n * Module constants\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_CUSTOM,\n\tLINK_DESTINATION_MEDIA,\n\tLINK_DESTINATION_NONE,\n\tALLOWED_MEDIA_TYPES,\n\tDEFAULT_MEDIA_SIZE_SLUG,\n} from './constants';\n\nexport const pickRelevantMediaFiles = ( image, size ) => {\n\tconst imageProps = Object.fromEntries(\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\n\t\t\t[ 'alt', 'id', 'link', 'caption' ].includes( key )\n\t\t)\n\t);\n\n\timageProps.url =\n\t\timage?.sizes?.[ size ]?.url ||\n\t\timage?.media_details?.sizes?.[ size ]?.source_url ||\n\t\timage.url;\n\treturn imageProps;\n};\n\n/**\n * Is the url for the image hosted externally. An externally hosted image has no\n * id and is not a blob url.\n *\n * @param {number=} id The id of the image.\n * @param {string=} url The url of the image.\n *\n * @return {boolean} Is the url an externally hosted url?\n */\nexport const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );\n\n/**\n * Checks if WP generated the specified image size. Size generation is skipped\n * when the image is smaller than the said size.\n *\n * @param {Object} image\n * @param {string} size\n *\n * @return {boolean} Whether or not it has default image size.\n */\nfunction hasSize( image, size ) {\n\treturn (\n\t\t'url' in ( image?.sizes?.[ size ] ?? {} ) ||\n\t\t'source_url' in ( image?.media_details?.sizes?.[ size ] ?? {} )\n\t);\n}\n\nexport function ImageEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected: isSingleSelected,\n\tclassName,\n\tinsertBlocksAfter,\n\tonReplace,\n\tcontext,\n\tclientId,\n\t__unstableParentLayout: parentLayout,\n} ) {\n\tconst {\n\t\turl = '',\n\t\tcaption,\n\t\tid,\n\t\twidth,\n\t\theight,\n\t\tsizeSlug,\n\t\taspectRatio,\n\t\tscale,\n\t\talign,\n\t\tmetadata,\n\t} = attributes;\n\n\tconst [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );\n\n\tconst containerRef = useRef();\n\t// Only observe the max width from the parent container when the parent layout is not flex nor grid.\n\t// This won't work for them because the container width changes with the image.\n\t// TODO: Find a way to observe the container width for flex and grid layouts.\n\tconst layoutType = parentLayout?.type || parentLayout?.default?.type;\n\tconst isMaxWidthContainerWidth =\n\t\t! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );\n\tconst [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();\n\n\tconst [ placeholderResizeListener, { width: placeholderWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst isSmallContainer = placeholderWidth && placeholderWidth < 160;\n\n\tconst captionRef = useRef();\n\tuseEffect( () => {\n\t\tcaptionRef.current = caption;\n\t}, [ caption ] );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( [ 'wide', 'full' ].includes( align ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\twidth: undefined,\n\t\t\t\theight: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ __unstableMarkNextChangeAsNotPersistent, align, setAttributes ] );\n\n\tconst {\n\t\tgetSettings,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tcanInsertBlockType,\n\t} = useSelect( blockEditorStore );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tfunction onUploadError( message ) {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\tsetTemporaryURL();\n\t\tsetAttributes( {\n\t\t\tsrc: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tblob: undefined,\n\t\t} );\n\t}\n\n\tfunction onFilesPreUpload( files ) {\n\t\tif ( files.length === 1 ) {\n\t\t\tsetTemporaryURL( createBlobURL( files[ 0 ] ) );\n\t\t}\n\t}\n\n\tfunction onSelectImagesList( images ) {\n\t\tconst win = containerRef.current?.ownerDocument.defaultView;\n\n\t\tif ( images.every( ( file ) => file instanceof win.File ) ) {\n\t\t\t/** @type {File[]} */\n\t\t\tconst files = images;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\tif ( files.some( ( file ) => ! isValidFileType( file ) ) ) {\n\t\t\t\t// Copied from the same notice in the gallery block.\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'If uploading to a gallery all files need to be image formats'\n\t\t\t\t\t),\n\t\t\t\t\t{ id: 'gallery-upload-invalid-file', type: 'snackbar' }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst imageBlocks = files\n\t\t\t\t.filter( ( file ) => isValidFileType( file ) )\n\t\t\t\t.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\tif ( getBlockName( rootClientId ) === 'core/gallery' ) {\n\t\t\t\treplaceBlock( clientId, imageBlocks );\n\t\t\t} else if ( canInsertBlockType( 'core/gallery', rootClientId ) ) {\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{},\n\t\t\t\t\timageBlocks\n\t\t\t\t);\n\n\t\t\t\treplaceBlock( clientId, galleryBlock );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onSelectImage( media ) {\n\t\tif ( Array.isArray( media ) ) {\n\t\t\tonSelectImagesList( media );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! media || ! media.url ) {\n\t\t\tsetAttributes( {\n\t\t\t\turl: undefined,\n\t\t\t\talt: undefined,\n\t\t\t\tid: undefined,\n\t\t\t\ttitle: undefined,\n\t\t\t\tcaption: undefined,\n\t\t\t\tblob: undefined,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\tsetTemporaryURL( media.url );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { imageDefaultSize } = getSettings();\n\n\t\t// Try to use the previous selected image size if its available\n\t\t// otherwise try the default image size or fallback to \"full\"\n\t\tlet newSize = DEFAULT_MEDIA_SIZE_SLUG;\n\t\tif ( sizeSlug && hasSize( media, sizeSlug ) ) {\n\t\t\tnewSize = sizeSlug;\n\t\t} else if ( hasSize( media, imageDefaultSize ) ) {\n\t\t\tnewSize = imageDefaultSize;\n\t\t}\n\n\t\tlet mediaAttributes = pickRelevantMediaFiles( media, newSize );\n\n\t\t// Normalize newline characters in caption to <br />\n\t\t// to preserve line breaks in both editor and frontend.\n\t\tif (\n\t\t\ttypeof mediaAttributes.caption === 'string' &&\n\t\t\tmediaAttributes.caption.includes( '\\n' )\n\t\t) {\n\t\t\tmediaAttributes.caption = mediaAttributes.caption.replace(\n\t\t\t\t/\\n/g,\n\t\t\t\t'<br>'\n\t\t\t);\n\t\t}\n\n\t\t// If a caption text was meanwhile written by the user,\n\t\t// make sure the text is not overwritten by empty captions.\n\t\tif ( captionRef.current && ! mediaAttributes.caption ) {\n\t\t\tconst { caption: omittedCaption, ...restMediaAttributes } =\n\t\t\t\tmediaAttributes;\n\t\t\tmediaAttributes = restMediaAttributes;\n\t\t}\n\n\t\tlet additionalAttributes;\n\t\t// Reset the dimension attributes if changing to a different image.\n\t\tif ( ! media.id || media.id !== id ) {\n\t\t\tadditionalAttributes = {\n\t\t\t\tsizeSlug: newSize,\n\t\t\t};\n\t\t}\n\n\t\t// Check if default link setting should be used.\n\t\tlet linkDestination = attributes.linkDestination;\n\t\tif ( ! linkDestination ) {\n\t\t\t// Use the WordPress option to determine the proper default.\n\t\t\t// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.\n\t\t\tswitch (\n\t\t\t\twindow?.wp?.media?.view?.settings?.defaultProps?.link ||\n\t\t\t\tLINK_DESTINATION_NONE\n\t\t\t) {\n\t\t\t\tcase 'file':\n\t\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_MEDIA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_CUSTOM:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_CUSTOM;\n\t\t\t\t\tbreak;\n\t\t\t\tcase LINK_DESTINATION_NONE:\n\t\t\t\t\tlinkDestination = LINK_DESTINATION_NONE;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Check if the image is linked to it's media.\n\t\tlet href;\n\t\tswitch ( linkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\thref = media.url;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\thref = media.link;\n\t\t\t\tbreak;\n\t\t}\n\t\tmediaAttributes.href = href;\n\n\t\tsetAttributes( {\n\t\t\tblob: undefined,\n\t\t\t...mediaAttributes,\n\t\t\t...additionalAttributes,\n\t\t\tlinkDestination,\n\t\t} );\n\t\tsetTemporaryURL();\n\t}\n\n\tfunction onSelectURL( newURL ) {\n\t\t// Handle URLs without protocol.\n\t\tconst normalizedNewURL = getProtocol( newURL )\n\t\t\t? newURL\n\t\t\t: prependHTTPS( newURL );\n\t\tif ( normalizedNewURL !== url ) {\n\t\t\tsetAttributes( {\n\t\t\t\tblob: undefined,\n\t\t\t\turl: normalizedNewURL,\n\t\t\t\tid: undefined,\n\t\t\t\tsizeSlug: getSettings().imageDefaultSize,\n\t\t\t} );\n\t\t\tsetTemporaryURL();\n\t\t}\n\t}\n\n\tuseUploadMediaFromBlobURL( {\n\t\turl: temporaryURL,\n\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\tonChange: onSelectImage,\n\t\tonError: onUploadError,\n\t} );\n\n\tconst isExternal = isExternalImage( id, url );\n\tconst src = isExternal ? url : undefined;\n\n\tconst isSideloading = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! window.__clientSideMediaProcessing || ! id ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( uploadStore ).isUploadingById( id );\n\t\t},\n\t\t[ id ]\n\t);\n\n\tconst mediaPreview = !! url && (\n\t\t<img\n\t\t\talt={ __( 'Edit image' ) }\n\t\t\ttitle={ __( 'Edit image' ) }\n\t\t\tclassName=\"edit-image-preview\"\n\t\t\tsrc={ url }\n\t\t/>\n\t);\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst shadowProps = getShadowClassesAndStyles( attributes );\n\n\tconst classes = clsx( className, {\n\t\t'is-transient': !! temporaryURL || isSideloading,\n\t\t'is-resized': !! width || !! height,\n\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t'has-custom-border':\n\t\t\t!! borderProps.className ||\n\t\t\t( borderProps.style &&\n\t\t\t\tObject.keys( borderProps.style ).length > 0 ),\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: containerRef,\n\t\tclassName: classes,\n\t} );\n\n\t// Much of this description is duplicated from MediaPlaceholder.\n\tconst { lockUrlControls = false, lockUrlControlsMessage } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isSingleSelected ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\tmetadata?.bindings?.url?.source\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlockUrlControls:\n\t\t\t\t\t!! metadata?.bindings?.url &&\n\t\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\targs: metadata?.bindings?.url?.args,\n\t\t\t\t\t} ),\n\t\t\t\tlockUrlControlsMessage: blockBindingsSource?.label\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Label of the bindings source. */\n\t\t\t\t\t\t\t__( 'Connected to %s' ),\n\t\t\t\t\t\t\tblockBindingsSource.label\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Connected to dynamic data' ),\n\t\t\t};\n\t\t},\n\t\t[ context, isSingleSelected, metadata?.bindings?.url ]\n\t);\n\t// `height: 'auto'` is not a pinned dimension (it lets the height follow the\n\t// aspect ratio, e.g. for an image pasted with both width and height). Treat\n\t// it as absent so the placeholder box keeps its aspect ratio and pinned\n\t// width instead of collapsing to a 100%×100% fill.\n\tconst pinnedHeight = height === 'auto' ? undefined : height;\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\tclassName={ clsx( 'block-editor-media-placeholder', {\n\t\t\t\t\t[ borderProps.className ]:\n\t\t\t\t\t\t!! borderProps.className && ! isSingleSelected,\n\t\t\t\t} ) }\n\t\t\t\ticon={\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t( lockUrlControls ? pluginsIcon : icon )\n\t\t\t\t}\n\t\t\t\twithIllustration={ ! isSingleSelected || isSmallContainer }\n\t\t\t\tlabel={ ! isSmallContainer && __( 'Image' ) }\n\t\t\t\tinstructions={\n\t\t\t\t\t! lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tstyle={ {\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! ( width && pinnedHeight ) && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\twidth: pinnedHeight && aspectRatio ? '100%' : width,\n\t\t\t\t\theight: width && aspectRatio ? '100%' : pinnedHeight,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t...shadowProps.style,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ lockUrlControls &&\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\tlockUrlControlsMessage }\n\n\t\t\t\t{ ! lockUrlControls && ! isSmallContainer && content }\n\t\t\t\t{ placeholderResizeListener }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<figure { ...blockProps }>\n\t\t\t\t<Image\n\t\t\t\t\ttemporaryURL={ temporaryURL }\n\t\t\t\t\tisSideloading={ isSideloading }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSingleSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\tonSelectImage={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonUploadError={ onUploadError }\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tblockEditingMode={ blockEditingMode }\n\t\t\t\t\tparentLayoutType={ layoutType }\n\t\t\t\t\tmaxContentWidth={ maxContentWidth }\n\t\t\t\t/>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\tonFilesPreUpload={ onFilesPreUpload }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\thandleUpload={ ( files ) => files.length === 1 }\n\t\t\t\t\tvalue={ { id, src } }\n\t\t\t\t\tmediaPreview={ mediaPreview }\n\t\t\t\t\tdisableMediaButtons={ temporaryURL || url }\n\t\t\t\t/>\n\t\t\t</figure>\n\t\t\t{\n\t\t\t\t// The listener cannot be placed as the first element as it will break the in-between inserter.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/blob/71134165868298fc15e22896d0c28b41b3755ff7/packages/block-editor/src/components/block-list/use-in-between-inserter.js#L120\n\t\t\t\tisSingleSelected && isMaxWidthContainerWidth && maxWidthObserver\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default ImageEdit;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAyC;AACzC,oBAAoD;AACpD,wBAA4B;AAC5B,kBAAuC;AACvC,0BAQO;AACP,qBAA4C;AAC5C,kBAA4B;AAC5B,mBAAsD;AACtD,qBAAsC;AACtC,qBAAkC;AAClC,iBAA0C;AAC1C,0BAAqC;AAKrC,mBAA0C;AAC1C,mBAAkB;AAClB,mBAAgC;AAChC,oCAAoC;AAKpC,uBA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A,UACV;AAAA,UACA,cAAe;AAAA,UACf,cAAe,CAAE,UAAW,MAAM,WAAW;AAAA,UAC7C,OAAQ,EAAE,IAAI,IAAI;AAAA,UAClB;AAAA,UACA,qBAAsB,gBAAgB;AAAA;AAAA,MACvC;AAAA,OACD;AAAA;AAAA;AAAA,IAIC,oBAAoB,4BAA4B;AAAA,KAElD;AAEF;AAEA,IAAO,eAAQ;",
6
6
  "names": ["blockEditorStore", "noticesStore", "uploadStore", "useBorderProps", "getShadowClassesAndStyles", "clsx", "pluginsIcon", "icon", "Image"]
7
7
  }
@@ -33,6 +33,7 @@ __export(image_exports, {
33
33
  default: () => Image
34
34
  });
35
35
  module.exports = __toCommonJS(image_exports);
36
+ var import_clsx = __toESM(require("clsx"));
36
37
  var import_components = require("@wordpress/components");
37
38
  var import_compose = require("@wordpress/compose");
38
39
  var import_data = require("@wordpress/data");
@@ -52,7 +53,6 @@ var import_media_control = require("../utils/media-control.cjs");
52
53
  var import_hooks = require("../utils/hooks.cjs");
53
54
  var import_style_state = require("../utils/style-state.cjs");
54
55
  var import_use_open_image_media_editor_modal = require("./use-open-image-media-editor-modal.cjs");
55
- var import_animated_gif_convert_control = __toESM(require("./animated-gif-convert-control.cjs"));
56
56
  var import_constants = require("./constants.cjs");
57
57
  var import_utils = require("./utils.cjs");
58
58
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -326,6 +326,8 @@ function Image({
326
326
  );
327
327
  const { getBlock, getSettings } = (0, import_data.useSelect)(import_block_editor.store);
328
328
  const cropButtonRef = (0, import_element.useRef)();
329
+ const [pendingSwapUrl, setPendingSwapUrl] = (0, import_element.useState)();
330
+ const isSwappingMedia = !!pendingSwapUrl;
329
331
  const handleMediaEditorModalClose = (0, import_element.useCallback)(
330
332
  () => cropButtonRef.current?.focus(),
331
333
  []
@@ -333,7 +335,8 @@ function Image({
333
335
  const openImageMediaEditorModal = (0, import_use_open_image_media_editor_modal.useOpenImageMediaEditorModal)({
334
336
  attributes,
335
337
  setAttributes,
336
- onClose: handleMediaEditorModalClose
338
+ onClose: handleMediaEditorModalClose,
339
+ onUrlChange: setPendingSwapUrl
337
340
  });
338
341
  const {
339
342
  replaceBlocks,
@@ -379,14 +382,21 @@ function Image({
379
382
  naturalHeight: imageElement?.naturalHeight || loadedNaturalHeight || void 0
380
383
  };
381
384
  }, [loadedNaturalWidth, loadedNaturalHeight, imageElement?.complete]);
385
+ (0, import_element.useEffect)(() => {
386
+ if (pendingSwapUrl && pendingSwapUrl === url && imageElement?.complete) {
387
+ setPendingSwapUrl(void 0);
388
+ }
389
+ }, [pendingSwapUrl, url, imageElement]);
382
390
  function onImageError() {
391
+ setPendingSwapUrl(void 0);
383
392
  setHasImageErrored(true);
384
393
  const embedBlock = (0, import_util.createUpgradedEmbedBlock)({ attributes: { url } });
385
- if (void 0 !== embedBlock) {
394
+ if (void 0 !== embedBlock && onReplace) {
386
395
  onReplace(embedBlock);
387
396
  }
388
397
  }
389
398
  function onImageLoad(event) {
399
+ setPendingSwapUrl(void 0);
390
400
  setHasImageErrored(false);
391
401
  setLoadedNaturalSize({
392
402
  loadedNaturalWidth: event.target?.naturalWidth,
@@ -677,8 +687,7 @@ function Image({
677
687
  const showUrlInput = isSingleSelected && !lockHrefControls && !lockUrlControls && !isDecorative;
678
688
  const showCoverControls = isSingleSelected && canInsertCover && !isContentOnlyMode;
679
689
  const showBlockControls = showUrlInput || allowCrop || showCoverControls;
680
- const mediaReplaceFlow = isSingleSelected && !lockUrlControls && // For contentOnly mode, put this button in its own area so it has borders around it.
681
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: isContentOnlyMode ? "inline" : "other", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
690
+ const mediaControls = isSingleSelected && !lockUrlControls && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: isContentOnlyMode ? "inline" : "other", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
682
691
  import_block_editor.MediaReplaceFlow,
683
692
  {
684
693
  mediaId: id,
@@ -691,7 +700,7 @@ function Image({
691
700
  onReset: () => onSelectImage(void 0),
692
701
  variant: "toolbar"
693
702
  }
694
- ) });
703
+ ) }) });
695
704
  const hasDataFormBlockFields = window?.__experimentalContentOnlyInspectorFields;
696
705
  const controls = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
697
706
  showBlockControls && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.BlockControls, { group: "block", children: [
@@ -719,7 +728,8 @@ function Image({
719
728
  onClick: openImageMediaEditorModal,
720
729
  "aria-haspopup": "dialog",
721
730
  icon: import_icons.crop,
722
- label: (0, import_i18n.__)("Crop")
731
+ label: (0, import_i18n.__)("Crop"),
732
+ disabled: isSwappingMedia
723
733
  }
724
734
  ),
725
735
  showCoverControls && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -972,7 +982,9 @@ function Image({
972
982
  onError: onImageError,
973
983
  onLoad: onImageLoad,
974
984
  ref: setRefs,
975
- className: borderProps.className,
985
+ className: (0, import_clsx.default)(borderProps.className, {
986
+ "is-swapping-media": isSwappingMedia
987
+ }),
976
988
  width: naturalWidth,
977
989
  height: naturalHeight,
978
990
  style: {
@@ -1001,7 +1013,7 @@ function Image({
1001
1013
  }
1002
1014
  }
1003
1015
  ),
1004
- isUploading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {})
1016
+ (isUploading || isSwappingMedia) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {})
1005
1017
  ] }) });
1006
1018
  let resizableBox;
1007
1019
  if (isResizable && isSingleSelected && !isUploading && !import_constants.SIZED_LAYOUTS.includes(parentLayoutType)) {
@@ -1088,7 +1100,7 @@ function Image({
1088
1100
  }
1089
1101
  if (!url && !temporaryURL) {
1090
1102
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1091
- mediaReplaceFlow,
1103
+ mediaControls,
1092
1104
  controls
1093
1105
  ] });
1094
1106
  }
@@ -1102,14 +1114,7 @@ function Image({
1102
1114
  };
1103
1115
  const featuredImageControl = !isDescendentOfQueryLoop && postId && id ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockSettingsMenuControls, { children: ({ canEdit, selectedClientIds }) => canEdit && selectedClientIds.length === 1 && clientId === selectedClientIds[0] && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.MenuItem, { onClick: setPostFeatureImage, children: (0, import_i18n.__)("Set as featured image") }) }) : null;
1104
1116
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1105
- isSingleSelected && !lockUrlControls && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1106
- import_animated_gif_convert_control.default,
1107
- {
1108
- attributes,
1109
- clientId
1110
- }
1111
- ),
1112
- mediaReplaceFlow,
1117
+ mediaControls,
1113
1118
  controls,
1114
1119
  featuredImageControl,
1115
1120
  img,