@wordpress/block-editor 14.0.0 → 14.1.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 (290) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -14
  3. package/build/autocompleters/block.js +1 -1
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-list/use-block-props/index.js +2 -2
  6. package/build/components/block-list/use-block-props/index.js.map +1 -1
  7. package/build/components/block-list/use-in-between-inserter.js +11 -4
  8. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  9. package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
  10. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  11. package/build/components/block-tools/insertion-point.js +14 -3
  12. package/build/components/block-tools/insertion-point.js.map +1 -1
  13. package/build/components/block-tools/use-show-block-tools.js +2 -1
  14. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  15. package/build/components/block-tools/zoom-out-mode-inserters.js +8 -4
  16. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  17. package/build/components/border-radius-control/index.js +1 -0
  18. package/build/components/border-radius-control/index.js.map +1 -1
  19. package/build/components/convert-to-group-buttons/index.js +1 -1
  20. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  21. package/build/components/date-format-picker/index.js +2 -0
  22. package/build/components/date-format-picker/index.js.map +1 -1
  23. package/build/components/font-appearance-control/index.js +3 -0
  24. package/build/components/font-appearance-control/index.js.map +1 -1
  25. package/build/components/font-family/index.js +3 -0
  26. package/build/components/font-family/index.js.map +1 -1
  27. package/build/components/global-styles/background-panel.js +114 -42
  28. package/build/components/global-styles/background-panel.js.map +1 -1
  29. package/build/components/global-styles/get-global-styles-changes.js +3 -1
  30. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  31. package/build/components/global-styles/hooks.js +0 -7
  32. package/build/components/global-styles/hooks.js.map +1 -1
  33. package/build/components/global-styles/index.js +0 -6
  34. package/build/components/global-styles/index.js.map +1 -1
  35. package/build/components/global-styles/use-global-styles-output.js +3 -3
  36. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  37. package/build/components/global-styles/utils.js +8 -24
  38. package/build/components/global-styles/utils.js.map +1 -1
  39. package/build/components/grid/grid-visualizer.js +20 -5
  40. package/build/components/grid/grid-visualizer.js.map +1 -1
  41. package/build/components/height-control/index.js +1 -0
  42. package/build/components/height-control/index.js.map +1 -1
  43. package/build/components/iframe/index.js +4 -2
  44. package/build/components/iframe/index.js.map +1 -1
  45. package/build/components/image-editor/zoom-dropdown.js +11 -7
  46. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  47. package/build/components/inner-blocks/button-block-appender.js +8 -8
  48. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  49. package/build/components/inner-blocks/default-block-appender.js +7 -25
  50. package/build/components/inner-blocks/default-block-appender.js.map +1 -1
  51. package/build/components/inner-blocks/index.js +9 -11
  52. package/build/components/inner-blocks/index.js.map +1 -1
  53. package/build/components/inserter/library.js +4 -2
  54. package/build/components/inserter/library.js.map +1 -1
  55. package/build/components/inserter/menu.js +30 -12
  56. package/build/components/inserter/menu.js.map +1 -1
  57. package/build/components/inserter/quick-inserter.js +4 -0
  58. package/build/components/inserter/quick-inserter.js.map +1 -1
  59. package/build/components/line-height-control/index.js +3 -0
  60. package/build/components/line-height-control/index.js.map +1 -1
  61. package/build/components/media-placeholder/index.js +9 -4
  62. package/build/components/media-placeholder/index.js.map +1 -1
  63. package/build/components/media-upload/index.native.js +4 -1
  64. package/build/components/media-upload/index.native.js.map +1 -1
  65. package/build/components/multi-selection-inspector/index.js +12 -12
  66. package/build/components/multi-selection-inspector/index.js.map +1 -1
  67. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  68. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  69. package/build/components/text-alignment-control/index.js +13 -8
  70. package/build/components/text-alignment-control/index.js.map +1 -1
  71. package/build/components/text-decoration-control/index.js +13 -8
  72. package/build/components/text-decoration-control/index.js.map +1 -1
  73. package/build/components/text-transform-control/index.js +13 -8
  74. package/build/components/text-transform-control/index.js.map +1 -1
  75. package/build/components/url-popover/image-url-input-ui.js +2 -0
  76. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  77. package/build/components/use-block-drop-zone/index.js +14 -2
  78. package/build/components/use-block-drop-zone/index.js.map +1 -1
  79. package/build/components/writing-mode-control/index.js +13 -8
  80. package/build/components/writing-mode-control/index.js.map +1 -1
  81. package/build/hooks/background.js +19 -23
  82. package/build/hooks/background.js.map +1 -1
  83. package/build/hooks/block-bindings.js +37 -79
  84. package/build/hooks/block-bindings.js.map +1 -1
  85. package/build/layouts/constrained.js +1 -0
  86. package/build/layouts/constrained.js.map +1 -1
  87. package/build/layouts/flex.js +2 -0
  88. package/build/layouts/flex.js.map +1 -1
  89. package/build/layouts/grid.js +3 -0
  90. package/build/layouts/grid.js.map +1 -1
  91. package/build/private-apis.js +3 -1
  92. package/build/private-apis.js.map +1 -1
  93. package/build/store/private-selectors.js +30 -0
  94. package/build/store/private-selectors.js.map +1 -1
  95. package/build/store/reducer.js +10 -1
  96. package/build/store/reducer.js.map +1 -1
  97. package/build/utils/block-bindings.js +112 -0
  98. package/build/utils/block-bindings.js.map +1 -0
  99. package/build-module/autocompleters/block.js +1 -1
  100. package/build-module/autocompleters/block.js.map +1 -1
  101. package/build-module/components/block-list/use-block-props/index.js +2 -2
  102. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  103. package/build-module/components/block-list/use-in-between-inserter.js +11 -4
  104. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  105. package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
  106. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  107. package/build-module/components/block-tools/insertion-point.js +14 -3
  108. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  109. package/build-module/components/block-tools/use-show-block-tools.js +2 -1
  110. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  111. package/build-module/components/block-tools/zoom-out-mode-inserters.js +8 -4
  112. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  113. package/build-module/components/border-radius-control/index.js +1 -0
  114. package/build-module/components/border-radius-control/index.js.map +1 -1
  115. package/build-module/components/convert-to-group-buttons/index.js +1 -1
  116. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  117. package/build-module/components/date-format-picker/index.js +2 -0
  118. package/build-module/components/date-format-picker/index.js.map +1 -1
  119. package/build-module/components/font-appearance-control/index.js +3 -0
  120. package/build-module/components/font-appearance-control/index.js.map +1 -1
  121. package/build-module/components/font-family/index.js +3 -0
  122. package/build-module/components/font-family/index.js.map +1 -1
  123. package/build-module/components/global-styles/background-panel.js +117 -45
  124. package/build-module/components/global-styles/background-panel.js.map +1 -1
  125. package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
  126. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  127. package/build-module/components/global-styles/hooks.js +0 -6
  128. package/build-module/components/global-styles/hooks.js.map +1 -1
  129. package/build-module/components/global-styles/index.js +1 -1
  130. package/build-module/components/global-styles/index.js.map +1 -1
  131. package/build-module/components/global-styles/use-global-styles-output.js +5 -5
  132. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  133. package/build-module/components/global-styles/utils.js +8 -23
  134. package/build-module/components/global-styles/utils.js.map +1 -1
  135. package/build-module/components/grid/grid-visualizer.js +20 -5
  136. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  137. package/build-module/components/height-control/index.js +1 -0
  138. package/build-module/components/height-control/index.js.map +1 -1
  139. package/build-module/components/iframe/index.js +4 -2
  140. package/build-module/components/iframe/index.js.map +1 -1
  141. package/build-module/components/image-editor/zoom-dropdown.js +12 -8
  142. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  143. package/build-module/components/inner-blocks/button-block-appender.js +7 -6
  144. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  145. package/build-module/components/inner-blocks/default-block-appender.js +6 -23
  146. package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
  147. package/build-module/components/inner-blocks/index.js +9 -11
  148. package/build-module/components/inner-blocks/index.js.map +1 -1
  149. package/build-module/components/inserter/library.js +4 -2
  150. package/build-module/components/inserter/library.js.map +1 -1
  151. package/build-module/components/inserter/menu.js +30 -12
  152. package/build-module/components/inserter/menu.js.map +1 -1
  153. package/build-module/components/inserter/quick-inserter.js +5 -1
  154. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  155. package/build-module/components/line-height-control/index.js +3 -0
  156. package/build-module/components/line-height-control/index.js.map +1 -1
  157. package/build-module/components/media-placeholder/index.js +9 -4
  158. package/build-module/components/media-placeholder/index.js.map +1 -1
  159. package/build-module/components/media-upload/index.native.js +4 -1
  160. package/build-module/components/media-upload/index.native.js.map +1 -1
  161. package/build-module/components/multi-selection-inspector/index.js +12 -12
  162. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  163. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
  164. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  165. package/build-module/components/text-alignment-control/index.js +13 -8
  166. package/build-module/components/text-alignment-control/index.js.map +1 -1
  167. package/build-module/components/text-decoration-control/index.js +13 -8
  168. package/build-module/components/text-decoration-control/index.js.map +1 -1
  169. package/build-module/components/text-transform-control/index.js +13 -8
  170. package/build-module/components/text-transform-control/index.js.map +1 -1
  171. package/build-module/components/url-popover/image-url-input-ui.js +2 -0
  172. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  173. package/build-module/components/use-block-drop-zone/index.js +14 -2
  174. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  175. package/build-module/components/writing-mode-control/index.js +13 -8
  176. package/build-module/components/writing-mode-control/index.js.map +1 -1
  177. package/build-module/hooks/background.js +19 -23
  178. package/build-module/hooks/background.js.map +1 -1
  179. package/build-module/hooks/block-bindings.js +38 -80
  180. package/build-module/hooks/block-bindings.js.map +1 -1
  181. package/build-module/layouts/constrained.js +1 -0
  182. package/build-module/layouts/constrained.js.map +1 -1
  183. package/build-module/layouts/flex.js +2 -0
  184. package/build-module/layouts/flex.js.map +1 -1
  185. package/build-module/layouts/grid.js +3 -0
  186. package/build-module/layouts/grid.js.map +1 -1
  187. package/build-module/private-apis.js +3 -1
  188. package/build-module/private-apis.js.map +1 -1
  189. package/build-module/store/private-selectors.js +27 -0
  190. package/build-module/store/private-selectors.js.map +1 -1
  191. package/build-module/store/reducer.js +9 -1
  192. package/build-module/store/reducer.js.map +1 -1
  193. package/build-module/utils/block-bindings.js +105 -0
  194. package/build-module/utils/block-bindings.js.map +1 -0
  195. package/build-style/content-rtl.css +7 -14
  196. package/build-style/content.css +7 -14
  197. package/build-style/default-editor-styles-rtl.css +2 -2
  198. package/build-style/default-editor-styles.css +2 -2
  199. package/build-style/style-rtl.css +36 -38
  200. package/build-style/style.css +36 -38
  201. package/package.json +32 -32
  202. package/src/autocompleters/block.js +2 -1
  203. package/src/components/block-list/content.scss +5 -13
  204. package/src/components/block-list/use-block-props/index.js +2 -2
  205. package/src/components/block-list/use-in-between-inserter.js +17 -5
  206. package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
  207. package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
  208. package/src/components/block-tools/insertion-point.js +11 -0
  209. package/src/components/block-tools/style.scss +1 -1
  210. package/src/components/block-tools/use-show-block-tools.js +4 -1
  211. package/src/components/block-tools/zoom-out-mode-inserters.js +7 -1
  212. package/src/components/block-variation-transforms/style.scss +1 -1
  213. package/src/components/border-radius-control/index.js +1 -0
  214. package/src/components/border-radius-control/style.scss +0 -10
  215. package/src/components/convert-to-group-buttons/index.js +1 -1
  216. package/src/components/date-format-picker/index.js +2 -0
  217. package/src/components/font-appearance-control/index.js +3 -0
  218. package/src/components/font-family/README.md +11 -2
  219. package/src/components/font-family/index.js +3 -0
  220. package/src/components/global-styles/background-panel.js +132 -53
  221. package/src/components/global-styles/get-global-styles-changes.js +4 -1
  222. package/src/components/global-styles/hooks.js +0 -5
  223. package/src/components/global-styles/index.js +0 -1
  224. package/src/components/global-styles/style.scss +13 -2
  225. package/src/components/global-styles/test/use-global-styles-output.js +20 -4
  226. package/src/components/global-styles/use-global-styles-output.js +5 -6
  227. package/src/components/global-styles/utils.js +7 -29
  228. package/src/components/grid/grid-visualizer.js +22 -7
  229. package/src/components/height-control/index.js +1 -0
  230. package/src/components/iframe/index.js +4 -2
  231. package/src/components/image-editor/zoom-dropdown.js +17 -9
  232. package/src/components/inner-blocks/button-block-appender.js +5 -7
  233. package/src/components/inner-blocks/default-block-appender.js +4 -23
  234. package/src/components/inner-blocks/index.js +10 -9
  235. package/src/components/inserter/library.js +2 -0
  236. package/src/components/inserter/menu.js +32 -27
  237. package/src/components/inserter/quick-inserter.js +4 -1
  238. package/src/components/inserter/style.scss +1 -1
  239. package/src/components/inserter-list-item/style.scss +1 -0
  240. package/src/components/line-height-control/README.md +7 -0
  241. package/src/components/line-height-control/index.js +3 -0
  242. package/src/components/link-control/style.scss +1 -1
  243. package/src/components/media-placeholder/index.js +12 -7
  244. package/src/components/media-upload/README.md +2 -0
  245. package/src/components/media-upload/index.native.js +2 -0
  246. package/src/components/multi-selection-inspector/index.js +8 -9
  247. package/src/components/responsive-block-control/README.md +1 -0
  248. package/src/components/responsive-block-control/test/index.js +1 -0
  249. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -4
  250. package/src/components/spacing-sizes-control/style.scss +16 -16
  251. package/src/components/text-alignment-control/index.js +20 -8
  252. package/src/components/text-decoration-control/index.js +20 -8
  253. package/src/components/text-decoration-control/stories/index.story.js +0 -4
  254. package/src/components/text-transform-control/index.js +20 -8
  255. package/src/components/text-transform-control/stories/index.story.js +0 -4
  256. package/src/components/url-input/style.scss +2 -2
  257. package/src/components/url-popover/image-url-input-ui.js +2 -0
  258. package/src/components/use-block-drop-zone/index.js +21 -3
  259. package/src/components/writing-mode-control/index.js +20 -8
  260. package/src/hooks/background.js +21 -27
  261. package/src/hooks/block-bindings.js +27 -84
  262. package/src/hooks/block-bindings.scss +1 -1
  263. package/src/hooks/test/background.js +60 -0
  264. package/src/layouts/constrained.js +1 -0
  265. package/src/layouts/flex.js +2 -0
  266. package/src/layouts/grid.js +3 -0
  267. package/src/private-apis.js +2 -0
  268. package/src/store/private-selectors.js +36 -0
  269. package/src/store/reducer.js +7 -0
  270. package/src/store/test/private-selectors.js +89 -0
  271. package/src/style.scss +0 -1
  272. package/src/utils/block-bindings.js +98 -0
  273. package/src/utils/test/transform-styles.js +49 -0
  274. package/build/components/global-styles/theme-file-uri-utils.js +0 -21
  275. package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
  276. package/build/components/inner-blocks/with-client-id.js +0 -28
  277. package/build/components/inner-blocks/with-client-id.js.map +0 -1
  278. package/build/components/segmented-text-control/index.js +0 -63
  279. package/build/components/segmented-text-control/index.js.map +0 -1
  280. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -15
  281. package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
  282. package/build-module/components/inner-blocks/with-client-id.js +0 -21
  283. package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
  284. package/build-module/components/segmented-text-control/index.js +0 -58
  285. package/build-module/components/segmented-text-control/index.js.map +0 -1
  286. package/src/components/global-styles/test/theme-file-uri-utils.js +0 -41
  287. package/src/components/global-styles/theme-file-uri-utils.js +0 -18
  288. package/src/components/inner-blocks/with-client-id.js +0 -19
  289. package/src/components/segmented-text-control/index.js +0 -63
  290. package/src/components/segmented-text-control/style.scss +0 -15
@@ -19,6 +19,7 @@ import { range, GridRect, getGridInfo } from './utils';
19
19
  import { store as blockEditorStore } from '../../store';
20
20
  import { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';
21
21
  import ButtonBlockAppender from '../button-block-appender';
22
+ import { unlock } from '../../lock-unlock';
22
23
 
23
24
  export function GridVisualizer( { clientId, contentRef, parentLayout } ) {
24
25
  const isDistractionFree = useSelect(
@@ -118,19 +119,25 @@ const GridVisualizerGrid = forwardRef(
118
119
  function ManualGridVisualizer( { gridClientId, gridInfo } ) {
119
120
  const [ highlightedRect, setHighlightedRect ] = useState( null );
120
121
 
121
- const gridItems = useSelect(
122
- ( select ) => select( blockEditorStore ).getBlocks( gridClientId ),
122
+ const gridItemStyles = useSelect(
123
+ ( select ) => {
124
+ const { getBlockOrder, getBlockStyles } = unlock(
125
+ select( blockEditorStore )
126
+ );
127
+ const blockOrder = getBlockOrder( gridClientId );
128
+ return getBlockStyles( blockOrder );
129
+ },
123
130
  [ gridClientId ]
124
131
  );
125
132
  const occupiedRects = useMemo( () => {
126
133
  const rects = [];
127
- for ( const block of gridItems ) {
134
+ for ( const style of Object.values( gridItemStyles ) ) {
128
135
  const {
129
136
  columnStart,
130
137
  rowStart,
131
138
  columnSpan = 1,
132
139
  rowSpan = 1,
133
- } = block.attributes.style?.layout || {};
140
+ } = style?.layout ?? {};
134
141
  if ( ! columnStart || ! rowStart ) {
135
142
  continue;
136
143
  }
@@ -144,7 +151,7 @@ function ManualGridVisualizer( { gridClientId, gridInfo } ) {
144
151
  );
145
152
  }
146
153
  return rects;
147
- }, [ gridItems ] );
154
+ }, [ gridItemStyles ] );
148
155
 
149
156
  return range( 1, gridInfo.numRows ).map( ( row ) =>
150
157
  range( 1, gridInfo.numColumns ).map( ( column ) => {
@@ -206,8 +213,12 @@ function useGridVisualizerDropZone(
206
213
  gridInfo,
207
214
  setHighlightedRect
208
215
  ) {
209
- const { getBlockAttributes, getBlockRootClientId } =
210
- useSelect( blockEditorStore );
216
+ const {
217
+ getBlockAttributes,
218
+ getBlockRootClientId,
219
+ canInsertBlockType,
220
+ getBlockName,
221
+ } = useSelect( blockEditorStore );
211
222
  const {
212
223
  updateBlockAttributes,
213
224
  moveBlocksToPosition,
@@ -221,6 +232,10 @@ function useGridVisualizerDropZone(
221
232
 
222
233
  return useDropZoneWithValidation( {
223
234
  validateDrag( srcClientId ) {
235
+ const blockName = getBlockName( srcClientId );
236
+ if ( ! canInsertBlockType( blockName, gridClientId ) ) {
237
+ return false;
238
+ }
224
239
  const attributes = getBlockAttributes( srcClientId );
225
240
  const rect = new GridRect( {
226
241
  columnStart: column,
@@ -164,6 +164,7 @@ export default function HeightControl( {
164
164
  <FlexItem isBlock>
165
165
  <Spacer marginX={ 2 } marginBottom={ 0 }>
166
166
  <RangeControl
167
+ __next40pxDefaultSize
167
168
  value={ customRangeValue }
168
169
  min={ 0 }
169
170
  max={
@@ -242,8 +242,10 @@ function Iframe( {
242
242
  const isZoomedOut = scale !== 1;
243
243
 
244
244
  useEffect( () => {
245
- prevContainerWidth.current = containerWidth;
246
- }, [ containerWidth ] );
245
+ if ( ! isZoomedOut ) {
246
+ prevContainerWidth.current = containerWidth;
247
+ }
248
+ }, [ containerWidth, isZoomedOut ] );
247
249
 
248
250
  const disabledRef = useDisabled( { isDisabled: ! readonly } );
249
251
  const bodyRef = useMergeRefs( [
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { ToolbarButton, RangeControl, Dropdown } from '@wordpress/components';
4
+ import {
5
+ ToolbarButton,
6
+ RangeControl,
7
+ Dropdown,
8
+ __experimentalDropdownContentWrapper as DropdownContentWrapper,
9
+ } from '@wordpress/components';
5
10
  import { __ } from '@wordpress/i18n';
6
11
  import { search } from '@wordpress/icons';
7
12
 
@@ -27,14 +32,17 @@ export default function ZoomDropdown() {
27
32
  />
28
33
  ) }
29
34
  renderContent={ () => (
30
- <RangeControl
31
- __nextHasNoMarginBottom
32
- label={ __( 'Zoom' ) }
33
- min={ MIN_ZOOM }
34
- max={ MAX_ZOOM }
35
- value={ Math.round( zoom ) }
36
- onChange={ setZoom }
37
- />
35
+ <DropdownContentWrapper paddingSize="medium">
36
+ <RangeControl
37
+ __next40pxDefaultSize
38
+ __nextHasNoMarginBottom
39
+ label={ __( 'Zoom' ) }
40
+ min={ MIN_ZOOM }
41
+ max={ MAX_ZOOM }
42
+ value={ Math.round( zoom ) }
43
+ onChange={ setZoom }
44
+ />
45
+ </DropdownContentWrapper>
38
46
  ) }
39
47
  />
40
48
  );
@@ -7,15 +7,15 @@ import clsx from 'clsx';
7
7
  * Internal dependencies
8
8
  */
9
9
  import BaseButtonBlockAppender from '../button-block-appender';
10
- import withClientId from './with-client-id';
10
+ import { useBlockEditContext } from '../block-edit/context';
11
11
 
12
- export const ButtonBlockAppender = ( {
13
- clientId,
12
+ export default function ButtonBlockAppender( {
14
13
  showSeparator,
15
14
  isFloating,
16
15
  onAddBlock,
17
16
  isToggle,
18
- } ) => {
17
+ } ) {
18
+ const { clientId } = useBlockEditContext();
19
19
  return (
20
20
  <BaseButtonBlockAppender
21
21
  className={ clsx( {
@@ -27,6 +27,4 @@ export const ButtonBlockAppender = ( {
27
27
  onAddBlock={ onAddBlock }
28
28
  />
29
29
  );
30
- };
31
-
32
- export default withClientId( ButtonBlockAppender );
30
+ }
@@ -1,29 +1,10 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { compose } from '@wordpress/compose';
5
- import { withSelect } from '@wordpress/data';
6
-
7
1
  /**
8
2
  * Internal dependencies
9
3
  */
10
4
  import BaseDefaultBlockAppender from '../default-block-appender';
11
- import withClientId from './with-client-id';
12
- import { store as blockEditorStore } from '../../store';
5
+ import { useBlockEditContext } from '../block-edit/context';
13
6
 
14
- export const DefaultBlockAppender = ( { clientId } ) => {
7
+ export default function DefaultBlockAppender() {
8
+ const { clientId } = useBlockEditContext();
15
9
  return <BaseDefaultBlockAppender rootClientId={ clientId } />;
16
- };
17
-
18
- export default compose( [
19
- withClientId,
20
- withSelect( ( select, { clientId } ) => {
21
- const { getBlockOrder } = select( blockEditorStore );
22
-
23
- const blockClientIds = getBlockOrder( clientId );
24
-
25
- return {
26
- lastBlockClientId: blockClientIds[ blockClientIds.length - 1 ],
27
- };
28
- } ),
29
- ] )( DefaultBlockAppender );
10
+ }
@@ -206,13 +206,7 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
206
206
  getSettings,
207
207
  } = unlock( select( blockEditorStore ) );
208
208
  let _isDropZoneDisabled;
209
- // In zoom out mode, we want to disable the drop zone for the sections.
210
- // The inner blocks belonging to the section drop zone is
211
- // already disabled by the blocks themselves being disabled.
212
- if ( __unstableGetEditorMode() === 'zoom-out' ) {
213
- const { sectionRootClientId } = unlock( getSettings() );
214
- _isDropZoneDisabled = clientId !== sectionRootClientId;
215
- }
209
+
216
210
  if ( ! clientId ) {
217
211
  return { isDropZoneDisabled: _isDropZoneDisabled };
218
212
  }
@@ -225,8 +219,15 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
225
219
  const parentClientId = getBlockRootClientId( clientId );
226
220
  const [ defaultLayout ] = getBlockSettings( clientId, 'layout' );
227
221
 
228
- if ( _isDropZoneDisabled !== undefined ) {
229
- _isDropZoneDisabled = blockEditingMode === 'disabled';
222
+ _isDropZoneDisabled = blockEditingMode === 'disabled';
223
+
224
+ if ( __unstableGetEditorMode() === 'zoom-out' ) {
225
+ // In zoom out mode, we want to disable the drop zone for the sections.
226
+ // The inner blocks belonging to the section drop zone is
227
+ // already disabled by the blocks themselves being disabled.
228
+ const { sectionRootClientId } = unlock( getSettings() );
229
+
230
+ _isDropZoneDisabled = clientId !== sectionRootClientId;
230
231
  }
231
232
 
232
233
  return {
@@ -27,6 +27,7 @@ function InserterLibrary(
27
27
  onSelect = noop,
28
28
  shouldFocusBlock = false,
29
29
  onClose,
30
+ __experimentalSearchInputRef,
30
31
  },
31
32
  ref
32
33
  ) {
@@ -58,6 +59,7 @@ function InserterLibrary(
58
59
  shouldFocusBlock={ shouldFocusBlock }
59
60
  ref={ ref }
60
61
  onClose={ onClose }
62
+ __experimentalSearchInputRef={ __experimentalSearchInputRef }
61
63
  />
62
64
  );
63
65
  }
@@ -33,6 +33,7 @@ import useInsertionPoint from './hooks/use-insertion-point';
33
33
  import { store as blockEditorStore } from '../../store';
34
34
  import TabbedSidebar from '../tabbed-sidebar';
35
35
  import { useZoomOut } from '../../hooks/use-zoom-out';
36
+ import { unlock } from '../../lock-unlock';
36
37
 
37
38
  const NOOP = () => {};
38
39
  function InserterMenu(
@@ -53,11 +54,16 @@ function InserterMenu(
53
54
  },
54
55
  ref
55
56
  ) {
56
- const isZoomOutMode = useSelect(
57
- ( select ) =>
58
- select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
59
- []
60
- );
57
+ const { isZoomOutMode, inserterSearchInputRef } = useSelect( ( select ) => {
58
+ const { __unstableGetEditorMode, getInserterSearchInputRef } = unlock(
59
+ select( blockEditorStore )
60
+ );
61
+ return {
62
+ isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
63
+ inserterSearchInputRef: getInserterSearchInputRef(),
64
+ };
65
+ }, [] );
66
+
61
67
  const [ filterValue, setFilterValue, delayedFilterValue ] =
62
68
  useDebouncedInput( __experimentalFilterValue );
63
69
  const [ hoveredItem, setHoveredItem ] = useState( null );
@@ -67,9 +73,16 @@ function InserterMenu(
67
73
  const [ patternFilter, setPatternFilter ] = useState( 'all' );
68
74
  const [ selectedMediaCategory, setSelectedMediaCategory ] =
69
75
  useState( null );
70
- const [ selectedTab, setSelectedTab ] = useState(
71
- __experimentalInitialTab
72
- );
76
+ function getInitialTab() {
77
+ if ( __experimentalInitialTab ) {
78
+ return __experimentalInitialTab;
79
+ }
80
+
81
+ if ( isZoomOutMode ) {
82
+ return 'patterns';
83
+ }
84
+ }
85
+ const [ selectedTab, setSelectedTab ] = useState( getInitialTab() );
73
86
 
74
87
  const [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =
75
88
  useInsertionPoint( {
@@ -104,15 +117,16 @@ function InserterMenu(
104
117
  }
105
118
  } );
106
119
  },
107
- [ onInsertBlocks, onSelect, shouldFocusBlock ]
120
+ [ onInsertBlocks, onSelect, ref, shouldFocusBlock ]
108
121
  );
109
122
 
110
123
  const onInsertPattern = useCallback(
111
124
  ( blocks, patternName ) => {
125
+ onToggleInsertionPoint( false );
112
126
  onInsertBlocks( blocks, { patternName } );
113
127
  onSelect();
114
128
  },
115
- [ onInsertBlocks, onSelect ]
129
+ [ onInsertBlocks, onSelect, onToggleInsertionPoint ]
116
130
  );
117
131
 
118
132
  const onHover = useCallback(
@@ -123,13 +137,6 @@ function InserterMenu(
123
137
  [ onToggleInsertionPoint, setHoveredItem ]
124
138
  );
125
139
 
126
- const onHoverPattern = useCallback(
127
- ( item ) => {
128
- onToggleInsertionPoint( !! item );
129
- },
130
- [ onToggleInsertionPoint ]
131
- );
132
-
133
140
  const onClickPatternCategory = useCallback(
134
141
  ( patternCategory, filter ) => {
135
142
  setSelectedPatternCategory( patternCategory );
@@ -170,13 +177,14 @@ function InserterMenu(
170
177
  value={ filterValue }
171
178
  label={ __( 'Search for blocks and patterns' ) }
172
179
  placeholder={ __( 'Search' ) }
180
+ ref={ inserterSearchInputRef }
173
181
  />
182
+
174
183
  { !! delayedFilterValue && (
175
184
  <InserterSearchResults
176
185
  filterValue={ delayedFilterValue }
177
186
  onSelect={ onSelect }
178
187
  onHover={ onHover }
179
- onHoverPattern={ onHoverPattern }
180
188
  rootClientId={ rootClientId }
181
189
  clientId={ clientId }
182
190
  isAppender={ isAppender }
@@ -192,19 +200,18 @@ function InserterMenu(
192
200
  );
193
201
  }, [
194
202
  selectedTab,
195
- hoveredItem,
196
- setHoveredItem,
197
- setFilterValue,
198
203
  filterValue,
204
+ inserterSearchInputRef,
199
205
  delayedFilterValue,
200
206
  onSelect,
201
207
  onHover,
202
- onHoverPattern,
203
- shouldFocusBlock,
204
- clientId,
205
208
  rootClientId,
206
- __experimentalInsertionIndex,
209
+ clientId,
207
210
  isAppender,
211
+ __experimentalInsertionIndex,
212
+ shouldFocusBlock,
213
+ hoveredItem,
214
+ setFilterValue,
208
215
  ] );
209
216
 
210
217
  const blocksTab = useMemo( () => {
@@ -249,7 +256,6 @@ function InserterMenu(
249
256
  <PatternCategoryPreviews
250
257
  rootClientId={ destinationRootClientId }
251
258
  onInsert={ onInsertPattern }
252
- onHover={ onHoverPattern }
253
259
  category={ selectedPatternCategory }
254
260
  patternFilter={ patternFilter }
255
261
  showTitlesAsTooltip
@@ -259,7 +265,6 @@ function InserterMenu(
259
265
  );
260
266
  }, [
261
267
  destinationRootClientId,
262
- onHoverPattern,
263
268
  onInsertPattern,
264
269
  onClickPatternCategory,
265
270
  patternFilter,
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import { useState, useEffect } from '@wordpress/element';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { Button, SearchControl } from '@wordpress/components';
12
- import { useSelect } from '@wordpress/data';
12
+ import { useDispatch, useSelect } from '@wordpress/data';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
@@ -82,6 +82,8 @@ export default function QuickInserter( {
82
82
  }
83
83
  }, [ setInserterIsOpened ] );
84
84
 
85
+ const { showInsertionPoint } = useDispatch( blockEditorStore );
86
+
85
87
  // When clicking Browse All select the appropriate block so as
86
88
  // the insertion point can work as expected.
87
89
  const onBrowseAll = () => {
@@ -91,6 +93,7 @@ export default function QuickInserter( {
91
93
  filterValue,
92
94
  onSelect,
93
95
  } );
96
+ showInsertionPoint( rootClientId, insertionIndex );
94
97
  };
95
98
 
96
99
  let maxBlockPatterns = 0;
@@ -36,7 +36,7 @@ $block-inserter-tabs-height: 44px;
36
36
  .components-popover__content {
37
37
  border: none;
38
38
  outline: none;
39
- box-shadow: $shadow-popover;
39
+ box-shadow: $elevation-x-small;
40
40
 
41
41
  .block-editor-inserter__quick-inserter > * {
42
42
  border-left: $border-width solid $gray-400;
@@ -120,4 +120,5 @@
120
120
  .block-editor-block-types-list__item-title {
121
121
  padding: 4px 2px 8px;
122
122
  font-size: 12px;
123
+ hyphens: auto;
123
124
  }
@@ -36,6 +36,13 @@ The value of the line height.
36
36
 
37
37
  A callback function that handles the application of the line height value.
38
38
 
39
+ #### `__next40pxDefaultSize`
40
+
41
+ - **Type:** `boolean`
42
+ - **Default:** `false`
43
+
44
+ Start opting into the larger default height that will become the default size in a future version.
45
+
39
46
  ## Related components
40
47
 
41
48
  Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
@@ -16,6 +16,8 @@ import {
16
16
  } from './utils';
17
17
 
18
18
  const LineHeightControl = ( {
19
+ /** Start opting into the larger default height that will become the default size in a future version. */
20
+ __next40pxDefaultSize = false,
19
21
  value: lineHeight,
20
22
  onChange,
21
23
  __unstableInputWidth = '60px',
@@ -91,6 +93,7 @@ const LineHeightControl = ( {
91
93
  <div className="block-editor-line-height-control">
92
94
  <NumberControl
93
95
  { ...otherProps }
96
+ __next40pxDefaultSize={ __next40pxDefaultSize }
94
97
  __unstableInputWidth={ __unstableInputWidth }
95
98
  __unstableStateReducer={ stateReducer }
96
99
  onChange={ handleOnChange }
@@ -77,7 +77,7 @@ $block-editor-link-control-number-of-actions: 1;
77
77
  &.block-editor-url-input input[type="text"].block-editor-url-input__input {
78
78
  @include input-control;
79
79
  display: block;
80
- border: 1px solid $gray-600;
80
+ border: $border-width solid $gray-600;
81
81
  border-radius: $radius-block-ui;
82
82
  height: $button-size-next-default-40px; // components do not properly support unstable-large yet.
83
83
  margin: 0;
@@ -491,17 +491,22 @@ export function MediaPlaceholder( {
491
491
  <>
492
492
  { renderDropZone() }
493
493
  <FormFileUpload
494
- variant="primary"
495
- className={ clsx(
496
- 'block-editor-media-placeholder__button',
497
- 'block-editor-media-placeholder__upload-button'
494
+ render={ ( { openFileDialog } ) => (
495
+ <Button
496
+ onClick={ openFileDialog }
497
+ variant="primary"
498
+ className={ clsx(
499
+ 'block-editor-media-placeholder__button',
500
+ 'block-editor-media-placeholder__upload-button'
501
+ ) }
502
+ >
503
+ { __( 'Upload' ) }
504
+ </Button>
498
505
  ) }
499
506
  onChange={ onUpload }
500
507
  accept={ accept }
501
508
  multiple={ !! multiple }
502
- >
503
- { __( 'Upload' ) }
504
- </FormFileUpload>
509
+ />
505
510
  { uploadMediaLibraryButton }
506
511
  { renderUrlSelectionUI() }
507
512
  { renderFeaturedImageToggle() }
@@ -105,6 +105,8 @@ Callback called when the media modal is closed after media is selected.
105
105
 
106
106
  This is called subsequent to `onClose` when media is selected. The selected media are passed as an argument.
107
107
 
108
+ The `image.sizes.full` resolution does always exist. Other defined sizes are only available when the image is larger and thus could be scaled down.
109
+
108
110
  - Type: `Function`
109
111
  - Required: Yes
110
112
  - Platform: Web | Mobile
@@ -327,6 +327,8 @@ function URLInput( props ) {
327
327
  >
328
328
  <PanelBody style={ styles[ 'media-upload__link-input' ] }>
329
329
  <TextControl
330
+ // TODO: Switch to `true` (40px size) if possible
331
+ __next40pxDefaultSize={ false }
330
332
  // eslint-disable-next-line jsx-a11y/no-autofocus
331
333
  autoFocus
332
334
  autoCapitalize="none"
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { sprintf, _n } from '@wordpress/i18n';
5
- import { withSelect } from '@wordpress/data';
5
+ import { useSelect } from '@wordpress/data';
6
6
  import { serialize } from '@wordpress/blocks';
7
7
  import { count as wordCount } from '@wordpress/wordcount';
8
8
  import { copy } from '@wordpress/icons';
@@ -13,7 +13,13 @@ import { copy } from '@wordpress/icons';
13
13
  import BlockIcon from '../block-icon';
14
14
  import { store as blockEditorStore } from '../../store';
15
15
 
16
- function MultiSelectionInspector( { blocks } ) {
16
+ export default function MultiSelectionInspector() {
17
+ const { blocks } = useSelect( ( select ) => {
18
+ const { getMultiSelectedBlocks } = select( blockEditorStore );
19
+ return {
20
+ blocks: getMultiSelectedBlocks(),
21
+ };
22
+ }, [] );
17
23
  const words = wordCount( serialize( blocks ), 'words' );
18
24
 
19
25
  return (
@@ -38,10 +44,3 @@ function MultiSelectionInspector( { blocks } ) {
38
44
  </div>
39
45
  );
40
46
  }
41
-
42
- export default withSelect( ( select ) => {
43
- const { getMultiSelectedBlocks } = select( blockEditorStore );
44
- return {
45
- blocks: getMultiSelectedBlocks(),
46
- };
47
- } )( MultiSelectionInspector );
@@ -64,6 +64,7 @@ registerBlockType( 'my-plugin/my-block', {
64
64
  const paddingControl = ( labelComponent, viewport ) => {
65
65
  return (
66
66
  <DimensionControl
67
+ __nextHasNoMarginBottom
67
68
  label={ viewport.label }
68
69
  onChange={ // handle update to padding value here }
69
70
  value={ paddingSize }
@@ -40,6 +40,7 @@ const renderTestDefaultControlComponent = ( labelComponent, device ) => {
40
40
  return (
41
41
  <>
42
42
  <SelectControl
43
+ __next40pxDefaultSize
43
44
  label={ labelComponent }
44
45
  options={ sizeOptions }
45
46
  __nextHasNoMarginBottom
@@ -188,10 +188,12 @@ export default function SpacingInputControl( {
188
188
  name: size.name,
189
189
  } ) );
190
190
 
191
- const marks = spacingSizes.map( ( _newValue, index ) => ( {
192
- value: index,
193
- label: undefined,
194
- } ) );
191
+ const marks = spacingSizes
192
+ .slice( 1, spacingSizes.length - 1 )
193
+ .map( ( _newValue, index ) => ( {
194
+ value: index + 1,
195
+ label: undefined,
196
+ } ) );
195
197
 
196
198
  const sideLabel =
197
199
  ALL_SIDES.includes( side ) && showSideInLabel ? LABELS[ side ] : '';
@@ -247,6 +249,7 @@ export default function SpacingInputControl( {
247
249
  } }
248
250
  />
249
251
  <RangeControl
252
+ __next40pxDefaultSize
250
253
  onMouseOver={ onMouseOver }
251
254
  onMouseOut={ onMouseOut }
252
255
  onFocus={ onMouseOver }
@@ -268,6 +271,7 @@ export default function SpacingInputControl( {
268
271
  ) }
269
272
  { showRangeControl && ! showCustomValueControl && (
270
273
  <RangeControl
274
+ __next40pxDefaultSize
271
275
  onMouseOver={ onMouseOver }
272
276
  onMouseOut={ onMouseOut }
273
277
  className="spacing-sizes-control__range-control"
@@ -4,34 +4,34 @@
4
4
  margin-bottom: 0;
5
5
  }
6
6
 
7
+ .is-marked {
8
+ .components-range-control__track {
9
+ transition: width ease 0.1s;
10
+ @include reduce-motion("transition");
11
+ }
12
+
13
+ .components-range-control__thumb-wrapper {
14
+ transition: left ease 0.1s;
15
+ @include reduce-motion("transition");
16
+ }
17
+ }
18
+
7
19
  .spacing-sizes-control__range-control,
8
20
  .spacing-sizes-control__custom-value-range {
9
- height: 40px;
10
- /* Vertically center the RangeControl until it has true 40px height. */
11
- display: flex;
12
- align-items: center;
13
- margin-bottom: 0;
14
21
  flex: 1;
15
-
16
- > .components-base-control__field {
17
- /* Fixes RangeControl contents when the outer wrapper is flex */
18
- flex: 1;
19
- }
20
22
  }
21
23
 
22
24
  .components-range-control__mark {
25
+ transform: translateX(-50%);
23
26
  height: $grid-unit-05;
24
- width: 3px;
25
- background-color: #fff;
27
+ width: math.div($grid-unit-05, 2);
28
+ background-color: $white;
26
29
  z-index: 1;
30
+ top: -#{$grid-unit-05};
27
31
  }
28
32
 
29
33
  .components-range-control__marks {
30
34
  margin-top: 17px;
31
-
32
- :first-child {
33
- display: none;
34
- }
35
35
  }
36
36
 
37
37
  .components-range-control__thumb-wrapper {