@wordpress/block-editor 15.21.0 → 15.21.1

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 (407) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/build/components/block-compare/index.cjs +2 -2
  3. package/build/components/block-compare/index.cjs.map +2 -2
  4. package/build/components/block-patterns-list/index.cjs +1 -1
  5. package/build/components/block-patterns-list/index.cjs.map +2 -2
  6. package/build/components/block-switcher/block-transformations-menu.cjs +16 -15
  7. package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
  8. package/build/components/block-switcher/index.cjs +4 -4
  9. package/build/components/block-switcher/index.cjs.map +2 -2
  10. package/build/components/global-styles/advanced-panel.cjs +23 -15
  11. package/build/components/global-styles/advanced-panel.cjs.map +2 -2
  12. package/build/components/global-styles/background-panel.cjs +2 -2
  13. package/build/components/global-styles/background-panel.cjs.map +2 -2
  14. package/build/components/global-styles/border-panel.cjs +2 -0
  15. package/build/components/global-styles/border-panel.cjs.map +2 -2
  16. package/build/components/global-styles/dimensions-panel.cjs +1 -1
  17. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  18. package/build/components/inner-blocks/use-inner-block-template-sync.cjs +3 -1
  19. package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
  20. package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
  21. package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
  22. package/build/components/inserter/index.cjs +179 -220
  23. package/build/components/inserter/index.cjs.map +3 -3
  24. package/build/components/inserter/search-results.cjs +1 -1
  25. package/build/components/inserter/search-results.cjs.map +2 -2
  26. package/build/components/list-view/block-select-button.cjs +10 -12
  27. package/build/components/list-view/block-select-button.cjs.map +2 -2
  28. package/build/components/list-view/block.cjs +2 -1
  29. package/build/components/list-view/block.cjs.map +2 -2
  30. package/build/components/provider/use-block-sync.cjs +11 -2
  31. package/build/components/provider/use-block-sync.cjs.map +2 -2
  32. package/build/components/rich-text/event-listeners/before-input-rules.cjs +4 -4
  33. package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
  34. package/build/components/rich-text/event-listeners/delete.cjs +4 -4
  35. package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
  36. package/build/components/rich-text/event-listeners/enter.cjs +7 -2
  37. package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
  38. package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
  39. package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
  40. package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
  41. package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
  42. package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
  43. package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
  44. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
  45. package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
  46. package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
  47. package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
  48. package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
  49. package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
  50. package/build/components/rich-text/index.cjs +1 -23
  51. package/build/components/rich-text/index.cjs.map +2 -2
  52. package/build/components/use-block-commands/index.cjs +5 -5
  53. package/build/components/use-block-commands/index.cjs.map +2 -2
  54. package/build/hooks/anchor.cjs +11 -15
  55. package/build/hooks/anchor.cjs.map +2 -2
  56. package/build/hooks/border.cjs +0 -3
  57. package/build/hooks/border.cjs.map +2 -2
  58. package/build/hooks/color.cjs +1 -4
  59. package/build/hooks/color.cjs.map +2 -2
  60. package/build/hooks/dimensions.cjs +0 -3
  61. package/build/hooks/dimensions.cjs.map +2 -2
  62. package/build/hooks/fit-text.cjs +11 -0
  63. package/build/hooks/fit-text.cjs.map +2 -2
  64. package/build/hooks/position.cjs +19 -22
  65. package/build/hooks/position.cjs.map +2 -2
  66. package/build/hooks/supports.cjs +0 -7
  67. package/build/hooks/supports.cjs.map +2 -2
  68. package/build/store/actions.cjs +7 -3
  69. package/build/store/actions.cjs.map +2 -2
  70. package/build/store/private-actions.cjs +1 -2
  71. package/build/store/private-actions.cjs.map +2 -2
  72. package/build/store/private-selectors.cjs +23 -0
  73. package/build/store/private-selectors.cjs.map +2 -2
  74. package/build/store/reducer.cjs +14 -6
  75. package/build/store/reducer.cjs.map +2 -2
  76. package/build/store/selectors.cjs +60 -41
  77. package/build/store/selectors.cjs.map +2 -2
  78. package/build-module/components/block-compare/index.mjs +1 -1
  79. package/build-module/components/block-compare/index.mjs.map +2 -2
  80. package/build-module/components/block-patterns-list/index.mjs +1 -1
  81. package/build-module/components/block-patterns-list/index.mjs.map +2 -2
  82. package/build-module/components/block-switcher/block-transformations-menu.mjs +16 -15
  83. package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
  84. package/build-module/components/block-switcher/index.mjs +4 -4
  85. package/build-module/components/block-switcher/index.mjs.map +2 -2
  86. package/build-module/components/global-styles/advanced-panel.mjs +23 -15
  87. package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
  88. package/build-module/components/global-styles/background-panel.mjs +3 -3
  89. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  90. package/build-module/components/global-styles/border-panel.mjs +2 -0
  91. package/build-module/components/global-styles/border-panel.mjs.map +2 -2
  92. package/build-module/components/global-styles/dimensions-panel.mjs +2 -2
  93. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  94. package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +3 -1
  95. package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
  96. package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
  97. package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
  98. package/build-module/components/inserter/index.mjs +185 -222
  99. package/build-module/components/inserter/index.mjs.map +3 -3
  100. package/build-module/components/inserter/search-results.mjs +1 -1
  101. package/build-module/components/inserter/search-results.mjs.map +2 -2
  102. package/build-module/components/list-view/block-select-button.mjs +10 -12
  103. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  104. package/build-module/components/list-view/block.mjs +2 -1
  105. package/build-module/components/list-view/block.mjs.map +2 -2
  106. package/build-module/components/provider/use-block-sync.mjs +11 -2
  107. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  108. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +4 -4
  109. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
  110. package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
  111. package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
  112. package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
  113. package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
  114. package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
  115. package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
  116. package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
  117. package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
  118. package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
  119. package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
  120. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
  121. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
  122. package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
  123. package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
  124. package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
  125. package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
  126. package/build-module/components/rich-text/index.mjs +1 -23
  127. package/build-module/components/rich-text/index.mjs.map +2 -2
  128. package/build-module/components/use-block-commands/index.mjs +5 -5
  129. package/build-module/components/use-block-commands/index.mjs.map +2 -2
  130. package/build-module/hooks/anchor.mjs +11 -15
  131. package/build-module/hooks/anchor.mjs.map +2 -2
  132. package/build-module/hooks/border.mjs +1 -4
  133. package/build-module/hooks/border.mjs.map +2 -2
  134. package/build-module/hooks/color.mjs +2 -5
  135. package/build-module/hooks/color.mjs.map +2 -2
  136. package/build-module/hooks/dimensions.mjs +1 -4
  137. package/build-module/hooks/dimensions.mjs.map +2 -2
  138. package/build-module/hooks/fit-text.mjs +11 -0
  139. package/build-module/hooks/fit-text.mjs.map +2 -2
  140. package/build-module/hooks/position.mjs +20 -23
  141. package/build-module/hooks/position.mjs.map +2 -2
  142. package/build-module/hooks/supports.mjs +0 -7
  143. package/build-module/hooks/supports.mjs.map +2 -2
  144. package/build-module/store/actions.mjs +7 -3
  145. package/build-module/store/actions.mjs.map +2 -2
  146. package/build-module/store/private-actions.mjs +1 -2
  147. package/build-module/store/private-actions.mjs.map +2 -2
  148. package/build-module/store/private-selectors.mjs +21 -0
  149. package/build-module/store/private-selectors.mjs.map +2 -2
  150. package/build-module/store/reducer.mjs +14 -6
  151. package/build-module/store/reducer.mjs.map +2 -2
  152. package/build-module/store/selectors.mjs +62 -42
  153. package/build-module/store/selectors.mjs.map +2 -2
  154. package/build-style/content-rtl.css +12 -0
  155. package/build-style/content.css +12 -0
  156. package/build-style/style-rtl.css +26 -8
  157. package/build-style/style.css +26 -8
  158. package/package.json +49 -46
  159. package/src/components/block-breadcrumb/README.md +2 -2
  160. package/src/components/block-compare/README.md +6 -6
  161. package/src/components/block-compare/index.js +1 -3
  162. package/src/components/block-patterns-list/index.js +1 -1
  163. package/src/components/block-preview/README.md +1 -1
  164. package/src/components/block-switcher/block-transformations-menu.js +16 -18
  165. package/src/components/block-switcher/index.js +4 -4
  166. package/src/components/block-types-list/README.md +0 -19
  167. package/src/components/global-styles/advanced-panel.js +5 -1
  168. package/src/components/global-styles/background-panel.js +3 -3
  169. package/src/components/global-styles/border-panel.js +2 -0
  170. package/src/components/global-styles/dimensions-panel.js +12 -13
  171. package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -1
  172. package/src/components/inserter/hooks/use-patterns-state.js +1 -1
  173. package/src/components/inserter/index.js +257 -288
  174. package/src/components/inserter/search-results.js +1 -3
  175. package/src/components/justify-content-control/README.md +1 -1
  176. package/src/components/list-view/block-select-button.js +9 -13
  177. package/src/components/list-view/block.js +1 -0
  178. package/src/components/media-placeholder/README.md +1 -29
  179. package/src/components/media-upload/README.md +0 -19
  180. package/src/components/provider/test/use-block-sync.js +40 -0
  181. package/src/components/provider/use-block-sync.js +12 -2
  182. package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
  183. package/src/components/rich-text/event-listeners/delete.js +9 -4
  184. package/src/components/rich-text/event-listeners/enter.js +9 -2
  185. package/src/components/rich-text/event-listeners/input-events.js +13 -4
  186. package/src/components/rich-text/event-listeners/input-rules.js +20 -4
  187. package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
  188. package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
  189. package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
  190. package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
  191. package/src/components/rich-text/index.js +1 -33
  192. package/src/components/unit-control/README.md +1 -1
  193. package/src/components/url-popover/README.md +1 -1
  194. package/src/components/use-block-commands/index.js +5 -5
  195. package/src/hooks/anchor.js +9 -17
  196. package/src/hooks/border.js +1 -5
  197. package/src/hooks/color.js +1 -6
  198. package/src/hooks/dimensions.js +1 -5
  199. package/src/hooks/fit-text.js +16 -0
  200. package/src/hooks/position.js +23 -27
  201. package/src/hooks/supports.js +0 -9
  202. package/src/store/actions.js +13 -3
  203. package/src/store/private-actions.js +1 -4
  204. package/src/store/private-selectors.js +42 -0
  205. package/src/store/reducer.js +19 -7
  206. package/src/store/selectors.js +91 -53
  207. package/src/store/test/actions.js +21 -0
  208. package/src/store/test/reducer.js +46 -0
  209. package/src/store/test/selectors.js +77 -0
  210. package/build/components/media-upload-progress/constants.cjs +0 -46
  211. package/build/components/media-upload-progress/constants.cjs.map +0 -7
  212. package/build/components/rich-text/native/format-edit.cjs +0 -60
  213. package/build/components/rich-text/native/format-edit.cjs.map +0 -7
  214. package/build/components/rich-text/native/index.cjs +0 -28
  215. package/build/components/rich-text/native/index.cjs.map +0 -7
  216. package/build/components/rich-text/native/use-format-types.cjs +0 -139
  217. package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
  218. package/build-module/components/media-upload-progress/constants.mjs +0 -16
  219. package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
  220. package/build-module/components/rich-text/native/format-edit.mjs +0 -39
  221. package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
  222. package/build-module/components/rich-text/native/index.mjs +0 -7
  223. package/build-module/components/rich-text/native/index.mjs.map +0 -7
  224. package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
  225. package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
  226. package/src/components/audio-player/audio-url-parser.native.js +0 -20
  227. package/src/components/audio-player/index.native.js +0 -225
  228. package/src/components/audio-player/styles.native.scss +0 -114
  229. package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
  230. package/src/components/block-alignment-control/test/index.native.js +0 -37
  231. package/src/components/block-alignment-control/ui.native.js +0 -86
  232. package/src/components/block-caption/README.md +0 -104
  233. package/src/components/block-caption/index.native.js +0 -89
  234. package/src/components/block-caption/styles.native.scss +0 -7
  235. package/src/components/block-controls/slot.native.js +0 -33
  236. package/src/components/block-draggable/draggable-chip.native.js +0 -49
  237. package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
  238. package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
  239. package/src/components/block-draggable/index.native.js +0 -467
  240. package/src/components/block-draggable/style.native.scss +0 -19
  241. package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
  242. package/src/components/block-draggable/test/helpers.native.js +0 -182
  243. package/src/components/block-draggable/test/index.native.js +0 -419
  244. package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
  245. package/src/components/block-edit/edit.native.js +0 -49
  246. package/src/components/block-edit/test/edit.native.js +0 -65
  247. package/src/components/block-heading-level-dropdown/index.native.js +0 -68
  248. package/src/components/block-icon/index.native.js +0 -47
  249. package/src/components/block-icon/style.native.scss +0 -7
  250. package/src/components/block-list/block-crash-boundary.native.js +0 -43
  251. package/src/components/block-list/block-crash-warning.native.js +0 -21
  252. package/src/components/block-list/block-invalid-warning.native.js +0 -70
  253. package/src/components/block-list/block-list-context.native.js +0 -172
  254. package/src/components/block-list/block-list-item-cell.native.js +0 -62
  255. package/src/components/block-list/block-list-item.native.js +0 -209
  256. package/src/components/block-list/block-list-item.native.scss +0 -16
  257. package/src/components/block-list/block-outline.native.js +0 -77
  258. package/src/components/block-list/block-selection-button.native.js +0 -100
  259. package/src/components/block-list/block-selection-button.native.scss +0 -34
  260. package/src/components/block-list/block.native.js +0 -716
  261. package/src/components/block-list/block.native.scss +0 -62
  262. package/src/components/block-list/grid-item.native.js +0 -58
  263. package/src/components/block-list/index.native.js +0 -437
  264. package/src/components/block-list/insertion-point.native.js +0 -36
  265. package/src/components/block-list/style.native.scss +0 -117
  266. package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
  267. package/src/components/block-list/test/block-list-context.native.js +0 -243
  268. package/src/components/block-list/test/block-outline.native.js +0 -255
  269. package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
  270. package/src/components/block-list/test/index.native.js +0 -205
  271. package/src/components/block-list/use-block-props/index.native.js +0 -10
  272. package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
  273. package/src/components/block-list-appender/index.native.js +0 -70
  274. package/src/components/block-list-appender/style.native.scss +0 -8
  275. package/src/components/block-media-update-progress/README.md +0 -100
  276. package/src/components/block-media-update-progress/index.native.js +0 -299
  277. package/src/components/block-media-update-progress/styles.native.scss +0 -9
  278. package/src/components/block-media-update-progress/test/index.native.js +0 -543
  279. package/src/components/block-mover/index.native.js +0 -193
  280. package/src/components/block-mover/mover-description.native.js +0 -155
  281. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
  282. package/src/components/block-mover/test/index.native.js +0 -186
  283. package/src/components/block-settings/button.native.js +0 -41
  284. package/src/components/block-settings/container.native.js +0 -91
  285. package/src/components/block-settings/container.native.scss +0 -4
  286. package/src/components/block-settings/index.native.js +0 -5
  287. package/src/components/block-styles/index.native.js +0 -94
  288. package/src/components/block-styles/preview.native.js +0 -109
  289. package/src/components/block-styles/style.native.scss +0 -64
  290. package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
  291. package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
  292. package/src/components/block-toolbar/index.native.js +0 -126
  293. package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
  294. package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
  295. package/src/components/block-toolbar/test/index.native.js +0 -36
  296. package/src/components/block-types-list/index.native.js +0 -175
  297. package/src/components/block-types-list/style.native.scss +0 -25
  298. package/src/components/block-variation-picker/index.native.js +0 -107
  299. package/src/components/block-variation-picker/style.native.scss +0 -32
  300. package/src/components/button-block-appender/index.native.js +0 -92
  301. package/src/components/button-block-appender/styles.native.scss +0 -43
  302. package/src/components/caption/README.md +0 -44
  303. package/src/components/caption/index.native.js +0 -61
  304. package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
  305. package/src/components/contrast-checker/index.native.js +0 -113
  306. package/src/components/contrast-checker/style.native.scss +0 -26
  307. package/src/components/convert-to-group-buttons/index.native.js +0 -79
  308. package/src/components/default-block-appender/index.native.js +0 -113
  309. package/src/components/default-block-appender/style.native.scss +0 -18
  310. package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
  311. package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
  312. package/src/components/floating-toolbar/index.native.js +0 -141
  313. package/src/components/floating-toolbar/styles.native.scss +0 -43
  314. package/src/components/font-sizes/index.native.js +0 -7
  315. package/src/components/global-styles/color-panel.native.js +0 -207
  316. package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
  317. package/src/components/global-styles/use-global-styles-context.native.js +0 -592
  318. package/src/components/gradients/index.native.js +0 -2
  319. package/src/components/image-link-destinations/index.native.js +0 -152
  320. package/src/components/image-link-destinations/style.native.scss +0 -16
  321. package/src/components/index.native.js +0 -108
  322. package/src/components/inner-blocks/constants.native.js +0 -5
  323. package/src/components/inner-blocks/index.native.js +0 -221
  324. package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
  325. package/src/components/inserter/block-types-tab.native.js +0 -76
  326. package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
  327. package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
  328. package/src/components/inserter/index.native.js +0 -424
  329. package/src/components/inserter/menu.native.js +0 -237
  330. package/src/components/inserter/no-results.native.js +0 -49
  331. package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
  332. package/src/components/inserter/search-results.native.js +0 -67
  333. package/src/components/inserter/style.native.scss +0 -83
  334. package/src/components/inserter/tabs.native.js +0 -152
  335. package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
  336. package/src/components/inserter/test/fixtures/index.native.js +0 -12
  337. package/src/components/inserter/test/index.native.js +0 -273
  338. package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
  339. package/src/components/inserter/test/utils.native.js +0 -37
  340. package/src/components/inserter/utils.native.js +0 -46
  341. package/src/components/inserter-button/index.native.js +0 -108
  342. package/src/components/inserter-button/style.native.scss +0 -72
  343. package/src/components/inspector-controls/fill.native.js +0 -62
  344. package/src/components/inspector-controls/slot.native.js +0 -35
  345. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
  346. package/src/components/line-height-control/index.native.js +0 -28
  347. package/src/components/media-placeholder/index.native.js +0 -258
  348. package/src/components/media-placeholder/styles.native.scss +0 -108
  349. package/src/components/media-replace-flow/index.native.js +0 -12
  350. package/src/components/media-upload/constants.native.js +0 -14
  351. package/src/components/media-upload/index.native.js +0 -356
  352. package/src/components/media-upload/style.native.scss +0 -4
  353. package/src/components/media-upload/test/index.native.js +0 -172
  354. package/src/components/media-upload-progress/README.md +0 -100
  355. package/src/components/media-upload-progress/constants.js +0 -6
  356. package/src/components/media-upload-progress/index.native.js +0 -233
  357. package/src/components/media-upload-progress/styles.native.scss +0 -15
  358. package/src/components/media-upload-progress/test/index.native.js +0 -220
  359. package/src/components/plain-text/index.native.js +0 -164
  360. package/src/components/plain-text/style.native.scss +0 -10
  361. package/src/components/provider/index.native.js +0 -32
  362. package/src/components/rich-text/embed-handler-picker.native.js +0 -65
  363. package/src/components/rich-text/file-paste-handler.native.js +0 -3
  364. package/src/components/rich-text/format-toolbar/index.native.js +0 -21
  365. package/src/components/rich-text/format-toolbar-container.native.js +0 -16
  366. package/src/components/rich-text/index.native.js +0 -701
  367. package/src/components/rich-text/input-event.native.js +0 -10
  368. package/src/components/rich-text/native/format-edit.js +0 -44
  369. package/src/components/rich-text/native/get-format-colors.native.js +0 -47
  370. package/src/components/rich-text/native/index.js +0 -1
  371. package/src/components/rich-text/native/index.native.js +0 -1389
  372. package/src/components/rich-text/native/style.native.scss +0 -28
  373. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
  374. package/src/components/rich-text/native/test/index.native.js +0 -345
  375. package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
  376. package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
  377. package/src/components/rich-text/native/use-format-types.js +0 -146
  378. package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
  379. package/src/components/rich-text/shortcut.native.js +0 -10
  380. package/src/components/ungroup-button/README.md +0 -23
  381. package/src/components/ungroup-button/index.native.js +0 -77
  382. package/src/components/unsupported-block-details/index.native.js +0 -187
  383. package/src/components/unsupported-block-details/style.native.scss +0 -56
  384. package/src/components/url-input/index.native.js +0 -33
  385. package/src/components/use-block-drop-zone/index.native.js +0 -207
  386. package/src/components/use-on-block-drop/index.native.js +0 -115
  387. package/src/components/use-unsupported-block-editor/index.native.js +0 -59
  388. package/src/components/video-player/gridicon-play.native.js +0 -13
  389. package/src/components/video-player/index.native.js +0 -133
  390. package/src/components/video-player/styles.native.scss +0 -29
  391. package/src/components/warning/index.native.js +0 -64
  392. package/src/components/warning/style.native.scss +0 -47
  393. package/src/hooks/align.native.js +0 -49
  394. package/src/hooks/custom-class-name.native.js +0 -70
  395. package/src/hooks/index.native.js +0 -36
  396. package/src/hooks/layout.native.js +0 -23
  397. package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
  398. package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
  399. package/src/hooks/test/align.native.js +0 -134
  400. package/src/hooks/test/anchor.native.js +0 -32
  401. package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
  402. package/src/hooks/typography.native.js +0 -60
  403. package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
  404. package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
  405. package/src/index.native.js +0 -6
  406. package/src/private-apis.native.js +0 -21
  407. package/src/store/defaults.native.js +0 -23
@@ -1,182 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import {
5
- act,
6
- advanceAnimationByFrames,
7
- fireEvent,
8
- initializeEditor,
9
- screen,
10
- waitForStoreResolvers,
11
- within,
12
- } from 'test/helpers';
13
- import { fireGestureHandler } from 'react-native-gesture-handler/jest-utils';
14
- import { State } from 'react-native-gesture-handler';
15
-
16
- // Touch event type constants have been extracted from original source code, as they are not exported in the package.
17
- // Reference: https://github.com/software-mansion/react-native-gesture-handler/blob/90895e5f38616a6be256fceec6c6a391cd9ad7c7/src/TouchEventType.ts
18
- export const TouchEventType = {
19
- UNDETERMINED: 0,
20
- TOUCHES_DOWN: 1,
21
- TOUCHES_MOVE: 2,
22
- TOUCHES_UP: 3,
23
- TOUCHES_CANCELLED: 4,
24
- };
25
-
26
- const DEFAULT_TOUCH_EVENTS = [
27
- {
28
- id: 1,
29
- eventType: TouchEventType.TOUCHES_DOWN,
30
- x: 0,
31
- y: 0,
32
- },
33
- ];
34
-
35
- /**
36
- * @typedef {Object} WPBlockWithLayout
37
- * @property {string} name Name of the block (e.g. Paragraph).
38
- * @property {string} html HTML content.
39
- * @property {Object} layout Layout data.
40
- * @property {Object} layout.x X position.
41
- * @property {Object} layout.y Y position.
42
- * @property {Object} layout.width Width.
43
- * @property {Object} layout.height Height.
44
- */
45
-
46
- /**
47
- * Initialize the editor with an array of blocks that include their HTML and layout.
48
- *
49
- * @param {WPBlockWithLayout[]} blocks Initial blocks.
50
- *
51
- * @return {import('@testing-library/react-native').RenderAPI} The Testing Library screen.
52
- */
53
- export const initializeWithBlocksLayouts = async ( blocks ) => {
54
- const initialHtml = blocks.map( ( block ) => block.html ).join( '\n' );
55
-
56
- await initializeEditor( { initialHtml } );
57
-
58
- const waitPromises = [];
59
- const blockListItems = screen.getAllByTestId( 'block-list-item-cell' );
60
- // Check that rendered block list items match expected block count.
61
- expect( blockListItems.length ).toBe( blocks.length );
62
-
63
- blocks.forEach( ( block, index ) => {
64
- const element = blockListItems[ index ];
65
- // "onLayout" event will populate the blocks layouts data.
66
- fireEvent( element, 'layout', {
67
- nativeEvent: { layout: block.layout },
68
- } );
69
- if ( block.nestedBlocks ) {
70
- // Nested blocks are rendered via the FlatList of the inner block list.
71
- // In order to render the items of a FlatList, it's required to trigger the
72
- // "onLayout" event. Additionally, the call is wrapped over "waitForStoreResolvers"
73
- // because the nested blocks might make API requests (e.g. the Gallery block).
74
- waitPromises.push(
75
- waitForStoreResolvers( () =>
76
- fireEvent(
77
- within( element ).getByTestId( 'block-list-wrapper' ),
78
- 'layout',
79
- {
80
- nativeEvent: {
81
- layout: {
82
- width: block.layout.width,
83
- height: block.layout.height,
84
- },
85
- },
86
- }
87
- )
88
- )
89
- );
90
-
91
- block.nestedBlocks.forEach( ( nestedBlock, nestedIndex ) => {
92
- const nestedA11yLabel = new RegExp(
93
- `${ nestedBlock.name } Block\\. Row ${ nestedIndex + 1 }`
94
- );
95
- const [ nestedElement ] =
96
- within( element ).getAllByLabelText( nestedA11yLabel );
97
- fireEvent( nestedElement, 'layout', {
98
- nativeEvent: { layout: nestedBlock.layout },
99
- } );
100
- } );
101
- }
102
- } );
103
- await Promise.all( waitPromises );
104
-
105
- return screen;
106
- };
107
-
108
- /**
109
- * Fires long-press gesture event on a block.
110
- *
111
- * @param {ReturnType<import('@testing-library/react-native').RenderAPI['getByTestId']>} block Block test instance.
112
- * @param {string} testID Id for querying the draggable trigger element.
113
- * @param {Object} [options] Configuration options for the gesture event.
114
- * @param {boolean} [options.failed] Determines if the gesture should fail.
115
- * @param {number} [options.triggerIndex] In case there are multiple draggable triggers, this specifies the index to use.
116
- */
117
- export const fireLongPress = (
118
- block,
119
- testID,
120
- { failed = false, triggerIndex } = {}
121
- ) => {
122
- const draggableTrigger =
123
- typeof triggerIndex !== 'undefined'
124
- ? within( block ).getAllByTestId( testID )[ triggerIndex ]
125
- : within( block ).getByTestId( testID );
126
- if ( failed ) {
127
- fireGestureHandler( draggableTrigger, [ { state: State.FAILED } ] );
128
- } else {
129
- fireGestureHandler( draggableTrigger, [
130
- { oldState: State.BEGAN, state: State.ACTIVE },
131
- { state: State.ACTIVE },
132
- { state: State.END },
133
- ] );
134
- }
135
- // Advance timers one frame to ensure that shared values
136
- // are updated and trigger animation reactions.
137
- act( () => advanceAnimationByFrames( 1 ) );
138
- };
139
-
140
- /**
141
- * Fires pan gesture event on a BlockDraggable component.
142
- *
143
- * @param {ReturnType<import('@testing-library/react-native').RenderAPI['getByTestId']>} blockDraggable BlockDraggable test instance.
144
- * @param {Object} [touchEvents] Array of touch events to dispatch on the pan gesture.
145
- */
146
- export const firePanGesture = (
147
- blockDraggable,
148
- touchEvents = DEFAULT_TOUCH_EVENTS
149
- ) => {
150
- const gestureTouchEvents = touchEvents.map(
151
- ( { eventType, ...touchEvent } ) => ( {
152
- allTouches: [ touchEvent ],
153
- eventType,
154
- } )
155
- );
156
- fireGestureHandler( blockDraggable, [
157
- // TOUCHES_DOWN event is only received on ACTIVE state, so we have to fire it manually.
158
- { oldState: State.BEGAN, state: State.ACTIVE },
159
- ...gestureTouchEvents,
160
- { state: State.END },
161
- ] );
162
- // Advance timers one frame to ensure that shared values
163
- // are updated and trigger animation reactions.
164
- act( () => advanceAnimationByFrames( 1 ) );
165
- };
166
-
167
- /**
168
- * Gets the draggable chip element.
169
- *
170
- * @param {import('@testing-library/react-native').RenderAPI} screen The Testing Library screen.
171
- *
172
- * @return {ReturnType<import('@testing-library/react-native').RenderAPI['getByTestId']>} Draggable chip test instance.
173
- */
174
- export const getDraggableChip = ( { getByTestId } ) => {
175
- let draggableChip;
176
- try {
177
- draggableChip = getByTestId( 'draggable-chip' );
178
- } catch {
179
- // NOOP.
180
- }
181
- return draggableChip;
182
- };
@@ -1,419 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import {
5
- fireEvent,
6
- getEditorHtml,
7
- within,
8
- waitForStoreResolvers,
9
- withReanimatedTimer,
10
- } from 'test/helpers';
11
- import { getByGestureTestId } from 'react-native-gesture-handler/jest-utils';
12
- import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState';
13
-
14
- /**
15
- * WordPress dependencies
16
- */
17
- import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
18
- import { registerCoreBlocks } from '@wordpress/block-library';
19
-
20
- /**
21
- * Internal dependencies
22
- */
23
- import {
24
- initializeWithBlocksLayouts,
25
- fireLongPress,
26
- firePanGesture,
27
- TouchEventType,
28
- getDraggableChip,
29
- } from './helpers';
30
-
31
- beforeAll( () => {
32
- // Register all core blocks
33
- registerCoreBlocks();
34
- } );
35
-
36
- afterAll( () => {
37
- // Clean up registered blocks
38
- getBlockTypes().forEach( ( block ) => {
39
- unregisterBlockType( block.name );
40
- } );
41
- } );
42
-
43
- const TOUCH_EVENT_ID = 1;
44
- const BLOCKS = [
45
- {
46
- name: 'Paragraph',
47
- html: `
48
- <!-- wp:paragraph -->
49
- <p>This is a paragraph.</p>
50
- <!-- /wp:paragraph -->`,
51
- layout: { x: 0, y: 0, width: 100, height: 100 },
52
- },
53
- {
54
- name: 'Image',
55
- html: `
56
- <!-- wp:image {"sizeSlug":"large"} -->
57
- <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
58
- <!-- /wp:image -->`,
59
- layout: { x: 0, y: 100, width: 100, height: 100 },
60
- },
61
- {
62
- name: 'Spacer',
63
- html: `
64
- <!-- wp:spacer -->
65
- <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
66
- <!-- /wp:spacer -->`,
67
- layout: { x: 0, y: 200, width: 100, height: 100 },
68
- },
69
- {
70
- name: 'Gallery',
71
- html: `
72
- <!-- wp:gallery {"linkTo":"none"} -->
73
- <figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
74
- <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
75
- <!-- /wp:image -->
76
-
77
- <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
78
- <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
79
- <!-- /wp:image --></figure>
80
- <!-- /wp:gallery -->`,
81
- layout: { x: 0, y: 300, width: 100, height: 100 },
82
- nestedBlocks: [
83
- { name: 'Image', layout: { x: 0, y: 300, width: 50, height: 50 } },
84
- { name: 'Image', layout: { x: 50, y: 300, width: 50, height: 50 } },
85
- ],
86
- },
87
- ];
88
-
89
- describe( 'BlockDraggable', () => {
90
- describe( 'drag mode', () => {
91
- describe( 'Text block', () => {
92
- it( 'enables drag mode when unselected', async () =>
93
- withReanimatedTimer( async () => {
94
- const screen = await initializeWithBlocksLayouts( BLOCKS );
95
-
96
- // Start dragging from block's content
97
- const [ paragraphBlock ] = screen.getAllByLabelText(
98
- /Paragraph Block\. Row 1/
99
- );
100
- fireLongPress(
101
- paragraphBlock,
102
- 'draggable-trigger-content'
103
- );
104
- expect( getDraggableChip( screen ) ).toBeVisible();
105
-
106
- // "firePanGesture" finishes the dragging gesture
107
- firePanGesture(
108
- getByGestureTestId( 'block-draggable-wrapper' )
109
- );
110
- expect( getDraggableChip( screen ) ).not.toBeDefined();
111
- } ) );
112
-
113
- it( 'enables drag mode when selected', async () =>
114
- withReanimatedTimer( async () => {
115
- const screen = await initializeWithBlocksLayouts( BLOCKS );
116
-
117
- const blockDraggableWrapper = getByGestureTestId(
118
- 'block-draggable-wrapper'
119
- );
120
-
121
- const [ paragraphBlock ] = screen.getAllByLabelText(
122
- /Paragraph Block\. Row 1/
123
- );
124
- fireEvent.press( paragraphBlock );
125
-
126
- // Start dragging from block's content
127
- fireLongPress(
128
- paragraphBlock,
129
- 'draggable-trigger-content'
130
- );
131
- expect( getDraggableChip( screen ) ).toBeVisible();
132
- // "firePanGesture" finishes the dragging gesture
133
- firePanGesture( blockDraggableWrapper );
134
- expect( getDraggableChip( screen ) ).not.toBeDefined();
135
- } ) );
136
-
137
- it( 'does not enable drag mode when selected and editing text', async () =>
138
- withReanimatedTimer( async () => {
139
- const screen = await initializeWithBlocksLayouts( BLOCKS );
140
-
141
- const [ paragraphBlock ] = screen.getAllByLabelText(
142
- /Paragraph Block\. Row 1/
143
- );
144
-
145
- // Select Paragraph block and start editing text
146
- fireEvent.press( paragraphBlock );
147
- fireEvent(
148
- within( paragraphBlock ).getByPlaceholderText(
149
- 'Start writing…'
150
- ),
151
- 'focus'
152
- );
153
-
154
- // Start dragging from block's content
155
- fireLongPress(
156
- paragraphBlock,
157
- 'draggable-trigger-content',
158
- { failed: true }
159
- );
160
- expect( getDraggableChip( screen ) ).not.toBeDefined();
161
- // Check that no text input has been unfocused to confirm
162
- // that editing text is still enabled.
163
- expect(
164
- TextInputState.blurTextInput
165
- ).not.toHaveBeenCalled();
166
- } ) );
167
-
168
- it( 'finishes editing text and enables drag mode when long-pressing over a different block', async () =>
169
- withReanimatedTimer( async () => {
170
- const screen = await initializeWithBlocksLayouts( BLOCKS );
171
-
172
- const [ paragraphBlock ] = screen.getAllByLabelText(
173
- /Paragraph Block\. Row 1/
174
- );
175
- const [ spacerBlock ] =
176
- screen.getAllByLabelText( /Spacer Block\. Row 3/ );
177
-
178
- // Select Paragraph block and start editing text
179
- fireEvent.press( paragraphBlock );
180
- fireEvent(
181
- within( paragraphBlock ).getByPlaceholderText(
182
- 'Start writing…'
183
- ),
184
- 'focus'
185
- );
186
-
187
- // Start dragging from a different block's content
188
- fireLongPress( spacerBlock, 'draggable-trigger-content' );
189
- expect( getDraggableChip( screen ) ).toBeVisible();
190
- // Check that any text input has been unfocused to confirm
191
- // that editing text finished.
192
- expect( TextInputState.blurTextInput ).toHaveBeenCalled();
193
- } ) );
194
- } );
195
-
196
- describe( 'Media block', () => {
197
- it( 'enables drag mode when unselected', async () =>
198
- withReanimatedTimer( async () => {
199
- const screen = await initializeWithBlocksLayouts( BLOCKS );
200
-
201
- // We select the first Image block as the Gallery block
202
- // also contains Image blocks.
203
- const [ imageBlock ] =
204
- screen.getAllByLabelText( /Image Block\. Row 2/ );
205
- // Start dragging from block's content
206
- fireLongPress( imageBlock, 'draggable-trigger-content' );
207
- expect( getDraggableChip( screen ) ).toBeVisible();
208
-
209
- // "firePanGesture" finishes the dragging gesture
210
- firePanGesture(
211
- getByGestureTestId( 'block-draggable-wrapper' )
212
- );
213
- expect( getDraggableChip( screen ) ).not.toBeDefined();
214
- } ) );
215
-
216
- it( 'enables drag mode when selected', async () =>
217
- withReanimatedTimer( async () => {
218
- const screen = await initializeWithBlocksLayouts( BLOCKS );
219
- const blockDraggableWrapper = getByGestureTestId(
220
- 'block-draggable-wrapper'
221
- );
222
-
223
- // We select the first Image block as the Gallery block
224
- // also contains Image blocks.
225
- const [ imageBlock ] =
226
- screen.getAllByLabelText( /Image Block\. Row 2/ );
227
- fireEvent.press( imageBlock );
228
-
229
- // Start dragging from block's content
230
- fireLongPress( imageBlock, 'draggable-trigger-content' );
231
- expect( getDraggableChip( screen ) ).toBeVisible();
232
- // "firePanGesture" finishes the dragging gesture
233
- firePanGesture( blockDraggableWrapper );
234
- expect( getDraggableChip( screen ) ).not.toBeDefined();
235
- } ) );
236
- } );
237
-
238
- describe( 'Nested block', () => {
239
- it( 'enables drag mode when unselected', async () =>
240
- withReanimatedTimer( async () => {
241
- const screen = await initializeWithBlocksLayouts( BLOCKS );
242
-
243
- // Start dragging from block's content, specifically the first
244
- // trigger index, which corresponds to the Gallery block content.
245
- const [ galleryBlock ] = screen.getAllByLabelText(
246
- /Gallery Block\. Row 4/
247
- );
248
- fireLongPress( galleryBlock, 'draggable-trigger-content', {
249
- triggerIndex: 0,
250
- } );
251
- expect( getDraggableChip( screen ) ).toBeVisible();
252
-
253
- // "firePanGesture" finishes the dragging gesture
254
- firePanGesture(
255
- getByGestureTestId( 'block-draggable-wrapper' )
256
- );
257
- expect( getDraggableChip( screen ) ).not.toBeDefined();
258
- } ) );
259
-
260
- it( 'enables drag mode when selected', async () =>
261
- withReanimatedTimer( async () => {
262
- const screen = await initializeWithBlocksLayouts( BLOCKS );
263
- const blockDraggableWrapper = getByGestureTestId(
264
- 'block-draggable-wrapper'
265
- );
266
-
267
- const [ galleryBlock ] = screen.getAllByLabelText(
268
- /Gallery Block\. Row 4/
269
- );
270
- await waitForStoreResolvers( () =>
271
- fireEvent.press( galleryBlock )
272
- );
273
-
274
- // Start dragging from block's content, specifically the first
275
- // trigger index, which corresponds to the Gallery block content.
276
- fireLongPress( galleryBlock, 'draggable-trigger-content', {
277
- triggerIndex: 0,
278
- } );
279
- expect( getDraggableChip( screen ) ).toBeVisible();
280
- // "firePanGesture" finishes the dragging gesture
281
- firePanGesture( blockDraggableWrapper );
282
- expect( getDraggableChip( screen ) ).not.toBeDefined();
283
- } ) );
284
-
285
- it( 'enables drag mode when nested block is selected', async () =>
286
- withReanimatedTimer( async () => {
287
- const screen = await initializeWithBlocksLayouts( BLOCKS );
288
- const blockDraggableWrapper = getByGestureTestId(
289
- 'block-draggable-wrapper'
290
- );
291
-
292
- const [ galleryBlock ] = screen.getAllByLabelText(
293
- /Gallery Block\. Row 4/
294
- );
295
- const [ galleryItem ] =
296
- within( galleryBlock ).getAllByLabelText(
297
- /Image Block\. Row 2/
298
- );
299
- fireEvent.press( galleryBlock );
300
- fireEvent.press( galleryItem );
301
-
302
- // Start dragging from nested block's content
303
- fireLongPress( galleryItem, 'draggable-trigger-content' );
304
- expect( getDraggableChip( screen ) ).toBeVisible();
305
- // "firePanGesture" finishes the dragging gesture
306
- firePanGesture( blockDraggableWrapper );
307
- expect( getDraggableChip( screen ) ).not.toBeDefined();
308
- } ) );
309
- } );
310
-
311
- describe( 'Other block', () => {
312
- it( 'enables drag mode when unselected', async () =>
313
- withReanimatedTimer( async () => {
314
- const screen = await initializeWithBlocksLayouts( BLOCKS );
315
-
316
- // Start dragging from block's content
317
- const [ spacerBlock ] =
318
- screen.getAllByLabelText( /Spacer Block\. Row 3/ );
319
- fireLongPress( spacerBlock, 'draggable-trigger-content' );
320
- expect( getDraggableChip( screen ) ).toBeVisible();
321
-
322
- // "firePanGesture" finishes the dragging gesture
323
- firePanGesture(
324
- getByGestureTestId( 'block-draggable-wrapper' )
325
- );
326
- expect( getDraggableChip( screen ) ).not.toBeDefined();
327
- } ) );
328
-
329
- it( 'enables drag mode when selected', async () =>
330
- withReanimatedTimer( async () => {
331
- const screen = await initializeWithBlocksLayouts( BLOCKS );
332
- const blockDraggableWrapper = getByGestureTestId(
333
- 'block-draggable-wrapper'
334
- );
335
-
336
- const [ spacerBlock ] =
337
- screen.getAllByLabelText( /Spacer Block\. Row 3/ );
338
- await waitForStoreResolvers( () =>
339
- fireEvent.press( spacerBlock )
340
- );
341
-
342
- // Start dragging from block's content
343
- fireLongPress( spacerBlock, 'draggable-trigger-content' );
344
- expect( getDraggableChip( screen ) ).toBeVisible();
345
- // "firePanGesture" finishes the dragging gesture
346
- firePanGesture( blockDraggableWrapper );
347
- expect( getDraggableChip( screen ) ).not.toBeDefined();
348
- } ) );
349
- } );
350
- } );
351
-
352
- it( 'moves blocks', async () =>
353
- withReanimatedTimer( async () => {
354
- const screen = await initializeWithBlocksLayouts( BLOCKS );
355
- const blockDraggableWrapper = getByGestureTestId(
356
- 'block-draggable-wrapper'
357
- );
358
-
359
- expect( getEditorHtml() ).toMatchSnapshot( 'Initial order' );
360
-
361
- // Move Paragraph block from first to second position
362
- const [ paragraphBlock ] = screen.getAllByLabelText(
363
- /Paragraph Block\. Row 1/
364
- );
365
- fireLongPress( paragraphBlock, 'draggable-trigger-content' );
366
- firePanGesture( blockDraggableWrapper, [
367
- {
368
- id: TOUCH_EVENT_ID,
369
- eventType: TouchEventType.TOUCHES_DOWN,
370
- x: 0,
371
- y: 0,
372
- },
373
- {
374
- id: TOUCH_EVENT_ID,
375
- eventType: TouchEventType.TOUCHES_MOVE,
376
- x: 0,
377
- // Dropping position is in the second half of the second block's height.
378
- y: 180,
379
- },
380
- ] );
381
- // Draggable Pan gesture uses the Gesture state manager to manually
382
- // activate the gesture. Since this not available in tests, the library
383
- // displays a warning message.
384
- expect( console ).toHaveWarnedWith(
385
- '[Reanimated] setGestureState() cannot be used with Jest.'
386
- );
387
- expect( getEditorHtml() ).toMatchSnapshot(
388
- 'Paragraph block moved from first to second position'
389
- );
390
-
391
- // Move Spacer block from third to first position
392
- const [ spacerBlock ] =
393
- screen.getAllByLabelText( /Spacer Block\. Row 3/ );
394
- fireLongPress( spacerBlock, 'draggable-trigger-content' );
395
- firePanGesture( blockDraggableWrapper, [
396
- {
397
- id: TOUCH_EVENT_ID,
398
- eventType: TouchEventType.TOUCHES_DOWN,
399
- x: 0,
400
- y: 250,
401
- },
402
- {
403
- id: TOUCH_EVENT_ID,
404
- eventType: TouchEventType.TOUCHES_MOVE,
405
- x: 0,
406
- y: 0,
407
- },
408
- ] );
409
- // Draggable Pan gesture uses the Gesture state manager to manually
410
- // activate the gesture. Since this not available in tests, the library
411
- // displays a warning message.
412
- expect( console ).toHaveWarnedWith(
413
- '[Reanimated] setGestureState() cannot be used with Jest.'
414
- );
415
- expect( getEditorHtml() ).toMatchSnapshot(
416
- 'Spacer block moved from third to first position'
417
- );
418
- } ) );
419
- } );