@wordpress/block-editor 11.3.0 → 11.3.1
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/build/components/block-actions/index.js +7 -2
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/iframe/index.js +5 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +2 -1
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/menu.js +4 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +3 -1
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +16 -4
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/hooks/position.js +5 -2
- package/build/hooks/position.js.map +1 -1
- package/build/store/private-selectors.js +14 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +0 -14
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-actions/index.js +7 -2
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +2 -1
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +4 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +2 -1
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +16 -4
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/hooks/position.js +5 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/store/private-selectors.js +12 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +0 -12
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +30 -30
- package/src/components/block-actions/index.js +9 -0
- package/src/components/iframe/index.js +8 -2
- package/src/components/inserter/block-patterns-tab.js +2 -1
- package/src/components/inserter/menu.js +8 -1
- package/src/components/off-canvas-editor/block-contents.js +2 -1
- package/src/components/off-canvas-editor/index.js +18 -3
- package/src/hooks/position.js +4 -0
- package/src/store/private-selectors.js +10 -0
- package/src/store/selectors.js +0 -10
- package/src/store/test/private-selectors.js +29 -1
- package/src/store/test/selectors.js +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.1",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,34 +33,34 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
35
|
"@react-spring/web": "^9.4.5",
|
|
36
|
-
"@wordpress/a11y": "^3.26.
|
|
37
|
-
"@wordpress/api-fetch": "^6.23.
|
|
38
|
-
"@wordpress/blob": "^3.26.
|
|
39
|
-
"@wordpress/blocks": "^12.3.
|
|
40
|
-
"@wordpress/components": "^23.3.
|
|
41
|
-
"@wordpress/compose": "^6.3.
|
|
42
|
-
"@wordpress/data": "^8.3.
|
|
43
|
-
"@wordpress/date": "^4.26.
|
|
44
|
-
"@wordpress/deprecated": "^3.26.
|
|
45
|
-
"@wordpress/dom": "^3.26.
|
|
46
|
-
"@wordpress/element": "^5.3.
|
|
47
|
-
"@wordpress/escape-html": "^2.26.
|
|
48
|
-
"@wordpress/experiments": "^0.8.
|
|
49
|
-
"@wordpress/hooks": "^3.26.
|
|
50
|
-
"@wordpress/html-entities": "^3.26.
|
|
51
|
-
"@wordpress/i18n": "^4.26.
|
|
52
|
-
"@wordpress/icons": "^9.17.
|
|
53
|
-
"@wordpress/is-shallow-equal": "^4.26.
|
|
54
|
-
"@wordpress/keyboard-shortcuts": "^4.3.
|
|
55
|
-
"@wordpress/keycodes": "^3.26.
|
|
56
|
-
"@wordpress/notices": "^3.26.
|
|
57
|
-
"@wordpress/rich-text": "^6.3.
|
|
58
|
-
"@wordpress/shortcode": "^3.26.
|
|
59
|
-
"@wordpress/style-engine": "^1.9.
|
|
60
|
-
"@wordpress/token-list": "^2.26.
|
|
61
|
-
"@wordpress/url": "^3.27.
|
|
62
|
-
"@wordpress/warning": "^2.26.
|
|
63
|
-
"@wordpress/wordcount": "^3.26.
|
|
36
|
+
"@wordpress/a11y": "^3.26.1",
|
|
37
|
+
"@wordpress/api-fetch": "^6.23.1",
|
|
38
|
+
"@wordpress/blob": "^3.26.1",
|
|
39
|
+
"@wordpress/blocks": "^12.3.1",
|
|
40
|
+
"@wordpress/components": "^23.3.1",
|
|
41
|
+
"@wordpress/compose": "^6.3.1",
|
|
42
|
+
"@wordpress/data": "^8.3.1",
|
|
43
|
+
"@wordpress/date": "^4.26.1",
|
|
44
|
+
"@wordpress/deprecated": "^3.26.1",
|
|
45
|
+
"@wordpress/dom": "^3.26.1",
|
|
46
|
+
"@wordpress/element": "^5.3.1",
|
|
47
|
+
"@wordpress/escape-html": "^2.26.1",
|
|
48
|
+
"@wordpress/experiments": "^0.8.1",
|
|
49
|
+
"@wordpress/hooks": "^3.26.1",
|
|
50
|
+
"@wordpress/html-entities": "^3.26.1",
|
|
51
|
+
"@wordpress/i18n": "^4.26.1",
|
|
52
|
+
"@wordpress/icons": "^9.17.1",
|
|
53
|
+
"@wordpress/is-shallow-equal": "^4.26.1",
|
|
54
|
+
"@wordpress/keyboard-shortcuts": "^4.3.1",
|
|
55
|
+
"@wordpress/keycodes": "^3.26.1",
|
|
56
|
+
"@wordpress/notices": "^3.26.1",
|
|
57
|
+
"@wordpress/rich-text": "^6.3.1",
|
|
58
|
+
"@wordpress/shortcode": "^3.26.1",
|
|
59
|
+
"@wordpress/style-engine": "^1.9.1",
|
|
60
|
+
"@wordpress/token-list": "^2.26.1",
|
|
61
|
+
"@wordpress/url": "^3.27.1",
|
|
62
|
+
"@wordpress/warning": "^2.26.1",
|
|
63
|
+
"@wordpress/wordcount": "^3.26.1",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"classnames": "^2.3.1",
|
|
66
66
|
"colord": "^2.7.0",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "e9ff92d836928aba65dde94d9d193bc401a934d7"
|
|
86
86
|
}
|
|
@@ -58,6 +58,8 @@ export default function BlockActions( {
|
|
|
58
58
|
setBlockMovingClientId,
|
|
59
59
|
setNavigationMode,
|
|
60
60
|
selectBlock,
|
|
61
|
+
clearSelectedBlock,
|
|
62
|
+
multiSelect,
|
|
61
63
|
} = useDispatch( blockEditorStore );
|
|
62
64
|
|
|
63
65
|
const notifyCopy = useNotifyCopy();
|
|
@@ -132,6 +134,13 @@ export default function BlockActions( {
|
|
|
132
134
|
},
|
|
133
135
|
async onPasteStyles() {
|
|
134
136
|
await pasteStyles( blocks );
|
|
137
|
+
|
|
138
|
+
// Need to reselect the block(s) in order for optional tool panel control changes to register.
|
|
139
|
+
clearSelectedBlock();
|
|
140
|
+
multiSelect(
|
|
141
|
+
blocks[ 0 ].clientId,
|
|
142
|
+
blocks[ blocks.length - 1 ].clientId
|
|
143
|
+
);
|
|
135
144
|
},
|
|
136
145
|
} );
|
|
137
146
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useResizeObserver,
|
|
20
20
|
useMergeRefs,
|
|
21
21
|
useRefEffect,
|
|
22
|
+
useDisabled,
|
|
22
23
|
} from '@wordpress/compose';
|
|
23
24
|
import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';
|
|
24
25
|
import { useSelect } from '@wordpress/data';
|
|
@@ -207,7 +208,13 @@ function Iframe( {
|
|
|
207
208
|
forceRender();
|
|
208
209
|
} );
|
|
209
210
|
}, [] );
|
|
210
|
-
const
|
|
211
|
+
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
212
|
+
const bodyRef = useMergeRefs( [
|
|
213
|
+
contentRef,
|
|
214
|
+
clearerRef,
|
|
215
|
+
writingFlowRef,
|
|
216
|
+
disabledRef,
|
|
217
|
+
] );
|
|
211
218
|
|
|
212
219
|
const styleAssets = (
|
|
213
220
|
<>
|
|
@@ -284,7 +291,6 @@ function Iframe( {
|
|
|
284
291
|
marginTop: frameSize,
|
|
285
292
|
transform: `scale( ${ scale } )`,
|
|
286
293
|
} }
|
|
287
|
-
inert={ readonly ? 'true' : undefined }
|
|
288
294
|
>
|
|
289
295
|
{ contentResizeListener }
|
|
290
296
|
<StyleProvider document={ iframeDocument }>
|
|
@@ -195,6 +195,7 @@ function BlockPatternsTabs( {
|
|
|
195
195
|
} ) {
|
|
196
196
|
const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );
|
|
197
197
|
const categories = usePatternsCategories( rootClientId );
|
|
198
|
+
const initialCategory = selectedCategory || categories[ 0 ];
|
|
198
199
|
const isMobile = useViewportMatch( 'medium', '<' );
|
|
199
200
|
return (
|
|
200
201
|
<>
|
|
@@ -261,7 +262,7 @@ function BlockPatternsTabs( {
|
|
|
261
262
|
) }
|
|
262
263
|
{ showPatternsExplorer && (
|
|
263
264
|
<PatternsExplorerModal
|
|
264
|
-
initialCategory={
|
|
265
|
+
initialCategory={ initialCategory }
|
|
265
266
|
patternCategories={ categories }
|
|
266
267
|
onModalClose={ () => setShowPatternsExplorer( false ) }
|
|
267
268
|
/>
|
|
@@ -113,6 +113,13 @@ function InserterMenu(
|
|
|
113
113
|
[ onToggleInsertionPoint, setHoveredItem ]
|
|
114
114
|
);
|
|
115
115
|
|
|
116
|
+
const onHoverPattern = useCallback(
|
|
117
|
+
( item ) => {
|
|
118
|
+
onToggleInsertionPoint( !! item );
|
|
119
|
+
},
|
|
120
|
+
[ onToggleInsertionPoint ]
|
|
121
|
+
);
|
|
122
|
+
|
|
116
123
|
const onClickPatternCategory = useCallback(
|
|
117
124
|
( patternCategory ) => {
|
|
118
125
|
setSelectedPatternCategory( patternCategory );
|
|
@@ -296,7 +303,7 @@ function InserterMenu(
|
|
|
296
303
|
<BlockPatternsCategoryDialog
|
|
297
304
|
rootClientId={ destinationRootClientId }
|
|
298
305
|
onInsert={ onInsertPattern }
|
|
299
|
-
onHover={
|
|
306
|
+
onHover={ onHoverPattern }
|
|
300
307
|
category={ selectedPatternCategory }
|
|
301
308
|
showTitlesAsTooltip
|
|
302
309
|
/>
|
|
@@ -12,6 +12,7 @@ import { forwardRef, useEffect, useState } from '@wordpress/element';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
+
import { unlock } from '../../experiments';
|
|
15
16
|
import ListViewBlockSelectButton from './block-select-button';
|
|
16
17
|
import BlockDraggable from '../block-draggable';
|
|
17
18
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -52,7 +53,7 @@ const ListViewBlockContents = forwardRef(
|
|
|
52
53
|
hasBlockMovingClientId,
|
|
53
54
|
getSelectedBlockClientId,
|
|
54
55
|
getLastInsertedBlocksClientIds,
|
|
55
|
-
} = select( blockEditorStore );
|
|
56
|
+
} = unlock( select( blockEditorStore ) );
|
|
56
57
|
const lastInsertedBlocksClientIds =
|
|
57
58
|
getLastInsertedBlocksClientIds();
|
|
58
59
|
return {
|
|
@@ -60,12 +60,23 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
|
|
|
60
60
|
* @param {boolean} props.showBlockMovers Flag to enable block movers
|
|
61
61
|
* @param {boolean} props.isExpanded Flag to determine whether nested levels are expanded by default.
|
|
62
62
|
* @param {Object} props.LeafMoreMenu Optional more menu substitution.
|
|
63
|
+
* @param {string} props.description Optional accessible description for the tree grid component.
|
|
64
|
+
* @param {string} props.onSelect Optional callback to be invoked when a block is selected.
|
|
63
65
|
* @param {Object} ref Forwarded ref
|
|
64
66
|
*/
|
|
65
67
|
function OffCanvasEditor(
|
|
66
|
-
{
|
|
68
|
+
{
|
|
69
|
+
id,
|
|
70
|
+
blocks,
|
|
71
|
+
showBlockMovers = false,
|
|
72
|
+
isExpanded = false,
|
|
73
|
+
LeafMoreMenu,
|
|
74
|
+
description = __( 'Block navigation structure' ),
|
|
75
|
+
onSelect,
|
|
76
|
+
},
|
|
67
77
|
ref
|
|
68
78
|
) {
|
|
79
|
+
const { getBlock } = useSelect( blockEditorStore );
|
|
69
80
|
const { clientIdsTree, draggedClientIds, selectedClientIds } =
|
|
70
81
|
useListViewClientIds( blocks );
|
|
71
82
|
|
|
@@ -105,8 +116,11 @@ function OffCanvasEditor(
|
|
|
105
116
|
( event, blockClientId ) => {
|
|
106
117
|
updateBlockSelection( event, blockClientId );
|
|
107
118
|
setSelectedTreeId( blockClientId );
|
|
119
|
+
if ( onSelect ) {
|
|
120
|
+
onSelect( getBlock( blockClientId ) );
|
|
121
|
+
}
|
|
108
122
|
},
|
|
109
|
-
[ setSelectedTreeId, updateBlockSelection ]
|
|
123
|
+
[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]
|
|
110
124
|
);
|
|
111
125
|
useEffect( () => {
|
|
112
126
|
isMounted.current = true;
|
|
@@ -208,7 +222,8 @@ function OffCanvasEditor(
|
|
|
208
222
|
onCollapseRow={ collapseRow }
|
|
209
223
|
onExpandRow={ expandRow }
|
|
210
224
|
onFocusRow={ focusRow }
|
|
211
|
-
|
|
225
|
+
// eslint-disable-next-line jsx-a11y/aria-props
|
|
226
|
+
aria-description={ description }
|
|
212
227
|
>
|
|
213
228
|
<ListViewContext.Provider value={ contextValue }>
|
|
214
229
|
<ListViewBranch
|
package/src/hooks/position.js
CHANGED
|
@@ -365,6 +365,10 @@ export const withPositionStyles = createHigherOrderComponent(
|
|
|
365
365
|
// Attach a `wp-container-` id-based class name.
|
|
366
366
|
const className = classnames( props?.className, {
|
|
367
367
|
[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.
|
|
368
|
+
[ `is-position-${ attributes?.style?.position?.type }` ]:
|
|
369
|
+
allowPositionStyles &&
|
|
370
|
+
!! css &&
|
|
371
|
+
!! attributes?.style?.position?.type,
|
|
368
372
|
} );
|
|
369
373
|
|
|
370
374
|
return (
|
|
@@ -8,3 +8,13 @@
|
|
|
8
8
|
export function isBlockInterfaceHidden( state ) {
|
|
9
9
|
return state.isBlockInterfaceHidden;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gets the client ids of the last inserted blocks.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} state Global application state.
|
|
16
|
+
* @return {Array|undefined} Client Ids of the last inserted block(s).
|
|
17
|
+
*/
|
|
18
|
+
export function getLastInsertedBlocksClientIds( state ) {
|
|
19
|
+
return state?.lastBlockInserted?.clientIds;
|
|
20
|
+
}
|
package/src/store/selectors.js
CHANGED
|
@@ -2703,16 +2703,6 @@ export function wasBlockJustInserted( state, clientId, source ) {
|
|
|
2703
2703
|
);
|
|
2704
2704
|
}
|
|
2705
2705
|
|
|
2706
|
-
/**
|
|
2707
|
-
* Gets the client ids of the last inserted blocks.
|
|
2708
|
-
*
|
|
2709
|
-
* @param {Object} state Global application state.
|
|
2710
|
-
* @return {Array|undefined} Client Ids of the last inserted block(s).
|
|
2711
|
-
*/
|
|
2712
|
-
export function getLastInsertedBlocksClientIds( state ) {
|
|
2713
|
-
return state?.lastBlockInserted?.clientIds;
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
2706
|
/**
|
|
2717
2707
|
* Tells if the block is visible on the canvas or not.
|
|
2718
2708
|
*
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isBlockInterfaceHidden,
|
|
6
|
+
getLastInsertedBlocksClientIds,
|
|
7
|
+
} from '../private-selectors';
|
|
5
8
|
|
|
6
9
|
describe( 'private selectors', () => {
|
|
7
10
|
describe( 'isBlockInterfaceHidden', () => {
|
|
@@ -21,4 +24,29 @@ describe( 'private selectors', () => {
|
|
|
21
24
|
expect( isBlockInterfaceHidden( state ) ).toBe( false );
|
|
22
25
|
} );
|
|
23
26
|
} );
|
|
27
|
+
|
|
28
|
+
describe( 'getLastInsertedBlocksClientIds', () => {
|
|
29
|
+
it( 'should return undefined if no blocks have been inserted', () => {
|
|
30
|
+
const state = {
|
|
31
|
+
lastBlockInserted: {},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
expect( getLastInsertedBlocksClientIds( state ) ).toEqual(
|
|
35
|
+
undefined
|
|
36
|
+
);
|
|
37
|
+
} );
|
|
38
|
+
|
|
39
|
+
it( 'should return clientIds if blocks have been inserted', () => {
|
|
40
|
+
const state = {
|
|
41
|
+
lastBlockInserted: {
|
|
42
|
+
clientIds: [ '123456', '78910' ],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
expect( getLastInsertedBlocksClientIds( state ) ).toEqual( [
|
|
47
|
+
'123456',
|
|
48
|
+
'78910',
|
|
49
|
+
] );
|
|
50
|
+
} );
|
|
51
|
+
} );
|
|
24
52
|
} );
|
|
@@ -72,7 +72,6 @@ const {
|
|
|
72
72
|
__experimentalGetPatternTransformItems,
|
|
73
73
|
wasBlockJustInserted,
|
|
74
74
|
__experimentalGetGlobalBlocksByName,
|
|
75
|
-
getLastInsertedBlocksClientIds,
|
|
76
75
|
} = selectors;
|
|
77
76
|
|
|
78
77
|
describe( 'selectors', () => {
|
|
@@ -4688,26 +4687,3 @@ describe( '__unstableGetClientIdsTree', () => {
|
|
|
4688
4687
|
] );
|
|
4689
4688
|
} );
|
|
4690
4689
|
} );
|
|
4691
|
-
|
|
4692
|
-
describe( 'getLastInsertedBlocksClientIds', () => {
|
|
4693
|
-
it( 'should return undefined if no blocks have been inserted', () => {
|
|
4694
|
-
const state = {
|
|
4695
|
-
lastBlockInserted: {},
|
|
4696
|
-
};
|
|
4697
|
-
|
|
4698
|
-
expect( getLastInsertedBlocksClientIds( state ) ).toEqual( undefined );
|
|
4699
|
-
} );
|
|
4700
|
-
|
|
4701
|
-
it( 'should return clientIds if blocks have been inserted', () => {
|
|
4702
|
-
const state = {
|
|
4703
|
-
lastBlockInserted: {
|
|
4704
|
-
clientIds: [ '123456', '78910' ],
|
|
4705
|
-
},
|
|
4706
|
-
};
|
|
4707
|
-
|
|
4708
|
-
expect( getLastInsertedBlocksClientIds( state ) ).toEqual( [
|
|
4709
|
-
'123456',
|
|
4710
|
-
'78910',
|
|
4711
|
-
] );
|
|
4712
|
-
} );
|
|
4713
|
-
} );
|