@wordpress/block-library 6.0.1 → 6.0.5

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 (1093) hide show
  1. package/build/block/edit.js +1 -1
  2. package/build/block/edit.js.map +1 -1
  3. package/build/button/deprecated.js +155 -10
  4. package/build/button/deprecated.js.map +1 -1
  5. package/build/button/edit.native.js +257 -330
  6. package/build/button/edit.native.js.map +1 -1
  7. package/build/button/index.js +4 -1
  8. package/build/button/index.js.map +1 -1
  9. package/build/buttons/deprecated.js +84 -2
  10. package/build/buttons/deprecated.js.map +1 -1
  11. package/build/buttons/edit.js +6 -42
  12. package/build/buttons/edit.js.map +1 -1
  13. package/build/buttons/index.js +16 -14
  14. package/build/buttons/index.js.map +1 -1
  15. package/build/buttons/save.js +4 -20
  16. package/build/buttons/save.js.map +1 -1
  17. package/build/buttons/transforms.js +15 -10
  18. package/build/buttons/transforms.js.map +1 -1
  19. package/build/categories/edit.js +16 -6
  20. package/build/categories/edit.js.map +1 -1
  21. package/build/categories/index.js +4 -0
  22. package/build/categories/index.js.map +1 -1
  23. package/build/code/edit.native.js +8 -5
  24. package/build/code/edit.native.js.map +1 -1
  25. package/build/code/index.js +24 -1
  26. package/build/code/index.js.map +1 -1
  27. package/build/column/edit.js +4 -2
  28. package/build/column/edit.js.map +1 -1
  29. package/build/column/index.js +4 -0
  30. package/build/column/index.js.map +1 -1
  31. package/build/column/save.js +7 -3
  32. package/build/column/save.js.map +1 -1
  33. package/build/columns/edit.js +1 -1
  34. package/build/columns/edit.js.map +1 -1
  35. package/build/columns/index.js +1 -0
  36. package/build/columns/index.js.map +1 -1
  37. package/build/columns/save.js +7 -2
  38. package/build/columns/save.js.map +1 -1
  39. package/build/comment-author-avatar/edit.js +83 -0
  40. package/build/comment-author-avatar/edit.js.map +1 -0
  41. package/build/{post-comment-date → comment-author-avatar}/index.js +25 -9
  42. package/build/comment-author-avatar/index.js.map +1 -0
  43. package/build/comment-author-name/deprecated.js +69 -0
  44. package/build/comment-author-name/deprecated.js.map +1 -0
  45. package/build/comment-author-name/edit.js +112 -0
  46. package/build/comment-author-name/edit.js.map +1 -0
  47. package/build/comment-author-name/index.js +77 -0
  48. package/build/comment-author-name/index.js.map +1 -0
  49. package/build/comment-content/edit.js +74 -0
  50. package/build/comment-content/edit.js.map +1 -0
  51. package/build/comment-content/index.js +68 -0
  52. package/build/comment-content/index.js.map +1 -0
  53. package/build/comment-date/deprecated.js +68 -0
  54. package/build/comment-date/deprecated.js.map +1 -0
  55. package/build/comment-date/edit.js +95 -0
  56. package/build/comment-date/edit.js.map +1 -0
  57. package/build/comment-date/index.js +72 -0
  58. package/build/comment-date/index.js.map +1 -0
  59. package/build/comment-edit-link/edit.js +61 -0
  60. package/build/comment-edit-link/edit.js.map +1 -0
  61. package/build/comment-edit-link/index.js +67 -0
  62. package/build/comment-edit-link/index.js.map +1 -0
  63. package/build/comment-reply-link/edit.js +63 -0
  64. package/build/comment-reply-link/edit.js.map +1 -0
  65. package/build/comment-reply-link/index.js +63 -0
  66. package/build/comment-reply-link/index.js.map +1 -0
  67. package/build/comment-template/edit.js +82 -0
  68. package/build/comment-template/edit.js.map +1 -0
  69. package/build/{post-comment-content → comment-template}/index.js +13 -8
  70. package/build/comment-template/index.js.map +1 -0
  71. package/build/comment-template/save.js +18 -0
  72. package/build/comment-template/save.js.map +1 -0
  73. package/build/comments-query-loop/edit.js +64 -0
  74. package/build/comments-query-loop/edit.js.map +1 -0
  75. package/build/comments-query-loop/index.js +67 -0
  76. package/build/comments-query-loop/index.js.map +1 -0
  77. package/build/comments-query-loop/save.js +22 -0
  78. package/build/comments-query-loop/save.js.map +1 -0
  79. package/build/comments-query-loop/toolbar.js +54 -0
  80. package/build/comments-query-loop/toolbar.js.map +1 -0
  81. package/build/cover/deprecated.js +180 -20
  82. package/build/cover/deprecated.js.map +1 -1
  83. package/build/cover/edit.js +62 -28
  84. package/build/cover/edit.js.map +1 -1
  85. package/build/cover/edit.native.js +6 -2
  86. package/build/cover/edit.native.js.map +1 -1
  87. package/build/cover/index.js +12 -1
  88. package/build/cover/index.js.map +1 -1
  89. package/build/cover/save.js +17 -14
  90. package/build/cover/save.js.map +1 -1
  91. package/build/cover/shared.js +3 -2
  92. package/build/cover/shared.js.map +1 -1
  93. package/build/embed/edit.native.js +4 -8
  94. package/build/embed/edit.native.js.map +1 -1
  95. package/build/embed/embed-bottom-sheet.native.js +4 -5
  96. package/build/embed/embed-bottom-sheet.native.js.map +1 -1
  97. package/build/embed/embed-no-preview.native.js +2 -1
  98. package/build/embed/embed-no-preview.native.js.map +1 -1
  99. package/build/embed/icons.js +16 -1
  100. package/build/embed/icons.js.map +1 -1
  101. package/build/embed/transforms.native.js +3 -1
  102. package/build/embed/transforms.native.js.map +1 -1
  103. package/build/embed/variations.js +20 -0
  104. package/build/embed/variations.js.map +1 -1
  105. package/build/freeform/edit.js +16 -4
  106. package/build/freeform/edit.js.map +1 -1
  107. package/build/gallery/edit.js +7 -0
  108. package/build/gallery/edit.js.map +1 -1
  109. package/build/gallery/gallery.js +1 -1
  110. package/build/gallery/gallery.js.map +1 -1
  111. package/build/gallery/gallery.native.js +1 -1
  112. package/build/gallery/gallery.native.js.map +1 -1
  113. package/build/gallery/index.js +6 -1
  114. package/build/gallery/index.js.map +1 -1
  115. package/build/gallery/save.js +7 -2
  116. package/build/gallery/save.js.map +1 -1
  117. package/build/gallery/shared.js +0 -7
  118. package/build/gallery/shared.js.map +1 -1
  119. package/build/gallery/use-get-media.js +4 -10
  120. package/build/gallery/use-get-media.js.map +1 -1
  121. package/build/gallery/use-mobile-warning.js +43 -0
  122. package/build/gallery/use-mobile-warning.js.map +1 -0
  123. package/build/group/edit.js +1 -1
  124. package/build/group/edit.js.map +1 -1
  125. package/build/group/index.js +1 -0
  126. package/build/group/index.js.map +1 -1
  127. package/build/group/save.js +4 -5
  128. package/build/group/save.js.map +1 -1
  129. package/build/group/variations.js +2 -1
  130. package/build/group/variations.js.map +1 -1
  131. package/build/heading/autogenerate-anchors.js +90 -0
  132. package/build/heading/autogenerate-anchors.js.map +1 -0
  133. package/build/heading/edit.js +42 -5
  134. package/build/heading/edit.js.map +1 -1
  135. package/build/heading/index.js +14 -2
  136. package/build/heading/index.js.map +1 -1
  137. package/build/heading/transforms.js +14 -2
  138. package/build/heading/transforms.js.map +1 -1
  139. package/build/image/edit.native.js +126 -60
  140. package/build/image/edit.native.js.map +1 -1
  141. package/build/image/index.js +1 -1
  142. package/build/image/transforms.js +2 -1
  143. package/build/image/transforms.js.map +1 -1
  144. package/build/index.js +83 -70
  145. package/build/index.js.map +1 -1
  146. package/build/index.native.js +3 -1
  147. package/build/index.native.js.map +1 -1
  148. package/build/list/deprecated.js +111 -0
  149. package/build/list/deprecated.js.map +1 -0
  150. package/build/list/index.js +15 -3
  151. package/build/list/index.js.map +1 -1
  152. package/build/media-text/edit.js +1 -1
  153. package/build/media-text/edit.js.map +1 -1
  154. package/build/media-text/save.js +3 -3
  155. package/build/media-text/save.js.map +1 -1
  156. package/build/navigation/deprecated.js +340 -23
  157. package/build/navigation/deprecated.js.map +1 -1
  158. package/build/navigation/edit/index.js +372 -0
  159. package/build/navigation/edit/index.js.map +1 -0
  160. package/build/navigation/edit/inner-blocks.js +100 -0
  161. package/build/navigation/edit/inner-blocks.js.map +1 -0
  162. package/build/navigation/edit/navigation-menu-delete-control.js +60 -0
  163. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -0
  164. package/build/navigation/edit/navigation-menu-name-control.js +27 -0
  165. package/build/navigation/edit/navigation-menu-name-control.js.map +1 -0
  166. package/build/navigation/edit/navigation-menu-name-modal.js +54 -0
  167. package/build/navigation/edit/navigation-menu-name-modal.js.map +1 -0
  168. package/build/navigation/edit/navigation-menu-publish-button.js +53 -0
  169. package/build/navigation/edit/navigation-menu-publish-button.js.map +1 -0
  170. package/build/navigation/edit/navigation-menu-selector.js +49 -0
  171. package/build/navigation/edit/navigation-menu-selector.js.map +1 -0
  172. package/build/navigation/edit/placeholder/index.js +207 -0
  173. package/build/navigation/edit/placeholder/index.js.map +1 -0
  174. package/build/navigation/{placeholder-preview.js → edit/placeholder/placeholder-preview.js} +14 -2
  175. package/build/navigation/edit/placeholder/placeholder-preview.js.map +1 -0
  176. package/build/navigation/{responsive-wrapper.js → edit/responsive-wrapper.js} +9 -5
  177. package/build/navigation/edit/responsive-wrapper.js.map +1 -0
  178. package/build/navigation/edit/unsaved-inner-blocks.js +153 -0
  179. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -0
  180. package/build/navigation/{block-navigation-list.js → edit/use-list-view-modal.js} +34 -3
  181. package/build/navigation/edit/use-list-view-modal.js.map +1 -0
  182. package/build/navigation/index.js +25 -13
  183. package/build/navigation/index.js.map +1 -1
  184. package/build/navigation/save.js +10 -1
  185. package/build/navigation/save.js.map +1 -1
  186. package/build/navigation/use-navigation-menu.js +40 -0
  187. package/build/navigation/use-navigation-menu.js.map +1 -0
  188. package/build/navigation/use-template-part-area-label.js +74 -0
  189. package/build/navigation/use-template-part-area-label.js.map +1 -0
  190. package/build/navigation/view.js +29 -26
  191. package/build/navigation/view.js.map +1 -1
  192. package/build/navigation-area/edit.js +97 -0
  193. package/build/navigation-area/edit.js.map +1 -0
  194. package/build/navigation-area/index.js +61 -0
  195. package/build/navigation-area/index.js.map +1 -0
  196. package/build/navigation-area/inner-blocks.js +33 -0
  197. package/build/navigation-area/inner-blocks.js.map +1 -0
  198. package/build/navigation-area/save.js +18 -0
  199. package/build/navigation-area/save.js.map +1 -0
  200. package/build/navigation-link/edit.js +69 -7
  201. package/build/navigation-link/edit.js.map +1 -1
  202. package/build/navigation-link/transforms.js +5 -1
  203. package/build/navigation-link/transforms.js.map +1 -1
  204. package/build/navigation-submenu/edit.js +2 -2
  205. package/build/navigation-submenu/edit.js.map +1 -1
  206. package/build/page-list/edit.js +125 -84
  207. package/build/page-list/edit.js.map +1 -1
  208. package/build/page-list/index.js +1 -35
  209. package/build/page-list/index.js.map +1 -1
  210. package/build/paragraph/edit.native.js +2 -1
  211. package/build/paragraph/edit.native.js.map +1 -1
  212. package/build/paragraph/index.js +8 -1
  213. package/build/paragraph/index.js.map +1 -1
  214. package/build/paragraph/transforms.js +8 -1
  215. package/build/paragraph/transforms.js.map +1 -1
  216. package/build/pattern/edit.js +43 -0
  217. package/build/pattern/edit.js.map +1 -0
  218. package/build/{post-comment-author → pattern}/index.js +11 -10
  219. package/build/pattern/index.js.map +1 -0
  220. package/build/post-author/index.js +12 -1
  221. package/build/post-author/index.js.map +1 -1
  222. package/build/post-comment/edit.js +7 -8
  223. package/build/post-comment/edit.js.map +1 -1
  224. package/build/post-comment/index.js +4 -3
  225. package/build/post-comment/index.js.map +1 -1
  226. package/build/post-comment/save.js +5 -1
  227. package/build/post-comment/save.js.map +1 -1
  228. package/build/post-comments/index.js +8 -1
  229. package/build/post-comments/index.js.map +1 -1
  230. package/build/post-comments-count/index.js +7 -1
  231. package/build/post-comments-count/index.js.map +1 -1
  232. package/build/post-comments-form/index.js +9 -2
  233. package/build/post-comments-form/index.js.map +1 -1
  234. package/build/post-comments-link/index.js +8 -1
  235. package/build/post-comments-link/index.js.map +1 -1
  236. package/build/post-content/edit.js +2 -2
  237. package/build/post-content/edit.js.map +1 -1
  238. package/build/post-date/deprecated.js +71 -0
  239. package/build/post-date/deprecated.js.map +1 -0
  240. package/build/post-date/edit.js +1 -1
  241. package/build/post-date/edit.js.map +1 -1
  242. package/build/post-date/index.js +12 -2
  243. package/build/post-date/index.js.map +1 -1
  244. package/build/post-excerpt/edit.js +1 -1
  245. package/build/post-excerpt/edit.js.map +1 -1
  246. package/build/post-excerpt/index.js +12 -1
  247. package/build/post-excerpt/index.js.map +1 -1
  248. package/build/post-featured-image/index.js +5 -1
  249. package/build/post-featured-image/index.js.map +1 -1
  250. package/build/post-navigation-link/index.js +8 -1
  251. package/build/post-navigation-link/index.js.map +1 -1
  252. package/build/post-template/edit.js +8 -4
  253. package/build/post-template/edit.js.map +1 -1
  254. package/build/post-terms/edit.js +2 -6
  255. package/build/post-terms/edit.js.map +1 -1
  256. package/build/post-terms/index.js +7 -1
  257. package/build/post-terms/index.js.map +1 -1
  258. package/build/post-terms/use-post-terms.js +3 -1
  259. package/build/post-terms/use-post-terms.js.map +1 -1
  260. package/build/post-title/deprecated.js +84 -0
  261. package/build/post-title/deprecated.js.map +1 -0
  262. package/build/post-title/edit.js +1 -1
  263. package/build/post-title/edit.js.map +1 -1
  264. package/build/post-title/index.js +14 -2
  265. package/build/post-title/index.js.map +1 -1
  266. package/build/preformatted/edit.js +5 -2
  267. package/build/preformatted/edit.js.map +1 -1
  268. package/build/preformatted/edit.native.js +16 -6
  269. package/build/preformatted/edit.native.js.map +1 -1
  270. package/build/preformatted/index.js +9 -1
  271. package/build/preformatted/index.js.map +1 -1
  272. package/build/pullquote/blockquote.native.js +14 -2
  273. package/build/pullquote/blockquote.native.js.map +1 -1
  274. package/build/pullquote/edit.native.js +124 -0
  275. package/build/pullquote/edit.native.js.map +1 -0
  276. package/build/pullquote/figure.native.js +20 -8
  277. package/build/pullquote/figure.native.js.map +1 -1
  278. package/build/pullquote/index.js +12 -0
  279. package/build/pullquote/index.js.map +1 -1
  280. package/build/query/edit/index.js +1 -1
  281. package/build/query/edit/index.js.map +1 -1
  282. package/build/query/save.js +5 -1
  283. package/build/query/save.js.map +1 -1
  284. package/build/query-pagination/edit.js +1 -1
  285. package/build/query-pagination/edit.js.map +1 -1
  286. package/build/query-pagination-next/index.js +8 -1
  287. package/build/query-pagination-next/index.js.map +1 -1
  288. package/build/query-pagination-previous/index.js +8 -1
  289. package/build/query-pagination-previous/index.js.map +1 -1
  290. package/build/query-title/deprecated.js +70 -0
  291. package/build/query-title/deprecated.js.map +1 -0
  292. package/build/query-title/index.js +17 -2
  293. package/build/query-title/index.js.map +1 -1
  294. package/build/quote/deprecated.js +9 -0
  295. package/build/quote/deprecated.js.map +1 -1
  296. package/build/quote/index.js +17 -1
  297. package/build/quote/index.js.map +1 -1
  298. package/build/search/edit.js +27 -1
  299. package/build/search/edit.js.map +1 -1
  300. package/build/search/edit.native.js +38 -7
  301. package/build/search/edit.native.js.map +1 -1
  302. package/build/separator/separator-settings.js +1 -0
  303. package/build/separator/separator-settings.js.map +1 -1
  304. package/build/site-logo/edit.js +46 -21
  305. package/build/site-logo/edit.js.map +1 -1
  306. package/build/site-logo/index.js +6 -0
  307. package/build/site-logo/index.js.map +1 -1
  308. package/build/site-tagline/deprecated.js +68 -0
  309. package/build/site-tagline/deprecated.js.map +1 -0
  310. package/build/site-tagline/index.js +11 -3
  311. package/build/site-tagline/index.js.map +1 -1
  312. package/build/site-title/deprecated.js +81 -0
  313. package/build/site-title/deprecated.js.map +1 -0
  314. package/build/site-title/index.js +15 -2
  315. package/build/site-title/index.js.map +1 -1
  316. package/build/social-links/edit.js +2 -1
  317. package/build/social-links/edit.js.map +1 -1
  318. package/build/social-links/index.js +1 -0
  319. package/build/social-links/index.js.map +1 -1
  320. package/build/social-links/save.js +7 -2
  321. package/build/social-links/save.js.map +1 -1
  322. package/build/table/index.js +11 -0
  323. package/build/table/index.js.map +1 -1
  324. package/build/template-part/edit/inner-blocks.js +1 -1
  325. package/build/template-part/edit/inner-blocks.js.map +1 -1
  326. package/build/template-part/edit/placeholder/index.js +3 -3
  327. package/build/template-part/edit/placeholder/index.js.map +1 -1
  328. package/build/template-part/edit/placeholder/patterns-setup.js +3 -2
  329. package/build/template-part/edit/placeholder/patterns-setup.js.map +1 -1
  330. package/build/template-part/edit/selection/template-part-previews.js +1 -1
  331. package/build/template-part/edit/selection/template-part-previews.js.map +1 -1
  332. package/build/template-part/variations.js +1 -1
  333. package/build/template-part/variations.js.map +1 -1
  334. package/build/term-description/edit.js +1 -1
  335. package/build/term-description/edit.js.map +1 -1
  336. package/build/term-description/index.js +4 -1
  337. package/build/term-description/index.js.map +1 -1
  338. package/build/utils/clean-empty-object.js +31 -0
  339. package/build/utils/clean-empty-object.js.map +1 -0
  340. package/build/utils/migrate-font-family.js +49 -0
  341. package/build/utils/migrate-font-family.js.map +1 -0
  342. package/build/verse/deprecated.js +93 -14
  343. package/build/verse/deprecated.js.map +1 -1
  344. package/build/verse/index.js +10 -1
  345. package/build/verse/index.js.map +1 -1
  346. package/build-module/block/edit.js +1 -1
  347. package/build-module/block/edit.js.map +1 -1
  348. package/build-module/button/deprecated.js +155 -11
  349. package/build-module/button/deprecated.js.map +1 -1
  350. package/build-module/button/edit.native.js +259 -331
  351. package/build-module/button/edit.native.js.map +1 -1
  352. package/build-module/button/index.js +4 -1
  353. package/build-module/button/index.js.map +1 -1
  354. package/build-module/buttons/deprecated.js +82 -3
  355. package/build-module/buttons/deprecated.js.map +1 -1
  356. package/build-module/buttons/edit.js +6 -39
  357. package/build-module/buttons/edit.js.map +1 -1
  358. package/build-module/buttons/index.js +16 -13
  359. package/build-module/buttons/index.js.map +1 -1
  360. package/build-module/buttons/save.js +4 -18
  361. package/build-module/buttons/save.js.map +1 -1
  362. package/build-module/buttons/transforms.js +15 -10
  363. package/build-module/buttons/transforms.js.map +1 -1
  364. package/build-module/categories/edit.js +16 -6
  365. package/build-module/categories/edit.js.map +1 -1
  366. package/build-module/categories/index.js +4 -0
  367. package/build-module/categories/index.js.map +1 -1
  368. package/build-module/code/edit.native.js +9 -5
  369. package/build-module/code/edit.native.js.map +1 -1
  370. package/build-module/code/index.js +24 -1
  371. package/build-module/code/index.js.map +1 -1
  372. package/build-module/column/edit.js +4 -2
  373. package/build-module/column/edit.js.map +1 -1
  374. package/build-module/column/index.js +4 -0
  375. package/build-module/column/index.js.map +1 -1
  376. package/build-module/column/save.js +6 -4
  377. package/build-module/column/save.js.map +1 -1
  378. package/build-module/columns/edit.js +1 -1
  379. package/build-module/columns/edit.js.map +1 -1
  380. package/build-module/columns/index.js +1 -0
  381. package/build-module/columns/index.js.map +1 -1
  382. package/build-module/columns/save.js +5 -3
  383. package/build-module/columns/save.js.map +1 -1
  384. package/build-module/comment-author-avatar/edit.js +69 -0
  385. package/build-module/comment-author-avatar/edit.js.map +1 -0
  386. package/build-module/comment-author-avatar/index.js +52 -0
  387. package/build-module/comment-author-avatar/index.js.map +1 -0
  388. package/build-module/comment-author-name/deprecated.js +58 -0
  389. package/build-module/comment-author-name/deprecated.js.map +1 -0
  390. package/build-module/comment-author-name/edit.js +97 -0
  391. package/build-module/comment-author-name/edit.js.map +1 -0
  392. package/build-module/comment-author-name/index.js +63 -0
  393. package/build-module/comment-author-name/index.js.map +1 -0
  394. package/build-module/comment-content/edit.js +61 -0
  395. package/build-module/comment-content/edit.js.map +1 -0
  396. package/build-module/comment-content/index.js +55 -0
  397. package/build-module/comment-content/index.js.map +1 -0
  398. package/build-module/comment-date/deprecated.js +57 -0
  399. package/build-module/comment-date/deprecated.js.map +1 -0
  400. package/build-module/comment-date/edit.js +85 -0
  401. package/build-module/comment-date/edit.js.map +1 -0
  402. package/build-module/comment-date/index.js +58 -0
  403. package/build-module/comment-date/index.js.map +1 -0
  404. package/build-module/comment-edit-link/edit.js +48 -0
  405. package/build-module/comment-edit-link/edit.js.map +1 -0
  406. package/build-module/comment-edit-link/index.js +54 -0
  407. package/build-module/comment-edit-link/index.js.map +1 -0
  408. package/build-module/comment-reply-link/edit.js +50 -0
  409. package/build-module/comment-reply-link/edit.js.map +1 -0
  410. package/build-module/comment-reply-link/index.js +50 -0
  411. package/build-module/comment-reply-link/index.js.map +1 -0
  412. package/build-module/comment-template/edit.js +71 -0
  413. package/build-module/comment-template/edit.js.map +1 -0
  414. package/build-module/comment-template/index.js +35 -0
  415. package/build-module/comment-template/index.js.map +1 -0
  416. package/build-module/comment-template/save.js +10 -0
  417. package/build-module/comment-template/save.js.map +1 -0
  418. package/build-module/comments-query-loop/edit.js +50 -0
  419. package/build-module/comments-query-loop/edit.js.map +1 -0
  420. package/build-module/comments-query-loop/index.js +53 -0
  421. package/build-module/comments-query-loop/index.js.map +1 -0
  422. package/build-module/comments-query-loop/save.js +14 -0
  423. package/build-module/comments-query-loop/save.js.map +1 -0
  424. package/build-module/comments-query-loop/toolbar.js +44 -0
  425. package/build-module/comments-query-loop/toolbar.js.map +1 -0
  426. package/build-module/cover/deprecated.js +183 -21
  427. package/build-module/cover/deprecated.js.map +1 -1
  428. package/build-module/cover/edit.js +62 -28
  429. package/build-module/cover/edit.js.map +1 -1
  430. package/build-module/cover/edit.native.js +6 -2
  431. package/build-module/cover/edit.native.js.map +1 -1
  432. package/build-module/cover/index.js +12 -1
  433. package/build-module/cover/index.js.map +1 -1
  434. package/build-module/cover/save.js +18 -15
  435. package/build-module/cover/save.js.map +1 -1
  436. package/build-module/cover/shared.js +3 -2
  437. package/build-module/cover/shared.js.map +1 -1
  438. package/build-module/embed/edit.native.js +4 -8
  439. package/build-module/embed/edit.native.js.map +1 -1
  440. package/build-module/embed/embed-bottom-sheet.native.js +4 -5
  441. package/build-module/embed/embed-bottom-sheet.native.js.map +1 -1
  442. package/build-module/embed/embed-no-preview.native.js +2 -1
  443. package/build-module/embed/embed-no-preview.native.js.map +1 -1
  444. package/build-module/embed/icons.js +13 -0
  445. package/build-module/embed/icons.js.map +1 -1
  446. package/build-module/embed/transforms.native.js +2 -1
  447. package/build-module/embed/transforms.native.js.map +1 -1
  448. package/build-module/embed/variations.js +21 -1
  449. package/build-module/embed/variations.js.map +1 -1
  450. package/build-module/freeform/edit.js +16 -5
  451. package/build-module/freeform/edit.js.map +1 -1
  452. package/build-module/gallery/edit.js +6 -0
  453. package/build-module/gallery/edit.js.map +1 -1
  454. package/build-module/gallery/gallery.js +1 -1
  455. package/build-module/gallery/gallery.js.map +1 -1
  456. package/build-module/gallery/gallery.native.js +1 -1
  457. package/build-module/gallery/gallery.native.js.map +1 -1
  458. package/build-module/gallery/index.js +6 -1
  459. package/build-module/gallery/index.js.map +1 -1
  460. package/build-module/gallery/save.js +5 -3
  461. package/build-module/gallery/save.js.map +1 -1
  462. package/build-module/gallery/shared.js +0 -6
  463. package/build-module/gallery/shared.js.map +1 -1
  464. package/build-module/gallery/use-get-media.js +4 -10
  465. package/build-module/gallery/use-get-media.js.map +1 -1
  466. package/build-module/gallery/use-mobile-warning.js +32 -0
  467. package/build-module/gallery/use-mobile-warning.js.map +1 -0
  468. package/build-module/group/edit.js +1 -1
  469. package/build-module/group/edit.js.map +1 -1
  470. package/build-module/group/index.js +1 -0
  471. package/build-module/group/index.js.map +1 -1
  472. package/build-module/group/save.js +5 -6
  473. package/build-module/group/save.js.map +1 -1
  474. package/build-module/group/variations.js +2 -1
  475. package/build-module/group/variations.js.map +1 -1
  476. package/build-module/heading/autogenerate-anchors.js +77 -0
  477. package/build-module/heading/autogenerate-anchors.js.map +1 -0
  478. package/build-module/heading/edit.js +43 -7
  479. package/build-module/heading/edit.js.map +1 -1
  480. package/build-module/heading/index.js +14 -2
  481. package/build-module/heading/index.js.map +1 -1
  482. package/build-module/heading/transforms.js +14 -2
  483. package/build-module/heading/transforms.js.map +1 -1
  484. package/build-module/image/edit.native.js +128 -63
  485. package/build-module/image/edit.native.js.map +1 -1
  486. package/build-module/image/index.js +1 -1
  487. package/build-module/image/transforms.js +2 -1
  488. package/build-module/image/transforms.js.map +1 -1
  489. package/build-module/index.js +59 -53
  490. package/build-module/index.js.map +1 -1
  491. package/build-module/index.native.js +1 -2
  492. package/build-module/index.native.js.map +1 -1
  493. package/build-module/list/deprecated.js +99 -0
  494. package/build-module/list/deprecated.js.map +1 -0
  495. package/build-module/list/index.js +14 -3
  496. package/build-module/list/index.js.map +1 -1
  497. package/build-module/media-text/edit.js +1 -1
  498. package/build-module/media-text/edit.js.map +1 -1
  499. package/build-module/media-text/save.js +4 -4
  500. package/build-module/media-text/save.js.map +1 -1
  501. package/build-module/navigation/deprecated.js +336 -23
  502. package/build-module/navigation/deprecated.js.map +1 -1
  503. package/build-module/navigation/edit/index.js +346 -0
  504. package/build-module/navigation/edit/index.js.map +1 -0
  505. package/build-module/navigation/edit/inner-blocks.js +87 -0
  506. package/build-module/navigation/edit/inner-blocks.js.map +1 -0
  507. package/build-module/navigation/edit/navigation-menu-delete-control.js +50 -0
  508. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -0
  509. package/build-module/navigation/edit/navigation-menu-name-control.js +17 -0
  510. package/build-module/navigation/edit/navigation-menu-name-control.js.map +1 -0
  511. package/build-module/navigation/edit/navigation-menu-name-modal.js +46 -0
  512. package/build-module/navigation/edit/navigation-menu-name-modal.js.map +1 -0
  513. package/build-module/navigation/edit/navigation-menu-publish-button.js +40 -0
  514. package/build-module/navigation/edit/navigation-menu-publish-button.js.map +1 -0
  515. package/build-module/navigation/edit/navigation-menu-selector.js +36 -0
  516. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -0
  517. package/build-module/navigation/edit/placeholder/index.js +189 -0
  518. package/build-module/navigation/edit/placeholder/index.js.map +1 -0
  519. package/build-module/navigation/{placeholder-preview.js → edit/placeholder/placeholder-preview.js} +11 -2
  520. package/build-module/navigation/edit/placeholder/placeholder-preview.js.map +1 -0
  521. package/build-module/navigation/{responsive-wrapper.js → edit/responsive-wrapper.js} +9 -5
  522. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -0
  523. package/build-module/navigation/edit/unsaved-inner-blocks.js +136 -0
  524. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -0
  525. package/build-module/navigation/{block-navigation-list.js → edit/use-list-view-modal.js} +31 -2
  526. package/build-module/navigation/edit/use-list-view-modal.js.map +1 -0
  527. package/build-module/navigation/index.js +25 -12
  528. package/build-module/navigation/index.js.map +1 -1
  529. package/build-module/navigation/save.js +10 -1
  530. package/build-module/navigation/save.js.map +1 -1
  531. package/build-module/navigation/use-navigation-menu.js +31 -0
  532. package/build-module/navigation/use-navigation-menu.js.map +1 -0
  533. package/build-module/navigation/use-template-part-area-label.js +63 -0
  534. package/build-module/navigation/use-template-part-area-label.js.map +1 -0
  535. package/build-module/navigation/view.js +28 -26
  536. package/build-module/navigation/view.js.map +1 -1
  537. package/build-module/navigation-area/edit.js +82 -0
  538. package/build-module/navigation-area/edit.js.map +1 -0
  539. package/build-module/navigation-area/index.js +47 -0
  540. package/build-module/navigation-area/index.js.map +1 -0
  541. package/build-module/navigation-area/inner-blocks.js +25 -0
  542. package/build-module/navigation-area/inner-blocks.js.map +1 -0
  543. package/build-module/navigation-area/save.js +10 -0
  544. package/build-module/navigation-area/save.js.map +1 -0
  545. package/build-module/navigation-link/edit.js +72 -10
  546. package/build-module/navigation-link/edit.js.map +1 -1
  547. package/build-module/navigation-link/transforms.js +5 -1
  548. package/build-module/navigation-link/transforms.js.map +1 -1
  549. package/build-module/navigation-submenu/edit.js +2 -2
  550. package/build-module/navigation-submenu/edit.js.map +1 -1
  551. package/build-module/page-list/edit.js +127 -86
  552. package/build-module/page-list/edit.js.map +1 -1
  553. package/build-module/page-list/index.js +1 -35
  554. package/build-module/page-list/index.js.map +1 -1
  555. package/build-module/paragraph/edit.native.js +2 -1
  556. package/build-module/paragraph/edit.native.js.map +1 -1
  557. package/build-module/paragraph/index.js +8 -1
  558. package/build-module/paragraph/index.js.map +1 -1
  559. package/build-module/paragraph/transforms.js +8 -1
  560. package/build-module/paragraph/transforms.js.map +1 -1
  561. package/build-module/pattern/edit.js +35 -0
  562. package/build-module/pattern/edit.js.map +1 -0
  563. package/build-module/pattern/index.js +29 -0
  564. package/build-module/pattern/index.js.map +1 -0
  565. package/build-module/post-author/index.js +12 -1
  566. package/build-module/post-author/index.js.map +1 -1
  567. package/build-module/post-comment/edit.js +8 -9
  568. package/build-module/post-comment/edit.js.map +1 -1
  569. package/build-module/post-comment/index.js +4 -3
  570. package/build-module/post-comment/index.js.map +1 -1
  571. package/build-module/post-comment/save.js +4 -2
  572. package/build-module/post-comment/save.js.map +1 -1
  573. package/build-module/post-comments/index.js +8 -1
  574. package/build-module/post-comments/index.js.map +1 -1
  575. package/build-module/post-comments-count/index.js +7 -1
  576. package/build-module/post-comments-count/index.js.map +1 -1
  577. package/build-module/post-comments-form/index.js +9 -2
  578. package/build-module/post-comments-form/index.js.map +1 -1
  579. package/build-module/post-comments-link/index.js +8 -1
  580. package/build-module/post-comments-link/index.js.map +1 -1
  581. package/build-module/post-content/edit.js +2 -2
  582. package/build-module/post-content/edit.js.map +1 -1
  583. package/build-module/post-date/deprecated.js +60 -0
  584. package/build-module/post-date/deprecated.js.map +1 -0
  585. package/build-module/post-date/edit.js +1 -1
  586. package/build-module/post-date/edit.js.map +1 -1
  587. package/build-module/post-date/index.js +11 -2
  588. package/build-module/post-date/index.js.map +1 -1
  589. package/build-module/post-excerpt/edit.js +1 -1
  590. package/build-module/post-excerpt/edit.js.map +1 -1
  591. package/build-module/post-excerpt/index.js +12 -1
  592. package/build-module/post-excerpt/index.js.map +1 -1
  593. package/build-module/post-featured-image/index.js +5 -1
  594. package/build-module/post-featured-image/index.js.map +1 -1
  595. package/build-module/post-navigation-link/index.js +8 -1
  596. package/build-module/post-navigation-link/index.js.map +1 -1
  597. package/build-module/post-template/edit.js +10 -5
  598. package/build-module/post-template/edit.js.map +1 -1
  599. package/build-module/post-terms/edit.js +2 -6
  600. package/build-module/post-terms/edit.js.map +1 -1
  601. package/build-module/post-terms/index.js +7 -1
  602. package/build-module/post-terms/index.js.map +1 -1
  603. package/build-module/post-terms/use-post-terms.js +3 -1
  604. package/build-module/post-terms/use-post-terms.js.map +1 -1
  605. package/build-module/post-title/deprecated.js +73 -0
  606. package/build-module/post-title/deprecated.js.map +1 -0
  607. package/build-module/post-title/edit.js +1 -1
  608. package/build-module/post-title/edit.js.map +1 -1
  609. package/build-module/post-title/index.js +13 -2
  610. package/build-module/post-title/index.js.map +1 -1
  611. package/build-module/preformatted/edit.js +5 -2
  612. package/build-module/preformatted/edit.js.map +1 -1
  613. package/build-module/preformatted/edit.native.js +17 -6
  614. package/build-module/preformatted/edit.native.js.map +1 -1
  615. package/build-module/preformatted/index.js +9 -1
  616. package/build-module/preformatted/index.js.map +1 -1
  617. package/build-module/pullquote/blockquote.native.js +14 -2
  618. package/build-module/pullquote/blockquote.native.js.map +1 -1
  619. package/build-module/pullquote/edit.native.js +112 -0
  620. package/build-module/pullquote/edit.native.js.map +1 -0
  621. package/build-module/pullquote/figure.native.js +20 -9
  622. package/build-module/pullquote/figure.native.js.map +1 -1
  623. package/build-module/pullquote/index.js +12 -0
  624. package/build-module/pullquote/index.js.map +1 -1
  625. package/build-module/query/edit/index.js +1 -1
  626. package/build-module/query/edit/index.js.map +1 -1
  627. package/build-module/query/save.js +4 -2
  628. package/build-module/query/save.js.map +1 -1
  629. package/build-module/query-pagination/edit.js +1 -1
  630. package/build-module/query-pagination/edit.js.map +1 -1
  631. package/build-module/query-pagination-next/index.js +8 -1
  632. package/build-module/query-pagination-next/index.js.map +1 -1
  633. package/build-module/query-pagination-previous/index.js +8 -1
  634. package/build-module/query-pagination-previous/index.js.map +1 -1
  635. package/build-module/query-title/deprecated.js +59 -0
  636. package/build-module/query-title/deprecated.js.map +1 -0
  637. package/build-module/query-title/index.js +16 -2
  638. package/build-module/query-title/index.js.map +1 -1
  639. package/build-module/quote/deprecated.js +9 -0
  640. package/build-module/quote/deprecated.js.map +1 -1
  641. package/build-module/quote/index.js +17 -1
  642. package/build-module/quote/index.js.map +1 -1
  643. package/build-module/search/edit.js +28 -2
  644. package/build-module/search/edit.js.map +1 -1
  645. package/build-module/search/edit.native.js +38 -7
  646. package/build-module/search/edit.native.js.map +1 -1
  647. package/build-module/separator/separator-settings.js +1 -0
  648. package/build-module/separator/separator-settings.js.map +1 -1
  649. package/build-module/site-logo/edit.js +49 -26
  650. package/build-module/site-logo/edit.js.map +1 -1
  651. package/build-module/site-logo/index.js +6 -0
  652. package/build-module/site-logo/index.js.map +1 -1
  653. package/build-module/site-tagline/deprecated.js +57 -0
  654. package/build-module/site-tagline/deprecated.js.map +1 -0
  655. package/build-module/site-tagline/index.js +10 -3
  656. package/build-module/site-tagline/index.js.map +1 -1
  657. package/build-module/site-title/deprecated.js +70 -0
  658. package/build-module/site-title/deprecated.js.map +1 -0
  659. package/build-module/site-title/index.js +14 -2
  660. package/build-module/site-title/index.js.map +1 -1
  661. package/build-module/social-links/edit.js +2 -1
  662. package/build-module/social-links/edit.js.map +1 -1
  663. package/build-module/social-links/index.js +1 -0
  664. package/build-module/social-links/index.js.map +1 -1
  665. package/build-module/social-links/save.js +5 -3
  666. package/build-module/social-links/save.js.map +1 -1
  667. package/build-module/table/index.js +11 -0
  668. package/build-module/table/index.js.map +1 -1
  669. package/build-module/template-part/edit/inner-blocks.js +1 -1
  670. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  671. package/build-module/template-part/edit/placeholder/index.js +3 -3
  672. package/build-module/template-part/edit/placeholder/index.js.map +1 -1
  673. package/build-module/template-part/edit/placeholder/patterns-setup.js +3 -2
  674. package/build-module/template-part/edit/placeholder/patterns-setup.js.map +1 -1
  675. package/build-module/template-part/edit/selection/template-part-previews.js +1 -1
  676. package/build-module/template-part/edit/selection/template-part-previews.js.map +1 -1
  677. package/build-module/template-part/variations.js +2 -2
  678. package/build-module/template-part/variations.js.map +1 -1
  679. package/build-module/term-description/edit.js +1 -1
  680. package/build-module/term-description/edit.js.map +1 -1
  681. package/build-module/term-description/index.js +4 -1
  682. package/build-module/term-description/index.js.map +1 -1
  683. package/build-module/utils/clean-empty-object.js +22 -0
  684. package/build-module/utils/clean-empty-object.js.map +1 -0
  685. package/build-module/utils/migrate-font-family.js +38 -0
  686. package/build-module/utils/migrate-font-family.js.map +1 -0
  687. package/build-module/verse/deprecated.js +90 -15
  688. package/build-module/verse/deprecated.js.map +1 -1
  689. package/build-module/verse/index.js +10 -1
  690. package/build-module/verse/index.js.map +1 -1
  691. package/build-style/button/editor-rtl.css +0 -1
  692. package/build-style/button/editor.css +0 -1
  693. package/build-style/button/style-rtl.css +15 -27
  694. package/build-style/button/style.css +15 -27
  695. package/build-style/buttons/editor-rtl.css +4 -8
  696. package/build-style/buttons/editor.css +4 -8
  697. package/build-style/buttons/style-rtl.css +1 -35
  698. package/build-style/buttons/style.css +1 -48
  699. package/build-style/columns/style-rtl.css +1 -1
  700. package/build-style/columns/style.css +1 -1
  701. package/build-style/common-rtl.css +2 -16
  702. package/build-style/common.css +2 -16
  703. package/build-style/cover/editor-rtl.css +14 -32
  704. package/build-style/cover/editor.css +14 -32
  705. package/build-style/cover/style-rtl.css +28 -40
  706. package/build-style/cover/style.css +28 -40
  707. package/build-style/editor-rtl.css +198 -145
  708. package/build-style/editor.css +198 -145
  709. package/build-style/image/editor-rtl.css +1 -0
  710. package/build-style/image/editor.css +1 -0
  711. package/build-style/image/style-rtl.css +4 -0
  712. package/build-style/image/style.css +4 -0
  713. package/build-style/media-text/style-rtl.css +1 -0
  714. package/build-style/media-text/style.css +1 -0
  715. package/build-style/navigation/editor-rtl.css +58 -16
  716. package/build-style/navigation/editor.css +58 -16
  717. package/build-style/navigation/style-rtl.css +51 -112
  718. package/build-style/navigation/style.css +51 -112
  719. package/build-style/navigation-link/editor-rtl.css +31 -14
  720. package/build-style/navigation-link/editor.css +31 -14
  721. package/build-style/navigation-link/style-rtl.css +1 -1
  722. package/build-style/navigation-link/style.css +1 -1
  723. package/build-style/navigation-submenu/editor-rtl.css +1 -1
  724. package/build-style/navigation-submenu/editor.css +1 -1
  725. package/build-style/navigation-submenu/style-rtl.css +2 -0
  726. package/build-style/navigation-submenu/style.css +2 -0
  727. package/build-style/page-list/style-rtl.css +4 -16
  728. package/build-style/page-list/style.css +4 -16
  729. package/build-style/post-author/style-rtl.css +0 -1
  730. package/build-style/post-author/style.css +0 -1
  731. package/build-style/post-comments/style-rtl.css +21 -1
  732. package/build-style/post-comments/style.css +21 -1
  733. package/build-style/post-comments-form/style-rtl.css +29 -0
  734. package/build-style/post-comments-form/style.css +29 -0
  735. package/build-style/post-featured-image/editor-rtl.css +1 -1
  736. package/build-style/post-featured-image/editor.css +1 -1
  737. package/build-style/post-featured-image/style-rtl.css +1 -1
  738. package/build-style/post-featured-image/style.css +1 -1
  739. package/build-style/quote/theme-rtl.css +1 -1
  740. package/build-style/quote/theme.css +1 -1
  741. package/build-style/reset-rtl.css +0 -5
  742. package/build-style/reset.css +0 -5
  743. package/build-style/search/style-rtl.css +18 -6
  744. package/build-style/search/style.css +18 -6
  745. package/build-style/separator/style-rtl.css +0 -1
  746. package/build-style/separator/style.css +0 -1
  747. package/build-style/site-logo/editor-rtl.css +82 -14
  748. package/build-style/site-logo/editor.css +82 -14
  749. package/build-style/site-logo/style-rtl.css +6 -2
  750. package/build-style/site-logo/style.css +6 -2
  751. package/build-style/social-link/editor-rtl.css +4 -0
  752. package/build-style/social-link/editor.css +4 -0
  753. package/build-style/social-links/editor-rtl.css +4 -0
  754. package/build-style/social-links/editor.css +4 -0
  755. package/build-style/social-links/style-rtl.css +7 -1
  756. package/build-style/social-links/style.css +7 -1
  757. package/build-style/style-rtl.css +192 -261
  758. package/build-style/style.css +192 -274
  759. package/build-style/template-part/editor-rtl.css +0 -7
  760. package/build-style/template-part/editor.css +0 -7
  761. package/build-style/theme-rtl.css +1 -1
  762. package/build-style/theme.css +1 -1
  763. package/package.json +20 -19
  764. package/src/audio/test/edit.native.js +4 -0
  765. package/src/block/edit.js +1 -1
  766. package/src/button/block.json +4 -1
  767. package/src/button/deprecated.js +149 -4
  768. package/src/button/edit.native.js +319 -366
  769. package/src/button/editor.scss +0 -1
  770. package/src/button/style.scss +18 -41
  771. package/src/buttons/block.json +15 -10
  772. package/src/buttons/deprecated.js +76 -3
  773. package/src/buttons/edit.js +4 -49
  774. package/src/buttons/editor.scss +8 -9
  775. package/src/buttons/index.js +0 -2
  776. package/src/buttons/save.js +4 -21
  777. package/src/buttons/style.scss +1 -51
  778. package/src/categories/block.json +4 -0
  779. package/src/categories/edit.js +36 -18
  780. package/src/categories/index.php +3 -0
  781. package/src/code/block.json +24 -1
  782. package/src/code/edit.native.js +12 -14
  783. package/src/column/block.json +4 -0
  784. package/src/column/edit.js +8 -2
  785. package/src/column/save.js +9 -12
  786. package/src/columns/block.json +1 -0
  787. package/src/columns/edit.js +1 -1
  788. package/src/columns/save.js +5 -6
  789. package/src/columns/style.scss +1 -1
  790. package/src/comment-author-avatar/block.json +34 -0
  791. package/src/comment-author-avatar/edit.js +96 -0
  792. package/src/comment-author-avatar/index.js +18 -0
  793. package/src/comment-author-avatar/index.php +62 -0
  794. package/src/comment-author-name/block.json +43 -0
  795. package/src/comment-author-name/deprecated.js +50 -0
  796. package/src/comment-author-name/edit.js +124 -0
  797. package/src/comment-author-name/index.js +20 -0
  798. package/src/comment-author-name/index.php +57 -0
  799. package/src/comment-content/block.json +37 -0
  800. package/src/comment-content/edit.js +80 -0
  801. package/src/{post-comment-content → comment-content}/index.js +1 -1
  802. package/src/comment-content/index.php +56 -0
  803. package/src/comment-date/block.json +38 -0
  804. package/src/comment-date/deprecated.js +49 -0
  805. package/src/comment-date/edit.js +106 -0
  806. package/src/{post-comment-date → comment-date}/index.js +2 -0
  807. package/src/comment-date/index.php +56 -0
  808. package/src/comment-edit-link/block.json +36 -0
  809. package/src/comment-edit-link/edit.js +68 -0
  810. package/src/{post-comment-author → comment-edit-link}/index.js +5 -5
  811. package/src/comment-edit-link/index.php +58 -0
  812. package/src/comment-reply-link/block.json +32 -0
  813. package/src/comment-reply-link/edit.js +59 -0
  814. package/src/comment-reply-link/index.js +18 -0
  815. package/src/comment-reply-link/index.php +80 -0
  816. package/src/comment-template/block.json +15 -0
  817. package/src/comment-template/edit.js +100 -0
  818. package/src/comment-template/index.js +20 -0
  819. package/src/comment-template/index.php +65 -0
  820. package/src/comment-template/save.js +8 -0
  821. package/src/comments-query-loop/block.json +33 -0
  822. package/src/comments-query-loop/edit.js +53 -0
  823. package/src/comments-query-loop/index.js +20 -0
  824. package/src/comments-query-loop/save.js +14 -0
  825. package/src/comments-query-loop/toolbar.js +57 -0
  826. package/src/common.scss +3 -17
  827. package/src/cover/block.json +12 -1
  828. package/src/cover/deprecated.js +707 -510
  829. package/src/cover/edit.js +70 -42
  830. package/src/cover/edit.native.js +5 -1
  831. package/src/cover/editor.scss +20 -38
  832. package/src/cover/save.js +30 -26
  833. package/src/cover/shared.js +3 -2
  834. package/src/cover/style.scss +9 -7
  835. package/src/editor.scss +4 -20
  836. package/src/embed/edit.native.js +6 -9
  837. package/src/embed/embed-bottom-sheet.native.js +4 -5
  838. package/src/embed/embed-no-preview.native.js +1 -0
  839. package/src/embed/icons.js +11 -0
  840. package/src/embed/test/__snapshots__/index.native.js.snap +181 -0
  841. package/src/embed/test/index.native.js +991 -0
  842. package/src/embed/transforms.native.js +2 -0
  843. package/src/embed/variations.js +21 -0
  844. package/src/file/test/__snapshots__/edit.native.js.snap +6 -3
  845. package/src/file/test/edit.native.js +4 -0
  846. package/src/freeform/edit.js +14 -4
  847. package/src/gallery/block.json +6 -1
  848. package/src/gallery/edit.js +7 -0
  849. package/src/gallery/editor.scss +0 -1
  850. package/src/gallery/gallery.js +1 -4
  851. package/src/gallery/gallery.native.js +1 -4
  852. package/src/gallery/index.php +52 -0
  853. package/src/gallery/save.js +9 -3
  854. package/src/gallery/shared.js +0 -7
  855. package/src/gallery/use-get-media.js +6 -11
  856. package/src/gallery/use-mobile-warning.js +28 -0
  857. package/src/group/block.json +1 -0
  858. package/src/group/edit.js +1 -1
  859. package/src/group/save.js +3 -8
  860. package/src/group/variations.js +1 -1
  861. package/src/heading/autogenerate-anchors.js +81 -0
  862. package/src/heading/block.json +14 -2
  863. package/src/heading/edit.js +42 -4
  864. package/src/home-link/index.php +3 -1
  865. package/src/image/block.json +1 -1
  866. package/src/image/edit.native.js +120 -64
  867. package/src/image/editor.scss +1 -0
  868. package/src/image/index.php +42 -0
  869. package/src/image/style.scss +8 -2
  870. package/src/image/test/edit.native.js +225 -40
  871. package/src/image/transforms.js +4 -0
  872. package/src/index.js +96 -88
  873. package/src/index.native.js +1 -1
  874. package/src/list/block.json +11 -2
  875. package/src/list/deprecated.js +79 -0
  876. package/src/list/index.js +2 -0
  877. package/src/media-text/edit.js +1 -1
  878. package/src/media-text/save.js +6 -4
  879. package/src/media-text/style.scss +1 -0
  880. package/src/navigation/block.json +41 -13
  881. package/src/navigation/deprecated.js +336 -27
  882. package/src/navigation/edit/index.js +510 -0
  883. package/src/navigation/edit/inner-blocks.js +134 -0
  884. package/src/navigation/edit/navigation-menu-delete-control.js +81 -0
  885. package/src/navigation/edit/navigation-menu-name-control.js +22 -0
  886. package/src/navigation/edit/navigation-menu-name-modal.js +69 -0
  887. package/src/navigation/edit/navigation-menu-publish-button.js +57 -0
  888. package/src/navigation/edit/navigation-menu-selector.js +42 -0
  889. package/src/navigation/edit/placeholder/index.js +257 -0
  890. package/src/navigation/{placeholder-preview.js → edit/placeholder/placeholder-preview.js} +13 -2
  891. package/src/navigation/{responsive-wrapper.js → edit/responsive-wrapper.js} +8 -6
  892. package/src/navigation/edit/unsaved-inner-blocks.js +197 -0
  893. package/src/navigation/edit/use-list-view-modal.js +72 -0
  894. package/src/navigation/editor.scss +86 -31
  895. package/src/navigation/index.js +0 -2
  896. package/src/navigation/index.php +54 -107
  897. package/src/navigation/save.js +7 -1
  898. package/src/navigation/style.scss +81 -155
  899. package/src/navigation/use-navigation-menu.js +60 -0
  900. package/src/navigation/use-template-part-area-label.js +78 -0
  901. package/src/navigation/view.js +33 -32
  902. package/src/navigation-area/block.json +27 -0
  903. package/src/navigation-area/edit.js +105 -0
  904. package/src/navigation-area/index.js +26 -0
  905. package/src/navigation-area/index.php +21 -0
  906. package/src/navigation-area/inner-blocks.js +24 -0
  907. package/src/navigation-area/save.js +8 -0
  908. package/src/navigation-link/edit.js +97 -12
  909. package/src/navigation-link/editor.scss +30 -19
  910. package/src/navigation-link/index.php +8 -10
  911. package/src/navigation-link/style.scss +1 -1
  912. package/src/navigation-link/transforms.js +5 -1
  913. package/src/navigation-submenu/edit.js +2 -2
  914. package/src/navigation-submenu/editor.scss +1 -1
  915. package/src/navigation-submenu/index.php +10 -9
  916. package/src/navigation-submenu/style.scss +5 -0
  917. package/src/page-list/block.json +0 -33
  918. package/src/page-list/edit.js +168 -110
  919. package/src/page-list/index.php +27 -26
  920. package/src/page-list/style.scss +4 -23
  921. package/src/paragraph/block.json +8 -1
  922. package/src/paragraph/edit.native.js +1 -0
  923. package/src/pattern/block.json +17 -0
  924. package/src/pattern/edit.js +41 -0
  925. package/src/pattern/index.js +12 -0
  926. package/src/pattern/index.php +44 -0
  927. package/src/post-author/block.json +12 -1
  928. package/src/post-author/style.scss +0 -1
  929. package/src/post-comment/block.json +4 -3
  930. package/src/post-comment/edit.js +16 -13
  931. package/src/post-comment/save.js +4 -6
  932. package/src/post-comments/block.json +8 -1
  933. package/src/post-comments/index.php +12 -3
  934. package/src/post-comments/style.scss +27 -1
  935. package/src/post-comments-count/block.json +7 -1
  936. package/src/post-comments-form/block.json +9 -2
  937. package/src/post-comments-form/index.php +0 -14
  938. package/src/post-comments-form/style.scss +47 -7
  939. package/src/post-comments-link/block.json +8 -1
  940. package/src/post-content/edit.js +2 -2
  941. package/src/post-date/block.json +8 -1
  942. package/src/post-date/deprecated.js +52 -0
  943. package/src/post-date/edit.js +1 -1
  944. package/src/post-date/index.js +2 -0
  945. package/src/post-excerpt/block.json +12 -1
  946. package/src/post-excerpt/edit.js +1 -7
  947. package/src/post-excerpt/index.php +7 -1
  948. package/src/post-featured-image/block.json +5 -1
  949. package/src/post-featured-image/editor.scss +1 -1
  950. package/src/post-featured-image/style.scss +1 -1
  951. package/src/post-navigation-link/block.json +8 -1
  952. package/src/post-navigation-link/index.php +1 -2
  953. package/src/post-template/edit.js +8 -3
  954. package/src/post-template/index.php +0 -11
  955. package/src/post-terms/block.json +7 -1
  956. package/src/post-terms/edit.js +2 -14
  957. package/src/post-terms/use-post-terms.js +1 -1
  958. package/src/post-title/block.json +10 -1
  959. package/src/post-title/deprecated.js +65 -0
  960. package/src/post-title/edit.js +1 -1
  961. package/src/post-title/index.js +2 -0
  962. package/src/post-title/index.php +7 -2
  963. package/src/preformatted/block.json +9 -1
  964. package/src/preformatted/edit.js +2 -1
  965. package/src/preformatted/edit.native.js +20 -6
  966. package/src/preformatted/styles.native.scss +5 -0
  967. package/src/preformatted/test/__snapshots__/edit.native.js.snap +20 -2
  968. package/src/pullquote/block.json +12 -0
  969. package/src/pullquote/blockquote.native.js +12 -2
  970. package/src/pullquote/edit.native.js +129 -0
  971. package/src/pullquote/figure.native.js +17 -7
  972. package/src/query/edit/index.js +1 -1
  973. package/src/query/save.js +4 -6
  974. package/src/query-pagination/edit.js +1 -1
  975. package/src/query-pagination-next/block.json +8 -1
  976. package/src/query-pagination-previous/block.json +8 -1
  977. package/src/query-title/block.json +13 -1
  978. package/src/query-title/deprecated.js +51 -0
  979. package/src/query-title/index.js +2 -0
  980. package/src/quote/block.json +15 -1
  981. package/src/quote/deprecated.js +10 -0
  982. package/src/quote/theme.scss +1 -0
  983. package/src/reset.scss +0 -9
  984. package/src/search/edit.js +29 -0
  985. package/src/search/edit.native.js +46 -12
  986. package/src/search/style.scss +54 -52
  987. package/src/search/test/__snapshots__/edit.native.js.snap +33 -5
  988. package/src/search/test/edit.native.js +4 -0
  989. package/src/separator/separator-settings.js +1 -0
  990. package/src/separator/style.scss +0 -1
  991. package/src/site-logo/block.json +6 -0
  992. package/src/site-logo/edit.js +59 -34
  993. package/src/site-logo/editor.scss +101 -16
  994. package/src/site-logo/index.php +20 -19
  995. package/src/site-logo/style.scss +8 -2
  996. package/src/site-tagline/block.json +7 -2
  997. package/src/site-tagline/deprecated.js +49 -0
  998. package/src/site-tagline/index.js +2 -0
  999. package/src/site-title/block.json +11 -1
  1000. package/src/site-title/deprecated.js +62 -0
  1001. package/src/site-title/index.js +2 -0
  1002. package/src/site-title/index.php +3 -0
  1003. package/src/social-link/editor.scss +4 -0
  1004. package/src/social-links/block.json +1 -0
  1005. package/src/social-links/edit.js +2 -1
  1006. package/src/social-links/editor.scss +4 -0
  1007. package/src/social-links/save.js +4 -6
  1008. package/src/social-links/style.scss +8 -1
  1009. package/src/table/block.json +11 -0
  1010. package/src/template-part/edit/inner-blocks.js +1 -1
  1011. package/src/template-part/edit/placeholder/index.js +5 -3
  1012. package/src/template-part/edit/placeholder/patterns-setup.js +3 -2
  1013. package/src/template-part/edit/selection/template-part-previews.js +3 -1
  1014. package/src/template-part/editor.scss +0 -16
  1015. package/src/template-part/index.php +6 -3
  1016. package/src/template-part/variations.js +2 -2
  1017. package/src/term-description/block.json +4 -1
  1018. package/src/term-description/edit.js +1 -1
  1019. package/src/utils/clean-empty-object.js +23 -0
  1020. package/src/utils/migrate-font-family.js +37 -0
  1021. package/src/verse/block.json +10 -1
  1022. package/src/verse/deprecated.js +86 -25
  1023. package/build/buttons/variations.js +0 -33
  1024. package/build/buttons/variations.js.map +0 -1
  1025. package/build/navigation/block-navigation-list.js.map +0 -1
  1026. package/build/navigation/edit.js +0 -304
  1027. package/build/navigation/edit.js.map +0 -1
  1028. package/build/navigation/placeholder-preview.js.map +0 -1
  1029. package/build/navigation/placeholder.js +0 -129
  1030. package/build/navigation/placeholder.js.map +0 -1
  1031. package/build/navigation/responsive-wrapper.js.map +0 -1
  1032. package/build/navigation/use-block-navigator.js +0 -51
  1033. package/build/navigation/use-block-navigator.js.map +0 -1
  1034. package/build/navigation/variations.js +0 -32
  1035. package/build/navigation/variations.js.map +0 -1
  1036. package/build/post-comment-author/edit.js +0 -51
  1037. package/build/post-comment-author/edit.js.map +0 -1
  1038. package/build/post-comment-author/index.js.map +0 -1
  1039. package/build/post-comment-content/edit.js +0 -37
  1040. package/build/post-comment-content/edit.js.map +0 -1
  1041. package/build/post-comment-content/index.js.map +0 -1
  1042. package/build/post-comment-date/edit.js +0 -62
  1043. package/build/post-comment-date/edit.js.map +0 -1
  1044. package/build/post-comment-date/index.js.map +0 -1
  1045. package/build-module/buttons/variations.js +0 -24
  1046. package/build-module/buttons/variations.js.map +0 -1
  1047. package/build-module/navigation/block-navigation-list.js.map +0 -1
  1048. package/build-module/navigation/edit.js +0 -284
  1049. package/build-module/navigation/edit.js.map +0 -1
  1050. package/build-module/navigation/placeholder-preview.js.map +0 -1
  1051. package/build-module/navigation/placeholder.js +0 -113
  1052. package/build-module/navigation/placeholder.js.map +0 -1
  1053. package/build-module/navigation/responsive-wrapper.js.map +0 -1
  1054. package/build-module/navigation/use-block-navigator.js +0 -39
  1055. package/build-module/navigation/use-block-navigator.js.map +0 -1
  1056. package/build-module/navigation/variations.js +0 -23
  1057. package/build-module/navigation/variations.js.map +0 -1
  1058. package/build-module/post-comment-author/edit.js +0 -40
  1059. package/build-module/post-comment-author/edit.js.map +0 -1
  1060. package/build-module/post-comment-author/index.js +0 -31
  1061. package/build-module/post-comment-author/index.js.map +0 -1
  1062. package/build-module/post-comment-content/edit.js +0 -27
  1063. package/build-module/post-comment-content/edit.js.map +0 -1
  1064. package/build-module/post-comment-content/index.js +0 -31
  1065. package/build-module/post-comment-content/index.js.map +0 -1
  1066. package/build-module/post-comment-date/edit.js +0 -52
  1067. package/build-module/post-comment-date/edit.js.map +0 -1
  1068. package/build-module/post-comment-date/index.js +0 -36
  1069. package/build-module/post-comment-date/index.js.map +0 -1
  1070. package/build-style/post-author/editor-rtl.css +0 -104
  1071. package/build-style/post-author/editor.css +0 -104
  1072. package/build-style/query-title/editor-rtl.css +0 -80
  1073. package/build-style/query-title/editor.css +0 -80
  1074. package/build-style/term-description/editor-rtl.css +0 -80
  1075. package/build-style/term-description/editor.css +0 -80
  1076. package/src/buttons/variations.js +0 -24
  1077. package/src/navigation/block-navigation-list.js +0 -38
  1078. package/src/navigation/edit.js +0 -411
  1079. package/src/navigation/placeholder.js +0 -154
  1080. package/src/navigation/use-block-navigator.js +0 -46
  1081. package/src/navigation/variations.js +0 -23
  1082. package/src/post-author/editor.scss +0 -35
  1083. package/src/post-comment-author/block.json +0 -13
  1084. package/src/post-comment-author/edit.js +0 -35
  1085. package/src/post-comment-author/index.php +0 -41
  1086. package/src/post-comment-content/block.json +0 -13
  1087. package/src/post-comment-content/edit.js +0 -32
  1088. package/src/post-comment-content/index.php +0 -42
  1089. package/src/post-comment-date/block.json +0 -18
  1090. package/src/post-comment-date/edit.js +0 -54
  1091. package/src/post-comment-date/index.php +0 -44
  1092. package/src/query-title/editor.scss +0 -4
  1093. package/src/term-description/editor.scss +0 -4
@@ -0,0 +1,991 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ getEditorHtml,
6
+ initializeEditor,
7
+ fireEvent,
8
+ waitFor,
9
+ within,
10
+ } from 'test/helpers';
11
+ import { Clipboard, Platform } from 'react-native';
12
+
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+ import {
17
+ getBlockTypes,
18
+ setDefaultBlockName,
19
+ unregisterBlockType,
20
+ } from '@wordpress/blocks';
21
+ import fetchRequest from '@wordpress/api-fetch';
22
+ import { store as coreStore } from '@wordpress/core-data';
23
+ import { dispatch } from '@wordpress/data';
24
+ import { requestPreview } from '@wordpress/react-native-bridge';
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ import * as paragraph from '../../paragraph';
30
+ import * as embed from '..';
31
+ import { registerBlock } from '../..';
32
+
33
+ // Override modal mock to prevent unmounting it when is not visible.
34
+ // This is required to be able to trigger onClose and onDismiss events when
35
+ // the modal is dismissed.
36
+ jest.mock( 'react-native-modal', () => {
37
+ const mockComponent = require( 'react-native/jest/mockComponent' );
38
+ return mockComponent( 'react-native-modal' );
39
+ } );
40
+ const MODAL_DISMISS_EVENT = Platform.OS === 'ios' ? 'onDismiss' : 'onModalHide';
41
+
42
+ // oEmbed response mocks
43
+ const RICH_TEXT_EMBED_SUCCESS_RESPONSE = {
44
+ url: 'https://twitter.com/notnownikki',
45
+ html: '<p>Mock success response.</p>',
46
+ type: 'rich',
47
+ provider_name: 'Twitter',
48
+ provider_url: 'https://twitter.com',
49
+ version: '1.0',
50
+ };
51
+ const VIDEO_EMBED_SUCCESS_RESPONSE = {
52
+ url: 'https://www.youtube.com/watch?v=lXMskKTw3Bc',
53
+ html: '<iframe width="16" height="9"></iframe>',
54
+ type: 'video',
55
+ provider_name: 'YouTube',
56
+ provider_url: 'https://youtube.com',
57
+ version: '1.0',
58
+ };
59
+ const MOCK_EMBED_PHOTO_SUCCESS_RESPONSE = {
60
+ url: 'https://cloudup.com/cQFlxqtY4ob',
61
+ html: '<p>Mock success response.</p>',
62
+ type: 'photo',
63
+ provider_name: 'Cloudup',
64
+ provider_url: 'https://cloudup.com',
65
+ version: '1.0',
66
+ };
67
+ const MOCK_BAD_WORDPRESS_RESPONSE = {
68
+ code: 'oembed_invalid_url',
69
+ message: 'Not Found',
70
+ data: {
71
+ status: 404,
72
+ },
73
+ html: false,
74
+ };
75
+ const MOCK_BAD_EMBED_PROVIDER_RESPONSE = {
76
+ url: 'https://youtu.be/BAD_URL',
77
+ html: '<p>Mock bad response.</p>',
78
+ provider_name: 'Embed Provider',
79
+ version: '1.0',
80
+ };
81
+ const EMBED_NULL_RESPONSE = null;
82
+
83
+ // Embed block HTML examples
84
+ const EMPTY_EMBED_HTML = '<!-- wp:embed /-->';
85
+ const RICH_TEXT_EMBED_HTML = `<!-- wp:embed {"url":"https://twitter.com/notnownikki","type":"rich","providerNameSlug":"twitter","responsive":true} -->
86
+ <figure class="wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter"><div class="wp-block-embed__wrapper">
87
+ https://twitter.com/notnownikki
88
+ </div></figure>
89
+ <!-- /wp:embed -->`;
90
+ const RICH_TEXT_ERROR_EMBED_HTML = `<!-- wp:embed {"url":"https://twitter.com/testing","type":"rich","providerNameSlug":"twitter","responsive":true} -->
91
+ <figure class="wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter"><div class="wp-block-embed__wrapper">
92
+ https://twitter.com/testing
93
+ </div></figure>
94
+ <!-- /wp:embed -->`;
95
+ const PHOTO_EMBED_HTML = `<!-- wp:embed {"url":"https://cloudup.com/cQFlxqtY4ob","type":"photo","providerNameSlug":"cloudup","responsive":true} -->
96
+ <figure class="wp-block-embed is-type-photo is-provider-cloudup wp-block-embed-cloudup"><div class="wp-block-embed__wrapper">
97
+ https://cloudup.com/cQFlxqtY4ob
98
+ </div></figure>
99
+ <!-- /wp:embed -->`;
100
+ const WP_EMBED_HTML = `<!-- wp:embed {"url":"https://wordpress.org/news/2021/07/tatum/","type":"wp-embed","providerNameSlug":"wordpress-news"} -->
101
+ <figure class="wp-block-embed is-type-wp-embed is-provider-wordpress-news wp-block-embed-wordpress-news"><div class="wp-block-embed__wrapper">
102
+ https://wordpress.org/news/2021/07/tatum/
103
+ </div></figure>
104
+ <!-- /wp:embed -->`;
105
+
106
+ const EMPTY_PARAGRAPH_HTML =
107
+ '<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->';
108
+
109
+ const MOST_USED_PROVIDERS = embed.settings.variations.filter( ( { name } ) =>
110
+ [ 'youtube', 'twitter', 'wordpress', 'vimeo' ].includes( name )
111
+ );
112
+
113
+ // Return specified mocked responses for the oembed endpoint.
114
+ const mockEmbedResponses = ( mockedResponses ) => {
115
+ fetchRequest.mockImplementation( ( { path } ) => {
116
+ if ( path.startsWith( '/wp/v2/themes' ) ) {
117
+ return Promise.resolve( [
118
+ { theme_supports: { 'responsive-embeds': true } },
119
+ ] );
120
+ }
121
+
122
+ const matchedEmbedResponse = mockedResponses.find(
123
+ ( mockedResponse ) =>
124
+ path ===
125
+ `/oembed/1.0/proxy?url=${ encodeURIComponent(
126
+ mockedResponse.url
127
+ ) }`
128
+ );
129
+ return Promise.resolve( matchedEmbedResponse || {} );
130
+ } );
131
+ };
132
+
133
+ const insertEmbedBlock = async ( blockTitle = 'Embed' ) => {
134
+ const editor = await initializeEditor( {
135
+ initialHtml: '',
136
+ } );
137
+ const { getByA11yLabel, getByText } = editor;
138
+
139
+ // Open inserter menu
140
+ fireEvent.press( await waitFor( () => getByA11yLabel( 'Add block' ) ) );
141
+
142
+ // Insert embed block
143
+ fireEvent.press( await waitFor( () => getByText( blockTitle ) ) );
144
+
145
+ // Return the embed block
146
+ const block = await waitFor( () =>
147
+ getByA11yLabel( /Embed Block\. Row 1/ )
148
+ );
149
+
150
+ return { ...editor, block };
151
+ };
152
+
153
+ const initializeWithEmbedBlock = async ( initialHtml, selectBlock = true ) => {
154
+ const editor = await initializeEditor( { initialHtml } );
155
+ const { getByA11yLabel } = editor;
156
+
157
+ const block = await waitFor( () =>
158
+ getByA11yLabel( /Embed Block\. Row 1/ )
159
+ );
160
+
161
+ if ( selectBlock ) {
162
+ // Select block
163
+ fireEvent.press( block );
164
+ }
165
+
166
+ return { ...editor, block };
167
+ };
168
+
169
+ beforeAll( () => {
170
+ // Paragraph block needs to be registered because by default a paragraph
171
+ // block is added to empty posts.
172
+ registerBlock( paragraph );
173
+ registerBlock( embed );
174
+ setDefaultBlockName( paragraph.name );
175
+ } );
176
+
177
+ beforeEach( () => {
178
+ // Invalidate embed preview resolutions
179
+ dispatch( coreStore ).invalidateResolutionForStoreSelector(
180
+ 'getEmbedPreview'
181
+ );
182
+ // Mock embed responses
183
+ mockEmbedResponses( [
184
+ RICH_TEXT_EMBED_SUCCESS_RESPONSE,
185
+ VIDEO_EMBED_SUCCESS_RESPONSE,
186
+ MOCK_EMBED_PHOTO_SUCCESS_RESPONSE,
187
+ MOCK_BAD_EMBED_PROVIDER_RESPONSE,
188
+ ] );
189
+ } );
190
+
191
+ afterAll( () => {
192
+ // Clean up registered blocks
193
+ getBlockTypes().forEach( ( block ) => {
194
+ unregisterBlockType( block.name );
195
+ } );
196
+ } );
197
+
198
+ describe( 'Embed block', () => {
199
+ describe( 'insertion', () => {
200
+ it( 'inserts generic embed block', async () => {
201
+ const { block } = await insertEmbedBlock();
202
+
203
+ const blockName = within( block ).getByText( 'Embed' );
204
+
205
+ expect( blockName ).toBeDefined();
206
+ expect( getEditorHtml() ).toMatchSnapshot();
207
+ } );
208
+
209
+ MOST_USED_PROVIDERS.forEach( ( { title } ) =>
210
+ it( `inserts ${ title } embed block`, async () => {
211
+ const { block } = await insertEmbedBlock( title );
212
+ const blockName = within( block ).getByText( title );
213
+
214
+ expect( blockName ).toBeDefined();
215
+ expect( getEditorHtml() ).toMatchSnapshot();
216
+ } )
217
+ );
218
+ } );
219
+
220
+ describe( 'set URL upon block insertion', () => {
221
+ it( 'sets empty URL when dismissing edit URL modal', async () => {
222
+ const { getByTestId } = await insertEmbedBlock();
223
+
224
+ // Wait for edit URL modal to be visible
225
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
226
+ await waitFor( () => embedEditURLModal.props.isVisible );
227
+
228
+ // Dismiss the edit URL modal
229
+ fireEvent( embedEditURLModal, 'backdropPress' );
230
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
231
+
232
+ expect( getEditorHtml() ).toMatchSnapshot();
233
+ } );
234
+
235
+ it( 'sets a valid URL when dismissing edit URL modal', async () => {
236
+ const expectedURL = 'https://twitter.com/notnownikki';
237
+
238
+ const {
239
+ getByA11yLabel,
240
+ getByPlaceholderText,
241
+ getByTestId,
242
+ } = await insertEmbedBlock();
243
+
244
+ // Wait for edit URL modal to be visible
245
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
246
+ await waitFor( () => embedEditURLModal.props.isVisible );
247
+
248
+ // Set an URL
249
+ const linkTextInput = getByPlaceholderText( 'Add link' );
250
+ fireEvent( linkTextInput, 'focus' );
251
+ fireEvent.changeText( linkTextInput, expectedURL );
252
+
253
+ // Dismiss the edit URL modal
254
+ fireEvent( embedEditURLModal, 'backdropPress' );
255
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
256
+
257
+ // Wait for block settings button to be present
258
+ const settingsButton = await waitFor( () =>
259
+ getByA11yLabel( 'Open Settings' )
260
+ );
261
+
262
+ expect( settingsButton ).toBeDefined();
263
+ expect( getEditorHtml() ).toMatchSnapshot();
264
+ } );
265
+
266
+ it( 'auto-pastes the URL from clipboard', async () => {
267
+ const clipboardURL = 'https://twitter.com/notnownikki';
268
+
269
+ // Mock clipboard
270
+ Clipboard.getString.mockResolvedValue( clipboardURL );
271
+
272
+ const {
273
+ getByA11yLabel,
274
+ getByTestId,
275
+ getByText,
276
+ } = await insertEmbedBlock();
277
+
278
+ // Wait for edit URL modal to be visible
279
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
280
+ await waitFor( () => embedEditURLModal.props.isVisible );
281
+
282
+ // Get embed link
283
+ const embedLink = await waitFor( () => getByText( clipboardURL ) );
284
+
285
+ // Dismiss the edit URL modal
286
+ fireEvent( embedEditURLModal, 'backdropPress' );
287
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
288
+
289
+ // Wait for block settings button to be present
290
+ const settingsButton = await waitFor( () =>
291
+ getByA11yLabel( 'Open Settings' )
292
+ );
293
+
294
+ expect( embedLink ).toBeDefined();
295
+ expect( settingsButton ).toBeDefined();
296
+ expect( getEditorHtml() ).toMatchSnapshot();
297
+
298
+ Clipboard.getString.mockReset();
299
+ } );
300
+ } );
301
+
302
+ describe( 'set URL when empty block', () => {
303
+ it( 'sets empty URL when dismissing edit URL modal', async () => {
304
+ const { getByTestId, getByText } = await initializeWithEmbedBlock(
305
+ EMPTY_EMBED_HTML
306
+ );
307
+
308
+ // Edit URL
309
+ fireEvent.press( await waitFor( () => getByText( 'ADD LINK' ) ) );
310
+
311
+ // Wait for edit URL modal to be visible
312
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
313
+ await waitFor( () => embedEditURLModal.props.isVisible );
314
+
315
+ // Dismiss the edit URL modal
316
+ fireEvent( embedEditURLModal, 'backdropPress' );
317
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
318
+
319
+ expect( getEditorHtml() ).toMatchSnapshot();
320
+ } );
321
+
322
+ it( 'sets a valid URL when dismissing edit URL modal', async () => {
323
+ const expectedURL = 'https://twitter.com/notnownikki';
324
+
325
+ const {
326
+ getByA11yLabel,
327
+ getByPlaceholderText,
328
+ getByTestId,
329
+ getByText,
330
+ } = await initializeWithEmbedBlock( EMPTY_EMBED_HTML );
331
+
332
+ // Edit URL
333
+ fireEvent.press( getByText( 'ADD LINK' ) );
334
+
335
+ // Wait for edit URL modal to be visible
336
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
337
+ await waitFor( () => embedEditURLModal.props.isVisible );
338
+
339
+ // Set an URL
340
+ const linkTextInput = getByPlaceholderText( 'Add link' );
341
+ fireEvent( linkTextInput, 'focus' );
342
+ fireEvent.changeText( linkTextInput, expectedURL );
343
+
344
+ // Dismiss the edit URL modal
345
+ fireEvent( embedEditURLModal, 'backdropPress' );
346
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
347
+
348
+ // Wait for block settings button to be present
349
+ const settingsButton = await waitFor( () =>
350
+ getByA11yLabel( 'Open Settings' )
351
+ );
352
+
353
+ expect( settingsButton ).toBeDefined();
354
+ expect( getEditorHtml() ).toMatchSnapshot();
355
+ } );
356
+
357
+ it( 'auto-pastes the URL from clipboard', async () => {
358
+ const clipboardURL = 'https://twitter.com/notnownikki';
359
+
360
+ // Mock clipboard
361
+ Clipboard.getString.mockResolvedValue( clipboardURL );
362
+
363
+ const {
364
+ getByA11yLabel,
365
+ getByTestId,
366
+ getByText,
367
+ } = await initializeWithEmbedBlock( EMPTY_EMBED_HTML );
368
+
369
+ // Edit URL
370
+ fireEvent.press( getByText( 'ADD LINK' ) );
371
+
372
+ // Wait for edit URL modal to be visible
373
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
374
+ await waitFor( () => embedEditURLModal.props.isVisible );
375
+
376
+ // Get embed link
377
+ const embedLink = await waitFor( () => getByText( clipboardURL ) );
378
+
379
+ // Dismiss the edit URL modal
380
+ fireEvent( embedEditURLModal, 'backdropPress' );
381
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
382
+
383
+ // Wait for block settings button to be present
384
+ const settingsButton = await waitFor( () =>
385
+ getByA11yLabel( 'Open Settings' )
386
+ );
387
+
388
+ expect( embedLink ).toBeDefined();
389
+ expect( settingsButton ).toBeDefined();
390
+ expect( getEditorHtml() ).toMatchSnapshot();
391
+
392
+ Clipboard.getString.mockReset();
393
+ } );
394
+ } );
395
+
396
+ describe( 'edit URL', () => {
397
+ it( 'keeps the previous URL if no URL is set', async () => {
398
+ const {
399
+ getByA11yLabel,
400
+ getByTestId,
401
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
402
+
403
+ // Edit URL
404
+ fireEvent.press(
405
+ await waitFor( () => getByA11yLabel( 'Edit URL' ) )
406
+ );
407
+
408
+ // Wait for edit URL modal to be visible
409
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
410
+ await waitFor( () => embedEditURLModal.props.isVisible );
411
+
412
+ // Dismiss the edit URL modal
413
+ fireEvent( embedEditURLModal, 'backdropPress' );
414
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
415
+
416
+ expect( getEditorHtml() ).toMatchSnapshot();
417
+ } );
418
+
419
+ it( 'replaces URL', async () => {
420
+ const initialURL = 'https://twitter.com/notnownikki';
421
+ const expectedURL = 'https://www.youtube.com/watch?v=lXMskKTw3Bc';
422
+
423
+ const {
424
+ getByA11yLabel,
425
+ getByDisplayValue,
426
+ getByTestId,
427
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
428
+
429
+ // Edit URL
430
+ fireEvent.press(
431
+ await waitFor( () => getByA11yLabel( 'Edit URL' ) )
432
+ );
433
+
434
+ // Wait for edit URL modal to be visible
435
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
436
+ await waitFor( () => embedEditURLModal.props.isVisible );
437
+
438
+ // Start editing link
439
+ fireEvent.press(
440
+ getByA11yLabel( `Twitter link, ${ initialURL }` )
441
+ );
442
+
443
+ // Replace URL
444
+ const linkTextInput = getByDisplayValue( initialURL );
445
+ fireEvent( linkTextInput, 'focus' );
446
+ fireEvent.changeText( linkTextInput, expectedURL );
447
+
448
+ // Dismiss the edit URL modal
449
+ fireEvent( embedEditURLModal, 'backdropPress' );
450
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
451
+
452
+ // Get YouTube link field
453
+ const youtubeLinkField = await waitFor( () =>
454
+ getByA11yLabel( `YouTube link, ${ expectedURL }` )
455
+ );
456
+
457
+ expect( youtubeLinkField ).toBeDefined();
458
+ expect( getEditorHtml() ).toMatchSnapshot();
459
+ } );
460
+
461
+ it( 'keeps the previous URL if an invalid URL is set', async () => {
462
+ const previousURL = 'https://twitter.com/notnownikki';
463
+ const invalidURL = 'http://';
464
+
465
+ const {
466
+ getByA11yLabel,
467
+ getByDisplayValue,
468
+ getByTestId,
469
+ getByText,
470
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
471
+
472
+ // Edit URL
473
+ fireEvent.press(
474
+ await waitFor( () => getByA11yLabel( 'Edit URL' ) )
475
+ );
476
+
477
+ // Wait for edit URL modal to be visible
478
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
479
+ await waitFor( () => embedEditURLModal.props.isVisible );
480
+
481
+ // Start editing link
482
+ fireEvent.press(
483
+ getByA11yLabel( `Twitter link, ${ previousURL }` )
484
+ );
485
+
486
+ // Replace URL
487
+ const linkTextInput = getByDisplayValue( previousURL );
488
+ fireEvent( linkTextInput, 'focus' );
489
+ fireEvent.changeText( linkTextInput, invalidURL );
490
+
491
+ // Dismiss the edit URL modal
492
+ fireEvent( embedEditURLModal, 'backdropPress' );
493
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
494
+
495
+ const errorNotice = await waitFor( () =>
496
+ getByText( 'Invalid URL. Please enter a valid URL.' )
497
+ );
498
+
499
+ expect( errorNotice ).toBeDefined();
500
+ expect( getEditorHtml() ).toMatchSnapshot();
501
+ } );
502
+
503
+ // This test case covers the bug fixed in PR #35460
504
+ it( 'edits URL after dismissing two times the edit URL bottom sheet with empty value', async () => {
505
+ const { block, getByTestId, getByText } = await insertEmbedBlock();
506
+
507
+ // Wait for edit URL modal to be visible
508
+ const embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
509
+ await waitFor( () => embedEditURLModal.props.isVisible );
510
+
511
+ // Dismiss the edit URL modal
512
+ fireEvent( embedEditURLModal, 'backdropPress' );
513
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
514
+
515
+ // Select block
516
+ fireEvent.press( block );
517
+
518
+ // Edit URL
519
+ fireEvent.press( getByText( 'ADD LINK' ) );
520
+
521
+ // Wait for edit URL modal to be visible
522
+ await waitFor( () => embedEditURLModal.props.isVisible );
523
+
524
+ // Dismiss the edit URL modal
525
+ fireEvent( embedEditURLModal, 'backdropPress' );
526
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
527
+
528
+ // Edit URL
529
+ fireEvent.press( getByText( 'ADD LINK' ) );
530
+
531
+ // Wait for edit URL modal to be visible
532
+ const isVisibleThirdTime = await waitFor(
533
+ () => embedEditURLModal.props.isVisible
534
+ );
535
+
536
+ expect( isVisibleThirdTime ).toBeTruthy();
537
+ } );
538
+
539
+ // This test case covers the bug fixed in PR #35013
540
+ it( 'edits URL when edited after setting a bad URL of a provider', async () => {
541
+ const badURL = 'https://youtu.be/BAD_URL';
542
+ const expectedURL = 'https://twitter.com/notnownikki';
543
+
544
+ const {
545
+ getByA11yLabel,
546
+ getByDisplayValue,
547
+ getByPlaceholderText,
548
+ getByTestId,
549
+ } = await insertEmbedBlock();
550
+
551
+ // Wait for edit URL modal to be visible
552
+ let embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
553
+ await waitFor( () => embedEditURLModal.props.isVisible );
554
+
555
+ // Set an bad URL
556
+ let linkTextInput = getByPlaceholderText( 'Add link' );
557
+ fireEvent( linkTextInput, 'focus' );
558
+ fireEvent.changeText( linkTextInput, badURL );
559
+
560
+ // Dismiss the edit URL modal
561
+ fireEvent( embedEditURLModal, 'backdropPress' );
562
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
563
+
564
+ // Edit URL
565
+ fireEvent.press(
566
+ await waitFor( () => getByA11yLabel( 'Edit URL' ) )
567
+ );
568
+
569
+ // Wait for edit URL modal to be visible
570
+ embedEditURLModal = getByTestId( 'embed-edit-url-modal' );
571
+ await waitFor( () => embedEditURLModal.props.isVisible );
572
+
573
+ // Start editing link
574
+ fireEvent.press( getByA11yLabel( `Embed link, ${ badURL }` ) );
575
+
576
+ // Replace URL
577
+ linkTextInput = getByDisplayValue( badURL );
578
+ fireEvent( linkTextInput, 'focus' );
579
+ fireEvent.changeText( linkTextInput, expectedURL );
580
+
581
+ // Dismiss the edit URL modal
582
+ fireEvent( embedEditURLModal, 'backdropPress' );
583
+ fireEvent( embedEditURLModal, MODAL_DISMISS_EVENT );
584
+
585
+ // Get Twitter link field
586
+ const twitterLinkField = await waitFor( () =>
587
+ getByA11yLabel( `Twitter link, ${ expectedURL }` )
588
+ );
589
+
590
+ expect( twitterLinkField ).toBeDefined();
591
+ expect( getEditorHtml() ).toMatchSnapshot();
592
+ } );
593
+ } );
594
+
595
+ describe( 'alignment options', () => {
596
+ [
597
+ 'Align left',
598
+ 'Align center',
599
+ 'Align right',
600
+ 'Wide width',
601
+ 'Full width',
602
+ ].forEach( ( alignmentOption ) =>
603
+ it( `sets ${ alignmentOption } option`, async () => {
604
+ const {
605
+ getByA11yLabel,
606
+ getByText,
607
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
608
+
609
+ // Open alignment options
610
+ fireEvent.press(
611
+ await waitFor( () => getByA11yLabel( 'Align' ) )
612
+ );
613
+
614
+ // Select alignment option
615
+ fireEvent.press(
616
+ await waitFor( () => getByText( alignmentOption ) )
617
+ );
618
+
619
+ expect( getEditorHtml() ).toMatchSnapshot();
620
+ } )
621
+ );
622
+ } );
623
+
624
+ describe( 'retry', () => {
625
+ it( 'retries loading the preview if initial request failed', async () => {
626
+ // Return bad response for the first request to oembed endpoint
627
+ // and success response for the rest of requests.
628
+ let isFirstEmbedRequest = true;
629
+ fetchRequest.mockImplementation( ( { path } ) => {
630
+ let response = {};
631
+ const isEmbedRequest = path.startsWith( '/oembed/1.0/proxy' );
632
+ if ( isEmbedRequest ) {
633
+ if ( isFirstEmbedRequest ) {
634
+ isFirstEmbedRequest = false;
635
+ response = MOCK_BAD_WORDPRESS_RESPONSE;
636
+ } else {
637
+ response = RICH_TEXT_EMBED_SUCCESS_RESPONSE;
638
+ }
639
+ }
640
+ return Promise.resolve( response );
641
+ } );
642
+
643
+ const {
644
+ getByA11yLabel,
645
+ getByText,
646
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
647
+
648
+ // Retry request
649
+ fireEvent.press( getByText( 'More options' ) );
650
+ fireEvent.press( getByText( 'Retry' ) );
651
+
652
+ // Wait for edit URL button to be present
653
+ const editURLButton = await waitFor( () =>
654
+ getByA11yLabel( 'Edit URL' )
655
+ );
656
+
657
+ expect( editURLButton ).toBeDefined();
658
+ expect( getEditorHtml() ).toMatchSnapshot();
659
+ } );
660
+ it( 'converts to link if preview request failed', async () => {
661
+ // Return bad response for requests to oembed endpoint.
662
+ fetchRequest.mockImplementation( ( { path } ) => {
663
+ const isEmbedRequest = path.startsWith( '/oembed/1.0/proxy' );
664
+ return Promise.resolve(
665
+ isEmbedRequest ? MOCK_BAD_WORDPRESS_RESPONSE : {}
666
+ );
667
+ } );
668
+
669
+ const {
670
+ getByA11yLabel,
671
+ getByText,
672
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
673
+
674
+ // Convert embed to link
675
+ fireEvent.press( getByText( 'More options' ) );
676
+ fireEvent.press( getByText( 'Convert to link' ) );
677
+
678
+ // Get paragraph block where the link is created
679
+ const paragraphBlock = await waitFor( () =>
680
+ getByA11yLabel( /Paragraph Block\. Row 1/ )
681
+ );
682
+
683
+ expect( paragraphBlock ).toBeDefined();
684
+ expect( getEditorHtml() ).toMatchSnapshot();
685
+ } );
686
+ } );
687
+
688
+ describe( 'preview coming soon', () => {
689
+ it( 'previews post for providers which embed preview is not available yet', async () => {
690
+ const { getByText, getByTestId } = await initializeWithEmbedBlock(
691
+ PHOTO_EMBED_HTML
692
+ );
693
+
694
+ // Try to preview the post
695
+ fireEvent.press( getByText( 'PREVIEW POST' ) );
696
+
697
+ // Wait for no preview modal to be visible
698
+ const noPreviewModal = getByTestId( 'embed-no-preview-modal' );
699
+ await waitFor( () => noPreviewModal.props.isVisible );
700
+
701
+ // Preview post
702
+ fireEvent.press( getByText( 'Preview post' ) );
703
+
704
+ // Dismiss the no preview modal
705
+ fireEvent( noPreviewModal, 'backdropPress' );
706
+ fireEvent( noPreviewModal, MODAL_DISMISS_EVENT );
707
+
708
+ expect( requestPreview ).toHaveBeenCalled();
709
+ } );
710
+
711
+ it( 'dismisses no preview modal', async () => {
712
+ const { getByText, getByTestId } = await initializeWithEmbedBlock(
713
+ PHOTO_EMBED_HTML
714
+ );
715
+
716
+ // Try to preview the post
717
+ fireEvent.press( getByText( 'PREVIEW POST' ) );
718
+
719
+ // Wait for no preview modal to be visible
720
+ const noPreviewModal = getByTestId( 'embed-no-preview-modal' );
721
+ await waitFor( () => noPreviewModal.props.isVisible );
722
+
723
+ // Dismiss modal
724
+ fireEvent.press( getByText( 'Dismiss' ) );
725
+
726
+ // Wait for no preview modal to be not visible
727
+ await waitFor( () => ! noPreviewModal.props.isVisible );
728
+
729
+ expect( requestPreview ).not.toHaveBeenCalled();
730
+ } );
731
+ } );
732
+
733
+ describe( 'create by pasting URL', () => {
734
+ it( 'creates embed block when pasting URL in paragraph block', async () => {
735
+ const expectedURL = 'https://www.youtube.com/watch?v=lXMskKTw3Bc';
736
+
737
+ const {
738
+ getByA11yLabel,
739
+ getByPlaceholderText,
740
+ getByTestId,
741
+ getByText,
742
+ } = await initializeEditor( {
743
+ initialHtml: EMPTY_PARAGRAPH_HTML,
744
+ } );
745
+
746
+ // Paste URL in paragraph block
747
+ const paragraphText = getByPlaceholderText( 'Start writing…' );
748
+ fireEvent( paragraphText, 'focus' );
749
+ fireEvent( paragraphText, 'paste', {
750
+ preventDefault: jest.fn(),
751
+ nativeEvent: {
752
+ eventCount: 1,
753
+ target: undefined,
754
+ files: [],
755
+ pastedHtml: expectedURL,
756
+ pastedText: expectedURL,
757
+ },
758
+ } );
759
+
760
+ // Wait for embed handler picker to be visible
761
+ await waitFor(
762
+ () => getByTestId( 'embed-handler-picker' ).props.isVisible
763
+ );
764
+
765
+ // Select create embed option
766
+ fireEvent.press( getByText( 'Create embed' ) );
767
+
768
+ // Get the created embed block
769
+ const embedBlock = await waitFor( () =>
770
+ getByA11yLabel( /Embed Block\. Row 1/ )
771
+ );
772
+
773
+ expect( embedBlock ).toBeDefined();
774
+ expect( getEditorHtml() ).toMatchSnapshot();
775
+ } );
776
+
777
+ it( 'creates link when pasting URL in paragraph block', async () => {
778
+ const expectedURL = 'https://www.youtube.com/watch?v=lXMskKTw3Bc';
779
+
780
+ const {
781
+ getByDisplayValue,
782
+ getByPlaceholderText,
783
+ getByTestId,
784
+ getByText,
785
+ } = await initializeEditor( {
786
+ initialHtml: EMPTY_PARAGRAPH_HTML,
787
+ } );
788
+
789
+ // Paste URL in paragraph block
790
+ const paragraphText = getByPlaceholderText( 'Start writing…' );
791
+ fireEvent( paragraphText, 'focus' );
792
+ fireEvent( paragraphText, 'paste', {
793
+ preventDefault: jest.fn(),
794
+ nativeEvent: {
795
+ eventCount: 1,
796
+ target: undefined,
797
+ files: [],
798
+ pastedHtml: expectedURL,
799
+ pastedText: expectedURL,
800
+ },
801
+ } );
802
+
803
+ // Wait for embed handler picker to be visible
804
+ await waitFor(
805
+ () => getByTestId( 'embed-handler-picker' ).props.isVisible
806
+ );
807
+
808
+ // Select create link option
809
+ fireEvent.press( getByText( 'Create link' ) );
810
+
811
+ // Get the link text
812
+ const linkText = await waitFor( () =>
813
+ getByDisplayValue(
814
+ `<p><a href="${ expectedURL }">${ expectedURL }</a></p>`
815
+ )
816
+ );
817
+
818
+ expect( linkText ).toBeDefined();
819
+ expect( getEditorHtml() ).toMatchSnapshot();
820
+ } );
821
+ } );
822
+
823
+ describe( 'insert via slash inserter', () => {
824
+ it( 'insert generic embed block', async () => {
825
+ const embedBlockSlashInserter = '/Embed';
826
+ const {
827
+ getByPlaceholderText,
828
+ getByA11yLabel,
829
+ getByText,
830
+ } = await initializeEditor( { initialHtml: EMPTY_PARAGRAPH_HTML } );
831
+
832
+ const paragraphText = getByPlaceholderText( 'Start writing…' );
833
+ fireEvent( paragraphText, 'focus' );
834
+ // Trigger onSelectionChange to update both the current text and text selection.
835
+ // This event is required by the autocompleter, as it only displays the slash inserter
836
+ // if the text selection is located at the end of the text, for this reason,
837
+ // the start and end arguments match the text length.
838
+ fireEvent(
839
+ paragraphText,
840
+ 'onSelectionChange',
841
+ embedBlockSlashInserter.length,
842
+ embedBlockSlashInserter.length,
843
+ embedBlockSlashInserter,
844
+ {
845
+ nativeEvent: {
846
+ eventCount: 1,
847
+ target: undefined,
848
+ text: embedBlockSlashInserter,
849
+ },
850
+ }
851
+ );
852
+
853
+ fireEvent.press( await waitFor( () => getByText( 'Embed' ) ) );
854
+
855
+ const block = await waitFor( () =>
856
+ getByA11yLabel( /Embed Block\. Row 1/ )
857
+ );
858
+
859
+ const blockName = within( block ).getByText( 'Embed' );
860
+
861
+ expect( blockName ).toBeDefined();
862
+ expect( getEditorHtml() ).toMatchSnapshot();
863
+ } );
864
+
865
+ MOST_USED_PROVIDERS.forEach( ( { title } ) =>
866
+ it( `inserts ${ title } embed block`, async () => {
867
+ const embedBlockSlashInserter = `/${ title }`;
868
+ const {
869
+ getByPlaceholderText,
870
+ getByA11yLabel,
871
+ getByText,
872
+ } = await initializeEditor( {
873
+ initialHtml: EMPTY_PARAGRAPH_HTML,
874
+ } );
875
+
876
+ const paragraphText = getByPlaceholderText( 'Start writing…' );
877
+ fireEvent( paragraphText, 'focus' );
878
+ // Trigger onSelectionChange to update both the current text and text selection.
879
+ // This event is required by the autocompleter, as it only displays the slash inserter
880
+ // if the text selection is located at the end of the text, for this reason,
881
+ // the start and end arguments match the text length.
882
+ fireEvent(
883
+ paragraphText,
884
+ 'onSelectionChange',
885
+ embedBlockSlashInserter.length,
886
+ embedBlockSlashInserter.length,
887
+ embedBlockSlashInserter,
888
+ {
889
+ nativeEvent: {
890
+ eventCount: 1,
891
+ target: undefined,
892
+ text: embedBlockSlashInserter,
893
+ },
894
+ }
895
+ );
896
+
897
+ fireEvent.press( await waitFor( () => getByText( title ) ) );
898
+
899
+ const block = await waitFor( () =>
900
+ getByA11yLabel( /Embed Block\. Row 1/ )
901
+ );
902
+
903
+ const blockName = within( block ).getByText( title );
904
+
905
+ expect( blockName ).toBeDefined();
906
+ expect( getEditorHtml() ).toMatchSnapshot();
907
+ } )
908
+ );
909
+ } );
910
+
911
+ it( 'sets block caption', async () => {
912
+ const expectedCaption = 'Caption';
913
+
914
+ const {
915
+ getByPlaceholderText,
916
+ getByDisplayValue,
917
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
918
+
919
+ // Set a caption
920
+ const captionField = getByPlaceholderText( 'Add caption' );
921
+ fireEvent( captionField, 'focus' );
922
+ fireEvent( captionField, 'onChange', {
923
+ nativeEvent: {
924
+ eventCount: 1,
925
+ target: undefined,
926
+ text: expectedCaption,
927
+ },
928
+ } );
929
+
930
+ // Get current caption
931
+ const caption = await waitFor( () =>
932
+ getByDisplayValue( `<p>${ expectedCaption }</p>` )
933
+ );
934
+
935
+ expect( caption ).toBeDefined();
936
+ expect( getEditorHtml() ).toMatchSnapshot();
937
+ } );
938
+
939
+ it( 'displays cannot embed on the placeholder if preview data is null', async () => {
940
+ // Return null response for requests to oembed endpoint.
941
+ fetchRequest.mockImplementation( ( { path } ) => {
942
+ const isEmbedRequest = path.startsWith( '/oembed/1.0/proxy' );
943
+ return Promise.resolve( isEmbedRequest ? EMBED_NULL_RESPONSE : {} );
944
+ } );
945
+
946
+ const { getByText } = await initializeWithEmbedBlock(
947
+ RICH_TEXT_ERROR_EMBED_HTML
948
+ );
949
+
950
+ const cannotEmbedText = getByText( 'Unable to embed media' );
951
+
952
+ expect( cannotEmbedText ).toBeDefined();
953
+ expect( getEditorHtml() ).toMatchSnapshot();
954
+ } );
955
+
956
+ describe( 'block settings', () => {
957
+ it( 'toggles resize for smaller devices media settings', async () => {
958
+ const {
959
+ getByA11yLabel,
960
+ getByText,
961
+ } = await initializeWithEmbedBlock( RICH_TEXT_EMBED_HTML );
962
+
963
+ fireEvent.press(
964
+ await waitFor( () => getByA11yLabel( 'Open Settings' ) )
965
+ );
966
+
967
+ fireEvent.press(
968
+ await waitFor( () => getByText( /Resize for smaller devices/ ) )
969
+ );
970
+
971
+ expect( getEditorHtml() ).toMatchSnapshot();
972
+ } );
973
+
974
+ it( 'does not show settings button if responsive is not supported', async () => {
975
+ const { getByA11yLabel } = await initializeWithEmbedBlock(
976
+ WP_EMBED_HTML
977
+ );
978
+
979
+ let settingsButton;
980
+ try {
981
+ settingsButton = await waitFor( () =>
982
+ getByA11yLabel( 'Open Settings' )
983
+ );
984
+ } catch ( e ) {
985
+ // NOOP
986
+ }
987
+
988
+ expect( settingsButton ).not.toBeDefined();
989
+ } );
990
+ } );
991
+ } );