@wordpress/block-editor 15.1.1-next.0f6f9d12c.0 → 15.2.1-next.e256d081a.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "15.1.1-next.0f6f9d12c.0",
3
+ "version": "15.2.1-next.e256d081a.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,38 +37,38 @@
37
37
  "@emotion/react": "^11.7.1",
38
38
  "@emotion/styled": "^11.6.0",
39
39
  "@react-spring/web": "^9.4.5",
40
- "@wordpress/a11y": "^4.28.1-next.0f6f9d12c.0",
41
- "@wordpress/api-fetch": "^7.28.1-next.0f6f9d12c.0",
42
- "@wordpress/blob": "^4.28.1-next.0f6f9d12c.0",
43
- "@wordpress/block-serialization-default-parser": "^5.28.1-next.0f6f9d12c.0",
44
- "@wordpress/blocks": "^15.1.1-next.0f6f9d12c.0",
45
- "@wordpress/commands": "^1.28.1-next.0f6f9d12c.0",
46
- "@wordpress/components": "^30.2.1-next.0f6f9d12c.0",
47
- "@wordpress/compose": "^7.28.1-next.0f6f9d12c.0",
48
- "@wordpress/data": "^10.28.1-next.0f6f9d12c.0",
49
- "@wordpress/date": "^5.28.1-next.0f6f9d12c.0",
50
- "@wordpress/deprecated": "^4.28.1-next.0f6f9d12c.0",
51
- "@wordpress/dom": "^4.28.1-next.0f6f9d12c.0",
52
- "@wordpress/element": "^6.28.1-next.0f6f9d12c.0",
53
- "@wordpress/escape-html": "^3.28.1-next.0f6f9d12c.0",
54
- "@wordpress/hooks": "^4.28.1-next.0f6f9d12c.0",
55
- "@wordpress/html-entities": "^4.28.1-next.0f6f9d12c.0",
56
- "@wordpress/i18n": "^6.1.1-next.0f6f9d12c.0",
57
- "@wordpress/icons": "^10.28.2-next.0f6f9d12c.0",
58
- "@wordpress/is-shallow-equal": "^5.28.1-next.0f6f9d12c.0",
59
- "@wordpress/keyboard-shortcuts": "^5.28.1-next.0f6f9d12c.0",
60
- "@wordpress/keycodes": "^4.28.1-next.0f6f9d12c.0",
61
- "@wordpress/notices": "^5.28.1-next.0f6f9d12c.0",
62
- "@wordpress/preferences": "^4.28.1-next.0f6f9d12c.0",
63
- "@wordpress/priority-queue": "^3.28.1-next.0f6f9d12c.0",
64
- "@wordpress/private-apis": "^1.28.1-next.0f6f9d12c.0",
65
- "@wordpress/rich-text": "^7.28.1-next.0f6f9d12c.0",
66
- "@wordpress/style-engine": "^2.28.1-next.0f6f9d12c.0",
67
- "@wordpress/token-list": "^3.28.1-next.0f6f9d12c.0",
68
- "@wordpress/upload-media": "^0.13.1-next.0f6f9d12c.0",
69
- "@wordpress/url": "^4.28.1-next.0f6f9d12c.0",
70
- "@wordpress/warning": "^3.28.1-next.0f6f9d12c.0",
71
- "@wordpress/wordcount": "^4.28.1-next.0f6f9d12c.0",
40
+ "@wordpress/a11y": "^4.29.1-next.e256d081a.0",
41
+ "@wordpress/api-fetch": "^7.29.1-next.e256d081a.0",
42
+ "@wordpress/blob": "^4.29.1-next.e256d081a.0",
43
+ "@wordpress/block-serialization-default-parser": "^5.29.1-next.e256d081a.0",
44
+ "@wordpress/blocks": "^15.2.1-next.e256d081a.0",
45
+ "@wordpress/commands": "^1.29.1-next.e256d081a.0",
46
+ "@wordpress/components": "^30.2.2-next.e256d081a.0",
47
+ "@wordpress/compose": "^7.29.1-next.e256d081a.0",
48
+ "@wordpress/data": "^10.29.1-next.e256d081a.0",
49
+ "@wordpress/date": "^5.30.1-next.e256d081a.0",
50
+ "@wordpress/deprecated": "^4.29.1-next.e256d081a.0",
51
+ "@wordpress/dom": "^4.29.1-next.e256d081a.0",
52
+ "@wordpress/element": "^6.29.1-next.e256d081a.0",
53
+ "@wordpress/escape-html": "^3.29.1-next.e256d081a.0",
54
+ "@wordpress/hooks": "^4.29.1-next.e256d081a.0",
55
+ "@wordpress/html-entities": "^4.29.1-next.e256d081a.0",
56
+ "@wordpress/i18n": "^6.2.1-next.e256d081a.0",
57
+ "@wordpress/icons": "^10.29.1-next.e256d081a.0",
58
+ "@wordpress/is-shallow-equal": "^5.29.1-next.e256d081a.0",
59
+ "@wordpress/keyboard-shortcuts": "^5.29.1-next.e256d081a.0",
60
+ "@wordpress/keycodes": "^4.29.1-next.e256d081a.0",
61
+ "@wordpress/notices": "^5.29.1-next.e256d081a.0",
62
+ "@wordpress/preferences": "^4.29.1-next.e256d081a.0",
63
+ "@wordpress/priority-queue": "^3.29.1-next.e256d081a.0",
64
+ "@wordpress/private-apis": "^1.29.1-next.e256d081a.0",
65
+ "@wordpress/rich-text": "^7.29.1-next.e256d081a.0",
66
+ "@wordpress/style-engine": "^2.29.1-next.e256d081a.0",
67
+ "@wordpress/token-list": "^3.29.1-next.e256d081a.0",
68
+ "@wordpress/upload-media": "^0.14.1-next.e256d081a.0",
69
+ "@wordpress/url": "^4.29.1-next.e256d081a.0",
70
+ "@wordpress/warning": "^3.29.1-next.e256d081a.0",
71
+ "@wordpress/wordcount": "^4.29.1-next.e256d081a.0",
72
72
  "change-case": "^4.1.2",
73
73
  "clsx": "^2.1.1",
74
74
  "colord": "^2.7.0",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "7d4f4367e2f76deddf4a09b540e6b2f9f4c3fe9f"
94
+ "gitHead": "7d529ba9a461795d5f1572d3856de33f744287c2"
95
95
  }
@@ -148,6 +148,10 @@ export function getDropTargetPosition(
148
148
  } ) => {
149
149
  const rect = getBoundingClientRect();
150
150
 
151
+ if ( ! rect ) {
152
+ return;
153
+ }
154
+
151
155
  let [ distance, edge ] = getDistanceToNearestEdge(
152
156
  position,
153
157
  rect,
@@ -428,10 +432,14 @@ export default function useBlockDropZone( {
428
432
  return {
429
433
  isUnmodifiedDefaultBlock:
430
434
  getIsUnmodifiedDefaultBlock( block ),
431
- getBoundingClientRect: () =>
432
- ownerDocument
433
- .getElementById( `block-${ clientId }` )
434
- .getBoundingClientRect(),
435
+ getBoundingClientRect: () => {
436
+ const blockElement = ownerDocument.getElementById(
437
+ `block-${ clientId }`
438
+ );
439
+ return blockElement
440
+ ? blockElement.getBoundingClientRect()
441
+ : null;
442
+ },
435
443
  blockIndex: getBlockIndex( clientId ),
436
444
  blockOrientation:
437
445
  getBlockListSettings( clientId )?.orientation,
@@ -155,22 +155,26 @@ export function receiveBlocks( blocks ) {
155
155
  /**
156
156
  * Action that updates attributes of multiple blocks with the specified client IDs.
157
157
  *
158
- * @param {string|string[]} clientIds Block client IDs.
159
- * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
160
- * uniqueByBlock is true.
161
- * @param {boolean} uniqueByBlock true if each block in clientIds array has a unique set of attributes
158
+ * @param {string|string[]} clientIds Block client IDs.
159
+ * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if `options.uniqueByBlock` is true.
160
+ * @param {Object} options Updating options.
161
+ * @param {boolean} [options.uniqueByBlock=false] Whether each block in clientIds array has a unique set of attributes.
162
162
  * @return {Object} Action object.
163
163
  */
164
164
  export function updateBlockAttributes(
165
165
  clientIds,
166
166
  attributes,
167
- uniqueByBlock = false
167
+ options = { uniqueByBlock: false }
168
168
  ) {
169
+ if ( typeof options === 'boolean' ) {
170
+ options = { uniqueByBlock: options };
171
+ }
172
+
169
173
  return {
170
174
  type: 'UPDATE_BLOCK_ATTRIBUTES',
171
175
  clientIds: castArray( clientIds ),
172
176
  attributes,
173
- uniqueByBlock,
177
+ options,
174
178
  };
175
179
  }
176
180
 
@@ -882,7 +882,7 @@ export const blocks = pipe(
882
882
  const newState = new Map( state );
883
883
  for ( const clientId of action.clientIds ) {
884
884
  const updatedAttributeEntries = Object.entries(
885
- action.uniqueByBlock
885
+ !! action.options?.uniqueByBlock
886
886
  ? action.attributes[ clientId ]
887
887
  : action.attributes ?? {}
888
888
  );
@@ -1833,7 +1833,7 @@ export function lastBlockAttributesChange( state = null, action ) {
1833
1833
  return action.clientIds.reduce(
1834
1834
  ( accumulator, id ) => ( {
1835
1835
  ...accumulator,
1836
- [ id ]: action.uniqueByBlock
1836
+ [ id ]: !! action.options?.uniqueByBlock
1837
1837
  ? action.attributes[ id ]
1838
1838
  : action.attributes,
1839
1839
  } ),
@@ -89,7 +89,7 @@ describe( 'actions', () => {
89
89
  type: 'UPDATE_BLOCK_ATTRIBUTES',
90
90
  clientIds: [ clientId ],
91
91
  attributes,
92
- uniqueByBlock: false,
92
+ options: { uniqueByBlock: false },
93
93
  } );
94
94
  } );
95
95
 
@@ -101,7 +101,19 @@ describe( 'actions', () => {
101
101
  type: 'UPDATE_BLOCK_ATTRIBUTES',
102
102
  clientIds,
103
103
  attributes,
104
- uniqueByBlock: false,
104
+ options: { uniqueByBlock: false },
105
+ } );
106
+ } );
107
+
108
+ it( 'should fold boolean uniqueByBlock option into an object', () => {
109
+ const clientId = 'myclientid';
110
+ const attributes = {};
111
+ const result = updateBlockAttributes( clientId, attributes, true );
112
+ expect( result ).toEqual( {
113
+ type: 'UPDATE_BLOCK_ATTRIBUTES',
114
+ clientIds: [ clientId ],
115
+ attributes,
116
+ options: { uniqueByBlock: true },
105
117
  } );
106
118
  } );
107
119
  } );
@@ -1963,7 +1963,7 @@ describe( 'state', () => {
1963
1963
  attributes: {
1964
1964
  kumquat: { updated: true },
1965
1965
  },
1966
- uniqueByBlock: true,
1966
+ options: { uniqueByBlock: true },
1967
1967
  } );
1968
1968
 
1969
1969
  expect( state.attributes.get( 'kumquat' ).updated ).toBe(
@@ -3308,7 +3308,7 @@ describe( 'state', () => {
3308
3308
  attributes: {
3309
3309
  'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1': { food: 'banana' },
3310
3310
  },
3311
- uniqueByBlock: true,
3311
+ options: { uniqueByBlock: true },
3312
3312
  } );
3313
3313
 
3314
3314
  expect( state ).toEqual( {