@wordpress/block-library 9.23.0 → 9.25.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 (606) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/button/edit.js +29 -17
  3. package/build/button/edit.js.map +1 -1
  4. package/build/code/index.js +2 -1
  5. package/build/code/index.js.map +1 -1
  6. package/build/columns/edit.js +18 -22
  7. package/build/columns/edit.js.map +1 -1
  8. package/build/comment-author-name/edit.js +41 -12
  9. package/build/comment-author-name/edit.js.map +1 -1
  10. package/build/comment-date/edit.js +41 -12
  11. package/build/comment-date/edit.js.map +1 -1
  12. package/build/comment-edit-link/edit.js +27 -7
  13. package/build/comment-edit-link/edit.js.map +1 -1
  14. package/build/comments/edit/comments-inspector-controls.js +1 -3
  15. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  16. package/build/comments-pagination/edit.js +23 -9
  17. package/build/comments-pagination/edit.js.map +1 -1
  18. package/build/comments-title/edit.js +41 -12
  19. package/build/comments-title/edit.js.map +1 -1
  20. package/build/details/edit.js +27 -3
  21. package/build/details/edit.js.map +1 -1
  22. package/build/details/index.js +2 -1
  23. package/build/details/index.js.map +1 -1
  24. package/build/embed/edit.js +2 -4
  25. package/build/embed/edit.js.map +1 -1
  26. package/build/embed/embed-controls.js +41 -22
  27. package/build/embed/embed-controls.js.map +1 -1
  28. package/build/file/inspector.js +73 -30
  29. package/build/file/inspector.js.map +1 -1
  30. package/build/form/edit.js +67 -37
  31. package/build/form/edit.js.map +1 -1
  32. package/build/form-input/edit.js +47 -18
  33. package/build/form-input/edit.js.map +1 -1
  34. package/build/html/index.js +2 -1
  35. package/build/html/index.js.map +1 -1
  36. package/build/image/constants.js +2 -1
  37. package/build/image/constants.js.map +1 -1
  38. package/build/image/edit.js +1 -1
  39. package/build/image/edit.js.map +1 -1
  40. package/build/image/image.js +1 -4
  41. package/build/image/image.js.map +1 -1
  42. package/build/latest-posts/edit.js +154 -82
  43. package/build/latest-posts/edit.js.map +1 -1
  44. package/build/list/ordered-list-settings.js +131 -52
  45. package/build/list/ordered-list-settings.js.map +1 -1
  46. package/build/more/index.js +2 -1
  47. package/build/more/index.js.map +1 -1
  48. package/build/navigation/edit/index.js +93 -51
  49. package/build/navigation/edit/index.js.map +1 -1
  50. package/build/navigation/edit/overlay-menu-preview.js +43 -27
  51. package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
  52. package/build/navigation-link/index.js +3 -0
  53. package/build/navigation-link/index.js.map +1 -1
  54. package/build/navigation-link/transforms.js +2 -0
  55. package/build/navigation-link/transforms.js.map +1 -1
  56. package/build/navigation-link/update-attributes.js +1 -0
  57. package/build/navigation-link/update-attributes.js.map +1 -1
  58. package/build/navigation-submenu/index.js +3 -0
  59. package/build/navigation-submenu/index.js.map +1 -1
  60. package/build/post-comments-count/index.js +3 -1
  61. package/build/post-comments-count/index.js.map +1 -1
  62. package/build/post-comments-count/transforms.js +26 -0
  63. package/build/post-comments-count/transforms.js.map +1 -0
  64. package/build/post-comments-link/index.js +3 -1
  65. package/build/post-comments-link/index.js.map +1 -1
  66. package/build/post-comments-link/transforms.js +26 -0
  67. package/build/post-comments-link/transforms.js.map +1 -0
  68. package/build/post-excerpt/edit.js +3 -1
  69. package/build/post-excerpt/edit.js.map +1 -1
  70. package/build/post-excerpt/index.js +2 -1
  71. package/build/post-excerpt/index.js.map +1 -1
  72. package/build/post-navigation-link/edit.js +3 -1
  73. package/build/post-navigation-link/edit.js.map +1 -1
  74. package/build/post-navigation-link/index.js +2 -1
  75. package/build/post-navigation-link/index.js.map +1 -1
  76. package/build/post-navigation-link/variations.js +13 -13
  77. package/build/post-navigation-link/variations.js.map +1 -1
  78. package/build/post-template/edit.js +5 -3
  79. package/build/post-template/edit.js.map +1 -1
  80. package/build/post-terms/edit.js +3 -1
  81. package/build/post-terms/edit.js.map +1 -1
  82. package/build/post-terms/index.js +4 -2
  83. package/build/post-terms/index.js.map +1 -1
  84. package/build/post-title/edit.js +56 -18
  85. package/build/post-title/edit.js.map +1 -1
  86. package/build/preformatted/transforms.js +5 -1
  87. package/build/preformatted/transforms.js.map +1 -1
  88. package/build/query/edit/enhanced-pagination-modal.js +1 -1
  89. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  90. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  91. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  92. package/build/read-more/index.js +2 -1
  93. package/build/read-more/index.js.map +1 -1
  94. package/build/rss/edit.js +120 -46
  95. package/build/rss/edit.js.map +1 -1
  96. package/build/rss/index.js +2 -1
  97. package/build/rss/index.js.map +1 -1
  98. package/build/search/edit.js +76 -86
  99. package/build/search/edit.js.map +1 -1
  100. package/build/separator/edit.js +52 -20
  101. package/build/separator/edit.js.map +1 -1
  102. package/build/shortcode/index.js +2 -1
  103. package/build/shortcode/index.js.map +1 -1
  104. package/build/social-link/variations.js +53 -48
  105. package/build/social-link/variations.js.map +1 -1
  106. package/build/social-links/edit.js +35 -45
  107. package/build/social-links/edit.js.map +1 -1
  108. package/build/table/edit.js +3 -2
  109. package/build/table/edit.js.map +1 -1
  110. package/build/table/index.js +8 -4
  111. package/build/table/index.js.map +1 -1
  112. package/build/video/tracks-editor.js +40 -12
  113. package/build/video/tracks-editor.js.map +1 -1
  114. package/build-module/button/edit.js +30 -18
  115. package/build-module/button/edit.js.map +1 -1
  116. package/build-module/code/index.js +2 -1
  117. package/build-module/code/index.js.map +1 -1
  118. package/build-module/columns/edit.js +18 -22
  119. package/build-module/columns/edit.js.map +1 -1
  120. package/build-module/comment-author-name/edit.js +42 -13
  121. package/build-module/comment-author-name/edit.js.map +1 -1
  122. package/build-module/comment-date/edit.js +42 -13
  123. package/build-module/comment-date/edit.js.map +1 -1
  124. package/build-module/comment-edit-link/edit.js +28 -8
  125. package/build-module/comment-edit-link/edit.js.map +1 -1
  126. package/build-module/comments/edit/comments-inspector-controls.js +1 -3
  127. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  128. package/build-module/comments-pagination/edit.js +24 -10
  129. package/build-module/comments-pagination/edit.js.map +1 -1
  130. package/build-module/comments-title/edit.js +42 -13
  131. package/build-module/comments-title/edit.js.map +1 -1
  132. package/build-module/details/edit.js +29 -5
  133. package/build-module/details/edit.js.map +1 -1
  134. package/build-module/details/index.js +2 -1
  135. package/build-module/details/index.js.map +1 -1
  136. package/build-module/embed/edit.js +2 -4
  137. package/build-module/embed/edit.js.map +1 -1
  138. package/build-module/embed/embed-controls.js +42 -23
  139. package/build-module/embed/embed-controls.js.map +1 -1
  140. package/build-module/file/inspector.js +74 -31
  141. package/build-module/file/inspector.js.map +1 -1
  142. package/build-module/form/edit.js +68 -38
  143. package/build-module/form/edit.js.map +1 -1
  144. package/build-module/form-input/edit.js +48 -19
  145. package/build-module/form-input/edit.js.map +1 -1
  146. package/build-module/html/index.js +2 -1
  147. package/build-module/html/index.js.map +1 -1
  148. package/build-module/image/constants.js +1 -0
  149. package/build-module/image/constants.js.map +1 -1
  150. package/build-module/image/edit.js +2 -2
  151. package/build-module/image/edit.js.map +1 -1
  152. package/build-module/image/image.js +2 -5
  153. package/build-module/image/image.js.map +1 -1
  154. package/build-module/latest-posts/edit.js +155 -83
  155. package/build-module/latest-posts/edit.js.map +1 -1
  156. package/build-module/list/ordered-list-settings.js +132 -53
  157. package/build-module/list/ordered-list-settings.js.map +1 -1
  158. package/build-module/more/index.js +2 -1
  159. package/build-module/more/index.js.map +1 -1
  160. package/build-module/navigation/edit/index.js +94 -52
  161. package/build-module/navigation/edit/index.js.map +1 -1
  162. package/build-module/navigation/edit/overlay-menu-preview.js +44 -28
  163. package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
  164. package/build-module/navigation-link/index.js +3 -0
  165. package/build-module/navigation-link/index.js.map +1 -1
  166. package/build-module/navigation-link/transforms.js +2 -0
  167. package/build-module/navigation-link/transforms.js.map +1 -1
  168. package/build-module/navigation-link/update-attributes.js +1 -0
  169. package/build-module/navigation-link/update-attributes.js.map +1 -1
  170. package/build-module/navigation-submenu/index.js +3 -0
  171. package/build-module/navigation-submenu/index.js.map +1 -1
  172. package/build-module/post-comments-count/index.js +3 -1
  173. package/build-module/post-comments-count/index.js.map +1 -1
  174. package/build-module/post-comments-count/transforms.js +19 -0
  175. package/build-module/post-comments-count/transforms.js.map +1 -0
  176. package/build-module/post-comments-link/index.js +3 -1
  177. package/build-module/post-comments-link/index.js.map +1 -1
  178. package/build-module/post-comments-link/transforms.js +19 -0
  179. package/build-module/post-comments-link/transforms.js.map +1 -0
  180. package/build-module/post-excerpt/edit.js +4 -2
  181. package/build-module/post-excerpt/edit.js.map +1 -1
  182. package/build-module/post-excerpt/index.js +2 -1
  183. package/build-module/post-excerpt/index.js.map +1 -1
  184. package/build-module/post-navigation-link/edit.js +4 -2
  185. package/build-module/post-navigation-link/edit.js.map +1 -1
  186. package/build-module/post-navigation-link/index.js +2 -1
  187. package/build-module/post-navigation-link/index.js.map +1 -1
  188. package/build-module/post-navigation-link/variations.js +13 -13
  189. package/build-module/post-navigation-link/variations.js.map +1 -1
  190. package/build-module/post-template/edit.js +5 -3
  191. package/build-module/post-template/edit.js.map +1 -1
  192. package/build-module/post-terms/edit.js +4 -2
  193. package/build-module/post-terms/edit.js.map +1 -1
  194. package/build-module/post-terms/index.js +4 -2
  195. package/build-module/post-terms/index.js.map +1 -1
  196. package/build-module/post-title/edit.js +57 -19
  197. package/build-module/post-title/edit.js.map +1 -1
  198. package/build-module/preformatted/transforms.js +5 -1
  199. package/build-module/preformatted/transforms.js.map +1 -1
  200. package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
  201. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  202. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  203. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  204. package/build-module/read-more/index.js +2 -1
  205. package/build-module/read-more/index.js.map +1 -1
  206. package/build-module/rss/edit.js +121 -47
  207. package/build-module/rss/edit.js.map +1 -1
  208. package/build-module/rss/index.js +2 -1
  209. package/build-module/rss/index.js.map +1 -1
  210. package/build-module/search/edit.js +78 -88
  211. package/build-module/search/edit.js.map +1 -1
  212. package/build-module/separator/edit.js +54 -22
  213. package/build-module/separator/edit.js.map +1 -1
  214. package/build-module/shortcode/index.js +2 -1
  215. package/build-module/shortcode/index.js.map +1 -1
  216. package/build-module/social-link/variations.js +53 -48
  217. package/build-module/social-link/variations.js.map +1 -1
  218. package/build-module/social-links/edit.js +37 -47
  219. package/build-module/social-links/edit.js.map +1 -1
  220. package/build-module/table/edit.js +4 -3
  221. package/build-module/table/edit.js.map +1 -1
  222. package/build-module/table/index.js +8 -4
  223. package/build-module/table/index.js.map +1 -1
  224. package/build-module/video/tracks-editor.js +41 -13
  225. package/build-module/video/tracks-editor.js.map +1 -1
  226. package/build-style/archives/editor-rtl.css +47 -11
  227. package/build-style/archives/editor.css +47 -11
  228. package/build-style/archives/style-rtl.css +47 -11
  229. package/build-style/archives/style.css +47 -11
  230. package/build-style/audio/editor-rtl.css +47 -11
  231. package/build-style/audio/editor.css +47 -11
  232. package/build-style/audio/style-rtl.css +47 -11
  233. package/build-style/audio/style.css +47 -11
  234. package/build-style/audio/theme-rtl.css +47 -11
  235. package/build-style/audio/theme.css +47 -11
  236. package/build-style/avatar/editor-rtl.css +47 -11
  237. package/build-style/avatar/editor.css +47 -11
  238. package/build-style/avatar/style-rtl.css +47 -11
  239. package/build-style/avatar/style.css +47 -11
  240. package/build-style/button/editor-rtl.css +47 -11
  241. package/build-style/button/editor.css +47 -11
  242. package/build-style/button/style-rtl.css +47 -12
  243. package/build-style/button/style.css +47 -12
  244. package/build-style/buttons/editor-rtl.css +47 -11
  245. package/build-style/buttons/editor.css +47 -11
  246. package/build-style/buttons/style-rtl.css +50 -11
  247. package/build-style/buttons/style.css +50 -11
  248. package/build-style/calendar/style-rtl.css +47 -11
  249. package/build-style/calendar/style.css +47 -11
  250. package/build-style/categories/editor-rtl.css +47 -11
  251. package/build-style/categories/editor.css +47 -11
  252. package/build-style/categories/style-rtl.css +47 -11
  253. package/build-style/categories/style.css +47 -11
  254. package/build-style/classic-rtl.css +47 -11
  255. package/build-style/classic.css +47 -11
  256. package/build-style/code/editor-rtl.css +47 -11
  257. package/build-style/code/editor.css +47 -11
  258. package/build-style/code/style-rtl.css +47 -11
  259. package/build-style/code/style.css +47 -11
  260. package/build-style/code/theme-rtl.css +47 -11
  261. package/build-style/code/theme.css +47 -11
  262. package/build-style/columns/editor-rtl.css +47 -11
  263. package/build-style/columns/editor.css +47 -11
  264. package/build-style/columns/style-rtl.css +47 -11
  265. package/build-style/columns/style.css +47 -11
  266. package/build-style/comment-author-avatar/editor-rtl.css +47 -11
  267. package/build-style/comment-author-avatar/editor.css +47 -11
  268. package/build-style/comment-author-name/style-rtl.css +47 -11
  269. package/build-style/comment-author-name/style.css +47 -11
  270. package/build-style/comment-content/style-rtl.css +47 -11
  271. package/build-style/comment-content/style.css +47 -11
  272. package/build-style/comment-date/style-rtl.css +47 -11
  273. package/build-style/comment-date/style.css +47 -11
  274. package/build-style/comment-edit-link/style-rtl.css +47 -11
  275. package/build-style/comment-edit-link/style.css +47 -11
  276. package/build-style/comment-reply-link/style-rtl.css +47 -11
  277. package/build-style/comment-reply-link/style.css +47 -11
  278. package/build-style/comment-template/style-rtl.css +47 -11
  279. package/build-style/comment-template/style.css +47 -11
  280. package/build-style/comments/editor-rtl.css +47 -11
  281. package/build-style/comments/editor.css +47 -11
  282. package/build-style/comments/style-rtl.css +47 -11
  283. package/build-style/comments/style.css +47 -11
  284. package/build-style/comments-pagination/editor-rtl.css +47 -11
  285. package/build-style/comments-pagination/editor.css +47 -11
  286. package/build-style/comments-pagination/style-rtl.css +47 -11
  287. package/build-style/comments-pagination/style.css +47 -11
  288. package/build-style/comments-pagination-numbers/editor-rtl.css +47 -11
  289. package/build-style/comments-pagination-numbers/editor.css +47 -11
  290. package/build-style/comments-title/editor-rtl.css +47 -11
  291. package/build-style/comments-title/editor.css +47 -11
  292. package/build-style/common-rtl.css +130 -9
  293. package/build-style/common.css +130 -9
  294. package/build-style/cover/editor-rtl.css +47 -11
  295. package/build-style/cover/editor.css +47 -11
  296. package/build-style/cover/style-rtl.css +47 -11
  297. package/build-style/cover/style.css +47 -11
  298. package/build-style/details/editor-rtl.css +47 -11
  299. package/build-style/details/editor.css +47 -11
  300. package/build-style/details/style-rtl.css +47 -11
  301. package/build-style/details/style.css +47 -11
  302. package/build-style/editor-elements-rtl.css +47 -11
  303. package/build-style/editor-elements.css +47 -11
  304. package/build-style/editor-rtl.css +57 -15
  305. package/build-style/editor.css +57 -15
  306. package/build-style/elements-rtl.css +47 -11
  307. package/build-style/elements.css +47 -11
  308. package/build-style/embed/editor-rtl.css +47 -11
  309. package/build-style/embed/editor.css +47 -11
  310. package/build-style/embed/style-rtl.css +47 -11
  311. package/build-style/embed/style.css +47 -11
  312. package/build-style/embed/theme-rtl.css +47 -11
  313. package/build-style/embed/theme.css +47 -11
  314. package/build-style/file/editor-rtl.css +47 -11
  315. package/build-style/file/editor.css +47 -11
  316. package/build-style/file/style-rtl.css +47 -11
  317. package/build-style/file/style.css +47 -11
  318. package/build-style/footnotes/style-rtl.css +47 -11
  319. package/build-style/footnotes/style.css +47 -11
  320. package/build-style/form-input/editor-rtl.css +47 -11
  321. package/build-style/form-input/editor.css +47 -11
  322. package/build-style/form-input/style-rtl.css +47 -11
  323. package/build-style/form-input/style.css +47 -11
  324. package/build-style/form-submission-notification/editor-rtl.css +47 -11
  325. package/build-style/form-submission-notification/editor.css +47 -11
  326. package/build-style/form-submit-button/style-rtl.css +47 -11
  327. package/build-style/form-submit-button/style.css +47 -11
  328. package/build-style/freeform/editor-rtl.css +47 -11
  329. package/build-style/freeform/editor.css +47 -11
  330. package/build-style/gallery/editor-rtl.css +47 -11
  331. package/build-style/gallery/editor.css +47 -11
  332. package/build-style/gallery/style-rtl.css +48 -11
  333. package/build-style/gallery/style.css +48 -11
  334. package/build-style/gallery/theme-rtl.css +47 -11
  335. package/build-style/gallery/theme.css +47 -11
  336. package/build-style/group/editor-rtl.css +47 -11
  337. package/build-style/group/editor.css +47 -11
  338. package/build-style/group/style-rtl.css +47 -11
  339. package/build-style/group/style.css +47 -11
  340. package/build-style/group/theme-rtl.css +47 -11
  341. package/build-style/group/theme.css +47 -11
  342. package/build-style/heading/style-rtl.css +47 -11
  343. package/build-style/heading/style.css +47 -11
  344. package/build-style/html/editor-rtl.css +48 -11
  345. package/build-style/html/editor.css +48 -11
  346. package/build-style/image/editor-rtl.css +47 -11
  347. package/build-style/image/editor.css +47 -11
  348. package/build-style/image/style-rtl.css +47 -11
  349. package/build-style/image/style.css +47 -11
  350. package/build-style/image/theme-rtl.css +47 -11
  351. package/build-style/image/theme.css +47 -11
  352. package/build-style/latest-comments/style-rtl.css +47 -11
  353. package/build-style/latest-comments/style.css +47 -11
  354. package/build-style/latest-posts/editor-rtl.css +47 -11
  355. package/build-style/latest-posts/editor.css +47 -11
  356. package/build-style/latest-posts/style-rtl.css +47 -11
  357. package/build-style/latest-posts/style.css +47 -11
  358. package/build-style/list/style-rtl.css +47 -11
  359. package/build-style/list/style.css +47 -11
  360. package/build-style/loginout/style-rtl.css +47 -11
  361. package/build-style/loginout/style.css +47 -11
  362. package/build-style/media-text/editor-rtl.css +47 -11
  363. package/build-style/media-text/editor.css +47 -11
  364. package/build-style/media-text/style-rtl.css +47 -11
  365. package/build-style/media-text/style.css +47 -11
  366. package/build-style/more/editor-rtl.css +47 -11
  367. package/build-style/more/editor.css +47 -11
  368. package/build-style/navigation/editor-rtl.css +55 -14
  369. package/build-style/navigation/editor.css +55 -14
  370. package/build-style/navigation/style-rtl.css +47 -11
  371. package/build-style/navigation/style.css +47 -11
  372. package/build-style/navigation-link/editor-rtl.css +47 -11
  373. package/build-style/navigation-link/editor.css +47 -11
  374. package/build-style/navigation-link/style-rtl.css +47 -11
  375. package/build-style/navigation-link/style.css +47 -11
  376. package/build-style/navigation-submenu/editor-rtl.css +47 -11
  377. package/build-style/navigation-submenu/editor.css +47 -11
  378. package/build-style/nextpage/editor-rtl.css +47 -11
  379. package/build-style/nextpage/editor.css +47 -11
  380. package/build-style/page-list/editor-rtl.css +47 -11
  381. package/build-style/page-list/editor.css +47 -11
  382. package/build-style/page-list/style-rtl.css +47 -11
  383. package/build-style/page-list/style.css +47 -11
  384. package/build-style/paragraph/editor-rtl.css +47 -11
  385. package/build-style/paragraph/editor.css +47 -11
  386. package/build-style/paragraph/style-rtl.css +47 -11
  387. package/build-style/paragraph/style.css +47 -11
  388. package/build-style/post-author/editor-rtl.css +47 -11
  389. package/build-style/post-author/editor.css +47 -11
  390. package/build-style/post-author/style-rtl.css +47 -11
  391. package/build-style/post-author/style.css +47 -11
  392. package/build-style/post-author-biography/style-rtl.css +47 -11
  393. package/build-style/post-author-biography/style.css +47 -11
  394. package/build-style/post-author-name/style-rtl.css +47 -11
  395. package/build-style/post-author-name/style.css +47 -11
  396. package/build-style/post-comments-count/style-rtl.css +47 -11
  397. package/build-style/post-comments-count/style.css +47 -11
  398. package/build-style/post-comments-form/editor-rtl.css +47 -11
  399. package/build-style/post-comments-form/editor.css +47 -11
  400. package/build-style/post-comments-form/style-rtl.css +47 -14
  401. package/build-style/post-comments-form/style.css +47 -14
  402. package/build-style/post-comments-link/style-rtl.css +47 -11
  403. package/build-style/post-comments-link/style.css +47 -11
  404. package/build-style/post-content/style-rtl.css +47 -11
  405. package/build-style/post-content/style.css +47 -11
  406. package/build-style/post-date/style-rtl.css +47 -11
  407. package/build-style/post-date/style.css +47 -11
  408. package/build-style/post-excerpt/editor-rtl.css +47 -11
  409. package/build-style/post-excerpt/editor.css +47 -11
  410. package/build-style/post-excerpt/style-rtl.css +47 -11
  411. package/build-style/post-excerpt/style.css +47 -11
  412. package/build-style/post-featured-image/editor-rtl.css +47 -11
  413. package/build-style/post-featured-image/editor.css +47 -11
  414. package/build-style/post-featured-image/style-rtl.css +47 -11
  415. package/build-style/post-featured-image/style.css +47 -11
  416. package/build-style/post-navigation-link/style-rtl.css +47 -11
  417. package/build-style/post-navigation-link/style.css +47 -11
  418. package/build-style/post-template/style-rtl.css +47 -11
  419. package/build-style/post-template/style.css +47 -11
  420. package/build-style/post-terms/style-rtl.css +47 -11
  421. package/build-style/post-terms/style.css +47 -11
  422. package/build-style/post-time-to-read/style-rtl.css +47 -11
  423. package/build-style/post-time-to-read/style.css +47 -11
  424. package/build-style/post-title/style-rtl.css +47 -11
  425. package/build-style/post-title/style.css +47 -11
  426. package/build-style/preformatted/style-rtl.css +47 -11
  427. package/build-style/preformatted/style.css +47 -11
  428. package/build-style/pullquote/editor-rtl.css +48 -12
  429. package/build-style/pullquote/editor.css +48 -12
  430. package/build-style/pullquote/style-rtl.css +49 -14
  431. package/build-style/pullquote/style.css +49 -14
  432. package/build-style/pullquote/theme-rtl.css +49 -13
  433. package/build-style/pullquote/theme.css +49 -13
  434. package/build-style/query/editor-rtl.css +47 -11
  435. package/build-style/query/editor.css +47 -11
  436. package/build-style/query-pagination/editor-rtl.css +47 -11
  437. package/build-style/query-pagination/editor.css +47 -11
  438. package/build-style/query-pagination/style-rtl.css +47 -11
  439. package/build-style/query-pagination/style.css +47 -11
  440. package/build-style/query-pagination-numbers/editor-rtl.css +47 -11
  441. package/build-style/query-pagination-numbers/editor.css +47 -11
  442. package/build-style/query-title/style-rtl.css +47 -11
  443. package/build-style/query-title/style.css +47 -11
  444. package/build-style/query-total/style-rtl.css +47 -11
  445. package/build-style/query-total/style.css +47 -11
  446. package/build-style/quote/style-rtl.css +47 -11
  447. package/build-style/quote/style.css +47 -11
  448. package/build-style/quote/theme-rtl.css +47 -11
  449. package/build-style/quote/theme.css +47 -11
  450. package/build-style/read-more/style-rtl.css +47 -11
  451. package/build-style/read-more/style.css +47 -11
  452. package/build-style/reset-rtl.css +47 -11
  453. package/build-style/reset.css +47 -11
  454. package/build-style/rss/editor-rtl.css +47 -11
  455. package/build-style/rss/editor.css +47 -11
  456. package/build-style/rss/style-rtl.css +47 -11
  457. package/build-style/rss/style.css +47 -11
  458. package/build-style/search/editor-rtl.css +47 -11
  459. package/build-style/search/editor.css +47 -11
  460. package/build-style/search/style-rtl.css +47 -11
  461. package/build-style/search/style.css +47 -11
  462. package/build-style/search/theme-rtl.css +47 -11
  463. package/build-style/search/theme.css +47 -11
  464. package/build-style/separator/editor-rtl.css +47 -11
  465. package/build-style/separator/editor.css +47 -11
  466. package/build-style/separator/style-rtl.css +47 -11
  467. package/build-style/separator/style.css +47 -11
  468. package/build-style/separator/theme-rtl.css +47 -11
  469. package/build-style/separator/theme.css +47 -11
  470. package/build-style/shortcode/editor-rtl.css +47 -11
  471. package/build-style/shortcode/editor.css +47 -11
  472. package/build-style/site-logo/editor-rtl.css +47 -11
  473. package/build-style/site-logo/editor.css +47 -11
  474. package/build-style/site-logo/style-rtl.css +47 -11
  475. package/build-style/site-logo/style.css +47 -11
  476. package/build-style/site-tagline/editor-rtl.css +47 -11
  477. package/build-style/site-tagline/editor.css +47 -11
  478. package/build-style/site-tagline/style-rtl.css +47 -11
  479. package/build-style/site-tagline/style.css +47 -11
  480. package/build-style/site-title/editor-rtl.css +47 -11
  481. package/build-style/site-title/editor.css +47 -11
  482. package/build-style/site-title/style-rtl.css +47 -11
  483. package/build-style/site-title/style.css +47 -11
  484. package/build-style/social-link/editor-rtl.css +47 -11
  485. package/build-style/social-link/editor.css +47 -11
  486. package/build-style/social-links/editor-rtl.css +47 -11
  487. package/build-style/social-links/editor.css +47 -11
  488. package/build-style/social-links/style-rtl.css +47 -11
  489. package/build-style/social-links/style.css +47 -11
  490. package/build-style/spacer/editor-rtl.css +47 -11
  491. package/build-style/spacer/editor.css +47 -11
  492. package/build-style/spacer/style-rtl.css +47 -11
  493. package/build-style/spacer/style.css +47 -11
  494. package/build-style/style-rtl.css +53 -18
  495. package/build-style/style.css +53 -18
  496. package/build-style/table/editor-rtl.css +47 -11
  497. package/build-style/table/editor.css +47 -11
  498. package/build-style/table/style-rtl.css +47 -11
  499. package/build-style/table/style.css +47 -11
  500. package/build-style/table/theme-rtl.css +47 -11
  501. package/build-style/table/theme.css +47 -11
  502. package/build-style/table-of-contents/style-rtl.css +47 -11
  503. package/build-style/table-of-contents/style.css +47 -11
  504. package/build-style/tag-cloud/editor-rtl.css +47 -11
  505. package/build-style/tag-cloud/editor.css +47 -11
  506. package/build-style/tag-cloud/style-rtl.css +47 -11
  507. package/build-style/tag-cloud/style.css +47 -11
  508. package/build-style/template-part/editor-rtl.css +47 -11
  509. package/build-style/template-part/editor.css +47 -11
  510. package/build-style/template-part/theme-rtl.css +47 -11
  511. package/build-style/template-part/theme.css +47 -11
  512. package/build-style/term-description/style-rtl.css +47 -11
  513. package/build-style/term-description/style.css +47 -11
  514. package/build-style/text-columns/editor-rtl.css +47 -11
  515. package/build-style/text-columns/editor.css +47 -11
  516. package/build-style/text-columns/style-rtl.css +47 -11
  517. package/build-style/text-columns/style.css +47 -11
  518. package/build-style/theme-rtl.css +49 -13
  519. package/build-style/theme.css +49 -13
  520. package/build-style/verse/style-rtl.css +47 -11
  521. package/build-style/verse/style.css +47 -11
  522. package/build-style/video/editor-rtl.css +47 -11
  523. package/build-style/video/editor.css +47 -11
  524. package/build-style/video/style-rtl.css +47 -11
  525. package/build-style/video/style.css +47 -11
  526. package/build-style/video/theme-rtl.css +47 -11
  527. package/build-style/video/theme.css +47 -11
  528. package/package.json +35 -35
  529. package/src/button/edit.js +44 -29
  530. package/src/button/style.scss +0 -1
  531. package/src/buttons/style.scss +5 -0
  532. package/src/code/block.json +2 -1
  533. package/src/columns/edit.js +20 -31
  534. package/src/comment-author-name/edit.js +54 -13
  535. package/src/comment-date/edit.js +50 -15
  536. package/src/comment-edit-link/edit.js +39 -11
  537. package/src/comments/edit/comments-inspector-controls.js +0 -2
  538. package/src/comments-pagination/edit.js +29 -9
  539. package/src/comments-title/edit.js +53 -15
  540. package/src/details/block.json +2 -1
  541. package/src/details/edit.js +36 -4
  542. package/src/embed/edit.js +3 -5
  543. package/src/embed/embed-controls.js +55 -33
  544. package/src/file/inspector.js +99 -45
  545. package/src/form/edit.js +91 -46
  546. package/src/form-input/edit.js +56 -18
  547. package/src/gallery/style.scss +1 -0
  548. package/src/html/block.json +2 -1
  549. package/src/html/editor.scss +1 -0
  550. package/src/image/constants.js +1 -0
  551. package/src/image/edit.js +2 -1
  552. package/src/image/image.js +7 -5
  553. package/src/latest-posts/edit.js +206 -98
  554. package/src/list/ordered-list-settings.js +172 -62
  555. package/src/more/block.json +2 -1
  556. package/src/navigation/edit/index.js +127 -64
  557. package/src/navigation/edit/overlay-menu-preview.js +43 -26
  558. package/src/navigation/editor.scss +8 -4
  559. package/src/navigation-link/block.json +3 -0
  560. package/src/navigation-link/index.php +4 -0
  561. package/src/navigation-link/transforms.js +2 -1
  562. package/src/navigation-link/update-attributes.js +1 -0
  563. package/src/navigation-submenu/block.json +3 -0
  564. package/src/navigation-submenu/index.php +4 -0
  565. package/src/post-comments-count/index.js +2 -0
  566. package/src/post-comments-count/transforms.js +20 -0
  567. package/src/post-comments-form/style.scss +0 -5
  568. package/src/post-comments-link/index.js +2 -0
  569. package/src/post-comments-link/transforms.js +20 -0
  570. package/src/post-excerpt/block.json +2 -1
  571. package/src/post-excerpt/edit.js +13 -8
  572. package/src/post-navigation-link/block.json +2 -1
  573. package/src/post-navigation-link/edit.js +13 -8
  574. package/src/post-navigation-link/variations.js +13 -13
  575. package/src/post-template/edit.js +4 -3
  576. package/src/post-terms/block.json +4 -2
  577. package/src/post-terms/edit.js +13 -8
  578. package/src/post-title/edit.js +76 -24
  579. package/src/preformatted/test/__snapshots__/transforms.native.js.snap +6 -0
  580. package/src/preformatted/test/transforms.native.js +6 -1
  581. package/src/preformatted/transforms.js +7 -1
  582. package/src/pullquote/editor.scss +1 -1
  583. package/src/pullquote/style.scss +2 -3
  584. package/src/pullquote/theme.scss +2 -2
  585. package/src/query/edit/enhanced-pagination-modal.js +1 -5
  586. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -13
  587. package/src/read-more/block.json +2 -1
  588. package/src/rss/block.json +2 -1
  589. package/src/rss/edit.js +141 -55
  590. package/src/search/edit.js +84 -99
  591. package/src/separator/edit.js +66 -21
  592. package/src/shortcode/block.json +2 -1
  593. package/src/site-title/index.php +1 -1
  594. package/src/social-link/index.php +49 -49
  595. package/src/social-link/variations.js +53 -48
  596. package/src/social-links/edit.js +39 -60
  597. package/src/table/block.json +8 -4
  598. package/src/table/edit.js +6 -2
  599. package/src/verse/test/__snapshots__/transforms.native.js.snap +6 -0
  600. package/src/verse/test/transforms.native.js +5 -1
  601. package/src/video/tracks-editor.js +57 -16
  602. package/build/search/icons.js +0 -121
  603. package/build/search/icons.js.map +0 -1
  604. package/build-module/search/icons.js +0 -114
  605. package/build-module/search/icons.js.map +0 -1
  606. package/src/search/icons.js +0 -89
@@ -9,11 +9,16 @@ var _date = require("@wordpress/date");
9
9
  var _blockEditor = require("@wordpress/block-editor");
10
10
  var _components = require("@wordpress/components");
11
11
  var _i18n = require("@wordpress/i18n");
12
+ var _hooks = require("../utils/hooks");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
14
15
  * WordPress dependencies
15
16
  */
16
17
 
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+
17
22
  /**
18
23
  * Renders the `core/comment-date` block on the editor.
19
24
  *
@@ -37,24 +42,48 @@ var _jsxRuntime = require("react/jsx-runtime");
37
42
  setAttributes
38
43
  }) {
39
44
  const blockProps = (0, _blockEditor.useBlockProps)();
45
+ const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
40
46
  let [date] = (0, _coreData.useEntityProp)('root', 'comment', 'date', commentId);
41
47
  const [siteFormat = (0, _date.getSettings)().formats.date] = (0, _coreData.useEntityProp)('root', 'site', 'date_format');
42
48
  const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
43
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
44
- title: (0, _i18n.__)('Settings'),
45
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalDateFormatPicker, {
46
- format: format,
47
- defaultFormat: siteFormat,
48
- onChange: nextFormat => setAttributes({
49
- format: nextFormat
49
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
50
+ label: (0, _i18n.__)('Settings'),
51
+ resetAll: () => {
52
+ setAttributes({
53
+ format: undefined,
54
+ isLink: true
55
+ });
56
+ },
57
+ dropdownMenuProps: dropdownMenuProps,
58
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
59
+ label: (0, _i18n.__)('Date format'),
60
+ hasValue: () => format !== undefined,
61
+ onDeselect: () => setAttributes({
62
+ format: undefined
63
+ }),
64
+ isShownByDefault: true,
65
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalDateFormatPicker, {
66
+ format: format,
67
+ defaultFormat: siteFormat,
68
+ onChange: nextFormat => setAttributes({
69
+ format: nextFormat
70
+ })
50
71
  })
51
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
52
- __nextHasNoMarginBottom: true,
72
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
53
73
  label: (0, _i18n.__)('Link to comment'),
54
- onChange: () => setAttributes({
55
- isLink: !isLink
74
+ hasValue: () => !isLink,
75
+ onDeselect: () => setAttributes({
76
+ isLink: true
56
77
  }),
57
- checked: isLink
78
+ isShownByDefault: true,
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
80
+ __nextHasNoMarginBottom: true,
81
+ label: (0, _i18n.__)('Link to comment'),
82
+ onChange: () => setAttributes({
83
+ isLink: !isLink
84
+ }),
85
+ checked: isLink
86
+ })
58
87
  })]
59
88
  })
60
89
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_date","_blockEditor","_components","_i18n","_jsxRuntime","Edit","attributes","format","isLink","context","commentId","setAttributes","blockProps","useBlockProps","date","useEntityProp","siteFormat","getDateSettings","formats","inspectorControls","jsx","InspectorControls","children","jsxs","PanelBody","title","__","__experimentalDateFormatPicker","defaultFormat","onChange","nextFormat","ToggleControl","__nextHasNoMarginBottom","label","checked","_x","commentDate","Date","dateTime","dateI18n","humanTimeDiff","href","onClick","event","preventDefault","Fragment"],"sources":["@wordpress/block-library/src/comment-date/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Renders the `core/comment-date` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.format Format of the date.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tlet [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<DateFormatPicker\n\t\t\t\t\tformat={ format }\n\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\tchecked={ isLink }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\tdate = _x( 'Comment Date', 'block title' );\n\t}\n\n\tlet commentDate =\n\t\tdate instanceof Date ? (\n\t\t\t<time dateTime={ dateI18n( 'c', date ) }>\n\t\t\t\t{ format === 'human-diff'\n\t\t\t\t\t? humanTimeDiff( date )\n\t\t\t\t\t: dateI18n( format || siteFormat, date ) }\n\t\t\t</time>\n\t\t) : (\n\t\t\t<time>{ date }</time>\n\t\t);\n\n\tif ( isLink ) {\n\t\tcommentDate = (\n\t\t\t<a\n\t\t\t\thref=\"#comment-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ commentDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ commentDate }</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAyC,IAAAK,WAAA,GAAAL,OAAA;AAfzC;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASM,IAAIA,CAAE;EAC7BC,UAAU,EAAE;IAAEC,MAAM;IAAEC;EAAO,CAAC;EAC9BC,OAAO,EAAE;IAAEC;EAAU,CAAC;EACtBC;AAC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gBACnB,IAAAjC,WAAA,CAAAgB,GAAA;IAAMkB,QAAQ,EAAG,IAAAC,cAAQ,EAAE,GAAG,EAAEzB,IAAK,CAAG;IAAAQ,QAAA,EACrCf,MAAM,KAAK,YAAY,GACtB,IAAAiC,mBAAa,EAAE1B,IAAK,CAAC,GACrB,IAAAyB,cAAQ,EAAEhC,MAAM,IAAIS,UAAU,EAAEF,IAAK;EAAC,CACpC,CAAC,gBAEP,IAAAV,WAAA,CAAAgB,GAAA;IAAAE,QAAA,EAAQR;EAAI,CAAQ,CACpB;EAEF,IAAKN,MAAM,EAAG;IACb4B,WAAW,gBACV,IAAAhC,WAAA,CAAAgB,GAAA;MACCqB,IAAI,EAAC,2BAA2B;MAChCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;MAAAtB,QAAA,EAE7Cc;IAAW,CACX,CACH;EACF;EAEA,oBACC,IAAAhC,WAAA,CAAAmB,IAAA,EAAAnB,WAAA,CAAAyC,QAAA;IAAAvB,QAAA,GACGH,iBAAiB,eACnB,IAAAf,WAAA,CAAAgB,GAAA;MAAA,GAAUR,UAAU;MAAAU,QAAA,EAAKc;IAAW,CAAO,CAAC;EAAA,CAC3C,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_date","_blockEditor","_components","_i18n","_hooks","_jsxRuntime","Edit","attributes","format","isLink","context","commentId","setAttributes","blockProps","useBlockProps","dropdownMenuProps","useToolsPanelDropdownMenuProps","date","useEntityProp","siteFormat","getDateSettings","formats","inspectorControls","jsx","InspectorControls","children","jsxs","__experimentalToolsPanel","label","__","resetAll","undefined","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","__experimentalDateFormatPicker","defaultFormat","onChange","nextFormat","ToggleControl","__nextHasNoMarginBottom","checked","_x","commentDate","Date","dateTime","dateI18n","humanTimeDiff","href","onClick","event","preventDefault","Fragment"],"sources":["@wordpress/block-library/src/comment-date/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Renders the `core/comment-date` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.format Format of the date.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( {\n\tattributes: { format, isLink },\n\tcontext: { commentId },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );\n\tconst [ siteFormat = getDateSettings().formats.date ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'date_format'\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tformat: undefined,\n\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Date format' ) }\n\t\t\t\t\thasValue={ () => format !== undefined }\n\t\t\t\t\tonDeselect={ () => setAttributes( { format: undefined } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: true } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Link to comment' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! date ) {\n\t\tdate = _x( 'Comment Date', 'block title' );\n\t}\n\n\tlet commentDate =\n\t\tdate instanceof Date ? (\n\t\t\t<time dateTime={ dateI18n( 'c', date ) }>\n\t\t\t\t{ format === 'human-diff'\n\t\t\t\t\t? humanTimeDiff( date )\n\t\t\t\t\t: dateI18n( format || siteFormat, date ) }\n\t\t\t</time>\n\t\t) : (\n\t\t\t<time>{ date }</time>\n\t\t);\n\n\tif ( isLink ) {\n\t\tcommentDate = (\n\t\t\t<a\n\t\t\t\thref=\"#comment-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ commentDate }\n\t\t\t</a>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t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G,IAAA0B,QAAE,EAAE,cAAc,EAAE,aAAc,CAAC;EAC3C;EAEA,IAAIC,WAAW,GACd3B,IAAI,YAAY4B,IAAI,gBACnB,IAAAxC,WAAA,CAAAkB,GAAA;IAAMuB,QAAQ,EAAG,IAAAC,cAAQ,EAAE,GAAG,EAAE9B,IAAK,CAAG;IAAAQ,QAAA,EACrCjB,MAAM,KAAK,YAAY,GACtB,IAAAwC,mBAAa,EAAE/B,IAAK,CAAC,GACrB,IAAA8B,cAAQ,EAAEvC,MAAM,IAAIW,UAAU,EAAEF,IAAK;EAAC,CACpC,CAAC,gBAEP,IAAAZ,WAAA,CAAAkB,GAAA;IAAAE,QAAA,EAAQR;EAAI,CAAQ,CACpB;EAEF,IAAKR,MAAM,EAAG;IACbmC,WAAW,gBACV,IAAAvC,WAAA,CAAAkB,GAAA;MACC0B,IAAI,EAAC,2BAA2B;MAChCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;MAAA3B,QAAA,EAE7CmB;IAAW,CACX,CACH;EACF;EAEA,oBACC,IAAAvC,WAAA,CAAAqB,IAAA,EAAArB,WAAA,CAAAgD,QAAA;IAAA5B,QAAA,GACGH,iBAAiB,eACnB,IAAAjB,WAAA,CAAAkB,GAAA;MAAA,GAAUV,UAAU;MAAAY,QAAA,EAAKmB;IAAW,CAAO,CAAC;EAAA,CAC3C,CAAC;AAEL","ignoreList":[]}
@@ -9,6 +9,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
9
9
  var _blockEditor = require("@wordpress/block-editor");
10
10
  var _components = require("@wordpress/components");
11
11
  var _i18n = require("@wordpress/i18n");
12
+ var _hooks = require("../utils/hooks");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
14
15
  * External dependencies
@@ -18,6 +19,10 @@ var _jsxRuntime = require("react/jsx-runtime");
18
19
  * WordPress dependencies
19
20
  */
20
21
 
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+
21
26
  function Edit({
22
27
  attributes: {
23
28
  linkTarget,
@@ -30,6 +35,7 @@ function Edit({
30
35
  [`has-text-align-${textAlign}`]: textAlign
31
36
  })
32
37
  });
38
+ const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
33
39
  const blockControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
34
40
  group: "block",
35
41
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.AlignmentControl, {
@@ -40,15 +46,29 @@ function Edit({
40
46
  })
41
47
  });
42
48
  const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
43
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
44
- title: (0, _i18n.__)('Settings'),
45
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
46
- __nextHasNoMarginBottom: true,
49
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanel, {
50
+ label: (0, _i18n.__)('Settings'),
51
+ resetAll: () => {
52
+ setAttributes({
53
+ linkTarget: '_self'
54
+ });
55
+ },
56
+ dropdownMenuProps: dropdownMenuProps,
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
47
58
  label: (0, _i18n.__)('Open in new tab'),
48
- onChange: value => setAttributes({
49
- linkTarget: value ? '_blank' : '_self'
59
+ isShownByDefault: true,
60
+ hasValue: () => linkTarget === '_blank',
61
+ onDeselect: () => setAttributes({
62
+ linkTarget: '_self'
50
63
  }),
51
- checked: linkTarget === '_blank'
64
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
65
+ __nextHasNoMarginBottom: true,
66
+ label: (0, _i18n.__)('Open in new tab'),
67
+ onChange: value => setAttributes({
68
+ linkTarget: value ? '_blank' : '_self'
69
+ }),
70
+ checked: linkTarget === '_blank'
71
+ })
52
72
  })
53
73
  })
54
74
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_components","_i18n","_jsxRuntime","Edit","attributes","linkTarget","textAlign","setAttributes","blockProps","useBlockProps","className","clsx","blockControls","jsx","BlockControls","group","children","AlignmentControl","value","onChange","newAlign","inspectorControls","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","label","checked","jsxs","Fragment","href","onClick","event","preventDefault"],"sources":["@wordpress/block-library/src/comment-edit-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function Edit( {\n\tattributes: { linkTarget, textAlign },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\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</BlockControls>\n\t);\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\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref=\"#edit-comment-pseudo-link\"\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,IAAAI,WAAA,GAAAJ,OAAA;AAfrC;AACA;AACA;;AAGA;AACA;AACA;;AAUe,SAASK,IAAIA,CAAE;EAC7BC,UAAU,EAAE;IAAEC,UAAU;IAAEC;EAAU,CAAC;EACrCC;AACD,CAAC,EAAG;EACH,MAAMC,UAAU,GAAG,IAAAC,0BAAa,EAAE;IACjCC,SAAS,EAAE,IAAAC,aAAI,EAAE;MAChB,CAAE,kBAAmBL,SAAS,EAAG,GAAIA;IACtC,CAAE;EACH,CAAE,CAAC;EAEH,MAAMM,aAAa,gBAClB,IAAAV,WAAA,CAAAW,GAAA,EAACd,YAAA,CAAAe,aAAa;IAACC,KAAK,EAAC,OAAO;IAAAC,QAAA,eAC3B,IAAAd,WAAA,CAAAW,GAAA,EAACd,YAAA,CAAAkB,gBAAgB;MAChBC,KAAK,EAAGZ,SAAW;MACnBa,QAAQ,EAAKC,QAAQ,IACpBb,aAAa,CAAE;QAAED,SAAS,EAAEc;MAAS,CAAE;IACvC,CACD;EAAC,CACY,CACf;EACD,MAAMC,iBAAiB,gBACtB,IAAAnB,WAAA,CAAAW,GAAA,EAACd,YAAA,CAAAuB,iBAAiB;IAAAN,QAAA,eACjB,IAAAd,WAAA,CAAAW,GAAA,EAACb,WAAA,CAAAuB,SAAS;MAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;MAAAT,QAAA,eACpC,IAAAd,WAAA,CAAAW,GAAA,EAACb,WAAA,CAAA0B,aAAa;QACbC,uBAAuB;QACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,iBAAkB,CAAG;QACjCN,QAAQ,EAAKD,KAAK,IACjBX,aAAa,CAAE;UACdF,UAAU,EAAEa,KAAK,GAAG,QAAQ,GAAG;QAChC,CAAE,CACF;QACDW,OAAO,EAAGxB,UAAU,KAAK;MAAU,CACnC;IAAC,CACQ;EAAC,CACM,CACnB;EAED,oBACC,IAAAH,WAAA,CAAA4B,IAAA,EAAA5B,WAAA,CAAA6B,QAAA;IAAAf,QAAA,GACGJ,aAAa,EACbS,iBAAiB,eACnB,IAAAnB,WAAA,CAAAW,GAAA;MAAA,GAAUL,UAAU;MAAAQ,QAAA,eACnB,IAAAd,WAAA,CAAAW,GAAA;QACCmB,IAAI,EAAC,2BAA2B;QAChCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;QAAAnB,QAAA,EAE7C,IAAAS,QAAE,EAAE,MAAO;MAAC,CACZ;IAAC,CACA,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_components","_i18n","_hooks","_jsxRuntime","Edit","attributes","linkTarget","textAlign","setAttributes","blockProps","useBlockProps","className","clsx","dropdownMenuProps","useToolsPanelDropdownMenuProps","blockControls","jsx","BlockControls","group","children","AlignmentControl","value","onChange","newAlign","inspectorControls","InspectorControls","__experimentalToolsPanel","label","__","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","jsxs","Fragment","href","onClick","event","preventDefault"],"sources":["@wordpress/block-library/src/comment-edit-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function Edit( {\n\tattributes: { linkTarget, textAlign },\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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</BlockControls>\n\t);\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => linkTarget === '_blank' }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ blockControls }\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref=\"#edit-comment-pseudo-link\"\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAgE,IAAAK,WAAA,GAAAL,OAAA;AAxBhE;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;;AAGe,SAASM,IAAIA,CAAE;EAC7BC,UAAU,EAAE;IAAEC,UAAU;IAAEC;EAAU,CAAC;EACrCC;AACD,CAAC,EAAG;EACH,MAAMC,UAAU,GAAG,IAAAC,0BAAa,EAAE;IACjCC,SAAS,EAAE,IAAAC,aAAI,EAAE;MAChB,CAAE,kBAAmBL,SAAS,EAAG,GAAIA;IACtC,CAAE;EACH,CAAE,CAAC;EAEH,MAAMM,iBAAiB,GAAG,IAAAC,qCAA8B,EAAC,CAAC;EAE1D,MAAMC,aAAa,gBAClB,IAAAZ,WAAA,CAAAa,GAAA,EAACjB,YAAA,CAAAkB,aAAa;IAACC,KAAK,EAAC,OAAO;IAAAC,QAAA,eAC3B,IAAAhB,WAAA,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ACbS,iBAAiB,eACnB,IAAArB,WAAA,CAAAa,GAAA;MAAA,GAAUP,UAAU;MAAAU,QAAA,eACnB,IAAAhB,WAAA,CAAAa,GAAA;QACCuB,IAAI,EAAC,2BAA2B;QAChCC,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;QAAAvB,QAAA,EAE7C,IAAAS,QAAE,EAAE,MAAO;MAAC,CACZ;IAAC,CACA,CAAC;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
@@ -23,8 +23,7 @@ function CommentsInspectorControls({
23
23
  attributes: {
24
24
  tagName
25
25
  },
26
- setAttributes,
27
- clientId
26
+ setAttributes
28
27
  }) {
29
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
30
29
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
@@ -34,7 +33,6 @@ function CommentsInspectorControls({
34
33
  onChange: value => setAttributes({
35
34
  tagName: value
36
35
  }),
37
- clientId: clientId,
38
36
  options: [{
39
37
  label: (0, _i18n.__)('Default (<div>)'),
40
38
  value: 'div'
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blockEditor","_lockUnlock","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","CommentsInspectorControls","attributes","tagName","setAttributes","clientId","jsx","InspectorControls","children","group","onChange","value","options","label","__"],"sources":["@wordpress/block-library/src/comments/edit/comments-inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function CommentsInspectorControls( {\n\tattributes: { tagName },\n\tsetAttributes,\n\tclientId,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AAA2C,IAAAG,WAAA,GAAAH,OAAA;AAZ3C;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAM;EAAEI;AAAmB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEhD,SAASC,yBAAyBA,CAAE;EAClDC,UAAU,EAAE;IAAEC;EAAQ,CAAC;EACvBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACC,IAAAR,WAAA,CAAAS,GAAA,EAACX,YAAA,CAAAY,iBAAiB;IAAAC,QAAA,eACjB,IAAAX,WAAA,CAAAS,GAAA,EAACX,YAAA,CAAAY,iBAAiB;MAACE,KAAK,EAAC,UAAU;MAAAD,QAAA,eAClC,IAAAX,WAAA,CAAAS,GAAA,EAACR,kBAAkB;QAClBK,OAAO,EAAGA,OAAS;QACnBO,QAAQ,EAAKC,KAAK,IACjBP,aAAa,CAAE;UAAED,OAAO,EAAEQ;QAAM,CAAE,CAClC;QACDN,QAAQ,EAAGA,QAAU;QACrBO,OAAO,EAAG,CACT;UAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;UAAEH,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEE,KAAK,EAAE,WAAW;UAAEF,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEE,KAAK,EAAE,SAAS;UAAEF,KAAK,EAAE;QAAQ,CAAC;MAClC,CACH;IAAC,CACgB;EAAC,CACF,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_blockEditor","_lockUnlock","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","CommentsInspectorControls","attributes","tagName","setAttributes","jsx","InspectorControls","children","group","onChange","value","options","label","__"],"sources":["@wordpress/block-library/src/comments/edit/comments-inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nexport default function CommentsInspectorControls( {\n\tattributes: { tagName },\n\tsetAttributes,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AAA2C,IAAAG,WAAA,GAAAH,OAAA;AAZ3C;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAM;EAAEI;AAAmB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEhD,SAASC,yBAAyBA,CAAE;EAClDC,UAAU,EAAE;IAAEC;EAAQ,CAAC;EACvBC;AACD,CAAC,EAAG;EACH,oBACC,IAAAP,WAAA,CAAAQ,GAAA,EAACV,YAAA,CAAAW,iBAAiB;IAAAC,QAAA,eACjB,IAAAV,WAAA,CAAAQ,GAAA,EAACV,YAAA,CAAAW,iBAAiB;MAACE,KAAK,EAAC,UAAU;MAAAD,QAAA,eAClC,IAAAV,WAAA,CAAAQ,GAAA,EAACP,kBAAkB;QAClBK,OAAO,EAAGA,OAAS;QACnBM,QAAQ,EAAKC,KAAK,IACjBN,aAAa,CAAE;UAAED,OAAO,EAAEO;QAAM,CAAE,CAClC;QACDC,OAAO,EAAG,CACT;UAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;UAAEH,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEE,KAAK,EAAE,WAAW;UAAEF,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEE,KAAK,EAAE,SAAS;UAAEF,KAAK,EAAE;QAAQ,CAAC;MAClC,CACH;IAAC,CACgB;EAAC,CACF,CAAC;AAEtB","ignoreList":[]}
@@ -9,6 +9,7 @@ var _blockEditor = require("@wordpress/block-editor");
9
9
  var _data = require("@wordpress/data");
10
10
  var _components = require("@wordpress/components");
11
11
  var _commentsPaginationArrowControls = require("./comments-pagination-arrow-controls");
12
+ var _hooks = require("../utils/hooks");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
14
15
  * WordPress dependencies
@@ -41,6 +42,7 @@ function QueryPaginationEdit({
41
42
  });
42
43
  }, []);
43
44
  const blockProps = (0, _blockEditor.useBlockProps)();
45
+ const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
44
46
  const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
45
47
  template: TEMPLATE
46
48
  });
@@ -66,15 +68,27 @@ function QueryPaginationEdit({
66
68
  }
67
69
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
68
70
  children: [hasNextPreviousBlocks && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
69
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
70
- title: (0, _i18n.__)('Settings'),
71
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentsPaginationArrowControls.CommentsPaginationArrowControls, {
72
- value: paginationArrow,
73
- onChange: value => {
74
- setAttributes({
75
- paginationArrow: value
76
- });
77
- }
71
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanel, {
72
+ label: (0, _i18n.__)('Settings'),
73
+ dropdownMenuProps: dropdownMenuProps,
74
+ resetAll: () => setAttributes({
75
+ paginationArrow: 'none'
76
+ }),
77
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
78
+ label: (0, _i18n.__)('Arrow'),
79
+ hasValue: () => paginationArrow !== 'none',
80
+ onDeselect: () => setAttributes({
81
+ paginationArrow: 'none'
82
+ }),
83
+ isShownByDefault: true,
84
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentsPaginationArrowControls.CommentsPaginationArrowControls, {
85
+ value: paginationArrow,
86
+ onChange: value => {
87
+ setAttributes({
88
+ paginationArrow: value
89
+ });
90
+ }
91
+ })
78
92
  })
79
93
  })
80
94
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blockEditor","_data","_components","_commentsPaginationArrowControls","_jsxRuntime","TEMPLATE","QueryPaginationEdit","attributes","paginationArrow","setAttributes","clientId","hasNextPreviousBlocks","useSelect","select","getBlocks","blockEditorStore","innerBlocks","find","innerBlock","includes","name","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","pageComments","getSettings","__experimentalDiscussionSettings","jsx","Warning","children","__","jsxs","Fragment","InspectorControls","PanelBody","title","CommentsPaginationArrowControls","value","onChange"],"sources":["@wordpress/block-library/src/comments-pagination/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tWarning,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { CommentsPaginationArrowControls } from './comments-pagination-arrow-controls';\n\nconst TEMPLATE = [\n\t[ 'core/comments-pagination-previous' ],\n\t[ 'core/comments-pagination-numbers' ],\n\t[ 'core/comments-pagination-next' ],\n];\n\nexport default function QueryPaginationEdit( {\n\tattributes: { paginationArrow },\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst hasNextPreviousBlocks = useSelect( ( select ) => {\n\t\tconst { getBlocks } = select( blockEditorStore );\n\t\tconst innerBlocks = getBlocks( clientId );\n\t\t/**\n\t\t * Show the `paginationArrow` control only if a\n\t\t * Comments Pagination Next or Comments Pagination Previous\n\t\t * block exists.\n\t\t */\n\t\treturn innerBlocks?.find( ( innerBlock ) => {\n\t\t\treturn [\n\t\t\t\t'core/comments-pagination-previous',\n\t\t\t\t'core/comments-pagination-next',\n\t\t\t].includes( innerBlock.name );\n\t\t} );\n\t}, [] );\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\t// Get the Discussion settings\n\tconst pageComments = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings?.pageComments;\n\t}, [] );\n\n\t// If paging comments is not enabled in the Discussion Settings then hide the pagination\n\t// controls. We don't want to remove them from the template so that when the user enables\n\t// paging comments, the controls will be visible.\n\tif ( ! pageComments ) {\n\t\treturn (\n\t\t\t<Warning>\n\t\t\t\t{ __(\n\t\t\t\t\t'Comments Pagination block: paging comments is disabled in the Discussion Settings'\n\t\t\t\t) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasNextPreviousBlocks && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t<CommentsPaginationArrowControls\n\t\t\t\t\t\t\tvalue={ paginationArrow }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { paginationArrow: value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,gCAAA,GAAAJ,OAAA;AAAuF,IAAAK,WAAA,GAAAL,OAAA;AAjBvF;AACA;AACA;;AAYA;AACA;AACA;;AAGA,MAAMM,QAAQ,GAAG,CAChB,CAAE,mCAAmC,CAAE,EACvC,CAAE,kCAAkC,CAAE,EACtC,CAAE,+BAA+B,CAAE,CACnC;AAEc,SAASC,mBAAmBA,CAAE;EAC5CC,UAAU,EAAE;IAAEC;EAAgB,CAAC;EAC/BC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,MAAMC,qBAAqB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACtD,MAAM;MAAEC;IAAU,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAChD,MAAMC,WAAW,GAAGF,SAAS,CAAEJ,QAAS,CAAC;IACzC;AACF;AACA;AACA;AACA;IACE,OAAOM,WAAW,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AAe,EAAE+B;YAAM,CAAE,CAAC;UAC5C;QAAG,CACH;MAAC,CACQ;IAAC,CACM,CACnB,eACD,IAAAnC,WAAA,CAAAyB,GAAA;MAAA,GAAUN;IAAgB,CAAI,CAAC;EAAA,CAC9B,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_blockEditor","_data","_components","_commentsPaginationArrowControls","_hooks","_jsxRuntime","TEMPLATE","QueryPaginationEdit","attributes","paginationArrow","setAttributes","clientId","hasNextPreviousBlocks","useSelect","select","getBlocks","blockEditorStore","innerBlocks","find","innerBlock","includes","name","blockProps","useBlockProps","dropdownMenuProps","useToolsPanelDropdownMenuProps","innerBlocksProps","useInnerBlocksProps","template","pageComments","getSettings","__experimentalDiscussionSettings","jsx","Warning","children","__","jsxs","Fragment","InspectorControls","__experimentalToolsPanel","label","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","CommentsPaginationArrowControls","value","onChange"],"sources":["@wordpress/block-library/src/comments-pagination/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tWarning,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { CommentsPaginationArrowControls } from './comments-pagination-arrow-controls';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst TEMPLATE = [\n\t[ 'core/comments-pagination-previous' ],\n\t[ 'core/comments-pagination-numbers' ],\n\t[ 'core/comments-pagination-next' ],\n];\n\nexport default function QueryPaginationEdit( {\n\tattributes: { paginationArrow },\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst hasNextPreviousBlocks = useSelect( ( select ) => {\n\t\tconst { getBlocks } = select( blockEditorStore );\n\t\tconst innerBlocks = getBlocks( clientId );\n\t\t/**\n\t\t * Show the `paginationArrow` control only if a\n\t\t * Comments Pagination Next or Comments Pagination Previous\n\t\t * block exists.\n\t\t */\n\t\treturn innerBlocks?.find( ( innerBlock ) => {\n\t\t\treturn [\n\t\t\t\t'core/comments-pagination-previous',\n\t\t\t\t'core/comments-pagination-next',\n\t\t\t].includes( innerBlock.name );\n\t\t} );\n\t}, [] );\n\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\t// Get the Discussion settings\n\tconst pageComments = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\treturn __experimentalDiscussionSettings?.pageComments;\n\t}, [] );\n\n\t// If paging comments is not enabled in the Discussion Settings then hide the pagination\n\t// controls. We don't want to remove them from the template so that when the user enables\n\t// paging comments, the controls will be visible.\n\tif ( ! pageComments ) {\n\t\treturn (\n\t\t\t<Warning>\n\t\t\t\t{ __(\n\t\t\t\t\t'Comments Pagination block: paging comments is disabled in the Discussion Settings'\n\t\t\t\t) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasNextPreviousBlocks && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\t\tsetAttributes( { paginationArrow: 'none' } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\t\thasValue={ () => paginationArrow !== 'none' }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { paginationArrow: 'none' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CommentsPaginationArrowControls\n\t\t\t\t\t\t\t\tvalue={ paginationArrow }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( { paginationArrow: value } );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,gCAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAgE,IAAAM,WAAA,GAAAN,OAAA;AArBhE;AACA;AACA;;AAeA;AACA;AACA;;AAIA,MAAMO,QAAQ,GAAG,CAChB,CAAE,mCAAmC,CAAE,EACvC,CAAE,kCAAkC,CAAE,EACtC,CAAE,+BAA+B,CAAE,CACnC;AAEc,SAASC,mBAAmBA,CAAE;EAC5CC,UAAU,EAAE;IAAEC;EAAgB,CAAC;EAC/BC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,MAAMC,qBAAqB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACtD,MAAM;MAAEC;IAAU,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAChD,MAAMC,WAAW,GAAGF,SAAS,CAAEJ,QAAS,CAAC;IACzC;AACF;AACA;AACA;AACA;IACE,OAAOM,WAAW,EAAEC,IAAI,CAAIC,UAAU,IAAM;MAC3C,OAAO,CACN,mCAAmC,EACn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AA,CAAAwC,4BAAc;UACdF,KAAK,EAAG,IAAAL,QAAE,EAAE,OAAQ,CAAG;UACvBQ,QAAQ,EAAGA,CAAA,KAAMlC,eAAe,KAAK,MAAQ;UAC7CmC,UAAU,EAAGA,CAAA,KACZlC,aAAa,CAAE;YAAED,eAAe,EAAE;UAAO,CAAE,CAC3C;UACDoC,gBAAgB;UAAAX,QAAA,eAEhB,IAAA7B,WAAA,CAAA2B,GAAA,EAAC7B,gCAAA,CAAA2C,+BAA+B;YAC/BC,KAAK,EAAGtC,eAAiB;YACzBuC,QAAQ,EAAKD,KAAK,IAAM;cACvBrC,aAAa,CAAE;gBAAED,eAAe,EAAEsC;cAAM,CAAE,CAAC;YAC5C;UAAG,CACH;QAAC,CACa;MAAC,CACN;IAAC,CACK,CACnB,eACD,IAAA1C,WAAA,CAAA2B,GAAA;MAAA,GAAUN;IAAgB,CAAI,CAAC;EAAA,CAC9B,CAAC;AAEL","ignoreList":[]}
@@ -14,6 +14,7 @@ var _element = require("@wordpress/element");
14
14
  var _data = require("@wordpress/data");
15
15
  var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
16
16
  var _url = require("@wordpress/url");
17
+ var _hooks = require("../utils/hooks");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  /**
19
20
  * External dependencies
@@ -23,6 +24,10 @@ var _jsxRuntime = require("react/jsx-runtime");
23
24
  * WordPress dependencies
24
25
  */
25
26
 
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+
26
31
  function Edit({
27
32
  attributes: {
28
33
  textAlign,
@@ -57,6 +62,7 @@ function Edit({
57
62
  } = select(_blockEditor.store);
58
63
  return getSettings().__experimentalDiscussionSettings;
59
64
  });
65
+ const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
60
66
  (0, _element.useEffect)(() => {
61
67
  if (isSiteEditor) {
62
68
  // Match the number of comments that will be shown in the comment-template/edit.js placeholder
@@ -100,21 +106,44 @@ function Edit({
100
106
  })]
101
107
  });
102
108
  const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
103
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.PanelBody, {
104
- title: (0, _i18n.__)('Settings'),
105
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
106
- __nextHasNoMarginBottom: true,
109
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
110
+ label: (0, _i18n.__)('Settings'),
111
+ resetAll: () => {
112
+ setAttributes({
113
+ showPostTitle: true,
114
+ showCommentsCount: true
115
+ });
116
+ },
117
+ dropdownMenuProps: dropdownMenuProps,
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
107
119
  label: (0, _i18n.__)('Show post title'),
108
- checked: showPostTitle,
109
- onChange: value => setAttributes({
110
- showPostTitle: value
120
+ isShownByDefault: true,
121
+ hasValue: () => !showPostTitle,
122
+ onDeselect: () => setAttributes({
123
+ showPostTitle: true
124
+ }),
125
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
126
+ __nextHasNoMarginBottom: true,
127
+ label: (0, _i18n.__)('Show post title'),
128
+ checked: showPostTitle,
129
+ onChange: value => setAttributes({
130
+ showPostTitle: value
131
+ })
111
132
  })
112
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
113
- __nextHasNoMarginBottom: true,
133
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
114
134
  label: (0, _i18n.__)('Show comments count'),
115
- checked: showCommentsCount,
116
- onChange: value => setAttributes({
117
- showCommentsCount: value
135
+ isShownByDefault: true,
136
+ hasValue: () => !showCommentsCount,
137
+ onDeselect: () => setAttributes({
138
+ showCommentsCount: true
139
+ }),
140
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
141
+ __nextHasNoMarginBottom: true,
142
+ label: (0, _i18n.__)('Show comments count'),
143
+ checked: showCommentsCount,
144
+ onChange: value => setAttributes({
145
+ showCommentsCount: value
146
+ })
118
147
  })
119
148
  })]
120
149
  })
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_i18n","_coreData","_components","_element","_data","_apiFetch","_url","_jsxRuntime","Edit","attributes","textAlign","showPostTitle","showCommentsCount","level","levelOptions","setAttributes","context","postType","postId","TagName","commentsCount","setCommentsCount","useState","rawTitle","useEntityProp","isSiteEditor","blockProps","useBlockProps","className","clsx","threadCommentsDepth","threadComments","commentsPerPage","pageComments","useSelect","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","useEffect","nestedCommentsNumber","Math","min","topLevelCommentsNumber","commentsNumber","parseInt","currentPostId","apiFetch","path","addQueryArgs","post","_fields","method","parse","then","res","headers","get","catch","blockControls","jsxs","BlockControls","group","children","jsx","AlignmentControl","value","onChange","newAlign","HeadingLevelDropdown","options","newLevel","inspectorControls","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","label","checked","postTitle","placeholder","undefined","sprintf","_n","Fragment"],"sources":["@wordpress/block-library/src/comments-title/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tHeadingLevelDropdown,\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\nexport default function Edit( {\n\tattributes: {\n\t\ttextAlign,\n\t\tshowPostTitle,\n\t\tshowCommentsCount,\n\t\tlevel,\n\t\tlevelOptions,\n\t},\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: clsx( {\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\tvalue={ level }\n\t\t\t\toptions={ levelOptions }\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\t__nextHasNoMarginBottom\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\t__nextHasNoMarginBottom\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"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AAA8C,IAAAS,WAAA,GAAAT,OAAA;AAtB9C;AACA;AACA;;AAGA;AACA;AACA;;AAiBe,SAASU,IAAIA,C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KAAK,CAAC,EAAG;MACjC8D,WAAW,GAAG,IAAAN,QAAE,EAAE,cAAe,CAAC;IACnC,CAAC,MAAM;MACNM,WAAW,GAAG,IAAAE,aAAO,EACpB;MACA,IAAAC,QAAE,EAAE,aAAa,EAAE,cAAc,EAAEjE,aAAc,CAAC,EAClDA,aACD,CAAC;IACF;EACD,CAAC,MAAM,IAAKT,aAAa,EAAG;IAC3B,IAAKS,aAAa,KAAK,CAAC,EAAG;MAC1B;MACA8D,WAAW,GAAG,IAAAE,aAAO,EAAE,IAAAR,QAAE,EAAE,gBAAiB,CAAC,EAAEK,SAAU,CAAC;IAC3D,CAAC,MAAM;MACN;MACAC,WAAW,GAAG,IAAAE,aAAO,EAAE,IAAAR,QAAE,EAAE,iBAAkB,CAAC,EAAEK,SAAU,CAAC;IAC5D;EACD,CAAC,MAAM,IAAK7D,aAAa,KAAK,CAAC,EAAG;IACjC8D,WAAW,GAAG,IAAAN,QAAE,EAAE,UAAW,CAAC;EAC/B,CAAC,MAAM;IACNM,WAAW,GAAG,IAAAN,QAAE,EAAE,WAAY,CAAC;EAChC;EAEA,oBACC,IAAArE,WAAA,CAAAqD,IAAA,EAAArD,WAAA,CAAA+E,QAAA;IAAAvB,QAAA,GACGJ,aAAa,EACba,iBAAiB,eACnB,IAAAjE,WAAA,CAAAyD,GAAA,EAAC7C,OAAO;MAAA,GAAMO,UAAU;MAAAqC,QAAA,EAAKmB;IAAW,CAAW,CAAC;EAAA,CACnD,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_i18n","_coreData","_components","_element","_data","_apiFetch","_url","_hooks","_jsxRuntime","Edit","attributes","textAlign","showPostTitle","showCommentsCount","level","levelOptions","setAttributes","context","postType","postId","TagName","commentsCount","setCommentsCount","useState","rawTitle","useEntityProp","isSiteEditor","blockProps","useBlockProps","className","clsx","threadCommentsDepth","threadComments","commentsPerPage","pageComments","useSelect","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","dropdownMenuProps","useToolsPanelDropdownMenuProps","useEffect","nestedCommentsNumber","Math","min","topLevelCommentsNumber","commentsNumber","parseInt","currentPostId","apiFetch","path","addQueryArgs","post","_fields","method","parse","then","res","headers","get","catch","blockControls","jsxs","BlockControls","group","children","jsx","AlignmentControl","value","onChange","newAlign","HeadingLevelDropdown","options","newLevel","inspectorControls","InspectorControls","__experimentalToolsPanel","label","__","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","postTitle","placeholder","undefined","sprintf","_n","Fragment"],"sources":["@wordpress/block-library/src/comments-title/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tuseBlockProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tHeadingLevelDropdown,\n} from '@wordpress/block-editor';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEntityProp } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} 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 { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function Edit( {\n\tattributes: {\n\t\ttextAlign,\n\t\tshowPostTitle,\n\t\tshowCommentsCount,\n\t\tlevel,\n\t\tlevelOptions,\n\t},\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: clsx( {\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\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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\tvalue={ level }\n\t\t\t\toptions={ levelOptions }\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<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tshowPostTitle: true,\n\t\t\t\t\t\tshowCommentsCount: true,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! showPostTitle }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showPostTitle: true } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show post title' ) }\n\t\t\t\t\t\tchecked={ showPostTitle }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { showPostTitle: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! showCommentsCount }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showCommentsCount: true } )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show comments count' ) }\n\t\t\t\t\t\tchecked={ showCommentsCount }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { showCommentsCount: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\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\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ACNC,WAAW,GAAG,IAAAE,aAAO,EACpB;QACA,IAAAC,QAAE,EACD,uBAAuB,EACvB,wBAAwB,EACxBvE,aACD,CAAC,EACDA,aAAa,EACbmE,SACD,CAAC;MACF;IACD,CAAC,MAAM,IAAKnE,aAAa,KAAK,CAAC,EAAG;MACjCoE,WAAW,GAAG,IAAAV,QAAE,EAAE,cAAe,CAAC;IACnC,CAAC,MAAM;MACNU,WAAW,GAAG,IAAAE,aAAO,EACpB;MACA,IAAAC,QAAE,EAAE,aAAa,EAAE,cAAc,EAAEvE,aAAc,CAAC,EAClDA,aACD,CAAC;IACF;EACD,CAAC,MAAM,IAAKT,aAAa,EAAG;IAC3B,IAAKS,aAAa,KAAK,CAAC,EAAG;MAC1B;MACAoE,WAAW,GAAG,IAAAE,aAAO,EAAE,IAAAZ,QAAE,EAAE,gBAAiB,CAAC,EAAES,SAAU,CAAC;IAC3D,CAAC,MAAM;MACN;MACAC,WAAW,GAAG,IAAAE,aAAO,EAAE,IAAAZ,QAAE,EAAE,iBAAkB,CAAC,EAAES,SAAU,CAAC;IAC5D;EACD,CAAC,MAAM,IAAKnE,aAAa,KAAK,CAAC,EAAG;IACjCoE,WAAW,GAAG,IAAAV,QAAE,EAAE,UAAW,CAAC;EAC/B,CAAC,MAAM;IACNU,WAAW,GAAG,IAAAV,QAAE,EAAE,WAAY,CAAC;EAChC;EAEA,oBACC,IAAAvE,WAAA,CAAAuD,IAAA,EAAAvD,WAAA,CAAAqF,QAAA;IAAA3B,QAAA,GACGJ,aAAa,EACba,iBAAiB,eACnB,IAAAnE,WAAA,CAAA2D,GAAA,EAAC/C,OAAO;MAAA,GAAMO,UAAU;MAAAuC,QAAA,EAAKuB;IAAW,CAAW,CAAC;EAAA,CACnD,CAAC;AAEL","ignoreList":[]}
@@ -8,7 +8,9 @@ var _blockEditor = require("@wordpress/block-editor");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _element = require("@wordpress/element");
11
+ var _data = require("@wordpress/data");
11
12
  var _hooks = require("../utils/hooks");
13
+ var _lockUnlock = require("../lock-unlock");
12
14
  var _jsxRuntime = require("react/jsx-runtime");
13
15
  /**
14
16
  * WordPress dependencies
@@ -18,12 +20,16 @@ var _jsxRuntime = require("react/jsx-runtime");
18
20
  * Internal dependencies
19
21
  */
20
22
 
23
+ const {
24
+ withIgnoreIMEEvents
25
+ } = (0, _lockUnlock.unlock)(_components.privateApis);
21
26
  const TEMPLATE = [['core/paragraph', {
22
27
  placeholder: (0, _i18n.__)('Type / to add a hidden block')
23
28
  }]];
24
29
  function DetailsEdit({
25
30
  attributes,
26
- setAttributes
31
+ setAttributes,
32
+ clientId
27
33
  }) {
28
34
  const {
29
35
  name,
@@ -40,6 +46,22 @@ function DetailsEdit({
40
46
  });
41
47
  const [isOpen, setIsOpen] = (0, _element.useState)(showContent);
42
48
  const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
49
+
50
+ // Check if the inner blocks are selected.
51
+ const hasSelectedInnerBlock = (0, _data.useSelect)(select => select(_blockEditor.store).hasSelectedInnerBlock(clientId, true), [clientId]);
52
+ const handleSummaryKeyDown = event => {
53
+ if (event.key === 'Enter' && !event.shiftKey) {
54
+ setIsOpen(prevIsOpen => !prevIsOpen);
55
+ event.preventDefault();
56
+ }
57
+ };
58
+
59
+ // Prevent spacebar from toggling <details> while typing.
60
+ const handleSummaryKeyUp = event => {
61
+ if (event.key === ' ') {
62
+ event.preventDefault();
63
+ }
64
+ };
43
65
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
44
66
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
45
67
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanel, {
@@ -83,12 +105,14 @@ function DetailsEdit({
83
105
  })
84
106
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("details", {
85
107
  ...innerBlocksProps,
86
- open: isOpen,
108
+ open: isOpen || hasSelectedInnerBlock,
87
109
  onToggle: event => setIsOpen(event.target.open),
88
110
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("summary", {
111
+ onKeyDown: withIgnoreIMEEvents(handleSummaryKeyDown),
112
+ onKeyUp: handleSummaryKeyUp,
89
113
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichText, {
90
114
  identifier: "summary",
91
- "aria-label": (0, _i18n.__)('Write summary'),
115
+ "aria-label": (0, _i18n.__)('Write summary. Press Enter to expand or collapse the details.'),
92
116
  placeholder: placeholder || (0, _i18n.__)('Write summary…'),
93
117
  withoutInteractiveFormatting: true,
94
118
  value: summary,
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_components","_i18n","_element","_hooks","_jsxRuntime","TEMPLATE","placeholder","__","DetailsEdit","attributes","setAttributes","name","showContent","summary","allowedBlocks","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","__experimentalCaptureToolbars","isOpen","setIsOpen","useState","dropdownMenuProps","useToolsPanelDropdownMenuProps","jsxs","Fragment","children","jsx","InspectorControls","__experimentalToolsPanel","label","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","onChange","group","TextControl","__next40pxDefaultSize","value","newName","help","open","onToggle","event","target","RichText","identifier","withoutInteractiveFormatting","newSummary","_default","exports","default"],"sources":["@wordpress/block-library/src/details/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __( 'Type / to add a hidden block' ),\n\t\t},\n\t],\n];\n\nfunction DetailsEdit( { attributes, setAttributes } ) {\n\tconst { name, showContent, summary, allowedBlocks, placeholder } =\n\t\tattributes;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\t__experimentalCaptureToolbars: true,\n\t\tallowedBlocks,\n\t} );\n\tconst [ isOpen, setIsOpen ] = useState( showContent );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tshowContent: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\thasValue={ () => showContent }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowContent: false,\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\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\t\tchecked={ showContent }\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\tshowContent: ! showContent,\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name attribute' ) }\n\t\t\t\t\tvalue={ name || '' }\n\t\t\t\t\tonChange={ ( newName ) =>\n\t\t\t\t\t\tsetAttributes( { name: newName } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Enables multiple Details blocks with the same name attribute to be connected, with only one open at a time.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<details\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t\topen={ isOpen }\n\t\t\t\tonToggle={ ( event ) => setIsOpen( event.target.open ) }\n\t\t\t>\n\t\t\t\t<summary>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"summary\"\n\t\t\t\t\t\taria-label={ __( 'Write summary' ) }\n\t\t\t\t\t\tplaceholder={ placeholder || __( 'Write summary…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ summary }\n\t\t\t\t\t\tonChange={ ( newSummary ) =>\n\t\t\t\t\t\t\tsetAttributes( { summary: newSummary } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</summary>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t</details>\n\t\t</>\n\t);\n}\n\nexport default DetailsEdit;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAgE,IAAAK,WAAA,GAAAL,OAAA;AArBhE;AACA;AACA;;AAgBA;AACA;AACA;;AAGA,MAAMM,QAAQ,GAAG,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E,EAAE,gBAAiB,CAAG;UACrD+C,4BAA4B;UAC5BT,KAAK,EAAGhC,OAAS;UACjB4B,QAAQ,EAAKc,UAAU,IACtB7C,aAAa,CAAE;YAAEG,OAAO,EAAE0C;UAAW,CAAE;QACvC,CACD;MAAC,CACM,CAAC,EACRtC,gBAAgB,CAACW,QAAQ;IAAA,CACnB,CAAC;EAAA,CACT,CAAC;AAEL;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclD,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_components","_i18n","_element","_data","_hooks","_lockUnlock","_jsxRuntime","withIgnoreIMEEvents","unlock","componentsPrivateApis","TEMPLATE","placeholder","__","DetailsEdit","attributes","setAttributes","clientId","name","showContent","summary","allowedBlocks","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","__experimentalCaptureToolbars","isOpen","setIsOpen","useState","dropdownMenuProps","useToolsPanelDropdownMenuProps","hasSelectedInnerBlock","useSelect","select","blockEditorStore","handleSummaryKeyDown","event","key","shiftKey","prevIsOpen","preventDefault","handleSummaryKeyUp","jsxs","Fragment","children","jsx","InspectorControls","__experimentalToolsPanel","label","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","onChange","group","TextControl","__next40pxDefaultSize","value","newName","help","open","onToggle","target","onKeyDown","onKeyUp","RichText","identifier","withoutInteractiveFormatting","newSummary","_default","exports","default"],"sources":["@wordpress/block-library/src/details/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport { unlock } from '../lock-unlock';\n\nconst { withIgnoreIMEEvents } = unlock( componentsPrivateApis );\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __( 'Type / to add a hidden block' ),\n\t\t},\n\t],\n];\n\nfunction DetailsEdit( { attributes, setAttributes, clientId } ) {\n\tconst { name, showContent, summary, allowedBlocks, placeholder } =\n\t\tattributes;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\t__experimentalCaptureToolbars: true,\n\t\tallowedBlocks,\n\t} );\n\tconst [ isOpen, setIsOpen ] = useState( showContent );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Check if the inner blocks are selected.\n\tconst hasSelectedInnerBlock = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).hasSelectedInnerBlock( clientId, true ),\n\t\t[ clientId ]\n\t);\n\n\tconst handleSummaryKeyDown = ( event ) => {\n\t\tif ( event.key === 'Enter' && ! event.shiftKey ) {\n\t\t\tsetIsOpen( ( prevIsOpen ) => ! prevIsOpen );\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\t// Prevent spacebar from toggling <details> while typing.\n\tconst handleSummaryKeyUp = ( event ) => {\n\t\tif ( event.key === ' ' ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tshowContent: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\thasValue={ () => showContent }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowContent: false,\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\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\t\tchecked={ showContent }\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\tshowContent: ! showContent,\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name attribute' ) }\n\t\t\t\t\tvalue={ name || '' }\n\t\t\t\t\tonChange={ ( newName ) =>\n\t\t\t\t\t\tsetAttributes( { name: newName } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Enables multiple Details blocks with the same name attribute to be connected, with only one open at a time.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<details\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t\topen={ isOpen || hasSelectedInnerBlock }\n\t\t\t\tonToggle={ ( event ) => setIsOpen( event.target.open ) }\n\t\t\t>\n\t\t\t\t<summary\n\t\t\t\t\tonKeyDown={ withIgnoreIMEEvents( handleSummaryKeyDown ) }\n\t\t\t\t\tonKeyUp={ handleSummaryKeyUp }\n\t\t\t\t>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"summary\"\n\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t'Write summary. Press Enter to expand or collapse the details.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tplaceholder={ placeholder || __( 'Write summary…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ summary }\n\t\t\t\t\t\tonChange={ ( newSummary ) =>\n\t\t\t\t\t\t\tsetAttributes( { summary: newSummary } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</summary>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t</details>\n\t\t</>\n\t);\n}\n\nexport default DetailsEdit;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAAwC,IAAAO,WAAA,GAAAP,OAAA;AAzBxC;AACA;AACA;;AAmBA;AACA;AACA;;AAIA,MAAM;EAAEQ;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAE/D,MAAMC,QAAQ,GAAG,CAChB,CACC,gBAAgB,EAChB;EACCC,WAAW,EAAE,IAAAC,QAAE,EAAE,8BAA+B;AACjD,CAAC,CACD,CACD;AAED,SAASC,WAAWA,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAEC;AAAS,CAAC,EAAG;EAC/D,MAAM;IAAEC,IAAI;IAAEC,WAAW;IAAEC,OAAO;IAAEC,aAAa;IAAET;EAAY,CAAC,GAC/DG,UAAU;EACX,MAAMO,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,MAAMC,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AG;MAAApB,QAAA,gBAExD,IAAAvC,WAAA,CAAAwC,GAAA;QACCsB,SAAS,EAAG7D,mBAAmB,CAAE6B,oBAAqB,CAAG;QACzDiC,OAAO,EAAG3B,kBAAoB;QAAAG,QAAA,eAE9B,IAAAvC,WAAA,CAAAwC,GAAA,EAAChD,YAAA,CAAAwE,QAAQ;UACRC,UAAU,EAAC,SAAS;UACpB,cAAa,IAAA3D,QAAE,EACd,+DACD,CAAG;UACHD,WAAW,EAAGA,WAAW,IAAI,IAAAC,QAAE,EAAE,gBAAiB,CAAG;UACrD4D,4BAA4B;UAC5BV,KAAK,EAAG3C,OAAS;UACjBuC,QAAQ,EAAKe,UAAU,IACtB1D,aAAa,CAAE;YAAEI,OAAO,EAAEsD;UAAW,CAAE;QACvC,CACD;MAAC,CACM,CAAC,EACRlD,gBAAgB,CAACsB,QAAQ;IAAA,CACnB,CAAC;EAAA,CACT,CAAC;AAEL;AAAC,IAAA6B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc/D,WAAW","ignoreList":[]}
@@ -34,7 +34,8 @@ const metadata = exports.metadata = {
34
34
  summary: {
35
35
  type: "rich-text",
36
36
  source: "rich-text",
37
- selector: "summary"
37
+ selector: "summary",
38
+ role: "content"
38
39
  },
39
40
  name: {
40
41
  type: "string",