@wordpress/block-library 7.15.1-next.4d3b314fd5.0 → 7.17.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 (351) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/build/archives/edit.js +1 -0
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/code/utils.js +3 -3
  5. package/build/code/utils.js.map +1 -1
  6. package/build/comment-template/edit.js +40 -32
  7. package/build/comment-template/edit.js.map +1 -1
  8. package/build/comments/edit/placeholder.js +1 -4
  9. package/build/comments/edit/placeholder.js.map +1 -1
  10. package/build/comments/index.js +5 -1
  11. package/build/comments/index.js.map +1 -1
  12. package/build/comments-title/edit.js +18 -1
  13. package/build/comments-title/edit.js.map +1 -1
  14. package/build/cover/edit/index.js +2 -2
  15. package/build/cover/edit/index.js.map +1 -1
  16. package/build/cover/edit/use-cover-is-dark.js +8 -7
  17. package/build/cover/edit/use-cover-is-dark.js.map +1 -1
  18. package/build/embed/variations.js +1 -1
  19. package/build/embed/variations.js.map +1 -1
  20. package/build/gallery/transforms.js +3 -3
  21. package/build/gallery/transforms.js.map +1 -1
  22. package/build/gallery/v1/edit.js +1 -1
  23. package/build/gallery/v1/edit.js.map +1 -1
  24. package/build/group/edit.js +1 -1
  25. package/build/group/edit.js.map +1 -1
  26. package/build/image/image.js +34 -10
  27. package/build/image/image.js.map +1 -1
  28. package/build/image/transforms.js +1 -7
  29. package/build/image/transforms.js.map +1 -1
  30. package/build/list/transforms.js +9 -1
  31. package/build/list/transforms.js.map +1 -1
  32. package/build/list-item/edit.js +3 -2
  33. package/build/list-item/edit.js.map +1 -1
  34. package/build/list-item/edit.native.js +3 -2
  35. package/build/list-item/edit.native.js.map +1 -1
  36. package/build/list-item/hooks/use-merge.js +19 -22
  37. package/build/list-item/hooks/use-merge.js.map +1 -1
  38. package/build/list-item/hooks/use-outdent-list-item.js +19 -3
  39. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  40. package/build/list-item/index.js +14 -1
  41. package/build/list-item/index.js.map +1 -1
  42. package/build/list-item/utils.js +14 -1
  43. package/build/list-item/utils.js.map +1 -1
  44. package/build/navigation/edit/index.js +46 -33
  45. package/build/navigation/edit/index.js.map +1 -1
  46. package/build/navigation/edit/inner-blocks.js +3 -5
  47. package/build/navigation/edit/inner-blocks.js.map +1 -1
  48. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  49. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  50. package/build/navigation/edit/use-create-navigation-menu.js +1 -1
  51. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  52. package/build/navigation/index.js +4 -1
  53. package/build/navigation/index.js.map +1 -1
  54. package/build/navigation-link/edit.js +1 -1
  55. package/build/navigation-link/edit.js.map +1 -1
  56. package/build/page-list/index.js +1 -5
  57. package/build/page-list/index.js.map +1 -1
  58. package/build/paragraph/deprecated.js +49 -10
  59. package/build/paragraph/deprecated.js.map +1 -1
  60. package/build/paragraph/edit.js +22 -14
  61. package/build/paragraph/edit.js.map +1 -1
  62. package/build/paragraph/save.js +3 -1
  63. package/build/paragraph/save.js.map +1 -1
  64. package/build/pattern/edit.js +11 -4
  65. package/build/pattern/edit.js.map +1 -1
  66. package/build/post-author/edit.js +20 -2
  67. package/build/post-author/edit.js.map +1 -1
  68. package/build/post-author/index.js +8 -0
  69. package/build/post-author/index.js.map +1 -1
  70. package/build/post-comments-form/form.js +1 -2
  71. package/build/post-comments-form/form.js.map +1 -1
  72. package/build/post-featured-image/index.js +1 -1
  73. package/build/post-featured-image/overlay.js +2 -2
  74. package/build/post-featured-image/overlay.js.map +1 -1
  75. package/build/post-terms/index.js +4 -0
  76. package/build/post-terms/index.js.map +1 -1
  77. package/build/query/edit/inspector-controls/author-control.js +2 -1
  78. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  79. package/build/query/edit/inspector-controls/index.js +3 -3
  80. package/build/query/edit/inspector-controls/index.js.map +1 -1
  81. package/build/query/edit/inspector-controls/parent-control.js +2 -1
  82. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  83. package/build/query/edit/inspector-controls/taxonomy-controls.js +79 -103
  84. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  85. package/build/query/utils.js +1 -1
  86. package/build/query/utils.js.map +1 -1
  87. package/build/quote/index.js +0 -1
  88. package/build/quote/index.js.map +1 -1
  89. package/build/search/edit.js +2 -1
  90. package/build/search/edit.js.map +1 -1
  91. package/build/site-logo/edit.js +6 -9
  92. package/build/site-logo/edit.js.map +1 -1
  93. package/build/site-title/index.js +2 -1
  94. package/build/site-title/index.js.map +1 -1
  95. package/build/table/state.js +1 -1
  96. package/build/table/state.js.map +1 -1
  97. package/build/table-of-contents/edit.js +1 -4
  98. package/build/table-of-contents/edit.js.map +1 -1
  99. package/build/tag-cloud/edit.js +1 -1
  100. package/build/tag-cloud/edit.js.map +1 -1
  101. package/build/tag-cloud/index.js +8 -0
  102. package/build/tag-cloud/index.js.map +1 -1
  103. package/build/template-part/index.js +2 -2
  104. package/build/template-part/index.js.map +1 -1
  105. package/build/video/edit.js +13 -1
  106. package/build/video/edit.js.map +1 -1
  107. package/build-module/archives/edit.js +1 -0
  108. package/build-module/archives/edit.js.map +1 -1
  109. package/build-module/code/utils.js +3 -3
  110. package/build-module/code/utils.js.map +1 -1
  111. package/build-module/comment-template/edit.js +38 -30
  112. package/build-module/comment-template/edit.js.map +1 -1
  113. package/build-module/comments/edit/placeholder.js +1 -3
  114. package/build-module/comments/edit/placeholder.js.map +1 -1
  115. package/build-module/comments/index.js +5 -1
  116. package/build-module/comments/index.js.map +1 -1
  117. package/build-module/comments-title/edit.js +18 -2
  118. package/build-module/comments-title/edit.js.map +1 -1
  119. package/build-module/cover/edit/index.js +2 -2
  120. package/build-module/cover/edit/index.js.map +1 -1
  121. package/build-module/cover/edit/use-cover-is-dark.js +7 -7
  122. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
  123. package/build-module/embed/variations.js +1 -1
  124. package/build-module/embed/variations.js.map +1 -1
  125. package/build-module/gallery/transforms.js +4 -4
  126. package/build-module/gallery/transforms.js.map +1 -1
  127. package/build-module/gallery/v1/edit.js +2 -2
  128. package/build-module/gallery/v1/edit.js.map +1 -1
  129. package/build-module/group/edit.js +1 -1
  130. package/build-module/group/edit.js.map +1 -1
  131. package/build-module/image/image.js +35 -11
  132. package/build-module/image/image.js.map +1 -1
  133. package/build-module/image/transforms.js +1 -6
  134. package/build-module/image/transforms.js.map +1 -1
  135. package/build-module/list/transforms.js +9 -1
  136. package/build-module/list/transforms.js.map +1 -1
  137. package/build-module/list-item/edit.js +3 -2
  138. package/build-module/list-item/edit.js.map +1 -1
  139. package/build-module/list-item/edit.native.js +3 -2
  140. package/build-module/list-item/edit.native.js.map +1 -1
  141. package/build-module/list-item/hooks/use-merge.js +19 -21
  142. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  143. package/build-module/list-item/hooks/use-outdent-list-item.js +19 -3
  144. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  145. package/build-module/list-item/index.js +14 -1
  146. package/build-module/list-item/index.js.map +1 -1
  147. package/build-module/list-item/utils.js +14 -1
  148. package/build-module/list-item/utils.js.map +1 -1
  149. package/build-module/navigation/edit/index.js +46 -33
  150. package/build-module/navigation/edit/index.js.map +1 -1
  151. package/build-module/navigation/edit/inner-blocks.js +3 -5
  152. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  153. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  154. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  155. package/build-module/navigation/edit/use-create-navigation-menu.js +1 -1
  156. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  157. package/build-module/navigation/index.js +4 -1
  158. package/build-module/navigation/index.js.map +1 -1
  159. package/build-module/navigation-link/edit.js +1 -1
  160. package/build-module/navigation-link/edit.js.map +1 -1
  161. package/build-module/page-list/index.js +1 -5
  162. package/build-module/page-list/index.js.map +1 -1
  163. package/build-module/paragraph/deprecated.js +49 -11
  164. package/build-module/paragraph/deprecated.js.map +1 -1
  165. package/build-module/paragraph/edit.js +22 -13
  166. package/build-module/paragraph/edit.js.map +1 -1
  167. package/build-module/paragraph/save.js +2 -1
  168. package/build-module/paragraph/save.js.map +1 -1
  169. package/build-module/pattern/edit.js +10 -3
  170. package/build-module/pattern/edit.js.map +1 -1
  171. package/build-module/post-author/edit.js +21 -2
  172. package/build-module/post-author/edit.js.map +1 -1
  173. package/build-module/post-author/index.js +8 -0
  174. package/build-module/post-author/index.js.map +1 -1
  175. package/build-module/post-comments-form/form.js +2 -3
  176. package/build-module/post-comments-form/form.js.map +1 -1
  177. package/build-module/post-featured-image/index.js +1 -1
  178. package/build-module/post-featured-image/overlay.js +2 -2
  179. package/build-module/post-featured-image/overlay.js.map +1 -1
  180. package/build-module/post-terms/index.js +4 -0
  181. package/build-module/post-terms/index.js.map +1 -1
  182. package/build-module/query/edit/inspector-controls/author-control.js +2 -1
  183. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  184. package/build-module/query/edit/inspector-controls/index.js +5 -5
  185. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  186. package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
  187. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  188. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +81 -101
  189. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  190. package/build-module/query/utils.js +1 -1
  191. package/build-module/query/utils.js.map +1 -1
  192. package/build-module/quote/index.js +0 -1
  193. package/build-module/quote/index.js.map +1 -1
  194. package/build-module/search/edit.js +3 -2
  195. package/build-module/search/edit.js.map +1 -1
  196. package/build-module/site-logo/edit.js +6 -9
  197. package/build-module/site-logo/edit.js.map +1 -1
  198. package/build-module/site-title/index.js +2 -1
  199. package/build-module/site-title/index.js.map +1 -1
  200. package/build-module/table/state.js +2 -2
  201. package/build-module/table/state.js.map +1 -1
  202. package/build-module/table-of-contents/edit.js +1 -3
  203. package/build-module/table-of-contents/edit.js.map +1 -1
  204. package/build-module/tag-cloud/edit.js +1 -1
  205. package/build-module/tag-cloud/edit.js.map +1 -1
  206. package/build-module/tag-cloud/index.js +8 -0
  207. package/build-module/tag-cloud/index.js.map +1 -1
  208. package/build-module/template-part/index.js +2 -2
  209. package/build-module/template-part/index.js.map +1 -1
  210. package/build-module/video/edit.js +15 -3
  211. package/build-module/video/edit.js.map +1 -1
  212. package/build-style/archives/style-rtl.css +4 -0
  213. package/build-style/archives/style.css +4 -0
  214. package/build-style/code/style-rtl.css +3 -0
  215. package/build-style/code/style.css +3 -0
  216. package/build-style/comments/editor-rtl.css +1 -0
  217. package/build-style/comments/editor.css +1 -0
  218. package/build-style/comments/style-rtl.css +1 -0
  219. package/build-style/comments/style.css +1 -0
  220. package/build-style/cover/editor-rtl.css +4 -0
  221. package/build-style/cover/editor.css +4 -0
  222. package/build-style/editor-rtl.css +78 -46
  223. package/build-style/editor.css +78 -46
  224. package/build-style/group/editor-rtl.css +1 -0
  225. package/build-style/group/editor.css +1 -0
  226. package/build-style/image/editor-rtl.css +1 -1
  227. package/build-style/image/editor.css +1 -1
  228. package/build-style/navigation/editor-rtl.css +5 -0
  229. package/build-style/navigation/editor.css +5 -0
  230. package/build-style/navigation/style-rtl.css +3 -0
  231. package/build-style/navigation/style.css +3 -0
  232. package/build-style/paragraph/editor-rtl.css +0 -16
  233. package/build-style/paragraph/editor.css +0 -16
  234. package/build-style/paragraph/style-rtl.css +5 -0
  235. package/build-style/paragraph/style.css +5 -0
  236. package/build-style/post-featured-image/editor-rtl.css +39 -29
  237. package/build-style/post-featured-image/editor.css +39 -29
  238. package/build-style/post-terms/style-rtl.css +4 -1
  239. package/build-style/post-terms/style.css +4 -1
  240. package/build-style/site-logo/editor-rtl.css +1 -0
  241. package/build-style/site-logo/editor.css +1 -0
  242. package/build-style/site-title/editor-rtl.css +4 -0
  243. package/build-style/site-title/editor.css +4 -0
  244. package/build-style/site-title/style-rtl.css +79 -0
  245. package/build-style/site-title/style.css +79 -0
  246. package/build-style/style-rtl.css +27 -1
  247. package/build-style/style.css +27 -1
  248. package/build-style/tag-cloud/style-rtl.css +3 -0
  249. package/build-style/tag-cloud/style.css +3 -0
  250. package/build-style/video/editor-rtl.css +22 -0
  251. package/build-style/video/editor.css +22 -0
  252. package/package.json +28 -28
  253. package/src/archives/edit.js +1 -0
  254. package/src/archives/style.scss +5 -0
  255. package/src/avatar/index.php +1 -1
  256. package/src/categories/index.php +1 -1
  257. package/src/code/style.scss +12 -7
  258. package/src/code/test/__snapshots__/edit.native.js.snap +13 -0
  259. package/src/code/test/edit.native.js +46 -32
  260. package/src/code/utils.js +3 -3
  261. package/src/comment-author-name/index.php +1 -1
  262. package/src/comment-reply-link/index.php +1 -1
  263. package/src/comment-template/edit.js +47 -34
  264. package/src/comment-template/index.php +2 -3
  265. package/src/comments/block.json +5 -1
  266. package/src/comments/edit/placeholder.js +1 -7
  267. package/src/comments/style.scss +2 -0
  268. package/src/comments-title/edit.js +24 -1
  269. package/src/cover/edit/index.js +2 -7
  270. package/src/cover/edit/use-cover-is-dark.js +11 -11
  271. package/src/cover/editor.scss +7 -0
  272. package/src/cover/index.php +1 -1
  273. package/src/embed/variations.js +1 -1
  274. package/src/gallery/transforms.js +8 -5
  275. package/src/gallery/v1/edit.js +2 -2
  276. package/src/group/edit.js +1 -1
  277. package/src/group/editor.scss +1 -0
  278. package/src/image/editor.scss +4 -1
  279. package/src/image/image.js +59 -29
  280. package/src/image/transforms.js +1 -7
  281. package/src/latest-posts/index.php +1 -1
  282. package/src/list/test/edit.native.js +102 -3
  283. package/src/list/transforms.js +11 -0
  284. package/src/list-item/block.json +14 -1
  285. package/src/list-item/edit.js +2 -1
  286. package/src/list-item/edit.native.js +2 -1
  287. package/src/list-item/hooks/use-merge.js +4 -23
  288. package/src/list-item/hooks/use-outdent-list-item.js +6 -2
  289. package/src/navigation/block.json +4 -1
  290. package/src/navigation/edit/index.js +60 -32
  291. package/src/navigation/edit/inner-blocks.js +2 -5
  292. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +32 -5
  293. package/src/navigation/edit/use-create-navigation-menu.js +2 -5
  294. package/src/navigation/editor.scss +7 -0
  295. package/src/navigation/index.php +103 -6
  296. package/src/navigation/style.scss +8 -0
  297. package/src/navigation-link/edit.js +1 -1
  298. package/src/navigation-link/index.php +8 -1
  299. package/src/navigation-submenu/index.php +8 -1
  300. package/src/page-list/block.json +1 -5
  301. package/src/page-list/index.php +10 -8
  302. package/src/paragraph/deprecated.js +36 -0
  303. package/src/paragraph/edit.js +24 -22
  304. package/src/paragraph/editor.scss +0 -20
  305. package/src/paragraph/save.js +5 -1
  306. package/src/paragraph/style.scss +5 -0
  307. package/src/pattern/edit.js +10 -3
  308. package/src/post-author/block.json +8 -0
  309. package/src/post-author/edit.js +29 -3
  310. package/src/post-author/index.php +7 -1
  311. package/src/post-comments-form/form.js +2 -3
  312. package/src/post-featured-image/block.json +1 -1
  313. package/src/post-featured-image/editor.scss +79 -72
  314. package/src/post-featured-image/index.php +18 -24
  315. package/src/post-featured-image/overlay.js +17 -14
  316. package/src/post-terms/block.json +4 -0
  317. package/src/post-terms/style.scss +7 -2
  318. package/src/query/edit/inspector-controls/author-control.js +1 -0
  319. package/src/query/edit/inspector-controls/index.js +5 -7
  320. package/src/query/edit/inspector-controls/parent-control.js +1 -0
  321. package/src/query/edit/inspector-controls/taxonomy-controls.js +82 -86
  322. package/src/query/utils.js +1 -1
  323. package/src/quote/block.json +0 -1
  324. package/src/rss/index.php +3 -3
  325. package/src/search/edit.js +6 -1
  326. package/src/search/index.php +21 -13
  327. package/src/site-logo/edit.js +10 -8
  328. package/src/site-logo/editor.scss +1 -0
  329. package/src/site-title/block.json +2 -1
  330. package/src/site-title/editor.scss +6 -0
  331. package/src/site-title/style.scss +5 -0
  332. package/src/style.scss +1 -0
  333. package/src/table/state.js +2 -2
  334. package/src/table-of-contents/edit.js +1 -3
  335. package/src/tag-cloud/block.json +8 -0
  336. package/src/tag-cloud/edit.js +1 -1
  337. package/src/tag-cloud/style.scss +3 -0
  338. package/src/template-part/index.js +2 -2
  339. package/src/template-part/index.php +4 -0
  340. package/src/video/edit.js +19 -0
  341. package/src/video/editor.scss +37 -0
  342. package/build/navigation-submenu/view.js +0 -56
  343. package/build/navigation-submenu/view.js.map +0 -1
  344. package/build/paragraph/drop-zone.js +0 -99
  345. package/build/paragraph/drop-zone.js.map +0 -1
  346. package/build-module/navigation-submenu/view.js +0 -54
  347. package/build-module/navigation-submenu/view.js.map +0 -1
  348. package/build-module/paragraph/drop-zone.js +0 -88
  349. package/build-module/paragraph/drop-zone.js.map +0 -1
  350. package/src/navigation-submenu/view.js +0 -67
  351. package/src/paragraph/drop-zone.js +0 -105
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.17.0 (2022-10-19)
6
+
7
+ ## 7.16.0 (2022-10-05)
8
+
5
9
  ## 7.15.0 (2022-09-21)
6
10
 
7
11
  ## 7.14.0 (2022-09-13)
@@ -9,7 +13,6 @@
9
13
  ### New Feature
10
14
 
11
15
  - Made it possible to import individual blocks ([#42258](https://github.com/WordPress/gutenberg/pull/42258)). Check [README](./README.md#loading-individual-blocks) for more information.
12
- - Paragraph block: You can now drop files/blocks/HTML on an empty Paragraph block to transform it into relevant blocks ([#42722](https://github.com/WordPress/gutenberg/pull/42722)).
13
16
 
14
17
  ## 7.13.0 (2022-08-24)
15
18
 
@@ -72,6 +72,7 @@ function ArchivesEdit(_ref) {
72
72
  })
73
73
  }))), (0, _element.createElement)("div", (0, _blockEditor.useBlockProps)(), (0, _element.createElement)(_components.Disabled, null, (0, _element.createElement)(_serverSideRender.default, {
74
74
  block: "core/archives",
75
+ skipBlockSupportAttributes: true,
75
76
  attributes: attributes
76
77
  }))));
77
78
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/archives/edit.js"],"names":["ArchivesEdit","attributes","setAttributes","showLabel","showPostCounts","displayAsDropdown","type","label","value"],"mappings":";;;;;;;;;;;AAGA;;AAMA;;AACA;;AACA;;AAXA;AACA;AACA;AAWe,SAASA,YAAT,OAAuD;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AACrE,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,cAAb;AAA6BC,IAAAA,iBAA7B;AAAgDC,IAAAA;AAAhD,MAAyDL,UAA/D;AAEA,SACC,qDACC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,qBAAJ,CADT;AAEC,IAAA,OAAO,EAAGI,iBAFX;AAGC,IAAA,QAAQ,EAAG,MACVH,aAAa,CAAE;AACdG,MAAAA,iBAAiB,EAAE,CAAEA;AADP,KAAF;AAJf,IADD,EAUGA,iBAAiB,IAClB,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,YAAJ,CADT;AAEC,IAAA,OAAO,EAAGF,SAFX;AAGC,IAAA,QAAQ,EAAG,MACVD,aAAa,CAAE;AACdC,MAAAA,SAAS,EAAE,CAAEA;AADC,KAAF;AAJf,IAXF,EAqBC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CADT;AAEC,IAAA,OAAO,EAAGC,cAFX;AAGC,IAAA,QAAQ,EAAG,MACVF,aAAa,CAAE;AACdE,MAAAA,cAAc,EAAE,CAAEA;AADJ,KAAF;AAJf,IArBD,EA8BC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,WAAJ,CADT;AAEC,IAAA,OAAO,EAAG,CACT;AAAEG,MAAAA,KAAK,EAAE,cAAI,MAAJ,CAAT;AAAuBC,MAAAA,KAAK,EAAE;AAA9B,KADS,EAET;AAAED,MAAAA,KAAK,EAAE,cAAI,OAAJ,CAAT;AAAwBC,MAAAA,KAAK,EAAE;AAA/B,KAFS,EAGT;AAAED,MAAAA,KAAK,EAAE,cAAI,MAAJ,CAAT;AAAuBC,MAAAA,KAAK,EAAE;AAA9B,KAHS,EAIT;AAAED,MAAAA,KAAK,EAAE,cAAI,KAAJ,CAAT;AAAsBC,MAAAA,KAAK,EAAE;AAA7B,KAJS,CAFX;AAQC,IAAA,KAAK,EAAGF,IART;AASC,IAAA,QAAQ,EAAKE,KAAF,IACVN,aAAa,CAAE;AAAEI,MAAAA,IAAI,EAAEE;AAAR,KAAF;AAVf,IA9BD,CADD,CADD,EA+CC,mCAAU,iCAAV,EACC,4BAAC,oBAAD,QACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAC,eADP;AAEC,IAAA,UAAU,EAAGP;AAFd,IADD,CADD,CA/CD,CADD;AA0DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tToggleControl,\n\tSelectControl,\n\tDisabled,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\n\nexport default function ArchivesEdit( { attributes, setAttributes } ) {\n\tconst { showLabel, showPostCounts, displayAsDropdown, type } = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayAsDropdown: ! displayAsDropdown,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowPostCounts: ! showPostCounts,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Group by:' ) }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: __( 'Year' ), value: 'yearly' },\n\t\t\t\t\t\t\t{ label: __( 'Month' ), value: 'monthly' },\n\t\t\t\t\t\t\t{ label: __( 'Week' ), value: 'weekly' },\n\t\t\t\t\t\t\t{ label: __( 'Day' ), value: 'daily' },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { type: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tblock=\"core/archives\"\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/archives/edit.js"],"names":["ArchivesEdit","attributes","setAttributes","showLabel","showPostCounts","displayA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AFS,EAGT;AAAED,MAAAA,KAAK,EAAE,cAAI,MAAJ,CAAT;AAAuBC,MAAAA,KAAK,EAAE;AAA9B,KAHS,EAIT;AAAED,MAAAA,KAAK,EAAE,cAAI,KAAJ,CAAT;AAAsBC,MAAAA,KAAK,EAAE;AAA7B,KAJS,CAFX;AAQC,IAAA,KAAK,EAAGF,IART;AASC,IAAA,QAAQ,EAAKE,KAAF,IACVN,aAAa,CAAE;AAAEI,MAAAA,IAAI,EAAEE;AAAR,KAAF;AAVf,IA9BD,CADD,CADD,EA+CC,mCAAU,iCAAV,EACC,4BAAC,oBAAD,QACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAC,eADP;AAEC,IAAA,0BAA0B,MAF3B;AAGC,IAAA,UAAU,EAAGP;AAHd,IADD,CADD,CA/CD,CADD;AA2DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tToggleControl,\n\tSelectControl,\n\tDisabled,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\n\nexport default function ArchivesEdit( { attributes, setAttributes } ) {\n\tconst { showLabel, showPostCounts, displayAsDropdown, type } = attributes;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Display as dropdown' ) }\n\t\t\t\t\t\tchecked={ displayAsDropdown }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayAsDropdown: ! displayAsDropdown,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ displayAsDropdown && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show post counts' ) }\n\t\t\t\t\t\tchecked={ showPostCounts }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowPostCounts: ! showPostCounts,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Group by:' ) }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: __( 'Year' ), value: 'yearly' },\n\t\t\t\t\t\t\t{ label: __( 'Month' ), value: 'monthly' },\n\t\t\t\t\t\t\t{ label: __( 'Week' ), value: 'weekly' },\n\t\t\t\t\t\t\t{ label: __( 'Day' ), value: 'daily' },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { type: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tblock=\"core/archives\"\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.escape = escape;
7
7
 
8
- var _lodash = require("lodash");
8
+ var _compose = require("@wordpress/compose");
9
9
 
10
10
  /**
11
- * External dependencies
11
+ * WordPress dependencies
12
12
  */
13
13
 
14
14
  /**
@@ -18,7 +18,7 @@ var _lodash = require("lodash");
18
18
  * @return {string} The given content with some characters escaped.
19
19
  */
20
20
  function escape(content) {
21
- return (0, _lodash.flow)(escapeOpeningSquareBrackets, escapeProtocolInIsolatedUrls)(content || '');
21
+ return (0, _compose.pipe)(escapeOpeningSquareBrackets, escapeProtocolInIsolatedUrls)(content || '');
22
22
  }
23
23
  /**
24
24
  * Returns the given content with all opening shortcode characters converted
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/code/utils.js"],"names":["escape","content","escapeOpeningSquareBrackets","escapeProtocolInIsolatedUrls","replace"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAT,CAAiBC,OAAjB,EAA2B;AACjC,SAAO,kBACNC,2BADM,EAENC,4BAFM,EAGJF,OAAO,IAAI,EAHP,CAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,2BAAT,CAAsCD,OAAtC,EAAgD;AAC/C,SAAOA,OAAO,CAACG,OAAR,CAAiB,KAAjB,EAAwB,OAAxB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASD,4BAAT,CAAuCF,OAAvC,EAAiD;AAChD,SAAOA,OAAO,CAACG,OAAR,CACN,mCADM,EAEN,gBAFM,CAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { flow } from 'lodash';\n\n/**\n * Escapes ampersands, shortcodes, and links.\n *\n * @param {string} content The content of a code block.\n * @return {string} The given content with some characters escaped.\n */\nexport function escape( content ) {\n\treturn flow(\n\t\tescapeOpeningSquareBrackets,\n\t\tescapeProtocolInIsolatedUrls\n\t)( content || '' );\n}\n\n/**\n * Returns the given content with all opening shortcode characters converted\n * into their HTML entity counterpart (i.e. [ => &#91;). For instance, a\n * shortcode like [embed] becomes &#91;embed]\n *\n * This function replicates the escaping of HTML tags, where a tag like\n * <strong> becomes &lt;strong>.\n *\n * @param {string} content The content of a code block.\n * @return {string} The given content with its opening shortcode characters\n * converted into their HTML entity counterpart\n * (i.e. [ => &#91;)\n */\nfunction escapeOpeningSquareBrackets( content ) {\n\treturn content.replace( /\\[/g, '&#91;' );\n}\n\n/**\n * Converts the first two forward slashes of any isolated URL into their HTML\n * counterparts (i.e. // => &#47;&#47;). For instance, https://youtube.com/watch?x\n * becomes https:&#47;&#47;youtube.com/watch?x.\n *\n * An isolated URL is a URL that sits in its own line, surrounded only by spacing\n * characters.\n *\n * See https://github.com/WordPress/wordpress-develop/blob/5.1.1/src/wp-includes/class-wp-embed.php#L403\n *\n * @param {string} content The content of a code block.\n * @return {string} The given content with its ampersands converted into\n * their HTML entity counterpart (i.e. & => &amp;)\n */\nfunction escapeProtocolInIsolatedUrls( content ) {\n\treturn content.replace(\n\t\t/^(\\s*https?:)\\/\\/([^\\s<>\"]+\\s*)$/m,\n\t\t'$1&#47;&#47;$2'\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/code/utils.js"],"names":["escape","content","escapeOpeningSquareBrackets","escapeProtocolInIsolatedUrls","replace"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAT,CAAiBC,OAAjB,EAA2B;AACjC,SAAO,mBACNC,2BADM,EAENC,4BAFM,EAGJF,OAAO,IAAI,EAHP,CAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,2BAAT,CAAsCD,OAAtC,EAAgD;AAC/C,SAAOA,OAAO,CAACG,OAAR,CAAiB,KAAjB,EAAwB,OAAxB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASD,4BAAT,CAAuCF,OAAvC,EAAiD;AAChD,SAAOA,OAAO,CAACG,OAAR,CACN,mCADM,EAEN,gBAFM,CAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { pipe } from '@wordpress/compose';\n\n/**\n * Escapes ampersands, shortcodes, and links.\n *\n * @param {string} content The content of a code block.\n * @return {string} The given content with some characters escaped.\n */\nexport function escape( content ) {\n\treturn pipe(\n\t\tescapeOpeningSquareBrackets,\n\t\tescapeProtocolInIsolatedUrls\n\t)( content || '' );\n}\n\n/**\n * Returns the given content with all opening shortcode characters converted\n * into their HTML entity counterpart (i.e. [ => &#91;). For instance, a\n * shortcode like [embed] becomes &#91;embed]\n *\n * This function replicates the escaping of HTML tags, where a tag like\n * <strong> becomes &lt;strong>.\n *\n * @param {string} content The content of a code block.\n * @return {string} The given content with its opening shortcode characters\n * converted into their HTML entity counterpart\n * (i.e. [ => &#91;)\n */\nfunction escapeOpeningSquareBrackets( content ) {\n\treturn content.replace( /\\[/g, '&#91;' );\n}\n\n/**\n * Converts the first two forward slashes of any isolated URL into their HTML\n * counterparts (i.e. // => &#47;&#47;). For instance, https://youtube.com/watch?x\n * becomes https:&#47;&#47;youtube.com/watch?x.\n *\n * An isolated URL is a URL that sits in its own line, surrounded only by spacing\n * characters.\n *\n * See https://github.com/WordPress/wordpress-develop/blob/5.1.1/src/wp-includes/class-wp-embed.php#L403\n *\n * @param {string} content The content of a code block.\n * @return {string} The given content with its ampersands converted into\n * their HTML entity counterpart (i.e. & => &amp;)\n */\nfunction escapeProtocolInIsolatedUrls( content ) {\n\treturn content.replace(\n\t\t/^(\\s*https?:)\\/\\/([^\\s<>\"]+\\s*)$/m,\n\t\t'$1&#47;&#47;$2'\n\t);\n}\n"]}
@@ -40,6 +40,7 @@ const TEMPLATE = [['core/avatar'], ['core/comment-author-name'], ['core/comment-
40
40
  *
41
41
  * @param {Object} settings Discussion Settings.
42
42
  * @param {number} [settings.perPage] - Comments per page setting or block attribute.
43
+ * @param {boolean} [settings.pageComments] - Enable break comments into pages setting.
43
44
  * @param {boolean} [settings.threadComments] - Enable threaded (nested) comments setting.
44
45
  * @param {number} [settings.threadCommentsDepth] - Level deep of threaded comments.
45
46
  *
@@ -50,44 +51,49 @@ const TEMPLATE = [['core/avatar'], ['core/comment-author-name'], ['core/comment-
50
51
  const getCommentsPlaceholder = _ref => {
51
52
  let {
52
53
  perPage,
54
+ pageComments,
53
55
  threadComments,
54
56
  threadCommentsDepth
55
57
  } = _ref;
56
- // In case that `threadCommentsDepth` is falsy, we default to a somewhat
57
- // arbitrary value of 3.
58
- // In case that the value is set but larger than 3 we truncate it to 3.
59
- const commentsDepth = Math.min(threadCommentsDepth || 3, 3); // We set a limit in order not to overload the editor of empty comments.
60
-
61
- const defaultCommentsToShow = perPage <= commentsDepth ? perPage : commentsDepth;
62
-
63
- if (!threadComments || defaultCommentsToShow === 1) {
64
- // If displaying threaded comments is disabled, we only show one comment
65
- // A commentId is negative in order to avoid conflicts with the actual comments.
66
- return [{
67
- commentId: -1,
68
- children: []
69
- }];
70
- } else if (defaultCommentsToShow === 2) {
71
- return [{
72
- commentId: -1,
73
- children: [{
74
- commentId: -2,
75
- children: []
76
- }]
77
- }];
78
- } // In case that the value is set but larger than 3 we truncate it to 3.
58
+ // Limit commentsDepth to 3
59
+ const commentsDepth = !threadComments ? 1 : Math.min(threadCommentsDepth, 3);
60
+
61
+ const buildChildrenComment = commentsLevel => {
62
+ // Render children comments until commentsDepth is reached
63
+ if (commentsLevel < commentsDepth) {
64
+ const nextLevel = commentsLevel + 1;
65
+ return [{
66
+ commentId: -(commentsLevel + 3),
67
+ children: buildChildrenComment(nextLevel)
68
+ }];
69
+ }
70
+
71
+ return [];
72
+ }; // Add the first comment and its children
79
73
 
80
74
 
81
- return [{
75
+ const placeholderComments = [{
82
76
  commentId: -1,
83
- children: [{
77
+ children: buildChildrenComment(1)
78
+ }]; // Add a second comment unless the break comments setting is active and set to less than 2, and there is one nested comment max
79
+
80
+ if ((!pageComments || perPage >= 2) && commentsDepth < 3) {
81
+ placeholderComments.push({
84
82
  commentId: -2,
85
- children: [{
86
- commentId: -3,
87
- children: []
88
- }]
89
- }]
90
- }];
83
+ children: []
84
+ });
85
+ } // Add a third comment unless the break comments setting is active and set to less than 3, and there aren't nested comments
86
+
87
+
88
+ if ((!pageComments || perPage >= 3) && commentsDepth < 2) {
89
+ placeholderComments.push({
90
+ commentId: -3,
91
+ children: []
92
+ });
93
+ } // In case that the value is set but larger than 3 we truncate it to 3.
94
+
95
+
96
+ return placeholderComments;
91
97
  };
92
98
  /**
93
99
  * Component which renders the inner blocks of the Comment Template.
@@ -232,7 +238,8 @@ function CommentTemplateEdit(_ref6) {
232
238
  commentOrder,
233
239
  threadCommentsDepth,
234
240
  threadComments,
235
- commentsPerPage
241
+ commentsPerPage,
242
+ pageComments
236
243
  } = (0, _data.useSelect)(select => {
237
244
  const {
238
245
  getSettings
@@ -269,6 +276,7 @@ function CommentTemplateEdit(_ref6) {
269
276
  if (!postId) {
270
277
  commentTree = getCommentsPlaceholder({
271
278
  perPage: commentsPerPage,
279
+ pageComments,
272
280
  threadComments,
273
281
  threadCommentsDepth
274
282
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comment-template/edit.js"],"names":["TEMPLATE","getCommentsPlaceholder","perPage","threadComments","threadCommentsDepth","commentsDepth","Math","min","defaultCommentsToShow","commentId","children","CommentTemplateInnerBlocks","comment","activeCommentId","setActiveCommentId","firstCommentId","blocks","innerBlocksProps","template","length","CommentTemplatePreview","isHidden","blockPreviewProps","handleOnClick","style","display","undefined","MemoizedCommentTemplatePreview","CommentsList","comments","blockProps","map","index","CommentTemplateEdit","clientId","context","postId","commentOrder","commentsPerPage","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","commentQuery","topLevelComments","getEntityRecords","coreStore","getBlocks","commentTree","reverse"],"mappings":";;;;;;;;;AAGA;;;;AACA;;A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A,MAAIK,WAAW,GAAG,4BACjB;AACAX,EAAAA,YAAY,KAAK,MAAjB,IAA2BO,gBAA3B,GACG,CAAE,GAAGA,gBAAL,EAAwBK,OAAxB,EADH,GAEGL,gBAJc,CAAlB;;AAOA,MAAK,CAAEA,gBAAP,EAA0B;AACzB,WACC,iCAAQd,UAAR,EACC,4BAAC,mBAAD,OADD,CADD;AAKA;;AAED,MAAK,CAAEM,MAAP,EAAgB;AACfY,IAAAA,WAAW,GAAG/C,sBAAsB,CAAE;AACrCC,MAAAA,OAAO,EAAEoC,eAD4B;AAErCnC,MAAAA,cAFqC;AAGrCC,MAAAA;AAHqC,KAAF,CAApC;AAKA;;AAED,MAAK,CAAE4C,WAAW,CAAC7B,MAAnB,EAA4B;AAC3B,WAAO,iCAAQW,UAAR,EAAuB,cAAI,mBAAJ,CAAvB,CAAP;AACA;;AAED,SACC,4BAAC,YAAD;AACC,IAAA,QAAQ,EAAGkB,WADZ;AAEC,IAAA,UAAU,EAAGlB,UAFd;AAGC,IAAA,MAAM,EAAGd,MAHV;AAIC,IAAA,eAAe,EAAGH,eAJnB;AAKC,IAAA,kBAAkB,EAAGC,kBALtB;AAMC,IAAA,cAAc,mBAAGkC,WAAW,CAAE,CAAF,CAAd,kDAAG,cAAkBvC;AANpC,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockContextProvider,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\t__experimentalUseBlockPreview as useBlockPreview,\n} from '@wordpress/block-editor';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useCommentQueryArgs, useCommentTree } from './hooks';\n\nconst TEMPLATE = [\n\t[ 'core/avatar' ],\n\t[ 'core/comment-author-name' ],\n\t[ 'core/comment-date' ],\n\t[ 'core/comment-content' ],\n\t[ 'core/comment-reply-link' ],\n\t[ 'core/comment-edit-link' ],\n];\n\n/**\n * Function that returns a comment structure that will be rendered with default placehoders.\n *\n * Each comment has a `commentId` property that is always a negative number in\n * case of the placeholders. This is to ensure that the comment does not\n * conflict with the actual (real) comments.\n *\n * @param {Object} settings Discussion Settings.\n * @param {number} [settings.perPage] - Comments per page setting or block attribute.\n * @param {boolean} [settings.threadComments] - Enable threaded (nested) comments setting.\n * @param {number} [settings.threadCommentsDepth] - Level deep of threaded comments.\n *\n * @typedef {{id: null, children: EmptyComment[]}} EmptyComment\n * @return {EmptyComment[]} \t\tInner blocks of the Comment Template\n */\nconst getCommentsPlaceholder = ( {\n\tperPage,\n\tthreadComments,\n\tthreadCommentsDepth,\n} ) => {\n\t// In case that `threadCommentsDepth` is falsy, we default to a somewhat\n\t// arbitrary value of 3.\n\t// In case that the value is set but larger than 3 we truncate it to 3.\n\tconst commentsDepth = Math.min( threadCommentsDepth || 3, 3 );\n\n\t// We set a limit in order not to overload the editor of empty comments.\n\tconst defaultCommentsToShow =\n\t\tperPage <= commentsDepth ? perPage : commentsDepth;\n\tif ( ! threadComments || defaultCommentsToShow === 1 ) {\n\t\t// If displaying threaded comments is disabled, we only show one comment\n\t\t// A commentId is negative in order to avoid conflicts with the actual comments.\n\t\treturn [ { commentId: -1, children: [] } ];\n\t} else if ( defaultCommentsToShow === 2 ) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcommentId: -1,\n\t\t\t\tchildren: [ { commentId: -2, children: [] } ],\n\t\t\t},\n\t\t];\n\t}\n\n\t// In case that the value is set but larger than 3 we truncate it to 3.\n\treturn [\n\t\t{\n\t\t\tcommentId: -1,\n\t\t\tchildren: [\n\t\t\t\t{\n\t\t\t\t\tcommentId: -2,\n\t\t\t\t\tchildren: [ { commentId: -3, children: [] } ],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t];\n};\n\n/**\n * Component which renders the inner blocks of the Comment Template.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.comment] - A comment object.\n * @param {Array} [props.activeCommentId] - The ID of the comment that is currently active.\n * @param {Array} [props.setActiveCommentId] - The setter for activeCommentId.\n * @param {Array} [props.firstCommentId] - ID of the first comment in the array.\n * @param {Array} [props.blocks] - Array of blocks returned from\n * getBlocks() in parent .\n * @return {WPElement} \t\tInner blocks of the Comment Template\n */\nfunction CommentTemplateInnerBlocks( {\n\tcomment,\n\tactiveCommentId,\n\tsetActiveCommentId,\n\tfirstCommentId,\n\tblocks,\n} ) {\n\tconst { children, ...innerBlocksProps } = useInnerBlocksProps(\n\t\t{},\n\t\t{ template: TEMPLATE }\n\t);\n\n\treturn (\n\t\t<li { ...innerBlocksProps }>\n\t\t\t{ comment.commentId === ( activeCommentId || firstCommentId )\n\t\t\t\t? children\n\t\t\t\t: null }\n\n\t\t\t{ /* To avoid flicker when switching active block contexts, a preview\n\t\t\tis ALWAYS rendered and the preview for the active block is hidden.\n\t\t\tThis ensures that when switching the active block, the component is not\n\t\t\tmounted again but rather it only toggles the `isHidden` prop.\n\n\t\t\tThe same strategy is used for preventing the flicker in the Post Template\n\t\t\tblock. */ }\n\t\t\t<MemoizedCommentTemplatePreview\n\t\t\t\tblocks={ blocks }\n\t\t\t\tcommentId={ comment.commentId }\n\t\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\t\tisHidden={\n\t\t\t\t\tcomment.commentId === ( activeCommentId || firstCommentId )\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t{ comment?.children?.length > 0 ? (\n\t\t\t\t<CommentsList\n\t\t\t\t\tcomments={ comment.children }\n\t\t\t\t\tactiveCommentId={ activeCommentId }\n\t\t\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tfirstCommentId={ firstCommentId }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t</li>\n\t);\n}\n\nconst CommentTemplatePreview = ( {\n\tblocks,\n\tcommentId,\n\tsetActiveCommentId,\n\tisHidden,\n} ) => {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveCommentId( commentId );\n\t};\n\n\t// We have to hide the preview block if the `comment` props points to\n\t// the curently active block!\n\n\t// Or, to put it differently, every preview block is visible unless it is the\n\t// currently active block - in this case we render its inner blocks.\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"button\"\n\t\t\tstyle={ style }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t/>\n\t);\n};\n\nconst MemoizedCommentTemplatePreview = memo( CommentTemplatePreview );\n\n/**\n * Component that renders a list of (nested) comments. It is called recursively.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.comments] - Array of comment objects.\n * @param {Array} [props.blockProps] - Props from parent's `useBlockProps()`.\n * @param {Array} [props.activeCommentId] - The ID of the comment that is currently active.\n * @param {Array} [props.setActiveCommentId] - The setter for activeCommentId.\n * @param {Array} [props.blocks] - Array of blocks returned from getBlocks() in parent.\n * @param {Object} [props.firstCommentId] - The ID of the first comment in the array of\n * comment objects.\n * @return {WPElement} \t\tList of comments.\n */\nconst CommentsList = ( {\n\tcomments,\n\tblockProps,\n\tactiveCommentId,\n\tsetActiveCommentId,\n\tblocks,\n\tfirstCommentId,\n} ) => (\n\t<ol { ...blockProps }>\n\t\t{ comments &&\n\t\t\tcomments.map( ( { commentId, ...comment }, index ) => (\n\t\t\t\t<BlockContextProvider\n\t\t\t\t\tkey={ comment.commentId || index }\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t// If the commentId is negative it means that this comment is a\n\t\t\t\t\t\t// \"placeholder\" and that the block is most likely being used in the\n\t\t\t\t\t\t// site editor. In this case, we have to set the commentId to `null`\n\t\t\t\t\t\t// because otherwise the (non-existent) comment with a negative ID\n\t\t\t\t\t\t// would be reqested from the REST API.\n\t\t\t\t\t\tcommentId: commentId < 0 ? null : commentId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<CommentTemplateInnerBlocks\n\t\t\t\t\t\tcomment={ { commentId, ...comment } }\n\t\t\t\t\t\tactiveCommentId={ activeCommentId }\n\t\t\t\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tfirstCommentId={ firstCommentId }\n\t\t\t\t\t/>\n\t\t\t\t</BlockContextProvider>\n\t\t\t) ) }\n\t</ol>\n);\n\nexport default function CommentTemplateEdit( {\n\tclientId,\n\tcontext: { postId },\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst [ activeCommentId, setActiveCommentId ] = useState();\n\tconst {\n\t\tcommentOrder,\n\t\tthreadCommentsDepth,\n\t\tthreadComments,\n\t\tcommentsPerPage,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalDiscussionSettings;\n\t} );\n\n\tconst commentQuery = useCommentQueryArgs( {\n\t\tpostId,\n\t} );\n\n\tconst { topLevelComments, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\t// Request only top-level comments. Replies are embedded.\n\t\t\t\ttopLevelComments: commentQuery\n\t\t\t\t\t? getEntityRecords( 'root', 'comment', commentQuery )\n\t\t\t\t\t: null,\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, commentQuery ]\n\t);\n\n\t// Generate a tree structure of comment IDs.\n\tlet commentTree = useCommentTree(\n\t\t// Reverse the order of top comments if needed.\n\t\tcommentOrder === 'desc' && topLevelComments\n\t\t\t? [ ...topLevelComments ].reverse()\n\t\t\t: topLevelComments\n\t);\n\n\tif ( ! topLevelComments ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! postId ) {\n\t\tcommentTree = getCommentsPlaceholder( {\n\t\t\tperPage: commentsPerPage,\n\t\t\tthreadComments,\n\t\t\tthreadCommentsDepth,\n\t\t} );\n\t}\n\n\tif ( ! commentTree.length ) {\n\t\treturn <p { ...blockProps }>{ __( 'No results found.' ) }</p>;\n\t}\n\n\treturn (\n\t\t<CommentsList\n\t\t\tcomments={ commentTree }\n\t\t\tblockProps={ blockProps }\n\t\t\tblocks={ blocks }\n\t\t\tactiveCommentId={ activeCommentId }\n\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\tfirstCommentId={ commentTree[ 0 ]?.commentId }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comment-template/edit.js"],"names":["TEMPLATE","getCommentsPlaceholder","perPage","pageComments","threadComments","threadCommentsDepth","commentsDepth","Math","min","buildChildrenComment","commentsLevel","nextLevel","commentId","children","placeholderComments","push","CommentTemplateInnerBlocks","comment","activeCommentId","setActiveCommentId","firstCommentId","blocks","innerBlocksProps","template","length","CommentTemplatePreview","isHidden","blockPreviewProps","handleOnClick","style","display","undefined","MemoizedCommentTemplatePreview","CommentsList","comments","blockProps","map","index","CommentTemplateEdit","clientId","context","postId","commentOrder","commentsPerPage","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","commentQuery","topLevelComments","getEntityRecords","coreStore","getBlocks","commentTree","reverse"],"mappings":";;;;;;;;;AAGA;;;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,CAChB,CAAE,aAAF,CADgB,EAEhB,CAAE,0BAAF,CAFgB,EAGhB,CAAE,mBAAF,CAHgB,EAIhB,CAAE,sBAAF,CAJgB,EAKhB,CAAE,yBA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AAYS,YAAZ,CAZoC,CAArC,CAnBG,CAkCH;;AACA,MAAIK,WAAW,GAAG,4BACjB;AACAX,EAAAA,YAAY,KAAK,MAAjB,IAA2BO,gBAA3B,GACG,CAAE,GAAGA,gBAAL,EAAwBK,OAAxB,EADH,GAEGL,gBAJc,CAAlB;;AAOA,MAAK,CAAEA,gBAAP,EAA0B;AACzB,WACC,iCAAQd,UAAR,EACC,4BAAC,mBAAD,OADD,CADD;AAKA;;AAED,MAAK,CAAEM,MAAP,EAAgB;AACfY,IAAAA,WAAW,GAAGpD,sBAAsB,CAAE;AACrCC,MAAAA,OAAO,EAAEyC,eAD4B;AAErCxC,MAAAA,YAFqC;AAGrCC,MAAAA,cAHqC;AAIrCC,MAAAA;AAJqC,KAAF,CAApC;AAMA;;AAED,MAAK,CAAEgD,WAAW,CAAC7B,MAAnB,EAA4B;AAC3B,WAAO,iCAAQW,UAAR,EAAuB,cAAI,mBAAJ,CAAvB,CAAP;AACA;;AAED,SACC,4BAAC,YAAD;AACC,IAAA,QAAQ,EAAGkB,WADZ;AAEC,IAAA,UAAU,EAAGlB,UAFd;AAGC,IAAA,MAAM,EAAGd,MAHV;AAIC,IAAA,eAAe,EAAGH,eAJnB;AAKC,IAAA,kBAAkB,EAAGC,kBALtB;AAMC,IAAA,cAAc,mBAAGkC,WAAW,CAAE,CAAF,CAAd,kDAAG,cAAkBzC;AANpC,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockContextProvider,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\t__experimentalUseBlockPreview as useBlockPreview,\n} from '@wordpress/block-editor';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useCommentQueryArgs, useCommentTree } from './hooks';\n\nconst TEMPLATE = [\n\t[ 'core/avatar' ],\n\t[ 'core/comment-author-name' ],\n\t[ 'core/comment-date' ],\n\t[ 'core/comment-content' ],\n\t[ 'core/comment-reply-link' ],\n\t[ 'core/comment-edit-link' ],\n];\n\n/**\n * Function that returns a comment structure that will be rendered with default placehoders.\n *\n * Each comment has a `commentId` property that is always a negative number in\n * case of the placeholders. This is to ensure that the comment does not\n * conflict with the actual (real) comments.\n *\n * @param {Object} settings Discussion Settings.\n * @param {number} [settings.perPage] - Comments per page setting or block attribute.\n * @param {boolean} [settings.pageComments] - Enable break comments into pages setting.\n * @param {boolean} [settings.threadComments] - Enable threaded (nested) comments setting.\n * @param {number} [settings.threadCommentsDepth] - Level deep of threaded comments.\n *\n * @typedef {{id: null, children: EmptyComment[]}} EmptyComment\n * @return {EmptyComment[]} \t\tInner blocks of the Comment Template\n */\nconst getCommentsPlaceholder = ( {\n\tperPage,\n\tpageComments,\n\tthreadComments,\n\tthreadCommentsDepth,\n} ) => {\n\t// Limit commentsDepth to 3\n\tconst commentsDepth = ! threadComments\n\t\t? 1\n\t\t: Math.min( threadCommentsDepth, 3 );\n\n\tconst buildChildrenComment = ( commentsLevel ) => {\n\t\t// Render children comments until commentsDepth is reached\n\t\tif ( commentsLevel < commentsDepth ) {\n\t\t\tconst nextLevel = commentsLevel + 1;\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tcommentId: -( commentsLevel + 3 ),\n\t\t\t\t\tchildren: buildChildrenComment( nextLevel ),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\treturn [];\n\t};\n\n\t// Add the first comment and its children\n\tconst placeholderComments = [\n\t\t{ commentId: -1, children: buildChildrenComment( 1 ) },\n\t];\n\n\t// Add a second comment unless the break comments setting is active and set to less than 2, and there is one nested comment max\n\tif ( ( ! pageComments || perPage >= 2 ) && commentsDepth < 3 ) {\n\t\tplaceholderComments.push( {\n\t\t\tcommentId: -2,\n\t\t\tchildren: [],\n\t\t} );\n\t}\n\n\t// Add a third comment unless the break comments setting is active and set to less than 3, and there aren't nested comments\n\tif ( ( ! pageComments || perPage >= 3 ) && commentsDepth < 2 ) {\n\t\tplaceholderComments.push( {\n\t\t\tcommentId: -3,\n\t\t\tchildren: [],\n\t\t} );\n\t}\n\n\t// In case that the value is set but larger than 3 we truncate it to 3.\n\treturn placeholderComments;\n};\n\n/**\n * Component which renders the inner blocks of the Comment Template.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.comment] - A comment object.\n * @param {Array} [props.activeCommentId] - The ID of the comment that is currently active.\n * @param {Array} [props.setActiveCommentId] - The setter for activeCommentId.\n * @param {Array} [props.firstCommentId] - ID of the first comment in the array.\n * @param {Array} [props.blocks] - Array of blocks returned from\n * getBlocks() in parent .\n * @return {WPElement} \t\tInner blocks of the Comment Template\n */\nfunction CommentTemplateInnerBlocks( {\n\tcomment,\n\tactiveCommentId,\n\tsetActiveCommentId,\n\tfirstCommentId,\n\tblocks,\n} ) {\n\tconst { children, ...innerBlocksProps } = useInnerBlocksProps(\n\t\t{},\n\t\t{ template: TEMPLATE }\n\t);\n\n\treturn (\n\t\t<li { ...innerBlocksProps }>\n\t\t\t{ comment.commentId === ( activeCommentId || firstCommentId )\n\t\t\t\t? children\n\t\t\t\t: null }\n\n\t\t\t{ /* To avoid flicker when switching active block contexts, a preview\n\t\t\t is ALWAYS rendered and the preview for the active block is hidden.\n\t\t\t This ensures that when switching the active block, the component is not\n\t\t\t mounted again but rather it only toggles the `isHidden` prop.\n\t\t\t The same strategy is used for preventing the flicker in the Post Template\n\t\t\t block. */ }\n\t\t\t<MemoizedCommentTemplatePreview\n\t\t\t\tblocks={ blocks }\n\t\t\t\tcommentId={ comment.commentId }\n\t\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\t\tisHidden={\n\t\t\t\t\tcomment.commentId === ( activeCommentId || firstCommentId )\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t{ comment?.children?.length > 0 ? (\n\t\t\t\t<CommentsList\n\t\t\t\t\tcomments={ comment.children }\n\t\t\t\t\tactiveCommentId={ activeCommentId }\n\t\t\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tfirstCommentId={ firstCommentId }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t</li>\n\t);\n}\n\nconst CommentTemplatePreview = ( {\n\tblocks,\n\tcommentId,\n\tsetActiveCommentId,\n\tisHidden,\n} ) => {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveCommentId( commentId );\n\t};\n\n\t// We have to hide the preview block if the `comment` props points to\n\t// the curently active block!\n\n\t// Or, to put it differently, every preview block is visible unless it is the\n\t// currently active block - in this case we render its inner blocks.\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"button\"\n\t\t\tstyle={ style }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t/>\n\t);\n};\n\nconst MemoizedCommentTemplatePreview = memo( CommentTemplatePreview );\n\n/**\n * Component that renders a list of (nested) comments. It is called recursively.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.comments] - Array of comment objects.\n * @param {Array} [props.blockProps] - Props from parent's `useBlockProps()`.\n * @param {Array} [props.activeCommentId] - The ID of the comment that is currently active.\n * @param {Array} [props.setActiveCommentId] - The setter for activeCommentId.\n * @param {Array} [props.blocks] - Array of blocks returned from getBlocks() in parent.\n * @param {Object} [props.firstCommentId] - The ID of the first comment in the array of\n * comment objects.\n * @return {WPElement} \t\tList of comments.\n */\nconst CommentsList = ( {\n\tcomments,\n\tblockProps,\n\tactiveCommentId,\n\tsetActiveCommentId,\n\tblocks,\n\tfirstCommentId,\n} ) => (\n\t<ol { ...blockProps }>\n\t\t{ comments &&\n\t\t\tcomments.map( ( { commentId, ...comment }, index ) => (\n\t\t\t\t<BlockContextProvider\n\t\t\t\t\tkey={ comment.commentId || index }\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t// If the commentId is negative it means that this comment is a\n\t\t\t\t\t\t// \"placeholder\" and that the block is most likely being used in the\n\t\t\t\t\t\t// site editor. In this case, we have to set the commentId to `null`\n\t\t\t\t\t\t// because otherwise the (non-existent) comment with a negative ID\n\t\t\t\t\t\t// would be reqested from the REST API.\n\t\t\t\t\t\tcommentId: commentId < 0 ? null : commentId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<CommentTemplateInnerBlocks\n\t\t\t\t\t\tcomment={ { commentId, ...comment } }\n\t\t\t\t\t\tactiveCommentId={ activeCommentId }\n\t\t\t\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\tfirstCommentId={ firstCommentId }\n\t\t\t\t\t/>\n\t\t\t\t</BlockContextProvider>\n\t\t\t) ) }\n\t</ol>\n);\n\nexport default function CommentTemplateEdit( {\n\tclientId,\n\tcontext: { postId },\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst [ activeCommentId, setActiveCommentId ] = useState();\n\tconst {\n\t\tcommentOrder,\n\t\tthreadCommentsDepth,\n\t\tthreadComments,\n\t\tcommentsPerPage,\n\t\tpageComments,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalDiscussionSettings;\n\t} );\n\n\tconst commentQuery = useCommentQueryArgs( {\n\t\tpostId,\n\t} );\n\n\tconst { topLevelComments, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\t// Request only top-level comments. Replies are embedded.\n\t\t\t\ttopLevelComments: commentQuery\n\t\t\t\t\t? getEntityRecords( 'root', 'comment', commentQuery )\n\t\t\t\t\t: null,\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, commentQuery ]\n\t);\n\n\t// Generate a tree structure of comment IDs.\n\tlet commentTree = useCommentTree(\n\t\t// Reverse the order of top comments if needed.\n\t\tcommentOrder === 'desc' && topLevelComments\n\t\t\t? [ ...topLevelComments ].reverse()\n\t\t\t: topLevelComments\n\t);\n\n\tif ( ! topLevelComments ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! postId ) {\n\t\tcommentTree = getCommentsPlaceholder( {\n\t\t\tperPage: commentsPerPage,\n\t\t\tpageComments,\n\t\t\tthreadComments,\n\t\t\tthreadCommentsDepth,\n\t\t} );\n\t}\n\n\tif ( ! commentTree.length ) {\n\t\treturn <p { ...blockProps }>{ __( 'No results found.' ) }</p>;\n\t}\n\n\treturn (\n\t\t<CommentsList\n\t\t\tcomments={ commentTree }\n\t\t\tblockProps={ blockProps }\n\t\t\tblocks={ blocks }\n\t\t\tactiveCommentId={ activeCommentId }\n\t\t\tsetActiveCommentId={ setActiveCommentId }\n\t\t\tfirstCommentId={ commentTree[ 0 ]?.commentId }\n\t\t/>\n\t);\n}\n"]}
@@ -17,8 +17,6 @@ var _data = require("@wordpress/data");
17
17
 
18
18
  var _coreData = require("@wordpress/core-data");
19
19
 
20
- var _compose = require("@wordpress/compose");
21
-
22
20
  var _form = _interopRequireDefault(require("../../post-comments-form/form"));
23
21
 
24
22
  /**
@@ -38,10 +36,9 @@ function PostCommentsPlaceholder(_ref) {
38
36
  const {
39
37
  avatarURL
40
38
  } = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings().__experimentalDiscussionSettings);
41
- const disabledRef = (0, _compose.useDisabled)();
42
39
  return (0, _element.createElement)("div", {
43
40
  className: "wp-block-comments__legacy-placeholder",
44
- ref: disabledRef
41
+ inert: "true"
45
42
  }, (0, _element.createElement)("h3", null,
46
43
  /* translators: %s: Post title. */
47
44
  (0, _i18n.sprintf)((0, _i18n.__)('One response to %s'), postTitle)), (0, _element.createElement)("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comments/edit/placeholder.js"],"names":["PostCommentsPlaceholder","postType","postId","postTitle","avatarURL","select","blockEditorStore","getSettings","__experimentalDiscussionSettings","disabledRef"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,uBAAT,OAAyD;AAAA,MAAvB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAuB;AACvE,MAAI,CAAEC,SAAF,IAAgB,6BAAe,UAAf,EAA2BF,QAA3B,EAAqC,OAArC,EAA8CC,MAA9C,CAApB;AACAC,EAAAA,SAAS,GAAGA,SAAS,IAAI,cAAI,YAAJ,CAAzB;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,qBACnBC,MAAF,IACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,WAA3B,GACEC,gCAHkB,CAAtB;AAMA,QAAMC,WAAW,GAAG,2BAApB;AAEA,SACC;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,GAAG,EAAGA;AAFP,KAIC;AAEE;AACA,qBAAS,cAAI,oBAAJ,CAAT,EAAqCN,SAArC,CAHF,CAJD,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAG,IAAA,IAAI,EAAC;AAAR,cAAmB,cAAI,gBAAJ,CAAnB,CADD,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAG,IAAA,IAAI,EAAC;AAAR,KAAiB,cAAI,gBAAJ,CAAjB,UADD,CAJD,CAXD,EAoBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACC;AAAS,I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;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAG,IAAA,IAAI,EAAC;AAAR,cAAmB,cAAI,gBAAJ,CAAnB,CADD,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAG,IAAA,IAAI,EAAC;AAAR,KAAiB,cAAI,gBAAJ,CAAjB,UADD,CAJD,CApFD,EA6FC,4BAAC,aAAD;AAAc,IAAA,MAAM,EAAGF,MAAvB;AAAgC,IAAA,QAAQ,EAAGD;AAA3C,IA7FD,CADD;AAiGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useDisabled } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst { avatarURL } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst disabledRef = useDisabled();\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"wp-block-comments__legacy-placeholder\"\n\t\t\tref={ disabledRef }\n\t\t>\n\t\t\t<h3>\n\t\t\t\t{\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t}\n\t\t\t</h3>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<ol className=\"commentlist\">\n\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt=\"Commenter Avatar\"\n\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'A WordPress Commenter' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</b>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"says\">{ __( 'says' ) }:</span>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T00:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'January 1, 2000 at 00:00 am' ) }\n\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __( 'Commenter avatars come from' ) }{ ' ' }\n\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\">Gravatar</a>.\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\taria-label=\"Reply to A WordPress Commenter\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Reply' ) }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>\n\t\t\t</ol>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<CommentsForm postId={ postId } postType={ postType } />\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comments/edit/placeholder.js"],"names":["PostCommentsPlaceholder","postType","postId","postTitle","avatarURL","select","blockEditorStore","getSettings","__experimentalDiscussionSettings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;A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\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst { avatarURL } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\treturn (\n\t\t<div className=\"wp-block-comments__legacy-placeholder\" inert=\"true\">\n\t\t\t<h3>\n\t\t\t\t{\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t}\n\t\t\t</h3>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<ol className=\"commentlist\">\n\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt=\"Commenter Avatar\"\n\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'A WordPress Commenter' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</b>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"says\">{ __( 'says' ) }:</span>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T00:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'January 1, 2000 at 00:00 am' ) }\n\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __( 'Commenter avatars come from' ) }{ ' ' }\n\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\">Gravatar</a>.\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\taria-label=\"Reply to A WordPress Commenter\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Reply' ) }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>\n\t\t\t</ol>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<CommentsForm postId={ postId } postType={ postType } />\n\t\t</div>\n\t);\n}\n"]}
@@ -44,7 +44,6 @@ const metadata = {
44
44
  },
45
45
  supports: {
46
46
  align: ["wide", "full"],
47
- html: false,
48
47
  color: {
49
48
  gradients: true,
50
49
  link: true,
@@ -54,6 +53,11 @@ const metadata = {
54
53
  link: true
55
54
  }
56
55
  },
56
+ html: false,
57
+ spacing: {
58
+ margin: true,
59
+ padding: true
60
+ },
57
61
  typography: {
58
62
  fontSize: true,
59
63
  lineHeight: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comments/index.js"],"names":["name","metadata","settings","icon","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,mBADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA;AAJuB,CAAjB;;;AAOA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEP,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postComments as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comments/index.js"],"names":["name","metadata","settings","icon","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,mBADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA,aAHuB;AAIvBC,EAAAA,UAAU,EAAVA;AAJuB,CAAjB;;;AAOA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEP,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postComments as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -19,6 +19,8 @@ var _coreData = require("@wordpress/core-data");
19
19
 
20
20
  var _components = require("@wordpress/components");
21
21
 
22
+ var _data = require("@wordpress/data");
23
+
22
24
  var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
23
25
 
24
26
  var _url = require("@wordpress/url");
@@ -59,9 +61,24 @@ function Edit(_ref) {
59
61
  [`has-text-align-${textAlign}`]: textAlign
60
62
  })
61
63
  });
64
+ const {
65
+ threadCommentsDepth,
66
+ threadComments,
67
+ commentsPerPage,
68
+ pageComments
69
+ } = (0, _data.useSelect)(select => {
70
+ const {
71
+ getSettings
72
+ } = select(_blockEditor.store);
73
+ return getSettings().__experimentalDiscussionSettings;
74
+ });
62
75
  (0, _element.useEffect)(() => {
63
76
  if (isSiteEditor) {
64
- setCommentsCount(3);
77
+ // Match the number of comments that will be shown in the comment-template/edit.js placeholder
78
+ const nestedCommentsNumber = threadComments ? Math.min(threadCommentsDepth, 3) - 1 : 0;
79
+ const topLevelCommentsNumber = pageComments ? commentsPerPage : 3;
80
+ const commentsNumber = parseInt(nestedCommentsNumber) + parseInt(topLevelCommentsNumber);
81
+ setCommentsCount(Math.min(commentsNumber, 3));
65
82
  return;
66
83
  }
67
84
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comments-title/edit.js"],"names":["Edit","attributes","textAlign","showPostTitle","showCommentsCount","level","setAttributes","context","postType","postId","TagName","commentsCount","setCommentsCount","rawTitle","isSiteEditor","blockProps","className","currentPostId","path","post","_fields","method","parse","then","res","parseInt","headers","get","catch","blockControls","newAlign","newLevel","inspectorControls","value","postTitle","placeholder","undefined"],"mappings":";;;;;;;;;AAiBA;;AAdA;;AAKA;;AAMA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAxBA;AACA;AACA;;AAGA;AAC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AK,CAAvB,EAA2B;AAC1B;AACAwB,QAAAA,WAAW,GAAG,mBAAS,cAAI,oBAAJ,CAAT,EAAqCD,SAArC,CAAd;AACA,OAHD,MAGO;AACNC,QAAAA,WAAW,GAAG;AACb;AACA,sBACC,uBADD,EAEC,wBAFD,EAGCxB,aAHD,CAFa,EAObA,aAPa,EAQbuB,SARa,CAAd;AAUA;AACD,KAhBD,MAgBO,IAAKvB,aAAa,KAAK,CAAvB,EAA2B;AACjCwB,MAAAA,WAAW,GAAG,cAAI,cAAJ,CAAd;AACA,KAFM,MAEA;AACNA,MAAAA,WAAW,GAAG;AACb;AACA,oBAAI,aAAJ,EAAmB,cAAnB,EAAmCxB,aAAnC,CAFa,EAGbA,aAHa,CAAd;AAKA;AACD,GA1BD,MA0BO,IAAKR,aAAL,EAAqB;AAC3B,QAAKQ,aAAa,KAAK,CAAvB,EAA2B;AAC1B;AACAwB,MAAAA,WAAW,GAAG,mBAAS,cAAI,gBAAJ,CAAT,EAAiCD,SAAjC,CAAd;AACA,KAHD,MAGO;AACN;AACAC,MAAAA,WAAW,GAAG,mBAAS,cAAI,iBAAJ,CAAT,EAAkCD,SAAlC,CAAd;AACA;AACD,GARM,MAQA,IAAKvB,aAAa,KAAK,CAAvB,EAA2B;AACjCwB,IAAAA,WAAW,GAAG,cAAI,UAAJ,CAAd;AACA,GAFM,MAEA;AACNA,IAAAA,WAAW,GAAG,cAAI,WAAJ,CAAd;AACA;;AAED,SACC,qDACGN,aADH,EAEGG,iBAFH,EAGC,4BAAC,OAAD,EAAcjB,UAAd,EAA6BoB,WAA7B,CAHD,CADD;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\n\nexport default function Edit( {\n\tattributes: { textAlign, showPostTitle, showCommentsCount, level },\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst TagName = 'h' + level;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tconst isSiteEditor = typeof postId === 'undefined';\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isSiteEditor ) {\n\t\t\tsetCommentsCount( 3 );\n\t\t\treturn;\n\t\t}\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\t\tif ( currentPostId === postId ) {\n\t\t\t\t\tsetCommentsCount(\n\t\t\t\t\t\tparseInt( res.headers.get( 'X-WP-Total' ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetCommentsCount( 0 );\n\t\t\t} );\n\t}, [ postId ] );\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<HeadingLevelDropdown\n\t\t\t\tselectedLevel={ level }\n\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst postTitle = isSiteEditor ? __( '“Post Title”' ) : `\"${ rawTitle }\"`;\n\n\tlet placeholder;\n\tif ( showCommentsCount && commentsCount !== undefined ) {\n\t\tif ( showPostTitle ) {\n\t\t\tif ( commentsCount === 1 ) {\n\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\tplaceholder = sprintf( __( 'One response to %s' ), postTitle );\n\t\t\t} else {\n\t\t\t\tplaceholder = sprintf(\n\t\t\t\t\t/* translators: 1: Number of comments, 2: Post title. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%1$s response to %2$s',\n\t\t\t\t\t\t'%1$s responses to %2$s',\n\t\t\t\t\t\tcommentsCount\n\t\t\t\t\t),\n\t\t\t\t\tcommentsCount,\n\t\t\t\t\tpostTitle\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( commentsCount === 1 ) {\n\t\t\tplaceholder = __( 'One response' );\n\t\t} else {\n\t\t\tplaceholder = sprintf(\n\t\t\t\t/* translators: %s: Number of comments. */\n\t\t\t\t_n( '%s response', '%s responses', commentsCount ),\n\t\t\t\tcommentsCount\n\t\t\t);\n\t\t}\n\t} else if ( showPostTitle ) {\n\t\tif ( commentsCount === 1 ) {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Response to %s' ), postTitle );\n\t\t} else {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Responses to %s' ), postTitle );\n\t\t}\n\t} else if ( commentsCount === 1 ) {\n\t\tplaceholder = __( 'Response' );\n\t} else {\n\t\tplaceholder = __( 'Responses' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName { ...blockProps }>{ placeholder }</TagName>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/comments-title/edit.js"],"names":["Edit","attributes","textAlign","showPostTitle","showCommentsCount","level","setAttributes","context","postType","postId","TagName","commentsCount","setCommentsCount","rawTitle","isSiteEditor","blockProps","className","threadCommentsDepth","threadComments","commentsPerPage","pageComments","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","nestedCommentsNumber","Math","min","topLevelCommentsNumber","commentsNumber","parseInt","currentPostId","path","post","_fields","method","parse","then","res","headers","get","catch","blockControls","newAlign","newLevel","inspectorControls","value","postTitle","placeholder","undefined"],"mappings":";;;;;;;;;AAkBA;;AAfA;;AAKA;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;AAGe,SAASA,IAAT,OAIX;AAAA,MAJ0B;AAC7BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;AAAaC,MAAAA,aAAb;AAA4BC,MAAAA,iBAA5B;AAA+CC,MAAAA;AAA/C,KADiB;AAE7BC,IAAAA,aAF6B;AAG7BC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AAHoB,GAI1B;AACH,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iC,WAA7B,CAHD,CADD;AAOA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelDropdown from '../heading/heading-level-dropdown';\n\nexport default function Edit( {\n\tattributes: { textAlign, showPostTitle, showCommentsCount, level },\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tconst TagName = 'h' + level;\n\tconst [ commentsCount, setCommentsCount ] = useState();\n\tconst [ rawTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tconst isSiteEditor = typeof postId === 'undefined';\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst {\n\t\tthreadCommentsDepth,\n\t\tthreadComments,\n\t\tcommentsPerPage,\n\t\tpageComments,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalDiscussionSettings;\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isSiteEditor ) {\n\t\t\t// Match the number of comments that will be shown in the comment-template/edit.js placeholder\n\n\t\t\tconst nestedCommentsNumber = threadComments\n\t\t\t\t? Math.min( threadCommentsDepth, 3 ) - 1\n\t\t\t\t: 0;\n\t\t\tconst topLevelCommentsNumber = pageComments ? commentsPerPage : 3;\n\n\t\t\tconst commentsNumber =\n\t\t\t\tparseInt( nestedCommentsNumber ) +\n\t\t\t\tparseInt( topLevelCommentsNumber );\n\n\t\t\tsetCommentsCount( Math.min( commentsNumber, 3 ) );\n\t\t\treturn;\n\t\t}\n\t\tconst currentPostId = postId;\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/comments', {\n\t\t\t\tpost: postId,\n\t\t\t\t_fields: 'id',\n\t\t\t} ),\n\t\t\tmethod: 'HEAD',\n\t\t\tparse: false,\n\t\t} )\n\t\t\t.then( ( res ) => {\n\t\t\t\t// Stale requests will have the `currentPostId` of an older closure.\n\t\t\t\tif ( currentPostId === postId ) {\n\t\t\t\t\tsetCommentsCount(\n\t\t\t\t\t\tparseInt( res.headers.get( 'X-WP-Total' ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tsetCommentsCount( 0 );\n\t\t\t} );\n\t}, [ postId ] );\n\n\tconst blockControls = (\n\t\t<BlockControls group=\"block\">\n\t\t\t<AlignmentControl\n\t\t\t\tvalue={ textAlign }\n\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<HeadingLevelDropdown\n\t\t\t\tselectedLevel={ level }\n\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst postTitle = isSiteEditor ? __( '“Post Title”' ) : `\"${ rawTitle }\"`;\n\n\tlet placeholder;\n\tif ( showCommentsCount && commentsCount !== undefined ) {\n\t\tif ( showPostTitle ) {\n\t\t\tif ( commentsCount === 1 ) {\n\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\tplaceholder = sprintf( __( 'One response to %s' ), postTitle );\n\t\t\t} else {\n\t\t\t\tplaceholder = sprintf(\n\t\t\t\t\t/* translators: 1: Number of comments, 2: Post title. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%1$s response to %2$s',\n\t\t\t\t\t\t'%1$s responses to %2$s',\n\t\t\t\t\t\tcommentsCount\n\t\t\t\t\t),\n\t\t\t\t\tcommentsCount,\n\t\t\t\t\tpostTitle\n\t\t\t\t);\n\t\t\t}\n\t\t} else if ( commentsCount === 1 ) {\n\t\t\tplaceholder = __( 'One response' );\n\t\t} else {\n\t\t\tplaceholder = sprintf(\n\t\t\t\t/* translators: %s: Number of comments. */\n\t\t\t\t_n( '%s response', '%s responses', commentsCount ),\n\t\t\t\tcommentsCount\n\t\t\t);\n\t\t}\n\t} else if ( showPostTitle ) {\n\t\tif ( commentsCount === 1 ) {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Response to %s' ), postTitle );\n\t\t} else {\n\t\t\t/* translators: %s: Post title. */\n\t\t\tplaceholder = sprintf( __( 'Responses to %s' ), postTitle );\n\t\t}\n\t} else if ( commentsCount === 1 ) {\n\t\tplaceholder = __( 'Response' );\n\t} else {\n\t\tplaceholder = __( 'Responses' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<TagName { ...blockProps }>{ placeholder }</TagName>\n\t\t</>\n\t);\n}\n"]}
@@ -139,8 +139,7 @@ function CoverEdit(_ref) {
139
139
  });
140
140
  };
141
141
 
142
- const mediaElement = (0, _element.useRef)();
143
- const isCoverDark = (0, _useCoverIsDark.default)(url, dimRatio, overlayColor.color, mediaElement);
142
+ const isCoverDark = (0, _useCoverIsDark.default)(url, dimRatio, overlayColor.color);
144
143
  (0, _element.useEffect)(() => {
145
144
  // This side-effect should not create an undo level.
146
145
  __unstableMarkNextChangeAsNotPersistent();
@@ -183,6 +182,7 @@ function CoverEdit(_ref) {
183
182
  allowedBlocks,
184
183
  templateLock
185
184
  });
185
+ const mediaElement = (0, _element.useRef)();
186
186
  const currentSettings = {
187
187
  isVideoBackground,
188
188
  isImageBackground,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/cover/edit/index.js"],"names":["namesPlugin","getInnerBlocksTemplate","attributes","align","placeholder","isTemporaryMedia","id","url","CoverEdit","clientId","isSelected","overlayColor","setAttributes","setOverlayColor","toggleSelection","context","postId","postType","contentPosition","useFeaturedImage","dimRatio","focalPoint","hasParallax","isDark","isRepeated","minHeight","minHeightUnit","alt","allowedBlocks","templateLock","featuredImage","media","select","coreStore","getMedia","mediaUrl","source_url","backgroundType","IMAGE_BACKGROUND_TYPE","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","createErrorNotice","noticesStore","gradientClass","gradientValue","onSelectMedia","isUploadingMedia","onUploadError","message","type","mediaElement","isCoverDark","color","isImageBackground","isVideoBackground","VIDEO_BACKGROUND_TYPE","minHeightWithUnit","isImgElement","style","undefined","backgroundImage","backgroundPosition","bgStyle","backgroundColor","mediaStyle","objectPosition","hasBackground","hasInnerBlocks","getBlock","innerBlocks","length","ref","blockProps","hasFontSizes","innerBlocksTemplate","fontSize","innerBlocksProps","className","template","templateInsertUpdatesSelection","currentSettings","toggleUseFeaturedImage","blockControls","inspectorControls","value","newMinHeight","classes","class"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;AACA;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SAFU,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { Placeholder, Spinner } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport {\n\twithColors,\n\tColorPalette,\n\tuseBlockProps,\n\tuseSetting,\n\tuseInnerBlocksProps,\n\t__experimentalUseGradient,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport {\n\tattributesFromMedia,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from '../shared';\nimport useCoverIsDark from './use-cover-is-dark';\nimport CoverInspectorControls from './inspector-controls';\nimport CoverBlockControls from './block-controls';\nimport CoverPlaceholder from './cover-placeholder';\nimport ResizableCover from './resizable-cover';\n\nextend( [ namesPlugin ] );\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tplaceholder: __( 'Write title…' ),\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t],\n\t];\n}\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while\n * the media (image or video) is being uploaded and will not have an id allocated yet.\n *\n * @param {number} id The id of the media.\n * @param {string} url The url of the media.\n *\n * @return {boolean} Is the URL a Blob URL.\n */\nconst isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );\n\nfunction CoverEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\toverlayColor,\n\tsetAttributes,\n\tsetOverlayColor,\n\ttoggleSelection,\n\tcontext: { postId, postType },\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t} = attributes;\n\n\tconst [ featuredImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = media?.source_url;\n\n\t// instead of destructuring the attributes\n\t// we define the url and background type\n\t// depending on the value of the useFeaturedImage flag\n\t// to preview in edit the dynamic featured image\n\tconst url = useFeaturedImage ? mediaUrl : attributes.url;\n\tconst backgroundType = useFeaturedImage\n\t\t? IMAGE_BACKGROUND_TYPE\n\t\t: attributes.backgroundType;\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { gradientClass, gradientValue } = __experimentalUseGradient();\n\tconst onSelectMedia = attributesFromMedia( setAttributes, dimRatio );\n\tconst isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst mediaElement = useRef();\n\tconst isCoverDark = useCoverIsDark(\n\t\turl,\n\t\tdimRatio,\n\t\toverlayColor.color,\n\t\tmediaElement\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isDark: isCoverDark } );\n\t}, [ isCoverDark ] );\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst minHeightWithUnit =\n\t\tminHeight && minHeightUnit\n\t\t\t? `${ minHeight }${ minHeightUnit }`\n\t\t\t: minHeight;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t};\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst bgStyle = { backgroundColor: overlayColor.color };\n\tconst mediaStyle = {\n\t\tobjectPosition:\n\t\t\tfocalPoint && isImgElement\n\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t: undefined,\n\t};\n\n\tconst hasBackground = !! ( url || overlayColor.color || gradientValue );\n\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlock( clientId ).innerBlocks.length >\n\t\t\t0,\n\t\t[ clientId ]\n\t);\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\t// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.\n\tconst hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length;\n\tconst innerBlocksTemplate = getInnerBlocksTemplate( {\n\t\tfontSize: hasFontSizes ? 'large' : undefined,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t},\n\t\t{\n\t\t\ttemplate: innerBlocksTemplate,\n\t\t\ttemplateInsertUpdatesSelection: true,\n\t\t\tallowedBlocks,\n\t\t\ttemplateLock,\n\t\t}\n\t);\n\n\tconst currentSettings = {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\thasInnerBlocks,\n\t\turl,\n\t\tisImgElement,\n\t\toverlayColor,\n\t};\n\n\tconst toggleUseFeaturedImage = () => {\n\t\tsetAttributes( {\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tuseFeaturedImage: ! useFeaturedImage,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\tbackgroundType: useFeaturedImage\n\t\t\t\t? IMAGE_BACKGROUND_TYPE\n\t\t\t\t: undefined,\n\t\t} );\n\t};\n\n\tconst blockControls = (\n\t\t<CoverBlockControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t/>\n\t);\n\n\tconst inspectorControls = (\n\t\t<CoverInspectorControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tclientId={ clientId }\n\t\t\tsetOverlayColor={ setOverlayColor }\n\t\t\tcoverRef={ ref }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t/>\n\t);\n\n\tif ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockControls }\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<div\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'is-placeholder',\n\t\t\t\t\t\tblockProps.className\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<CoverPlaceholder\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tminHeight: minHeightWithUnit || undefined,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"wp-block-cover__placeholder-background-options\">\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t\tvalue={ overlayColor.color }\n\t\t\t\t\t\t\t\tonChange={ setOverlayColor }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</CoverPlaceholder>\n\t\t\t\t\t<ResizableCover\n\t\t\t\t\t\tclassName=\"block-library-cover__resize-container\"\n\t\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResize={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { minHeight: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStop={ ( newMinHeight ) => {\n\t\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst classes = classnames(\n\t\t{\n\t\t\t'is-dark-theme': isDark,\n\t\t\t'is-light': ! isDark,\n\t\t\t'is-transient': isUploadingMedia,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classnames( classes, blockProps.className ) }\n\t\t\t\tstyle={ { ...style, ...blockProps.style } }\n\t\t\t\tdata-url={ url }\n\t\t\t>\n\t\t\t\t<ResizableCover\n\t\t\t\t\tclassName=\"block-library-cover__resize-container\"\n\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonResize={ ( value ) => {\n\t\t\t\t\t\tsetAttributes( { minHeight: value } );\n\t\t\t\t\t} }\n\t\t\t\t\tonResizeStop={ ( newMinHeight ) => {\n\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t\t\t\t} }\n\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t/>\n\n\t\t\t\t{ ( ! useFeaturedImage || url ) && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ overlayColor.class ]: overlayColor.class,\n\t\t\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ { backgroundImage: gradientValue, ...bgStyle } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ ! url && useFeaturedImage && (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\tclassName=\"wp-block-cover__image--placeholder-image\"\n\t\t\t\t\t\twithIllustration={ true }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ url &&\n\t\t\t\t\tisImageBackground &&\n\t\t\t\t\t( isImgElement ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\tclassName=\"wp-block-cover__image-background\"\n\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\tclasses,\n\t\t\t\t\t\t\t\t'wp-block-cover__image-background'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ { backgroundImage, backgroundPosition } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ url && isVideoBackground && (\n\t\t\t\t\t<video\n\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\tclassName=\"wp-block-cover__video-background\"\n\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tloop\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isUploadingMedia && <Spinner /> }\n\t\t\t\t<CoverPlaceholder\n\t\t\t\t\tdisableMediaButtons\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( CoverEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/cover/edit/index.js"],"names":["namesPlugin","getInnerBlocksTemplate","attributes","align","placeholder","isTemporaryMedia","id","url","CoverEdit","clientId","isSelected","overlayColor","setAttributes","setOverlayColor","toggleSelection","context","postId","postType","contentPosition","useFeaturedImage","dimRatio","focalPoint","hasParallax","isDark","isRepeated","minHeight","minHeightUnit","alt","allowedBlocks","templateLock","featuredImage","media","select","coreStore","getMedia","mediaUrl","source_url","backgroundType","IMAGE_BACKGROUND_TYPE","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","createErrorNotice","noticesStore","gradientClass","gradientValue","onSelectMedia","isUploadingMedia","onUploadError","message","type","isCoverDark","color","isImageBackground","isVideoBackground","VIDEO_BACKGROUND_TYPE","minHeightWithUnit","isImgElement","style","undefined","backgroundImage","backgroundPosition","bgStyle","backgroundColor","mediaStyle","objectPosition","hasBackground","hasInnerBlocks","getBlock","innerBlocks","length","ref","blockProps","hasFontSizes","innerBlocksTemplate","fontSize","innerBlocksProps","className","template","templateInsertUpdatesSelection","mediaElement","currentSettings","toggleUseFeaturedImage","blockControls","inspectorControls","value","newMinHeight","classes","class"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AASA;;AACA;;AACA;;AACA;;AAKA;;AASA;;AACA;;AACA;;AACA;;AACA;;AA5CA;AACA;AACA;;AAKA;AACA;AACA;;AAmBA;AACA;AACA;AAgBA,oBAAQ,CAAEA,cAAF,CAAR;;AAEA,SAASC,sBAAT,CAAiCC,UAAjC,EAA8C;AAC7C,SAAO,CACN,CACC,gBADD,EAEC;AACCC,IAAAA,KAAK,EAAE,QADR;AAECC,IAAAA,WAAW,EAAE,cAAI,cAAJ,CAFd;AAGC,OAAGF;AAHJ,GAFD,CADM,CAAP;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,gBAAgB,GAAG,CAAEC,EAAF,EAAMC,GAAN,KAAe,CAAED,EAAF,IAAQ,qBAAWC,GAAX,CAAhD;;AAEA,SAASC,SAAT,OASI;AAAA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AAG,yBACXO,OADW,EAEX,kCAFW,CAHb;AAOC,IAAA,KAAK,EAAG;AAAE3B,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB;AAPT,IAXA,CAnDH,EAwEGrD,GAAG,IAAI8C,iBAAP,IACD;AACC,IAAA,GAAG,EAAG0B,YADP;AAEC,IAAA,SAAS,EAAC,kCAFX;AAGC,IAAA,QAAQ,MAHT;AAIC,IAAA,KAAK,MAJN;AAKC,IAAA,IAAI,MALL;AAMC,IAAA,GAAG,EAAGxE,GANP;AAOC,IAAA,KAAK,EAAGwD;AAPT,IAzEF,EAmFGjB,gBAAgB,IAAI,4BAAC,mBAAD,OAnFvB,EAoFC,4BAAC,yBAAD;AACC,IAAA,mBAAmB,MADpB;AAEC,IAAA,aAAa,EAAGD,aAFjB;AAGC,IAAA,OAAO,EAAGE,aAHX;AAIC,IAAA,sBAAsB,EAAGkC;AAJ1B,IApFD,EA0FC,mCAAUN,gBAAV,CA1FD,CAHD,CADD;AAkGA;;eAEc,sBAAS,CACvB,6BAAY;AAAEhE,EAAAA,YAAY,EAAE;AAAhB,CAAZ,CADuB,CAAT,EAEVH,SAFU,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { Placeholder, Spinner } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport {\n\twithColors,\n\tColorPalette,\n\tuseBlockProps,\n\tuseSetting,\n\tuseInnerBlocksProps,\n\t__experimentalUseGradient,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport {\n\tattributesFromMedia,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from '../shared';\nimport useCoverIsDark from './use-cover-is-dark';\nimport CoverInspectorControls from './inspector-controls';\nimport CoverBlockControls from './block-controls';\nimport CoverPlaceholder from './cover-placeholder';\nimport ResizableCover from './resizable-cover';\n\nextend( [ namesPlugin ] );\n\nfunction getInnerBlocksTemplate( attributes ) {\n\treturn [\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\talign: 'center',\n\t\t\t\tplaceholder: __( 'Write title…' ),\n\t\t\t\t...attributes,\n\t\t\t},\n\t\t],\n\t];\n}\n\n/**\n * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while\n * the media (image or video) is being uploaded and will not have an id allocated yet.\n *\n * @param {number} id The id of the media.\n * @param {string} url The url of the media.\n *\n * @return {boolean} Is the URL a Blob URL.\n */\nconst isTemporaryMedia = ( id, url ) => ! id && isBlobURL( url );\n\nfunction CoverEdit( {\n\tattributes,\n\tclientId,\n\tisSelected,\n\toverlayColor,\n\tsetAttributes,\n\tsetOverlayColor,\n\ttoggleSelection,\n\tcontext: { postId, postType },\n} ) {\n\tconst {\n\t\tcontentPosition,\n\t\tid,\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t} = attributes;\n\n\tconst [ featuredImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = media?.source_url;\n\n\t// instead of destructuring the attributes\n\t// we define the url and background type\n\t// depending on the value of the useFeaturedImage flag\n\t// to preview in edit the dynamic featured image\n\tconst url = useFeaturedImage ? mediaUrl : attributes.url;\n\tconst backgroundType = useFeaturedImage\n\t\t? IMAGE_BACKGROUND_TYPE\n\t\t: attributes.backgroundType;\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { gradientClass, gradientValue } = __experimentalUseGradient();\n\tconst onSelectMedia = attributesFromMedia( setAttributes, dimRatio );\n\tconst isUploadingMedia = isTemporaryMedia( id, url );\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst isCoverDark = useCoverIsDark( url, dimRatio, overlayColor.color );\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isDark: isCoverDark } );\n\t}, [ isCoverDark ] );\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst minHeightWithUnit =\n\t\tminHeight && minHeightUnit\n\t\t\t? `${ minHeight }${ minHeightUnit }`\n\t\t\t: minHeight;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeightWithUnit || undefined,\n\t};\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst bgStyle = { backgroundColor: overlayColor.color };\n\tconst mediaStyle = {\n\t\tobjectPosition:\n\t\t\tfocalPoint && isImgElement\n\t\t\t\t? mediaPosition( focalPoint )\n\t\t\t\t: undefined,\n\t};\n\n\tconst hasBackground = !! ( url || overlayColor.color || gradientValue );\n\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlock( clientId ).innerBlocks.length >\n\t\t\t0,\n\t\t[ clientId ]\n\t);\n\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\t// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.\n\tconst hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length;\n\tconst innerBlocksTemplate = getInnerBlocksTemplate( {\n\t\tfontSize: hasFontSizes ? 'large' : undefined,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t},\n\t\t{\n\t\t\ttemplate: innerBlocksTemplate,\n\t\t\ttemplateInsertUpdatesSelection: true,\n\t\t\tallowedBlocks,\n\t\t\ttemplateLock,\n\t\t}\n\t);\n\n\tconst mediaElement = useRef();\n\tconst currentSettings = {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\thasInnerBlocks,\n\t\turl,\n\t\tisImgElement,\n\t\toverlayColor,\n\t};\n\n\tconst toggleUseFeaturedImage = () => {\n\t\tsetAttributes( {\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t\tuseFeaturedImage: ! useFeaturedImage,\n\t\t\tdimRatio: dimRatio === 100 ? 50 : dimRatio,\n\t\t\tbackgroundType: useFeaturedImage\n\t\t\t\t? IMAGE_BACKGROUND_TYPE\n\t\t\t\t: undefined,\n\t\t} );\n\t};\n\n\tconst blockControls = (\n\t\t<CoverBlockControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t/>\n\t);\n\n\tconst inspectorControls = (\n\t\t<CoverInspectorControls\n\t\t\tattributes={ attributes }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tclientId={ clientId }\n\t\t\tsetOverlayColor={ setOverlayColor }\n\t\t\tcoverRef={ ref }\n\t\t\tcurrentSettings={ currentSettings }\n\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t/>\n\t);\n\n\tif ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockControls }\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<div\n\t\t\t\t\t{ ...blockProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'is-placeholder',\n\t\t\t\t\t\tblockProps.className\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<CoverPlaceholder\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tminHeight: minHeightWithUnit || undefined,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"wp-block-cover__placeholder-background-options\">\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t\tvalue={ overlayColor.color }\n\t\t\t\t\t\t\t\tonChange={ setOverlayColor }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</CoverPlaceholder>\n\t\t\t\t\t<ResizableCover\n\t\t\t\t\t\tclassName=\"block-library-cover__resize-container\"\n\t\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResize={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { minHeight: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStop={ ( newMinHeight ) => {\n\t\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst classes = classnames(\n\t\t{\n\t\t\t'is-dark-theme': isDark,\n\t\t\t'is-light': ! isDark,\n\t\t\t'is-transient': isUploadingMedia,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div\n\t\t\t\t{ ...blockProps }\n\t\t\t\tclassName={ classnames( classes, blockProps.className ) }\n\t\t\t\tstyle={ { ...style, ...blockProps.style } }\n\t\t\t\tdata-url={ url }\n\t\t\t>\n\t\t\t\t<ResizableCover\n\t\t\t\t\tclassName=\"block-library-cover__resize-container\"\n\t\t\t\t\tonResizeStart={ () => {\n\t\t\t\t\t\tsetAttributes( { minHeightUnit: 'px' } );\n\t\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonResize={ ( value ) => {\n\t\t\t\t\t\tsetAttributes( { minHeight: value } );\n\t\t\t\t\t} }\n\t\t\t\t\tonResizeStop={ ( newMinHeight ) => {\n\t\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } );\n\t\t\t\t\t} }\n\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t/>\n\n\t\t\t\t{ ( ! useFeaturedImage || url ) && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ overlayColor.class ]: overlayColor.class,\n\t\t\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyle={ { backgroundImage: gradientValue, ...bgStyle } }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ ! url && useFeaturedImage && (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\tclassName=\"wp-block-cover__image--placeholder-image\"\n\t\t\t\t\t\twithIllustration={ true }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ url &&\n\t\t\t\t\tisImageBackground &&\n\t\t\t\t\t( isImgElement ? (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\tclassName=\"wp-block-cover__image-background\"\n\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\tclasses,\n\t\t\t\t\t\t\t\t'wp-block-cover__image-background'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ { backgroundImage, backgroundPosition } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t{ url && isVideoBackground && (\n\t\t\t\t\t<video\n\t\t\t\t\t\tref={ mediaElement }\n\t\t\t\t\t\tclassName=\"wp-block-cover__video-background\"\n\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tloop\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ mediaStyle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ isUploadingMedia && <Spinner /> }\n\t\t\t\t<CoverPlaceholder\n\t\t\t\t\tdisableMediaButtons\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( CoverEdit );\n"]}