@wordpress/block-editor 14.2.0 → 14.2.1-next.1f6eadc42.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 (235) hide show
  1. package/build/components/block-breadcrumb/index.js +4 -10
  2. package/build/components/block-breadcrumb/index.js.map +1 -1
  3. package/build/components/block-compare/block-view.js +2 -4
  4. package/build/components/block-compare/block-view.js.map +1 -1
  5. package/build/components/block-edit/multiple-usage-warning.js +4 -8
  6. package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
  7. package/build/components/block-inspector/index.js +0 -2
  8. package/build/components/block-inspector/index.js.map +1 -1
  9. package/build/components/block-list/block-invalid-warning.js +2 -4
  10. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  11. package/build/components/block-list/index.js +14 -3
  12. package/build/components/block-list/index.js.map +1 -1
  13. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +7 -0
  14. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
  15. package/build/components/block-list/zoom-out-separator.js +98 -0
  16. package/build/components/block-list/zoom-out-separator.js.map +1 -0
  17. package/build/components/block-mover/button.js +2 -4
  18. package/build/components/block-mover/button.js.map +1 -1
  19. package/build/components/block-mover/index.js +2 -4
  20. package/build/components/block-mover/index.js.map +1 -1
  21. package/build/components/block-pattern-setup/index.js +2 -7
  22. package/build/components/block-pattern-setup/index.js.map +1 -1
  23. package/build/components/block-patterns-list/index.js +2 -7
  24. package/build/components/block-patterns-list/index.js.map +1 -1
  25. package/build/components/block-switcher/index.js +8 -2
  26. package/build/components/block-switcher/index.js.map +1 -1
  27. package/build/components/block-switcher/pattern-transformations-menu.js +2 -7
  28. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  29. package/build/components/block-toolbar/index.js +10 -4
  30. package/build/components/block-toolbar/index.js.map +1 -1
  31. package/build/components/block-tools/index.js +1 -1
  32. package/build/components/block-tools/index.js.map +1 -1
  33. package/build/components/block-tools/zoom-out-mode-inserters.js +3 -12
  34. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  35. package/build/components/block-tools/zoom-out-toolbar.js +13 -3
  36. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  37. package/build/components/button-block-appender/index.js +7 -21
  38. package/build/components/button-block-appender/index.js.map +1 -1
  39. package/build/components/global-styles/shadow-panel-components.js +2 -11
  40. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  41. package/build/components/grid/grid-item-resizer.js +2 -2
  42. package/build/components/grid/grid-item-resizer.js.map +1 -1
  43. package/build/components/iframe/get-compatibility-styles.js +1 -1
  44. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  45. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
  46. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  47. package/build/components/inserter/index.js +4 -11
  48. package/build/components/inserter/index.js.map +1 -1
  49. package/build/components/inserter/media-tab/media-list.js +1 -5
  50. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  51. package/build/components/inserter/media-tab/media-preview.js +1 -5
  52. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  53. package/build/components/inserter/quick-inserter.js +0 -4
  54. package/build/components/inserter/quick-inserter.js.map +1 -1
  55. package/build/components/inserter-listbox/index.js +2 -8
  56. package/build/components/inserter-listbox/index.js.map +1 -1
  57. package/build/components/inserter-listbox/item.js +2 -10
  58. package/build/components/inserter-listbox/item.js.map +1 -1
  59. package/build/components/inserter-listbox/row.js +1 -9
  60. package/build/components/inserter-listbox/row.js.map +1 -1
  61. package/build/components/list-view/index.js +3 -7
  62. package/build/components/list-view/index.js.map +1 -1
  63. package/build/components/media-placeholder/index.js +4 -4
  64. package/build/components/media-placeholder/index.js.map +1 -1
  65. package/build/components/spacing-sizes-control/index.js +8 -9
  66. package/build/components/spacing-sizes-control/index.js.map +1 -1
  67. package/build/components/spacing-sizes-control/linked-button.js +35 -0
  68. package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
  69. package/build/components/spacing-sizes-control/utils.js +4 -15
  70. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  71. package/build/components/use-block-drop-zone/index.js +27 -1
  72. package/build/components/use-block-drop-zone/index.js.map +1 -1
  73. package/build/hooks/block-bindings.js +1 -0
  74. package/build/hooks/block-bindings.js.map +1 -1
  75. package/build/hooks/layout.js +0 -1
  76. package/build/hooks/layout.js.map +1 -1
  77. package/build/layouts/constrained.js +5 -6
  78. package/build/layouts/constrained.js.map +1 -1
  79. package/build/layouts/grid.js +19 -16
  80. package/build/layouts/grid.js.map +1 -1
  81. package/build/private-apis.js +0 -2
  82. package/build/private-apis.js.map +1 -1
  83. package/build/store/private-selectors.js +3 -3
  84. package/build/store/private-selectors.js.map +1 -1
  85. package/build/store/reducer.js +0 -2
  86. package/build/store/reducer.js.map +1 -1
  87. package/build-module/components/block-breadcrumb/index.js +4 -10
  88. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  89. package/build-module/components/block-compare/block-view.js +2 -4
  90. package/build-module/components/block-compare/block-view.js.map +1 -1
  91. package/build-module/components/block-edit/multiple-usage-warning.js +4 -8
  92. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  93. package/build-module/components/block-inspector/index.js +0 -2
  94. package/build-module/components/block-inspector/index.js.map +1 -1
  95. package/build-module/components/block-list/block-invalid-warning.js +2 -4
  96. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  97. package/build-module/components/block-list/index.js +14 -3
  98. package/build-module/components/block-list/index.js.map +1 -1
  99. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +8 -1
  100. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
  101. package/build-module/components/block-list/zoom-out-separator.js +90 -0
  102. package/build-module/components/block-list/zoom-out-separator.js.map +1 -0
  103. package/build-module/components/block-mover/button.js +2 -4
  104. package/build-module/components/block-mover/button.js.map +1 -1
  105. package/build-module/components/block-mover/index.js +2 -4
  106. package/build-module/components/block-mover/index.js.map +1 -1
  107. package/build-module/components/block-pattern-setup/index.js +2 -7
  108. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  109. package/build-module/components/block-patterns-list/index.js +2 -7
  110. package/build-module/components/block-patterns-list/index.js.map +1 -1
  111. package/build-module/components/block-switcher/index.js +8 -2
  112. package/build-module/components/block-switcher/index.js.map +1 -1
  113. package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -7
  114. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  115. package/build-module/components/block-toolbar/index.js +10 -4
  116. package/build-module/components/block-toolbar/index.js.map +1 -1
  117. package/build-module/components/block-tools/index.js +1 -1
  118. package/build-module/components/block-tools/index.js.map +1 -1
  119. package/build-module/components/block-tools/zoom-out-mode-inserters.js +3 -13
  120. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  121. package/build-module/components/block-tools/zoom-out-toolbar.js +13 -3
  122. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  123. package/build-module/components/button-block-appender/index.js +8 -23
  124. package/build-module/components/button-block-appender/index.js.map +1 -1
  125. package/build-module/components/global-styles/shadow-panel-components.js +2 -11
  126. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  127. package/build-module/components/grid/grid-item-resizer.js +2 -2
  128. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  129. package/build-module/components/iframe/get-compatibility-styles.js +1 -1
  130. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  131. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
  132. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  133. package/build-module/components/inserter/index.js +4 -11
  134. package/build-module/components/inserter/index.js.map +1 -1
  135. package/build-module/components/inserter/media-tab/media-list.js +1 -5
  136. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  137. package/build-module/components/inserter/media-tab/media-preview.js +2 -6
  138. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  139. package/build-module/components/inserter/quick-inserter.js +1 -5
  140. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  141. package/build-module/components/inserter-listbox/index.js +1 -5
  142. package/build-module/components/inserter-listbox/index.js.map +1 -1
  143. package/build-module/components/inserter-listbox/item.js +3 -11
  144. package/build-module/components/inserter-listbox/item.js.map +1 -1
  145. package/build-module/components/inserter-listbox/row.js +2 -10
  146. package/build-module/components/inserter-listbox/row.js.map +1 -1
  147. package/build-module/components/list-view/index.js +3 -7
  148. package/build-module/components/list-view/index.js.map +1 -1
  149. package/build-module/components/media-placeholder/index.js +4 -4
  150. package/build-module/components/media-placeholder/index.js.map +1 -1
  151. package/build-module/components/spacing-sizes-control/index.js +9 -10
  152. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  153. package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
  154. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
  155. package/build-module/components/spacing-sizes-control/utils.js +4 -15
  156. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  157. package/build-module/components/use-block-drop-zone/index.js +27 -1
  158. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  159. package/build-module/hooks/block-bindings.js +1 -0
  160. package/build-module/hooks/block-bindings.js.map +1 -1
  161. package/build-module/hooks/layout.js +0 -1
  162. package/build-module/hooks/layout.js.map +1 -1
  163. package/build-module/layouts/constrained.js +7 -8
  164. package/build-module/layouts/constrained.js.map +1 -1
  165. package/build-module/layouts/grid.js +21 -18
  166. package/build-module/layouts/grid.js.map +1 -1
  167. package/build-module/private-apis.js +0 -2
  168. package/build-module/private-apis.js.map +1 -1
  169. package/build-module/store/private-selectors.js +3 -3
  170. package/build-module/store/private-selectors.js.map +1 -1
  171. package/build-module/store/reducer.js +0 -2
  172. package/build-module/store/reducer.js.map +1 -1
  173. package/build-style/content-rtl.css +17 -0
  174. package/build-style/content.css +17 -0
  175. package/build-style/style-rtl.css +13 -82
  176. package/build-style/style.css +13 -82
  177. package/package.json +32 -32
  178. package/src/components/block-breadcrumb/index.js +2 -6
  179. package/src/components/block-breadcrumb/style.scss +1 -30
  180. package/src/components/block-compare/block-view.js +1 -2
  181. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
  182. package/src/components/block-edit/multiple-usage-warning.js +2 -4
  183. package/src/components/block-inspector/index.js +0 -1
  184. package/src/components/block-inspector/style.scss +2 -4
  185. package/src/components/block-list/block-invalid-warning.js +1 -2
  186. package/src/components/block-list/content.scss +21 -0
  187. package/src/components/block-list/index.js +59 -38
  188. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +13 -1
  189. package/src/components/block-list/zoom-out-separator.js +110 -0
  190. package/src/components/block-mover/button.js +1 -2
  191. package/src/components/block-mover/index.js +1 -2
  192. package/src/components/block-pattern-setup/index.js +3 -11
  193. package/src/components/block-patterns-list/index.js +3 -8
  194. package/src/components/block-switcher/index.js +19 -3
  195. package/src/components/block-switcher/pattern-transformations-menu.js +3 -8
  196. package/src/components/block-switcher/style.scss +0 -24
  197. package/src/components/block-toolbar/index.js +10 -3
  198. package/src/components/block-toolbar/style.scss +4 -1
  199. package/src/components/block-tools/index.js +1 -1
  200. package/src/components/block-tools/zoom-out-mode-inserters.js +0 -12
  201. package/src/components/block-tools/zoom-out-toolbar.js +11 -0
  202. package/src/components/button-block-appender/index.js +16 -25
  203. package/src/components/global-styles/shadow-panel-components.js +2 -10
  204. package/src/components/grid/grid-item-resizer.js +2 -2
  205. package/src/components/iframe/get-compatibility-styles.js +6 -1
  206. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +32 -15
  207. package/src/components/inserter/index.js +4 -10
  208. package/src/components/inserter/media-tab/media-list.js +1 -4
  209. package/src/components/inserter/media-tab/media-preview.js +3 -6
  210. package/src/components/inserter/quick-inserter.js +1 -4
  211. package/src/components/inserter/style.scss +4 -9
  212. package/src/components/inserter-listbox/index.js +1 -4
  213. package/src/components/inserter-listbox/item.js +3 -13
  214. package/src/components/inserter-listbox/row.js +2 -9
  215. package/src/components/list-view/index.js +3 -8
  216. package/src/components/media-placeholder/README.md +2 -2
  217. package/src/components/media-placeholder/index.js +7 -4
  218. package/src/components/spacing-sizes-control/index.js +10 -13
  219. package/src/components/spacing-sizes-control/linked-button.js +32 -0
  220. package/src/components/spacing-sizes-control/test/utils.js +14 -15
  221. package/src/components/spacing-sizes-control/utils.js +5 -18
  222. package/src/components/use-block-drop-zone/index.js +33 -1
  223. package/src/hooks/block-bindings.js +1 -1
  224. package/src/hooks/layout.js +0 -1
  225. package/src/hooks/layout.scss +6 -20
  226. package/src/layouts/constrained.js +9 -7
  227. package/src/layouts/grid.js +29 -22
  228. package/src/private-apis.js +0 -2
  229. package/src/store/private-selectors.js +6 -3
  230. package/src/store/reducer.js +0 -2
  231. package/build/components/spacing-sizes-control/sides-dropdown/index.js +0 -86
  232. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
  233. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +0 -81
  234. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
  235. package/src/components/spacing-sizes-control/sides-dropdown/index.js +0 -91
@@ -39,6 +39,7 @@ import {
39
39
  DEFAULT_BLOCK_EDIT_CONTEXT,
40
40
  } from '../block-edit/context';
41
41
  import { useTypingObserver } from '../observe-typing';
42
+ import { ZoomOutSeparator } from './zoom-out-separator';
42
43
  import { unlock } from '../../lock-unlock';
43
44
 
44
45
  export const IntersectionObserver = createContext();
@@ -174,49 +175,55 @@ function Items( {
174
175
  // function on every render.
175
176
  const hasAppender = CustomAppender !== false;
176
177
  const hasCustomAppender = !! CustomAppender;
177
- const { order, selectedBlocks, visibleBlocks, shouldRenderAppender } =
178
- useSelect(
179
- ( select ) => {
180
- const {
181
- getSettings,
182
- getBlockOrder,
183
- getSelectedBlockClientId,
184
- getSelectedBlockClientIds,
185
- __unstableGetVisibleBlocks,
186
- getTemplateLock,
187
- getBlockEditingMode,
188
- __unstableGetEditorMode,
189
- } = select( blockEditorStore );
190
-
191
- const _order = getBlockOrder( rootClientId );
178
+ const {
179
+ order,
180
+ isZoomOut,
181
+ selectedBlocks,
182
+ visibleBlocks,
183
+ shouldRenderAppender,
184
+ } = useSelect(
185
+ ( select ) => {
186
+ const {
187
+ getSettings,
188
+ getBlockOrder,
189
+ getSelectedBlockClientId,
190
+ getSelectedBlockClientIds,
191
+ __unstableGetVisibleBlocks,
192
+ getTemplateLock,
193
+ getBlockEditingMode,
194
+ __unstableGetEditorMode,
195
+ } = select( blockEditorStore );
192
196
 
193
- if ( getSettings().__unstableIsPreviewMode ) {
194
- return {
195
- order: _order,
196
- selectedBlocks: EMPTY_ARRAY,
197
- visibleBlocks: EMPTY_SET,
198
- };
199
- }
197
+ const _order = getBlockOrder( rootClientId );
200
198
 
201
- const selectedBlockClientId = getSelectedBlockClientId();
199
+ if ( getSettings().__unstableIsPreviewMode ) {
202
200
  return {
203
201
  order: _order,
204
- selectedBlocks: getSelectedBlockClientIds(),
205
- visibleBlocks: __unstableGetVisibleBlocks(),
206
- shouldRenderAppender:
207
- hasAppender &&
208
- __unstableGetEditorMode() !== 'zoom-out' &&
209
- ( hasCustomAppender
210
- ? ! getTemplateLock( rootClientId ) &&
211
- getBlockEditingMode( rootClientId ) !== 'disabled'
212
- : rootClientId === selectedBlockClientId ||
213
- ( ! rootClientId &&
214
- ! selectedBlockClientId &&
215
- ! _order.length ) ),
202
+ selectedBlocks: EMPTY_ARRAY,
203
+ visibleBlocks: EMPTY_SET,
216
204
  };
217
- },
218
- [ rootClientId, hasAppender, hasCustomAppender ]
219
- );
205
+ }
206
+
207
+ const selectedBlockClientId = getSelectedBlockClientId();
208
+ return {
209
+ order: _order,
210
+ selectedBlocks: getSelectedBlockClientIds(),
211
+ visibleBlocks: __unstableGetVisibleBlocks(),
212
+ isZoomOut: __unstableGetEditorMode() === 'zoom-out',
213
+ shouldRenderAppender:
214
+ hasAppender &&
215
+ __unstableGetEditorMode() !== 'zoom-out' &&
216
+ ( hasCustomAppender
217
+ ? ! getTemplateLock( rootClientId ) &&
218
+ getBlockEditingMode( rootClientId ) !== 'disabled'
219
+ : rootClientId === selectedBlockClientId ||
220
+ ( ! rootClientId &&
221
+ ! selectedBlockClientId &&
222
+ ! _order.length ) ),
223
+ };
224
+ },
225
+ [ rootClientId, hasAppender, hasCustomAppender ]
226
+ );
220
227
 
221
228
  return (
222
229
  <LayoutProvider value={ layout }>
@@ -230,10 +237,24 @@ function Items( {
230
237
  ! selectedBlocks.includes( clientId )
231
238
  }
232
239
  >
240
+ { isZoomOut && (
241
+ <ZoomOutSeparator
242
+ clientId={ clientId }
243
+ rootClientId={ rootClientId }
244
+ position="top"
245
+ />
246
+ ) }
233
247
  <BlockListBlock
234
248
  rootClientId={ rootClientId }
235
249
  clientId={ clientId }
236
250
  />
251
+ { isZoomOut && (
252
+ <ZoomOutSeparator
253
+ clientId={ clientId }
254
+ rootClientId={ rootClientId }
255
+ position="bottom"
256
+ />
257
+ ) }
237
258
  </AsyncModeProvider>
238
259
  ) ) }
239
260
  { order.length < 1 && placeholder }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useDispatch } from '@wordpress/data';
4
+ import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { useRefEffect } from '@wordpress/compose';
6
6
 
7
7
  /**
@@ -16,6 +16,10 @@ import { unlock } from '../../../lock-unlock';
16
16
  * @param {string} clientId Block client ID.
17
17
  */
18
18
  export function useZoomOutModeExit( { editorMode } ) {
19
+ const getSettings = useSelect(
20
+ ( select ) => select( blockEditorStore ).getSettings
21
+ );
22
+
19
23
  const { __unstableSetEditorMode } = unlock(
20
24
  useDispatch( blockEditorStore )
21
25
  );
@@ -29,6 +33,14 @@ export function useZoomOutModeExit( { editorMode } ) {
29
33
  function onDoubleClick( event ) {
30
34
  if ( ! event.defaultPrevented ) {
31
35
  event.preventDefault();
36
+
37
+ const { __experimentalSetIsInserterOpened } = getSettings();
38
+
39
+ if (
40
+ typeof __experimentalSetIsInserterOpened === 'function'
41
+ ) {
42
+ __experimentalSetIsInserterOpened( false );
43
+ }
32
44
  __unstableSetEditorMode( 'edit' );
33
45
  }
34
46
  }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import {
10
+ __unstableMotion as motion,
11
+ __unstableAnimatePresence as AnimatePresence,
12
+ } from '@wordpress/components';
13
+ import { useReducedMotion } from '@wordpress/compose';
14
+ import { useSelect } from '@wordpress/data';
15
+ import { useState } from '@wordpress/element';
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+ import { store as blockEditorStore } from '../../store';
21
+ import { unlock } from '../../lock-unlock';
22
+
23
+ export function ZoomOutSeparator( {
24
+ clientId,
25
+ rootClientId = '',
26
+ position = 'top',
27
+ } ) {
28
+ const [ isDraggedOver, setIsDraggedOver ] = useState( false );
29
+ const {
30
+ sectionRootClientId,
31
+ sectionClientIds,
32
+ blockInsertionPoint,
33
+ blockInsertionPointVisible,
34
+ } = useSelect( ( select ) => {
35
+ const {
36
+ getBlockInsertionPoint,
37
+ getBlockOrder,
38
+ isBlockInsertionPointVisible,
39
+ getSectionRootClientId,
40
+ } = unlock( select( blockEditorStore ) );
41
+
42
+ const root = getSectionRootClientId();
43
+ const sectionRootClientIds = getBlockOrder( root );
44
+ return {
45
+ sectionRootClientId: root,
46
+ sectionClientIds: sectionRootClientIds,
47
+ blockOrder: getBlockOrder( root ),
48
+ blockInsertionPoint: getBlockInsertionPoint(),
49
+ blockInsertionPointVisible: isBlockInsertionPointVisible(),
50
+ };
51
+ }, [] );
52
+
53
+ const isReducedMotion = useReducedMotion();
54
+
55
+ if ( ! clientId ) {
56
+ return;
57
+ }
58
+
59
+ let isVisible = false;
60
+
61
+ const isSectionBlock =
62
+ rootClientId === sectionRootClientId &&
63
+ sectionClientIds &&
64
+ sectionClientIds.includes( clientId );
65
+
66
+ if ( ! isSectionBlock ) {
67
+ return null;
68
+ }
69
+
70
+ if ( position === 'top' ) {
71
+ isVisible =
72
+ blockInsertionPointVisible &&
73
+ blockInsertionPoint.index === 0 &&
74
+ clientId === sectionClientIds[ blockInsertionPoint.index ];
75
+ }
76
+
77
+ if ( position === 'bottom' ) {
78
+ isVisible =
79
+ blockInsertionPointVisible &&
80
+ clientId === sectionClientIds[ blockInsertionPoint.index - 1 ];
81
+ }
82
+
83
+ return (
84
+ <AnimatePresence>
85
+ { isVisible && (
86
+ <motion.div
87
+ as="button"
88
+ layout={ ! isReducedMotion }
89
+ initial={ { height: 0 } }
90
+ animate={ { height: '120px' } }
91
+ exit={ { height: 0 } }
92
+ transition={ {
93
+ type: 'tween',
94
+ duration: 0.2,
95
+ ease: [ 0.6, 0, 0.4, 1 ],
96
+ } }
97
+ className={ clsx(
98
+ 'block-editor-block-list__zoom-out-separator',
99
+ {
100
+ 'is-dragged-over': isDraggedOver,
101
+ }
102
+ ) }
103
+ data-is-insertion-point="true"
104
+ onDragOver={ () => setIsDraggedOver( true ) }
105
+ onDragLeave={ () => setIsDraggedOver( false ) }
106
+ ></motion.div>
107
+ ) }
108
+ </AnimatePresence>
109
+ );
110
+ }
@@ -129,8 +129,7 @@ const BlockMoverButton = forwardRef(
129
129
  return (
130
130
  <>
131
131
  <Button
132
- // TODO: Switch to `true` (40px size) if possible
133
- __next40pxDefaultSize={ false }
132
+ __next40pxDefaultSize
134
133
  ref={ ref }
135
134
  className={ clsx(
136
135
  'block-editor-block-mover-button',
@@ -87,8 +87,7 @@ function BlockMover( {
87
87
  <BlockDraggable clientIds={ clientIds } fadeWhenDisabled>
88
88
  { ( draggableProps ) => (
89
89
  <Button
90
- // TODO: Switch to `true` (40px size) if possible
91
- __next40pxDefaultSize={ false }
90
+ __next40pxDefaultSize
92
91
  icon={ dragHandle }
93
92
  className="block-editor-block-mover__drag-handle"
94
93
  label={ __( 'Drag' ) }
@@ -3,10 +3,7 @@
3
3
  */
4
4
  import { useDispatch } from '@wordpress/data';
5
5
  import { cloneBlock } from '@wordpress/blocks';
6
- import {
7
- VisuallyHidden,
8
- privateApis as componentsPrivateApis,
9
- } from '@wordpress/components';
6
+ import { Composite, VisuallyHidden } from '@wordpress/components';
10
7
 
11
8
  import { useState } from '@wordpress/element';
12
9
  import { useInstanceId } from '@wordpress/compose';
@@ -20,11 +17,6 @@ import BlockPreview from '../block-preview';
20
17
  import SetupToolbar from './setup-toolbar';
21
18
  import usePatternsSetup from './use-patterns-setup';
22
19
  import { VIEWMODES } from './constants';
23
- import { unlock } from '../../lock-unlock';
24
-
25
- const { CompositeV2: Composite, CompositeItemV2: CompositeItem } = unlock(
26
- componentsPrivateApis
27
- );
28
20
 
29
21
  const SetupContent = ( {
30
22
  viewMode,
@@ -88,7 +80,7 @@ function BlockPattern( { pattern, onSelect, showTitles } ) {
88
80
  );
89
81
  return (
90
82
  <div className={ `${ baseClassName }__list-item` }>
91
- <CompositeItem
83
+ <Composite.Item
92
84
  render={
93
85
  <div
94
86
  aria-describedby={
@@ -116,7 +108,7 @@ function BlockPattern( { pattern, onSelect, showTitles } ) {
116
108
  { description }
117
109
  </VisuallyHidden>
118
110
  ) }
119
- </CompositeItem>
111
+ </Composite.Item>
120
112
  </div>
121
113
  );
122
114
  }
@@ -9,9 +9,9 @@ import clsx from 'clsx';
9
9
  import { cloneBlock } from '@wordpress/blocks';
10
10
  import { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';
11
11
  import {
12
+ Composite,
12
13
  VisuallyHidden,
13
14
  Tooltip,
14
- privateApis as componentsPrivateApis,
15
15
  __experimentalHStack as HStack,
16
16
  } from '@wordpress/components';
17
17
  import { useInstanceId } from '@wordpress/compose';
@@ -21,16 +21,11 @@ import { Icon, symbol } from '@wordpress/icons';
21
21
  /**
22
22
  * Internal dependencies
23
23
  */
24
- import { unlock } from '../../lock-unlock';
25
24
  import BlockPreview from '../block-preview';
26
25
  import InserterDraggableBlocks from '../inserter-draggable-blocks';
27
26
  import BlockPatternsPaging from '../block-patterns-paging';
28
27
  import { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
29
28
 
30
- const { CompositeV2: Composite, CompositeItemV2: CompositeItem } = unlock(
31
- componentsPrivateApis
32
- );
33
-
34
29
  const WithToolTip = ( { showTooltip, title, children } ) => {
35
30
  if ( showTooltip ) {
36
31
  return <Tooltip text={ title }>{ children }</Tooltip>;
@@ -105,7 +100,7 @@ function BlockPattern( {
105
100
  }
106
101
  title={ pattern.title }
107
102
  >
108
- <CompositeItem
103
+ <Composite.Item
109
104
  render={
110
105
  <div
111
106
  role="option"
@@ -174,7 +169,7 @@ function BlockPattern( {
174
169
  { pattern.description }
175
170
  </VisuallyHidden>
176
171
  ) }
177
- </CompositeItem>
172
+ </Composite.Item>
178
173
  </WithToolTip>
179
174
  </div>
180
175
  ) }
@@ -198,6 +198,7 @@ const BlockIndicator = ( { icon, showTitle, blockTitle } ) => (
198
198
 
199
199
  export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
200
200
  const {
201
+ hasContentOnlyLocking,
201
202
  canRemove,
202
203
  hasBlockStyles,
203
204
  icon,
@@ -206,8 +207,12 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
206
207
  isTemplate,
207
208
  } = useSelect(
208
209
  ( select ) => {
209
- const { getBlocksByClientId, getBlockAttributes, canRemoveBlocks } =
210
- select( blockEditorStore );
210
+ const {
211
+ getTemplateLock,
212
+ getBlocksByClientId,
213
+ getBlockAttributes,
214
+ canRemoveBlocks,
215
+ } = select( blockEditorStore );
211
216
  const { getBlockStyles, getBlockType, getActiveBlockVariation } =
212
217
  select( blocksStore );
213
218
  const _blocks = getBlocksByClientId( clientIds );
@@ -219,6 +224,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
219
224
  const blockType = getBlockType( firstBlockName );
220
225
 
221
226
  let _icon;
227
+ let _hasTemplateLock;
222
228
  if ( _isSingleBlockSelected ) {
223
229
  const match = getActiveBlockVariation(
224
230
  firstBlockName,
@@ -226,9 +232,14 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
226
232
  );
227
233
  // Take into account active block variations.
228
234
  _icon = match?.icon || blockType.icon;
235
+ _hasTemplateLock =
236
+ getTemplateLock( clientIds[ 0 ] ) === 'contentOnly';
229
237
  } else {
230
238
  const isSelectionOfSameType =
231
239
  new Set( _blocks.map( ( { name } ) => name ) ).size === 1;
240
+ _hasTemplateLock = clientIds.some(
241
+ ( id ) => getTemplateLock( id ) === 'contentOnly'
242
+ );
232
243
  // When selection consists of blocks of multiple types, display an
233
244
  // appropriate icon to communicate the non-uniformity.
234
245
  _icon = isSelectionOfSameType ? blockType.icon : copy;
@@ -244,6 +255,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
244
255
  _isSingleBlockSelected && isReusableBlock( _blocks[ 0 ] ),
245
256
  isTemplate:
246
257
  _isSingleBlockSelected && isTemplatePart( _blocks[ 0 ] ),
258
+ hasContentOnlyLocking: _hasTemplateLock,
247
259
  };
248
260
  },
249
261
  [ clientIds ]
@@ -252,6 +264,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
252
264
  clientId: clientIds?.[ 0 ],
253
265
  maximumLength: 35,
254
266
  } );
267
+
255
268
  if ( invalidBlocks ) {
256
269
  return null;
257
270
  }
@@ -261,7 +274,10 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
261
274
  ? blockTitle
262
275
  : __( 'Multiple blocks selected' );
263
276
 
264
- const hideDropdown = disabled || ( ! hasBlockStyles && ! canRemove );
277
+ const hideDropdown =
278
+ disabled ||
279
+ ( ! hasBlockStyles && ! canRemove ) ||
280
+ hasContentOnlyLocking;
265
281
 
266
282
  if ( hideDropdown ) {
267
283
  return (
@@ -7,11 +7,11 @@ import { useInstanceId, useViewportMatch } from '@wordpress/compose';
7
7
  import { chevronRight } from '@wordpress/icons';
8
8
 
9
9
  import {
10
+ Composite,
10
11
  MenuGroup,
11
12
  MenuItem,
12
13
  Popover,
13
14
  VisuallyHidden,
14
- privateApis as componentsPrivateApis,
15
15
  } from '@wordpress/components';
16
16
 
17
17
  /**
@@ -19,11 +19,6 @@ import {
19
19
  */
20
20
  import BlockPreview from '../block-preview';
21
21
  import useTransformedPatterns from './use-transformed-patterns';
22
- import { unlock } from '../../lock-unlock';
23
-
24
- const { CompositeV2: Composite, CompositeItemV2: CompositeItem } = unlock(
25
- componentsPrivateApis
26
- );
27
22
 
28
23
  function PatternTransformationsMenu( {
29
24
  blocks,
@@ -107,7 +102,7 @@ function BlockPattern( { pattern, onSelect } ) {
107
102
  );
108
103
  return (
109
104
  <div className={ `${ baseClassName }-list__list-item` }>
110
- <CompositeItem
105
+ <Composite.Item
111
106
  render={
112
107
  <div
113
108
  role="option"
@@ -127,7 +122,7 @@ function BlockPattern( { pattern, onSelect } ) {
127
122
  <div className={ `${ baseClassName }-list__item-title` }>
128
123
  { pattern.title }
129
124
  </div>
130
- </CompositeItem>
125
+ </Composite.Item>
131
126
  { !! pattern.description && (
132
127
  <VisuallyHidden id={ descriptionId }>
133
128
  { pattern.description }
@@ -55,30 +55,6 @@
55
55
  }
56
56
  }
57
57
 
58
- // Style this the same as the block buttons in the library.
59
- // Needs specificity to override the icon button.
60
- .block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon,
61
- .block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon,
62
- .block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon,
63
- .block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon {
64
- .block-editor-block-icon {
65
- height: 100%;
66
- position: relative;
67
- margin: 0 auto;
68
- display: flex;
69
- align-items: center;
70
- min-width: 100%;
71
- }
72
-
73
- // Position the focus style correctly.
74
- &::before {
75
- top: $grid-unit-10;
76
- right: $grid-unit-10;
77
- bottom: $grid-unit-10;
78
- left: $grid-unit-10;
79
- }
80
- }
81
-
82
58
  .components-popover.block-editor-block-switcher__popover .components-popover__content {
83
59
  min-width: 300px;
84
60
  }
@@ -66,6 +66,7 @@ export function PrivateBlockToolbar( {
66
66
  showParentSelector,
67
67
  isUsingBindings,
68
68
  hasParentPattern,
69
+ hasContentOnlyLocking,
69
70
  } = useSelect( ( select ) => {
70
71
  const {
71
72
  getBlockName,
@@ -76,6 +77,7 @@ export function PrivateBlockToolbar( {
76
77
  getBlockEditingMode,
77
78
  getBlockAttributes,
78
79
  getBlockParentsByBlockName,
80
+ getTemplateLock,
79
81
  } = select( blockEditorStore );
80
82
  const selectedBlockClientIds = getSelectedBlockClientIds();
81
83
  const selectedBlockClientId = selectedBlockClientIds[ 0 ];
@@ -103,6 +105,10 @@ export function PrivateBlockToolbar( {
103
105
  .length > 0
104
106
  );
105
107
 
108
+ // If one or more selected blocks are locked, do not show the BlockGroupToolbar.
109
+ const _hasTemplateLock = selectedBlockClientIds.some(
110
+ ( id ) => getTemplateLock( id ) === 'contentOnly'
111
+ );
106
112
  return {
107
113
  blockClientId: selectedBlockClientId,
108
114
  blockClientIds: selectedBlockClientIds,
@@ -123,6 +129,7 @@ export function PrivateBlockToolbar( {
123
129
  _isDefaultEditingMode,
124
130
  isUsingBindings: _isUsingBindings,
125
131
  hasParentPattern: _hasParentPattern,
132
+ hasContentOnlyLocking: _hasTemplateLock,
126
133
  };
127
134
  }, [] );
128
135
 
@@ -205,9 +212,9 @@ export function PrivateBlockToolbar( {
205
212
  </ToolbarGroup>
206
213
  </div>
207
214
  ) }
208
- { shouldShowVisualToolbar && isMultiToolbar && (
209
- <BlockGroupToolbar />
210
- ) }
215
+ { ! hasContentOnlyLocking &&
216
+ shouldShowVisualToolbar &&
217
+ isMultiToolbar && <BlockGroupToolbar /> }
211
218
  { shouldShowVisualToolbar && (
212
219
  <>
213
220
  <BlockControls.Slot
@@ -70,10 +70,13 @@
70
70
  // Raise the specificity.
71
71
  &.components-accessible-toolbar {
72
72
  border: none;
73
- border-bottom: $border-width solid $gray-200;
74
73
  border-radius: 0;
75
74
  }
76
75
 
76
+ &.is-unstyled {
77
+ box-shadow: 0 $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
78
+ }
79
+
77
80
  .block-editor-block-toolbar {
78
81
  overflow: auto;
79
82
  overflow-y: hidden;
@@ -202,7 +202,7 @@ export default function BlockTools( {
202
202
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
203
203
  <div { ...props } onKeyDown={ onKeyDown }>
204
204
  <InsertionPointOpenRef.Provider value={ useRef( false ) }>
205
- { ! isTyping && (
205
+ { ! isTyping && ! isZoomOutMode && (
206
206
  <InsertionPoint
207
207
  __unstableContentRef={ __unstableContentRef }
208
208
  />
@@ -88,18 +88,6 @@ function ZoomOutModeInserters() {
88
88
  previousClientId={ previousClientId }
89
89
  nextClientId={ nextClientId }
90
90
  >
91
- { shouldRenderInsertionPoint && (
92
- <div
93
- style={ {
94
- borderRadius: '0',
95
- height: '12px',
96
- opacity: 1,
97
- transform: 'translateY(-50%)',
98
- width: '100%',
99
- } }
100
- className="block-editor-block-list__insertion-point-indicator"
101
- />
102
- ) }
103
91
  { ! shouldRenderInsertionPoint && (
104
92
  <ZoomOutModeInserterButton
105
93
  isVisible={ isSelected || isHovered }
@@ -31,7 +31,12 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
31
31
  getPreviousBlockClientId,
32
32
  canRemoveBlock,
33
33
  canMoveBlock,
34
+ getSettings,
34
35
  } = select( blockEditorStore );
36
+
37
+ const { __experimentalSetIsInserterOpened: setIsInserterOpened } =
38
+ getSettings();
39
+
35
40
  const { getBlockType } = select( blocksStore );
36
41
  const { name } = getBlock( clientId );
37
42
  const blockType = getBlockType( name );
@@ -63,6 +68,7 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
63
68
  isPrevBlockTemplatePart,
64
69
  canRemove: canRemoveBlock( clientId ),
65
70
  canMove: canMoveBlock( clientId ),
71
+ setIsInserterOpened,
66
72
  };
67
73
  },
68
74
  [ clientId ]
@@ -75,6 +81,7 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
75
81
  isPrevBlockTemplatePart,
76
82
  canRemove,
77
83
  canMove,
84
+ setIsInserterOpened,
78
85
  } = selected;
79
86
 
80
87
  const { removeBlock, __unstableSetEditorMode } =
@@ -132,6 +139,10 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
132
139
  icon={ edit }
133
140
  label={ __( 'Edit' ) }
134
141
  onClick={ () => {
142
+ // Setting may be undefined.
143
+ if ( typeof setIsInserterOpened === 'function' ) {
144
+ setIsInserterOpened( false );
145
+ }
135
146
  __unstableSetEditorMode( 'edit' );
136
147
  __unstableContentRef.current?.focus();
137
148
  } }