@wordpress/block-library 8.24.1 → 8.25.1-next.79a6196f.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (509) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/audio/edit.js +15 -62
  4. package/build/audio/edit.js.map +1 -1
  5. package/build/audio/edit.native.js +1 -1
  6. package/build/audio/edit.native.js.map +1 -1
  7. package/build/audio/index.js +2 -2
  8. package/build/block/edit.js +157 -19
  9. package/build/block/edit.js.map +1 -1
  10. package/build/block/index.js +3 -2
  11. package/build/block/index.js.map +1 -1
  12. package/build/block/v1/edit.js +116 -0
  13. package/build/block/v1/edit.js.map +1 -0
  14. package/build/block/{edit.native.js → v1/edit.native.js} +2 -2
  15. package/build/block/v1/edit.native.js.map +1 -0
  16. package/build/button/index.js +2 -2
  17. package/build/button/save.js +1 -1
  18. package/build/button/save.js.map +1 -1
  19. package/build/code/edit.native.js +13 -14
  20. package/build/code/edit.native.js.map +1 -1
  21. package/build/code/index.js +2 -2
  22. package/build/code/save.js +6 -2
  23. package/build/code/save.js.map +1 -1
  24. package/build/comments-title/deprecated.js +1 -1
  25. package/build/comments-title/index.js +1 -1
  26. package/build/cover/edit/inspector-controls.js +1 -1
  27. package/build/cover/edit/inspector-controls.js.map +1 -1
  28. package/build/cover/edit.native.js +1 -0
  29. package/build/cover/edit.native.js.map +1 -1
  30. package/build/details/index.js +2 -2
  31. package/build/embed/deprecated.js +2 -2
  32. package/build/embed/embed-preview.native.js +1 -1
  33. package/build/embed/embed-preview.native.js.map +1 -1
  34. package/build/embed/icons.js +1 -1
  35. package/build/embed/icons.js.map +1 -1
  36. package/build/embed/index.js +2 -2
  37. package/build/embed/transforms.js +2 -2
  38. package/build/embed/util.js +6 -6
  39. package/build/embed/util.js.map +1 -1
  40. package/build/file/edit.js +20 -28
  41. package/build/file/edit.js.map +1 -1
  42. package/build/file/edit.native.js +1 -1
  43. package/build/file/edit.native.js.map +1 -1
  44. package/build/file/index.js +4 -4
  45. package/build/file/save.js +4 -1
  46. package/build/file/save.js.map +1 -1
  47. package/build/form-input/deprecated.js +147 -0
  48. package/build/form-input/deprecated.js.map +1 -0
  49. package/build/form-input/edit.js +1 -1
  50. package/build/form-input/edit.js.map +1 -1
  51. package/build/form-input/index.js +4 -2
  52. package/build/form-input/index.js.map +1 -1
  53. package/build/form-input/save.js +7 -9
  54. package/build/form-input/save.js.map +1 -1
  55. package/build/gallery/edit.js +38 -58
  56. package/build/gallery/edit.js.map +1 -1
  57. package/build/gallery/gallery.js +19 -24
  58. package/build/gallery/gallery.js.map +1 -1
  59. package/build/gallery/gallery.native.js +1 -1
  60. package/build/gallery/gallery.native.js.map +1 -1
  61. package/build/gallery/index.js +8 -4
  62. package/build/gallery/index.js.map +1 -1
  63. package/build/gallery/transforms.js +4 -68
  64. package/build/gallery/transforms.js.map +1 -1
  65. package/build/gallery/v1/gallery.native.js +1 -1
  66. package/build/gallery/v1/gallery.native.js.map +1 -1
  67. package/build/group/edit.js +6 -1
  68. package/build/group/edit.js.map +1 -1
  69. package/build/group/index.js +5 -1
  70. package/build/group/index.js.map +1 -1
  71. package/build/heading/index.js +3 -6
  72. package/build/heading/index.js.map +1 -1
  73. package/build/image/deprecated.js +11 -0
  74. package/build/image/deprecated.js.map +1 -1
  75. package/build/image/edit.native.js +4 -1
  76. package/build/image/edit.native.js.map +1 -1
  77. package/build/image/image.js +35 -71
  78. package/build/image/image.js.map +1 -1
  79. package/build/image/index.js +2 -2
  80. package/build/image/save.js +3 -1
  81. package/build/image/save.js.map +1 -1
  82. package/build/image/view.js +7 -1
  83. package/build/image/view.js.map +1 -1
  84. package/build/list/edit.js +10 -15
  85. package/build/list/edit.js.map +1 -1
  86. package/build/list-item/edit.js +17 -2
  87. package/build/list-item/edit.js.map +1 -1
  88. package/build/list-item/hooks/use-enter.js +5 -3
  89. package/build/list-item/hooks/use-enter.js.map +1 -1
  90. package/build/list-item/hooks/use-enter.native.js +4 -3
  91. package/build/list-item/hooks/use-enter.native.js.map +1 -1
  92. package/build/list-item/hooks/use-indent-list-item.js +2 -3
  93. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  94. package/build/list-item/hooks/use-merge.js +1 -1
  95. package/build/list-item/hooks/use-merge.js.map +1 -1
  96. package/build/list-item/hooks/use-outdent-list-item.js +3 -17
  97. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  98. package/build/list-item/hooks/use-space.js +8 -4
  99. package/build/list-item/hooks/use-space.js.map +1 -1
  100. package/build/list-item/index.js +10 -3
  101. package/build/list-item/index.js.map +1 -1
  102. package/build/media-text/media-container.native.js +3 -0
  103. package/build/media-text/media-container.native.js.map +1 -1
  104. package/build/navigation/constants.js +3 -1
  105. package/build/navigation/constants.js.map +1 -1
  106. package/build/navigation/edit/index.js +5 -1
  107. package/build/navigation/edit/index.js.map +1 -1
  108. package/build/navigation/view.js +25 -1
  109. package/build/navigation/view.js.map +1 -1
  110. package/build/page-list/convert-to-links-modal.js +2 -2
  111. package/build/page-list/convert-to-links-modal.js.map +1 -1
  112. package/build/paragraph/edit.js +54 -32
  113. package/build/paragraph/edit.js.map +1 -1
  114. package/build/paragraph/index.js +2 -4
  115. package/build/paragraph/index.js.map +1 -1
  116. package/build/paragraph/transforms.js +2 -4
  117. package/build/paragraph/transforms.js.map +1 -1
  118. package/build/pattern/edit.js +24 -2
  119. package/build/pattern/edit.js.map +1 -1
  120. package/build/pattern/recursion-detector.js +147 -0
  121. package/build/pattern/recursion-detector.js.map +1 -0
  122. package/build/post-featured-image/edit.js +19 -2
  123. package/build/post-featured-image/edit.js.map +1 -1
  124. package/build/post-featured-image/index.js +4 -0
  125. package/build/post-featured-image/index.js.map +1 -1
  126. package/build/post-title/index.js +1 -3
  127. package/build/post-title/index.js.map +1 -1
  128. package/build/preformatted/index.js +2 -3
  129. package/build/preformatted/index.js.map +1 -1
  130. package/build/pullquote/index.js +5 -7
  131. package/build/pullquote/index.js.map +1 -1
  132. package/build/query/edit/inspector-controls/index.js +3 -1
  133. package/build/query/edit/inspector-controls/index.js.map +1 -1
  134. package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -0
  135. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  136. package/build/query-pagination-numbers/index.js +1 -1
  137. package/build/query-title/index.js +1 -3
  138. package/build/query-title/index.js.map +1 -1
  139. package/build/quote/index.js +3 -5
  140. package/build/quote/index.js.map +1 -1
  141. package/build/quote/transforms.js +7 -6
  142. package/build/quote/transforms.js.map +1 -1
  143. package/build/search/edit.js +3 -5
  144. package/build/search/edit.js.map +1 -1
  145. package/build/search/index.js +0 -4
  146. package/build/search/index.js.map +1 -1
  147. package/build/site-logo/edit.js +7 -6
  148. package/build/site-logo/edit.js.map +1 -1
  149. package/build/site-title/index.js +1 -5
  150. package/build/site-title/index.js.map +1 -1
  151. package/build/social-link/icons/gravatar.js +22 -0
  152. package/build/social-link/icons/gravatar.js.map +1 -0
  153. package/build/social-link/icons/index.js +11 -0
  154. package/build/social-link/icons/index.js.map +1 -1
  155. package/build/social-link/variations.js +7 -0
  156. package/build/social-link/variations.js.map +1 -1
  157. package/build/spacer/edit.native.js +2 -2
  158. package/build/spacer/edit.native.js.map +1 -1
  159. package/build/table/edit.js +3 -1
  160. package/build/table/edit.js.map +1 -1
  161. package/build/table/index.js +9 -10
  162. package/build/table/index.js.map +1 -1
  163. package/build/table-of-contents/edit.js +2 -2
  164. package/build/table-of-contents/edit.js.map +1 -1
  165. package/build/table-of-contents/index.js +5 -2
  166. package/build/table-of-contents/index.js.map +1 -1
  167. package/build/tag-cloud/edit.js +5 -9
  168. package/build/tag-cloud/edit.js.map +1 -1
  169. package/build/utils/caption.js +90 -0
  170. package/build/utils/caption.js.map +1 -0
  171. package/build/utils/constants.js +16 -0
  172. package/build/utils/constants.js.map +1 -0
  173. package/build/utils/remove-anchor-tag.js +2 -1
  174. package/build/utils/remove-anchor-tag.js.map +1 -1
  175. package/build/verse/index.js +3 -5
  176. package/build/verse/index.js.map +1 -1
  177. package/build/video/deprecated.js +2 -2
  178. package/build/video/edit.js +16 -57
  179. package/build/video/edit.js.map +1 -1
  180. package/build/video/edit.native.js +1 -1
  181. package/build/video/edit.native.js.map +1 -1
  182. package/build/video/index.js +2 -2
  183. package/build-module/audio/edit.js +19 -66
  184. package/build-module/audio/edit.js.map +1 -1
  185. package/build-module/audio/edit.native.js +2 -2
  186. package/build-module/audio/edit.native.js.map +1 -1
  187. package/build-module/audio/index.js +2 -2
  188. package/build-module/block/edit.js +160 -22
  189. package/build-module/block/edit.js.map +1 -1
  190. package/build-module/block/index.js +3 -2
  191. package/build-module/block/index.js.map +1 -1
  192. package/build-module/block/v1/edit.js +108 -0
  193. package/build-module/block/v1/edit.js.map +1 -0
  194. package/build-module/block/{edit.native.js → v1/edit.native.js} +2 -2
  195. package/build-module/block/v1/edit.native.js.map +1 -0
  196. package/build-module/button/index.js +2 -2
  197. package/build-module/button/save.js +1 -1
  198. package/build-module/button/save.js.map +1 -1
  199. package/build-module/code/edit.native.js +14 -16
  200. package/build-module/code/edit.native.js.map +1 -1
  201. package/build-module/code/index.js +2 -2
  202. package/build-module/code/save.js +6 -2
  203. package/build-module/code/save.js.map +1 -1
  204. package/build-module/comments-title/deprecated.js +1 -1
  205. package/build-module/comments-title/index.js +1 -1
  206. package/build-module/cover/edit/inspector-controls.js +1 -1
  207. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  208. package/build-module/cover/edit.native.js +1 -0
  209. package/build-module/cover/edit.native.js.map +1 -1
  210. package/build-module/details/index.js +2 -2
  211. package/build-module/embed/deprecated.js +2 -2
  212. package/build-module/embed/embed-preview.native.js +2 -2
  213. package/build-module/embed/embed-preview.native.js.map +1 -1
  214. package/build-module/embed/icons.js +1 -1
  215. package/build-module/embed/icons.js.map +1 -1
  216. package/build-module/embed/index.js +2 -2
  217. package/build-module/embed/transforms.js +2 -2
  218. package/build-module/embed/util.js +6 -6
  219. package/build-module/embed/util.js.map +1 -1
  220. package/build-module/file/edit.js +20 -28
  221. package/build-module/file/edit.js.map +1 -1
  222. package/build-module/file/edit.native.js +1 -1
  223. package/build-module/file/edit.native.js.map +1 -1
  224. package/build-module/file/index.js +4 -4
  225. package/build-module/file/save.js +4 -1
  226. package/build-module/file/save.js.map +1 -1
  227. package/build-module/form-input/deprecated.js +138 -0
  228. package/build-module/form-input/deprecated.js.map +1 -0
  229. package/build-module/form-input/edit.js +1 -1
  230. package/build-module/form-input/edit.js.map +1 -1
  231. package/build-module/form-input/index.js +4 -2
  232. package/build-module/form-input/index.js.map +1 -1
  233. package/build-module/form-input/save.js +8 -10
  234. package/build-module/form-input/save.js.map +1 -1
  235. package/build-module/gallery/edit.js +41 -61
  236. package/build-module/gallery/edit.js.map +1 -1
  237. package/build-module/gallery/gallery.js +18 -21
  238. package/build-module/gallery/gallery.js.map +1 -1
  239. package/build-module/gallery/gallery.native.js +2 -2
  240. package/build-module/gallery/gallery.native.js.map +1 -1
  241. package/build-module/gallery/index.js +8 -4
  242. package/build-module/gallery/index.js.map +1 -1
  243. package/build-module/gallery/transforms.js +4 -68
  244. package/build-module/gallery/transforms.js.map +1 -1
  245. package/build-module/gallery/v1/gallery.native.js +2 -2
  246. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  247. package/build-module/group/edit.js +6 -1
  248. package/build-module/group/edit.js.map +1 -1
  249. package/build-module/group/index.js +5 -1
  250. package/build-module/group/index.js.map +1 -1
  251. package/build-module/heading/index.js +3 -6
  252. package/build-module/heading/index.js.map +1 -1
  253. package/build-module/image/deprecated.js +11 -0
  254. package/build-module/image/deprecated.js.map +1 -1
  255. package/build-module/image/edit.native.js +5 -2
  256. package/build-module/image/edit.native.js.map +1 -1
  257. package/build-module/image/image.js +35 -71
  258. package/build-module/image/image.js.map +1 -1
  259. package/build-module/image/index.js +2 -2
  260. package/build-module/image/save.js +3 -1
  261. package/build-module/image/save.js.map +1 -1
  262. package/build-module/image/view.js +7 -1
  263. package/build-module/image/view.js.map +1 -1
  264. package/build-module/list/edit.js +10 -15
  265. package/build-module/list/edit.js.map +1 -1
  266. package/build-module/list-item/edit.js +18 -3
  267. package/build-module/list-item/edit.js.map +1 -1
  268. package/build-module/list-item/hooks/use-enter.js +5 -3
  269. package/build-module/list-item/hooks/use-enter.js.map +1 -1
  270. package/build-module/list-item/hooks/use-enter.native.js +4 -3
  271. package/build-module/list-item/hooks/use-enter.native.js.map +1 -1
  272. package/build-module/list-item/hooks/use-indent-list-item.js +2 -3
  273. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  274. package/build-module/list-item/hooks/use-merge.js +1 -1
  275. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  276. package/build-module/list-item/hooks/use-outdent-list-item.js +3 -17
  277. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  278. package/build-module/list-item/hooks/use-space.js +8 -4
  279. package/build-module/list-item/hooks/use-space.js.map +1 -1
  280. package/build-module/list-item/index.js +10 -3
  281. package/build-module/list-item/index.js.map +1 -1
  282. package/build-module/media-text/media-container.native.js +3 -0
  283. package/build-module/media-text/media-container.native.js.map +1 -1
  284. package/build-module/navigation/constants.js +1 -0
  285. package/build-module/navigation/constants.js.map +1 -1
  286. package/build-module/navigation/edit/index.js +7 -3
  287. package/build-module/navigation/edit/index.js.map +1 -1
  288. package/build-module/navigation/view.js +25 -1
  289. package/build-module/navigation/view.js.map +1 -1
  290. package/build-module/page-list/convert-to-links-modal.js +2 -2
  291. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  292. package/build-module/paragraph/edit.js +54 -32
  293. package/build-module/paragraph/edit.js.map +1 -1
  294. package/build-module/paragraph/index.js +2 -4
  295. package/build-module/paragraph/index.js.map +1 -1
  296. package/build-module/paragraph/transforms.js +2 -4
  297. package/build-module/paragraph/transforms.js.map +1 -1
  298. package/build-module/pattern/edit.js +26 -4
  299. package/build-module/pattern/edit.js.map +1 -1
  300. package/build-module/pattern/recursion-detector.js +139 -0
  301. package/build-module/pattern/recursion-detector.js.map +1 -0
  302. package/build-module/post-featured-image/edit.js +19 -2
  303. package/build-module/post-featured-image/edit.js.map +1 -1
  304. package/build-module/post-featured-image/index.js +4 -0
  305. package/build-module/post-featured-image/index.js.map +1 -1
  306. package/build-module/post-title/index.js +1 -3
  307. package/build-module/post-title/index.js.map +1 -1
  308. package/build-module/preformatted/index.js +2 -3
  309. package/build-module/preformatted/index.js.map +1 -1
  310. package/build-module/pullquote/index.js +5 -7
  311. package/build-module/pullquote/index.js.map +1 -1
  312. package/build-module/query/edit/inspector-controls/index.js +3 -1
  313. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  314. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -0
  315. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  316. package/build-module/query-pagination-numbers/index.js +1 -1
  317. package/build-module/query-title/index.js +1 -3
  318. package/build-module/query-title/index.js.map +1 -1
  319. package/build-module/quote/index.js +3 -5
  320. package/build-module/quote/index.js.map +1 -1
  321. package/build-module/quote/transforms.js +7 -6
  322. package/build-module/quote/transforms.js.map +1 -1
  323. package/build-module/search/edit.js +3 -5
  324. package/build-module/search/edit.js.map +1 -1
  325. package/build-module/search/index.js +0 -4
  326. package/build-module/search/index.js.map +1 -1
  327. package/build-module/site-logo/edit.js +7 -6
  328. package/build-module/site-logo/edit.js.map +1 -1
  329. package/build-module/site-title/index.js +1 -5
  330. package/build-module/site-title/index.js.map +1 -1
  331. package/build-module/social-link/icons/gravatar.js +14 -0
  332. package/build-module/social-link/icons/gravatar.js.map +1 -0
  333. package/build-module/social-link/icons/index.js +1 -0
  334. package/build-module/social-link/icons/index.js.map +1 -1
  335. package/build-module/social-link/variations.js +8 -1
  336. package/build-module/social-link/variations.js.map +1 -1
  337. package/build-module/spacer/edit.native.js +2 -2
  338. package/build-module/spacer/edit.native.js.map +1 -1
  339. package/build-module/table/edit.js +3 -1
  340. package/build-module/table/edit.js.map +1 -1
  341. package/build-module/table/index.js +9 -10
  342. package/build-module/table/index.js.map +1 -1
  343. package/build-module/table-of-contents/edit.js +1 -1
  344. package/build-module/table-of-contents/edit.js.map +1 -1
  345. package/build-module/table-of-contents/index.js +5 -1
  346. package/build-module/table-of-contents/index.js.map +1 -1
  347. package/build-module/tag-cloud/edit.js +6 -10
  348. package/build-module/tag-cloud/edit.js.map +1 -1
  349. package/build-module/utils/caption.js +82 -0
  350. package/build-module/utils/caption.js.map +1 -0
  351. package/build-module/utils/constants.js +9 -0
  352. package/build-module/utils/constants.js.map +1 -0
  353. package/build-module/utils/remove-anchor-tag.js +2 -1
  354. package/build-module/utils/remove-anchor-tag.js.map +1 -1
  355. package/build-module/verse/index.js +3 -5
  356. package/build-module/verse/index.js.map +1 -1
  357. package/build-module/video/deprecated.js +2 -2
  358. package/build-module/video/edit.js +21 -62
  359. package/build-module/video/edit.js.map +1 -1
  360. package/build-module/video/edit.native.js +2 -2
  361. package/build-module/video/edit.native.js.map +1 -1
  362. package/build-module/video/index.js +2 -2
  363. package/build-style/button/editor-rtl.css +0 -37
  364. package/build-style/button/editor.css +0 -37
  365. package/build-style/button/style-rtl.css +6 -6
  366. package/build-style/button/style.css +6 -6
  367. package/build-style/editor-rtl.css +3 -55
  368. package/build-style/editor.css +3 -55
  369. package/build-style/navigation/editor-rtl.css +2 -4
  370. package/build-style/navigation/editor.css +2 -4
  371. package/build-style/navigation/style-rtl.css +14 -18
  372. package/build-style/navigation/style.css +14 -18
  373. package/build-style/search/style-rtl.css +26 -27
  374. package/build-style/search/style.css +26 -27
  375. package/build-style/social-links/style-rtl.css +14 -2
  376. package/build-style/social-links/style.css +14 -2
  377. package/build-style/style-rtl.css +60 -53
  378. package/build-style/style.css +60 -53
  379. package/build-style/table/editor-rtl.css +1 -14
  380. package/build-style/table/editor.css +1 -14
  381. package/package.json +32 -32
  382. package/src/audio/block.json +2 -2
  383. package/src/audio/edit.js +29 -92
  384. package/src/audio/edit.native.js +2 -1
  385. package/src/audio/test/__snapshots__/edit.native.js.snap +12 -0
  386. package/src/audio/test/edit.native.js +29 -0
  387. package/src/block/edit.js +218 -37
  388. package/src/block/index.js +3 -2
  389. package/src/block/index.php +48 -0
  390. package/src/block/v1/edit.js +163 -0
  391. package/src/block/{edit.native.js → v1/edit.native.js} +2 -2
  392. package/src/button/block.json +2 -2
  393. package/src/button/editor.scss +0 -43
  394. package/src/button/save.js +1 -1
  395. package/src/button/style.scss +6 -6
  396. package/src/buttons/test/__snapshots__/edit.native.js.snap +6 -0
  397. package/src/buttons/test/edit.native.js +49 -0
  398. package/src/code/block.json +2 -2
  399. package/src/code/edit.native.js +11 -13
  400. package/src/code/save.js +4 -1
  401. package/src/code/test/edit.native.js +2 -2
  402. package/src/comments-title/block.json +1 -1
  403. package/src/cover/edit/inspector-controls.js +1 -1
  404. package/src/cover/edit.native.js +1 -0
  405. package/src/cover/test/edit.native.js +7 -1
  406. package/src/details/block.json +2 -2
  407. package/src/embed/block.json +2 -2
  408. package/src/embed/embed-preview.native.js +2 -1
  409. package/src/embed/icons.js +1 -1
  410. package/src/embed/util.js +2 -2
  411. package/src/file/block.json +4 -4
  412. package/src/file/edit.js +18 -25
  413. package/src/file/edit.native.js +1 -1
  414. package/src/file/save.js +5 -1
  415. package/src/form-input/block.json +2 -2
  416. package/src/form-input/deprecated.js +142 -0
  417. package/src/form-input/edit.js +1 -1
  418. package/src/form-input/index.js +2 -0
  419. package/src/form-input/save.js +27 -24
  420. package/src/gallery/block.json +8 -4
  421. package/src/gallery/edit.js +70 -98
  422. package/src/gallery/gallery.js +22 -36
  423. package/src/gallery/gallery.native.js +6 -2
  424. package/src/gallery/index.php +15 -0
  425. package/src/gallery/transforms.js +2 -55
  426. package/src/gallery/v1/gallery.native.js +2 -1
  427. package/src/group/block.json +5 -1
  428. package/src/group/edit.js +4 -1
  429. package/src/heading/block.json +3 -6
  430. package/src/image/block.json +2 -2
  431. package/src/image/deprecated.js +8 -0
  432. package/src/image/edit.native.js +5 -3
  433. package/src/image/image.js +77 -127
  434. package/src/image/index.php +1 -6
  435. package/src/image/save.js +3 -1
  436. package/src/image/view.js +5 -2
  437. package/src/list/edit.js +27 -35
  438. package/src/list-item/block.json +10 -3
  439. package/src/list-item/edit.js +18 -2
  440. package/src/list-item/hooks/use-enter.js +63 -62
  441. package/src/list-item/hooks/use-enter.native.js +9 -5
  442. package/src/list-item/hooks/use-indent-list-item.js +43 -53
  443. package/src/list-item/hooks/use-merge.js +1 -1
  444. package/src/list-item/hooks/use-outdent-list-item.js +50 -69
  445. package/src/list-item/hooks/use-space.js +7 -4
  446. package/src/media-text/media-container.native.js +3 -1
  447. package/src/navigation/constants.js +2 -0
  448. package/src/navigation/edit/index.js +18 -3
  449. package/src/navigation/editor.scss +1 -1
  450. package/src/navigation/index.php +1 -1
  451. package/src/navigation/style.scss +18 -16
  452. package/src/navigation/view.js +29 -3
  453. package/src/navigation-link/test/__snapshots__/hooks.js.snap +6 -3
  454. package/src/page-list/convert-to-links-modal.js +2 -2
  455. package/src/paragraph/block.json +2 -4
  456. package/src/paragraph/edit.js +53 -40
  457. package/src/paragraph/test/__snapshots__/edit.native.js.snap +12 -0
  458. package/src/paragraph/test/edit.native.js +114 -0
  459. package/src/pattern/edit.js +35 -3
  460. package/src/pattern/index.php +16 -0
  461. package/src/pattern/recursion-detector.js +145 -0
  462. package/src/pattern/test/index.js +74 -0
  463. package/src/post-featured-image/block.json +4 -0
  464. package/src/post-featured-image/edit.js +32 -1
  465. package/src/post-featured-image/index.php +31 -0
  466. package/src/post-title/block.json +1 -3
  467. package/src/preformatted/block.json +2 -3
  468. package/src/pullquote/block.json +5 -7
  469. package/src/query/edit/inspector-controls/index.js +2 -0
  470. package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -0
  471. package/src/query-pagination-numbers/block.json +1 -1
  472. package/src/query-title/block.json +1 -3
  473. package/src/quote/block.json +3 -5
  474. package/src/quote/transforms.js +12 -11
  475. package/src/search/block.json +0 -4
  476. package/src/search/edit.js +2 -8
  477. package/src/search/index.php +3 -7
  478. package/src/search/style.scss +27 -29
  479. package/src/site-logo/edit.js +3 -4
  480. package/src/site-title/block.json +1 -5
  481. package/src/social-link/icons/gravatar.js +10 -0
  482. package/src/social-link/icons/index.js +1 -0
  483. package/src/social-link/index.php +5 -1
  484. package/src/social-link/socials-with-bg.scss +5 -0
  485. package/src/social-link/socials-without-bg.scss +4 -0
  486. package/src/social-link/variations.js +7 -0
  487. package/src/social-links/style.scss +14 -8
  488. package/src/spacer/edit.native.js +4 -2
  489. package/src/table/block.json +9 -10
  490. package/src/table/edit.js +3 -1
  491. package/src/table/editor.scss +1 -17
  492. package/src/table-of-contents/edit.js +1 -1
  493. package/src/table-of-contents/index.js +5 -1
  494. package/src/tag-cloud/edit.js +7 -7
  495. package/src/template-part/index.php +6 -0
  496. package/src/utils/caption.js +108 -0
  497. package/src/utils/constants.js +8 -0
  498. package/src/utils/remove-anchor-tag.js +2 -1
  499. package/src/verse/block.json +3 -5
  500. package/src/video/block.json +2 -2
  501. package/src/video/edit.js +40 -100
  502. package/src/video/edit.native.js +2 -1
  503. package/build/block/edit.native.js.map +0 -1
  504. package/build/table-of-contents/icon.js +0 -22
  505. package/build/table-of-contents/icon.js.map +0 -1
  506. package/build-module/block/edit.native.js.map +0 -1
  507. package/build-module/table-of-contents/icon.js +0 -15
  508. package/build-module/table-of-contents/icon.js.map +0 -1
  509. package/src/table-of-contents/icon.js +0 -18
@@ -1 +1 @@
1
- {"version":3,"names":["_interactivity","require","focusableSelectors","scrollCallback","isTouching","lastTouchTime","handleScroll","ctx","Date","now","window","scrollTo","scrollLeftReset","scrollTopReset","state","actions","callbacks","store","windowWidth","innerWidth","windowHeight","innerHeight","roleAttribute","getContext","lightboxEnabled","ariaModal","dialogLabel","lightboxObjectFit","initialized","enlargedImgSrc","imageUploadedSrc","showLightbox","event","imageLoaded","lastFocusedElement","document","activeElement","scrollDelta","pointerType","setStyles","imageRef","pageYOffset","documentElement","scrollTop","pageXOffset","scrollLeft","bind","addEventListener","hideLightbox","hideAnimationEnabled","setTimeout","removeEventListener","lightboxTriggerRef","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","ref","getElement","imageCurrentSrc","currentSrc","setButtonStyles","handleTouchStart","handleTouchMove","handleTouchEnd","initOriginImage","parentElement","querySelector","complete","initLightbox","focusableElements","querySelectorAll","length","naturalWidth","naturalHeight","offsetWidth","offsetHeight","figure","figureWidth","clientWidth","figureHeight","clientHeight","caption","captionComputedStyle","getComputedStyle","includes","position","parseFloat","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","scaleAttr","naturalRatio","offsetRatio","referenceHeight","imageButtonTop","imageButtonRight","referenceWidth","setStylesOnResize","debounce","originalWidth","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","originalRatio","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","styleTag","getElementById","createElement","id","head","appendChild","innerHTML","func","wait","timeout","later","clearTimeout"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'area[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'iframe',\n\t'object',\n\t'embed',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n/**\n * Stores a context-bound scroll handler.\n *\n * This callback could be defined inline inside of the store\n * object but it's created externally to avoid confusion about\n * how its logic is called. This logic is not referenced directly\n * by the directives in the markup because the scroll event we\n * need to listen to is triggered on the window; so by defining it\n * outside of the store, we signal that the behavior here is different.\n * If we find a compelling reason to move it to the store, feel free.\n *\n * @type {Function}\n */\nlet scrollCallback;\n\n/**\n * Tracks whether user is touching screen; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/**\n * Tracks the last time the screen was touched; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/**\n * Lightbox page-scroll handler: prevents scrolling.\n *\n * This handler is added to prevent scrolling behaviors that\n * trigger content shift while the lightbox is open.\n *\n * It would be better to accomplish this through CSS alone, but\n * using overflow: hidden is currently the only way to do so, and\n * that causes the layout to shift and prevents the zoom animation\n * from working in some cases because we're unable to account for\n * the layout shift when doing the animation calculations. Instead,\n * here we use JavaScript to prevent and reset the scrolling\n * behavior. In the future, we may be able to use CSS or overflow: hidden\n * instead to not rely on JavaScript, but this seems to be the best approach\n * for now that provides the best visual experience.\n *\n * @param {Object} ctx Context object with the `core/image` namespace.\n */\nfunction handleScroll( ctx ) {\n\t// We can't override the scroll behavior on mobile devices\n\t// because doing so breaks the pinch to zoom functionality, and we\n\t// want to allow users to zoom in further on the high-res image.\n\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t// We are unable to use event.preventDefault() to prevent scrolling\n\t\t// because the scroll event can't be canceled, so we reset the position instead.\n\t\twindow.scrollTo( ctx.scrollLeftReset, ctx.scrollTopReset );\n\t}\n}\n\nconst { state, actions, callbacks } = store( 'core/image', {\n\tstate: {\n\t\twindowWidth: window.innerWidth,\n\t\twindowHeight: window.innerHeight,\n\t\tget roleAttribute() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.lightboxEnabled ? 'dialog' : null;\n\t\t},\n\t\tget ariaModal() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.lightboxEnabled ? 'true' : null;\n\t\t},\n\t\tget dialogLabel() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.lightboxEnabled ? ctx.dialogLabel : null;\n\t\t},\n\t\tget lightboxObjectFit() {\n\t\t\tconst ctx = getContext();\n\t\t\tif ( ctx.initialized ) {\n\t\t\t\treturn 'cover';\n\t\t\t}\n\t\t},\n\t\tget enlargedImgSrc() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.initialized\n\t\t\t\t? ctx.imageUploadedSrc\n\t\t\t\t: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\n\t\t},\n\t},\n\tactions: {\n\t\tshowLightbox( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\t// We can't initialize the lightbox until the reference\n\t\t\t// image is loaded, otherwise the UX is broken.\n\t\t\tif ( ! ctx.imageLoaded ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tctx.initialized = true;\n\t\t\tctx.lastFocusedElement = window.document.activeElement;\n\t\t\tctx.scrollDelta = 0;\n\t\t\tctx.pointerType = event.pointerType;\n\n\t\t\tctx.lightboxEnabled = true;\n\t\t\tsetStyles( ctx, ctx.imageRef );\n\n\t\t\tctx.scrollTopReset =\n\t\t\t\twindow.pageYOffset || document.documentElement.scrollTop;\n\n\t\t\t// In most cases, this value will be 0, but this is included\n\t\t\t// in case a user has created a page with horizontal scrolling.\n\t\t\tctx.scrollLeftReset =\n\t\t\t\twindow.pageXOffset || document.documentElement.scrollLeft;\n\n\t\t\t// We define and bind the scroll callback here so\n\t\t\t// that we can pass the context and as an argument.\n\t\t\t// We may be able to change this in the future if we\n\t\t\t// define the scroll callback in the store instead, but\n\t\t\t// this approach seems to tbe clearest for now.\n\t\t\tscrollCallback = handleScroll.bind( null, ctx );\n\n\t\t\t// We need to add a scroll event listener to the window\n\t\t\t// here because we are unable to otherwise access it via\n\t\t\t// the Interactivity API directives. If we add a native way\n\t\t\t// to access the window, we can remove this.\n\t\t\twindow.addEventListener( 'scroll', scrollCallback, false );\n\t\t},\n\t\thideLightbox() {\n\t\t\tconst ctx = getContext();\n\t\t\tctx.hideAnimationEnabled = true;\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\t// We want to wait until the close animation is completed\n\t\t\t\t// before allowing a user to scroll again. The duration of this\n\t\t\t\t// animation is defined in the styles.scss and depends on if the\n\t\t\t\t// animation is 'zoom' or 'fade', but in any case we should wait\n\t\t\t\t// a few milliseconds longer than the duration, otherwise a user\n\t\t\t\t// may scroll too soon and cause the animation to look sloppy.\n\t\t\t\tsetTimeout( function () {\n\t\t\t\t\twindow.removeEventListener( 'scroll', scrollCallback );\n\t\t\t\t\t// If we don't delay before changing the focus,\n\t\t\t\t\t// the focus ring will appear on Firefox before\n\t\t\t\t\t// the image has finished animating, which looks broken.\n\t\t\t\t\tctx.lightboxTriggerRef.focus( {\n\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t} );\n\t\t\t\t}, 450 );\n\n\t\t\t\tctx.lightboxEnabled = false;\n\t\t\t}\n\t\t},\n\t\thandleKeydown( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\tif ( event.key === 'Tab' || event.keyCode === 9 ) {\n\t\t\t\t\t// If shift + tab it change the direction\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\tctx.firstFocusableElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tctx.lastFocusableElement.focus();\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\tctx.lastFocusableElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tctx.firstFocusableElement.focus();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( event.key === 'Escape' || event.keyCode === 27 ) {\n\t\t\t\t\tactions.hideLightbox( event );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// This is fired just by lazily loaded\n\t\t// images on the page, not all images.\n\t\thandleLoad() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tctx.imageLoaded = true;\n\t\t\tctx.imageCurrentSrc = ref.currentSrc;\n\t\t\tcallbacks.setButtonStyles();\n\t\t},\n\t\thandleTouchStart() {\n\t\t\tisTouching = true;\n\t\t},\n\t\thandleTouchMove( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\t// On mobile devices, we want to prevent triggering the\n\t\t\t// scroll event because otherwise the page jumps around as\n\t\t\t// we reset the scroll position. This also means that closing\n\t\t\t// the lightbox requires that a user perform a simple tap. This\n\t\t\t// may be changed in the future if we find a better alternative\n\t\t\t// to override or reset the scroll position during swipe actions.\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\thandleTouchEnd() {\n\t\t\t// We need to wait a few milliseconds before resetting\n\t\t\t// to ensure that pinch to zoom works consistently\n\t\t\t// on mobile devices when the lightbox is open.\n\t\t\tlastTouchTime = Date.now();\n\t\t\tisTouching = false;\n\t\t},\n\t},\n\tcallbacks: {\n\t\tinitOriginImage() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tctx.imageRef = ref;\n\t\t\tctx.lightboxTriggerRef =\n\t\t\t\tref.parentElement.querySelector( '.lightbox-trigger' );\n\t\t\tif ( ref.complete ) {\n\t\t\t\tctx.imageLoaded = true;\n\t\t\t\tctx.imageCurrentSrc = ref.currentSrc;\n\t\t\t}\n\t\t},\n\t\tinitLightbox() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\tconst focusableElements =\n\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\tctx.firstFocusableElement = focusableElements[ 0 ];\n\t\t\t\tctx.lastFocusableElement =\n\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\n\t\t\t\t// Move focus to the dialog when opening it.\n\t\t\t\tref.focus();\n\t\t\t}\n\t\t},\n\t\tsetButtonStyles() {\n\t\t\tconst { ref } = getElement();\n\t\t\tconst { naturalWidth, naturalHeight, offsetWidth, offsetHeight } =\n\t\t\t\tref;\n\n\t\t\t// If the image isn't loaded yet, we can't\n\t\t\t// calculate where the button should be.\n\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst figure = ref.parentElement;\n\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t// We need special handling for the height because\n\t\t\t// a caption will cause the figure to be taller than\n\t\t\t// the image, which means we need to account for that\n\t\t\t// when calculating the placement of the button in the\n\t\t\t// top right corner of the image.\n\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\tif ( caption ) {\n\t\t\t\tconst captionComputedStyle = window.getComputedStyle( caption );\n\t\t\t\tif (\n\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\tconst ctx = getContext();\n\n\t\t\t// In the case of an image with object-fit: contain, the\n\t\t\t// size of the <img> element can be larger than the image itself,\n\t\t\t// so we need to calculate where to place the button.\n\t\t\tif ( ctx.scaleAttr === 'contain' ) {\n\t\t\t\t// Natural ratio of the image.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Offset ratio of the image.\n\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t// If it reaches the width first, keep\n\t\t\t\t\t// the width and compute the height.\n\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\tctx.imageButtonTop =\n\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t16;\n\t\t\t\t\tctx.imageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t} else {\n\t\t\t\t\t// If it reaches the height first, keep\n\t\t\t\t\t// the height and compute the width.\n\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\tctx.imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\tctx.imageButtonRight =\n\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t16;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tctx.imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\tctx.imageButtonRight = buttonOffsetRight + 16;\n\t\t\t}\n\t\t},\n\t\tsetStylesOnResize() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif (\n\t\t\t\tctx.lightboxEnabled &&\n\t\t\t\t( state.windowWidth || state.windowHeight )\n\t\t\t) {\n\t\t\t\tsetStyles( ctx, ref );\n\t\t\t}\n\t\t},\n\t},\n} );\n\nwindow.addEventListener(\n\t'resize',\n\tdebounce( () => {\n\t\tstate.windowWidth = window.innerWidth;\n\t\tstate.windowHeight = window.innerHeight;\n\t} )\n);\n\n/**\n * Computes styles for the lightbox and adds them to the document.\n *\n * @function\n * @param {Object} ctx - Context for the `core/image` namespace.\n * @param {Object} ref - The element reference.\n */\nfunction setStyles( ctx, ref ) {\n\t// The reference img element lies adjacent\n\t// to the event target button in the DOM.\n\tlet {\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t\toffsetWidth: originalWidth,\n\t\toffsetHeight: originalHeight,\n\t} = ref;\n\tlet { x: screenPosX, y: screenPosY } = ref.getBoundingClientRect();\n\n\t// Natural ratio of the image clicked to open the lightbox.\n\tconst naturalRatio = naturalWidth / naturalHeight;\n\t// Original ratio of the image clicked to open the lightbox.\n\tlet originalRatio = originalWidth / originalHeight;\n\n\t// If it has object-fit: contain, recalculate the original sizes\n\t// and the screen position without the blank spaces.\n\tif ( ctx.scaleAttr === 'contain' ) {\n\t\tif ( naturalRatio > originalRatio ) {\n\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t// Recalculate screen position without the top space.\n\t\t\tscreenPosY += ( originalHeight - heightWithoutSpace ) / 2;\n\t\t\toriginalHeight = heightWithoutSpace;\n\t\t} else {\n\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t// Recalculate screen position without the left space.\n\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\toriginalWidth = widthWithoutSpace;\n\t\t}\n\t}\n\toriginalRatio = originalWidth / originalHeight;\n\n\t// Typically, we use the image's full-sized dimensions. If those\n\t// dimensions have not been set (i.e. an external image with only one size),\n\t// the image's dimensions in the lightbox are the same\n\t// as those of the image in the content.\n\tlet imgMaxWidth = parseFloat(\n\t\tctx.targetWidth !== 'none' ? ctx.targetWidth : naturalWidth\n\t);\n\tlet imgMaxHeight = parseFloat(\n\t\tctx.targetHeight !== 'none' ? ctx.targetHeight : naturalHeight\n\t);\n\n\t// Ratio of the biggest image stored in the database.\n\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\tlet containerMaxWidth = imgMaxWidth;\n\tlet containerMaxHeight = imgMaxHeight;\n\tlet containerWidth = imgMaxWidth;\n\tlet containerHeight = imgMaxHeight;\n\t// Check if the target image has a different ratio than the original one (thumbnail).\n\t// Recalculate the width and height.\n\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t// If the width is reached before the height, we keep the maxWidth\n\t\t\t// and recalculate the height.\n\t\t\t// Unless the difference between the maxHeight and the reducedHeight\n\t\t\t// is higher than the maxWidth, where we keep the reducedHeight and\n\t\t\t// recalculate the width.\n\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t}\n\t\t} else {\n\t\t\t// If the height is reached before the width, we keep the maxHeight\n\t\t\t// and recalculate the width.\n\t\t\t// Unless the difference between the maxWidth and the reducedWidth\n\t\t\t// is higher than the maxHeight, where we keep the reducedWidth and\n\t\t\t// recalculate the height.\n\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t}\n\t\t}\n\t\tcontainerWidth = imgMaxWidth;\n\t\tcontainerHeight = imgMaxHeight;\n\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t// Calculate the max size of the container.\n\t\tif ( originalRatio > imgRatio ) {\n\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t} else {\n\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t}\n\t}\n\n\t// If the image has been pixelated on purpose, keep that size.\n\tif ( originalWidth > containerWidth || originalHeight > containerHeight ) {\n\t\tcontainerWidth = originalWidth;\n\t\tcontainerHeight = originalHeight;\n\t}\n\n\t// Calculate the final lightbox image size and the\n\t// scale factor. MaxWidth is either the window container\n\t// (accounting for padding) or the image resolution.\n\tlet horizontalPadding = 0;\n\tif ( window.innerWidth > 480 ) {\n\t\thorizontalPadding = 80;\n\t} else if ( window.innerWidth > 1920 ) {\n\t\thorizontalPadding = 160;\n\t}\n\tconst verticalPadding = 80;\n\n\tconst targetMaxWidth = Math.min(\n\t\twindow.innerWidth - horizontalPadding,\n\t\tcontainerWidth\n\t);\n\tconst targetMaxHeight = Math.min(\n\t\twindow.innerHeight - verticalPadding,\n\t\tcontainerHeight\n\t);\n\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\tif ( originalRatio > targetContainerRatio ) {\n\t\t// If targetMaxWidth is reached before targetMaxHeight\n\t\tcontainerWidth = targetMaxWidth;\n\t\tcontainerHeight = containerWidth / originalRatio;\n\t} else {\n\t\t// If targetMaxHeight is reached before targetMaxWidth\n\t\tcontainerHeight = targetMaxHeight;\n\t\tcontainerWidth = containerHeight * originalRatio;\n\t}\n\n\tconst containerScale = originalWidth / containerWidth;\n\tconst lightboxImgWidth =\n\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\tconst lightboxImgHeight =\n\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t// Add the CSS variables needed.\n\tlet styleTag = document.getElementById( 'wp-lightbox-styles' );\n\tif ( ! styleTag ) {\n\t\tstyleTag = document.createElement( 'style' );\n\t\tstyleTag.id = 'wp-lightbox-styles';\n\t\tdocument.head.appendChild( styleTag );\n\t}\n\n\t// As of this writing, using the calculations above will render the lightbox\n\t// with a small, erroneous whitespace on the left side of the image in iOS Safari,\n\t// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS\n\t// transformation. In any case, adding 1 pixel to the container width and height solves\n\t// the problem, though this can be removed if the issue is fixed in the future.\n\tstyleTag.innerHTML = `\n\t\t:root {\n\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t}px;\n\t\t}\n\t`;\n}\n\n/**\n * Debounces a function call.\n *\n * @function\n * @param {Function} func - A function to be called\n * @param {number} wait - The time to wait before calling the function\n */\nfunction debounce( func, wait = 50 ) {\n\tlet timeout;\n\treturn () => {\n\t\tconst later = () => {\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tclearTimeout( timeout );\n\t\ttimeout = setTimeout( later, wait );\n\t};\n}\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,YAAY,EACZ,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C,EAC3C,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,iCAAiC,CACjC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,cAAc;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,KAAK;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,aAAa,GAAG,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAAEC,GAAG,EAAG;EAC5B;EACA;EACA;EACA,IAAK,CAAEH,UAAU,IAAII,IAAI,C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;EACA;EACA;EACAA,QAAQ,CAACM,SAAS,GAAI;AACvB;AACA,0CAA2CjC,UAAY;AACvD,2CAA4CF,UAAY;AACxD,qCAAsCc,cAAc,GAAG,CAAG;AAC1D,sCAAuCC,eAAe,GAAG,CAAG;AAC5D,iCAAkCY,gBAAkB;AACpD,kCAAmCC,iBAAmB;AACtD,2BAA4BF,cAAgB;AAC5C,qCACI9H,MAAM,CAACS,UAAU,GAAGgB,QAAQ,CAACO,eAAe,CAAC2C,WAC7C;AACJ;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASqB,QAAQA,CAAEwC,IAAI,EAAEC,IAAI,GAAG,EAAE,EAAG;EACpC,IAAIC,OAAO;EACX,OAAO,MAAM;IACZ,MAAMC,KAAK,GAAGA,CAAA,KAAM;MACnBD,OAAO,GAAG,IAAI;MACdF,IAAI,CAAC,CAAC;IACP,CAAC;IACDI,YAAY,CAAEF,OAAQ,CAAC;IACvBA,OAAO,GAAGlG,UAAU,CAAEmG,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
1
+ {"version":3,"names":["_interactivity","require","focusableSelectors","scrollCallback","isTouching","lastTouchTime","handleScroll","ctx","Date","now","window","scrollTo","scrollLeftReset","scrollTopReset","state","actions","callbacks","store","windowWidth","innerWidth","windowHeight","innerHeight","roleAttribute","getContext","lightboxEnabled","ariaModal","dialogLabel","lightboxObjectFit","initialized","enlargedImgSrc","imageUploadedSrc","showLightbox","event","imageLoaded","lastFocusedElement","document","activeElement","scrollDelta","pointerType","setStyles","imageRef","pageYOffset","documentElement","scrollTop","pageXOffset","scrollLeft","bind","addEventListener","hideLightbox","hideAnimationEnabled","setTimeout","removeEventListener","lightboxTriggerRef","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","ref","getElement","imageCurrentSrc","currentSrc","setButtonStyles","handleTouchStart","handleTouchMove","handleTouchEnd","initOriginImage","complete","initTriggerButton","initLightbox","focusableElements","querySelectorAll","length","naturalWidth","naturalHeight","offsetWidth","offsetHeight","figure","parentElement","figureWidth","clientWidth","figureHeight","clientHeight","caption","querySelector","captionComputedStyle","getComputedStyle","includes","position","parseFloat","marginTop","marginBottom","buttonOffsetTop","buttonOffsetRight","scaleAttr","naturalRatio","offsetRatio","referenceHeight","imageButtonTop","imageButtonRight","referenceWidth","setStylesOnResize","debounce","originalWidth","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","originalRatio","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","styleTag","getElementById","createElement","id","head","appendChild","innerHTML","func","wait","timeout","later","clearTimeout"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'area[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'iframe',\n\t'object',\n\t'embed',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n/**\n * Stores a context-bound scroll handler.\n *\n * This callback could be defined inline inside of the store\n * object but it's created externally to avoid confusion about\n * how its logic is called. This logic is not referenced directly\n * by the directives in the markup because the scroll event we\n * need to listen to is triggered on the window; so by defining it\n * outside of the store, we signal that the behavior here is different.\n * If we find a compelling reason to move it to the store, feel free.\n *\n * @type {Function}\n */\nlet scrollCallback;\n\n/**\n * Tracks whether user is touching screen; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/**\n * Tracks the last time the screen was touched; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/**\n * Lightbox page-scroll handler: prevents scrolling.\n *\n * This handler is added to prevent scrolling behaviors that\n * trigger content shift while the lightbox is open.\n *\n * It would be better to accomplish this through CSS alone, but\n * using overflow: hidden is currently the only way to do so, and\n * that causes the layout to shift and prevents the zoom animation\n * from working in some cases because we're unable to account for\n * the layout shift when doing the animation calculations. Instead,\n * here we use JavaScript to prevent and reset the scrolling\n * behavior. In the future, we may be able to use CSS or overflow: hidden\n * instead to not rely on JavaScript, but this seems to be the best approach\n * for now that provides the best visual experience.\n *\n * @param {Object} ctx Context object with the `core/image` namespace.\n */\nfunction handleScroll( ctx ) {\n\t// We can't override the scroll behavior on mobile devices\n\t// because doing so breaks the pinch to zoom functionality, and we\n\t// want to allow users to zoom in further on the high-res image.\n\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t// We are unable to use event.preventDefault() to prevent scrolling\n\t\t// because the scroll event can't be canceled, so we reset the position instead.\n\t\twindow.scrollTo( ctx.scrollLeftReset, ctx.scrollTopReset );\n\t}\n}\n\nconst { state, actions, callbacks } = store( 'core/image', {\n\tstate: {\n\t\twindowWidth: window.innerWidth,\n\t\twindowHeight: window.innerHeight,\n\t\tget roleAttribute() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.lightboxEnabled ? 'dialog' : null;\n\t\t},\n\t\tget ariaModal() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.lightboxEnabled ? 'true' : null;\n\t\t},\n\t\tget dialogLabel() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.lightboxEnabled ? ctx.dialogLabel : null;\n\t\t},\n\t\tget lightboxObjectFit() {\n\t\t\tconst ctx = getContext();\n\t\t\tif ( ctx.initialized ) {\n\t\t\t\treturn 'cover';\n\t\t\t}\n\t\t},\n\t\tget enlargedImgSrc() {\n\t\t\tconst ctx = getContext();\n\t\t\treturn ctx.initialized\n\t\t\t\t? ctx.imageUploadedSrc\n\t\t\t\t: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\n\t\t},\n\t},\n\tactions: {\n\t\tshowLightbox( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\t// We can't initialize the lightbox until the reference\n\t\t\t// image is loaded, otherwise the UX is broken.\n\t\t\tif ( ! ctx.imageLoaded ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tctx.initialized = true;\n\t\t\tctx.lastFocusedElement = window.document.activeElement;\n\t\t\tctx.scrollDelta = 0;\n\t\t\tctx.pointerType = event.pointerType;\n\n\t\t\tctx.lightboxEnabled = true;\n\t\t\tsetStyles( ctx, ctx.imageRef );\n\n\t\t\tctx.scrollTopReset =\n\t\t\t\twindow.pageYOffset || document.documentElement.scrollTop;\n\n\t\t\t// In most cases, this value will be 0, but this is included\n\t\t\t// in case a user has created a page with horizontal scrolling.\n\t\t\tctx.scrollLeftReset =\n\t\t\t\twindow.pageXOffset || document.documentElement.scrollLeft;\n\n\t\t\t// We define and bind the scroll callback here so\n\t\t\t// that we can pass the context and as an argument.\n\t\t\t// We may be able to change this in the future if we\n\t\t\t// define the scroll callback in the store instead, but\n\t\t\t// this approach seems to tbe clearest for now.\n\t\t\tscrollCallback = handleScroll.bind( null, ctx );\n\n\t\t\t// We need to add a scroll event listener to the window\n\t\t\t// here because we are unable to otherwise access it via\n\t\t\t// the Interactivity API directives. If we add a native way\n\t\t\t// to access the window, we can remove this.\n\t\t\twindow.addEventListener( 'scroll', scrollCallback, false );\n\t\t},\n\t\thideLightbox() {\n\t\t\tconst ctx = getContext();\n\t\t\tctx.hideAnimationEnabled = true;\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\t// We want to wait until the close animation is completed\n\t\t\t\t// before allowing a user to scroll again. The duration of this\n\t\t\t\t// animation is defined in the styles.scss and depends on if the\n\t\t\t\t// animation is 'zoom' or 'fade', but in any case we should wait\n\t\t\t\t// a few milliseconds longer than the duration, otherwise a user\n\t\t\t\t// may scroll too soon and cause the animation to look sloppy.\n\t\t\t\tsetTimeout( function () {\n\t\t\t\t\twindow.removeEventListener( 'scroll', scrollCallback );\n\t\t\t\t\t// If we don't delay before changing the focus,\n\t\t\t\t\t// the focus ring will appear on Firefox before\n\t\t\t\t\t// the image has finished animating, which looks broken.\n\t\t\t\t\tctx.lightboxTriggerRef.focus( {\n\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t} );\n\t\t\t\t}, 450 );\n\n\t\t\t\tctx.lightboxEnabled = false;\n\t\t\t}\n\t\t},\n\t\thandleKeydown( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\tif ( event.key === 'Tab' || event.keyCode === 9 ) {\n\t\t\t\t\t// If shift + tab it change the direction\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\tctx.firstFocusableElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tctx.lastFocusableElement.focus();\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\tctx.lastFocusableElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tctx.firstFocusableElement.focus();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( event.key === 'Escape' || event.keyCode === 27 ) {\n\t\t\t\t\tactions.hideLightbox( event );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// This is fired just by lazily loaded\n\t\t// images on the page, not all images.\n\t\thandleLoad() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tctx.imageLoaded = true;\n\t\t\tctx.imageCurrentSrc = ref.currentSrc;\n\t\t\tcallbacks.setButtonStyles();\n\t\t},\n\t\thandleTouchStart() {\n\t\t\tisTouching = true;\n\t\t},\n\t\thandleTouchMove( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\t// On mobile devices, we want to prevent triggering the\n\t\t\t// scroll event because otherwise the page jumps around as\n\t\t\t// we reset the scroll position. This also means that closing\n\t\t\t// the lightbox requires that a user perform a simple tap. This\n\t\t\t// may be changed in the future if we find a better alternative\n\t\t\t// to override or reset the scroll position during swipe actions.\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\thandleTouchEnd() {\n\t\t\t// We need to wait a few milliseconds before resetting\n\t\t\t// to ensure that pinch to zoom works consistently\n\t\t\t// on mobile devices when the lightbox is open.\n\t\t\tlastTouchTime = Date.now();\n\t\t\tisTouching = false;\n\t\t},\n\t},\n\tcallbacks: {\n\t\tinitOriginImage() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tctx.imageRef = ref;\n\t\t\tif ( ref.complete ) {\n\t\t\t\tctx.imageLoaded = true;\n\t\t\t\tctx.imageCurrentSrc = ref.currentSrc;\n\t\t\t}\n\t\t},\n\t\tinitTriggerButton() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tctx.lightboxTriggerRef = ref;\n\t\t},\n\t\tinitLightbox() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( ctx.lightboxEnabled ) {\n\t\t\t\tconst focusableElements =\n\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\tctx.firstFocusableElement = focusableElements[ 0 ];\n\t\t\t\tctx.lastFocusableElement =\n\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\n\t\t\t\t// Move focus to the dialog when opening it.\n\t\t\t\tref.focus();\n\t\t\t}\n\t\t},\n\t\tsetButtonStyles() {\n\t\t\tconst { ref } = getElement();\n\t\t\tconst { naturalWidth, naturalHeight, offsetWidth, offsetHeight } =\n\t\t\t\tref;\n\n\t\t\t// If the image isn't loaded yet, we can't\n\t\t\t// calculate where the button should be.\n\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst figure = ref.parentElement;\n\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t// We need special handling for the height because\n\t\t\t// a caption will cause the figure to be taller than\n\t\t\t// the image, which means we need to account for that\n\t\t\t// when calculating the placement of the button in the\n\t\t\t// top right corner of the image.\n\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\tif ( caption ) {\n\t\t\t\tconst captionComputedStyle = window.getComputedStyle( caption );\n\t\t\t\tif (\n\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\tconst ctx = getContext();\n\n\t\t\t// In the case of an image with object-fit: contain, the\n\t\t\t// size of the <img> element can be larger than the image itself,\n\t\t\t// so we need to calculate where to place the button.\n\t\t\tif ( ctx.scaleAttr === 'contain' ) {\n\t\t\t\t// Natural ratio of the image.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Offset ratio of the image.\n\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t// If it reaches the width first, keep\n\t\t\t\t\t// the width and compute the height.\n\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\tctx.imageButtonTop =\n\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t16;\n\t\t\t\t\tctx.imageButtonRight = buttonOffsetRight + 16;\n\t\t\t\t} else {\n\t\t\t\t\t// If it reaches the height first, keep\n\t\t\t\t\t// the height and compute the width.\n\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\tctx.imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\t\tctx.imageButtonRight =\n\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t16;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tctx.imageButtonTop = buttonOffsetTop + 16;\n\t\t\t\tctx.imageButtonRight = buttonOffsetRight + 16;\n\t\t\t}\n\t\t},\n\t\tsetStylesOnResize() {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif (\n\t\t\t\tctx.lightboxEnabled &&\n\t\t\t\t( state.windowWidth || state.windowHeight )\n\t\t\t) {\n\t\t\t\tsetStyles( ctx, ref );\n\t\t\t}\n\t\t},\n\t},\n} );\n\nwindow.addEventListener(\n\t'resize',\n\tdebounce( () => {\n\t\tstate.windowWidth = window.innerWidth;\n\t\tstate.windowHeight = window.innerHeight;\n\t} )\n);\n\n/**\n * Computes styles for the lightbox and adds them to the document.\n *\n * @function\n * @param {Object} ctx - Context for the `core/image` namespace.\n * @param {Object} ref - The element reference.\n */\nfunction setStyles( ctx, ref ) {\n\t// The reference img element lies adjacent\n\t// to the event target button in the DOM.\n\tlet {\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t\toffsetWidth: originalWidth,\n\t\toffsetHeight: originalHeight,\n\t} = ref;\n\tlet { x: screenPosX, y: screenPosY } = ref.getBoundingClientRect();\n\n\t// Natural ratio of the image clicked to open the lightbox.\n\tconst naturalRatio = naturalWidth / naturalHeight;\n\t// Original ratio of the image clicked to open the lightbox.\n\tlet originalRatio = originalWidth / originalHeight;\n\n\t// If it has object-fit: contain, recalculate the original sizes\n\t// and the screen position without the blank spaces.\n\tif ( ctx.scaleAttr === 'contain' ) {\n\t\tif ( naturalRatio > originalRatio ) {\n\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t// Recalculate screen position without the top space.\n\t\t\tscreenPosY += ( originalHeight - heightWithoutSpace ) / 2;\n\t\t\toriginalHeight = heightWithoutSpace;\n\t\t} else {\n\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t// Recalculate screen position without the left space.\n\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\toriginalWidth = widthWithoutSpace;\n\t\t}\n\t}\n\toriginalRatio = originalWidth / originalHeight;\n\n\t// Typically, we use the image's full-sized dimensions. If those\n\t// dimensions have not been set (i.e. an external image with only one size),\n\t// the image's dimensions in the lightbox are the same\n\t// as those of the image in the content.\n\tlet imgMaxWidth = parseFloat(\n\t\tctx.targetWidth !== 'none' ? ctx.targetWidth : naturalWidth\n\t);\n\tlet imgMaxHeight = parseFloat(\n\t\tctx.targetHeight !== 'none' ? ctx.targetHeight : naturalHeight\n\t);\n\n\t// Ratio of the biggest image stored in the database.\n\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\tlet containerMaxWidth = imgMaxWidth;\n\tlet containerMaxHeight = imgMaxHeight;\n\tlet containerWidth = imgMaxWidth;\n\tlet containerHeight = imgMaxHeight;\n\t// Check if the target image has a different ratio than the original one (thumbnail).\n\t// Recalculate the width and height.\n\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t// If the width is reached before the height, we keep the maxWidth\n\t\t\t// and recalculate the height.\n\t\t\t// Unless the difference between the maxHeight and the reducedHeight\n\t\t\t// is higher than the maxWidth, where we keep the reducedHeight and\n\t\t\t// recalculate the width.\n\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t}\n\t\t} else {\n\t\t\t// If the height is reached before the width, we keep the maxHeight\n\t\t\t// and recalculate the width.\n\t\t\t// Unless the difference between the maxWidth and the reducedWidth\n\t\t\t// is higher than the maxHeight, where we keep the reducedWidth and\n\t\t\t// recalculate the height.\n\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t}\n\t\t}\n\t\tcontainerWidth = imgMaxWidth;\n\t\tcontainerHeight = imgMaxHeight;\n\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t// Calculate the max size of the container.\n\t\tif ( originalRatio > imgRatio ) {\n\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t} else {\n\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t}\n\t}\n\n\t// If the image has been pixelated on purpose, keep that size.\n\tif ( originalWidth > containerWidth || originalHeight > containerHeight ) {\n\t\tcontainerWidth = originalWidth;\n\t\tcontainerHeight = originalHeight;\n\t}\n\n\t// Calculate the final lightbox image size and the\n\t// scale factor. MaxWidth is either the window container\n\t// (accounting for padding) or the image resolution.\n\tlet horizontalPadding = 0;\n\tif ( window.innerWidth > 480 ) {\n\t\thorizontalPadding = 80;\n\t} else if ( window.innerWidth > 1920 ) {\n\t\thorizontalPadding = 160;\n\t}\n\tconst verticalPadding = 80;\n\n\tconst targetMaxWidth = Math.min(\n\t\twindow.innerWidth - horizontalPadding,\n\t\tcontainerWidth\n\t);\n\tconst targetMaxHeight = Math.min(\n\t\twindow.innerHeight - verticalPadding,\n\t\tcontainerHeight\n\t);\n\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\tif ( originalRatio > targetContainerRatio ) {\n\t\t// If targetMaxWidth is reached before targetMaxHeight\n\t\tcontainerWidth = targetMaxWidth;\n\t\tcontainerHeight = containerWidth / originalRatio;\n\t} else {\n\t\t// If targetMaxHeight is reached before targetMaxWidth\n\t\tcontainerHeight = targetMaxHeight;\n\t\tcontainerWidth = containerHeight * originalRatio;\n\t}\n\n\tconst containerScale = originalWidth / containerWidth;\n\tconst lightboxImgWidth =\n\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\tconst lightboxImgHeight =\n\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t// Add the CSS variables needed.\n\tlet styleTag = document.getElementById( 'wp-lightbox-styles' );\n\tif ( ! styleTag ) {\n\t\tstyleTag = document.createElement( 'style' );\n\t\tstyleTag.id = 'wp-lightbox-styles';\n\t\tdocument.head.appendChild( styleTag );\n\t}\n\n\t// As of this writing, using the calculations above will render the lightbox\n\t// with a small, erroneous whitespace on the left side of the image in iOS Safari,\n\t// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS\n\t// transformation. In any case, adding 1 pixel to the container width and height solves\n\t// the problem, though this can be removed if the issue is fixed in the future.\n\tstyleTag.innerHTML = `\n\t\t:root {\n\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t}px;\n\t\t}\n\t`;\n}\n\n/**\n * Debounces a function call.\n *\n * @function\n * @param {Function} func - A function to be called\n * @param {number} wait - The time to wait before calling the function\n */\nfunction debounce( func, wait = 50 ) {\n\tlet timeout;\n\treturn () => {\n\t\tconst later = () => {\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tclearTimeout( timeout );\n\t\ttimeout = setTimeout( later, wait );\n\t};\n}\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,YAAY,EACZ,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C,EAC3C,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,iCAAiC,CACjC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,cAAc;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,KAAK;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,aAAa,GAAG,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAYA,CAAEC,GAAG,EAAG;EAC5B;EACA;EACA;EACA,IAAK,CAAEH,UAAU,IAAII,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGJ,aAAa,GAAG,GAAG,EAAG;IACvD;IACA;IACAK,MAAM,CAACC,QAAQ,CAAEJ,GAAG,CAACK,eAAe,EAAEL,GAAG,CAACM,cAAe,CAAC;EAC3D;AACD;AAEA,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CAA2CjC,UAAY;AACvD,2CAA4CF,UAAY;AACxD,qCAAsCc,cAAc,GAAG,CAAG;AAC1D,sCAAuCC,eAAe,GAAG,CAAG;AAC5D,iCAAkCY,gBAAkB;AACpD,kCAAmCC,iBAAmB;AACtD,2BAA4BF,cAAgB;AAC5C,qCACI/H,MAAM,CAACS,UAAU,GAAGgB,QAAQ,CAACO,eAAe,CAAC2C,WAC7C;AACJ;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASsB,QAAQA,CAAEwC,IAAI,EAAEC,IAAI,GAAG,EAAE,EAAG;EACpC,IAAIC,OAAO;EACX,OAAO,MAAM;IACZ,MAAMC,KAAK,GAAGA,CAAA,KAAM;MACnBD,OAAO,GAAG,IAAI;MACdF,IAAI,CAAC,CAAC;IACP,CAAC;IACDI,YAAY,CAAEF,OAAQ,CAAC;IACvBA,OAAO,GAAGnG,UAAU,CAAEoG,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
@@ -61,18 +61,6 @@ function useMigrateOnLoad(attributes, clientId) {
61
61
  }, [attributes.values]);
62
62
  }
63
63
  function useOutdentList(clientId) {
64
- const {
65
- canOutdent
66
- } = (0, _data.useSelect)(innerSelect => {
67
- const {
68
- getBlockRootClientId,
69
- getBlock
70
- } = innerSelect(_blockEditor.store);
71
- const parentId = getBlockRootClientId(clientId);
72
- return {
73
- canOutdent: !!parentId && getBlock(parentId).name === 'core/list-item'
74
- };
75
- }, [clientId]);
76
64
  const {
77
65
  replaceBlocks,
78
66
  selectionChange
@@ -82,7 +70,7 @@ function useOutdentList(clientId) {
82
70
  getBlockAttributes,
83
71
  getBlock
84
72
  } = (0, _data.useSelect)(_blockEditor.store);
85
- return [canOutdent, (0, _element.useCallback)(() => {
73
+ return (0, _element.useCallback)(() => {
86
74
  const parentBlockId = getBlockRootClientId(clientId);
87
75
  const parentBlockAttributes = getBlockAttributes(parentBlockId);
88
76
  // Create a new parent block without the inner blocks.
@@ -95,12 +83,19 @@ function useOutdentList(clientId) {
95
83
  replaceBlocks([parentBlockId], [newParentBlock, ...innerBlocks]);
96
84
  // Select the last child of the list being outdent.
97
85
  selectionChange(innerBlocks[innerBlocks.length - 1].clientId);
98
- }, [clientId])];
86
+ }, [clientId]);
99
87
  }
100
88
  function IndentUI({
101
89
  clientId
102
90
  }) {
103
- const [canOutdent, outdentList] = useOutdentList(clientId);
91
+ const outdentList = useOutdentList(clientId);
92
+ const canOutdent = (0, _data.useSelect)(select => {
93
+ const {
94
+ getBlockRootClientId,
95
+ getBlockName
96
+ } = select(_blockEditor.store);
97
+ return getBlockName(getBlockRootClientId(clientId)) === 'core/list-item';
98
+ }, [clientId]);
104
99
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarButton, {
105
100
  icon: (0, _i18n.isRTL)() ? _icons.formatOutdentRTL : _icons.formatOutdent,
106
101
  title: (0, _i18n.__)('Outdent'),
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_components","_data","_i18n","_icons","_blocks","_element","_deprecated","_interopRequireDefault","_orderedListSettings","_utils","_tagName","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","useRegistry","updateBlockAttributes","replaceInnerBlocks","useDispatch","blockEditorStore","useEffect","values","newAttributes","newInnerBlocks","migrateToListV2","deprecated","since","version","alternative","batch","useOutdentList","canOutdent","useSelect","innerSelect","getBlockRootClientId","getBlock","parentId","name","replaceBlocks","selectionChange","getBlockAttributes","useCallback","parentBlockId","parentBlockAttributes","newParentBlock","createBlock","innerBlocks","length","IndentUI","outdentList","_react","createElement","Fragment","ToolbarButton","icon","isRTL","formatOutdentRTL","formatOutdent","title","__","describedBy","disabled","onClick","Edit","setAttributes","style","ordered","type","reversed","start","blockProps","useBlockProps","Platform","isNative","listStyleType","undefined","innerBlocksProps","useInnerBlocksProps","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","__experimentalCaptureToolbars","controls","BlockControls","group","formatListBulletsRTL","formatListBullets","isActive","formatListNumberedRTL","formatListNumbered","default"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId, getBlock } =\n\t\t\t\tinnerSelect( blockEditorStore );\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tcanOutdent:\n\t\t\t\t\t!! parentId &&\n\t\t\t\t\tgetBlock( parentId ).name === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( () => {\n\t\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t\t// Create a new parent block without the inner blocks.\n\t\t\tconst newParentBlock = createBlock(\n\t\t\t\t'core/list-item',\n\t\t\t\tparentBlockAttributes\n\t\t\t);\n\t\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t\t// and make the inner blocks siblings of the parent.\n\t\t\treplaceBlocks(\n\t\t\t\t[ parentBlockId ],\n\t\t\t\t[ newParentBlock, ...innerBlocks ]\n\t\t\t);\n\t\t\t// Select the last child of the list being outdent.\n\t\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t\t}, [ clientId ] ),\n\t];\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst [ canOutdent, outdentList ] = useOutdentList( clientId );\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst { ordered, type, reversed, start } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tstyle: {\n\t\t\t...( Platform.isNative && style ),\n\t\t\tlistStyleType: ordered && type !== 'decimal' ? type : undefined,\n\t\t},\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list-item' ],\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\treversed,\n\t\t\t\t\t\tstart,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAQA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAC,sBAAA,CAAAR,OAAA;AAKA,IAAAS,oBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAH,sBAAA,CAAAR,OAAA;AA7BA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA,MAAMY,QAAQ,GAAG,CAAE,CAAE,gBAAgB,CAAE,CAAE;AACzC,MAAMC,qBAAqB,GAAG,CAAC;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAEC,UAAU,EAAEC,QAAQ,EAAG;EACjD,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC,qBAAqB;IAAEC;EAAmB,CAAC,GAClD,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAEhC,IAAAC,kBAAS,EAAE,MAAM;IAChB;;IAEA,IAAK,CAAER,UAAU,CAACS,MAAM,EAAG;MAC1B;IACD;IAEA,MAAM,CAAEC,aAAa,EAAEC,cAAc,CAAE,G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AA,KAAM;MACfE,aAAa,CAAE;QAAEE,OAAO,EAAE;MAAK,CAAE,CAAC;IACnC;EAAG,CACH,CAAC,EACF,IAAAhB,MAAA,CAAAC,aAAA,EAACH,QAAQ;IAACnC,QAAQ,EAAGA;EAAU,CAAE,CACnB,CACf;EAED,OACC,IAAAqC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAC3C,QAAA,CAAAsF,OAAO;IACP5B,OAAO,EAAGA,OAAS;IACnBE,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAO;IAAA,GACVO;EAAgB,CACrB,CAAC,EACAU,QAAQ,EACRpB,OAAO,IACR,IAAAhB,MAAA,CAAAC,aAAA,EAAC7C,oBAAA,CAAAwF,OAAmB;IAElB9B,aAAa;IACbI,QAAQ;IACRC,KAAK;IACLF;EAAI,CAEL,CAED,CAAC;AAEL"}
1
+ {"version":3,"names":["_blockEditor","require","_components","_data","_i18n","_icons","_blocks","_element","_deprecated","_interopRequireDefault","_orderedListSettings","_utils","_tagName","TEMPLATE","NATIVE_MARGIN_SPACING","useMigrateOnLoad","attributes","clientId","registry","useRegistry","updateBlockAttributes","replaceInnerBlocks","useDispatch","blockEditorStore","useEffect","values","newAttributes","newInnerBlocks","migrateToListV2","deprecated","since","version","alternative","batch","useOutdentList","replaceBlocks","selectionChange","getBlockRootClientId","getBlockAttributes","getBlock","useSelect","useCallback","parentBlockId","parentBlockAttributes","newParentBlock","createBlock","innerBlocks","length","IndentUI","outdentList","canOutdent","select","getBlockName","_react","createElement","Fragment","ToolbarButton","icon","isRTL","formatOutdentRTL","formatOutdent","title","__","describedBy","disabled","onClick","Edit","setAttributes","style","ordered","type","reversed","start","blockProps","useBlockProps","Platform","isNative","listStyleType","undefined","innerBlocksProps","useInnerBlocksProps","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","marginVertical","marginHorizontal","renderAppender","__experimentalCaptureToolbars","controls","BlockControls","group","formatListBulletsRTL","formatListBullets","isActive","formatListNumberedRTL","formatListNumbered","default"],"sources":["@wordpress/block-library/src/list/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tformatListBullets,\n\tformatListBulletsRTL,\n\tformatListNumbered,\n\tformatListNumberedRTL,\n\tformatOutdent,\n\tformatOutdentRTL,\n} from '@wordpress/icons';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback, useEffect, Platform } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport OrderedListSettings from './ordered-list-settings';\nimport { migrateToListV2 } from './utils';\nimport TagName from './tag-name';\n\nconst TEMPLATE = [ [ 'core/list-item' ] ];\nconst NATIVE_MARGIN_SPACING = 8;\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old list block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nfunction useMigrateOnLoad( attributes, clientId ) {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.values ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the list block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.values ] );\n}\n\nfunction useOutdentList( clientId ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockAttributes, getBlock } =\n\t\tuseSelect( blockEditorStore );\n\n\treturn useCallback( () => {\n\t\tconst parentBlockId = getBlockRootClientId( clientId );\n\t\tconst parentBlockAttributes = getBlockAttributes( parentBlockId );\n\t\t// Create a new parent block without the inner blocks.\n\t\tconst newParentBlock = createBlock(\n\t\t\t'core/list-item',\n\t\t\tparentBlockAttributes\n\t\t);\n\t\tconst { innerBlocks } = getBlock( clientId );\n\t\t// Replace the parent block with a new parent block without inner blocks,\n\t\t// and make the inner blocks siblings of the parent.\n\t\treplaceBlocks( [ parentBlockId ], [ newParentBlock, ...innerBlocks ] );\n\t\t// Select the last child of the list being outdent.\n\t\tselectionChange( innerBlocks[ innerBlocks.length - 1 ].clientId );\n\t}, [ clientId ] );\n}\n\nfunction IndentUI( { clientId } ) {\n\tconst outdentList = useOutdentList( clientId );\n\tconst canOutdent = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t'core/list-item'\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ outdentList }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function Edit( { attributes, setAttributes, clientId, style } ) {\n\tconst { ordered, type, reversed, start } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tstyle: {\n\t\t\t...( Platform.isNative && style ),\n\t\t\tlistStyleType: ordered && type !== 'decimal' ? type : undefined,\n\t\t},\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list-item' ],\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t...( Platform.isNative && {\n\t\t\tmarginVertical: NATIVE_MARGIN_SPACING,\n\t\t\tmarginHorizontal: NATIVE_MARGIN_SPACING,\n\t\t\trenderAppender: false,\n\t\t} ),\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst controls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListBulletsRTL : formatListBullets }\n\t\t\t\ttitle={ __( 'Unordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to unordered list' ) }\n\t\t\t\tisActive={ ordered === false }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: false } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatListNumberedRTL : formatListNumbered }\n\t\t\t\ttitle={ __( 'Ordered' ) }\n\t\t\t\tdescribedBy={ __( 'Convert to ordered list' ) }\n\t\t\t\tisActive={ ordered === true }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetAttributes( { ordered: true } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<IndentUI clientId={ clientId } />\n\t\t</BlockControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TagName\n\t\t\t\tordered={ ordered }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t/>\n\t\t\t{ controls }\n\t\t\t{ ordered && (\n\t\t\t\t<OrderedListSettings\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tsetAttributes,\n\t\t\t\t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EAAGA,QAAU;IACrBC,KAAK,EAAGA,KAAO;IAAA,GACVO;EAAgB,CACrB,CAAC,EACAU,QAAQ,EACRpB,OAAO,IACR,IAAAhB,MAAA,CAAAC,aAAA,EAAC5C,oBAAA,CAAAuF,OAAmB;IAElB9B,aAAa;IACbI,QAAQ;IACRC,KAAK;IACLF;EAAI,CAEL,CAED,CAAC;AAEL"}
@@ -11,6 +11,7 @@ var _i18n = require("@wordpress/i18n");
11
11
  var _components = require("@wordpress/components");
12
12
  var _icons = require("@wordpress/icons");
13
13
  var _compose = require("@wordpress/compose");
14
+ var _data = require("@wordpress/data");
14
15
  var _hooks = require("./hooks");
15
16
  var _utils = require("./utils");
16
17
  /**
@@ -24,8 +25,22 @@ var _utils = require("./utils");
24
25
  function IndentUI({
25
26
  clientId
26
27
  }) {
27
- const [canIndent, indentListItem] = (0, _hooks.useIndentListItem)(clientId);
28
- const [canOutdent, outdentListItem] = (0, _hooks.useOutdentListItem)(clientId);
28
+ const indentListItem = (0, _hooks.useIndentListItem)(clientId);
29
+ const outdentListItem = (0, _hooks.useOutdentListItem)();
30
+ const {
31
+ canIndent,
32
+ canOutdent
33
+ } = (0, _data.useSelect)(select => {
34
+ const {
35
+ getBlockIndex,
36
+ getBlockRootClientId,
37
+ getBlockName
38
+ } = select(_blockEditor.store);
39
+ return {
40
+ canIndent: getBlockIndex(clientId) > 0,
41
+ canOutdent: getBlockName(getBlockRootClientId(getBlockRootClientId(clientId))) === 'core/list-item'
42
+ };
43
+ }, [clientId]);
29
44
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarButton, {
30
45
  icon: (0, _i18n.isRTL)() ? _icons.formatOutdentRTL : _icons.formatOutdent,
31
46
  title: (0, _i18n.__)('Outdent'),
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_i18n","_components","_icons","_compose","_hooks","_utils","IndentUI","clientId","canIndent","indentListItem","useIndentListItem","canOutdent","outdentListItem","useOutdentListItem","_react","createElement","Fragment","ToolbarButton","icon","isRTL","formatOutdentRTL","formatOutdent","title","__","describedBy","disabled","onClick","formatIndentRTL","formatIndent","isDisabled","ListItemEdit","attributes","setAttributes","onReplace","mergeBlocks","placeholder","content","blockProps","useBlockProps","ref","useCopy","innerBlocksProps","useInnerBlocksProps","allowedBlocks","renderAppender","__unstableDisableDropZone","useEnterRef","useEnter","useSpaceRef","useSpace","onSplit","useSplit","onMerge","useMerge","RichText","useMergeRefs","identifier","tagName","onChange","nextContent","value","blocks","args","convertToListItems","undefined","children","BlockControls","group"],"sources":["@wordpress/block-library/src/list-item/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport {\n\tformatOutdent,\n\tformatOutdentRTL,\n\tformatIndentRTL,\n\tformatIndent,\n} from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseEnter,\n\tuseSpace,\n\tuseIndentListItem,\n\tuseOutdentListItem,\n\tuseSplit,\n\tuseMerge,\n\tuseCopy,\n} from './hooks';\nimport { convertToListItems } from './utils';\n\nexport function IndentUI( { clientId } ) {\n\tconst [ canIndent, indentListItem ] = useIndentListItem( clientId );\n\tconst [ canOutdent, outdentListItem ] = useOutdentListItem( clientId );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ () => outdentListItem() }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatIndentRTL : formatIndent }\n\t\t\t\ttitle={ __( 'Indent' ) }\n\t\t\t\tdescribedBy={ __( 'Indent list item' ) }\n\t\t\t\tisDisabled={ ! canIndent }\n\t\t\t\tonClick={ () => indentListItem() }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function ListItemEdit( {\n\tattributes,\n\tsetAttributes,\n\tonReplace,\n\tclientId,\n\tmergeBlocks,\n} ) {\n\tconst { placeholder, content } = attributes;\n\tconst blockProps = useBlockProps( { ref: useCopy( clientId ) } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list' ],\n\t\trenderAppender: false,\n\t\t__unstableDisableDropZone: true,\n\t} );\n\tconst useEnterRef = useEnter( { content, clientId } );\n\tconst useSpaceRef = useSpace( clientId );\n\tconst onSplit = useSplit( clientId );\n\tconst onMerge = useMerge( clientId, mergeBlocks );\n\treturn (\n\t\t<>\n\t\t\t<li { ...innerBlocksProps }>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ useMergeRefs( [ useEnterRef, useSpaceRef ] ) }\n\t\t\t\t\tidentifier=\"content\"\n\t\t\t\t\ttagName=\"div\"\n\t\t\t\t\tonChange={ ( nextContent ) =>\n\t\t\t\t\t\tsetAttributes( { content: nextContent } )\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\taria-label={ __( 'List text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'List' ) }\n\t\t\t\t\tonSplit={ onSplit }\n\t\t\t\t\tonMerge={ onMerge }\n\t\t\t\t\tonReplace={\n\t\t\t\t\t\tonReplace\n\t\t\t\t\t\t\t? ( blocks, ...args ) => {\n\t\t\t\t\t\t\t\t\tonReplace(\n\t\t\t\t\t\t\t\t\t\tconvertToListItems( blocks ),\n\t\t\t\t\t\t\t\t\t\t...args\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t</li>\n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AK,EAAGxB,OAAS;IACjB,cAAa,IAAAb,QAAE,EAAE,WAAY,CAAG;IAChCY,WAAW,EAAGA,WAAW,IAAI,IAAAZ,QAAE,EAAE,MAAO,CAAG;IAC3C2B,OAAO,EAAGA,OAAS;IACnBE,OAAO,EAAGA,OAAS;IACnBnB,SAAS,EACRA,SAAS,GACN,CAAE4B,MAAM,EAAE,GAAGC,IAAI,KAAM;MACvB7B,SAAS,CACR,IAAA8B,yBAAkB,EAAEF,MAAO,CAAC,EAC5B,GAAGC,IACJ,CAAC;IACD,CAAC,GACDE;EACH,CACD,CAAC,EACAvB,gBAAgB,CAACwB,QAChB,CAAC,EACL,IAAAnD,MAAA,CAAAC,aAAA,EAACjB,YAAA,CAAAoE,aAAa;IAACC,KAAK,EAAC;EAAO,GAC3B,IAAArD,MAAA,CAAAC,aAAA,EAACT,QAAQ;IAACC,QAAQ,EAAGA;EAAU,CAAE,CACnB,CACd,CAAC;AAEL"}
1
+ {"version":3,"names":["_blockEditor","require","_i18n","_components","_icons","_compose","_data","_hooks","_utils","IndentUI","clientId","indentListItem","useIndentListItem","outdentListItem","useOutdentListItem","canIndent","canOutdent","useSelect","select","getBlockIndex","getBlockRootClientId","getBlockName","blockEditorStore","_react","createElement","Fragment","ToolbarButton","icon","isRTL","formatOutdentRTL","formatOutdent","title","__","describedBy","disabled","onClick","formatIndentRTL","formatIndent","isDisabled","ListItemEdit","attributes","setAttributes","onReplace","mergeBlocks","placeholder","content","blockProps","useBlockProps","ref","useCopy","innerBlocksProps","useInnerBlocksProps","allowedBlocks","renderAppender","__unstableDisableDropZone","useEnterRef","useEnter","useSpaceRef","useSpace","onSplit","useSplit","onMerge","useMerge","RichText","useMergeRefs","identifier","tagName","onChange","nextContent","value","blocks","args","convertToListItems","undefined","children","BlockControls","group"],"sources":["@wordpress/block-library/src/list-item/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport {\n\tformatOutdent,\n\tformatOutdentRTL,\n\tformatIndentRTL,\n\tformatIndent,\n} from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseEnter,\n\tuseSpace,\n\tuseIndentListItem,\n\tuseOutdentListItem,\n\tuseSplit,\n\tuseMerge,\n\tuseCopy,\n} from './hooks';\nimport { convertToListItems } from './utils';\n\nexport function IndentUI( { clientId } ) {\n\tconst indentListItem = useIndentListItem( clientId );\n\tconst outdentListItem = useOutdentListItem();\n\tconst { canIndent, canOutdent } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tcanIndent: getBlockIndex( clientId ) > 0,\n\t\t\t\tcanOutdent:\n\t\t\t\t\tgetBlockName(\n\t\t\t\t\t\tgetBlockRootClientId( getBlockRootClientId( clientId ) )\n\t\t\t\t\t) === 'core/list-item',\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatOutdentRTL : formatOutdent }\n\t\t\t\ttitle={ __( 'Outdent' ) }\n\t\t\t\tdescribedBy={ __( 'Outdent list item' ) }\n\t\t\t\tdisabled={ ! canOutdent }\n\t\t\t\tonClick={ () => outdentListItem() }\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ isRTL() ? formatIndentRTL : formatIndent }\n\t\t\t\ttitle={ __( 'Indent' ) }\n\t\t\t\tdescribedBy={ __( 'Indent list item' ) }\n\t\t\t\tisDisabled={ ! canIndent }\n\t\t\t\tonClick={ () => indentListItem() }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default function ListItemEdit( {\n\tattributes,\n\tsetAttributes,\n\tonReplace,\n\tclientId,\n\tmergeBlocks,\n} ) {\n\tconst { placeholder, content } = attributes;\n\tconst blockProps = useBlockProps( { ref: useCopy( clientId ) } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: [ 'core/list' ],\n\t\trenderAppender: false,\n\t\t__unstableDisableDropZone: true,\n\t} );\n\tconst useEnterRef = useEnter( { content, clientId } );\n\tconst useSpaceRef = useSpace( clientId );\n\tconst onSplit = useSplit( clientId );\n\tconst onMerge = useMerge( clientId, mergeBlocks );\n\treturn (\n\t\t<>\n\t\t\t<li { ...innerBlocksProps }>\n\t\t\t\t<RichText\n\t\t\t\t\tref={ useMergeRefs( [ useEnterRef, useSpaceRef ] ) }\n\t\t\t\t\tidentifier=\"content\"\n\t\t\t\t\ttagName=\"div\"\n\t\t\t\t\tonChange={ ( nextContent ) =>\n\t\t\t\t\t\tsetAttributes( { content: nextContent } )\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\taria-label={ __( 'List text' ) }\n\t\t\t\t\tplaceholder={ placeholder || __( 'List' ) }\n\t\t\t\t\tonSplit={ onSplit }\n\t\t\t\t\tonMerge={ onMerge }\n\t\t\t\t\tonReplace={\n\t\t\t\t\t\tonReplace\n\t\t\t\t\t\t\t? ( blocks, ...args ) => {\n\t\t\t\t\t\t\t\t\tonReplace(\n\t\t\t\t\t\t\t\t\t\tconvertToListItems( blocks ),\n\t\t\t\t\t\t\t\t\t\t...args\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t</li>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<IndentUI clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAA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B,YAAA,CAAA+D,QAAQ;IACRf,GAAG,EAAG,IAAAgB,qBAAY,EAAE,CAAET,WAAW,EAAEE,WAAW,CAAG,CAAG;IACpDQ,UAAU,EAAC,SAAS;IACpBC,OAAO,EAAC,KAAK;IACbC,QAAQ,EAAKC,WAAW,IACvB3B,aAAa,CAAE;MAAEI,OAAO,EAAEuB;IAAY,CAAE,CACxC;IACDC,KAAK,EAAGxB,OAAS;IACjB,cAAa,IAAAb,QAAE,EAAE,WAAY,CAAG;IAChCY,WAAW,EAAGA,WAAW,IAAI,IAAAZ,QAAE,EAAE,MAAO,CAAG;IAC3C2B,OAAO,EAAGA,OAAS;IACnBE,OAAO,EAAGA,OAAS;IACnBnB,SAAS,EACRA,SAAS,GACN,CAAE4B,MAAM,EAAE,GAAGC,IAAI,KAAM;MACvB7B,SAAS,CACR,IAAA8B,yBAAkB,EAAEF,MAAO,CAAC,EAC5B,GAAGC,IACJ,CAAC;IACD,CAAC,GACDE;EACH,CACD,CAAC,EACAvB,gBAAgB,CAACwB,QAChB,CAAC,EACL,IAAAnD,MAAA,CAAAC,aAAA,EAACxB,YAAA,CAAA2E,aAAa;IAACC,KAAK,EAAC;EAAO,GAC3B,IAAArD,MAAA,CAAAC,aAAA,EAACf,QAAQ;IAACC,QAAQ,EAAGA;EAAU,CAAE,CACnB,CACd,CAAC;AAEL"}
@@ -28,11 +28,12 @@ function useEnter(props) {
28
28
  const {
29
29
  getBlock,
30
30
  getBlockRootClientId,
31
- getBlockIndex
31
+ getBlockIndex,
32
+ getBlockName
32
33
  } = (0, _data.useSelect)(_blockEditor.store);
33
34
  const propsRef = (0, _element.useRef)(props);
34
35
  propsRef.current = props;
35
- const [canOutdent, outdentListItem] = (0, _useOutdentListItem.default)(propsRef.current.clientId);
36
+ const outdentListItem = (0, _useOutdentListItem.default)();
36
37
  return (0, _compose.useRefEffect)(element => {
37
38
  function onKeyDown(event) {
38
39
  if (event.defaultPrevented || event.keyCode !== _keycodes.ENTER) {
@@ -46,6 +47,7 @@ function useEnter(props) {
46
47
  return;
47
48
  }
48
49
  event.preventDefault();
50
+ const canOutdent = getBlockName(getBlockRootClientId(getBlockRootClientId(propsRef.current.clientId))) === 'core/list-item';
49
51
  if (canOutdent) {
50
52
  outdentListItem();
51
53
  return;
@@ -74,6 +76,6 @@ function useEnter(props) {
74
76
  return () => {
75
77
  element.removeEventListener('keydown', onKeyDown);
76
78
  };
77
- }, [canOutdent]);
79
+ }, []);
78
80
  }
79
81
  //# sourceMappingURL=use-enter.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_element","_compose","_keycodes","_data","_blockEditor","_useOutdentListItem","_interopRequireDefault","useEnter","props","replaceBlocks","selectionChange","useDispatch","blockEditorStore","getBlock","getBlockRootClientId","getBlockIndex","useSelect","propsRef","useRef","current","canOutdent","outdentListItem","useOutdentListItem","clientId","useRefEffect","element","onKeyDown","event","defaultPrevented","keyCode","ENTER","content","length","preventDefault","topParentListBlock","blockIndex","head","cloneBlock","innerBlocks","slice","middle","createBlock","getDefaultBlockName","after","tail","addEventListener","removeEventListener"],"sources":["@wordpress/block-library/src/list-item/hooks/use-enter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tcloneBlock,\n} from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useEnter( props ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\tconst [ canOutdent, outdentListItem ] = useOutdentListItem(\n\t\tpropsRef.current.clientId\n\t);\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tfunction onKeyDown( event ) {\n\t\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\t\tif ( content.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( canOutdent ) {\n\t\t\t\t\toutdentListItem();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Here we are in top level list so we need to split.\n\t\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t);\n\t\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\t\tconst head = cloneBlock( {\n\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tblockIndex\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\t\t// Last list item might contain a `list` block innerBlock\n\t\t\t\t// In that case append remaining innerBlocks blocks.\n\t\t\t\tconst after = [\n\t\t\t\t\t...( topParentListBlock.innerBlocks[ blockIndex ]\n\t\t\t\t\t\t.innerBlocks[ 0 ]?.innerBlocks || [] ),\n\t\t\t\t\t...topParentListBlock.innerBlocks.slice( blockIndex + 1 ),\n\t\t\t\t];\n\t\t\t\tconst tail = after.length\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t ]\n\t\t\t\t\t: [];\n\t\t\t\treplaceBlocks(\n\t\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t\t1\n\t\t\t\t);\n\t\t\t\t// We manually change the selection here because we are replacing\n\t\t\t\t// a different block than the selected one.\n\t\t\t\tselectionChange( middle.clientId );\n\t\t\t}\n\n\t\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t\t};\n\t\t},\n\t\t[ canOutdent ]\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,mBAAA,GAAAC,sBAAA,CAAAP,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGe,SAASQ,QAAQA,CAAEC,KAAK,EAAG;EACzC,MAAM;IAAEC,aAAa;IAAEC;EAAgB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAC1E,MAAM;IAAEC,QAAQ;IAAEC,oBAAoB;IAAEC;EAAc,CAAC,GACtD,IAAAC,eAAS,EAAEJ,kBAAiB,CAAC;EAC9B,MAAMK,QAAQ,GAAG,IAAAC,eAAM,EAAEV,KAAM,CAAC;EAChCS,QAAQ,CAACE,OAAO,GAAGX,KAAK;EACxB,MAAM,CAAEY,UAAU,EAAEC,eAAe,CAAE,GAAG,IAAAC,2BAAkB,EACzDL,QAAQ,CAACE,OAAO,CAACI,QAClB,CAAC;EACD,OAAO,IAAAC,qBAAY,EAChBC,OAAO,IAAM;IACd,SAASC,SAASA,CAAEC,KAAK,EAAG;MAC3B,IAAKA,KAAK,CAACC,gBAAgB,IAAID,KAAK,CAACE,OAAO,KAAKC,eAAK,EAAG;QACxD;MACD;MACA,MAAM;QAAEC,OAAO;QAAER;MAAS,CAAC,GAAGN,QAAQ,CAACE,OAAO;MAC9C,IAAKY,OAAO,CAACC,MAAM,EAAG;QACr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AC;AACF"}
1
+ {"version":3,"names":["_blocks","require","_element","_compose","_keycodes","_data","_blockEditor","_useOutdentListItem","_interopRequireDefault","useEnter","props","replaceBlocks","selectionChange","useDispatch","blockEditorStore","getBlock","getBlockRootClientId","getBlockIndex","getBlockName","useSelect","propsRef","useRef","current","outdentListItem","useOutdentListItem","useRefEffect","element","onKeyDown","event","defaultPrevented","keyCode","ENTER","content","clientId","length","preventDefault","canOutdent","topParentListBlock","blockIndex","head","cloneBlock","innerBlocks","slice","middle","createBlock","getDefaultBlockName","after","tail","addEventListener","removeEventListener"],"sources":["@wordpress/block-library/src/list-item/hooks/use-enter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tcloneBlock,\n} from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useEnter( props ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex, getBlockName } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\tconst outdentListItem = useOutdentListItem();\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented || event.keyCode !== ENTER ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tconst canOutdent =\n\t\t\t\tgetBlockName(\n\t\t\t\t\tgetBlockRootClientId(\n\t\t\t\t\t\tgetBlockRootClientId( propsRef.current.clientId )\n\t\t\t\t\t)\n\t\t\t\t) === 'core/list-item';\n\t\t\tif ( canOutdent ) {\n\t\t\t\toutdentListItem();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Here we are in top level list so we need to split.\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\t// Last list item might contain a `list` block innerBlock\n\t\t\t// In that case append remaining innerBlocks blocks.\n\t\t\tconst after = [\n\t\t\t\t...( topParentListBlock.innerBlocks[ blockIndex ]\n\t\t\t\t\t.innerBlocks[ 0 ]?.innerBlocks || [] ),\n\t\t\t\t...topParentListBlock.innerBlocks.slice( blockIndex + 1 ),\n\t\t\t];\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH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AG,IAAAC,kBAAU,EAAE;QACxB,GAAGH,kBAAkB;QACrBI,WAAW,EAAEJ,kBAAkB,CAACI,WAAW,CAACC,KAAK,CAChD,CAAC,EACDJ,UACD;MACD,CAAE,CAAC;MACH,MAAMK,MAAM,GAAG,IAAAC,mBAAW,EAAE,IAAAC,2BAAmB,EAAC,CAAE,CAAC;MACnD;MACA;MACA,MAAMC,KAAK,GAAG,CACb,IAAKT,kBAAkB,CAACI,WAAW,CAAEH,UAAU,CAAE,CAC/CG,WAAW,CAAE,CAAC,CAAE,EAAEA,WAAW,IAAI,EAAE,CAAE,EACvC,GAAGJ,kBAAkB,CAACI,WAAW,CAACC,KAAK,CAAEJ,UAAU,GAAG,CAAE,CAAC,CACzD;MACD,MAAMS,IAAI,GAAGD,KAAK,CAACZ,MAAM,GACtB,CACA,IAAAM,kBAAU,EAAE;QACX,GAAGH,kBAAkB;QACrBI,WAAW,EAAEK;MACd,CAAE,CAAC,CACF,GACD,EAAE;MACLnC,aAAa,CACZ0B,kBAAkB,CAACJ,QAAQ,EAC3B,CAAEM,IAAI,EAAEI,MAAM,EAAE,GAAGI,IAAI,CAAE,EACzB,CACD,CAAC;MACD;MACA;MACAnC,eAAe,CAAE+B,MAAM,CAACV,QAAS,CAAC;IACnC;IAEAP,OAAO,CAACsB,gBAAgB,CAAE,SAAS,EAAErB,SAAU,CAAC;IAChD,OAAO,MAAM;MACZD,OAAO,CAACuB,mBAAmB,CAAE,SAAS,EAAEtB,SAAU,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -26,11 +26,12 @@ function useEnter(props, preventDefault) {
26
26
  const {
27
27
  getBlock,
28
28
  getBlockRootClientId,
29
- getBlockIndex
29
+ getBlockIndex,
30
+ getBlockName
30
31
  } = (0, _data.useSelect)(_blockEditor.store);
31
32
  const propsRef = (0, _element.useRef)(props);
32
33
  propsRef.current = props;
33
- const [canOutdent, outdentListItem] = (0, _useOutdentListItem.default)(propsRef.current.clientId);
34
+ const outdentListItem = (0, _useOutdentListItem.default)();
34
35
  return {
35
36
  onEnter() {
36
37
  const {
@@ -41,7 +42,7 @@ function useEnter(props, preventDefault) {
41
42
  return;
42
43
  }
43
44
  preventDefault.current = true;
44
- if (canOutdent) {
45
+ if (getBlockName(getBlockRootClientId(getBlockRootClientId(propsRef.current.clientId))) === 'core/list-item') {
45
46
  outdentListItem();
46
47
  return;
47
48
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_element","_data","_blockEditor","_useOutdentListItem","_interopRequireDefault","useEnter","props","preventDefault","replaceBlocks","selectionChange","useDispatch","blockEditorStore","getBlock","getBlockRootClientId","getBlockIndex","useSelect","propsRef","useRef","current","canOutdent","outdentListItem","useOutdentListItem","clientId","onEnter","content","length","topParentListBlock","blockIndex","head","cloneBlock","innerBlocks","slice","middle","createBlock","getDefaultBlockName","after","tail"],"sources":["@wordpress/block-library/src/list-item/hooks/use-enter.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tcloneBlock,\n} from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useEnter( props, preventDefault ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\tconst [ canOutdent, outdentListItem ] = useOutdentListItem(\n\t\tpropsRef.current.clientId\n\t);\n\n\treturn {\n\t\tonEnter() {\n\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpreventDefault.current = true;\n\t\t\tif ( canOutdent ) {\n\t\t\t\toutdentListItem();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Here we are in top level list so we need to split.\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\t// Last list item might contain a `list` block innerBlock\n\t\t\t// In that case append remaining innerBlocks blocks.\n\t\t\tconst after = [\n\t\t\t\t...( topParentListBlock.innerBlocks[ blockIndex ]\n\t\t\t\t\t.innerBlocks[ 0 ]?.innerBlocks || [] ),\n\t\t\t\t...topParentListBlock.innerBlocks.slice( blockIndex + 1 ),\n\t\t\t];\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGe,SAASM,QAAQA,CAAEC,KAAK,EAAEC,cAAc,EAAG;EACzD,MAAM;IAAEC,a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AE,CAAC,CACzD;MACD,MAAMS,IAAI,GAAGD,KAAK,CAACV,MAAM,GACtB,CACA,IAAAI,kBAAU,EAAE;QACX,GAAGH,kBAAkB;QACrBI,WAAW,EAAEK;MACd,CAAE,CAAC,CACF,GACD,EAAE;MACL3B,aAAa,CACZkB,kBAAkB,CAACJ,QAAQ,EAC3B,CAAEM,IAAI,EAAEI,MAAM,EAAE,GAAGI,IAAI,CAAE,EACzB,CACD,CAAC;MACD;MACA;MACA3B,eAAe,CAAEuB,MAAM,CAACV,QAAS,CAAC;IACnC;EACD,CAAC;AACF"}
1
+ {"version":3,"names":["_blocks","require","_element","_data","_blockEditor","_useOutdentListItem","_interopRequireDefault","useEnter","props","preventDefault","replaceBlocks","selectionChange","useDispatch","blockEditorStore","getBlock","getBlockRootClientId","getBlockIndex","getBlockName","useSelect","propsRef","useRef","current","outdentListItem","useOutdentListItem","onEnter","content","clientId","length","topParentListBlock","blockIndex","head","cloneBlock","innerBlocks","slice","middle","createBlock","getDefaultBlockName","after","tail"],"sources":["@wordpress/block-library/src/list-item/hooks/use-enter.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\tcloneBlock,\n} from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useEnter( props, preventDefault ) {\n\tconst { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );\n\tconst { getBlock, getBlockRootClientId, getBlockIndex, getBlockName } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\tconst outdentListItem = useOutdentListItem();\n\n\treturn {\n\t\tonEnter() {\n\t\t\tconst { content, clientId } = propsRef.current;\n\t\t\tif ( content.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpreventDefault.current = true;\n\t\t\tif (\n\t\t\t\tgetBlockName(\n\t\t\t\t\tgetBlockRootClientId(\n\t\t\t\t\t\tgetBlockRootClientId( propsRef.current.clientId )\n\t\t\t\t\t)\n\t\t\t\t) === 'core/list-item'\n\t\t\t) {\n\t\t\t\toutdentListItem();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Here we are in top level list so we need to split.\n\t\t\tconst topParentListBlock = getBlock(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\tconst blockIndex = getBlockIndex( clientId );\n\t\t\tconst head = cloneBlock( {\n\t\t\t\t...topParentListBlock,\n\t\t\t\tinnerBlocks: topParentListBlock.innerBlocks.slice(\n\t\t\t\t\t0,\n\t\t\t\t\tblockIndex\n\t\t\t\t),\n\t\t\t} );\n\t\t\tconst middle = createBlock( getDefaultBlockName() );\n\t\t\t// Last list item might contain a `list` block innerBlock\n\t\t\t// In that case append remaining innerBlocks blocks.\n\t\t\tconst after = [\n\t\t\t\t...( topParentListBlock.innerBlocks[ blockIndex ]\n\t\t\t\t\t.innerBlocks[ 0 ]?.innerBlocks || [] ),\n\t\t\t\t...topParentListBlock.innerBlocks.slice( blockIndex + 1 ),\n\t\t\t];\n\t\t\tconst tail = after.length\n\t\t\t\t? [\n\t\t\t\t\t\tcloneBlock( {\n\t\t\t\t\t\t\t...topParentListBlock,\n\t\t\t\t\t\t\tinnerBlocks: after,\n\t\t\t\t\t\t} ),\n\t\t\t\t ]\n\t\t\t\t: [];\n\t\t\treplaceBlocks(\n\t\t\t\ttopParentListBlock.clientId,\n\t\t\t\t[ head, middle, ...tail ],\n\t\t\t\t1\n\t\t\t);\n\t\t\t// We manually change the selection here because we are replacing\n\t\t\t// a different block than the selected one.\n\t\t\tselectionChange( middle.clientId );\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OA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BAAmB,EAAC,CAAE,CAAC;MACnD;MACA;MACA,MAAMC,KAAK,GAAG,CACb,IAAKT,kBAAkB,CAACI,WAAW,CAAEH,UAAU,CAAE,CAC/CG,WAAW,CAAE,CAAC,CAAE,EAAEA,WAAW,IAAI,EAAE,CAAE,EACvC,GAAGJ,kBAAkB,CAACI,WAAW,CAACC,KAAK,CAAEJ,UAAU,GAAG,CAAE,CAAC,CACzD;MACD,MAAMS,IAAI,GAAGD,KAAK,CAACV,MAAM,GACtB,CACA,IAAAI,kBAAU,EAAE;QACX,GAAGH,kBAAkB;QACrBI,WAAW,EAAEK;MACd,CAAE,CAAC,CACF,GACD,EAAE;MACL3B,aAAa,CACZkB,kBAAkB,CAACF,QAAQ,EAC3B,CAAEI,IAAI,EAAEI,MAAM,EAAE,GAAGI,IAAI,CAAE,EACzB,CACD,CAAC;MACD;MACA;MACA3B,eAAe,CAAEuB,MAAM,CAACR,QAAS,CAAC;IACnC;EACD,CAAC;AACF"}
@@ -13,7 +13,6 @@ var _blocks = require("@wordpress/blocks");
13
13
  */
14
14
 
15
15
  function useIndentListItem(clientId) {
16
- const canIndent = (0, _data.useSelect)(select => select(_blockEditor.store).getBlockIndex(clientId) > 0, [clientId]);
17
16
  const {
18
17
  replaceBlocks,
19
18
  selectionChange,
@@ -27,7 +26,7 @@ function useIndentListItem(clientId) {
27
26
  hasMultiSelection,
28
27
  getMultiSelectedBlockClientIds
29
28
  } = (0, _data.useSelect)(_blockEditor.store);
30
- return [canIndent, (0, _element.useCallback)(() => {
29
+ return (0, _element.useCallback)(() => {
31
30
  const _hasMultiSelection = hasMultiSelection();
32
31
  const clientIds = _hasMultiSelection ? getMultiSelectedBlockClientIds() : [clientId];
33
32
  const clonedBlocks = clientIds.map(_clientId => (0, _blocks.cloneBlock)(getBlock(_clientId)));
@@ -55,6 +54,6 @@ function useIndentListItem(clientId) {
55
54
  } else {
56
55
  multiSelect(clonedBlocks[0].clientId, clonedBlocks[clonedBlocks.length - 1].clientId);
57
56
  }
58
- }, [clientId])];
57
+ }, [clientId]);
59
58
  }
60
59
  //# sourceMappingURL=use-indent-list-item.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_blockEditor","_blocks","useIndentListItem","clientId","canIndent","useSelect","select","blockEditorStore","getBlockIndex","replaceBlocks","selectionChange","multiSelect","useDispatch","getBlock","getPreviousBlockClientId","getSelectionStart","getSelectionEnd","hasMultiSelection","getMultiSelectedBlockClientIds","useCallback","_hasMultiSelection","clientIds","clonedBlocks","map","_clientId","cloneBlock","previousSiblingId","newListItem","innerBlocks","length","createBlock","push","selectionStart","selectionEnd","attributeKey","offset"],"sources":["@wordpress/block-library/src/list-item/hooks/use-indent-list-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock, cloneBlock } from '@wordpress/blocks';\n\nexport default function useIndentListItem( clientId ) {\n\tconst canIndent = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockIndex( clientId ) > 0,\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, selectionChange, multiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlock,\n\t\tgetPreviousBlockClientId,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\thasMultiSelection,\n\t\tgetMultiSelectedBlockClientIds,\n\t} = useSelect( blockEditorStore );\n\treturn [\n\t\tcanIndent,\n\t\tuseCallback( () => {\n\t\t\tconst _hasMultiSelection = hasMultiSelection();\n\t\t\tconst clientIds = _hasMultiSelection\n\t\t\t\t? getMultiSelectedBlockClientIds()\n\t\t\t\t: [ clientId ];\n\t\t\tconst clonedBlocks = clientIds.map( ( _clientId ) =>\n\t\t\t\tcloneBlock( getBlock( _clientId ) )\n\t\t\t);\n\t\t\tconst previousSiblingId = getPreviousBlockClientId( clientId );\n\t\t\tconst newListItem = cloneBlock( getBlock( previousSiblingId ) );\n\t\t\t// If the sibling has no innerBlocks, create a new `list` block.\n\t\t\tif ( ! newListItem.innerBlocks?.length ) {\n\t\t\t\tnewListItem.innerBlocks = [ createBlock( 'core/list' ) ];\n\t\t\t}\n\t\t\t// A list item usually has one `list`, but it's possible to have\n\t\t\t// more. So we need to preserve the previous `list` blocks and\n\t\t\t// merge the new blocks to the last `list`.\n\t\t\tnewListItem.innerBlocks[\n\t\t\t\tnewListItem.innerBlocks.length - 1\n\t\t\t].innerBlocks.push( ...clonedBlocks );\n\n\t\t\t// We get the selection start/end here, because when\n\t\t\t// we replace blocks, the selection is updated too.\n\t\t\tconst selectionStart = getSelectionStart();\n\t\t\tconst selectionEnd = getSelectionEnd();\n\t\t\t// Replace the previous sibling of the block being indented and the indented blocks,\n\t\t\t// with a new block whose attributes are equal to the ones of the previous sibling and\n\t\t\t// whose descendants are the children of the previous sibling, followed by the indented blocks.\n\t\t\treplaceBlocks(\n\t\t\t\t[ previousSiblingId, ...clientIds ],\n\t\t\t\t[ newListItem ]\n\t\t\t);\n\t\t\tif ( ! _hasMultiSelection ) {\n\t\t\t\tselectionChange(\n\t\t\t\t\tclonedBlocks[ 0 ].clientId,\n\t\t\t\t\tselectionEnd.attributeKey,\n\t\t\t\t\tselectionEnd.clientId === selectionStart.clientId\n\t\t\t\t\t\t? selectionStart.offset\n\t\t\t\t\t\t: selectionEnd.offset,\n\t\t\t\t\tselectionEnd.offset\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmultiSelect(\n\t\t\t\t\tclonedBlocks[ 0 ].clientId,\n\t\t\t\t\tclonedBlocks[ clonedBlocks.length - 1 ].clientId\n\t\t\t\t);\n\t\t\t}\n\t\t}, [ clientId ] ),\n\t];\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AAC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GAAGjB,iBAAiB,CAAC,CAAC;IAC1C,MAAMkB,YAAY,GAAGjB,eAAe,CAAC,CAAC;IACtC;IACA;IACA;IACAP,aAAa,CACZ,CAAEiB,iBAAiB,EAAE,GAAGL,SAAS,CAAE,EACnC,CAAEM,WAAW,CACd,CAAC;IACD,IAAK,CAAEP,kBAAkB,EAAG;MAC3BV,eAAe,CACdY,YAAY,CAAE,CAAC,CAAE,CAACnB,QAAQ,EAC1B8B,YAAY,CAACC,YAAY,EACzBD,YAAY,CAAC9B,QAAQ,KAAK6B,cAAc,CAAC7B,QAAQ,GAC9C6B,cAAc,CAACG,MAAM,GACrBF,YAAY,CAACE,MAAM,EACtBF,YAAY,CAACE,MACd,CAAC;IACF,CAAC,MAAM;MACNxB,WAAW,CACVW,YAAY,CAAE,CAAC,CAAE,CAACnB,QAAQ,EAC1BmB,YAAY,CAAEA,YAAY,CAACO,MAAM,GAAG,CAAC,CAAE,CAAC1B,QACzC,CAAC;IACF;EACD,CAAC,EAAE,CAAEA,QAAQ,CAAG,CAAC,CACjB;AACF"}
1
+ {"version":3,"names":["_element","require","_data","_blockEditor","_blocks","useIndentListItem","clientId","replaceBlocks","selectionChange","multiSelect","useDispatch","blockEditorStore","getBlock","getPreviousBlockClientId","getSelectionStart","getSelectionEnd","hasMultiSelection","getMultiSelectedBlockClientIds","useSelect","useCallback","_hasMultiSelection","clientIds","clonedBlocks","map","_clientId","cloneBlock","previousSiblingId","newListItem","innerBlocks","length","createBlock","push","selectionStart","selectionEnd","attributeKey","offset"],"sources":["@wordpress/block-library/src/list-item/hooks/use-indent-list-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock, cloneBlock } from '@wordpress/blocks';\n\nexport default function useIndentListItem( clientId ) {\n\tconst { replaceBlocks, selectionChange, multiSelect } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlock,\n\t\tgetPreviousBlockClientId,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\thasMultiSelection,\n\t\tgetMultiSelectedBlockClientIds,\n\t} = useSelect( blockEditorStore );\n\treturn useCallback( () => {\n\t\tconst _hasMultiSelection = hasMultiSelection();\n\t\tconst clientIds = _hasMultiSelection\n\t\t\t? getMultiSelectedBlockClientIds()\n\t\t\t: [ clientId ];\n\t\tconst clonedBlocks = clientIds.map( ( _clientId ) =>\n\t\t\tcloneBlock( getBlock( _clientId ) )\n\t\t);\n\t\tconst previousSiblingId = getPreviousBlockClientId( clientId );\n\t\tconst newListItem = cloneBlock( getBlock( previousSiblingId ) );\n\t\t// If the sibling has no innerBlocks, create a new `list` block.\n\t\tif ( ! newListItem.innerBlocks?.length ) {\n\t\t\tnewListItem.innerBlocks = [ createBlock( 'core/list' ) ];\n\t\t}\n\t\t// A list item usually has one `list`, but it's possible to have\n\t\t// more. So we need to preserve the previous `list` blocks and\n\t\t// merge the new blocks to the last `list`.\n\t\tnewListItem.innerBlocks[\n\t\t\tnewListItem.innerBlocks.length - 1\n\t\t].innerBlocks.push( ...clonedBlocks );\n\n\t\t// We get the selection start/end here, because when\n\t\t// we replace blocks, the selection is updated too.\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\t\t// Replace the previous sibling of the block being indented and the indented blocks,\n\t\t// with a new block whose attributes are equal to the ones of the previous sibling and\n\t\t// whose descendants are the children of the previous sibling, followed by the indented blocks.\n\t\treplaceBlocks( [ previousSiblingId, ...clientIds ], [ newListItem ] );\n\t\tif ( ! _hasMultiSelection ) {\n\t\t\tselectionChange(\n\t\t\t\tclonedBlocks[ 0 ].clientId,\n\t\t\t\tselectionEnd.attributeKey,\n\t\t\t\tselectionEnd.clientId === selectionStart.clientId\n\t\t\t\t\t? selectionStart.offset\n\t\t\t\t\t: selectionEnd.offset,\n\t\t\t\tselectionEnd.offset\n\t\t\t);\n\t\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AAW,CAACC,MAAM,GAAG,CAAC,CAClC,CAACD,WAAW,CAACG,IAAI,CAAE,GAAGT,YAAa,CAAC;;IAErC;IACA;IACA,MAAMU,cAAc,GAAGlB,iBAAiB,CAAC,CAAC;IAC1C,MAAMmB,YAAY,GAAGlB,eAAe,CAAC,CAAC;IACtC;IACA;IACA;IACAR,aAAa,CAAE,CAAEmB,iBAAiB,EAAE,GAAGL,SAAS,CAAE,EAAE,CAAEM,WAAW,CAAG,CAAC;IACrE,IAAK,CAAEP,kBAAkB,EAAG;MAC3BZ,eAAe,CACdc,YAAY,CAAE,CAAC,CAAE,CAAChB,QAAQ,EAC1B2B,YAAY,CAACC,YAAY,EACzBD,YAAY,CAAC3B,QAAQ,KAAK0B,cAAc,CAAC1B,QAAQ,GAC9C0B,cAAc,CAACG,MAAM,GACrBF,YAAY,CAACE,MAAM,EACtBF,YAAY,CAACE,MACd,CAAC;IACF,CAAC,MAAM;MACN1B,WAAW,CACVa,YAAY,CAAE,CAAC,CAAE,CAAChB,QAAQ,EAC1BgB,YAAY,CAAEA,YAAY,CAACO,MAAM,GAAG,CAAC,CAAE,CAACvB,QACzC,CAAC;IACF;EACD,CAAC,EAAE,CAAEA,QAAQ,CAAG,CAAC;AAClB"}
@@ -29,7 +29,7 @@ function useMerge(clientId, onMerge) {
29
29
  mergeBlocks,
30
30
  moveBlocksToPosition
31
31
  } = (0, _data.useDispatch)(_blockEditor.store);
32
- const [, outdentListItem] = (0, _useOutdentListItem.default)(clientId);
32
+ const outdentListItem = (0, _useOutdentListItem.default)();
33
33
  function getTrailingId(id) {
34
34
  const order = getBlockOrder(id);
35
35
  if (!order.length) {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_useOutdentListItem","_interopRequireDefault","useMerge","clientId","onMerge","registry","useRegistry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","useSelect","blockEditorStore","mergeBlocks","moveBlocksToPosition","useDispatch","outdentListItem","useOutdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ , outdentListItem ] = useOutdentListItem( clientId );\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) return;\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) return next;\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) return;\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,QAAQA,CAAEC,QAAQ,EAAEC,OAAO,EAAG;EACrD,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IACLC,wBAAwB;IACxBC,oBAAoB;IACpBC,aAAa;IACbC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,kBAAiB,CAAC;EACjC,MAAM;IAAEC,WAAW;IAAEC;EAAqB,CAAC,GAC1C,IAAAC,iBAAW,EAAEH,kBAAiB,CAAC;EAChC,MAAM,GAAII,eAAe,CAAE,GAAG,IAAAC,2BAAkB,EAAEf,QAAS,CAAC;EAE5D,SAASgB,aAAaA,CAAEC,EAAE,EAAG;IAC5B,MAAMC,KAAK,GAAGZ,aAAa,CAAEW,EAAG,CAAC;IAEjC,IAAK,CAAEC,KAAK,CAACC,MAAM,EAAG;MACrB,OAAOF,EAAE;IACV;IAEA,OAAOD,aAAa,CAAEE,KAAK,CAAEA,KAAK,CAACC,MAAM,GAAG,CAAC,CAAG,CAAC;EAClD;EAEA,SAASC,mBAAmBA,CAAEH,EAAE,EAAG;IAClC,MAAMI,MAAM,GAAGd,oBAAoB,CAAEU,EAAG,CAAC;IACzC,MAAMK,gBAAgB,GAAGf,oBAAoB,CAAEc,MAAO,CAAC;IACvD,IAAK,CAAEC,gBAAgB,EAAG;IAC1B,IAAKd,YAAY,CAAEc,gBAAiB,CAAC,KAAK,gBAAgB,EAAG;IAC7D,OAAOA,gBAAgB;EACxB;;EAEA;AACD;AACA;AACA;AACA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B,eAAe,CAAEkB,iBAAkB,CAAC;MACrC,CAAC,MAAM;QACNL,eAAe,CAAE3B,QAAQ,EAAEgC,iBAAkB,CAAC;MAC/C;IACD,CAAC,MAAM;MACN;MACA;MACA,MAAMC,qBAAqB,GAAG7B,wBAAwB,CAAEJ,QAAS,CAAC;MAClE,IAAKoB,mBAAmB,CAAEpB,QAAS,CAAC,EAAG;QACtCc,eAAe,CAAEd,QAAS,CAAC;MAC5B,CAAC,MAAM,IAAKiC,qBAAqB,EAAG;QACnC,MAAMC,UAAU,GAAGlB,aAAa,CAAEiB,qBAAsB,CAAC;QACzDN,eAAe,CAAEO,UAAU,EAAElC,QAAS,CAAC;MACxC,CAAC,MAAM;QACNC,OAAO,CAAEyB,OAAQ,CAAC;MACnB;IACD;EACD,CAAC;AACF"}
1
+ {"version":3,"names":["_data","require","_blockEditor","_useOutdentListItem","_interopRequireDefault","useMerge","clientId","onMerge","registry","useRegistry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","useSelect","blockEditorStore","mergeBlocks","moveBlocksToPosition","useDispatch","outdentListItem","useOutdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","_getNextId","next","getNextId","forward","mergeWithNested","clientIdA","clientIdB","batch","nestedListClientId","nextBlockClientId","previousBlockClientId","trailingId"],"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useMerge( clientId, onMerge ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition } =\n\t\tuseDispatch( blockEditorStore );\n\tconst outdentListItem = useOutdentListItem();\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== 'core/list-item' ) return;\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) return next;\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) return;\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\treturn ( forward ) => {\n\t\tfunction mergeWithNested( clientIdA, clientIdB ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\t// When merging a sub list item with a higher next list item, we\n\t\t\t\t// also need to move any nested list items. Check if there's a\n\t\t\t\t// listed list, and append its nested list items to the current\n\t\t\t\t// list.\n\t\t\t\tconst [ nestedListClientId ] = getBlockOrder( clientIdB );\n\t\t\t\tif ( nestedListClientId ) {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nestedListClientId ),\n\t\t\t\t\t\tnestedListClientId,\n\t\t\t\t\t\tgetBlockRootClientId( clientIdA )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmergeBlocks( clientIdA, clientIdB );\n\t\t\t} );\n\t\t}\n\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tonMerge( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tmergeWithNested( clientId, nextBlockClientId );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tmergeWithNested( trailingId, clientId );\n\t\t\t} else {\n\t\t\t\tonMerge( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,QAAQA,CAAEC,QAAQ,EAAEC,OAAO,EAAG;EACrD,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IACLC,wBAAwB;IACxBC,oBAAoB;IACpBC,aAAa;IACbC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,kBAAiB,CAAC;EACjC,MAAM;IAAEC,WAAW;IA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