@wordpress/block-editor 14.21.1-next.719a03cbe.0 → 15.0.1-next.46f643fa0.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/CHANGELOG.md +6 -0
- package/build/components/block-list/use-block-props/index.js +1 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +8 -25
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +0 -1
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-toolbar/index.js +6 -3
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +53 -34
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/iframe/index.js +20 -15
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +49 -30
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter-button/index.native.js +54 -64
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -2
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +7 -5
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-list-view-images.js +62 -30
- package/build/components/list-view/use-list-view-images.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +2 -1
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +3 -1
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +2 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +12 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/reducer.js +0 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +2 -1
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +8 -26
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +0 -1
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -3
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +54 -35
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +20 -15
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +50 -30
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +55 -65
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +8 -6
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-list-view-images.js +62 -30
- package/build-module/components/list-view/use-list-view-images.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +2 -1
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +3 -1
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +3 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +12 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/reducer.js +0 -17
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +2 -1
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/style-rtl.css +50 -26
- package/build-style/style.css +50 -26
- package/package.json +34 -34
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +12 -26
- package/src/components/block-list/zoom-out-separator.js +0 -1
- package/src/components/block-lock/style.scss +10 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-toolbar/index.js +8 -2
- package/src/components/block-variation-transforms/style.scss +7 -0
- package/src/components/border-radius-control/style.scss +5 -0
- package/src/components/child-layout-control/index.js +66 -42
- package/src/components/colors-gradients/style.scss +5 -0
- package/src/components/grid/style.scss +3 -2
- package/src/components/iframe/index.js +25 -16
- package/src/components/image-editor/use-save-image.js +58 -31
- package/src/components/inserter/style.scss +1 -1
- package/src/components/inserter-button/index.native.js +69 -80
- package/src/components/inserter-list-item/style.scss +9 -6
- package/src/components/link-control/search-input.js +9 -2
- package/src/components/link-control/style.scss +7 -0
- package/src/components/link-control/test/index.js +44 -44
- package/src/components/list-view/block.js +10 -5
- package/src/components/list-view/style.scss +2 -20
- package/src/components/list-view/use-list-view-images.js +57 -36
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/publish-date-time-picker/README.md +9 -0
- package/src/components/publish-date-time-picker/index.js +2 -1
- package/src/components/spacing-sizes-control/style.scss +5 -0
- package/src/components/writing-flow/use-click-selection.js +3 -1
- package/src/hooks/layout.scss +8 -0
- package/src/layouts/grid.js +2 -2
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +15 -7
- package/src/store/private-keys.js +1 -0
- package/src/store/reducer.js +0 -18
- package/src/store/selectors.js +29 -31
- package/src/store/test/actions.js +15 -2
- package/src/utils/block-bindings.js +1 -0
package/src/private-apis.js
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
globalStylesDataKey,
|
|
40
40
|
globalStylesLinksDataKey,
|
|
41
41
|
sectionRootClientIdKey,
|
|
42
|
+
mediaEditKey,
|
|
42
43
|
} from './store/private-keys';
|
|
43
44
|
import { requiresWrapperOnCopy } from './components/writing-flow/utils';
|
|
44
45
|
import { PrivateRichText } from './components/rich-text/';
|
|
@@ -99,4 +100,5 @@ lock( privateApis, {
|
|
|
99
100
|
sectionRootClientIdKey,
|
|
100
101
|
CommentIconSlotFill,
|
|
101
102
|
CommentIconToolbarSlotFill,
|
|
103
|
+
mediaEditKey,
|
|
102
104
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -216,14 +216,15 @@ export function selectBlock( clientId, initialPosition = 0 ) {
|
|
|
216
216
|
* Returns an action object used in signalling that the block with the
|
|
217
217
|
* specified client ID has been hovered.
|
|
218
218
|
*
|
|
219
|
-
* @
|
|
220
|
-
*
|
|
221
|
-
* @return {Object} Action object.
|
|
219
|
+
* @deprecated
|
|
222
220
|
*/
|
|
223
|
-
export function hoverBlock(
|
|
221
|
+
export function hoverBlock() {
|
|
222
|
+
deprecated( 'wp.data.dispatch( "core/block-editor" ).hoverBlock', {
|
|
223
|
+
since: '6.9',
|
|
224
|
+
version: '7.1',
|
|
225
|
+
} );
|
|
224
226
|
return {
|
|
225
|
-
type: '
|
|
226
|
-
clientId,
|
|
227
|
+
type: 'DO_NOTHING',
|
|
227
228
|
};
|
|
228
229
|
}
|
|
229
230
|
|
|
@@ -1254,7 +1255,14 @@ export const mergeBlocks =
|
|
|
1254
1255
|
}
|
|
1255
1256
|
|
|
1256
1257
|
if ( ! blockAType.merge ) {
|
|
1257
|
-
|
|
1258
|
+
if ( isUnmodifiedBlock( blockB, 'content' ) ) {
|
|
1259
|
+
dispatch.removeBlock(
|
|
1260
|
+
clientIdB,
|
|
1261
|
+
select.isBlockSelected( clientIdB )
|
|
1262
|
+
);
|
|
1263
|
+
} else {
|
|
1264
|
+
dispatch.selectBlock( blockA.clientId );
|
|
1265
|
+
}
|
|
1258
1266
|
return;
|
|
1259
1267
|
}
|
|
1260
1268
|
|
|
@@ -3,3 +3,4 @@ export const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );
|
|
|
3
3
|
export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );
|
|
4
4
|
export const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );
|
|
5
5
|
export const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );
|
|
6
|
+
export const mediaEditKey = Symbol( 'mediaEditKey' );
|
package/src/store/reducer.js
CHANGED
|
@@ -2055,23 +2055,6 @@ export function lastFocus( state = false, action ) {
|
|
|
2055
2055
|
return state;
|
|
2056
2056
|
}
|
|
2057
2057
|
|
|
2058
|
-
/**
|
|
2059
|
-
* Reducer setting currently hovered block.
|
|
2060
|
-
*
|
|
2061
|
-
* @param {boolean} state Current state.
|
|
2062
|
-
* @param {Object} action Dispatched action.
|
|
2063
|
-
*
|
|
2064
|
-
* @return {boolean} Updated state.
|
|
2065
|
-
*/
|
|
2066
|
-
export function hoveredBlockClientId( state = false, action ) {
|
|
2067
|
-
switch ( action.type ) {
|
|
2068
|
-
case 'HOVER_BLOCK':
|
|
2069
|
-
return action.clientId;
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
return state;
|
|
2073
|
-
}
|
|
2074
|
-
|
|
2075
2058
|
/**
|
|
2076
2059
|
* Reducer setting zoom out state.
|
|
2077
2060
|
*
|
|
@@ -2141,7 +2124,6 @@ const combinedReducers = combineReducers( {
|
|
|
2141
2124
|
blockRemovalRules,
|
|
2142
2125
|
openedBlockSettingsMenu,
|
|
2143
2126
|
registeredInserterMediaCategories,
|
|
2144
|
-
hoveredBlockClientId,
|
|
2145
2127
|
zoomLevel,
|
|
2146
2128
|
} );
|
|
2147
2129
|
|
package/src/store/selectors.js
CHANGED
|
@@ -2318,26 +2318,21 @@ export const getBlockTransformItems = createRegistrySelector( ( select ) =>
|
|
|
2318
2318
|
*
|
|
2319
2319
|
* @return {boolean} Items that appear in inserter.
|
|
2320
2320
|
*/
|
|
2321
|
-
export const hasInserterItems =
|
|
2322
|
-
(
|
|
2323
|
-
( state, rootClientId
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
'core/block',
|
|
2334
|
-
rootClientId
|
|
2335
|
-
) &&
|
|
2336
|
-
unlock( select( STORE_NAME ) ).getReusableBlocks().length > 0;
|
|
2321
|
+
export const hasInserterItems = ( state, rootClientId = null ) => {
|
|
2322
|
+
const hasBlockType = getBlockTypes().some( ( blockType ) =>
|
|
2323
|
+
canIncludeBlockTypeInInserter( state, blockType, rootClientId )
|
|
2324
|
+
);
|
|
2325
|
+
if ( hasBlockType ) {
|
|
2326
|
+
return true;
|
|
2327
|
+
}
|
|
2328
|
+
const hasReusableBlock = canInsertBlockTypeUnmemoized(
|
|
2329
|
+
state,
|
|
2330
|
+
'core/block',
|
|
2331
|
+
rootClientId
|
|
2332
|
+
);
|
|
2337
2333
|
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
);
|
|
2334
|
+
return hasReusableBlock;
|
|
2335
|
+
};
|
|
2341
2336
|
|
|
2342
2337
|
/**
|
|
2343
2338
|
* Returns the list of allowed inserter blocks for inner blocks children.
|
|
@@ -2358,13 +2353,11 @@ export const getAllowedBlocks = createRegistrySelector( ( select ) =>
|
|
|
2358
2353
|
canIncludeBlockTypeInInserter( state, blockType, rootClientId )
|
|
2359
2354
|
);
|
|
2360
2355
|
|
|
2361
|
-
const hasReusableBlock =
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
) &&
|
|
2367
|
-
unlock( select( STORE_NAME ) ).getReusableBlocks().length > 0;
|
|
2356
|
+
const hasReusableBlock = canInsertBlockTypeUnmemoized(
|
|
2357
|
+
state,
|
|
2358
|
+
'core/block',
|
|
2359
|
+
rootClientId
|
|
2360
|
+
);
|
|
2368
2361
|
|
|
2369
2362
|
if ( hasReusableBlock ) {
|
|
2370
2363
|
blockTypes.push( 'core/block' );
|
|
@@ -2374,7 +2367,6 @@ export const getAllowedBlocks = createRegistrySelector( ( select ) =>
|
|
|
2374
2367
|
},
|
|
2375
2368
|
( state, rootClientId ) => [
|
|
2376
2369
|
getBlockTypes(),
|
|
2377
|
-
unlock( select( STORE_NAME ) ).getReusableBlocks(),
|
|
2378
2370
|
...getInsertBlockTypeDependants( select )( state, rootClientId ),
|
|
2379
2371
|
]
|
|
2380
2372
|
)
|
|
@@ -2920,11 +2912,17 @@ export function isBlockVisible( state, clientId ) {
|
|
|
2920
2912
|
/**
|
|
2921
2913
|
* Returns the currently hovered block.
|
|
2922
2914
|
*
|
|
2923
|
-
* @
|
|
2924
|
-
* @return {Object} Client Id of the hovered block.
|
|
2915
|
+
* @deprecated
|
|
2925
2916
|
*/
|
|
2926
|
-
export function getHoveredBlockClientId(
|
|
2927
|
-
|
|
2917
|
+
export function getHoveredBlockClientId() {
|
|
2918
|
+
deprecated(
|
|
2919
|
+
"wp.data.select( 'core/block-editor' ).getHoveredBlockClientId",
|
|
2920
|
+
{
|
|
2921
|
+
since: '6.9',
|
|
2922
|
+
version: '7.1',
|
|
2923
|
+
}
|
|
2924
|
+
);
|
|
2925
|
+
return undefined;
|
|
2928
2926
|
}
|
|
2929
2927
|
|
|
2930
2928
|
/**
|
|
@@ -808,8 +808,16 @@ describe( 'actions', () => {
|
|
|
808
808
|
} );
|
|
809
809
|
} );
|
|
810
810
|
|
|
811
|
-
it( 'should only focus the blockA if the blockA has no merge function', () => {
|
|
812
|
-
registerBlockType( 'core/test-block',
|
|
811
|
+
it( 'should only focus the blockA if the blockA has no merge function and the content of blockB is modified', () => {
|
|
812
|
+
registerBlockType( 'core/test-block', {
|
|
813
|
+
...defaultBlockSettings,
|
|
814
|
+
attributes: {
|
|
815
|
+
content: {
|
|
816
|
+
type: 'string',
|
|
817
|
+
role: 'content',
|
|
818
|
+
},
|
|
819
|
+
},
|
|
820
|
+
} );
|
|
813
821
|
const blockA = deepFreeze( {
|
|
814
822
|
clientId: 'chicken',
|
|
815
823
|
name: 'core/test-block',
|
|
@@ -817,15 +825,20 @@ describe( 'actions', () => {
|
|
|
817
825
|
const blockB = deepFreeze( {
|
|
818
826
|
clientId: 'ribs',
|
|
819
827
|
name: 'core/test-block',
|
|
828
|
+
attributes: {
|
|
829
|
+
content: 'Updated content',
|
|
830
|
+
},
|
|
820
831
|
} );
|
|
821
832
|
|
|
822
833
|
const select = {
|
|
823
834
|
getBlock: ( clientId ) =>
|
|
824
835
|
[ blockA, blockB ].find( ( b ) => b.clientId === clientId ),
|
|
825
836
|
getBlockEditingMode: () => 'default',
|
|
837
|
+
isBlockSelected: () => false,
|
|
826
838
|
};
|
|
827
839
|
const dispatch = Object.assign( jest.fn(), {
|
|
828
840
|
selectBlock: jest.fn(),
|
|
841
|
+
removeBlock: jest.fn(),
|
|
829
842
|
} );
|
|
830
843
|
|
|
831
844
|
mergeBlocks(
|