@wordpress/block-library 8.29.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 (527) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/audio/edit.js +7 -17
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/audio/edit.native.js.map +1 -1
  5. package/build/avatar/edit.js.map +1 -1
  6. package/build/block/deprecated.js +71 -11
  7. package/build/block/deprecated.js.map +1 -1
  8. package/build/block/edit.js +65 -31
  9. package/build/block/edit.js.map +1 -1
  10. package/build/button/edit.js +2 -2
  11. package/build/button/edit.js.map +1 -1
  12. package/build/buttons/edit.native.js.map +1 -1
  13. package/build/buttons/transforms.js +16 -2
  14. package/build/buttons/transforms.js.map +1 -1
  15. package/build/code/save.js +3 -1
  16. package/build/code/save.js.map +1 -1
  17. package/build/code/transforms.js +17 -6
  18. package/build/code/transforms.js.map +1 -1
  19. package/build/columns/edit.js +3 -2
  20. package/build/columns/edit.js.map +1 -1
  21. package/build/comment-author-avatar/edit.js +1 -1
  22. package/build/comment-author-avatar/edit.js.map +1 -1
  23. package/build/cover/edit/block-controls.js +14 -3
  24. package/build/cover/edit/block-controls.js.map +1 -1
  25. package/build/cover/edit/index.js +2 -1
  26. package/build/cover/edit/index.js.map +1 -1
  27. package/build/cover/edit/inspector-controls.js.map +1 -1
  28. package/build/cover/edit/resizable-cover-popover.js +0 -6
  29. package/build/cover/edit/resizable-cover-popover.js.map +1 -1
  30. package/build/cover/edit.native.js.map +1 -1
  31. package/build/details/edit.js +1 -0
  32. package/build/details/edit.js.map +1 -1
  33. package/build/file/deprecated.js.map +1 -1
  34. package/build/file/edit.js +8 -13
  35. package/build/file/edit.js.map +1 -1
  36. package/build/file/edit.native.js.map +1 -1
  37. package/build/file/save.js.map +1 -1
  38. package/build/form-input/edit.js +1 -1
  39. package/build/form-input/edit.js.map +1 -1
  40. package/build/gallery/edit.js.map +1 -1
  41. package/build/gallery/gallery.native.js.map +1 -1
  42. package/build/gallery/v1/edit.js.map +1 -1
  43. package/build/gallery/v1/gallery.native.js.map +1 -1
  44. package/build/heading/index.js +4 -3
  45. package/build/heading/index.js.map +1 -1
  46. package/build/heading/transforms.js +17 -4
  47. package/build/heading/transforms.js.map +1 -1
  48. package/build/image/edit.js +8 -4
  49. package/build/image/edit.js.map +1 -1
  50. package/build/image/edit.native.js.map +1 -1
  51. package/build/image/image.js +22 -8
  52. package/build/image/image.js.map +1 -1
  53. package/build/latest-posts/edit.native.js.map +1 -1
  54. package/build/list/ordered-list-settings.js +1 -1
  55. package/build/list/ordered-list-settings.js.map +1 -1
  56. package/build/list-item/edit.js +1 -3
  57. package/build/list-item/edit.js.map +1 -1
  58. package/build/list-item/edit.native.js.map +1 -1
  59. package/build/list-item/hooks/index.js +0 -7
  60. package/build/list-item/hooks/index.js.map +1 -1
  61. package/build/list-item/hooks/use-indent-list-item.js +1 -0
  62. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  63. package/build/list-item/hooks/use-outdent-list-item.js +1 -0
  64. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  65. package/build/list-item/hooks/use-space.js +16 -7
  66. package/build/list-item/hooks/use-space.js.map +1 -1
  67. package/build/list-item/index.js +4 -1
  68. package/build/list-item/index.js.map +1 -1
  69. package/build/media-text/edit.js +33 -9
  70. package/build/media-text/edit.js.map +1 -1
  71. package/build/media-text/index.js +5 -0
  72. package/build/media-text/index.js.map +1 -1
  73. package/build/media-text/media-container.js +30 -11
  74. package/build/media-text/media-container.js.map +1 -1
  75. package/build/media-text/media-container.native.js +1 -1
  76. package/build/media-text/media-container.native.js.map +1 -1
  77. package/build/media-text/save.js +2 -2
  78. package/build/media-text/save.js.map +1 -1
  79. package/build/navigation/edit/index.js +23 -29
  80. package/build/navigation/edit/index.js.map +1 -1
  81. package/build/navigation/edit/navigation-menu-delete-control.js +12 -20
  82. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  83. package/build/navigation/edit/navigation-menu-selector.js +24 -23
  84. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  85. package/build/navigation/edit/placeholder/index.js +4 -4
  86. package/build/navigation/edit/placeholder/index.js.map +1 -1
  87. package/build/navigation/use-navigation-menu.js +15 -12
  88. package/build/navigation/use-navigation-menu.js.map +1 -1
  89. package/build/navigation-link/edit.js +12 -10
  90. package/build/navigation-link/edit.js.map +1 -1
  91. package/build/navigation-link/link-ui.js.map +1 -1
  92. package/build/navigation-submenu/edit.js +4 -0
  93. package/build/navigation-submenu/edit.js.map +1 -1
  94. package/build/paragraph/edit.native.js.map +1 -1
  95. package/build/pattern/edit.js +11 -0
  96. package/build/pattern/edit.js.map +1 -1
  97. package/build/post-author/edit.js +1 -0
  98. package/build/post-author/edit.js.map +1 -1
  99. package/build/post-excerpt/edit.js +1 -0
  100. package/build/post-excerpt/edit.js.map +1 -1
  101. package/build/post-featured-image/dimension-controls.js.map +1 -1
  102. package/build/post-featured-image/edit.js +12 -12
  103. package/build/post-featured-image/edit.js.map +1 -1
  104. package/build/post-featured-image/index.js +6 -0
  105. package/build/post-featured-image/index.js.map +1 -1
  106. package/build/post-navigation-link/edit.js +1 -0
  107. package/build/post-navigation-link/edit.js.map +1 -1
  108. package/build/post-terms/edit.js +2 -0
  109. package/build/post-terms/edit.js.map +1 -1
  110. package/build/post-title/edit.js +2 -2
  111. package/build/post-title/edit.js.map +1 -1
  112. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  113. package/build/query/utils.js +7 -5
  114. package/build/query/utils.js.map +1 -1
  115. package/build/query-pagination-next/edit.js.map +1 -1
  116. package/build/query-pagination-previous/edit.js.map +1 -1
  117. package/build/quote/deprecated.js +111 -12
  118. package/build/quote/deprecated.js.map +1 -1
  119. package/build/quote/edit.js +7 -7
  120. package/build/quote/edit.js.map +1 -1
  121. package/build/quote/index.js +1 -1
  122. package/build/quote/index.js.map +1 -1
  123. package/build/quote/save.js +2 -2
  124. package/build/quote/save.js.map +1 -1
  125. package/build/read-more/edit.js +1 -0
  126. package/build/read-more/edit.js.map +1 -1
  127. package/build/search/edit.js +3 -1
  128. package/build/search/edit.js.map +1 -1
  129. package/build/search/edit.native.js +2 -2
  130. package/build/search/edit.native.js.map +1 -1
  131. package/build/site-logo/edit.js +7 -2
  132. package/build/site-logo/edit.js.map +1 -1
  133. package/build/site-title/{edit/index.js → edit.js} +1 -1
  134. package/build/site-title/edit.js.map +1 -0
  135. package/build/social-link/edit.js +1 -1
  136. package/build/social-link/edit.js.map +1 -1
  137. package/build/social-link/icons/medium.js +1 -1
  138. package/build/social-link/icons/medium.js.map +1 -1
  139. package/build/social-link/icons/reddit.js +1 -1
  140. package/build/social-link/icons/reddit.js.map +1 -1
  141. package/build/social-links/edit.native.js.map +1 -1
  142. package/build/spacer/edit.js.map +1 -1
  143. package/build/table/deprecated.js +285 -175
  144. package/build/table/deprecated.js.map +1 -1
  145. package/build/table/index.js +1 -1
  146. package/build/table-of-contents/edit.js.map +1 -1
  147. package/build/template-part/edit/index.js +53 -1
  148. package/build/template-part/edit/index.js.map +1 -1
  149. package/build/template-part/edit/selection-modal.js +2 -8
  150. package/build/template-part/edit/selection-modal.js.map +1 -1
  151. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
  152. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  153. package/build/utils/caption.js +15 -5
  154. package/build/utils/caption.js.map +1 -1
  155. package/build/utils/get-transformed-metadata.js +57 -0
  156. package/build/utils/get-transformed-metadata.js.map +1 -0
  157. package/build/utils/hooks.js +55 -4
  158. package/build/utils/hooks.js.map +1 -1
  159. package/build/video/edit-common-settings.js.map +1 -1
  160. package/build/video/edit.js +7 -16
  161. package/build/video/edit.js.map +1 -1
  162. package/build/video/edit.native.js +3 -8
  163. package/build/video/edit.native.js.map +1 -1
  164. package/build-module/audio/edit.js +10 -20
  165. package/build-module/audio/edit.js.map +1 -1
  166. package/build-module/audio/edit.native.js.map +1 -1
  167. package/build-module/avatar/edit.js.map +1 -1
  168. package/build-module/block/deprecated.js +71 -11
  169. package/build-module/block/deprecated.js.map +1 -1
  170. package/build-module/block/edit.js +66 -32
  171. package/build-module/block/edit.js.map +1 -1
  172. package/build-module/button/edit.js +3 -3
  173. package/build-module/button/edit.js.map +1 -1
  174. package/build-module/buttons/edit.native.js.map +1 -1
  175. package/build-module/buttons/transforms.js +16 -2
  176. package/build-module/buttons/transforms.js.map +1 -1
  177. package/build-module/code/save.js +3 -1
  178. package/build-module/code/save.js.map +1 -1
  179. package/build-module/code/transforms.js +17 -6
  180. package/build-module/code/transforms.js.map +1 -1
  181. package/build-module/columns/edit.js +3 -2
  182. package/build-module/columns/edit.js.map +1 -1
  183. package/build-module/comment-author-avatar/edit.js +1 -1
  184. package/build-module/comment-author-avatar/edit.js.map +1 -1
  185. package/build-module/cover/edit/block-controls.js +15 -4
  186. package/build-module/cover/edit/block-controls.js.map +1 -1
  187. package/build-module/cover/edit/index.js +2 -1
  188. package/build-module/cover/edit/index.js.map +1 -1
  189. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  190. package/build-module/cover/edit/resizable-cover-popover.js +1 -7
  191. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
  192. package/build-module/cover/edit.native.js.map +1 -1
  193. package/build-module/details/edit.js +1 -0
  194. package/build-module/details/edit.js.map +1 -1
  195. package/build-module/file/deprecated.js.map +1 -1
  196. package/build-module/file/edit.js +9 -14
  197. package/build-module/file/edit.js.map +1 -1
  198. package/build-module/file/edit.native.js.map +1 -1
  199. package/build-module/file/save.js.map +1 -1
  200. package/build-module/form-input/edit.js +1 -1
  201. package/build-module/form-input/edit.js.map +1 -1
  202. package/build-module/gallery/edit.js.map +1 -1
  203. package/build-module/gallery/gallery.native.js.map +1 -1
  204. package/build-module/gallery/v1/edit.js.map +1 -1
  205. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  206. package/build-module/heading/index.js +4 -3
  207. package/build-module/heading/index.js.map +1 -1
  208. package/build-module/heading/transforms.js +17 -4
  209. package/build-module/heading/transforms.js.map +1 -1
  210. package/build-module/image/edit.js +9 -5
  211. package/build-module/image/edit.js.map +1 -1
  212. package/build-module/image/edit.native.js.map +1 -1
  213. package/build-module/image/image.js +23 -9
  214. package/build-module/image/image.js.map +1 -1
  215. package/build-module/latest-posts/edit.native.js.map +1 -1
  216. package/build-module/list/ordered-list-settings.js +1 -1
  217. package/build-module/list/ordered-list-settings.js.map +1 -1
  218. package/build-module/list-item/edit.js +2 -4
  219. package/build-module/list-item/edit.js.map +1 -1
  220. package/build-module/list-item/edit.native.js.map +1 -1
  221. package/build-module/list-item/hooks/index.js +0 -1
  222. package/build-module/list-item/hooks/index.js.map +1 -1
  223. package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
  224. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  225. package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
  226. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  227. package/build-module/list-item/hooks/use-space.js +17 -8
  228. package/build-module/list-item/hooks/use-space.js.map +1 -1
  229. package/build-module/list-item/index.js +4 -1
  230. package/build-module/list-item/index.js.map +1 -1
  231. package/build-module/media-text/edit.js +34 -10
  232. package/build-module/media-text/edit.js.map +1 -1
  233. package/build-module/media-text/index.js +5 -0
  234. package/build-module/media-text/index.js.map +1 -1
  235. package/build-module/media-text/media-container.js +31 -12
  236. package/build-module/media-text/media-container.js.map +1 -1
  237. package/build-module/media-text/media-container.native.js +1 -1
  238. package/build-module/media-text/media-container.native.js.map +1 -1
  239. package/build-module/media-text/save.js +2 -2
  240. package/build-module/media-text/save.js.map +1 -1
  241. package/build-module/navigation/edit/index.js +24 -30
  242. package/build-module/navigation/edit/index.js.map +1 -1
  243. package/build-module/navigation/edit/navigation-menu-delete-control.js +15 -23
  244. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  245. package/build-module/navigation/edit/navigation-menu-selector.js +24 -23
  246. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  247. package/build-module/navigation/edit/placeholder/index.js +4 -4
  248. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  249. package/build-module/navigation/use-navigation-menu.js +15 -12
  250. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  251. package/build-module/navigation-link/edit.js +13 -11
  252. package/build-module/navigation-link/edit.js.map +1 -1
  253. package/build-module/navigation-link/link-ui.js.map +1 -1
  254. package/build-module/navigation-submenu/edit.js +4 -0
  255. package/build-module/navigation-submenu/edit.js.map +1 -1
  256. package/build-module/paragraph/edit.native.js.map +1 -1
  257. package/build-module/pattern/edit.js +11 -0
  258. package/build-module/pattern/edit.js.map +1 -1
  259. package/build-module/post-author/edit.js +1 -0
  260. package/build-module/post-author/edit.js.map +1 -1
  261. package/build-module/post-excerpt/edit.js +1 -0
  262. package/build-module/post-excerpt/edit.js.map +1 -1
  263. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  264. package/build-module/post-featured-image/edit.js +13 -13
  265. package/build-module/post-featured-image/edit.js.map +1 -1
  266. package/build-module/post-featured-image/index.js +6 -0
  267. package/build-module/post-featured-image/index.js.map +1 -1
  268. package/build-module/post-navigation-link/edit.js +1 -0
  269. package/build-module/post-navigation-link/edit.js.map +1 -1
  270. package/build-module/post-terms/edit.js +2 -0
  271. package/build-module/post-terms/edit.js.map +1 -1
  272. package/build-module/post-title/edit.js +2 -2
  273. package/build-module/post-title/edit.js.map +1 -1
  274. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  275. package/build-module/query/utils.js +7 -5
  276. package/build-module/query/utils.js.map +1 -1
  277. package/build-module/query-pagination-next/edit.js.map +1 -1
  278. package/build-module/query-pagination-previous/edit.js.map +1 -1
  279. package/build-module/quote/deprecated.js +112 -13
  280. package/build-module/quote/deprecated.js.map +1 -1
  281. package/build-module/quote/edit.js +7 -7
  282. package/build-module/quote/edit.js.map +1 -1
  283. package/build-module/quote/index.js +1 -1
  284. package/build-module/quote/index.js.map +1 -1
  285. package/build-module/quote/save.js +2 -2
  286. package/build-module/quote/save.js.map +1 -1
  287. package/build-module/read-more/edit.js +1 -0
  288. package/build-module/read-more/edit.js.map +1 -1
  289. package/build-module/search/edit.js +3 -1
  290. package/build-module/search/edit.js.map +1 -1
  291. package/build-module/search/edit.native.js +2 -2
  292. package/build-module/search/edit.native.js.map +1 -1
  293. package/build-module/site-logo/edit.js +7 -2
  294. package/build-module/site-logo/edit.js.map +1 -1
  295. package/build-module/site-title/{edit/index.js → edit.js} +1 -1
  296. package/build-module/site-title/edit.js.map +1 -0
  297. package/build-module/social-link/edit.js +1 -1
  298. package/build-module/social-link/edit.js.map +1 -1
  299. package/build-module/social-link/icons/medium.js +1 -1
  300. package/build-module/social-link/icons/medium.js.map +1 -1
  301. package/build-module/social-link/icons/reddit.js +1 -1
  302. package/build-module/social-link/icons/reddit.js.map +1 -1
  303. package/build-module/social-links/edit.native.js.map +1 -1
  304. package/build-module/spacer/edit.js.map +1 -1
  305. package/build-module/table/deprecated.js +286 -176
  306. package/build-module/table/deprecated.js.map +1 -1
  307. package/build-module/table/index.js +1 -1
  308. package/build-module/table-of-contents/edit.js.map +1 -1
  309. package/build-module/template-part/edit/index.js +57 -5
  310. package/build-module/template-part/edit/index.js.map +1 -1
  311. package/build-module/template-part/edit/selection-modal.js +2 -8
  312. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  313. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
  314. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  315. package/build-module/utils/caption.js +13 -3
  316. package/build-module/utils/caption.js.map +1 -1
  317. package/build-module/utils/get-transformed-metadata.js +51 -0
  318. package/build-module/utils/get-transformed-metadata.js.map +1 -0
  319. package/build-module/utils/hooks.js +54 -3
  320. package/build-module/utils/hooks.js.map +1 -1
  321. package/build-module/video/edit-common-settings.js.map +1 -1
  322. package/build-module/video/edit.js +10 -19
  323. package/build-module/video/edit.js.map +1 -1
  324. package/build-module/video/edit.native.js +3 -8
  325. package/build-module/video/edit.native.js.map +1 -1
  326. package/build-style/common-rtl.css +1 -0
  327. package/build-style/common.css +1 -0
  328. package/build-style/cover/style-rtl.css +2 -1
  329. package/build-style/cover/style.css +2 -1
  330. package/build-style/editor-rtl.css +11 -2
  331. package/build-style/editor.css +11 -2
  332. package/build-style/file/editor-rtl.css +3 -0
  333. package/build-style/file/editor.css +3 -0
  334. package/build-style/group/editor-rtl.css +1 -1
  335. package/build-style/group/editor.css +1 -1
  336. package/build-style/media-text/editor-rtl.css +7 -1
  337. package/build-style/media-text/editor.css +7 -1
  338. package/build-style/search/style-rtl.css +2 -0
  339. package/build-style/search/style.css +2 -0
  340. package/build-style/social-links/style-rtl.css +2 -2
  341. package/build-style/social-links/style.css +2 -2
  342. package/build-style/style-rtl.css +6 -3
  343. package/build-style/style.css +6 -3
  344. package/package.json +34 -34
  345. package/src/archives/index.php +4 -0
  346. package/src/audio/edit.js +9 -19
  347. package/src/audio/edit.native.js +3 -3
  348. package/src/avatar/edit.js +1 -1
  349. package/src/avatar/index.php +6 -0
  350. package/src/block/deprecated.js +76 -11
  351. package/src/block/edit.js +100 -32
  352. package/src/block/index.php +27 -12
  353. package/src/block/test/edit.native.js +67 -0
  354. package/src/button/edit.js +4 -3
  355. package/src/buttons/edit.native.js +1 -1
  356. package/src/buttons/transforms.js +14 -4
  357. package/src/calendar/index.php +17 -0
  358. package/src/categories/index.php +6 -0
  359. package/src/code/save.js +7 -1
  360. package/src/code/transforms.js +20 -5
  361. package/src/columns/edit.js +3 -2
  362. package/src/comment-author-avatar/edit.js +1 -1
  363. package/src/comment-author-name/index.php +4 -0
  364. package/src/comment-content/index.php +4 -0
  365. package/src/comment-date/index.php +4 -0
  366. package/src/comment-edit-link/index.php +4 -0
  367. package/src/comment-reply-link/index.php +4 -0
  368. package/src/comment-template/index.php +4 -0
  369. package/src/comments/index.php +12 -0
  370. package/src/comments-pagination/index.php +4 -0
  371. package/src/comments-pagination-next/index.php +4 -0
  372. package/src/comments-pagination-numbers/index.php +4 -0
  373. package/src/comments-pagination-previous/index.php +4 -0
  374. package/src/comments-title/index.php +4 -0
  375. package/src/cover/edit/block-controls.js +16 -2
  376. package/src/cover/edit/index.js +6 -3
  377. package/src/cover/edit/inspector-controls.js +1 -1
  378. package/src/cover/edit/resizable-cover-popover.js +1 -6
  379. package/src/cover/edit.native.js +1 -1
  380. package/src/cover/index.php +4 -0
  381. package/src/cover/style.scss +3 -2
  382. package/src/details/edit.js +1 -0
  383. package/src/file/deprecated.js +3 -3
  384. package/src/file/edit.js +10 -15
  385. package/src/file/edit.native.js +4 -4
  386. package/src/file/editor.scss +3 -0
  387. package/src/file/index.php +4 -0
  388. package/src/file/save.js +1 -1
  389. package/src/footnotes/index.php +1 -1
  390. package/src/form-input/edit.js +1 -1
  391. package/src/gallery/edit.js +3 -3
  392. package/src/gallery/gallery.native.js +1 -1
  393. package/src/gallery/index.php +6 -0
  394. package/src/gallery/test/index.native.js +1 -1
  395. package/src/gallery/v1/edit.js +2 -2
  396. package/src/gallery/v1/gallery.native.js +1 -1
  397. package/src/group/editor.scss +1 -1
  398. package/src/heading/index.js +4 -3
  399. package/src/heading/index.php +4 -0
  400. package/src/heading/transforms.js +27 -8
  401. package/src/home-link/index.php +10 -0
  402. package/src/image/edit.js +13 -5
  403. package/src/image/edit.native.js +1 -1
  404. package/src/image/editor.scss +1 -0
  405. package/src/image/image.js +34 -22
  406. package/src/image/index.php +12 -1
  407. package/src/latest-comments/index.php +4 -0
  408. package/src/latest-posts/edit.native.js +1 -1
  409. package/src/latest-posts/index.php +8 -0
  410. package/src/list/ordered-list-settings.js +1 -1
  411. package/src/list-item/edit.js +1 -2
  412. package/src/list-item/edit.native.js +1 -1
  413. package/src/list-item/hooks/index.js +0 -1
  414. package/src/list-item/hooks/use-indent-list-item.js +2 -0
  415. package/src/list-item/hooks/use-outdent-list-item.js +2 -0
  416. package/src/list-item/hooks/use-space.js +16 -9
  417. package/src/list-item/index.js +3 -0
  418. package/src/loginout/index.php +4 -0
  419. package/src/media-text/block.json +5 -0
  420. package/src/media-text/edit.js +70 -19
  421. package/src/media-text/editor.scss +7 -1
  422. package/src/media-text/index.php +70 -0
  423. package/src/media-text/media-container.js +49 -9
  424. package/src/media-text/media-container.native.js +5 -3
  425. package/src/media-text/save.js +2 -2
  426. package/src/media-text/test/edit.native.js +58 -0
  427. package/src/missing/test/edit-integration.native.js +2 -1
  428. package/src/navigation/edit/index.js +68 -72
  429. package/src/navigation/edit/navigation-menu-delete-control.js +22 -49
  430. package/src/navigation/edit/navigation-menu-selector.js +39 -21
  431. package/src/navigation/edit/placeholder/index.js +4 -4
  432. package/src/navigation/edit/test/navigation-menu-selector.js +77 -55
  433. package/src/navigation/index.php +118 -34
  434. package/src/navigation/test/use-navigation-menu.js +21 -21
  435. package/src/navigation/use-navigation-menu.js +23 -9
  436. package/src/navigation-link/edit.js +12 -13
  437. package/src/navigation-link/index.php +14 -0
  438. package/src/navigation-link/link-ui.js +2 -2
  439. package/src/navigation-submenu/edit.js +4 -0
  440. package/src/navigation-submenu/index.php +8 -0
  441. package/src/page-list/index.php +12 -0
  442. package/src/page-list-item/index.php +2 -0
  443. package/src/paragraph/edit.native.js +1 -1
  444. package/src/paragraph/test/edit.native.js +36 -0
  445. package/src/pattern/edit.js +14 -0
  446. package/src/pattern/index.php +2 -0
  447. package/src/post-author/edit.js +1 -0
  448. package/src/post-author/index.php +4 -0
  449. package/src/post-author-biography/index.php +4 -0
  450. package/src/post-author-name/index.php +4 -0
  451. package/src/post-comments-form/index.php +6 -0
  452. package/src/post-content/index.php +4 -0
  453. package/src/post-date/index.php +4 -0
  454. package/src/post-excerpt/edit.js +2 -1
  455. package/src/post-excerpt/index.php +4 -0
  456. package/src/post-featured-image/block.json +6 -0
  457. package/src/post-featured-image/dimension-controls.js +4 -4
  458. package/src/post-featured-image/edit.js +14 -12
  459. package/src/post-featured-image/index.php +15 -0
  460. package/src/post-navigation-link/edit.js +2 -1
  461. package/src/post-navigation-link/index.php +4 -0
  462. package/src/post-template/index.php +6 -0
  463. package/src/post-terms/edit.js +2 -0
  464. package/src/post-terms/index.php +6 -0
  465. package/src/post-title/edit.js +49 -43
  466. package/src/post-title/index.php +2 -0
  467. package/src/query/edit/pattern-selection-modal.js +1 -1
  468. package/src/query/index.php +2 -0
  469. package/src/query/utils.js +6 -4
  470. package/src/query-no-results/index.php +4 -0
  471. package/src/query-pagination/index.php +4 -0
  472. package/src/query-pagination-next/edit.js +1 -1
  473. package/src/query-pagination-next/index.php +4 -0
  474. package/src/query-pagination-numbers/index.php +4 -0
  475. package/src/query-pagination-previous/edit.js +1 -1
  476. package/src/query-pagination-previous/index.php +4 -0
  477. package/src/query-title/index.php +4 -0
  478. package/src/quote/block.json +1 -1
  479. package/src/quote/deprecated.js +110 -15
  480. package/src/quote/edit.js +16 -10
  481. package/src/quote/save.js +2 -2
  482. package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
  483. package/src/read-more/edit.js +2 -1
  484. package/src/read-more/index.php +4 -0
  485. package/src/rss/index.php +4 -0
  486. package/src/search/edit.js +3 -1
  487. package/src/search/edit.native.js +6 -6
  488. package/src/search/index.php +20 -2
  489. package/src/search/style.scss +2 -0
  490. package/src/shortcode/index.php +4 -0
  491. package/src/site-logo/edit.js +11 -6
  492. package/src/site-logo/index.php +20 -0
  493. package/src/site-tagline/index.php +4 -0
  494. package/src/site-title/index.php +4 -0
  495. package/src/social-link/edit.js +2 -2
  496. package/src/social-link/icons/medium.js +1 -1
  497. package/src/social-link/icons/reddit.js +1 -1
  498. package/src/social-link/index.php +22 -9
  499. package/src/social-link/socials-with-bg.scss +1 -1
  500. package/src/social-link/socials-without-bg.scss +1 -1
  501. package/src/social-links/edit.native.js +1 -1
  502. package/src/spacer/edit.js +1 -1
  503. package/src/table/block.json +1 -1
  504. package/src/table/deprecated.js +308 -175
  505. package/src/table-of-contents/edit.js +1 -1
  506. package/src/tag-cloud/index.php +4 -0
  507. package/src/template-part/edit/index.js +91 -4
  508. package/src/template-part/edit/selection-modal.js +4 -8
  509. package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
  510. package/src/template-part/index.php +10 -0
  511. package/src/term-description/index.php +4 -0
  512. package/src/utils/caption.js +10 -1
  513. package/src/utils/get-transformed-metadata.js +65 -0
  514. package/src/utils/hooks.js +53 -3
  515. package/src/video/edit-common-settings.js +1 -1
  516. package/src/video/edit.js +10 -18
  517. package/src/video/edit.native.js +7 -8
  518. package/src/video/test/edit.native.js +0 -14
  519. package/tsconfig.json +1 -0
  520. package/build/list-item/hooks/use-copy.js +0 -39
  521. package/build/list-item/hooks/use-copy.js.map +0 -1
  522. package/build/site-title/edit/index.js.map +0 -1
  523. package/build-module/list-item/hooks/use-copy.js +0 -32
  524. package/build-module/list-item/hooks/use-copy.js.map +0 -1
  525. package/build-module/site-title/edit/index.js.map +0 -1
  526. package/src/list-item/hooks/use-copy.js +0 -38
  527. /package/src/site-title/{edit/index.js → edit.js} +0 -0
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
  /**
@@ -42,6 +42,25 @@ const { PARTIAL_SYNCING_SUPPORTED_BLOCKS } = unlock( patternsPrivateApis );
42
42
 
43
43
  const fullAlignments = [ 'full', 'wide', 'left', 'right' ];
44
44
 
45
+ function getLegacyIdMap( blocks, content, nameCount = {} ) {
46
+ let idToClientIdMap = {};
47
+ for ( const block of blocks ) {
48
+ if ( block?.innerBlocks?.length ) {
49
+ idToClientIdMap = {
50
+ ...idToClientIdMap,
51
+ ...getLegacyIdMap( block.innerBlocks, content, nameCount ),
52
+ };
53
+ }
54
+
55
+ const id = block.attributes.metadata?.id;
56
+ const clientId = block.clientId;
57
+ if ( id && content?.[ id ] ) {
58
+ idToClientIdMap[ clientId ] = id;
59
+ }
60
+ }
61
+ return idToClientIdMap;
62
+ }
63
+
45
64
  const useInferredLayout = ( blocks, parentLayout ) => {
46
65
  const initialInferredAlignmentRef = useRef();
47
66
 
@@ -101,25 +120,31 @@ function getOverridableAttributes( block ) {
101
120
  function applyInitialContentValuesToInnerBlocks(
102
121
  blocks,
103
122
  content = {},
104
- defaultValues
123
+ defaultValues,
124
+ legacyIdMap
105
125
  ) {
106
126
  return blocks.map( ( block ) => {
107
127
  const innerBlocks = applyInitialContentValuesToInnerBlocks(
108
128
  block.innerBlocks,
109
129
  content,
110
- defaultValues
130
+ defaultValues,
131
+ legacyIdMap
111
132
  );
112
- const blockId = block.attributes.metadata?.id;
113
- if ( ! hasOverridableAttributes( block ) || ! blockId )
133
+ const metadataName =
134
+ legacyIdMap?.[ block.clientId ] ?? block.attributes.metadata?.name;
135
+
136
+ if ( ! metadataName || ! hasOverridableAttributes( block ) ) {
114
137
  return { ...block, innerBlocks };
138
+ }
139
+
115
140
  const attributes = getOverridableAttributes( block );
116
141
  const newAttributes = { ...block.attributes };
117
142
  for ( const attributeKey of attributes ) {
118
- defaultValues[ blockId ] ??= {};
119
- defaultValues[ blockId ][ attributeKey ] =
143
+ defaultValues[ metadataName ] ??= {};
144
+ defaultValues[ metadataName ][ attributeKey ] =
120
145
  block.attributes[ attributeKey ];
121
146
 
122
- const contentValues = content[ blockId ]?.values;
147
+ const contentValues = content[ metadataName ];
123
148
  if ( contentValues?.[ attributeKey ] !== undefined ) {
124
149
  newAttributes[ attributeKey ] = contentValues[ attributeKey ];
125
150
  }
@@ -142,29 +167,40 @@ function isAttributeEqual( attribute1, attribute2 ) {
142
167
  return attribute1 === attribute2;
143
168
  }
144
169
 
145
- function getContentValuesFromInnerBlocks( blocks, defaultValues ) {
170
+ function getContentValuesFromInnerBlocks( blocks, defaultValues, legacyIdMap ) {
146
171
  /** @type {Record<string, { values: Record<string, unknown>}>} */
147
172
  const content = {};
148
173
  for ( const block of blocks ) {
149
174
  if ( block.name === patternBlockName ) continue;
150
- Object.assign(
151
- content,
152
- getContentValuesFromInnerBlocks( block.innerBlocks, defaultValues )
153
- );
154
- const blockId = block.attributes.metadata?.id;
155
- if ( ! hasOverridableAttributes( block ) || ! blockId ) continue;
175
+ if ( block.innerBlocks.length ) {
176
+ Object.assign(
177
+ content,
178
+ getContentValuesFromInnerBlocks(
179
+ block.innerBlocks,
180
+ defaultValues,
181
+ legacyIdMap
182
+ )
183
+ );
184
+ }
185
+ const metadataName =
186
+ legacyIdMap?.[ block.clientId ] ?? block.attributes.metadata?.name;
187
+ if ( ! metadataName || ! hasOverridableAttributes( block ) ) {
188
+ continue;
189
+ }
190
+
156
191
  const attributes = getOverridableAttributes( block );
192
+
157
193
  for ( const attributeKey of attributes ) {
158
194
  if (
159
195
  ! isAttributeEqual(
160
196
  block.attributes[ attributeKey ],
161
- defaultValues[ blockId ][ attributeKey ]
197
+ defaultValues?.[ metadataName ]?.[ attributeKey ]
162
198
  )
163
199
  ) {
164
- content[ blockId ] ??= { values: {}, blockName: block.name };
200
+ content[ metadataName ] ??= {};
165
201
  // TODO: We need a way to represent `undefined` in the serialized overrides.
166
202
  // Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
167
- content[ blockId ].values[ attributeKey ] =
203
+ content[ metadataName ][ attributeKey ] =
168
204
  block.attributes[ attributeKey ] === undefined
169
205
  ? // TODO: We use an empty string to represent undefined for now until
170
206
  // we support a richer format for overrides and the block binding API.
@@ -229,6 +265,7 @@ export default function ReusableBlockEdit( {
229
265
  getBlockEditingMode,
230
266
  onNavigateToEntityRecord,
231
267
  editingMode,
268
+ hasPatternOverridesSource,
232
269
  } = useSelect(
233
270
  ( select ) => {
234
271
  const { canUser } = select( coreStore );
@@ -237,6 +274,7 @@ export default function ReusableBlockEdit( {
237
274
  getSettings,
238
275
  getBlockEditingMode: _getBlockEditingMode,
239
276
  } = select( blockEditorStore );
277
+ const { getBlockBindingsSource } = unlock( select( blocksStore ) );
240
278
  const blocks = getBlocks( patternClientId );
241
279
  const canEdit = canUser( 'update', 'blocks', ref );
242
280
 
@@ -248,6 +286,9 @@ export default function ReusableBlockEdit( {
248
286
  onNavigateToEntityRecord:
249
287
  getSettings().onNavigateToEntityRecord,
250
288
  editingMode: _getBlockEditingMode( patternClientId ),
289
+ hasPatternOverridesSource: !! getBlockBindingsSource(
290
+ 'core/pattern-overrides'
291
+ ),
251
292
  };
252
293
  },
253
294
  [ patternClientId, ref ]
@@ -259,13 +300,20 @@ export default function ReusableBlockEdit( {
259
300
  setBlockEditingMode,
260
301
  innerBlocks,
261
302
  // Disable editing if the pattern itself is disabled.
262
- editingMode === 'disabled' ? 'disabled' : undefined
303
+ editingMode === 'disabled' || ! hasPatternOverridesSource
304
+ ? 'disabled'
305
+ : undefined
263
306
  );
264
- }, [ editingMode, innerBlocks, setBlockEditingMode ] );
307
+ }, [
308
+ editingMode,
309
+ innerBlocks,
310
+ setBlockEditingMode,
311
+ hasPatternOverridesSource,
312
+ ] );
265
313
 
266
314
  const canOverrideBlocks = useMemo(
267
- () => hasOverridableBlocks( innerBlocks ),
268
- [ innerBlocks ]
315
+ () => hasPatternOverridesSource && hasOverridableBlocks( innerBlocks ),
316
+ [ hasPatternOverridesSource, innerBlocks ]
269
317
  );
270
318
 
271
319
  const initialBlocks = useMemo(
@@ -278,26 +326,36 @@ export default function ReusableBlockEdit( {
278
326
  [ editedRecord.blocks, editedRecord.content ]
279
327
  );
280
328
 
329
+ const legacyIdMap = useRef( {} );
330
+
281
331
  // Apply the initial overrides from the pattern block to the inner blocks.
282
332
  useEffect( () => {
333
+ // Build a map of clientIds to the old nano id system to provide back compat.
334
+ legacyIdMap.current = getLegacyIdMap(
335
+ initialBlocks,
336
+ initialContent.current
337
+ );
283
338
  defaultContent.current = {};
284
339
  const originalEditingMode = getBlockEditingMode( patternClientId );
285
340
  // Replace the contents of the blocks with the overrides.
286
341
  registry.batch( () => {
287
342
  setBlockEditingMode( patternClientId, 'default' );
288
343
  syncDerivedUpdates( () => {
289
- replaceInnerBlocks(
290
- patternClientId,
291
- applyInitialContentValuesToInnerBlocks(
292
- initialBlocks,
293
- initialContent.current,
294
- defaultContent.current
295
- )
296
- );
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 );
297
354
  } );
298
355
  setBlockEditingMode( patternClientId, originalEditingMode );
299
356
  } );
300
357
  }, [
358
+ hasPatternOverridesSource,
301
359
  __unstableMarkNextChangeAsNotPersistent,
302
360
  patternClientId,
303
361
  initialBlocks,
@@ -333,6 +391,9 @@ export default function ReusableBlockEdit( {
333
391
  // Sync the `content` attribute from the updated blocks to the pattern block.
334
392
  // `syncDerivedUpdates` is used here to avoid creating an additional undo level.
335
393
  useEffect( () => {
394
+ if ( ! hasPatternOverridesSource ) {
395
+ return;
396
+ }
336
397
  const { getBlocks } = registry.select( blockEditorStore );
337
398
  let prevBlocks = getBlocks( patternClientId );
338
399
  return registry.subscribe( () => {
@@ -343,13 +404,20 @@ export default function ReusableBlockEdit( {
343
404
  setAttributes( {
344
405
  content: getContentValuesFromInnerBlocks(
345
406
  blocks,
346
- defaultContent.current
407
+ defaultContent.current,
408
+ legacyIdMap.current
347
409
  ),
348
410
  } );
349
411
  } );
350
412
  }
351
413
  }, blockEditorStore );
352
- }, [ syncDerivedUpdates, patternClientId, registry, setAttributes ] );
414
+ }, [
415
+ hasPatternOverridesSource,
416
+ syncDerivedUpdates,
417
+ patternClientId,
418
+ registry,
419
+ setAttributes,
420
+ ] );
353
421
 
354
422
  const handleEditOriginal = () => {
355
423
  onNavigateToEntityRecord( {
@@ -8,6 +8,10 @@
8
8
  /**
9
9
  * Renders the `core/block` block on server.
10
10
  *
11
+ * @since 5.0.0
12
+ *
13
+ * @global WP_Embed $wp_embed
14
+ *
11
15
  * @param array $attributes The block attributes.
12
16
  *
13
17
  * @return string Rendered HTML of the referenced block.
@@ -46,26 +50,35 @@ function render_block_core_block( $attributes ) {
46
50
  $content = $wp_embed->run_shortcode( $reusable_block->post_content );
47
51
  $content = $wp_embed->autoembed( $content );
48
52
 
49
- // Back compat, the content attribute was previously named overrides and
50
- // had a slightly different format. For blocks that have not been migrated,
51
- // also convert the format here so that the provided `pattern/overrides`
52
- // context is correct.
53
- if ( isset( $attributes['overrides'] ) && ! isset( $attributes['content'] ) ) {
54
- $migrated_content = array();
55
- foreach ( $attributes['overrides'] as $id => $values ) {
56
- $migrated_content[ $id ] = array(
57
- 'values' => $values,
58
- );
53
+ // Back compat.
54
+ // For blocks that have not been migrated in the editor, add some back compat
55
+ // so that front-end rendering continues to work.
56
+
57
+ // This matches the `v2` deprecation. Removes the inner `values` property
58
+ // from every item.
59
+ if ( isset( $attributes['content'] ) ) {
60
+ foreach ( $attributes['content'] as &$content_data ) {
61
+ if ( isset( $content_data['values'] ) ) {
62
+ $is_assoc_array = is_array( $content_data['values'] ) && ! wp_is_numeric_array( $content_data['values'] );
63
+
64
+ if ( $is_assoc_array ) {
65
+ $content_data = $content_data['values'];
66
+ }
67
+ }
59
68
  }
60
- $attributes['content'] = $migrated_content;
61
69
  }
62
- $has_pattern_overrides = isset( $attributes['content'] );
70
+
71
+ // This matches the `v1` deprecation. Rename `overrides` to `content`.
72
+ if ( isset( $attributes['overrides'] ) && ! isset( $attributes['content'] ) ) {
73
+ $attributes['content'] = $attributes['overrides'];
74
+ }
63
75
 
64
76
  /**
65
77
  * We set the `pattern/overrides` context through the `render_block_context`
66
78
  * filter so that it is available when a pattern's inner blocks are
67
79
  * rendering via do_blocks given it only receives the inner content.
68
80
  */
81
+ $has_pattern_overrides = isset( $attributes['content'] );
69
82
  if ( $has_pattern_overrides ) {
70
83
  $filter_block_context = static function ( $context ) use ( $attributes ) {
71
84
  $context['pattern/overrides'] = $attributes['content'];
@@ -86,6 +99,8 @@ function render_block_core_block( $attributes ) {
86
99
 
87
100
  /**
88
101
  * Registers the `core/block` block.
102
+ *
103
+ * @since 5.3.0
89
104
  */
90
105
  function register_block_core_block() {
91
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
  } );
@@ -45,6 +45,7 @@ import {
45
45
  createBlock,
46
46
  cloneBlock,
47
47
  getDefaultBlockName,
48
+ store as blocksStore,
48
49
  } from '@wordpress/blocks';
49
50
  import { useMergeRefs, useRefEffect } from '@wordpress/compose';
50
51
  import { useSelect, useDispatch } from '@wordpress/data';
@@ -123,7 +124,7 @@ function WidthPanel( { selectedWidth, setAttributes } ) {
123
124
  }
124
125
 
125
126
  return (
126
- <PanelBody title={ __( 'Width settings' ) }>
127
+ <PanelBody title={ __( 'Settings' ) }>
127
128
  <ButtonGroup aria-label={ __( 'Button width' ) }>
128
129
  { [ 25, 50, 75, 100 ].map( ( widthValue ) => {
129
130
  return (
@@ -239,7 +240,7 @@ function ButtonEdit( props ) {
239
240
  }
240
241
 
241
242
  const blockBindingsSource = unlock(
242
- select( blockEditorStore )
243
+ select( blocksStore )
243
244
  ).getBlockBindingsSource( metadata?.bindings?.url?.source );
244
245
 
245
246
  return {
@@ -328,7 +329,7 @@ function ButtonEdit( props ) {
328
329
  title={ __( 'Unlink' ) }
329
330
  shortcut={ displayShortcut.primaryShift( 'k' ) }
330
331
  onClick={ unlink }
331
- isActive={ true }
332
+ isActive
332
333
  />
333
334
  ) }
334
335
  </BlockControls>
@@ -106,7 +106,7 @@ export default function ButtonsEdit( {
106
106
  const renderFooterAppender = useRef( () => (
107
107
  <View style={ styles.appenderContainer }>
108
108
  <InnerBlocks.ButtonBlockAppender
109
- isFloating={ true }
109
+ isFloating
110
110
  onAddBlock={ onAddNextButton }
111
111
  />
112
112
  </View>
@@ -4,6 +4,11 @@
4
4
  import { createBlock } from '@wordpress/blocks';
5
5
  import { __unstableCreateElement as createElement } from '@wordpress/rich-text';
6
6
 
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { getTransformedMetadata } from '../utils/get-transformed-metadata';
11
+
7
12
  const transforms = {
8
13
  from: [
9
14
  {
@@ -33,10 +38,8 @@ const transforms = {
33
38
  {},
34
39
  // Loop the selected buttons.
35
40
  buttons.map( ( attributes ) => {
36
- const element = createElement(
37
- document,
38
- attributes.content
39
- );
41
+ const { content, metadata } = attributes;
42
+ const element = createElement( document, content );
40
43
  // Remove any HTML tags.
41
44
  const text = element.innerText || '';
42
45
  // Get first url.
@@ -46,6 +49,13 @@ const transforms = {
46
49
  return createBlock( 'core/button', {
47
50
  text,
48
51
  url,
52
+ metadata: getTransformedMetadata(
53
+ metadata,
54
+ 'core/button',
55
+ ( { content: contentBinding } ) => ( {
56
+ text: contentBinding,
57
+ } )
58
+ ),
49
59
  } );
50
60
  } )
51
61
  ),
@@ -8,6 +8,11 @@
8
8
  /**
9
9
  * Renders the `core/calendar` block on server.
10
10
  *
11
+ * @since 5.2.0
12
+ *
13
+ * @global int $monthnum.
14
+ * @global int $year.
15
+ *
11
16
  * @param array $attributes The block attributes.
12
17
  *
13
18
  * @return string Returns the block content.
@@ -76,6 +81,8 @@ function render_block_core_calendar( $attributes ) {
76
81
 
77
82
  /**
78
83
  * Registers the `core/calendar` block on server.
84
+ *
85
+ * @since 5.2.0
79
86
  */
80
87
  function register_block_core_calendar() {
81
88
  register_block_type_from_metadata(
@@ -94,6 +101,8 @@ add_action( 'init', 'register_block_core_calendar' );
94
101
  * Used to hide the calendar block when there are no published posts.
95
102
  * This compensates for a known Core bug: https://core.trac.wordpress.org/ticket/12016
96
103
  *
104
+ * @since 5.9.0
105
+ *
97
106
  * @return bool Has any published posts or not.
98
107
  */
99
108
  function block_core_calendar_has_published_posts() {
@@ -117,6 +126,10 @@ function block_core_calendar_has_published_posts() {
117
126
  * Queries the database for any published post and saves
118
127
  * a flag whether any published post exists or not.
119
128
  *
129
+ * @since 5.9.0
130
+ *
131
+ * @global wpdb $wpdb WordPress database abstraction object.
132
+ *
120
133
  * @return bool Has any published posts or not.
121
134
  */
122
135
  function block_core_calendar_update_has_published_posts() {
@@ -132,6 +145,8 @@ if ( ! is_multisite() ) {
132
145
  /**
133
146
  * Handler for updating the has published posts flag when a post is deleted.
134
147
  *
148
+ * @since 5.9.0
149
+ *
135
150
  * @param int $post_id Deleted post ID.
136
151
  */
137
152
  function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
@@ -147,6 +162,8 @@ if ( ! is_multisite() ) {
147
162
  /**
148
163
  * Handler for updating the has published posts flag when a post status changes.
149
164
  *
165
+ * @since 5.9.0
166
+ *
150
167
  * @param string $new_status The status the post is changing to.
151
168
  * @param string $old_status The status the post is changing from.
152
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
  );
@@ -4,6 +4,11 @@
4
4
  import { createBlock } from '@wordpress/blocks';
5
5
  import { create, toHTMLString } from '@wordpress/rich-text';
6
6
 
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { getTransformedMetadata } from '../utils/get-transformed-metadata';
11
+
7
12
  const transforms = {
8
13
  from: [
9
14
  {
@@ -14,17 +19,21 @@ const transforms = {
14
19
  {
15
20
  type: 'block',
16
21
  blocks: [ 'core/paragraph' ],
17
- transform: ( { content } ) =>
18
- createBlock( 'core/code', { content } ),
22
+ transform: ( { content, metadata } ) =>
23
+ createBlock( 'core/code', {
24
+ content,
25
+ metadata: getTransformedMetadata( metadata, 'core/code' ),
26
+ } ),
19
27
  },
20
28
  {
21
29
  type: 'block',
22
30
  blocks: [ 'core/html' ],
23
- transform: ( { content: text } ) => {
31
+ transform: ( { content: text, metadata } ) => {
24
32
  return createBlock( 'core/code', {
25
33
  // The HTML is plain text (with plain line breaks), so
26
34
  // convert it to rich text.
27
35
  content: toHTMLString( { value: create( { text } ) } ),
36
+ metadata: getTransformedMetadata( metadata, 'core/code' ),
28
37
  } );
29
38
  },
30
39
  },
@@ -51,8 +60,14 @@ const transforms = {
51
60
  {
52
61
  type: 'block',
53
62
  blocks: [ 'core/paragraph' ],
54
- transform: ( { content } ) =>
55
- createBlock( 'core/paragraph', { content } ),
63
+ transform: ( { content, metadata } ) =>
64
+ createBlock( 'core/paragraph', {
65
+ content,
66
+ metadata: getTransformedMetadata(
67
+ metadata,
68
+ 'core/paragraph'
69
+ ),
70
+ } ),
56
71
  },
57
72
  ],
58
73
  };
@@ -139,18 +139,19 @@ function ColumnsEditContainer( { attributes, setAttributes, clientId } ) {
139
139
  // If adding a new column, assign width to the new column equal to
140
140
  // as if it were `1 / columns` of the total available space.
141
141
  const newColumnWidth = toWidthPrecision( 100 / newColumns );
142
+ const newlyAddedColumns = newColumns - previousColumns;
142
143
 
143
144
  // Redistribute in consideration of pending block insertion as
144
145
  // constraining the available working width.
145
146
  const widths = getRedistributedColumnWidths(
146
147
  innerBlocks,
147
- 100 - newColumnWidth
148
+ 100 - newColumnWidth * newlyAddedColumns
148
149
  );
149
150
 
150
151
  innerBlocks = [
151
152
  ...getMappedColumnWidths( innerBlocks, widths ),
152
153
  ...Array.from( {
153
- length: newColumns - previousColumns,
154
+ length: newlyAddedColumns,
154
155
  } ).map( () => {
155
156
  return createBlock( 'core/column', {
156
157
  width: `${ newColumnWidth }%`,
@@ -48,7 +48,7 @@ export default function Edit( {
48
48
 
49
49
  const inspectorControls = (
50
50
  <InspectorControls>
51
- <PanelBody title={ __( 'Avatar Settings' ) }>
51
+ <PanelBody title={ __( 'Settings' ) }>
52
52
  <RangeControl
53
53
  __nextHasNoMarginBottom
54
54
  __next40pxDefaultSize