@wordpress/block-library 8.30.0 → 8.31.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 (254) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/edit.js +17 -8
  3. package/build/block/edit.js.map +1 -1
  4. package/build/code/save.js +3 -1
  5. package/build/code/save.js.map +1 -1
  6. package/build/cover/edit/index.js +2 -1
  7. package/build/cover/edit/index.js.map +1 -1
  8. package/build/details/edit.js +1 -0
  9. package/build/details/edit.js.map +1 -1
  10. package/build/file/edit.js +2 -0
  11. package/build/file/edit.js.map +1 -1
  12. package/build/heading/index.js +4 -3
  13. package/build/heading/index.js.map +1 -1
  14. package/build/media-text/edit.js +33 -9
  15. package/build/media-text/edit.js.map +1 -1
  16. package/build/media-text/index.js +5 -0
  17. package/build/media-text/index.js.map +1 -1
  18. package/build/media-text/media-container.js +30 -11
  19. package/build/media-text/media-container.js.map +1 -1
  20. package/build/media-text/save.js +2 -2
  21. package/build/media-text/save.js.map +1 -1
  22. package/build/navigation/edit/index.js +23 -29
  23. package/build/navigation/edit/index.js.map +1 -1
  24. package/build/navigation/edit/navigation-menu-delete-control.js +12 -20
  25. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  26. package/build/navigation/edit/navigation-menu-selector.js +24 -23
  27. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  28. package/build/navigation/edit/placeholder/index.js +4 -4
  29. package/build/navigation/edit/placeholder/index.js.map +1 -1
  30. package/build/navigation/use-navigation-menu.js +15 -12
  31. package/build/navigation/use-navigation-menu.js.map +1 -1
  32. package/build/navigation-link/edit.js +12 -10
  33. package/build/navigation-link/edit.js.map +1 -1
  34. package/build/navigation-submenu/edit.js +4 -0
  35. package/build/navigation-submenu/edit.js.map +1 -1
  36. package/build/post-author/edit.js +1 -0
  37. package/build/post-author/edit.js.map +1 -1
  38. package/build/post-excerpt/edit.js +1 -0
  39. package/build/post-excerpt/edit.js.map +1 -1
  40. package/build/post-featured-image/edit.js +4 -1
  41. package/build/post-featured-image/edit.js.map +1 -1
  42. package/build/post-featured-image/index.js +6 -0
  43. package/build/post-featured-image/index.js.map +1 -1
  44. package/build/post-navigation-link/edit.js +1 -0
  45. package/build/post-navigation-link/edit.js.map +1 -1
  46. package/build/post-terms/edit.js +2 -0
  47. package/build/post-terms/edit.js.map +1 -1
  48. package/build/quote/edit.js +2 -2
  49. package/build/quote/edit.js.map +1 -1
  50. package/build/read-more/edit.js +1 -0
  51. package/build/read-more/edit.js.map +1 -1
  52. package/build/search/edit.js +2 -0
  53. package/build/search/edit.js.map +1 -1
  54. package/build/search/edit.native.js +2 -2
  55. package/build/search/edit.native.js.map +1 -1
  56. package/build/social-link/edit.js +1 -1
  57. package/build/social-link/edit.js.map +1 -1
  58. package/build/social-link/icons/medium.js +1 -1
  59. package/build/social-link/icons/medium.js.map +1 -1
  60. package/build/social-link/icons/reddit.js +1 -1
  61. package/build/social-link/icons/reddit.js.map +1 -1
  62. package/build/table/deprecated.js +285 -175
  63. package/build/table/deprecated.js.map +1 -1
  64. package/build/table/index.js +1 -1
  65. package/build/template-part/edit/index.js +1 -1
  66. package/build/template-part/edit/index.js.map +1 -1
  67. package/build/video/edit.native.js +1 -1
  68. package/build/video/edit.native.js.map +1 -1
  69. package/build-module/block/edit.js +18 -9
  70. package/build-module/block/edit.js.map +1 -1
  71. package/build-module/code/save.js +3 -1
  72. package/build-module/code/save.js.map +1 -1
  73. package/build-module/cover/edit/index.js +2 -1
  74. package/build-module/cover/edit/index.js.map +1 -1
  75. package/build-module/details/edit.js +1 -0
  76. package/build-module/details/edit.js.map +1 -1
  77. package/build-module/file/edit.js +2 -0
  78. package/build-module/file/edit.js.map +1 -1
  79. package/build-module/heading/index.js +4 -3
  80. package/build-module/heading/index.js.map +1 -1
  81. package/build-module/media-text/edit.js +34 -10
  82. package/build-module/media-text/edit.js.map +1 -1
  83. package/build-module/media-text/index.js +5 -0
  84. package/build-module/media-text/index.js.map +1 -1
  85. package/build-module/media-text/media-container.js +31 -12
  86. package/build-module/media-text/media-container.js.map +1 -1
  87. package/build-module/media-text/save.js +2 -2
  88. package/build-module/media-text/save.js.map +1 -1
  89. package/build-module/navigation/edit/index.js +24 -30
  90. package/build-module/navigation/edit/index.js.map +1 -1
  91. package/build-module/navigation/edit/navigation-menu-delete-control.js +15 -23
  92. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  93. package/build-module/navigation/edit/navigation-menu-selector.js +24 -23
  94. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  95. package/build-module/navigation/edit/placeholder/index.js +4 -4
  96. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  97. package/build-module/navigation/use-navigation-menu.js +15 -12
  98. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  99. package/build-module/navigation-link/edit.js +13 -11
  100. package/build-module/navigation-link/edit.js.map +1 -1
  101. package/build-module/navigation-submenu/edit.js +4 -0
  102. package/build-module/navigation-submenu/edit.js.map +1 -1
  103. package/build-module/post-author/edit.js +1 -0
  104. package/build-module/post-author/edit.js.map +1 -1
  105. package/build-module/post-excerpt/edit.js +1 -0
  106. package/build-module/post-excerpt/edit.js.map +1 -1
  107. package/build-module/post-featured-image/edit.js +5 -2
  108. package/build-module/post-featured-image/edit.js.map +1 -1
  109. package/build-module/post-featured-image/index.js +6 -0
  110. package/build-module/post-featured-image/index.js.map +1 -1
  111. package/build-module/post-navigation-link/edit.js +1 -0
  112. package/build-module/post-navigation-link/edit.js.map +1 -1
  113. package/build-module/post-terms/edit.js +2 -0
  114. package/build-module/post-terms/edit.js.map +1 -1
  115. package/build-module/quote/edit.js +2 -2
  116. package/build-module/quote/edit.js.map +1 -1
  117. package/build-module/read-more/edit.js +1 -0
  118. package/build-module/read-more/edit.js.map +1 -1
  119. package/build-module/search/edit.js +2 -0
  120. package/build-module/search/edit.js.map +1 -1
  121. package/build-module/search/edit.native.js +2 -2
  122. package/build-module/search/edit.native.js.map +1 -1
  123. package/build-module/social-link/edit.js +1 -1
  124. package/build-module/social-link/edit.js.map +1 -1
  125. package/build-module/social-link/icons/medium.js +1 -1
  126. package/build-module/social-link/icons/medium.js.map +1 -1
  127. package/build-module/social-link/icons/reddit.js +1 -1
  128. package/build-module/social-link/icons/reddit.js.map +1 -1
  129. package/build-module/table/deprecated.js +286 -176
  130. package/build-module/table/deprecated.js.map +1 -1
  131. package/build-module/table/index.js +1 -1
  132. package/build-module/template-part/edit/index.js +1 -1
  133. package/build-module/template-part/edit/index.js.map +1 -1
  134. package/build-module/video/edit.native.js +1 -1
  135. package/build-module/video/edit.native.js.map +1 -1
  136. package/build-style/editor-rtl.css +10 -4
  137. package/build-style/editor.css +10 -4
  138. package/build-style/file/editor-rtl.css +3 -0
  139. package/build-style/file/editor.css +3 -0
  140. package/build-style/image/editor-rtl.css +0 -3
  141. package/build-style/image/editor.css +0 -3
  142. package/build-style/media-text/editor-rtl.css +7 -1
  143. package/build-style/media-text/editor.css +7 -1
  144. package/build-style/social-links/style-rtl.css +2 -2
  145. package/build-style/social-links/style.css +2 -2
  146. package/build-style/style-rtl.css +2 -2
  147. package/build-style/style.css +2 -2
  148. package/package.json +34 -34
  149. package/src/archives/index.php +4 -0
  150. package/src/avatar/index.php +6 -0
  151. package/src/block/edit.js +38 -15
  152. package/src/block/index.php +4 -0
  153. package/src/block/test/edit.native.js +67 -0
  154. package/src/calendar/index.php +12 -0
  155. package/src/categories/index.php +6 -0
  156. package/src/code/save.js +7 -1
  157. package/src/comment-author-name/index.php +4 -0
  158. package/src/comment-content/index.php +4 -0
  159. package/src/comment-date/index.php +4 -0
  160. package/src/comment-edit-link/index.php +4 -0
  161. package/src/comment-reply-link/index.php +4 -0
  162. package/src/comment-template/index.php +4 -0
  163. package/src/comments/index.php +10 -0
  164. package/src/comments-pagination/index.php +4 -0
  165. package/src/comments-pagination-next/index.php +4 -0
  166. package/src/comments-pagination-numbers/index.php +4 -0
  167. package/src/comments-pagination-previous/index.php +4 -0
  168. package/src/comments-title/index.php +4 -0
  169. package/src/cover/edit/index.js +4 -1
  170. package/src/cover/index.php +4 -0
  171. package/src/details/edit.js +1 -0
  172. package/src/file/edit.js +2 -0
  173. package/src/file/editor.scss +3 -0
  174. package/src/file/index.php +4 -0
  175. package/src/gallery/index.php +6 -0
  176. package/src/heading/index.js +4 -3
  177. package/src/heading/index.php +4 -0
  178. package/src/home-link/index.php +10 -0
  179. package/src/image/editor.scss +0 -5
  180. package/src/image/index.php +12 -1
  181. package/src/latest-comments/index.php +4 -0
  182. package/src/latest-posts/index.php +8 -0
  183. package/src/loginout/index.php +4 -0
  184. package/src/media-text/block.json +5 -0
  185. package/src/media-text/edit.js +70 -19
  186. package/src/media-text/editor.scss +7 -1
  187. package/src/media-text/index.php +70 -0
  188. package/src/media-text/media-container.js +49 -9
  189. package/src/media-text/save.js +2 -2
  190. package/src/navigation/edit/index.js +67 -71
  191. package/src/navigation/edit/navigation-menu-delete-control.js +22 -49
  192. package/src/navigation/edit/navigation-menu-selector.js +39 -21
  193. package/src/navigation/edit/placeholder/index.js +4 -4
  194. package/src/navigation/edit/test/navigation-menu-selector.js +75 -53
  195. package/src/navigation/index.php +101 -26
  196. package/src/navigation/test/use-navigation-menu.js +21 -21
  197. package/src/navigation/use-navigation-menu.js +23 -9
  198. package/src/navigation-link/edit.js +12 -13
  199. package/src/navigation-link/index.php +14 -0
  200. package/src/navigation-submenu/edit.js +4 -0
  201. package/src/navigation-submenu/index.php +8 -0
  202. package/src/page-list/index.php +12 -0
  203. package/src/page-list-item/index.php +2 -0
  204. package/src/pattern/index.php +2 -0
  205. package/src/post-author/edit.js +1 -0
  206. package/src/post-author/index.php +4 -0
  207. package/src/post-author-biography/index.php +4 -0
  208. package/src/post-author-name/index.php +4 -0
  209. package/src/post-comments-form/index.php +6 -0
  210. package/src/post-content/index.php +4 -0
  211. package/src/post-date/index.php +4 -0
  212. package/src/post-excerpt/edit.js +1 -0
  213. package/src/post-excerpt/index.php +4 -0
  214. package/src/post-featured-image/block.json +6 -0
  215. package/src/post-featured-image/edit.js +4 -0
  216. package/src/post-featured-image/index.php +15 -0
  217. package/src/post-navigation-link/edit.js +1 -0
  218. package/src/post-navigation-link/index.php +4 -0
  219. package/src/post-template/index.php +4 -0
  220. package/src/post-terms/edit.js +2 -0
  221. package/src/post-terms/index.php +6 -0
  222. package/src/post-title/index.php +2 -0
  223. package/src/query/index.php +2 -0
  224. package/src/query-no-results/index.php +4 -0
  225. package/src/query-pagination/index.php +4 -0
  226. package/src/query-pagination-next/index.php +4 -0
  227. package/src/query-pagination-numbers/index.php +4 -0
  228. package/src/query-pagination-previous/index.php +4 -0
  229. package/src/query-title/index.php +4 -0
  230. package/src/quote/edit.js +11 -5
  231. package/src/read-more/edit.js +1 -0
  232. package/src/read-more/index.php +4 -0
  233. package/src/rss/index.php +4 -0
  234. package/src/search/edit.js +2 -0
  235. package/src/search/edit.native.js +2 -2
  236. package/src/search/index.php +19 -1
  237. package/src/shortcode/index.php +4 -0
  238. package/src/site-logo/index.php +20 -0
  239. package/src/site-tagline/index.php +4 -0
  240. package/src/site-title/index.php +4 -0
  241. package/src/social-link/edit.js +1 -1
  242. package/src/social-link/icons/medium.js +1 -1
  243. package/src/social-link/icons/reddit.js +1 -1
  244. package/src/social-link/index.php +22 -9
  245. package/src/social-link/socials-with-bg.scss +1 -1
  246. package/src/social-link/socials-without-bg.scss +1 -1
  247. package/src/table/block.json +1 -1
  248. package/src/table/deprecated.js +308 -175
  249. package/src/tag-cloud/index.php +4 -0
  250. package/src/template-part/edit/index.js +1 -1
  251. package/src/template-part/index.php +10 -0
  252. package/src/term-description/index.php +4 -0
  253. package/src/video/edit.native.js +2 -0
  254. package/tsconfig.json +1 -0
@@ -250,7 +250,7 @@
250
250
  color: #fff;
251
251
  }
252
252
  .wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium {
253
- background-color: #02ab6c;
253
+ background-color: #000;
254
254
  color: #fff;
255
255
  }
256
256
  .wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup {
@@ -414,7 +414,7 @@
414
414
  color: #3288d4;
415
415
  }
416
416
  .wp-block-social-links.is-style-logos-only .wp-social-link-medium {
417
- color: #02ab6c;
417
+ color: #000;
418
418
  }
419
419
  .wp-block-social-links.is-style-logos-only .wp-social-link-meetup {
420
420
  color: #f6405f;
@@ -3565,7 +3565,7 @@ ul.wp-block-rss.is-grid li {
3565
3565
  color: #fff;
3566
3566
  }
3567
3567
  .wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium {
3568
- background-color: #02ab6c;
3568
+ background-color: #000;
3569
3569
  color: #fff;
3570
3570
  }
3571
3571
  .wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup {
@@ -3729,7 +3729,7 @@ ul.wp-block-rss.is-grid li {
3729
3729
  color: #3288d4;
3730
3730
  }
3731
3731
  .wp-block-social-links.is-style-logos-only .wp-social-link-medium {
3732
- color: #02ab6c;
3732
+ color: #000;
3733
3733
  }
3734
3734
  .wp-block-social-links.is-style-logos-only .wp-social-link-meetup {
3735
3735
  color: #f6405f;
@@ -3600,7 +3600,7 @@ ul.wp-block-rss.is-grid li {
3600
3600
  color: #fff;
3601
3601
  }
3602
3602
  .wp-block-social-links:not(.is-style-logos-only) .wp-social-link-medium {
3603
- background-color: #02ab6c;
3603
+ background-color: #000;
3604
3604
  color: #fff;
3605
3605
  }
3606
3606
  .wp-block-social-links:not(.is-style-logos-only) .wp-social-link-meetup {
@@ -3764,7 +3764,7 @@ ul.wp-block-rss.is-grid li {
3764
3764
  color: #3288d4;
3765
3765
  }
3766
3766
  .wp-block-social-links.is-style-logos-only .wp-social-link-medium {
3767
- color: #02ab6c;
3767
+ color: #000;
3768
3768
  }
3769
3769
  .wp-block-social-links.is-style-logos-only .wp-social-link-meetup {
3770
3770
  color: #f6405f;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.30.0",
3
+ "version": "8.31.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,38 +31,38 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.53.0",
35
- "@wordpress/api-fetch": "^6.50.0",
36
- "@wordpress/autop": "^3.53.0",
37
- "@wordpress/blob": "^3.53.0",
38
- "@wordpress/block-editor": "^12.21.0",
39
- "@wordpress/blocks": "^12.30.0",
40
- "@wordpress/components": "^27.1.0",
41
- "@wordpress/compose": "^6.30.0",
42
- "@wordpress/core-data": "^6.30.0",
43
- "@wordpress/data": "^9.23.0",
44
- "@wordpress/date": "^4.53.0",
45
- "@wordpress/deprecated": "^3.53.0",
46
- "@wordpress/dom": "^3.53.0",
47
- "@wordpress/element": "^5.30.0",
48
- "@wordpress/escape-html": "^2.53.0",
49
- "@wordpress/hooks": "^3.53.0",
50
- "@wordpress/html-entities": "^3.53.0",
51
- "@wordpress/i18n": "^4.53.0",
52
- "@wordpress/icons": "^9.44.0",
53
- "@wordpress/interactivity": "^5.2.0",
54
- "@wordpress/interactivity-router": "^1.3.0",
55
- "@wordpress/keycodes": "^3.53.0",
56
- "@wordpress/notices": "^4.21.0",
57
- "@wordpress/patterns": "^1.14.0",
58
- "@wordpress/primitives": "^3.51.0",
59
- "@wordpress/private-apis": "^0.35.0",
60
- "@wordpress/reusable-blocks": "^4.30.0",
61
- "@wordpress/rich-text": "^6.30.0",
62
- "@wordpress/server-side-render": "^4.30.0",
63
- "@wordpress/url": "^3.54.0",
64
- "@wordpress/viewport": "^5.30.0",
65
- "@wordpress/wordcount": "^3.53.0",
34
+ "@wordpress/a11y": "^3.54.0",
35
+ "@wordpress/api-fetch": "^6.51.0",
36
+ "@wordpress/autop": "^3.54.0",
37
+ "@wordpress/blob": "^3.54.0",
38
+ "@wordpress/block-editor": "^12.22.0",
39
+ "@wordpress/blocks": "^12.31.0",
40
+ "@wordpress/components": "^27.2.0",
41
+ "@wordpress/compose": "^6.31.0",
42
+ "@wordpress/core-data": "^6.31.0",
43
+ "@wordpress/data": "^9.24.0",
44
+ "@wordpress/date": "^4.54.0",
45
+ "@wordpress/deprecated": "^3.54.0",
46
+ "@wordpress/dom": "^3.54.0",
47
+ "@wordpress/element": "^5.31.0",
48
+ "@wordpress/escape-html": "^2.54.0",
49
+ "@wordpress/hooks": "^3.54.0",
50
+ "@wordpress/html-entities": "^3.54.0",
51
+ "@wordpress/i18n": "^4.54.0",
52
+ "@wordpress/icons": "^9.45.0",
53
+ "@wordpress/interactivity": "^5.3.0",
54
+ "@wordpress/interactivity-router": "^1.4.0",
55
+ "@wordpress/keycodes": "^3.54.0",
56
+ "@wordpress/notices": "^4.22.0",
57
+ "@wordpress/patterns": "^1.15.0",
58
+ "@wordpress/primitives": "^3.52.0",
59
+ "@wordpress/private-apis": "^0.36.0",
60
+ "@wordpress/reusable-blocks": "^4.31.0",
61
+ "@wordpress/rich-text": "^6.31.0",
62
+ "@wordpress/server-side-render": "^4.31.0",
63
+ "@wordpress/url": "^3.55.0",
64
+ "@wordpress/viewport": "^5.31.0",
65
+ "@wordpress/wordcount": "^3.54.0",
66
66
  "change-case": "^4.1.2",
67
67
  "classnames": "^2.3.1",
68
68
  "colord": "^2.7.0",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "ac3c3e465a083081a86a4da6ee6fb817b41e5130"
83
+ "gitHead": "ffc07735d0abfb3f69e91d48f25b7fe8d1ef92d2"
84
84
  }
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/archives` block on server.
10
10
  *
11
+ * @since 5.0.0
12
+ *
11
13
  * @see WP_Widget_Archives
12
14
  *
13
15
  * @param array $attributes The block attributes.
@@ -106,6 +108,8 @@ function render_block_core_archives( $attributes ) {
106
108
 
107
109
  /**
108
110
  * Register archives block.
111
+ *
112
+ * @since 5.0.0
109
113
  */
110
114
  function register_block_core_archives() {
111
115
  register_block_type_from_metadata(
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/avatar` 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.
@@ -99,6 +101,8 @@ function render_block_core_avatar( $attributes, $content, $block ) {
99
101
  * Generates class names and styles to apply the border support styles for
100
102
  * the Avatar block.
101
103
  *
104
+ * @since 6.3.0
105
+ *
102
106
  * @param array $attributes The block attributes.
103
107
  * @return array The border-related classnames and styles for the block.
104
108
  */
@@ -149,6 +153,8 @@ function get_block_core_avatar_border_attributes( $attributes ) {
149
153
 
150
154
  /**
151
155
  * Registers the `core/avatar` block on the server.
156
+ *
157
+ * @since 6.0.0
152
158
  */
153
159
  function register_block_core_avatar() {
154
160
  register_block_type_from_metadata(
package/src/block/edit.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  BlockControls,
29
29
  } from '@wordpress/block-editor';
30
30
  import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
31
- import { parse, cloneBlock } from '@wordpress/blocks';
31
+ import { parse, cloneBlock, store as blocksStore } from '@wordpress/blocks';
32
32
  import { RichTextData } from '@wordpress/rich-text';
33
33
 
34
34
  /**
@@ -265,6 +265,7 @@ export default function ReusableBlockEdit( {
265
265
  getBlockEditingMode,
266
266
  onNavigateToEntityRecord,
267
267
  editingMode,
268
+ hasPatternOverridesSource,
268
269
  } = useSelect(
269
270
  ( select ) => {
270
271
  const { canUser } = select( coreStore );
@@ -273,6 +274,7 @@ export default function ReusableBlockEdit( {
273
274
  getSettings,
274
275
  getBlockEditingMode: _getBlockEditingMode,
275
276
  } = select( blockEditorStore );
277
+ const { getBlockBindingsSource } = unlock( select( blocksStore ) );
276
278
  const blocks = getBlocks( patternClientId );
277
279
  const canEdit = canUser( 'update', 'blocks', ref );
278
280
 
@@ -284,6 +286,9 @@ export default function ReusableBlockEdit( {
284
286
  onNavigateToEntityRecord:
285
287
  getSettings().onNavigateToEntityRecord,
286
288
  editingMode: _getBlockEditingMode( patternClientId ),
289
+ hasPatternOverridesSource: !! getBlockBindingsSource(
290
+ 'core/pattern-overrides'
291
+ ),
287
292
  };
288
293
  },
289
294
  [ patternClientId, ref ]
@@ -295,13 +300,20 @@ export default function ReusableBlockEdit( {
295
300
  setBlockEditingMode,
296
301
  innerBlocks,
297
302
  // Disable editing if the pattern itself is disabled.
298
- editingMode === 'disabled' ? 'disabled' : undefined
303
+ editingMode === 'disabled' || ! hasPatternOverridesSource
304
+ ? 'disabled'
305
+ : undefined
299
306
  );
300
- }, [ editingMode, innerBlocks, setBlockEditingMode ] );
307
+ }, [
308
+ editingMode,
309
+ innerBlocks,
310
+ setBlockEditingMode,
311
+ hasPatternOverridesSource,
312
+ ] );
301
313
 
302
314
  const canOverrideBlocks = useMemo(
303
- () => hasOverridableBlocks( innerBlocks ),
304
- [ innerBlocks ]
315
+ () => hasPatternOverridesSource && hasOverridableBlocks( innerBlocks ),
316
+ [ hasPatternOverridesSource, innerBlocks ]
305
317
  );
306
318
 
307
319
  const initialBlocks = useMemo(
@@ -329,19 +341,21 @@ export default function ReusableBlockEdit( {
329
341
  registry.batch( () => {
330
342
  setBlockEditingMode( patternClientId, 'default' );
331
343
  syncDerivedUpdates( () => {
332
- replaceInnerBlocks(
333
- patternClientId,
334
- applyInitialContentValuesToInnerBlocks(
335
- initialBlocks,
336
- initialContent.current,
337
- defaultContent.current,
338
- legacyIdMap.current
339
- )
340
- );
344
+ const blocks = hasPatternOverridesSource
345
+ ? applyInitialContentValuesToInnerBlocks(
346
+ initialBlocks,
347
+ initialContent.current,
348
+ defaultContent.current,
349
+ legacyIdMap.current
350
+ )
351
+ : initialBlocks;
352
+
353
+ replaceInnerBlocks( patternClientId, blocks );
341
354
  } );
342
355
  setBlockEditingMode( patternClientId, originalEditingMode );
343
356
  } );
344
357
  }, [
358
+ hasPatternOverridesSource,
345
359
  __unstableMarkNextChangeAsNotPersistent,
346
360
  patternClientId,
347
361
  initialBlocks,
@@ -377,6 +391,9 @@ export default function ReusableBlockEdit( {
377
391
  // Sync the `content` attribute from the updated blocks to the pattern block.
378
392
  // `syncDerivedUpdates` is used here to avoid creating an additional undo level.
379
393
  useEffect( () => {
394
+ if ( ! hasPatternOverridesSource ) {
395
+ return;
396
+ }
380
397
  const { getBlocks } = registry.select( blockEditorStore );
381
398
  let prevBlocks = getBlocks( patternClientId );
382
399
  return registry.subscribe( () => {
@@ -394,7 +411,13 @@ export default function ReusableBlockEdit( {
394
411
  } );
395
412
  }
396
413
  }, blockEditorStore );
397
- }, [ syncDerivedUpdates, patternClientId, registry, setAttributes ] );
414
+ }, [
415
+ hasPatternOverridesSource,
416
+ syncDerivedUpdates,
417
+ patternClientId,
418
+ registry,
419
+ setAttributes,
420
+ ] );
398
421
 
399
422
  const handleEditOriginal = () => {
400
423
  onNavigateToEntityRecord( {
@@ -8,6 +8,8 @@
8
8
  /**
9
9
  * Renders the `core/block` block on server.
10
10
  *
11
+ * @since 5.0.0
12
+ *
11
13
  * @global WP_Embed $wp_embed
12
14
  *
13
15
  * @param array $attributes The block attributes.
@@ -97,6 +99,8 @@ function render_block_core_block( $attributes ) {
97
99
 
98
100
  /**
99
101
  * Registers the `core/block` block.
102
+ *
103
+ * @since 5.3.0
100
104
  */
101
105
  function register_block_core_block() {
102
106
  register_block_type_from_metadata(
@@ -6,6 +6,8 @@ import {
6
6
  initializeEditor,
7
7
  fireEvent,
8
8
  within,
9
+ setupApiFetch,
10
+ triggerBlockListLayout,
9
11
  } from 'test/helpers';
10
12
 
11
13
  /**
@@ -42,6 +44,7 @@ const getMockedReusableBlock = ( id ) => ( {
42
44
  id,
43
45
  title: { raw: `Reusable block - ${ id }` },
44
46
  type: 'wp_block',
47
+ meta: { footnotes: '' },
45
48
  } );
46
49
 
47
50
  beforeAll( () => {
@@ -187,4 +190,68 @@ describe( 'Synced patterns', () => {
187
190
  expect( reusableBlock ).toBeDefined();
188
191
  expect( headingInnerBlock ).toBeDefined();
189
192
  } );
193
+
194
+ it( 'renders block after content is updated due to a side effect', async () => {
195
+ // We have to use different ids because entities are cached in memory.
196
+ const id = 5;
197
+ const initialHtml = `<!-- wp:block {"ref":${ id }} /-->`;
198
+ const endpoint = `/wp/v2/blocks/${ id }`;
199
+ const fetchMedia = {
200
+ request: {
201
+ path: `/wp/v2/media/1?context=edit`,
202
+ },
203
+ response: {
204
+ source_url: 'https://cldup.com/cXyG__fTLN.jpg',
205
+ id: 1,
206
+ // We need to include the sizes to trigger the side effect.
207
+ media_details: {
208
+ sizes: {
209
+ large: {
210
+ source_url:
211
+ 'https://cldup.com/cXyG__fTLN.jpg?w=500',
212
+ },
213
+ },
214
+ },
215
+ },
216
+ };
217
+
218
+ // Return mocked response for the block endpoint.
219
+ fetchRequest.mockImplementation( ( { path } ) => {
220
+ let response = {};
221
+ if ( path.startsWith( endpoint ) ) {
222
+ response = getMockedReusableBlock( id );
223
+ }
224
+ // Replace content with an Image block to trigger a side effect.
225
+ // The side effect will be produced when the `source` attribute is replaced
226
+ // with an URL that includes the width query parameter:
227
+ // https://cldup.com/cXyG__fTLN.jpg => https://cldup.com/cXyG__fTLN.jpg?w=500
228
+ response.content.raw = `<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none"} -->
229
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="" class="wp-image-1"/></figure>
230
+ <!-- /wp:image -->`;
231
+ return Promise.resolve( response );
232
+ } );
233
+
234
+ const screen = await initializeEditor( {
235
+ initialHtml,
236
+ } );
237
+
238
+ const reusableBlock = await screen.findByLabelText(
239
+ /Pattern Block\. Row 1/
240
+ );
241
+
242
+ // Mock media fetch requests
243
+ setupApiFetch( [ fetchMedia ] );
244
+
245
+ await triggerBlockListLayout(
246
+ within( reusableBlock ).getByTestId( 'block-list-wrapper' )
247
+ );
248
+
249
+ const imageBlock =
250
+ await within( reusableBlock ).getByLabelText(
251
+ 'Image Block. Row 1'
252
+ );
253
+
254
+ expect( reusableBlock ).toBeDefined();
255
+ expect( imageBlock ).toBeDefined();
256
+ } );
190
257
  } );
@@ -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(