@wordpress/block-editor 11.3.1 → 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-inspector/index.js +1 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +13 -3
- package/build/components/inserter/block-patterns-tab.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/provider/use-block-sync.js +4 -1
- package/build/components/provider/use-block-sync.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-module/components/block-inspector/index.js +1 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +13 -4
- package/build-module/components/inserter/block-patterns-tab.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/provider/use-block-sync.js +4 -1
- package/build-module/components/provider/use-block-sync.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-style/style-rtl.css +18 -0
- package/build-style/style.css +18 -0
- package/package.json +3 -2
- package/src/components/block-inspector/index.js +1 -1
- package/src/components/inserter/block-patterns-tab.js +28 -5
- 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/provider/use-block-sync.js +4 -1
- package/src/store/defaults.js +7 -0
- package/src/store/private-actions.js +4 -1
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",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@wordpress/keyboard-shortcuts": "^4.3.1",
|
|
55
55
|
"@wordpress/keycodes": "^3.26.1",
|
|
56
56
|
"@wordpress/notices": "^3.26.1",
|
|
57
|
+
"@wordpress/preferences": "^3.3.1",
|
|
57
58
|
"@wordpress/rich-text": "^6.3.1",
|
|
58
59
|
"@wordpress/shortcode": "^3.26.1",
|
|
59
60
|
"@wordpress/style-engine": "^1.9.1",
|
|
@@ -82,5 +83,5 @@
|
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public"
|
|
84
85
|
},
|
|
85
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "3eb2c536278d5a17f698b9c378fe3db746a89622"
|
|
86
87
|
}
|
|
@@ -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
|
];
|
|
@@ -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 (
|
|
@@ -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
|
+
}
|
|
@@ -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/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
|