@wordpress/block-editor 12.5.0 → 12.7.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 (442) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -6
  3. package/build/autocompleters/block.js +6 -2
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-draggable/index.js +6 -3
  6. package/build/components/block-draggable/index.js.map +1 -1
  7. package/build/components/block-draggable/index.native.js +2 -2
  8. package/build/components/block-draggable/index.native.js.map +1 -1
  9. package/build/components/block-edit/edit.js +25 -13
  10. package/build/components/block-edit/edit.js.map +1 -1
  11. package/build/components/block-editing-mode/index.js +1 -1
  12. package/build/components/block-editing-mode/index.js.map +1 -1
  13. package/build/components/block-list/block-outline.native.js +14 -18
  14. package/build/components/block-list/block-outline.native.js.map +1 -1
  15. package/build/components/block-list/block.js +4 -2
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/block.native.js +21 -42
  18. package/build/components/block-list/block.native.js.map +1 -1
  19. package/build/components/block-list/index.js +2 -4
  20. package/build/components/block-list/index.js.map +1 -1
  21. package/build/components/block-mover/index.native.js +1 -1
  22. package/build/components/block-mover/index.native.js.map +1 -1
  23. package/build/components/block-parent-selector/index.js +6 -21
  24. package/build/components/block-parent-selector/index.js.map +1 -1
  25. package/build/components/block-preview/auto.js +6 -1
  26. package/build/components/block-preview/auto.js.map +1 -1
  27. package/build/components/block-removal-warning-modal/index.js +1 -4
  28. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  29. package/build/components/block-settings/button.native.js +2 -2
  30. package/build/components/block-settings/button.native.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +3 -17
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
  34. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  35. package/build/components/block-toolbar/index.js +4 -33
  36. package/build/components/block-toolbar/index.js.map +1 -1
  37. package/build/components/block-toolbar/index.native.js +62 -3
  38. package/build/components/block-toolbar/index.native.js.map +1 -1
  39. package/build/components/block-toolbar/utils.js +56 -51
  40. package/build/components/block-toolbar/utils.js.map +1 -1
  41. package/build/components/block-tools/block-contextual-toolbar.js +4 -2
  42. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  43. package/build/components/block-variation-picker/index.native.js +10 -20
  44. package/build/components/block-variation-picker/index.native.js.map +1 -1
  45. package/build/components/colors-gradients/control.js +4 -2
  46. package/build/components/colors-gradients/control.js.map +1 -1
  47. package/build/components/editor-styles/index.js +2 -2
  48. package/build/components/editor-styles/index.js.map +1 -1
  49. package/build/components/font-sizes/fluid-utils.js +11 -11
  50. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  51. package/build/components/global-styles/behaviors-panel.js +66 -0
  52. package/build/components/global-styles/behaviors-panel.js.map +1 -0
  53. package/build/components/global-styles/color-panel.js +21 -15
  54. package/build/components/global-styles/color-panel.js.map +1 -1
  55. package/build/components/global-styles/dimensions-panel.js +13 -2
  56. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  57. package/build/components/global-styles/get-block-css-selector.js +4 -8
  58. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  59. package/build/components/global-styles/hooks.js +131 -27
  60. package/build/components/global-styles/hooks.js.map +1 -1
  61. package/build/components/global-styles/index.js +20 -0
  62. package/build/components/global-styles/index.js.map +1 -1
  63. package/build/components/global-styles/typography-panel.js +18 -3
  64. package/build/components/global-styles/typography-panel.js.map +1 -1
  65. package/build/components/global-styles/typography-utils.js +4 -4
  66. package/build/components/global-styles/typography-utils.js.map +1 -1
  67. package/build/components/global-styles/use-global-styles-output.js +12 -18
  68. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  69. package/build/components/global-styles/utils.js +7 -7
  70. package/build/components/global-styles/utils.js.map +1 -1
  71. package/build/components/iframe/index.js +36 -48
  72. package/build/components/iframe/index.js.map +1 -1
  73. package/build/components/iframe/use-compatibility-styles.js +5 -0
  74. package/build/components/iframe/use-compatibility-styles.js.map +1 -1
  75. package/build/components/index.js +1 -10
  76. package/build/components/index.js.map +1 -1
  77. package/build/components/inner-blocks/index.js +3 -1
  78. package/build/components/inner-blocks/index.js.map +1 -1
  79. package/build/components/inner-blocks/index.native.js +3 -1
  80. package/build/components/inner-blocks/index.native.js.map +1 -1
  81. package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
  82. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  83. package/build/components/inserter/hooks/use-block-types-state.js +6 -2
  84. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  85. package/build/components/inserter/hooks/use-debounced-input.js +5 -7
  86. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -1
  87. package/build/components/inserter/hooks/use-patterns-state.js +3 -2
  88. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  89. package/build/components/inserter/index.js +2 -4
  90. package/build/components/inserter/index.js.map +1 -1
  91. package/build/components/inserter/index.native.js +21 -32
  92. package/build/components/inserter/index.native.js.map +1 -1
  93. package/build/components/inserter/reusable-block-rename-hint.js +23 -3
  94. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
  95. package/build/components/inserter/reusable-blocks-tab.js +3 -2
  96. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  97. package/build/components/inserter-list-item/index.js +1 -1
  98. package/build/components/inserter-list-item/index.js.map +1 -1
  99. package/build/components/link-control/index.js +51 -7
  100. package/build/components/link-control/index.js.map +1 -1
  101. package/build/components/link-control/link-preview.js +3 -3
  102. package/build/components/link-control/link-preview.js.map +1 -1
  103. package/build/components/link-control/search-item.js +1 -1
  104. package/build/components/link-control/search-item.js.map +1 -1
  105. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  106. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  107. package/build/components/list-view/use-list-view-drop-zone.js +6 -1
  108. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  109. package/build/components/media-placeholder/index.native.js +65 -31
  110. package/build/components/media-placeholder/index.native.js.map +1 -1
  111. package/build/components/media-replace-flow/index.native.js +15 -3
  112. package/build/components/media-replace-flow/index.native.js.map +1 -1
  113. package/build/components/preview-options/index.js +2 -2
  114. package/build/components/preview-options/index.js.map +1 -1
  115. package/build/components/rich-text/content.js +0 -36
  116. package/build/components/rich-text/content.js.map +1 -1
  117. package/build/components/rich-text/format-edit.js +57 -28
  118. package/build/components/rich-text/format-edit.js.map +1 -1
  119. package/build/components/rich-text/get-rich-text-values.js +111 -0
  120. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  121. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  122. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
  124. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  125. package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
  126. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  127. package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
  128. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  129. package/build/components/spacing-sizes-control/utils.js +2 -2
  130. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  131. package/build/components/use-block-display-information/index.js +7 -3
  132. package/build/components/use-block-display-information/index.js.map +1 -1
  133. package/build/components/use-block-drop-zone/index.native.js +49 -8
  134. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  135. package/build/components/use-setting/index.js +5 -9
  136. package/build/components/use-setting/index.js.map +1 -1
  137. package/build/hooks/behaviors.js +5 -12
  138. package/build/hooks/behaviors.js.map +1 -1
  139. package/build/hooks/border.js +2 -1
  140. package/build/hooks/border.js.map +1 -1
  141. package/build/hooks/margin.js +1 -1
  142. package/build/hooks/margin.js.map +1 -1
  143. package/build/hooks/padding.js +1 -1
  144. package/build/hooks/padding.js.map +1 -1
  145. package/build/hooks/style.js +11 -2
  146. package/build/hooks/style.js.map +1 -1
  147. package/build/hooks/utils.js +1 -7
  148. package/build/hooks/utils.js.map +1 -1
  149. package/build/private-apis.js +10 -3
  150. package/build/private-apis.js.map +1 -1
  151. package/build/store/actions.js +3 -4
  152. package/build/store/actions.js.map +1 -1
  153. package/build/store/private-selectors.js +5 -6
  154. package/build/store/private-selectors.js.map +1 -1
  155. package/build/store/reducer.js +0 -1
  156. package/build/store/reducer.js.map +1 -1
  157. package/build/store/selectors.js +23 -79
  158. package/build/store/selectors.js.map +1 -1
  159. package/build/utils/object.js +38 -2
  160. package/build/utils/object.js.map +1 -1
  161. package/build-module/autocompleters/block.js +7 -3
  162. package/build-module/autocompleters/block.js.map +1 -1
  163. package/build-module/components/block-draggable/index.js +6 -3
  164. package/build-module/components/block-draggable/index.js.map +1 -1
  165. package/build-module/components/block-draggable/index.native.js +2 -2
  166. package/build-module/components/block-draggable/index.native.js.map +1 -1
  167. package/build-module/components/block-edit/edit.js +27 -10
  168. package/build-module/components/block-edit/edit.js.map +1 -1
  169. package/build-module/components/block-editing-mode/index.js +1 -1
  170. package/build-module/components/block-editing-mode/index.js.map +1 -1
  171. package/build-module/components/block-list/block-outline.native.js +14 -18
  172. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  173. package/build-module/components/block-list/block.js +4 -2
  174. package/build-module/components/block-list/block.js.map +1 -1
  175. package/build-module/components/block-list/block.native.js +24 -43
  176. package/build-module/components/block-list/block.native.js.map +1 -1
  177. package/build-module/components/block-list/index.js +2 -3
  178. package/build-module/components/block-list/index.js.map +1 -1
  179. package/build-module/components/block-mover/index.native.js +3 -3
  180. package/build-module/components/block-mover/index.native.js.map +1 -1
  181. package/build-module/components/block-parent-selector/index.js +7 -22
  182. package/build-module/components/block-parent-selector/index.js.map +1 -1
  183. package/build-module/components/block-preview/auto.js +6 -1
  184. package/build-module/components/block-preview/auto.js.map +1 -1
  185. package/build-module/components/block-removal-warning-modal/index.js +1 -4
  186. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  187. package/build-module/components/block-settings/button.native.js +3 -3
  188. package/build-module/components/block-settings/button.native.js.map +1 -1
  189. package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -18
  190. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  191. package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
  192. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  193. package/build-module/components/block-toolbar/index.js +6 -35
  194. package/build-module/components/block-toolbar/index.js.map +1 -1
  195. package/build-module/components/block-toolbar/index.native.js +60 -4
  196. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  197. package/build-module/components/block-toolbar/utils.js +54 -49
  198. package/build-module/components/block-toolbar/utils.js.map +1 -1
  199. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -2
  200. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  201. package/build-module/components/block-variation-picker/index.native.js +13 -23
  202. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  203. package/build-module/components/colors-gradients/control.js +3 -2
  204. package/build-module/components/colors-gradients/control.js.map +1 -1
  205. package/build-module/components/editor-styles/index.js +2 -2
  206. package/build-module/components/editor-styles/index.js.map +1 -1
  207. package/build-module/components/font-sizes/fluid-utils.js +11 -11
  208. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  209. package/build-module/components/global-styles/behaviors-panel.js +57 -0
  210. package/build-module/components/global-styles/behaviors-panel.js.map +1 -0
  211. package/build-module/components/global-styles/color-panel.js +21 -15
  212. package/build-module/components/global-styles/color-panel.js.map +1 -1
  213. package/build-module/components/global-styles/dimensions-panel.js +13 -2
  214. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  215. package/build-module/components/global-styles/get-block-css-selector.js +4 -8
  216. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  217. package/build-module/components/global-styles/hooks.js +127 -27
  218. package/build-module/components/global-styles/hooks.js.map +1 -1
  219. package/build-module/components/global-styles/index.js +2 -1
  220. package/build-module/components/global-styles/index.js.map +1 -1
  221. package/build-module/components/global-styles/typography-panel.js +18 -3
  222. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  223. package/build-module/components/global-styles/typography-utils.js +4 -4
  224. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  225. package/build-module/components/global-styles/use-global-styles-output.js +13 -18
  226. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  227. package/build-module/components/global-styles/utils.js +6 -6
  228. package/build-module/components/global-styles/utils.js.map +1 -1
  229. package/build-module/components/iframe/index.js +37 -49
  230. package/build-module/components/iframe/index.js.map +1 -1
  231. package/build-module/components/iframe/use-compatibility-styles.js +5 -0
  232. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
  233. package/build-module/components/index.js +0 -5
  234. package/build-module/components/index.js.map +1 -1
  235. package/build-module/components/inner-blocks/index.js +3 -1
  236. package/build-module/components/inner-blocks/index.js.map +1 -1
  237. package/build-module/components/inner-blocks/index.native.js +3 -1
  238. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  239. package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
  240. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  241. package/build-module/components/inserter/hooks/use-block-types-state.js +7 -3
  242. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  243. package/build-module/components/inserter/hooks/use-debounced-input.js +5 -7
  244. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -1
  245. package/build-module/components/inserter/hooks/use-patterns-state.js +3 -2
  246. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  247. package/build-module/components/inserter/index.js +2 -4
  248. package/build-module/components/inserter/index.js.map +1 -1
  249. package/build-module/components/inserter/index.native.js +22 -33
  250. package/build-module/components/inserter/index.native.js.map +1 -1
  251. package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
  252. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
  253. package/build-module/components/inserter/reusable-blocks-tab.js +3 -2
  254. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  255. package/build-module/components/inserter-list-item/index.js +1 -1
  256. package/build-module/components/inserter-list-item/index.js.map +1 -1
  257. package/build-module/components/link-control/index.js +49 -7
  258. package/build-module/components/link-control/index.js.map +1 -1
  259. package/build-module/components/link-control/link-preview.js +3 -3
  260. package/build-module/components/link-control/link-preview.js.map +1 -1
  261. package/build-module/components/link-control/search-item.js +1 -1
  262. package/build-module/components/link-control/search-item.js.map +1 -1
  263. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  264. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  265. package/build-module/components/list-view/use-list-view-drop-zone.js +6 -1
  266. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  267. package/build-module/components/media-placeholder/index.native.js +66 -33
  268. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  269. package/build-module/components/media-replace-flow/index.native.js +15 -3
  270. package/build-module/components/media-replace-flow/index.native.js.map +1 -1
  271. package/build-module/components/preview-options/index.js +2 -2
  272. package/build-module/components/preview-options/index.js.map +1 -1
  273. package/build-module/components/rich-text/content.js +1 -36
  274. package/build-module/components/rich-text/content.js.map +1 -1
  275. package/build-module/components/rich-text/format-edit.js +51 -26
  276. package/build-module/components/rich-text/format-edit.js.map +1 -1
  277. package/build-module/components/rich-text/get-rich-text-values.js +100 -0
  278. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  279. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  280. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  281. package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
  282. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  283. package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
  284. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  285. package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
  286. package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  287. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  288. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  289. package/build-module/components/use-block-display-information/index.js +7 -3
  290. package/build-module/components/use-block-display-information/index.js.map +1 -1
  291. package/build-module/components/use-block-drop-zone/index.native.js +50 -8
  292. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  293. package/build-module/components/use-setting/index.js +5 -9
  294. package/build-module/components/use-setting/index.js.map +1 -1
  295. package/build-module/hooks/behaviors.js +5 -12
  296. package/build-module/hooks/behaviors.js.map +1 -1
  297. package/build-module/hooks/border.js +2 -1
  298. package/build-module/hooks/border.js.map +1 -1
  299. package/build-module/hooks/margin.js +1 -1
  300. package/build-module/hooks/margin.js.map +1 -1
  301. package/build-module/hooks/padding.js +1 -1
  302. package/build-module/hooks/padding.js.map +1 -1
  303. package/build-module/hooks/style.js +11 -2
  304. package/build-module/hooks/style.js.map +1 -1
  305. package/build-module/hooks/utils.js +2 -7
  306. package/build-module/hooks/utils.js.map +1 -1
  307. package/build-module/private-apis.js +7 -2
  308. package/build-module/private-apis.js.map +1 -1
  309. package/build-module/store/actions.js +4 -5
  310. package/build-module/store/actions.js.map +1 -1
  311. package/build-module/store/private-selectors.js +3 -3
  312. package/build-module/store/private-selectors.js.map +1 -1
  313. package/build-module/store/reducer.js +0 -1
  314. package/build-module/store/reducer.js.map +1 -1
  315. package/build-module/store/selectors.js +20 -75
  316. package/build-module/store/selectors.js.map +1 -1
  317. package/build-module/utils/object.js +34 -2
  318. package/build-module/utils/object.js.map +1 -1
  319. package/build-style/content-rtl.css +2 -1
  320. package/build-style/content.css +2 -1
  321. package/build-style/style-rtl.css +25 -6
  322. package/build-style/style.css +25 -6
  323. package/package.json +32 -32
  324. package/src/autocompleters/block.js +21 -6
  325. package/src/components/block-controls/README.md +89 -0
  326. package/src/components/block-draggable/index.js +13 -4
  327. package/src/components/block-draggable/index.native.js +7 -3
  328. package/src/components/block-draggable/test/index.native.js +2 -57
  329. package/src/components/block-edit/edit.js +26 -9
  330. package/src/components/block-edit/test/edit.js +1 -1
  331. package/src/components/block-editing-mode/index.js +1 -1
  332. package/src/components/block-list/block-outline.native.js +26 -25
  333. package/src/components/block-list/block.js +6 -1
  334. package/src/components/block-list/block.native.js +24 -38
  335. package/src/components/block-list/block.native.scss +18 -40
  336. package/src/components/block-list/index.js +3 -6
  337. package/src/components/block-list/style.native.scss +3 -3
  338. package/src/components/block-list/test/block-invalid-warning.native.js +8 -1
  339. package/src/components/block-mover/index.native.js +3 -3
  340. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +40 -6
  341. package/src/components/block-parent-selector/index.js +30 -42
  342. package/src/components/block-preview/auto.js +8 -1
  343. package/src/components/block-preview/style.scss +2 -1
  344. package/src/components/block-removal-warning-modal/index.js +0 -3
  345. package/src/components/block-settings/button.native.js +12 -6
  346. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -13
  347. package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
  348. package/src/components/block-toolbar/index.js +36 -64
  349. package/src/components/block-toolbar/index.native.js +86 -6
  350. package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
  351. package/src/components/block-toolbar/test/index.native.js +42 -0
  352. package/src/components/block-toolbar/utils.js +57 -45
  353. package/src/components/block-tools/block-contextual-toolbar.js +43 -35
  354. package/src/components/block-tools/style.scss +17 -5
  355. package/src/components/block-variation-picker/index.native.js +52 -72
  356. package/src/components/button-block-appender/styles.native.scss +2 -2
  357. package/src/components/caption/README.md +49 -0
  358. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  359. package/src/components/colors-gradients/control.js +3 -2
  360. package/src/components/editor-styles/index.js +2 -2
  361. package/src/components/font-sizes/fluid-utils.js +17 -17
  362. package/src/components/font-sizes/test/fluid-utils.js +6 -6
  363. package/src/components/global-styles/behaviors-panel.js +71 -0
  364. package/src/components/global-styles/color-panel.js +23 -16
  365. package/src/components/global-styles/dimensions-panel.js +8 -2
  366. package/src/components/global-styles/get-block-css-selector.js +5 -9
  367. package/src/components/global-styles/hooks.js +134 -31
  368. package/src/components/global-styles/index.js +3 -0
  369. package/src/components/global-styles/test/typography-utils.js +6 -6
  370. package/src/components/global-styles/typography-panel.js +17 -5
  371. package/src/components/global-styles/typography-utils.js +4 -4
  372. package/src/components/global-styles/use-global-styles-output.js +36 -18
  373. package/src/components/global-styles/utils.js +17 -7
  374. package/src/components/iframe/index.js +30 -56
  375. package/src/components/iframe/use-compatibility-styles.js +5 -0
  376. package/src/components/index.js +0 -5
  377. package/src/components/inner-blocks/README.md +10 -0
  378. package/src/components/inner-blocks/index.js +4 -0
  379. package/src/components/inner-blocks/index.native.js +4 -0
  380. package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
  381. package/src/components/inserter/hooks/use-block-types-state.js +15 -6
  382. package/src/components/inserter/hooks/use-debounced-input.js +8 -7
  383. package/src/components/inserter/hooks/use-patterns-state.js +2 -1
  384. package/src/components/inserter/index.js +2 -3
  385. package/src/components/inserter/index.native.js +17 -36
  386. package/src/components/inserter/reusable-block-rename-hint.js +18 -1
  387. package/src/components/inserter/reusable-blocks-tab.js +4 -1
  388. package/src/components/inserter/style.native.scss +10 -15
  389. package/src/components/inserter-list-item/index.js +3 -1
  390. package/src/components/link-control/README.md +12 -3
  391. package/src/components/link-control/index.js +47 -7
  392. package/src/components/link-control/link-preview.js +6 -4
  393. package/src/components/link-control/search-item.js +1 -1
  394. package/src/components/link-control/style.scss +11 -3
  395. package/src/components/link-control/test/index.js +28 -1
  396. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  397. package/src/components/list-view/use-list-view-drop-zone.js +5 -1
  398. package/src/components/media-placeholder/index.native.js +108 -59
  399. package/src/components/media-placeholder/styles.native.scss +59 -24
  400. package/src/components/media-replace-flow/index.native.js +12 -3
  401. package/src/components/media-upload/test/index.native.js +1 -0
  402. package/src/components/preview-options/README.md +18 -17
  403. package/src/components/preview-options/index.js +2 -2
  404. package/src/components/rich-text/content.js +1 -46
  405. package/src/components/rich-text/format-edit.js +62 -38
  406. package/src/components/rich-text/get-rich-text-values.js +99 -0
  407. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  408. package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
  409. package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
  410. package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
  411. package/src/components/spacing-sizes-control/test/utils.js +9 -1
  412. package/src/components/spacing-sizes-control/utils.js +2 -2
  413. package/src/components/text-transform-control/README.md +44 -0
  414. package/src/components/use-block-display-information/index.js +12 -5
  415. package/src/components/use-block-drop-zone/index.native.js +65 -28
  416. package/src/components/use-setting/index.js +8 -8
  417. package/src/hooks/behaviors.js +10 -16
  418. package/src/hooks/border.js +2 -1
  419. package/src/hooks/margin.js +4 -1
  420. package/src/hooks/padding.js +4 -1
  421. package/src/hooks/style.js +7 -3
  422. package/src/hooks/utils.js +5 -7
  423. package/src/private-apis.js +9 -1
  424. package/src/store/actions.js +23 -30
  425. package/src/store/private-selectors.js +3 -6
  426. package/src/store/reducer.js +0 -1
  427. package/src/store/selectors.js +36 -85
  428. package/src/store/test/actions.js +3 -0
  429. package/src/store/test/private-selectors.js +5 -5
  430. package/src/store/test/reducer.js +14 -7
  431. package/src/store/test/selectors.js +8 -7
  432. package/src/utils/object.js +32 -2
  433. package/src/utils/test/object.js +36 -0
  434. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  435. package/build/components/block-mobile-toolbar/index.native.js +0 -135
  436. package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
  437. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  438. package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
  439. package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
  440. package/src/components/block-mobile-toolbar/index.native.js +0 -127
  441. package/src/components/block-mobile-toolbar/style.native.scss +0 -16
  442. /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
@@ -57,6 +57,7 @@ export function kebabCase(str) {
57
57
  }
58
58
  /**
59
59
  * Clones an object.
60
+ * Arrays are also cloned as arrays.
60
61
  * Non-object values are returned unchanged.
61
62
  *
62
63
  * @param {*} object Object to clone.
@@ -64,6 +65,10 @@ export function kebabCase(str) {
64
65
  */
65
66
 
66
67
  function cloneObject(object) {
68
+ if (Array.isArray(object)) {
69
+ return object.map(cloneObject);
70
+ }
71
+
67
72
  if (object && typeof object === 'object') {
68
73
  return { ...Object.fromEntries(Object.entries(object).map(([key, value]) => [key, cloneObject(value)]))
69
74
  };
@@ -74,7 +79,7 @@ function cloneObject(object) {
74
79
  /**
75
80
  * Immutably sets a value inside an object. Like `lodash#set`, but returning a
76
81
  * new object. Treats nullish initial values as empty objects. Clones any
77
- * nested objects.
82
+ * nested objects. Supports arrays, too.
78
83
  *
79
84
  * @param {Object} object Object to set a value in.
80
85
  * @param {number|string|Array} path Path in the object to modify.
@@ -88,7 +93,11 @@ export function setImmutably(object, path, value) {
88
93
  const newObject = object ? cloneObject(object) : {};
89
94
  normalizedPath.reduce((acc, key, i) => {
90
95
  if (acc[key] === undefined) {
91
- acc[key] = {};
96
+ if (Number.isInteger(path[i + 1])) {
97
+ acc[key] = [];
98
+ } else {
99
+ acc[key] = {};
100
+ }
92
101
  }
93
102
 
94
103
  if (i === normalizedPath.length - 1) {
@@ -99,4 +108,27 @@ export function setImmutably(object, path, value) {
99
108
  }, newObject);
100
109
  return newObject;
101
110
  }
111
+ /**
112
+ * Helper util to return a value from a certain path of the object.
113
+ * Path is specified as either:
114
+ * - a string of properties, separated by dots, for example: "x.y".
115
+ * - an array of properties, for example `[ 'x', 'y' ]`.
116
+ * You can also specify a default value in case the result is nullish.
117
+ *
118
+ * @param {Object} object Input object.
119
+ * @param {string|Array} path Path to the object property.
120
+ * @param {*} defaultValue Default value if the value at the specified path is nullish.
121
+ * @return {*} Value of the object property at the specified path.
122
+ */
123
+
124
+ export const getValueFromObjectPath = (object, path, defaultValue) => {
125
+ var _value;
126
+
127
+ const normalizedPath = Array.isArray(path) ? path : path.split('.');
128
+ let value = object;
129
+ normalizedPath.forEach(fieldName => {
130
+ value = value?.[fieldName];
131
+ });
132
+ return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
133
+ };
102
134
  //# sourceMappingURL=object.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/utils/object.js"],"names":["paramCase","normalizePath","path","Array","isArray","toString","kebabCase","str","input","replace","splitRegexp","cloneObject","object","Object","fromEntries","entries","map","key","value","setImmutably","normalizedPath","newObject","reduce","acc","i","undefined","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,aAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AAC9B,MAAKC,KAAK,CAACC,OAAN,CAAeF,IAAf,CAAL,EAA6B;AAC5B,WAAOA,IAAP;AACA,GAFD,MAEO,IAAK,OAAOA,IAAP,KAAgB,QAArB,EAAgC;AACtC,WAAO,CAAEA,IAAI,CAACG,QAAL,EAAF,CAAP;AACA;;AAED,SAAO,CAAEH,IAAF,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASI,SAAT,CAAoBC,GAApB,EAA0B;AAChC,MAAIC,KAAK,GAAGD,GAAZ;;AACA,MAAK,OAAOA,GAAP,KAAe,QAApB,EAA+B;AAAA;;AAC9BC,IAAAA,KAAK,oBAAGD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AuC;AACtCH,MAAAA,GAAG,CAAEN,GAAF,CAAH,GAAaC,KAAb;AACA;;AACD,WAAOK,GAAG,CAAEN,GAAF,CAAV;AACA,GARD,EAQGI,SARH;AAUA,SAAOA,SAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase } from 'change-case';\n\n/**\n * Converts a path to an array of its fragments.\n * Supports strings, numbers and arrays:\n *\n * 'foo' => [ 'foo' ]\n * 2 => [ '2' ]\n * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]\n *\n * @param {string|number|Array} path Path\n * @return {Array} Normalized path.\n */\nfunction normalizePath( path ) {\n\tif ( Array.isArray( path ) ) {\n\t\treturn path;\n\t} else if ( typeof path === 'number' ) {\n\t\treturn [ path.toString() ];\n\t}\n\n\treturn [ path ];\n}\n\n/**\n * Converts any string to kebab case.\n * Backwards compatible with Lodash's `_.kebabCase()`.\n * Backwards compatible with `_wp_to_kebab_case()`.\n *\n * @see https://lodash.com/docs/4.17.15#kebabCase\n * @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/\n *\n * @param {string} str String to convert.\n * @return {string} Kebab-cased string\n */\nexport function kebabCase( str ) {\n\tlet input = str;\n\tif ( typeof str !== 'string' ) {\n\t\tinput = str?.toString?.() ?? '';\n\t}\n\n\t// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970\n\tinput = input.replace( /['\\u2019]/, '' );\n\n\treturn paramCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar\n\t\t\t/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar\n\t\t\t/([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3\n\t\t\t/([A-Z])([A-Z][a-z])/g, // FOOBar => foo-bar\n\t\t],\n\t} );\n}\n\n/**\n * Clones an object.\n * Non-object values are returned unchanged.\n *\n * @param {*} object Object to clone.\n * @return {*} Cloned object, or original literal non-object value.\n */\nfunction cloneObject( object ) {\n\tif ( object && typeof object === 'object' ) {\n\t\treturn {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tcloneObject( value ),\n\t\t\t\t] )\n\t\t\t),\n\t\t};\n\t}\n\n\treturn object;\n}\n\n/**\n * Immutably sets a value inside an object. Like `lodash#set`, but returning a\n * new object. Treats nullish initial values as empty objects. Clones any\n * nested objects.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function setImmutably( object, path, value ) {\n\tconst normalizedPath = normalizePath( path );\n\tconst newObject = object ? cloneObject( object ) : {};\n\n\tnormalizedPath.reduce( ( acc, key, i ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tacc[ key ] = {};\n\t\t}\n\t\tif ( i === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, newObject );\n\n\treturn newObject;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/utils/object.js"],"names":["paramCase","normalizePath","path","Array","isArray","toString","kebabCase","str","input","replace","splitRegexp","cloneObject","object","map","Object","fromEntries","entries","key","value","setImmutably","normalizedPath","newObject","reduce","acc","i","undefined","Number","isInteger","length","getValueFromObjectPath","defaultValue","split","forEach","fieldName"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,aAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AAC9B,MAAKC,KAAK,CAACC,OAAN,CAAeF,IAAf,CAAL,EAA6B;AAC5B,WAAOA,IAAP;AACA,GAFD,MAEO,I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AAgBY,YAAhB;AACA,CAPM","sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase } from 'change-case';\n\n/**\n * Converts a path to an array of its fragments.\n * Supports strings, numbers and arrays:\n *\n * 'foo' => [ 'foo' ]\n * 2 => [ '2' ]\n * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]\n *\n * @param {string|number|Array} path Path\n * @return {Array} Normalized path.\n */\nfunction normalizePath( path ) {\n\tif ( Array.isArray( path ) ) {\n\t\treturn path;\n\t} else if ( typeof path === 'number' ) {\n\t\treturn [ path.toString() ];\n\t}\n\n\treturn [ path ];\n}\n\n/**\n * Converts any string to kebab case.\n * Backwards compatible with Lodash's `_.kebabCase()`.\n * Backwards compatible with `_wp_to_kebab_case()`.\n *\n * @see https://lodash.com/docs/4.17.15#kebabCase\n * @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/\n *\n * @param {string} str String to convert.\n * @return {string} Kebab-cased string\n */\nexport function kebabCase( str ) {\n\tlet input = str;\n\tif ( typeof str !== 'string' ) {\n\t\tinput = str?.toString?.() ?? '';\n\t}\n\n\t// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970\n\tinput = input.replace( /['\\u2019]/, '' );\n\n\treturn paramCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar\n\t\t\t/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar\n\t\t\t/([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3\n\t\t\t/([A-Z])([A-Z][a-z])/g, // FOOBar => foo-bar\n\t\t],\n\t} );\n}\n\n/**\n * Clones an object.\n * Arrays are also cloned as arrays.\n * Non-object values are returned unchanged.\n *\n * @param {*} object Object to clone.\n * @return {*} Cloned object, or original literal non-object value.\n */\nfunction cloneObject( object ) {\n\tif ( Array.isArray( object ) ) {\n\t\treturn object.map( cloneObject );\n\t}\n\n\tif ( object && typeof object === 'object' ) {\n\t\treturn {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tcloneObject( value ),\n\t\t\t\t] )\n\t\t\t),\n\t\t};\n\t}\n\n\treturn object;\n}\n\n/**\n * Immutably sets a value inside an object. Like `lodash#set`, but returning a\n * new object. Treats nullish initial values as empty objects. Clones any\n * nested objects. Supports arrays, too.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function setImmutably( object, path, value ) {\n\tconst normalizedPath = normalizePath( path );\n\tconst newObject = object ? cloneObject( object ) : {};\n\n\tnormalizedPath.reduce( ( acc, key, i ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ i + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( i === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, newObject );\n\n\treturn newObject;\n}\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n * You can also specify a default value in case the result is nullish.\n *\n * @param {Object} object Input object.\n * @param {string|Array} path Path to the object property.\n * @param {*} defaultValue Default value if the value at the specified path is nullish.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path, defaultValue ) => {\n\tconst normalizedPath = Array.isArray( path ) ? path : path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value ?? defaultValue;\n};\n"]}
@@ -708,7 +708,8 @@
708
708
  opacity: 0.62;
709
709
  }
710
710
  :where(body .is-layout-constrained) .block-editor-default-block-appender > :first-child:first-child {
711
- margin-block-start: 0;
711
+ -webkit-margin-before: 0;
712
+ margin-block-start: 0;
712
713
  }
713
714
  .block-editor-default-block-appender .components-drop-zone__content-icon {
714
715
  display: none;
@@ -708,7 +708,8 @@
708
708
  opacity: 0.62;
709
709
  }
710
710
  :where(body .is-layout-constrained) .block-editor-default-block-appender > :first-child:first-child {
711
- margin-block-start: 0;
711
+ -webkit-margin-before: 0;
712
+ margin-block-start: 0;
712
713
  }
713
714
  .block-editor-default-block-appender .components-drop-zone__content-icon {
714
715
  display: none;
@@ -332,6 +332,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
332
332
  .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
333
333
  display: none;
334
334
  }
335
+ .block-editor-block-contextual-toolbar.is-collapsed::after {
336
+ content: "";
337
+ position: absolute;
338
+ right: 100%;
339
+ width: 48px;
340
+ height: 100%;
341
+ background: linear-gradient(to left, #fff, transparent);
342
+ }
335
343
  @media (min-width: 782px) {
336
344
  .block-editor-block-contextual-toolbar.is-fixed {
337
345
  margin-right: 180px;
@@ -351,11 +359,11 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
351
359
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
352
360
  width: initial;
353
361
  }
354
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers {
362
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar {
355
363
  flex-grow: initial;
356
364
  width: initial;
357
365
  }
358
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers::before {
366
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar::before {
359
367
  content: "";
360
368
  width: 1px;
361
369
  height: 24px;
@@ -473,7 +481,10 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
473
481
  }
474
482
  @media (min-width: 960px) {
475
483
  .block-editor-block-contextual-toolbar.is-fixed {
476
- width: calc(100% - 240px - 256px);
484
+ width: auto;
485
+ }
486
+ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
487
+ width: calc(100% - 280px - 256px);
477
488
  }
478
489
  }
479
490
 
@@ -1011,6 +1022,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1011
1022
  overflow: hidden;
1012
1023
  }
1013
1024
  .block-editor-block-preview__container .block-editor-block-preview__content {
1025
+ width: 100%;
1014
1026
  top: 0;
1015
1027
  right: 0;
1016
1028
  transform-origin: top right;
@@ -1972,7 +1984,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1972
1984
  flex-direction: row-reverse;
1973
1985
  justify-content: flex-start;
1974
1986
  gap: 8px;
1975
- padding: 8px;
1987
+ padding: 8px 16px 16px;
1976
1988
  order: 20;
1977
1989
  }
1978
1990
 
@@ -2017,6 +2029,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2017
2029
  overflow: hidden;
2018
2030
  text-overflow: ellipsis;
2019
2031
  display: inline-block;
2032
+ width: 100%;
2033
+ }
2034
+ .block-editor-link-control__search-item .components-menu-item__item mark {
2035
+ font-weight: 600;
2036
+ color: inherit;
2037
+ background-color: transparent;
2020
2038
  }
2021
2039
  .block-editor-link-control__search-item .components-menu-item__shortcut {
2022
2040
  color: #757575;
@@ -2071,12 +2089,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2071
2089
  }
2072
2090
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2073
2091
  display: block;
2074
- margin-bottom: 0.2em;
2075
2092
  font-weight: 500;
2076
2093
  position: relative;
2094
+ line-height: 24px;
2077
2095
  }
2078
2096
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
2079
- font-weight: 700;
2097
+ font-weight: 600;
2080
2098
  color: inherit;
2081
2099
  background-color: transparent;
2082
2100
  }
@@ -2135,6 +2153,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2135
2153
  display: flex;
2136
2154
  flex-direction: row;
2137
2155
  width: 100%;
2156
+ align-items: center;
2138
2157
  }
2139
2158
 
2140
2159
  .block-editor-link-control__search-item-bottom {
@@ -332,6 +332,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
332
332
  .block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
333
333
  display: none;
334
334
  }
335
+ .block-editor-block-contextual-toolbar.is-collapsed::after {
336
+ content: "";
337
+ position: absolute;
338
+ left: 100%;
339
+ width: 48px;
340
+ height: 100%;
341
+ background: linear-gradient(to right, #fff, transparent);
342
+ }
335
343
  @media (min-width: 782px) {
336
344
  .block-editor-block-contextual-toolbar.is-fixed {
337
345
  margin-left: 180px;
@@ -351,11 +359,11 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
351
359
  .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
352
360
  width: initial;
353
361
  }
354
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers {
362
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar {
355
363
  flex-grow: initial;
356
364
  width: initial;
357
365
  }
358
- .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar.is-showing-movers::before {
366
+ .block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar::before {
359
367
  content: "";
360
368
  width: 1px;
361
369
  height: 24px;
@@ -473,7 +481,10 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
473
481
  }
474
482
  @media (min-width: 960px) {
475
483
  .block-editor-block-contextual-toolbar.is-fixed {
476
- width: calc(100% - 240px - 256px);
484
+ width: auto;
485
+ }
486
+ .is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
487
+ width: calc(100% - 280px - 256px);
477
488
  }
478
489
  }
479
490
 
@@ -1011,6 +1022,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1011
1022
  overflow: hidden;
1012
1023
  }
1013
1024
  .block-editor-block-preview__container .block-editor-block-preview__content {
1025
+ width: 100%;
1014
1026
  top: 0;
1015
1027
  left: 0;
1016
1028
  transform-origin: top left;
@@ -1973,7 +1985,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
1973
1985
  flex-direction: row-reverse;
1974
1986
  justify-content: flex-start;
1975
1987
  gap: 8px;
1976
- padding: 8px;
1988
+ padding: 8px 16px 16px;
1977
1989
  order: 20;
1978
1990
  }
1979
1991
 
@@ -2018,6 +2030,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2018
2030
  overflow: hidden;
2019
2031
  text-overflow: ellipsis;
2020
2032
  display: inline-block;
2033
+ width: 100%;
2034
+ }
2035
+ .block-editor-link-control__search-item .components-menu-item__item mark {
2036
+ font-weight: 600;
2037
+ color: inherit;
2038
+ background-color: transparent;
2021
2039
  }
2022
2040
  .block-editor-link-control__search-item .components-menu-item__shortcut {
2023
2041
  color: #757575;
@@ -2072,12 +2090,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2072
2090
  }
2073
2091
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title {
2074
2092
  display: block;
2075
- margin-bottom: 0.2em;
2076
2093
  font-weight: 500;
2077
2094
  position: relative;
2095
+ line-height: 24px;
2078
2096
  }
2079
2097
  .block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
2080
- font-weight: 700;
2098
+ font-weight: 600;
2081
2099
  color: inherit;
2082
2100
  background-color: transparent;
2083
2101
  }
@@ -2136,6 +2154,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
2136
2154
  display: flex;
2137
2155
  flex-direction: row;
2138
2156
  width: 100%;
2157
+ align-items: center;
2139
2158
  }
2140
2159
 
2141
2160
  .block-editor-link-control__search-item-bottom {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.5.0",
3
+ "version": "12.7.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -32,37 +32,38 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.16.0",
35
+ "@emotion/react": "^11.7.1",
35
36
  "@emotion/styled": "^11.6.0",
36
37
  "@react-spring/web": "^9.4.5",
37
- "@wordpress/a11y": "^3.37.0",
38
- "@wordpress/api-fetch": "^6.34.0",
39
- "@wordpress/blob": "^3.37.0",
40
- "@wordpress/blocks": "^12.14.0",
41
- "@wordpress/components": "^25.3.0",
42
- "@wordpress/compose": "^6.14.0",
43
- "@wordpress/data": "^9.7.0",
44
- "@wordpress/date": "^4.37.0",
45
- "@wordpress/deprecated": "^3.37.0",
46
- "@wordpress/dom": "^3.37.0",
47
- "@wordpress/element": "^5.14.0",
48
- "@wordpress/escape-html": "^2.37.0",
49
- "@wordpress/hooks": "^3.37.0",
50
- "@wordpress/html-entities": "^3.37.0",
51
- "@wordpress/i18n": "^4.37.0",
52
- "@wordpress/icons": "^9.28.0",
53
- "@wordpress/is-shallow-equal": "^4.37.0",
54
- "@wordpress/keyboard-shortcuts": "^4.14.0",
55
- "@wordpress/keycodes": "^3.37.0",
56
- "@wordpress/notices": "^4.5.0",
57
- "@wordpress/preferences": "^3.14.0",
58
- "@wordpress/private-apis": "^0.19.0",
59
- "@wordpress/rich-text": "^6.14.0",
60
- "@wordpress/shortcode": "^3.37.0",
61
- "@wordpress/style-engine": "^1.20.0",
62
- "@wordpress/token-list": "^2.37.0",
63
- "@wordpress/url": "^3.38.0",
64
- "@wordpress/warning": "^2.37.0",
65
- "@wordpress/wordcount": "^3.37.0",
38
+ "@wordpress/a11y": "^3.39.0",
39
+ "@wordpress/api-fetch": "^6.36.0",
40
+ "@wordpress/blob": "^3.39.0",
41
+ "@wordpress/blocks": "^12.16.0",
42
+ "@wordpress/components": "^25.5.0",
43
+ "@wordpress/compose": "^6.16.0",
44
+ "@wordpress/data": "^9.9.0",
45
+ "@wordpress/date": "^4.39.0",
46
+ "@wordpress/deprecated": "^3.39.0",
47
+ "@wordpress/dom": "^3.39.0",
48
+ "@wordpress/element": "^5.16.0",
49
+ "@wordpress/escape-html": "^2.39.0",
50
+ "@wordpress/hooks": "^3.39.0",
51
+ "@wordpress/html-entities": "^3.39.0",
52
+ "@wordpress/i18n": "^4.39.0",
53
+ "@wordpress/icons": "^9.30.0",
54
+ "@wordpress/is-shallow-equal": "^4.39.0",
55
+ "@wordpress/keyboard-shortcuts": "^4.16.0",
56
+ "@wordpress/keycodes": "^3.39.0",
57
+ "@wordpress/notices": "^4.7.0",
58
+ "@wordpress/preferences": "^3.16.0",
59
+ "@wordpress/private-apis": "^0.21.0",
60
+ "@wordpress/rich-text": "^6.16.0",
61
+ "@wordpress/shortcode": "^3.39.0",
62
+ "@wordpress/style-engine": "^1.22.0",
63
+ "@wordpress/token-list": "^2.39.0",
64
+ "@wordpress/url": "^3.40.0",
65
+ "@wordpress/warning": "^2.39.0",
66
+ "@wordpress/wordcount": "^3.39.0",
66
67
  "change-case": "^4.1.2",
67
68
  "classnames": "^2.3.1",
68
69
  "colord": "^2.7.0",
@@ -71,7 +72,6 @@
71
72
  "dom-scroll-into-view": "^1.2.1",
72
73
  "fast-deep-equal": "^3.1.3",
73
74
  "inherits": "^2.0.3",
74
- "lodash": "^4.17.21",
75
75
  "react-autosize-textarea": "^7.1.0",
76
76
  "react-easy-crop": "^4.5.1",
77
77
  "rememo": "^4.0.2",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "bcd13d59b22553b3c9dc5869077bff1e864cf9f5"
88
+ "gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
89
89
  }
@@ -5,6 +5,7 @@ import { useSelect } from '@wordpress/data';
5
5
  import {
6
6
  createBlock,
7
7
  createBlocksFromInnerBlocksTemplate,
8
+ parse,
8
9
  } from '@wordpress/blocks';
9
10
  import { useMemo } from '@wordpress/element';
10
11
 
@@ -116,14 +117,28 @@ function createBlockCompleter() {
116
117
  return ! ( /\S/.test( before ) || /\S/.test( after ) );
117
118
  },
118
119
  getOptionCompletion( inserterItem ) {
119
- const { name, initialAttributes, innerBlocks } = inserterItem;
120
+ const {
121
+ name,
122
+ initialAttributes,
123
+ innerBlocks,
124
+ syncStatus,
125
+ content,
126
+ } = inserterItem;
127
+
120
128
  return {
121
129
  action: 'replace',
122
- value: createBlock(
123
- name,
124
- initialAttributes,
125
- createBlocksFromInnerBlocksTemplate( innerBlocks )
126
- ),
130
+ value:
131
+ syncStatus === 'unsynced'
132
+ ? parse( content, {
133
+ __unstableSkipMigrationLogs: true,
134
+ } )
135
+ : createBlock(
136
+ name,
137
+ initialAttributes,
138
+ createBlocksFromInnerBlocksTemplate(
139
+ innerBlocks
140
+ )
141
+ ),
127
142
  };
128
143
  },
129
144
  };
@@ -0,0 +1,89 @@
1
+ # BlockControls
2
+
3
+ When the user selects a particular block, a toolbar positioned above the selected block displays a set of control buttons. Certain block-level controls are automatically included in the toolbar under specific circumstances. For example, there is a control for converting the block into a different type or when the focused element is a RichText component.
4
+
5
+ With `BlockControls`, you can customize the toolbar to include controls specific to your block type. If the return value of your block type's `edit` function includes a `BlockControls` element, the controls nested inside it will be shown in the selected block's toolbar.
6
+
7
+ ![Screenshot of the block controls of a Paragraph block inside the block editor](https://raw.githubusercontent.com/WordPress/gutenberg/HEAD/docs/assets/toolbar-text.png)
8
+
9
+ ## Usage
10
+
11
+ ```jsx
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ import {
16
+ BlockControls,
17
+ __experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl,
18
+ useBlockProps,
19
+ } from '@wordpress/block-editor';
20
+ import { __ } from '@wordpress/i18n';
21
+
22
+ export default function MyBlockEdit( { attributes, setAttributes } ) {
23
+ const blockProps = useBlockProps( {
24
+ className: 'my-block__custom-class',
25
+ } );
26
+ const { contentPosition } = attributes;
27
+
28
+ return (
29
+ <div { ...blockProps }>
30
+ {
31
+ <BlockControls>
32
+ <BlockAlignmentMatrixControl
33
+ label={ __( 'Change content position' ) }
34
+ value={ contentPosition }
35
+ onChange={ ( nextPosition ) =>
36
+ setAttributes( {
37
+ contentPosition: nextPosition,
38
+ } )
39
+ }
40
+ />
41
+ </BlockControls>
42
+ }
43
+ </div>
44
+ );
45
+ }
46
+
47
+ /// ...
48
+
49
+ <MyBlockEdit />;
50
+ ```
51
+
52
+ See [this custom block tutorial page](/docs/how-to-guides/block-tutorial/block-controls-toolbar-and-sidebar.md) for more information and block controls examples.
53
+
54
+ Furthermore, the READMEs of various components inside the block editor package and the components package include examples that also utilize `BlockControls` and can be a good reference.
55
+
56
+ ### Props
57
+
58
+ The component accepts the following props:
59
+
60
+ ### `group`
61
+
62
+ Group of the block controls. Allows you to create and render multiple groups of block controls.
63
+
64
+ - Type: `string`
65
+ - Default: `default`
66
+ - Required: No
67
+
68
+ ### `controls`
69
+
70
+ Allows overriding the default `controls` if the `default` group is used.
71
+
72
+ See [this custom block tutorial page](/docs/how-to-guides/block-tutorial/block-controls-toolbar-and-sidebar.md) for more details and examples with block controls.
73
+
74
+ - Type: `array`
75
+
76
+ ### `children`
77
+
78
+ Additional control components to be rendered.
79
+
80
+ - Type: `Element`
81
+ - Required: No.
82
+
83
+
84
+ ### `__experimentalShareWithChildBlocks`
85
+
86
+ Whether the additional block controls should be added to the block toolbars of child blocks.
87
+
88
+ - Type: `boolean`
89
+ - Default: `false`
@@ -22,16 +22,25 @@ const BlockDraggable = ( {
22
22
  } ) => {
23
23
  const { srcRootClientId, isDraggable, icon } = useSelect(
24
24
  ( select ) => {
25
- const { canMoveBlocks, getBlockRootClientId, getBlockName } =
26
- select( blockEditorStore );
27
- const { getBlockType } = select( blocksStore );
25
+ const {
26
+ canMoveBlocks,
27
+ getBlockRootClientId,
28
+ getBlockName,
29
+ getBlockAttributes,
30
+ } = select( blockEditorStore );
31
+ const { getBlockType, getActiveBlockVariation } =
32
+ select( blocksStore );
28
33
  const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
29
34
  const blockName = getBlockName( clientIds[ 0 ] );
35
+ const variation = getActiveBlockVariation(
36
+ blockName,
37
+ getBlockAttributes( clientIds[ 0 ] )
38
+ );
30
39
 
31
40
  return {
32
41
  srcRootClientId: rootClientId,
33
42
  isDraggable: canMoveBlocks( clientIds, rootClientId ),
34
- icon: getBlockType( blockName )?.icon,
43
+ icon: variation?.icon || getBlockType( blockName )?.icon,
35
44
  };
36
45
  },
37
46
  [ clientIds ]
@@ -109,8 +109,12 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
109
109
  draggingScrollHandler( event );
110
110
  };
111
111
 
112
- const { onBlockDragOver, onBlockDragEnd, onBlockDrop, targetBlockIndex } =
113
- useBlockDropZone();
112
+ const {
113
+ onBlockDragOverWorklet,
114
+ onBlockDragEnd,
115
+ onBlockDrop,
116
+ targetBlockIndex,
117
+ } = useBlockDropZone();
114
118
 
115
119
  // Stop dragging blocks if the block draggable is unmounted.
116
120
  useEffect( () => {
@@ -184,7 +188,7 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
184
188
  chip.y.value = dragPosition.y;
185
189
  currentYPosition.value = dragPosition.y;
186
190
 
187
- runOnJS( onBlockDragOver )( { x, y: y + scroll.offsetY.value } );
191
+ onBlockDragOverWorklet( { x, y: y + scroll.offsetY.value } );
188
192
 
189
193
  // Update scrolling velocity
190
194
  scrollOnDragOver( dragPosition.y );