@wordpress/block-editor 11.3.0 → 11.3.2
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/block-inspector/index.js +1 -2
- package/build/components/block-inspector/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 +15 -4
- 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/inspector-controls-tabs/settings-tab-hint.js +62 -0
- package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.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/components/provider/use-block-sync.js +4 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/hooks/position.js +5 -2
- package/build/hooks/position.js.map +1 -1
- package/build/store/defaults.js +12 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.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/block-inspector/index.js +1 -2
- package/build-module/components/block-inspector/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 +15 -5
- 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/inspector-controls-tabs/settings-tab-hint.js +48 -0
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +2 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.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/components/provider/use-block-sync.js +4 -1
- package/build-module/components/provider/use-block-sync.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/defaults.js +12 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.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/build-style/style-rtl.css +18 -0
- package/build-style/style.css +18 -0
- package/package.json +31 -30
- package/src/components/block-actions/index.js +9 -0
- package/src/components/block-inspector/index.js +1 -1
- package/src/components/iframe/index.js +8 -2
- package/src/components/inserter/block-patterns-tab.js +30 -6
- package/src/components/inserter/menu.js +8 -1
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +52 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +2 -0
- package/src/components/inspector-controls-tabs/style.scss +20 -0
- package/src/components/off-canvas-editor/block-contents.js +2 -1
- package/src/components/off-canvas-editor/index.js +18 -3
- package/src/components/provider/use-block-sync.js +4 -1
- package/src/hooks/position.js +4 -0
- package/src/store/defaults.js +7 -0
- package/src/store/private-actions.js +4 -1
- 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
|
@@ -1591,6 +1591,24 @@
|
|
|
1591
1591
|
content: attr(aria-label);
|
|
1592
1592
|
}
|
|
1593
1593
|
|
|
1594
|
+
.block-editor-inspector-controls-tabs__hint {
|
|
1595
|
+
align-items: top;
|
|
1596
|
+
background: #f0f0f0;
|
|
1597
|
+
border-radius: 2px;
|
|
1598
|
+
color: #1e1e1e;
|
|
1599
|
+
display: flex;
|
|
1600
|
+
flex-direction: row;
|
|
1601
|
+
margin: 16px;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.block-editor-inspector-controls-tabs__hint-content {
|
|
1605
|
+
margin: 12px 12px 12px 0;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.block-editor-inspector-controls-tabs__hint-dismiss {
|
|
1609
|
+
margin: 4px 0 4px 4px;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1594
1612
|
.block-editor-inspector-popover-header {
|
|
1595
1613
|
margin-bottom: 16px;
|
|
1596
1614
|
}
|
package/build-style/style.css
CHANGED
|
@@ -1591,6 +1591,24 @@
|
|
|
1591
1591
|
content: attr(aria-label);
|
|
1592
1592
|
}
|
|
1593
1593
|
|
|
1594
|
+
.block-editor-inspector-controls-tabs__hint {
|
|
1595
|
+
align-items: top;
|
|
1596
|
+
background: #f0f0f0;
|
|
1597
|
+
border-radius: 2px;
|
|
1598
|
+
color: #1e1e1e;
|
|
1599
|
+
display: flex;
|
|
1600
|
+
flex-direction: row;
|
|
1601
|
+
margin: 16px;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.block-editor-inspector-controls-tabs__hint-content {
|
|
1605
|
+
margin: 12px 0 12px 12px;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.block-editor-inspector-controls-tabs__hint-dismiss {
|
|
1609
|
+
margin: 4px 4px 4px 0;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1594
1612
|
.block-editor-inspector-popover-header {
|
|
1595
1613
|
margin-bottom: 16px;
|
|
1596
1614
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.2",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,34 +33,35 @@
|
|
|
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/
|
|
58
|
-
"@wordpress/
|
|
59
|
-
"@wordpress/
|
|
60
|
-
"@wordpress/
|
|
61
|
-
"@wordpress/
|
|
62
|
-
"@wordpress/
|
|
63
|
-
"@wordpress/
|
|
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/preferences": "^3.3.1",
|
|
58
|
+
"@wordpress/rich-text": "^6.3.1",
|
|
59
|
+
"@wordpress/shortcode": "^3.26.1",
|
|
60
|
+
"@wordpress/style-engine": "^1.9.1",
|
|
61
|
+
"@wordpress/token-list": "^2.26.1",
|
|
62
|
+
"@wordpress/url": "^3.27.1",
|
|
63
|
+
"@wordpress/warning": "^2.26.1",
|
|
64
|
+
"@wordpress/wordcount": "^3.26.1",
|
|
64
65
|
"change-case": "^4.1.2",
|
|
65
66
|
"classnames": "^2.3.1",
|
|
66
67
|
"colord": "^2.7.0",
|
|
@@ -82,5 +83,5 @@
|
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public"
|
|
84
85
|
},
|
|
85
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "3eb2c536278d5a17f698b9c378fe3db746a89622"
|
|
86
87
|
}
|
|
@@ -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
|
}
|
|
@@ -178,7 +178,7 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
178
178
|
if ( blockType ) {
|
|
179
179
|
const globalBlockInspectorAnimationSettings =
|
|
180
180
|
select( blockEditorStore ).getSettings()
|
|
181
|
-
.
|
|
181
|
+
.blockInspectorAnimation;
|
|
182
182
|
return globalBlockInspectorAnimationSettings?.[
|
|
183
183
|
blockType.name
|
|
184
184
|
];
|
|
@@ -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 }>
|
|
@@ -28,6 +28,19 @@ import BlockPatternList from '../block-patterns-list';
|
|
|
28
28
|
import PatternsExplorerModal from './block-patterns-explorer/explorer';
|
|
29
29
|
import MobileTabNavigation from './mobile-tab-navigation';
|
|
30
30
|
|
|
31
|
+
// Preffered order of pattern categories. Any other categories should
|
|
32
|
+
// be at the bottom without any re-ordering.
|
|
33
|
+
const patternCategoriesOrder = [
|
|
34
|
+
'featured',
|
|
35
|
+
'posts',
|
|
36
|
+
'text',
|
|
37
|
+
'gallery',
|
|
38
|
+
'call-to-action',
|
|
39
|
+
'banner',
|
|
40
|
+
'header',
|
|
41
|
+
'footer',
|
|
42
|
+
];
|
|
43
|
+
|
|
31
44
|
function usePatternsCategories( rootClientId ) {
|
|
32
45
|
const [ allPatterns, allCategories ] = usePatternsState(
|
|
33
46
|
undefined,
|
|
@@ -56,17 +69,27 @@ function usePatternsCategories( rootClientId ) {
|
|
|
56
69
|
)
|
|
57
70
|
)
|
|
58
71
|
.sort( ( { name: currentName }, { name: nextName } ) => {
|
|
72
|
+
// The pattern categories should be ordered as follows:
|
|
73
|
+
// 1. The categories from `patternCategoriesOrder` in that specific order should be at the top.
|
|
74
|
+
// 2. The rest categories should be at the bottom without any re-ordering.
|
|
59
75
|
if (
|
|
60
76
|
! [ currentName, nextName ].some( ( categoryName ) =>
|
|
61
|
-
|
|
77
|
+
patternCategoriesOrder.includes( categoryName )
|
|
62
78
|
)
|
|
63
79
|
) {
|
|
64
80
|
return 0;
|
|
65
81
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
if (
|
|
83
|
+
[ currentName, nextName ].every( ( categoryName ) =>
|
|
84
|
+
patternCategoriesOrder.includes( categoryName )
|
|
85
|
+
)
|
|
86
|
+
) {
|
|
87
|
+
return (
|
|
88
|
+
patternCategoriesOrder.indexOf( currentName ) -
|
|
89
|
+
patternCategoriesOrder.indexOf( nextName )
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return patternCategoriesOrder.includes( currentName ) ? -1 : 1;
|
|
70
93
|
} );
|
|
71
94
|
|
|
72
95
|
if (
|
|
@@ -195,6 +218,7 @@ function BlockPatternsTabs( {
|
|
|
195
218
|
} ) {
|
|
196
219
|
const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );
|
|
197
220
|
const categories = usePatternsCategories( rootClientId );
|
|
221
|
+
const initialCategory = selectedCategory || categories[ 0 ];
|
|
198
222
|
const isMobile = useViewportMatch( 'medium', '<' );
|
|
199
223
|
return (
|
|
200
224
|
<>
|
|
@@ -261,7 +285,7 @@ function BlockPatternsTabs( {
|
|
|
261
285
|
) }
|
|
262
286
|
{ showPatternsExplorer && (
|
|
263
287
|
<PatternsExplorerModal
|
|
264
|
-
initialCategory={
|
|
288
|
+
initialCategory={ initialCategory }
|
|
265
289
|
patternCategories={ categories }
|
|
266
290
|
onModalClose={ () => setShowPatternsExplorer( false ) }
|
|
267
291
|
/>
|
|
@@ -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
|
/>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Button } from '@wordpress/components';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { focus } from '@wordpress/dom';
|
|
7
|
+
import { useRef } from '@wordpress/element';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { close } from '@wordpress/icons';
|
|
10
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
|
+
|
|
12
|
+
const PREFERENCE_NAME = 'isInspectorControlsTabsHintVisible';
|
|
13
|
+
|
|
14
|
+
export default function InspectorControlsTabsHint() {
|
|
15
|
+
const isInspectorControlsTabsHintVisible = useSelect(
|
|
16
|
+
( select ) =>
|
|
17
|
+
select( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,
|
|
18
|
+
[]
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const ref = useRef();
|
|
22
|
+
|
|
23
|
+
const { set: setPreference } = useDispatch( preferencesStore );
|
|
24
|
+
if ( ! isInspectorControlsTabsHintVisible ) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div ref={ ref } className="block-editor-inspector-controls-tabs__hint">
|
|
30
|
+
<div className="block-editor-inspector-controls-tabs__hint-content">
|
|
31
|
+
{ __(
|
|
32
|
+
"Looking for other block settings? They've moved to the styles tab."
|
|
33
|
+
) }
|
|
34
|
+
</div>
|
|
35
|
+
<Button
|
|
36
|
+
className="block-editor-inspector-controls-tabs__hint-dismiss"
|
|
37
|
+
icon={ close }
|
|
38
|
+
iconSize="16"
|
|
39
|
+
label={ __( 'Dismiss hint' ) }
|
|
40
|
+
onClick={ () => {
|
|
41
|
+
// Retain focus when dismissing the element.
|
|
42
|
+
const previousElement = focus.tabbable.findPrevious(
|
|
43
|
+
ref.current
|
|
44
|
+
);
|
|
45
|
+
previousElement?.focus();
|
|
46
|
+
setPreference( 'core', PREFERENCE_NAME, false );
|
|
47
|
+
} }
|
|
48
|
+
showTooltip={ false }
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import AdvancedControls from './advanced-controls-panel';
|
|
5
5
|
import PositionControls from './position-controls-panel';
|
|
6
6
|
import { default as InspectorControls } from '../inspector-controls';
|
|
7
|
+
import SettingsTabHint from './settings-tab-hint';
|
|
7
8
|
|
|
8
9
|
const SettingsTab = ( { showAdvancedControls = false } ) => (
|
|
9
10
|
<>
|
|
@@ -14,6 +15,7 @@ const SettingsTab = ( { showAdvancedControls = false } ) => (
|
|
|
14
15
|
<AdvancedControls />
|
|
15
16
|
</div>
|
|
16
17
|
) }
|
|
18
|
+
<SettingsTabHint />
|
|
17
19
|
</>
|
|
18
20
|
);
|
|
19
21
|
|
|
@@ -13,3 +13,23 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
.block-editor-inspector-controls-tabs__hint {
|
|
18
|
+
align-items: top;
|
|
19
|
+
background: $gray-100;
|
|
20
|
+
border-radius: $radius-block-ui;
|
|
21
|
+
color: $gray-900;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
margin: $grid-unit-20;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.block-editor-inspector-controls-tabs__hint-content {
|
|
28
|
+
margin: $grid-unit-15 0 $grid-unit-15 $grid-unit-15;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.block-editor-inspector-controls-tabs__hint-dismiss {
|
|
32
|
+
// The dismiss button has a lot of empty space through its padding.
|
|
33
|
+
// Apply margin to visually align the icon with the top of the text to its left.
|
|
34
|
+
margin: $grid-unit-05 $grid-unit-05 $grid-unit-05 0;
|
|
35
|
+
}
|
|
@@ -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
|
|
@@ -265,6 +265,9 @@ export default function useBlockSync( {
|
|
|
265
265
|
previousAreBlocksDifferent = areBlocksDifferent;
|
|
266
266
|
} );
|
|
267
267
|
|
|
268
|
-
return () =>
|
|
268
|
+
return () => {
|
|
269
|
+
subscribed.current = false;
|
|
270
|
+
unsubscribe();
|
|
271
|
+
};
|
|
269
272
|
}, [ registry, clientId ] );
|
|
270
273
|
}
|
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 (
|
package/src/store/defaults.js
CHANGED
|
@@ -170,6 +170,13 @@ export const SETTINGS_DEFAULTS = {
|
|
|
170
170
|
__unstableGalleryWithImageBlocks: false,
|
|
171
171
|
__unstableIsPreviewMode: false,
|
|
172
172
|
|
|
173
|
+
// This setting is `private` now with `lock` API.
|
|
174
|
+
blockInspectorAnimation: {
|
|
175
|
+
'core/navigation': { enterDirection: 'leftToRight' },
|
|
176
|
+
'core/navigation-submenu': { enterDirection: 'rightToLeft' },
|
|
177
|
+
'core/navigation-link': { enterDirection: 'rightToLeft' },
|
|
178
|
+
},
|
|
179
|
+
|
|
173
180
|
generateAnchors: false,
|
|
174
181
|
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
|
175
182
|
// The setting is only kept for backward compatibility purposes.
|
|
@@ -11,7 +11,10 @@ import { Platform } from '@wordpress/element';
|
|
|
11
11
|
*
|
|
12
12
|
* @see https://github.com/WordPress/gutenberg/pull/46131
|
|
13
13
|
*/
|
|
14
|
-
const privateSettings = [
|
|
14
|
+
const privateSettings = [
|
|
15
|
+
'inserterMediaCategories',
|
|
16
|
+
'blockInspectorAnimation',
|
|
17
|
+
];
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Action that updates the block editor settings and
|
|
@@ -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
|
-
} );
|