@wordpress/block-editor 12.15.0 → 12.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (500) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -4
  3. package/build/components/block-canvas/index.js +22 -6
  4. package/build/components/block-canvas/index.js.map +1 -1
  5. package/build/components/block-card/index.js +1 -1
  6. package/build/components/block-card/index.js.map +1 -1
  7. package/build/components/block-controls/hook.js +3 -23
  8. package/build/components/block-controls/hook.js.map +1 -1
  9. package/build/components/block-edit/context.js +5 -1
  10. package/build/components/block-edit/context.js.map +1 -1
  11. package/build/components/block-edit/index.js +18 -9
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-info-slot-fill/index.js +3 -4
  14. package/build/components/block-info-slot-fill/index.js.map +1 -1
  15. package/build/components/block-list/block.js +28 -9
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/block.native.js +14 -5
  18. package/build/components/block-list/block.native.js.map +1 -1
  19. package/build/components/block-list/use-block-props/index.js +61 -18
  20. package/build/components/block-list/use-block-props/index.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  22. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  23. package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
  24. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  25. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  26. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  27. package/build/components/block-patterns-list/index.js +1 -1
  28. package/build/components/block-patterns-list/index.js.map +1 -1
  29. package/build/components/block-removal-warning-modal/index.js +2 -9
  30. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  31. package/build/components/block-rename/modal.js +3 -0
  32. package/build/components/block-rename/modal.js.map +1 -1
  33. package/build/components/block-settings/container.native.js +6 -4
  34. package/build/components/block-settings/container.native.js.map +1 -1
  35. package/build/components/block-styles/index.js +1 -1
  36. package/build/components/block-styles/index.js.map +1 -1
  37. package/build/components/block-styles/index.native.js +3 -2
  38. package/build/components/block-styles/index.native.js.map +1 -1
  39. package/build/components/block-toolbar/index.js +89 -27
  40. package/build/components/block-toolbar/index.js.map +1 -1
  41. package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
  42. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  43. package/build/components/block-tools/block-toolbar-popover.js +86 -0
  44. package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
  45. package/build/components/block-tools/index.js +27 -24
  46. package/build/components/block-tools/index.js.map +1 -1
  47. package/build/components/block-types-list/index.native.js +4 -3
  48. package/build/components/block-types-list/index.native.js.map +1 -1
  49. package/build/components/block-variation-picker/index.native.js +2 -1
  50. package/build/components/block-variation-picker/index.native.js.map +1 -1
  51. package/build/components/colors-gradients/control.js +28 -17
  52. package/build/components/colors-gradients/control.js.map +1 -1
  53. package/build/components/duotone-control/index.js +1 -4
  54. package/build/components/duotone-control/index.js.map +1 -1
  55. package/build/components/global-styles/color-panel.js +22 -20
  56. package/build/components/global-styles/color-panel.js.map +1 -1
  57. package/build/components/global-styles/filters-panel.js +9 -3
  58. package/build/components/global-styles/filters-panel.js.map +1 -1
  59. package/build/components/global-styles/typography-panel.js +20 -31
  60. package/build/components/global-styles/typography-panel.js.map +1 -1
  61. package/build/components/image-link-destinations/index.native.js +118 -0
  62. package/build/components/image-link-destinations/index.native.js.map +1 -0
  63. package/build/components/index.native.js +8 -0
  64. package/build/components/index.native.js.map +1 -1
  65. package/build/components/inserter/media-tab/media-panel.js +2 -2
  66. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  67. package/build/components/inserter/menu.js +14 -7
  68. package/build/components/inserter/menu.js.map +1 -1
  69. package/build/components/inserter/preview-panel.js +2 -2
  70. package/build/components/inserter/preview-panel.js.map +1 -1
  71. package/build/components/inserter-button/index.native.js +98 -0
  72. package/build/components/inserter-button/index.native.js.map +1 -0
  73. package/build/components/inserter-button/sparkles.js +23 -0
  74. package/build/components/inserter-button/sparkles.js.map +1 -0
  75. package/build/components/inserter-draggable-blocks/index.js +8 -4
  76. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  77. package/build/components/inspector-controls/fill.js +3 -3
  78. package/build/components/inspector-controls/fill.js.map +1 -1
  79. package/build/components/inspector-controls/fill.native.js +3 -3
  80. package/build/components/inspector-controls/fill.native.js.map +1 -1
  81. package/build/components/navigable-toolbar/index.js +2 -2
  82. package/build/components/navigable-toolbar/index.js.map +1 -1
  83. package/build/components/preview-options/index.js +6 -62
  84. package/build/components/preview-options/index.js.map +1 -1
  85. package/build/components/rich-text/content.js +26 -23
  86. package/build/components/rich-text/content.js.map +1 -1
  87. package/build/components/rich-text/get-rich-text-values.js +2 -1
  88. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  89. package/build/components/rich-text/index.js +2 -30
  90. package/build/components/rich-text/index.js.map +1 -1
  91. package/build/components/rich-text/index.native.js +9 -16
  92. package/build/components/rich-text/index.native.js.map +1 -1
  93. package/build/components/rich-text/native/get-format-colors.native.js +22 -24
  94. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  95. package/build/components/rich-text/native/index.native.js +7 -34
  96. package/build/components/rich-text/native/index.native.js.map +1 -1
  97. package/build/components/rich-text/use-input-rules.js +5 -1
  98. package/build/components/rich-text/use-input-rules.js.map +1 -1
  99. package/build/components/rich-text/with-deprecations.js +50 -0
  100. package/build/components/rich-text/with-deprecations.js.map +1 -0
  101. package/build/components/use-block-drop-zone/index.js +70 -8
  102. package/build/components/use-block-drop-zone/index.js.map +1 -1
  103. package/build/components/use-on-block-drop/index.js +1 -1
  104. package/build/components/use-on-block-drop/index.js.map +1 -1
  105. package/build/components/use-resize-canvas/index.js +4 -1
  106. package/build/components/use-resize-canvas/index.js.map +1 -1
  107. package/build/components/use-settings/index.js +14 -0
  108. package/build/components/use-settings/index.js.map +1 -1
  109. package/build/hooks/align.js +20 -68
  110. package/build/hooks/align.js.map +1 -1
  111. package/build/hooks/align.native.js +11 -1
  112. package/build/hooks/align.native.js.map +1 -1
  113. package/build/hooks/anchor.js +13 -29
  114. package/build/hooks/anchor.js.map +1 -1
  115. package/build/hooks/background.js +28 -31
  116. package/build/hooks/background.js.map +1 -1
  117. package/build/hooks/block-hooks.js +24 -32
  118. package/build/hooks/block-hooks.js.map +1 -1
  119. package/build/hooks/block-renaming.js +18 -22
  120. package/build/hooks/block-renaming.js.map +1 -1
  121. package/build/hooks/border.js +58 -80
  122. package/build/hooks/border.js.map +1 -1
  123. package/build/hooks/color.js +76 -89
  124. package/build/hooks/color.js.map +1 -1
  125. package/build/hooks/content-lock-ui.js +29 -29
  126. package/build/hooks/content-lock-ui.js.map +1 -1
  127. package/build/hooks/custom-class-name.js +12 -29
  128. package/build/hooks/custom-class-name.js.map +1 -1
  129. package/build/hooks/custom-fields.js +24 -38
  130. package/build/hooks/custom-fields.js.map +1 -1
  131. package/build/hooks/dimensions.js +21 -17
  132. package/build/hooks/dimensions.js.map +1 -1
  133. package/build/hooks/duotone.js +31 -61
  134. package/build/hooks/duotone.js.map +1 -1
  135. package/build/hooks/font-family.js +16 -25
  136. package/build/hooks/font-family.js.map +1 -1
  137. package/build/hooks/font-size.js +51 -119
  138. package/build/hooks/font-size.js.map +1 -1
  139. package/build/hooks/index.js +25 -14
  140. package/build/hooks/index.js.map +1 -1
  141. package/build/hooks/index.native.js +10 -3
  142. package/build/hooks/index.native.js.map +1 -1
  143. package/build/hooks/layout-child.js +68 -0
  144. package/build/hooks/layout-child.js.map +1 -0
  145. package/build/hooks/layout.js +16 -101
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/hooks/padding.js +2 -2
  148. package/build/hooks/padding.js.map +1 -1
  149. package/build/hooks/position.js +40 -62
  150. package/build/hooks/position.js.map +1 -1
  151. package/build/hooks/style.js +51 -88
  152. package/build/hooks/style.js.map +1 -1
  153. package/build/hooks/typography.js +34 -14
  154. package/build/hooks/typography.js.map +1 -1
  155. package/build/hooks/utils.js +154 -7
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/private-apis.js +0 -2
  158. package/build/private-apis.js.map +1 -1
  159. package/build/store/private-actions.js +8 -0
  160. package/build/store/private-actions.js.map +1 -1
  161. package/build/store/private-selectors.js +34 -0
  162. package/build/store/private-selectors.js.map +1 -1
  163. package/build/store/reducer.js +8 -0
  164. package/build/store/reducer.js.map +1 -1
  165. package/build/store/selectors.js +10 -60
  166. package/build/store/selectors.js.map +1 -1
  167. package/build/store/utils.js +66 -0
  168. package/build/store/utils.js.map +1 -0
  169. package/build/utils/object.js +21 -61
  170. package/build/utils/object.js.map +1 -1
  171. package/build/utils/selection.js +9 -1
  172. package/build/utils/selection.js.map +1 -1
  173. package/build-module/components/block-canvas/index.js +23 -7
  174. package/build-module/components/block-canvas/index.js.map +1 -1
  175. package/build-module/components/block-card/index.js +1 -1
  176. package/build-module/components/block-card/index.js.map +1 -1
  177. package/build-module/components/block-controls/hook.js +4 -24
  178. package/build-module/components/block-controls/hook.js.map +1 -1
  179. package/build-module/components/block-edit/context.js +2 -0
  180. package/build-module/components/block-edit/context.js.map +1 -1
  181. package/build-module/components/block-edit/index.js +19 -10
  182. package/build-module/components/block-edit/index.js.map +1 -1
  183. package/build-module/components/block-info-slot-fill/index.js +3 -3
  184. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  185. package/build-module/components/block-list/block.js +29 -10
  186. package/build-module/components/block-list/block.js.map +1 -1
  187. package/build-module/components/block-list/block.native.js +14 -5
  188. package/build-module/components/block-list/block.native.js.map +1 -1
  189. package/build-module/components/block-list/use-block-props/index.js +62 -19
  190. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  191. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  192. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  193. package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
  194. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  195. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  196. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  197. package/build-module/components/block-patterns-list/index.js +1 -1
  198. package/build-module/components/block-patterns-list/index.js.map +1 -1
  199. package/build-module/components/block-removal-warning-modal/index.js +3 -10
  200. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  201. package/build-module/components/block-rename/modal.js +3 -0
  202. package/build-module/components/block-rename/modal.js.map +1 -1
  203. package/build-module/components/block-settings/container.native.js +4 -2
  204. package/build-module/components/block-settings/container.native.js.map +1 -1
  205. package/build-module/components/block-styles/index.js +1 -1
  206. package/build-module/components/block-styles/index.js.map +1 -1
  207. package/build-module/components/block-styles/index.native.js +3 -2
  208. package/build-module/components/block-styles/index.native.js.map +1 -1
  209. package/build-module/components/block-toolbar/index.js +88 -25
  210. package/build-module/components/block-toolbar/index.js.map +1 -1
  211. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
  212. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  213. package/build-module/components/block-tools/block-toolbar-popover.js +76 -0
  214. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
  215. package/build-module/components/block-tools/index.js +27 -24
  216. package/build-module/components/block-tools/index.js.map +1 -1
  217. package/build-module/components/block-types-list/index.native.js +2 -1
  218. package/build-module/components/block-types-list/index.native.js.map +1 -1
  219. package/build-module/components/block-variation-picker/index.native.js +2 -1
  220. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +29 -18
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/duotone-control/index.js +1 -4
  224. package/build-module/components/duotone-control/index.js.map +1 -1
  225. package/build-module/components/global-styles/color-panel.js +23 -21
  226. package/build-module/components/global-styles/color-panel.js.map +1 -1
  227. package/build-module/components/global-styles/filters-panel.js +10 -4
  228. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  229. package/build-module/components/global-styles/typography-panel.js +20 -31
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/image-link-destinations/index.native.js +109 -0
  232. package/build-module/components/image-link-destinations/index.native.js.map +1 -0
  233. package/build-module/components/index.native.js +1 -0
  234. package/build-module/components/index.native.js.map +1 -1
  235. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  236. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  237. package/build-module/components/inserter/menu.js +14 -7
  238. package/build-module/components/inserter/menu.js.map +1 -1
  239. package/build-module/components/inserter/preview-panel.js +2 -2
  240. package/build-module/components/inserter/preview-panel.js.map +1 -1
  241. package/build-module/components/inserter-button/index.native.js +89 -0
  242. package/build-module/components/inserter-button/index.native.js.map +1 -0
  243. package/build-module/components/inserter-button/sparkles.js +15 -0
  244. package/build-module/components/inserter-button/sparkles.js.map +1 -0
  245. package/build-module/components/inserter-draggable-blocks/index.js +9 -5
  246. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  247. package/build-module/components/inspector-controls/fill.js +3 -3
  248. package/build-module/components/inspector-controls/fill.js.map +1 -1
  249. package/build-module/components/inspector-controls/fill.native.js +3 -3
  250. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  251. package/build-module/components/navigable-toolbar/index.js +2 -2
  252. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  253. package/build-module/components/preview-options/index.js +6 -62
  254. package/build-module/components/preview-options/index.js.map +1 -1
  255. package/build-module/components/rich-text/content.js +25 -21
  256. package/build-module/components/rich-text/content.js.map +1 -1
  257. package/build-module/components/rich-text/get-rich-text-values.js +2 -1
  258. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  259. package/build-module/components/rich-text/index.js +4 -32
  260. package/build-module/components/rich-text/index.js.map +1 -1
  261. package/build-module/components/rich-text/index.native.js +10 -18
  262. package/build-module/components/rich-text/index.native.js.map +1 -1
  263. package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
  264. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  265. package/build-module/components/rich-text/native/index.native.js +7 -34
  266. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  267. package/build-module/components/rich-text/use-input-rules.js +5 -1
  268. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  269. package/build-module/components/rich-text/with-deprecations.js +42 -0
  270. package/build-module/components/rich-text/with-deprecations.js.map +1 -0
  271. package/build-module/components/use-block-drop-zone/index.js +69 -8
  272. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  273. package/build-module/components/use-on-block-drop/index.js +1 -1
  274. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  275. package/build-module/components/use-resize-canvas/index.js +4 -1
  276. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  277. package/build-module/components/use-settings/index.js +13 -1
  278. package/build-module/components/use-settings/index.js.map +1 -1
  279. package/build-module/hooks/align.js +19 -66
  280. package/build-module/hooks/align.js.map +1 -1
  281. package/build-module/hooks/align.native.js +1 -0
  282. package/build-module/hooks/align.native.js.map +1 -1
  283. package/build-module/hooks/anchor.js +11 -26
  284. package/build-module/hooks/anchor.js.map +1 -1
  285. package/build-module/hooks/background.js +26 -28
  286. package/build-module/hooks/background.js.map +1 -1
  287. package/build-module/hooks/block-hooks.js +22 -30
  288. package/build-module/hooks/block-hooks.js.map +1 -1
  289. package/build-module/hooks/block-renaming.js +17 -21
  290. package/build-module/hooks/block-renaming.js.map +1 -1
  291. package/build-module/hooks/border.js +57 -78
  292. package/build-module/hooks/border.js.map +1 -1
  293. package/build-module/hooks/color.js +74 -86
  294. package/build-module/hooks/color.js.map +1 -1
  295. package/build-module/hooks/content-lock-ui.js +27 -27
  296. package/build-module/hooks/content-lock-ui.js.map +1 -1
  297. package/build-module/hooks/custom-class-name.js +11 -27
  298. package/build-module/hooks/custom-class-name.js.map +1 -1
  299. package/build-module/hooks/custom-fields.js +20 -39
  300. package/build-module/hooks/custom-fields.js.map +1 -1
  301. package/build-module/hooks/dimensions.js +21 -16
  302. package/build-module/hooks/dimensions.js.map +1 -1
  303. package/build-module/hooks/duotone.js +30 -61
  304. package/build-module/hooks/duotone.js.map +1 -1
  305. package/build-module/hooks/font-family.js +14 -23
  306. package/build-module/hooks/font-family.js.map +1 -1
  307. package/build-module/hooks/font-size.js +49 -119
  308. package/build-module/hooks/font-size.js.map +1 -1
  309. package/build-module/hooks/index.js +18 -14
  310. package/build-module/hooks/index.js.map +1 -1
  311. package/build-module/hooks/index.native.js +5 -3
  312. package/build-module/hooks/index.native.js.map +1 -1
  313. package/build-module/hooks/layout-child.js +60 -0
  314. package/build-module/hooks/layout-child.js.map +1 -0
  315. package/build-module/hooks/layout.js +13 -98
  316. package/build-module/hooks/layout.js.map +1 -1
  317. package/build-module/hooks/padding.js +2 -2
  318. package/build-module/hooks/padding.js.map +1 -1
  319. package/build-module/hooks/position.js +38 -59
  320. package/build-module/hooks/position.js.map +1 -1
  321. package/build-module/hooks/style.js +51 -84
  322. package/build-module/hooks/style.js.map +1 -1
  323. package/build-module/hooks/typography.js +33 -12
  324. package/build-module/hooks/typography.js.map +1 -1
  325. package/build-module/hooks/utils.js +149 -6
  326. package/build-module/hooks/utils.js.map +1 -1
  327. package/build-module/private-apis.js +0 -2
  328. package/build-module/private-apis.js.map +1 -1
  329. package/build-module/store/private-actions.js +7 -0
  330. package/build-module/store/private-actions.js.map +1 -1
  331. package/build-module/store/private-selectors.js +33 -1
  332. package/build-module/store/private-selectors.js.map +1 -1
  333. package/build-module/store/reducer.js +8 -0
  334. package/build-module/store/reducer.js.map +1 -1
  335. package/build-module/store/selectors.js +3 -53
  336. package/build-module/store/selectors.js.map +1 -1
  337. package/build-module/store/utils.js +56 -0
  338. package/build-module/store/utils.js.map +1 -0
  339. package/build-module/utils/object.js +21 -60
  340. package/build-module/utils/object.js.map +1 -1
  341. package/build-module/utils/selection.js +9 -1
  342. package/build-module/utils/selection.js.map +1 -1
  343. package/build-style/style-rtl.css +113 -293
  344. package/build-style/style.css +113 -293
  345. package/package.json +31 -31
  346. package/src/components/block-canvas/index.js +31 -17
  347. package/src/components/block-caption/README.md +2 -2
  348. package/src/components/block-card/index.js +5 -3
  349. package/src/components/block-card/style.scss +7 -3
  350. package/src/components/block-controls/hook.js +8 -30
  351. package/src/components/block-controls/test/index.js +3 -3
  352. package/src/components/block-edit/context.js +3 -0
  353. package/src/components/block-edit/index.js +36 -10
  354. package/src/components/block-info-slot-fill/index.js +6 -3
  355. package/src/components/block-inspector/style.scss +0 -4
  356. package/src/components/block-list/block.js +39 -5
  357. package/src/components/block-list/block.native.js +18 -4
  358. package/src/components/block-list/use-block-props/index.js +74 -21
  359. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
  360. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
  361. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
  362. package/src/components/block-patterns-list/index.js +1 -1
  363. package/src/components/block-removal-warning-modal/index.js +7 -14
  364. package/src/components/block-rename/modal.js +7 -1
  365. package/src/components/block-settings/container.native.js +3 -5
  366. package/src/components/block-styles/index.js +1 -1
  367. package/src/components/block-styles/index.native.js +4 -2
  368. package/src/components/block-styles/style.scss +0 -11
  369. package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
  370. package/src/components/block-toolbar/index.js +180 -95
  371. package/src/components/block-toolbar/style.scss +50 -66
  372. package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
  373. package/src/components/block-tools/block-toolbar-popover.js +90 -0
  374. package/src/components/block-tools/index.js +42 -29
  375. package/src/components/block-tools/style.scss +60 -172
  376. package/src/components/block-types-list/index.native.js +2 -1
  377. package/src/components/block-variation-picker/index.native.js +1 -1
  378. package/src/components/colors-gradients/control.js +49 -30
  379. package/src/components/colors-gradients/style.scss +0 -7
  380. package/src/components/duotone-control/index.js +2 -5
  381. package/src/components/duotone-control/style.scss +1 -6
  382. package/src/components/global-styles/color-panel.js +34 -25
  383. package/src/components/global-styles/filters-panel.js +8 -4
  384. package/src/components/global-styles/typography-panel.js +23 -43
  385. package/src/components/image-link-destinations/index.native.js +152 -0
  386. package/src/components/image-link-destinations/style.native.scss +16 -0
  387. package/src/components/index.native.js +1 -0
  388. package/src/components/inner-blocks/README.md +13 -2
  389. package/src/components/inserter/media-tab/media-panel.js +1 -1
  390. package/src/components/inserter/menu.js +16 -8
  391. package/src/components/inserter/preview-panel.js +2 -2
  392. package/src/components/inserter/style.scss +15 -17
  393. package/src/components/inserter-button/README.md +62 -0
  394. package/src/components/inserter-button/index.native.js +116 -0
  395. package/src/components/inserter-button/sparkles.js +15 -0
  396. package/src/components/inserter-button/style.native.scss +72 -0
  397. package/src/components/inserter-draggable-blocks/index.js +18 -5
  398. package/src/components/inspector-controls/fill.js +6 -3
  399. package/src/components/inspector-controls/fill.native.js +6 -3
  400. package/src/components/link-control/style.scss +1 -1
  401. package/src/components/link-control/test/index.js +1 -1
  402. package/src/components/navigable-toolbar/README.md +2 -0
  403. package/src/components/navigable-toolbar/index.js +2 -2
  404. package/src/components/preview-options/index.js +6 -86
  405. package/src/components/rich-text/content.js +27 -20
  406. package/src/components/rich-text/get-rich-text-values.js +6 -1
  407. package/src/components/rich-text/index.js +5 -46
  408. package/src/components/rich-text/index.native.js +8 -25
  409. package/src/components/rich-text/native/get-format-colors.native.js +33 -40
  410. package/src/components/rich-text/native/index.native.js +7 -48
  411. package/src/components/rich-text/use-input-rules.js +6 -1
  412. package/src/components/rich-text/with-deprecations.js +51 -0
  413. package/src/components/use-block-drop-zone/index.js +114 -14
  414. package/src/components/use-on-block-drop/index.js +2 -1
  415. package/src/components/use-resize-canvas/README.md +3 -3
  416. package/src/components/use-resize-canvas/index.js +4 -1
  417. package/src/components/use-settings/index.js +15 -1
  418. package/src/hooks/align.js +15 -76
  419. package/src/hooks/align.native.js +1 -0
  420. package/src/hooks/anchor.js +13 -33
  421. package/src/hooks/background.js +28 -23
  422. package/src/hooks/block-hooks.js +22 -51
  423. package/src/hooks/block-renaming.js +23 -37
  424. package/src/hooks/border.js +67 -118
  425. package/src/hooks/color.js +100 -132
  426. package/src/hooks/content-lock-ui.js +110 -122
  427. package/src/hooks/custom-class-name.js +8 -40
  428. package/src/hooks/custom-fields.js +20 -47
  429. package/src/hooks/dimensions.js +20 -16
  430. package/src/hooks/duotone.js +70 -127
  431. package/src/hooks/font-family.js +10 -29
  432. package/src/hooks/font-size.js +66 -162
  433. package/src/hooks/index.js +42 -14
  434. package/src/hooks/index.native.js +6 -3
  435. package/src/hooks/layout-child.js +53 -0
  436. package/src/hooks/layout.js +13 -102
  437. package/src/hooks/padding.js +2 -2
  438. package/src/hooks/position.js +50 -90
  439. package/src/hooks/style.js +117 -187
  440. package/src/hooks/test/align.js +1 -178
  441. package/src/hooks/typography.js +20 -16
  442. package/src/hooks/utils.js +187 -6
  443. package/src/private-apis.js +0 -2
  444. package/src/store/private-actions.js +8 -0
  445. package/src/store/private-selectors.js +45 -0
  446. package/src/store/reducer.js +8 -0
  447. package/src/store/selectors.js +5 -69
  448. package/src/store/utils.js +74 -0
  449. package/src/style.scss +0 -2
  450. package/src/utils/object.js +18 -69
  451. package/src/utils/selection.js +9 -2
  452. package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
  453. package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  454. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
  455. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  456. package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
  457. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  458. package/build/components/block-tools/back-compat.js +0 -45
  459. package/build/components/block-tools/back-compat.js.map +0 -1
  460. package/build/components/block-tools/block-contextual-toolbar.js +0 -91
  461. package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
  462. package/build/components/block-tools/selected-block-tools.js +0 -113
  463. package/build/components/block-tools/selected-block-tools.js.map +0 -1
  464. package/build/components/inserter/hooks/use-debounced-input.js +0 -22
  465. package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
  466. package/build/components/use-display-block-controls/index.js +0 -39
  467. package/build/components/use-display-block-controls/index.js.map +0 -1
  468. package/build/components/use-display-block-controls/index.native.js +0 -39
  469. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  470. package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
  471. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  472. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
  473. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  474. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
  475. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  476. package/build-module/components/block-tools/back-compat.js +0 -35
  477. package/build-module/components/block-tools/back-compat.js.map +0 -1
  478. package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
  479. package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
  480. package/build-module/components/block-tools/selected-block-tools.js +0 -105
  481. package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
  482. package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
  483. package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
  484. package/build-module/components/use-display-block-controls/index.js +0 -32
  485. package/build-module/components/use-display-block-controls/index.js.map +0 -1
  486. package/build-module/components/use-display-block-controls/index.native.js +0 -32
  487. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  488. package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
  489. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
  490. package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
  491. package/src/components/block-parent-selector/style.scss +0 -11
  492. package/src/components/block-tools/back-compat.js +0 -35
  493. package/src/components/block-tools/block-contextual-toolbar.js +0 -100
  494. package/src/components/block-tools/selected-block-tools.js +0 -127
  495. package/src/components/inserter/hooks/use-debounced-input.js +0 -18
  496. package/src/components/preview-options/README.md +0 -94
  497. package/src/components/preview-options/style.scss +0 -64
  498. package/src/components/use-display-block-controls/index.js +0 -36
  499. package/src/components/use-display-block-controls/index.native.js +0 -37
  500. package/src/hooks/test/color.js +0 -112
@@ -5,50 +5,43 @@ import { getColorObjectByAttributeValues } from '../../../components/colors';
5
5
 
6
6
  const FORMAT_TYPE = 'core/text-color';
7
7
  const REGEX_TO_MATCH = /^has-(.*)-color$/;
8
- const TAGS_TO_SEARCH = /\<mark/;
9
8
 
10
- export function getFormatColors( value, formats, colors ) {
11
- if ( value?.search( TAGS_TO_SEARCH ) !== -1 ) {
12
- const newFormats = formats.slice();
9
+ export function getFormatColors( formats, colors ) {
10
+ const newFormats = formats.slice();
13
11
 
14
- newFormats.forEach( ( format ) => {
15
- format.forEach( ( currentFormat ) => {
16
- if ( currentFormat?.type === FORMAT_TYPE ) {
17
- const className = currentFormat?.attributes?.class;
18
- currentFormat.attributes.style =
19
- currentFormat.attributes.style.replace( / /g, '' );
12
+ // We are looping through a sparse array where empty indices will be
13
+ // skipped.
14
+ newFormats.forEach( ( format ) => {
15
+ format.forEach( ( currentFormat ) => {
16
+ if ( currentFormat?.type === FORMAT_TYPE ) {
17
+ const className = currentFormat?.attributes?.class;
20
18
 
21
- className?.split( ' ' ).forEach( ( currentClass ) => {
22
- const match = currentClass.match( REGEX_TO_MATCH );
23
- if ( match ) {
24
- const [ , colorSlug ] =
25
- currentClass.match( REGEX_TO_MATCH );
26
- const colorObject = getColorObjectByAttributeValues(
27
- colors,
28
- colorSlug
29
- );
30
- const currentStyles =
31
- currentFormat?.attributes?.style;
32
- if (
33
- colorObject &&
34
- ( ! currentStyles ||
35
- currentStyles?.indexOf(
36
- colorObject.color
37
- ) === -1 )
38
- ) {
39
- currentFormat.attributes.style = [
40
- `color: ${ colorObject.color }`,
41
- currentStyles,
42
- ].join( ';' );
43
- }
19
+ className?.split( ' ' ).forEach( ( currentClass ) => {
20
+ const match = currentClass.match( REGEX_TO_MATCH );
21
+ if ( match ) {
22
+ const [ , colorSlug ] =
23
+ currentClass.match( REGEX_TO_MATCH );
24
+ const colorObject = getColorObjectByAttributeValues(
25
+ colors,
26
+ colorSlug
27
+ );
28
+ const currentStyles = currentFormat?.attributes?.style;
29
+ if (
30
+ colorObject &&
31
+ ( ! currentStyles ||
32
+ currentStyles?.indexOf( colorObject.color ) ===
33
+ -1 )
34
+ ) {
35
+ currentFormat.attributes.style = [
36
+ `color: ${ colorObject.color }`,
37
+ currentStyles,
38
+ ].join( ';' );
44
39
  }
45
- } );
46
- }
47
- } );
40
+ }
41
+ } );
42
+ }
48
43
  } );
44
+ } );
49
45
 
50
- return newFormats;
51
- }
52
-
53
- return formats;
46
+ return newFormats;
54
47
  }
@@ -105,27 +105,11 @@ const DEFAULT_FONT_SIZE = 16;
105
105
  const MIN_LINE_HEIGHT = 1;
106
106
 
107
107
  export class RichText extends Component {
108
- constructor( {
109
- value,
110
- selectionStart,
111
- selectionEnd,
112
- __unstableMultilineTag: multiline,
113
- } ) {
108
+ constructor( { value, selectionStart, selectionEnd } ) {
114
109
  super( ...arguments );
115
110
 
116
- this.isMultiline = false;
117
- if ( multiline === true || multiline === 'p' || multiline === 'li' ) {
118
- this.multilineTag = multiline === true ? 'p' : multiline;
119
- this.isMultiline = true;
120
- }
121
-
122
- if ( this.multilineTag === 'li' ) {
123
- this.multilineWrapperTags = [ 'ul', 'ol' ];
124
- }
125
-
126
111
  this.isIOS = Platform.OS === 'ios';
127
112
  this.createRecord = this.createRecord.bind( this );
128
- this.restoreParagraphTags = this.restoreParagraphTags.bind( this );
129
113
  this.onChangeFromAztec = this.onChangeFromAztec.bind( this );
130
114
  this.onKeyDown = this.onKeyDown.bind( this );
131
115
  this.handleEnter = this.handleEnter.bind( this );
@@ -196,7 +180,7 @@ export class RichText extends Component {
196
180
 
197
181
  const { formats, replacements, text } = currentValue;
198
182
  const { activeFormats } = this.state;
199
- const newFormats = getFormatColors( value, formats, colorPalette );
183
+ const newFormats = getFormatColors( formats, colorPalette );
200
184
 
201
185
  return {
202
186
  formats: newFormats,
@@ -223,8 +207,6 @@ export class RichText extends Component {
223
207
  ...create( {
224
208
  html: this.value,
225
209
  range: null,
226
- multilineTag: this.multilineTag,
227
- multilineWrapperTags: this.multilineWrapperTags,
228
210
  preserveWhiteSpace,
229
211
  } ),
230
212
  };
@@ -235,12 +217,7 @@ export class RichText extends Component {
235
217
 
236
218
  valueToFormat( value ) {
237
219
  // Remove the outer root tags.
238
- return this.removeRootTagsProducedByAztec(
239
- toHTMLString( {
240
- value,
241
- multilineTag: this.multilineTag,
242
- } )
243
- );
220
+ return this.removeRootTagsProducedByAztec( toHTMLString( { value } ) );
244
221
  }
245
222
 
246
223
  getActiveFormatNames( record ) {
@@ -357,29 +334,15 @@ export class RichText extends Component {
357
334
  const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
358
335
  unescapeSpaces( event.nativeEvent.text )
359
336
  );
360
- let formattedContent = contentWithoutRootTag;
361
- if ( ! this.isIOS ) {
362
- formattedContent = this.restoreParagraphTags(
363
- contentWithoutRootTag,
364
- this.multilineTag
365
- );
366
- }
367
337
 
368
338
  this.debounceCreateUndoLevel();
369
- const refresh = this.value !== formattedContent;
370
- this.value = formattedContent;
339
+ const refresh = this.value !== contentWithoutRootTag;
340
+ this.value = contentWithoutRootTag;
371
341
 
372
342
  // We don't want to refresh if our goal is just to create a record.
373
343
  if ( refresh ) {
374
- this.props.onChange( formattedContent );
375
- }
376
- }
377
-
378
- restoreParagraphTags( value, tag ) {
379
- if ( tag === 'p' && ( ! value || ! value.startsWith( '<p>' ) ) ) {
380
- return '<p>' + value + '</p>';
344
+ this.props.onChange( contentWithoutRootTag );
381
345
  }
382
- return value;
383
346
  }
384
347
 
385
348
  /*
@@ -739,8 +702,6 @@ export class RichText extends Component {
739
702
  if ( Array.isArray( value ) ) {
740
703
  return create( {
741
704
  html: childrenBlock.toHTML( value ),
742
- multilineTag: this.multilineTag,
743
- multilineWrapperTags: this.multilineWrapperTags,
744
705
  preserveWhiteSpace,
745
706
  } );
746
707
  }
@@ -748,8 +709,6 @@ export class RichText extends Component {
748
709
  if ( this.props.format === 'string' ) {
749
710
  return create( {
750
711
  html: value,
751
- multilineTag: this.multilineTag,
752
- multilineWrapperTags: this.multilineWrapperTags,
753
712
  preserveWhiteSpace,
754
713
  } );
755
714
  }
@@ -1323,7 +1282,7 @@ export class RichText extends Component {
1323
1282
  fontWeight={ this.props.fontWeight }
1324
1283
  fontStyle={ this.props.fontStyle }
1325
1284
  disableEditingMenu={ disableEditingMenu }
1326
- isMultiline={ this.isMultiline }
1285
+ isMultiline={ false }
1327
1286
  textAlign={ this.props.textAlign }
1328
1287
  { ...( this.isIOS ? { maxWidth } : {} ) }
1329
1288
  minWidth={ minWidth }
@@ -28,7 +28,12 @@ function findSelection( blocks ) {
28
28
  if ( attributeKey ) {
29
29
  blocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[
30
30
  attributeKey
31
- ].replace( START_OF_SELECTED_AREA, '' );
31
+ ]
32
+ // To do: refactor this to use rich text's selection instead, so
33
+ // we no longer have to use on this hack inserting a special
34
+ // character.
35
+ .toString()
36
+ .replace( START_OF_SELECTED_AREA, '' );
32
37
  return [ blocks[ i ].clientId, attributeKey, 0, 0 ];
33
38
  }
34
39
 
@@ -0,0 +1,51 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { forwardRef } from '@wordpress/element';
5
+ import { children as childrenSource } from '@wordpress/blocks';
6
+ import { useInstanceId } from '@wordpress/compose';
7
+ import { __unstableCreateElement } from '@wordpress/rich-text';
8
+ import deprecated from '@wordpress/deprecated';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import RichTextMultiline from './multiline';
14
+
15
+ export function withDeprecations( Component ) {
16
+ return forwardRef( ( props, ref ) => {
17
+ let value = props.value;
18
+ let onChange = props.onChange;
19
+
20
+ // Handle deprecated format.
21
+ if ( Array.isArray( value ) ) {
22
+ deprecated( 'wp.blockEditor.RichText value prop as children type', {
23
+ since: '6.1',
24
+ version: '6.3',
25
+ alternative: 'value prop as string',
26
+ link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',
27
+ } );
28
+
29
+ value = childrenSource.toHTML( props.value );
30
+ onChange = ( newValue ) =>
31
+ props.onChange(
32
+ childrenSource.fromDOM(
33
+ __unstableCreateElement( document, newValue ).childNodes
34
+ )
35
+ );
36
+ }
37
+
38
+ const NewComponent = props.multiline ? RichTextMultiline : Component;
39
+ const instanceId = useInstanceId( NewComponent );
40
+
41
+ return (
42
+ <NewComponent
43
+ { ...props }
44
+ identifier={ props.identifier || instanceId }
45
+ value={ value }
46
+ onChange={ onChange }
47
+ ref={ ref }
48
+ />
49
+ );
50
+ } );
51
+ }
@@ -20,6 +20,10 @@ import {
20
20
  } from '../../utils/math';
21
21
  import { store as blockEditorStore } from '../../store';
22
22
 
23
+ const THRESHOLD_DISTANCE = 30;
24
+ const MINIMUM_HEIGHT_FOR_THRESHOLD = 120;
25
+ const MINIMUM_WIDTH_FOR_THRESHOLD = 120;
26
+
23
27
  /** @typedef {import('../../utils/math').WPPoint} WPPoint */
24
28
  /** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */
25
29
 
@@ -48,24 +52,86 @@ import { store as blockEditorStore } from '../../store';
48
52
  * @param {WPBlockData[]} blocksData The block data list.
49
53
  * @param {WPPoint} position The position of the item being dragged.
50
54
  * @param {WPBlockListOrientation} orientation The orientation of the block list.
55
+ * @param {Object} options Additional options.
51
56
  * @return {[number, WPDropOperation]} The drop target position.
52
57
  */
53
58
  export function getDropTargetPosition(
54
59
  blocksData,
55
60
  position,
56
- orientation = 'vertical'
61
+ orientation = 'vertical',
62
+ options = {}
57
63
  ) {
58
64
  const allowedEdges =
59
65
  orientation === 'horizontal'
60
66
  ? [ 'left', 'right' ]
61
67
  : [ 'top', 'bottom' ];
62
68
 
63
- const isRightToLeft = isRTL();
64
-
65
69
  let nearestIndex = 0;
66
70
  let insertPosition = 'before';
67
71
  let minDistance = Infinity;
68
72
 
73
+ const {
74
+ dropZoneElement,
75
+ parentBlockOrientation,
76
+ rootBlockIndex = 0,
77
+ } = options;
78
+
79
+ // Allow before/after when dragging over the top/bottom edges of the drop zone.
80
+ if ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {
81
+ const rect = dropZoneElement.getBoundingClientRect();
82
+ const [ distance, edge ] = getDistanceToNearestEdge( position, rect, [
83
+ 'top',
84
+ 'bottom',
85
+ ] );
86
+
87
+ // If dragging over the top or bottom of the drop zone, insert the block
88
+ // before or after the parent block. This only applies to blocks that use
89
+ // a drop zone element, typically container blocks such as Group or Cover.
90
+ if (
91
+ rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&
92
+ distance < THRESHOLD_DISTANCE
93
+ ) {
94
+ if ( edge === 'top' ) {
95
+ return [ rootBlockIndex, 'before' ];
96
+ }
97
+ if ( edge === 'bottom' ) {
98
+ return [ rootBlockIndex + 1, 'after' ];
99
+ }
100
+ }
101
+ }
102
+
103
+ const isRightToLeft = isRTL();
104
+
105
+ // Allow before/after when dragging over the left/right edges of the drop zone.
106
+ if ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {
107
+ const rect = dropZoneElement.getBoundingClientRect();
108
+ const [ distance, edge ] = getDistanceToNearestEdge( position, rect, [
109
+ 'left',
110
+ 'right',
111
+ ] );
112
+
113
+ // If dragging over the left or right of the drop zone, insert the block
114
+ // before or after the parent block. This only applies to blocks that use
115
+ // a drop zone element, typically container blocks such as Group.
116
+ if (
117
+ rect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&
118
+ distance < THRESHOLD_DISTANCE
119
+ ) {
120
+ if (
121
+ ( isRightToLeft && edge === 'right' ) ||
122
+ ( ! isRightToLeft && edge === 'left' )
123
+ ) {
124
+ return [ rootBlockIndex, 'before' ];
125
+ }
126
+ if (
127
+ ( isRightToLeft && edge === 'left' ) ||
128
+ ( ! isRightToLeft && edge === 'right' )
129
+ ) {
130
+ return [ rootBlockIndex + 1, 'after' ];
131
+ }
132
+ }
133
+ }
134
+
69
135
  blocksData.forEach(
70
136
  ( { isUnmodifiedDefaultBlock, getBoundingClientRect, blockIndex } ) => {
71
137
  const rect = getBoundingClientRect();
@@ -150,19 +216,27 @@ export default function useBlockDropZone( {
150
216
  operation: 'insert',
151
217
  } );
152
218
 
153
- const isDisabled = useSelect(
219
+ const { isDisabled, parentBlockClientId, rootBlockIndex } = useSelect(
154
220
  ( select ) => {
155
221
  const {
156
222
  __unstableIsWithinBlockOverlay,
157
223
  __unstableHasActiveBlockOverlayActive,
224
+ getBlockIndex,
225
+ getBlockParents,
158
226
  getBlockEditingMode,
159
227
  } = select( blockEditorStore );
160
228
  const blockEditingMode = getBlockEditingMode( targetRootClientId );
161
- return (
162
- blockEditingMode !== 'default' ||
163
- __unstableHasActiveBlockOverlayActive( targetRootClientId ) ||
164
- __unstableIsWithinBlockOverlay( targetRootClientId )
165
- );
229
+ return {
230
+ parentBlockClientId:
231
+ getBlockParents( targetRootClientId, true )[ 0 ] || '',
232
+ rootBlockIndex: getBlockIndex( targetRootClientId ),
233
+ isDisabled:
234
+ blockEditingMode !== 'default' ||
235
+ __unstableHasActiveBlockOverlayActive(
236
+ targetRootClientId
237
+ ) ||
238
+ __unstableIsWithinBlockOverlay( targetRootClientId ),
239
+ };
166
240
  },
167
241
  [ targetRootClientId ]
168
242
  );
@@ -172,9 +246,15 @@ export default function useBlockDropZone( {
172
246
  const { showInsertionPoint, hideInsertionPoint } =
173
247
  useDispatch( blockEditorStore );
174
248
 
175
- const onBlockDrop = useOnBlockDrop( targetRootClientId, dropTarget.index, {
176
- operation: dropTarget.operation,
177
- } );
249
+ const onBlockDrop = useOnBlockDrop(
250
+ dropTarget.operation === 'before' || dropTarget.operation === 'after'
251
+ ? parentBlockClientId
252
+ : targetRootClientId,
253
+ dropTarget.index,
254
+ {
255
+ operation: dropTarget.operation,
256
+ }
257
+ );
178
258
  const throttled = useThrottle(
179
259
  useCallback(
180
260
  ( event, ownerDocument ) => {
@@ -211,7 +291,16 @@ export default function useBlockDropZone( {
211
291
  const [ targetIndex, operation ] = getDropTargetPosition(
212
292
  blocksData,
213
293
  { x: event.clientX, y: event.clientY },
214
- getBlockListSettings( targetRootClientId )?.orientation
294
+ getBlockListSettings( targetRootClientId )?.orientation,
295
+ {
296
+ dropZoneElement,
297
+ parentBlockClientId,
298
+ parentBlockOrientation: parentBlockClientId
299
+ ? getBlockListSettings( parentBlockClientId )
300
+ ?.orientation
301
+ : undefined,
302
+ rootBlockIndex,
303
+ }
215
304
  );
216
305
 
217
306
  registry.batch( () => {
@@ -219,18 +308,29 @@ export default function useBlockDropZone( {
219
308
  index: targetIndex,
220
309
  operation,
221
310
  } );
222
- showInsertionPoint( targetRootClientId, targetIndex, {
311
+
312
+ const insertionPointClientId = [
313
+ 'before',
314
+ 'after',
315
+ ].includes( operation )
316
+ ? parentBlockClientId
317
+ : targetRootClientId;
318
+
319
+ showInsertionPoint( insertionPointClientId, targetIndex, {
223
320
  operation,
224
321
  } );
225
322
  } );
226
323
  },
227
324
  [
325
+ dropZoneElement,
228
326
  getBlocks,
229
327
  targetRootClientId,
230
328
  getBlockListSettings,
231
329
  registry,
232
330
  showInsertionPoint,
233
331
  getBlockIndex,
332
+ parentBlockClientId,
333
+ rootBlockIndex,
234
334
  ]
235
335
  ),
236
336
  200
@@ -292,9 +292,10 @@ export default function useOnBlockDrop(
292
292
  operation,
293
293
  getBlockOrder,
294
294
  getBlocksByClientId,
295
- insertBlocks,
296
295
  moveBlocksToPosition,
296
+ registry,
297
297
  removeBlocks,
298
+ replaceBlocks,
298
299
  targetBlockIndex,
299
300
  targetRootClientId,
300
301
  ]
@@ -1,6 +1,6 @@
1
1
  # useResizeCanvas
2
2
 
3
- This React hook generates inline CSS suitable for resizing a container to fit a device's dimensions. It adjusts the CSS according to the current device dimensions. It has no effect on desktop.
3
+ This React hook generates inline CSS suitable for resizing a container to fit a device's dimensions. It adjusts the CSS according to the current device dimensions.
4
4
 
5
5
  On-page CSS media queries are also updated to match the width of the device.
6
6
 
@@ -14,14 +14,14 @@ Note that this is currently experimental, and is available as `__experimentalUse
14
14
 
15
15
  ### Usage
16
16
 
17
- The hook returns a style object which can be applied to a container. It is passed the current device type, which can be obtained from `__experimentalGetPreviewDeviceType`.
17
+ The hook returns a style object which can be applied to a container. It is passed the current device type, which can be obtained from `getDeviceType`.
18
18
 
19
19
  ```jsx
20
20
  import { __experimentalUseResizeCanvas as useResizeCanvas } from '@wordpress/block-editor';
21
21
 
22
22
  function ResizedContainer() {
23
23
  const deviceType = useSelect( ( select ) => {
24
- return select( 'core/edit-post' ).__experimentalGetPreviewDeviceType();
24
+ return select( 'core/editor' ).getDeviceType();
25
25
  }, [] );
26
26
  const inlineStyles = useResizeCanvas( deviceType );
27
27
 
@@ -67,7 +67,10 @@ export default function useResizeCanvas( deviceType ) {
67
67
  overflowY: 'auto',
68
68
  };
69
69
  default:
70
- return null;
70
+ return {
71
+ marginLeft: marginHorizontal,
72
+ marginRight: marginHorizontal,
73
+ };
71
74
  }
72
75
  };
73
76
 
@@ -103,7 +103,7 @@ const removeCustomPrefixes = ( path ) => {
103
103
  * @param {Object} value Object to merge
104
104
  * @return {Array} Array of merged items
105
105
  */
106
- function mergeOrigins( value ) {
106
+ export function mergeOrigins( value ) {
107
107
  let result = mergeCache.get( value );
108
108
  if ( ! result ) {
109
109
  result = [ 'default', 'theme', 'custom' ].flatMap(
@@ -115,6 +115,20 @@ function mergeOrigins( value ) {
115
115
  }
116
116
  const mergeCache = new WeakMap();
117
117
 
118
+ /**
119
+ * For settings like `color.palette`, which have a value that is an object
120
+ * with `default`, `theme`, `custom`, with field values that are arrays of
121
+ * items, see if any of the three origins have values.
122
+ *
123
+ * @param {Object} value Object to check
124
+ * @return {boolean} Whether the object has values in any of the three origins
125
+ */
126
+ export function hasMergedOrigins( value ) {
127
+ return [ 'default', 'theme', 'custom' ].some(
128
+ ( key ) => value?.[ key ]?.length
129
+ );
130
+ }
131
+
118
132
  /**
119
133
  * Hook that retrieves the given settings for the block instance in use.
120
134
  *
@@ -6,7 +6,6 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { createHigherOrderComponent } from '@wordpress/compose';
10
9
  import { addFilter } from '@wordpress/hooks';
11
10
  import {
12
11
  getBlockSupport,
@@ -108,9 +107,9 @@ export function addAttribute( settings ) {
108
107
  return settings;
109
108
  }
110
109
 
111
- function BlockEditAlignmentToolbarControls( {
112
- blockName,
113
- attributes,
110
+ function BlockEditAlignmentToolbarControlsPure( {
111
+ name: blockName,
112
+ align,
114
113
  setAttributes,
115
114
  } ) {
116
115
  // Compute the block valid alignments by taking into account,
@@ -144,7 +143,7 @@ function BlockEditAlignmentToolbarControls( {
144
143
  return (
145
144
  <BlockControls group="block" __experimentalShareWithChildBlocks>
146
145
  <BlockAlignmentControl
147
- value={ attributes.align }
146
+ value={ align }
148
147
  onChange={ updateAlignment }
149
148
  controls={ validAlignments }
150
149
  />
@@ -152,80 +151,30 @@ function BlockEditAlignmentToolbarControls( {
152
151
  );
153
152
  }
154
153
 
155
- /**
156
- * Override the default edit UI to include new toolbar controls for block
157
- * alignment, if block defines support.
158
- *
159
- * @param {Function} BlockEdit Original component.
160
- *
161
- * @return {Function} Wrapped component.
162
- */
163
- export const withAlignmentControls = createHigherOrderComponent(
164
- ( BlockEdit ) => ( props ) => {
165
- const hasAlignmentSupport = hasBlockSupport(
166
- props.name,
167
- 'align',
168
- false
169
- );
170
-
171
- return (
172
- <>
173
- { hasAlignmentSupport && (
174
- <BlockEditAlignmentToolbarControls
175
- blockName={ props.name }
176
- attributes={ props.attributes }
177
- setAttributes={ props.setAttributes }
178
- />
179
- ) }
180
- <BlockEdit key="edit" { ...props } />
181
- </>
182
- );
154
+ export default {
155
+ shareWithChildBlocks: true,
156
+ edit: BlockEditAlignmentToolbarControlsPure,
157
+ useBlockProps,
158
+ attributeKeys: [ 'align' ],
159
+ hasSupport( name ) {
160
+ return hasBlockSupport( name, 'align', false );
183
161
  },
184
- 'withAlignmentControls'
185
- );
162
+ };
186
163
 
187
- function BlockListBlockWithDataAlign( { block: BlockListBlock, props } ) {
188
- const { name, attributes } = props;
189
- const { align } = attributes;
164
+ function useBlockProps( { name, align } ) {
190
165
  const blockAllowedAlignments = getValidAlignments(
191
166
  getBlockSupport( name, 'align' ),
192
167
  hasBlockSupport( name, 'alignWide', true )
193
168
  );
194
169
  const validAlignments = useAvailableAlignments( blockAllowedAlignments );
195
170
 
196
- let wrapperProps = props.wrapperProps;
197
171
  if ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {
198
- wrapperProps = { ...wrapperProps, 'data-align': align };
172
+ return { 'data-align': align };
199
173
  }
200
174
 
201
- return <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;
175
+ return {};
202
176
  }
203
177
 
204
- /**
205
- * Override the default block element to add alignment wrapper props.
206
- *
207
- * @param {Function} BlockListBlock Original component.
208
- *
209
- * @return {Function} Wrapped component.
210
- */
211
- export const withDataAlign = createHigherOrderComponent(
212
- ( BlockListBlock ) => ( props ) => {
213
- // If an alignment is not assigned, there's no need to go through the
214
- // effort to validate or assign its value.
215
- if ( props.attributes.align === undefined ) {
216
- return <BlockListBlock { ...props } />;
217
- }
218
-
219
- return (
220
- <BlockListBlockWithDataAlign
221
- block={ BlockListBlock }
222
- props={ props }
223
- />
224
- );
225
- },
226
- 'withDataAlign'
227
- );
228
-
229
178
  /**
230
179
  * Override props assigned to save component to inject alignment class name if
231
180
  * block supports it.
@@ -260,16 +209,6 @@ addFilter(
260
209
  'core/editor/align/addAttribute',
261
210
  addAttribute
262
211
  );
263
- addFilter(
264
- 'editor.BlockListBlock',
265
- 'core/editor/align/with-data-align',
266
- withDataAlign
267
- );
268
- addFilter(
269
- 'editor.BlockEdit',
270
- 'core/editor/align/with-toolbar-controls',
271
- withAlignmentControls
272
- );
273
212
  addFilter(
274
213
  'blocks.getSaveContent.extraProps',
275
214
  'core/editor/align/addAssignedAlign',