@wordpress/block-library 7.15.1-next.4d3b314fd5.0 → 7.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/build/archives/edit.js +1 -0
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/code/utils.js +3 -3
  5. package/build/code/utils.js.map +1 -1
  6. package/build/comment-template/edit.js +40 -32
  7. package/build/comment-template/edit.js.map +1 -1
  8. package/build/comments/edit/placeholder.js +1 -4
  9. package/build/comments/edit/placeholder.js.map +1 -1
  10. package/build/comments/index.js +5 -1
  11. package/build/comments/index.js.map +1 -1
  12. package/build/comments-title/edit.js +18 -1
  13. package/build/comments-title/edit.js.map +1 -1
  14. package/build/cover/edit/index.js +2 -2
  15. package/build/cover/edit/index.js.map +1 -1
  16. package/build/cover/edit/use-cover-is-dark.js +8 -7
  17. package/build/cover/edit/use-cover-is-dark.js.map +1 -1
  18. package/build/embed/variations.js +1 -1
  19. package/build/embed/variations.js.map +1 -1
  20. package/build/gallery/transforms.js +3 -3
  21. package/build/gallery/transforms.js.map +1 -1
  22. package/build/gallery/v1/edit.js +1 -1
  23. package/build/gallery/v1/edit.js.map +1 -1
  24. package/build/group/edit.js +1 -1
  25. package/build/group/edit.js.map +1 -1
  26. package/build/image/image.js +34 -10
  27. package/build/image/image.js.map +1 -1
  28. package/build/image/transforms.js +1 -7
  29. package/build/image/transforms.js.map +1 -1
  30. package/build/list/transforms.js +9 -1
  31. package/build/list/transforms.js.map +1 -1
  32. package/build/list-item/edit.js +3 -2
  33. package/build/list-item/edit.js.map +1 -1
  34. package/build/list-item/edit.native.js +3 -2
  35. package/build/list-item/edit.native.js.map +1 -1
  36. package/build/list-item/hooks/use-merge.js +19 -22
  37. package/build/list-item/hooks/use-merge.js.map +1 -1
  38. package/build/list-item/hooks/use-outdent-list-item.js +19 -3
  39. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  40. package/build/list-item/index.js +14 -1
  41. package/build/list-item/index.js.map +1 -1
  42. package/build/list-item/utils.js +14 -1
  43. package/build/list-item/utils.js.map +1 -1
  44. package/build/navigation/edit/index.js +46 -33
  45. package/build/navigation/edit/index.js.map +1 -1
  46. package/build/navigation/edit/inner-blocks.js +3 -5
  47. package/build/navigation/edit/inner-blocks.js.map +1 -1
  48. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  49. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  50. package/build/navigation/edit/use-create-navigation-menu.js +1 -1
  51. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  52. package/build/navigation/index.js +4 -1
  53. package/build/navigation/index.js.map +1 -1
  54. package/build/navigation-link/edit.js +1 -1
  55. package/build/navigation-link/edit.js.map +1 -1
  56. package/build/page-list/index.js +1 -5
  57. package/build/page-list/index.js.map +1 -1
  58. package/build/paragraph/deprecated.js +49 -10
  59. package/build/paragraph/deprecated.js.map +1 -1
  60. package/build/paragraph/edit.js +22 -14
  61. package/build/paragraph/edit.js.map +1 -1
  62. package/build/paragraph/save.js +3 -1
  63. package/build/paragraph/save.js.map +1 -1
  64. package/build/pattern/edit.js +11 -4
  65. package/build/pattern/edit.js.map +1 -1
  66. package/build/post-author/edit.js +20 -2
  67. package/build/post-author/edit.js.map +1 -1
  68. package/build/post-author/index.js +8 -0
  69. package/build/post-author/index.js.map +1 -1
  70. package/build/post-comments-form/form.js +1 -2
  71. package/build/post-comments-form/form.js.map +1 -1
  72. package/build/post-featured-image/index.js +1 -1
  73. package/build/post-featured-image/overlay.js +2 -2
  74. package/build/post-featured-image/overlay.js.map +1 -1
  75. package/build/post-terms/index.js +4 -0
  76. package/build/post-terms/index.js.map +1 -1
  77. package/build/query/edit/inspector-controls/author-control.js +2 -1
  78. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  79. package/build/query/edit/inspector-controls/index.js +3 -3
  80. package/build/query/edit/inspector-controls/index.js.map +1 -1
  81. package/build/query/edit/inspector-controls/parent-control.js +2 -1
  82. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  83. package/build/query/edit/inspector-controls/taxonomy-controls.js +79 -103
  84. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  85. package/build/query/utils.js +1 -1
  86. package/build/query/utils.js.map +1 -1
  87. package/build/quote/index.js +0 -1
  88. package/build/quote/index.js.map +1 -1
  89. package/build/search/edit.js +2 -1
  90. package/build/search/edit.js.map +1 -1
  91. package/build/site-logo/edit.js +6 -9
  92. package/build/site-logo/edit.js.map +1 -1
  93. package/build/site-title/index.js +2 -1
  94. package/build/site-title/index.js.map +1 -1
  95. package/build/table/state.js +1 -1
  96. package/build/table/state.js.map +1 -1
  97. package/build/table-of-contents/edit.js +1 -4
  98. package/build/table-of-contents/edit.js.map +1 -1
  99. package/build/tag-cloud/edit.js +1 -1
  100. package/build/tag-cloud/edit.js.map +1 -1
  101. package/build/tag-cloud/index.js +8 -0
  102. package/build/tag-cloud/index.js.map +1 -1
  103. package/build/template-part/index.js +2 -2
  104. package/build/template-part/index.js.map +1 -1
  105. package/build/video/edit.js +13 -1
  106. package/build/video/edit.js.map +1 -1
  107. package/build-module/archives/edit.js +1 -0
  108. package/build-module/archives/edit.js.map +1 -1
  109. package/build-module/code/utils.js +3 -3
  110. package/build-module/code/utils.js.map +1 -1
  111. package/build-module/comment-template/edit.js +38 -30
  112. package/build-module/comment-template/edit.js.map +1 -1
  113. package/build-module/comments/edit/placeholder.js +1 -3
  114. package/build-module/comments/edit/placeholder.js.map +1 -1
  115. package/build-module/comments/index.js +5 -1
  116. package/build-module/comments/index.js.map +1 -1
  117. package/build-module/comments-title/edit.js +18 -2
  118. package/build-module/comments-title/edit.js.map +1 -1
  119. package/build-module/cover/edit/index.js +2 -2
  120. package/build-module/cover/edit/index.js.map +1 -1
  121. package/build-module/cover/edit/use-cover-is-dark.js +7 -7
  122. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
  123. package/build-module/embed/variations.js +1 -1
  124. package/build-module/embed/variations.js.map +1 -1
  125. package/build-module/gallery/transforms.js +4 -4
  126. package/build-module/gallery/transforms.js.map +1 -1
  127. package/build-module/gallery/v1/edit.js +2 -2
  128. package/build-module/gallery/v1/edit.js.map +1 -1
  129. package/build-module/group/edit.js +1 -1
  130. package/build-module/group/edit.js.map +1 -1
  131. package/build-module/image/image.js +35 -11
  132. package/build-module/image/image.js.map +1 -1
  133. package/build-module/image/transforms.js +1 -6
  134. package/build-module/image/transforms.js.map +1 -1
  135. package/build-module/list/transforms.js +9 -1
  136. package/build-module/list/transforms.js.map +1 -1
  137. package/build-module/list-item/edit.js +3 -2
  138. package/build-module/list-item/edit.js.map +1 -1
  139. package/build-module/list-item/edit.native.js +3 -2
  140. package/build-module/list-item/edit.native.js.map +1 -1
  141. package/build-module/list-item/hooks/use-merge.js +19 -21
  142. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  143. package/build-module/list-item/hooks/use-outdent-list-item.js +19 -3
  144. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  145. package/build-module/list-item/index.js +14 -1
  146. package/build-module/list-item/index.js.map +1 -1
  147. package/build-module/list-item/utils.js +14 -1
  148. package/build-module/list-item/utils.js.map +1 -1
  149. package/build-module/navigation/edit/index.js +46 -33
  150. package/build-module/navigation/edit/index.js.map +1 -1
  151. package/build-module/navigation/edit/inner-blocks.js +3 -5
  152. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  153. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  154. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  155. package/build-module/navigation/edit/use-create-navigation-menu.js +1 -1
  156. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  157. package/build-module/navigation/index.js +4 -1
  158. package/build-module/navigation/index.js.map +1 -1
  159. package/build-module/navigation-link/edit.js +1 -1
  160. package/build-module/navigation-link/edit.js.map +1 -1
  161. package/build-module/page-list/index.js +1 -5
  162. package/build-module/page-list/index.js.map +1 -1
  163. package/build-module/paragraph/deprecated.js +49 -11
  164. package/build-module/paragraph/deprecated.js.map +1 -1
  165. package/build-module/paragraph/edit.js +22 -13
  166. package/build-module/paragraph/edit.js.map +1 -1
  167. package/build-module/paragraph/save.js +2 -1
  168. package/build-module/paragraph/save.js.map +1 -1
  169. package/build-module/pattern/edit.js +10 -3
  170. package/build-module/pattern/edit.js.map +1 -1
  171. package/build-module/post-author/edit.js +21 -2
  172. package/build-module/post-author/edit.js.map +1 -1
  173. package/build-module/post-author/index.js +8 -0
  174. package/build-module/post-author/index.js.map +1 -1
  175. package/build-module/post-comments-form/form.js +2 -3
  176. package/build-module/post-comments-form/form.js.map +1 -1
  177. package/build-module/post-featured-image/index.js +1 -1
  178. package/build-module/post-featured-image/overlay.js +2 -2
  179. package/build-module/post-featured-image/overlay.js.map +1 -1
  180. package/build-module/post-terms/index.js +4 -0
  181. package/build-module/post-terms/index.js.map +1 -1
  182. package/build-module/query/edit/inspector-controls/author-control.js +2 -1
  183. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  184. package/build-module/query/edit/inspector-controls/index.js +5 -5
  185. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  186. package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
  187. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  188. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +81 -101
  189. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  190. package/build-module/query/utils.js +1 -1
  191. package/build-module/query/utils.js.map +1 -1
  192. package/build-module/quote/index.js +0 -1
  193. package/build-module/quote/index.js.map +1 -1
  194. package/build-module/search/edit.js +3 -2
  195. package/build-module/search/edit.js.map +1 -1
  196. package/build-module/site-logo/edit.js +6 -9
  197. package/build-module/site-logo/edit.js.map +1 -1
  198. package/build-module/site-title/index.js +2 -1
  199. package/build-module/site-title/index.js.map +1 -1
  200. package/build-module/table/state.js +2 -2
  201. package/build-module/table/state.js.map +1 -1
  202. package/build-module/table-of-contents/edit.js +1 -3
  203. package/build-module/table-of-contents/edit.js.map +1 -1
  204. package/build-module/tag-cloud/edit.js +1 -1
  205. package/build-module/tag-cloud/edit.js.map +1 -1
  206. package/build-module/tag-cloud/index.js +8 -0
  207. package/build-module/tag-cloud/index.js.map +1 -1
  208. package/build-module/template-part/index.js +2 -2
  209. package/build-module/template-part/index.js.map +1 -1
  210. package/build-module/video/edit.js +15 -3
  211. package/build-module/video/edit.js.map +1 -1
  212. package/build-style/archives/style-rtl.css +4 -0
  213. package/build-style/archives/style.css +4 -0
  214. package/build-style/code/style-rtl.css +3 -0
  215. package/build-style/code/style.css +3 -0
  216. package/build-style/comments/editor-rtl.css +1 -0
  217. package/build-style/comments/editor.css +1 -0
  218. package/build-style/comments/style-rtl.css +1 -0
  219. package/build-style/comments/style.css +1 -0
  220. package/build-style/cover/editor-rtl.css +4 -0
  221. package/build-style/cover/editor.css +4 -0
  222. package/build-style/editor-rtl.css +78 -46
  223. package/build-style/editor.css +78 -46
  224. package/build-style/group/editor-rtl.css +1 -0
  225. package/build-style/group/editor.css +1 -0
  226. package/build-style/image/editor-rtl.css +1 -1
  227. package/build-style/image/editor.css +1 -1
  228. package/build-style/navigation/editor-rtl.css +5 -0
  229. package/build-style/navigation/editor.css +5 -0
  230. package/build-style/navigation/style-rtl.css +3 -0
  231. package/build-style/navigation/style.css +3 -0
  232. package/build-style/paragraph/editor-rtl.css +0 -16
  233. package/build-style/paragraph/editor.css +0 -16
  234. package/build-style/paragraph/style-rtl.css +5 -0
  235. package/build-style/paragraph/style.css +5 -0
  236. package/build-style/post-featured-image/editor-rtl.css +39 -29
  237. package/build-style/post-featured-image/editor.css +39 -29
  238. package/build-style/post-terms/style-rtl.css +4 -1
  239. package/build-style/post-terms/style.css +4 -1
  240. package/build-style/site-logo/editor-rtl.css +1 -0
  241. package/build-style/site-logo/editor.css +1 -0
  242. package/build-style/site-title/editor-rtl.css +4 -0
  243. package/build-style/site-title/editor.css +4 -0
  244. package/build-style/site-title/style-rtl.css +79 -0
  245. package/build-style/site-title/style.css +79 -0
  246. package/build-style/style-rtl.css +27 -1
  247. package/build-style/style.css +27 -1
  248. package/build-style/tag-cloud/style-rtl.css +3 -0
  249. package/build-style/tag-cloud/style.css +3 -0
  250. package/build-style/video/editor-rtl.css +22 -0
  251. package/build-style/video/editor.css +22 -0
  252. package/package.json +28 -28
  253. package/src/archives/edit.js +1 -0
  254. package/src/archives/style.scss +5 -0
  255. package/src/avatar/index.php +1 -1
  256. package/src/categories/index.php +1 -1
  257. package/src/code/style.scss +12 -7
  258. package/src/code/test/__snapshots__/edit.native.js.snap +13 -0
  259. package/src/code/test/edit.native.js +46 -32
  260. package/src/code/utils.js +3 -3
  261. package/src/comment-author-name/index.php +1 -1
  262. package/src/comment-reply-link/index.php +1 -1
  263. package/src/comment-template/edit.js +47 -34
  264. package/src/comment-template/index.php +2 -3
  265. package/src/comments/block.json +5 -1
  266. package/src/comments/edit/placeholder.js +1 -7
  267. package/src/comments/style.scss +2 -0
  268. package/src/comments-title/edit.js +24 -1
  269. package/src/cover/edit/index.js +2 -7
  270. package/src/cover/edit/use-cover-is-dark.js +11 -11
  271. package/src/cover/editor.scss +7 -0
  272. package/src/cover/index.php +1 -1
  273. package/src/embed/variations.js +1 -1
  274. package/src/gallery/transforms.js +8 -5
  275. package/src/gallery/v1/edit.js +2 -2
  276. package/src/group/edit.js +1 -1
  277. package/src/group/editor.scss +1 -0
  278. package/src/image/editor.scss +4 -1
  279. package/src/image/image.js +59 -29
  280. package/src/image/transforms.js +1 -7
  281. package/src/latest-posts/index.php +1 -1
  282. package/src/list/test/edit.native.js +102 -3
  283. package/src/list/transforms.js +11 -0
  284. package/src/list-item/block.json +14 -1
  285. package/src/list-item/edit.js +2 -1
  286. package/src/list-item/edit.native.js +2 -1
  287. package/src/list-item/hooks/use-merge.js +4 -23
  288. package/src/list-item/hooks/use-outdent-list-item.js +6 -2
  289. package/src/navigation/block.json +4 -1
  290. package/src/navigation/edit/index.js +60 -32
  291. package/src/navigation/edit/inner-blocks.js +2 -5
  292. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +32 -5
  293. package/src/navigation/edit/use-create-navigation-menu.js +2 -5
  294. package/src/navigation/editor.scss +7 -0
  295. package/src/navigation/index.php +103 -6
  296. package/src/navigation/style.scss +8 -0
  297. package/src/navigation-link/edit.js +1 -1
  298. package/src/navigation-link/index.php +8 -1
  299. package/src/navigation-submenu/index.php +8 -1
  300. package/src/page-list/block.json +1 -5
  301. package/src/page-list/index.php +10 -8
  302. package/src/paragraph/deprecated.js +36 -0
  303. package/src/paragraph/edit.js +24 -22
  304. package/src/paragraph/editor.scss +0 -20
  305. package/src/paragraph/save.js +5 -1
  306. package/src/paragraph/style.scss +5 -0
  307. package/src/pattern/edit.js +10 -3
  308. package/src/post-author/block.json +8 -0
  309. package/src/post-author/edit.js +29 -3
  310. package/src/post-author/index.php +7 -1
  311. package/src/post-comments-form/form.js +2 -3
  312. package/src/post-featured-image/block.json +1 -1
  313. package/src/post-featured-image/editor.scss +79 -72
  314. package/src/post-featured-image/index.php +18 -24
  315. package/src/post-featured-image/overlay.js +17 -14
  316. package/src/post-terms/block.json +4 -0
  317. package/src/post-terms/style.scss +7 -2
  318. package/src/query/edit/inspector-controls/author-control.js +1 -0
  319. package/src/query/edit/inspector-controls/index.js +5 -7
  320. package/src/query/edit/inspector-controls/parent-control.js +1 -0
  321. package/src/query/edit/inspector-controls/taxonomy-controls.js +82 -86
  322. package/src/query/utils.js +1 -1
  323. package/src/quote/block.json +0 -1
  324. package/src/rss/index.php +3 -3
  325. package/src/search/edit.js +6 -1
  326. package/src/search/index.php +21 -13
  327. package/src/site-logo/edit.js +10 -8
  328. package/src/site-logo/editor.scss +1 -0
  329. package/src/site-title/block.json +2 -1
  330. package/src/site-title/editor.scss +6 -0
  331. package/src/site-title/style.scss +5 -0
  332. package/src/style.scss +1 -0
  333. package/src/table/state.js +2 -2
  334. package/src/table-of-contents/edit.js +1 -3
  335. package/src/tag-cloud/block.json +8 -0
  336. package/src/tag-cloud/edit.js +1 -1
  337. package/src/tag-cloud/style.scss +3 -0
  338. package/src/template-part/index.js +2 -2
  339. package/src/template-part/index.php +4 -0
  340. package/src/video/edit.js +19 -0
  341. package/src/video/editor.scss +37 -0
  342. package/build/navigation-submenu/view.js +0 -56
  343. package/build/navigation-submenu/view.js.map +0 -1
  344. package/build/paragraph/drop-zone.js +0 -99
  345. package/build/paragraph/drop-zone.js.map +0 -1
  346. package/build-module/navigation-submenu/view.js +0 -54
  347. package/build-module/navigation-submenu/view.js.map +0 -1
  348. package/build-module/paragraph/drop-zone.js +0 -88
  349. package/build-module/paragraph/drop-zone.js.map +0 -1
  350. package/src/navigation-submenu/view.js +0 -67
  351. package/src/paragraph/drop-zone.js +0 -105
@@ -8,14 +8,18 @@ import { store as coreStore } from '@wordpress/core-data';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import { getEntitiesInfo, useTaxonomies } from '../../utils';
11
+ import { useTaxonomies } from '../../utils';
12
12
  import { MAX_FETCHED_TERMS } from '../../constants';
13
13
 
14
14
  // Helper function to get the term id based on user input in terms `FormTokenField`.
15
- const getTermIdByTermValue = ( termsMappedByName, termValue ) => {
15
+ const getTermIdByTermValue = ( terms, termValue ) => {
16
16
  // First we check for exact match by `term.id` or case sensitive `term.name` match.
17
- const termId = termValue?.id || termsMappedByName[ termValue ]?.id;
18
- if ( termId ) return termId;
17
+ const termId =
18
+ termValue?.id || terms.find( ( term ) => term.name === termValue )?.id;
19
+ if ( termId ) {
20
+ return termId;
21
+ }
22
+
19
23
  /**
20
24
  * Here we make an extra check for entered terms in a non case sensitive way,
21
25
  * to match user expectations, due to `FormTokenField` behaviour that shows
@@ -26,100 +30,92 @@ const getTermIdByTermValue = ( termsMappedByName, termValue ) => {
26
30
  * In this edge case we always apply the first match from the terms list.
27
31
  */
28
32
  const termValueLower = termValue.toLocaleLowerCase();
29
- for ( const term in termsMappedByName ) {
30
- if ( term.toLocaleLowerCase() === termValueLower ) {
31
- return termsMappedByName[ term ].id;
32
- }
33
- }
33
+ return terms.find(
34
+ ( term ) => term.name.toLocaleLowerCase() === termValueLower
35
+ )?.id;
34
36
  };
35
37
 
36
- export const useTaxonomiesInfo = ( postType ) => {
37
- const taxonomies = useTaxonomies( postType );
38
- const taxonomiesInfo = useSelect(
38
+ const useTaxonomyTerms = ( slug ) => {
39
+ return useSelect(
39
40
  ( select ) => {
40
- const { getEntityRecords } = select( coreStore );
41
- const termsQuery = { context: 'view', per_page: MAX_FETCHED_TERMS };
42
- const _taxonomiesInfo = taxonomies?.map( ( { slug, name } ) => {
43
- const _terms = getEntityRecords( 'taxonomy', slug, termsQuery );
44
- return {
45
- slug,
46
- name,
47
- terms: getEntitiesInfo( _terms ),
48
- };
49
- } );
50
- return _taxonomiesInfo;
41
+ const terms = select( coreStore ).getEntityRecords(
42
+ 'taxonomy',
43
+ slug,
44
+ { context: 'view', per_page: MAX_FETCHED_TERMS }
45
+ );
46
+ return { terms };
51
47
  },
52
- [ taxonomies ]
48
+ [ slug ]
53
49
  );
54
- return taxonomiesInfo;
55
50
  };
56
51
 
57
52
  export function TaxonomyControls( { onChange, query } ) {
58
- const taxonomiesInfo = useTaxonomiesInfo( query.postType );
59
- const onTermsChange = ( taxonomySlug ) => ( newTermValues ) => {
60
- const taxonomyInfo = taxonomiesInfo.find(
61
- ( { slug } ) => slug === taxonomySlug
62
- );
63
- if ( ! taxonomyInfo ) return;
64
- const termIds = Array.from(
65
- newTermValues.reduce( ( accumulator, termValue ) => {
66
- const termId = getTermIdByTermValue(
67
- taxonomyInfo.terms.mapByName,
68
- termValue
53
+ const { postType, taxQuery } = query;
54
+
55
+ const taxonomies = useTaxonomies( postType );
56
+ if ( ! taxonomies || taxonomies.length === 0 ) {
57
+ return null;
58
+ }
59
+
60
+ return (
61
+ <>
62
+ { taxonomies.map( ( taxonomy ) => {
63
+ const value = taxQuery?.[ taxonomy.slug ] || [];
64
+ const handleChange = ( newTermIds ) =>
65
+ onChange( {
66
+ taxQuery: {
67
+ ...taxQuery,
68
+ [ taxonomy.slug ]: newTermIds,
69
+ },
70
+ } );
71
+
72
+ return (
73
+ <TaxonomyItem
74
+ key={ taxonomy.slug }
75
+ taxonomy={ taxonomy }
76
+ value={ value }
77
+ onChange={ handleChange }
78
+ />
69
79
  );
70
- if ( termId ) accumulator.add( termId );
71
- return accumulator;
72
- }, new Set() )
73
- );
74
- const newTaxQuery = {
75
- ...query.taxQuery,
76
- [ taxonomySlug ]: termIds,
77
- };
78
- onChange( { taxQuery: newTaxQuery } );
80
+ } ) }
81
+ </>
82
+ );
83
+ }
84
+ function TaxonomyItem( { taxonomy, value, onChange } ) {
85
+ const { terms } = useTaxonomyTerms( taxonomy.slug );
86
+ if ( ! terms?.length ) {
87
+ return null;
88
+ }
89
+
90
+ const onTermsChange = ( newTermValues ) => {
91
+ const termIds = new Set();
92
+ for ( const termValue of newTermValues ) {
93
+ const termId = getTermIdByTermValue( terms, termValue );
94
+ if ( termId ) {
95
+ termIds.add( termId );
96
+ }
97
+ }
98
+
99
+ onChange( Array.from( termIds ) );
79
100
  };
80
- // Returns only the existing term ids in proper format to be
101
+
102
+ // Selects only the existing term ids in proper format to be
81
103
  // used in `FormTokenField`. This prevents the component from
82
104
  // crashing in the editor, when non existing term ids were provided.
83
- const getExistingTaxQueryValue = ( taxonomySlug ) => {
84
- const taxonomyInfo = taxonomiesInfo.find(
85
- ( { slug } ) => slug === taxonomySlug
86
- );
87
- if ( ! taxonomyInfo ) return [];
88
- return ( query.taxQuery?.[ taxonomySlug ] || [] ).reduce(
89
- ( accumulator, termId ) => {
90
- const term = taxonomyInfo.terms.mapById[ termId ];
91
- if ( term ) {
92
- accumulator.push( {
93
- id: termId,
94
- value: term.name,
95
- } );
96
- }
97
- return accumulator;
98
- },
99
- []
100
- );
101
- };
105
+ const taxQueryValue = value
106
+ .map( ( termId ) => terms.find( ( t ) => t.id === termId ) )
107
+ .filter( Boolean )
108
+ .map( ( term ) => ( { id: term.id, value: term.name } ) );
109
+
102
110
  return (
103
- <>
104
- { !! taxonomiesInfo?.length &&
105
- taxonomiesInfo.map( ( { slug, name, terms } ) => {
106
- if ( ! terms?.names?.length ) {
107
- return null;
108
- }
109
- return (
110
- <div
111
- key={ slug }
112
- className="block-library-query-inspector__taxonomy-control"
113
- >
114
- <FormTokenField
115
- label={ name }
116
- value={ getExistingTaxQueryValue( slug ) }
117
- suggestions={ terms.names }
118
- onChange={ onTermsChange( slug ) }
119
- />
120
- </div>
121
- );
122
- } ) }
123
- </>
111
+ <div className="block-library-query-inspector__taxonomy-control">
112
+ <FormTokenField
113
+ label={ taxonomy.name }
114
+ value={ taxQueryValue }
115
+ suggestions={ terms.map( ( t ) => t.name ) }
116
+ onChange={ onTermsChange }
117
+ __experimentalShowHowTo={ false }
118
+ />
119
+ </div>
124
120
  );
125
121
  }
@@ -162,7 +162,7 @@ export function useAllowedControls( attributes ) {
162
162
  select( blocksStore ).getActiveBlockVariation(
163
163
  queryLoopName,
164
164
  attributes
165
- )?.allowControls,
165
+ )?.allowedControls,
166
166
 
167
167
  [ attributes ]
168
168
  );
@@ -29,7 +29,6 @@
29
29
  },
30
30
  "supports": {
31
31
  "anchor": true,
32
- "__experimentalSlashInserter": true,
33
32
  "__experimentalOnEnter": true,
34
33
  "typography": {
35
34
  "fontSize": true,
package/src/rss/index.php CHANGED
@@ -20,7 +20,7 @@ function render_block_core_rss( $attributes ) {
20
20
  $rss = fetch_feed( $attributes['feedURL'] );
21
21
 
22
22
  if ( is_wp_error( $rss ) ) {
23
- return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</div></div>';
23
+ return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
24
24
  }
25
25
 
26
26
  if ( ! $rss->get_item_quantity() ) {
@@ -48,8 +48,8 @@ function render_block_core_rss( $attributes ) {
48
48
  if ( $date ) {
49
49
  $date = sprintf(
50
50
  '<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
51
- date_i18n( get_option( 'c' ), $date ),
52
- date_i18n( get_option( 'date_format' ), $date )
51
+ esc_attr( date_i18n( get_option( 'c' ), $date ) ),
52
+ esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
53
53
  );
54
54
  }
55
55
  }
@@ -16,6 +16,7 @@ import {
16
16
  getTypographyClassesAndStyles as useTypographyProps,
17
17
  store as blockEditorStore,
18
18
  __experimentalGetElementClassName,
19
+ useSetting,
19
20
  } from '@wordpress/block-editor';
20
21
  import { useDispatch, useSelect } from '@wordpress/data';
21
22
  import { useEffect } from '@wordpress/element';
@@ -113,7 +114,11 @@ export default function SearchEdit( {
113
114
  }
114
115
 
115
116
  const colorProps = useColorProps( attributes );
116
- const typographyProps = useTypographyProps( attributes );
117
+ const fluidTypographyEnabled = useSetting( 'typography.fluid' );
118
+ const typographyProps = useTypographyProps(
119
+ attributes,
120
+ fluidTypographyEnabled
121
+ );
117
122
  const unitControlInstanceId = useInstanceId( UnitControl );
118
123
  const unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;
119
124
  const isButtonPositionInside = 'button-inside' === buttonPosition;
@@ -367,12 +367,12 @@ function styles_for_block_core_search( $attributes ) {
367
367
  // Add color styles.
368
368
  $has_text_color = ! empty( $attributes['style']['color']['text'] );
369
369
  if ( $has_text_color ) {
370
- $button_styles[] = sprintf( 'color: %s;', esc_attr( $attributes['style']['color']['text'] ) );
370
+ $button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
371
371
  }
372
372
 
373
373
  $has_background_color = ! empty( $attributes['style']['color']['background'] );
374
374
  if ( $has_background_color ) {
375
- $button_styles[] = sprintf( 'background-color: %s;', esc_attr( $attributes['style']['color']['background'] ) );
375
+ $button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
376
376
  }
377
377
 
378
378
  $has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
@@ -381,7 +381,7 @@ function styles_for_block_core_search( $attributes ) {
381
381
  }
382
382
 
383
383
  // Get typography styles to be shared across inner elements.
384
- $typography_styles = get_typography_styles_for_block_core_search( $attributes );
384
+ $typography_styles = esc_attr( get_typography_styles_for_block_core_search( $attributes ) );
385
385
  if ( ! empty( $typography_styles ) ) {
386
386
  $label_styles [] = $typography_styles;
387
387
  $button_styles[] = $typography_styles;
@@ -399,9 +399,9 @@ function styles_for_block_core_search( $attributes ) {
399
399
  }
400
400
 
401
401
  return array(
402
- 'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
403
- 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
404
- 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
402
+ 'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '',
403
+ 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '',
404
+ 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '',
405
405
  'label' => ! empty( $label_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $label_styles ) ) ) ) : '',
406
406
  );
407
407
  }
@@ -442,31 +442,39 @@ function get_typography_styles_for_block_core_search( $attributes ) {
442
442
 
443
443
  // Add typography styles.
444
444
  if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) {
445
- $typography_styles[] = sprintf( 'font-size: %s;', esc_attr( $attributes['style']['typography']['fontSize'] ) );
445
+ $typography_styles[] = sprintf(
446
+ 'font-size: %s;',
447
+ wp_get_typography_font_size_value(
448
+ array(
449
+ 'size' => $attributes['style']['typography']['fontSize'],
450
+ )
451
+ )
452
+ );
453
+
446
454
  }
447
455
 
448
456
  if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) {
449
- $typography_styles[] = sprintf( 'font-family: %s;', esc_attr( $attributes['style']['typography']['fontFamily'] ) );
457
+ $typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] );
450
458
  }
451
459
 
452
460
  if ( ! empty( $attributes['style']['typography']['letterSpacing'] ) ) {
453
- $typography_styles[] = sprintf( 'letter-spacing: %s;', esc_attr( $attributes['style']['typography']['letterSpacing'] ) );
461
+ $typography_styles[] = sprintf( 'letter-spacing: %s;', $attributes['style']['typography']['letterSpacing'] );
454
462
  }
455
463
 
456
464
  if ( ! empty( $attributes['style']['typography']['fontWeight'] ) ) {
457
- $typography_styles[] = sprintf( 'font-weight: %s;', esc_attr( $attributes['style']['typography']['fontWeight'] ) );
465
+ $typography_styles[] = sprintf( 'font-weight: %s;', $attributes['style']['typography']['fontWeight'] );
458
466
  }
459
467
 
460
468
  if ( ! empty( $attributes['style']['typography']['fontStyle'] ) ) {
461
- $typography_styles[] = sprintf( 'font-style: %s;', esc_attr( $attributes['style']['typography']['fontStyle'] ) );
469
+ $typography_styles[] = sprintf( 'font-style: %s;', $attributes['style']['typography']['fontStyle'] );
462
470
  }
463
471
 
464
472
  if ( ! empty( $attributes['style']['typography']['lineHeight'] ) ) {
465
- $typography_styles[] = sprintf( 'line-height: %s;', esc_attr( $attributes['style']['typography']['lineHeight'] ) );
473
+ $typography_styles[] = sprintf( 'line-height: %s;', $attributes['style']['typography']['lineHeight'] );
466
474
  }
467
475
 
468
476
  if ( ! empty( $attributes['style']['typography']['textTransform'] ) ) {
469
- $typography_styles[] = sprintf( 'text-transform: %s;', esc_attr( $attributes['style']['typography']['textTransform'] ) );
477
+ $typography_styles[] = sprintf( 'text-transform: %s;', $attributes['style']['typography']['textTransform'] );
470
478
  }
471
479
 
472
480
  return implode( '', $typography_styles );
@@ -81,12 +81,12 @@ const SiteLogo = ( {
81
81
  } );
82
82
  const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
83
83
  const { getSettings } = select( blockEditorStore );
84
- const siteEntities = select( coreStore ).getEditedEntityRecord(
84
+ const siteEntities = select( coreStore ).getEntityRecord(
85
85
  'root',
86
- 'site'
86
+ '__unstableBase'
87
87
  );
88
88
  return {
89
- title: siteEntities.title,
89
+ title: siteEntities?.name,
90
90
  ...pick( getSettings(), [ 'imageEditing', 'maxWidth' ] ),
91
91
  };
92
92
  }, [] );
@@ -370,12 +370,14 @@ export default function LogoEdit( {
370
370
  } = useSelect( ( select ) => {
371
371
  const { canUser, getEntityRecord, getEditedEntityRecord } =
372
372
  select( coreStore );
373
- const siteSettings = getEditedEntityRecord( 'root', 'site' );
374
- const siteData = getEntityRecord( 'root', '__unstableBase' );
375
- const _siteLogo = siteSettings?.site_logo;
376
- const _readOnlyLogo = siteData?.site_logo;
377
373
  const _canUserEdit = canUser( 'update', 'settings' );
378
- const _siteLogoId = _canUserEdit ? _siteLogo : _readOnlyLogo;
374
+ const siteSettings = _canUserEdit
375
+ ? getEditedEntityRecord( 'root', 'site' )
376
+ : undefined;
377
+ const siteData = getEntityRecord( 'root', '__unstableBase' );
378
+ const _siteLogoId = _canUserEdit
379
+ ? siteSettings?.site_logo
380
+ : siteData?.site_logo;
379
381
  const _siteIconId = siteSettings?.site_icon;
380
382
  const mediaItem =
381
383
  _siteLogoId &&
@@ -47,6 +47,7 @@
47
47
 
48
48
  // Style the placeholder.
49
49
  .components-placeholder {
50
+ display: flex;
50
51
  justify-content: center;
51
52
  align-items: center;
52
53
  padding: 0;
@@ -60,5 +60,6 @@
60
60
  }
61
61
  }
62
62
  },
63
- "editorStyle": "wp-block-site-title-editor"
63
+ "editorStyle": "wp-block-site-title-editor",
64
+ "style": "wp-block-site-title"
64
65
  }
@@ -2,3 +2,9 @@
2
2
  padding: 1em 0;
3
3
  border: 1px dashed;
4
4
  }
5
+
6
+ .editor-styles-wrapper .wp-block-site-title {
7
+ a {
8
+ color: inherit;
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ .wp-block-site-title {
2
+ a {
3
+ color: inherit;
4
+ }
5
+ }
package/src/style.scss CHANGED
@@ -44,6 +44,7 @@
44
44
  @import "./search/style.scss";
45
45
  @import "./separator/style.scss";
46
46
  @import "./site-logo/style.scss";
47
+ @import "./site-title/style.scss";
47
48
  @import "./social-links/style.scss";
48
49
  @import "./spacer/style.scss";
49
50
  @import "./tag-cloud/style.scss";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, mapValues, every, pick } from 'lodash';
4
+ import { get, mapValues, pick } from 'lodash';
5
5
 
6
6
  const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];
7
7
 
@@ -309,7 +309,7 @@ export function toggleSection( state, sectionName ) {
309
309
  * @return {boolean} True if the table section is empty, false otherwise.
310
310
  */
311
311
  export function isEmptyTableSection( section ) {
312
- return ! section || ! section.length || every( section, isEmptyRow );
312
+ return ! section || ! section.length || section.every( isEmptyRow );
313
313
  }
314
314
 
315
315
  /**
@@ -21,7 +21,6 @@ import {
21
21
  ToolbarButton,
22
22
  ToolbarGroup,
23
23
  } from '@wordpress/components';
24
- import { useDisabled } from '@wordpress/compose';
25
24
  import { useDispatch, useSelect } from '@wordpress/data';
26
25
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
27
26
  import { renderToString, useEffect } from '@wordpress/element';
@@ -55,7 +54,6 @@ export default function TableOfContentsEdit( {
55
54
  setAttributes,
56
55
  } ) {
57
56
  const blockProps = useBlockProps();
58
- const disabledRef = useDisabled();
59
57
 
60
58
  const canInsertList = useSelect(
61
59
  ( select ) => {
@@ -295,7 +293,7 @@ export default function TableOfContentsEdit( {
295
293
  return (
296
294
  <>
297
295
  <nav { ...blockProps }>
298
- <ol ref={ disabledRef }>
296
+ <ol inert="true">
299
297
  <TableOfContentsList nestedHeadingList={ headingTree } />
300
298
  </ol>
301
299
  </nav>
@@ -40,6 +40,14 @@
40
40
  "spacing": {
41
41
  "margin": true,
42
42
  "padding": true
43
+ },
44
+ "typography": {
45
+ "lineHeight": true,
46
+ "__experimentalFontFamily": true,
47
+ "__experimentalFontWeight": true,
48
+ "__experimentalFontStyle": true,
49
+ "__experimentalTextTransform": true,
50
+ "__experimentalLetterSpacing": true
43
51
  }
44
52
  },
45
53
  "editorStyle": "wp-block-tag-cloud-editor"
@@ -168,7 +168,7 @@ function TagCloudEdit( { attributes, setAttributes, taxonomies } ) {
168
168
  { inspectorControls }
169
169
  <div { ...useBlockProps() }>
170
170
  <ServerSideRender
171
- key="tag-cloud"
171
+ skipBlockSupportAttributes
172
172
  block="core/tag-cloud"
173
173
  attributes={ attributes }
174
174
  />
@@ -1,4 +1,7 @@
1
1
  .wp-block-tag-cloud {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
4
+
2
5
  &.aligncenter {
3
6
  text-align: center;
4
7
  justify-content: center;
@@ -62,13 +62,13 @@ export const init = () => {
62
62
  'blockEditor.__unstableCanInsertBlockType',
63
63
  'removeTemplatePartsFromPostTemplates',
64
64
  (
65
- can,
65
+ canInsert,
66
66
  blockType,
67
67
  rootClientId,
68
68
  { getBlock, getBlockParentsByBlockName }
69
69
  ) => {
70
70
  if ( blockType.name !== 'core/template-part' ) {
71
- return can;
71
+ return canInsert;
72
72
  }
73
73
 
74
74
  for ( const disallowedParentType of DISALLOWED_PARENTS ) {
@@ -189,6 +189,10 @@ function build_template_part_block_area_variations() {
189
189
  * @return array Array containing the block variation objects.
190
190
  */
191
191
  function build_template_part_block_instance_variations() {
192
+ // Block themes are unavailable during installation.
193
+ if ( wp_installing() ) {
194
+ return array();
195
+ }
192
196
  $variations = array();
193
197
  $template_parts = get_block_templates(
194
198
  array(
package/src/video/edit.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  Disabled,
14
14
  PanelBody,
15
15
  Spinner,
16
+ Placeholder,
16
17
  } from '@wordpress/components';
17
18
  import {
18
19
  BlockControls,
@@ -43,6 +44,23 @@ import VideoCommonSettings from './edit-common-settings';
43
44
  import TracksEditor from './tracks-editor';
44
45
  import Tracks from './tracks';
45
46
 
47
+ // Much of this description is duplicated from MediaPlaceholder.
48
+ const placeholder = ( content ) => {
49
+ return (
50
+ <Placeholder
51
+ className="block-editor-media-placeholder"
52
+ withIllustration={ true }
53
+ icon={ icon }
54
+ label={ __( 'Video' ) }
55
+ instructions={ __(
56
+ 'Upload a video file, pick one from your media library, or add one with a URL.'
57
+ ) }
58
+ >
59
+ { content }
60
+ </Placeholder>
61
+ );
62
+ };
63
+
46
64
  const ALLOWED_MEDIA_TYPES = [ 'video' ];
47
65
  const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
48
66
 
@@ -146,6 +164,7 @@ function VideoEdit( {
146
164
  allowedTypes={ ALLOWED_MEDIA_TYPES }
147
165
  value={ attributes }
148
166
  onError={ onUploadError }
167
+ placeholder={ placeholder }
149
168
  />
150
169
  </div>
151
170
  );
@@ -1,3 +1,40 @@
1
+ // Provide special styling for the placeholder.
2
+ // @todo: this particular minimal style of placeholder could be componentized further.
3
+ .wp-block-video.wp-block-video {
4
+ // Show Placeholder style on-select.
5
+ &.is-selected .components-placeholder {
6
+ // Block UI appearance.
7
+ color: $gray-900;
8
+ background-color: $white;
9
+ box-shadow: inset 0 0 0 $border-width $gray-900;
10
+ border: none;
11
+
12
+ // @todo: this should eventually be overridden by a custom border-radius set in the inspector.
13
+ border-radius: $radius-block-ui;
14
+
15
+ > svg {
16
+ opacity: 0;
17
+ }
18
+
19
+ .components-placeholder__illustration {
20
+ display: none;
21
+ }
22
+
23
+ &::before {
24
+ opacity: 0;
25
+ }
26
+ }
27
+
28
+ // Remove the transition while we still have a legacy placeholder style.
29
+ // Otherwise the content jumps between the 1px placeholder border, and any inherited custom
30
+ // parent border that may get applied when you deselect.
31
+ .components-placeholder__label,
32
+ .components-placeholder__instructions,
33
+ .components-button {
34
+ transition: none;
35
+ }
36
+ }
37
+
1
38
  .wp-block[data-align="center"] > .wp-block-video {
2
39
  text-align: center;
3
40
  }