@wordpress/block-library 8.30.0 → 8.32.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 (362) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/block/edit.js +22 -16
  3. package/build/block/edit.js.map +1 -1
  4. package/build/button/edit.native.js +1 -1
  5. package/build/button/edit.native.js.map +1 -1
  6. package/build/code/save.js +3 -1
  7. package/build/code/save.js.map +1 -1
  8. package/build/cover/edit/index.js +2 -1
  9. package/build/cover/edit/index.js.map +1 -1
  10. package/build/details/edit.js +1 -0
  11. package/build/details/edit.js.map +1 -1
  12. package/build/file/edit.js +2 -0
  13. package/build/file/edit.js.map +1 -1
  14. package/build/heading/index.js +4 -3
  15. package/build/heading/index.js.map +1 -1
  16. package/build/image/edit.js +10 -39
  17. package/build/image/edit.js.map +1 -1
  18. package/build/image/image.js +27 -6
  19. package/build/image/image.js.map +1 -1
  20. package/build/media-text/edit.js +33 -9
  21. package/build/media-text/edit.js.map +1 -1
  22. package/build/media-text/index.js +5 -0
  23. package/build/media-text/index.js.map +1 -1
  24. package/build/media-text/media-container.js +30 -11
  25. package/build/media-text/media-container.js.map +1 -1
  26. package/build/media-text/save.js +2 -2
  27. package/build/media-text/save.js.map +1 -1
  28. package/build/navigation/edit/index.js +23 -29
  29. package/build/navigation/edit/index.js.map +1 -1
  30. package/build/navigation/edit/navigation-menu-delete-control.js +12 -20
  31. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  32. package/build/navigation/edit/navigation-menu-selector.js +24 -23
  33. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  34. package/build/navigation/edit/placeholder/index.js +4 -4
  35. package/build/navigation/edit/placeholder/index.js.map +1 -1
  36. package/build/navigation/use-navigation-menu.js +15 -12
  37. package/build/navigation/use-navigation-menu.js.map +1 -1
  38. package/build/navigation/view.js +12 -2
  39. package/build/navigation/view.js.map +1 -1
  40. package/build/navigation-link/edit.js +52 -27
  41. package/build/navigation-link/edit.js.map +1 -1
  42. package/build/navigation-submenu/edit.js +31 -9
  43. package/build/navigation-submenu/edit.js.map +1 -1
  44. package/build/pattern/edit.js +3 -1
  45. package/build/pattern/edit.js.map +1 -1
  46. package/build/post-author/edit.js +1 -0
  47. package/build/post-author/edit.js.map +1 -1
  48. package/build/post-excerpt/edit.js +1 -0
  49. package/build/post-excerpt/edit.js.map +1 -1
  50. package/build/post-featured-image/edit.js +16 -4
  51. package/build/post-featured-image/edit.js.map +1 -1
  52. package/build/post-featured-image/index.js +13 -2
  53. package/build/post-featured-image/index.js.map +1 -1
  54. package/build/post-featured-image/overlay-controls.js +82 -0
  55. package/build/post-featured-image/overlay-controls.js.map +1 -0
  56. package/build/post-featured-image/overlay.js +5 -54
  57. package/build/post-featured-image/overlay.js.map +1 -1
  58. package/build/post-navigation-link/edit.js +1 -0
  59. package/build/post-navigation-link/edit.js.map +1 -1
  60. package/build/post-terms/edit.js +2 -0
  61. package/build/post-terms/edit.js.map +1 -1
  62. package/build/quote/edit.js +18 -23
  63. package/build/quote/edit.js.map +1 -1
  64. package/build/read-more/edit.js +1 -0
  65. package/build/read-more/edit.js.map +1 -1
  66. package/build/search/edit.js +2 -0
  67. package/build/search/edit.js.map +1 -1
  68. package/build/search/edit.native.js +2 -2
  69. package/build/search/edit.native.js.map +1 -1
  70. package/build/site-tagline/edit.js +13 -4
  71. package/build/site-tagline/edit.js.map +1 -1
  72. package/build/site-tagline/index.js +4 -0
  73. package/build/site-tagline/index.js.map +1 -1
  74. package/build/social-link/edit.js +1 -1
  75. package/build/social-link/edit.js.map +1 -1
  76. package/build/social-link/icons/medium.js +1 -1
  77. package/build/social-link/icons/medium.js.map +1 -1
  78. package/build/social-link/icons/reddit.js +1 -1
  79. package/build/social-link/icons/reddit.js.map +1 -1
  80. package/build/table/deprecated.js +285 -175
  81. package/build/table/deprecated.js.map +1 -1
  82. package/build/table/index.js +1 -1
  83. package/build/template-part/edit/index.js +55 -47
  84. package/build/template-part/edit/index.js.map +1 -1
  85. package/build/template-part/edit/inner-blocks.js +106 -10
  86. package/build/template-part/edit/inner-blocks.js.map +1 -1
  87. package/build/template-part/edit/selection-modal.js +1 -9
  88. package/build/template-part/edit/selection-modal.js.map +1 -1
  89. package/build/utils/caption.js +19 -13
  90. package/build/utils/caption.js.map +1 -1
  91. package/build/utils/hooks.js +1 -0
  92. package/build/utils/hooks.js.map +1 -1
  93. package/build/video/edit.native.js +1 -1
  94. package/build/video/edit.native.js.map +1 -1
  95. package/build-module/block/edit.js +23 -17
  96. package/build-module/block/edit.js.map +1 -1
  97. package/build-module/button/edit.native.js +1 -1
  98. package/build-module/button/edit.native.js.map +1 -1
  99. package/build-module/code/save.js +3 -1
  100. package/build-module/code/save.js.map +1 -1
  101. package/build-module/cover/edit/index.js +2 -1
  102. package/build-module/cover/edit/index.js.map +1 -1
  103. package/build-module/details/edit.js +1 -0
  104. package/build-module/details/edit.js.map +1 -1
  105. package/build-module/file/edit.js +2 -0
  106. package/build-module/file/edit.js.map +1 -1
  107. package/build-module/heading/index.js +4 -3
  108. package/build-module/heading/index.js.map +1 -1
  109. package/build-module/image/edit.js +11 -40
  110. package/build-module/image/edit.js.map +1 -1
  111. package/build-module/image/image.js +27 -6
  112. package/build-module/image/image.js.map +1 -1
  113. package/build-module/media-text/edit.js +34 -10
  114. package/build-module/media-text/edit.js.map +1 -1
  115. package/build-module/media-text/index.js +5 -0
  116. package/build-module/media-text/index.js.map +1 -1
  117. package/build-module/media-text/media-container.js +31 -12
  118. package/build-module/media-text/media-container.js.map +1 -1
  119. package/build-module/media-text/save.js +2 -2
  120. package/build-module/media-text/save.js.map +1 -1
  121. package/build-module/navigation/edit/index.js +24 -30
  122. package/build-module/navigation/edit/index.js.map +1 -1
  123. package/build-module/navigation/edit/navigation-menu-delete-control.js +15 -23
  124. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  125. package/build-module/navigation/edit/navigation-menu-selector.js +24 -23
  126. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  127. package/build-module/navigation/edit/placeholder/index.js +4 -4
  128. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  129. package/build-module/navigation/use-navigation-menu.js +15 -12
  130. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  131. package/build-module/navigation/view.js +12 -2
  132. package/build-module/navigation/view.js.map +1 -1
  133. package/build-module/navigation-link/edit.js +55 -30
  134. package/build-module/navigation-link/edit.js.map +1 -1
  135. package/build-module/navigation-submenu/edit.js +31 -9
  136. package/build-module/navigation-submenu/edit.js.map +1 -1
  137. package/build-module/pattern/edit.js +3 -1
  138. package/build-module/pattern/edit.js.map +1 -1
  139. package/build-module/post-author/edit.js +1 -0
  140. package/build-module/post-author/edit.js.map +1 -1
  141. package/build-module/post-excerpt/edit.js +1 -0
  142. package/build-module/post-excerpt/edit.js.map +1 -1
  143. package/build-module/post-featured-image/edit.js +17 -5
  144. package/build-module/post-featured-image/edit.js.map +1 -1
  145. package/build-module/post-featured-image/index.js +13 -2
  146. package/build-module/post-featured-image/index.js.map +1 -1
  147. package/build-module/post-featured-image/overlay-controls.js +75 -0
  148. package/build-module/post-featured-image/overlay-controls.js.map +1 -0
  149. package/build-module/post-featured-image/overlay.js +7 -56
  150. package/build-module/post-featured-image/overlay.js.map +1 -1
  151. package/build-module/post-navigation-link/edit.js +1 -0
  152. package/build-module/post-navigation-link/edit.js.map +1 -1
  153. package/build-module/post-terms/edit.js +2 -0
  154. package/build-module/post-terms/edit.js.map +1 -1
  155. package/build-module/quote/edit.js +20 -25
  156. package/build-module/quote/edit.js.map +1 -1
  157. package/build-module/read-more/edit.js +1 -0
  158. package/build-module/read-more/edit.js.map +1 -1
  159. package/build-module/search/edit.js +2 -0
  160. package/build-module/search/edit.js.map +1 -1
  161. package/build-module/search/edit.native.js +2 -2
  162. package/build-module/search/edit.native.js.map +1 -1
  163. package/build-module/site-tagline/edit.js +14 -5
  164. package/build-module/site-tagline/edit.js.map +1 -1
  165. package/build-module/site-tagline/index.js +4 -0
  166. package/build-module/site-tagline/index.js.map +1 -1
  167. package/build-module/social-link/edit.js +1 -1
  168. package/build-module/social-link/edit.js.map +1 -1
  169. package/build-module/social-link/icons/medium.js +1 -1
  170. package/build-module/social-link/icons/medium.js.map +1 -1
  171. package/build-module/social-link/icons/reddit.js +1 -1
  172. package/build-module/social-link/icons/reddit.js.map +1 -1
  173. package/build-module/table/deprecated.js +286 -176
  174. package/build-module/table/deprecated.js.map +1 -1
  175. package/build-module/table/index.js +1 -1
  176. package/build-module/template-part/edit/index.js +58 -50
  177. package/build-module/template-part/edit/index.js.map +1 -1
  178. package/build-module/template-part/edit/inner-blocks.js +108 -12
  179. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  180. package/build-module/template-part/edit/selection-modal.js +2 -10
  181. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  182. package/build-module/utils/caption.js +19 -13
  183. package/build-module/utils/caption.js.map +1 -1
  184. package/build-module/utils/hooks.js +1 -0
  185. package/build-module/utils/hooks.js.map +1 -1
  186. package/build-module/video/edit.native.js +1 -1
  187. package/build-module/video/edit.native.js.map +1 -1
  188. package/build-style/audio/theme-rtl.css +1 -1
  189. package/build-style/audio/theme.css +1 -1
  190. package/build-style/cover/style-rtl.css +5 -2
  191. package/build-style/cover/style.css +5 -2
  192. package/build-style/editor-rtl.css +22 -12
  193. package/build-style/editor.css +22 -12
  194. package/build-style/embed/theme-rtl.css +1 -1
  195. package/build-style/embed/theme.css +1 -1
  196. package/build-style/file/editor-rtl.css +3 -0
  197. package/build-style/file/editor.css +3 -0
  198. package/build-style/image/editor-rtl.css +0 -3
  199. package/build-style/image/editor.css +0 -3
  200. package/build-style/image/theme-rtl.css +1 -1
  201. package/build-style/image/theme.css +1 -1
  202. package/build-style/media-text/editor-rtl.css +7 -1
  203. package/build-style/media-text/editor.css +7 -1
  204. package/build-style/pullquote/theme-rtl.css +2 -1
  205. package/build-style/pullquote/theme.css +2 -1
  206. package/build-style/quote/theme-rtl.css +6 -6
  207. package/build-style/quote/theme.css +6 -6
  208. package/build-style/search/style-rtl.css +10 -0
  209. package/build-style/search/style.css +10 -0
  210. package/build-style/social-links/editor-rtl.css +0 -4
  211. package/build-style/social-links/editor.css +0 -4
  212. package/build-style/social-links/style-rtl.css +2 -2
  213. package/build-style/social-links/style.css +2 -2
  214. package/build-style/style-rtl.css +17 -4
  215. package/build-style/style.css +17 -4
  216. package/build-style/table/theme-rtl.css +4 -3
  217. package/build-style/table/theme.css +4 -3
  218. package/build-style/template-part/editor-rtl.css +12 -4
  219. package/build-style/template-part/editor.css +12 -4
  220. package/build-style/template-part/theme-rtl.css +1 -1
  221. package/build-style/template-part/theme.css +1 -1
  222. package/build-style/theme-rtl.css +17 -15
  223. package/build-style/theme.css +17 -15
  224. package/build-style/video/theme-rtl.css +1 -1
  225. package/build-style/video/theme.css +1 -1
  226. package/package.json +34 -34
  227. package/src/archives/index.php +4 -0
  228. package/src/audio/theme.scss +1 -1
  229. package/src/avatar/index.php +6 -0
  230. package/src/block/edit.js +43 -32
  231. package/src/block/index.php +4 -0
  232. package/src/block/test/edit.native.js +67 -0
  233. package/src/button/edit.native.js +1 -1
  234. package/src/calendar/index.php +12 -0
  235. package/src/categories/index.php +6 -0
  236. package/src/code/save.js +7 -1
  237. package/src/comment-author-name/index.php +4 -0
  238. package/src/comment-content/index.php +4 -0
  239. package/src/comment-date/index.php +4 -0
  240. package/src/comment-edit-link/index.php +4 -0
  241. package/src/comment-reply-link/index.php +4 -0
  242. package/src/comment-template/index.php +4 -0
  243. package/src/comments/index.php +10 -0
  244. package/src/comments-pagination/index.php +4 -0
  245. package/src/comments-pagination-next/index.php +4 -0
  246. package/src/comments-pagination-numbers/index.php +4 -0
  247. package/src/comments-pagination-previous/index.php +4 -0
  248. package/src/comments-title/index.php +4 -0
  249. package/src/cover/edit/index.js +4 -1
  250. package/src/cover/index.php +4 -0
  251. package/src/cover/style.scss +6 -2
  252. package/src/details/edit.js +1 -0
  253. package/src/embed/theme.scss +1 -1
  254. package/src/file/edit.js +2 -0
  255. package/src/file/editor.scss +3 -0
  256. package/src/file/index.php +4 -0
  257. package/src/gallery/editor.scss +1 -1
  258. package/src/gallery/index.php +7 -1
  259. package/src/heading/index.js +4 -3
  260. package/src/heading/index.php +4 -0
  261. package/src/home-link/index.php +10 -0
  262. package/src/image/edit.js +11 -40
  263. package/src/image/editor.scss +2 -7
  264. package/src/image/image.js +25 -7
  265. package/src/image/index.php +12 -1
  266. package/src/image/theme.scss +1 -1
  267. package/src/latest-comments/index.php +4 -0
  268. package/src/latest-posts/index.php +8 -0
  269. package/src/loginout/index.php +4 -0
  270. package/src/media-text/block.json +5 -0
  271. package/src/media-text/edit.js +70 -19
  272. package/src/media-text/editor.scss +7 -1
  273. package/src/media-text/index.php +70 -0
  274. package/src/media-text/media-container.js +49 -9
  275. package/src/media-text/save.js +2 -2
  276. package/src/navigation/edit/index.js +67 -71
  277. package/src/navigation/edit/navigation-menu-delete-control.js +22 -49
  278. package/src/navigation/edit/navigation-menu-selector.js +39 -21
  279. package/src/navigation/edit/placeholder/index.js +4 -4
  280. package/src/navigation/edit/test/navigation-menu-selector.js +75 -53
  281. package/src/navigation/index.php +109 -26
  282. package/src/navigation/test/use-navigation-menu.js +21 -21
  283. package/src/navigation/use-navigation-menu.js +23 -9
  284. package/src/navigation/view.js +11 -2
  285. package/src/navigation-link/edit.js +64 -39
  286. package/src/navigation-link/index.php +14 -0
  287. package/src/navigation-submenu/edit.js +34 -10
  288. package/src/navigation-submenu/index.php +8 -0
  289. package/src/page-list/index.php +12 -0
  290. package/src/page-list-item/index.php +2 -0
  291. package/src/pattern/edit.js +4 -0
  292. package/src/pattern/index.php +2 -0
  293. package/src/post-author/edit.js +1 -0
  294. package/src/post-author/index.php +4 -0
  295. package/src/post-author-biography/index.php +4 -0
  296. package/src/post-author-name/index.php +4 -0
  297. package/src/post-comments-form/index.php +6 -0
  298. package/src/post-content/index.php +4 -0
  299. package/src/post-date/index.php +4 -0
  300. package/src/post-excerpt/edit.js +1 -0
  301. package/src/post-excerpt/index.php +4 -0
  302. package/src/post-featured-image/block.json +13 -2
  303. package/src/post-featured-image/edit.js +16 -1
  304. package/src/post-featured-image/editor.scss +1 -1
  305. package/src/post-featured-image/index.php +15 -0
  306. package/src/post-featured-image/overlay-controls.js +88 -0
  307. package/src/post-featured-image/overlay.js +17 -84
  308. package/src/post-navigation-link/edit.js +1 -0
  309. package/src/post-navigation-link/index.php +4 -0
  310. package/src/post-template/index.php +4 -0
  311. package/src/post-terms/edit.js +2 -0
  312. package/src/post-terms/index.php +6 -0
  313. package/src/post-title/index.php +2 -0
  314. package/src/pullquote/theme.scss +3 -1
  315. package/src/query/index.php +2 -0
  316. package/src/query-no-results/index.php +6 -0
  317. package/src/query-pagination/index.php +4 -0
  318. package/src/query-pagination-next/index.php +6 -0
  319. package/src/query-pagination-numbers/index.php +6 -0
  320. package/src/query-pagination-previous/index.php +4 -0
  321. package/src/query-title/index.php +4 -0
  322. package/src/quote/edit.js +27 -37
  323. package/src/quote/test/edit.native.js +4 -6
  324. package/src/quote/theme.scss +1 -2
  325. package/src/read-more/edit.js +1 -0
  326. package/src/read-more/index.php +4 -0
  327. package/src/rss/index.php +4 -0
  328. package/src/search/edit.js +2 -0
  329. package/src/search/edit.native.js +2 -2
  330. package/src/search/index.php +19 -1
  331. package/src/search/style.scss +11 -0
  332. package/src/shortcode/index.php +4 -0
  333. package/src/site-logo/editor.scss +2 -2
  334. package/src/site-logo/index.php +20 -0
  335. package/src/site-tagline/block.json +4 -0
  336. package/src/site-tagline/edit.js +16 -3
  337. package/src/site-tagline/index.php +13 -1
  338. package/src/site-title/index.php +4 -0
  339. package/src/social-link/edit.js +1 -1
  340. package/src/social-link/icons/medium.js +1 -1
  341. package/src/social-link/icons/reddit.js +1 -1
  342. package/src/social-link/index.php +22 -9
  343. package/src/social-link/socials-with-bg.scss +1 -1
  344. package/src/social-link/socials-without-bg.scss +1 -1
  345. package/src/social-links/editor.scss +1 -9
  346. package/src/table/block.json +1 -1
  347. package/src/table/deprecated.js +308 -175
  348. package/src/table/theme.scss +4 -2
  349. package/src/tag-cloud/index.php +4 -0
  350. package/src/template-part/edit/index.js +87 -79
  351. package/src/template-part/edit/inner-blocks.js +126 -13
  352. package/src/template-part/edit/selection-modal.js +1 -22
  353. package/src/template-part/editor.scss +11 -3
  354. package/src/template-part/index.php +12 -0
  355. package/src/template-part/theme.scss +1 -1
  356. package/src/term-description/index.php +4 -0
  357. package/src/utils/caption.js +19 -16
  358. package/src/utils/hooks.js +1 -0
  359. package/src/video/edit.native.js +2 -0
  360. package/src/video/editor.scss +2 -2
  361. package/src/video/theme.scss +1 -1
  362. package/tsconfig.json +1 -0
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/calendar` block on server.
10
10
  *
11
+ * @since 5.2.0
12
+ *
11
13
  * @global int $monthnum.
12
14
  * @global int $year.
13
15
  *
@@ -79,6 +81,8 @@ function render_block_core_calendar( $attributes ) {
79
81
 
80
82
  /**
81
83
  * Registers the `core/calendar` block on server.
84
+ *
85
+ * @since 5.2.0
82
86
  */
83
87
  function register_block_core_calendar() {
84
88
  register_block_type_from_metadata(
@@ -97,6 +101,8 @@ add_action( 'init', 'register_block_core_calendar' );
97
101
  * Used to hide the calendar block when there are no published posts.
98
102
  * This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016
99
103
  *
104
+ * @since 5.9.0
105
+ *
100
106
  * @return bool Has any published posts or not.
101
107
  */
102
108
  function block_core_calendar_has_published_posts() {
@@ -120,6 +126,8 @@ function block_core_calendar_has_published_posts() {
120
126
  * Queries the database for any published post and saves
121
127
  * a flag whether any published post exists or not.
122
128
  *
129
+ * @since 5.9.0
130
+ *
123
131
  * @global wpdb $wpdb WordPress database abstraction object.
124
132
  *
125
133
  * @return bool Has any published posts or not.
@@ -137,6 +145,8 @@ if ( ! is_multisite() ) {
137
145
  /**
138
146
  * Handler for updating the has published posts flag when a post is deleted.
139
147
  *
148
+ * @since 5.9.0
149
+ *
140
150
  * @param int $post_id Deleted post ID.
141
151
  */
142
152
  function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
@@ -152,6 +162,8 @@ if ( ! is_multisite() ) {
152
162
  /**
153
163
  * Handler for updating the has published posts flag when a post status changes.
154
164
  *
165
+ * @since 5.9.0
166
+ *
155
167
  * @param string $new_status The status the post is changing to.
156
168
  * @param string $old_status The status the post is changing from.
157
169
  * @param WP_Post $post Post object.
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/categories` block on server.
10
10
  *
11
+ * @since 5.0.0
12
+ *
11
13
  * @param array $attributes The block attributes.
12
14
  *
13
15
  * @return string Returns the categories list/dropdown markup.
@@ -63,6 +65,8 @@ function render_block_core_categories( $attributes ) {
63
65
  /**
64
66
  * Generates the inline script for a categories dropdown field.
65
67
  *
68
+ * @since 5.0.0
69
+ *
66
70
  * @param string $dropdown_id ID of the dropdown field.
67
71
  *
68
72
  * @return string Returns the dropdown onChange redirection script.
@@ -87,6 +91,8 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
87
91
 
88
92
  /**
89
93
  * Registers the `core/categories` block on server.
94
+ *
95
+ * @since 5.0.0
90
96
  */
91
97
  function register_block_core_categories() {
92
98
  register_block_type_from_metadata(
package/src/code/save.js CHANGED
@@ -16,7 +16,13 @@ export default function save( { attributes } ) {
16
16
  // To do: `escape` encodes characters in shortcodes and URLs to
17
17
  // prevent embedding in PHP. Ideally checks for the code block,
18
18
  // or pre/code tags, should be made on the PHP side?
19
- value={ escape( attributes.content.toString() ) }
19
+ value={ escape(
20
+ typeof attributes.content === 'string'
21
+ ? attributes.content
22
+ : attributes.content.toHTMLString( {
23
+ preserveWhiteSpace: true,
24
+ } )
25
+ ) }
20
26
  />
21
27
  </pre>
22
28
  );
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comment-author-name` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -53,6 +55,8 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
53
55
 
54
56
  /**
55
57
  * Registers the `core/comment-author-name` block on the server.
58
+ *
59
+ * @since 6.0.0
56
60
  */
57
61
  function register_block_core_comment_author_name() {
58
62
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comment-content` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -69,6 +71,8 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
69
71
 
70
72
  /**
71
73
  * Registers the `core/comment-content` block on the server.
74
+ *
75
+ * @since 6.0.0
72
76
  */
73
77
  function register_block_core_comment_content() {
74
78
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comment-date` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -46,6 +48,8 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
46
48
 
47
49
  /**
48
50
  * Registers the `core/comment-date` block on the server.
51
+ *
52
+ * @since 6.0.0
49
53
  */
50
54
  function register_block_core_comment_date() {
51
55
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comment-edit-link` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -48,6 +50,8 @@ function render_block_core_comment_edit_link( $attributes, $content, $block ) {
48
50
 
49
51
  /**
50
52
  * Registers the `core/comment-edit-link` block on the server.
53
+ *
54
+ * @since 6.0.0
51
55
  */
52
56
  function register_block_core_comment_edit_link() {
53
57
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comment-reply-link` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -70,6 +72,8 @@ function render_block_core_comment_reply_link( $attributes, $content, $block ) {
70
72
 
71
73
  /**
72
74
  * Registers the `core/comment-reply-link` block on the server.
75
+ *
76
+ * @since 6.0.0
73
77
  */
74
78
  function register_block_core_comment_reply_link() {
75
79
  register_block_type_from_metadata(
@@ -92,6 +92,8 @@ function block_core_comment_template_render_comments( $comments, $block ) {
92
92
  /**
93
93
  * Renders the `core/comment-template` block on the server.
94
94
  *
95
+ * @since 6.0.0
96
+ *
95
97
  * @param array $attributes Block attributes.
96
98
  * @param string $content Block default content.
97
99
  * @param WP_Block $block Block instance.
@@ -136,6 +138,8 @@ function render_block_core_comment_template( $attributes, $content, $block ) {
136
138
 
137
139
  /**
138
140
  * Registers the `core/comment-template` block on the server.
141
+ *
142
+ * @since 6.0.0
139
143
  */
140
144
  function register_block_core_comment_template() {
141
145
  register_block_type_from_metadata(
@@ -16,6 +16,8 @@
16
16
  * the block is in legacy mode. If not, the HTML generated in the editor is
17
17
  * returned instead.
18
18
  *
19
+ * @since 6.1.0
20
+ *
19
21
  * @global WP_Post $post Global post object.
20
22
  *
21
23
  * @param array $attributes Block attributes.
@@ -85,6 +87,8 @@ function render_block_core_comments( $attributes, $content, $block ) {
85
87
 
86
88
  /**
87
89
  * Registers the `core/comments` block on the server.
90
+ *
91
+ * @since 6.1.0
88
92
  */
89
93
  function register_block_core_comments() {
90
94
  register_block_type_from_metadata(
@@ -100,6 +104,8 @@ add_action( 'init', 'register_block_core_comments' );
100
104
  /**
101
105
  * Use the button block classes for the form-submit button.
102
106
  *
107
+ * @since 6.1.0
108
+ *
103
109
  * @param array $fields The default comment form arguments.
104
110
  *
105
111
  * @return array Returns the modified fields.
@@ -118,6 +124,8 @@ add_filter( 'comment_form_defaults', 'comments_block_form_defaults' );
118
124
  * Enqueues styles from the legacy `core/post-comments` block. These styles are
119
125
  * required only by the block's fallback.
120
126
  *
127
+ * @since 6.1.0
128
+ *
121
129
  * @param string $block_name Name of the new block type.
122
130
  */
123
131
  function enqueue_legacy_post_comments_block_styles( $block_name ) {
@@ -143,6 +151,8 @@ function enqueue_legacy_post_comments_block_styles( $block_name ) {
143
151
  * The same approach was followed when core/query-loop was renamed to
144
152
  * core/post-template.
145
153
  *
154
+ * @since 6.1.0
155
+ *
146
156
  * @see https://github.com/WordPress/gutenberg/pull/41807
147
157
  * @see https://github.com/WordPress/gutenberg/pull/32514
148
158
  */
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comments-pagination` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  *
@@ -34,6 +36,8 @@ function render_block_core_comments_pagination( $attributes, $content ) {
34
36
 
35
37
  /**
36
38
  * Registers the `core/comments-pagination` block on the server.
39
+ *
40
+ * @since 6.0.0
37
41
  */
38
42
  function register_block_core_comments_pagination() {
39
43
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comments-pagination-next` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -48,6 +50,8 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
48
50
 
49
51
  /**
50
52
  * Registers the `core/comments-pagination-next` block on the server.
53
+ *
54
+ * @since 6.0.0
51
55
  */
52
56
  function register_block_core_comments_pagination_next() {
53
57
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comments-pagination-numbers` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -50,6 +52,8 @@ function render_block_core_comments_pagination_numbers( $attributes, $content, $
50
52
 
51
53
  /**
52
54
  * Registers the `core/comments-pagination-numbers` block on the server.
55
+ *
56
+ * @since 6.0.0
53
57
  */
54
58
  function register_block_core_comments_pagination_numbers() {
55
59
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comments-pagination-previous` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  * @param string $content Block default content.
13
15
  * @param WP_Block $block Block instance.
@@ -40,6 +42,8 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
40
42
 
41
43
  /**
42
44
  * Registers the `core/comments-pagination-previous` block on the server.
45
+ *
46
+ * @since 6.0.0
43
47
  */
44
48
  function register_block_core_comments_pagination_previous() {
45
49
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/comments-title` block on the server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes Block attributes.
12
14
  *
13
15
  * @return string Return the post comments title.
@@ -84,6 +86,8 @@ function render_block_core_comments_title( $attributes ) {
84
86
 
85
87
  /**
86
88
  * Registers the `core/comments-title` block on the server.
89
+ *
90
+ * @since 6.0.0
87
91
  */
88
92
  function register_block_core_comments_title() {
89
93
  register_block_type_from_metadata(
@@ -489,6 +489,9 @@ function CoverEdit( {
489
489
  getPositionClassName( contentPosition )
490
490
  );
491
491
 
492
+ const showOverlay =
493
+ url || ! useFeaturedImage || ( useFeaturedImage && ! url );
494
+
492
495
  return (
493
496
  <>
494
497
  { blockControls }
@@ -500,7 +503,7 @@ function CoverEdit( {
500
503
  data-url={ url }
501
504
  >
502
505
  { resizeListener }
503
- { ( ! useFeaturedImage || url ) && (
506
+ { showOverlay && (
504
507
  <span
505
508
  aria-hidden="true"
506
509
  className={ classnames(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/cover` block on server.
10
10
  *
11
+ * @since 6.0.0
12
+ *
11
13
  * @param array $attributes The block attributes.
12
14
  * @param string $content The block rendered content.
13
15
  *
@@ -66,6 +68,8 @@ function render_block_core_cover( $attributes, $content ) {
66
68
 
67
69
  /**
68
70
  * Registers the `core/cover` block renderer on server.
71
+ *
72
+ * @since 6.0.0
69
73
  */
70
74
  function register_block_core_cover() {
71
75
  register_block_type_from_metadata(
@@ -1,12 +1,16 @@
1
+ // Lowest specificity styles are used to ensure that the default styles for the cover block can be overridden by global styles.
2
+ :where(.wp-block-cover-image, .wp-block-cover) {
3
+ min-height: 430px;
4
+ padding: 1em;
5
+ }
6
+
1
7
  .wp-block-cover-image,
2
8
  .wp-block-cover {
3
9
  position: relative;
4
10
  background-position: center center;
5
- min-height: 430px;
6
11
  display: flex;
7
12
  justify-content: center;
8
13
  align-items: center;
9
- padding: 1em;
10
14
  // Prevent the `wp-block-cover__background` span from overflowing the container when border-radius is applied.
11
15
  // `overflow: hidden` is provided as a fallback for browsers that don't support `overflow: clip`.
12
16
  overflow: hidden;
@@ -64,6 +64,7 @@ function DetailsEdit( { attributes, setAttributes, clientId } ) {
64
64
  >
65
65
  <summary onClick={ ( event ) => event.preventDefault() }>
66
66
  <RichText
67
+ identifier="summary"
67
68
  aria-label={ __( 'Write summary' ) }
68
69
  placeholder={ __( 'Write summary…' ) }
69
70
  allowedFormats={ [] }
@@ -2,6 +2,6 @@
2
2
  @include caption-style-theme();
3
3
  }
4
4
 
5
- .wp-block-embed {
5
+ :where(.wp-block-embed) {
6
6
  margin: 0 0 1em 0;
7
7
  }
package/src/file/edit.js CHANGED
@@ -254,6 +254,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
254
254
  ) }
255
255
  <div className={ 'wp-block-file__content-wrapper' }>
256
256
  <RichText
257
+ identifier="fileName"
257
258
  tagName="a"
258
259
  value={ fileName }
259
260
  placeholder={ __( 'Write file name…' ) }
@@ -273,6 +274,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
273
274
  >
274
275
  { /* Using RichText here instead of PlainText so that it can be styled like a button. */ }
275
276
  <RichText
277
+ identifier="downloadButtonText"
276
278
  tagName="div" // Must be block-level or else cursor disappears.
277
279
  aria-label={ __( 'Download button text' ) }
278
280
  className={ classnames(
@@ -4,6 +4,9 @@
4
4
  // Stop file block from collapsing when floated.
5
5
  height: auto;
6
6
  }
7
+ .wp-block[data-align="center"] > & {
8
+ text-align: center;
9
+ }
7
10
 
8
11
  display: flex;
9
12
  flex-wrap: wrap;
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * When the `core/file` block is rendering, check if we need to enqueue the `wp-block-file-view` script.
10
10
  *
11
+ * @since 5.8.0
12
+ *
11
13
  * @param array $attributes The block attributes.
12
14
  * @param string $content The block content.
13
15
  * @param WP_Block $block The parsed block.
@@ -65,6 +67,8 @@ function render_block_core_file( $attributes, $content ) {
65
67
 
66
68
  /**
67
69
  * Registers the `core/file` block on server.
70
+ *
71
+ * @since 5.8.0
68
72
  */
69
73
  function register_block_core_file() {
70
74
  register_block_type_from_metadata(
@@ -27,7 +27,7 @@ figure.wp-block-gallery {
27
27
  }
28
28
  }
29
29
 
30
- // @todo: this deserves a refactor, by being moved to the toolbar.
30
+ // @todo this deserves a refactor, by being moved to the toolbar.
31
31
  .block-editor-media-placeholder.is-appender {
32
32
  .components-placeholder__label {
33
33
  display: none;
@@ -13,6 +13,8 @@
13
13
  * we add a custom `data-id` attribute before rendering the gallery
14
14
  * so that the Image Block can pick it up in its render_callback.
15
15
  *
16
+ * @since 5.9.0
17
+ *
16
18
  * @param array $parsed_block The block being rendered.
17
19
  * @return array The migrated block object.
18
20
  */
@@ -35,6 +37,8 @@ add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility'
35
37
  /**
36
38
  * Renders the `core/gallery` block on the server.
37
39
  *
40
+ * @since 6.0.0
41
+ *
38
42
  * @param array $attributes Attributes of the block being rendered.
39
43
  * @param string $content Content of the block being rendered.
40
44
  * @return string The content of the block being rendered.
@@ -127,7 +131,7 @@ function block_core_gallery_render( $attributes, $content ) {
127
131
  * the `$parsed_block['innerBlocks']` via the `render_block_data` hook.
128
132
  * However, this hook doesn't apply inner block updates when blocks are
129
133
  * nested.
130
- * @todo: In the future, if this hook supports updating innerBlocks in
134
+ * @todo In the future, if this hook supports updating innerBlocks in
131
135
  * nested blocks, it should be refactored.
132
136
  *
133
137
  * @see: https://github.com/WordPress/gutenberg/pull/58733
@@ -164,6 +168,8 @@ function block_core_gallery_render( $attributes, $content ) {
164
168
  }
165
169
  /**
166
170
  * Registers the `core/gallery` block on server.
171
+ *
172
+ * @since 5.9.0
167
173
  */
168
174
  function register_block_core_gallery() {
169
175
  register_block_type_from_metadata(
@@ -30,15 +30,16 @@ export const settings = {
30
30
  const { content, level } = attributes;
31
31
 
32
32
  const customName = attributes?.metadata?.name;
33
+ const hasContent = content?.trim().length > 0;
33
34
 
34
35
  // In the list view, use the block's content as the label.
35
36
  // If the content is empty, fall back to the default label.
36
- if ( context === 'list-view' && ( customName || content ) ) {
37
- return attributes?.metadata?.name || content;
37
+ if ( context === 'list-view' && ( customName || hasContent ) ) {
38
+ return customName || content;
38
39
  }
39
40
 
40
41
  if ( context === 'accessibility' ) {
41
- return ! content || content.length === 0
42
+ return ! hasContent
42
43
  ? sprintf(
43
44
  /* translators: accessibility text. %s: heading level. */
44
45
  __( 'Level %s. Empty.' ),
@@ -14,6 +14,8 @@
14
14
  * Would be transformed to:
15
15
  * <h2 class="align-left wp-block-heading">Hello World</h2>
16
16
  *
17
+ * @since 6.2.0
18
+ *
17
19
  * @param array $attributes Attributes of the block being rendered.
18
20
  * @param string $content Content of the block being rendered.
19
21
  *
@@ -39,6 +41,8 @@ function block_core_heading_render( $attributes, $content ) {
39
41
 
40
42
  /**
41
43
  * Registers the `core/heading` block on server.
44
+ *
45
+ * @since 6.2.0
42
46
  */
43
47
  function register_block_core_heading() {
44
48
  register_block_type_from_metadata(
@@ -9,6 +9,8 @@
9
9
  * Build an array with CSS classes and inline styles defining the colors
10
10
  * which will be applied to the home link markup in the front-end.
11
11
  *
12
+ * @since 6.0.0
13
+ *
12
14
  * @param array $context home link block context.
13
15
  * @return array Colors CSS classes and inline styles.
14
16
  */
@@ -61,6 +63,8 @@ function block_core_home_link_build_css_colors( $context ) {
61
63
  * Build an array with CSS classes and inline styles defining the font sizes
62
64
  * which will be applied to the home link markup in the front-end.
63
65
  *
66
+ * @since 6.0.0
67
+ *
64
68
  * @param array $context Home link block context.
65
69
  * @return array Font size CSS classes and inline styles.
66
70
  */
@@ -88,6 +92,8 @@ function block_core_home_link_build_css_font_sizes( $context ) {
88
92
  /**
89
93
  * Builds an array with classes and style for the li wrapper
90
94
  *
95
+ * @since 6.0.0
96
+ *
91
97
  * @param array $context Home link block context.
92
98
  * @return string The li wrapper attributes.
93
99
  */
@@ -121,6 +127,8 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
121
127
  /**
122
128
  * Renders the `core/home-link` block.
123
129
  *
130
+ * @since 6.0.0
131
+ *
124
132
  * @param array $attributes The block attributes.
125
133
  * @param string $content The saved content.
126
134
  * @param WP_Block $block The parsed block.
@@ -155,6 +163,8 @@ function render_block_core_home_link( $attributes, $content, $block ) {
155
163
  /**
156
164
  * Register the home block
157
165
  *
166
+ * @since 6.0.0
167
+ *
158
168
  * @uses render_block_core_home_link()
159
169
  * @throws WP_Error An WP_Error exception parsing the block definition.
160
170
  */
package/src/image/edit.js CHANGED
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';
9
+ import { isBlobURL } from '@wordpress/blob';
10
10
  import { store as blocksStore } from '@wordpress/blocks';
11
11
  import { Placeholder } from '@wordpress/components';
12
12
  import { useDispatch, useSelect } from '@wordpress/data';
@@ -28,6 +28,7 @@ import { store as noticesStore } from '@wordpress/notices';
28
28
  * Internal dependencies
29
29
  */
30
30
  import { unlock } from '../lock-unlock';
31
+ import { useUploadMediaFromBlobURL } from '../utils/hooks';
31
32
  import Image from './image';
32
33
 
33
34
  /**
@@ -116,7 +117,9 @@ export function ImageEdit( {
116
117
  align,
117
118
  metadata,
118
119
  } = attributes;
119
- const [ temporaryURL, setTemporaryURL ] = useState();
120
+ const [ temporaryURL, setTemporaryURL ] = useState( () => {
121
+ return isTemporaryImage( id, url ) ? url : undefined;
122
+ } );
120
123
 
121
124
  const altRef = useRef();
122
125
  useEffect( () => {
@@ -267,44 +270,12 @@ export function ImageEdit( {
267
270
  }
268
271
  }
269
272
 
270
- let isTemp = isTemporaryImage( id, url );
271
-
272
- // Upload a temporary image on mount.
273
- useEffect( () => {
274
- if ( ! isTemp ) {
275
- return;
276
- }
277
-
278
- const file = getBlobByURL( url );
279
-
280
- if ( file ) {
281
- const { mediaUpload } = getSettings();
282
- if ( ! mediaUpload ) {
283
- return;
284
- }
285
- mediaUpload( {
286
- filesList: [ file ],
287
- onFileChange: ( [ img ] ) => {
288
- onSelectImage( img );
289
- },
290
- allowedTypes: ALLOWED_MEDIA_TYPES,
291
- onError: ( message ) => {
292
- isTemp = false;
293
- onUploadError( message );
294
- },
295
- } );
296
- }
297
- }, [] );
298
-
299
- // If an image is temporary, revoke the Blob url when it is uploaded (and is
300
- // no longer temporary).
301
- useEffect( () => {
302
- if ( isTemp ) {
303
- setTemporaryURL( url );
304
- return;
305
- }
306
- revokeBlobURL( temporaryURL );
307
- }, [ isTemp, url ] );
273
+ useUploadMediaFromBlobURL( {
274
+ url,
275
+ allowedTypes: ALLOWED_MEDIA_TYPES,
276
+ onChange: onSelectImage,
277
+ onError: onUploadError,
278
+ } );
308
279
 
309
280
  const isExternal = isExternalImage( id, url );
310
281
  const src = isExternal ? url : undefined;