@wordpress/block-library 8.20.1 → 8.21.1-next.f8d8eceb.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 (412) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +12 -0
  3. package/build/avatar/index.js +5 -1
  4. package/build/avatar/index.js.map +1 -1
  5. package/build/block/edit-title.native.js +11 -3
  6. package/build/block/edit-title.native.js.map +1 -1
  7. package/build/block/index.js +2 -1
  8. package/build/block/index.js.map +1 -1
  9. package/build/code/edit.native.js +8 -2
  10. package/build/code/edit.native.js.map +1 -1
  11. package/build/column/edit.js +2 -1
  12. package/build/column/edit.js.map +1 -1
  13. package/build/column/edit.native.js +2 -1
  14. package/build/column/edit.native.js.map +1 -1
  15. package/build/columns/edit.native.js +2 -1
  16. package/build/columns/edit.native.js.map +1 -1
  17. package/build/cover/controls.native.js +2 -1
  18. package/build/cover/controls.native.js.map +1 -1
  19. package/build/cover/deprecated.js +110 -1
  20. package/build/cover/deprecated.js.map +1 -1
  21. package/build/cover/edit/index.js +11 -4
  22. package/build/cover/edit/index.js.map +1 -1
  23. package/build/cover/edit/inspector-controls.js +3 -3
  24. package/build/cover/edit/inspector-controls.js.map +1 -1
  25. package/build/cover/index.js +0 -3
  26. package/build/cover/index.js.map +1 -1
  27. package/build/cover/save.js +2 -1
  28. package/build/cover/save.js.map +1 -1
  29. package/build/cover/shared.js +1 -1
  30. package/build/cover/shared.js.map +1 -1
  31. package/build/file/view.js +1 -1
  32. package/build/file/view.js.map +1 -1
  33. package/build/footnotes/index.js +1 -0
  34. package/build/footnotes/index.js.map +1 -1
  35. package/build/form/edit.js +138 -0
  36. package/build/form/edit.js.map +1 -0
  37. package/build/form/index.js +92 -0
  38. package/build/form/index.js.map +1 -0
  39. package/build/form/init.js +13 -0
  40. package/build/form/init.js.map +1 -0
  41. package/build/form/save.js +28 -0
  42. package/build/form/save.js.map +1 -0
  43. package/build/form/utils.js +24 -0
  44. package/build/form/utils.js.map +1 -0
  45. package/build/form/variations.js +95 -0
  46. package/build/form/variations.js.map +1 -0
  47. package/build/form/view.js +42 -0
  48. package/build/form/view.js.map +1 -0
  49. package/build/form-input/edit.js +124 -0
  50. package/build/form-input/edit.js.map +1 -0
  51. package/build/form-input/index.js +105 -0
  52. package/build/form-input/index.js.map +1 -0
  53. package/build/form-input/init.js +13 -0
  54. package/build/form-input/init.js.map +1 -0
  55. package/build/form-input/save.js +87 -0
  56. package/build/form-input/save.js.map +1 -0
  57. package/build/form-input/variations.js +93 -0
  58. package/build/form-input/variations.js.map +1 -0
  59. package/build/form-submission-notification/edit.js +59 -0
  60. package/build/form-submission-notification/edit.js.map +1 -0
  61. package/build/form-submission-notification/index.js +56 -0
  62. package/build/form-submission-notification/index.js.map +1 -0
  63. package/build/form-submission-notification/init.js +13 -0
  64. package/build/form-submission-notification/init.js.map +1 -0
  65. package/build/form-submission-notification/save.js +33 -0
  66. package/build/form-submission-notification/save.js.map +1 -0
  67. package/build/form-submission-notification/variations.js +63 -0
  68. package/build/form-submission-notification/variations.js.map +1 -0
  69. package/build/form-submit-button/edit.js +32 -0
  70. package/build/form-submit-button/edit.js.map +1 -0
  71. package/build/form-submit-button/index.js +44 -0
  72. package/build/form-submit-button/index.js.map +1 -0
  73. package/build/form-submit-button/init.js +13 -0
  74. package/build/form-submit-button/init.js.map +1 -0
  75. package/build/form-submit-button/save.js +22 -0
  76. package/build/form-submit-button/save.js.map +1 -0
  77. package/build/group/edit.js +2 -11
  78. package/build/group/edit.js.map +1 -1
  79. package/build/group/index.js +0 -1
  80. package/build/group/index.js.map +1 -1
  81. package/build/heading/index.js +3 -2
  82. package/build/heading/index.js.map +1 -1
  83. package/build/html/preview.js +2 -4
  84. package/build/html/preview.js.map +1 -1
  85. package/build/image/image.js +15 -6
  86. package/build/image/image.js.map +1 -1
  87. package/build/image/view.js +71 -39
  88. package/build/image/view.js.map +1 -1
  89. package/build/index.js +10 -0
  90. package/build/index.js.map +1 -1
  91. package/build/latest-posts/edit.js +6 -2
  92. package/build/latest-posts/edit.js.map +1 -1
  93. package/build/list-item/hooks/use-merge.js +15 -15
  94. package/build/list-item/hooks/use-merge.js.map +1 -1
  95. package/build/lock-unlock.js +1 -1
  96. package/build/lock-unlock.js.map +1 -1
  97. package/build/missing/edit.native.js +54 -64
  98. package/build/missing/edit.native.js.map +1 -1
  99. package/build/navigation/edit/index.js +0 -1
  100. package/build/navigation/edit/index.js.map +1 -1
  101. package/build/navigation/index.js +2 -1
  102. package/build/navigation/index.js.map +1 -1
  103. package/build/navigation/view.js +27 -5
  104. package/build/navigation/view.js.map +1 -1
  105. package/build/page-list-item/edit.js +3 -1
  106. package/build/page-list-item/edit.js.map +1 -1
  107. package/build/paragraph/edit.js +1 -1
  108. package/build/paragraph/edit.js.map +1 -1
  109. package/build/paragraph/index.js +7 -0
  110. package/build/paragraph/index.js.map +1 -1
  111. package/build/pattern/index.js +2 -1
  112. package/build/pattern/index.js.map +1 -1
  113. package/build/post-featured-image/dimension-controls.js +2 -2
  114. package/build/post-featured-image/dimension-controls.js.map +1 -1
  115. package/build/query/edit/enhanced-pagination-modal.js +27 -13
  116. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  117. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +15 -12
  118. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  119. package/build/query/utils.js +29 -8
  120. package/build/query/utils.js.map +1 -1
  121. package/build/query/view.js +4 -2
  122. package/build/query/view.js.map +1 -1
  123. package/build/search/edit.js +1 -2
  124. package/build/search/edit.js.map +1 -1
  125. package/build/social-link/edit.native.js +7 -19
  126. package/build/social-link/edit.native.js.map +1 -1
  127. package/build/spacer/controls.js +3 -3
  128. package/build/spacer/controls.js.map +1 -1
  129. package/build/spacer/controls.native.js +2 -1
  130. package/build/spacer/controls.native.js.map +1 -1
  131. package/build/spacer/edit.js +1 -1
  132. package/build/spacer/edit.js.map +1 -1
  133. package/build/spacer/edit.native.js +5 -1
  134. package/build/spacer/edit.native.js.map +1 -1
  135. package/build/tag-cloud/edit.js +2 -1
  136. package/build/tag-cloud/edit.js.map +1 -1
  137. package/build/template-part/edit/inner-blocks.js +2 -2
  138. package/build/template-part/edit/inner-blocks.js.map +1 -1
  139. package/build/template-part/index.js +2 -1
  140. package/build/template-part/index.js.map +1 -1
  141. package/build/term-description/index.js +0 -1
  142. package/build/term-description/index.js.map +1 -1
  143. package/build-module/avatar/index.js +5 -1
  144. package/build-module/avatar/index.js.map +1 -1
  145. package/build-module/block/edit-title.native.js +12 -4
  146. package/build-module/block/edit-title.native.js.map +1 -1
  147. package/build-module/block/index.js +2 -1
  148. package/build-module/block/index.js.map +1 -1
  149. package/build-module/code/edit.native.js +8 -2
  150. package/build-module/code/edit.native.js.map +1 -1
  151. package/build-module/column/edit.js +3 -2
  152. package/build-module/column/edit.js.map +1 -1
  153. package/build-module/column/edit.native.js +3 -2
  154. package/build-module/column/edit.native.js.map +1 -1
  155. package/build-module/columns/edit.native.js +3 -2
  156. package/build-module/columns/edit.native.js.map +1 -1
  157. package/build-module/cover/controls.native.js +3 -2
  158. package/build-module/cover/controls.native.js.map +1 -1
  159. package/build-module/cover/deprecated.js +110 -1
  160. package/build-module/cover/deprecated.js.map +1 -1
  161. package/build-module/cover/edit/index.js +12 -5
  162. package/build-module/cover/edit/index.js.map +1 -1
  163. package/build-module/cover/edit/inspector-controls.js +4 -4
  164. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  165. package/build-module/cover/index.js +0 -3
  166. package/build-module/cover/index.js.map +1 -1
  167. package/build-module/cover/save.js +2 -1
  168. package/build-module/cover/save.js.map +1 -1
  169. package/build-module/cover/shared.js +1 -1
  170. package/build-module/cover/shared.js.map +1 -1
  171. package/build-module/file/view.js +2 -2
  172. package/build-module/file/view.js.map +1 -1
  173. package/build-module/footnotes/index.js +1 -0
  174. package/build-module/footnotes/index.js.map +1 -1
  175. package/build-module/form/edit.js +130 -0
  176. package/build-module/form/edit.js.map +1 -0
  177. package/build-module/form/index.js +82 -0
  178. package/build-module/form/index.js.map +1 -0
  179. package/build-module/form/init.js +6 -0
  180. package/build-module/form/init.js.map +1 -0
  181. package/build-module/form/save.js +20 -0
  182. package/build-module/form/save.js.map +1 -0
  183. package/build-module/form/utils.js +15 -0
  184. package/build-module/form/utils.js.map +1 -0
  185. package/build-module/form/variations.js +86 -0
  186. package/build-module/form/variations.js.map +1 -0
  187. package/build-module/form/view.js +40 -0
  188. package/build-module/form/view.js.map +1 -0
  189. package/build-module/form-input/edit.js +115 -0
  190. package/build-module/form-input/edit.js.map +1 -0
  191. package/build-module/form-input/index.js +95 -0
  192. package/build-module/form-input/index.js.map +1 -0
  193. package/build-module/form-input/init.js +6 -0
  194. package/build-module/form-input/init.js.map +1 -0
  195. package/build-module/form-input/save.js +80 -0
  196. package/build-module/form-input/save.js.map +1 -0
  197. package/build-module/form-input/variations.js +85 -0
  198. package/build-module/form-input/variations.js.map +1 -0
  199. package/build-module/form-submission-notification/edit.js +50 -0
  200. package/build-module/form-submission-notification/edit.js.map +1 -0
  201. package/build-module/form-submission-notification/index.js +47 -0
  202. package/build-module/form-submission-notification/index.js.map +1 -0
  203. package/build-module/form-submission-notification/init.js +6 -0
  204. package/build-module/form-submission-notification/init.js.map +1 -0
  205. package/build-module/form-submission-notification/save.js +25 -0
  206. package/build-module/form-submission-notification/save.js.map +1 -0
  207. package/build-module/form-submission-notification/variations.js +55 -0
  208. package/build-module/form-submission-notification/variations.js.map +1 -0
  209. package/build-module/form-submit-button/edit.js +24 -0
  210. package/build-module/form-submit-button/edit.js.map +1 -0
  211. package/build-module/form-submit-button/index.js +34 -0
  212. package/build-module/form-submit-button/index.js.map +1 -0
  213. package/build-module/form-submit-button/init.js +6 -0
  214. package/build-module/form-submit-button/init.js.map +1 -0
  215. package/build-module/form-submit-button/save.js +14 -0
  216. package/build-module/form-submit-button/save.js.map +1 -0
  217. package/build-module/group/edit.js +3 -12
  218. package/build-module/group/edit.js.map +1 -1
  219. package/build-module/group/index.js +0 -1
  220. package/build-module/group/index.js.map +1 -1
  221. package/build-module/heading/index.js +3 -2
  222. package/build-module/heading/index.js.map +1 -1
  223. package/build-module/html/preview.js +2 -4
  224. package/build-module/html/preview.js.map +1 -1
  225. package/build-module/image/image.js +16 -7
  226. package/build-module/image/image.js.map +1 -1
  227. package/build-module/image/view.js +71 -39
  228. package/build-module/image/view.js.map +1 -1
  229. package/build-module/index.js +10 -0
  230. package/build-module/index.js.map +1 -1
  231. package/build-module/latest-posts/edit.js +6 -2
  232. package/build-module/latest-posts/edit.js.map +1 -1
  233. package/build-module/list-item/hooks/use-merge.js +15 -15
  234. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  235. package/build-module/lock-unlock.js +1 -1
  236. package/build-module/lock-unlock.js.map +1 -1
  237. package/build-module/missing/edit.native.js +58 -68
  238. package/build-module/missing/edit.native.js.map +1 -1
  239. package/build-module/navigation/edit/index.js +0 -1
  240. package/build-module/navigation/edit/index.js.map +1 -1
  241. package/build-module/navigation/index.js +2 -1
  242. package/build-module/navigation/index.js.map +1 -1
  243. package/build-module/navigation/view.js +27 -5
  244. package/build-module/navigation/view.js.map +1 -1
  245. package/build-module/page-list-item/edit.js +3 -1
  246. package/build-module/page-list-item/edit.js.map +1 -1
  247. package/build-module/paragraph/edit.js +2 -2
  248. package/build-module/paragraph/edit.js.map +1 -1
  249. package/build-module/paragraph/index.js +7 -0
  250. package/build-module/paragraph/index.js.map +1 -1
  251. package/build-module/pattern/index.js +2 -1
  252. package/build-module/pattern/index.js.map +1 -1
  253. package/build-module/post-featured-image/dimension-controls.js +3 -3
  254. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  255. package/build-module/query/edit/enhanced-pagination-modal.js +28 -14
  256. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  257. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +17 -14
  258. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  259. package/build-module/query/utils.js +27 -5
  260. package/build-module/query/utils.js.map +1 -1
  261. package/build-module/query/view.js +4 -2
  262. package/build-module/query/view.js.map +1 -1
  263. package/build-module/search/edit.js +2 -3
  264. package/build-module/search/edit.js.map +1 -1
  265. package/build-module/social-link/edit.native.js +8 -20
  266. package/build-module/social-link/edit.native.js.map +1 -1
  267. package/build-module/spacer/controls.js +4 -4
  268. package/build-module/spacer/controls.js.map +1 -1
  269. package/build-module/spacer/controls.native.js +3 -2
  270. package/build-module/spacer/controls.native.js.map +1 -1
  271. package/build-module/spacer/edit.js +2 -2
  272. package/build-module/spacer/edit.js.map +1 -1
  273. package/build-module/spacer/edit.native.js +6 -2
  274. package/build-module/spacer/edit.native.js.map +1 -1
  275. package/build-module/tag-cloud/edit.js +3 -2
  276. package/build-module/tag-cloud/edit.js.map +1 -1
  277. package/build-module/template-part/edit/inner-blocks.js +3 -3
  278. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  279. package/build-module/template-part/index.js +2 -1
  280. package/build-module/template-part/index.js.map +1 -1
  281. package/build-module/term-description/index.js +0 -1
  282. package/build-module/term-description/index.js.map +1 -1
  283. package/build-style/editor-rtl.css +50 -0
  284. package/build-style/editor.css +50 -0
  285. package/build-style/file/style-rtl.css +0 -5
  286. package/build-style/file/style.css +0 -5
  287. package/build-style/form-input/editor-rtl.css +106 -0
  288. package/build-style/form-input/editor.css +106 -0
  289. package/build-style/form-input/style-rtl.css +135 -0
  290. package/build-style/form-input/style.css +135 -0
  291. package/build-style/form-submission-notification/editor-rtl.css +118 -0
  292. package/build-style/form-submission-notification/editor.css +118 -0
  293. package/build-style/form-submit-button/style-rtl.css +91 -0
  294. package/build-style/form-submit-button/style.css +91 -0
  295. package/build-style/image/style-rtl.css +39 -5
  296. package/build-style/image/style.css +39 -5
  297. package/build-style/navigation/style-rtl.css +5 -0
  298. package/build-style/navigation/style.css +5 -0
  299. package/build-style/query/style-rtl.css +0 -10
  300. package/build-style/query/style.css +0 -10
  301. package/build-style/style-rtl.css +92 -10
  302. package/build-style/style.css +92 -10
  303. package/package.json +32 -32
  304. package/src/avatar/block.json +5 -1
  305. package/src/block/block.json +2 -1
  306. package/src/block/edit-title.native.js +16 -13
  307. package/src/calendar/index.php +2 -6
  308. package/src/code/edit.native.js +15 -1
  309. package/src/column/edit.js +3 -8
  310. package/src/column/edit.native.js +3 -8
  311. package/src/columns/edit.native.js +3 -8
  312. package/src/comment-author-avatar/index.php +1 -1
  313. package/src/cover/block.json +0 -3
  314. package/src/cover/controls.native.js +3 -8
  315. package/src/cover/deprecated.js +151 -1
  316. package/src/cover/edit/index.js +15 -5
  317. package/src/cover/edit/inspector-controls.js +22 -33
  318. package/src/cover/save.js +2 -1
  319. package/src/cover/shared.js +1 -1
  320. package/src/editor.scss +2 -0
  321. package/src/file/index.php +2 -1
  322. package/src/file/style.scss +0 -6
  323. package/src/file/view.js +2 -2
  324. package/src/footnotes/block.json +1 -0
  325. package/src/form/block.json +60 -0
  326. package/src/form/edit.js +179 -0
  327. package/src/form/index.js +20 -0
  328. package/src/form/index.php +214 -0
  329. package/src/form/init.js +6 -0
  330. package/src/form/save.js +20 -0
  331. package/src/form/utils.js +39 -0
  332. package/src/form/variations.js +139 -0
  333. package/src/form/view.js +41 -0
  334. package/src/form-input/block.json +73 -0
  335. package/src/form-input/edit.js +151 -0
  336. package/src/form-input/editor.scss +24 -0
  337. package/src/form-input/index.js +20 -0
  338. package/src/form-input/index.php +45 -0
  339. package/src/form-input/init.js +6 -0
  340. package/src/form-input/save.js +83 -0
  341. package/src/form-input/style.scss +61 -0
  342. package/src/form-input/variations.js +82 -0
  343. package/src/form-submission-notification/block.json +19 -0
  344. package/src/form-submission-notification/edit.js +63 -0
  345. package/src/form-submission-notification/editor.scss +45 -0
  346. package/src/form-submission-notification/index.js +26 -0
  347. package/src/form-submission-notification/index.php +48 -0
  348. package/src/form-submission-notification/init.js +6 -0
  349. package/src/form-submission-notification/save.js +28 -0
  350. package/src/form-submission-notification/variations.js +59 -0
  351. package/src/form-submit-button/block.json +14 -0
  352. package/src/form-submit-button/edit.js +33 -0
  353. package/src/form-submit-button/index.js +18 -0
  354. package/src/form-submit-button/init.js +6 -0
  355. package/src/form-submit-button/save.js +14 -0
  356. package/src/form-submit-button/style.scss +3 -0
  357. package/src/freeform/test/__snapshots__/index.native.js.snap +7 -0
  358. package/src/freeform/test/index.native.js +57 -0
  359. package/src/group/block.json +0 -1
  360. package/src/group/edit.js +2 -7
  361. package/src/heading/index.js +4 -2
  362. package/src/html/preview.js +9 -4
  363. package/src/image/image.js +27 -6
  364. package/src/image/index.php +128 -83
  365. package/src/image/style.scss +49 -5
  366. package/src/image/view.js +93 -51
  367. package/src/index.js +10 -0
  368. package/src/latest-posts/edit.js +11 -2
  369. package/src/latest-posts/index.php +17 -8
  370. package/src/list-item/hooks/use-merge.js +20 -23
  371. package/src/lock-unlock.js +1 -1
  372. package/src/missing/edit.native.js +56 -117
  373. package/src/missing/style.native.scss +0 -67
  374. package/src/missing/test/edit-integration.native.js +135 -49
  375. package/src/missing/test/edit.native.js +0 -41
  376. package/src/navigation/block.json +2 -1
  377. package/src/navigation/edit/index.js +0 -1
  378. package/src/navigation/index.php +28 -8
  379. package/src/navigation/style.scss +6 -1
  380. package/src/navigation/view.js +25 -6
  381. package/src/page-list-item/edit.js +2 -0
  382. package/src/paragraph/edit.js +2 -2
  383. package/src/paragraph/index.js +10 -0
  384. package/src/pattern/block.json +2 -1
  385. package/src/pattern/index.php +0 -3
  386. package/src/post-featured-image/dimension-controls.js +3 -3
  387. package/src/post-navigation-link/index.php +2 -1
  388. package/src/preformatted/test/edit.native.js +38 -0
  389. package/src/query/edit/enhanced-pagination-modal.js +37 -21
  390. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +18 -22
  391. package/src/query/index.php +100 -10
  392. package/src/query/style.scss +0 -11
  393. package/src/query/utils.js +29 -8
  394. package/src/query/view.js +11 -2
  395. package/src/query-pagination-next/index.php +1 -1
  396. package/src/query-pagination-previous/index.php +1 -1
  397. package/src/search/edit.js +5 -3
  398. package/src/search/index.php +0 -4
  399. package/src/social-link/edit.native.js +12 -26
  400. package/src/social-link/editor.native.scss +0 -9
  401. package/src/social-link/index.php +2 -2
  402. package/src/spacer/controls.js +9 -12
  403. package/src/spacer/controls.native.js +3 -8
  404. package/src/spacer/edit.js +2 -2
  405. package/src/spacer/edit.native.js +6 -5
  406. package/src/style.scss +1 -0
  407. package/src/tag-cloud/edit.js +3 -7
  408. package/src/template-part/block.json +2 -1
  409. package/src/template-part/edit/inner-blocks.js +3 -3
  410. package/src/template-part/index.php +4 -7
  411. package/src/term-description/block.json +0 -1
  412. package/src/verse/test/edit.native.js +37 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_blob","require","_components","_compose","_data","_blockEditor","_element","_i18n","_url","_blocks","_icons","_notices","_coreData","_lockUnlock","_util","_useClientWidth","_interopRequireDefault","_edit","_constants","_utils","DimensionsTool","ResolutionTool","unlock","blockEditorPrivateApis","scaleOptions","value","label","_x","help","__","Image","temporaryURL","attributes","setAttributes","isSelected","insertBlocksAfter","onReplace","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","blockEditingMode","url","alt","caption","align","id","href","rel","linkClass","linkDestination","title","width","height","aspectRatio","scale","linkTarget","sizeSlug","lightbox","numericWidth","parseInt","undefined","numericHeight","imageRef","useRef","prevCaption","usePrevious","showCaption","setShowCaption","useState","allowResize","getBlock","useSelect","blockEditorStore","image","multiImageSelection","select","getMedia","coreStore","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","useDispatch","createErrorNotice","createSuccessNotice","noticesStore","isLargeViewport","useViewportMatch","isWideAligned","includes","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","useClientWidth","hasNonContentControls","isResizable","imageSizeOptions","filter","slug","media_details","sizes","source_url","map","name","canUploadMedia","useEffect","isExternalImage","window","fetch","then","response","blob","catch","captionRef","useCallback","node","focus","naturalWidth","naturalHeight","useMemo","current","complete","onResizeStart","onResizeStop","onImageError","embedBlock","createUpgradedEmbedBlock","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","isBlobURL","type","allowedTypes","ALLOWED_MEDIA_TYPES","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","canEditImage","allowCrop","switchToCover","switchToBlockType","dimensionsUnitsOptions","useCustomUnits","availableUnits","lightboxSetting","useSetting","showLightboxToggle","allowEditing","lightboxChecked","enabled","dimensionsControl","_react","createElement","onChange","newWidth","newHeight","newScale","newAspectRatio","defaultScale","defaultAspectRatio","unitsOptions","resetAll","sizeControls","InspectorControls","__experimentalToolsPanel","controls","Fragment","BlockControls","group","BlockAlignmentControl","ToolbarButton","onClick","icon","captionIcon","isPressed","__experimentalImageURLInputUI","onChangeUrl","mediaUrl","mediaLink","link","crop","overlayText","MediaReplaceFlow","mediaId","mediaURL","accept","onSelect","ToolbarGroup","upload","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","TextareaControl","ExternalLink","__nextHasNoMarginBottom","options","ToggleControl","checked","newValue","TextControl","filename","getFilename","defaultedAlt","sprintf","borderProps","useBorderProps","isRounded","className","src","onLoad","event","target","ref","style","objectFit","Spinner","fallbackClientWidth","__experimentalImageEditor","onSaveImage","imageAttributes","onFinishEditing","numericRatio","evalAspectRatio","customRatio","naturalRatio","ratio","currentWidth","currentHeight","minWidth","MIN_SIZE","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","isRTL","ResizableBox","display","size","showHandle","maxHeight","lockAspectRatio","enable","top","right","bottom","left","direction","elt","offsetWidth","String","resizeRatio","RichText","isEmpty","identifier","__experimentalGetElementClassName","tagName","placeholder","inlineToolbar","__unstableOnSplitAtEnd","createBlock","getDefaultBlockName"],"sources":["@wordpress/block-library/src/image/image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tToggleControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSetting,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalGetElementClassName,\n\t__experimentalUseBorderProps as useBorderProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tcrop,\n\toverlayText,\n\tupload,\n\tcaption as captionIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\nimport { evalAspectRatio } from './utils';\n\nconst { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t} = attributes;\n\n\t// The only supported unit is px, so we can parseInt to strip the px here.\n\tconst numericWidth = width ? parseInt( width, 10 ) : undefined;\n\tconst numericHeight = height ? parseInt( height, 10 ) : undefined;\n\n\tconst imageRef = useRef();\n\tconst prevCaption = usePrevious( caption );\n\tconst [ showCaption, setShowCaption ] = useState( !! caption );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tcanInsertBlockType,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst settings = getSettings();\n\n\t\t\t\treturn {\n\t\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\tconst canUploadMedia = !! mediaUpload;\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSelected ||\n\t\t\t! canUploadMedia\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) return;\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob, canUploadMedia ] );\n\n\t// We need to show the caption when changes come from\n\t// history navigation(undo/redo).\n\tuseEffect( () => {\n\t\tif ( caption && ! prevCaption ) {\n\t\t\tsetShowCaption( true );\n\t\t}\n\t}, [ caption, prevCaption ] );\n\n\t// Focus the caption when we click to add one.\n\tconst captionRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( node && ! caption ) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t},\n\t\t[ caption ]\n\t);\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\tscale: undefined,\n\t\t\t }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t\tif ( ! caption ) {\n\t\t\t\tsetShowCaption( false );\n\t\t\t}\n\t\t}\n\t}, [ isSelected, caption ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst lightboxSetting = useSetting( 'lightbox' );\n\n\tconst showLightboxToggle =\n\t\t!! lightbox || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst dimensionsControl = (\n\t\t<DimensionsTool\n\t\t\tvalue={ { width, height, scale, aspectRatio } }\n\t\t\tonChange={ ( {\n\t\t\t\twidth: newWidth,\n\t\t\t\theight: newHeight,\n\t\t\t\tscale: newScale,\n\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t} ) => {\n\t\t\t\t// Rebuilding the object forces setting `undefined`\n\t\t\t\t// for values that are removed since setAttributes\n\t\t\t\t// doesn't do anything with keys that aren't set.\n\t\t\t\tsetAttributes( {\n\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdefaultScale=\"cover\"\n\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\tscaleOptions={ scaleOptions }\n\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t/>\n\t);\n\n\tconst resetAll = () => {\n\t\tsetAttributes( {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tscale: undefined,\n\t\t\taspectRatio: undefined,\n\t\t\tlightbox: undefined,\n\t\t} );\n\t};\n\n\tconst sizeControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetShowCaption( ! showCaption );\n\t\t\t\t\t\t\tif ( showCaption && caption ) {\n\t\t\t\t\t\t\t\tsetAttributes( { caption: undefined } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ captionIcon }\n\t\t\t\t\t\tisPressed={ showCaption }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowCaption\n\t\t\t\t\t\t\t\t? __( 'Remove caption' )\n\t\t\t\t\t\t\t\t: __( 'Add caption' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! multiImageSelection && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t\thasValue={ () => alt !== '' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\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\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showLightboxToggle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! lightbox }\n\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { lightbox: undefined } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlightbox: { enabled: newValue },\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/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\theight:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\t// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0\n\t// So we try using the imageRef width first and fallback to clientWidth.\n\tconst fallbackClientWidth = imageRef.current?.width || clientWidth;\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ id }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ numericWidth }\n\t\t\t\theight={ numericHeight }\n\t\t\t\tclientWidth={ fallbackClientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t}\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable ) {\n\t\timg = <div style={ { width, height, aspectRatio } }>{ img }</div>;\n\t} else {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = numericWidth / numericHeight;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst currentWidth =\n\t\t\t! numericWidth && numericHeight\n\t\t\t\t? numericHeight * ratio\n\t\t\t\t: numericWidth;\n\t\tconst currentHeight =\n\t\t\t! numericHeight && numericWidth\n\t\t\t\t? numericWidth / ratio\n\t\t\t\t: numericHeight;\n\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! width && ! height && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t} }\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth ?? 'auto',\n\t\t\t\t\theight: currentHeight ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn sizeControls;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ showCaption &&\n\t\t\t\t( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\t\tclassName={ __experimentalGetElementClassName(\n\t\t\t\t\t\t\t'caption'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tref={ captionRef }\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAaA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAcA,IAAAK,QAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAMA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AAKA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,KAAA,GAAAb,OAAA;AACA,IAAAc,eAAA,GAAAC,sBAAA,CAAAf,OAAA;AACA,IAAAgB,KAAA,GAAAhB,OAAA;AAKA,IAAAiB,UAAA,GAAAjB,OAAA;AACA,IAAAkB,MAAA,GAAAlB,OAAA;AApEA;AACA;AACA;;AAsDA;AACA;AACA;;AAMA;AACA;AACA;;AAIA,MAAM;EAAEmB,cAAc;EAAEC;AAAe,CAAC,GAAG,IAAAC,kBAAM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YAAY;EACpB;EAEA,OACC,IAAAX,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAe,QAAA,QAGG,CAAExK,YAAY,IAAIuK,QAAQ,EAC1BtC,GAAG,EACH3F,WAAW,KACV,CAAEwN,qBAAQ,CAACC,OAAO,CAAEhP,OAAQ,CAAC,IAAIZ,UAAU,CAAE,IAC9C,IAAAsJ,MAAA,CAAAC,aAAA,EAACpL,YAAA,CAAAwR,QAAQ;IACRE,UAAU,EAAC,SAAS;IACpB9C,SAAS,EAAG,IAAA+C,8CAAiC,EAC5C,SACD,CAAG;IACH1C,GAAG,EAAG/G,UAAY;IAClB0J,OAAO,EAAC,YAAY;IACpB,cAAa,IAAApQ,QAAE,EAAE,oBAAqB,CAAG;IACzCqQ,WAAW,EAAG,IAAArQ,QAAE,EAAE,aAAc,CAAG;IACnCJ,KAAK,EAAGqB,OAAS;IACjB4I,QAAQ,EAAKjK,KAAK,IACjBQ,aAAa,CAAE;MAAEa,OAAO,EAAErB;IAAM,CAAE,CAClC;IACD0Q,aAAa;IACbC,sBAAsB,EAAGA,CAAA,KACxBjQ,iBAAiB,CAChB,IAAAkQ,mBAAW,EAAE,IAAAC,2BAAmB,EAAC,CAAE,CACpC;EACA,CACD,CAEF,CAAC;AAEL"}
1
+ {"version":3,"names":["_blob","require","_components","_compose","_data","_blockEditor","_element","_i18n","_url","_blocks","_icons","_notices","_coreData","_lockUnlock","_util","_useClientWidth","_interopRequireDefault","_edit","_constants","_utils","DimensionsTool","ResolutionTool","unlock","blockEditorPrivateApis","scaleOptions","value","label","_x","help","__","disabledClickProps","onClick","event","preventDefault","Image","temporaryURL","attributes","setAttributes","isSelected","insertBlocksAfter","onReplace","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","blockEditingMode","url","alt","caption","align","id","href","rel","linkClass","linkDestination","title","width","height","aspectRatio","scale","linkTarget","sizeSlug","lightbox","numericWidth","parseInt","undefined","numericHeight","imageRef","useRef","prevCaption","usePrevious","showCaption","setShowCaption","useState","allowResize","getBlock","useSelect","blockEditorStore","image","multiImageSelection","select","getMedia","coreStore","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","useDispatch","createErrorNotice","createSuccessNotice","noticesStore","isLargeViewport","useViewportMatch","isWideAligned","includes","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","useClientWidth","hasNonContentControls","isResizable","imageSizeOptions","filter","slug","media_details","sizes","source_url","map","name","canUploadMedia","useEffect","isExternalImage","window","fetch","then","response","blob","catch","captionRef","useCallback","node","focus","naturalWidth","naturalHeight","useMemo","current","complete","onResizeStart","onResizeStop","onImageError","embedBlock","createUpgradedEmbedBlock","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","isBlobURL","type","allowedTypes","ALLOWED_MEDIA_TYPES","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","canEditImage","allowCrop","switchToCover","switchToBlockType","dimensionsUnitsOptions","useCustomUnits","availableUnits","lightboxSetting","useSettings","showLightboxToggle","allowEditing","lightboxChecked","enabled","lightboxToggleDisabled","dimensionsControl","_react","createElement","onChange","newWidth","newHeight","newScale","newAspectRatio","defaultScale","defaultAspectRatio","unitsOptions","resetAll","sizeControls","InspectorControls","__experimentalToolsPanel","controls","Fragment","BlockControls","group","BlockAlignmentControl","ToolbarButton","icon","captionIcon","isPressed","__experimentalImageURLInputUI","onChangeUrl","mediaUrl","mediaLink","link","crop","overlayText","MediaReplaceFlow","mediaId","mediaURL","accept","onSelect","ToolbarGroup","upload","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","TextareaControl","ExternalLink","__nextHasNoMarginBottom","options","ToggleControl","checked","newValue","disabled","TextControl","filename","getFilename","defaultedAlt","sprintf","borderProps","useBorderProps","isRounded","className","src","onLoad","target","ref","style","objectFit","Spinner","fallbackClientWidth","__experimentalImageEditor","onSaveImage","imageAttributes","onFinishEditing","numericRatio","evalAspectRatio","customRatio","naturalRatio","ratio","currentWidth","currentHeight","minWidth","MIN_SIZE","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","isRTL","ResizableBox","display","size","showHandle","maxHeight","lockAspectRatio","enable","top","right","bottom","left","direction","elt","offsetWidth","String","resizeRatio","RichText","isEmpty","identifier","__experimentalGetElementClassName","tagName","placeholder","inlineToolbar","__unstableOnSplitAtEnd","createBlock","getDefaultBlockName"],"sources":["@wordpress/block-library/src/image/image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tToggleControl,\n\tTextControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tuseSettings,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalGetElementClassName,\n\t__experimentalUseBorderProps as useBorderProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tcrop,\n\toverlayText,\n\tupload,\n\tcaption as captionIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\nimport { evalAspectRatio } from './utils';\n\nconst { DimensionsTool, ResolutionTool } = unlock( blockEditorPrivateApis );\n\nconst scaleOptions = [\n\t{\n\t\tvalue: 'cover',\n\t\tlabel: _x( 'Cover', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image covers the space evenly.' ),\n\t},\n\t{\n\t\tvalue: 'contain',\n\t\tlabel: _x( 'Contain', 'Scale option for dimensions control' ),\n\t\thelp: __( 'Image is contained without distortion.' ),\n\t},\n];\n\nconst disabledClickProps = {\n\tonClick: ( event ) => event.preventDefault(),\n\t'aria-disabled': true,\n};\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tblockEditingMode,\n} ) {\n\tconst {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\taspectRatio,\n\t\tscale,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t\tlightbox,\n\t} = attributes;\n\n\t// The only supported unit is px, so we can parseInt to strip the px here.\n\tconst numericWidth = width ? parseInt( width, 10 ) : undefined;\n\tconst numericHeight = height ? parseInt( height, 10 ) : undefined;\n\n\tconst imageRef = useRef();\n\tconst prevCaption = usePrevious( caption );\n\tconst [ showCaption, setShowCaption ] = useState( !! caption );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tcanInsertBlockType,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst settings = getSettings();\n\n\t\t\t\treturn {\n\t\t\t\t\timageEditing: settings.imageEditing,\n\t\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\t\tmaxWidth: settings.maxWidth,\n\t\t\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\trootClientId\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = [ 'wide', 'full' ].includes( align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst hasNonContentControls = blockEditingMode === 'default';\n\tconst isResizable =\n\t\tallowResize &&\n\t\thasNonContentControls &&\n\t\t! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = imageSizes\n\t\t.filter(\n\t\t\t( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url\n\t\t)\n\t\t.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\tconst canUploadMedia = !! mediaUpload;\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! isExternalImage( id, url ) ||\n\t\t\t! isSelected ||\n\t\t\t! canUploadMedia\n\t\t) {\n\t\t\tsetExternalBlob();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( externalBlob ) return;\n\n\t\twindow\n\t\t\t// Avoid cache, which seems to help avoid CORS problems.\n\t\t\t.fetch( url.includes( '?' ) ? url : url + '?' )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob, canUploadMedia ] );\n\n\t// We need to show the caption when changes come from\n\t// history navigation(undo/redo).\n\tuseEffect( () => {\n\t\tif ( caption && ! prevCaption ) {\n\t\t\tsetShowCaption( true );\n\t\t}\n\t}, [ caption, prevCaption ] );\n\n\t// Focus the caption when we click to add one.\n\tconst captionRef = useCallback(\n\t\t( node ) => {\n\t\t\tif ( node && ! caption ) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t},\n\t\t[ caption ]\n\t);\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// width and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\n\t\tif ( undefined !== embedBlock ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = image?.media_details?.sizes?.[ newSizeSlug ]?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t\theight: undefined,\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t\tscale: undefined,\n\t\t\t }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t\tif ( ! caption ) {\n\t\t\t\tsetShowCaption( false );\n\t\t\t}\n\t\t}\n\t}, [ isSelected, caption ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\t// TODO: Can allow more units after figuring out how they should interact\n\t// with the ResizableBox and ImageEditor components. Calculations later on\n\t// for those components are currently assuming px units.\n\tconst dimensionsUnitsOptions = useCustomUnits( {\n\t\tavailableUnits: [ 'px' ],\n\t} );\n\n\tconst [ lightboxSetting ] = useSettings( 'lightbox' );\n\n\tconst showLightboxToggle =\n\t\t!! lightbox || lightboxSetting?.allowEditing === true;\n\n\tconst lightboxChecked =\n\t\t!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );\n\n\tconst lightboxToggleDisabled = linkDestination !== 'none';\n\n\tconst dimensionsControl = (\n\t\t<DimensionsTool\n\t\t\tvalue={ { width, height, scale, aspectRatio } }\n\t\t\tonChange={ ( {\n\t\t\t\twidth: newWidth,\n\t\t\t\theight: newHeight,\n\t\t\t\tscale: newScale,\n\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t} ) => {\n\t\t\t\t// Rebuilding the object forces setting `undefined`\n\t\t\t\t// for values that are removed since setAttributes\n\t\t\t\t// doesn't do anything with keys that aren't set.\n\t\t\t\tsetAttributes( {\n\t\t\t\t\t// CSS includes `height: auto`, but we need\n\t\t\t\t\t// `width: auto` to fix the aspect ratio when\n\t\t\t\t\t// only height is set due to the width and\n\t\t\t\t\t// height attributes set via the server.\n\t\t\t\t\twidth: ! newWidth && newHeight ? 'auto' : newWidth,\n\t\t\t\t\theight: newHeight,\n\t\t\t\t\tscale: newScale,\n\t\t\t\t\taspectRatio: newAspectRatio,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tdefaultScale=\"cover\"\n\t\t\tdefaultAspectRatio=\"auto\"\n\t\t\tscaleOptions={ scaleOptions }\n\t\t\tunitsOptions={ dimensionsUnitsOptions }\n\t\t/>\n\t);\n\n\tconst resetAll = () => {\n\t\tsetAttributes( {\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tscale: undefined,\n\t\t\taspectRatio: undefined,\n\t\t\tlightbox: undefined,\n\t\t} );\n\t};\n\n\tconst sizeControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasNonContentControls && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetShowCaption( ! showCaption );\n\t\t\t\t\t\t\tif ( showCaption && caption ) {\n\t\t\t\t\t\t\t\tsetAttributes( { caption: undefined } );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ captionIcon }\n\t\t\t\t\t\tisPressed={ showCaption }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowCaption\n\t\t\t\t\t\t\t\t? __( 'Remove caption' )\n\t\t\t\t\t\t\t\t: __( 'Add caption' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ ! multiImageSelection && externalBlob && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel label={ __( 'Settings' ) } resetAll={ resetAll }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t\thasValue={ () => alt !== '' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { alt: undefined } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\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\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isResizable && dimensionsControl }\n\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showLightboxToggle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! lightbox }\n\t\t\t\t\t\t\tlabel={ __( 'Expand on click' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( { lightbox: undefined } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlightbox: { enabled: newValue },\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\tdisabled={ lightboxToggleDisabled }\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlightboxToggleDisabled\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'“Expand on click” scales the image up, and can’t be combined with a link.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\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/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst isRounded = attributes.className?.includes( 'is-style-rounded' );\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t\tclassName={ borderProps.className }\n\t\t\t\tstyle={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\theight:\n\t\t\t\t\t\t( width && height ) || aspectRatio ? '100%' : undefined,\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\t...borderProps.style,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\t// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0\n\t// So we try using the imageRef width first and fallback to clientWidth.\n\tconst fallbackClientWidth = imageRef.current?.width || clientWidth;\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\tid={ id }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ numericWidth }\n\t\t\t\theight={ numericHeight }\n\t\t\t\tclientWidth={ fallbackClientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t\t}\n\t\t\t\tonFinishEditing={ () => {\n\t\t\t\t\tsetIsEditingImage( false );\n\t\t\t\t} }\n\t\t\t\tborderProps={ isRounded ? undefined : borderProps }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable ) {\n\t\timg = <div style={ { width, height, aspectRatio } }>{ img }</div>;\n\t} else {\n\t\tconst numericRatio = aspectRatio && evalAspectRatio( aspectRatio );\n\t\tconst customRatio = numericWidth / numericHeight;\n\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\tconst ratio = numericRatio || customRatio || naturalRatio || 1;\n\t\tconst currentWidth =\n\t\t\t! numericWidth && numericHeight\n\t\t\t\t? numericHeight * ratio\n\t\t\t\t: numericWidth;\n\t\tconst currentHeight =\n\t\t\t! numericHeight && numericWidth\n\t\t\t\t? numericWidth / ratio\n\t\t\t\t: numericHeight;\n\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'block',\n\t\t\t\t\tobjectFit: scale,\n\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t! width && ! height && aspectRatio\n\t\t\t\t\t\t\t? aspectRatio\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t} }\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: currentWidth ?? 'auto',\n\t\t\t\t\theight: currentHeight ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio={ ratio }\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\t// Since the aspect ratio is locked when resizing, we can\n\t\t\t\t\t// use the width of the resized element to calculate the\n\t\t\t\t\t// height in CSS to prevent stretching when the max-width\n\t\t\t\t\t// is reached.\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: `${ elt.offsetWidth }px`,\n\t\t\t\t\t\theight: 'auto',\n\t\t\t\t\t\taspectRatio:\n\t\t\t\t\t\t\tratio === naturalRatio\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: String( ratio ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tresizeRatio={ align === 'center' ? 2 : 1 }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\tif ( ! url && ! temporaryURL ) {\n\t\treturn sizeControls;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ /* If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles */ }\n\t\t\t{ !! href ? (\n\t\t\t\t<a href={ href } { ...disabledClickProps }>\n\t\t\t\t\t{ img }\n\t\t\t\t</a>\n\t\t\t) : (\n\t\t\t\timg\n\t\t\t) }\n\t\t\t{ showCaption &&\n\t\t\t\t( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\t\tclassName={ __experimentalGetElementClassName(\n\t\t\t\t\t\t\t'caption'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tref={ captionRef }\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinlineToolbar\n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C9B,OAAOqK,YAAY;EACpB;EAEA,OACC,IAAAX,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAe,QAAA,QAGG,CAAEzK,YAAY,IAAIwK,QAAQ,EAE1B,CAAC,CAAEtJ,IAAI,GACR,IAAAwI,MAAA,CAAAC,aAAA;IAAGzI,IAAI,EAAGA,IAAM;IAAA,GAAMvB;EAAkB,GACrCsI,GACA,CAAC,GAEJA,GACA,EACC3F,WAAW,KACV,CAAEwN,qBAAQ,CAACC,OAAO,CAAEhP,OAAQ,CAAC,IAAIZ,UAAU,CAAE,IAC9C,IAAAuJ,MAAA,CAAAC,aAAA,EAACzL,YAAA,CAAA4R,QAAQ;IACRE,UAAU,EAAC,SAAS;IACpB7C,SAAS,EAAG,IAAA8C,8CAAiC,EAC5C,SACD,CAAG;IACH1C,GAAG,EAAG/G,UAAY;IAClB0J,OAAO,EAAC,YAAY;IACpB,cAAa,IAAAxQ,QAAE,EAAE,oBAAqB,CAAG;IACzCyQ,WAAW,EAAG,IAAAzQ,QAAE,EAAE,aAAc,CAAG;IACnCJ,KAAK,EAAGyB,OAAS;IACjB6I,QAAQ,EAAKtK,KAAK,IACjBY,aAAa,CAAE;MAAEa,OAAO,EAAEzB;IAAM,CAAE,CAClC;IACD8Q,aAAa;IACbC,sBAAsB,EAAGA,CAAA,KACxBjQ,iBAAiB,CAChB,IAAAkQ,mBAAW,EAAE,IAAAC,2BAAmB,EAAC,CAAE,CACpC;EACA,CACD,CAEF,CAAC;AAEL"}
@@ -90,8 +90,9 @@ function handleScroll(context) {
90
90
  context.core.image.initialized = true;
91
91
  context.core.image.lastFocusedElement = window.document.activeElement;
92
92
  context.core.image.scrollDelta = 0;
93
+ context.core.image.pointerType = event.pointerType;
93
94
  context.core.image.lightboxEnabled = true;
94
- setStyles(context, event);
95
+ setStyles(context, context.core.image.imageRef);
95
96
  context.core.image.scrollTopReset = window.pageYOffset || document.documentElement.scrollTop;
96
97
 
97
98
  // In most cases, this value will be 0, but this is included
@@ -124,11 +125,14 @@ function handleScroll(context) {
124
125
  // may scroll too soon and cause the animation to look sloppy.
125
126
  setTimeout(function () {
126
127
  window.removeEventListener('scroll', scrollCallback);
128
+ // If we don't delay before changing the focus,
129
+ // the focus ring will appear on Firefox before
130
+ // the image has finished animating, which looks broken.
131
+ context.core.image.lightboxTriggerRef.focus({
132
+ preventScroll: true
133
+ });
127
134
  }, 450);
128
135
  context.core.image.lightboxEnabled = false;
129
- context.core.image.lastFocusedElement.focus({
130
- preventScroll: true
131
- });
132
136
  }
133
137
  },
134
138
  handleKeydown: ({
@@ -155,8 +159,9 @@ function handleScroll(context) {
155
159
  }
156
160
  }
157
161
  },
162
+ // This is fired just by lazily loaded
163
+ // images on the page, not all images.
158
164
  handleLoad: ({
159
- state,
160
165
  context,
161
166
  effects,
162
167
  ref
@@ -164,7 +169,6 @@ function handleScroll(context) {
164
169
  context.core.image.imageLoaded = true;
165
170
  context.core.image.imageCurrentSrc = ref.currentSrc;
166
171
  effects.core.image.setButtonStyles({
167
- state,
168
172
  context,
169
173
  ref
170
174
  });
@@ -202,7 +206,17 @@ function handleScroll(context) {
202
206
  roleAttribute: ({
203
207
  context
204
208
  }) => {
205
- return context.core.image.lightboxEnabled ? 'dialog' : '';
209
+ return context.core.image.lightboxEnabled ? 'dialog' : null;
210
+ },
211
+ ariaModal: ({
212
+ context
213
+ }) => {
214
+ return context.core.image.lightboxEnabled ? 'true' : null;
215
+ },
216
+ dialogLabel: ({
217
+ context
218
+ }) => {
219
+ return context.core.image.lightboxEnabled ? context.core.image.dialogLabel : null;
206
220
  },
207
221
  lightboxObjectFit: ({
208
222
  context
@@ -214,7 +228,7 @@ function handleScroll(context) {
214
228
  enlargedImgSrc: ({
215
229
  context
216
230
  }) => {
217
- return context.core.image.initialized ? context.core.image.imageUploadedSrc : '';
231
+ return context.core.image.initialized ? context.core.image.imageUploadedSrc : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
218
232
  }
219
233
  }
220
234
  }
@@ -222,10 +236,12 @@ function handleScroll(context) {
222
236
  effects: {
223
237
  core: {
224
238
  image: {
225
- setCurrentSrc: ({
239
+ initOriginImage: ({
226
240
  context,
227
241
  ref
228
242
  }) => {
243
+ context.core.image.imageRef = ref;
244
+ context.core.image.lightboxTriggerRef = ref.parentElement.querySelector('.lightbox-trigger');
229
245
  if (ref.complete) {
230
246
  context.core.image.imageLoaded = true;
231
247
  context.core.image.imageCurrentSrc = ref.currentSrc;
@@ -235,17 +251,16 @@ function handleScroll(context) {
235
251
  context,
236
252
  ref
237
253
  }) => {
238
- context.core.image.figureRef = ref.querySelector('figure');
239
- context.core.image.imageRef = ref.querySelector('img');
240
254
  if (context.core.image.lightboxEnabled) {
241
255
  const focusableElements = ref.querySelectorAll(focusableSelectors);
242
256
  context.core.image.firstFocusableElement = focusableElements[0];
243
257
  context.core.image.lastFocusableElement = focusableElements[focusableElements.length - 1];
244
- ref.querySelector('.close-button').focus();
258
+
259
+ // Move focus to the dialog when opening it.
260
+ ref.focus();
245
261
  }
246
262
  },
247
263
  setButtonStyles: ({
248
- state,
249
264
  context,
250
265
  ref
251
266
  }) => {
@@ -257,43 +272,60 @@ function handleScroll(context) {
257
272
  } = ref;
258
273
 
259
274
  // If the image isn't loaded yet, we can't
260
- // calculate how big the button should be.
275
+ // calculate where the button should be.
261
276
  if (naturalWidth === 0 || naturalHeight === 0) {
262
277
  return;
263
278
  }
279
+ const figure = ref.parentElement;
280
+ const figureWidth = ref.parentElement.clientWidth;
264
281
 
265
- // Subscribe to the window dimensions so we can
266
- // recalculate the styles if the window is resized.
267
- if ((state.core.image.windowWidth || state.core.image.windowHeight) && context.core.image.scaleAttr === 'contain') {
268
- // In the case of an image with object-fit: contain, the
269
- // size of the img element can be larger than the image itself,
270
- // so we need to calculate the size of the button to match.
282
+ // We need special handling for the height because
283
+ // a caption will cause the figure to be taller than
284
+ // the image, which means we need to account for that
285
+ // when calculating the placement of the button in the
286
+ // top right corner of the image.
287
+ let figureHeight = ref.parentElement.clientHeight;
288
+ const caption = figure.querySelector('figcaption');
289
+ if (caption) {
290
+ const captionComputedStyle = window.getComputedStyle(caption);
291
+ figureHeight = figureHeight - caption.offsetHeight - parseFloat(captionComputedStyle.marginTop) - parseFloat(captionComputedStyle.marginBottom);
292
+ }
293
+ const buttonOffsetTop = figureHeight - offsetHeight;
294
+ const buttonOffsetRight = figureWidth - offsetWidth;
271
295
 
296
+ // In the case of an image with object-fit: contain, the
297
+ // size of the <img> element can be larger than the image itself,
298
+ // so we need to calculate where to place the button.
299
+ if (context.core.image.scaleAttr === 'contain') {
272
300
  // Natural ratio of the image.
273
301
  const naturalRatio = naturalWidth / naturalHeight;
274
302
  // Offset ratio of the image.
275
303
  const offsetRatio = offsetWidth / offsetHeight;
276
- if (naturalRatio > offsetRatio) {
304
+ if (naturalRatio >= offsetRatio) {
277
305
  // If it reaches the width first, keep
278
- // the width and recalculate the height.
279
- context.core.image.imageButtonWidth = offsetWidth;
280
- const buttonHeight = offsetWidth / naturalRatio;
281
- context.core.image.imageButtonHeight = buttonHeight;
282
- context.core.image.imageButtonTop = (offsetHeight - buttonHeight) / 2;
306
+ // the width and compute the height.
307
+ const referenceHeight = offsetWidth / naturalRatio;
308
+ context.core.image.imageButtonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 10;
309
+ context.core.image.imageButtonRight = buttonOffsetRight + 10;
283
310
  } else {
284
311
  // If it reaches the height first, keep
285
- // the height and recalculate the width.
286
- context.core.image.imageButtonHeight = offsetHeight;
287
- const buttonWidth = offsetHeight * naturalRatio;
288
- context.core.image.imageButtonWidth = buttonWidth;
289
- context.core.image.imageButtonLeft = (offsetWidth - buttonWidth) / 2;
312
+ // the height and compute the width.
313
+ const referenceWidth = offsetHeight * naturalRatio;
314
+ context.core.image.imageButtonTop = buttonOffsetTop + 10;
315
+ context.core.image.imageButtonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 10;
290
316
  }
291
317
  } else {
292
- // In all other cases, we can trust that the size of
293
- // the image is the right size for the button as well.
294
-
295
- context.core.image.imageButtonWidth = offsetWidth;
296
- context.core.image.imageButtonHeight = offsetHeight;
318
+ context.core.image.imageButtonTop = buttonOffsetTop + 10;
319
+ context.core.image.imageButtonRight = buttonOffsetRight + 10;
320
+ }
321
+ },
322
+ setStylesOnResize: ({
323
+ state,
324
+ context,
325
+ ref
326
+ }) => {
327
+ if (context.core.image.lightboxEnabled && (state.core.image.windowWidth || state.core.image.windowHeight)) {
328
+ setStyles(context, ref);
297
329
  }
298
330
  }
299
331
  }
@@ -317,7 +349,7 @@ function handleScroll(context) {
317
349
  * @param {Object} context - An Interactivity API context
318
350
  * @param {Object} event - A triggering event
319
351
  */
320
- function setStyles(context, event) {
352
+ function setStyles(context, ref) {
321
353
  // The reference img element lies adjacent
322
354
  // to the event target button in the DOM.
323
355
  let {
@@ -325,11 +357,11 @@ function setStyles(context, event) {
325
357
  naturalHeight,
326
358
  offsetWidth: originalWidth,
327
359
  offsetHeight: originalHeight
328
- } = event.target.nextElementSibling;
360
+ } = ref;
329
361
  let {
330
362
  x: screenPosX,
331
363
  y: screenPosY
332
- } = event.target.nextElementSibling.getBoundingClientRect();
364
+ } = ref.getBoundingClientRect();
333
365
 
334
366
  // Natural ratio of the image clicked to open the lightbox.
335
367
  const naturalRatio = naturalWidth / naturalHeight;