@wordpress/block-library 9.48.1 → 10.0.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 (638) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/audio/edit.cjs +8 -1
  3. package/build/audio/edit.cjs.map +2 -2
  4. package/build/breadcrumbs/edit.cjs +1 -2
  5. package/build/breadcrumbs/edit.cjs.map +2 -2
  6. package/build/button/edit.cjs +1 -2
  7. package/build/button/edit.cjs.map +2 -2
  8. package/build/categories/edit.cjs +1 -1
  9. package/build/categories/edit.cjs.map +1 -1
  10. package/build/code/edit.cjs +1 -1
  11. package/build/code/edit.cjs.map +2 -2
  12. package/build/code/index.cjs +1 -1
  13. package/build/code/index.cjs.map +1 -1
  14. package/build/columns/utils.cjs.map +1 -1
  15. package/build/comments/edit/comments-legacy.cjs +1 -1
  16. package/build/comments/edit/comments-legacy.cjs.map +1 -1
  17. package/build/comments/edit/placeholder.cjs +4 -4
  18. package/build/comments/edit/placeholder.cjs.map +1 -1
  19. package/build/comments-pagination-next/edit.cjs +2 -2
  20. package/build/comments-pagination-next/edit.cjs.map +1 -1
  21. package/build/comments-pagination-previous/edit.cjs +2 -2
  22. package/build/comments-pagination-previous/edit.cjs.map +1 -1
  23. package/build/cover/deprecated.cjs +3 -3
  24. package/build/cover/deprecated.cjs.map +2 -2
  25. package/build/cover/edit/block-controls.cjs +13 -0
  26. package/build/cover/edit/block-controls.cjs.map +2 -2
  27. package/build/cover/edit/embed-video-url-input.cjs +0 -1
  28. package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
  29. package/build/cover/edit/index.cjs +61 -2
  30. package/build/cover/edit/index.cjs.map +3 -3
  31. package/build/cover/edit/inspector-controls.cjs +93 -35
  32. package/build/cover/edit/inspector-controls.cjs.map +2 -2
  33. package/build/details/edit.cjs +1 -2
  34. package/build/details/edit.cjs.map +2 -2
  35. package/build/embed/embed-placeholder.cjs +1 -1
  36. package/build/embed/embed-placeholder.cjs.map +2 -2
  37. package/build/file/edit.cjs +3 -11
  38. package/build/file/edit.cjs.map +2 -2
  39. package/build/file/index.cjs +3 -1
  40. package/build/file/index.cjs.map +3 -3
  41. package/build/file/transforms.cjs +11 -32
  42. package/build/file/transforms.cjs.map +2 -2
  43. package/build/{freeform/convert-to-blocks-button.cjs → file/variations.cjs} +16 -18
  44. package/build/file/variations.cjs.map +7 -0
  45. package/build/footnotes/edit.cjs +1 -1
  46. package/build/footnotes/edit.cjs.map +2 -2
  47. package/build/form/edit.cjs +0 -2
  48. package/build/form/edit.cjs.map +2 -2
  49. package/build/form-input/edit.cjs +1 -3
  50. package/build/form-input/edit.cjs.map +2 -2
  51. package/build/freeform/edit.cjs +6 -15
  52. package/build/freeform/edit.cjs.map +3 -3
  53. package/build/freeform/migration-notice.cjs.map +2 -2
  54. package/build/gallery/edit.cjs +2 -2
  55. package/build/gallery/edit.cjs.map +2 -2
  56. package/build/home-link/edit.cjs +1 -2
  57. package/build/home-link/edit.cjs.map +2 -2
  58. package/build/html/index.cjs +1 -1
  59. package/build/html/index.cjs.map +2 -2
  60. package/build/html/modal.cjs +9 -6
  61. package/build/html/modal.cjs.map +2 -2
  62. package/build/icon/block.json +12 -0
  63. package/build/icon/edit.cjs +90 -41
  64. package/build/icon/edit.cjs.map +3 -3
  65. package/build/icon/index.cjs +3 -1
  66. package/build/icon/index.cjs.map +3 -3
  67. package/build/{tab/save.cjs → icon/variations.cjs} +14 -15
  68. package/build/icon/variations.cjs.map +7 -0
  69. package/build/image/block.json +1 -0
  70. package/build/image/edit.cjs +4 -3
  71. package/build/image/edit.cjs.map +2 -2
  72. package/build/image/image.cjs +91 -29
  73. package/build/image/image.cjs.map +2 -2
  74. package/build/image/index.cjs +1 -1
  75. package/build/image/index.cjs.map +2 -2
  76. package/build/image/transforms.cjs +9 -3
  77. package/build/image/transforms.cjs.map +2 -2
  78. package/build/image/use-open-image-media-editor-modal.cjs +5 -25
  79. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  80. package/build/index.cjs +1 -3
  81. package/build/index.cjs.map +2 -2
  82. package/build/latest-posts/edit.cjs +1 -1
  83. package/build/latest-posts/edit.cjs.map +1 -1
  84. package/build/list/ordered-list-settings.cjs +0 -1
  85. package/build/list/ordered-list-settings.cjs.map +2 -2
  86. package/build/math/edit.cjs +1 -1
  87. package/build/math/index.cjs +1 -1
  88. package/build/math/index.cjs.map +1 -1
  89. package/build/media-text/constants.cjs +1 -1
  90. package/build/media-text/constants.cjs.map +2 -2
  91. package/build/media-text/index.cjs +1 -1
  92. package/build/media-text/index.cjs.map +2 -2
  93. package/build/missing/edit.cjs +2 -2
  94. package/build/missing/edit.cjs.map +1 -1
  95. package/build/navigation/edit/index.cjs +19 -13
  96. package/build/navigation/edit/index.cjs.map +2 -2
  97. package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
  98. package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
  99. package/build/navigation/edit/navigation-menu-selector.cjs +1 -1
  100. package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
  101. package/build/navigation/edit/placeholder/index.cjs +1 -1
  102. package/build/navigation/edit/placeholder/index.cjs.map +2 -2
  103. package/build/navigation-link/block.json +1 -1
  104. package/build/navigation-link/edit.cjs +1 -1
  105. package/build/navigation-link/edit.cjs.map +2 -2
  106. package/build/navigation-link/link-ui/page-creator.cjs +0 -1
  107. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  108. package/build/navigation-link/shared/controls.cjs +0 -2
  109. package/build/navigation-link/shared/controls.cjs.map +2 -2
  110. package/build/navigation-submenu/block.json +7 -0
  111. package/build/navigation-submenu/edit.cjs +1 -1
  112. package/build/navigation-submenu/edit.cjs.map +2 -2
  113. package/build/page-list/block.json +2 -5
  114. package/build/page-list/edit.cjs +1 -11
  115. package/build/page-list/edit.cjs.map +2 -2
  116. package/build/playlist-track/edit.cjs +0 -3
  117. package/build/playlist-track/edit.cjs.map +2 -2
  118. package/build/post-author/edit.cjs +1 -1
  119. package/build/post-author/edit.cjs.map +2 -2
  120. package/build/post-author/utils.cjs +1 -1
  121. package/build/post-author/utils.cjs.map +2 -2
  122. package/build/post-comment/edit.cjs +0 -1
  123. package/build/post-comment/edit.cjs.map +2 -2
  124. package/build/post-date/edit.cjs +2 -2
  125. package/build/post-date/edit.cjs.map +2 -2
  126. package/build/post-excerpt/edit.cjs +2 -2
  127. package/build/post-excerpt/edit.cjs.map +2 -2
  128. package/build/post-featured-image/block.json +1 -0
  129. package/build/post-featured-image/dimension-controls.cjs +90 -178
  130. package/build/post-featured-image/dimension-controls.cjs.map +3 -3
  131. package/build/post-featured-image/edit.cjs +47 -18
  132. package/build/post-featured-image/edit.cjs.map +2 -2
  133. package/build/post-navigation-link/edit.cjs +2 -2
  134. package/build/post-navigation-link/edit.cjs.map +2 -2
  135. package/build/post-terms/edit.cjs +0 -1
  136. package/build/post-terms/edit.cjs.map +2 -2
  137. package/build/post-time-to-read/edit.cjs +1 -1
  138. package/build/post-time-to-read/edit.cjs.map +1 -1
  139. package/build/post-title/edit.cjs +0 -1
  140. package/build/post-title/edit.cjs.map +2 -2
  141. package/build/preformatted/edit.cjs +1 -1
  142. package/build/preformatted/edit.cjs.map +2 -2
  143. package/build/pullquote/block.json +1 -3
  144. package/build/pullquote/deprecated.cjs +114 -9
  145. package/build/pullquote/deprecated.cjs.map +3 -3
  146. package/build/pullquote/edit.cjs +43 -61
  147. package/build/pullquote/edit.cjs.map +3 -3
  148. package/build/pullquote/save.cjs +5 -26
  149. package/build/pullquote/save.cjs.map +3 -3
  150. package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
  151. package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
  152. package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +1 -1
  153. package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +1 -1
  154. package/build/query/edit/inspector-controls/index.cjs +0 -1
  155. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  156. package/build/query/edit/inspector-controls/order-control.cjs +2 -2
  157. package/build/query/edit/inspector-controls/order-control.cjs.map +2 -2
  158. package/build/query/utils.cjs +2 -2
  159. package/build/query/utils.cjs.map +2 -2
  160. package/build/query-pagination-next/edit.cjs +2 -2
  161. package/build/query-pagination-next/edit.cjs.map +1 -1
  162. package/build/query-pagination-previous/edit.cjs +2 -2
  163. package/build/query-pagination-previous/edit.cjs.map +1 -1
  164. package/build/query-title/edit.cjs +1 -1
  165. package/build/query-title/edit.cjs.map +2 -2
  166. package/build/query-total/edit.cjs +1 -1
  167. package/build/query-total/edit.cjs.map +2 -2
  168. package/build/quote/index.cjs +1 -1
  169. package/build/quote/index.cjs.map +2 -2
  170. package/build/read-more/edit.cjs +1 -1
  171. package/build/read-more/edit.cjs.map +2 -2
  172. package/build/rss/edit.cjs +1 -2
  173. package/build/rss/edit.cjs.map +2 -2
  174. package/build/search/block.json +4 -0
  175. package/build/search/edit.cjs +244 -206
  176. package/build/search/edit.cjs.map +2 -2
  177. package/build/shortcode/edit.cjs +1 -1
  178. package/build/shortcode/edit.cjs.map +2 -2
  179. package/build/site-logo/edit.cjs +2 -1
  180. package/build/site-logo/edit.cjs.map +2 -2
  181. package/build/site-tagline/edit.cjs +1 -1
  182. package/build/site-tagline/edit.cjs.map +2 -2
  183. package/build/site-title/edit.cjs +1 -1
  184. package/build/site-title/edit.cjs.map +2 -2
  185. package/build/social-link/edit.cjs +0 -3
  186. package/build/social-link/edit.cjs.map +2 -2
  187. package/build/tab-list/block.json +33 -20
  188. package/build/tab-list/edit.cjs +122 -12
  189. package/build/tab-list/edit.cjs.map +3 -3
  190. package/build/tab-list/init.cjs +28 -0
  191. package/build/tab-list/init.cjs.map +7 -0
  192. package/build/tab-list/save.cjs +33 -3
  193. package/build/tab-list/save.cjs.map +3 -3
  194. package/build/tab-panel/add-tab-toolbar-control.cjs +19 -8
  195. package/build/tab-panel/add-tab-toolbar-control.cjs.map +2 -2
  196. package/build/tab-panel/block.json +2 -6
  197. package/build/tab-panel/edit.cjs +0 -9
  198. package/build/tab-panel/edit.cjs.map +2 -2
  199. package/build/tab-panel/remove-tab-toolbar-control.cjs +9 -14
  200. package/build/tab-panel/remove-tab-toolbar-control.cjs.map +2 -2
  201. package/build/tab-panel/save.cjs +2 -1
  202. package/build/tab-panel/save.cjs.map +2 -2
  203. package/build/tab-panels/block.json +2 -28
  204. package/build/tab-panels/init.cjs +28 -0
  205. package/build/tab-panels/init.cjs.map +7 -0
  206. package/build/table/edit.cjs +0 -2
  207. package/build/table/edit.cjs.map +2 -2
  208. package/build/table/index.cjs +1 -1
  209. package/build/table/index.cjs.map +2 -2
  210. package/build/tabs/block.json +3 -17
  211. package/build/tabs/edit.cjs +7 -21
  212. package/build/tabs/edit.cjs.map +3 -3
  213. package/build/tabs/index.cjs +6 -10
  214. package/build/tabs/index.cjs.map +2 -2
  215. package/build/tabs/use-tab-list-items-sync.cjs +53 -0
  216. package/build/tabs/use-tab-list-items-sync.cjs.map +7 -0
  217. package/build/tabs/view.cjs +22 -104
  218. package/build/tabs/view.cjs.map +2 -2
  219. package/build/template-part/edit/advanced-controls.cjs +0 -1
  220. package/build/template-part/edit/advanced-controls.cjs.map +2 -2
  221. package/build/template-part/edit/title-modal.cjs +1 -2
  222. package/build/template-part/edit/title-modal.cjs.map +2 -2
  223. package/build/terms-query/edit/inspector-controls/order-control.cjs +2 -2
  224. package/build/terms-query/edit/inspector-controls/order-control.cjs.map +2 -2
  225. package/build/utils/style-state.cjs +164 -0
  226. package/build/utils/style-state.cjs.map +7 -0
  227. package/build/utils/waveform-player.cjs +1 -1
  228. package/build/verse/edit.cjs +1 -1
  229. package/build/verse/edit.cjs.map +2 -2
  230. package/build/video/edit.cjs +3 -2
  231. package/build/video/edit.cjs.map +2 -2
  232. package/build/video/tracks-editor.cjs +0 -2
  233. package/build/video/tracks-editor.cjs.map +2 -2
  234. package/build-module/audio/edit.mjs +8 -2
  235. package/build-module/audio/edit.mjs.map +2 -2
  236. package/build-module/breadcrumbs/edit.mjs +1 -2
  237. package/build-module/breadcrumbs/edit.mjs.map +2 -2
  238. package/build-module/button/edit.mjs +1 -2
  239. package/build-module/button/edit.mjs.map +2 -2
  240. package/build-module/categories/edit.mjs +1 -1
  241. package/build-module/categories/edit.mjs.map +1 -1
  242. package/build-module/code/edit.mjs +1 -1
  243. package/build-module/code/edit.mjs.map +2 -2
  244. package/build-module/code/index.mjs +1 -1
  245. package/build-module/code/index.mjs.map +1 -1
  246. package/build-module/columns/utils.mjs.map +1 -1
  247. package/build-module/comments/edit/comments-legacy.mjs +1 -1
  248. package/build-module/comments/edit/comments-legacy.mjs.map +1 -1
  249. package/build-module/comments/edit/placeholder.mjs +4 -4
  250. package/build-module/comments/edit/placeholder.mjs.map +1 -1
  251. package/build-module/comments-pagination-next/edit.mjs +2 -2
  252. package/build-module/comments-pagination-next/edit.mjs.map +1 -1
  253. package/build-module/comments-pagination-previous/edit.mjs +2 -2
  254. package/build-module/comments-pagination-previous/edit.mjs.map +1 -1
  255. package/build-module/cover/deprecated.mjs +3 -3
  256. package/build-module/cover/deprecated.mjs.map +2 -2
  257. package/build-module/cover/edit/block-controls.mjs +15 -2
  258. package/build-module/cover/edit/block-controls.mjs.map +2 -2
  259. package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
  260. package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
  261. package/build-module/cover/edit/index.mjs +64 -3
  262. package/build-module/cover/edit/index.mjs.map +2 -2
  263. package/build-module/cover/edit/inspector-controls.mjs +98 -35
  264. package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
  265. package/build-module/details/edit.mjs +1 -2
  266. package/build-module/details/edit.mjs.map +2 -2
  267. package/build-module/embed/embed-placeholder.mjs +1 -1
  268. package/build-module/embed/embed-placeholder.mjs.map +2 -2
  269. package/build-module/file/edit.mjs +5 -13
  270. package/build-module/file/edit.mjs.map +2 -2
  271. package/build-module/file/index.mjs +3 -1
  272. package/build-module/file/index.mjs.map +2 -2
  273. package/build-module/file/transforms.mjs +11 -32
  274. package/build-module/file/transforms.mjs.map +2 -2
  275. package/build-module/file/variations.mjs +17 -0
  276. package/build-module/file/variations.mjs.map +7 -0
  277. package/build-module/footnotes/edit.mjs +1 -1
  278. package/build-module/footnotes/edit.mjs.map +2 -2
  279. package/build-module/form/edit.mjs +0 -2
  280. package/build-module/form/edit.mjs.map +2 -2
  281. package/build-module/form-input/edit.mjs +1 -3
  282. package/build-module/form-input/edit.mjs.map +2 -2
  283. package/build-module/freeform/edit.mjs +6 -15
  284. package/build-module/freeform/edit.mjs.map +2 -2
  285. package/build-module/freeform/migration-notice.mjs.map +2 -2
  286. package/build-module/gallery/edit.mjs +2 -2
  287. package/build-module/gallery/edit.mjs.map +2 -2
  288. package/build-module/home-link/edit.mjs +1 -2
  289. package/build-module/home-link/edit.mjs.map +2 -2
  290. package/build-module/html/index.mjs +1 -1
  291. package/build-module/html/index.mjs.map +2 -2
  292. package/build-module/html/modal.mjs +9 -6
  293. package/build-module/html/modal.mjs.map +2 -2
  294. package/build-module/icon/block.json +12 -0
  295. package/build-module/icon/edit.mjs +94 -42
  296. package/build-module/icon/edit.mjs.map +2 -2
  297. package/build-module/icon/index.mjs +3 -1
  298. package/build-module/icon/index.mjs.map +2 -2
  299. package/build-module/icon/variations.mjs +13 -0
  300. package/build-module/icon/variations.mjs.map +7 -0
  301. package/build-module/image/block.json +1 -0
  302. package/build-module/image/edit.mjs +4 -3
  303. package/build-module/image/edit.mjs.map +2 -2
  304. package/build-module/image/image.mjs +96 -29
  305. package/build-module/image/image.mjs.map +2 -2
  306. package/build-module/image/index.mjs +1 -1
  307. package/build-module/image/index.mjs.map +2 -2
  308. package/build-module/image/transforms.mjs +9 -3
  309. package/build-module/image/transforms.mjs.map +2 -2
  310. package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
  311. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  312. package/build-module/index.mjs +1 -3
  313. package/build-module/index.mjs.map +2 -2
  314. package/build-module/latest-posts/edit.mjs +1 -1
  315. package/build-module/latest-posts/edit.mjs.map +1 -1
  316. package/build-module/list/ordered-list-settings.mjs +0 -1
  317. package/build-module/list/ordered-list-settings.mjs.map +2 -2
  318. package/build-module/math/edit.mjs +1 -1
  319. package/build-module/math/index.mjs +1 -1
  320. package/build-module/math/index.mjs.map +1 -1
  321. package/build-module/media-text/constants.mjs +1 -1
  322. package/build-module/media-text/constants.mjs.map +2 -2
  323. package/build-module/media-text/index.mjs +1 -1
  324. package/build-module/media-text/index.mjs.map +2 -2
  325. package/build-module/missing/edit.mjs +2 -2
  326. package/build-module/missing/edit.mjs.map +1 -1
  327. package/build-module/navigation/edit/index.mjs +19 -13
  328. package/build-module/navigation/edit/index.mjs.map +2 -2
  329. package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
  330. package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
  331. package/build-module/navigation/edit/navigation-menu-selector.mjs +1 -1
  332. package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
  333. package/build-module/navigation/edit/placeholder/index.mjs +1 -1
  334. package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
  335. package/build-module/navigation-link/block.json +1 -1
  336. package/build-module/navigation-link/edit.mjs +1 -1
  337. package/build-module/navigation-link/edit.mjs.map +2 -2
  338. package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
  339. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  340. package/build-module/navigation-link/shared/controls.mjs +0 -2
  341. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  342. package/build-module/navigation-submenu/block.json +7 -0
  343. package/build-module/navigation-submenu/edit.mjs +1 -1
  344. package/build-module/navigation-submenu/edit.mjs.map +2 -2
  345. package/build-module/page-list/block.json +2 -5
  346. package/build-module/page-list/edit.mjs +1 -11
  347. package/build-module/page-list/edit.mjs.map +2 -2
  348. package/build-module/playlist-track/edit.mjs +0 -3
  349. package/build-module/playlist-track/edit.mjs.map +2 -2
  350. package/build-module/post-author/edit.mjs +1 -1
  351. package/build-module/post-author/edit.mjs.map +2 -2
  352. package/build-module/post-author/utils.mjs +1 -1
  353. package/build-module/post-author/utils.mjs.map +2 -2
  354. package/build-module/post-comment/edit.mjs +0 -1
  355. package/build-module/post-comment/edit.mjs.map +2 -2
  356. package/build-module/post-date/edit.mjs +2 -2
  357. package/build-module/post-date/edit.mjs.map +2 -2
  358. package/build-module/post-excerpt/edit.mjs +2 -2
  359. package/build-module/post-excerpt/edit.mjs.map +2 -2
  360. package/build-module/post-featured-image/block.json +1 -0
  361. package/build-module/post-featured-image/dimension-controls.mjs +99 -187
  362. package/build-module/post-featured-image/dimension-controls.mjs.map +2 -2
  363. package/build-module/post-featured-image/edit.mjs +47 -18
  364. package/build-module/post-featured-image/edit.mjs.map +2 -2
  365. package/build-module/post-navigation-link/edit.mjs +2 -2
  366. package/build-module/post-navigation-link/edit.mjs.map +2 -2
  367. package/build-module/post-terms/edit.mjs +0 -1
  368. package/build-module/post-terms/edit.mjs.map +2 -2
  369. package/build-module/post-time-to-read/edit.mjs +1 -1
  370. package/build-module/post-time-to-read/edit.mjs.map +1 -1
  371. package/build-module/post-title/edit.mjs +0 -1
  372. package/build-module/post-title/edit.mjs.map +2 -2
  373. package/build-module/preformatted/edit.mjs +1 -1
  374. package/build-module/preformatted/edit.mjs.map +2 -2
  375. package/build-module/pullquote/block.json +1 -3
  376. package/build-module/pullquote/deprecated.mjs +114 -9
  377. package/build-module/pullquote/deprecated.mjs.map +2 -2
  378. package/build-module/pullquote/edit.mjs +44 -67
  379. package/build-module/pullquote/edit.mjs.map +2 -2
  380. package/build-module/pullquote/save.mjs +5 -16
  381. package/build-module/pullquote/save.mjs.map +2 -2
  382. package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
  383. package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
  384. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +1 -1
  385. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +1 -1
  386. package/build-module/query/edit/inspector-controls/index.mjs +0 -1
  387. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  388. package/build-module/query/edit/inspector-controls/order-control.mjs +2 -2
  389. package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
  390. package/build-module/query/utils.mjs +2 -2
  391. package/build-module/query/utils.mjs.map +2 -2
  392. package/build-module/query-pagination-next/edit.mjs +2 -2
  393. package/build-module/query-pagination-next/edit.mjs.map +1 -1
  394. package/build-module/query-pagination-previous/edit.mjs +2 -2
  395. package/build-module/query-pagination-previous/edit.mjs.map +1 -1
  396. package/build-module/query-title/edit.mjs +1 -1
  397. package/build-module/query-title/edit.mjs.map +2 -2
  398. package/build-module/query-total/edit.mjs +1 -1
  399. package/build-module/query-total/edit.mjs.map +2 -2
  400. package/build-module/quote/index.mjs +1 -1
  401. package/build-module/quote/index.mjs.map +2 -2
  402. package/build-module/read-more/edit.mjs +1 -1
  403. package/build-module/read-more/edit.mjs.map +2 -2
  404. package/build-module/rss/edit.mjs +1 -2
  405. package/build-module/rss/edit.mjs.map +2 -2
  406. package/build-module/search/block.json +4 -0
  407. package/build-module/search/edit.mjs +244 -206
  408. package/build-module/search/edit.mjs.map +2 -2
  409. package/build-module/shortcode/edit.mjs +1 -1
  410. package/build-module/shortcode/edit.mjs.map +2 -2
  411. package/build-module/site-logo/edit.mjs +2 -1
  412. package/build-module/site-logo/edit.mjs.map +2 -2
  413. package/build-module/site-tagline/edit.mjs +1 -1
  414. package/build-module/site-tagline/edit.mjs.map +2 -2
  415. package/build-module/site-title/edit.mjs +1 -1
  416. package/build-module/site-title/edit.mjs.map +2 -2
  417. package/build-module/social-link/edit.mjs +0 -3
  418. package/build-module/social-link/edit.mjs.map +2 -2
  419. package/build-module/tab-list/block.json +33 -20
  420. package/build-module/tab-list/edit.mjs +128 -15
  421. package/build-module/tab-list/edit.mjs.map +2 -2
  422. package/build-module/tab-list/init.mjs +7 -0
  423. package/build-module/tab-list/init.mjs.map +7 -0
  424. package/build-module/tab-list/save.mjs +29 -4
  425. package/build-module/tab-list/save.mjs.map +2 -2
  426. package/build-module/tab-panel/add-tab-toolbar-control.mjs +19 -8
  427. package/build-module/tab-panel/add-tab-toolbar-control.mjs.map +2 -2
  428. package/build-module/tab-panel/block.json +2 -6
  429. package/build-module/tab-panel/edit.mjs +1 -10
  430. package/build-module/tab-panel/edit.mjs.map +2 -2
  431. package/build-module/tab-panel/remove-tab-toolbar-control.mjs +9 -14
  432. package/build-module/tab-panel/remove-tab-toolbar-control.mjs.map +2 -2
  433. package/build-module/tab-panel/save.mjs +2 -1
  434. package/build-module/tab-panel/save.mjs.map +2 -2
  435. package/build-module/tab-panels/block.json +2 -28
  436. package/build-module/tab-panels/init.mjs +7 -0
  437. package/build-module/tab-panels/init.mjs.map +7 -0
  438. package/build-module/table/edit.mjs +0 -2
  439. package/build-module/table/edit.mjs.map +2 -2
  440. package/build-module/table/index.mjs +1 -1
  441. package/build-module/table/index.mjs.map +2 -2
  442. package/build-module/tabs/block.json +3 -17
  443. package/build-module/tabs/edit.mjs +7 -21
  444. package/build-module/tabs/edit.mjs.map +2 -2
  445. package/build-module/tabs/index.mjs +6 -10
  446. package/build-module/tabs/index.mjs.map +2 -2
  447. package/build-module/tabs/use-tab-list-items-sync.mjs +32 -0
  448. package/build-module/tabs/use-tab-list-items-sync.mjs.map +7 -0
  449. package/build-module/tabs/view.mjs +22 -104
  450. package/build-module/tabs/view.mjs.map +2 -2
  451. package/build-module/template-part/edit/advanced-controls.mjs +0 -1
  452. package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
  453. package/build-module/template-part/edit/title-modal.mjs +1 -2
  454. package/build-module/template-part/edit/title-modal.mjs.map +2 -2
  455. package/build-module/terms-query/edit/inspector-controls/order-control.mjs +2 -2
  456. package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
  457. package/build-module/utils/style-state.mjs +132 -0
  458. package/build-module/utils/style-state.mjs.map +7 -0
  459. package/build-module/utils/waveform-player.mjs +1 -1
  460. package/build-module/verse/edit.mjs +1 -1
  461. package/build-module/verse/edit.mjs.map +2 -2
  462. package/build-module/video/edit.mjs +3 -3
  463. package/build-module/video/edit.mjs.map +2 -2
  464. package/build-module/video/tracks-editor.mjs +0 -2
  465. package/build-module/video/tracks-editor.mjs.map +2 -2
  466. package/build-style/editor-rtl.css +0 -19
  467. package/build-style/editor.css +0 -19
  468. package/build-style/icon/style-rtl.css +9 -0
  469. package/build-style/icon/style.css +9 -0
  470. package/build-style/style-rtl.css +11 -24
  471. package/build-style/style.css +11 -24
  472. package/build-style/{tab → tab-list}/style-rtl.css +2 -2
  473. package/build-style/{tab → tab-list}/style.css +2 -2
  474. package/build-style/tab-panel/style-rtl.css +0 -17
  475. package/build-style/tab-panel/style.css +0 -17
  476. package/package.json +48 -45
  477. package/src/audio/edit.js +5 -9
  478. package/src/avatar/index.php +2 -2
  479. package/src/block/index.php +2 -26
  480. package/src/breadcrumbs/edit.js +0 -1
  481. package/src/button/edit.js +0 -1
  482. package/src/comment-author-avatar/index.php +3 -3
  483. package/src/comment-author-name/index.php +1 -1
  484. package/src/comment-date/index.php +1 -1
  485. package/src/cover/edit/block-controls.js +14 -2
  486. package/src/cover/edit/embed-video-url-input.js +0 -1
  487. package/src/cover/edit/index.js +86 -0
  488. package/src/cover/edit/inspector-controls.js +124 -54
  489. package/src/cover/test/edit.js +51 -2
  490. package/src/details/edit.js +0 -1
  491. package/src/editor.scss +0 -2
  492. package/src/file/edit.js +3 -16
  493. package/src/file/index.js +2 -0
  494. package/src/file/transforms.js +12 -31
  495. package/src/file/variations.js +17 -0
  496. package/src/form/edit.js +0 -2
  497. package/src/form-input/edit.js +0 -2
  498. package/src/freeform/edit.js +6 -29
  499. package/src/freeform/migration-notice.js +2 -4
  500. package/src/gallery/edit.js +13 -13
  501. package/src/home-link/edit.js +0 -1
  502. package/src/html/modal.js +3 -0
  503. package/src/icon/README.md +3 -0
  504. package/src/icon/block.json +12 -0
  505. package/src/icon/edit.js +85 -37
  506. package/src/icon/index.js +3 -1
  507. package/src/icon/index.php +23 -0
  508. package/src/icon/style.scss +12 -0
  509. package/src/icon/variations.js +9 -0
  510. package/src/image/README.md +1 -0
  511. package/src/image/block.json +1 -0
  512. package/src/image/edit.js +8 -3
  513. package/src/image/image.js +120 -56
  514. package/src/image/index.php +0 -1
  515. package/src/image/test/use-open-image-media-editor-modal.js +20 -26
  516. package/src/image/transforms.js +34 -8
  517. package/src/image/use-open-image-media-editor-modal.js +24 -42
  518. package/src/index.js +4 -11
  519. package/src/list/ordered-list-settings.js +0 -1
  520. package/src/navigation/edit/index.js +25 -16
  521. package/src/navigation/edit/navigation-menu-name-control.js +0 -1
  522. package/src/navigation/index.php +58 -0
  523. package/src/navigation-link/README.md +1 -1
  524. package/src/navigation-link/block.json +1 -1
  525. package/src/navigation-link/link-ui/page-creator.js +0 -1
  526. package/src/navigation-link/shared/controls.js +0 -2
  527. package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
  528. package/src/navigation-submenu/README.md +5 -0
  529. package/src/navigation-submenu/block.json +7 -0
  530. package/src/page-list/README.md +1 -1
  531. package/src/page-list/block.json +2 -5
  532. package/src/page-list/edit.js +0 -11
  533. package/src/page-list/index.php +1 -1
  534. package/src/playlist-track/edit.js +0 -3
  535. package/src/post-comment/edit.js +0 -1
  536. package/src/post-date/edit.js +2 -2
  537. package/src/post-featured-image/README.md +1 -0
  538. package/src/post-featured-image/block.json +1 -0
  539. package/src/post-featured-image/dimension-controls.js +105 -184
  540. package/src/post-featured-image/edit.js +53 -22
  541. package/src/post-featured-image/index.php +24 -22
  542. package/src/post-terms/edit.js +0 -1
  543. package/src/post-title/edit.js +0 -1
  544. package/src/pullquote/README.md +1 -1
  545. package/src/pullquote/block.json +1 -3
  546. package/src/pullquote/deprecated.js +121 -9
  547. package/src/pullquote/edit.js +7 -31
  548. package/src/pullquote/save.js +2 -13
  549. package/src/query/edit/enhanced-pagination-modal.js +11 -1
  550. package/src/query/edit/inspector-controls/index.js +0 -1
  551. package/src/rss/edit.js +0 -1
  552. package/src/search/README.md +1 -0
  553. package/src/search/block.json +4 -0
  554. package/src/search/edit.js +106 -55
  555. package/src/search/index.php +25 -1
  556. package/src/site-logo/edit.js +3 -1
  557. package/src/social-link/edit.js +0 -3
  558. package/src/style.scss +1 -2
  559. package/src/tab-list/README.md +19 -17
  560. package/src/tab-list/block.json +33 -20
  561. package/src/tab-list/edit.js +153 -15
  562. package/src/tab-list/index.php +24 -33
  563. package/src/tab-list/init.js +6 -0
  564. package/src/tab-list/save.js +39 -4
  565. package/src/{tab → tab-list}/style.scss +2 -3
  566. package/src/tab-panel/README.md +0 -3
  567. package/src/tab-panel/add-tab-toolbar-control.js +24 -11
  568. package/src/tab-panel/block.json +2 -6
  569. package/src/tab-panel/edit.js +1 -14
  570. package/src/tab-panel/index.php +2 -25
  571. package/src/tab-panel/remove-tab-toolbar-control.js +10 -14
  572. package/src/tab-panel/save.js +1 -0
  573. package/src/tab-panel/style.scss +0 -17
  574. package/src/tab-panels/README.md +0 -16
  575. package/src/tab-panels/block.json +2 -28
  576. package/src/tab-panels/init.js +6 -0
  577. package/src/table/edit.js +0 -2
  578. package/src/tabs/README.md +1 -7
  579. package/src/tabs/block.json +3 -17
  580. package/src/tabs/edit.js +8 -19
  581. package/src/tabs/index.js +6 -10
  582. package/src/tabs/index.php +12 -32
  583. package/src/tabs/use-tab-list-items-sync.js +49 -0
  584. package/src/tabs/view.js +22 -110
  585. package/src/template-part/edit/advanced-controls.js +0 -1
  586. package/src/template-part/edit/title-modal.js +0 -1
  587. package/src/utils/style-state.js +151 -0
  588. package/src/utils/test/style-state.js +307 -0
  589. package/src/video/edit.js +9 -16
  590. package/src/video/tracks-editor.js +0 -2
  591. package/babel-plugin.cjs +0 -150
  592. package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
  593. package/build/list-item/utils.cjs +0 -57
  594. package/build/list-item/utils.cjs.map +0 -7
  595. package/build/tab/block.json +0 -56
  596. package/build/tab/controls.cjs +0 -46
  597. package/build/tab/controls.cjs.map +0 -7
  598. package/build/tab/edit.cjs +0 -135
  599. package/build/tab/edit.cjs.map +0 -7
  600. package/build/tab/index.cjs +0 -58
  601. package/build/tab/index.cjs.map +0 -7
  602. package/build/tab/save.cjs.map +0 -7
  603. package/build/tabs/use-tab-list-sync.cjs +0 -190
  604. package/build/tabs/use-tab-list-sync.cjs.map +0 -7
  605. package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
  606. package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
  607. package/build-module/list-item/utils.mjs +0 -32
  608. package/build-module/list-item/utils.mjs.map +0 -7
  609. package/build-module/tab/block.json +0 -56
  610. package/build-module/tab/controls.mjs +0 -15
  611. package/build-module/tab/controls.mjs.map +0 -7
  612. package/build-module/tab/edit.mjs +0 -108
  613. package/build-module/tab/edit.mjs.map +0 -7
  614. package/build-module/tab/index.mjs +0 -20
  615. package/build-module/tab/index.mjs.map +0 -7
  616. package/build-module/tab/save.mjs +0 -14
  617. package/build-module/tab/save.mjs.map +0 -7
  618. package/build-module/tabs/use-tab-list-sync.mjs +0 -169
  619. package/build-module/tabs/use-tab-list-sync.mjs.map +0 -7
  620. package/build-style/tab/editor-rtl.css +0 -11
  621. package/build-style/tab/editor.css +0 -11
  622. package/build-style/tab-list/editor-rtl.css +0 -6
  623. package/build-style/tab-list/editor.css +0 -6
  624. package/build-style/tab-panels/style-rtl.css +0 -4
  625. package/build-style/tab-panels/style.css +0 -4
  626. package/src/freeform/convert-to-blocks-button.js +0 -18
  627. package/src/list-item/utils.js +0 -34
  628. package/src/tab/README.md +0 -69
  629. package/src/tab/block.json +0 -56
  630. package/src/tab/controls.js +0 -19
  631. package/src/tab/edit.js +0 -141
  632. package/src/tab/editor.scss +0 -14
  633. package/src/tab/index.js +0 -24
  634. package/src/tab/index.php +0 -70
  635. package/src/tab/save.js +0 -13
  636. package/src/tab-list/editor.scss +0 -10
  637. package/src/tab-panels/style.scss +0 -4
  638. package/src/tabs/use-tab-list-sync.js +0 -237
@@ -1,169 +0,0 @@
1
- // packages/block-library/src/tabs/use-tab-list-sync.js
2
- import { createBlock } from "@wordpress/blocks";
3
- import { store as blockEditorStore } from "@wordpress/block-editor";
4
- import { useDispatch } from "@wordpress/data";
5
- import { useEffect, useRef } from "@wordpress/element";
6
- function useTabListSync({
7
- tabPanels,
8
- tabs,
9
- tabPanelsClientId,
10
- tabsListClientId
11
- }) {
12
- const {
13
- removeBlock,
14
- insertBlocks,
15
- replaceInnerBlocks,
16
- __unstableMarkNextChangeAsNotPersistent
17
- } = useDispatch(blockEditorStore);
18
- const prevSyncStateRef = useRef(null);
19
- useEffect(() => {
20
- if (prevSyncStateRef.current === null) {
21
- prevSyncStateRef.current = {
22
- tabPanels: [...tabPanels],
23
- tabs: [...tabs]
24
- };
25
- return;
26
- }
27
- const { tabPanels: prevTabPanels, tabs: prevTabs } = prevSyncStateRef.current;
28
- const tabPanelCountChange = tabPanels.length - prevTabPanels.length;
29
- const tabCountChange = tabs.length - prevTabs.length;
30
- const tabPanelsInserted = tabPanelCountChange > 0;
31
- const tabsInserted = tabCountChange > 0;
32
- if (tabPanelCountChange === tabCountChange) {
33
- if (tabPanelCountChange === 0 && tabPanelsClientId && tabs.some((m, i) => m.clientId !== prevTabs[i]?.clientId)) {
34
- const reorderedTabPanels = tabs.map((tab) => {
35
- const oldIndex = prevTabs.findIndex(
36
- (pm) => pm.clientId === tab.clientId
37
- );
38
- return oldIndex !== -1 ? tabPanels[oldIndex] : null;
39
- }).filter(Boolean);
40
- if (reorderedTabPanels.length === tabPanels.length) {
41
- __unstableMarkNextChangeAsNotPersistent();
42
- replaceInnerBlocks(
43
- tabPanelsClientId,
44
- reorderedTabPanels,
45
- false
46
- );
47
- }
48
- }
49
- prevSyncStateRef.current = {
50
- tabPanels: [...tabPanels],
51
- tabs: [...tabs]
52
- };
53
- return;
54
- }
55
- if (tabPanelCountChange > 0 && tabCountChange > 0 || tabPanelCountChange < 0 && tabCountChange < 0) {
56
- prevSyncStateRef.current = {
57
- tabPanels: [...tabPanels],
58
- tabs: [...tabs]
59
- };
60
- return;
61
- }
62
- if (tabPanelsInserted && !tabsListClientId) {
63
- return;
64
- }
65
- if (tabsInserted && !tabPanelsClientId) {
66
- return;
67
- }
68
- prevSyncStateRef.current = {
69
- tabPanels: [...tabPanels],
70
- tabs: [...tabs]
71
- };
72
- const currentTabPanelIds = new Set(
73
- tabPanels.map((t) => t.clientId)
74
- );
75
- const currentTabIds = new Set(tabs.map((m) => m.clientId));
76
- if (tabPanelCountChange < 0) {
77
- const removedIndices = prevTabPanels.map(
78
- (t, i) => !currentTabPanelIds.has(t.clientId) ? i : -1
79
- ).filter((i) => i !== -1);
80
- const removedSet = new Set(removedIndices);
81
- removedIndices.forEach((removedIndex) => {
82
- if (tabs[removedIndex]) {
83
- __unstableMarkNextChangeAsNotPersistent();
84
- removeBlock(tabs[removedIndex].clientId, false);
85
- }
86
- });
87
- prevSyncStateRef.current.tabs = prevSyncStateRef.current.tabs.filter(
88
- (_, i) => !removedSet.has(i)
89
- );
90
- } else if (tabCountChange < 0) {
91
- const removedIndices = prevTabs.map(
92
- (m, i) => !currentTabIds.has(m.clientId) ? i : -1
93
- ).filter((i) => i !== -1);
94
- const removedSet = new Set(removedIndices);
95
- removedIndices.forEach((removedIndex) => {
96
- if (tabPanels[removedIndex]) {
97
- __unstableMarkNextChangeAsNotPersistent();
98
- removeBlock(tabPanels[removedIndex].clientId, false);
99
- }
100
- });
101
- prevSyncStateRef.current.tabPanels = prevSyncStateRef.current.tabPanels.filter(
102
- (_, i) => !removedSet.has(i)
103
- );
104
- } else if (tabPanelsInserted) {
105
- const prevTabPanelIds = new Set(
106
- prevTabPanels.map((t) => t.clientId)
107
- );
108
- const newTabs = tabPanels.map(
109
- (tabPanel, tabPanelIndex) => !prevTabPanelIds.has(tabPanel.clientId) ? {
110
- tabPanelIndex,
111
- block: createBlock("core/tab", {})
112
- } : null
113
- ).filter(Boolean);
114
- if (newTabs.length > 0) {
115
- __unstableMarkNextChangeAsNotPersistent();
116
- insertBlocks(
117
- newTabs.map(({ block }) => block),
118
- newTabs[0].tabPanelIndex,
119
- tabsListClientId,
120
- false
121
- );
122
- newTabs.forEach(({ tabPanelIndex, block }) => {
123
- prevSyncStateRef.current.tabs.splice(tabPanelIndex, 0, {
124
- clientId: block.clientId
125
- });
126
- });
127
- }
128
- } else if (tabsInserted) {
129
- const prevTabIds = new Set(prevTabs.map((m) => m.clientId));
130
- const newTabPanels = tabs.map((tab, tabIndex) => {
131
- if (prevTabIds.has(tab.clientId)) {
132
- return null;
133
- }
134
- const label = tabPanels[tabIndex - 1]?.attributes?.label ?? tabPanels[tabIndex]?.attributes?.label ?? "";
135
- return {
136
- tabIndex,
137
- block: createBlock("core/tab-panel", { label })
138
- };
139
- }).filter(Boolean);
140
- if (newTabPanels.length > 0) {
141
- __unstableMarkNextChangeAsNotPersistent();
142
- insertBlocks(
143
- newTabPanels.map(({ block }) => block),
144
- newTabPanels[0].tabIndex,
145
- tabPanelsClientId,
146
- false
147
- );
148
- newTabPanels.forEach(({ tabIndex, block }) => {
149
- prevSyncStateRef.current.tabPanels.splice(tabIndex, 0, {
150
- clientId: block.clientId
151
- });
152
- });
153
- }
154
- }
155
- }, [
156
- tabPanels,
157
- tabs,
158
- removeBlock,
159
- insertBlocks,
160
- replaceInnerBlocks,
161
- __unstableMarkNextChangeAsNotPersistent,
162
- tabsListClientId,
163
- tabPanelsClientId
164
- ]);
165
- }
166
- export {
167
- useTabListSync as default
168
- };
169
- //# sourceMappingURL=use-tab-list-sync.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/tabs/use-tab-list-sync.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Keep tabs and tab panels in sync when the lists change due to direct\n * user actions (deletion, paste, duplicate, drag-and-drop).\n *\n * Deletion: when one side shrinks, remove the counterpart at the same index.\n * Insertion: when one side grows without the other, insert the missing\n * counterpart at the matching index.\n *\n * When both lists change simultaneously (e.g. the \"Add Tab\" toolbar button,\n * which inserts both at once), no action is needed and the effect exits early.\n *\n * @param {Object} props\n * @param {Array} props.tabs Raw core/tab block objects.\n * @param {Array} props.tabPanels Raw core/tab-panel block objects.\n * @param {string|null} props.tabPanelsClientId Client ID of the core/tab-panels block.\n * @param {string|null} props.tabsListClientId Client ID of the core/tab-list block.\n */\nexport default function useTabListSync( {\n\ttabPanels,\n\ttabs,\n\ttabPanelsClientId,\n\ttabsListClientId,\n} ) {\n\tconst {\n\t\tremoveBlock,\n\t\tinsertBlocks,\n\t\treplaceInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\n\tconst prevSyncStateRef = useRef( null );\n\tuseEffect( () => {\n\t\tif ( prevSyncStateRef.current === null ) {\n\t\t\tprevSyncStateRef.current = {\n\t\t\t\ttabPanels: [ ...tabPanels ],\n\t\t\t\ttabs: [ ...tabs ],\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabPanels: prevTabPanels, tabs: prevTabs } =\n\t\t\tprevSyncStateRef.current;\n\n\t\tconst tabPanelCountChange = tabPanels.length - prevTabPanels.length;\n\t\tconst tabCountChange = tabs.length - prevTabs.length;\n\n\t\tconst tabPanelsInserted = tabPanelCountChange > 0;\n\t\tconst tabsInserted = tabCountChange > 0;\n\n\t\t// Both sides changed by the same amount.\n\t\t// Covers: no-op re-renders, \"Add Tab\" toolbar, and toolbar-remove.\n\t\t// Also handles drag-and-drop reordering of tabs.\n\t\tif ( tabPanelCountChange === tabCountChange ) {\n\t\t\t// When lengths are equal but order changed, the user reordered tabs\n\t\t\t// via drag-and-drop. Reorder the tab panel blocks to match.\n\t\t\tif (\n\t\t\t\ttabPanelCountChange === 0 &&\n\t\t\t\ttabPanelsClientId &&\n\t\t\t\ttabs.some( ( m, i ) => m.clientId !== prevTabs[ i ]?.clientId )\n\t\t\t) {\n\t\t\t\tconst reorderedTabPanels = tabs\n\t\t\t\t\t.map( ( tab ) => {\n\t\t\t\t\t\tconst oldIndex = prevTabs.findIndex(\n\t\t\t\t\t\t\t( pm ) => pm.clientId === tab.clientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn oldIndex !== -1 ? tabPanels[ oldIndex ] : null;\n\t\t\t\t\t} )\n\t\t\t\t\t.filter( Boolean );\n\t\t\t\tif ( reorderedTabPanels.length === tabPanels.length ) {\n\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\ttabPanelsClientId,\n\t\t\t\t\t\treorderedTabPanels,\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprevSyncStateRef.current = {\n\t\t\t\ttabPanels: [ ...tabPanels ],\n\t\t\t\ttabs: [ ...tabs ],\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\n\t\t// Both sides changed in the same direction but by different amounts.\n\t\t// Bail without making a partial fix.\n\t\tif (\n\t\t\t( tabPanelCountChange > 0 && tabCountChange > 0 ) ||\n\t\t\t( tabPanelCountChange < 0 && tabCountChange < 0 )\n\t\t) {\n\t\t\tprevSyncStateRef.current = {\n\t\t\t\ttabPanels: [ ...tabPanels ],\n\t\t\t\ttabs: [ ...tabs ],\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\n\t\t// If the required container block isn't available yet, bail without\n\t\t// updating the snapshot so the next render re-evaluates the same count change.\n\t\tif ( tabPanelsInserted && ! tabsListClientId ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( tabsInserted && ! tabPanelsClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update snapshot to the current state.\n\t\tprevSyncStateRef.current = {\n\t\t\ttabPanels: [ ...tabPanels ],\n\t\t\ttabs: [ ...tabs ],\n\t\t};\n\n\t\tconst currentTabPanelIds = new Set(\n\t\t\ttabPanels.map( ( t ) => t.clientId )\n\t\t);\n\t\tconst currentTabIds = new Set( tabs.map( ( m ) => m.clientId ) );\n\n\t\tif ( tabPanelCountChange < 0 ) {\n\t\t\t// Remove the tab at the same position as each deleted tab panel.\n\t\t\tconst removedIndices = prevTabPanels\n\t\t\t\t.map( ( t, i ) =>\n\t\t\t\t\t! currentTabPanelIds.has( t.clientId ) ? i : -1\n\t\t\t\t)\n\t\t\t\t.filter( ( i ) => i !== -1 );\n\t\t\tconst removedSet = new Set( removedIndices );\n\t\t\tremovedIndices.forEach( ( removedIndex ) => {\n\t\t\t\tif ( tabs[ removedIndex ] ) {\n\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\tremoveBlock( tabs[ removedIndex ].clientId, false );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tprevSyncStateRef.current.tabs =\n\t\t\t\tprevSyncStateRef.current.tabs.filter(\n\t\t\t\t\t( _, i ) => ! removedSet.has( i )\n\t\t\t\t);\n\t\t} else if ( tabCountChange < 0 ) {\n\t\t\t// Remove the tab panel at the same position as each deleted tab.\n\t\t\tconst removedIndices = prevTabs\n\t\t\t\t.map( ( m, i ) =>\n\t\t\t\t\t! currentTabIds.has( m.clientId ) ? i : -1\n\t\t\t\t)\n\t\t\t\t.filter( ( i ) => i !== -1 );\n\t\t\tconst removedSet = new Set( removedIndices );\n\t\t\tremovedIndices.forEach( ( removedIndex ) => {\n\t\t\t\tif ( tabPanels[ removedIndex ] ) {\n\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\tremoveBlock( tabPanels[ removedIndex ].clientId, false );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tprevSyncStateRef.current.tabPanels =\n\t\t\t\tprevSyncStateRef.current.tabPanels.filter(\n\t\t\t\t\t( _, i ) => ! removedSet.has( i )\n\t\t\t\t);\n\t\t} else if ( tabPanelsInserted ) {\n\t\t\t// A tab panel was pasted or duplicated \u2014 insert a matching tab.\n\t\t\tconst prevTabPanelIds = new Set(\n\t\t\t\tprevTabPanels.map( ( t ) => t.clientId )\n\t\t\t);\n\t\t\tconst newTabs = tabPanels\n\t\t\t\t.map( ( tabPanel, tabPanelIndex ) =>\n\t\t\t\t\t! prevTabPanelIds.has( tabPanel.clientId )\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttabPanelIndex,\n\t\t\t\t\t\t\t\tblock: createBlock( 'core/tab', {} ),\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: null\n\t\t\t\t)\n\t\t\t\t.filter( Boolean );\n\n\t\t\tif ( newTabs.length > 0 ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tnewTabs.map( ( { block } ) => block ),\n\t\t\t\t\tnewTabs[ 0 ].tabPanelIndex,\n\t\t\t\t\ttabsListClientId,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tnewTabs.forEach( ( { tabPanelIndex, block } ) => {\n\t\t\t\t\tprevSyncStateRef.current.tabs.splice( tabPanelIndex, 0, {\n\t\t\t\t\t\tclientId: block.clientId,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t}\n\t\t} else if ( tabsInserted ) {\n\t\t\t// A tab was pasted or duplicated \u2014 insert a matching tab panels,\n\t\t\t// copying the label from the adjacent tab panel.\n\t\t\tconst prevTabIds = new Set( prevTabs.map( ( m ) => m.clientId ) );\n\t\t\tconst newTabPanels = tabs\n\t\t\t\t.map( ( tab, tabIndex ) => {\n\t\t\t\t\tif ( prevTabIds.has( tab.clientId ) ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tconst label =\n\t\t\t\t\t\ttabPanels[ tabIndex - 1 ]?.attributes?.label ??\n\t\t\t\t\t\ttabPanels[ tabIndex ]?.attributes?.label ??\n\t\t\t\t\t\t'';\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\tblock: createBlock( 'core/tab-panel', { label } ),\n\t\t\t\t\t};\n\t\t\t\t} )\n\t\t\t\t.filter( Boolean );\n\n\t\t\tif ( newTabPanels.length > 0 ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tnewTabPanels.map( ( { block } ) => block ),\n\t\t\t\t\tnewTabPanels[ 0 ].tabIndex,\n\t\t\t\t\ttabPanelsClientId,\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tnewTabPanels.forEach( ( { tabIndex, block } ) => {\n\t\t\t\t\tprevSyncStateRef.current.tabPanels.splice( tabIndex, 0, {\n\t\t\t\t\t\tclientId: block.clientId,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}, [\n\t\ttabPanels,\n\t\ttabs,\n\t\tremoveBlock,\n\t\tinsertBlocks,\n\t\treplaceInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\ttabsListClientId,\n\t\ttabPanelsClientId,\n\t] );\n}\n"],
5
- "mappings": "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",
6
- "names": []
7
- }
@@ -1,11 +0,0 @@
1
- .wp-block-tab.is-selected {
2
- outline-offset: 2px;
3
- }
4
-
5
- .block-editor-block-preview__live-content:has(.wp-block-tab) {
6
- flex-basis: inherit !important;
7
- flex-grow: inherit !important;
8
- }
9
- .block-editor-block-preview__live-content:has(.wp-block-tab) .wp-block-tab {
10
- flex-basis: 100% !important;
11
- }
@@ -1,11 +0,0 @@
1
- .wp-block-tab.is-selected {
2
- outline-offset: 2px;
3
- }
4
-
5
- .block-editor-block-preview__live-content:has(.wp-block-tab) {
6
- flex-basis: inherit !important;
7
- flex-grow: inherit !important;
8
- }
9
- .block-editor-block-preview__live-content:has(.wp-block-tab) .wp-block-tab {
10
- flex-basis: 100% !important;
11
- }
@@ -1,6 +0,0 @@
1
- .wp-block-tab-list > .block-editor-block-list__layout {
2
- display: contents;
3
- }
4
- .wp-block-tab-list .block-editor-block-list__block:has(> .wp-block-tab) {
5
- display: contents;
6
- }
@@ -1,6 +0,0 @@
1
- .wp-block-tab-list > .block-editor-block-list__layout {
2
- display: contents;
3
- }
4
- .wp-block-tab-list .block-editor-block-list__block:has(> .wp-block-tab) {
5
- display: contents;
6
- }
@@ -1,4 +0,0 @@
1
- .wp-block-tab-panels {
2
- flex-grow: 1;
3
- min-width: 0;
4
- }
@@ -1,4 +0,0 @@
1
- .wp-block-tab-panels {
2
- flex-grow: 1;
3
- min-width: 0;
4
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { ToolbarButton } from '@wordpress/components';
6
- import { rawHandler } from '@wordpress/blocks';
7
-
8
- const ConvertToBlocksButton = ( { content, onReplace } ) => {
9
- return (
10
- <ToolbarButton
11
- onClick={ () => onReplace( rawHandler( { HTML: content } ) ) }
12
- >
13
- { __( 'Convert to blocks' ) }
14
- </ToolbarButton>
15
- );
16
- };
17
-
18
- export default ConvertToBlocksButton;
@@ -1,34 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { switchToBlockType } from '@wordpress/blocks';
5
-
6
- function convertBlockToList( block ) {
7
- const list = switchToBlockType( block, 'core/list' );
8
- if ( list ) {
9
- return list;
10
- }
11
- const paragraph = switchToBlockType( block, 'core/paragraph' );
12
- if ( ! paragraph ) {
13
- return null;
14
- }
15
- return switchToBlockType( paragraph, 'core/list' );
16
- }
17
-
18
- export function convertToListItems( blocks ) {
19
- const listItems = [];
20
-
21
- for ( let block of blocks ) {
22
- if ( block.name === 'core/list-item' ) {
23
- listItems.push( block );
24
- } else if ( block.name === 'core/list' ) {
25
- listItems.push( ...block.innerBlocks );
26
- } else if ( ( block = convertBlockToList( block ) ) ) {
27
- for ( const { innerBlocks } of block ) {
28
- listItems.push( ...innerBlocks );
29
- }
30
- }
31
- }
32
-
33
- return listItems;
34
- }
package/src/tab/README.md DELETED
@@ -1,69 +0,0 @@
1
- # Tab
2
-
3
- <!-- START TOKEN(Autogenerated block API docs) -->
4
- <div class="callout callout-warning">This block is <strong>experimental</strong> and may change or be removed without notice.</div>
5
-
6
- A single tab button in the tab list.
7
-
8
- - **Name:** `core/tab`
9
- - **Category:** [design](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-design/)
10
- - **API Version:** [3](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/)
11
- - **Block Type:** [Hybrid](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/) (static save + server enhancements)
12
-
13
- ## Block Relationships
14
-
15
- **[Parent](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#parent) blocks (direct):**
16
- - [`core/tab-list`](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-design/core-block-tab-list/)
17
-
18
- ## Attributes
19
-
20
- _Defined via the [`attributes`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/) property in block.json._
21
-
22
- _This block has no custom attributes._
23
-
24
- ## Supports
25
-
26
- _Defined via the [`supports`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/) property in block.json._
27
-
28
- - [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
29
- - [`reusable`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#reusable): `false`
30
- - [`visibility`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#visibility): `false`
31
- - [`lock`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#lock): `false`
32
- - [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
33
- - [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-background): `true`
34
- - [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `true`
35
- - [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
36
- - [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
37
- - [`textAlign`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textalign): `true`
38
- - [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
39
- - `padding`: `true`
40
-
41
- ## Context
42
-
43
- _Defined via the [`usesContext` and `providesContext`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-context/) properties in block.json._
44
-
45
- **Uses context:**
46
-
47
- - `core/tabs-list`
48
- - `core/tabs-activeTabIndex`
49
- - `core/tabs-editorActiveTabIndex`
50
- - `core/tab-index`
51
- - `core/tab-id`
52
- - `core/tab-label`
53
-
54
- ## Block Markup
55
-
56
- This is a [**hybrid block**](https://developer.wordpress.org/block-editor/getting-started/fundamentals/static-dynamic-rendering/). It saves static markup that the server may enhance during rendering.
57
-
58
- ```html
59
- <!-- wp:tab -->
60
- <!-- Content... -->
61
- <!-- /wp:tab -->
62
- ```
63
-
64
- ## Source
65
-
66
- - [block.json](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/tab/block.json) ([reference](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/))
67
- - [Source directory](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/tab/) — browse `edit.js`, `save.js`, `index.php`, and more.
68
-
69
- <!-- END TOKEN(Autogenerated block API docs) -->
@@ -1,56 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "__experimental": true,
4
- "apiVersion": 3,
5
- "name": "core/tab",
6
- "title": "Tab",
7
- "description": "A single tab button in the tab list.",
8
- "category": "design",
9
- "textdomain": "default",
10
- "parent": [ "core/tab-list" ],
11
- "usesContext": [
12
- "core/tabs-list",
13
- "core/tabs-activeTabIndex",
14
- "core/tabs-editorActiveTabIndex",
15
- "core/tab-index",
16
- "core/tab-id",
17
- "core/tab-label"
18
- ],
19
- "supports": {
20
- "html": false,
21
- "reusable": false,
22
- "visibility": false,
23
- "lock": false,
24
- "color": {
25
- "background": true,
26
- "text": true,
27
- "__experimentalDefaultControls": {
28
- "background": true,
29
- "text": true
30
- }
31
- },
32
- "typography": {
33
- "fontSize": true,
34
- "__experimentalFontFamily": true,
35
- "textAlign": true,
36
- "__experimentalDefaultControls": {
37
- "fontSize": true
38
- }
39
- },
40
- "spacing": {
41
- "padding": true,
42
- "__experimentalDefaultControls": {
43
- "padding": true
44
- }
45
- },
46
- "__experimentalBorder": {
47
- "radius": true,
48
- "color": true,
49
- "width": true,
50
- "style": true
51
- }
52
- },
53
- "editorScript": "file:./index.js",
54
- "editorStyle": "file:./editor.css",
55
- "style": "file:./style-index.css"
56
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { BlockControls } from '@wordpress/block-editor';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import AddTabToolbarControl from '../tab-panel/add-tab-toolbar-control';
10
- import RemoveTabToolbarControl from '../tab-panel/remove-tab-toolbar-control';
11
-
12
- export default function Controls( { tabsClientId } ) {
13
- return (
14
- <BlockControls>
15
- <AddTabToolbarControl tabsClientId={ tabsClientId } />
16
- <RemoveTabToolbarControl tabsClientId={ tabsClientId } />
17
- </BlockControls>
18
- );
19
- }
package/src/tab/edit.js DELETED
@@ -1,141 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { __ } from '@wordpress/i18n';
10
- import {
11
- useBlockProps,
12
- store as blockEditorStore,
13
- RichText,
14
- } from '@wordpress/block-editor';
15
- import { useSelect, useDispatch } from '@wordpress/data';
16
- import { useMemo, useCallback } from '@wordpress/element';
17
-
18
- /**
19
- * Internal dependencies
20
- */
21
- import Controls from './controls';
22
-
23
- const EMPTY_ARRAY = [];
24
-
25
- function Edit( { context, clientId } ) {
26
- const tabsList = context[ 'core/tabs-list' ] || EMPTY_ARRAY;
27
- const activeTabIndex = context[ 'core/tabs-activeTabIndex' ];
28
- const editorActiveTabIndex = context[ 'core/tabs-editorActiveTabIndex' ];
29
-
30
- const effectiveActiveIndex = useMemo( () => {
31
- return editorActiveTabIndex ?? activeTabIndex;
32
- }, [ editorActiveTabIndex, activeTabIndex ] );
33
-
34
- const { tabIndex, tabsClientId, selectedTabClientId } = useSelect(
35
- ( select ) => {
36
- const {
37
- getBlockOrder,
38
- getBlockRootClientId,
39
- getSelectedBlockClientIds,
40
- hasSelectedInnerBlock,
41
- } = select( blockEditorStore );
42
-
43
- const _tabsListClientId = getBlockRootClientId( clientId );
44
- const _tabsClientId = _tabsListClientId
45
- ? getBlockRootClientId( _tabsListClientId )
46
- : null;
47
-
48
- const siblings = getBlockOrder( _tabsListClientId );
49
- const _tabIndex = siblings.indexOf( clientId );
50
-
51
- // Find which tab panel block is currently selected.
52
- const selectedIds = getSelectedBlockClientIds();
53
- let _selectedTabClientId = null;
54
- for ( const tab of tabsList ) {
55
- if (
56
- selectedIds.includes( tab.clientId ) ||
57
- hasSelectedInnerBlock( tab.clientId, true )
58
- ) {
59
- _selectedTabClientId = tab.clientId;
60
- break;
61
- }
62
- }
63
-
64
- return {
65
- tabIndex: _tabIndex,
66
- tabsClientId: _tabsClientId,
67
- selectedTabClientId: _selectedTabClientId,
68
- };
69
- },
70
- [ clientId, tabsList ]
71
- );
72
-
73
- const tab = tabsList[ tabIndex ] || {};
74
-
75
- // tabListIndex is the tab's position in tabsList, used for active-state
76
- // checks and click handling.
77
- const tabListIndex = tab.index ?? tabIndex;
78
-
79
- const tabClientId = tab.clientId || '';
80
- const label = tab.label || '';
81
-
82
- const isActive = tabListIndex === effectiveActiveIndex;
83
- const isSelected = tabClientId === selectedTabClientId;
84
-
85
- const { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =
86
- useDispatch( blockEditorStore );
87
-
88
- const handleTabClick = useCallback(
89
- ( event ) => {
90
- event.preventDefault();
91
- if ( tabsClientId && tabListIndex !== effectiveActiveIndex ) {
92
- __unstableMarkNextChangeAsNotPersistent();
93
- updateBlockAttributes( tabsClientId, {
94
- editorActiveTabIndex: tabListIndex,
95
- } );
96
- }
97
- },
98
- [
99
- tabsClientId,
100
- tabListIndex,
101
- effectiveActiveIndex,
102
- updateBlockAttributes,
103
- __unstableMarkNextChangeAsNotPersistent,
104
- ]
105
- );
106
-
107
- const handleLabelChange = useCallback(
108
- ( newLabel ) => {
109
- if ( tabClientId ) {
110
- updateBlockAttributes( tabClientId, { label: newLabel } );
111
- }
112
- },
113
- [ tabClientId, updateBlockAttributes ]
114
- );
115
-
116
- const blockProps = useBlockProps( {
117
- className: clsx( {
118
- 'is-active': isActive,
119
- 'is-selected': isSelected,
120
- } ),
121
- tabIndex: -1,
122
- onClick: handleTabClick,
123
- } );
124
-
125
- return (
126
- <>
127
- <Controls tabsClientId={ tabsClientId } />
128
- <button { ...blockProps } type="button">
129
- <RichText
130
- tagName="span"
131
- withoutInteractiveFormatting
132
- placeholder={ __( 'Tab title' ) }
133
- value={ label }
134
- onChange={ handleLabelChange }
135
- />
136
- </button>
137
- </>
138
- );
139
- }
140
-
141
- export default Edit;
@@ -1,14 +0,0 @@
1
- .wp-block-tab {
2
- &.is-selected {
3
- outline-offset: 2px;
4
- }
5
- }
6
-
7
- .block-editor-block-preview__live-content:has(.wp-block-tab) {
8
- flex-basis: inherit !important;
9
- flex-grow: inherit !important;
10
-
11
- .wp-block-tab {
12
- flex-basis: 100% !important;
13
- }
14
- }
package/src/tab/index.js DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { tab as icon } from '@wordpress/icons';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import initBlock from '../utils/init-block';
10
- import edit from './edit';
11
- import save from './save';
12
- import metadata from './block.json';
13
-
14
- const { name } = metadata;
15
-
16
- export { metadata, name };
17
-
18
- export const settings = {
19
- icon,
20
- edit,
21
- save,
22
- };
23
-
24
- export const init = () => initBlock( { name, metadata, settings } );