@wordpress/block-library 7.19.0 → 8.1.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 (862) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/audio/edit.native.js +1 -3
  3. package/build/audio/edit.native.js.map +1 -1
  4. package/build/audio/index.js +2 -1
  5. package/build/audio/index.js.map +1 -1
  6. package/build/avatar/edit.js +1 -0
  7. package/build/avatar/edit.js.map +1 -1
  8. package/build/avatar/user-control.js +1 -0
  9. package/build/avatar/user-control.js.map +1 -1
  10. package/build/block/edit.js +14 -2
  11. package/build/block/edit.js.map +1 -1
  12. package/build/block/edit.native.js +14 -6
  13. package/build/block/edit.native.js.map +1 -1
  14. package/build/block/index.js +1 -2
  15. package/build/block/index.js.map +1 -1
  16. package/build/button/edit.native.js.map +1 -1
  17. package/build/categories/edit.js +1 -1
  18. package/build/categories/edit.js.map +1 -1
  19. package/build/code/transforms.js +1 -1
  20. package/build/code/transforms.js.map +1 -1
  21. package/build/columns/edit.js +1 -0
  22. package/build/columns/edit.js.map +1 -1
  23. package/build/columns/edit.native.js +13 -30
  24. package/build/columns/edit.native.js.map +1 -1
  25. package/build/comment-author-avatar/edit.js +1 -0
  26. package/build/comment-author-avatar/edit.js.map +1 -1
  27. package/build/cover/edit/inspector-controls.js +3 -1
  28. package/build/cover/edit/inspector-controls.js.map +1 -1
  29. package/build/cover/edit.native.js +24 -16
  30. package/build/cover/edit.native.js.map +1 -1
  31. package/build/embed/embed-controls.native.js +1 -0
  32. package/build/embed/embed-controls.native.js.map +1 -1
  33. package/build/embed/embed-preview.native.js +1 -3
  34. package/build/embed/embed-preview.native.js.map +1 -1
  35. package/build/file/inspector.js +1 -0
  36. package/build/file/inspector.js.map +1 -1
  37. package/build/freeform/edit.js +21 -6
  38. package/build/freeform/edit.js.map +1 -1
  39. package/build/freeform/modal.js +97 -0
  40. package/build/freeform/modal.js.map +1 -0
  41. package/build/gallery/edit.js +38 -15
  42. package/build/gallery/edit.js.map +1 -1
  43. package/build/gallery/gallery.js +2 -16
  44. package/build/gallery/gallery.js.map +1 -1
  45. package/build/gallery/gallery.native.js +1 -3
  46. package/build/gallery/gallery.native.js.map +1 -1
  47. package/build/gallery/shared.js +4 -10
  48. package/build/gallery/shared.js.map +1 -1
  49. package/build/gallery/transforms.js +1 -7
  50. package/build/gallery/transforms.js.map +1 -1
  51. package/build/gallery/use-get-media.js +1 -1
  52. package/build/gallery/use-get-media.js.map +1 -1
  53. package/build/gallery/use-get-media.native.js +3 -1
  54. package/build/gallery/use-get-media.native.js.map +1 -1
  55. package/build/gallery/v1/edit.js +22 -15
  56. package/build/gallery/v1/edit.js.map +1 -1
  57. package/build/gallery/v1/gallery.native.js +1 -3
  58. package/build/gallery/v1/gallery.native.js.map +1 -1
  59. package/build/gallery/v1/shared.js +4 -1
  60. package/build/gallery/v1/shared.js.map +1 -1
  61. package/build/group/edit.js +1 -2
  62. package/build/group/edit.js.map +1 -1
  63. package/build/group/index.js +3 -1
  64. package/build/group/index.js.map +1 -1
  65. package/build/group/placeholder.js +5 -26
  66. package/build/group/placeholder.js.map +1 -1
  67. package/build/heading/deprecated.js +152 -69
  68. package/build/heading/deprecated.js.map +1 -1
  69. package/build/heading/index.js +1 -2
  70. package/build/heading/index.js.map +1 -1
  71. package/build/heading/transforms.js +1 -2
  72. package/build/heading/transforms.js.map +1 -1
  73. package/build/html/index.js +1 -1
  74. package/build/image/edit.js +8 -5
  75. package/build/image/edit.js.map +1 -1
  76. package/build/image/edit.native.js +3 -2
  77. package/build/image/edit.native.js.map +1 -1
  78. package/build/image/image.js +13 -8
  79. package/build/image/image.js.map +1 -1
  80. package/build/index.js +3 -1
  81. package/build/index.js.map +1 -1
  82. package/build/latest-comments/edit.js +1 -0
  83. package/build/latest-comments/edit.js.map +1 -1
  84. package/build/latest-posts/edit.js +2 -0
  85. package/build/latest-posts/edit.js.map +1 -1
  86. package/build/list/transforms.js +1 -9
  87. package/build/list/transforms.js.map +1 -1
  88. package/build/list/utils.js +5 -2
  89. package/build/list/utils.js.map +1 -1
  90. package/build/list-item/index.js +4 -1
  91. package/build/list-item/index.js.map +1 -1
  92. package/build/list-item/transforms.js +22 -0
  93. package/build/list-item/transforms.js.map +1 -0
  94. package/build/list-item/utils.js +77 -1
  95. package/build/list-item/utils.js.map +1 -1
  96. package/build/media-text/edit.js +5 -2
  97. package/build/media-text/edit.js.map +1 -1
  98. package/build/missing/edit.native.js +2 -2
  99. package/build/missing/edit.native.js.map +1 -1
  100. package/build/navigation/edit/are-blocks-dirty.js +52 -0
  101. package/build/navigation/edit/are-blocks-dirty.js.map +1 -0
  102. package/build/navigation/edit/index.js +95 -117
  103. package/build/navigation/edit/index.js.map +1 -1
  104. package/build/navigation/edit/menu-inspector-controls.js +94 -0
  105. package/build/navigation/edit/menu-inspector-controls.js.map +1 -0
  106. package/build/navigation/edit/navigation-menu-selector.js +2 -4
  107. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  108. package/build/navigation/edit/unsaved-inner-blocks.js +11 -7
  109. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  110. package/build/navigation/edit/utils.js +81 -0
  111. package/build/navigation/edit/utils.js.map +1 -1
  112. package/build/navigation/view-modal.js +6 -2
  113. package/build/navigation/view-modal.js.map +1 -1
  114. package/build/navigation-link/edit.js +46 -356
  115. package/build/navigation-link/edit.js.map +1 -1
  116. package/build/navigation-link/link-ui.js +222 -0
  117. package/build/navigation-link/link-ui.js.map +1 -0
  118. package/build/navigation-link/transforms.js +12 -0
  119. package/build/navigation-link/transforms.js.map +1 -1
  120. package/build/navigation-link/update-attributes.js +108 -0
  121. package/build/navigation-link/update-attributes.js.map +1 -0
  122. package/build/navigation-submenu/edit.js +49 -245
  123. package/build/navigation-submenu/edit.js.map +1 -1
  124. package/build/page-list/constants.js +15 -0
  125. package/build/page-list/constants.js.map +1 -0
  126. package/build/page-list/convert-to-links-modal.js +22 -86
  127. package/build/page-list/convert-to-links-modal.js.map +1 -1
  128. package/build/page-list/convert-to-navigation-links.js +76 -0
  129. package/build/page-list/convert-to-navigation-links.js.map +1 -0
  130. package/build/page-list/edit.js +143 -78
  131. package/build/page-list/edit.js.map +1 -1
  132. package/build/page-list/index.js +35 -3
  133. package/build/page-list/index.js.map +1 -1
  134. package/build/page-list-item/edit.js +91 -0
  135. package/build/page-list-item/edit.js.map +1 -0
  136. package/build/page-list-item/index.js +85 -0
  137. package/build/page-list-item/index.js.map +1 -0
  138. package/build/page-list-item/init.js +16 -0
  139. package/build/page-list-item/init.js.map +1 -0
  140. package/build/paragraph/index.js +1 -7
  141. package/build/paragraph/index.js.map +1 -1
  142. package/build/post-author/edit.js +3 -2
  143. package/build/post-author/edit.js.map +1 -1
  144. package/build/post-featured-image/overlay.js +1 -1
  145. package/build/post-featured-image/overlay.js.map +1 -1
  146. package/build/post-template/index.js +8 -0
  147. package/build/post-template/index.js.map +1 -1
  148. package/build/preformatted/transforms.js +3 -1
  149. package/build/preformatted/transforms.js.map +1 -1
  150. package/build/query/deprecated.js +192 -21
  151. package/build/query/deprecated.js.map +1 -1
  152. package/build/query/edit/index.js +2 -1
  153. package/build/query/edit/index.js.map +1 -1
  154. package/build/query/edit/inspector-controls/index.js +11 -5
  155. package/build/query/edit/inspector-controls/index.js.map +1 -1
  156. package/build/query/edit/inspector-controls/taxonomy-controls.js +101 -37
  157. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  158. package/build/query/edit/query-content.js +2 -3
  159. package/build/query/edit/query-content.js.map +1 -1
  160. package/build/query/edit/query-placeholder.js +16 -27
  161. package/build/query/edit/query-placeholder.js.map +1 -1
  162. package/build/query/index.js +0 -8
  163. package/build/query/index.js.map +1 -1
  164. package/build/query/utils.js +73 -9
  165. package/build/query/utils.js.map +1 -1
  166. package/build/rss/edit.js +3 -0
  167. package/build/rss/edit.js.map +1 -1
  168. package/build/search/edit.js +2 -2
  169. package/build/search/edit.js.map +1 -1
  170. package/build/search/edit.native.js +22 -22
  171. package/build/search/edit.native.js.map +1 -1
  172. package/build/search/index.js +9 -1
  173. package/build/search/index.js.map +1 -1
  174. package/build/site-logo/edit.js +17 -9
  175. package/build/site-logo/edit.js.map +1 -1
  176. package/build/site-logo/index.js +1 -0
  177. package/build/site-logo/index.js.map +1 -1
  178. package/build/site-title/index.js +1 -0
  179. package/build/site-title/index.js.map +1 -1
  180. package/build/social-link/edit.js.map +1 -1
  181. package/build/social-link/social-list.js +4 -12
  182. package/build/social-link/social-list.js.map +1 -1
  183. package/build/social-links/edit.js +0 -1
  184. package/build/social-links/edit.js.map +1 -1
  185. package/build/table/edit.js +3 -1
  186. package/build/table/edit.js.map +1 -1
  187. package/build/table/index.js +17 -1
  188. package/build/table/index.js.map +1 -1
  189. package/build/table/save.js +4 -2
  190. package/build/table/save.js.map +1 -1
  191. package/build/table/state.js +24 -12
  192. package/build/table/state.js.map +1 -1
  193. package/build/table/transforms.js +3 -2
  194. package/build/table/transforms.js.map +1 -1
  195. package/build/table-of-contents/edit.js +3 -3
  196. package/build/table-of-contents/edit.js.map +1 -1
  197. package/build/tag-cloud/edit.js +2 -1
  198. package/build/tag-cloud/edit.js.map +1 -1
  199. package/build/template-part/edit/advanced-controls.js +11 -1
  200. package/build/template-part/edit/advanced-controls.js.map +1 -1
  201. package/build/template-part/edit/import-controls.js +160 -0
  202. package/build/template-part/edit/import-controls.js.map +1 -0
  203. package/build/template-part/edit/index.js +2 -1
  204. package/build/template-part/edit/index.js.map +1 -1
  205. package/build/template-part/edit/selection-modal.js +5 -2
  206. package/build/template-part/edit/selection-modal.js.map +1 -1
  207. package/build/template-part/edit/utils/hooks.js +2 -6
  208. package/build/template-part/edit/utils/hooks.js.map +1 -1
  209. package/build/template-part/edit/utils/transformers.js +48 -0
  210. package/build/template-part/edit/utils/transformers.js.map +1 -0
  211. package/build/text-columns/edit.js +1 -0
  212. package/build/text-columns/edit.js.map +1 -1
  213. package/build/utils/transformation-categories.native.js +1 -1
  214. package/build/utils/transformation-categories.native.js.map +1 -1
  215. package/build/video/edit.js +1 -1
  216. package/build/video/edit.js.map +1 -1
  217. package/build/video/edit.native.js +1 -3
  218. package/build/video/edit.native.js.map +1 -1
  219. package/build-module/audio/edit.native.js +1 -2
  220. package/build-module/audio/edit.native.js.map +1 -1
  221. package/build-module/audio/index.js +2 -1
  222. package/build-module/audio/index.js.map +1 -1
  223. package/build-module/avatar/edit.js +1 -0
  224. package/build-module/avatar/edit.js.map +1 -1
  225. package/build-module/avatar/user-control.js +1 -0
  226. package/build-module/avatar/user-control.js.map +1 -1
  227. package/build-module/block/edit.js +14 -2
  228. package/build-module/block/edit.js.map +1 -1
  229. package/build-module/block/edit.native.js +14 -6
  230. package/build-module/block/edit.native.js.map +1 -1
  231. package/build-module/block/index.js +1 -2
  232. package/build-module/block/index.js.map +1 -1
  233. package/build-module/button/edit.native.js +2 -1
  234. package/build-module/button/edit.native.js.map +1 -1
  235. package/build-module/categories/edit.js +1 -1
  236. package/build-module/categories/edit.js.map +1 -1
  237. package/build-module/code/transforms.js +1 -1
  238. package/build-module/code/transforms.js.map +1 -1
  239. package/build-module/columns/edit.js +1 -0
  240. package/build-module/columns/edit.js.map +1 -1
  241. package/build-module/columns/edit.native.js +13 -29
  242. package/build-module/columns/edit.native.js.map +1 -1
  243. package/build-module/comment-author-avatar/edit.js +1 -0
  244. package/build-module/comment-author-avatar/edit.js.map +1 -1
  245. package/build-module/cover/edit/inspector-controls.js +5 -3
  246. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  247. package/build-module/cover/edit.native.js +22 -14
  248. package/build-module/cover/edit.native.js.map +1 -1
  249. package/build-module/embed/embed-controls.native.js +2 -1
  250. package/build-module/embed/embed-controls.native.js.map +1 -1
  251. package/build-module/embed/embed-preview.native.js +1 -2
  252. package/build-module/embed/embed-preview.native.js.map +1 -1
  253. package/build-module/file/inspector.js +1 -0
  254. package/build-module/file/inspector.js.map +1 -1
  255. package/build-module/freeform/edit.js +22 -8
  256. package/build-module/freeform/edit.js.map +1 -1
  257. package/build-module/freeform/modal.js +90 -0
  258. package/build-module/freeform/modal.js.map +1 -0
  259. package/build-module/gallery/edit.js +39 -15
  260. package/build-module/gallery/edit.js.map +1 -1
  261. package/build-module/gallery/gallery.js +3 -16
  262. package/build-module/gallery/gallery.js.map +1 -1
  263. package/build-module/gallery/gallery.native.js +1 -2
  264. package/build-module/gallery/gallery.native.js.map +1 -1
  265. package/build-module/gallery/shared.js +5 -11
  266. package/build-module/gallery/shared.js.map +1 -1
  267. package/build-module/gallery/transforms.js +1 -6
  268. package/build-module/gallery/transforms.js.map +1 -1
  269. package/build-module/gallery/use-get-media.js +1 -1
  270. package/build-module/gallery/use-get-media.js.map +1 -1
  271. package/build-module/gallery/use-get-media.native.js +3 -1
  272. package/build-module/gallery/use-get-media.native.js.map +1 -1
  273. package/build-module/gallery/v1/edit.js +23 -16
  274. package/build-module/gallery/v1/edit.js.map +1 -1
  275. package/build-module/gallery/v1/gallery.native.js +1 -2
  276. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  277. package/build-module/gallery/v1/shared.js +5 -2
  278. package/build-module/gallery/v1/shared.js.map +1 -1
  279. package/build-module/group/edit.js +1 -3
  280. package/build-module/group/edit.js.map +1 -1
  281. package/build-module/group/index.js +3 -1
  282. package/build-module/group/index.js.map +1 -1
  283. package/build-module/group/placeholder.js +5 -26
  284. package/build-module/group/placeholder.js.map +1 -1
  285. package/build-module/heading/deprecated.js +152 -69
  286. package/build-module/heading/deprecated.js.map +1 -1
  287. package/build-module/heading/index.js +1 -2
  288. package/build-module/heading/index.js.map +1 -1
  289. package/build-module/heading/transforms.js +1 -2
  290. package/build-module/heading/transforms.js.map +1 -1
  291. package/build-module/html/index.js +1 -1
  292. package/build-module/image/edit.js +9 -6
  293. package/build-module/image/edit.js.map +1 -1
  294. package/build-module/image/edit.native.js +2 -1
  295. package/build-module/image/edit.native.js.map +1 -1
  296. package/build-module/image/image.js +14 -9
  297. package/build-module/image/image.js.map +1 -1
  298. package/build-module/index.js +2 -1
  299. package/build-module/index.js.map +1 -1
  300. package/build-module/latest-comments/edit.js +1 -0
  301. package/build-module/latest-comments/edit.js.map +1 -1
  302. package/build-module/latest-posts/edit.js +2 -0
  303. package/build-module/latest-posts/edit.js.map +1 -1
  304. package/build-module/list/transforms.js +1 -9
  305. package/build-module/list/transforms.js.map +1 -1
  306. package/build-module/list/utils.js +5 -2
  307. package/build-module/list/utils.js.map +1 -1
  308. package/build-module/list-item/index.js +3 -1
  309. package/build-module/list-item/index.js.map +1 -1
  310. package/build-module/list-item/transforms.js +13 -0
  311. package/build-module/list-item/transforms.js.map +1 -0
  312. package/build-module/list-item/utils.js +78 -1
  313. package/build-module/list-item/utils.js.map +1 -1
  314. package/build-module/media-text/edit.js +6 -3
  315. package/build-module/media-text/edit.js.map +1 -1
  316. package/build-module/missing/edit.native.js +2 -2
  317. package/build-module/missing/edit.native.js.map +1 -1
  318. package/build-module/navigation/edit/are-blocks-dirty.js +44 -0
  319. package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -0
  320. package/build-module/navigation/edit/index.js +95 -118
  321. package/build-module/navigation/edit/index.js.map +1 -1
  322. package/build-module/navigation/edit/menu-inspector-controls.js +80 -0
  323. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -0
  324. package/build-module/navigation/edit/navigation-menu-selector.js +2 -4
  325. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  326. package/build-module/navigation/edit/unsaved-inner-blocks.js +9 -6
  327. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  328. package/build-module/navigation/edit/utils.js +75 -0
  329. package/build-module/navigation/edit/utils.js.map +1 -1
  330. package/build-module/navigation/view-modal.js +6 -2
  331. package/build-module/navigation/view-modal.js.map +1 -1
  332. package/build-module/navigation-link/edit.js +49 -357
  333. package/build-module/navigation-link/edit.js.map +1 -1
  334. package/build-module/navigation-link/link-ui.js +206 -0
  335. package/build-module/navigation-link/link-ui.js.map +1 -0
  336. package/build-module/navigation-link/transforms.js +12 -0
  337. package/build-module/navigation-link/transforms.js.map +1 -1
  338. package/build-module/navigation-link/update-attributes.js +97 -0
  339. package/build-module/navigation-link/update-attributes.js.map +1 -0
  340. package/build-module/navigation-submenu/edit.js +52 -246
  341. package/build-module/navigation-submenu/edit.js.map +1 -1
  342. package/build-module/page-list/constants.js +6 -0
  343. package/build-module/page-list/constants.js.map +1 -0
  344. package/build-module/page-list/convert-to-links-modal.js +20 -81
  345. package/build-module/page-list/convert-to-links-modal.js.map +1 -1
  346. package/build-module/page-list/convert-to-navigation-links.js +66 -0
  347. package/build-module/page-list/convert-to-navigation-links.js.map +1 -0
  348. package/build-module/page-list/edit.js +146 -82
  349. package/build-module/page-list/edit.js.map +1 -1
  350. package/build-module/page-list/index.js +36 -4
  351. package/build-module/page-list/index.js.map +1 -1
  352. package/build-module/page-list-item/edit.js +77 -0
  353. package/build-module/page-list-item/edit.js.map +1 -0
  354. package/build-module/page-list-item/index.js +68 -0
  355. package/build-module/page-list-item/index.js.map +1 -0
  356. package/build-module/page-list-item/init.js +6 -0
  357. package/build-module/page-list-item/init.js.map +1 -0
  358. package/build-module/paragraph/index.js +1 -7
  359. package/build-module/paragraph/index.js.map +1 -1
  360. package/build-module/post-author/edit.js +3 -2
  361. package/build-module/post-author/edit.js.map +1 -1
  362. package/build-module/post-featured-image/overlay.js +1 -1
  363. package/build-module/post-featured-image/overlay.js.map +1 -1
  364. package/build-module/post-template/index.js +8 -0
  365. package/build-module/post-template/index.js.map +1 -1
  366. package/build-module/preformatted/transforms.js +3 -1
  367. package/build-module/preformatted/transforms.js.map +1 -1
  368. package/build-module/query/deprecated.js +185 -21
  369. package/build-module/query/deprecated.js.map +1 -1
  370. package/build-module/query/edit/index.js +2 -1
  371. package/build-module/query/edit/index.js.map +1 -1
  372. package/build-module/query/edit/inspector-controls/index.js +11 -5
  373. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  374. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +99 -35
  375. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  376. package/build-module/query/edit/query-content.js +1 -1
  377. package/build-module/query/edit/query-content.js.map +1 -1
  378. package/build-module/query/edit/query-placeholder.js +15 -27
  379. package/build-module/query/edit/query-placeholder.js.map +1 -1
  380. package/build-module/query/index.js +0 -8
  381. package/build-module/query/index.js.map +1 -1
  382. package/build-module/query/utils.js +69 -8
  383. package/build-module/query/utils.js.map +1 -1
  384. package/build-module/rss/edit.js +3 -0
  385. package/build-module/rss/edit.js.map +1 -1
  386. package/build-module/search/edit.js +2 -2
  387. package/build-module/search/edit.js.map +1 -1
  388. package/build-module/search/edit.native.js +20 -20
  389. package/build-module/search/edit.native.js.map +1 -1
  390. package/build-module/search/index.js +8 -1
  391. package/build-module/search/index.js.map +1 -1
  392. package/build-module/site-logo/edit.js +17 -8
  393. package/build-module/site-logo/edit.js.map +1 -1
  394. package/build-module/site-logo/index.js +1 -0
  395. package/build-module/site-logo/index.js.map +1 -1
  396. package/build-module/site-title/index.js +1 -0
  397. package/build-module/site-title/index.js.map +1 -1
  398. package/build-module/social-link/edit.js +2 -2
  399. package/build-module/social-link/edit.js.map +1 -1
  400. package/build-module/social-link/social-list.js +2 -11
  401. package/build-module/social-link/social-list.js.map +1 -1
  402. package/build-module/social-links/edit.js +0 -1
  403. package/build-module/social-links/edit.js.map +1 -1
  404. package/build-module/table/edit.js +3 -1
  405. package/build-module/table/edit.js.map +1 -1
  406. package/build-module/table/index.js +17 -1
  407. package/build-module/table/index.js.map +1 -1
  408. package/build-module/table/save.js +4 -2
  409. package/build-module/table/save.js.map +1 -1
  410. package/build-module/table/state.js +25 -13
  411. package/build-module/table/state.js.map +1 -1
  412. package/build-module/table/transforms.js +3 -2
  413. package/build-module/table/transforms.js.map +1 -1
  414. package/build-module/table-of-contents/edit.js +3 -3
  415. package/build-module/table-of-contents/edit.js.map +1 -1
  416. package/build-module/tag-cloud/edit.js +3 -2
  417. package/build-module/tag-cloud/edit.js.map +1 -1
  418. package/build-module/template-part/edit/advanced-controls.js +10 -1
  419. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  420. package/build-module/template-part/edit/import-controls.js +146 -0
  421. package/build-module/template-part/edit/import-controls.js.map +1 -0
  422. package/build-module/template-part/edit/index.js +2 -1
  423. package/build-module/template-part/edit/index.js.map +1 -1
  424. package/build-module/template-part/edit/selection-modal.js +6 -3
  425. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  426. package/build-module/template-part/edit/utils/hooks.js +3 -7
  427. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  428. package/build-module/template-part/edit/utils/transformers.js +40 -0
  429. package/build-module/template-part/edit/utils/transformers.js.map +1 -0
  430. package/build-module/text-columns/edit.js +1 -0
  431. package/build-module/text-columns/edit.js.map +1 -1
  432. package/build-module/utils/transformation-categories.native.js +1 -1
  433. package/build-module/utils/transformation-categories.native.js.map +1 -1
  434. package/build-module/video/edit.js +1 -1
  435. package/build-module/video/edit.js.map +1 -1
  436. package/build-module/video/edit.native.js +1 -2
  437. package/build-module/video/edit.native.js.map +1 -1
  438. package/build-style/archives/editor-rtl.css +15 -3
  439. package/build-style/archives/editor.css +15 -3
  440. package/build-style/archives/style-rtl.css +15 -3
  441. package/build-style/archives/style.css +15 -3
  442. package/build-style/audio/editor-rtl.css +15 -3
  443. package/build-style/audio/editor.css +15 -3
  444. package/build-style/audio/style-rtl.css +15 -3
  445. package/build-style/audio/style.css +15 -3
  446. package/build-style/audio/theme-rtl.css +15 -3
  447. package/build-style/audio/theme.css +15 -3
  448. package/build-style/avatar/editor-rtl.css +15 -3
  449. package/build-style/avatar/editor.css +15 -3
  450. package/build-style/avatar/style-rtl.css +15 -3
  451. package/build-style/avatar/style.css +15 -3
  452. package/build-style/block/editor-rtl.css +25 -3
  453. package/build-style/block/editor.css +25 -3
  454. package/build-style/button/editor-rtl.css +15 -3
  455. package/build-style/button/editor.css +15 -3
  456. package/build-style/button/style-rtl.css +15 -3
  457. package/build-style/button/style.css +15 -3
  458. package/build-style/buttons/editor-rtl.css +15 -3
  459. package/build-style/buttons/editor.css +15 -3
  460. package/build-style/buttons/style-rtl.css +15 -3
  461. package/build-style/buttons/style.css +15 -3
  462. package/build-style/calendar/style-rtl.css +15 -3
  463. package/build-style/calendar/style.css +15 -3
  464. package/build-style/categories/editor-rtl.css +15 -3
  465. package/build-style/categories/editor.css +15 -3
  466. package/build-style/categories/style-rtl.css +15 -3
  467. package/build-style/categories/style.css +15 -3
  468. package/build-style/classic-rtl.css +15 -3
  469. package/build-style/classic.css +15 -3
  470. package/build-style/code/editor-rtl.css +15 -3
  471. package/build-style/code/editor.css +15 -3
  472. package/build-style/code/style-rtl.css +15 -3
  473. package/build-style/code/style.css +15 -3
  474. package/build-style/code/theme-rtl.css +15 -3
  475. package/build-style/code/theme.css +15 -3
  476. package/build-style/columns/editor-rtl.css +15 -3
  477. package/build-style/columns/editor.css +15 -3
  478. package/build-style/columns/style-rtl.css +15 -3
  479. package/build-style/columns/style.css +15 -3
  480. package/build-style/comment-author-avatar/editor-rtl.css +15 -3
  481. package/build-style/comment-author-avatar/editor.css +15 -3
  482. package/build-style/comment-content/style-rtl.css +15 -3
  483. package/build-style/comment-content/style.css +15 -3
  484. package/build-style/comment-template/style-rtl.css +15 -3
  485. package/build-style/comment-template/style.css +15 -3
  486. package/build-style/comments/editor-rtl.css +15 -3
  487. package/build-style/comments/editor.css +15 -3
  488. package/build-style/comments/style-rtl.css +15 -3
  489. package/build-style/comments/style.css +15 -3
  490. package/build-style/comments-pagination/editor-rtl.css +15 -3
  491. package/build-style/comments-pagination/editor.css +15 -3
  492. package/build-style/comments-pagination/style-rtl.css +15 -3
  493. package/build-style/comments-pagination/style.css +15 -3
  494. package/build-style/comments-pagination-numbers/editor-rtl.css +15 -3
  495. package/build-style/comments-pagination-numbers/editor.css +15 -3
  496. package/build-style/comments-title/editor-rtl.css +15 -3
  497. package/build-style/comments-title/editor.css +15 -3
  498. package/build-style/common-rtl.css +20 -4
  499. package/build-style/common.css +20 -4
  500. package/build-style/cover/editor-rtl.css +15 -3
  501. package/build-style/cover/editor.css +15 -3
  502. package/build-style/cover/style-rtl.css +17 -4
  503. package/build-style/cover/style.css +17 -4
  504. package/build-style/editor-elements-rtl.css +15 -3
  505. package/build-style/editor-elements.css +15 -3
  506. package/build-style/editor-rtl.css +46 -29
  507. package/build-style/editor.css +46 -29
  508. package/build-style/elements-rtl.css +15 -3
  509. package/build-style/elements.css +15 -3
  510. package/build-style/embed/editor-rtl.css +15 -3
  511. package/build-style/embed/editor.css +15 -3
  512. package/build-style/embed/style-rtl.css +15 -3
  513. package/build-style/embed/style.css +15 -3
  514. package/build-style/embed/theme-rtl.css +15 -3
  515. package/build-style/embed/theme.css +15 -3
  516. package/build-style/file/editor-rtl.css +15 -3
  517. package/build-style/file/editor.css +15 -3
  518. package/build-style/file/style-rtl.css +15 -3
  519. package/build-style/file/style.css +15 -3
  520. package/build-style/freeform/editor-rtl.css +15 -3
  521. package/build-style/freeform/editor.css +15 -3
  522. package/build-style/gallery/editor-rtl.css +16 -4
  523. package/build-style/gallery/editor.css +16 -4
  524. package/build-style/gallery/style-rtl.css +19 -5
  525. package/build-style/gallery/style.css +19 -5
  526. package/build-style/gallery/theme-rtl.css +15 -3
  527. package/build-style/gallery/theme.css +15 -3
  528. package/build-style/group/editor-rtl.css +15 -3
  529. package/build-style/group/editor.css +15 -3
  530. package/build-style/group/style-rtl.css +15 -3
  531. package/build-style/group/style.css +15 -3
  532. package/build-style/group/theme-rtl.css +15 -3
  533. package/build-style/group/theme.css +15 -3
  534. package/build-style/heading/style-rtl.css +15 -3
  535. package/build-style/heading/style.css +15 -3
  536. package/build-style/html/editor-rtl.css +15 -3
  537. package/build-style/html/editor.css +15 -3
  538. package/build-style/image/editor-rtl.css +15 -12
  539. package/build-style/image/editor.css +15 -12
  540. package/build-style/image/style-rtl.css +15 -3
  541. package/build-style/image/style.css +15 -3
  542. package/build-style/image/theme-rtl.css +15 -3
  543. package/build-style/image/theme.css +15 -3
  544. package/build-style/latest-comments/style-rtl.css +15 -3
  545. package/build-style/latest-comments/style.css +15 -3
  546. package/build-style/latest-posts/editor-rtl.css +15 -3
  547. package/build-style/latest-posts/editor.css +15 -3
  548. package/build-style/latest-posts/style-rtl.css +15 -3
  549. package/build-style/latest-posts/style.css +15 -3
  550. package/build-style/list/style-rtl.css +15 -3
  551. package/build-style/list/style.css +15 -3
  552. package/build-style/media-text/editor-rtl.css +15 -3
  553. package/build-style/media-text/editor.css +15 -3
  554. package/build-style/media-text/style-rtl.css +15 -3
  555. package/build-style/media-text/style.css +15 -3
  556. package/build-style/more/editor-rtl.css +15 -3
  557. package/build-style/more/editor.css +15 -3
  558. package/build-style/navigation/editor-rtl.css +15 -9
  559. package/build-style/navigation/editor.css +15 -9
  560. package/build-style/navigation/style-rtl.css +15 -4
  561. package/build-style/navigation/style.css +15 -4
  562. package/build-style/navigation-link/editor-rtl.css +15 -3
  563. package/build-style/navigation-link/editor.css +15 -3
  564. package/build-style/navigation-link/style-rtl.css +15 -3
  565. package/build-style/navigation-link/style.css +15 -3
  566. package/build-style/navigation-submenu/editor-rtl.css +15 -3
  567. package/build-style/navigation-submenu/editor.css +15 -3
  568. package/build-style/nextpage/editor-rtl.css +15 -3
  569. package/build-style/nextpage/editor.css +15 -3
  570. package/build-style/page-list/editor-rtl.css +19 -3
  571. package/build-style/page-list/editor.css +19 -3
  572. package/build-style/page-list/style-rtl.css +15 -3
  573. package/build-style/page-list/style.css +15 -3
  574. package/build-style/paragraph/editor-rtl.css +15 -3
  575. package/build-style/paragraph/editor.css +15 -3
  576. package/build-style/paragraph/style-rtl.css +15 -3
  577. package/build-style/paragraph/style.css +15 -3
  578. package/build-style/post-author/style-rtl.css +15 -3
  579. package/build-style/post-author/style.css +15 -3
  580. package/build-style/post-comments-form/editor-rtl.css +15 -3
  581. package/build-style/post-comments-form/editor.css +15 -3
  582. package/build-style/post-comments-form/style-rtl.css +15 -3
  583. package/build-style/post-comments-form/style.css +15 -3
  584. package/build-style/post-date/style-rtl.css +15 -3
  585. package/build-style/post-date/style.css +15 -3
  586. package/build-style/post-excerpt/editor-rtl.css +15 -3
  587. package/build-style/post-excerpt/editor.css +15 -3
  588. package/build-style/post-excerpt/style-rtl.css +15 -3
  589. package/build-style/post-excerpt/style.css +15 -3
  590. package/build-style/post-featured-image/editor-rtl.css +15 -3
  591. package/build-style/post-featured-image/editor.css +15 -3
  592. package/build-style/post-featured-image/style-rtl.css +15 -3
  593. package/build-style/post-featured-image/style.css +15 -3
  594. package/build-style/post-navigation-link/style-rtl.css +15 -3
  595. package/build-style/post-navigation-link/style.css +15 -3
  596. package/build-style/post-template/editor-rtl.css +15 -3
  597. package/build-style/post-template/editor.css +15 -3
  598. package/build-style/post-template/style-rtl.css +15 -3
  599. package/build-style/post-template/style.css +15 -3
  600. package/build-style/post-terms/style-rtl.css +15 -3
  601. package/build-style/post-terms/style.css +15 -3
  602. package/build-style/post-title/style-rtl.css +15 -3
  603. package/build-style/post-title/style.css +15 -3
  604. package/build-style/preformatted/style-rtl.css +15 -3
  605. package/build-style/preformatted/style.css +15 -3
  606. package/build-style/pullquote/editor-rtl.css +15 -3
  607. package/build-style/pullquote/editor.css +15 -3
  608. package/build-style/pullquote/style-rtl.css +15 -3
  609. package/build-style/pullquote/style.css +15 -3
  610. package/build-style/pullquote/theme-rtl.css +15 -3
  611. package/build-style/pullquote/theme.css +15 -3
  612. package/build-style/query/editor-rtl.css +15 -3
  613. package/build-style/query/editor.css +15 -3
  614. package/build-style/query-pagination/editor-rtl.css +15 -3
  615. package/build-style/query-pagination/editor.css +15 -3
  616. package/build-style/query-pagination/style-rtl.css +15 -3
  617. package/build-style/query-pagination/style.css +15 -3
  618. package/build-style/query-pagination-numbers/editor-rtl.css +15 -3
  619. package/build-style/query-pagination-numbers/editor.css +15 -3
  620. package/build-style/query-title/style-rtl.css +15 -3
  621. package/build-style/query-title/style.css +15 -3
  622. package/build-style/quote/style-rtl.css +15 -3
  623. package/build-style/quote/style.css +15 -3
  624. package/build-style/quote/theme-rtl.css +15 -3
  625. package/build-style/quote/theme.css +15 -3
  626. package/build-style/read-more/style-rtl.css +15 -3
  627. package/build-style/read-more/style.css +15 -3
  628. package/build-style/reset-rtl.css +15 -3
  629. package/build-style/reset.css +15 -3
  630. package/build-style/rss/editor-rtl.css +15 -3
  631. package/build-style/rss/editor.css +15 -3
  632. package/build-style/rss/style-rtl.css +15 -3
  633. package/build-style/rss/style.css +15 -3
  634. package/build-style/search/editor-rtl.css +15 -3
  635. package/build-style/search/editor.css +15 -3
  636. package/build-style/search/style-rtl.css +15 -3
  637. package/build-style/search/style.css +15 -3
  638. package/build-style/search/theme-rtl.css +15 -3
  639. package/build-style/search/theme.css +15 -3
  640. package/build-style/separator/editor-rtl.css +15 -3
  641. package/build-style/separator/editor.css +15 -3
  642. package/build-style/separator/style-rtl.css +15 -3
  643. package/build-style/separator/style.css +15 -3
  644. package/build-style/separator/theme-rtl.css +15 -3
  645. package/build-style/separator/theme.css +15 -3
  646. package/build-style/shortcode/editor-rtl.css +16 -4
  647. package/build-style/shortcode/editor.css +16 -4
  648. package/build-style/site-logo/editor-rtl.css +15 -3
  649. package/build-style/site-logo/editor.css +15 -3
  650. package/build-style/site-logo/style-rtl.css +15 -3
  651. package/build-style/site-logo/style.css +15 -3
  652. package/build-style/site-tagline/editor-rtl.css +15 -3
  653. package/build-style/site-tagline/editor.css +15 -3
  654. package/build-style/site-title/editor-rtl.css +15 -3
  655. package/build-style/site-title/editor.css +15 -3
  656. package/build-style/site-title/style-rtl.css +15 -3
  657. package/build-style/site-title/style.css +15 -3
  658. package/build-style/social-link/editor-rtl.css +15 -3
  659. package/build-style/social-link/editor.css +15 -3
  660. package/build-style/social-links/editor-rtl.css +15 -3
  661. package/build-style/social-links/editor.css +15 -3
  662. package/build-style/social-links/style-rtl.css +15 -3
  663. package/build-style/social-links/style.css +15 -3
  664. package/build-style/spacer/editor-rtl.css +15 -3
  665. package/build-style/spacer/editor.css +15 -3
  666. package/build-style/spacer/style-rtl.css +15 -3
  667. package/build-style/spacer/style.css +15 -3
  668. package/build-style/style-rtl.css +36 -10
  669. package/build-style/style.css +36 -10
  670. package/build-style/table/editor-rtl.css +15 -11
  671. package/build-style/table/editor.css +15 -11
  672. package/build-style/table/style-rtl.css +21 -3
  673. package/build-style/table/style.css +21 -3
  674. package/build-style/table/theme-rtl.css +15 -9
  675. package/build-style/table/theme.css +15 -9
  676. package/build-style/tag-cloud/style-rtl.css +15 -3
  677. package/build-style/tag-cloud/style.css +15 -3
  678. package/build-style/template-part/editor-rtl.css +30 -4
  679. package/build-style/template-part/editor.css +30 -4
  680. package/build-style/template-part/theme-rtl.css +15 -3
  681. package/build-style/template-part/theme.css +15 -3
  682. package/build-style/text-columns/editor-rtl.css +15 -3
  683. package/build-style/text-columns/editor.css +15 -3
  684. package/build-style/text-columns/style-rtl.css +15 -3
  685. package/build-style/text-columns/style.css +15 -3
  686. package/build-style/theme-rtl.css +15 -9
  687. package/build-style/theme.css +15 -9
  688. package/build-style/verse/style-rtl.css +19 -4
  689. package/build-style/verse/style.css +19 -4
  690. package/build-style/video/editor-rtl.css +15 -3
  691. package/build-style/video/editor.css +15 -3
  692. package/build-style/video/style-rtl.css +17 -4
  693. package/build-style/video/style.css +17 -4
  694. package/build-style/video/theme-rtl.css +15 -3
  695. package/build-style/video/theme.css +15 -3
  696. package/package.json +32 -30
  697. package/src/audio/edit.native.js +1 -2
  698. package/src/audio/index.js +1 -0
  699. package/src/avatar/edit.js +1 -0
  700. package/src/avatar/user-control.js +1 -0
  701. package/src/block/block.json +1 -2
  702. package/src/block/edit.js +14 -3
  703. package/src/block/edit.native.js +24 -12
  704. package/src/block/editor.scss +17 -0
  705. package/src/block/index.php +1 -2
  706. package/src/block/test/edit.native.js +28 -32
  707. package/src/button/edit.native.js +1 -0
  708. package/src/buttons/test/edit.native.js +40 -51
  709. package/src/categories/edit.js +1 -1
  710. package/src/code/transforms.js +3 -1
  711. package/src/columns/edit.js +1 -0
  712. package/src/columns/edit.native.js +18 -26
  713. package/src/comment-author-avatar/edit.js +1 -0
  714. package/src/comments/index.php +0 -1
  715. package/src/cover/edit/inspector-controls.js +6 -4
  716. package/src/cover/edit.native.js +32 -19
  717. package/src/cover/test/edit.native.js +73 -126
  718. package/src/embed/embed-controls.native.js +1 -0
  719. package/src/embed/embed-preview.native.js +1 -2
  720. package/src/embed/test/index.native.js +237 -231
  721. package/src/file/inspector.js +1 -0
  722. package/src/file/test/__snapshots__/edit.native.js.snap +2 -6
  723. package/src/freeform/edit.js +48 -29
  724. package/src/freeform/modal.js +111 -0
  725. package/src/gallery/edit.js +32 -7
  726. package/src/gallery/gallery.js +3 -13
  727. package/src/gallery/gallery.native.js +1 -2
  728. package/src/gallery/shared.js +7 -11
  729. package/src/gallery/transforms.js +1 -6
  730. package/src/gallery/use-get-media.js +1 -1
  731. package/src/gallery/use-get-media.native.js +2 -1
  732. package/src/gallery/v1/edit.js +8 -7
  733. package/src/gallery/v1/gallery.native.js +1 -2
  734. package/src/gallery/v1/shared.js +7 -2
  735. package/src/group/block.json +3 -1
  736. package/src/group/edit.js +2 -6
  737. package/src/group/placeholder.js +6 -25
  738. package/src/group/test/__snapshots__/edit.native.js.snap +1 -1
  739. package/src/heading/block.json +1 -2
  740. package/src/heading/deprecated.js +209 -136
  741. package/src/heading/index.php +52 -0
  742. package/src/heading/test/__snapshots__/index.native.js.snap +7 -0
  743. package/src/heading/test/index.native.js +44 -0
  744. package/src/home-link/index.php +1 -1
  745. package/src/html/block.json +1 -1
  746. package/src/image/edit.js +7 -2
  747. package/src/image/edit.native.js +2 -1
  748. package/src/image/editor.scss +0 -11
  749. package/src/image/image.js +14 -8
  750. package/src/image/test/edit.native.js +14 -10
  751. package/src/index.js +2 -0
  752. package/src/latest-comments/edit.js +1 -0
  753. package/src/latest-posts/edit.js +2 -0
  754. package/src/latest-posts/test/__snapshots__/edit.native.js.snap +3 -0
  755. package/src/latest-posts/test/edit.native.js +49 -0
  756. package/src/list/test/edit.native.js +53 -45
  757. package/src/list/transforms.js +0 -11
  758. package/src/list/utils.js +6 -2
  759. package/src/list-item/index.js +2 -0
  760. package/src/list-item/transforms.js +17 -0
  761. package/src/list-item/utils.js +10 -1
  762. package/src/media-text/edit.js +6 -3
  763. package/src/missing/edit.native.js +13 -6
  764. package/src/missing/test/edit-integration.native.js +10 -12
  765. package/src/more/test/__snapshots__/edit.native.js.snap +7 -0
  766. package/src/more/test/edit.native.js +41 -0
  767. package/src/navigation/edit/are-blocks-dirty.js +51 -0
  768. package/src/navigation/edit/index.js +229 -298
  769. package/src/navigation/edit/menu-inspector-controls.js +119 -0
  770. package/src/navigation/edit/navigation-menu-selector.js +6 -7
  771. package/src/navigation/edit/test/are-blocks-dirty.js +121 -0
  772. package/src/navigation/edit/unsaved-inner-blocks.js +12 -7
  773. package/src/navigation/edit/utils.js +82 -0
  774. package/src/navigation/editor.scss +0 -7
  775. package/src/navigation/index.php +89 -10
  776. package/src/navigation/style.scss +0 -1
  777. package/src/navigation/view-modal.js +11 -1
  778. package/src/navigation-link/edit.js +62 -386
  779. package/src/navigation-link/index.php +64 -0
  780. package/src/navigation-link/link-ui.js +213 -0
  781. package/src/navigation-link/test/edit.js +23 -82
  782. package/src/navigation-link/transforms.js +14 -0
  783. package/src/navigation-link/update-attributes.js +99 -0
  784. package/src/navigation-submenu/edit.js +85 -276
  785. package/src/navigation-submenu/index.php +72 -0
  786. package/src/page-list/block.json +24 -2
  787. package/src/page-list/constants.js +8 -0
  788. package/src/page-list/convert-to-links-modal.js +19 -76
  789. package/src/page-list/convert-to-navigation-links.js +60 -0
  790. package/src/page-list/edit.js +187 -118
  791. package/src/page-list/editor.scss +4 -0
  792. package/src/page-list/index.js +8 -2
  793. package/src/page-list/index.php +18 -10
  794. package/src/page-list/test/convert-to-links-modal.js +28 -34
  795. package/src/page-list-item/block.json +51 -0
  796. package/src/page-list-item/edit.js +102 -0
  797. package/src/page-list-item/index.js +24 -0
  798. package/src/page-list-item/init.js +6 -0
  799. package/src/paragraph/index.js +0 -6
  800. package/src/post-author/edit.js +3 -2
  801. package/src/post-content/index.php +1 -2
  802. package/src/post-featured-image/index.php +7 -2
  803. package/src/post-featured-image/overlay.js +1 -1
  804. package/src/post-template/block.json +8 -0
  805. package/src/preformatted/transforms.js +4 -1
  806. package/src/query/block.json +0 -8
  807. package/src/query/deprecated.js +257 -86
  808. package/src/query/edit/index.js +1 -0
  809. package/src/query/edit/inspector-controls/index.js +50 -38
  810. package/src/query/edit/inspector-controls/taxonomy-controls.js +102 -38
  811. package/src/query/edit/query-content.js +2 -1
  812. package/src/query/edit/query-placeholder.js +14 -25
  813. package/src/query/utils.js +59 -1
  814. package/src/rss/edit.js +3 -0
  815. package/src/search/edit.js +2 -2
  816. package/src/search/edit.native.js +31 -27
  817. package/src/search/index.js +5 -1
  818. package/src/separator/test/__snapshots__/edit.native.js.snap +7 -0
  819. package/src/separator/test/edit.native.js +41 -0
  820. package/src/shortcode/test/edit.native.js +15 -18
  821. package/src/site-logo/edit.js +13 -5
  822. package/src/site-logo/index.js +1 -0
  823. package/src/site-title/index.js +1 -0
  824. package/src/social-link/edit.js +3 -3
  825. package/src/social-link/social-list.js +2 -7
  826. package/src/social-link/test/index.native.js +10 -16
  827. package/src/social-links/edit.js +0 -1
  828. package/src/social-links/test/edit.native.js +4 -3
  829. package/src/spacer/test/index.native.js +39 -36
  830. package/src/table/block.json +15 -0
  831. package/src/table/edit.js +2 -1
  832. package/src/table/editor.scss +0 -4
  833. package/src/table/index.js +1 -0
  834. package/src/table/save.js +5 -1
  835. package/src/table/state.js +22 -7
  836. package/src/table/style.scss +8 -0
  837. package/src/table/theme.scss +0 -8
  838. package/src/table/transforms.js +2 -1
  839. package/src/table-of-contents/edit.js +3 -3
  840. package/src/tag-cloud/edit.js +3 -2
  841. package/src/template-part/edit/advanced-controls.js +12 -0
  842. package/src/template-part/edit/import-controls.js +180 -0
  843. package/src/template-part/edit/index.js +1 -0
  844. package/src/template-part/edit/selection-modal.js +4 -3
  845. package/src/template-part/edit/utils/hooks.js +7 -3
  846. package/src/template-part/edit/utils/transformers.js +37 -0
  847. package/src/template-part/editor.scss +20 -2
  848. package/src/template-part/index.php +1 -2
  849. package/src/text-columns/edit.js +1 -0
  850. package/src/utils/transformation-categories.native.js +1 -0
  851. package/src/verse/style.scss +4 -1
  852. package/src/verse/test/__snapshots__/edit.native.js.snap +13 -0
  853. package/src/verse/test/edit.native.js +40 -33
  854. package/src/video/edit.js +1 -1
  855. package/src/video/edit.native.js +1 -2
  856. package/test/babel-plugin.js +35 -35
  857. package/tsconfig.tsbuildinfo +1 -1
  858. package/build/query/constants.js +0 -16
  859. package/build/query/constants.js.map +0 -1
  860. package/build-module/query/constants.js +0 -7
  861. package/build-module/query/constants.js.map +0 -1
  862. package/src/query/constants.js +0 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table/edit.js"],"names":["ALIGNMENT_CONTROLS","icon","alignLeft","title","align","alignCenter","alignRight","cellAriaLabel","head","body","foot","placeholder","TSection","name","props","TagName","TableEdit","attributes","setAttributes","insertBlocksAfter","isSelected","hasFixedLayout","caption","initialRowCount","setInitialRowCount","initialColumnCount","setInitialColumnCount","selectedCell","setSelectedCell","colorProps","borderProps","tableRef","hasTableCreated","setHasTableCreated","onChangeInitialColumnCount","count","onChangeInitialRowCount","onCreateTable","event","preventDefault","rowCount","parseInt","columnCount","onChangeFixedLayout","onChange","content","cellAttributes","onChangeColumnAlignment","columnSelection","type","columnIndex","newAttributes","getCellAlignment","onToggleHeaderSection","onToggleFooterSection","onInsertRow","delta","sectionName","rowIndex","newRowIndex","onInsertRowBefore","onInsertRowAfter","onDeleteRow","onInsertColumn","newColumnIndex","onInsertColumnBefore","onInsertColumnAfter","onDeleteColumn","current","querySelector","focus","sections","filter","tableControls","tableRowBefore","isDisabled","onClick","tableRowAfter","tableRowDelete","tableColumnBefore","tableColumnAfter","tableColumnDelete","renderedSections","map","cells","tag","CellTag","scope","undefined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C,GALL;AAMC,IAAA,SAAS,EAAC;AANX,IAZD,EAoBC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,kCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,IAAI,EAAC;AAHN,KAKG,cAAI,cAAJ,CALH,CApBD,CALD,CAvFF,CADD;AA6HA;;eAEcpB,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPanelBody,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: __( 'Header label' ),\n\tfoot: __( 'Footer label' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected,\n} ) {\n\tconst { hasFixedLayout, caption, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tfunction onChange( content ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes(\n\t\t\tupdateSelectedCell(\n\t\t\t\tattributes,\n\t\t\t\tselectedCell,\n\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t...cellAttributes,\n\t\t\t\t\tcontent,\n\t\t\t\t} )\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = [ 'head', 'body', 'foot' ].map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t{ content, tag: CellTag, scope, align },\n\t\t\t\t\t\t\tcolumnIndex\n\t\t\t\t\t\t) => (\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName={ CellTag }\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'wp-block-table__cell-content'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\thasArrowIndicator\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\t\t\tclassName=\"blocks-table-settings\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t\taria-label={ __( 'Table caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\t// Deselect the selected table cell when the caption is focused.\n\t\t\t\t\tunstableOnFocus={ () => setSelectedCell() }\n\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEmpty && (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-button\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nexport default TableEdit;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table/edit.js"],"names":["ALIGNMENT_CONTROLS","icon","alignLeft","title","align","alignCenter","alignRight","cellAriaLabel","head","body","foot","placeholder","TSection","name","props","TagName","TableEdit","attributes","setAttributes","insertBlocksAfter","isSelected","hasFixedLayout","caption","initialRowCount","setInitialRowCount","initialColumnCount","setInitialColumnCount","selectedCell","setSelectedCell","colorProps","borderProps","tableRef","hasTableCreated","setHasTableCreated","onChangeInitialColumnCount","count","onChangeInitialRowCount","onCreateTable","event","preventDefault","rowCount","parseInt","columnCount","onChangeFixedLayout","onChange","content","cellAttributes","onChangeColumnAlignment","columnSelection","type","columnIndex","newAttributes","getCellAlignment","onToggleHeaderSection","onToggleFooterSection","onInsertRow","delta","sectionName","rowIndex","newRowIndex","onInsertRowBefore","onInsertRowAfter","onDeleteRow","onInsertColumn","newColumnIndex","onInsertColumnBefore","onInsertColumnAfter","onDeleteColumn","current","querySelector","focus","sections","filter","tableControls","tableRowBefore","isDisabled","onClick","tableRowAfter","tableRowDelete","tableColumnBefore","tableColumnAfter","tableColumnDelete","renderedSections","map","cells","tag","CellTag","scope","colspan","undefined","isEmpty","length","ref","nextAlign","table","className","style","border","value"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAWA;;AACA;;AASA;;AAaA;;AAKA;;AAhDA;AACA;AACA;;AAGA;AACA;AACA;;AAsCA;AACA;AACA;AAaA,MAAMA,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAEC,gBADP;AAECC,EAAAA,KAAK,EAAE,cAAI,mBAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE;AAHR,CAD0B,EAM1B;AACCH,EAAAA,IAAI,EAAEI,kBADP;AAECF,EAAAA,KAAK,EAAE,cAAI,qBAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE;AAHR,CAN0B,EAW1B;AACCH,EAAAA,IAAI,EAAEK,iBADP;AAECH,EAAAA,KAAK,EAAE,cAAI,oBAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE;AAHR,CAX0B,CAA3B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,CADgB;AAZnB,IApEF,EAsFGuE,OAAO,IACR,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,IAAI,EAAG,4BAAC,sBAAD;AAAW,MAAA,IAAI,EAAGzF,iBAAlB;AAAyB,MAAA,UAAU;AAAnC,MAFR;AAGC,IAAA,YAAY,EAAG,cAAI,kCAAJ;AAHhB,KAKC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,QAAQ,EAAGoC;AAFZ,KAIC,4BAAC,uBAAD;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,KAAK,EAAG,cAAI,cAAJ,CAFT;AAGC,IAAA,KAAK,EAAGZ,kBAHT;AAIC,IAAA,QAAQ,EAAGS,0BAJZ;AAKC,IAAA,GAAG,EAAC,GALL;AAMC,IAAA,SAAS,EAAC;AANX,IAJD,EAYC,4BAAC,uBAAD;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,KAAK,EAAG,cAAI,WAAJ,CAFT;AAGC,IAAA,KAAK,EAAGX,eAHT;AAIC,IAAA,QAAQ,EAAGa,uBAJZ;AAKC,IAAA,GAAG,EAAC,GALL;AAMC,IAAA,SAAS,EAAC;AANX,IAZD,EAoBC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,kCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,IAAI,EAAC;AAHN,KAKG,cAAI,cAAJ,CALH,CApBD,CALD,CAvFF,CADD;AA6HA;;eAEcpB,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPanelBody,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: __( 'Header label' ),\n\tfoot: __( 'Footer label' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected,\n} ) {\n\tconst { hasFixedLayout, caption, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tfunction onChange( content ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes(\n\t\t\tupdateSelectedCell(\n\t\t\t\tattributes,\n\t\t\t\tselectedCell,\n\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t...cellAttributes,\n\t\t\t\t\tcontent,\n\t\t\t\t} )\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = [ 'head', 'body', 'foot' ].map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t{ content, tag: CellTag, scope, align, colspan },\n\t\t\t\t\t\t\tcolumnIndex\n\t\t\t\t\t\t) => (\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName={ CellTag }\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'wp-block-table__cell-content'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\thasArrowIndicator\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\t\t\tclassName=\"blocks-table-settings\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t\taria-label={ __( 'Table caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\t// Deselect the selected table cell when the caption is focused.\n\t\t\t\t\tunstableOnFocus={ () => setSelectedCell() }\n\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEmpty && (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-button\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nexport default TableEdit;\n"]}
@@ -77,6 +77,11 @@ const metadata = {
77
77
  type: "string",
78
78
  source: "attribute",
79
79
  attribute: "data-align"
80
+ },
81
+ colspan: {
82
+ type: "string",
83
+ source: "attribute",
84
+ attribute: "colspan"
80
85
  }
81
86
  }
82
87
  }
@@ -112,6 +117,11 @@ const metadata = {
112
117
  type: "string",
113
118
  source: "attribute",
114
119
  attribute: "data-align"
120
+ },
121
+ colspan: {
122
+ type: "string",
123
+ source: "attribute",
124
+ attribute: "colspan"
115
125
  }
116
126
  }
117
127
  }
@@ -147,6 +157,11 @@ const metadata = {
147
157
  type: "string",
148
158
  source: "attribute",
149
159
  attribute: "data-align"
160
+ },
161
+ colspan: {
162
+ type: "string",
163
+ source: "attribute",
164
+ attribute: "colspan"
150
165
  }
151
166
  }
152
167
  }
@@ -260,7 +275,8 @@ const settings = {
260
275
  tag: 'td'
261
276
  }]
262
277
  }]
263
- }
278
+ },
279
+ viewportWidth: 450
264
280
  },
265
281
  transforms: _transforms.default,
266
282
  edit: _edit.default,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table/index.js"],"names":["name","metadata","settings","icon","example","attributes","head","cells","content","tag","body","transforms","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,iBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,IAAI,EAAE,CACL;AACCC,QAAAA,KAAK,EAAE,CACN;AACCC,UAAAA,OAAO,EAAE,cAAI,SAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SADM,EAKN;AACCD,UAAAA,OAAO,EAAE,cAAI,eAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,cAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SATM;AADR,OADK,CADK;AAmBXC,MAAAA,IAAI,EAAE,CACL;AACCH,QAAAA,KAAK,EAAE,CACN;AACCC,UAAAA,OAAO,EAAE,KADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SADM,EAKN;AACCD,UAAAA,OAAO,EAAE,gBADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,aAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SATM;AADR,OADK,EAiBL;AACCF,QAAAA,KAAK,EAAE,CACN;AACCC,UAAAA,OAAO,EAAE,KADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SADM,EAKN;AACCD,UAAAA,OAAO,EAAE,cADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,mBAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SATM;AADR,OAjBK,EAiCL;AACCF,QAAAA,KAAK,EAAE,CACN;AACCC,UAAAA,OAAO,EAAE,KADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SADM,EAKN;AACCD,UAAAA,OAAO,EAAE,aADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,kBAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SATM;AADR,OAjCK;AAnBK;AADJ,GAFc;AA0EvBE,EAAAA,UAAU,EAAVA,mBA1EuB;AA2EvBC,EAAAA,IAAI,EAAJA,aA3EuB;AA4EvBC,EAAAA,IAAI,EAAJA,aA5EuB;AA6EvBC,EAAAA,UAAU,EAAVA;AA7EuB,CAAjB;;;AAgFA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEf,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Jaco Pastorius',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Betty Carter',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Bebo Valdés',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table/index.js"],"names":["name","metadata","settings","icon","example","attributes","head","cells","content","tag","body","viewportWidth","transforms","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,iBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,IAAI,EAAE,CACL;AACCC,QAAAA,KAAK,EAAE,CACN;AACCC,UAAAA,OAAO,EAAE,cAAI,SAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SADM,EAKN;AACCD,UAAAA,OAAO,EAAE,cAAI,eAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,cAAJ,CADV;AAECC,UAAAA,GAAG,EAA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n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Jaco Pastorius',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Betty Carter',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Bebo Valdés',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tviewportWidth: 450,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
@@ -66,7 +66,8 @@ function save(_ref) {
66
66
  content,
67
67
  tag,
68
68
  scope,
69
- align
69
+ align,
70
+ colspan
70
71
  } = _ref4;
71
72
  const cellClasses = (0, _classnames.default)({
72
73
  [`has-text-align-${align}`]: align
@@ -77,7 +78,8 @@ function save(_ref) {
77
78
  tagName: tag,
78
79
  value: content,
79
80
  key: cellIndex,
80
- scope: tag === 'th' ? scope : undefined
81
+ scope: tag === 'th' ? scope : undefined,
82
+ colSpan: colspan
81
83
  });
82
84
  }));
83
85
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table/save.js"],"names":["save","attributes","hasFixedLayout","head","body","foot","caption","isEmpty","length","colorProps","borderProps","classes","className","hasCaption","RichText","Section","type","rows","Tag","map","rowIndex","cells","cellIndex","content","tag","scope","align","cellClasses","undefined","useBlockProps","style"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASe,SAAS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B,GAAiCA;AADF,SAAZ,CAApB;AAIA,eACC,4BAAC,qBAAD,CAAU,OAAV;AACC,UAAA,SAAS,EACRC,WAAW,GACRA,WADQ,GAERC,SAJL;AAMC,wBAAaF,KANd;AAOC,UAAA,OAAO,EAAGF,GAPX;AAQC,UAAA,KAAK,EAAGD,OART;AASC,UAAA,GAAG,EAAGD,SATP;AAUC,UAAA,KAAK,EACJE,GAAG,KAAK,IAAR,GAAeC,KAAf,GAAuBG;AAXzB,UADD;AAgBA,OAtBA,CADH,CADW;AAAA,KAAV,CADH,CADD;AAgCA,GAvCD;;AAyCA,SACC,sCAAaC,2BAAc7B,IAAd,EAAb,EACC;AACC,IAAA,SAAS,EAAGW,OAAO,KAAK,EAAZ,GAAiBiB,SAAjB,GAA6BjB,OAD1C;AAEC,IAAA,KAAK,EAAG,EAAE,GAAGF,UAAU,CAACqB,KAAhB;AAAuB,SAAGpB,WAAW,CAACoB;AAAtC;AAFT,KAIC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAG3B;AAA5B,IAJD,EAKC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAGC;AAA5B,IALD,EAMC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAGC;AAA5B,IAND,CADD,EASGQ,UAAU,IACX,4BAAC,qBAAD,CAAU,OAAV;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,KAAK,EAAGP,OAFT;AAGC,IAAA,SAAS,EAAG,oDAAmC,SAAnC;AAHb,IAVF,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { hasFixedLayout, head, body, foot, caption } = attributes;\n\tconst isEmpty = ! head.length && ! body.length && ! foot.length;\n\n\tif ( isEmpty ) {\n\t\treturn null;\n\t}\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\tconst classes = classnames( colorProps.className, borderProps.className, {\n\t\t'has-fixed-layout': hasFixedLayout,\n\t} );\n\n\tconst hasCaption = ! RichText.isEmpty( caption );\n\n\tconst Section = ( { type, rows } ) => {\n\t\tif ( ! rows.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst Tag = `t${ type }`;\n\n\t\treturn (\n\t\t\t<Tag>\n\t\t\t\t{ rows.map( ( { cells }, rowIndex ) => (\n\t\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t\t( { content, tag, scope, align }, cellIndex ) => {\n\t\t\t\t\t\t\t\tconst cellClasses = classnames( {\n\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<RichText.Content\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t? cellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdata-align={ align }\n\t\t\t\t\t\t\t\t\t\ttagName={ tag }\n\t\t\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\t\t\tkey={ cellIndex }\n\t\t\t\t\t\t\t\t\t\tscope={\n\t\t\t\t\t\t\t\t\t\t\ttag === 'th' ? scope : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</tr>\n\t\t\t\t) ) }\n\t\t\t</Tag>\n\t\t);\n\t};\n\n\treturn (\n\t\t<figure { ...useBlockProps.save() }>\n\t\t\t<table\n\t\t\t\tclassName={ classes === '' ? undefined : classes }\n\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t>\n\t\t\t\t<Section type=\"head\" rows={ head } />\n\t\t\t\t<Section type=\"body\" rows={ body } />\n\t\t\t\t<Section type=\"foot\" rows={ foot } />\n\t\t\t</table>\n\t\t\t{ hasCaption && (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table/save.js"],"names":["save","attributes","hasFixedLayout","head","body","foot","caption","isEmpty","length","colorProps","borderProps","classes","className","hasCaption","RichText","Section","type","rows","Tag","map","rowIndex","cells","cellIndex","content","tag","scope","align","colspan","cellClasses","undefined","useBlockProps","style"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASe,SAASA,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,IAAlB;AAAwBC,IAAAA,IAAxB;AAA8BC,IAAAA,IAA9B;AAAoCC,IAAAA;AAApC,MAAgDL,UAAtD;AACA,QAAMM,OAAO,GAAG,CAAEJ,IAAI,CAACK,MAAP,IAAiB,CAAEJ,IAAI,CAACI,MAAxB,IAAkC,CAAEH,IAAI,CAACG,MAAzD;;AAEA,MAAKD,OAAL,EAAe;AACd,WAAO,IAAP;AACA;;AAED,QAAME,UAAU,GAAG,yDAA0BR,UAA1B,CAAnB;AACA,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CA,SACC,sCAAaG,2BAAc9B,IAAd,EAAb,EACC;AACC,IAAA,SAAS,EAAGW,OAAO,KAAK,EAAZ,GAAiBkB,SAAjB,GAA6BlB,OAD1C;AAEC,IAAA,KAAK,EAAG,EAAE,GAAGF,UAAU,CAACsB,KAAhB;AAAuB,SAAGrB,WAAW,CAACqB;AAAtC;AAFT,KAIC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAG5B;AAA5B,IAJD,EAKC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAGC;AAA5B,IALD,EAMC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAGC;AAA5B,IAND,CADD,EASGQ,UAAU,IACX,4BAAC,qBAAD,CAAU,OAAV;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,KAAK,EAAGP,OAFT;AAGC,IAAA,SAAS,EAAG,oDAAmC,SAAnC;AAHb,IAVF,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { hasFixedLayout, head, body, foot, caption } = attributes;\n\tconst isEmpty = ! head.length && ! body.length && ! foot.length;\n\n\tif ( isEmpty ) {\n\t\treturn null;\n\t}\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\tconst classes = classnames( colorProps.className, borderProps.className, {\n\t\t'has-fixed-layout': hasFixedLayout,\n\t} );\n\n\tconst hasCaption = ! RichText.isEmpty( caption );\n\n\tconst Section = ( { type, rows } ) => {\n\t\tif ( ! rows.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst Tag = `t${ type }`;\n\n\t\treturn (\n\t\t\t<Tag>\n\t\t\t\t{ rows.map( ( { cells }, rowIndex ) => (\n\t\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t{ content, tag, scope, align, colspan },\n\t\t\t\t\t\t\t\tcellIndex\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst cellClasses = classnames( {\n\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<RichText.Content\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t? cellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdata-align={ align }\n\t\t\t\t\t\t\t\t\t\ttagName={ tag }\n\t\t\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\t\t\tkey={ cellIndex }\n\t\t\t\t\t\t\t\t\t\tscope={\n\t\t\t\t\t\t\t\t\t\t\ttag === 'th' ? scope : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</tr>\n\t\t\t\t) ) }\n\t\t\t</Tag>\n\t\t);\n\t};\n\n\treturn (\n\t\t<figure { ...useBlockProps.save() }>\n\t\t\t<table\n\t\t\t\tclassName={ classes === '' ? undefined : classes }\n\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t>\n\t\t\t\t<Section type=\"head\" rows={ head } />\n\t\t\t\t<Section type=\"body\" rows={ body } />\n\t\t\t\t<Section type=\"foot\" rows={ foot } />\n\t\t\t</table>\n\t\t\t{ hasCaption && (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n"]}
@@ -107,7 +107,10 @@ function updateSelectedCell(state, selection, updateCell) {
107
107
  return state;
108
108
  }
109
109
 
110
- const tableSections = (0, _lodash.pick)(state, ['head', 'body', 'foot']);
110
+ const tableSections = Object.fromEntries(Object.entries(state).filter(_ref2 => {
111
+ let [key] = _ref2;
112
+ return ['head', 'body', 'foot'].includes(key);
113
+ }));
111
114
  const {
112
115
  sectionName: selectionSectionName,
113
116
  rowIndex: selectionRowIndex
@@ -176,12 +179,12 @@ function isCellSelected(cellLocation, selection) {
176
179
  */
177
180
 
178
181
 
179
- function insertRow(state, _ref2) {
182
+ function insertRow(state, _ref3) {
180
183
  let {
181
184
  sectionName,
182
185
  rowIndex,
183
186
  columnCount
184
- } = _ref2;
187
+ } = _ref3;
185
188
  const firstRow = getFirstRow(state);
186
189
  const cellCount = columnCount === undefined ? (0, _lodash.get)(firstRow, ['cells', 'length']) : columnCount; // Bail early if the function cannot determine how many cells to add.
187
190
 
@@ -195,7 +198,10 @@ function insertRow(state, _ref2) {
195
198
  length: cellCount
196
199
  }).map((_, index) => {
197
200
  const firstCellInColumn = (0, _lodash.get)(firstRow, ['cells', index], {});
198
- const inheritedAttributes = (0, _lodash.pick)(firstCellInColumn, INHERITED_COLUMN_ATTRIBUTES);
201
+ const inheritedAttributes = Object.fromEntries(Object.entries(firstCellInColumn).filter(_ref4 => {
202
+ let [key] = _ref4;
203
+ return INHERITED_COLUMN_ATTRIBUTES.includes(key);
204
+ }));
199
205
  return { ...inheritedAttributes,
200
206
  content: '',
201
207
  tag: sectionName === 'head' ? 'th' : 'td'
@@ -216,11 +222,11 @@ function insertRow(state, _ref2) {
216
222
  */
217
223
 
218
224
 
219
- function deleteRow(state, _ref3) {
225
+ function deleteRow(state, _ref5) {
220
226
  let {
221
227
  sectionName,
222
228
  rowIndex
223
- } = _ref3;
229
+ } = _ref5;
224
230
  return {
225
231
  [sectionName]: state[sectionName].filter((row, index) => index !== rowIndex)
226
232
  };
@@ -236,11 +242,14 @@ function deleteRow(state, _ref3) {
236
242
  */
237
243
 
238
244
 
239
- function insertColumn(state, _ref4) {
245
+ function insertColumn(state, _ref6) {
240
246
  let {
241
247
  columnIndex
242
- } = _ref4;
243
- const tableSections = (0, _lodash.pick)(state, ['head', 'body', 'foot']);
248
+ } = _ref6;
249
+ const tableSections = Object.fromEntries(Object.entries(state).filter(_ref7 => {
250
+ let [key] = _ref7;
251
+ return ['head', 'body', 'foot'].includes(key);
252
+ }));
244
253
  return (0, _lodash.mapValues)(tableSections, (section, sectionName) => {
245
254
  // Bail early if the table section is empty.
246
255
  if (isEmptyTableSection(section)) {
@@ -274,11 +283,14 @@ function insertColumn(state, _ref4) {
274
283
  */
275
284
 
276
285
 
277
- function deleteColumn(state, _ref5) {
286
+ function deleteColumn(state, _ref8) {
278
287
  let {
279
288
  columnIndex
280
- } = _ref5;
281
- const tableSections = (0, _lodash.pick)(state, ['head', 'body', 'foot']);
289
+ } = _ref8;
290
+ const tableSections = Object.fromEntries(Object.entries(state).filter(_ref9 => {
291
+ let [key] = _ref9;
292
+ return ['head', 'body', 'foot'].includes(key);
293
+ }));
282
294
  return (0, _lodash.mapValues)(tableSections, section => {
283
295
  // Bail early if the table section is empty.
284
296
  if (isEmptyTableSection(section)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table/state.js"],"names":["INHERITED_COLUMN_ATTRIBUTES","createTable","rowCount","columnCount","body","Array","from","length","map","cells","content","tag","getFirstRow","state","isEmptyTableSection","head","foot","getCellAttribute","cellLocation","attributeName","sectionName","rowIndex","columnIndex","updateSelectedCell","selection","updateCell","tableSections","selectionSectionName","selectionRowIndex","section","row","cellAttributes","isCellSelected","type","insertRow","firstRow","cellCount","undefined","slice","_","index","firstCellInColumn","inheritedAttributes","deleteRow","filter","insertColumn","isEmptyRow","deleteColumn","cell","toggleSection","every"],"mappings":";;;;;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,2BAA2B,GAAG,CAAE,OAAF,CAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,WAAT,OAAkD;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;AACxD,SAAO;AACNC,IAAAA,IAAI,EAAEC,KAAK,CAACC,IAAN,CAAY;AAAEC,MAAAA,MAAM,EAAEL;AAAV,KAAZ,EAAmCM,GAAnC,CAAwC,OAAQ;AACrDC,MAAAA,KAAK,EAAEJ,KAAK,CAACC,IAAN,CAAY;AAAEC,QAAAA,MAAM,EAAEJ;AAAV,OAAZ,EAAsCK,GAAtC,CAA2C,OAAQ;AACzDE,QAAAA,OAAO,EAAE,EADgD;AAEzDC,QAAAA,GAAG,EAAE;AAFoD,OAAR,CAA3C;AAD8C,KAAR,CAAxC;AADA,GAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AACpC,MAAK,CAAEC,mBAAmB,CAAED,KAAK,CAACE,IAAR,CAA1B,EAA2C;AAC1C,WAAOF,KAAK,CAACE,IAAN,CAAY,CAAZ,CAAP;AACA;;AACD,MAAK,CAAED,mBAAmB,CAAED,KAAK,CAACT,IAAR,CAA1B,EAA2C;AAC1C,WAAOS,KAAK,CAACT,IAAN,CAAY,CAAZ,CAAP;AACA;;AACD,MAAK,CAAEU,mBAAmB,CAAED,KAAK,CAACG,IAAR,CAA1B,EAA2C;AAC1C,WAAOH,KAAK,CAACG,IAAN,CAAY,CAAZ,CAA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F,EAAQR,KAAR,KAAmBA,KAAK,KAAKlB,WAD7B,CADH,GAIGQ,GAAG,CAACrB;AANU,KAAb,CADA,EASLmC,MATK,CASKd,GAAF,IAAWA,GAAG,CAACrB,KAAJ,CAAUF,MATxB,CAAP;AAUA,GAhBM,CAAP;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS0C,aAAT,CAAwBpC,KAAxB,EAA+BO,WAA/B,EAA6C;AACnD;AACA,MAAK,CAAEN,mBAAmB,CAAED,KAAK,CAAEO,WAAF,CAAP,CAA1B,EAAqD;AACpD,WAAO;AAAE,OAAEA,WAAF,GAAiB;AAAnB,KAAP;AACA,GAJkD,CAMnD;;;AACA,QAAMjB,WAAW,GAAG,iBAAKU,KAAL,EAAY,CAAE,MAAF,EAAU,CAAV,EAAa,OAAb,EAAsB,QAAtB,CAAZ,EAA8C,CAA9C,CAApB,CAPmD,CASnD;;AACA,SAAOqB,SAAS,CAAErB,KAAF,EAAS;AAAEO,IAAAA,WAAF;AAAeC,IAAAA,QAAQ,EAAE,CAAzB;AAA4BlB,IAAAA;AAA5B,GAAT,CAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASW,mBAAT,CAA8Be,OAA9B,EAAwC;AAC9C,SAAO,CAAEA,OAAF,IAAa,CAAEA,OAAO,CAACtB,MAAvB,IAAiCsB,OAAO,CAACqB,KAAR,CAAeJ,UAAf,CAAxC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASA,UAAT,CAAqBhB,GAArB,EAA2B;AACjC,SAAO,EAAIA,GAAG,CAACrB,KAAJ,IAAaqB,GAAG,CAACrB,KAAJ,CAAUF,MAA3B,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, mapValues, pick } from 'lodash';\n\nconst INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];\n\n/**\n * Creates a table state.\n *\n * @param {Object} options\n * @param {number} options.rowCount Row count for the table to create.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function createTable( { rowCount, columnCount } ) {\n\treturn {\n\t\tbody: Array.from( { length: rowCount } ).map( () => ( {\n\t\t\tcells: Array.from( { length: columnCount } ).map( () => ( {\n\t\t\t\tcontent: '',\n\t\t\t\ttag: 'td',\n\t\t\t} ) ),\n\t\t} ) ),\n\t};\n}\n\n/**\n * Returns the first row in the table.\n *\n * @param {Object} state Current table state.\n *\n * @return {Object} The first table row.\n */\nexport function getFirstRow( state ) {\n\tif ( ! isEmptyTableSection( state.head ) ) {\n\t\treturn state.head[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.body ) ) {\n\t\treturn state.body[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.foot ) ) {\n\t\treturn state.foot[ 0 ];\n\t}\n}\n\n/**\n * Gets an attribute for a cell.\n *\n * @param {Object} state Current table state.\n * @param {Object} cellLocation The location of the cell\n * @param {string} attributeName The name of the attribute to get the value of.\n *\n * @return {*} The attribute value.\n */\nexport function getCellAttribute( state, cellLocation, attributeName ) {\n\tconst { sectionName, rowIndex, columnIndex } = cellLocation;\n\treturn get( state, [\n\t\tsectionName,\n\t\trowIndex,\n\t\t'cells',\n\t\tcolumnIndex,\n\t\tattributeName,\n\t] );\n}\n\n/**\n * Returns updated cell attributes after applying the `updateCell` function to the selection.\n *\n * @param {Object} state The block attributes.\n * @param {Object} selection The selection of cells to update.\n * @param {Function} updateCell A function to update the selected cell attributes.\n *\n * @return {Object} New table state including the updated cells.\n */\nexport function updateSelectedCell( state, selection, updateCell ) {\n\tif ( ! selection ) {\n\t\treturn state;\n\t}\n\n\tconst tableSections = pick( state, [ 'head', 'body', 'foot' ] );\n\tconst { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =\n\t\tselection;\n\n\treturn mapValues( tableSections, ( section, sectionName ) => {\n\t\tif ( selectionSectionName && selectionSectionName !== sectionName ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row, rowIndex ) => {\n\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: row.cells.map( ( cellAttributes, columnIndex ) => {\n\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t};\n\n\t\t\t\t\tif ( ! isCellSelected( cellLocation, selection ) ) {\n\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn updateCell( cellAttributes );\n\t\t\t\t} ),\n\t\t\t};\n\t\t} );\n\t} );\n}\n\n/**\n * Returns whether the cell at `cellLocation` is included in the selection `selection`.\n *\n * @param {Object} cellLocation An object containing cell location properties.\n * @param {Object} selection An object containing selection properties.\n *\n * @return {boolean} True if the cell is selected, false otherwise.\n */\nexport function isCellSelected( cellLocation, selection ) {\n\tif ( ! cellLocation || ! selection ) {\n\t\treturn false;\n\t}\n\n\tswitch ( selection.type ) {\n\t\tcase 'column':\n\t\t\treturn (\n\t\t\t\tselection.type === 'column' &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex\n\t\t\t);\n\t\tcase 'cell':\n\t\t\treturn (\n\t\t\t\tselection.type === 'cell' &&\n\t\t\t\tcellLocation.sectionName === selection.sectionName &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex &&\n\t\t\t\tcellLocation.rowIndex === selection.rowIndex\n\t\t\t);\n\t}\n}\n\n/**\n * Inserts a row in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to insert the row.\n * @param {number} options.rowIndex Row index at which to insert the row.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function insertRow( state, { sectionName, rowIndex, columnCount } ) {\n\tconst firstRow = getFirstRow( state );\n\tconst cellCount =\n\t\tcolumnCount === undefined\n\t\t\t? get( firstRow, [ 'cells', 'length' ] )\n\t\t\t: columnCount;\n\n\t// Bail early if the function cannot determine how many cells to add.\n\tif ( ! cellCount ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t[ sectionName ]: [\n\t\t\t...state[ sectionName ].slice( 0, rowIndex ),\n\t\t\t{\n\t\t\t\tcells: Array.from( { length: cellCount } ).map(\n\t\t\t\t\t( _, index ) => {\n\t\t\t\t\t\tconst firstCellInColumn = get(\n\t\t\t\t\t\t\tfirstRow,\n\t\t\t\t\t\t\t[ 'cells', index ],\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst inheritedAttributes = pick(\n\t\t\t\t\t\t\tfirstCellInColumn,\n\t\t\t\t\t\t\tINHERITED_COLUMN_ATTRIBUTES\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...inheritedAttributes,\n\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t\t...state[ sectionName ].slice( rowIndex ),\n\t\t],\n\t};\n}\n\n/**\n * Deletes a row from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to delete the row.\n * @param {number} options.rowIndex Row index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteRow( state, { sectionName, rowIndex } ) {\n\treturn {\n\t\t[ sectionName ]: state[ sectionName ].filter(\n\t\t\t( row, index ) => index !== rowIndex\n\t\t),\n\t};\n}\n\n/**\n * Inserts a column in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index at which to insert the column.\n *\n * @return {Object} New table state.\n */\nexport function insertColumn( state, { columnIndex } ) {\n\tconst tableSections = pick( state, [ 'head', 'body', 'foot' ] );\n\n\treturn mapValues( tableSections, ( section, sectionName ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row ) => {\n\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t// the last possible index of the array.\n\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: [\n\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t},\n\t\t\t\t\t...row.cells.slice( columnIndex ),\n\t\t\t\t],\n\t\t\t};\n\t\t} );\n\t} );\n}\n\n/**\n * Deletes a column from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteColumn( state, { columnIndex } ) {\n\tconst tableSections = pick( state, [ 'head', 'body', 'foot' ] );\n\n\treturn mapValues( tableSections, ( section ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section\n\t\t\t.map( ( row ) => ( {\n\t\t\t\tcells:\n\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: row.cells,\n\t\t\t} ) )\n\t\t\t.filter( ( row ) => row.cells.length );\n\t} );\n}\n\n/**\n * Toggles the existence of a section.\n *\n * @param {Object} state Current table state.\n * @param {string} sectionName Name of the section to toggle.\n *\n * @return {Object} New table state.\n */\nexport function toggleSection( state, sectionName ) {\n\t// Section exists, replace it with an empty row to remove it.\n\tif ( ! isEmptyTableSection( state[ sectionName ] ) ) {\n\t\treturn { [ sectionName ]: [] };\n\t}\n\n\t// Get the length of the first row of the body to use when creating the header.\n\tconst columnCount = get( state, [ 'body', 0, 'cells', 'length' ], 1 );\n\n\t// Section doesn't exist, insert an empty row to create the section.\n\treturn insertRow( state, { sectionName, rowIndex: 0, columnCount } );\n}\n\n/**\n * Determines whether a table section is empty.\n *\n * @param {Object} section Table section state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyTableSection( section ) {\n\treturn ! section || ! section.length || section.every( isEmptyRow );\n}\n\n/**\n * Determines whether a table row is empty.\n *\n * @param {Object} row Table row state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyRow( row ) {\n\treturn ! ( row.cells && row.cells.length );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table/state.js"],"names":["INHERITED_COLUMN_ATTRIBUTES","createTable","rowCount","columnCount","body","Array","from","length","map","cells","content","tag","getFirstRow","state","isEmptyTableSection","head","foot","getCellAttribute","cellLocation","attributeName","sectionName","rowIndex","columnIndex","updateSelectedCell","selection","updateCell","tableSections","Object","fromEntries","entries","filter","key","includes","selectionSectionName","selectionRowIndex","section","row","cellAttributes","isCellSelected","type","insertRow","firstRow","cellCount","undefined","slice","_","index","firstCellInColumn","inheritedAttributes","deleteRow","insertColumn","isEmptyRow","deleteColumn","cell","toggleSection","every"],"mappings":";;;;;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,2BAA2B,GAAG,CAAE,OAAF,CAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,WAAT,OAAkD;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;AACxD,SAAO;AACNC,IAAAA,IAAI,EAAEC,KAAK,CAACC,IAAN,CAAY;AAAEC,MAAAA,MAAM,EAAEL;AAAV,KAAZ,EAAmCM,GAAnC,CAAwC,OAAQ;AACrDC,MAAAA,KAAK,EAAEJ,KAAK,CAACC,IAAN,CAAY;AAAEC,QAAAA,MAAM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,CAAUqB,MAAV,CACA,CAAEuB,IAAF,EAAQP,KAAR,KAAmBA,KAAK,KAAKxB,WAD7B,CADH,GAIGc,GAAG,CAAC3B;AANU,KAAb,CADA,EASLqB,MATK,CASKM,GAAF,IAAWA,GAAG,CAAC3B,KAAJ,CAAUF,MATxB,CAAP;AAUA,GAhBM,CAAP;AAiBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS+C,aAAT,CAAwBzC,KAAxB,EAA+BO,WAA/B,EAA6C;AACnD;AACA,MAAK,CAAEN,mBAAmB,CAAED,KAAK,CAAEO,WAAF,CAAP,CAA1B,EAAqD;AACpD,WAAO;AAAE,OAAEA,WAAF,GAAiB;AAAnB,KAAP;AACA,GAJkD,CAMnD;;;AACA,QAAMjB,WAAW,GAAG,iBAAKU,KAAL,EAAY,CAAE,MAAF,EAAU,CAAV,EAAa,OAAb,EAAsB,QAAtB,CAAZ,EAA8C,CAA9C,CAApB,CAPmD,CASnD;;AACA,SAAO2B,SAAS,CAAE3B,KAAF,EAAS;AAAEO,IAAAA,WAAF;AAAeC,IAAAA,QAAQ,EAAE,CAAzB;AAA4BlB,IAAAA;AAA5B,GAAT,CAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASW,mBAAT,CAA8BqB,OAA9B,EAAwC;AAC9C,SAAO,CAAEA,OAAF,IAAa,CAAEA,OAAO,CAAC5B,MAAvB,IAAiC4B,OAAO,CAACoB,KAAR,CAAeJ,UAAf,CAAxC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASA,UAAT,CAAqBf,GAArB,EAA2B;AACjC,SAAO,EAAIA,GAAG,CAAC3B,KAAJ,IAAa2B,GAAG,CAAC3B,KAAJ,CAAUF,MAA3B,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, mapValues } from 'lodash';\n\nconst INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];\n\n/**\n * Creates a table state.\n *\n * @param {Object} options\n * @param {number} options.rowCount Row count for the table to create.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function createTable( { rowCount, columnCount } ) {\n\treturn {\n\t\tbody: Array.from( { length: rowCount } ).map( () => ( {\n\t\t\tcells: Array.from( { length: columnCount } ).map( () => ( {\n\t\t\t\tcontent: '',\n\t\t\t\ttag: 'td',\n\t\t\t} ) ),\n\t\t} ) ),\n\t};\n}\n\n/**\n * Returns the first row in the table.\n *\n * @param {Object} state Current table state.\n *\n * @return {Object} The first table row.\n */\nexport function getFirstRow( state ) {\n\tif ( ! isEmptyTableSection( state.head ) ) {\n\t\treturn state.head[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.body ) ) {\n\t\treturn state.body[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.foot ) ) {\n\t\treturn state.foot[ 0 ];\n\t}\n}\n\n/**\n * Gets an attribute for a cell.\n *\n * @param {Object} state Current table state.\n * @param {Object} cellLocation The location of the cell\n * @param {string} attributeName The name of the attribute to get the value of.\n *\n * @return {*} The attribute value.\n */\nexport function getCellAttribute( state, cellLocation, attributeName ) {\n\tconst { sectionName, rowIndex, columnIndex } = cellLocation;\n\treturn get( state, [\n\t\tsectionName,\n\t\trowIndex,\n\t\t'cells',\n\t\tcolumnIndex,\n\t\tattributeName,\n\t] );\n}\n\n/**\n * Returns updated cell attributes after applying the `updateCell` function to the selection.\n *\n * @param {Object} state The block attributes.\n * @param {Object} selection The selection of cells to update.\n * @param {Function} updateCell A function to update the selected cell attributes.\n *\n * @return {Object} New table state including the updated cells.\n */\nexport function updateSelectedCell( state, selection, updateCell ) {\n\tif ( ! selection ) {\n\t\treturn state;\n\t}\n\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\tconst { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =\n\t\tselection;\n\n\treturn mapValues( tableSections, ( section, sectionName ) => {\n\t\tif ( selectionSectionName && selectionSectionName !== sectionName ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row, rowIndex ) => {\n\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: row.cells.map( ( cellAttributes, columnIndex ) => {\n\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t};\n\n\t\t\t\t\tif ( ! isCellSelected( cellLocation, selection ) ) {\n\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn updateCell( cellAttributes );\n\t\t\t\t} ),\n\t\t\t};\n\t\t} );\n\t} );\n}\n\n/**\n * Returns whether the cell at `cellLocation` is included in the selection `selection`.\n *\n * @param {Object} cellLocation An object containing cell location properties.\n * @param {Object} selection An object containing selection properties.\n *\n * @return {boolean} True if the cell is selected, false otherwise.\n */\nexport function isCellSelected( cellLocation, selection ) {\n\tif ( ! cellLocation || ! selection ) {\n\t\treturn false;\n\t}\n\n\tswitch ( selection.type ) {\n\t\tcase 'column':\n\t\t\treturn (\n\t\t\t\tselection.type === 'column' &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex\n\t\t\t);\n\t\tcase 'cell':\n\t\t\treturn (\n\t\t\t\tselection.type === 'cell' &&\n\t\t\t\tcellLocation.sectionName === selection.sectionName &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex &&\n\t\t\t\tcellLocation.rowIndex === selection.rowIndex\n\t\t\t);\n\t}\n}\n\n/**\n * Inserts a row in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to insert the row.\n * @param {number} options.rowIndex Row index at which to insert the row.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function insertRow( state, { sectionName, rowIndex, columnCount } ) {\n\tconst firstRow = getFirstRow( state );\n\tconst cellCount =\n\t\tcolumnCount === undefined\n\t\t\t? get( firstRow, [ 'cells', 'length' ] )\n\t\t\t: columnCount;\n\n\t// Bail early if the function cannot determine how many cells to add.\n\tif ( ! cellCount ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t[ sectionName ]: [\n\t\t\t...state[ sectionName ].slice( 0, rowIndex ),\n\t\t\t{\n\t\t\t\tcells: Array.from( { length: cellCount } ).map(\n\t\t\t\t\t( _, index ) => {\n\t\t\t\t\t\tconst firstCellInColumn = get(\n\t\t\t\t\t\t\tfirstRow,\n\t\t\t\t\t\t\t[ 'cells', index ],\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst inheritedAttributes = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( firstCellInColumn ).filter(\n\t\t\t\t\t\t\t\t( [ key ] ) =>\n\t\t\t\t\t\t\t\t\tINHERITED_COLUMN_ATTRIBUTES.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...inheritedAttributes,\n\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t\t...state[ sectionName ].slice( rowIndex ),\n\t\t],\n\t};\n}\n\n/**\n * Deletes a row from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to delete the row.\n * @param {number} options.rowIndex Row index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteRow( state, { sectionName, rowIndex } ) {\n\treturn {\n\t\t[ sectionName ]: state[ sectionName ].filter(\n\t\t\t( row, index ) => index !== rowIndex\n\t\t),\n\t};\n}\n\n/**\n * Inserts a column in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index at which to insert the column.\n *\n * @return {Object} New table state.\n */\nexport function insertColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn mapValues( tableSections, ( section, sectionName ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row ) => {\n\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t// the last possible index of the array.\n\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: [\n\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t},\n\t\t\t\t\t...row.cells.slice( columnIndex ),\n\t\t\t\t],\n\t\t\t};\n\t\t} );\n\t} );\n}\n\n/**\n * Deletes a column from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn mapValues( tableSections, ( section ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section\n\t\t\t.map( ( row ) => ( {\n\t\t\t\tcells:\n\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: row.cells,\n\t\t\t} ) )\n\t\t\t.filter( ( row ) => row.cells.length );\n\t} );\n}\n\n/**\n * Toggles the existence of a section.\n *\n * @param {Object} state Current table state.\n * @param {string} sectionName Name of the section to toggle.\n *\n * @return {Object} New table state.\n */\nexport function toggleSection( state, sectionName ) {\n\t// Section exists, replace it with an empty row to remove it.\n\tif ( ! isEmptyTableSection( state[ sectionName ] ) ) {\n\t\treturn { [ sectionName ]: [] };\n\t}\n\n\t// Get the length of the first row of the body to use when creating the header.\n\tconst columnCount = get( state, [ 'body', 0, 'cells', 'length' ], 1 );\n\n\t// Section doesn't exist, insert an empty row to create the section.\n\treturn insertRow( state, { sectionName, rowIndex: 0, columnCount } );\n}\n\n/**\n * Determines whether a table section is empty.\n *\n * @param {Object} section Table section state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyTableSection( section ) {\n\treturn ! section || ! section.length || section.every( isEmptyRow );\n}\n\n/**\n * Determines whether a table row is empty.\n *\n * @param {Object} row Table row state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyRow( row ) {\n\treturn ! ( row.cells && row.cells.length );\n}\n"]}
@@ -16,11 +16,12 @@ const tableContentPasteSchema = _ref => {
16
16
  th: {
17
17
  allowEmpty: true,
18
18
  children: phrasingContentSchema,
19
- attributes: ['scope']
19
+ attributes: ['scope', 'colspan']
20
20
  },
21
21
  td: {
22
22
  allowEmpty: true,
23
- children: phrasingContentSchema
23
+ children: phrasingContentSchema,
24
+ attributes: ['colspan']
24
25
  }
25
26
  }
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table/transforms.js"],"names":["tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema"],"mappings":";;;;;;;AAAA,MAAMA,uBAAuB,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAAmC;AAClEC,IAAAA,EAAE,EAAE;AACHC,MAAAA,UAAU,EAAE,IADT;AAEHC,MAAAA,QAAQ,EAAE;AACTC,QAAAA,EAAE,EAAE;AACHF,UAAAA,UAAU,EAAE,IADT;AAEHC,UAAAA,QAAQ,EAAEH,qBAFP;AAGHK,UAAAA,UAAU,EAAE,CAAE,OAAF;AAHT,SADK;AAMTC,QAAAA,EAAE,EAAE;AACHJ,UAAAA,UAAU,EAAE,IADT;AAEHC,UAAAA,QAAQ,EAAEH;AAFP;AANK;AAFP;AAD8D,GAAnC;AAAA,CAAhC;;AAiBA,MAAMO,gBAAgB,GAAKC,IAAF,KAAc;AACtCC,EAAAA,KAAK,EAAE;AACNN,IAAAA,QAAQ,EAAE;AACTO,MAAAA,KAAK,EAAE;AACNR,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B,OADE;AAKTG,MAAAA,KAAK,EAAE;AACNT,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B,OALE;AASTI,MAAAA,KAAK,EAAE;AACNV,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B;AATE;AADJ;AAD+B,CAAd,CAAzB;;AAmBA,MAAMK,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,KADP;AAECC,IAAAA,QAAQ,EAAE,OAFX;AAGCC,IAAAA,MAAM,EAAEV;AAHT,GADK;AADY,CAAnB;eAUeM,U","sourcesContent":["const tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table/transforms.js"],"names":["tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema"],"mappings":";;;;;;;AAAA,MAAMA,uBAAuB,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAAmC;AAClEC,IAAAA,EAAE,EAAE;AACHC,MAAAA,UAAU,EAAE,IADT;AAEHC,MAAAA,QAAQ,EAAE;AACTC,QAAAA,EAAE,EAAE;AACHF,UAAAA,UAAU,EAAE,IADT;AAEHC,UAAAA,QAAQ,EAAEH,qBAFP;AAGHK,UAAAA,UAAU,EAAE,CAAE,OAAF,EAAW,SAAX;AAHT,SADK;AAMTC,QAAAA,EAAE,EAAE;AACHJ,UAAAA,UAAU,EAAE,IADT;AAEHC,UAAAA,QAAQ,EAAEH,qBAFP;AAGHK,UAAAA,UAAU,EAAE,CAAE,SAAF;AAHT;AANK;AAFP;AAD8D,GAAnC;AAAA,CAAhC;;AAkBA,MAAME,gBAAgB,GAAKC,IAAF,KAAc;AACtCC,EAAAA,KAAK,EAAE;AACNN,IAAAA,QAAQ,EAAE;AACTO,MAAAA,KAAK,EAAE;AACNR,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B,OADE;AAKTG,MAAAA,KAAK,EAAE;AACNT,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B,OALE;AASTI,MAAAA,KAAK,EAAE;AACNV,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B;AATE;AADJ;AAD+B,CAAd,CAAzB;;AAmBA,MAAMK,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,KADP;AAECC,IAAAA,QAAQ,EAAE,OAFX;AAGCC,IAAAA,MAAM,EAAEV;AAHT,GADK;AADY,CAAnB;eAUeM,U","sourcesContent":["const tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
@@ -9,7 +9,7 @@ exports.default = TableOfContentsEdit;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
12
+ var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
13
13
 
14
14
  var _blockEditor = require("@wordpress/block-editor");
15
15
 
@@ -190,7 +190,7 @@ function TableOfContentsEdit(_ref) {
190
190
  }
191
191
  }
192
192
 
193
- if ((0, _lodash.isEqual)(headings, _latestHeadings)) {
193
+ if ((0, _es.default)(headings, _latestHeadings)) {
194
194
  return null;
195
195
  }
196
196
 
@@ -234,7 +234,7 @@ function TableOfContentsEdit(_ref) {
234
234
  icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
235
235
  icon: _icon.default
236
236
  }),
237
- label: "Table of Contents",
237
+ label: (0, _i18n.__)('Table of Contents'),
238
238
  instructions: (0, _i18n.__)('Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.')
239
239
  })), inspectorControls);
240
240
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","canInsertList","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value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yC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel=\"Table of Contents\"\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol inert=\"true\">\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","canInsertList","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value","icon"],"mappings":";;;;;;;;;AAyBA;;AAtBA;;AAKA;;AAOA;;AACA;;AAOA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA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AG,MACTO,aAAa,CACZV,QADY,EAEZ,yBAAa,WAAb,EAA0B;AACzB6C,MAAAA,OAAO,EAAE,IADgB;AAEzBC,MAAAA,MAAM,EAAE,6BACP,4BAAC,aAAD;AACC,QAAA,iBAAiB,EAAGH;AADrB,QADO;AAFiB,KAA1B,CAFY;AAFf,KAeG,cAAI,wBAAJ,CAfH,CADD,CADD,CADD;AAwBA,QAAMI,iBAAiB,GACtB,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,2BAAJ,CADT;AAEC,IAAA,OAAO,EAAGhD,sBAFX;AAGC,IAAA,QAAQ,EAAKiD,KAAF,IACV/C,aAAa,CAAE;AAAEF,MAAAA,sBAAsB,EAAEiD;AAA1B,KAAF,CAJf;AAMC,IAAA,IAAI,EACHjD,sBAAsB,GACnB,cACA,2EADA,CADmB,GAInB,cACA,mFADA;AAXL,IADD,CADD,CADD,CAnMG,CA0NH;AACA;AACA;;AACA,MAAKD,QAAQ,CAACsB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,qDACC,mCAAUlB,UAAV,EACC,4BAAC,uBAAD;AACC,MAAA,IAAI,EAAG,4BAAC,sBAAD;AAAW,QAAA,IAAI,EAAG+C;AAAlB,QADR;AAEC,MAAA,KAAK,EAAG,cAAI,mBAAJ,CAFT;AAGC,MAAA,YAAY,EAAG,cACd,4GADc;AAHhB,MADD,CADD,EAUGF,iBAVH,CADD;AAcA;;AAED,SACC,qDACC,mCAAU7C,UAAV,EACC;AAAI,IAAA,KAAK,EAAC;AAAV,KACC,4BAAC,aAAD;AAAqB,IAAA,iBAAiB,EAAGyC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fastDeepEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol inert=\"true\">\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
@@ -70,7 +70,7 @@ function TagCloudEdit(_ref) {
70
70
  value: '',
71
71
  disabled: true
72
72
  };
73
- const taxonomyOptions = (0, _lodash.map)((0, _lodash.filter)(taxonomies, 'show_cloud'), item => {
73
+ const taxonomyOptions = (0, _lodash.map)(taxonomies === null || taxonomies === void 0 ? void 0 : taxonomies.filter(tax => !!tax.show_cloud), item => {
74
74
  return {
75
75
  value: item.slug,
76
76
  label: item.name
@@ -122,6 +122,7 @@ function TagCloudEdit(_ref) {
122
122
  showTagCounts: !showTagCounts
123
123
  })
124
124
  }), (0, _element.createElement)(_components.RangeControl, {
125
+ __nextHasNoMarginBottom: true,
125
126
  label: (0, _i18n.__)('Number of tags'),
126
127
  value: numberOfTags,
127
128
  onChange: value => setAttributes({