@wordpress/block-editor 11.3.1 → 11.3.3
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/README.md +4 -4
- package/build/components/block-actions/index.js +2 -7
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +5 -3
- package/build/components/block-alignment-control/use-available-alignments.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/block-tools/selected-block-popover.js +2 -2
- package/build/components/block-tools/selected-block-popover.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/off-canvas-editor/block-contents.js +2 -2
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/provider/index.js +2 -2
- package/build/components/provider/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/components/url-popover/index.js +6 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/metadata.js +6 -0
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/position.js +6 -1
- package/build/hooks/position.js.map +1 -1
- package/build/index.js +6 -6
- package/build/index.js.map +1 -1
- package/build/layouts/flow.js +23 -2
- package/build/layouts/flow.js.map +1 -1
- package/build/lock-unlock.js +19 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/{experiments.js → private-apis.js} +9 -19
- package/build/private-apis.js.map +1 -0
- package/build/{experiments.native.js → private-apis.native.js} +9 -19
- package/build/private-apis.native.js.map +1 -0
- package/build/store/defaults.js +12 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +3 -3
- package/build/store/index.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-actions/index.js +2 -7
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +5 -3
- package/build-module/components/block-alignment-control/use-available-alignments.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/block-tools/selected-block-popover.js +1 -1
- package/build-module/components/block-tools/selected-block-popover.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/off-canvas-editor/block-contents.js +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/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/components/url-popover/index.js +6 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/metadata.js +6 -0
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/position.js +5 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flow.js +23 -2
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/private-apis.js +17 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/private-apis.native.js +15 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/defaults.js +12 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.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 +13 -12
- package/src/components/block-actions/index.js +0 -9
- package/src/components/block-alignment-control/use-available-alignments.js +17 -12
- package/src/components/block-inspector/index.js +1 -1
- package/src/components/block-tools/selected-block-popover.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/off-canvas-editor/block-contents.js +1 -1
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/use-block-sync.js +4 -1
- package/src/components/url-popover/index.js +8 -2
- package/src/hooks/dimensions.js +1 -1
- package/src/hooks/metadata.js +4 -0
- package/src/hooks/position.js +7 -1
- package/src/index.js +1 -1
- package/src/layouts/flow.js +16 -1
- package/src/lock-unlock.js +10 -0
- package/src/private-apis.js +17 -0
- package/src/private-apis.native.js +15 -0
- package/src/store/defaults.js +7 -0
- package/src/store/index.js +1 -1
- package/src/store/private-actions.js +4 -1
- package/tsconfig.json +20 -1
- package/build/experiments.js.map +0 -1
- package/build/experiments.native.js.map +0 -1
- package/build-module/experiments.js +0 -25
- package/build-module/experiments.js.map +0 -1
- package/build-module/experiments.native.js +0 -23
- package/build-module/experiments.native.js.map +0 -1
- package/src/experiments.js +0 -27
- package/src/experiments.native.js +0 -25
|
@@ -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.3",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -36,25 +36,26 @@
|
|
|
36
36
|
"@wordpress/a11y": "^3.26.1",
|
|
37
37
|
"@wordpress/api-fetch": "^6.23.1",
|
|
38
38
|
"@wordpress/blob": "^3.26.1",
|
|
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.
|
|
39
|
+
"@wordpress/blocks": "^12.3.2",
|
|
40
|
+
"@wordpress/components": "^23.3.2",
|
|
41
|
+
"@wordpress/compose": "^6.3.2",
|
|
42
|
+
"@wordpress/data": "^8.3.2",
|
|
43
|
+
"@wordpress/date": "^4.26.2",
|
|
44
44
|
"@wordpress/deprecated": "^3.26.1",
|
|
45
45
|
"@wordpress/dom": "^3.26.1",
|
|
46
46
|
"@wordpress/element": "^5.3.1",
|
|
47
47
|
"@wordpress/escape-html": "^2.26.1",
|
|
48
|
-
"@wordpress/experiments": "^0.8.1",
|
|
49
48
|
"@wordpress/hooks": "^3.26.1",
|
|
50
49
|
"@wordpress/html-entities": "^3.26.1",
|
|
51
50
|
"@wordpress/i18n": "^4.26.1",
|
|
52
51
|
"@wordpress/icons": "^9.17.1",
|
|
53
52
|
"@wordpress/is-shallow-equal": "^4.26.1",
|
|
54
|
-
"@wordpress/keyboard-shortcuts": "^4.3.
|
|
55
|
-
"@wordpress/keycodes": "^3.26.
|
|
56
|
-
"@wordpress/notices": "^3.26.
|
|
57
|
-
"@wordpress/
|
|
53
|
+
"@wordpress/keyboard-shortcuts": "^4.3.2",
|
|
54
|
+
"@wordpress/keycodes": "^3.26.2",
|
|
55
|
+
"@wordpress/notices": "^3.26.2",
|
|
56
|
+
"@wordpress/preferences": "^3.3.2",
|
|
57
|
+
"@wordpress/private-apis": "^0.8.1",
|
|
58
|
+
"@wordpress/rich-text": "^6.3.2",
|
|
58
59
|
"@wordpress/shortcode": "^3.26.1",
|
|
59
60
|
"@wordpress/style-engine": "^1.9.1",
|
|
60
61
|
"@wordpress/token-list": "^2.26.1",
|
|
@@ -82,5 +83,5 @@
|
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public"
|
|
84
85
|
},
|
|
85
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "1bf01c01a8238ce3a681ad1e517f86033818b78d"
|
|
86
87
|
}
|
|
@@ -58,8 +58,6 @@ export default function BlockActions( {
|
|
|
58
58
|
setBlockMovingClientId,
|
|
59
59
|
setNavigationMode,
|
|
60
60
|
selectBlock,
|
|
61
|
-
clearSelectedBlock,
|
|
62
|
-
multiSelect,
|
|
63
61
|
} = useDispatch( blockEditorStore );
|
|
64
62
|
|
|
65
63
|
const notifyCopy = useNotifyCopy();
|
|
@@ -134,13 +132,6 @@ export default function BlockActions( {
|
|
|
134
132
|
},
|
|
135
133
|
async onPasteStyles() {
|
|
136
134
|
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
|
-
);
|
|
144
135
|
},
|
|
145
136
|
} );
|
|
146
137
|
}
|
|
@@ -19,20 +19,25 @@ export default function useAvailableAlignments( controls = DEFAULT_CONTROLS ) {
|
|
|
19
19
|
if ( ! controls.includes( 'none' ) ) {
|
|
20
20
|
controls = [ 'none', ...controls ];
|
|
21
21
|
}
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const {
|
|
23
|
+
wideControlsEnabled = false,
|
|
24
|
+
themeSupportsLayout,
|
|
25
|
+
isBlockBasedTheme,
|
|
26
|
+
} = useSelect( ( select ) => {
|
|
27
|
+
const { getSettings } = select( blockEditorStore );
|
|
28
|
+
const settings = getSettings();
|
|
29
|
+
return {
|
|
30
|
+
wideControlsEnabled: settings.alignWide,
|
|
31
|
+
themeSupportsLayout: settings.supportsLayout,
|
|
32
|
+
isBlockBasedTheme: settings.__unstableIsBlockBasedTheme,
|
|
33
|
+
};
|
|
34
|
+
}, [] );
|
|
33
35
|
const layout = useLayout();
|
|
34
36
|
const layoutType = getLayoutType( layout?.type );
|
|
35
|
-
const layoutAlignments = layoutType.getAlignments(
|
|
37
|
+
const layoutAlignments = layoutType.getAlignments(
|
|
38
|
+
layout,
|
|
39
|
+
isBlockBasedTheme
|
|
40
|
+
);
|
|
36
41
|
|
|
37
42
|
if ( themeSupportsLayout ) {
|
|
38
43
|
const alignments = layoutAlignments.filter(
|
|
@@ -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
|
];
|
|
@@ -21,7 +21,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
21
21
|
import BlockPopover from '../block-popover';
|
|
22
22
|
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
23
23
|
import Inserter from '../inserter';
|
|
24
|
-
import { unlock } from '../../
|
|
24
|
+
import { unlock } from '../../lock-unlock';
|
|
25
25
|
|
|
26
26
|
function selector( select ) {
|
|
27
27
|
const {
|
|
@@ -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
|
+
}
|
|
@@ -12,7 +12,7 @@ import { forwardRef, useEffect, useState } from '@wordpress/element';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import { unlock } from '../../
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
16
|
import ListViewBlockSelectButton from './block-select-button';
|
|
17
17
|
import BlockDraggable from '../block-draggable';
|
|
18
18
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -11,7 +11,7 @@ import withRegistryProvider from './with-registry-provider';
|
|
|
11
11
|
import useBlockSync from './use-block-sync';
|
|
12
12
|
import { store as blockEditorStore } from '../../store';
|
|
13
13
|
import { BlockRefsProvider } from './block-refs-provider';
|
|
14
|
-
import { unlock } from '../../
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
15
|
|
|
16
16
|
/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */
|
|
17
17
|
|
|
@@ -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
|
}
|
|
@@ -6,7 +6,7 @@ import { useState } from '@wordpress/element';
|
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
8
|
Popover,
|
|
9
|
-
|
|
9
|
+
privateApis as componentsPrivateApis,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { chevronDown } from '@wordpress/icons';
|
|
12
12
|
import deprecated from '@wordpress/deprecated';
|
|
@@ -16,6 +16,11 @@ import deprecated from '@wordpress/deprecated';
|
|
|
16
16
|
*/
|
|
17
17
|
import LinkViewer from './link-viewer';
|
|
18
18
|
import LinkEditor from './link-editor';
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
20
|
+
|
|
21
|
+
const { __experimentalPopoverLegacyPositionToPlacement } = unlock(
|
|
22
|
+
componentsPrivateApis
|
|
23
|
+
);
|
|
19
24
|
|
|
20
25
|
const DEFAULT_PLACEMENT = 'bottom';
|
|
21
26
|
|
|
@@ -46,7 +51,8 @@ function URLPopover( {
|
|
|
46
51
|
if ( placement !== undefined ) {
|
|
47
52
|
computedPlacement = placement;
|
|
48
53
|
} else if ( position !== undefined ) {
|
|
49
|
-
computedPlacement =
|
|
54
|
+
computedPlacement =
|
|
55
|
+
__experimentalPopoverLegacyPositionToPlacement( position );
|
|
50
56
|
}
|
|
51
57
|
computedPlacement = computedPlacement || DEFAULT_PLACEMENT;
|
|
52
58
|
|
package/src/hooks/dimensions.js
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
} from './child-layout';
|
|
60
60
|
import useSetting from '../components/use-setting';
|
|
61
61
|
import { store as blockEditorStore } from '../store';
|
|
62
|
-
import { unlock } from '../
|
|
62
|
+
import { unlock } from '../lock-unlock';
|
|
63
63
|
|
|
64
64
|
export const DIMENSIONS_SUPPORT_KEY = 'dimensions';
|
|
65
65
|
export const SPACING_SUPPORT_KEY = 'spacing';
|
package/src/hooks/metadata.js
CHANGED
|
@@ -7,6 +7,10 @@ import { getBlockSupport } from '@wordpress/blocks';
|
|
|
7
7
|
const META_ATTRIBUTE_NAME = 'metadata';
|
|
8
8
|
|
|
9
9
|
export function hasBlockMetadataSupport( blockType, feature = '' ) {
|
|
10
|
+
// Only core blocks are allowed to use __experimentalMetadata until the fetaure is stablised.
|
|
11
|
+
if ( ! blockType.name.startsWith( 'core/' ) ) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
10
14
|
const support = getBlockSupport( blockType, '__experimentalMetadata' );
|
|
11
15
|
return !! ( true === support || support?.[ feature ] );
|
|
12
16
|
}
|
package/src/hooks/position.js
CHANGED
|
@@ -8,7 +8,10 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
BaseControl,
|
|
13
|
+
privateApis as componentsPrivateApis,
|
|
14
|
+
} from '@wordpress/components';
|
|
12
15
|
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
13
16
|
import { useSelect } from '@wordpress/data';
|
|
14
17
|
import {
|
|
@@ -26,8 +29,11 @@ import BlockList from '../components/block-list';
|
|
|
26
29
|
import useSetting from '../components/use-setting';
|
|
27
30
|
import InspectorControls from '../components/inspector-controls';
|
|
28
31
|
import { cleanEmptyObject } from './utils';
|
|
32
|
+
import { unlock } from '../lock-unlock';
|
|
29
33
|
import { store as blockEditorStore } from '../store';
|
|
30
34
|
|
|
35
|
+
const { CustomSelectControl } = unlock( componentsPrivateApis );
|
|
36
|
+
|
|
31
37
|
const POSITION_SUPPORT_KEY = 'position';
|
|
32
38
|
|
|
33
39
|
const OPTION_CLASSNAME =
|
package/src/index.js
CHANGED
package/src/layouts/flow.js
CHANGED
|
@@ -56,7 +56,7 @@ export default {
|
|
|
56
56
|
getOrientation() {
|
|
57
57
|
return 'vertical';
|
|
58
58
|
},
|
|
59
|
-
getAlignments( layout ) {
|
|
59
|
+
getAlignments( layout, isBlockBasedTheme ) {
|
|
60
60
|
const alignmentInfo = getAlignmentsInfo( layout );
|
|
61
61
|
if ( layout.alignments !== undefined ) {
|
|
62
62
|
if ( ! layout.alignments.includes( 'none' ) ) {
|
|
@@ -74,6 +74,21 @@ export default {
|
|
|
74
74
|
{ name: 'right' },
|
|
75
75
|
];
|
|
76
76
|
|
|
77
|
+
// This is for backwards compatibility with hybrid themes.
|
|
78
|
+
if ( ! isBlockBasedTheme ) {
|
|
79
|
+
const { contentSize, wideSize } = layout;
|
|
80
|
+
if ( contentSize ) {
|
|
81
|
+
alignments.unshift( { name: 'full' } );
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if ( wideSize ) {
|
|
85
|
+
alignments.unshift( {
|
|
86
|
+
name: 'wide',
|
|
87
|
+
info: alignmentInfo.wide,
|
|
88
|
+
} );
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
77
92
|
alignments.unshift( { name: 'none', info: alignmentInfo.none } );
|
|
78
93
|
|
|
79
94
|
return alignments;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
5
|
+
|
|
6
|
+
export const { lock, unlock } =
|
|
7
|
+
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
+
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
|
|
9
|
+
'@wordpress/block-editor'
|
|
10
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as globalStyles from './components/global-styles';
|
|
5
|
+
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
+
import { lock } from './lock-unlock';
|
|
7
|
+
import OffCanvasEditor from './components/off-canvas-editor';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Private @wordpress/block-editor APIs.
|
|
11
|
+
*/
|
|
12
|
+
export const privateApis = {};
|
|
13
|
+
lock( privateApis, {
|
|
14
|
+
...globalStyles,
|
|
15
|
+
ExperimentalBlockEditorProvider,
|
|
16
|
+
OffCanvasEditor,
|
|
17
|
+
} );
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as globalStyles from './components/global-styles';
|
|
5
|
+
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
+
import { lock } from './lock-unlock';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Private @wordpress/block-editor APIs.
|
|
10
|
+
*/
|
|
11
|
+
export const privateApis = {};
|
|
12
|
+
lock( privateApis, {
|
|
13
|
+
...globalStyles,
|
|
14
|
+
ExperimentalBlockEditorProvider,
|
|
15
|
+
} );
|
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.
|
package/src/store/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import * as privateActions from './private-actions';
|
|
|
12
12
|
import * as privateSelectors from './private-selectors';
|
|
13
13
|
import * as actions from './actions';
|
|
14
14
|
import { STORE_NAME } from './constants';
|
|
15
|
-
import { unlock } from '../
|
|
15
|
+
import { unlock } from '../lock-unlock';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Block editor data store configuration.
|
|
@@ -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
|
package/tsconfig.json
CHANGED
|
@@ -5,10 +5,29 @@
|
|
|
5
5
|
"declarationDir": "build-types"
|
|
6
6
|
},
|
|
7
7
|
"references": [
|
|
8
|
+
{ "path": "../a11y" },
|
|
9
|
+
{ "path": "../api-fetch" },
|
|
10
|
+
{ "path": "../blob" },
|
|
11
|
+
{ "path": "../components" },
|
|
12
|
+
{ "path": "../compose" },
|
|
13
|
+
{ "path": "../data" },
|
|
14
|
+
{ "path": "../date" },
|
|
8
15
|
{ "path": "../deprecated" },
|
|
16
|
+
{ "path": "../dom" },
|
|
9
17
|
{ "path": "../element" },
|
|
18
|
+
{ "path": "../escape-html" },
|
|
19
|
+
{ "path": "../private-apis" },
|
|
10
20
|
{ "path": "../hooks" },
|
|
11
|
-
{ "path": "../
|
|
21
|
+
{ "path": "../html-entities" },
|
|
22
|
+
{ "path": "../i18n" },
|
|
23
|
+
{ "path": "../icons" },
|
|
24
|
+
{ "path": "../is-shallow-equal" },
|
|
25
|
+
{ "path": "../keycodes" },
|
|
26
|
+
{ "path": "../style-engine" },
|
|
27
|
+
{ "path": "../token-list" },
|
|
28
|
+
{ "path": "../url" },
|
|
29
|
+
{ "path": "../warning" },
|
|
30
|
+
{ "path": "../wordcount" }
|
|
12
31
|
],
|
|
13
32
|
// NOTE: This package is being progressively typed. You are encouraged to
|
|
14
33
|
// expand this array with files which can be type-checked. At some point in
|
package/build/experiments.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/experiments.js"],"names":["lock","unlock","experiments","globalStyles","ExperimentalBlockEditorProvider","OffCanvasEditor"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;;;;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,yBAFD,CADM;AAMP;AACA;AACA;;;;AACO,MAAMC,WAAW,GAAG,EAApB;;AACPF,IAAI,CAAEE,WAAF,EAAe,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA,yCAFkB;AAGlBC,EAAAA,eAAe,EAAfA;AAHkB,CAAf,CAAJ","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\n\n/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport OffCanvasEditor from './components/off-canvas-editor';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/block-editor'\n\t);\n\n/**\n * Experimental @wordpress/block-editor APIs.\n */\nexport const experiments = {};\nlock( experiments, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tOffCanvasEditor,\n} );\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/experiments.native.js"],"names":["lock","unlock","experiments","globalStyles","ExperimentalBlockEditorProvider"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;;;;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,yBAFD,CADM;AAMP;AACA;AACA;;;;AACO,MAAMC,WAAW,GAAG,EAApB;;AACPF,IAAI,CAAEE,WAAF,EAAe,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA;AAFkB,CAAf,CAAJ","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\n\n/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/block-editor'\n\t);\n\n/**\n * Experimental @wordpress/block-editor APIs.\n */\nexport const experiments = {};\nlock( experiments, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n} );\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as globalStyles from './components/global-styles';
|
|
10
|
-
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
11
|
-
import OffCanvasEditor from './components/off-canvas-editor';
|
|
12
|
-
export const {
|
|
13
|
-
lock,
|
|
14
|
-
unlock
|
|
15
|
-
} = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/block-editor');
|
|
16
|
-
/**
|
|
17
|
-
* Experimental @wordpress/block-editor APIs.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export const experiments = {};
|
|
21
|
-
lock(experiments, { ...globalStyles,
|
|
22
|
-
ExperimentalBlockEditorProvider,
|
|
23
|
-
OffCanvasEditor
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=experiments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/experiments.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","globalStyles","ExperimentalBlockEditorProvider","OffCanvasEditor","lock","unlock","experiments"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,wBAAjE;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,OAAOC,eAAP,MAA4B,gCAA5B;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZL,gDAAgD,CAC/C,8GAD+C,EAE/C,yBAF+C,CAD1C;AAMP;AACA;AACA;;AACA,OAAO,MAAMM,WAAW,GAAG,EAApB;AACPF,IAAI,CAAEE,WAAF,EAAe,EAClB,GAAGL,YADe;AAElBC,EAAAA,+BAFkB;AAGlBC,EAAAA;AAHkB,CAAf,CAAJ","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\n\n/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport OffCanvasEditor from './components/off-canvas-editor';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/block-editor'\n\t);\n\n/**\n * Experimental @wordpress/block-editor APIs.\n */\nexport const experiments = {};\nlock( experiments, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tOffCanvasEditor,\n} );\n"]}
|