@wordpress/block-library 7.12.0 → 7.12.2-next.d6164808d3.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 (626) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/build/archives/index.js +5 -1
  3. package/build/archives/index.js.map +1 -1
  4. package/build/audio/index.js +4 -0
  5. package/build/audio/index.js.map +1 -1
  6. package/build/button/deprecated.js +14 -5
  7. package/build/button/deprecated.js.map +1 -1
  8. package/build/button/index.js +1 -1
  9. package/build/categories/edit.js +3 -1
  10. package/build/categories/edit.js.map +1 -1
  11. package/build/categories/index.js +14 -1
  12. package/build/categories/index.js.map +1 -1
  13. package/build/code/index.js +4 -2
  14. package/build/code/index.js.map +1 -1
  15. package/build/column/index.js +13 -0
  16. package/build/column/index.js.map +1 -1
  17. package/build/columns/deprecated.js +16 -5
  18. package/build/columns/deprecated.js.map +1 -1
  19. package/build/columns/edit.js +6 -2
  20. package/build/columns/edit.js.map +1 -1
  21. package/build/columns/edit.native.js +6 -2
  22. package/build/columns/edit.native.js.map +1 -1
  23. package/build/columns/index.js +13 -0
  24. package/build/columns/index.js.map +1 -1
  25. package/build/comment-author-name/index.js +5 -1
  26. package/build/comment-author-name/index.js.map +1 -1
  27. package/build/comment-content/index.js +5 -1
  28. package/build/comment-content/index.js.map +1 -1
  29. package/build/comment-date/index.js +1 -0
  30. package/build/comment-date/index.js.map +1 -1
  31. package/build/comment-edit-link/index.js +5 -1
  32. package/build/comment-edit-link/index.js.map +1 -1
  33. package/build/comment-reply-link/index.js +5 -1
  34. package/build/comment-reply-link/index.js.map +1 -1
  35. package/build/comment-template/index.js +14 -1
  36. package/build/comment-template/index.js.map +1 -1
  37. package/build/comments/index.js +13 -0
  38. package/build/comments/index.js.map +1 -1
  39. package/build/comments-pagination/index.js +13 -0
  40. package/build/comments-pagination/index.js.map +1 -1
  41. package/build/comments-pagination-next/index.js +4 -2
  42. package/build/comments-pagination-next/index.js.map +1 -1
  43. package/build/comments-pagination-numbers/edit.js +5 -1
  44. package/build/comments-pagination-numbers/edit.js.map +1 -1
  45. package/build/comments-pagination-numbers/index.js +14 -1
  46. package/build/comments-pagination-numbers/index.js.map +1 -1
  47. package/build/comments-pagination-previous/index.js +4 -2
  48. package/build/comments-pagination-previous/index.js.map +1 -1
  49. package/build/comments-title/deprecated.js +4 -2
  50. package/build/comments-title/deprecated.js.map +1 -1
  51. package/build/comments-title/index.js +4 -2
  52. package/build/comments-title/index.js.map +1 -1
  53. package/build/cover/deprecated.js +20 -5
  54. package/build/cover/deprecated.js.map +1 -1
  55. package/build/cover/index.js +13 -0
  56. package/build/cover/index.js.map +1 -1
  57. package/build/cover/shared.js +1 -1
  58. package/build/cover/shared.js.map +1 -1
  59. package/build/embed/icons.js +1 -1
  60. package/build/embed/icons.js.map +1 -1
  61. package/build/gallery/deprecated.js +6 -1
  62. package/build/gallery/deprecated.js.map +1 -1
  63. package/build/gallery/edit.js +15 -2
  64. package/build/gallery/edit.js.map +1 -1
  65. package/build/gallery/index.js +5 -0
  66. package/build/gallery/index.js.map +1 -1
  67. package/build/gallery/transforms.js +20 -7
  68. package/build/gallery/transforms.js.map +1 -1
  69. package/build/gallery/utils.js +7 -6
  70. package/build/gallery/utils.js.map +1 -1
  71. package/build/group/deprecated.js +108 -12
  72. package/build/group/deprecated.js.map +1 -1
  73. package/build/group/edit.js +23 -1
  74. package/build/group/edit.js.map +1 -1
  75. package/build/group/index.js +10 -2
  76. package/build/group/index.js.map +1 -1
  77. package/build/group/variations.js +8 -8
  78. package/build/group/variations.js.map +1 -1
  79. package/build/heading/deprecated.js +5 -3
  80. package/build/heading/deprecated.js.map +1 -1
  81. package/build/heading/index.js +3 -1
  82. package/build/heading/index.js.map +1 -1
  83. package/build/heading/transforms.js +3 -1
  84. package/build/heading/transforms.js.map +1 -1
  85. package/build/home-link/edit.js +8 -4
  86. package/build/home-link/edit.js.map +1 -1
  87. package/build/image/edit.js +13 -1
  88. package/build/image/edit.js.map +1 -1
  89. package/build/image/index.js +13 -7
  90. package/build/image/index.js.map +1 -1
  91. package/build/index.native.js +6 -3
  92. package/build/index.native.js.map +1 -1
  93. package/build/list-item/edit.js +3 -1
  94. package/build/list-item/edit.js.map +1 -1
  95. package/build/list-item/hooks/index.js +8 -0
  96. package/build/list-item/hooks/index.js.map +1 -1
  97. package/build/list-item/hooks/use-copy.js +42 -0
  98. package/build/list-item/hooks/use-copy.js.map +1 -0
  99. package/build/list-item/list-style-type.native.js +4 -1
  100. package/build/list-item/list-style-type.native.js.map +1 -1
  101. package/build/media-text/deprecated.js +5 -1
  102. package/build/media-text/deprecated.js.map +1 -1
  103. package/build/media-text/index.js +13 -0
  104. package/build/media-text/index.js.map +1 -1
  105. package/build/navigation/deprecated.js +6 -1
  106. package/build/navigation/deprecated.js.map +1 -1
  107. package/build/navigation/edit/index.js +119 -38
  108. package/build/navigation/edit/index.js.map +1 -1
  109. package/build/navigation/edit/unsaved-inner-blocks.js +2 -1
  110. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  111. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -7
  112. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  113. package/build/navigation/menu-items-to-blocks.js +1 -7
  114. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  115. package/build/navigation/use-navigation-menu.js +8 -7
  116. package/build/navigation/use-navigation-menu.js.map +1 -1
  117. package/build/navigation-link/edit.js +6 -8
  118. package/build/navigation-link/edit.js.map +1 -1
  119. package/build/navigation-submenu/edit.js +4 -6
  120. package/build/navigation-submenu/edit.js.map +1 -1
  121. package/build/page-list/edit.js +7 -3
  122. package/build/page-list/edit.js.map +1 -1
  123. package/build/paragraph/deprecated.js +18 -10
  124. package/build/paragraph/deprecated.js.map +1 -1
  125. package/build/paragraph/edit.js +1 -0
  126. package/build/paragraph/edit.js.map +1 -1
  127. package/build/paragraph/index.js +5 -0
  128. package/build/paragraph/index.js.map +1 -1
  129. package/build/paragraph/transforms.js +5 -0
  130. package/build/paragraph/transforms.js.map +1 -1
  131. package/build/post-author/index.js +4 -2
  132. package/build/post-author/index.js.map +1 -1
  133. package/build/post-author-biography/index.js +1 -0
  134. package/build/post-author-biography/index.js.map +1 -1
  135. package/build/post-author-name/index.js +5 -1
  136. package/build/post-author-name/index.js.map +1 -1
  137. package/build/post-comments-count/edit.js +11 -1
  138. package/build/post-comments-count/edit.js.map +1 -1
  139. package/build/post-comments-count/index.js +4 -1
  140. package/build/post-comments-count/index.js.map +1 -1
  141. package/build/post-comments-link/index.js +4 -2
  142. package/build/post-comments-link/index.js.map +1 -1
  143. package/build/post-date/edit.js +9 -2
  144. package/build/post-date/edit.js.map +1 -1
  145. package/build/post-date/index.js +9 -0
  146. package/build/post-date/index.js.map +1 -1
  147. package/build/post-featured-image/edit.js +27 -12
  148. package/build/post-featured-image/edit.js.map +1 -1
  149. package/build/post-featured-image/index.js +12 -0
  150. package/build/post-featured-image/index.js.map +1 -1
  151. package/build/post-navigation-link/index.js +3 -2
  152. package/build/post-navigation-link/index.js.map +1 -1
  153. package/build/post-template/edit.js +8 -4
  154. package/build/post-template/edit.js.map +1 -1
  155. package/build/post-template/index.js +14 -1
  156. package/build/post-template/index.js.map +1 -1
  157. package/build/post-terms/index.js +5 -3
  158. package/build/post-terms/index.js.map +1 -1
  159. package/build/post-title/index.js +2 -1
  160. package/build/post-title/index.js.map +1 -1
  161. package/build/preformatted/index.js +4 -2
  162. package/build/preformatted/index.js.map +1 -1
  163. package/build/pullquote/deprecated.js +135 -25
  164. package/build/pullquote/deprecated.js.map +1 -1
  165. package/build/pullquote/edit.js +1 -1
  166. package/build/pullquote/edit.js.map +1 -1
  167. package/build/pullquote/edit.native.js +0 -1
  168. package/build/pullquote/edit.native.js.map +1 -1
  169. package/build/pullquote/index.js +13 -6
  170. package/build/pullquote/index.js.map +1 -1
  171. package/build/pullquote/save.js +2 -2
  172. package/build/pullquote/save.js.map +1 -1
  173. package/build/pullquote/transforms.js +14 -33
  174. package/build/pullquote/transforms.js.map +1 -1
  175. package/build/query/deprecated.js +10 -9
  176. package/build/query/deprecated.js.map +1 -1
  177. package/build/query/edit/index.js +19 -8
  178. package/build/query/edit/index.js.map +1 -1
  179. package/build/query/edit/inspector-controls/taxonomy-controls.js +1 -0
  180. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  181. package/build/query/edit/query-placeholder.js +6 -1
  182. package/build/query/edit/query-placeholder.js.map +1 -1
  183. package/build/query/utils.js +35 -9
  184. package/build/query/utils.js.map +1 -1
  185. package/build/query-no-results/edit.js +1 -1
  186. package/build/query-no-results/edit.js.map +1 -1
  187. package/build/query-title/edit.js +10 -1
  188. package/build/query-title/edit.js.map +1 -1
  189. package/build/query-title/index.js +7 -2
  190. package/build/query-title/index.js.map +1 -1
  191. package/build/quote/deprecated.js +13 -6
  192. package/build/quote/deprecated.js.map +1 -1
  193. package/build/quote/transforms.js +22 -37
  194. package/build/quote/transforms.js.map +1 -1
  195. package/build/separator/deprecated.js +3 -4
  196. package/build/separator/deprecated.js.map +1 -1
  197. package/build/separator/index.js +1 -0
  198. package/build/separator/index.js.map +1 -1
  199. package/build/social-link/icons/reddit.js +1 -1
  200. package/build/social-link/icons/reddit.js.map +1 -1
  201. package/build/social-links/edit.js +2 -1
  202. package/build/social-links/edit.js.map +1 -1
  203. package/build/spacer/index.js +7 -1
  204. package/build/spacer/index.js.map +1 -1
  205. package/build/table/index.js +4 -0
  206. package/build/table/index.js.map +1 -1
  207. package/build/table/state.js +9 -3
  208. package/build/table/state.js.map +1 -1
  209. package/build/table-of-contents/index.js +11 -1
  210. package/build/table-of-contents/index.js.map +1 -1
  211. package/build/tag-cloud/index.js +5 -1
  212. package/build/tag-cloud/index.js.map +1 -1
  213. package/build/template-part/index.js +2 -2
  214. package/build/template-part/index.js.map +1 -1
  215. package/build/term-description/index.js +4 -0
  216. package/build/term-description/index.js.map +1 -1
  217. package/build/text-columns/edit.js +3 -1
  218. package/build/text-columns/edit.js.map +1 -1
  219. package/build/text-columns/save.js +3 -1
  220. package/build/text-columns/save.js.map +1 -1
  221. package/build/verse/index.js +1 -0
  222. package/build/verse/index.js.map +1 -1
  223. package/build/video/index.js +4 -0
  224. package/build/video/index.js.map +1 -1
  225. package/build-module/archives/index.js +5 -1
  226. package/build-module/archives/index.js.map +1 -1
  227. package/build-module/audio/index.js +4 -0
  228. package/build-module/audio/index.js.map +1 -1
  229. package/build-module/button/deprecated.js +14 -4
  230. package/build-module/button/deprecated.js.map +1 -1
  231. package/build-module/button/index.js +1 -1
  232. package/build-module/categories/edit.js +4 -2
  233. package/build-module/categories/edit.js.map +1 -1
  234. package/build-module/categories/index.js +14 -1
  235. package/build-module/categories/index.js.map +1 -1
  236. package/build-module/code/index.js +4 -2
  237. package/build-module/code/index.js.map +1 -1
  238. package/build-module/column/index.js +13 -0
  239. package/build-module/column/index.js.map +1 -1
  240. package/build-module/columns/deprecated.js +16 -4
  241. package/build-module/columns/deprecated.js.map +1 -1
  242. package/build-module/columns/edit.js +7 -3
  243. package/build-module/columns/edit.js.map +1 -1
  244. package/build-module/columns/edit.native.js +7 -3
  245. package/build-module/columns/edit.native.js.map +1 -1
  246. package/build-module/columns/index.js +13 -0
  247. package/build-module/columns/index.js.map +1 -1
  248. package/build-module/comment-author-name/index.js +5 -1
  249. package/build-module/comment-author-name/index.js.map +1 -1
  250. package/build-module/comment-content/index.js +5 -1
  251. package/build-module/comment-content/index.js.map +1 -1
  252. package/build-module/comment-date/index.js +1 -0
  253. package/build-module/comment-date/index.js.map +1 -1
  254. package/build-module/comment-edit-link/index.js +5 -1
  255. package/build-module/comment-edit-link/index.js.map +1 -1
  256. package/build-module/comment-reply-link/index.js +5 -1
  257. package/build-module/comment-reply-link/index.js.map +1 -1
  258. package/build-module/comment-template/index.js +14 -1
  259. package/build-module/comment-template/index.js.map +1 -1
  260. package/build-module/comments/index.js +13 -0
  261. package/build-module/comments/index.js.map +1 -1
  262. package/build-module/comments-pagination/index.js +13 -0
  263. package/build-module/comments-pagination/index.js.map +1 -1
  264. package/build-module/comments-pagination-next/index.js +4 -2
  265. package/build-module/comments-pagination-next/index.js.map +1 -1
  266. package/build-module/comments-pagination-numbers/edit.js +5 -1
  267. package/build-module/comments-pagination-numbers/edit.js.map +1 -1
  268. package/build-module/comments-pagination-numbers/index.js +14 -1
  269. package/build-module/comments-pagination-numbers/index.js.map +1 -1
  270. package/build-module/comments-pagination-previous/index.js +4 -2
  271. package/build-module/comments-pagination-previous/index.js.map +1 -1
  272. package/build-module/comments-title/deprecated.js +4 -2
  273. package/build-module/comments-title/deprecated.js.map +1 -1
  274. package/build-module/comments-title/index.js +4 -2
  275. package/build-module/comments-title/index.js.map +1 -1
  276. package/build-module/cover/deprecated.js +20 -4
  277. package/build-module/cover/deprecated.js.map +1 -1
  278. package/build-module/cover/index.js +13 -0
  279. package/build-module/cover/index.js.map +1 -1
  280. package/build-module/cover/shared.js +1 -1
  281. package/build-module/cover/shared.js.map +1 -1
  282. package/build-module/embed/icons.js +1 -1
  283. package/build-module/embed/icons.js.map +1 -1
  284. package/build-module/gallery/deprecated.js +7 -2
  285. package/build-module/gallery/deprecated.js.map +1 -1
  286. package/build-module/gallery/edit.js +15 -2
  287. package/build-module/gallery/edit.js.map +1 -1
  288. package/build-module/gallery/index.js +5 -0
  289. package/build-module/gallery/index.js.map +1 -1
  290. package/build-module/gallery/transforms.js +20 -7
  291. package/build-module/gallery/transforms.js.map +1 -1
  292. package/build-module/gallery/utils.js +7 -6
  293. package/build-module/gallery/utils.js.map +1 -1
  294. package/build-module/group/deprecated.js +109 -12
  295. package/build-module/group/deprecated.js.map +1 -1
  296. package/build-module/group/edit.js +25 -2
  297. package/build-module/group/edit.js.map +1 -1
  298. package/build-module/group/index.js +10 -2
  299. package/build-module/group/index.js.map +1 -1
  300. package/build-module/group/variations.js +8 -8
  301. package/build-module/group/variations.js.map +1 -1
  302. package/build-module/heading/deprecated.js +5 -2
  303. package/build-module/heading/deprecated.js.map +1 -1
  304. package/build-module/heading/index.js +3 -1
  305. package/build-module/heading/index.js.map +1 -1
  306. package/build-module/heading/transforms.js +3 -1
  307. package/build-module/heading/transforms.js.map +1 -1
  308. package/build-module/home-link/edit.js +10 -6
  309. package/build-module/home-link/edit.js.map +1 -1
  310. package/build-module/image/edit.js +14 -2
  311. package/build-module/image/edit.js.map +1 -1
  312. package/build-module/image/index.js +13 -7
  313. package/build-module/image/index.js.map +1 -1
  314. package/build-module/index.native.js +6 -2
  315. package/build-module/index.native.js.map +1 -1
  316. package/build-module/list-item/edit.js +4 -2
  317. package/build-module/list-item/edit.js.map +1 -1
  318. package/build-module/list-item/hooks/index.js +1 -0
  319. package/build-module/list-item/hooks/index.js.map +1 -1
  320. package/build-module/list-item/hooks/use-copy.js +32 -0
  321. package/build-module/list-item/hooks/use-copy.js.map +1 -0
  322. package/build-module/list-item/list-style-type.native.js +3 -1
  323. package/build-module/list-item/list-style-type.native.js.map +1 -1
  324. package/build-module/media-text/deprecated.js +6 -2
  325. package/build-module/media-text/deprecated.js.map +1 -1
  326. package/build-module/media-text/index.js +13 -0
  327. package/build-module/media-text/index.js.map +1 -1
  328. package/build-module/navigation/deprecated.js +7 -2
  329. package/build-module/navigation/deprecated.js.map +1 -1
  330. package/build-module/navigation/edit/index.js +120 -40
  331. package/build-module/navigation/edit/index.js.map +1 -1
  332. package/build-module/navigation/edit/unsaved-inner-blocks.js +2 -1
  333. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  334. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -7
  335. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  336. package/build-module/navigation/menu-items-to-blocks.js +1 -6
  337. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  338. package/build-module/navigation/use-navigation-menu.js +8 -7
  339. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  340. package/build-module/navigation-link/edit.js +7 -9
  341. package/build-module/navigation-link/edit.js.map +1 -1
  342. package/build-module/navigation-submenu/edit.js +5 -7
  343. package/build-module/navigation-submenu/edit.js.map +1 -1
  344. package/build-module/page-list/edit.js +7 -2
  345. package/build-module/page-list/edit.js.map +1 -1
  346. package/build-module/paragraph/deprecated.js +18 -9
  347. package/build-module/paragraph/deprecated.js.map +1 -1
  348. package/build-module/paragraph/edit.js +1 -0
  349. package/build-module/paragraph/edit.js.map +1 -1
  350. package/build-module/paragraph/index.js +5 -0
  351. package/build-module/paragraph/index.js.map +1 -1
  352. package/build-module/paragraph/transforms.js +5 -0
  353. package/build-module/paragraph/transforms.js.map +1 -1
  354. package/build-module/post-author/index.js +4 -2
  355. package/build-module/post-author/index.js.map +1 -1
  356. package/build-module/post-author-biography/index.js +1 -0
  357. package/build-module/post-author-biography/index.js.map +1 -1
  358. package/build-module/post-author-name/index.js +5 -1
  359. package/build-module/post-author-name/index.js.map +1 -1
  360. package/build-module/post-comments-count/edit.js +10 -1
  361. package/build-module/post-comments-count/edit.js.map +1 -1
  362. package/build-module/post-comments-count/index.js +4 -1
  363. package/build-module/post-comments-count/index.js.map +1 -1
  364. package/build-module/post-comments-link/index.js +4 -2
  365. package/build-module/post-comments-link/index.js.map +1 -1
  366. package/build-module/post-date/edit.js +9 -2
  367. package/build-module/post-date/edit.js.map +1 -1
  368. package/build-module/post-date/index.js +9 -0
  369. package/build-module/post-date/index.js.map +1 -1
  370. package/build-module/post-featured-image/edit.js +28 -13
  371. package/build-module/post-featured-image/edit.js.map +1 -1
  372. package/build-module/post-featured-image/index.js +12 -0
  373. package/build-module/post-featured-image/index.js.map +1 -1
  374. package/build-module/post-navigation-link/index.js +3 -2
  375. package/build-module/post-navigation-link/index.js.map +1 -1
  376. package/build-module/post-template/edit.js +8 -4
  377. package/build-module/post-template/edit.js.map +1 -1
  378. package/build-module/post-template/index.js +14 -1
  379. package/build-module/post-template/index.js.map +1 -1
  380. package/build-module/post-terms/index.js +5 -3
  381. package/build-module/post-terms/index.js.map +1 -1
  382. package/build-module/post-title/index.js +2 -1
  383. package/build-module/post-title/index.js.map +1 -1
  384. package/build-module/preformatted/index.js +4 -2
  385. package/build-module/preformatted/index.js.map +1 -1
  386. package/build-module/pullquote/deprecated.js +134 -25
  387. package/build-module/pullquote/deprecated.js.map +1 -1
  388. package/build-module/pullquote/edit.js +1 -1
  389. package/build-module/pullquote/edit.js.map +1 -1
  390. package/build-module/pullquote/edit.native.js +0 -1
  391. package/build-module/pullquote/edit.native.js.map +1 -1
  392. package/build-module/pullquote/index.js +13 -6
  393. package/build-module/pullquote/index.js.map +1 -1
  394. package/build-module/pullquote/save.js +2 -2
  395. package/build-module/pullquote/save.js.map +1 -1
  396. package/build-module/pullquote/transforms.js +15 -34
  397. package/build-module/pullquote/transforms.js.map +1 -1
  398. package/build-module/query/deprecated.js +10 -8
  399. package/build-module/query/deprecated.js.map +1 -1
  400. package/build-module/query/edit/index.js +23 -12
  401. package/build-module/query/edit/index.js.map +1 -1
  402. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +1 -0
  403. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  404. package/build-module/query/edit/query-placeholder.js +6 -1
  405. package/build-module/query/edit/query-placeholder.js.map +1 -1
  406. package/build-module/query/utils.js +32 -7
  407. package/build-module/query/utils.js.map +1 -1
  408. package/build-module/query-no-results/edit.js +1 -1
  409. package/build-module/query-no-results/edit.js.map +1 -1
  410. package/build-module/query-title/edit.js +10 -1
  411. package/build-module/query-title/edit.js.map +1 -1
  412. package/build-module/query-title/index.js +7 -2
  413. package/build-module/query-title/index.js.map +1 -1
  414. package/build-module/quote/deprecated.js +13 -5
  415. package/build-module/quote/deprecated.js.map +1 -1
  416. package/build-module/quote/transforms.js +23 -38
  417. package/build-module/quote/transforms.js.map +1 -1
  418. package/build-module/separator/deprecated.js +3 -3
  419. package/build-module/separator/deprecated.js.map +1 -1
  420. package/build-module/separator/index.js +1 -0
  421. package/build-module/separator/index.js.map +1 -1
  422. package/build-module/social-link/icons/reddit.js +1 -1
  423. package/build-module/social-link/icons/reddit.js.map +1 -1
  424. package/build-module/social-links/edit.js +2 -1
  425. package/build-module/social-links/edit.js.map +1 -1
  426. package/build-module/spacer/index.js +7 -1
  427. package/build-module/spacer/index.js.map +1 -1
  428. package/build-module/table/index.js +4 -0
  429. package/build-module/table/index.js.map +1 -1
  430. package/build-module/table/state.js +10 -4
  431. package/build-module/table/state.js.map +1 -1
  432. package/build-module/table-of-contents/index.js +11 -1
  433. package/build-module/table-of-contents/index.js.map +1 -1
  434. package/build-module/tag-cloud/index.js +5 -1
  435. package/build-module/tag-cloud/index.js.map +1 -1
  436. package/build-module/template-part/index.js +2 -2
  437. package/build-module/template-part/index.js.map +1 -1
  438. package/build-module/term-description/index.js +4 -0
  439. package/build-module/term-description/index.js.map +1 -1
  440. package/build-module/text-columns/edit.js +4 -2
  441. package/build-module/text-columns/edit.js.map +1 -1
  442. package/build-module/text-columns/save.js +4 -2
  443. package/build-module/text-columns/save.js.map +1 -1
  444. package/build-module/verse/index.js +1 -0
  445. package/build-module/verse/index.js.map +1 -1
  446. package/build-module/video/index.js +4 -0
  447. package/build-module/video/index.js.map +1 -1
  448. package/build-style/audio/style-rtl.css +3 -0
  449. package/build-style/audio/style.css +3 -0
  450. package/build-style/button/style-rtl.css +6 -6
  451. package/build-style/button/style.css +6 -6
  452. package/build-style/editor-rtl.css +105 -122
  453. package/build-style/editor.css +105 -122
  454. package/build-style/group/editor-rtl.css +27 -8
  455. package/build-style/group/editor.css +27 -8
  456. package/build-style/image/editor-rtl.css +21 -2
  457. package/build-style/image/editor.css +21 -2
  458. package/build-style/navigation/editor-rtl.css +8 -4
  459. package/build-style/navigation/editor.css +8 -4
  460. package/build-style/navigation/style-rtl.css +2 -2
  461. package/build-style/navigation/style.css +2 -2
  462. package/build-style/paragraph/editor-rtl.css +1 -1
  463. package/build-style/paragraph/editor.css +1 -1
  464. package/build-style/post-date/style-rtl.css +79 -0
  465. package/build-style/post-date/style.css +79 -0
  466. package/build-style/post-featured-image/editor-rtl.css +45 -43
  467. package/build-style/post-featured-image/editor.css +45 -43
  468. package/build-style/post-featured-image/style-rtl.css +1 -0
  469. package/build-style/post-featured-image/style.css +1 -0
  470. package/build-style/post-title/style-rtl.css +1 -0
  471. package/build-style/post-title/style.css +1 -0
  472. package/build-style/pullquote/editor-rtl.css +0 -12
  473. package/build-style/pullquote/editor.css +0 -12
  474. package/build-style/pullquote/style-rtl.css +1 -8
  475. package/build-style/pullquote/style.css +1 -8
  476. package/build-style/query-title/style-rtl.css +79 -0
  477. package/build-style/query-title/style.css +79 -0
  478. package/build-style/site-logo/editor-rtl.css +3 -52
  479. package/build-style/site-logo/editor.css +3 -52
  480. package/build-style/social-links/style-rtl.css +2 -2
  481. package/build-style/social-links/style.css +2 -2
  482. package/build-style/style-rtl.css +27 -18
  483. package/build-style/style.css +27 -18
  484. package/build-style/video/style-rtl.css +3 -0
  485. package/build-style/video/style.css +3 -0
  486. package/package.json +30 -29
  487. package/src/archives/block.json +5 -1
  488. package/src/audio/block.json +4 -0
  489. package/src/audio/style.scss +2 -0
  490. package/src/button/block.json +1 -1
  491. package/src/button/deprecated.js +21 -22
  492. package/src/button/style.scss +6 -6
  493. package/src/calendar/index.php +2 -2
  494. package/src/categories/block.json +14 -1
  495. package/src/categories/edit.js +2 -2
  496. package/src/code/block.json +4 -2
  497. package/src/column/block.json +13 -0
  498. package/src/columns/block.json +13 -0
  499. package/src/columns/deprecated.js +10 -4
  500. package/src/columns/edit.js +7 -3
  501. package/src/columns/edit.native.js +7 -3
  502. package/src/comment-author-name/block.json +5 -1
  503. package/src/comment-content/block.json +5 -1
  504. package/src/comment-date/block.json +1 -0
  505. package/src/comment-edit-link/block.json +5 -1
  506. package/src/comment-reply-link/block.json +5 -1
  507. package/src/comment-template/block.json +14 -1
  508. package/src/comments/block.json +13 -0
  509. package/src/comments/index.php +6 -5
  510. package/src/comments-pagination/block.json +13 -0
  511. package/src/comments-pagination-next/block.json +4 -2
  512. package/src/comments-pagination-numbers/block.json +14 -1
  513. package/src/comments-pagination-numbers/edit.js +12 -3
  514. package/src/comments-pagination-previous/block.json +4 -2
  515. package/src/comments-title/block.json +4 -2
  516. package/src/cover/block.json +13 -0
  517. package/src/cover/deprecated.js +11 -4
  518. package/src/cover/shared.js +2 -1
  519. package/src/embed/icons.js +1 -1
  520. package/src/gallery/block.json +5 -0
  521. package/src/gallery/deprecated.js +4 -2
  522. package/src/gallery/edit.js +22 -2
  523. package/src/gallery/transforms.js +18 -5
  524. package/src/gallery/utils.js +11 -7
  525. package/src/group/block.json +10 -2
  526. package/src/group/deprecated.js +89 -2
  527. package/src/group/edit.js +15 -2
  528. package/src/group/editor.scss +28 -3
  529. package/src/group/variations.js +4 -3
  530. package/src/heading/block.json +3 -1
  531. package/src/heading/deprecated.js +4 -2
  532. package/src/home-link/edit.js +19 -20
  533. package/src/image/block.json +13 -7
  534. package/src/image/edit.js +19 -1
  535. package/src/image/editor.scss +39 -3
  536. package/src/image/index.php +1 -1
  537. package/src/index.native.js +15 -10
  538. package/src/list-item/edit.js +2 -1
  539. package/src/list-item/hooks/index.js +1 -0
  540. package/src/list-item/hooks/use-copy.js +36 -0
  541. package/src/list-item/list-style-type.native.js +8 -1
  542. package/src/list-item/style.native.scss +4 -0
  543. package/src/media-text/block.json +13 -0
  544. package/src/media-text/deprecated.js +3 -2
  545. package/src/navigation/deprecated.js +4 -2
  546. package/src/navigation/edit/index.js +159 -81
  547. package/src/navigation/edit/unsaved-inner-blocks.js +3 -1
  548. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +31 -37
  549. package/src/navigation/editor.scss +3 -2
  550. package/src/navigation/index.php +11 -16
  551. package/src/navigation/menu-items-to-blocks.js +3 -6
  552. package/src/navigation/style.scss +3 -2
  553. package/src/navigation/use-navigation-menu.js +11 -8
  554. package/src/navigation-link/edit.js +9 -13
  555. package/src/navigation-submenu/edit.js +9 -13
  556. package/src/page-list/edit.js +6 -2
  557. package/src/paragraph/block.json +5 -0
  558. package/src/paragraph/deprecated.js +33 -35
  559. package/src/paragraph/edit.js +1 -0
  560. package/src/paragraph/editor.scss +5 -3
  561. package/src/post-author/block.json +4 -2
  562. package/src/post-author-biography/block.json +1 -0
  563. package/src/post-author-name/block.json +5 -1
  564. package/src/post-comments-count/block.json +4 -1
  565. package/src/post-comments-count/edit.js +10 -2
  566. package/src/post-comments-link/block.json +4 -2
  567. package/src/post-date/block.json +9 -0
  568. package/src/post-date/edit.js +12 -2
  569. package/src/post-date/index.php +10 -2
  570. package/src/post-date/style.scss +4 -0
  571. package/src/post-featured-image/block.json +12 -0
  572. package/src/post-featured-image/edit.js +43 -13
  573. package/src/post-featured-image/editor.scss +44 -53
  574. package/src/post-featured-image/index.php +61 -4
  575. package/src/post-featured-image/style.scss +1 -0
  576. package/src/post-navigation-link/block.json +3 -2
  577. package/src/post-template/block.json +15 -1
  578. package/src/post-template/edit.js +6 -1
  579. package/src/post-template/index.php +7 -4
  580. package/src/post-terms/block.json +5 -3
  581. package/src/post-title/block.json +2 -1
  582. package/src/post-title/style.scss +2 -0
  583. package/src/preformatted/block.json +4 -2
  584. package/src/pullquote/block.json +11 -4
  585. package/src/pullquote/deprecated.js +490 -412
  586. package/src/pullquote/edit.js +1 -1
  587. package/src/pullquote/edit.native.js +0 -1
  588. package/src/pullquote/editor.scss +0 -16
  589. package/src/pullquote/index.js +1 -3
  590. package/src/pullquote/save.js +1 -1
  591. package/src/pullquote/style.scss +0 -11
  592. package/src/pullquote/transforms.js +17 -33
  593. package/src/query/deprecated.js +4 -9
  594. package/src/query/edit/index.js +28 -15
  595. package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -1
  596. package/src/query/edit/query-placeholder.js +17 -2
  597. package/src/query/utils.js +29 -7
  598. package/src/query-no-results/edit.js +1 -1
  599. package/src/query-title/block.json +7 -2
  600. package/src/query-title/edit.js +19 -2
  601. package/src/query-title/index.php +11 -1
  602. package/src/query-title/style.scss +4 -0
  603. package/src/quote/deprecated.js +6 -5
  604. package/src/quote/transforms.js +4 -18
  605. package/src/search/index.php +1 -1
  606. package/src/separator/block.json +1 -0
  607. package/src/separator/deprecated.js +2 -3
  608. package/src/site-logo/editor.scss +8 -66
  609. package/src/social-link/icons/reddit.js +1 -1
  610. package/src/social-link/index.php +1 -1
  611. package/src/social-link/socials-with-bg.scss +1 -1
  612. package/src/social-link/socials-without-bg.scss +1 -1
  613. package/src/social-links/edit.js +1 -0
  614. package/src/spacer/block.json +7 -1
  615. package/src/style.scss +2 -0
  616. package/src/table/block.json +4 -0
  617. package/src/table/state.js +21 -19
  618. package/src/table-of-contents/block.json +11 -1
  619. package/src/tag-cloud/block.json +5 -1
  620. package/src/template-part/index.js +3 -2
  621. package/src/term-description/block.json +4 -0
  622. package/src/text-columns/edit.js +2 -2
  623. package/src/text-columns/save.js +2 -2
  624. package/src/verse/block.json +1 -0
  625. package/src/video/block.json +4 -0
  626. package/src/video/style.scss +2 -0
@@ -15,6 +15,12 @@ import {
15
15
  useBlockProps,
16
16
  } from '@wordpress/block-editor';
17
17
  import { select } from '@wordpress/data';
18
+ import {
19
+ create,
20
+ replace,
21
+ toHTMLString,
22
+ __UNSTABLE_LINE_SEPARATOR,
23
+ } from '@wordpress/rich-text';
18
24
 
19
25
  /**
20
26
  * Internal dependencies
@@ -58,458 +64,530 @@ function parseBorderColor( styleString ) {
58
64
  }
59
65
  }
60
66
 
61
- // TODO: this is ripe for a bit of a clean up according to the example in https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/#example
62
- const deprecated = [
63
- {
64
- attributes: {
65
- ...blockAttributes,
66
- },
67
- save( { attributes } ) {
68
- const {
69
- mainColor,
70
- customMainColor,
71
- customTextColor,
72
- textColor,
73
- value,
74
- citation,
75
- className,
76
- } = attributes;
77
-
78
- const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
79
-
80
- let figureClasses, figureStyles;
81
-
82
- // Is solid color style
83
- if ( isSolidColorStyle ) {
84
- const backgroundClass = getColorClassName(
85
- 'background-color',
86
- mainColor
87
- );
88
-
89
- figureClasses = classnames( {
90
- 'has-background': backgroundClass || customMainColor,
91
- [ backgroundClass ]: backgroundClass,
92
- } );
93
-
94
- figureStyles = {
95
- backgroundColor: backgroundClass
96
- ? undefined
97
- : customMainColor,
98
- };
99
- // Is normal style and a custom color is being used ( we can set a style directly with its value)
100
- } else if ( customMainColor ) {
101
- figureStyles = {
102
- borderColor: customMainColor,
103
- };
104
- }
67
+ function multilineToInline( value ) {
68
+ return toHTMLString( {
69
+ value: replace(
70
+ create( { html: value, multilineTag: 'p' } ),
71
+ new RegExp( __UNSTABLE_LINE_SEPARATOR, 'g' ),
72
+ '\n'
73
+ ),
74
+ } );
75
+ }
105
76
 
106
- const blockquoteTextColorClass = getColorClassName(
107
- 'color',
108
- textColor
109
- );
110
- const blockquoteClasses = classnames( {
111
- 'has-text-color': textColor || customTextColor,
112
- [ blockquoteTextColorClass ]: blockquoteTextColorClass,
113
- } );
77
+ const v5 = {
78
+ attributes: {
79
+ value: {
80
+ type: 'string',
81
+ source: 'html',
82
+ selector: 'blockquote',
83
+ multiline: 'p',
84
+ __experimentalRole: 'content',
85
+ },
86
+ citation: {
87
+ type: 'string',
88
+ source: 'html',
89
+ selector: 'cite',
90
+ default: '',
91
+ __experimentalRole: 'content',
92
+ },
93
+ textAlign: {
94
+ type: 'string',
95
+ },
96
+ },
97
+ save( { attributes } ) {
98
+ const { textAlign, citation, value } = attributes;
99
+ const shouldShowCitation = ! RichText.isEmpty( citation );
100
+
101
+ return (
102
+ <figure
103
+ { ...useBlockProps.save( {
104
+ className: classnames( {
105
+ [ `has-text-align-${ textAlign }` ]: textAlign,
106
+ } ),
107
+ } ) }
108
+ >
109
+ <blockquote>
110
+ <RichText.Content value={ value } multiline />
111
+ { shouldShowCitation && (
112
+ <RichText.Content tagName="cite" value={ citation } />
113
+ ) }
114
+ </blockquote>
115
+ </figure>
116
+ );
117
+ },
118
+ migrate( { value, ...attributes } ) {
119
+ return {
120
+ value: multilineToInline( value ),
121
+ ...attributes,
122
+ };
123
+ },
124
+ };
114
125
 
115
- const blockquoteStyles = blockquoteTextColorClass
116
- ? undefined
117
- : { color: customTextColor };
126
+ // TODO: this is ripe for a bit of a clean up according to the example in https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/#example
118
127
 
119
- return (
120
- <figure
121
- { ...useBlockProps.save( {
122
- className: figureClasses,
123
- style: figureStyles,
124
- } ) }
125
- >
126
- <blockquote
127
- className={ blockquoteClasses }
128
- style={ blockquoteStyles }
129
- >
130
- <RichText.Content value={ value } multiline />
131
- { ! RichText.isEmpty( citation ) && (
132
- <RichText.Content
133
- tagName="cite"
134
- value={ citation }
135
- />
136
- ) }
137
- </blockquote>
138
- </figure>
139
- );
140
- },
141
- migrate( {
142
- className,
128
+ const v4 = {
129
+ attributes: {
130
+ ...blockAttributes,
131
+ },
132
+ save( { attributes } ) {
133
+ const {
143
134
  mainColor,
144
135
  customMainColor,
145
136
  customTextColor,
146
- ...attributes
147
- } ) {
148
- const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
149
- let style;
150
-
151
- if ( customMainColor ) {
152
- if ( ! isSolidColorStyle ) {
153
- // Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
154
- style = {
155
- border: {
156
- color: customMainColor,
157
- },
158
- };
159
- } else {
160
- // Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
161
- style = {
162
- color: {
163
- background: customMainColor,
164
- },
165
- };
166
- }
167
- }
137
+ textColor,
138
+ value,
139
+ citation,
140
+ className,
141
+ } = attributes;
168
142
 
169
- // Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
170
- if ( customTextColor && style ) {
171
- style.color = {
172
- ...style.color,
173
- text: customTextColor,
174
- };
175
- }
143
+ const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
144
+
145
+ let figureClasses, figureStyles;
176
146
 
177
- return {
178
- className,
179
- backgroundColor: isSolidColorStyle ? mainColor : undefined,
180
- borderColor: isSolidColorStyle ? undefined : mainColor,
181
- textAlign: isSolidColorStyle ? 'left' : undefined,
182
- style,
183
- ...attributes,
147
+ // Is solid color style
148
+ if ( isSolidColorStyle ) {
149
+ const backgroundClass = getColorClassName(
150
+ 'background-color',
151
+ mainColor
152
+ );
153
+
154
+ figureClasses = classnames( {
155
+ 'has-background': backgroundClass || customMainColor,
156
+ [ backgroundClass ]: backgroundClass,
157
+ } );
158
+
159
+ figureStyles = {
160
+ backgroundColor: backgroundClass ? undefined : customMainColor,
184
161
  };
185
- },
162
+ // Is normal style and a custom color is being used ( we can set a style directly with its value)
163
+ } else if ( customMainColor ) {
164
+ figureStyles = {
165
+ borderColor: customMainColor,
166
+ };
167
+ }
168
+
169
+ const blockquoteTextColorClass = getColorClassName(
170
+ 'color',
171
+ textColor
172
+ );
173
+ const blockquoteClasses = classnames( {
174
+ 'has-text-color': textColor || customTextColor,
175
+ [ blockquoteTextColorClass ]: blockquoteTextColorClass,
176
+ } );
177
+
178
+ const blockquoteStyles = blockquoteTextColorClass
179
+ ? undefined
180
+ : { color: customTextColor };
181
+
182
+ return (
183
+ <figure
184
+ { ...useBlockProps.save( {
185
+ className: figureClasses,
186
+ style: figureStyles,
187
+ } ) }
188
+ >
189
+ <blockquote
190
+ className={ blockquoteClasses }
191
+ style={ blockquoteStyles }
192
+ >
193
+ <RichText.Content value={ value } multiline />
194
+ { ! RichText.isEmpty( citation ) && (
195
+ <RichText.Content tagName="cite" value={ citation } />
196
+ ) }
197
+ </blockquote>
198
+ </figure>
199
+ );
186
200
  },
187
- {
188
- attributes: {
189
- ...blockAttributes,
190
- // figureStyle is an attribute that never existed.
191
- // We are using it as a way to access the styles previously applied to the figure.
192
- figureStyle: {
193
- source: 'attribute',
194
- selector: 'figure',
195
- attribute: 'style',
196
- },
197
- },
198
- save( { attributes } ) {
199
- const {
200
- mainColor,
201
- customMainColor,
202
- textColor,
203
- customTextColor,
204
- value,
205
- citation,
206
- className,
207
- figureStyle,
208
- } = attributes;
209
-
210
- const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
211
-
212
- let figureClasses, figureStyles;
213
-
214
- // Is solid color style
215
- if ( isSolidColorStyle ) {
216
- const backgroundClass = getColorClassName(
217
- 'background-color',
218
- mainColor
219
- );
220
-
221
- figureClasses = classnames( {
222
- 'has-background': backgroundClass || customMainColor,
223
- [ backgroundClass ]: backgroundClass,
224
- } );
225
-
226
- figureStyles = {
227
- backgroundColor: backgroundClass
228
- ? undefined
229
- : customMainColor,
201
+ migrate( {
202
+ value,
203
+ className,
204
+ mainColor,
205
+ customMainColor,
206
+ customTextColor,
207
+ ...attributes
208
+ } ) {
209
+ const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
210
+ let style;
211
+
212
+ if ( customMainColor ) {
213
+ if ( ! isSolidColorStyle ) {
214
+ // Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
215
+ style = {
216
+ border: {
217
+ color: customMainColor,
218
+ },
230
219
  };
231
- // Is normal style and a custom color is being used ( we can set a style directly with its value)
232
- } else if ( customMainColor ) {
233
- figureStyles = {
234
- borderColor: customMainColor,
235
- };
236
- // If normal style and a named color are being used, we need to retrieve the color value to set the style,
237
- // as there is no expectation that themes create classes that set border colors.
238
- } else if ( mainColor ) {
239
- // Previously here we queried the color settings to know the color value
240
- // of a named color. This made the save function impure and the block was refactored,
241
- // because meanwhile a change in the editor made it impossible to query color settings in the save function.
242
- // Here instead of querying the color settings to know the color value, we retrieve the value
243
- // directly from the style previously serialized.
244
- const borderColor = parseBorderColor( figureStyle );
245
- figureStyles = {
246
- borderColor,
220
+ } else {
221
+ // Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
222
+ style = {
223
+ color: {
224
+ background: customMainColor,
225
+ },
247
226
  };
248
227
  }
228
+ }
249
229
 
250
- const blockquoteTextColorClass = getColorClassName(
251
- 'color',
252
- textColor
253
- );
254
- const blockquoteClasses =
255
- ( textColor || customTextColor ) &&
256
- classnames( 'has-text-color', {
257
- [ blockquoteTextColorClass ]: blockquoteTextColorClass,
258
- } );
259
-
260
- const blockquoteStyles = blockquoteTextColorClass
261
- ? undefined
262
- : { color: customTextColor };
263
-
264
- return (
265
- <figure className={ figureClasses } style={ figureStyles }>
266
- <blockquote
267
- className={ blockquoteClasses }
268
- style={ blockquoteStyles }
269
- >
270
- <RichText.Content value={ value } multiline />
271
- { ! RichText.isEmpty( citation ) && (
272
- <RichText.Content
273
- tagName="cite"
274
- value={ citation }
275
- />
276
- ) }
277
- </blockquote>
278
- </figure>
279
- );
280
- },
281
- migrate( {
230
+ // Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
231
+ if ( customTextColor && style ) {
232
+ style.color = {
233
+ ...style.color,
234
+ text: customTextColor,
235
+ };
236
+ }
237
+
238
+ return {
239
+ value: multilineToInline( value ),
282
240
  className,
283
- figureStyle,
241
+ backgroundColor: isSolidColorStyle ? mainColor : undefined,
242
+ borderColor: isSolidColorStyle ? undefined : mainColor,
243
+ textAlign: isSolidColorStyle ? 'left' : undefined,
244
+ style,
245
+ ...attributes,
246
+ };
247
+ },
248
+ };
249
+
250
+ const v3 = {
251
+ attributes: {
252
+ ...blockAttributes,
253
+ // figureStyle is an attribute that never existed.
254
+ // We are using it as a way to access the styles previously applied to the figure.
255
+ figureStyle: {
256
+ source: 'attribute',
257
+ selector: 'figure',
258
+ attribute: 'style',
259
+ },
260
+ },
261
+ save( { attributes } ) {
262
+ const {
284
263
  mainColor,
285
264
  customMainColor,
265
+ textColor,
286
266
  customTextColor,
287
- ...attributes
288
- } ) {
289
- const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
290
- let style;
291
-
292
- if ( customMainColor ) {
293
- if ( ! isSolidColorStyle ) {
294
- // Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
295
- style = {
296
- border: {
297
- color: customMainColor,
298
- },
299
- };
300
- } else {
301
- // Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
302
- style = {
303
- color: {
304
- background: customMainColor,
305
- },
306
- };
307
- }
308
- }
267
+ value,
268
+ citation,
269
+ className,
270
+ figureStyle,
271
+ } = attributes;
309
272
 
310
- // Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
311
- if ( customTextColor && style ) {
312
- style.color = {
313
- ...style.color,
314
- text: customTextColor,
315
- };
316
- }
317
- // If is the default style, and a main color is set,
318
- // migrate the main color value into a custom border color.
319
- // The custom border color value is retrieved by parsing the figure styles.
320
- if ( ! isSolidColorStyle && mainColor && figureStyle ) {
321
- const borderColor = parseBorderColor( figureStyle );
322
- if ( borderColor ) {
323
- return {
324
- ...attributes,
325
- className,
326
- // Block supports: Set style.border.color if a deprecated block has `mainColor`, inline border CSS and is not a solid color style.
327
- style: {
328
- border: {
329
- color: borderColor,
330
- },
331
- },
332
- };
333
- }
334
- }
335
- return {
336
- className,
337
- backgroundColor: isSolidColorStyle ? mainColor : undefined,
338
- borderColor: isSolidColorStyle ? undefined : mainColor,
339
- textAlign: isSolidColorStyle ? 'left' : undefined,
340
- style,
341
- ...attributes,
273
+ const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
274
+
275
+ let figureClasses, figureStyles;
276
+
277
+ // Is solid color style
278
+ if ( isSolidColorStyle ) {
279
+ const backgroundClass = getColorClassName(
280
+ 'background-color',
281
+ mainColor
282
+ );
283
+
284
+ figureClasses = classnames( {
285
+ 'has-background': backgroundClass || customMainColor,
286
+ [ backgroundClass ]: backgroundClass,
287
+ } );
288
+
289
+ figureStyles = {
290
+ backgroundColor: backgroundClass ? undefined : customMainColor,
342
291
  };
343
- },
292
+ // Is normal style and a custom color is being used ( we can set a style directly with its value)
293
+ } else if ( customMainColor ) {
294
+ figureStyles = {
295
+ borderColor: customMainColor,
296
+ };
297
+ // If normal style and a named color are being used, we need to retrieve the color value to set the style,
298
+ // as there is no expectation that themes create classes that set border colors.
299
+ } else if ( mainColor ) {
300
+ // Previously here we queried the color settings to know the color value
301
+ // of a named color. This made the save function impure and the block was refactored,
302
+ // because meanwhile a change in the editor made it impossible to query color settings in the save function.
303
+ // Here instead of querying the color settings to know the color value, we retrieve the value
304
+ // directly from the style previously serialized.
305
+ const borderColor = parseBorderColor( figureStyle );
306
+ figureStyles = {
307
+ borderColor,
308
+ };
309
+ }
310
+
311
+ const blockquoteTextColorClass = getColorClassName(
312
+ 'color',
313
+ textColor
314
+ );
315
+ const blockquoteClasses =
316
+ ( textColor || customTextColor ) &&
317
+ classnames( 'has-text-color', {
318
+ [ blockquoteTextColorClass ]: blockquoteTextColorClass,
319
+ } );
320
+
321
+ const blockquoteStyles = blockquoteTextColorClass
322
+ ? undefined
323
+ : { color: customTextColor };
324
+
325
+ return (
326
+ <figure className={ figureClasses } style={ figureStyles }>
327
+ <blockquote
328
+ className={ blockquoteClasses }
329
+ style={ blockquoteStyles }
330
+ >
331
+ <RichText.Content value={ value } multiline />
332
+ { ! RichText.isEmpty( citation ) && (
333
+ <RichText.Content tagName="cite" value={ citation } />
334
+ ) }
335
+ </blockquote>
336
+ </figure>
337
+ );
344
338
  },
345
- {
346
- attributes: blockAttributes,
347
- save( { attributes } ) {
348
- const {
349
- mainColor,
350
- customMainColor,
351
- textColor,
352
- customTextColor,
353
- value,
354
- citation,
355
- className,
356
- } = attributes;
357
- const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
358
-
359
- let figureClass, figureStyles;
360
- // Is solid color style
361
- if ( isSolidColorStyle ) {
362
- figureClass = getColorClassName(
363
- 'background-color',
364
- mainColor
365
- );
366
- if ( ! figureClass ) {
367
- figureStyles = {
368
- backgroundColor: customMainColor,
369
- };
370
- }
371
- // Is normal style and a custom color is being used ( we can set a style directly with its value)
372
- } else if ( customMainColor ) {
373
- figureStyles = {
374
- borderColor: customMainColor,
339
+ migrate( {
340
+ value,
341
+ className,
342
+ figureStyle,
343
+ mainColor,
344
+ customMainColor,
345
+ customTextColor,
346
+ ...attributes
347
+ } ) {
348
+ const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
349
+ let style;
350
+
351
+ if ( customMainColor ) {
352
+ if ( ! isSolidColorStyle ) {
353
+ // Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
354
+ style = {
355
+ border: {
356
+ color: customMainColor,
357
+ },
375
358
  };
376
- // Is normal style and a named color is being used, we need to retrieve the color value to set the style,
377
- // as there is no expectation that themes create classes that set border colors.
378
- } else if ( mainColor ) {
379
- const colors = get(
380
- select( blockEditorStore ).getSettings(),
381
- [ 'colors' ],
382
- []
383
- );
384
- const colorObject = getColorObjectByAttributeValues(
385
- colors,
386
- mainColor
387
- );
388
- figureStyles = {
389
- borderColor: colorObject.color,
359
+ } else {
360
+ // Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
361
+ style = {
362
+ color: {
363
+ background: customMainColor,
364
+ },
390
365
  };
391
366
  }
367
+ }
392
368
 
393
- const blockquoteTextColorClass = getColorClassName(
394
- 'color',
395
- textColor
396
- );
397
- const blockquoteClasses =
398
- textColor || customTextColor
399
- ? classnames( 'has-text-color', {
400
- [ blockquoteTextColorClass ]:
401
- blockquoteTextColorClass,
402
- } )
403
- : undefined;
404
- const blockquoteStyle = blockquoteTextColorClass
405
- ? undefined
406
- : { color: customTextColor };
407
- return (
408
- <figure className={ figureClass } style={ figureStyles }>
409
- <blockquote
410
- className={ blockquoteClasses }
411
- style={ blockquoteStyle }
412
- >
413
- <RichText.Content value={ value } multiline />
414
- { ! RichText.isEmpty( citation ) && (
415
- <RichText.Content
416
- tagName="cite"
417
- value={ citation }
418
- />
419
- ) }
420
- </blockquote>
421
- </figure>
422
- );
423
- },
424
- migrate( {
425
- className,
426
- mainColor,
427
- customMainColor,
428
- customTextColor,
429
- ...attributes
430
- } ) {
431
- const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
432
- let style = {};
433
-
434
- if ( customMainColor ) {
435
- if ( ! isSolidColorStyle ) {
436
- // Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
437
- style = {
369
+ // Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
370
+ if ( customTextColor && style ) {
371
+ style.color = {
372
+ ...style.color,
373
+ text: customTextColor,
374
+ };
375
+ }
376
+ // If is the default style, and a main color is set,
377
+ // migrate the main color value into a custom border color.
378
+ // The custom border color value is retrieved by parsing the figure styles.
379
+ if ( ! isSolidColorStyle && mainColor && figureStyle ) {
380
+ const borderColor = parseBorderColor( figureStyle );
381
+ if ( borderColor ) {
382
+ return {
383
+ value: multilineToInline( value ),
384
+ ...attributes,
385
+ className,
386
+ // Block supports: Set style.border.color if a deprecated block has `mainColor`, inline border CSS and is not a solid color style.
387
+ style: {
438
388
  border: {
439
- color: customMainColor,
389
+ color: borderColor,
440
390
  },
441
- };
442
- } else {
443
- // Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
444
- style = {
445
- color: {
446
- background: customMainColor,
447
- },
448
- };
449
- }
391
+ },
392
+ };
450
393
  }
394
+ }
395
+ return {
396
+ value: multilineToInline( value ),
397
+ className,
398
+ backgroundColor: isSolidColorStyle ? mainColor : undefined,
399
+ borderColor: isSolidColorStyle ? undefined : mainColor,
400
+ textAlign: isSolidColorStyle ? 'left' : undefined,
401
+ style,
402
+ ...attributes,
403
+ };
404
+ },
405
+ };
451
406
 
452
- // Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
453
- if ( customTextColor && style ) {
454
- style.color = {
455
- ...style.color,
456
- text: customTextColor,
407
+ const v2 = {
408
+ attributes: blockAttributes,
409
+ save( { attributes } ) {
410
+ const {
411
+ mainColor,
412
+ customMainColor,
413
+ textColor,
414
+ customTextColor,
415
+ value,
416
+ citation,
417
+ className,
418
+ } = attributes;
419
+ const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
420
+
421
+ let figureClass, figureStyles;
422
+ // Is solid color style
423
+ if ( isSolidColorStyle ) {
424
+ figureClass = getColorClassName( 'background-color', mainColor );
425
+ if ( ! figureClass ) {
426
+ figureStyles = {
427
+ backgroundColor: customMainColor,
457
428
  };
458
429
  }
459
-
460
- return {
461
- className,
462
- backgroundColor: isSolidColorStyle ? mainColor : undefined,
463
- borderColor: isSolidColorStyle ? undefined : mainColor,
464
- textAlign: isSolidColorStyle ? 'left' : undefined,
465
- style,
466
- ...attributes,
430
+ // Is normal style and a custom color is being used ( we can set a style directly with its value)
431
+ } else if ( customMainColor ) {
432
+ figureStyles = {
433
+ borderColor: customMainColor,
467
434
  };
468
- },
469
- },
470
- {
471
- attributes: {
472
- ...blockAttributes,
473
- },
474
- save( { attributes } ) {
475
- const { value, citation } = attributes;
476
- return (
477
- <blockquote>
435
+ // Is normal style and a named color is being used, we need to retrieve the color value to set the style,
436
+ // as there is no expectation that themes create classes that set border colors.
437
+ } else if ( mainColor ) {
438
+ const colors = get(
439
+ select( blockEditorStore ).getSettings(),
440
+ [ 'colors' ],
441
+ []
442
+ );
443
+ const colorObject = getColorObjectByAttributeValues(
444
+ colors,
445
+ mainColor
446
+ );
447
+ figureStyles = {
448
+ borderColor: colorObject.color,
449
+ };
450
+ }
451
+
452
+ const blockquoteTextColorClass = getColorClassName(
453
+ 'color',
454
+ textColor
455
+ );
456
+ const blockquoteClasses =
457
+ textColor || customTextColor
458
+ ? classnames( 'has-text-color', {
459
+ [ blockquoteTextColorClass ]: blockquoteTextColorClass,
460
+ } )
461
+ : undefined;
462
+ const blockquoteStyle = blockquoteTextColorClass
463
+ ? undefined
464
+ : { color: customTextColor };
465
+ return (
466
+ <figure className={ figureClass } style={ figureStyles }>
467
+ <blockquote
468
+ className={ blockquoteClasses }
469
+ style={ blockquoteStyle }
470
+ >
478
471
  <RichText.Content value={ value } multiline />
479
472
  { ! RichText.isEmpty( citation ) && (
480
473
  <RichText.Content tagName="cite" value={ citation } />
481
474
  ) }
482
475
  </blockquote>
483
- );
484
- },
476
+ </figure>
477
+ );
485
478
  },
486
- {
487
- attributes: {
488
- ...blockAttributes,
489
- citation: {
490
- type: 'string',
491
- source: 'html',
492
- selector: 'footer',
493
- },
494
- align: {
495
- type: 'string',
496
- default: 'none',
497
- },
498
- },
479
+ migrate( {
480
+ value,
481
+ className,
482
+ mainColor,
483
+ customMainColor,
484
+ customTextColor,
485
+ ...attributes
486
+ } ) {
487
+ const isSolidColorStyle = includes( className, SOLID_COLOR_CLASS );
488
+ let style = {};
489
+
490
+ if ( customMainColor ) {
491
+ if ( ! isSolidColorStyle ) {
492
+ // Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
493
+ style = {
494
+ border: {
495
+ color: customMainColor,
496
+ },
497
+ };
498
+ } else {
499
+ // Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
500
+ style = {
501
+ color: {
502
+ background: customMainColor,
503
+ },
504
+ };
505
+ }
506
+ }
499
507
 
500
- save( { attributes } ) {
501
- const { value, citation, align } = attributes;
508
+ // Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
509
+ if ( customTextColor && style ) {
510
+ style.color = {
511
+ ...style.color,
512
+ text: customTextColor,
513
+ };
514
+ }
502
515
 
503
- return (
504
- <blockquote className={ `align${ align }` }>
505
- <RichText.Content value={ value } multiline />
506
- { ! RichText.isEmpty( citation ) && (
507
- <RichText.Content tagName="footer" value={ citation } />
508
- ) }
509
- </blockquote>
510
- );
516
+ return {
517
+ value: multilineToInline( value ),
518
+ className,
519
+ backgroundColor: isSolidColorStyle ? mainColor : undefined,
520
+ borderColor: isSolidColorStyle ? undefined : mainColor,
521
+ textAlign: isSolidColorStyle ? 'left' : undefined,
522
+ style,
523
+ ...attributes,
524
+ };
525
+ },
526
+ };
527
+
528
+ const v1 = {
529
+ attributes: {
530
+ ...blockAttributes,
531
+ },
532
+ save( { attributes } ) {
533
+ const { value, citation } = attributes;
534
+ return (
535
+ <blockquote>
536
+ <RichText.Content value={ value } multiline />
537
+ { ! RichText.isEmpty( citation ) && (
538
+ <RichText.Content tagName="cite" value={ citation } />
539
+ ) }
540
+ </blockquote>
541
+ );
542
+ },
543
+ migrate( { value, ...attributes } ) {
544
+ return {
545
+ value: multilineToInline( value ),
546
+ ...attributes,
547
+ };
548
+ },
549
+ };
550
+
551
+ const v0 = {
552
+ attributes: {
553
+ ...blockAttributes,
554
+ citation: {
555
+ type: 'string',
556
+ source: 'html',
557
+ selector: 'footer',
558
+ },
559
+ align: {
560
+ type: 'string',
561
+ default: 'none',
511
562
  },
512
563
  },
513
- ];
514
564
 
515
- export default deprecated;
565
+ save( { attributes } ) {
566
+ const { value, citation, align } = attributes;
567
+
568
+ return (
569
+ <blockquote className={ `align${ align }` }>
570
+ <RichText.Content value={ value } multiline />
571
+ { ! RichText.isEmpty( citation ) && (
572
+ <RichText.Content tagName="footer" value={ citation } />
573
+ ) }
574
+ </blockquote>
575
+ );
576
+ },
577
+ migrate( { value, ...attributes } ) {
578
+ return {
579
+ value: multilineToInline( value ),
580
+ ...attributes,
581
+ };
582
+ },
583
+ };
584
+
585
+ /**
586
+ * New deprecations need to be placed first
587
+ * for them to have higher priority.
588
+ *
589
+ * Old deprecations may need to be updated as well.
590
+ *
591
+ * See block-deprecation.md
592
+ */
593
+ export default [ v5, v4, v3, v2, v1, v0 ];