@wordpress/block-editor 10.1.0 → 10.1.1-next.4d3b314fd5.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 (76) hide show
  1. package/build/components/block-draggable/index.js +1 -1
  2. package/build/components/block-draggable/index.js.map +1 -1
  3. package/build/components/block-list/use-in-between-inserter.js +4 -4
  4. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  5. package/build/components/block-popover/index.js +0 -1
  6. package/build/components/block-popover/index.js.map +1 -1
  7. package/build/components/block-tools/index.js +1 -1
  8. package/build/components/block-tools/index.js.map +1 -1
  9. package/build/components/block-tools/use-block-toolbar-popover-props.js +6 -3
  10. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  11. package/build/components/index.js +9 -0
  12. package/build/components/index.js.map +1 -1
  13. package/build/components/url-popover/image-url-input-ui.js +1 -1
  14. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  15. package/build/components/use-block-drop-zone/index.js +19 -1
  16. package/build/components/use-block-drop-zone/index.js.map +1 -1
  17. package/build/components/use-on-block-drop/index.js +62 -20
  18. package/build/components/use-on-block-drop/index.js.map +1 -1
  19. package/build/components/writing-flow/use-arrow-nav.js +14 -7
  20. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  21. package/build/hooks/index.js +13 -1
  22. package/build/hooks/index.js.map +1 -1
  23. package/build/hooks/layout.js +76 -23
  24. package/build/hooks/layout.js.map +1 -1
  25. package/build/index.js +14 -0
  26. package/build/index.js.map +1 -1
  27. package/build/store/selectors.js +1 -1
  28. package/build/store/selectors.js.map +1 -1
  29. package/build-module/components/block-draggable/index.js +1 -1
  30. package/build-module/components/block-draggable/index.js.map +1 -1
  31. package/build-module/components/block-list/use-in-between-inserter.js +4 -4
  32. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  33. package/build-module/components/block-popover/index.js +0 -1
  34. package/build-module/components/block-popover/index.js.map +1 -1
  35. package/build-module/components/block-tools/index.js +1 -1
  36. package/build-module/components/block-tools/index.js.map +1 -1
  37. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +6 -3
  38. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  39. package/build-module/components/index.js +1 -0
  40. package/build-module/components/index.js.map +1 -1
  41. package/build-module/components/url-popover/image-url-input-ui.js +1 -1
  42. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  43. package/build-module/components/use-block-drop-zone/index.js +19 -1
  44. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  45. package/build-module/components/use-on-block-drop/index.js +62 -21
  46. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  47. package/build-module/components/writing-flow/use-arrow-nav.js +14 -7
  48. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  49. package/build-module/hooks/index.js +1 -0
  50. package/build-module/hooks/index.js.map +1 -1
  51. package/build-module/hooks/layout.js +73 -23
  52. package/build-module/hooks/layout.js.map +1 -1
  53. package/build-module/index.js +1 -1
  54. package/build-module/index.js.map +1 -1
  55. package/build-module/store/selectors.js +1 -1
  56. package/build-module/store/selectors.js.map +1 -1
  57. package/build-style/style-rtl.css +21 -1
  58. package/build-style/style.css +21 -1
  59. package/package.json +29 -29
  60. package/src/components/block-draggable/index.js +1 -1
  61. package/src/components/block-draggable/test/index.native.js +0 -9
  62. package/src/components/block-list/use-in-between-inserter.js +5 -5
  63. package/src/components/block-popover/index.js +0 -1
  64. package/src/components/block-preview/style.scss +13 -0
  65. package/src/components/block-tools/index.js +1 -1
  66. package/src/components/block-tools/use-block-toolbar-popover-props.js +6 -0
  67. package/src/components/index.js +1 -0
  68. package/src/components/url-popover/image-url-input-ui.js +1 -1
  69. package/src/components/use-block-drop-zone/index.js +26 -1
  70. package/src/components/use-on-block-drop/index.js +110 -35
  71. package/src/components/use-on-block-drop/test/index.js +33 -43
  72. package/src/components/writing-flow/use-arrow-nav.js +12 -8
  73. package/src/hooks/index.js +1 -0
  74. package/src/hooks/layout.js +64 -21
  75. package/src/index.js +2 -0
  76. package/src/store/selectors.js +1 -0
@@ -98,7 +98,7 @@ describe( 'onBlockDrop', () => {
98
98
  const targetBlockIndex = 0;
99
99
  const getBlockIndex = noop;
100
100
  const getClientIdsOfDescendants = noop;
101
- const moveBlocksToPosition = jest.fn();
101
+ const moveBlocks = jest.fn();
102
102
 
103
103
  const event = {
104
104
  dataTransfer: {
@@ -115,11 +115,11 @@ describe( 'onBlockDrop', () => {
115
115
  targetBlockIndex,
116
116
  getBlockIndex,
117
117
  getClientIdsOfDescendants,
118
- moveBlocksToPosition
118
+ moveBlocks
119
119
  );
120
120
  eventHandler( event );
121
121
 
122
- expect( moveBlocksToPosition ).not.toHaveBeenCalled();
122
+ expect( moveBlocks ).not.toHaveBeenCalled();
123
123
  } );
124
124
 
125
125
  it( 'does nothing if the block is dropped to the same place it was dragged from', () => {
@@ -128,7 +128,7 @@ describe( 'onBlockDrop', () => {
128
128
  // Target and source block index is the same.
129
129
  const getBlockIndex = jest.fn( () => targetBlockIndex );
130
130
  const getClientIdsOfDescendants = noop;
131
- const moveBlocksToPosition = jest.fn();
131
+ const moveBlocks = jest.fn();
132
132
 
133
133
  const event = {
134
134
  dataTransfer: {
@@ -148,11 +148,11 @@ describe( 'onBlockDrop', () => {
148
148
  targetBlockIndex,
149
149
  getBlockIndex,
150
150
  getClientIdsOfDescendants,
151
- moveBlocksToPosition
151
+ moveBlocks
152
152
  );
153
153
  eventHandler( event );
154
154
 
155
- expect( moveBlocksToPosition ).not.toHaveBeenCalled();
155
+ expect( moveBlocks ).not.toHaveBeenCalled();
156
156
  } );
157
157
 
158
158
  it( 'does nothing if the block is dropped as a child of itself', () => {
@@ -160,7 +160,7 @@ describe( 'onBlockDrop', () => {
160
160
  const targetBlockIndex = 0;
161
161
  const getBlockIndex = jest.fn( () => 6 );
162
162
  const getClientIdsOfDescendants = noop;
163
- const moveBlocksToPosition = jest.fn();
163
+ const moveBlocks = jest.fn();
164
164
 
165
165
  const event = {
166
166
  dataTransfer: {
@@ -180,11 +180,11 @@ describe( 'onBlockDrop', () => {
180
180
  targetBlockIndex,
181
181
  getBlockIndex,
182
182
  getClientIdsOfDescendants,
183
- moveBlocksToPosition
183
+ moveBlocks
184
184
  );
185
185
  eventHandler( event );
186
186
 
187
- expect( moveBlocksToPosition ).not.toHaveBeenCalled();
187
+ expect( moveBlocks ).not.toHaveBeenCalled();
188
188
  } );
189
189
 
190
190
  it( 'does nothing if the block is dropped as a descendant of itself', () => {
@@ -195,7 +195,7 @@ describe( 'onBlockDrop', () => {
195
195
  const getClientIdsOfDescendants = jest.fn( () => [
196
196
  targetRootClientId,
197
197
  ] );
198
- const moveBlocksToPosition = jest.fn();
198
+ const moveBlocks = jest.fn();
199
199
 
200
200
  const event = {
201
201
  dataTransfer: {
@@ -214,11 +214,11 @@ describe( 'onBlockDrop', () => {
214
214
  targetBlockIndex,
215
215
  getBlockIndex,
216
216
  getClientIdsOfDescendants,
217
- moveBlocksToPosition
217
+ moveBlocks
218
218
  );
219
219
  eventHandler( event );
220
220
 
221
- expect( moveBlocksToPosition ).not.toHaveBeenCalled();
221
+ expect( moveBlocks ).not.toHaveBeenCalled();
222
222
  } );
223
223
 
224
224
  it( 'inserts blocks if the drop is valid', () => {
@@ -228,7 +228,7 @@ describe( 'onBlockDrop', () => {
228
228
  const targetBlockIndex = 0;
229
229
  const getBlockIndex = jest.fn( () => 1 );
230
230
  const getClientIdsOfDescendants = () => [];
231
- const moveBlocksToPosition = jest.fn();
231
+ const moveBlocks = jest.fn();
232
232
 
233
233
  const event = {
234
234
  dataTransfer: {
@@ -247,14 +247,13 @@ describe( 'onBlockDrop', () => {
247
247
  targetBlockIndex,
248
248
  getBlockIndex,
249
249
  getClientIdsOfDescendants,
250
- moveBlocksToPosition
250
+ moveBlocks
251
251
  );
252
252
  eventHandler( event );
253
253
 
254
- expect( moveBlocksToPosition ).toHaveBeenCalledWith(
254
+ expect( moveBlocks ).toHaveBeenCalledWith(
255
255
  sourceClientIds,
256
256
  sourceRootClientId,
257
- targetRootClientId,
258
257
  targetBlockIndex
259
258
  );
260
259
  } );
@@ -267,7 +266,7 @@ describe( 'onBlockDrop', () => {
267
266
  const getBlockIndex = jest.fn( () => 1 );
268
267
  // Dragged block is being dropped as a descendant of itself.
269
268
  const getClientIdsOfDescendants = () => [];
270
- const moveBlocksToPosition = jest.fn();
269
+ const moveBlocks = jest.fn();
271
270
 
272
271
  const event = {
273
272
  dataTransfer: {
@@ -289,14 +288,13 @@ describe( 'onBlockDrop', () => {
289
288
  targetBlockIndex,
290
289
  getBlockIndex,
291
290
  getClientIdsOfDescendants,
292
- moveBlocksToPosition
291
+ moveBlocks
293
292
  );
294
293
  eventHandler( event );
295
294
 
296
- expect( moveBlocksToPosition ).toHaveBeenCalledWith(
295
+ expect( moveBlocks ).toHaveBeenCalledWith(
297
296
  sourceClientIds,
298
297
  sourceRootClientId,
299
- targetRootClientId,
300
298
  insertIndex
301
299
  );
302
300
  } );
@@ -306,7 +304,7 @@ describe( 'onFilesDrop', () => {
306
304
  it( 'does nothing if hasUploadPermissions is false', () => {
307
305
  const updateBlockAttributes = jest.fn();
308
306
  const canInsertBlockType = noop;
309
- const insertBlocks = jest.fn();
307
+ const insertOrReplaceBlocks = jest.fn();
310
308
  const targetRootClientId = '1';
311
309
  const targetBlockIndex = 0;
312
310
  const uploadPermissions = false;
@@ -317,12 +315,12 @@ describe( 'onFilesDrop', () => {
317
315
  uploadPermissions,
318
316
  updateBlockAttributes,
319
317
  canInsertBlockType,
320
- insertBlocks
318
+ insertOrReplaceBlocks
321
319
  );
322
320
  onFileDropHandler();
323
321
 
324
322
  expect( findTransform ).not.toHaveBeenCalled();
325
- expect( insertBlocks ).not.toHaveBeenCalled();
323
+ expect( insertOrReplaceBlocks ).not.toHaveBeenCalled();
326
324
  } );
327
325
 
328
326
  it( 'does nothing if the block has no matching file transforms', () => {
@@ -330,7 +328,7 @@ describe( 'onFilesDrop', () => {
330
328
  // to have no return value.
331
329
  findTransform.mockImplementation( noop );
332
330
  const updateBlockAttributes = noop;
333
- const insertBlocks = jest.fn();
331
+ const insertOrReplaceBlocks = jest.fn();
334
332
  const canInsertBlockType = noop;
335
333
  const targetRootClientId = '1';
336
334
  const targetBlockIndex = 0;
@@ -342,12 +340,12 @@ describe( 'onFilesDrop', () => {
342
340
  uploadPermissions,
343
341
  updateBlockAttributes,
344
342
  canInsertBlockType,
345
- insertBlocks
343
+ insertOrReplaceBlocks
346
344
  );
347
345
  onFileDropHandler();
348
346
 
349
347
  expect( findTransform ).toHaveBeenCalled();
350
- expect( insertBlocks ).not.toHaveBeenCalled();
348
+ expect( insertOrReplaceBlocks ).not.toHaveBeenCalled();
351
349
  } );
352
350
 
353
351
  it( 'inserts blocks if a valid transform can be found', () => {
@@ -359,7 +357,7 @@ describe( 'onFilesDrop', () => {
359
357
  findTransform.mockImplementation( () => transformation );
360
358
  const updateBlockAttributes = noop;
361
359
  const canInsertBlockType = noop;
362
- const insertBlocks = jest.fn();
360
+ const insertOrReplaceBlocks = jest.fn();
363
361
  const targetRootClientId = '1';
364
362
  const targetBlockIndex = 0;
365
363
  const uploadPermissions = true;
@@ -370,7 +368,7 @@ describe( 'onFilesDrop', () => {
370
368
  uploadPermissions,
371
369
  updateBlockAttributes,
372
370
  canInsertBlockType,
373
- insertBlocks
371
+ insertOrReplaceBlocks
374
372
  );
375
373
  const files = 'test';
376
374
  onFileDropHandler( files );
@@ -380,11 +378,7 @@ describe( 'onFilesDrop', () => {
380
378
  files,
381
379
  updateBlockAttributes
382
380
  );
383
- expect( insertBlocks ).toHaveBeenCalledWith(
384
- blocks,
385
- targetBlockIndex,
386
- targetRootClientId
387
- );
381
+ expect( insertOrReplaceBlocks ).toHaveBeenCalledWith( blocks );
388
382
  } );
389
383
  } );
390
384
 
@@ -393,16 +387,16 @@ describe( 'onHTMLDrop', () => {
393
387
  pasteHandler.mockImplementation( () => [] );
394
388
  const targetRootClientId = '1';
395
389
  const targetBlockIndex = 0;
396
- const insertBlocks = jest.fn();
390
+ const insertOrReplaceBlocks = jest.fn();
397
391
 
398
392
  const eventHandler = onHTMLDrop(
399
393
  targetRootClientId,
400
394
  targetBlockIndex,
401
- insertBlocks
395
+ insertOrReplaceBlocks
402
396
  );
403
397
  eventHandler();
404
398
 
405
- expect( insertBlocks ).not.toHaveBeenCalled();
399
+ expect( insertOrReplaceBlocks ).not.toHaveBeenCalled();
406
400
  } );
407
401
 
408
402
  it( 'inserts blocks if the HTML can be converted into blocks', () => {
@@ -410,19 +404,15 @@ describe( 'onHTMLDrop', () => {
410
404
  pasteHandler.mockImplementation( () => blocks );
411
405
  const targetRootClientId = '1';
412
406
  const targetBlockIndex = 0;
413
- const insertBlocks = jest.fn();
407
+ const insertOrReplaceBlocks = jest.fn();
414
408
 
415
409
  const eventHandler = onHTMLDrop(
416
410
  targetRootClientId,
417
411
  targetBlockIndex,
418
- insertBlocks
412
+ insertOrReplaceBlocks
419
413
  );
420
414
  eventHandler();
421
415
 
422
- expect( insertBlocks ).toHaveBeenCalledWith(
423
- blocks,
424
- targetBlockIndex,
425
- targetRootClientId
426
- );
416
+ expect( insertOrReplaceBlocks ).toHaveBeenCalledWith( blocks );
427
417
  } );
428
418
  } );
@@ -167,7 +167,8 @@ export default function useArrowNav() {
167
167
  }
168
168
 
169
169
  function onKeyDown( event ) {
170
- const { keyCode, target } = event;
170
+ const { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } =
171
+ event;
171
172
  const isUp = keyCode === UP;
172
173
  const isDown = keyCode === DOWN;
173
174
  const isLeft = keyCode === LEFT;
@@ -176,9 +177,7 @@ export default function useArrowNav() {
176
177
  const isHorizontal = isLeft || isRight;
177
178
  const isVertical = isUp || isDown;
178
179
  const isNav = isHorizontal || isVertical;
179
- const isShift = event.shiftKey;
180
- const hasModifier =
181
- isShift || event.ctrlKey || event.altKey || event.metaKey;
180
+ const hasModifier = shiftKey || ctrlKey || altKey || metaKey;
182
181
  const isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;
183
182
  const { ownerDocument } = node;
184
183
  const { defaultView } = ownerDocument;
@@ -200,7 +199,7 @@ export default function useArrowNav() {
200
199
  return;
201
200
  }
202
201
 
203
- if ( isShift ) {
202
+ if ( shiftKey ) {
204
203
  return;
205
204
  }
206
205
 
@@ -249,7 +248,7 @@ export default function useArrowNav() {
249
248
  const isReverseDir = isRTL( target ) ? ! isReverse : isReverse;
250
249
  const { keepCaretInsideBlock } = getSettings();
251
250
 
252
- if ( isShift ) {
251
+ if ( shiftKey ) {
253
252
  if (
254
253
  isClosestTabbableABlock( target, isReverse ) &&
255
254
  isNavEdge( target, isReverse )
@@ -261,6 +260,9 @@ export default function useArrowNav() {
261
260
  } else if (
262
261
  isVertical &&
263
262
  isVerticalEdge( target, isReverse ) &&
263
+ // When Alt is pressed, only intercept if the caret is also at
264
+ // the horizontal edge.
265
+ ( altKey ? isHorizontalEdge( target, isReverseDir ) : true ) &&
264
266
  ! keepCaretInsideBlock
265
267
  ) {
266
268
  const closestTabbable = getClosestTabbable(
@@ -273,8 +275,10 @@ export default function useArrowNav() {
273
275
  if ( closestTabbable ) {
274
276
  placeCaretAtVerticalEdge(
275
277
  closestTabbable,
276
- isReverse,
277
- verticalRect
278
+ // When Alt is pressed, place the caret at the furthest
279
+ // horizontal edge and the furthest vertical edge.
280
+ altKey ? ! isReverse : isReverse,
281
+ altKey ? undefined : verticalRect
278
282
  );
279
283
  event.preventDefault();
280
284
  }
@@ -20,6 +20,7 @@ import './metadata';
20
20
  import './metadata-name';
21
21
 
22
22
  export { useCustomSides } from './dimensions';
23
+ export { useLayoutClasses, useLayoutStyles } from './layout';
23
24
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
24
25
  export { getColorClassesAndStyles, useColorProps } from './use-color-props';
25
26
  export { getSpacingClassesAndStyles } from './use-spacing-props';
@@ -37,58 +37,101 @@ import { getLayoutType, getLayoutTypes } from '../layouts';
37
37
  const layoutBlockSupportKey = '__experimentalLayout';
38
38
 
39
39
  /**
40
- * Generates the utility classnames for the given blocks layout attributes.
41
- * This method was primarily added to reintroduce classnames that were removed
42
- * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather
43
- * than providing an extensive list of all possible layout classes. The plan is to
44
- * have the style engine generate a more extensive list of utility classnames which
45
- * will then replace this method.
40
+ * Generates the utility classnames for the given block's layout attributes.
46
41
  *
47
- * @param { Object } layout Layout object.
48
- * @param { Object } layoutDefinitions An object containing layout definitions, stored in theme.json.
42
+ * @param { Object } block Block object.
49
43
  *
50
44
  * @return { Array } Array of CSS classname strings.
51
45
  */
52
- function useLayoutClasses( layout, layoutDefinitions ) {
46
+ export function useLayoutClasses( block = {} ) {
53
47
  const rootPaddingAlignment = useSelect( ( select ) => {
54
48
  const { getSettings } = select( blockEditorStore );
55
49
  return getSettings().__experimentalFeatures
56
50
  ?.useRootPaddingAwareAlignments;
57
51
  }, [] );
52
+ const globalLayoutSettings = useSetting( 'layout' ) || {};
53
+
54
+ const { attributes = {}, name } = block;
55
+ const { layout } = attributes;
56
+
57
+ const { default: defaultBlockLayout } =
58
+ getBlockSupport( name, layoutBlockSupportKey ) || {};
59
+ const usedLayout =
60
+ layout?.inherit || layout?.contentSize || layout?.wideSize
61
+ ? { ...layout, type: 'constrained' }
62
+ : layout || defaultBlockLayout || {};
63
+
58
64
  const layoutClassnames = [];
59
65
 
60
- if ( layoutDefinitions?.[ layout?.type || 'default' ]?.className ) {
66
+ if (
67
+ globalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]
68
+ ?.className
69
+ ) {
61
70
  layoutClassnames.push(
62
- layoutDefinitions?.[ layout?.type || 'default' ]?.className
71
+ globalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]
72
+ ?.className
63
73
  );
64
74
  }
65
75
 
66
76
  if (
67
- ( layout?.inherit ||
68
- layout?.contentSize ||
69
- layout?.type === 'constrained' ) &&
77
+ ( usedLayout?.inherit ||
78
+ usedLayout?.contentSize ||
79
+ usedLayout?.type === 'constrained' ) &&
70
80
  rootPaddingAlignment
71
81
  ) {
72
82
  layoutClassnames.push( 'has-global-padding' );
73
83
  }
74
84
 
75
- if ( layout?.orientation ) {
76
- layoutClassnames.push( `is-${ kebabCase( layout.orientation ) }` );
85
+ if ( usedLayout?.orientation ) {
86
+ layoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );
77
87
  }
78
88
 
79
- if ( layout?.justifyContent ) {
89
+ if ( usedLayout?.justifyContent ) {
80
90
  layoutClassnames.push(
81
- `is-content-justification-${ kebabCase( layout.justifyContent ) }`
91
+ `is-content-justification-${ kebabCase(
92
+ usedLayout.justifyContent
93
+ ) }`
82
94
  );
83
95
  }
84
96
 
85
- if ( layout?.flexWrap && layout.flexWrap === 'nowrap' ) {
97
+ if ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {
86
98
  layoutClassnames.push( 'is-nowrap' );
87
99
  }
88
100
 
89
101
  return layoutClassnames;
90
102
  }
91
103
 
104
+ /**
105
+ * Generates a CSS rule with the given block's layout styles.
106
+ *
107
+ * @param { Object } block Block object.
108
+ * @param { string } selector A selector to use in generating the CSS rule.
109
+ *
110
+ * @return { string } CSS rule.
111
+ */
112
+ export function useLayoutStyles( block = {}, selector ) {
113
+ const { attributes = {}, name } = block;
114
+ const { layout = {}, style = {} } = attributes;
115
+ // Update type for blocks using legacy layouts.
116
+ const usedLayout =
117
+ layout?.inherit || layout?.contentSize || layout?.wideSize
118
+ ? { ...layout, type: 'constrained' }
119
+ : layout || {};
120
+ const fullLayoutType = getLayoutType( usedLayout?.type || 'default' );
121
+ const globalLayoutSettings = useSetting( 'layout' ) || {};
122
+ const blockGapSupport = useSetting( 'spacing.blockGap' );
123
+ const hasBlockGapSupport = blockGapSupport !== null;
124
+ const css = fullLayoutType?.getLayoutStyle?.( {
125
+ blockName: name,
126
+ selector,
127
+ layout,
128
+ layoutDefinitions: globalLayoutSettings?.definitions,
129
+ style,
130
+ hasBlockGapSupport,
131
+ } );
132
+ return css;
133
+ }
134
+
92
135
  function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
93
136
  const { layout } = attributes;
94
137
  const defaultThemeLayout = useSetting( 'layout' );
@@ -299,7 +342,7 @@ export const withInspectorControls = createHigherOrderComponent(
299
342
  */
300
343
  export const withLayoutStyles = createHigherOrderComponent(
301
344
  ( BlockListBlock ) => ( props ) => {
302
- const { name, attributes } = props;
345
+ const { name, attributes, block } = props;
303
346
  const hasLayoutBlockSupport = hasBlockSupport(
304
347
  name,
305
348
  layoutBlockSupportKey
@@ -321,7 +364,7 @@ export const withLayoutStyles = createHigherOrderComponent(
321
364
  ? { ...layout, type: 'constrained' }
322
365
  : layout || defaultBlockLayout || {};
323
366
  const layoutClasses = hasLayoutBlockSupport
324
- ? useLayoutClasses( usedLayout, defaultThemeLayout?.definitions )
367
+ ? useLayoutClasses( block )
325
368
  : null;
326
369
  const selector = `.${ getBlockDefaultClassName(
327
370
  name
package/src/index.js CHANGED
@@ -12,6 +12,8 @@ export {
12
12
  getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,
13
13
  getGapCSSValue as __experimentalGetGapCSSValue,
14
14
  useCachedTruthy,
15
+ useLayoutClasses as __experimentaluseLayoutClasses,
16
+ useLayoutStyles as __experimentaluseLayoutStyles,
15
17
  } from './hooks';
16
18
  export * from './components';
17
19
  export * from './elements';
@@ -2720,6 +2720,7 @@ export function __unstableHasActiveBlockOverlayActive( state, clientId ) {
2720
2720
  // In zoom-out mode, the block overlay is always active for top level blocks.
2721
2721
  if (
2722
2722
  editorMode === 'zoom-out' &&
2723
+ clientId &&
2723
2724
  ! getBlockRootClientId( state, clientId )
2724
2725
  ) {
2725
2726
  return true;