@wordpress/block-library 9.15.1 → 9.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/archives/edit.js +2 -2
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/button/edit.js +2 -1
  5. package/build/button/edit.js.map +1 -1
  6. package/build/categories/edit.js +115 -37
  7. package/build/categories/edit.js.map +1 -1
  8. package/build/columns/edit.js +1 -1
  9. package/build/columns/edit.js.map +1 -1
  10. package/build/columns/edit.native.js +1 -1
  11. package/build/columns/edit.native.js.map +1 -1
  12. package/build/comment-template/edit.js +2 -2
  13. package/build/comment-template/edit.js.map +1 -1
  14. package/build/comments/edit/comments-inspector-controls.js +6 -5
  15. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  16. package/build/comments-pagination/index.js +5 -0
  17. package/build/comments-pagination/index.js.map +1 -1
  18. package/build/comments-pagination-next/index.js +7 -6
  19. package/build/comments-pagination-next/index.js.map +1 -1
  20. package/build/comments-pagination-previous/index.js +7 -6
  21. package/build/comments-pagination-previous/index.js.map +1 -1
  22. package/build/cover/deprecated.js +1 -1
  23. package/build/cover/deprecated.js.map +1 -1
  24. package/build/cover/edit/inspector-controls.js +2 -9
  25. package/build/cover/edit/inspector-controls.js.map +1 -1
  26. package/build/details/edit.js +27 -18
  27. package/build/details/edit.js.map +1 -1
  28. package/build/details/index.js +12 -0
  29. package/build/details/index.js.map +1 -1
  30. package/build/details/save.js +2 -0
  31. package/build/details/save.js.map +1 -1
  32. package/build/embed/transforms.js +5 -2
  33. package/build/embed/transforms.js.map +1 -1
  34. package/build/embed/util.js +1 -1
  35. package/build/embed/util.js.map +1 -1
  36. package/build/file/edit.js +7 -4
  37. package/build/file/edit.js.map +1 -1
  38. package/build/file/transforms.js +1 -1
  39. package/build/file/transforms.js.map +1 -1
  40. package/build/file/utils/index.js +1 -1
  41. package/build/file/utils/index.js.map +1 -1
  42. package/build/form/variations.js +1 -1
  43. package/build/form/variations.js.map +1 -1
  44. package/build/form-input/edit.js +1 -1
  45. package/build/form-input/edit.js.map +1 -1
  46. package/build/gallery/edit.js +1 -1
  47. package/build/gallery/edit.js.map +1 -1
  48. package/build/gallery/transforms.js +2 -2
  49. package/build/gallery/transforms.js.map +1 -1
  50. package/build/gallery/use-get-new-images.js +1 -1
  51. package/build/gallery/use-get-new-images.js.map +1 -1
  52. package/build/group/edit.js +2 -9
  53. package/build/group/edit.js.map +1 -1
  54. package/build/home-link/edit.js +1 -2
  55. package/build/home-link/edit.js.map +1 -1
  56. package/build/latest-comments/edit.js +73 -26
  57. package/build/latest-comments/edit.js.map +1 -1
  58. package/build/latest-posts/constants.js +2 -1
  59. package/build/latest-posts/constants.js.map +1 -1
  60. package/build/latest-posts/edit.js +91 -38
  61. package/build/latest-posts/edit.js.map +1 -1
  62. package/build/list-item/edit.native.js +2 -2
  63. package/build/list-item/edit.native.js.map +1 -1
  64. package/build/list-item/index.js +1 -1
  65. package/build/media-text/edit.native.js +2 -2
  66. package/build/media-text/edit.native.js.map +1 -1
  67. package/build/media-text/media-container.native.js +4 -4
  68. package/build/media-text/media-container.native.js.map +1 -1
  69. package/build/navigation/edit/index.js +8 -4
  70. package/build/navigation/edit/index.js.map +1 -1
  71. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
  72. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  73. package/build/navigation/edit/use-generate-default-navigation-title.js +4 -4
  74. package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
  75. package/build/navigation/index.js +15 -0
  76. package/build/navigation/index.js.map +1 -1
  77. package/build/navigation-link/edit.js +15 -20
  78. package/build/navigation-link/edit.js.map +1 -1
  79. package/build/navigation-link/link-ui.js +9 -18
  80. package/build/navigation-link/link-ui.js.map +1 -1
  81. package/build/navigation-submenu/edit.js +1 -1
  82. package/build/navigation-submenu/edit.js.map +1 -1
  83. package/build/navigation-submenu/index.js +7 -0
  84. package/build/navigation-submenu/index.js.map +1 -1
  85. package/build/page-list/edit.js +1 -1
  86. package/build/page-list/edit.js.map +1 -1
  87. package/build/page-list/index.js +11 -0
  88. package/build/page-list/index.js.map +1 -1
  89. package/build/paragraph/edit.js +4 -14
  90. package/build/paragraph/edit.js.map +1 -1
  91. package/build/pattern/index.js +1 -1
  92. package/build/post-author-name/edit.js +41 -12
  93. package/build/post-author-name/edit.js.map +1 -1
  94. package/build/post-comments-link/index.js +7 -1
  95. package/build/post-comments-link/index.js.map +1 -1
  96. package/build/post-content/index.js +1 -0
  97. package/build/post-content/index.js.map +1 -1
  98. package/build/post-date/edit.js +1 -1
  99. package/build/post-date/edit.js.map +1 -1
  100. package/build/post-featured-image/edit.js +0 -6
  101. package/build/post-featured-image/edit.js.map +1 -1
  102. package/build/post-featured-image/overlay-controls.js +2 -1
  103. package/build/post-featured-image/overlay-controls.js.map +1 -1
  104. package/build/post-navigation-link/variations.js +2 -2
  105. package/build/post-navigation-link/variations.js.map +1 -1
  106. package/build/post-terms/edit.js +1 -0
  107. package/build/post-terms/edit.js.map +1 -1
  108. package/build/post-time-to-read/index.js +1 -1
  109. package/build/query/edit/inspector-controls/author-control.js +1 -1
  110. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  111. package/build/query/edit/inspector-controls/index.js +110 -61
  112. package/build/query/edit/inspector-controls/index.js.map +1 -1
  113. package/build/query/edit/query-content.js +2 -6
  114. package/build/query/edit/query-content.js.map +1 -1
  115. package/build/query/utils.js +1 -1
  116. package/build/query/utils.js.map +1 -1
  117. package/build/query-no-results/index.js +1 -1
  118. package/build/query-pagination-numbers/edit.js +1 -1
  119. package/build/query-pagination-numbers/edit.js.map +1 -1
  120. package/build/query-title/edit.js +40 -14
  121. package/build/query-title/edit.js.map +1 -1
  122. package/build/query-total/index.js +7 -1
  123. package/build/query-total/index.js.map +1 -1
  124. package/build/quote/transforms.js +1 -1
  125. package/build/quote/transforms.js.map +1 -1
  126. package/build/read-more/edit.js +25 -7
  127. package/build/read-more/edit.js.map +1 -1
  128. package/build/rss/edit.js +1 -0
  129. package/build/rss/edit.js.map +1 -1
  130. package/build/rss/index.js +6 -0
  131. package/build/rss/index.js.map +1 -1
  132. package/build/search/edit.js +67 -48
  133. package/build/search/edit.js.map +1 -1
  134. package/build/separator/edit.js +2 -4
  135. package/build/separator/edit.js.map +1 -1
  136. package/build/site-logo/edit.js +26 -35
  137. package/build/site-logo/edit.js.map +1 -1
  138. package/build/social-links/edit.js +2 -1
  139. package/build/social-links/edit.js.map +1 -1
  140. package/build/spacer/controls.js +13 -9
  141. package/build/spacer/controls.js.map +1 -1
  142. package/build/spacer/edit.js +23 -21
  143. package/build/spacer/edit.js.map +1 -1
  144. package/build/table-of-contents/edit.js +24 -8
  145. package/build/table-of-contents/edit.js.map +1 -1
  146. package/build/template-part/edit/advanced-controls.js +2 -9
  147. package/build/template-part/edit/advanced-controls.js.map +1 -1
  148. package/build/utils/messages.js +22 -0
  149. package/build/utils/messages.js.map +1 -0
  150. package/build/video/edit-common-settings.js +1 -1
  151. package/build/video/edit-common-settings.js.map +1 -1
  152. package/build/video/edit.native.js +3 -3
  153. package/build/video/edit.native.js.map +1 -1
  154. package/build-module/archives/edit.js +2 -2
  155. package/build-module/archives/edit.js.map +1 -1
  156. package/build-module/button/edit.js +3 -2
  157. package/build-module/button/edit.js.map +1 -1
  158. package/build-module/categories/edit.js +116 -38
  159. package/build-module/categories/edit.js.map +1 -1
  160. package/build-module/columns/edit.js +1 -1
  161. package/build-module/columns/edit.js.map +1 -1
  162. package/build-module/columns/edit.native.js +1 -1
  163. package/build-module/columns/edit.native.js.map +1 -1
  164. package/build-module/comment-template/edit.js +2 -2
  165. package/build-module/comment-template/edit.js.map +1 -1
  166. package/build-module/comments/edit/comments-inspector-controls.js +5 -4
  167. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  168. package/build-module/comments-pagination/index.js +5 -0
  169. package/build-module/comments-pagination/index.js.map +1 -1
  170. package/build-module/comments-pagination-next/index.js +7 -6
  171. package/build-module/comments-pagination-next/index.js.map +1 -1
  172. package/build-module/comments-pagination-previous/index.js +7 -6
  173. package/build-module/comments-pagination-previous/index.js.map +1 -1
  174. package/build-module/cover/deprecated.js +1 -1
  175. package/build-module/cover/deprecated.js.map +1 -1
  176. package/build-module/cover/edit/inspector-controls.js +1 -8
  177. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  178. package/build-module/details/edit.js +29 -20
  179. package/build-module/details/edit.js.map +1 -1
  180. package/build-module/details/index.js +12 -0
  181. package/build-module/details/index.js.map +1 -1
  182. package/build-module/details/save.js +2 -0
  183. package/build-module/details/save.js.map +1 -1
  184. package/build-module/embed/transforms.js +5 -2
  185. package/build-module/embed/transforms.js.map +1 -1
  186. package/build-module/embed/util.js +1 -1
  187. package/build-module/embed/util.js.map +1 -1
  188. package/build-module/file/edit.js +7 -4
  189. package/build-module/file/edit.js.map +1 -1
  190. package/build-module/file/transforms.js +1 -1
  191. package/build-module/file/transforms.js.map +1 -1
  192. package/build-module/file/utils/index.js +1 -1
  193. package/build-module/file/utils/index.js.map +1 -1
  194. package/build-module/form/variations.js +1 -1
  195. package/build-module/form/variations.js.map +1 -1
  196. package/build-module/form-input/edit.js +1 -1
  197. package/build-module/form-input/edit.js.map +1 -1
  198. package/build-module/gallery/edit.js +1 -1
  199. package/build-module/gallery/edit.js.map +1 -1
  200. package/build-module/gallery/transforms.js +2 -2
  201. package/build-module/gallery/transforms.js.map +1 -1
  202. package/build-module/gallery/use-get-new-images.js +1 -1
  203. package/build-module/gallery/use-get-new-images.js.map +1 -1
  204. package/build-module/group/edit.js +1 -8
  205. package/build-module/group/edit.js.map +1 -1
  206. package/build-module/home-link/edit.js +1 -2
  207. package/build-module/home-link/edit.js.map +1 -1
  208. package/build-module/latest-comments/edit.js +74 -27
  209. package/build-module/latest-comments/edit.js.map +1 -1
  210. package/build-module/latest-posts/constants.js +1 -0
  211. package/build-module/latest-posts/constants.js.map +1 -1
  212. package/build-module/latest-posts/edit.js +93 -40
  213. package/build-module/latest-posts/edit.js.map +1 -1
  214. package/build-module/list-item/edit.native.js +2 -2
  215. package/build-module/list-item/edit.native.js.map +1 -1
  216. package/build-module/list-item/index.js +1 -1
  217. package/build-module/media-text/edit.native.js +2 -2
  218. package/build-module/media-text/edit.native.js.map +1 -1
  219. package/build-module/media-text/media-container.native.js +4 -4
  220. package/build-module/media-text/media-container.native.js.map +1 -1
  221. package/build-module/navigation/edit/index.js +8 -4
  222. package/build-module/navigation/edit/index.js.map +1 -1
  223. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
  224. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  225. package/build-module/navigation/edit/use-generate-default-navigation-title.js +4 -4
  226. package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
  227. package/build-module/navigation/index.js +15 -0
  228. package/build-module/navigation/index.js.map +1 -1
  229. package/build-module/navigation-link/edit.js +16 -21
  230. package/build-module/navigation-link/edit.js.map +1 -1
  231. package/build-module/navigation-link/link-ui.js +9 -18
  232. package/build-module/navigation-link/link-ui.js.map +1 -1
  233. package/build-module/navigation-submenu/edit.js +1 -1
  234. package/build-module/navigation-submenu/edit.js.map +1 -1
  235. package/build-module/navigation-submenu/index.js +7 -0
  236. package/build-module/navigation-submenu/index.js.map +1 -1
  237. package/build-module/page-list/edit.js +1 -1
  238. package/build-module/page-list/edit.js.map +1 -1
  239. package/build-module/page-list/index.js +11 -0
  240. package/build-module/page-list/index.js.map +1 -1
  241. package/build-module/paragraph/edit.js +5 -15
  242. package/build-module/paragraph/edit.js.map +1 -1
  243. package/build-module/pattern/index.js +1 -1
  244. package/build-module/post-author-name/edit.js +42 -13
  245. package/build-module/post-author-name/edit.js.map +1 -1
  246. package/build-module/post-comments-link/index.js +7 -1
  247. package/build-module/post-comments-link/index.js.map +1 -1
  248. package/build-module/post-content/index.js +1 -0
  249. package/build-module/post-content/index.js.map +1 -1
  250. package/build-module/post-date/edit.js +1 -1
  251. package/build-module/post-date/edit.js.map +1 -1
  252. package/build-module/post-featured-image/edit.js +0 -6
  253. package/build-module/post-featured-image/edit.js.map +1 -1
  254. package/build-module/post-featured-image/overlay-controls.js +2 -1
  255. package/build-module/post-featured-image/overlay-controls.js.map +1 -1
  256. package/build-module/post-navigation-link/variations.js +2 -2
  257. package/build-module/post-navigation-link/variations.js.map +1 -1
  258. package/build-module/post-terms/edit.js +1 -0
  259. package/build-module/post-terms/edit.js.map +1 -1
  260. package/build-module/post-time-to-read/index.js +1 -1
  261. package/build-module/query/edit/inspector-controls/author-control.js +1 -1
  262. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  263. package/build-module/query/edit/inspector-controls/index.js +111 -62
  264. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  265. package/build-module/query/edit/query-content.js +1 -5
  266. package/build-module/query/edit/query-content.js.map +1 -1
  267. package/build-module/query/utils.js +1 -1
  268. package/build-module/query/utils.js.map +1 -1
  269. package/build-module/query-no-results/index.js +1 -1
  270. package/build-module/query-pagination-numbers/edit.js +1 -1
  271. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  272. package/build-module/query-title/edit.js +41 -15
  273. package/build-module/query-title/edit.js.map +1 -1
  274. package/build-module/query-total/index.js +7 -1
  275. package/build-module/query-total/index.js.map +1 -1
  276. package/build-module/quote/transforms.js +1 -1
  277. package/build-module/quote/transforms.js.map +1 -1
  278. package/build-module/read-more/edit.js +26 -8
  279. package/build-module/read-more/edit.js.map +1 -1
  280. package/build-module/rss/edit.js +1 -0
  281. package/build-module/rss/edit.js.map +1 -1
  282. package/build-module/rss/index.js +6 -0
  283. package/build-module/rss/index.js.map +1 -1
  284. package/build-module/search/edit.js +69 -50
  285. package/build-module/search/edit.js.map +1 -1
  286. package/build-module/separator/edit.js +1 -3
  287. package/build-module/separator/edit.js.map +1 -1
  288. package/build-module/site-logo/edit.js +27 -36
  289. package/build-module/site-logo/edit.js.map +1 -1
  290. package/build-module/social-links/edit.js +2 -1
  291. package/build-module/social-links/edit.js.map +1 -1
  292. package/build-module/spacer/controls.js +13 -9
  293. package/build-module/spacer/controls.js.map +1 -1
  294. package/build-module/spacer/edit.js +24 -22
  295. package/build-module/spacer/edit.js.map +1 -1
  296. package/build-module/table-of-contents/edit.js +25 -9
  297. package/build-module/table-of-contents/edit.js.map +1 -1
  298. package/build-module/template-part/edit/advanced-controls.js +1 -8
  299. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  300. package/build-module/utils/messages.js +15 -0
  301. package/build-module/utils/messages.js.map +1 -0
  302. package/build-module/video/edit-common-settings.js +1 -1
  303. package/build-module/video/edit-common-settings.js.map +1 -1
  304. package/build-module/video/edit.native.js +3 -3
  305. package/build-module/video/edit.native.js.map +1 -1
  306. package/build-style/editor-rtl.css +12 -86
  307. package/build-style/editor.css +12 -86
  308. package/build-style/freeform/editor-rtl.css +2 -4
  309. package/build-style/freeform/editor.css +2 -4
  310. package/build-style/gallery/editor-rtl.css +0 -46
  311. package/build-style/gallery/editor.css +0 -46
  312. package/build-style/image/style-rtl.css +24 -10
  313. package/build-style/image/style.css +24 -10
  314. package/build-style/navigation/style-rtl.css +8 -6
  315. package/build-style/navigation/style.css +8 -6
  316. package/build-style/navigation-link/editor-rtl.css +3 -0
  317. package/build-style/navigation-link/editor.css +3 -0
  318. package/build-style/paragraph/editor-rtl.css +4 -0
  319. package/build-style/paragraph/editor.css +4 -0
  320. package/build-style/post-featured-image/editor-rtl.css +1 -1
  321. package/build-style/post-featured-image/editor.css +1 -1
  322. package/build-style/query/editor-rtl.css +0 -27
  323. package/build-style/query/editor.css +0 -27
  324. package/build-style/site-logo/editor-rtl.css +2 -8
  325. package/build-style/site-logo/editor.css +2 -8
  326. package/build-style/social-links/style-rtl.css +2 -5
  327. package/build-style/social-links/style.css +2 -5
  328. package/build-style/style-rtl.css +34 -21
  329. package/build-style/style.css +34 -21
  330. package/package.json +35 -35
  331. package/src/archives/edit.js +2 -2
  332. package/src/audio/test/transforms.native.js +4 -3
  333. package/src/button/edit.js +6 -2
  334. package/src/categories/edit.js +133 -45
  335. package/src/columns/edit.js +1 -1
  336. package/src/columns/edit.native.js +1 -1
  337. package/src/comment-template/edit.js +2 -2
  338. package/src/comments/edit/comments-inspector-controls.js +5 -8
  339. package/src/comments-pagination/block.json +5 -0
  340. package/src/comments-pagination-next/block.json +0 -5
  341. package/src/comments-pagination-next/index.js +6 -0
  342. package/src/comments-pagination-previous/block.json +0 -5
  343. package/src/comments-pagination-previous/index.js +6 -0
  344. package/src/cover/deprecated.js +1 -1
  345. package/src/cover/edit/inspector-controls.js +1 -21
  346. package/src/cover/test/__snapshots__/edit.native.js.snap +1 -1
  347. package/src/cover/test/edit.js +7 -7
  348. package/src/cover/test/edit.native.js +2 -2
  349. package/src/cover/test/transforms.native.js +9 -5
  350. package/src/details/block.json +12 -0
  351. package/src/details/edit.js +29 -24
  352. package/src/details/save.js +6 -2
  353. package/src/editor.scss +1 -1
  354. package/src/embed/test/index.js +1 -1
  355. package/src/embed/transforms.js +3 -1
  356. package/src/embed/util.js +1 -1
  357. package/src/file/edit.js +4 -3
  358. package/src/file/test/transforms.native.js +4 -3
  359. package/src/file/transforms.js +1 -1
  360. package/src/file/utils/index.js +1 -1
  361. package/src/form/variations.js +1 -1
  362. package/src/form-input/edit.js +1 -1
  363. package/src/freeform/editor.scss +4 -3
  364. package/src/gallery/edit.js +1 -1
  365. package/src/gallery/editor.scss +0 -54
  366. package/src/gallery/test/transforms.native.js +4 -3
  367. package/src/gallery/transforms.js +2 -2
  368. package/src/gallery/use-get-new-images.js +1 -1
  369. package/src/group/edit.js +1 -20
  370. package/src/home-link/edit.js +0 -6
  371. package/src/image/block.json +8 -1
  372. package/src/image/editor.scss +1 -1
  373. package/src/image/index.php +9 -13
  374. package/src/image/style.scss +17 -7
  375. package/src/image/test/edit.native.js +1 -1
  376. package/src/image/test/transforms.native.js +4 -3
  377. package/src/latest-comments/edit.js +93 -33
  378. package/src/latest-posts/constants.js +1 -0
  379. package/src/latest-posts/edit.js +119 -44
  380. package/src/list/test/edit.native.js +10 -10
  381. package/src/list-item/block.json +1 -1
  382. package/src/list-item/edit.native.js +2 -2
  383. package/src/media-text/edit.native.js +2 -2
  384. package/src/media-text/media-container.native.js +4 -4
  385. package/src/media-text/test/transforms.native.js +9 -5
  386. package/src/navigation/edit/index.js +4 -0
  387. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
  388. package/src/navigation/edit/use-generate-default-navigation-title.js +4 -4
  389. package/src/navigation/index.js +20 -0
  390. package/src/navigation/style.scss +7 -4
  391. package/src/navigation-link/edit.js +26 -30
  392. package/src/navigation-link/editor.scss +27 -18
  393. package/src/navigation-link/link-ui.js +7 -13
  394. package/src/navigation-submenu/edit.js +1 -1
  395. package/src/navigation-submenu/index.js +7 -0
  396. package/src/navigation-submenu/index.php +21 -4
  397. package/src/page-list/block.json +11 -0
  398. package/src/page-list/edit.js +52 -50
  399. package/src/paragraph/edit.js +3 -18
  400. package/src/paragraph/editor.scss +7 -0
  401. package/src/paragraph/style.scss +1 -1
  402. package/src/pattern/block.json +1 -1
  403. package/src/post-author-name/edit.js +53 -15
  404. package/src/post-comments-link/block.json +7 -1
  405. package/src/post-content/block.json +2 -1
  406. package/src/post-date/edit.js +1 -3
  407. package/src/post-featured-image/edit.js +2 -15
  408. package/src/post-featured-image/editor.scss +2 -2
  409. package/src/post-featured-image/overlay-controls.js +1 -0
  410. package/src/post-navigation-link/variations.js +2 -2
  411. package/src/post-terms/edit.js +1 -0
  412. package/src/post-time-to-read/block.json +1 -1
  413. package/src/query/edit/inspector-controls/author-control.js +1 -1
  414. package/src/query/edit/inspector-controls/index.js +148 -88
  415. package/src/query/edit/query-content.js +1 -11
  416. package/src/query/editor.scss +0 -31
  417. package/src/query/utils.js +1 -1
  418. package/src/query-no-results/block.json +1 -1
  419. package/src/query-pagination-numbers/edit.js +1 -1
  420. package/src/query-title/edit.js +61 -19
  421. package/src/query-total/block.json +7 -1
  422. package/src/quote/transforms.js +1 -1
  423. package/src/read-more/edit.js +35 -11
  424. package/src/rss/block.json +6 -0
  425. package/src/rss/edit.js +1 -0
  426. package/src/search/edit.js +100 -71
  427. package/src/separator/deprecated.scss +1 -1
  428. package/src/separator/edit.js +1 -6
  429. package/src/site-logo/edit.js +34 -47
  430. package/src/site-logo/editor.scss +3 -6
  431. package/src/social-link/index.php +2 -2
  432. package/src/social-links/edit.js +1 -0
  433. package/src/social-links/style.scss +3 -3
  434. package/src/spacer/controls.js +10 -9
  435. package/src/spacer/edit.js +25 -23
  436. package/src/table-of-contents/edit.js +38 -19
  437. package/src/template-part/edit/advanced-controls.js +1 -21
  438. package/src/utils/messages.js +31 -0
  439. package/src/video/edit-common-settings.js +1 -1
  440. package/src/video/edit.native.js +3 -3
  441. package/src/video/test/transforms.native.js +4 -3
@@ -1 +1 @@
1
- {"version":3,"names":["createBlock","createBlobURL","addFilter","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","parseShortcodeIds","ids","split","map","id","parseInt","updateThirdPartyTransformToGallery","block","name","attributes","images","length","innerBlocks","url","alt","sizeSlug","linkDestination","updateThirdPartyTransformFromGallery","toBlock","fromBlocks","from","Array","isArray","galleryBlock","find","transformedBlock","includes","transforms","type","isMultiBlock","blocks","transform","align","every","attribute","undefined","validImages","filter","image","width","height","tag","named","columns","link","orderby","imageIds","linkTo","randomOrder","imageId","isMatch","priority","files","file","indexOf","blob","to","caption","title","href","rel","linkClass","imageSizeSlug","linkTarget","anchor","className"],"sources":["@wordpress/block-library/src/gallery/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\n\nconst parseShortcodeIds = ( ids ) => {\n\tif ( ! ids ) {\n\t\treturn [];\n\t}\n\n\treturn ids.split( ',' ).map( ( id ) => parseInt( id, 10 ) );\n};\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * 3rdPartyBlock -> GalleryBlock transform so this tranform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} block The transformed block.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformToGallery( block ) {\n\tif (\n\t\tblock.name === 'core/gallery' &&\n\t\tblock.attributes?.images.length > 0\n\t) {\n\t\tconst innerBlocks = block.attributes.images.map(\n\t\t\t( { url, id, alt } ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl,\n\t\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\t\talt,\n\t\t\t\t\tsizeSlug: block.attributes.sizeSlug,\n\t\t\t\t\tlinkDestination: block.attributes.linkDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tdelete block.attributes.ids;\n\t\tdelete block.attributes.images;\n\t\tblock.innerBlocks = innerBlocks;\n\t}\n\n\treturn block;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-to',\n\tupdateThirdPartyTransformToGallery\n);\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * GalleryBlock -> 3rdPartyBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} toBlock The block to transform to.\n * @param {Block[]} fromBlocks The blocks to transform from.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformFromGallery( toBlock, fromBlocks ) {\n\tconst from = Array.isArray( fromBlocks ) ? fromBlocks : [ fromBlocks ];\n\tconst galleryBlock = from.find(\n\t\t( transformedBlock ) =>\n\t\t\ttransformedBlock.name === 'core/gallery' &&\n\t\t\ttransformedBlock.innerBlocks.length > 0 &&\n\t\t\t! transformedBlock.attributes.images?.length > 0 &&\n\t\t\t! toBlock.name.includes( 'core/' )\n\t);\n\n\tif ( galleryBlock ) {\n\t\tconst images = galleryBlock.innerBlocks.map(\n\t\t\t( { attributes: { url, id, alt } } ) => ( {\n\t\t\t\turl,\n\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\talt,\n\t\t\t} )\n\t\t);\n\t\tconst ids = images.map( ( { id } ) => id );\n\t\tgalleryBlock.attributes.images = images;\n\t\tgalleryBlock.attributes.ids = ids;\n\t}\n\n\treturn toBlock;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-from',\n\tupdateThirdPartyTransformFromGallery\n);\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\t// Init the align and size from the first item which may be either the placeholder or an image.\n\t\t\t\tlet { align, sizeSlug } = attributes[ 0 ];\n\t\t\t\t// Loop through all the images and check if they have the same align and size.\n\t\t\t\talign = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.align === align\n\t\t\t\t)\n\t\t\t\t\t? align\n\t\t\t\t\t: undefined;\n\t\t\t\tsizeSlug = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.sizeSlug === sizeSlug\n\t\t\t\t)\n\t\t\t\t\t? sizeSlug\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst validImages = attributes.filter( ( { url } ) => url );\n\n\t\t\t\tconst innerBlocks = validImages.map( ( image ) => {\n\t\t\t\t\t// Gallery images can't currently be resized so make sure height and width are undefined.\n\t\t\t\t\timage.width = undefined;\n\t\t\t\t\timage.height = undefined;\n\t\t\t\t\treturn createBlock( 'core/image', image );\n\t\t\t\t} );\n\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t},\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'gallery',\n\t\t\ttransform( { named: { ids, columns = 3, link, orderby } } ) {\n\t\t\t\tconst imageIds = parseShortcodeIds( ids ).map( ( id ) =>\n\t\t\t\t\tparseInt( id, 10 )\n\t\t\t\t);\n\n\t\t\t\tlet linkTo = LINK_DESTINATION_NONE;\n\t\t\t\tif ( link === 'post' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t} else if ( link === 'file' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_MEDIA;\n\t\t\t\t}\n\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: parseInt( columns, 10 ),\n\t\t\t\t\t\tlinkTo,\n\t\t\t\t\t\trandomOrder: orderby === 'rand',\n\t\t\t\t\t},\n\t\t\t\t\timageIds.map( ( imageId ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', { id: imageId } )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn galleryBlock;\n\t\t\t},\n\t\t\tisMatch( { named } ) {\n\t\t\t\treturn undefined !== named.ids;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// When created by drag and dropping multiple files on an insertion point. Because multiple\n\t\t\t// files must not be transformed to a gallery when dropped within a gallery there is another transform\n\t\t\t// within the image block to handle that case. Therefore this transform has to have priority 1\n\t\t\t// set so that it overrrides the image block transformation when mulitple images are dropped outside\n\t\t\t// of a gallery block.\n\t\t\ttype: 'files',\n\t\t\tpriority: 1,\n\t\t\tisMatch( files ) {\n\t\t\t\treturn (\n\t\t\t\t\tfiles.length !== 1 &&\n\t\t\t\t\tfiles.every(\n\t\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tconst innerBlocks = files.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/gallery', {}, innerBlocks );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { align }, innerBlocks ) => {\n\t\t\t\tif ( innerBlocks.length > 0 ) {\n\t\t\t\t\treturn innerBlocks.map(\n\t\t\t\t\t\t( {\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn createBlock( 'core/image', { align } );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SACCC,2BAA2B,EAC3BC,qBAAqB,EACrBC,sBAAsB,QAChB,aAAa;AAEpB,MAAMC,iBAAiB,GAAKC,GAAG,IAAM;EACpC,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;EAEA,OAAOA,GAAG,CAACC,KAAK,CAAE,GAAI,CAAC,CAACC,GAAG,CAAIC,EAAE,IAAMC,QAAQ,CAAED,EAAE,EAAE,EAAG,CAAE,CAAC;AAC5D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,kCAAkCA,CAAEC,KAAK,EAAG;EACpD,IACCA,KAAK,CAACC,IAAI,KAAK,cAAc,IAC7BD,KAAK,CAACE,UAAU,EAAEC,MAAM,CAACC,MAAM,GAAG,CAAC,EAClC;IACD,MAAMC,WAAW,GAAGL,KAAK,CAACE,UAAU,CAACC,MAAM,CAACP,GAAG,CAC9C,CAAE;MAAEU,GAAG;MAAET,EAAE;MAAEU;IAAI,CAAC,KAAM;MACvB,OAAOpB,WAAW,CAAE,YAAY,EAAE;QACjCmB,GAAG;QACHT,EA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IAEH,CAAC;IACDvB,SAASA,CAAEqB,KAAK,EAAG;MAClB,MAAMxC,WAAW,GAAGwC,KAAK,CAACjD,GAAG,CAAIkD,IAAI,IACpC3D,WAAW,CAAE,YAAY,EAAE;QAC1B6D,IAAI,EAAE5D,aAAa,CAAE0D,IAAK;MAC3B,CAAE,CACH,CAAC;MAED,OAAO3D,WAAW,CAAE,cAAc,EAAE,CAAC,CAAC,EAAEkB,WAAY,CAAC;IACtD;EACD,CAAC,CACD;EACD4C,EAAE,EAAE,CACH;IACC5B,IAAI,EAAE,OAAO;IACbE,MAAM,EAAE,CAAE,YAAY,CAAE;IACxBC,SAAS,EAAEA,CAAE;MAAEC;IAAM,CAAC,EAAEpB,WAAW,KAAM;MACxC,IAAKA,WAAW,CAACD,MAAM,GAAG,CAAC,EAAG;QAC7B,OAAOC,WAAW,CAACT,GAAG,CACrB,CAAE;UACDM,UAAU,EAAE;YACXI,GAAG;YACHC,GAAG;YACH2C,OAAO;YACPC,KAAK;YACLC,IAAI;YACJC,GAAG;YACHC,SAAS;YACTzD,EAAE;YACFW,QAAQ,EAAE+C,aAAa;YACvB9C,eAAe;YACf+C,UAAU;YACVC,MAAM;YACNC;UACD;QACD,CAAC,KACAvE,WAAW,CAAE,YAAY,EAAE;UAC1BsC,KAAK;UACLnB,GAAG;UACHC,GAAG;UACH2C,OAAO;UACPC,KAAK;UACLC,IAAI;UACJC,GAAG;UACHC,SAAS;UACTzD,EAAE;UACFW,QAAQ,EAAE+C,aAAa;UACvB9C,eAAe;UACf+C,UAAU;UACVC,MAAM;UACNC;QACD,CAAE,CACJ,CAAC;MACF;MACA,OAAOvE,WAAW,CAAE,YAAY,EAAE;QAAEsC;MAAM,CAAE,CAAC;IAC9C;EACD,CAAC;AAEH,CAAC;AAED,eAAeL,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["createBlock","createBlobURL","addFilter","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","parseShortcodeIds","ids","split","map","id","parseInt","updateThirdPartyTransformToGallery","block","name","attributes","images","length","innerBlocks","url","alt","sizeSlug","linkDestination","updateThirdPartyTransformFromGallery","toBlock","fromBlocks","from","Array","isArray","galleryBlock","find","transformedBlock","includes","transforms","type","isMultiBlock","blocks","transform","align","every","attribute","undefined","validImages","filter","image","width","height","tag","named","columns","link","orderby","imageIds","linkTo","randomOrder","imageId","isMatch","priority","files","file","indexOf","blob","to","caption","title","href","rel","linkClass","imageSizeSlug","linkTarget","anchor","className"],"sources":["@wordpress/block-library/src/gallery/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\n\nconst parseShortcodeIds = ( ids ) => {\n\tif ( ! ids ) {\n\t\treturn [];\n\t}\n\n\treturn ids.split( ',' ).map( ( id ) => parseInt( id, 10 ) );\n};\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * 3rdPartyBlock -> GalleryBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} block The transformed block.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformToGallery( block ) {\n\tif (\n\t\tblock.name === 'core/gallery' &&\n\t\tblock.attributes?.images.length > 0\n\t) {\n\t\tconst innerBlocks = block.attributes.images.map(\n\t\t\t( { url, id, alt } ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl,\n\t\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\t\talt,\n\t\t\t\t\tsizeSlug: block.attributes.sizeSlug,\n\t\t\t\t\tlinkDestination: block.attributes.linkDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tdelete block.attributes.ids;\n\t\tdelete block.attributes.images;\n\t\tblock.innerBlocks = innerBlocks;\n\t}\n\n\treturn block;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-to',\n\tupdateThirdPartyTransformToGallery\n);\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * GalleryBlock -> 3rdPartyBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} toBlock The block to transform to.\n * @param {Block[]} fromBlocks The blocks to transform from.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformFromGallery( toBlock, fromBlocks ) {\n\tconst from = Array.isArray( fromBlocks ) ? fromBlocks : [ fromBlocks ];\n\tconst galleryBlock = from.find(\n\t\t( transformedBlock ) =>\n\t\t\ttransformedBlock.name === 'core/gallery' &&\n\t\t\ttransformedBlock.innerBlocks.length > 0 &&\n\t\t\t! transformedBlock.attributes.images?.length > 0 &&\n\t\t\t! toBlock.name.includes( 'core/' )\n\t);\n\n\tif ( galleryBlock ) {\n\t\tconst images = galleryBlock.innerBlocks.map(\n\t\t\t( { attributes: { url, id, alt } } ) => ( {\n\t\t\t\turl,\n\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\talt,\n\t\t\t} )\n\t\t);\n\t\tconst ids = images.map( ( { id } ) => id );\n\t\tgalleryBlock.attributes.images = images;\n\t\tgalleryBlock.attributes.ids = ids;\n\t}\n\n\treturn toBlock;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-from',\n\tupdateThirdPartyTransformFromGallery\n);\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\t// Init the align and size from the first item which may be either the placeholder or an image.\n\t\t\t\tlet { align, sizeSlug } = attributes[ 0 ];\n\t\t\t\t// Loop through all the images and check if they have the same align and size.\n\t\t\t\talign = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.align === align\n\t\t\t\t)\n\t\t\t\t\t? align\n\t\t\t\t\t: undefined;\n\t\t\t\tsizeSlug = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.sizeSlug === sizeSlug\n\t\t\t\t)\n\t\t\t\t\t? sizeSlug\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst validImages = attributes.filter( ( { url } ) => url );\n\n\t\t\t\tconst innerBlocks = validImages.map( ( image ) => {\n\t\t\t\t\t// Gallery images can't currently be resized so make sure height and width are undefined.\n\t\t\t\t\timage.width = undefined;\n\t\t\t\t\timage.height = undefined;\n\t\t\t\t\treturn createBlock( 'core/image', image );\n\t\t\t\t} );\n\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t},\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'gallery',\n\t\t\ttransform( { named: { ids, columns = 3, link, orderby } } ) {\n\t\t\t\tconst imageIds = parseShortcodeIds( ids ).map( ( id ) =>\n\t\t\t\t\tparseInt( id, 10 )\n\t\t\t\t);\n\n\t\t\t\tlet linkTo = LINK_DESTINATION_NONE;\n\t\t\t\tif ( link === 'post' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t} else if ( link === 'file' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_MEDIA;\n\t\t\t\t}\n\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: parseInt( columns, 10 ),\n\t\t\t\t\t\tlinkTo,\n\t\t\t\t\t\trandomOrder: orderby === 'rand',\n\t\t\t\t\t},\n\t\t\t\t\timageIds.map( ( imageId ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', { id: imageId } )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn galleryBlock;\n\t\t\t},\n\t\t\tisMatch( { named } ) {\n\t\t\t\treturn undefined !== named.ids;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// When created by drag and dropping multiple files on an insertion point. Because multiple\n\t\t\t// files must not be transformed to a gallery when dropped within a gallery there is another transform\n\t\t\t// within the image block to handle that case. Therefore this transform has to have priority 1\n\t\t\t// set so that it overrides the image block transformation when multiple images are dropped outside\n\t\t\t// of a gallery block.\n\t\t\ttype: 'files',\n\t\t\tpriority: 1,\n\t\t\tisMatch( files ) {\n\t\t\t\treturn (\n\t\t\t\t\tfiles.length !== 1 &&\n\t\t\t\t\tfiles.every(\n\t\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tconst innerBlocks = files.map( ( file ) =>\n\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/gallery', {}, innerBlocks );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { align }, innerBlocks ) => {\n\t\t\t\tif ( innerBlocks.length > 0 ) {\n\t\t\t\t\treturn innerBlocks.map(\n\t\t\t\t\t\t( {\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn createBlock( 'core/image', { align } );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SACCC,2BAA2B,EAC3BC,qBAAqB,EACrBC,sBAAsB,QAChB,aAAa;AAEpB,MAAMC,iBAAiB,GAAKC,GAAG,IAAM;EACpC,IAAK,CAAEA,GAAG,EAAG;IACZ,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ACFW,QAAQ,EAAE+C,aAAa;YACvB9C,eAAe;YACf+C,UAAU;YACVC,MAAM;YACNC;UACD;QACD,CAAC,KACAvE,WAAW,CAAE,YAAY,EAAE;UAC1BsC,KAAK;UACLnB,GAAG;UACHC,GAAG;UACH2C,OAAO;UACPC,KAAK;UACLC,IAAI;UACJC,GAAG;UACHC,SAAS;UACTzD,EAAE;UACFW,QAAQ,EAAE+C,aAAa;UACvB9C,eAAe;UACf+C,UAAU;UACVC,MAAM;UACNC;QACD,CAAE,CACJ,CAAC;MACF;MACA,OAAOvE,WAAW,CAAE,YAAY,EAAE;QAAEsC;MAAM,CAAE,CAAC;IAC9C;EACD,CAAC;AAEH,CAAC;AAED,eAAeL,UAAU","ignoreList":[]}
@@ -39,7 +39,7 @@ export default function useGetNewImages(images, imageData) {
39
39
 
40
40
  // Now check for any new images that have been added to InnerBlocks and for which
41
41
  // we have the imageData we need for setting default block attributes.
42
- const newImages = images.filter(image => !newCurrentImages.find(currentImage => image.clientId && currentImage.clientId === image.clientId) && imageData?.find(img => img.id === image.id) && !image.fromSavedConent);
42
+ const newImages = images.filter(image => !newCurrentImages.find(currentImage => image.clientId && currentImage.clientId === image.clientId) && imageData?.find(img => img.id === image.id) && !image.fromSavedContent);
43
43
  if (imagesUpdated || newImages?.length > 0) {
44
44
  setCurrentImages([...newCurrentImages, ...newImages]);
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","useGetNewImages","images","imageData","currentImages","setCurrentImages","getNewImages","imagesUpdated","newCurrentImages","filter","currentImg","find","img","clientId","length","forEach","image","fromSavedContent","currentImage","id","push","newImages","fromSavedConent"],"sources":["@wordpress/block-library/src/gallery/use-get-new-images.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Keeps track of images already in the gallery to allow new innerBlocks to be identified. This\n * is required so default gallery attributes can be applied without overwriting any custom\n * attributes applied to existing images.\n *\n * @param {Array} images Basic image block data taken from current gallery innerBlock\n * @param {Array} imageData The related image data for each of the current gallery images.\n *\n * @return {Array} An array of any new images that have been added to the gallery.\n */\nexport default function useGetNewImages( images, imageData ) {\n\tconst [ currentImages, setCurrentImages ] = useState( [] );\n\n\treturn useMemo( () => getNewImages(), [ images, imageData ] );\n\n\tfunction getNewImages() {\n\t\tlet imagesUpdated = false;\n\n\t\t// First lets check if any images have been deleted.\n\t\tconst newCurrentImages = currentImages.filter( ( currentImg ) =>\n\t\t\timages.find( ( img ) => {\n\t\t\t\treturn currentImg.clientId === img.clientId;\n\t\t\t} )\n\t\t);\n\n\t\tif ( newCurrentImages.length < currentImages.length ) {\n\t\t\timagesUpdated = true;\n\t\t}\n\n\t\t// Now lets see if we have any images hydrated from saved content and if so\n\t\t// add them to currentImages state.\n\t\timages.forEach( ( image ) => {\n\t\t\tif (\n\t\t\t\timage.fromSavedContent &&\n\t\t\t\t! newCurrentImages.find(\n\t\t\t\t\t( currentImage ) => currentImage.id === image.id\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\timagesUpdated = true;\n\t\t\t\tnewCurrentImages.push( image );\n\t\t\t}\n\t\t} );\n\n\t\t// Now check for any new images that have been added to InnerBlocks and for which\n\t\t// we have the imageData we need for setting default block attributes.\n\t\tconst newImages = images.filter(\n\t\t\t( image ) =>\n\t\t\t\t! newCurrentImages.find(\n\t\t\t\t\t( currentImage ) =>\n\t\t\t\t\t\timage.clientId &&\n\t\t\t\t\t\tcurrentImage.clientId === image.clientId\n\t\t\t\t) &&\n\t\t\t\timageData?.find( ( img ) => img.id === image.id ) &&\n\t\t\t\t! image.fromSavedConent\n\t\t);\n\n\t\tif ( imagesUpdated || newImages?.length > 0 ) {\n\t\t\tsetCurrentImages( [ ...newCurrentImages, ...newImages ] );\n\t\t}\n\n\t\treturn newImages.length > 0 ? newImages : null;\n\t}\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA;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,eACV,CAAC;IAED,IAAKf,aAAa,IAAIc,SAAS,EAAEP,MAAM,GAAG,CAAC,EAAG;MAC7CT,gBAAgB,CAAE,CAAE,GAAGG,gBAAgB,EAAE,GAAGa,SAAS,CAAG,CAAC;IAC1D;IAEA,OAAOA,SAAS,CAACP,MAAM,GAAG,CAAC,GAAGO,SAAS,GAAG,IAAI;EAC/C;AACD","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useState","useGetNewImages","images","imageData","currentImages","setCurrentImages","getNewImages","imagesUpdated","newCurrentImages","filter","currentImg","find","img","clientId","length","forEach","image","fromSavedContent","currentImage","id","push","newImages"],"sources":["@wordpress/block-library/src/gallery/use-get-new-images.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Keeps track of images already in the gallery to allow new innerBlocks to be identified. This\n * is required so default gallery attributes can be applied without overwriting any custom\n * attributes applied to existing images.\n *\n * @param {Array} images Basic image block data taken from current gallery innerBlock\n * @param {Array} imageData The related image data for each of the current gallery images.\n *\n * @return {Array} An array of any new images that have been added to the gallery.\n */\nexport default function useGetNewImages( images, imageData ) {\n\tconst [ currentImages, setCurrentImages ] = useState( [] );\n\n\treturn useMemo( () => getNewImages(), [ images, imageData ] );\n\n\tfunction getNewImages() {\n\t\tlet imagesUpdated = false;\n\n\t\t// First lets check if any images have been deleted.\n\t\tconst newCurrentImages = currentImages.filter( ( currentImg ) =>\n\t\t\timages.find( ( img ) => {\n\t\t\t\treturn currentImg.clientId === img.clientId;\n\t\t\t} )\n\t\t);\n\n\t\tif ( newCurrentImages.length < currentImages.length ) {\n\t\t\timagesUpdated = true;\n\t\t}\n\n\t\t// Now lets see if we have any images hydrated from saved content and if so\n\t\t// add them to currentImages state.\n\t\timages.forEach( ( image ) => {\n\t\t\tif (\n\t\t\t\timage.fromSavedContent &&\n\t\t\t\t! newCurrentImages.find(\n\t\t\t\t\t( currentImage ) => currentImage.id === image.id\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\timagesUpdated = true;\n\t\t\t\tnewCurrentImages.push( image );\n\t\t\t}\n\t\t} );\n\n\t\t// Now check for any new images that have been added to InnerBlocks and for which\n\t\t// we have the imageData we need for setting default block attributes.\n\t\tconst newImages = images.filter(\n\t\t\t( image ) =>\n\t\t\t\t! newCurrentImages.find(\n\t\t\t\t\t( currentImage ) =>\n\t\t\t\t\t\timage.clientId &&\n\t\t\t\t\t\tcurrentImage.clientId === image.clientId\n\t\t\t\t) &&\n\t\t\t\timageData?.find( ( img ) => img.id === image.id ) &&\n\t\t\t\t! image.fromSavedContent\n\t\t);\n\n\t\tif ( imagesUpdated || newImages?.length > 0 ) {\n\t\t\tsetCurrentImages( [ ...newCurrentImages, ...newImages ] );\n\t\t}\n\n\t\treturn newImages.length > 0 ? newImages : null;\n\t}\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,MAAM,EAAEC,SAAS,EAAG;EAC5D,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGL,QAAQ,CAAE,EAAG,CAAC;EAE1D,OAAOD,OAAO,CAAE,MAAMO,YAAY,CAAC,CAAC,EAAE,CAAEJ,MAAM,EAAEC,SAAS,CAAG,CAAC;EAE7D,SAASG,YAAYA,CAAA,EAAG;IACvB,IAAIC,aAAa,GAAG,KAAK;;IAEzB;IACA,MAAMC,gBAAgB,GAAGJ,aAAa,CAACK,MAAM,CAAIC,UAAU,IAC1DR,MAAM,CAACS,IAAI,CAAIC,GAAG,IAAM;MACvB,OAAOF,UAAU,CAACG,QAAQ,KAAKD,GAAG,CAACC,QAAQ;IAC5C,CAAE,CACH,CAAC;IAED,IAAKL,gBAAgB,CAACM,MAAM,GAAGV,aAAa,CAACU,MAAM,EAAG;MACrDP,aAAa,GAAG,IAAI;IACrB;;IAEA;IACA;IACAL,MAAM,CAACa,OAAO,CAAIC,KAAK,IAAM;MAC5B,IACCA,KAAK,CAACC,gBAAgB,IACtB,CAAET,gBAAgB,CAACG,IAAI,CACpBO,YAAY,IAAMA,YAAY,CAACC,EAAE,KAAKH,KAAK,CAACG,EAC/C,CAAC,EACA;QACDZ,aAAa,GAAG,IAAI;QACpBC,gBAAgB,CAACY,IAAI,CAAEJ,KAAM,CAAC;MAC/B;IACD,CAAE,CAAC;;IAEH;IACA;IACA,MAAMK,SAAS,GAAGnB,MAAM,CAACO,MAAM,CAC5BO,KAAK,IACN,CAAER,gBAAgB,CAACG,IAAI,CACpBO,YAAY,IACbF,KAAK,CAACH,QAAQ,IACdK,YAAY,CAACL,QAAQ,KAAKG,KAAK,CAACH,QAClC,CAAC,IACDV,SAAS,EAAEQ,IAAI,CAAIC,GAAG,IAAMA,GAAG,CAACO,EAAE,KAAKH,KAAK,CAACG,EAAG,CAAC,IACjD,CAAEH,KAAK,CAACC,gBACV,CAAC;IAED,IAAKV,aAAa,IAAIc,SAAS,EAAEP,MAAM,GAAG,CAAC,EAAG;MAC7CT,gBAAgB,CAAE,CAAE,GAAGG,gBAAgB,EAAE,GAAGa,SAAS,CAAG,CAAC;IAC1D;IAEA,OAAOA,SAAS,CAACP,MAAM,GAAG,CAAC,GAAGO,SAAS,GAAG,IAAI;EAC/C;AACD","ignoreList":[]}
@@ -12,6 +12,7 @@ import { View } from '@wordpress/primitives';
12
12
  * Internal dependencies
13
13
  */
14
14
  import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';
15
+ import { htmlElementMessages } from '../utils/messages';
15
16
 
16
17
  /**
17
18
  * Render inspector controls for the Group block.
@@ -27,14 +28,6 @@ function GroupEditControls({
27
28
  tagName,
28
29
  onSelectTagName
29
30
  }) {
30
- const htmlElementMessages = {
31
- header: __('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
32
- main: __('The <main> element should be used for the primary content of your document only.'),
33
- section: __("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
34
- article: __('The <article> element should represent a self-contained, syndicatable portion of the document.'),
35
- aside: __("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
36
- footer: __('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).')
37
- };
38
31
  return /*#__PURE__*/_jsx(InspectorControls, {
39
32
  group: "advanced",
40
33
  children: /*#__PURE__*/_jsx(SelectControl, {
@@ -1 +1 @@
1
- {"version":3,"names":["useDispatch","useSelect","InnerBlocks","useBlockProps","InspectorControls","useInnerBlocksProps","store","blockEditorStore","SelectControl","useRef","__","View","GroupPlaceHolder","useShouldShowPlaceHolder","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","GroupEditControls","tagName","onSelectTagName","htmlElementMessages","header","main","section","article","aside","footer","group","children","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","hasInnerBlocks","themeSupportsLayout","select","getBlock","getSettings","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","ref","blockProps","showPlaceholder","setShowPlaceholder","usedLayoutType","renderAppender","ButtonBlockAppender","innerBlocksProps","className","dropZoneElement","current","selectBlock","selectVariation","nextVariation","onSelect"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,uBAAuB;;AAE5C;AACA;AACA;AACA,OAAOC,gBAAgB,IAAIC,wBAAwB,QAAQ,eAAe;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AASA,SAASC,iBAAiBA,CAAE;EAAEC,OAAO;EAAEC;AAAgB,CAAC,EAAG;EAC1D,MAAMC,mBAAmB,GAAG;IAC3BC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C,aAAa;IACbS;EACD,CACD,CAAC;EAED,MAAM;IAAEM;EAAY,CAAC,GAAGtE,WAAW,CAAEO,gBAAiB,CAAC;EAEvD,MAAMgE,eAAe,GAAKC,aAAa,IAAM;IAC5C9B,aAAa,CAAE8B,aAAa,CAAChC,UAAW,CAAC;IACzC8B,WAAW,CAAE3B,QAAQ,EAAE,CAAC,CAAE,CAAC;IAC3BmB,kBAAkB,CAAE,KAAM,CAAC;EAC5B,CAAC;EAED,oBACC7C,KAAA,CAAAE,SAAA;IAAAY,QAAA,gBACChB,IAAA,CAACK,iBAAiB;MACjBC,OAAO,EAAGgC,OAAS;MACnB/B,eAAe,EAAKc,KAAK,IACxBM,aAAa,CAAE;QAAErB,OAAO,EAAEe;MAAM,CAAE;IAClC,CACD,CAAC,EACAyB,eAAe,iBAChB5C,KAAA,CAACN,IAAI;MAAAoB,QAAA,GACFmC,gBAAgB,CAACnC,QAAQ,eAC3BhB,IAAA,CAACH,gBAAgB;QAChB6B,IAAI,EAAGA,IAAM;QACbgC,QAAQ,EAAGF;MAAiB,CAC5B,CAAC;IAAA,CACG,CACN,EACCb,oBAAoB,IAAI,CAAEG,eAAe,iBAC1C9C,IAAA,CAACsC,OAAO;MAAA,GAAMa;IAAgB,CAAI,CAClC,EAGC,CAAER,oBAAoB,IAAI,CAAEG,eAAe,iBAC5C9C,IAAA,CAACsC,OAAO;MAAA,GAAMO,UAAU;MAAA7B,QAAA,eACvBhB,IAAA;QAAA,GAAUmD;MAAgB,CAAI;IAAC,CACvB,CACT;EAAA,CACA,CAAC;AAEL;AAEA,eAAe3B,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["useDispatch","useSelect","InnerBlocks","useBlockProps","InspectorControls","useInnerBlocksProps","store","blockEditorStore","SelectControl","useRef","__","View","GroupPlaceHolder","useShouldShowPlaceHolder","htmlElementMessages","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","GroupEditControls","tagName","onSelectTagName","group","children","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","hasInnerBlocks","themeSupportsLayout","select","getBlock","getSettings","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","ref","blockProps","showPlaceholder","setShowPlaceholder","usedLayoutType","renderAppender","ButtonBlockAppender","innerBlocksProps","className","dropZoneElement","current","selectBlock","selectVariation","nextVariation","onSelect"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\nimport { htmlElementMessages } from '../utils/messages';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,uBAAuB;;AAE5C;AACA;AACA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AO;IAC5Bf,YAAY;IACZC,aAAa;IACbS;EACD,CACD,CAAC;EAED,MAAM;IAAEM;EAAY,CAAC,GAAGhE,WAAW,CAAEO,gBAAiB,CAAC;EAEvD,MAAM0D,eAAe,GAAKC,aAAa,IAAM;IAC5C9B,aAAa,CAAE8B,aAAa,CAAChC,UAAW,CAAC;IACzC8B,WAAW,CAAE3B,QAAQ,EAAE,CAAC,CAAE,CAAC;IAC3BmB,kBAAkB,CAAE,KAAM,CAAC;EAC5B,CAAC;EAED,oBACCtC,KAAA,CAAAE,SAAA;IAAAK,QAAA,gBACCT,IAAA,CAACK,iBAAiB;MACjBC,OAAO,EAAGyB,OAAS;MACnBxB,eAAe,EAAKO,KAAK,IACxBM,aAAa,CAAE;QAAEd,OAAO,EAAEQ;MAAM,CAAE;IAClC,CACD,CAAC,EACAyB,eAAe,iBAChBrC,KAAA,CAACP,IAAI;MAAAc,QAAA,GACFmC,gBAAgB,CAACnC,QAAQ,eAC3BT,IAAA,CAACJ,gBAAgB;QAChBuB,IAAI,EAAGA,IAAM;QACbgC,QAAQ,EAAGF;MAAiB,CAC5B,CAAC;IAAA,CACG,CACN,EACCb,oBAAoB,IAAI,CAAEG,eAAe,iBAC1CvC,IAAA,CAAC+B,OAAO;MAAA,GAAMa;IAAgB,CAAI,CAClC,EAGC,CAAER,oBAAoB,IAAI,CAAEG,eAAe,iBAC5CvC,IAAA,CAAC+B,OAAO;MAAA,GAAMO,UAAU;MAAA7B,QAAA,eACvBT,IAAA;QAAA,GAAU4C;MAAgB,CAAI;IAAC,CACvB,CACT;EAAA,CACA,CAAC;AAEL;AAEA,eAAe3B,SAAS","ignoreList":[]}
@@ -56,8 +56,7 @@ export default function HomeEdit({
56
56
  },
57
57
  "aria-label": __('Home link text'),
58
58
  placeholder: __('Add home link'),
59
- withoutInteractiveFormatting: true,
60
- allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough']
59
+ withoutInteractiveFormatting: true
61
60
  })
62
61
  })
63
62
  });
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","RichText","useBlockProps","__","useSelect","store","coreStore","jsx","_jsx","preventDefault","event","HomeEdit","attributes","setAttributes","context","_attributes$label","homeUrl","select","getEntityRecord","home","textColor","backgroundColor","style","blockProps","className","color","text","background","children","href","onClick","identifier","value","label","onChange","labelValue","placeholder","withoutInteractiveFormatting","allowedFormats"],"sources":["@wordpress/block-library/src/home-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst preventDefault = ( event ) => event.preventDefault();\n\nexport default function HomeEdit( { attributes, setAttributes, context } ) {\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst { textColor, backgroundColor, style } = context;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'has-text-color': !! textColor || !! style?.color?.text,\n\t\t\t[ `has-${ textColor }-color` ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || !! style?.color?.background,\n\t\t\t[ `has-${ backgroundColor }-background-color` ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: style?.color?.text,\n\t\t\tbackgroundColor: style?.color?.background,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<a\n\t\t\t\tclassName=\"wp-block-home-link__content wp-block-navigation-item__content\"\n\t\t\t\thref={ homeUrl }\n\t\t\t\tonClick={ preventDefault }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName=\"wp-block-home-link__label\"\n\t\t\t\t\tvalue={ attributes.label ?? __( 'Home' ) }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\taria-label={ __( 'Home link text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add home link' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</a>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,aAAa,QAAQ,yBAAyB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1D,MAAMC,cAAc,GAAKC,KAAK,IAAMA,KAAK,CAACD,cAAc,CAAC,CAAC;AAE1D,eAAe,SAASE,QAAQA,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAEC;AAAQ,CAAC,EAAG;EAAA,IAAAC,iBAAA;EAC1E,MAAMC,OAAO,GAAGZ,SAAS,CAAIa,MAAM,IAAM;IACxC;IACA,OAAOA,MAAM,CAAEX,SAAU,CAAC,CAACY,eAAe,CAAE,MAAM,EAAE,gBAAiB,CAAC,EACnEC,IAAI;EACR,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEC,SAAS;IAAEC,eAAe;IAAEC;EAAM,CAAC,GAAGR,OAAO;EACrD,MAAMS,UAAU,GAAGrB,aAAa,CAAE;IACjCsB,SAAS,EAAExB,IAAI,CAAE,0BAA0B,EAAE;MAC5C,gBAAgB,EAAE,CAAC,CAAEoB,SAAS,IAAI,CAAC,CAAEE,KAAK,EAAEG,KAAK,EAAEC,IAAI;MACvD,CAAE,OAAQN,SAAS,QAAS,GAAI,CAAC,CAAEA,SAAS;MAC5C,gBAAgB,EAAE,CAAC,CAAEC,eAAe,IAAI,CAAC,CAAEC,KAAK,EAAEG,KAAK,EAAEE,UAAU;MACnE,CAAE,OAAQN,eAAe,mBAAoB,GAAI,CAAC,CAAEA;IACrD,CAAE,CAAC;IACHC,KAAK,EAAE;MACNG,KAAK,EAAEH,KAAK,EAAEG,KAAK,EAAEC,IAAI;MACzBL,eAAe,EAAEC,KAAK,EAAEG,KAAK,EAAEE;IAChC;EACD,CAAE,CAAC;EAEH,oBACCnB,IAAA;IAAA,GAAUe,UAAU;IAAAK,QAAA,eACnBpB,IAAA;MACCgB,SAAS,EAAC,+DAA+D;MACzEK,IAAI,EAAGb,OAAS;MAChBc,OAAO,EAAGrB,cAAgB;MAAAmB,QAAA,eAE1BpB,IAAA,CAACP,QAAQ;QACR8B,UAAU,EAAC,OAAO;QAClBP,SAAS,EAAC,2BAA2B;QACrCQ,KAAK,GAAAjB,iBAAA,GAAGH,UAAU,CAACqB,KAAK,cAAAlB,iBAAA,cAAAA,iBAAA,GAAIZ,EAAE,CAAE,MAAO,CAAG;QAC1C+B,QAAQ,EAAKC,UAAU,IAAM;UAC5BtB,aAAa,CAAE;YAAEoB,KAAK,EAAEE;UAAW,CAAE,CAAC;QACvC,CAAG;QACH,cAAahC,EAAE,CAAE,gBAAiB,CAAG;QACrCiC,WAAW,EAAGjC,EAAE,CAAE,eAAgB,CAAG;QACrCkC,4BAA4B;QAC5BC,cAAc,EAAG,CAChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,oBAAoB;MAClB,CACH;IAAC,CACA;EAAC,CACA,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["clsx","RichText","useBlockProps","__","useSelect","store","coreStore","jsx","_jsx","preventDefault","event","HomeEdit","attributes","setAttributes","context","_attributes$label","homeUrl","select","getEntityRecord","home","textColor","backgroundColor","style","blockProps","className","color","text","background","children","href","onClick","identifier","value","label","onChange","labelValue","placeholder","withoutInteractiveFormatting"],"sources":["@wordpress/block-library/src/home-link/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst preventDefault = ( event ) => event.preventDefault();\n\nexport default function HomeEdit( { attributes, setAttributes, context } ) {\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\n\tconst { textColor, backgroundColor, style } = context;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wp-block-navigation-item', {\n\t\t\t'has-text-color': !! textColor || !! style?.color?.text,\n\t\t\t[ `has-${ textColor }-color` ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || !! style?.color?.background,\n\t\t\t[ `has-${ backgroundColor }-background-color` ]: !! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: style?.color?.text,\n\t\t\tbackgroundColor: style?.color?.background,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<a\n\t\t\t\tclassName=\"wp-block-home-link__content wp-block-navigation-item__content\"\n\t\t\t\thref={ homeUrl }\n\t\t\t\tonClick={ preventDefault }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName=\"wp-block-home-link__label\"\n\t\t\t\t\tvalue={ attributes.label ?? __( 'Home' ) }\n\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t} }\n\t\t\t\t\taria-label={ __( 'Home link text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add home link' )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,KAAK,EAAEC,IAAI;MACzBL,eAAe,EAAEC,KAAK,EAAEG,KAAK,EAAEE;IAChC;EACD,CAAE,CAAC;EAEH,oBACCnB,IAAA;IAAA,GAAUe,UAAU;IAAAK,QAAA,eACnBpB,IAAA;MACCgB,SAAS,EAAC,+DAA+D;MACzEK,IAAI,EAAGb,OAAS;MAChBc,OAAO,EAAGrB,cAAgB;MAAAmB,QAAA,eAE1BpB,IAAA,CAACP,QAAQ;QACR8B,UAAU,EAAC,OAAO;QAClBP,SAAS,EAAC,2BAA2B;QACrCQ,KAAK,GAAAjB,iBAAA,GAAGH,UAAU,CAACqB,KAAK,cAAAlB,iBAAA,cAAAA,iBAAA,GAAIZ,EAAE,CAAE,MAAO,CAAG;QAC1C+B,QAAQ,EAAKC,UAAU,IAAM;UAC5BtB,aAAa,CAAE;YAAEoB,KAAK,EAAEE;UAAW,CAAE,CAAC;QACvC,CAAG;QACH,cAAahC,EAAE,CAAE,gBAAiB,CAAG;QACrCiC,WAAW,EAAGjC,EAAE,CAAE,eAAgB,CAAG;QACrCkC,4BAA4B;MAAA,CAC5B;IAAC,CACA;EAAC,CACA,CAAC;AAER","ignoreList":[]}
@@ -2,10 +2,15 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
5
- import { Disabled, PanelBody, RangeControl, ToggleControl } from '@wordpress/components';
5
+ import { Disabled, RangeControl, ToggleControl, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
6
6
  import ServerSideRender from '@wordpress/server-side-render';
7
7
  import { __ } from '@wordpress/i18n';
8
8
 
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
13
+
9
14
  /**
10
15
  * Minimum number of comments a user can show using this block.
11
16
  *
@@ -36,43 +41,85 @@ export default function LatestComments({
36
41
  spacing: undefined
37
42
  }
38
43
  };
44
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
39
45
  return /*#__PURE__*/_jsxs("div", {
40
46
  ...useBlockProps(),
41
47
  children: [/*#__PURE__*/_jsx(InspectorControls, {
42
- children: /*#__PURE__*/_jsxs(PanelBody, {
43
- title: __('Settings'),
44
- children: [/*#__PURE__*/_jsx(ToggleControl, {
45
- __nextHasNoMarginBottom: true,
48
+ children: /*#__PURE__*/_jsxs(ToolsPanel, {
49
+ label: __('Settings'),
50
+ resetAll: () => {
51
+ setAttributes({
52
+ commentsToShow: 5,
53
+ displayAvatar: true,
54
+ displayDate: true,
55
+ displayExcerpt: true
56
+ });
57
+ },
58
+ dropdownMenuProps: dropdownMenuProps,
59
+ children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
60
+ hasValue: () => !displayAvatar,
46
61
  label: __('Display avatar'),
47
- checked: displayAvatar,
48
- onChange: () => setAttributes({
49
- displayAvatar: !displayAvatar
62
+ onDeselect: () => setAttributes({
63
+ displayAvatar: true
64
+ }),
65
+ isShownByDefault: true,
66
+ children: /*#__PURE__*/_jsx(ToggleControl, {
67
+ __nextHasNoMarginBottom: true,
68
+ label: __('Display avatar'),
69
+ checked: displayAvatar,
70
+ onChange: () => setAttributes({
71
+ displayAvatar: !displayAvatar
72
+ })
50
73
  })
51
- }), /*#__PURE__*/_jsx(ToggleControl, {
52
- __nextHasNoMarginBottom: true,
74
+ }), /*#__PURE__*/_jsx(ToolsPanelItem, {
75
+ hasValue: () => !displayDate,
53
76
  label: __('Display date'),
54
- checked: displayDate,
55
- onChange: () => setAttributes({
56
- displayDate: !displayDate
77
+ onDeselect: () => setAttributes({
78
+ displayDate: true
79
+ }),
80
+ isShownByDefault: true,
81
+ children: /*#__PURE__*/_jsx(ToggleControl, {
82
+ __nextHasNoMarginBottom: true,
83
+ label: __('Display date'),
84
+ checked: displayDate,
85
+ onChange: () => setAttributes({
86
+ displayDate: !displayDate
87
+ })
57
88
  })
58
- }), /*#__PURE__*/_jsx(ToggleControl, {
59
- __nextHasNoMarginBottom: true,
89
+ }), /*#__PURE__*/_jsx(ToolsPanelItem, {
90
+ hasValue: () => !displayExcerpt,
60
91
  label: __('Display excerpt'),
61
- checked: displayExcerpt,
62
- onChange: () => setAttributes({
63
- displayExcerpt: !displayExcerpt
92
+ onDeselect: () => setAttributes({
93
+ displayExcerpt: true
94
+ }),
95
+ isShownByDefault: true,
96
+ children: /*#__PURE__*/_jsx(ToggleControl, {
97
+ __nextHasNoMarginBottom: true,
98
+ label: __('Display excerpt'),
99
+ checked: displayExcerpt,
100
+ onChange: () => setAttributes({
101
+ displayExcerpt: !displayExcerpt
102
+ })
64
103
  })
65
- }), /*#__PURE__*/_jsx(RangeControl, {
66
- __nextHasNoMarginBottom: true,
67
- __next40pxDefaultSize: true,
104
+ }), /*#__PURE__*/_jsx(ToolsPanelItem, {
105
+ hasValue: () => commentsToShow !== 5,
68
106
  label: __('Number of comments'),
69
- value: commentsToShow,
70
- onChange: value => setAttributes({
71
- commentsToShow: value
107
+ onDeselect: () => setAttributes({
108
+ commentsToShow: 5
72
109
  }),
73
- min: MIN_COMMENTS,
74
- max: MAX_COMMENTS,
75
- required: true
110
+ isShownByDefault: true,
111
+ children: /*#__PURE__*/_jsx(RangeControl, {
112
+ __nextHasNoMarginBottom: true,
113
+ __next40pxDefaultSize: true,
114
+ label: __('Number of comments'),
115
+ value: commentsToShow,
116
+ onChange: value => setAttributes({
117
+ commentsToShow: value
118
+ }),
119
+ min: MIN_COMMENTS,
120
+ max: MAX_COMMENTS,
121
+ required: true
122
+ })
76
123
  })]
77
124
  })
78
125
  }), /*#__PURE__*/_jsx(Disabled, {
@@ -1 +1 @@
1
- {"version":3,"names":["InspectorControls","useBlockProps","Disabled","PanelBody","RangeControl","ToggleControl","ServerSideRender","__","jsx","_jsx","jsxs","_jsxs","MIN_COMMENTS","MAX_COMMENTS","LatestComments","attributes","setAttributes","commentsToShow","displayAvatar","displayDate","displayExcerpt","serverSideAttributes","style","spacing","undefined","children","title","__nextHasNoMarginBottom","label","checked","onChange","__next40pxDefaultSize","value","min","max","required","block","urlQueryArgs","_locale"],"sources":["@wordpress/block-library/src/latest-comments/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tDisabled,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Minimum number of comments a user can show using this block.\n *\n * @type {number}\n */\nconst MIN_COMMENTS = 1;\n/**\n * Maximum number of comments a user can show using this block.\n *\n * @type {number}\n */\nconst MAX_COMMENTS = 100;\n\nexport default function LatestComments( { attributes, setAttributes } ) {\n\tconst { commentsToShow, displayAvatar, displayDate, displayExcerpt } =\n\t\tattributes;\n\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tspacing: undefined,\n\t\t},\n\t};\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display avatar' ) }\n\t\t\t\t\t\tchecked={ displayAvatar }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAvatar: ! displayAvatar } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display date' ) }\n\t\t\t\t\t\tchecked={ displayDate }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayDate: ! displayDate } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Display excerpt' ) }\n\t\t\t\t\t\tchecked={ displayExcerpt }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayExcerpt: ! displayExcerpt,\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<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Number of comments' ) }\n\t\t\t\t\t\tvalue={ commentsToShow }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { commentsToShow: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ MIN_COMMENTS }\n\t\t\t\t\t\tmax={ MAX_COMMENTS }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender\n\t\t\t\t\tblock=\"core/latest-comments\"\n\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t// The preview uses the site's locale to make it more true to how\n\t\t\t\t\t// the block appears on the frontend. Setting the locale\n\t\t\t\t\t// explicitly prevents any middleware from setting it to 'user'.\n\t\t\t\t\turlQueryArgs={ { _locale: 'site' } }\n\t\t\t\t/>\n\t\t\t</Disabled>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAiB,EAAEC,aAAa,QAAQ,yBAAyB;AAC1E,SACCC,QAAQ,EACRC,SAAS,EACTC,YAAY,EACZC,aAAa,QACP,uBAAuB;AAC9B,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,MAAMC,YAAY,GAAG,CA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uB;UACvBI,qBAAqB;UACrBH,KAAK,EAAGrB,EAAE,CAAE,oBAAqB,CAAG;UACpCyB,KAAK,EAAGf,cAAgB;UACxBa,QAAQ,EAAKE,KAAK,IACjBhB,aAAa,CAAE;YAAEC,cAAc,EAAEe;UAAM,CAAE,CACzC;UACDC,GAAG,EAAGrB,YAAc;UACpBsB,GAAG,EAAGrB,YAAc;UACpBsB,QAAQ;QAAA,CACR,CAAC;MAAA,CACQ;IAAC,CACM,CAAC,eACpB1B,IAAA,CAACP,QAAQ;MAAAuB,QAAA,eACRhB,IAAA,CAACH,gBAAgB;QAChB8B,KAAK,EAAC,sBAAsB;QAC5BrB,UAAU,EAAGM;QACb;QACA;QACA;QAAA;QACAgB,YAAY,EAAG;UAAEC,OAAO,EAAE;QAAO;MAAG,CACpC;IAAC,CACO,CAAC;EAAA,CACP,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["InspectorControls","useBlockProps","Disabled","RangeControl","ToggleControl","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","ServerSideRender","__","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","MIN_COMMENTS","MAX_COMMENTS","LatestComments","attributes","setAttributes","commentsToShow","displayAvatar","displayDate","displayExcerpt","serverSideAttributes","style","spacing","undefined","dropdownMenuProps","children","label","resetAll","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","checked","onChange","__next40pxDefaultSize","value","min","max","required","block","urlQueryArgs","_locale"],"sources":["@wordpress/block-library/src/latest-comments/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tDisabled,\n\tRangeControl,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Minimum number of comments a user can show using this block.\n *\n * @type {number}\n */\nconst MIN_COMMENTS = 1;\n/**\n * Maximum number of comments a user can show using this block.\n *\n * @type {number}\n */\nconst MAX_COMMENTS = 100;\n\nexport default function LatestComments( { attributes, setAttributes } ) {\n\tconst { commentsToShow, displayAvatar, displayDate, displayExcerpt } =\n\t\tattributes;\n\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tspacing: undefined,\n\t\t},\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\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\tcommentsToShow: 5,\n\t\t\t\t\t\t\tdisplayAvatar: true,\n\t\t\t\t\t\t\tdisplayDate: true,\n\t\t\t\t\t\t\tdisplayExcerpt: true,\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\thasValue={ () => ! displayAvatar }\n\t\t\t\t\t\tlabel={ __( 'Display avatar' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAvatar: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\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={ __( 'Display avatar' ) }\n\t\t\t\t\t\t\tchecked={ displayAvatar }\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\tdisplayAvatar: ! displayAvatar,\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\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! displayDate }\n\t\t\t\t\t\tlabel={ __( 'Display date' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayDate: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\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={ __( 'Display date' ) }\n\t\t\t\t\t\t\tchecked={ displayDate }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { displayDate: ! displayDate } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! displayExcerpt }\n\t\t\t\t\t\tlabel={ __( 'Display excerpt' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayExcerpt: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\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={ __( 'Display excerpt' ) }\n\t\t\t\t\t\t\tchecked={ displayExcerpt }\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\tdisplayExcerpt: ! displayExcerpt,\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\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => commentsToShow !== 5 }\n\t\t\t\t\t\tlabel={ __( 'Number of comments' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { commentsToShow: 5 } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Number of comments' ) }\n\t\t\t\t\t\t\tvalue={ commentsToShow }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { commentsToShow: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ MIN_COMMENTS }\n\t\t\t\t\t\t\tmax={ MAX_COMMENTS }\n\t\t\t\t\t\t\trequired\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<Disabled>\n\t\t\t\t<ServerSideRender\n\t\t\t\t\tblock=\"core/latest-comments\"\n\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t// The preview uses the site's locale to make it more true to how\n\t\t\t\t\t// the block appears on the frontend. Setting the locale\n\t\t\t\t\t// explicitly prevents any middleware from setting it to 'user'.\n\t\t\t\t\turlQueryArgs={ { _locale: 'site' } }\n\t\t\t\t/>\n\t\t\t</Disabled>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAiB,EAAEC,aAAa,QAAQ,yBAAyB;AAC1E,SACCC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,8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ACpCwB,UAAU,EAAGA,CAAA,KACZd,aAAa,CAAE;YAAEC,cAAc,EAAE;UAAE,CAAE,CACrC;UACDc,gBAAgB;UAAAL,QAAA,eAEhBjB,IAAA,CAACV,YAAY;YACZiC,uBAAuB;YACvBG,qBAAqB;YACrBR,KAAK,EAAGrB,EAAE,CAAE,oBAAqB,CAAG;YACpC8B,KAAK,EAAGnB,cAAgB;YACxBiB,QAAQ,EAAKE,KAAK,IACjBpB,aAAa,CAAE;cAAEC,cAAc,EAAEmB;YAAM,CAAE,CACzC;YACDC,GAAG,EAAGzB,YAAc;YACpB0B,GAAG,EAAGzB,YAAc;YACpB0B,QAAQ;UAAA,CACR;QAAC,CACa,CAAC;MAAA,CACN;IAAC,CACK,CAAC,eACpB9B,IAAA,CAACX,QAAQ;MAAA4B,QAAA,eACRjB,IAAA,CAACJ,gBAAgB;QAChBmC,KAAK,EAAC,sBAAsB;QAC5BzB,UAAU,EAAGM;QACb;QACA;QACA;QAAA;QACAoB,YAAY,EAAG;UAAEC,OAAO,EAAE;QAAO;MAAG,CACpC;IAAC,CACO,CAAC;EAAA,CACP,CAAC;AAER","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  export const MIN_EXCERPT_LENGTH = 10;
2
2
  export const MAX_EXCERPT_LENGTH = 100;
3
3
  export const MAX_POSTS_COLUMNS = 6;
4
+ export const DEFAULT_EXCERPT_LENGTH = 55;
4
5
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MIN_EXCERPT_LENGTH","MAX_EXCERPT_LENGTH","MAX_POSTS_COLUMNS"],"sources":["@wordpress/block-library/src/latest-posts/constants.js"],"sourcesContent":["export const MIN_EXCERPT_LENGTH = 10;\nexport const MAX_EXCERPT_LENGTH = 100;\nexport const MAX_POSTS_COLUMNS = 6;\n"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAAG,EAAE;AACpC,OAAO,MAAMC,kBAAkB,GAAG,GAAG;AACrC,OAAO,MAAMC,iBAAiB,GAAG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["MIN_EXCERPT_LENGTH","MAX_EXCERPT_LENGTH","MAX_POSTS_COLUMNS","DEFAULT_EXCERPT_LENGTH"],"sources":["@wordpress/block-library/src/latest-posts/constants.js"],"sourcesContent":["export const MIN_EXCERPT_LENGTH = 10;\nexport const MAX_EXCERPT_LENGTH = 100;\nexport const MAX_POSTS_COLUMNS = 6;\nexport const DEFAULT_EXCERPT_LENGTH = 55;\n"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAAG,EAAE;AACpC,OAAO,MAAMC,kBAAkB,GAAG,GAAG;AACrC,OAAO,MAAMC,iBAAiB,GAAG,CAAC;AAClC,OAAO,MAAMC,sBAAsB,GAAG,EAAE","ignoreList":[]}
@@ -7,7 +7,7 @@ import clsx from 'clsx';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { PanelBody, Placeholder, QueryControls, RadioControl, RangeControl, Spinner, ToggleControl, ToolbarGroup, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon } from '@wordpress/components';
10
+ import { PanelBody, Placeholder, QueryControls, RadioControl, RangeControl, Spinner, ToggleControl, ToolbarGroup, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
11
11
  import { __, _x, sprintf } from '@wordpress/i18n';
12
12
  import { dateI18n, format, getSettings } from '@wordpress/date';
13
13
  import { InspectorControls, BlockControls, __experimentalImageSizeControl as ImageSizeControl, useBlockProps, store as blockEditorStore } from '@wordpress/block-editor';
@@ -21,7 +21,8 @@ import { createInterpolateElement } from '@wordpress/element';
21
21
  /**
22
22
  * Internal dependencies
23
23
  */
24
- import { MIN_EXCERPT_LENGTH, MAX_EXCERPT_LENGTH, MAX_POSTS_COLUMNS } from './constants';
24
+ import { MIN_EXCERPT_LENGTH, MAX_EXCERPT_LENGTH, MAX_POSTS_COLUMNS, DEFAULT_EXCERPT_LENGTH } from './constants';
25
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
25
26
 
26
27
  /**
27
28
  * Module Constants
@@ -50,6 +51,7 @@ export default function LatestPostsEdit({
50
51
  }) {
51
52
  var _categoriesList$reduc;
52
53
  const instanceId = useInstanceId(LatestPostsEdit);
54
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
53
55
  const {
54
56
  postsToShow,
55
57
  order,
@@ -165,54 +167,105 @@ export default function LatestPostsEdit({
165
167
  }];
166
168
  const hasPosts = !!latestPosts?.length;
167
169
  const inspectorControls = /*#__PURE__*/_jsxs(InspectorControls, {
168
- children: [/*#__PURE__*/_jsxs(PanelBody, {
169
- title: __('Post content'),
170
- children: [/*#__PURE__*/_jsx(ToggleControl, {
171
- __nextHasNoMarginBottom: true,
170
+ children: [/*#__PURE__*/_jsxs(ToolsPanel, {
171
+ label: __('Post content'),
172
+ resetAll: () => setAttributes({
173
+ displayPostContent: false,
174
+ displayPostContentRadio: 'excerpt',
175
+ excerptLength: DEFAULT_EXCERPT_LENGTH
176
+ }),
177
+ dropdownMenuProps: dropdownMenuProps,
178
+ children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
179
+ hasValue: () => !!displayPostContent,
172
180
  label: __('Post content'),
173
- checked: displayPostContent,
174
- onChange: value => setAttributes({
175
- displayPostContent: value
181
+ onDeselect: () => setAttributes({
182
+ displayPostContent: false
183
+ }),
184
+ isShownByDefault: true,
185
+ children: /*#__PURE__*/_jsx(ToggleControl, {
186
+ __nextHasNoMarginBottom: true,
187
+ label: __('Post content'),
188
+ checked: displayPostContent,
189
+ onChange: value => setAttributes({
190
+ displayPostContent: value
191
+ })
176
192
  })
177
- }), displayPostContent && /*#__PURE__*/_jsx(RadioControl, {
193
+ }), displayPostContent && /*#__PURE__*/_jsx(ToolsPanelItem, {
194
+ hasValue: () => displayPostContentRadio !== 'excerpt',
178
195
  label: __('Show'),
179
- selected: displayPostContentRadio,
180
- options: [{
181
- label: __('Excerpt'),
182
- value: 'excerpt'
183
- }, {
184
- label: __('Full post'),
185
- value: 'full_post'
186
- }],
187
- onChange: value => setAttributes({
188
- displayPostContentRadio: value
196
+ onDeselect: () => setAttributes({
197
+ displayPostContentRadio: 'excerpt'
198
+ }),
199
+ isShownByDefault: true,
200
+ children: /*#__PURE__*/_jsx(RadioControl, {
201
+ label: __('Show'),
202
+ selected: displayPostContentRadio,
203
+ options: [{
204
+ label: __('Excerpt'),
205
+ value: 'excerpt'
206
+ }, {
207
+ label: __('Full post'),
208
+ value: 'full_post'
209
+ }],
210
+ onChange: value => setAttributes({
211
+ displayPostContentRadio: value
212
+ })
189
213
  })
190
- }), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/_jsx(RangeControl, {
191
- __nextHasNoMarginBottom: true,
192
- __next40pxDefaultSize: true,
214
+ }), displayPostContent && displayPostContentRadio === 'excerpt' && /*#__PURE__*/_jsx(ToolsPanelItem, {
215
+ hasValue: () => excerptLength !== DEFAULT_EXCERPT_LENGTH,
193
216
  label: __('Max number of words'),
194
- value: excerptLength,
195
- onChange: value => setAttributes({
196
- excerptLength: value
217
+ onDeselect: () => setAttributes({
218
+ excerptLength: DEFAULT_EXCERPT_LENGTH
197
219
  }),
198
- min: MIN_EXCERPT_LENGTH,
199
- max: MAX_EXCERPT_LENGTH
220
+ isShownByDefault: true,
221
+ children: /*#__PURE__*/_jsx(RangeControl, {
222
+ __nextHasNoMarginBottom: true,
223
+ __next40pxDefaultSize: true,
224
+ label: __('Max number of words'),
225
+ value: excerptLength,
226
+ onChange: value => setAttributes({
227
+ excerptLength: value
228
+ }),
229
+ min: MIN_EXCERPT_LENGTH,
230
+ max: MAX_EXCERPT_LENGTH
231
+ })
200
232
  })]
201
- }), /*#__PURE__*/_jsxs(PanelBody, {
202
- title: __('Post meta'),
203
- children: [/*#__PURE__*/_jsx(ToggleControl, {
204
- __nextHasNoMarginBottom: true,
233
+ }), /*#__PURE__*/_jsxs(ToolsPanel, {
234
+ label: __('Post meta'),
235
+ resetAll: () => setAttributes({
236
+ displayAuthor: false,
237
+ displayPostDate: false
238
+ }),
239
+ dropdownMenuProps: dropdownMenuProps,
240
+ children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
241
+ hasValue: () => !!displayAuthor,
205
242
  label: __('Display author name'),
206
- checked: displayAuthor,
207
- onChange: value => setAttributes({
208
- displayAuthor: value
243
+ onDeselect: () => setAttributes({
244
+ displayAuthor: false
245
+ }),
246
+ isShownByDefault: true,
247
+ children: /*#__PURE__*/_jsx(ToggleControl, {
248
+ __nextHasNoMarginBottom: true,
249
+ label: __('Display author name'),
250
+ checked: displayAuthor,
251
+ onChange: value => setAttributes({
252
+ displayAuthor: value
253
+ })
209
254
  })
210
- }), /*#__PURE__*/_jsx(ToggleControl, {
211
- __nextHasNoMarginBottom: true,
255
+ }), /*#__PURE__*/_jsx(ToolsPanelItem, {
256
+ hasValue: () => !!displayPostDate,
212
257
  label: __('Display post date'),
213
- checked: displayPostDate,
214
- onChange: value => setAttributes({
215
- displayPostDate: value
258
+ onDeselect: () => setAttributes({
259
+ displayPostDate: false
260
+ }),
261
+ isShownByDefault: true,
262
+ children: /*#__PURE__*/_jsx(ToggleControl, {
263
+ __nextHasNoMarginBottom: true,
264
+ label: __('Display post date'),
265
+ checked: displayPostDate,
266
+ onChange: value => setAttributes({
267
+ displayPostDate: value
268
+ })
216
269
  })
217
270
  })]
218
271
  }), /*#__PURE__*/_jsxs(PanelBody, {