@wordpress/block-library 7.16.0 → 7.18.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 (419) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/build/archives/edit.js +1 -0
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/audio/edit.js +44 -4
  5. package/build/audio/edit.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/buttons/edit.native.js +1 -1
  9. package/build/buttons/edit.native.js.map +1 -1
  10. package/build/comment-template/edit.js +40 -32
  11. package/build/comment-template/edit.js.map +1 -1
  12. package/build/comment-template/index.js +6 -2
  13. package/build/comment-template/index.js.map +1 -1
  14. package/build/comments/edit/placeholder.js +1 -4
  15. package/build/comments/edit/placeholder.js.map +1 -1
  16. package/build/comments/index.js +5 -1
  17. package/build/comments/index.js.map +1 -1
  18. package/build/comments-title/edit.js +18 -1
  19. package/build/comments-title/edit.js.map +1 -1
  20. package/build/cover/edit/index.js +2 -2
  21. package/build/cover/edit/index.js.map +1 -1
  22. package/build/cover/edit/inspector-controls.js +3 -7
  23. package/build/cover/edit/inspector-controls.js.map +1 -1
  24. package/build/cover/edit/use-cover-is-dark.js +8 -7
  25. package/build/cover/edit/use-cover-is-dark.js.map +1 -1
  26. package/build/embed/deprecated.js +43 -4
  27. package/build/embed/deprecated.js.map +1 -1
  28. package/build/embed/variations.js +1 -1
  29. package/build/embed/variations.js.map +1 -1
  30. package/build/file/deprecated.js +108 -4
  31. package/build/file/deprecated.js.map +1 -1
  32. package/build/file/transforms.js +3 -9
  33. package/build/file/transforms.js.map +1 -1
  34. package/build/gallery/deprecated.js +148 -23
  35. package/build/gallery/deprecated.js.map +1 -1
  36. package/build/gallery/gallery.js +3 -2
  37. package/build/gallery/gallery.js.map +1 -1
  38. package/build/gallery/transforms.js +3 -3
  39. package/build/gallery/transforms.js.map +1 -1
  40. package/build/gallery/use-image-sizes.js +2 -1
  41. package/build/gallery/use-image-sizes.js.map +1 -1
  42. package/build/gallery/v1/edit.js +3 -2
  43. package/build/gallery/v1/edit.js.map +1 -1
  44. package/build/group/edit.js +7 -3
  45. package/build/group/edit.js.map +1 -1
  46. package/build/image/edit.native.js +1 -1
  47. package/build/image/edit.native.js.map +1 -1
  48. package/build/image/image.js +33 -12
  49. package/build/image/image.js.map +1 -1
  50. package/build/image/transforms.js +1 -7
  51. package/build/image/transforms.js.map +1 -1
  52. package/build/latest-posts/edit.js +1 -1
  53. package/build/latest-posts/edit.js.map +1 -1
  54. package/build/list/transforms.js +9 -1
  55. package/build/list/transforms.js.map +1 -1
  56. package/build/list/utils.js +4 -8
  57. package/build/list/utils.js.map +1 -1
  58. package/build/list-item/edit.js +3 -2
  59. package/build/list-item/edit.js.map +1 -1
  60. package/build/list-item/edit.native.js +3 -2
  61. package/build/list-item/edit.native.js.map +1 -1
  62. package/build/list-item/hooks/use-merge.js +19 -22
  63. package/build/list-item/hooks/use-merge.js.map +1 -1
  64. package/build/list-item/hooks/use-outdent-list-item.js +24 -10
  65. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  66. package/build/list-item/index.js +14 -1
  67. package/build/list-item/index.js.map +1 -1
  68. package/build/list-item/utils.js +14 -1
  69. package/build/list-item/utils.js.map +1 -1
  70. package/build/navigation/edit/index.js +45 -31
  71. package/build/navigation/edit/index.js.map +1 -1
  72. package/build/navigation/edit/inner-blocks.js +3 -5
  73. package/build/navigation/edit/inner-blocks.js.map +1 -1
  74. package/build/navigation/edit/unsaved-inner-blocks.js +3 -1
  75. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  76. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  77. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  78. package/build/navigation/edit/use-create-navigation-menu.js +1 -1
  79. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  80. package/build/navigation/index.js +4 -1
  81. package/build/navigation/index.js.map +1 -1
  82. package/build/navigation-link/edit.js +5 -3
  83. package/build/navigation-link/edit.js.map +1 -1
  84. package/build/navigation-submenu/edit.js +4 -4
  85. package/build/navigation-submenu/edit.js.map +1 -1
  86. package/build/page-list/edit.js +29 -10
  87. package/build/page-list/edit.js.map +1 -1
  88. package/build/page-list/index.js +1 -5
  89. package/build/page-list/index.js.map +1 -1
  90. package/build/paragraph/edit.js +3 -11
  91. package/build/paragraph/edit.js.map +1 -1
  92. package/build/pattern/edit.js +11 -4
  93. package/build/pattern/edit.js.map +1 -1
  94. package/build/post-comments-count/index.js +4 -0
  95. package/build/post-comments-count/index.js.map +1 -1
  96. package/build/post-comments-form/form.js +1 -2
  97. package/build/post-comments-form/form.js.map +1 -1
  98. package/build/post-comments-form/index.js +4 -0
  99. package/build/post-comments-form/index.js.map +1 -1
  100. package/build/post-comments-link/index.js +4 -0
  101. package/build/post-comments-link/index.js.map +1 -1
  102. package/build/post-content/edit.js +14 -6
  103. package/build/post-content/edit.js.map +1 -1
  104. package/build/pullquote/deprecated.js +6 -6
  105. package/build/pullquote/deprecated.js.map +1 -1
  106. package/build/query/edit/inspector-controls/index.js +2 -2
  107. package/build/query/edit/inspector-controls/index.js.map +1 -1
  108. package/build/query/edit/inspector-controls/taxonomy-controls.js +79 -104
  109. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  110. package/build/search/edit.js +3 -4
  111. package/build/search/edit.js.map +1 -1
  112. package/build/site-logo/edit.js +7 -10
  113. package/build/site-logo/edit.js.map +1 -1
  114. package/build/site-tagline/edit.js +21 -9
  115. package/build/site-tagline/edit.js.map +1 -1
  116. package/build/site-title/edit/index.js +20 -8
  117. package/build/site-title/edit/index.js.map +1 -1
  118. package/build/social-link/edit.js +11 -2
  119. package/build/social-link/edit.js.map +1 -1
  120. package/build/social-link/index.js +3 -0
  121. package/build/social-link/index.js.map +1 -1
  122. package/build/spacer/controls.js +3 -7
  123. package/build/spacer/controls.js.map +1 -1
  124. package/build/table/deprecated.js +282 -27
  125. package/build/table/deprecated.js.map +1 -1
  126. package/build/table/state.js +2 -2
  127. package/build/table/state.js.map +1 -1
  128. package/build/table-of-contents/edit.js +1 -4
  129. package/build/table-of-contents/edit.js.map +1 -1
  130. package/build/tag-cloud/edit.js +1 -1
  131. package/build/tag-cloud/edit.js.map +1 -1
  132. package/build/tag-cloud/index.js +8 -0
  133. package/build/tag-cloud/index.js.map +1 -1
  134. package/build/utils/clean-empty-object.js +5 -4
  135. package/build/utils/clean-empty-object.js.map +1 -1
  136. package/build/video/deprecated.js +159 -0
  137. package/build/video/deprecated.js.map +1 -0
  138. package/build/video/edit.js +41 -5
  139. package/build/video/edit.js.map +1 -1
  140. package/build/video/index.js +3 -0
  141. package/build/video/index.js.map +1 -1
  142. package/build/video/tracks-editor.js +3 -28
  143. package/build/video/tracks-editor.js.map +1 -1
  144. package/build-module/archives/edit.js +1 -0
  145. package/build-module/archives/edit.js.map +1 -1
  146. package/build-module/audio/edit.js +46 -7
  147. package/build-module/audio/edit.js.map +1 -1
  148. package/build-module/button/edit.js +1 -1
  149. package/build-module/button/edit.js.map +1 -1
  150. package/build-module/buttons/edit.native.js +1 -1
  151. package/build-module/buttons/edit.native.js.map +1 -1
  152. package/build-module/comment-template/edit.js +38 -30
  153. package/build-module/comment-template/edit.js.map +1 -1
  154. package/build-module/comment-template/index.js +6 -2
  155. package/build-module/comment-template/index.js.map +1 -1
  156. package/build-module/comments/edit/placeholder.js +1 -3
  157. package/build-module/comments/edit/placeholder.js.map +1 -1
  158. package/build-module/comments/index.js +5 -1
  159. package/build-module/comments/index.js.map +1 -1
  160. package/build-module/comments-title/edit.js +18 -2
  161. package/build-module/comments-title/edit.js.map +1 -1
  162. package/build-module/cover/edit/index.js +2 -2
  163. package/build-module/cover/edit/index.js.map +1 -1
  164. package/build-module/cover/edit/inspector-controls.js +4 -8
  165. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  166. package/build-module/cover/edit/use-cover-is-dark.js +7 -7
  167. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
  168. package/build-module/embed/deprecated.js +44 -5
  169. package/build-module/embed/deprecated.js.map +1 -1
  170. package/build-module/embed/variations.js +1 -1
  171. package/build-module/embed/variations.js.map +1 -1
  172. package/build-module/file/deprecated.js +108 -4
  173. package/build-module/file/deprecated.js.map +1 -1
  174. package/build-module/file/transforms.js +3 -8
  175. package/build-module/file/transforms.js.map +1 -1
  176. package/build-module/gallery/deprecated.js +147 -25
  177. package/build-module/gallery/deprecated.js.map +1 -1
  178. package/build-module/gallery/gallery.js +3 -2
  179. package/build-module/gallery/gallery.js.map +1 -1
  180. package/build-module/gallery/transforms.js +4 -4
  181. package/build-module/gallery/transforms.js.map +1 -1
  182. package/build-module/gallery/use-image-sizes.js +3 -2
  183. package/build-module/gallery/use-image-sizes.js.map +1 -1
  184. package/build-module/gallery/v1/edit.js +4 -3
  185. package/build-module/gallery/v1/edit.js.map +1 -1
  186. package/build-module/group/edit.js +7 -3
  187. package/build-module/group/edit.js.map +1 -1
  188. package/build-module/image/edit.native.js +1 -1
  189. package/build-module/image/edit.native.js.map +1 -1
  190. package/build-module/image/image.js +36 -15
  191. package/build-module/image/image.js.map +1 -1
  192. package/build-module/image/transforms.js +1 -6
  193. package/build-module/image/transforms.js.map +1 -1
  194. package/build-module/latest-posts/edit.js +2 -2
  195. package/build-module/latest-posts/edit.js.map +1 -1
  196. package/build-module/list/transforms.js +9 -1
  197. package/build-module/list/transforms.js.map +1 -1
  198. package/build-module/list/utils.js +5 -9
  199. package/build-module/list/utils.js.map +1 -1
  200. package/build-module/list-item/edit.js +3 -2
  201. package/build-module/list-item/edit.js.map +1 -1
  202. package/build-module/list-item/edit.native.js +3 -2
  203. package/build-module/list-item/edit.native.js.map +1 -1
  204. package/build-module/list-item/hooks/use-merge.js +19 -21
  205. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  206. package/build-module/list-item/hooks/use-outdent-list-item.js +24 -9
  207. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  208. package/build-module/list-item/index.js +14 -1
  209. package/build-module/list-item/index.js.map +1 -1
  210. package/build-module/list-item/utils.js +14 -1
  211. package/build-module/list-item/utils.js.map +1 -1
  212. package/build-module/navigation/edit/index.js +45 -31
  213. package/build-module/navigation/edit/index.js.map +1 -1
  214. package/build-module/navigation/edit/inner-blocks.js +3 -5
  215. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  216. package/build-module/navigation/edit/unsaved-inner-blocks.js +3 -1
  217. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  218. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +25 -8
  219. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  220. package/build-module/navigation/edit/use-create-navigation-menu.js +1 -1
  221. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  222. package/build-module/navigation/index.js +4 -1
  223. package/build-module/navigation/index.js.map +1 -1
  224. package/build-module/navigation-link/edit.js +5 -4
  225. package/build-module/navigation-link/edit.js.map +1 -1
  226. package/build-module/navigation-submenu/edit.js +4 -4
  227. package/build-module/navigation-submenu/edit.js.map +1 -1
  228. package/build-module/page-list/edit.js +29 -10
  229. package/build-module/page-list/edit.js.map +1 -1
  230. package/build-module/page-list/index.js +1 -5
  231. package/build-module/page-list/index.js.map +1 -1
  232. package/build-module/paragraph/edit.js +3 -10
  233. package/build-module/paragraph/edit.js.map +1 -1
  234. package/build-module/pattern/edit.js +10 -3
  235. package/build-module/pattern/edit.js.map +1 -1
  236. package/build-module/post-comments-count/index.js +4 -0
  237. package/build-module/post-comments-count/index.js.map +1 -1
  238. package/build-module/post-comments-form/form.js +2 -3
  239. package/build-module/post-comments-form/form.js.map +1 -1
  240. package/build-module/post-comments-form/index.js +4 -0
  241. package/build-module/post-comments-form/index.js.map +1 -1
  242. package/build-module/post-comments-link/index.js +4 -0
  243. package/build-module/post-comments-link/index.js.map +1 -1
  244. package/build-module/post-content/edit.js +14 -6
  245. package/build-module/post-content/edit.js.map +1 -1
  246. package/build-module/pullquote/deprecated.js +7 -7
  247. package/build-module/pullquote/deprecated.js.map +1 -1
  248. package/build-module/query/edit/inspector-controls/index.js +4 -4
  249. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  250. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +81 -102
  251. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  252. package/build-module/search/edit.js +4 -5
  253. package/build-module/search/edit.js.map +1 -1
  254. package/build-module/site-logo/edit.js +8 -11
  255. package/build-module/site-logo/edit.js.map +1 -1
  256. package/build-module/site-tagline/edit.js +23 -11
  257. package/build-module/site-tagline/edit.js.map +1 -1
  258. package/build-module/site-title/edit/index.js +22 -10
  259. package/build-module/site-title/edit/index.js.map +1 -1
  260. package/build-module/social-link/edit.js +11 -2
  261. package/build-module/social-link/edit.js.map +1 -1
  262. package/build-module/social-link/index.js +3 -0
  263. package/build-module/social-link/index.js.map +1 -1
  264. package/build-module/spacer/controls.js +4 -8
  265. package/build-module/spacer/controls.js.map +1 -1
  266. package/build-module/table/deprecated.js +282 -27
  267. package/build-module/table/deprecated.js.map +1 -1
  268. package/build-module/table/state.js +3 -3
  269. package/build-module/table/state.js.map +1 -1
  270. package/build-module/table-of-contents/edit.js +1 -3
  271. package/build-module/table-of-contents/edit.js.map +1 -1
  272. package/build-module/tag-cloud/edit.js +1 -1
  273. package/build-module/tag-cloud/edit.js.map +1 -1
  274. package/build-module/tag-cloud/index.js +8 -0
  275. package/build-module/tag-cloud/index.js.map +1 -1
  276. package/build-module/utils/clean-empty-object.js +5 -5
  277. package/build-module/utils/clean-empty-object.js.map +1 -1
  278. package/build-module/video/deprecated.js +147 -0
  279. package/build-module/video/deprecated.js.map +1 -0
  280. package/build-module/video/edit.js +45 -9
  281. package/build-module/video/edit.js.map +1 -1
  282. package/build-module/video/index.js +2 -0
  283. package/build-module/video/index.js.map +1 -1
  284. package/build-module/video/tracks-editor.js +4 -29
  285. package/build-module/video/tracks-editor.js.map +1 -1
  286. package/build-style/archives/style-rtl.css +4 -0
  287. package/build-style/archives/style.css +4 -0
  288. package/build-style/button/style-rtl.css +1 -0
  289. package/build-style/button/style.css +1 -0
  290. package/build-style/comment-template/style-rtl.css +1 -0
  291. package/build-style/comment-template/style.css +1 -0
  292. package/build-style/comments/editor-rtl.css +1 -0
  293. package/build-style/comments/editor.css +1 -0
  294. package/build-style/comments/style-rtl.css +1 -0
  295. package/build-style/comments/style.css +1 -0
  296. package/build-style/cover/editor-rtl.css +4 -0
  297. package/build-style/cover/editor.css +4 -0
  298. package/build-style/editor-rtl.css +13 -21
  299. package/build-style/editor.css +13 -21
  300. package/build-style/group/editor-rtl.css +1 -0
  301. package/build-style/group/editor.css +1 -0
  302. package/build-style/image/editor-rtl.css +1 -1
  303. package/build-style/image/editor.css +1 -1
  304. package/build-style/navigation/editor-rtl.css +5 -4
  305. package/build-style/navigation/editor.css +5 -4
  306. package/build-style/navigation/style-rtl.css +3 -1
  307. package/build-style/navigation/style.css +3 -1
  308. package/build-style/paragraph/editor-rtl.css +0 -16
  309. package/build-style/paragraph/editor.css +0 -16
  310. package/build-style/post-comments-form/style-rtl.css +3 -0
  311. package/build-style/post-comments-form/style.css +3 -0
  312. package/build-style/site-logo/editor-rtl.css +1 -0
  313. package/build-style/site-logo/editor.css +1 -0
  314. package/build-style/style-rtl.css +16 -1
  315. package/build-style/style.css +16 -1
  316. package/build-style/tag-cloud/style-rtl.css +3 -0
  317. package/build-style/tag-cloud/style.css +3 -0
  318. package/package.json +29 -28
  319. package/src/archives/edit.js +1 -0
  320. package/src/archives/style.scss +5 -0
  321. package/src/audio/edit.js +79 -24
  322. package/src/avatar/index.php +1 -1
  323. package/src/button/edit.js +1 -1
  324. package/src/button/style.scss +2 -0
  325. package/src/buttons/edit.native.js +1 -1
  326. package/src/code/test/__snapshots__/edit.native.js.snap +13 -0
  327. package/src/code/test/edit.native.js +46 -32
  328. package/src/comment-template/block.json +6 -2
  329. package/src/comment-template/edit.js +47 -34
  330. package/src/comment-template/style.scss +2 -0
  331. package/src/comments/block.json +5 -1
  332. package/src/comments/edit/placeholder.js +1 -7
  333. package/src/comments/style.scss +2 -0
  334. package/src/comments-title/edit.js +24 -1
  335. package/src/cover/edit/index.js +2 -7
  336. package/src/cover/edit/inspector-controls.js +11 -13
  337. package/src/cover/edit/use-cover-is-dark.js +11 -11
  338. package/src/cover/editor.scss +7 -0
  339. package/src/embed/deprecated.js +53 -26
  340. package/src/embed/variations.js +1 -1
  341. package/src/file/deprecated.js +130 -2
  342. package/src/file/transforms.js +3 -8
  343. package/src/gallery/deprecated.js +129 -4
  344. package/src/gallery/gallery.js +2 -0
  345. package/src/gallery/index.php +19 -10
  346. package/src/gallery/transforms.js +8 -5
  347. package/src/gallery/use-image-sizes.js +3 -2
  348. package/src/gallery/v1/edit.js +4 -3
  349. package/src/group/edit.js +10 -2
  350. package/src/group/editor.scss +1 -0
  351. package/src/image/edit.native.js +1 -1
  352. package/src/image/editor.scss +4 -1
  353. package/src/image/image.js +75 -33
  354. package/src/image/transforms.js +1 -7
  355. package/src/latest-posts/edit.js +2 -2
  356. package/src/list/test/edit.native.js +102 -3
  357. package/src/list/transforms.js +11 -0
  358. package/src/list/utils.js +3 -11
  359. package/src/list-item/block.json +14 -1
  360. package/src/list-item/edit.js +2 -1
  361. package/src/list-item/edit.native.js +2 -1
  362. package/src/list-item/hooks/use-merge.js +4 -23
  363. package/src/list-item/hooks/use-outdent-list-item.js +9 -8
  364. package/src/navigation/block.json +4 -1
  365. package/src/navigation/edit/index.js +61 -37
  366. package/src/navigation/edit/inner-blocks.js +2 -5
  367. package/src/navigation/edit/unsaved-inner-blocks.js +9 -2
  368. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +32 -5
  369. package/src/navigation/edit/use-create-navigation-menu.js +2 -5
  370. package/src/navigation/editor.scss +5 -4
  371. package/src/navigation/index.php +103 -6
  372. package/src/navigation/style.scss +3 -1
  373. package/src/navigation-link/edit.js +6 -5
  374. package/src/navigation-link/index.php +8 -1
  375. package/src/navigation-submenu/edit.js +7 -5
  376. package/src/navigation-submenu/index.php +8 -1
  377. package/src/page-list/block.json +1 -5
  378. package/src/page-list/edit.js +36 -22
  379. package/src/page-list/index.php +8 -6
  380. package/src/paragraph/edit.js +1 -14
  381. package/src/paragraph/editor.scss +0 -20
  382. package/src/pattern/edit.js +10 -3
  383. package/src/post-comments-count/block.json +4 -0
  384. package/src/post-comments-form/block.json +4 -0
  385. package/src/post-comments-form/form.js +2 -3
  386. package/src/post-comments-form/style.scss +3 -0
  387. package/src/post-comments-link/block.json +4 -0
  388. package/src/post-content/edit.js +8 -4
  389. package/src/pullquote/deprecated.js +7 -7
  390. package/src/query/edit/inspector-controls/index.js +4 -3
  391. package/src/query/edit/inspector-controls/taxonomy-controls.js +82 -87
  392. package/src/rss/index.php +3 -3
  393. package/src/search/edit.js +7 -2
  394. package/src/search/index.php +21 -13
  395. package/src/site-logo/edit.js +12 -10
  396. package/src/site-logo/editor.scss +1 -0
  397. package/src/site-tagline/edit.js +25 -18
  398. package/src/site-title/edit/index.js +26 -12
  399. package/src/social-link/block.json +3 -0
  400. package/src/social-link/edit.js +8 -1
  401. package/src/social-link/index.php +11 -7
  402. package/src/spacer/controls.js +10 -12
  403. package/src/table/deprecated.js +587 -348
  404. package/src/table/state.js +3 -3
  405. package/src/table-of-contents/edit.js +1 -3
  406. package/src/tag-cloud/block.json +8 -0
  407. package/src/tag-cloud/edit.js +1 -1
  408. package/src/tag-cloud/style.scss +3 -0
  409. package/src/template-part/index.php +4 -0
  410. package/src/utils/clean-empty-object.js +5 -6
  411. package/src/video/deprecated.js +57 -0
  412. package/src/video/edit.js +71 -23
  413. package/src/video/index.js +2 -0
  414. package/src/video/tracks-editor.js +12 -28
  415. package/build/paragraph/drop-zone.js +0 -99
  416. package/build/paragraph/drop-zone.js.map +0 -1
  417. package/build-module/paragraph/drop-zone.js +0 -88
  418. package/build-module/paragraph/drop-zone.js.map +0 -1
  419. package/src/paragraph/drop-zone.js +0 -105
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, filter, isEmpty, map, pick, includes } from 'lodash';
4
+ import { get, filter, isEmpty, map, pick } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -32,7 +32,13 @@ import {
32
32
  __experimentalGetElementClassName,
33
33
  __experimentalUseBorderProps as useBorderProps,
34
34
  } from '@wordpress/block-editor';
35
- import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
35
+ import {
36
+ useEffect,
37
+ useMemo,
38
+ useState,
39
+ useRef,
40
+ useCallback,
41
+ } from '@wordpress/element';
36
42
  import { __, sprintf, isRTL } from '@wordpress/i18n';
37
43
  import { getFilename } from '@wordpress/url';
38
44
  import {
@@ -40,7 +46,12 @@ import {
40
46
  getDefaultBlockName,
41
47
  switchToBlockType,
42
48
  } from '@wordpress/blocks';
43
- import { crop, overlayText, upload } from '@wordpress/icons';
49
+ import {
50
+ crop,
51
+ overlayText,
52
+ upload,
53
+ caption as captionIcon,
54
+ } from '@wordpress/icons';
44
55
  import { store as noticesStore } from '@wordpress/notices';
45
56
  import { store as coreStore } from '@wordpress/core-data';
46
57
 
@@ -88,8 +99,8 @@ export default function Image( {
88
99
  sizeSlug,
89
100
  } = attributes;
90
101
  const imageRef = useRef();
91
- const captionRef = useRef();
92
- const prevUrl = usePrevious( url );
102
+ const prevCaption = usePrevious( caption );
103
+ const [ showCaption, setShowCaption ] = useState( !! caption );
93
104
  const { allowResize = true } = context;
94
105
  const { getBlock } = useSelect( blockEditorStore );
95
106
 
@@ -145,7 +156,7 @@ export default function Image( {
145
156
  const { createErrorNotice, createSuccessNotice } =
146
157
  useDispatch( noticesStore );
147
158
  const isLargeViewport = useViewportMatch( 'medium' );
148
- const isWideAligned = includes( [ 'wide', 'full' ], align );
159
+ const isWideAligned = [ 'wide', 'full' ].includes( align );
149
160
  const [
150
161
  { loadedNaturalWidth, loadedNaturalHeight },
151
162
  setLoadedNaturalSize,
@@ -180,15 +191,23 @@ export default function Image( {
180
191
  .catch( () => {} );
181
192
  }, [ id, url, isSelected, externalBlob ] );
182
193
 
183
- // Focus the caption after inserting an image from the placeholder. This is
184
- // done to preserve the behaviour of focussing the first tabbable element
185
- // when a block is mounted. Previously, the image block would remount when
186
- // the placeholder is removed. Maybe this behaviour could be removed.
194
+ // We need to show the caption when changes come from
195
+ // history navigation(undo/redo).
187
196
  useEffect( () => {
188
- if ( url && ! prevUrl && isSelected ) {
189
- captionRef.current.focus();
197
+ if ( caption && ! prevCaption ) {
198
+ setShowCaption( true );
190
199
  }
191
- }, [ url, prevUrl ] );
200
+ }, [ caption, prevCaption ] );
201
+
202
+ // Focus the caption when we click to add one.
203
+ const captionRef = useCallback(
204
+ ( node ) => {
205
+ if ( node && ! caption ) {
206
+ node.focus();
207
+ }
208
+ },
209
+ [ caption ]
210
+ );
192
211
 
193
212
  // Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural
194
213
  // width and height. This resolves an issue in Safari where the loaded natural
@@ -297,8 +316,11 @@ export default function Image( {
297
316
  useEffect( () => {
298
317
  if ( ! isSelected ) {
299
318
  setIsEditingImage( false );
319
+ if ( ! caption ) {
320
+ setShowCaption( false );
321
+ }
300
322
  }
301
- }, [ isSelected ] );
323
+ }, [ isSelected, caption ] );
302
324
 
303
325
  const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
304
326
  const allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;
@@ -319,6 +341,23 @@ export default function Image( {
319
341
  onChange={ updateAlignment }
320
342
  />
321
343
  ) }
344
+ { ! isContentLocked && (
345
+ <ToolbarButton
346
+ onClick={ () => {
347
+ setShowCaption( ! showCaption );
348
+ if ( showCaption && caption ) {
349
+ setAttributes( { caption: undefined } );
350
+ }
351
+ } }
352
+ icon={ captionIcon }
353
+ isPressed={ showCaption }
354
+ label={
355
+ showCaption
356
+ ? __( 'Remove caption' )
357
+ : __( 'Add caption' )
358
+ }
359
+ />
360
+ ) }
322
361
  { ! multiImageSelection && ! isEditingImage && (
323
362
  <ImageURLInputUI
324
363
  url={ href || '' }
@@ -591,25 +630,28 @@ export default function Image( {
591
630
  which causes duplicated image upload. */ }
592
631
  { ! temporaryURL && controls }
593
632
  { img }
594
- { ( ! RichText.isEmpty( caption ) || isSelected ) && (
595
- <RichText
596
- className={ __experimentalGetElementClassName( 'caption' ) }
597
- ref={ captionRef }
598
- tagName="figcaption"
599
- aria-label={ __( 'Image caption text' ) }
600
- placeholder={ __( 'Add caption' ) }
601
- value={ caption }
602
- onChange={ ( value ) =>
603
- setAttributes( { caption: value } )
604
- }
605
- inlineToolbar
606
- __unstableOnSplitAtEnd={ () =>
607
- insertBlocksAfter(
608
- createBlock( getDefaultBlockName() )
609
- )
610
- }
611
- />
612
- ) }
633
+ { showCaption &&
634
+ ( ! RichText.isEmpty( caption ) || isSelected ) && (
635
+ <RichText
636
+ className={ __experimentalGetElementClassName(
637
+ 'caption'
638
+ ) }
639
+ ref={ captionRef }
640
+ tagName="figcaption"
641
+ aria-label={ __( 'Image caption text' ) }
642
+ placeholder={ __( 'Add caption' ) }
643
+ value={ caption }
644
+ onChange={ ( value ) =>
645
+ setAttributes( { caption: value } )
646
+ }
647
+ inlineToolbar
648
+ __unstableOnSplitAtEnd={ () =>
649
+ insertBlocksAfter(
650
+ createBlock( getDefaultBlockName() )
651
+ )
652
+ }
653
+ />
654
+ ) }
613
655
  </ImageEditingProvider>
614
656
  );
615
657
  }
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { every } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -157,8 +152,7 @@ const transforms = {
157
152
  }
158
153
  );
159
154
  }
160
- return every(
161
- files,
155
+ return files.every(
162
156
  ( file ) => file.type.indexOf( 'image/' ) === 0
163
157
  );
164
158
  },
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, includes, pickBy } from 'lodash';
4
+ import { get, pickBy } from 'lodash';
5
5
  import classnames from 'classnames';
6
6
 
7
7
  /**
@@ -196,7 +196,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
196
196
  } );
197
197
  // We do nothing if the category is not selected
198
198
  // from suggestions.
199
- if ( includes( allCategories, null ) ) {
199
+ if ( allCategories.includes( null ) ) {
200
200
  return false;
201
201
  }
202
202
  setAttributes( { categories: allCategories } );
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import {
5
5
  changeTextOfRichText,
6
+ changeAndSelectTextOfRichText,
6
7
  fireEvent,
7
8
  getEditorHtml,
8
9
  initializeEditor,
@@ -18,6 +19,7 @@ import {
18
19
  */
19
20
  import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
20
21
  import { registerCoreBlocks } from '@wordpress/block-library';
22
+ import { BACKSPACE } from '@wordpress/keycodes';
21
23
 
22
24
  describe( 'List block', () => {
23
25
  beforeAll( () => {
@@ -210,7 +212,7 @@ describe( 'List block', () => {
210
212
  <!-- /wp:list-item -->
211
213
  <!-- wp:list-item -->
212
214
  <li>Item 2</li>
213
- <!-- /wp:list-item -->
215
+ <!-- /wp:list-item -->
214
216
  <!-- wp:list-item -->
215
217
  <li>Item 3</li>
216
218
  <!-- /wp:list-item --></ul>
@@ -238,7 +240,7 @@ describe( 'List block', () => {
238
240
  <!-- /wp:list-item -->
239
241
  <!-- wp:list-item -->
240
242
  <li>Item 2</li>
241
- <!-- /wp:list-item -->
243
+ <!-- /wp:list-item -->
242
244
  <!-- wp:list-item -->
243
245
  <li>Item 3</li>
244
246
  <!-- /wp:list-item --></ul>
@@ -277,7 +279,7 @@ describe( 'List block', () => {
277
279
  <!-- /wp:list-item -->
278
280
  <!-- wp:list-item -->
279
281
  <li>Item 2</li>
280
- <!-- /wp:list-item -->
282
+ <!-- /wp:list-item -->
281
283
  <!-- wp:list-item -->
282
284
  <li>Item 3</li>
283
285
  <!-- /wp:list-item --></ul>
@@ -311,4 +313,101 @@ describe( 'List block', () => {
311
313
 
312
314
  expect( getEditorHtml() ).toMatchSnapshot();
313
315
  } );
316
+
317
+ it( 'merges with other lists', async () => {
318
+ const initialHtml = `<!-- wp:list -->
319
+ <ul><!-- wp:list-item -->
320
+ <li>One</li><!-- /wp:list-item --></ul>
321
+ <!-- /wp:list --><!-- wp:list -->
322
+ <ul><!-- wp:list-item -->
323
+ <li>Two</li><!-- /wp:list-item --></ul>
324
+ <!-- /wp:list -->`;
325
+
326
+ const screen = await initializeEditor( {
327
+ initialHtml,
328
+ } );
329
+
330
+ // Select List block
331
+ const listBlock = screen.getByA11yLabel( /List Block\. Row 2/ );
332
+ fireEvent.press( listBlock );
333
+
334
+ // Select List Item block
335
+ const listItemBlock = within( listBlock ).getByA11yLabel(
336
+ /List item Block\. Row 1/
337
+ );
338
+ fireEvent.press( listItemBlock );
339
+
340
+ // With cursor positioned at the beginning of the first List Item, press
341
+ // backward delete
342
+ const listItemField =
343
+ within( listItemBlock ).getByA11yLabel( /Text input. .*Two.*/ );
344
+ changeAndSelectTextOfRichText( listItemField, 'Two' );
345
+ fireEvent( listItemField, 'onKeyDown', {
346
+ nativeEvent: {},
347
+ preventDefault() {},
348
+ keyCode: BACKSPACE,
349
+ } );
350
+
351
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
352
+ "<!-- wp:list -->
353
+ <ul><!-- wp:list-item -->
354
+ <li>One</li>
355
+ <!-- /wp:list-item -->
356
+
357
+ <!-- wp:list-item -->
358
+ <li>Two</li>
359
+ <!-- /wp:list-item --></ul>
360
+ <!-- /wp:list -->"
361
+ ` );
362
+ } );
363
+
364
+ it( 'unwraps list items when attempting to merge with non-list block', async () => {
365
+ const initialHtml = `<!-- wp:paragraph -->
366
+ <p>A quick brown fox.</p>
367
+ <!-- /wp:paragraph -->
368
+ <!-- wp:list -->
369
+ <ul><!-- wp:list-item -->
370
+ <li>One</li><!-- /wp:list-item --><!-- wp:list-item -->
371
+ <li>Two</li><!-- /wp:list-item --></ul>
372
+ <!-- /wp:list -->`;
373
+
374
+ const screen = await initializeEditor( {
375
+ initialHtml,
376
+ } );
377
+
378
+ // Select List block
379
+ const listBlock = screen.getByA11yLabel( /List Block\. Row 2/ );
380
+ fireEvent.press( listBlock );
381
+
382
+ // Select List Item block
383
+ const listItemBlock = within( listBlock ).getByA11yLabel(
384
+ /List item Block\. Row 1/
385
+ );
386
+ fireEvent.press( listItemBlock );
387
+
388
+ // With cursor positioned at the beginning of the first List Item, press
389
+ // backward delete
390
+ const listItemField =
391
+ within( listItemBlock ).getByA11yLabel( /Text input. .*One.*/ );
392
+ changeAndSelectTextOfRichText( listItemField, 'One' );
393
+ fireEvent( listItemField, 'onKeyDown', {
394
+ nativeEvent: {},
395
+ preventDefault() {},
396
+ keyCode: BACKSPACE,
397
+ } );
398
+
399
+ expect( getEditorHtml() ).toMatchInlineSnapshot( `
400
+ "<!-- wp:paragraph -->
401
+ <p>A quick brown fox.</p>
402
+ <!-- /wp:paragraph -->
403
+
404
+ <!-- wp:paragraph -->
405
+ <p>One</p>
406
+ <!-- /wp:paragraph -->
407
+
408
+ <!-- wp:paragraph -->
409
+ <p>Two</p>
410
+ <!-- /wp:paragraph -->"
411
+ ` );
412
+ } );
314
413
  } );
@@ -114,6 +114,17 @@ const transforms = {
114
114
  );
115
115
  },
116
116
  } ) ),
117
+ {
118
+ type: 'block',
119
+ blocks: [ '*' ],
120
+ transform: ( _attributes, childBlocks ) => {
121
+ return getListContentFlat( childBlocks ).map( ( content ) =>
122
+ createBlock( 'core/paragraph', {
123
+ content,
124
+ } )
125
+ );
126
+ },
127
+ },
117
128
  ],
118
129
  };
119
130
 
package/src/list/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { createBlock } from '@wordpress/blocks';
4
+ import { createBlock, rawHandler } from '@wordpress/blocks';
5
5
 
6
6
  export function createListBlockFromDOMElement( listElement ) {
7
7
  const listAttributes = {
@@ -70,15 +70,7 @@ export function migrateToListV2( attributes ) {
70
70
  list.setAttribute( 'type', type );
71
71
  }
72
72
 
73
- const listBlock = createListBlockFromDOMElement( list );
73
+ const [ listBlock ] = rawHandler( { HTML: list.outerHTML } );
74
74
 
75
- const { values: omittedValues, ...restAttributes } = attributes;
76
-
77
- return [
78
- {
79
- ...restAttributes,
80
- ...listBlock.attributes,
81
- },
82
- listBlock.innerBlocks,
83
- ];
75
+ return [ listBlock.attributes, listBlock.innerBlocks ];
84
76
  }
@@ -21,6 +21,19 @@
21
21
  },
22
22
  "supports": {
23
23
  "className": false,
24
- "__experimentalSelector": "li"
24
+ "__experimentalSelector": "li",
25
+ "typography": {
26
+ "fontSize": true,
27
+ "lineHeight": true,
28
+ "__experimentalFontFamily": true,
29
+ "__experimentalFontWeight": true,
30
+ "__experimentalFontStyle": true,
31
+ "__experimentalTextTransform": true,
32
+ "__experimentalTextDecoration": true,
33
+ "__experimentalLetterSpacing": true,
34
+ "__experimentalDefaultControls": {
35
+ "fontSize": true
36
+ }
37
+ }
25
38
  }
26
39
  }
@@ -60,6 +60,7 @@ export default function ListItemEdit( {
60
60
  setAttributes,
61
61
  onReplace,
62
62
  clientId,
63
+ mergeBlocks,
63
64
  } ) {
64
65
  const { placeholder, content } = attributes;
65
66
  const blockProps = useBlockProps( { ref: useCopy( clientId ) } );
@@ -70,7 +71,7 @@ export default function ListItemEdit( {
70
71
  const useEnterRef = useEnter( { content, clientId } );
71
72
  const useSpaceRef = useSpace( clientId );
72
73
  const onSplit = useSplit( clientId );
73
- const onMerge = useMerge( clientId );
74
+ const onMerge = useMerge( clientId, mergeBlocks );
74
75
  return (
75
76
  <>
76
77
  <li { ...innerBlocksProps }>
@@ -35,6 +35,7 @@ export default function ListItemEdit( {
35
35
  onReplace,
36
36
  clientId,
37
37
  style,
38
+ mergeBlocks,
38
39
  } ) {
39
40
  const [ contentWidth, setContentWidth ] = useState();
40
41
  const { placeholder, content } = attributes;
@@ -119,7 +120,7 @@ export default function ListItemEdit( {
119
120
  const preventDefault = useRef( false );
120
121
  const { onEnter } = useEnter( { content, clientId }, preventDefault );
121
122
  const onSplit = useSplit( clientId );
122
- const onMerge = useMerge( clientId );
123
+ const onMerge = useMerge( clientId, mergeBlocks );
123
124
  const onSplitList = useCallback(
124
125
  ( value ) => {
125
126
  if ( ! preventDefault.current ) {
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { useRegistry, useDispatch, useSelect } from '@wordpress/data';
5
5
  import { store as blockEditorStore } from '@wordpress/block-editor';
6
- import { getDefaultBlockName, switchToBlockType } from '@wordpress/blocks';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
@@ -12,7 +11,7 @@ import useOutdentListItem from './use-outdent-list-item';
12
11
 
13
12
  import { name as listItemName } from '../block.json';
14
13
 
15
- export default function useMerge( clientId ) {
14
+ export default function useMerge( clientId, onMerge ) {
16
15
  const registry = useRegistry();
17
16
  const {
18
17
  getPreviousBlockClientId,
@@ -20,9 +19,8 @@ export default function useMerge( clientId ) {
20
19
  getBlockOrder,
21
20
  getBlockRootClientId,
22
21
  getBlockName,
23
- getBlock,
24
22
  } = useSelect( blockEditorStore );
25
- const { mergeBlocks, moveBlocksToPosition, replaceBlock, selectBlock } =
23
+ const { mergeBlocks, moveBlocksToPosition } =
26
24
  useDispatch( blockEditorStore );
27
25
  const [ , outdentListItem ] = useOutdentListItem( clientId );
28
26
 
@@ -79,29 +77,12 @@ export default function useMerge( clientId ) {
79
77
  return getBlockOrder( order[ 0 ] )[ 0 ];
80
78
  }
81
79
 
82
- function switchToDefaultBlockType( forward ) {
83
- const rootClientId = getBlockRootClientId( clientId );
84
- const replacement = switchToBlockType(
85
- getBlock( rootClientId ),
86
- getDefaultBlockName()
87
- );
88
- const indexToSelect = forward ? replacement.length - 1 : 0;
89
- const initialPosition = forward ? -1 : 0;
90
- registry.batch( () => {
91
- replaceBlock( rootClientId, replacement );
92
- selectBlock(
93
- replacement[ indexToSelect ].clientId,
94
- initialPosition
95
- );
96
- } );
97
- }
98
-
99
80
  return ( forward ) => {
100
81
  if ( forward ) {
101
82
  const nextBlockClientId = getNextId( clientId );
102
83
 
103
84
  if ( ! nextBlockClientId ) {
104
- switchToDefaultBlockType( forward );
85
+ onMerge( forward );
105
86
  return;
106
87
  }
107
88
 
@@ -134,7 +115,7 @@ export default function useMerge( clientId ) {
134
115
  mergeBlocks( trailingId, clientId );
135
116
  } );
136
117
  } else {
137
- switchToDefaultBlockType( forward );
118
+ onMerge( forward );
138
119
  }
139
120
  }
140
121
  };
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { castArray } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -20,12 +15,16 @@ export default function useOutdentListItem( clientId ) {
20
15
  const registry = useRegistry();
21
16
  const { canOutdent } = useSelect(
22
17
  ( innerSelect ) => {
23
- const { getBlockRootClientId } = innerSelect( blockEditorStore );
18
+ const { getBlockRootClientId, getBlockName } =
19
+ innerSelect( blockEditorStore );
24
20
  const grandParentId = getBlockRootClientId(
25
21
  getBlockRootClientId( clientId )
26
22
  );
23
+ const grandParentName = getBlockName( grandParentId );
24
+ const isListItem = grandParentName === listItemName;
25
+
27
26
  return {
28
- canOutdent: !! grandParentId,
27
+ canOutdent: isListItem,
29
28
  };
30
29
  },
31
30
  [ clientId ]
@@ -57,7 +56,9 @@ export default function useOutdentListItem( clientId ) {
57
56
  return [
58
57
  canOutdent,
59
58
  useCallback( ( clientIds = getSelectedBlockClientIds() ) => {
60
- clientIds = castArray( clientIds );
59
+ if ( ! Array.isArray( clientIds ) ) {
60
+ clientIds = [ clientIds ];
61
+ }
61
62
 
62
63
  if ( ! clientIds.length ) return;
63
64
 
@@ -67,6 +67,10 @@
67
67
  "maxNestingLevel": {
68
68
  "type": "number",
69
69
  "default": 5
70
+ },
71
+ "templateLock": {
72
+ "type": [ "string", "boolean" ],
73
+ "enum": [ "all", "insert", "contentOnly", false ]
70
74
  }
71
75
  },
72
76
  "providesContext": {
@@ -88,7 +92,6 @@
88
92
  },
89
93
  "supports": {
90
94
  "align": [ "wide", "full" ],
91
- "anchor": true,
92
95
  "html": false,
93
96
  "inserter": true,
94
97
  "typography": {