@wordpress/block-editor 12.17.0 → 12.18.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 (421) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +32 -0
  3. package/build/components/block-draggable/index.js +11 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-edit/context.js +3 -1
  6. package/build/components/block-edit/context.js.map +1 -1
  7. package/build/components/block-edit/index.js +4 -2
  8. package/build/components/block-edit/index.js.map +1 -1
  9. package/build/components/block-editing-mode/index.js +6 -3
  10. package/build/components/block-editing-mode/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +5 -2
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/block.js +4 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +9 -5
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-list/index.js +30 -4
  18. package/build/components/block-list/index.js.map +1 -1
  19. package/build/components/block-list/private-block-context.js +1 -1
  20. package/build/components/block-list/private-block-context.js.map +1 -1
  21. package/build/components/block-list/use-in-between-inserter.js +1 -1
  22. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  23. package/build/components/block-lock/toolbar.js +8 -2
  24. package/build/components/block-lock/toolbar.js.map +1 -1
  25. package/build/components/block-popover/inbetween.js +15 -3
  26. package/build/components/block-popover/inbetween.js.map +1 -1
  27. package/build/components/block-preview/auto.js +1 -1
  28. package/build/components/block-preview/auto.js.map +1 -1
  29. package/build/components/block-removal-warning-modal/index.js +3 -2
  30. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-switcher/block-transformations-menu.js +12 -1
  34. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  35. package/build/components/block-switcher/index.js +119 -90
  36. package/build/components/block-switcher/index.js.map +1 -1
  37. package/build/components/block-tools/insertion-point.js +10 -3
  38. package/build/components/block-tools/insertion-point.js.map +1 -1
  39. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  40. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  41. package/build/components/font-sizes/fluid-utils.js +7 -1
  42. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  43. package/build/components/global-styles/border-panel.js +5 -14
  44. package/build/components/global-styles/border-panel.js.map +1 -1
  45. package/build/components/global-styles/dimensions-panel.js +30 -5
  46. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  47. package/build/components/global-styles/effects-panel.js +7 -1
  48. package/build/components/global-styles/effects-panel.js.map +1 -1
  49. package/build/components/global-styles/hooks.js +11 -8
  50. package/build/components/global-styles/hooks.js.map +1 -1
  51. package/build/components/global-styles/typography-panel.js +31 -14
  52. package/build/components/global-styles/typography-panel.js.map +1 -1
  53. package/build/components/global-styles/use-global-styles-output.js +6 -0
  54. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  55. package/build/components/iframe/get-compatibility-styles.js +99 -0
  56. package/build/components/iframe/get-compatibility-styles.js.map +1 -0
  57. package/build/components/iframe/index.js +2 -3
  58. package/build/components/iframe/index.js.map +1 -1
  59. package/build/components/index.js +16 -2
  60. package/build/components/index.js.map +1 -1
  61. package/build/components/index.native.js +16 -2
  62. package/build/components/index.native.js.map +1 -1
  63. package/build/components/inspector-controls/groups.js +2 -0
  64. package/build/components/inspector-controls/groups.js.map +1 -1
  65. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  66. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  67. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  68. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  69. package/build/components/link-control/link-preview.js +30 -26
  70. package/build/components/link-control/link-preview.js.map +1 -1
  71. package/build/components/link-control/search-input.js +1 -9
  72. package/build/components/link-control/search-input.js.map +1 -1
  73. package/build/components/list-view/block-contents.js +3 -1
  74. package/build/components/list-view/block-contents.js.map +1 -1
  75. package/build/components/list-view/block.js +10 -1
  76. package/build/components/list-view/block.js.map +1 -1
  77. package/build/components/list-view/branch.js +29 -8
  78. package/build/components/list-view/branch.js.map +1 -1
  79. package/build/components/list-view/drop-indicator.js +100 -32
  80. package/build/components/list-view/drop-indicator.js.map +1 -1
  81. package/build/components/list-view/index.js +52 -4
  82. package/build/components/list-view/index.js.map +1 -1
  83. package/build/components/list-view/leaf.js +2 -2
  84. package/build/components/list-view/leaf.js.map +1 -1
  85. package/build/components/list-view/use-list-view-block-indexes.js +30 -0
  86. package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
  87. package/build/components/list-view/use-list-view-drop-zone.js +56 -5
  88. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  89. package/build/components/list-view/utils.js +92 -0
  90. package/build/components/list-view/utils.js.map +1 -1
  91. package/build/components/provider/index.js +1 -1
  92. package/build/components/provider/index.js.map +1 -1
  93. package/build/components/recursion-provider/index.js +21 -0
  94. package/build/components/recursion-provider/index.js.map +1 -1
  95. package/build/components/rich-text/index.js +30 -6
  96. package/build/components/rich-text/index.js.map +1 -1
  97. package/build/components/rich-text/native/index.native.js +9 -9
  98. package/build/components/rich-text/native/index.native.js.map +1 -1
  99. package/build/components/use-block-drop-zone/index.js +30 -7
  100. package/build/components/use-block-drop-zone/index.js.map +1 -1
  101. package/build/components/use-on-block-drop/index.js +50 -8
  102. package/build/components/use-on-block-drop/index.js.map +1 -1
  103. package/build/hooks/block-hooks.js +5 -14
  104. package/build/hooks/block-hooks.js.map +1 -1
  105. package/build/hooks/content-lock-ui.js +17 -42
  106. package/build/hooks/content-lock-ui.js.map +1 -1
  107. package/build/hooks/dimensions.js +71 -1
  108. package/build/hooks/dimensions.js.map +1 -1
  109. package/build/hooks/effects.js +66 -0
  110. package/build/hooks/effects.js.map +1 -0
  111. package/build/hooks/index.js +17 -4
  112. package/build/hooks/index.js.map +1 -1
  113. package/build/hooks/index.native.js +13 -0
  114. package/build/hooks/index.native.js.map +1 -1
  115. package/build/hooks/style.js +9 -2
  116. package/build/hooks/style.js.map +1 -1
  117. package/build/hooks/supports.js +2 -1
  118. package/build/hooks/supports.js.map +1 -1
  119. package/build/hooks/typography.native.js +2 -2
  120. package/build/hooks/typography.native.js.map +1 -1
  121. package/build/hooks/use-bindings-attributes.js +115 -0
  122. package/build/hooks/use-bindings-attributes.js.map +1 -0
  123. package/build/hooks/use-shadow-props.js +46 -0
  124. package/build/hooks/use-shadow-props.js.map +1 -0
  125. package/build/hooks/utils.js +12 -7
  126. package/build/hooks/utils.js.map +1 -1
  127. package/build/index.js +14 -0
  128. package/build/index.js.map +1 -1
  129. package/build/store/actions.js +10 -6
  130. package/build/store/actions.js.map +1 -1
  131. package/build/store/index.js +2 -0
  132. package/build/store/index.js.map +1 -1
  133. package/build/store/private-actions.js +37 -0
  134. package/build/store/private-actions.js.map +1 -1
  135. package/build/store/private-selectors.js +60 -9
  136. package/build/store/private-selectors.js.map +1 -1
  137. package/build/store/reducer.js +44 -3
  138. package/build/store/reducer.js.map +1 -1
  139. package/build/store/resolvers.js +27 -0
  140. package/build/store/resolvers.js.map +1 -0
  141. package/build/store/selectors.js +94 -56
  142. package/build/store/selectors.js.map +1 -1
  143. package/build/store/utils.js +5 -26
  144. package/build/store/utils.js.map +1 -1
  145. package/build/utils/index.js +0 -16
  146. package/build/utils/index.js.map +1 -1
  147. package/build/utils/math.js +13 -0
  148. package/build/utils/math.js.map +1 -1
  149. package/build/utils/object.js +17 -0
  150. package/build/utils/object.js.map +1 -1
  151. package/build/utils/transform-styles/index.js +37 -27
  152. package/build/utils/transform-styles/index.js.map +1 -1
  153. package/build-module/components/block-draggable/index.js +11 -3
  154. package/build-module/components/block-draggable/index.js.map +1 -1
  155. package/build-module/components/block-edit/context.js +1 -0
  156. package/build-module/components/block-edit/context.js.map +1 -1
  157. package/build-module/components/block-edit/index.js +5 -3
  158. package/build-module/components/block-edit/index.js.map +1 -1
  159. package/build-module/components/block-editing-mode/index.js +7 -4
  160. package/build-module/components/block-editing-mode/index.js.map +1 -1
  161. package/build-module/components/block-inspector/index.js +5 -2
  162. package/build-module/components/block-inspector/index.js.map +1 -1
  163. package/build-module/components/block-list/block.js +6 -5
  164. package/build-module/components/block-list/block.js.map +1 -1
  165. package/build-module/components/block-list/block.native.js +11 -7
  166. package/build-module/components/block-list/block.native.js.map +1 -1
  167. package/build-module/components/block-list/index.js +31 -5
  168. package/build-module/components/block-list/index.js.map +1 -1
  169. package/build-module/components/block-list/private-block-context.js +1 -1
  170. package/build-module/components/block-list/private-block-context.js.map +1 -1
  171. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  172. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  173. package/build-module/components/block-lock/toolbar.js +8 -2
  174. package/build-module/components/block-lock/toolbar.js.map +1 -1
  175. package/build-module/components/block-popover/inbetween.js +15 -3
  176. package/build-module/components/block-popover/inbetween.js.map +1 -1
  177. package/build-module/components/block-preview/auto.js +3 -3
  178. package/build-module/components/block-preview/auto.js.map +1 -1
  179. package/build-module/components/block-removal-warning-modal/index.js +3 -2
  180. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  181. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
  182. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  183. package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
  184. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  185. package/build-module/components/block-switcher/index.js +116 -86
  186. package/build-module/components/block-switcher/index.js.map +1 -1
  187. package/build-module/components/block-tools/insertion-point.js +10 -3
  188. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  189. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  190. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  191. package/build-module/components/font-sizes/fluid-utils.js +7 -1
  192. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  193. package/build-module/components/global-styles/border-panel.js +5 -14
  194. package/build-module/components/global-styles/border-panel.js.map +1 -1
  195. package/build-module/components/global-styles/dimensions-panel.js +30 -5
  196. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  197. package/build-module/components/global-styles/effects-panel.js +7 -1
  198. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  199. package/build-module/components/global-styles/hooks.js +11 -8
  200. package/build-module/components/global-styles/hooks.js.map +1 -1
  201. package/build-module/components/global-styles/typography-panel.js +32 -15
  202. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  203. package/build-module/components/global-styles/use-global-styles-output.js +6 -0
  204. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  205. package/build-module/components/iframe/get-compatibility-styles.js +93 -0
  206. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
  207. package/build-module/components/iframe/index.js +2 -3
  208. package/build-module/components/iframe/index.js.map +1 -1
  209. package/build-module/components/index.js +1 -1
  210. package/build-module/components/index.js.map +1 -1
  211. package/build-module/components/index.native.js +1 -1
  212. package/build-module/components/index.native.js.map +1 -1
  213. package/build-module/components/inspector-controls/groups.js +2 -0
  214. package/build-module/components/inspector-controls/groups.js.map +1 -1
  215. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  216. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  217. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  218. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  219. package/build-module/components/link-control/link-preview.js +32 -28
  220. package/build-module/components/link-control/link-preview.js.map +1 -1
  221. package/build-module/components/link-control/search-input.js +1 -8
  222. package/build-module/components/link-control/search-input.js.map +1 -1
  223. package/build-module/components/list-view/block-contents.js +3 -1
  224. package/build-module/components/list-view/block-contents.js.map +1 -1
  225. package/build-module/components/list-view/block.js +10 -1
  226. package/build-module/components/list-view/block.js.map +1 -1
  227. package/build-module/components/list-view/branch.js +30 -9
  228. package/build-module/components/list-view/branch.js.map +1 -1
  229. package/build-module/components/list-view/drop-indicator.js +99 -32
  230. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  231. package/build-module/components/list-view/index.js +54 -6
  232. package/build-module/components/list-view/index.js.map +1 -1
  233. package/build-module/components/list-view/leaf.js +2 -2
  234. package/build-module/components/list-view/leaf.js.map +1 -1
  235. package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
  236. package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
  237. package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
  238. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  239. package/build-module/components/list-view/utils.js +91 -0
  240. package/build-module/components/list-view/utils.js.map +1 -1
  241. package/build-module/components/provider/index.js +1 -1
  242. package/build-module/components/provider/index.js.map +1 -1
  243. package/build-module/components/recursion-provider/index.js +17 -0
  244. package/build-module/components/recursion-provider/index.js.map +1 -1
  245. package/build-module/components/rich-text/index.js +30 -6
  246. package/build-module/components/rich-text/index.js.map +1 -1
  247. package/build-module/components/rich-text/native/index.native.js +9 -9
  248. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  249. package/build-module/components/use-block-drop-zone/index.js +31 -8
  250. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  251. package/build-module/components/use-on-block-drop/index.js +51 -9
  252. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  253. package/build-module/hooks/block-hooks.js +5 -14
  254. package/build-module/hooks/block-hooks.js.map +1 -1
  255. package/build-module/hooks/content-lock-ui.js +19 -43
  256. package/build-module/hooks/content-lock-ui.js.map +1 -1
  257. package/build-module/hooks/dimensions.js +70 -2
  258. package/build-module/hooks/dimensions.js.map +1 -1
  259. package/build-module/hooks/effects.js +51 -0
  260. package/build-module/hooks/effects.js.map +1 -0
  261. package/build-module/hooks/index.js +5 -3
  262. package/build-module/hooks/index.js.map +1 -1
  263. package/build-module/hooks/index.native.js +1 -0
  264. package/build-module/hooks/index.native.js.map +1 -1
  265. package/build-module/hooks/style.js +9 -2
  266. package/build-module/hooks/style.js.map +1 -1
  267. package/build-module/hooks/supports.js +2 -1
  268. package/build-module/hooks/supports.js.map +1 -1
  269. package/build-module/hooks/typography.native.js +2 -2
  270. package/build-module/hooks/typography.native.js.map +1 -1
  271. package/build-module/hooks/use-bindings-attributes.js +112 -0
  272. package/build-module/hooks/use-bindings-attributes.js.map +1 -0
  273. package/build-module/hooks/use-shadow-props.js +39 -0
  274. package/build-module/hooks/use-shadow-props.js.map +1 -0
  275. package/build-module/hooks/utils.js +14 -9
  276. package/build-module/hooks/utils.js.map +1 -1
  277. package/build-module/index.js +1 -1
  278. package/build-module/index.js.map +1 -1
  279. package/build-module/store/actions.js +10 -6
  280. package/build-module/store/actions.js.map +1 -1
  281. package/build-module/store/index.js +2 -0
  282. package/build-module/store/index.js.map +1 -1
  283. package/build-module/store/private-actions.js +35 -0
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-selectors.js +53 -8
  286. package/build-module/store/private-selectors.js.map +1 -1
  287. package/build-module/store/reducer.js +43 -3
  288. package/build-module/store/reducer.js.map +1 -1
  289. package/build-module/store/resolvers.js +20 -0
  290. package/build-module/store/resolvers.js.map +1 -0
  291. package/build-module/store/selectors.js +89 -52
  292. package/build-module/store/selectors.js.map +1 -1
  293. package/build-module/store/utils.js +3 -23
  294. package/build-module/store/utils.js.map +1 -1
  295. package/build-module/utils/index.js +0 -1
  296. package/build-module/utils/index.js.map +1 -1
  297. package/build-module/utils/math.js +12 -0
  298. package/build-module/utils/math.js.map +1 -1
  299. package/build-module/utils/object.js +16 -0
  300. package/build-module/utils/object.js.map +1 -1
  301. package/build-module/utils/transform-styles/index.js +36 -27
  302. package/build-module/utils/transform-styles/index.js.map +1 -1
  303. package/build-style/content-rtl.css +33 -16
  304. package/build-style/content.css +33 -16
  305. package/build-style/default-editor-styles-rtl.css +1 -1
  306. package/build-style/default-editor-styles.css +1 -1
  307. package/build-style/style-rtl.css +169 -114
  308. package/build-style/style.css +169 -114
  309. package/package.json +31 -31
  310. package/src/components/block-canvas/style.scss +8 -1
  311. package/src/components/block-draggable/index.js +16 -5
  312. package/src/components/block-edit/context.js +1 -0
  313. package/src/components/block-edit/index.js +4 -0
  314. package/src/components/block-editing-mode/index.js +12 -7
  315. package/src/components/block-inspector/index.js +5 -2
  316. package/src/components/block-list/block.js +5 -4
  317. package/src/components/block-list/block.native.js +13 -3
  318. package/src/components/block-list/content.scss +34 -5
  319. package/src/components/block-list/index.js +52 -16
  320. package/src/components/block-list/private-block-context.js +1 -1
  321. package/src/components/block-list/use-in-between-inserter.js +1 -2
  322. package/src/components/block-lock/toolbar.js +10 -2
  323. package/src/components/block-popover/inbetween.js +22 -2
  324. package/src/components/block-preview/auto.js +3 -3
  325. package/src/components/block-removal-warning-modal/index.js +3 -2
  326. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
  327. package/src/components/block-switcher/block-transformations-menu.js +18 -1
  328. package/src/components/block-switcher/index.js +133 -111
  329. package/src/components/block-switcher/style.scss +6 -4
  330. package/src/components/block-switcher/test/index.js +113 -230
  331. package/src/components/block-toolbar/style.scss +22 -18
  332. package/src/components/block-tools/insertion-point.js +15 -2
  333. package/src/components/block-tools/style.scss +8 -7
  334. package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
  335. package/src/components/font-sizes/fluid-utils.js +8 -2
  336. package/src/components/font-sizes/test/fluid-utils.js +9 -0
  337. package/src/components/global-styles/border-panel.js +7 -17
  338. package/src/components/global-styles/dimensions-panel.js +50 -1
  339. package/src/components/global-styles/effects-panel.js +16 -1
  340. package/src/components/global-styles/hooks.js +11 -6
  341. package/src/components/global-styles/typography-panel.js +45 -13
  342. package/src/components/global-styles/use-global-styles-output.js +6 -0
  343. package/src/components/iframe/get-compatibility-styles.js +120 -0
  344. package/src/components/iframe/index.js +2 -3
  345. package/src/components/index.js +4 -2
  346. package/src/components/index.native.js +4 -2
  347. package/src/components/inspector-controls/groups.js +2 -0
  348. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  349. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
  350. package/src/components/link-control/link-preview.js +31 -55
  351. package/src/components/link-control/search-input.js +1 -9
  352. package/src/components/link-control/style.scss +31 -85
  353. package/src/components/link-control/test/index.js +2 -1
  354. package/src/components/list-view/block-contents.js +5 -1
  355. package/src/components/list-view/block.js +9 -0
  356. package/src/components/list-view/branch.js +30 -10
  357. package/src/components/list-view/drop-indicator.js +139 -46
  358. package/src/components/list-view/index.js +74 -3
  359. package/src/components/list-view/leaf.js +2 -2
  360. package/src/components/list-view/style.scss +102 -13
  361. package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
  362. package/src/components/list-view/test/utils.js +218 -1
  363. package/src/components/list-view/use-list-view-block-indexes.js +29 -0
  364. package/src/components/list-view/use-list-view-drop-zone.js +78 -6
  365. package/src/components/list-view/utils.js +116 -0
  366. package/src/components/provider/index.js +3 -1
  367. package/src/components/recursion-provider/README.md +2 -2
  368. package/src/components/recursion-provider/index.js +17 -0
  369. package/src/components/rich-text/index.js +48 -10
  370. package/src/components/rich-text/native/index.native.js +10 -10
  371. package/src/components/use-block-drop-zone/index.js +60 -19
  372. package/src/components/use-block-drop-zone/test/index.js +32 -61
  373. package/src/components/use-on-block-drop/index.js +92 -11
  374. package/src/hooks/block-hooks.js +5 -17
  375. package/src/hooks/content-lock-ui.js +15 -55
  376. package/src/hooks/dimensions.js +74 -3
  377. package/src/hooks/effects.js +57 -0
  378. package/src/hooks/index.js +4 -2
  379. package/src/hooks/index.native.js +1 -0
  380. package/src/hooks/style.js +12 -0
  381. package/src/hooks/supports.js +2 -0
  382. package/src/hooks/test/effects.js +39 -0
  383. package/src/hooks/typography.native.js +2 -2
  384. package/src/hooks/use-bindings-attributes.js +148 -0
  385. package/src/hooks/use-shadow-props.js +37 -0
  386. package/src/hooks/utils.js +30 -10
  387. package/src/index.js +2 -0
  388. package/src/store/actions.js +9 -4
  389. package/src/store/index.js +2 -0
  390. package/src/store/private-actions.js +32 -0
  391. package/src/store/private-selectors.js +78 -21
  392. package/src/store/reducer.js +49 -2
  393. package/src/store/resolvers.js +17 -0
  394. package/src/store/selectors.js +169 -161
  395. package/src/store/test/registry-selectors.js +431 -0
  396. package/src/store/test/selectors.js +14 -400
  397. package/src/store/utils.js +10 -33
  398. package/src/style.scss +0 -1
  399. package/src/utils/index.js +0 -1
  400. package/src/utils/math.js +12 -0
  401. package/src/utils/object.js +16 -0
  402. package/src/utils/transform-styles/index.js +52 -37
  403. package/tsconfig.tsbuildinfo +1 -1
  404. package/build/components/iframe/use-compatibility-styles.js +0 -100
  405. package/build/components/iframe/use-compatibility-styles.js.map +0 -1
  406. package/build/hooks/custom-fields.js +0 -106
  407. package/build/hooks/custom-fields.js.map +0 -1
  408. package/build/utils/block-variation-transforms.js +0 -42
  409. package/build/utils/block-variation-transforms.js.map +0 -1
  410. package/build-module/components/iframe/use-compatibility-styles.js +0 -94
  411. package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
  412. package/build-module/hooks/custom-fields.js +0 -99
  413. package/build-module/hooks/custom-fields.js.map +0 -1
  414. package/build-module/utils/block-variation-transforms.js +0 -35
  415. package/build-module/utils/block-variation-transforms.js.map +0 -1
  416. package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
  417. package/src/components/contrast-checker/style.scss +0 -3
  418. package/src/components/iframe/use-compatibility-styles.js +0 -122
  419. package/src/hooks/custom-fields.js +0 -115
  420. package/src/utils/block-variation-transforms.js +0 -38
  421. package/src/utils/test/block-variation-transforms.js +0 -94
@@ -2,10 +2,11 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
- import { useState, useCallback } from '@wordpress/element';
5
+ import { useState, useCallback, useEffect } from '@wordpress/element';
6
6
  import {
7
7
  useThrottle,
8
8
  __experimentalUseDropZone as useDropZone,
9
+ usePrevious,
9
10
  } from '@wordpress/compose';
10
11
  import { isRTL } from '@wordpress/i18n';
11
12
 
@@ -304,6 +305,7 @@ export function getListViewDropTarget( blocksData, position, rtl = false ) {
304
305
 
305
306
  return {
306
307
  rootClientId: candidateBlockData.clientId,
308
+ clientId: candidateBlockData.clientId,
307
309
  blockIndex: newBlockIndex,
308
310
  dropPosition: 'inside',
309
311
  };
@@ -396,15 +398,30 @@ export function getListViewDropTarget( blocksData, position, rtl = false ) {
396
398
  };
397
399
  }
398
400
 
401
+ // Throttle options need to be defined outside of the hook to avoid
402
+ // re-creating the object on every render. This is due to a limitation
403
+ // of the `useThrottle` hook, where the options object is included
404
+ // in the dependency array for memoization.
405
+ const EXPAND_THROTTLE_OPTIONS = {
406
+ leading: false, // Don't call the function immediately on the first call.
407
+ trailing: true, // Do call the function on the last call.
408
+ };
409
+
399
410
  /**
400
411
  * A react hook for implementing a drop zone in list view.
401
412
  *
402
- * @param {Object} props Named parameters.
403
- * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
413
+ * @param {Object} props Named parameters.
414
+ * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
415
+ * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.
416
+ * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.
404
417
  *
405
418
  * @return {WPListViewDropZoneTarget} The drop target.
406
419
  */
407
- export default function useListViewDropZone( { dropZoneElement } ) {
420
+ export default function useListViewDropZone( {
421
+ dropZoneElement,
422
+ expandedState,
423
+ setExpandedState,
424
+ } ) {
408
425
  const {
409
426
  getBlockRootClientId,
410
427
  getBlockIndex,
@@ -420,6 +437,55 @@ export default function useListViewDropZone( { dropZoneElement } ) {
420
437
 
421
438
  const rtl = isRTL();
422
439
 
440
+ const previousRootClientId = usePrevious( targetRootClientId );
441
+
442
+ const maybeExpandBlock = useCallback(
443
+ ( _expandedState, _target ) => {
444
+ // If the user is attempting to drop a block inside a collapsed block,
445
+ // that is, using a nesting gesture flagged by 'inside' dropPosition,
446
+ // expand the block within the list view, if it isn't already.
447
+ const { rootClientId } = _target || {};
448
+ if ( ! rootClientId ) {
449
+ return;
450
+ }
451
+ if (
452
+ _target?.dropPosition === 'inside' &&
453
+ ! _expandedState[ rootClientId ]
454
+ ) {
455
+ setExpandedState( {
456
+ type: 'expand',
457
+ clientIds: [ rootClientId ],
458
+ } );
459
+ }
460
+ },
461
+ [ setExpandedState ]
462
+ );
463
+
464
+ // Throttle the maybeExpandBlock function to avoid expanding the block
465
+ // too quickly when the user is dragging over the block. This is to
466
+ // avoid expanding the block when the user is just passing over it.
467
+ const throttledMaybeExpandBlock = useThrottle(
468
+ maybeExpandBlock,
469
+ 500,
470
+ EXPAND_THROTTLE_OPTIONS
471
+ );
472
+
473
+ useEffect( () => {
474
+ if (
475
+ target?.dropPosition !== 'inside' ||
476
+ previousRootClientId !== target?.rootClientId
477
+ ) {
478
+ throttledMaybeExpandBlock.cancel();
479
+ return;
480
+ }
481
+ throttledMaybeExpandBlock( expandedState, target );
482
+ }, [
483
+ expandedState,
484
+ previousRootClientId,
485
+ target,
486
+ throttledMaybeExpandBlock,
487
+ ] );
488
+
423
489
  const draggedBlockClientIds = getDraggedBlockClientIds();
424
490
  const throttled = useThrottle(
425
491
  useCallback(
@@ -484,7 +550,7 @@ export default function useListViewDropZone( { dropZoneElement } ) {
484
550
  rtl,
485
551
  ]
486
552
  ),
487
- 200
553
+ 50
488
554
  );
489
555
 
490
556
  const ref = useDropZone( {
@@ -496,6 +562,9 @@ export default function useListViewDropZone( { dropZoneElement } ) {
496
562
  },
497
563
  onDragLeave() {
498
564
  throttled.cancel();
565
+ // Use `null` value to indicate that the drop target is not valid,
566
+ // but that the drag is still active. This allows for styling rules
567
+ // that are active only when a user drags outside of the list view.
499
568
  setTarget( null );
500
569
  },
501
570
  onDragOver( event ) {
@@ -506,7 +575,10 @@ export default function useListViewDropZone( { dropZoneElement } ) {
506
575
  },
507
576
  onDragEnd() {
508
577
  throttled.cancel();
509
- setTarget( null );
578
+ // Use `undefined` value to indicate that the drag has concluded.
579
+ // This allows styling rules that are active only when a user is
580
+ // dragging to be removed.
581
+ setTarget( undefined );
510
582
  },
511
583
  } );
512
584
 
@@ -93,3 +93,119 @@ export function focusListItem( focusClientId, treeGridElementRef ) {
93
93
  } );
94
94
  }
95
95
  }
96
+
97
+ /**
98
+ * Get values for the block that flag whether the block should be displaced up or down,
99
+ * whether the block is being nested, and whether the block appears after the dragged
100
+ * blocks. These values are used to determine the class names to apply to the block.
101
+ * The list view rows are displaced visually via CSS rules. Displacement rules:
102
+ * - `normal`: no displacement — used to apply a translateY of `0` so that the block
103
+ * appears in its original position, and moves to that position smoothly when dragging
104
+ * outside of the list view area.
105
+ * - `up`: the block should be displaced up, creating room beneath the block for the drop indicator.
106
+ * - `down`: the block should be displaced down, creating room above the block for the drop indicator.
107
+ *
108
+ * @param {Object} props
109
+ * @param {Object} props.blockIndexes The indexes of all the blocks in the list view, keyed by clientId.
110
+ * @param {number|null|undefined} props.blockDropTargetIndex The index of the block that the user is dropping to.
111
+ * @param {?string} props.blockDropPosition The position relative to the block that the user is dropping to.
112
+ * @param {string} props.clientId The client id for the current block.
113
+ * @param {?number} props.firstDraggedBlockIndex The index of the first dragged block.
114
+ * @param {?boolean} props.isDragged Whether the current block is being dragged. Dragged blocks skip displacement.
115
+ * @return {Object} An object containing the `displacement`, `isAfterDraggedBlocks` and `isNesting` values.
116
+ */
117
+ export function getDragDisplacementValues( {
118
+ blockIndexes,
119
+ blockDropTargetIndex,
120
+ blockDropPosition,
121
+ clientId,
122
+ firstDraggedBlockIndex,
123
+ isDragged,
124
+ } ) {
125
+ let displacement;
126
+ let isNesting;
127
+ let isAfterDraggedBlocks;
128
+
129
+ if ( ! isDragged ) {
130
+ isNesting = false;
131
+ const thisBlockIndex = blockIndexes[ clientId ];
132
+ isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex;
133
+
134
+ // Determine where to displace the position of the current block, relative
135
+ // to the blocks being dragged (in their original position) and the drop target
136
+ // (the position where a user is currently dragging the blocks to).
137
+ if (
138
+ blockDropTargetIndex !== undefined &&
139
+ blockDropTargetIndex !== null &&
140
+ firstDraggedBlockIndex !== undefined
141
+ ) {
142
+ // If the block is being dragged and there is a valid drop target,
143
+ // determine if the block being rendered should be displaced up or down.
144
+
145
+ if ( thisBlockIndex !== undefined ) {
146
+ if (
147
+ thisBlockIndex >= firstDraggedBlockIndex &&
148
+ thisBlockIndex < blockDropTargetIndex
149
+ ) {
150
+ // If the current block appears after the set of dragged blocks
151
+ // (in their original position), but is before the drop target,
152
+ // then the current block should be displaced up.
153
+ displacement = 'up';
154
+ } else if (
155
+ thisBlockIndex < firstDraggedBlockIndex &&
156
+ thisBlockIndex >= blockDropTargetIndex
157
+ ) {
158
+ // If the current block appears before the set of dragged blocks
159
+ // (in their original position), but is after the drop target,
160
+ // then the current block should be displaced down.
161
+ displacement = 'down';
162
+ } else {
163
+ displacement = 'normal';
164
+ }
165
+ isNesting =
166
+ typeof blockDropTargetIndex === 'number' &&
167
+ blockDropTargetIndex - 1 === thisBlockIndex &&
168
+ blockDropPosition === 'inside';
169
+ }
170
+ } else if (
171
+ blockDropTargetIndex === null &&
172
+ firstDraggedBlockIndex !== undefined
173
+ ) {
174
+ // A `null` value for `blockDropTargetIndex` indicates that the
175
+ // drop target is outside of the valid areas within the list view.
176
+ // In this case, the drag is still active, but as there is no
177
+ // valid drop target, we should remove the gap indicating where
178
+ // the block would be inserted.
179
+ if (
180
+ thisBlockIndex !== undefined &&
181
+ thisBlockIndex >= firstDraggedBlockIndex
182
+ ) {
183
+ displacement = 'up';
184
+ } else {
185
+ displacement = 'normal';
186
+ }
187
+ } else if (
188
+ blockDropTargetIndex !== undefined &&
189
+ blockDropTargetIndex !== null &&
190
+ firstDraggedBlockIndex === undefined
191
+ ) {
192
+ // If the blockdrop target is defined, but there are no dragged blocks,
193
+ // then the block should be displaced relative to the drop target.
194
+ if ( thisBlockIndex !== undefined ) {
195
+ if ( thisBlockIndex < blockDropTargetIndex ) {
196
+ displacement = 'normal';
197
+ } else {
198
+ displacement = 'down';
199
+ }
200
+ }
201
+ } else if ( blockDropTargetIndex === null ) {
202
+ displacement = 'normal';
203
+ }
204
+ }
205
+
206
+ return {
207
+ displacement,
208
+ isNesting,
209
+ isAfterDraggedBlocks,
210
+ };
211
+ }
@@ -46,7 +46,9 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
46
46
 
47
47
  return (
48
48
  <SlotFillProvider passthrough>
49
- <KeyboardShortcuts.Register />
49
+ { ! settings.__unstableIsPreviewMode && (
50
+ <KeyboardShortcuts.Register />
51
+ ) }
50
52
  <BlockRefsProvider>{ children }</BlockRefsProvider>
51
53
  </SlotFillProvider>
52
54
  );
@@ -11,8 +11,8 @@ To help with detecting infinite loops on the client, the `RecursionProvider` com
11
11
  * WordPress dependencies
12
12
  */
13
13
  import {
14
- __experimentalRecursionProvider as RecursionProvider,
15
- __experimentalUseHasRecursion as useHasRecursion,
14
+ RecursionProvider,
15
+ useHasRecursion,
16
16
  useBlockProps,
17
17
  Warning,
18
18
  } from '@wordpress/block-editor';
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createContext, useContext, useMemo } from '@wordpress/element';
5
+ import deprecated from '@wordpress/deprecated';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -82,3 +83,19 @@ export function useHasRecursion( uniqueId, blockName = '' ) {
82
83
  blockName = blockName || name;
83
84
  return Boolean( previouslyRenderedBlocks[ blockName ]?.has( uniqueId ) );
84
85
  }
86
+
87
+ export const DeprecatedExperimentalRecursionProvider = ( props ) => {
88
+ deprecated( 'wp.blockEditor.__experimentalRecursionProvider', {
89
+ since: '6.5',
90
+ alternative: 'wp.blockEditor.RecursionProvider',
91
+ } );
92
+ return <RecursionProvider { ...props } />;
93
+ };
94
+
95
+ export const DeprecatedExperimentalUseHasRecursion = ( props ) => {
96
+ deprecated( 'wp.blockEditor.__experimentalUseHasRecursion', {
97
+ since: '6.5',
98
+ alternative: 'wp.blockEditor.useHasRecursion',
99
+ } );
100
+ return useHasRecursion( ...props );
101
+ };
@@ -19,6 +19,7 @@ import {
19
19
  removeFormat,
20
20
  } from '@wordpress/rich-text';
21
21
  import { Popover } from '@wordpress/components';
22
+ import { getBlockType } from '@wordpress/blocks';
22
23
 
23
24
  /**
24
25
  * Internal dependencies
@@ -44,6 +45,7 @@ import FormatEdit from './format-edit';
44
45
  import { getAllowedFormats } from './utils';
45
46
  import { Content } from './content';
46
47
  import { withDeprecations } from './with-deprecations';
48
+ import { unlock } from '../../lock-unlock';
47
49
 
48
50
  export const keyboardShortcutContext = createContext();
49
51
  export const inputEventContext = createContext();
@@ -113,7 +115,11 @@ export function RichTextWrapper(
113
115
  props = removeNativeProps( props );
114
116
 
115
117
  const anchorRef = useRef();
116
- const { clientId, isSelected: isBlockSelected } = useBlockEditContext();
118
+ const {
119
+ clientId,
120
+ isSelected: isBlockSelected,
121
+ name: blockName,
122
+ } = useBlockEditContext();
117
123
  const selector = ( select ) => {
118
124
  // Avoid subscribing to the block editor store if the block is not
119
125
  // selected.
@@ -121,10 +127,12 @@ export function RichTextWrapper(
121
127
  return { isSelected: false };
122
128
  }
123
129
 
124
- const { getSelectionStart, getSelectionEnd } =
130
+ const { getSelectionStart, getSelectionEnd, getBlockAttributes } =
125
131
  select( blockEditorStore );
126
132
  const selectionStart = getSelectionStart();
127
133
  const selectionEnd = getSelectionEnd();
134
+ const blockBindings =
135
+ getBlockAttributes( clientId )?.metadata?.bindings;
128
136
 
129
137
  let isSelected;
130
138
 
@@ -137,18 +145,44 @@ export function RichTextWrapper(
137
145
  isSelected = selectionStart.clientId === clientId;
138
146
  }
139
147
 
148
+ // Disable Rich Text editing if block bindings specify that.
149
+ let shouldDisableEditing = false;
150
+ if ( blockBindings ) {
151
+ const blockTypeAttributes = getBlockType( blockName ).attributes;
152
+ const { getBlockBindingsSource } = unlock(
153
+ select( blockEditorStore )
154
+ );
155
+ for ( const [ attribute, args ] of Object.entries(
156
+ blockBindings
157
+ ) ) {
158
+ // If any of the attributes with source "rich-text" is part of the bindings,
159
+ // has a source with `lockAttributesEditing`, disable it.
160
+ if (
161
+ blockTypeAttributes?.[ attribute ]?.source ===
162
+ 'rich-text' &&
163
+ getBlockBindingsSource( args.source.name )
164
+ ?.lockAttributesEditing
165
+ ) {
166
+ shouldDisableEditing = true;
167
+ break;
168
+ }
169
+ }
170
+ }
171
+
140
172
  return {
141
173
  selectionStart: isSelected ? selectionStart.offset : undefined,
142
174
  selectionEnd: isSelected ? selectionEnd.offset : undefined,
143
175
  isSelected,
176
+ shouldDisableEditing,
144
177
  };
145
178
  };
146
- const { selectionStart, selectionEnd, isSelected } = useSelect( selector, [
147
- clientId,
148
- identifier,
149
- originalIsSelected,
150
- isBlockSelected,
151
- ] );
179
+ const { selectionStart, selectionEnd, isSelected, shouldDisableEditing } =
180
+ useSelect( selector, [
181
+ clientId,
182
+ identifier,
183
+ originalIsSelected,
184
+ isBlockSelected,
185
+ ] );
152
186
  const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
153
187
  useSelect( blockEditorStore );
154
188
  const { selectionChange } = useDispatch( blockEditorStore );
@@ -376,7 +410,7 @@ export function RichTextWrapper(
376
410
  useFirefoxCompat(),
377
411
  anchorRef,
378
412
  ] ) }
379
- contentEditable={ true }
413
+ contentEditable={ ! shouldDisableEditing }
380
414
  suppressContentEditableWarning={ true }
381
415
  className={ classnames(
382
416
  'block-editor-rich-text__editable',
@@ -389,7 +423,11 @@ export function RichTextWrapper(
389
423
  // select blocks when Shift Clicking into an element with
390
424
  // tabIndex because Safari will focus the element. However,
391
425
  // Safari will correctly ignore nested contentEditable elements.
392
- tabIndex={ props.tabIndex === 0 ? null : props.tabIndex }
426
+ tabIndex={
427
+ props.tabIndex === 0 && ! shouldDisableEditing
428
+ ? null
429
+ : props.tabIndex
430
+ }
393
431
  data-wp-block-attribute-key={ identifier }
394
432
  />
395
433
  </>
@@ -264,7 +264,7 @@ export class RichText extends Component {
264
264
  onCreateUndoLevel() {
265
265
  const { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;
266
266
  // If the content is the same, no level needs to be created.
267
- if ( this.lastHistoryValue.toString() === this.value.toString() ) {
267
+ if ( this.lastHistoryValue?.toString() === this.value?.toString() ) {
268
268
  return;
269
269
  }
270
270
 
@@ -317,7 +317,7 @@ export class RichText extends Component {
317
317
  event.nativeEvent.text
318
318
  );
319
319
  // On iOS, onChange can be triggered after selection changes, even though there are no content changes.
320
- if ( contentWithoutRootTag === this.value.toString() ) {
320
+ if ( contentWithoutRootTag === this.value?.toString() ) {
321
321
  return;
322
322
  }
323
323
  this.lastEventCount = event.nativeEvent.eventCount;
@@ -333,7 +333,7 @@ export class RichText extends Component {
333
333
  );
334
334
 
335
335
  this.debounceCreateUndoLevel();
336
- const refresh = this.value.toString() !== contentWithoutRootTag;
336
+ const refresh = this.value?.toString() !== contentWithoutRootTag;
337
337
  this.value = contentWithoutRootTag;
338
338
 
339
339
  // We don't want to refresh if our goal is just to create a record.
@@ -564,7 +564,7 @@ export class RichText extends Component {
564
564
  // Check if value is up to date with latest state of native AztecView.
565
565
  if (
566
566
  event.nativeEvent.text &&
567
- event.nativeEvent.text !== this.props.value.toString()
567
+ event.nativeEvent.text !== this.props.value?.toString()
568
568
  ) {
569
569
  this.onTextUpdate( event );
570
570
  }
@@ -589,7 +589,7 @@ export class RichText extends Component {
589
589
  // this approach is not perfectly reliable.
590
590
  const isManual =
591
591
  this.lastAztecEventType !== 'input' &&
592
- this.props.value.toString() === this.value.toString();
592
+ this.props.value?.toString() === this.value?.toString();
593
593
  if ( hasChanged && isManual ) {
594
594
  const value = this.createRecord();
595
595
  const activeFormats = getActiveFormats( value );
@@ -659,7 +659,7 @@ export class RichText extends Component {
659
659
  event.nativeEvent.text
660
660
  );
661
661
  if (
662
- contentWithoutRootTag === this.value.toString() &&
662
+ contentWithoutRootTag === this.value?.toString() &&
663
663
  realStart === this.selectionStart &&
664
664
  realEnd === this.selectionEnd
665
665
  ) {
@@ -756,7 +756,7 @@ export class RichText extends Component {
756
756
  typeof nextProps.value !== 'undefined' &&
757
757
  typeof this.props.value !== 'undefined' &&
758
758
  ( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&
759
- nextProps.value.toString() !== this.props.value.toString()
759
+ nextProps.value?.toString() !== this.props.value?.toString()
760
760
  ) {
761
761
  // Gutenberg seems to try to mirror the caret state even on events that only change the content so,
762
762
  // let's force caret update if state has selection set.
@@ -824,7 +824,7 @@ export class RichText extends Component {
824
824
  const { style, tagName } = this.props;
825
825
  const { currentFontSize } = this.state;
826
826
 
827
- if ( this.props.value.toString() !== this.value.toString() ) {
827
+ if ( this.props.value?.toString() !== this.value?.toString() ) {
828
828
  this.value = this.props.value;
829
829
  }
830
830
  const { __unstableIsSelected: prevIsSelected } = prevProps;
@@ -884,8 +884,8 @@ export class RichText extends Component {
884
884
  // On android if content is empty we need to send no content or else the placeholder will not show.
885
885
  if (
886
886
  ! this.isIOS &&
887
- ( value.toString() === '' ||
888
- value.toString() === EMPTY_PARAGRAPH_TAGS )
887
+ ( value?.toString() === '' ||
888
+ value?.toString() === EMPTY_PARAGRAPH_TAGS )
889
889
  ) {
890
890
  return '';
891
891
  }
@@ -20,6 +20,7 @@ import useOnBlockDrop from '../use-on-block-drop';
20
20
  import {
21
21
  getDistanceToNearestEdge,
22
22
  isPointContainedByRect,
23
+ isPointWithinTopAndBottomBoundariesOfRect,
23
24
  } from '../../utils/math';
24
25
  import { store as blockEditorStore } from '../../store';
25
26
 
@@ -72,6 +73,8 @@ export function getDropTargetPosition(
72
73
  let nearestIndex = 0;
73
74
  let insertPosition = 'before';
74
75
  let minDistance = Infinity;
76
+ let targetBlockIndex = null;
77
+ let nearestSide = 'right';
75
78
 
76
79
  const {
77
80
  dropZoneElement,
@@ -136,7 +139,12 @@ export function getDropTargetPosition(
136
139
  }
137
140
 
138
141
  blocksData.forEach(
139
- ( { isUnmodifiedDefaultBlock, getBoundingClientRect, blockIndex } ) => {
142
+ ( {
143
+ isUnmodifiedDefaultBlock,
144
+ getBoundingClientRect,
145
+ blockIndex,
146
+ blockOrientation,
147
+ } ) => {
140
148
  const rect = getBoundingClientRect();
141
149
 
142
150
  let [ distance, edge ] = getDistanceToNearestEdge(
@@ -144,12 +152,35 @@ export function getDropTargetPosition(
144
152
  rect,
145
153
  allowedEdges
146
154
  );
155
+ // If the the point is close to a side, prioritize that side.
156
+ const [ sideDistance, sideEdge ] = getDistanceToNearestEdge(
157
+ position,
158
+ rect,
159
+ [ 'left', 'right' ]
160
+ );
161
+
162
+ const isPointInsideRect = isPointContainedByRect( position, rect );
163
+
147
164
  // Prioritize the element if the point is inside of an unmodified default block.
148
- if (
149
- isUnmodifiedDefaultBlock &&
150
- isPointContainedByRect( position, rect )
151
- ) {
165
+ if ( isUnmodifiedDefaultBlock && isPointInsideRect ) {
152
166
  distance = 0;
167
+ } else if (
168
+ orientation === 'vertical' &&
169
+ blockOrientation !== 'horizontal' &&
170
+ ( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||
171
+ ( ! isPointInsideRect &&
172
+ isPointWithinTopAndBottomBoundariesOfRect(
173
+ position,
174
+ rect
175
+ ) ) )
176
+ ) {
177
+ /**
178
+ * This condition should only apply when the layout is vertical (otherwise there's
179
+ * no need to create a Row) and dropzones should only activate when the block is
180
+ * either within and close to the sides of the target block or on its outer sides.
181
+ */
182
+ targetBlockIndex = blockIndex;
183
+ nearestSide = sideEdge;
153
184
  }
154
185
 
155
186
  if ( distance < minDistance ) {
@@ -175,6 +206,10 @@ export function getDropTargetPosition(
175
206
  const isAdjacentBlockUnmodifiedDefaultBlock =
176
207
  !! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;
177
208
 
209
+ // If the target index is set then group with the block at that index.
210
+ if ( targetBlockIndex !== null ) {
211
+ return [ targetBlockIndex, 'group', nearestSide ];
212
+ }
178
213
  // If both blocks are not unmodified default blocks then just insert between them.
179
214
  if (
180
215
  ! isNearestBlockUnmodifiedDefaultBlock &&
@@ -284,6 +319,7 @@ export default function useBlockDropZone( {
284
319
  dropTarget.index,
285
320
  {
286
321
  operation: dropTarget.operation,
322
+ nearestSide: dropTarget.nearestSide,
287
323
  }
288
324
  );
289
325
  const throttled = useThrottle(
@@ -333,28 +369,32 @@ export default function useBlockDropZone( {
333
369
  .getElementById( `block-${ clientId }` )
334
370
  .getBoundingClientRect(),
335
371
  blockIndex: getBlockIndex( clientId ),
372
+ blockOrientation:
373
+ getBlockListSettings( clientId )?.orientation,
336
374
  };
337
375
  } );
338
376
 
339
- const [ targetIndex, operation ] = getDropTargetPosition(
340
- blocksData,
341
- { x: event.clientX, y: event.clientY },
342
- getBlockListSettings( targetRootClientId )?.orientation,
343
- {
344
- dropZoneElement,
345
- parentBlockClientId,
346
- parentBlockOrientation: parentBlockClientId
347
- ? getBlockListSettings( parentBlockClientId )
348
- ?.orientation
349
- : undefined,
350
- rootBlockIndex: getBlockIndex( targetRootClientId ),
351
- }
352
- );
377
+ const [ targetIndex, operation, nearestSide ] =
378
+ getDropTargetPosition(
379
+ blocksData,
380
+ { x: event.clientX, y: event.clientY },
381
+ getBlockListSettings( targetRootClientId )?.orientation,
382
+ {
383
+ dropZoneElement,
384
+ parentBlockClientId,
385
+ parentBlockOrientation: parentBlockClientId
386
+ ? getBlockListSettings( parentBlockClientId )
387
+ ?.orientation
388
+ : undefined,
389
+ rootBlockIndex: getBlockIndex( targetRootClientId ),
390
+ }
391
+ );
353
392
 
354
393
  registry.batch( () => {
355
394
  setDropTarget( {
356
395
  index: targetIndex,
357
396
  operation,
397
+ nearestSide,
358
398
  } );
359
399
 
360
400
  const insertionPointClientId = [
@@ -366,6 +406,7 @@ export default function useBlockDropZone( {
366
406
 
367
407
  showInsertionPoint( insertionPointClientId, targetIndex, {
368
408
  operation,
409
+ nearestSide,
369
410
  } );
370
411
  } );
371
412
  },