@wordpress/block-library 7.10.0 → 7.11.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 (374) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/edit.js +2 -1
  3. package/build/button/edit.js.map +1 -1
  4. package/build/buttons/edit.js +1 -1
  5. package/build/buttons/edit.js.map +1 -1
  6. package/build/columns/edit.native.js +1 -1
  7. package/build/columns/edit.native.js.map +1 -1
  8. package/build/comments/edit/comments-legacy.js +73 -0
  9. package/build/comments/edit/comments-legacy.js.map +1 -0
  10. package/build/comments/{edit.js → edit/index.js} +17 -38
  11. package/build/comments/edit/index.js.map +1 -0
  12. package/build/comments/edit/placeholder.js +117 -0
  13. package/build/comments/edit/placeholder.js.map +1 -0
  14. package/build/comments/edit/template.js +39 -0
  15. package/build/comments/edit/template.js.map +1 -0
  16. package/build/comments/index.js +6 -1
  17. package/build/comments/index.js.map +1 -1
  18. package/build/comments/save.js +12 -4
  19. package/build/comments/save.js.map +1 -1
  20. package/build/cover/transforms.js +3 -2
  21. package/build/cover/transforms.js.map +1 -1
  22. package/build/embed/embed-placeholder.native.js +1 -3
  23. package/build/embed/embed-placeholder.native.js.map +1 -1
  24. package/build/gallery/edit.js +2 -2
  25. package/build/gallery/edit.js.map +1 -1
  26. package/build/gallery/use-get-media.native.js +59 -0
  27. package/build/gallery/use-get-media.native.js.map +1 -0
  28. package/build/group/index.js +1 -0
  29. package/build/group/index.js.map +1 -1
  30. package/build/group/variations.js +1 -1
  31. package/build/group/variations.js.map +1 -1
  32. package/build/image/deprecated.js +77 -9
  33. package/build/image/deprecated.js.map +1 -1
  34. package/build/image/edit.js +3 -1
  35. package/build/image/edit.js.map +1 -1
  36. package/build/image/edit.native.js +18 -8
  37. package/build/image/edit.native.js.map +1 -1
  38. package/build/image/image.js +27 -20
  39. package/build/image/image.js.map +1 -1
  40. package/build/image/index.js +7 -1
  41. package/build/image/index.js.map +1 -1
  42. package/build/image/save.js +8 -2
  43. package/build/image/save.js.map +1 -1
  44. package/build/index.js +1 -3
  45. package/build/index.js.map +1 -1
  46. package/build/index.native.js +3 -13
  47. package/build/index.native.js.map +1 -1
  48. package/build/list/transforms.js +4 -63
  49. package/build/list/transforms.js.map +1 -1
  50. package/build/list/v2/transforms.js +0 -27
  51. package/build/list/v2/transforms.js.map +1 -1
  52. package/build/list-item/edit.js +14 -9
  53. package/build/list-item/edit.js.map +1 -1
  54. package/build/list-item/hooks/index.js +8 -8
  55. package/build/list-item/hooks/index.js.map +1 -1
  56. package/build/list-item/hooks/use-merge.js +174 -0
  57. package/build/list-item/hooks/use-merge.js.map +1 -0
  58. package/build/list-item/hooks/use-outdent-list-item.js +86 -50
  59. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  60. package/build/list-item/utils.js +125 -1
  61. package/build/list-item/utils.js.map +1 -1
  62. package/build/media-text/deprecated.js +134 -7
  63. package/build/media-text/deprecated.js.map +1 -1
  64. package/build/media-text/edit.js +2 -2
  65. package/build/media-text/edit.js.map +1 -1
  66. package/build/media-text/save.js +13 -0
  67. package/build/media-text/save.js.map +1 -1
  68. package/build/more/save.js +1 -7
  69. package/build/more/save.js.map +1 -1
  70. package/build/navigation-link/edit.js +5 -4
  71. package/build/navigation-link/edit.js.map +1 -1
  72. package/build/navigation-submenu/edit.js +2 -1
  73. package/build/navigation-submenu/edit.js.map +1 -1
  74. package/build/page-list/edit.js +8 -1
  75. package/build/page-list/edit.js.map +1 -1
  76. package/build/paragraph/edit.js +7 -11
  77. package/build/paragraph/edit.js.map +1 -1
  78. package/build/post-comments-form/edit.js +4 -45
  79. package/build/post-comments-form/edit.js.map +1 -1
  80. package/build/post-comments-form/form.js +47 -3
  81. package/build/post-comments-form/form.js.map +1 -1
  82. package/build/post-terms/edit.js +3 -2
  83. package/build/post-terms/edit.js.map +1 -1
  84. package/build/query-no-results/edit.js +1 -1
  85. package/build/query-no-results/edit.js.map +1 -1
  86. package/build/query-pagination-next/edit.js +2 -1
  87. package/build/query-pagination-next/edit.js.map +1 -1
  88. package/build/query-pagination-previous/edit.js +2 -1
  89. package/build/query-pagination-previous/edit.js.map +1 -1
  90. package/build/quote/deprecated.js +168 -36
  91. package/build/quote/deprecated.js.map +1 -1
  92. package/build/quote/edit.js +76 -39
  93. package/build/quote/edit.js.map +1 -1
  94. package/build/quote/index.js +9 -45
  95. package/build/quote/index.js.map +1 -1
  96. package/build/quote/save.js +1 -5
  97. package/build/quote/save.js.map +1 -1
  98. package/build/quote/transforms.js +110 -158
  99. package/build/quote/transforms.js.map +1 -1
  100. package/build/social-link/icons/index.js +13 -0
  101. package/build/social-link/icons/index.js.map +1 -1
  102. package/build/social-link/icons/whatsapp.js +25 -0
  103. package/build/social-link/icons/whatsapp.js.map +1 -0
  104. package/build/social-link/variations.js +7 -0
  105. package/build/social-link/variations.js.map +1 -1
  106. package/build/template-part/edit/index.js +17 -8
  107. package/build/template-part/edit/index.js.map +1 -1
  108. package/build/template-part/edit/selection-modal.js +33 -13
  109. package/build/template-part/edit/selection-modal.js.map +1 -1
  110. package/build/template-part/edit/utils/search.js +94 -0
  111. package/build/template-part/edit/utils/search.js.map +1 -0
  112. package/build-module/button/edit.js +2 -1
  113. package/build-module/button/edit.js.map +1 -1
  114. package/build-module/buttons/edit.js +2 -2
  115. package/build-module/buttons/edit.js.map +1 -1
  116. package/build-module/columns/edit.native.js +2 -2
  117. package/build-module/columns/edit.native.js.map +1 -1
  118. package/build-module/comments/edit/comments-legacy.js +59 -0
  119. package/build-module/comments/edit/comments-legacy.js.map +1 -0
  120. package/build-module/comments/edit/index.js +37 -0
  121. package/build-module/comments/edit/index.js.map +1 -0
  122. package/build-module/comments/edit/placeholder.js +102 -0
  123. package/build-module/comments/edit/placeholder.js.map +1 -0
  124. package/build-module/comments/edit/template.js +32 -0
  125. package/build-module/comments/edit/template.js.map +1 -0
  126. package/build-module/comments/index.js +6 -1
  127. package/build-module/comments/index.js.map +1 -1
  128. package/build-module/comments/save.js +9 -4
  129. package/build-module/comments/save.js.map +1 -1
  130. package/build-module/cover/transforms.js +3 -2
  131. package/build-module/cover/transforms.js.map +1 -1
  132. package/build-module/embed/embed-placeholder.native.js +1 -2
  133. package/build-module/embed/embed-placeholder.native.js.map +1 -1
  134. package/build-module/gallery/edit.js +2 -2
  135. package/build-module/gallery/edit.js.map +1 -1
  136. package/build-module/gallery/use-get-media.native.js +50 -0
  137. package/build-module/gallery/use-get-media.native.js.map +1 -0
  138. package/build-module/group/index.js +1 -0
  139. package/build-module/group/index.js.map +1 -1
  140. package/build-module/group/variations.js +2 -2
  141. package/build-module/group/variations.js.map +1 -1
  142. package/build-module/image/deprecated.js +77 -9
  143. package/build-module/image/deprecated.js.map +1 -1
  144. package/build-module/image/edit.js +5 -3
  145. package/build-module/image/edit.js.map +1 -1
  146. package/build-module/image/edit.native.js +18 -8
  147. package/build-module/image/edit.native.js.map +1 -1
  148. package/build-module/image/image.js +29 -22
  149. package/build-module/image/image.js.map +1 -1
  150. package/build-module/image/index.js +7 -1
  151. package/build-module/image/index.js.map +1 -1
  152. package/build-module/image/save.js +9 -3
  153. package/build-module/image/save.js.map +1 -1
  154. package/build-module/index.js +1 -2
  155. package/build-module/index.js.map +1 -1
  156. package/build-module/index.native.js +3 -13
  157. package/build-module/index.native.js.map +1 -1
  158. package/build-module/list/transforms.js +4 -63
  159. package/build-module/list/transforms.js.map +1 -1
  160. package/build-module/list/v2/transforms.js +2 -29
  161. package/build-module/list/v2/transforms.js.map +1 -1
  162. package/build-module/list-item/edit.js +14 -10
  163. package/build-module/list-item/edit.js.map +1 -1
  164. package/build-module/list-item/hooks/index.js +1 -1
  165. package/build-module/list-item/hooks/index.js.map +1 -1
  166. package/build-module/list-item/hooks/use-merge.js +160 -0
  167. package/build-module/list-item/hooks/use-merge.js.map +1 -0
  168. package/build-module/list-item/hooks/use-outdent-list-item.js +82 -46
  169. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  170. package/build-module/list-item/utils.js +123 -2
  171. package/build-module/list-item/utils.js.map +1 -1
  172. package/build-module/media-text/deprecated.js +134 -8
  173. package/build-module/media-text/deprecated.js.map +1 -1
  174. package/build-module/media-text/edit.js +2 -2
  175. package/build-module/media-text/edit.js.map +1 -1
  176. package/build-module/media-text/save.js +13 -0
  177. package/build-module/media-text/save.js.map +1 -1
  178. package/build-module/more/save.js +1 -6
  179. package/build-module/more/save.js.map +1 -1
  180. package/build-module/navigation-link/edit.js +5 -4
  181. package/build-module/navigation-link/edit.js.map +1 -1
  182. package/build-module/navigation-submenu/edit.js +2 -1
  183. package/build-module/navigation-submenu/edit.js.map +1 -1
  184. package/build-module/page-list/edit.js +8 -1
  185. package/build-module/page-list/edit.js.map +1 -1
  186. package/build-module/paragraph/edit.js +8 -12
  187. package/build-module/paragraph/edit.js.map +1 -1
  188. package/build-module/post-comments-form/edit.js +5 -42
  189. package/build-module/post-comments-form/edit.js.map +1 -1
  190. package/build-module/post-comments-form/form.js +46 -5
  191. package/build-module/post-comments-form/form.js.map +1 -1
  192. package/build-module/post-terms/edit.js +3 -2
  193. package/build-module/post-terms/edit.js.map +1 -1
  194. package/build-module/query-no-results/edit.js +2 -2
  195. package/build-module/query-no-results/edit.js.map +1 -1
  196. package/build-module/query-pagination-next/edit.js +2 -1
  197. package/build-module/query-pagination-next/edit.js.map +1 -1
  198. package/build-module/query-pagination-previous/edit.js +2 -1
  199. package/build-module/query-pagination-previous/edit.js.map +1 -1
  200. package/build-module/quote/deprecated.js +162 -36
  201. package/build-module/quote/deprecated.js.map +1 -1
  202. package/build-module/quote/edit.js +77 -43
  203. package/build-module/quote/edit.js.map +1 -1
  204. package/build-module/quote/index.js +9 -39
  205. package/build-module/quote/index.js.map +1 -1
  206. package/build-module/quote/save.js +4 -8
  207. package/build-module/quote/save.js.map +1 -1
  208. package/build-module/quote/transforms.js +111 -158
  209. package/build-module/quote/transforms.js.map +1 -1
  210. package/build-module/social-link/icons/index.js +1 -0
  211. package/build-module/social-link/icons/index.js.map +1 -1
  212. package/build-module/social-link/icons/whatsapp.js +15 -0
  213. package/build-module/social-link/icons/whatsapp.js.map +1 -0
  214. package/build-module/social-link/variations.js +8 -1
  215. package/build-module/social-link/variations.js.map +1 -1
  216. package/build-module/template-part/edit/index.js +20 -11
  217. package/build-module/template-part/edit/index.js.map +1 -1
  218. package/build-module/template-part/edit/selection-modal.js +33 -15
  219. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  220. package/build-module/template-part/edit/utils/search.js +84 -0
  221. package/build-module/template-part/edit/utils/search.js.map +1 -0
  222. package/build-style/button/style-rtl.css +1 -1
  223. package/build-style/button/style.css +1 -1
  224. package/build-style/comments/editor-rtl.css +122 -0
  225. package/build-style/comments/editor.css +122 -0
  226. package/build-style/{post-comments → comments}/style-rtl.css +1 -0
  227. package/build-style/{post-comments → comments}/style.css +1 -0
  228. package/build-style/common-rtl.css +7 -0
  229. package/build-style/common.css +7 -0
  230. package/build-style/cover/style-rtl.css +2 -2
  231. package/build-style/cover/style.css +2 -2
  232. package/build-style/{post-comments/editor.css → editor-elements-rtl.css} +8 -2
  233. package/build-style/{post-comments/editor-rtl.css → editor-elements.css} +8 -2
  234. package/build-style/editor-rtl.css +151 -10
  235. package/build-style/editor.css +151 -10
  236. package/build-style/gallery/style-rtl.css +7 -2
  237. package/build-style/gallery/style.css +7 -2
  238. package/build-style/image/editor-rtl.css +4 -3
  239. package/build-style/image/editor.css +4 -3
  240. package/build-style/image/style-rtl.css +33 -3
  241. package/build-style/image/style.css +33 -3
  242. package/build-style/post-comments-form/style-rtl.css +0 -1
  243. package/build-style/post-comments-form/style.css +0 -1
  244. package/build-style/social-link/editor-rtl.css +1 -0
  245. package/build-style/social-link/editor.css +1 -0
  246. package/build-style/social-links/style-rtl.css +8 -0
  247. package/build-style/social-links/style.css +8 -0
  248. package/build-style/style-rtl.css +170 -127
  249. package/build-style/style.css +170 -127
  250. package/build-style/template-part/editor-rtl.css +14 -3
  251. package/build-style/template-part/editor.css +14 -3
  252. package/package.json +28 -28
  253. package/src/button/edit.js +1 -0
  254. package/src/button/style.scss +3 -1
  255. package/src/buttons/edit.js +1 -5
  256. package/src/columns/edit.native.js +2 -2
  257. package/src/comments/block.json +6 -1
  258. package/src/comments/edit/comments-legacy.js +71 -0
  259. package/src/comments/edit/index.js +35 -0
  260. package/src/comments/edit/placeholder.js +124 -0
  261. package/src/comments/{edit.js → edit/template.js} +1 -28
  262. package/src/comments/editor.scss +9 -0
  263. package/src/comments/index.php +219 -0
  264. package/src/comments/save.js +8 -7
  265. package/src/{post-comments → comments}/style.scss +7 -0
  266. package/src/common.scss +2 -0
  267. package/src/cover/style.scss +2 -2
  268. package/src/cover/transforms.js +2 -2
  269. package/src/editor-elements.scss +10 -0
  270. package/src/editor.scss +2 -1
  271. package/src/embed/embed-placeholder.native.js +2 -3
  272. package/src/gallery/edit.js +4 -2
  273. package/src/gallery/style.scss +10 -1
  274. package/src/gallery/use-get-media.native.js +44 -0
  275. package/src/group/block.json +1 -0
  276. package/src/group/variations.js +2 -2
  277. package/src/image/block.json +7 -1
  278. package/src/image/deprecated.js +86 -0
  279. package/src/image/edit.js +6 -1
  280. package/src/image/edit.native.js +18 -7
  281. package/src/image/editor.scss +9 -4
  282. package/src/image/image.js +26 -16
  283. package/src/image/save.js +10 -1
  284. package/src/image/style.scss +39 -3
  285. package/src/index.js +0 -2
  286. package/src/index.native.js +2 -11
  287. package/src/list/transforms.js +0 -47
  288. package/src/list/v2/transforms.js +2 -40
  289. package/src/list-item/edit.js +10 -12
  290. package/src/list-item/hooks/index.js +1 -1
  291. package/src/list-item/hooks/use-merge.js +141 -0
  292. package/src/list-item/hooks/use-outdent-list-item.js +72 -74
  293. package/src/list-item/utils.js +27 -3
  294. package/src/media-text/deprecated.js +148 -1
  295. package/src/media-text/edit.js +2 -1
  296. package/src/media-text/save.js +18 -0
  297. package/src/more/save.js +3 -6
  298. package/src/navigation-link/edit.js +4 -3
  299. package/src/navigation-submenu/edit.js +1 -0
  300. package/src/page-list/edit.js +9 -0
  301. package/src/paragraph/edit.js +8 -14
  302. package/src/post-comments-form/edit.js +2 -71
  303. package/src/post-comments-form/form.js +80 -5
  304. package/src/post-comments-form/index.php +1 -1
  305. package/src/post-comments-form/style.scss +0 -1
  306. package/src/post-terms/edit.js +3 -2
  307. package/src/query-no-results/edit.js +2 -5
  308. package/src/query-pagination-next/edit.js +1 -0
  309. package/src/query-pagination-previous/edit.js +1 -0
  310. package/src/quote/deprecated.js +213 -99
  311. package/src/quote/edit.js +77 -52
  312. package/src/quote/index.js +10 -33
  313. package/src/quote/save.js +5 -5
  314. package/src/quote/{v2/test → test}/migrate.js +2 -7
  315. package/src/quote/transforms.js +117 -147
  316. package/src/social-link/editor.scss +3 -0
  317. package/src/social-link/icons/index.js +1 -0
  318. package/src/social-link/icons/whatsapp.js +10 -0
  319. package/src/social-link/index.php +4 -0
  320. package/src/social-link/socials-with-bg.scss +5 -0
  321. package/src/social-link/socials-without-bg.scss +5 -0
  322. package/src/social-link/variations.js +7 -0
  323. package/src/style.scss +1 -2
  324. package/src/template-part/edit/index.js +37 -24
  325. package/src/template-part/edit/selection-modal.js +68 -40
  326. package/src/template-part/edit/utils/search.js +76 -0
  327. package/src/template-part/editor.scss +21 -9
  328. package/src/template-part/index.php +56 -2
  329. package/build/comments/edit.js.map +0 -1
  330. package/build/list-item/hooks/use-backspace.js +0 -59
  331. package/build/list-item/hooks/use-backspace.js.map +0 -1
  332. package/build/post-comments/edit.js +0 -184
  333. package/build/post-comments/edit.js.map +0 -1
  334. package/build/post-comments/index.js +0 -72
  335. package/build/post-comments/index.js.map +0 -1
  336. package/build/quote/v2/deprecated.js +0 -133
  337. package/build/quote/v2/deprecated.js.map +0 -1
  338. package/build/quote/v2/edit.js +0 -139
  339. package/build/quote/v2/edit.js.map +0 -1
  340. package/build/quote/v2/index.js +0 -49
  341. package/build/quote/v2/index.js.map +0 -1
  342. package/build/quote/v2/save.js +0 -43
  343. package/build/quote/v2/save.js.map +0 -1
  344. package/build/quote/v2/transforms.js +0 -156
  345. package/build/quote/v2/transforms.js.map +0 -1
  346. package/build-module/comments/edit.js +0 -59
  347. package/build-module/comments/edit.js.map +0 -1
  348. package/build-module/list-item/hooks/use-backspace.js +0 -44
  349. package/build-module/list-item/hooks/use-backspace.js.map +0 -1
  350. package/build-module/post-comments/edit.js +0 -171
  351. package/build-module/post-comments/edit.js.map +0 -1
  352. package/build-module/post-comments/index.js +0 -59
  353. package/build-module/post-comments/index.js.map +0 -1
  354. package/build-module/quote/v2/deprecated.js +0 -116
  355. package/build-module/quote/v2/deprecated.js.map +0 -1
  356. package/build-module/quote/v2/edit.js +0 -122
  357. package/build-module/quote/v2/edit.js.map +0 -1
  358. package/build-module/quote/v2/index.js +0 -33
  359. package/build-module/quote/v2/index.js.map +0 -1
  360. package/build-module/quote/v2/save.js +0 -30
  361. package/build-module/quote/v2/save.js.map +0 -1
  362. package/build-module/quote/v2/transforms.js +0 -147
  363. package/build-module/quote/v2/transforms.js.map +0 -1
  364. package/src/list-item/hooks/use-backspace.js +0 -51
  365. package/src/post-comments/block.json +0 -45
  366. package/src/post-comments/edit.js +0 -247
  367. package/src/post-comments/editor.scss +0 -3
  368. package/src/post-comments/index.js +0 -18
  369. package/src/post-comments/index.php +0 -87
  370. package/src/quote/v2/deprecated.js +0 -107
  371. package/src/quote/v2/edit.js +0 -139
  372. package/src/quote/v2/index.js +0 -36
  373. package/src/quote/v2/save.js +0 -26
  374. package/src/quote/v2/transforms.js +0 -155
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useCallback, useMemo } from '@wordpress/element';
4
+ import { useCallback, useMemo, useState } from '@wordpress/element';
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
6
  import { store as noticesStore } from '@wordpress/notices';
7
7
  import { useDispatch } from '@wordpress/data';
@@ -11,6 +11,10 @@ import {
11
11
  __experimentalBlockPatternsList as BlockPatternsList,
12
12
  store as blockEditorStore,
13
13
  } from '@wordpress/block-editor';
14
+ import {
15
+ SearchControl,
16
+ __experimentalHStack as HStack,
17
+ } from '@wordpress/components';
14
18
 
15
19
  /**
16
20
  * Internal dependencies
@@ -21,6 +25,7 @@ import {
21
25
  useCreateTemplatePartFromBlocks,
22
26
  } from './utils/hooks';
23
27
  import { createTemplatePartId } from './utils/create-template-part-id';
28
+ import { searchPatterns } from './utils/search';
24
29
 
25
30
  export default function TemplatePartSelectionModal( {
26
31
  setAttributes,
@@ -29,6 +34,8 @@ export default function TemplatePartSelectionModal( {
29
34
  area,
30
35
  clientId,
31
36
  } ) {
37
+ const [ searchValue, setSearchValue ] = useState( '' );
38
+
32
39
  // When the templatePartId is undefined,
33
40
  // it means the user is creating a new one from the placeholder.
34
41
  const isReplacingTemplatePartContent = !! templatePartId;
@@ -37,18 +44,24 @@ export default function TemplatePartSelectionModal( {
37
44
  templatePartId
38
45
  );
39
46
  // We can map template parts to block patters to reuse the BlockPatternsList UI
40
- const templartPartsAsBlockPatterns = useMemo( () => {
41
- return templateParts.map( ( templatePart ) => ( {
47
+ const filteredTemplateParts = useMemo( () => {
48
+ const partsAsPatterns = templateParts.map( ( templatePart ) => ( {
42
49
  name: createTemplatePartId( templatePart.theme, templatePart.slug ),
43
50
  title: templatePart.title.rendered,
44
51
  blocks: parse( templatePart.content.raw ),
45
52
  templatePart,
46
53
  } ) );
47
- }, [ templateParts ] );
48
- const shownTemplateParts = useAsyncList( templartPartsAsBlockPatterns );
49
- const { createSuccessNotice } = useDispatch( noticesStore );
54
+
55
+ return searchPatterns( partsAsPatterns, searchValue );
56
+ }, [ templateParts, searchValue ] );
57
+ const shownTemplateParts = useAsyncList( filteredTemplateParts );
50
58
  const blockPatterns = useAlternativeBlockPatterns( area, clientId );
51
- const shownBlockPatterns = useAsyncList( blockPatterns );
59
+ const filteredBlockPatterns = useMemo( () => {
60
+ return searchPatterns( blockPatterns, searchValue );
61
+ }, [ blockPatterns, searchValue ] );
62
+ const shownBlockPatterns = useAsyncList( filteredBlockPatterns );
63
+
64
+ const { createSuccessNotice } = useDispatch( noticesStore );
52
65
  const { replaceInnerBlocks } = useDispatch( blockEditorStore );
53
66
 
54
67
  const onTemplatePartSelect = useCallback( ( templatePart ) => {
@@ -75,41 +88,56 @@ export default function TemplatePartSelectionModal( {
75
88
  setAttributes
76
89
  );
77
90
 
91
+ const hasTemplateParts = !! filteredTemplateParts.length;
92
+ const hasBlockPatterns = !! filteredBlockPatterns.length;
93
+
78
94
  return (
79
- <>
80
- <div className="block-library-template-part__selection-content">
81
- { !! templartPartsAsBlockPatterns.length && (
82
- <div>
83
- <h2>{ __( 'Existing template parts' ) }</h2>
84
- <BlockPatternsList
85
- blockPatterns={ templartPartsAsBlockPatterns }
86
- shownPatterns={ shownTemplateParts }
87
- onClickPattern={ ( pattern ) => {
88
- onTemplatePartSelect( pattern.templatePart );
89
- } }
90
- />
91
- </div>
92
- ) }
95
+ <div className="block-library-template-part__selection-content">
96
+ <div className="block-library-template-part__selection-search">
97
+ <SearchControl
98
+ onChange={ setSearchValue }
99
+ value={ searchValue }
100
+ label={ __( 'Search for replacements' ) }
101
+ placeholder={ __( 'Search' ) }
102
+ />
103
+ </div>
104
+ { hasTemplateParts && (
105
+ <div>
106
+ <h2>{ __( 'Existing template parts' ) }</h2>
107
+ <BlockPatternsList
108
+ blockPatterns={ filteredTemplateParts }
109
+ shownPatterns={ shownTemplateParts }
110
+ onClickPattern={ ( pattern ) => {
111
+ onTemplatePartSelect( pattern.templatePart );
112
+ } }
113
+ />
114
+ </div>
115
+ ) }
93
116
 
94
- { !! blockPatterns.length && (
95
- <div>
96
- <h2>{ __( 'Patterns' ) }</h2>
97
- <BlockPatternsList
98
- blockPatterns={ blockPatterns }
99
- shownPatterns={ shownBlockPatterns }
100
- onClickPattern={ ( pattern, blocks ) => {
101
- if ( isReplacingTemplatePartContent ) {
102
- replaceInnerBlocks( clientId, blocks );
103
- } else {
104
- createFromBlocks( blocks, pattern.title );
105
- }
117
+ { hasBlockPatterns && (
118
+ <div>
119
+ <h2>{ __( 'Patterns' ) }</h2>
120
+ <BlockPatternsList
121
+ blockPatterns={ filteredBlockPatterns }
122
+ shownPatterns={ shownBlockPatterns }
123
+ onClickPattern={ ( pattern, blocks ) => {
124
+ if ( isReplacingTemplatePartContent ) {
125
+ replaceInnerBlocks( clientId, blocks );
126
+ } else {
127
+ createFromBlocks( blocks, pattern.title );
128
+ }
106
129
 
107
- onClose();
108
- } }
109
- />
110
- </div>
111
- ) }
112
- </div>
113
- </>
130
+ onClose();
131
+ } }
132
+ />
133
+ </div>
134
+ ) }
135
+
136
+ { ! hasTemplateParts && ! hasBlockPatterns && (
137
+ <HStack alignment="center">
138
+ <p>{ __( 'No results found.' ) }</p>
139
+ </HStack>
140
+ ) }
141
+ </div>
114
142
  );
115
143
  }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import removeAccents from 'remove-accents';
5
+
6
+ /**
7
+ * Sanitizes the search input string.
8
+ *
9
+ * @param {string} input The search input to normalize.
10
+ *
11
+ * @return {string} The normalized search input.
12
+ */
13
+ function normalizeSearchInput( input = '' ) {
14
+ // Disregard diacritics.
15
+ input = removeAccents( input );
16
+
17
+ // Trim & Lowercase.
18
+ input = input.trim().toLowerCase();
19
+
20
+ return input;
21
+ }
22
+
23
+ /**
24
+ * Get the search rank for a given pattern and a specific search term.
25
+ *
26
+ * @param {Object} pattern Pattern to rank
27
+ * @param {string} searchValue Search term
28
+ * @return {number} A pattern search rank
29
+ */
30
+ function getPatternSearchRank( pattern, searchValue ) {
31
+ const normalizedSearchValue = normalizeSearchInput( searchValue );
32
+ const normalizedTitle = normalizeSearchInput( pattern.title );
33
+
34
+ let rank = 0;
35
+
36
+ if ( normalizedSearchValue === normalizedTitle ) {
37
+ rank += 30;
38
+ } else if ( normalizedTitle.startsWith( normalizedSearchValue ) ) {
39
+ rank += 20;
40
+ } else {
41
+ const searchTerms = normalizedSearchValue.split( ' ' );
42
+ const hasMatchedTerms = searchTerms.every( ( searchTerm ) =>
43
+ normalizedTitle.includes( searchTerm )
44
+ );
45
+
46
+ // Prefer pattern with every search word in the title.
47
+ if ( hasMatchedTerms ) {
48
+ rank += 10;
49
+ }
50
+ }
51
+
52
+ return rank;
53
+ }
54
+
55
+ /**
56
+ * Filters an pattern list given a search term.
57
+ *
58
+ * @param {Array} patterns Item list
59
+ * @param {string} searchValue Search input.
60
+ *
61
+ * @return {Array} Filtered pattern list.
62
+ */
63
+ export function searchPatterns( patterns = [], searchValue = '' ) {
64
+ if ( ! searchValue ) {
65
+ return patterns;
66
+ }
67
+
68
+ const rankedPatterns = patterns
69
+ .map( ( pattern ) => {
70
+ return [ pattern, getPatternSearchRank( pattern, searchValue ) ];
71
+ } )
72
+ .filter( ( [ , rank ] ) => rank > 0 );
73
+
74
+ rankedPatterns.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );
75
+ return rankedPatterns.map( ( [ pattern ] ) => pattern );
76
+ }
@@ -1,14 +1,26 @@
1
1
  .block-editor-template-part__selection-modal {
2
+ z-index: z-index(".block-editor-template-part__selection-modal");
3
+
2
4
  // To keep modal dimensions consistent as subsections are navigated, width
3
5
  // and height are used instead of max-(width/height).
4
- @include break-small() {
5
- width: calc(100% - #{ $grid-unit-20 * 2 });
6
- height: calc(100% - #{ $header-height * 2 });
7
- }
8
- @include break-medium() {
9
- width: $break-medium - $grid-unit-20 * 2;
10
- }
11
- @include break-large() {
12
- height: 70%;
6
+ .components-modal__frame {
7
+ @include break-small() {
8
+ width: calc(100% - #{ $grid-unit-20 * 2 });
9
+ height: calc(100% - #{ $header-height * 2 });
10
+ }
11
+ @include break-medium() {
12
+ width: $break-medium - $grid-unit-20 * 2;
13
+ }
14
+ @include break-large() {
15
+ height: 70%;
16
+ }
13
17
  }
14
18
  }
19
+
20
+ .block-library-template-part__selection-search {
21
+ background: $white;
22
+ position: sticky;
23
+ top: 0;
24
+ padding: $grid-unit-20 0;
25
+ z-index: z-index(".block-library-template-part__selection-search");
26
+ }
@@ -159,11 +159,11 @@ function render_block_core_template_part( $attributes ) {
159
159
  }
160
160
 
161
161
  /**
162
- * Returns an array of variation objects for the template part block.
162
+ * Returns an array of area variation objects for the template part block.
163
163
  *
164
164
  * @return array Array containing the block variation objects.
165
165
  */
166
- function build_template_part_block_variations() {
166
+ function build_template_part_block_area_variations() {
167
167
  $variations = array();
168
168
  $defined_areas = get_allowed_block_template_part_areas();
169
169
  foreach ( $defined_areas as $area ) {
@@ -183,6 +183,60 @@ function build_template_part_block_variations() {
183
183
  return $variations;
184
184
  }
185
185
 
186
+ /**
187
+ * Returns an array of instance variation objects for the template part block
188
+ *
189
+ * @return array Array containing the block variation objects.
190
+ */
191
+ function build_template_part_block_instance_variations() {
192
+ $variations = array();
193
+ $template_parts = get_block_templates(
194
+ array(
195
+ 'post_type' => 'wp_template_part',
196
+ ),
197
+ 'wp_template_part'
198
+ );
199
+
200
+ $defined_areas = get_allowed_block_template_part_areas();
201
+ $icon_by_area = array_combine( array_column( $defined_areas, 'area' ), array_column( $defined_areas, 'icon' ) );
202
+
203
+ foreach ( $template_parts as $template_part ) {
204
+ $variations[] = array(
205
+ 'name' => sanitize_title( $template_part->slug ),
206
+ 'title' => $template_part->title,
207
+ // If there's no description for the template part don't show the
208
+ // block description. This is a bit hacky, but prevent the fallback
209
+ // by using a non-breaking space so that the value of description
210
+ // isn't falsey.
211
+ 'description' => $template_part->description || '&nbsp;',
212
+ 'attributes' => array(
213
+ 'slug' => $template_part->slug,
214
+ 'theme' => $template_part->theme,
215
+ 'area' => $template_part->area,
216
+ ),
217
+ 'scope' => array( 'inserter' ),
218
+ 'icon' => $icon_by_area[ $template_part->area ],
219
+ 'example' => array(
220
+ 'attributes' => array(
221
+ 'slug' => $template_part->slug,
222
+ 'theme' => $template_part->theme,
223
+ 'area' => $template_part->area,
224
+ ),
225
+ ),
226
+ );
227
+ }
228
+ return $variations;
229
+ }
230
+
231
+ /**
232
+ * Returns an array of all template part block variations.
233
+ *
234
+ * @return array Array containing the block variation objects.
235
+ */
236
+ function build_template_part_block_variations() {
237
+ return array_merge( build_template_part_block_area_variations(), build_template_part_block_instance_variations() );
238
+ }
239
+
186
240
  /**
187
241
  * Registers the `core/template-part` block on the server.
188
242
  */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/comments/edit.js"],"names":["TEMPLATE","width","size","style","border","radius","fontSize","layout","type","spacing","margin","top","bottom","CommentsEdit","attributes","setAttributes","tagName","TagName","blockProps","innerBlocksProps","template"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,CAChB,CAAE,qBAAF,CADgB,EAEhB,CACC,uBADD,EAEC,EAFD,EAGC,CACC,CACC,cADD,EAEC,EAFD,EAGC,CACC,CACC,aADD,EAEC;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAFD,EAGC,CACC,CACC,aADD,EAEC;AACCC,EAAAA,IAAI,EAAE,EADP;AAECC,EAAAA,KAAK,EAAE;AACNC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAM,EAAE;AAAV;AADF;AAFR,CAFD,CADD,CAHD,CADD,EAgBC,CACC,aADD,EAEC,EAFD,EAGC,CACC,CACC,0BADD,EAEC;AACCC,EAAAA,QAAQ,EAAE;AADX,CAFD,CADD,EAOC,CACC,YADD,EAEC;AACCC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,IAAI,EAAE;AAAR,GADT;AAECL,EAAAA,KAAK,EAAE;AACNM,IAAAA,OAAO,EAAE;AACRC,MAAAA,MAAM,EAAE;AACPC,QAAAA,GAAG,EAAE,KADE;AAEPC,QAAAA,MAAM,EAAE;AAFD;AADA;AADH;AAFR,CAFD,EAaC,CACC,CACC,mBADD,EAEC;AACCN,EAAAA,QAAQ,EAAE;AADX,CAFD,CADD,EAOC,CACC,wBADD,EAEC;AACCA,EAAAA,QAAQ,EAAE;AADX,CAFD,CAPD,CAbD,CAPD,EAmCC,CAAE,sBAAF,CAnCD,EAoCC,CACC,yBADD,EAEC;AACCA,EAAAA,QAAQ,EAAE;AADX,CAFD,CApCD,CAHD,CAhBD,CAHD,CADD,CAHD,CAFgB,EA4EhB,CAAE,0BAAF,CA5EgB,EA6EhB,CAAE,yBAAF,CA7EgB,CAAjB;;AAgFe,SAASO,YAAT,OAAuD;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AACrE,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAAuBH,UAA7B;AAEA,QAAMI,UAAU,GAAG,iCAAnB;AACA,QAAMC,gBAAgB,GAAG,sCAAqBD,UAArB,EAAiC;AACzDE,IAAAA,QAAQ,EAAEpB;AAD+C,GAAjC,CAAzB;AAIA,SACC,qDACC,4BAAC,kCAAD;AACC,IAAA,UAAU,EAAGc,UADd;AAEC,IAAA,aAAa,EAAGC;AAFjB,IADD,EAKC,4BAAC,OAAD,EAAcI,gBAAd,CALD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport CommentsInspectorControls from './edit/comments-inspector-controls';\n\nconst TEMPLATE = [\n\t[ 'core/comments-title' ],\n\t[\n\t\t'core/comment-template',\n\t\t{},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/columns',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{ width: '40px' },\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/avatar',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tsize: 40,\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\tborder: { radius: '20px' },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/comment-author-name',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfontSize: 'small',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlayout: { type: 'flex' },\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\t\t\t\t\tmargin: {\n\t\t\t\t\t\t\t\t\t\t\t\ttop: '0px',\n\t\t\t\t\t\t\t\t\t\t\t\tbottom: '0px',\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'core/comment-date',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfontSize: 'small',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t'core/comment-edit-link',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfontSize: 'small',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t[ 'core/comment-content' ],\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'core/comment-reply-link',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfontSize: 'small',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t],\n\t\t],\n\t],\n\t[ 'core/comments-pagination' ],\n\t[ 'core/post-comments-form' ],\n];\n\nexport default function CommentsEdit( { attributes, setAttributes } ) {\n\tconst { tagName: TagName } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<CommentsInspectorControls\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t/>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"]}
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = useBackspace;
9
-
10
- var _element = require("@wordpress/element");
11
-
12
- var _compose = require("@wordpress/compose");
13
-
14
- var _keycodes = require("@wordpress/keycodes");
15
-
16
- var _data = require("@wordpress/data");
17
-
18
- var _blockEditor = require("@wordpress/block-editor");
19
-
20
- var _useOutdentListItem = _interopRequireDefault(require("./use-outdent-list-item"));
21
-
22
- /**
23
- * WordPress dependencies
24
- */
25
-
26
- /**
27
- * Internal dependencies
28
- */
29
- function useBackspace(props) {
30
- const {
31
- getSelectionStart,
32
- getSelectionEnd
33
- } = (0, _data.useSelect)(_blockEditor.store);
34
- const propsRef = (0, _element.useRef)(props);
35
- propsRef.current = props;
36
- const [canOutdent, outdentListItem] = (0, _useOutdentListItem.default)(propsRef.current.clientId);
37
- return (0, _compose.useRefEffect)(element => {
38
- function onKeyDown(event) {
39
- if (event.defaultPrevented || event.keyCode !== _keycodes.BACKSPACE) {
40
- return;
41
- } // Handle only if we have a collapsed selection at the
42
- // start of a list item and we can outdent.
43
-
44
-
45
- if (!canOutdent || [getSelectionStart().offset, getSelectionEnd().offset].some(offset => offset !== 0)) {
46
- return;
47
- }
48
-
49
- event.preventDefault();
50
- outdentListItem();
51
- }
52
-
53
- element.addEventListener('keydown', onKeyDown);
54
- return () => {
55
- element.removeEventListener('keydown', onKeyDown);
56
- };
57
- }, [canOutdent]);
58
- }
59
- //# sourceMappingURL=use-backspace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-backspace.js"],"names":["useBackspace","props","getSelectionStart","getSelectionEnd","blockEditorStore","propsRef","current","canOutdent","outdentListItem","clientId","element","onKeyDown","event","defaultPrevented","keyCode","BACKSPACE","offset","some","preventDefault","addEventListener","removeEventListener"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,YAAT,CAAuBC,KAAvB,EAA+B;AAC7C,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MACL,qBAAWC,kBAAX,CADD;AAEA,QAAMC,QAAQ,GAAG,qBAAQJ,KAAR,CAAjB;AACAI,EAAAA,QAAQ,CAACC,OAAT,GAAmBL,KAAnB;AACA,QAAM,CAAEM,UAAF,EAAcC,eAAd,IAAkC,iCACvCH,QAAQ,CAACC,OAAT,CAAiBG,QADsB,CAAxC;AAGA,SAAO,2BACJC,OAAF,IAAe;AACd,aAASC,SAAT,CAAoBC,KAApB,EAA4B;AAC3B,UAAKA,KAAK,CAACC,gBAAN,IAA0BD,KAAK,CAACE,OAAN,KAAkBC,mBAAjD,EAA6D;AAC5D;AACA,OAH0B,CAI3B;AACA;;;AACA,UACC,CAAER,UAAF,IACA,CACCL,iBAAiB,GAAGc,MADrB,EAECb,eAAe,GAAGa,MAFnB,EAGEC,IAHF,CAGUD,MAAF,IAAcA,MAAM,KAAK,CAHjC,CAFD,EAME;AACD;AACA;;AACDJ,MAAAA,KAAK,CAACM,cAAN;AACAV,MAAAA,eAAe;AACf;;AAEDE,IAAAA,OAAO,CAACS,gBAAR,CAA0B,SAA1B,EAAqCR,SAArC;AACA,WAAO,MAAM;AACZD,MAAAA,OAAO,CAACU,mBAAR,CAA6B,SAA7B,EAAwCT,SAAxC;AACA,KAFD;AAGA,GAzBK,EA0BN,CAAEJ,UAAF,CA1BM,CAAP;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { BACKSPACE } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nexport default function useBackspace( props ) {\n\tconst { getSelectionStart, getSelectionEnd } =\n\t\tuseSelect( blockEditorStore );\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\tconst [ canOutdent, outdentListItem ] = useOutdentListItem(\n\t\tpropsRef.current.clientId\n\t);\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tfunction onKeyDown( event ) {\n\t\t\t\tif ( event.defaultPrevented || event.keyCode !== BACKSPACE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Handle only if we have a collapsed selection at the\n\t\t\t\t// start of a list item and we can outdent.\n\t\t\t\tif (\n\t\t\t\t\t! canOutdent ||\n\t\t\t\t\t[\n\t\t\t\t\t\tgetSelectionStart().offset,\n\t\t\t\t\t\tgetSelectionEnd().offset,\n\t\t\t\t\t].some( ( offset ) => offset !== 0 )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t\toutdentListItem();\n\t\t\t}\n\n\t\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t\t};\n\t\t},\n\t\t[ canOutdent ]\n\t);\n}\n"]}
@@ -1,184 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = PostCommentsEdit;
9
-
10
- var _element = require("@wordpress/element");
11
-
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- var _blockEditor = require("@wordpress/block-editor");
15
-
16
- var _i18n = require("@wordpress/i18n");
17
-
18
- var _data = require("@wordpress/data");
19
-
20
- var _coreData = require("@wordpress/core-data");
21
-
22
- var _compose = require("@wordpress/compose");
23
-
24
- var _form = _interopRequireDefault(require("../post-comments-form/form"));
25
-
26
- /**
27
- * External dependencies
28
- */
29
-
30
- /**
31
- * WordPress dependencies
32
- */
33
-
34
- /**
35
- * Internal dependencies
36
- */
37
- function PostCommentsEdit(_ref) {
38
- let {
39
- attributes: {
40
- textAlign
41
- },
42
- setAttributes,
43
- context: {
44
- postType,
45
- postId
46
- }
47
- } = _ref;
48
- let [postTitle] = (0, _coreData.useEntityProp)('postType', postType, 'title', postId);
49
- postTitle = postTitle || (0, _i18n.__)('Post Title');
50
- const [commentStatus] = (0, _coreData.useEntityProp)('postType', postType, 'comment_status', postId);
51
- const {
52
- avatarURL,
53
- defaultCommentStatus
54
- } = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings().__experimentalDiscussionSettings);
55
- const isSiteEditor = postType === undefined || postId === undefined;
56
- const postTypeSupportsComments = (0, _data.useSelect)(select => {
57
- var _select$getPostType;
58
-
59
- return postType ? !!((_select$getPostType = select(_coreData.store).getPostType(postType)) !== null && _select$getPostType !== void 0 && _select$getPostType.supports.comments) : false;
60
- });
61
- let warning = (0, _i18n.__)('Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the "Comments" block.');
62
- let showPlaceholder = true;
63
-
64
- if (!isSiteEditor && 'open' !== commentStatus) {
65
- if ('closed' === commentStatus) {
66
- warning = (0, _i18n.sprintf)(
67
- /* translators: 1: Post type (i.e. "post", "page") */
68
- (0, _i18n.__)('Post Comments block: Comments to this %s are not allowed.'), postType);
69
- showPlaceholder = false;
70
- } else if (!postTypeSupportsComments) {
71
- warning = (0, _i18n.sprintf)(
72
- /* translators: 1: Post type (i.e. "post", "page") */
73
- (0, _i18n.__)('Post Comments block: Comments for this post type (%s) are not enabled.'), postType);
74
- showPlaceholder = false;
75
- } else if ('open' !== defaultCommentStatus) {
76
- warning = (0, _i18n.__)('Post Comments block: Comments are not enabled.');
77
- showPlaceholder = false;
78
- }
79
- }
80
-
81
- const blockProps = (0, _blockEditor.useBlockProps)({
82
- className: (0, _classnames.default)({
83
- [`has-text-align-${textAlign}`]: textAlign
84
- })
85
- });
86
- const disabledRef = (0, _compose.useDisabled)();
87
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, {
88
- group: "block"
89
- }, (0, _element.createElement)(_blockEditor.AlignmentControl, {
90
- value: textAlign,
91
- onChange: nextAlign => {
92
- setAttributes({
93
- textAlign: nextAlign
94
- });
95
- }
96
- })), (0, _element.createElement)("div", blockProps, (0, _element.createElement)(_blockEditor.Warning, null, warning), showPlaceholder && (0, _element.createElement)("div", {
97
- className: "wp-block-post-comments__placeholder",
98
- ref: disabledRef
99
- }, (0, _element.createElement)("h3", null,
100
- /* translators: %s: Post title. */
101
- (0, _i18n.sprintf)((0, _i18n.__)('One response to %s'), postTitle)), (0, _element.createElement)("div", {
102
- className: "navigation"
103
- }, (0, _element.createElement)("div", {
104
- className: "alignleft"
105
- }, (0, _element.createElement)("a", {
106
- href: "#top"
107
- }, "\xAB ", (0, _i18n.__)('Older Comments'))), (0, _element.createElement)("div", {
108
- className: "alignright"
109
- }, (0, _element.createElement)("a", {
110
- href: "#top"
111
- }, (0, _i18n.__)('Newer Comments'), " \xBB"))), (0, _element.createElement)("ol", {
112
- className: "commentlist"
113
- }, (0, _element.createElement)("li", {
114
- className: "comment even thread-even depth-1"
115
- }, (0, _element.createElement)("article", {
116
- className: "comment-body"
117
- }, (0, _element.createElement)("footer", {
118
- className: "comment-meta"
119
- }, (0, _element.createElement)("div", {
120
- className: "comment-author vcard"
121
- }, (0, _element.createElement)("img", {
122
- alt: "Commenter Avatar",
123
- src: avatarURL,
124
- className: "avatar avatar-32 photo",
125
- height: "32",
126
- width: "32",
127
- loading: "lazy"
128
- }), (0, _element.createInterpolateElement)((0, _i18n.sprintf)(
129
- /* translators: %s: Comment author link. */
130
- (0, _i18n.__)('%s <span>says:</span>'), (0, _i18n.sprintf)('<cite><a>%s</a></cite>', (0, _i18n.__)('A WordPress Commenter'))), {
131
- span: (0, _element.createElement)("span", {
132
- className: "says"
133
- }),
134
- a:
135
- /* eslint-disable jsx-a11y/anchor-has-content */
136
- (0, _element.createElement)("a", {
137
- href: "#top",
138
- className: "url"
139
- })
140
- /* eslint-enable jsx-a11y/anchor-has-content */
141
- ,
142
- cite: (0, _element.createElement)("cite", {
143
- className: "fn"
144
- })
145
- })), (0, _element.createElement)("div", {
146
- className: "comment-metadata"
147
- }, (0, _element.createElement)("a", {
148
- href: "#top"
149
- }, (0, _element.createElement)("time", {
150
- dateTime: "2000-01-01T12:00:00+00:00"
151
- }, (0, _i18n.__)('January 1, 2000 at 12:00 am'))), ' ', (0, _element.createElement)("span", {
152
- className: "edit-link"
153
- }, (0, _element.createElement)("a", {
154
- className: "comment-edit-link",
155
- href: "#top"
156
- }, (0, _i18n.__)('Edit'))))), (0, _element.createElement)("div", {
157
- className: "comment-content"
158
- }, (0, _element.createElement)("p", null, (0, _i18n.__)('Hi, this is a comment.'), (0, _element.createElement)("br", null), (0, _i18n.__)('To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'), (0, _element.createElement)("br", null), (0, _element.createInterpolateElement)((0, _i18n.__)('Commenter avatars come from <a>Gravatar</a>'), {
159
- a:
160
- /* eslint-disable-next-line jsx-a11y/anchor-has-content */
161
- (0, _element.createElement)("a", {
162
- href: "https://gravatar.com/"
163
- })
164
- }))), (0, _element.createElement)("div", {
165
- className: "reply"
166
- }, (0, _element.createElement)("a", {
167
- className: "comment-reply-link",
168
- href: "#top",
169
- "aria-label": (0, _i18n.sprintf)(
170
- /* translators: Comment reply button text. %s: Comment author name. */
171
- (0, _i18n.__)('Reply to %s'), (0, _i18n.__)('A WordPress Commenter'))
172
- }, (0, _i18n.__)('Reply')))))), (0, _element.createElement)("div", {
173
- className: "navigation"
174
- }, (0, _element.createElement)("div", {
175
- className: "alignleft"
176
- }, (0, _element.createElement)("a", {
177
- href: "#top"
178
- }, "\xAB ", (0, _i18n.__)('Older Comments'))), (0, _element.createElement)("div", {
179
- className: "alignright"
180
- }, (0, _element.createElement)("a", {
181
- href: "#top"
182
- }, (0, _i18n.__)('Newer Comments'), " \xBB"))), (0, _element.createElement)(_form.default, null))));
183
- }
184
- //# sourceMappingURL=edit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-comments/edit.js"],"names":["PostCommentsEdit","attributes","textAlign","setAttributes","context","postType","postId","postTitle","commentStatus","avatarURL","defaultCommentStatus","select","blockEditorStore","getSettings","__experimentalDiscussionSettings","isSiteEditor","undefined","postTypeSupportsComments","coreStore","getPostType","supports","comments","warning","showPlaceholder","blockProps","className","disabledRef","nextAlign","span","a","cite"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useDisabled } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../post-comments-form/form';\n\nexport default function PostCommentsEdit( {\n\tattributes: { textAlign },\n\tsetAttributes,\n\tcontext: { postType, postId },\n} ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst [ commentStatus ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'comment_status',\n\t\tpostId\n\t);\n\n\tconst { avatarURL, defaultCommentStatus } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings\n\t);\n\n\tconst isSiteEditor = postType === undefined || postId === undefined;\n\n\tconst postTypeSupportsComments = useSelect( ( select ) =>\n\t\tpostType\n\t\t\t? !! select( coreStore ).getPostType( postType )?.supports.comments\n\t\t\t: false\n\t);\n\n\tlet warning = __(\n\t\t'Post Comments block: This is just a placeholder, not a real comment. The final styling may differ because it also depends on the current theme. For better compatibility with the Block Editor, please consider replacing this block with the \"Comments\" block.'\n\t);\n\tlet showPlaceholder = true;\n\n\tif ( ! isSiteEditor && 'open' !== commentStatus ) {\n\t\tif ( 'closed' === commentStatus ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments block: Comments to this %s are not allowed.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( ! postTypeSupportsComments ) {\n\t\t\twarning = sprintf(\n\t\t\t\t/* translators: 1: Post type (i.e. \"post\", \"page\") */\n\t\t\t\t__(\n\t\t\t\t\t'Post Comments block: Comments for this post type (%s) are not enabled.'\n\t\t\t\t),\n\t\t\t\tpostType\n\t\t\t);\n\t\t\tshowPlaceholder = false;\n\t\t} else if ( 'open' !== defaultCommentStatus ) {\n\t\t\twarning = __( 'Post Comments block: Comments are not enabled.' );\n\t\t\tshowPlaceholder = false;\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\tconst disabledRef = useDisabled();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>{ warning }</Warning>\n\n\t\t\t\t{ showPlaceholder && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"wp-block-post-comments__placeholder\"\n\t\t\t\t\t\tref={ disabledRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<h3>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</h3>\n\n\t\t\t\t\t\t<div className=\"navigation\">\n\t\t\t\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<ol className=\"commentlist\">\n\t\t\t\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"Commenter Avatar\"\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: Comment author link. */\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'%s <span>says:</span>'\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'<cite><a>%s</a></cite>',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'A WordPress Commenter'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"says\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-disable jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"url\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-enable jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\tcite: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<cite className=\"fn\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T12:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'January 1, 2000 at 12:00 am'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/anchor-has-content */\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. %s: Comment author name. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Reply to %s' ),\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'A WordPress Commenter' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Reply' ) }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</article>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ol>\n\n\t\t\t\t\t\t<div className=\"navigation\">\n\t\t\t\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">« { __( 'Older Comments' ) }</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } »</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<CommentsForm />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}