@wordpress/block-editor 15.4.0 → 15.4.1-next.f56bd8138.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/build/components/block-inspector/index.js +110 -95
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/content-tab.js +34 -0
- package/build/components/inspector-controls-tabs/content-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/index.js +12 -2
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +24 -21
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +9 -5
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +7 -1
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/rich-text/index.js +4 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +3 -2
- package/build/store/actions.js.map +1 -1
- package/build-module/components/block-inspector/index.js +110 -95
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/content-tab.js +26 -0
- package/build-module/components/inspector-controls-tabs/content-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/index.js +13 -3
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +24 -21
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +10 -6
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +7 -1
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +3 -2
- package/build-module/store/actions.js.map +1 -1
- package/package.json +34 -34
- package/src/components/block-inspector/index.js +134 -114
- package/src/components/block-switcher/index.js +8 -3
- package/src/components/inspector-controls-tabs/content-tab.js +24 -0
- package/src/components/inspector-controls-tabs/index.js +8 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +33 -21
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +19 -6
- package/src/components/inspector-controls-tabs/utils.js +8 -1
- package/src/components/rich-text/index.js +8 -1
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "15.4.0",
|
|
3
|
+
"version": "15.4.1-next.f56bd8138.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,38 +37,38 @@
|
|
|
37
37
|
"@emotion/react": "^11.7.1",
|
|
38
38
|
"@emotion/styled": "^11.6.0",
|
|
39
39
|
"@react-spring/web": "^9.4.5",
|
|
40
|
-
"@wordpress/a11y": "^4.31.0",
|
|
41
|
-
"@wordpress/api-fetch": "^7.31.0",
|
|
42
|
-
"@wordpress/blob": "^4.31.0",
|
|
43
|
-
"@wordpress/block-serialization-default-parser": "^5.31.0",
|
|
44
|
-
"@wordpress/blocks": "^15.4.0",
|
|
45
|
-
"@wordpress/commands": "^1.31.0",
|
|
46
|
-
"@wordpress/components": "^30.
|
|
47
|
-
"@wordpress/compose": "^7.31.0",
|
|
48
|
-
"@wordpress/data": "^10.31.0",
|
|
49
|
-
"@wordpress/date": "^5.31.0",
|
|
50
|
-
"@wordpress/deprecated": "^4.31.0",
|
|
51
|
-
"@wordpress/dom": "^4.31.0",
|
|
52
|
-
"@wordpress/element": "^6.31.0",
|
|
53
|
-
"@wordpress/escape-html": "^3.31.0",
|
|
54
|
-
"@wordpress/hooks": "^4.31.0",
|
|
55
|
-
"@wordpress/html-entities": "^4.31.0",
|
|
56
|
-
"@wordpress/i18n": "^6.4.0",
|
|
57
|
-
"@wordpress/icons": "^10.31.0",
|
|
58
|
-
"@wordpress/is-shallow-equal": "^5.31.0",
|
|
59
|
-
"@wordpress/keyboard-shortcuts": "^5.31.0",
|
|
60
|
-
"@wordpress/keycodes": "^4.31.0",
|
|
61
|
-
"@wordpress/notices": "^5.31.0",
|
|
62
|
-
"@wordpress/preferences": "^4.31.0",
|
|
63
|
-
"@wordpress/priority-queue": "^3.31.0",
|
|
64
|
-
"@wordpress/private-apis": "^1.31.0",
|
|
65
|
-
"@wordpress/rich-text": "^7.31.0",
|
|
66
|
-
"@wordpress/style-engine": "^2.31.0",
|
|
67
|
-
"@wordpress/token-list": "^3.31.0",
|
|
68
|
-
"@wordpress/upload-media": "^0.16.0",
|
|
69
|
-
"@wordpress/url": "^4.31.0",
|
|
70
|
-
"@wordpress/warning": "^3.31.0",
|
|
71
|
-
"@wordpress/wordcount": "^4.31.0",
|
|
40
|
+
"@wordpress/a11y": "^4.31.1-next.f56bd8138.0",
|
|
41
|
+
"@wordpress/api-fetch": "^7.31.1-next.f56bd8138.0",
|
|
42
|
+
"@wordpress/blob": "^4.31.1-next.f56bd8138.0",
|
|
43
|
+
"@wordpress/block-serialization-default-parser": "^5.31.1-next.f56bd8138.0",
|
|
44
|
+
"@wordpress/blocks": "^15.4.1-next.f56bd8138.0",
|
|
45
|
+
"@wordpress/commands": "^1.31.1-next.f56bd8138.0",
|
|
46
|
+
"@wordpress/components": "^30.5.1-next.f56bd8138.0",
|
|
47
|
+
"@wordpress/compose": "^7.31.1-next.f56bd8138.0",
|
|
48
|
+
"@wordpress/data": "^10.31.1-next.f56bd8138.0",
|
|
49
|
+
"@wordpress/date": "^5.31.1-next.f56bd8138.0",
|
|
50
|
+
"@wordpress/deprecated": "^4.31.1-next.f56bd8138.0",
|
|
51
|
+
"@wordpress/dom": "^4.31.1-next.f56bd8138.0",
|
|
52
|
+
"@wordpress/element": "^6.31.1-next.f56bd8138.0",
|
|
53
|
+
"@wordpress/escape-html": "^3.31.1-next.f56bd8138.0",
|
|
54
|
+
"@wordpress/hooks": "^4.31.1-next.f56bd8138.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.31.1-next.f56bd8138.0",
|
|
56
|
+
"@wordpress/i18n": "^6.4.1-next.f56bd8138.0",
|
|
57
|
+
"@wordpress/icons": "^10.31.1-next.f56bd8138.0",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.31.1-next.f56bd8138.0",
|
|
59
|
+
"@wordpress/keyboard-shortcuts": "^5.31.1-next.f56bd8138.0",
|
|
60
|
+
"@wordpress/keycodes": "^4.31.1-next.f56bd8138.0",
|
|
61
|
+
"@wordpress/notices": "^5.31.1-next.f56bd8138.0",
|
|
62
|
+
"@wordpress/preferences": "^4.31.1-next.f56bd8138.0",
|
|
63
|
+
"@wordpress/priority-queue": "^3.31.1-next.f56bd8138.0",
|
|
64
|
+
"@wordpress/private-apis": "^1.31.1-next.f56bd8138.0",
|
|
65
|
+
"@wordpress/rich-text": "^7.31.1-next.f56bd8138.0",
|
|
66
|
+
"@wordpress/style-engine": "^2.31.1-next.f56bd8138.0",
|
|
67
|
+
"@wordpress/token-list": "^3.31.1-next.f56bd8138.0",
|
|
68
|
+
"@wordpress/upload-media": "^0.16.1-next.f56bd8138.0",
|
|
69
|
+
"@wordpress/url": "^4.31.1-next.f56bd8138.0",
|
|
70
|
+
"@wordpress/warning": "^3.31.1-next.f56bd8138.0",
|
|
71
|
+
"@wordpress/wordcount": "^4.31.1-next.f56bd8138.0",
|
|
72
72
|
"change-case": "^4.1.2",
|
|
73
73
|
"clsx": "^2.1.1",
|
|
74
74
|
"colord": "^2.7.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "ea4a281fd857f48338877590de8c8eb9b9a8cef4"
|
|
95
95
|
}
|
|
@@ -27,8 +27,8 @@ import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-c
|
|
|
27
27
|
import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
|
|
28
28
|
import PositionControls from '../inspector-controls-tabs/position-controls-panel';
|
|
29
29
|
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
30
|
-
import BlockQuickNavigation from '../block-quick-navigation';
|
|
31
30
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
31
|
+
import ContentTab from '../inspector-controls-tabs/content-tab';
|
|
32
32
|
|
|
33
33
|
import { unlock } from '../../lock-unlock';
|
|
34
34
|
|
|
@@ -40,41 +40,129 @@ function BlockStylesPanel( { clientId } ) {
|
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function StyleInspectorSlots( {
|
|
44
|
+
blockName,
|
|
45
|
+
showAdvancedControls = true,
|
|
46
|
+
showPositionControls = true,
|
|
47
|
+
showListControls = false,
|
|
48
|
+
showBindingsControls = true,
|
|
49
|
+
} ) {
|
|
50
|
+
const borderPanelLabel = useBorderPanelLabel( { blockName } );
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<InspectorControls.Slot />
|
|
54
|
+
{ showListControls && <InspectorControls.Slot group="list" /> }
|
|
55
|
+
<InspectorControls.Slot
|
|
56
|
+
group="color"
|
|
57
|
+
label={ __( 'Color' ) }
|
|
58
|
+
className="color-block-support-panel__inner-wrapper"
|
|
59
|
+
/>
|
|
60
|
+
<InspectorControls.Slot
|
|
61
|
+
group="background"
|
|
62
|
+
label={ __( 'Background image' ) }
|
|
63
|
+
/>
|
|
64
|
+
<InspectorControls.Slot
|
|
65
|
+
group="typography"
|
|
66
|
+
label={ __( 'Typography' ) }
|
|
67
|
+
/>
|
|
68
|
+
<InspectorControls.Slot
|
|
69
|
+
group="dimensions"
|
|
70
|
+
label={ __( 'Dimensions' ) }
|
|
71
|
+
/>
|
|
72
|
+
<InspectorControls.Slot group="border" label={ borderPanelLabel } />
|
|
73
|
+
<InspectorControls.Slot group="styles" />
|
|
74
|
+
{ showPositionControls && <PositionControls /> }
|
|
75
|
+
{ showBindingsControls && (
|
|
76
|
+
<InspectorControls.Slot group="bindings" />
|
|
77
|
+
) }
|
|
78
|
+
{ showAdvancedControls && (
|
|
79
|
+
<div>
|
|
80
|
+
<AdvancedControls />
|
|
81
|
+
</div>
|
|
82
|
+
) }
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
43
87
|
function BlockInspector() {
|
|
44
88
|
const {
|
|
45
|
-
|
|
89
|
+
selectedBlockCount,
|
|
46
90
|
selectedBlockName,
|
|
47
91
|
selectedBlockClientId,
|
|
48
92
|
blockType,
|
|
49
93
|
isSectionBlock,
|
|
94
|
+
isSectionBlockInSelection,
|
|
95
|
+
hasBlockStyles,
|
|
50
96
|
} = useSelect( ( select ) => {
|
|
51
97
|
const {
|
|
52
98
|
getSelectedBlockClientId,
|
|
99
|
+
getSelectedBlockClientIds,
|
|
53
100
|
getSelectedBlockCount,
|
|
54
101
|
getBlockName,
|
|
55
102
|
getParentSectionBlock,
|
|
56
103
|
isSectionBlock: _isSectionBlock,
|
|
57
104
|
} = unlock( select( blockEditorStore ) );
|
|
105
|
+
const { getBlockStyles } = select( blocksStore );
|
|
58
106
|
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
59
107
|
const renderedBlockClientId =
|
|
60
108
|
getParentSectionBlock( _selectedBlockClientId ) ||
|
|
61
|
-
|
|
109
|
+
_selectedBlockClientId;
|
|
62
110
|
const _selectedBlockName =
|
|
63
111
|
renderedBlockClientId && getBlockName( renderedBlockClientId );
|
|
64
112
|
const _blockType =
|
|
65
113
|
_selectedBlockName && getBlockType( _selectedBlockName );
|
|
114
|
+
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
115
|
+
const _isSectionBlockInSelection = selectedBlockClientIds.some(
|
|
116
|
+
( id ) => _isSectionBlock( id )
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const blockStyles =
|
|
120
|
+
_selectedBlockName && getBlockStyles( _selectedBlockName );
|
|
121
|
+
const _hasBlockStyles = blockStyles && blockStyles.length > 0;
|
|
66
122
|
|
|
67
123
|
return {
|
|
68
|
-
|
|
124
|
+
selectedBlockCount: getSelectedBlockCount(),
|
|
69
125
|
selectedBlockClientId: renderedBlockClientId,
|
|
70
126
|
selectedBlockName: _selectedBlockName,
|
|
71
127
|
blockType: _blockType,
|
|
128
|
+
isSectionBlockInSelection: _isSectionBlockInSelection,
|
|
72
129
|
isSectionBlock: _isSectionBlock( renderedBlockClientId ),
|
|
130
|
+
hasBlockStyles: _hasBlockStyles,
|
|
73
131
|
};
|
|
74
132
|
}, [] );
|
|
75
133
|
|
|
76
|
-
|
|
77
|
-
const
|
|
134
|
+
// Separate useSelect for contentClientIds with proper dependencies
|
|
135
|
+
const contentClientIds = useSelect(
|
|
136
|
+
( select ) => {
|
|
137
|
+
if ( ! isSectionBlock || ! selectedBlockClientId ) {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const {
|
|
142
|
+
getClientIdsOfDescendants,
|
|
143
|
+
getBlockName,
|
|
144
|
+
getBlockEditingMode,
|
|
145
|
+
} = unlock( select( blockEditorStore ) );
|
|
146
|
+
|
|
147
|
+
const descendants = getClientIdsOfDescendants(
|
|
148
|
+
selectedBlockClientId
|
|
149
|
+
);
|
|
150
|
+
return descendants.filter(
|
|
151
|
+
( current ) =>
|
|
152
|
+
getBlockName( current ) !== 'core/list-item' &&
|
|
153
|
+
getBlockEditingMode( current ) === 'contentOnly'
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
[ isSectionBlock, selectedBlockClientId ]
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const availableTabs = useInspectorControlsTabs(
|
|
160
|
+
blockType?.name,
|
|
161
|
+
contentClientIds,
|
|
162
|
+
isSectionBlock,
|
|
163
|
+
hasBlockStyles
|
|
164
|
+
);
|
|
165
|
+
const hasMultipleTabs = availableTabs?.length > 1;
|
|
78
166
|
|
|
79
167
|
// The block inspector animation settings will be completely
|
|
80
168
|
// removed in the future to create an API which allows the block
|
|
@@ -85,47 +173,34 @@ function BlockInspector() {
|
|
|
85
173
|
const blockInspectorAnimationSettings =
|
|
86
174
|
useBlockInspectorAnimationSettings( blockType );
|
|
87
175
|
|
|
88
|
-
const
|
|
89
|
-
blockName: selectedBlockName,
|
|
90
|
-
} );
|
|
176
|
+
const hasSelectedBlocks = selectedBlockCount > 1;
|
|
91
177
|
|
|
92
|
-
if (
|
|
178
|
+
if ( hasSelectedBlocks && ! isSectionBlockInSelection ) {
|
|
93
179
|
return (
|
|
94
180
|
<div className="block-editor-block-inspector">
|
|
95
181
|
<MultiSelectionInspector />
|
|
96
|
-
{
|
|
182
|
+
{ hasMultipleTabs ? (
|
|
97
183
|
<InspectorControlsTabs tabs={ availableTabs } />
|
|
98
184
|
) : (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/>
|
|
106
|
-
<InspectorControls.Slot
|
|
107
|
-
group="background"
|
|
108
|
-
label={ __( 'Background image' ) }
|
|
109
|
-
/>
|
|
110
|
-
<InspectorControls.Slot
|
|
111
|
-
group="typography"
|
|
112
|
-
label={ __( 'Typography' ) }
|
|
113
|
-
/>
|
|
114
|
-
<InspectorControls.Slot
|
|
115
|
-
group="dimensions"
|
|
116
|
-
label={ __( 'Dimensions' ) }
|
|
117
|
-
/>
|
|
118
|
-
<InspectorControls.Slot
|
|
119
|
-
group="border"
|
|
120
|
-
label={ borderPanelLabel }
|
|
121
|
-
/>
|
|
122
|
-
<InspectorControls.Slot group="styles" />
|
|
123
|
-
</>
|
|
185
|
+
<StyleInspectorSlots
|
|
186
|
+
blockName={ selectedBlockName }
|
|
187
|
+
showAdvancedControls={ false }
|
|
188
|
+
showPositionControls={ false }
|
|
189
|
+
showBindingsControls={ false }
|
|
190
|
+
/>
|
|
124
191
|
) }
|
|
125
192
|
</div>
|
|
126
193
|
);
|
|
127
194
|
}
|
|
128
195
|
|
|
196
|
+
if ( hasSelectedBlocks && isSectionBlockInSelection ) {
|
|
197
|
+
return (
|
|
198
|
+
<div className="block-editor-block-inspector">
|
|
199
|
+
<MultiSelectionInspector />
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
129
204
|
const isSelectedBlockUnregistered =
|
|
130
205
|
selectedBlockName === getUnregisteredTypeHandlerName();
|
|
131
206
|
|
|
@@ -133,11 +208,10 @@ function BlockInspector() {
|
|
|
133
208
|
* If the selected block is of an unregistered type, avoid showing it as an actual selection
|
|
134
209
|
* because we want the user to focus on the unregistered block warning, not block settings.
|
|
135
210
|
*/
|
|
136
|
-
|
|
137
|
-
! blockType ||
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
) {
|
|
211
|
+
const shouldShowWarning =
|
|
212
|
+
! blockType || ! selectedBlockClientId || isSelectedBlockUnregistered;
|
|
213
|
+
|
|
214
|
+
if ( shouldShowWarning ) {
|
|
141
215
|
return (
|
|
142
216
|
<span className="block-editor-block-inspector__no-blocks">
|
|
143
217
|
{ __( 'No block selected.' ) }
|
|
@@ -163,6 +237,9 @@ function BlockInspector() {
|
|
|
163
237
|
clientId={ selectedBlockClientId }
|
|
164
238
|
blockName={ blockType.name }
|
|
165
239
|
isSectionBlock={ isSectionBlock }
|
|
240
|
+
availableTabs={ availableTabs }
|
|
241
|
+
contentClientIds={ contentClientIds }
|
|
242
|
+
hasBlockStyles={ hasBlockStyles }
|
|
166
243
|
/>
|
|
167
244
|
</BlockInspectorSingleBlockWrapper>
|
|
168
245
|
);
|
|
@@ -208,106 +285,49 @@ const BlockInspectorSingleBlock = ( {
|
|
|
208
285
|
clientId,
|
|
209
286
|
blockName,
|
|
210
287
|
isSectionBlock,
|
|
288
|
+
availableTabs,
|
|
289
|
+
contentClientIds,
|
|
290
|
+
hasBlockStyles,
|
|
211
291
|
} ) => {
|
|
212
|
-
const
|
|
213
|
-
const showTabs = ! isSectionBlock && availableTabs?.length > 1;
|
|
292
|
+
const hasMultipleTabs = availableTabs?.length > 1;
|
|
214
293
|
|
|
215
|
-
const hasBlockStyles = useSelect(
|
|
216
|
-
( select ) => {
|
|
217
|
-
const { getBlockStyles } = select( blocksStore );
|
|
218
|
-
const blockStyles = getBlockStyles( blockName );
|
|
219
|
-
return blockStyles && blockStyles.length > 0;
|
|
220
|
-
},
|
|
221
|
-
[ blockName ]
|
|
222
|
-
);
|
|
223
294
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
224
|
-
const
|
|
225
|
-
const contentClientIds = useSelect(
|
|
226
|
-
( select ) => {
|
|
227
|
-
// Avoid unnecessary subscription.
|
|
228
|
-
if ( ! isSectionBlock ) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
295
|
+
const isBlockSynced = blockInformation.isSynced;
|
|
231
296
|
|
|
232
|
-
|
|
233
|
-
getClientIdsOfDescendants,
|
|
234
|
-
getBlockName,
|
|
235
|
-
getBlockEditingMode,
|
|
236
|
-
} = select( blockEditorStore );
|
|
237
|
-
return getClientIdsOfDescendants( clientId ).filter(
|
|
238
|
-
( current ) =>
|
|
239
|
-
getBlockName( current ) !== 'core/list-item' &&
|
|
240
|
-
getBlockEditingMode( current ) === 'contentOnly'
|
|
241
|
-
);
|
|
242
|
-
},
|
|
243
|
-
[ isSectionBlock, clientId ]
|
|
244
|
-
);
|
|
297
|
+
const shouldShowTabs = ! isBlockSynced && hasMultipleTabs;
|
|
245
298
|
|
|
246
299
|
return (
|
|
247
300
|
<div className="block-editor-block-inspector">
|
|
248
301
|
<BlockCard
|
|
249
302
|
{ ...blockInformation }
|
|
250
|
-
className={
|
|
303
|
+
className={ isBlockSynced && 'is-synced' }
|
|
251
304
|
>
|
|
252
305
|
{ window?.__experimentalContentOnlyPatternInsertion && (
|
|
253
306
|
<EditContentsButton clientId={ clientId } />
|
|
254
307
|
) }
|
|
255
308
|
</BlockCard>
|
|
256
309
|
<BlockVariationTransforms blockClientId={ clientId } />
|
|
257
|
-
{
|
|
310
|
+
{ shouldShowTabs && (
|
|
258
311
|
<InspectorControlsTabs
|
|
259
312
|
hasBlockStyles={ hasBlockStyles }
|
|
260
313
|
clientId={ clientId }
|
|
261
314
|
blockName={ blockName }
|
|
262
315
|
tabs={ availableTabs }
|
|
316
|
+
isSectionBlock={ isSectionBlock }
|
|
317
|
+
contentClientIds={ contentClientIds }
|
|
263
318
|
/>
|
|
264
319
|
) }
|
|
265
|
-
{ !
|
|
320
|
+
{ ! shouldShowTabs && (
|
|
266
321
|
<>
|
|
267
322
|
{ hasBlockStyles && (
|
|
268
323
|
<BlockStylesPanel clientId={ clientId } />
|
|
269
324
|
) }
|
|
270
|
-
|
|
271
|
-
{ contentClientIds && contentClientIds?.length > 0 && (
|
|
272
|
-
<PanelBody title={ __( 'Content' ) }>
|
|
273
|
-
<BlockQuickNavigation
|
|
274
|
-
clientIds={ contentClientIds }
|
|
275
|
-
/>
|
|
276
|
-
</PanelBody>
|
|
277
|
-
) }
|
|
278
|
-
|
|
325
|
+
<ContentTab contentClientIds={ contentClientIds } />
|
|
279
326
|
{ ! isSectionBlock && (
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
group="color"
|
|
285
|
-
label={ __( 'Color' ) }
|
|
286
|
-
className="color-block-support-panel__inner-wrapper"
|
|
287
|
-
/>
|
|
288
|
-
<InspectorControls.Slot
|
|
289
|
-
group="background"
|
|
290
|
-
label={ __( 'Background image' ) }
|
|
291
|
-
/>
|
|
292
|
-
<InspectorControls.Slot
|
|
293
|
-
group="typography"
|
|
294
|
-
label={ __( 'Typography' ) }
|
|
295
|
-
/>
|
|
296
|
-
<InspectorControls.Slot
|
|
297
|
-
group="dimensions"
|
|
298
|
-
label={ __( 'Dimensions' ) }
|
|
299
|
-
/>
|
|
300
|
-
<InspectorControls.Slot
|
|
301
|
-
group="border"
|
|
302
|
-
label={ borderPanelLabel }
|
|
303
|
-
/>
|
|
304
|
-
<InspectorControls.Slot group="styles" />
|
|
305
|
-
<PositionControls />
|
|
306
|
-
<InspectorControls.Slot group="bindings" />
|
|
307
|
-
<div>
|
|
308
|
-
<AdvancedControls />
|
|
309
|
-
</div>
|
|
310
|
-
</>
|
|
327
|
+
<StyleInspectorSlots
|
|
328
|
+
blockName={ blockName }
|
|
329
|
+
showListControls
|
|
330
|
+
/>
|
|
311
331
|
) }
|
|
312
332
|
</>
|
|
313
333
|
) }
|
|
@@ -199,7 +199,7 @@ export const BlockSwitcher = ( { clientIds } ) => {
|
|
|
199
199
|
isReusable,
|
|
200
200
|
isTemplate,
|
|
201
201
|
isDisabled,
|
|
202
|
-
|
|
202
|
+
isSectionInSelection,
|
|
203
203
|
} = useSelect(
|
|
204
204
|
( select ) => {
|
|
205
205
|
const {
|
|
@@ -243,6 +243,10 @@ export const BlockSwitcher = ( { clientIds } ) => {
|
|
|
243
243
|
_icon = isSelectionOfSameType ? blockType.icon : copy;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
const _isSectionInSelection = clientIds.some( ( id ) =>
|
|
247
|
+
isSectionBlock( id )
|
|
248
|
+
);
|
|
249
|
+
|
|
246
250
|
return {
|
|
247
251
|
canRemove: canRemoveBlocks( clientIds ),
|
|
248
252
|
hasBlockStyles:
|
|
@@ -255,7 +259,7 @@ export const BlockSwitcher = ( { clientIds } ) => {
|
|
|
255
259
|
_isSingleBlockSelected && isTemplatePart( _blocks[ 0 ] ),
|
|
256
260
|
hasContentOnlyLocking: _hasTemplateLock,
|
|
257
261
|
isDisabled: editingMode !== 'default',
|
|
258
|
-
|
|
262
|
+
isSectionInSelection: _isSectionInSelection,
|
|
259
263
|
};
|
|
260
264
|
},
|
|
261
265
|
[ clientIds ]
|
|
@@ -285,7 +289,8 @@ export const BlockSwitcher = ( { clientIds } ) => {
|
|
|
285
289
|
: undefined;
|
|
286
290
|
|
|
287
291
|
const hideTransformsForSections =
|
|
288
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
292
|
+
window?.__experimentalContentOnlyPatternInsertion &&
|
|
293
|
+
isSectionInSelection;
|
|
289
294
|
const hideDropdown =
|
|
290
295
|
hideTransformsForSections ||
|
|
291
296
|
isDisabled ||
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PanelBody } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import BlockQuickNavigation from '../block-quick-navigation';
|
|
11
|
+
|
|
12
|
+
const ContentTab = ( { contentClientIds } ) => {
|
|
13
|
+
if ( ! contentClientIds || contentClientIds.length === 0 ) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<PanelBody title={ __( 'Content' ) }>
|
|
19
|
+
<BlockQuickNavigation clientIds={ contentClientIds } />
|
|
20
|
+
</PanelBody>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default ContentTab;
|
|
@@ -12,9 +12,10 @@ import { useSelect } from '@wordpress/data';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import { TAB_SETTINGS, TAB_STYLES, TAB_LIST_VIEW } from './utils';
|
|
15
|
+
import { TAB_SETTINGS, TAB_STYLES, TAB_LIST_VIEW, TAB_CONTENT } from './utils';
|
|
16
16
|
import SettingsTab from './settings-tab';
|
|
17
17
|
import StylesTab from './styles-tab';
|
|
18
|
+
import ContentTab from './content-tab';
|
|
18
19
|
import InspectorControls from '../inspector-controls';
|
|
19
20
|
import useIsListViewTabDisabled from './use-is-list-view-tab-disabled';
|
|
20
21
|
import { unlock } from '../../lock-unlock';
|
|
@@ -26,6 +27,8 @@ export default function InspectorControlsTabs( {
|
|
|
26
27
|
clientId,
|
|
27
28
|
hasBlockStyles,
|
|
28
29
|
tabs,
|
|
30
|
+
isSectionBlock,
|
|
31
|
+
contentClientIds,
|
|
29
32
|
} ) {
|
|
30
33
|
const showIconLabels = useSelect( ( select ) => {
|
|
31
34
|
return select( preferencesStore ).get( 'core', 'showIconLabels' );
|
|
@@ -69,8 +72,12 @@ export default function InspectorControlsTabs( {
|
|
|
69
72
|
blockName={ blockName }
|
|
70
73
|
clientId={ clientId }
|
|
71
74
|
hasBlockStyles={ hasBlockStyles }
|
|
75
|
+
isSectionBlock={ isSectionBlock }
|
|
72
76
|
/>
|
|
73
77
|
</Tabs.TabPanel>
|
|
78
|
+
<Tabs.TabPanel tabId={ TAB_CONTENT.name } focusable={ false }>
|
|
79
|
+
<ContentTab contentClientIds={ contentClientIds } />
|
|
80
|
+
</Tabs.TabPanel>
|
|
74
81
|
<Tabs.TabPanel tabId={ TAB_LIST_VIEW.name } focusable={ false }>
|
|
75
82
|
<InspectorControls.Slot group="list" />
|
|
76
83
|
</Tabs.TabPanel>
|
|
@@ -11,7 +11,12 @@ import BlockStyles from '../block-styles';
|
|
|
11
11
|
import InspectorControls from '../inspector-controls';
|
|
12
12
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
13
13
|
|
|
14
|
-
const StylesTab = ( {
|
|
14
|
+
const StylesTab = ( {
|
|
15
|
+
blockName,
|
|
16
|
+
clientId,
|
|
17
|
+
hasBlockStyles,
|
|
18
|
+
isSectionBlock,
|
|
19
|
+
} ) => {
|
|
15
20
|
const borderPanelLabel = useBorderPanelLabel( { blockName } );
|
|
16
21
|
|
|
17
22
|
return (
|
|
@@ -23,26 +28,33 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
|
|
|
23
28
|
</PanelBody>
|
|
24
29
|
</div>
|
|
25
30
|
) }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
{ ! isSectionBlock && (
|
|
32
|
+
<>
|
|
33
|
+
<InspectorControls.Slot
|
|
34
|
+
group="color"
|
|
35
|
+
label={ __( 'Color' ) }
|
|
36
|
+
className="color-block-support-panel__inner-wrapper"
|
|
37
|
+
/>
|
|
38
|
+
<InspectorControls.Slot
|
|
39
|
+
group="background"
|
|
40
|
+
label={ __( 'Background image' ) }
|
|
41
|
+
/>
|
|
42
|
+
<InspectorControls.Slot group="filter" />
|
|
43
|
+
<InspectorControls.Slot
|
|
44
|
+
group="typography"
|
|
45
|
+
label={ __( 'Typography' ) }
|
|
46
|
+
/>
|
|
47
|
+
<InspectorControls.Slot
|
|
48
|
+
group="dimensions"
|
|
49
|
+
label={ __( 'Dimensions' ) }
|
|
50
|
+
/>
|
|
51
|
+
<InspectorControls.Slot
|
|
52
|
+
group="border"
|
|
53
|
+
label={ borderPanelLabel }
|
|
54
|
+
/>
|
|
55
|
+
<InspectorControls.Slot group="styles" />
|
|
56
|
+
</>
|
|
57
|
+
) }
|
|
46
58
|
</>
|
|
47
59
|
);
|
|
48
60
|
};
|
|
@@ -10,7 +10,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
10
10
|
import InspectorControlsGroups from '../inspector-controls/groups';
|
|
11
11
|
import useIsListViewTabDisabled from './use-is-list-view-tab-disabled';
|
|
12
12
|
import { InspectorAdvancedControls } from '../inspector-controls';
|
|
13
|
-
import { TAB_LIST_VIEW, TAB_SETTINGS, TAB_STYLES } from './utils';
|
|
13
|
+
import { TAB_LIST_VIEW, TAB_SETTINGS, TAB_STYLES, TAB_CONTENT } from './utils';
|
|
14
14
|
import { store as blockEditorStore } from '../../store';
|
|
15
15
|
|
|
16
16
|
const EMPTY_ARRAY = [];
|
|
@@ -29,7 +29,12 @@ function getShowTabs( blockName, tabSettings = {} ) {
|
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export default function useInspectorControlsTabs(
|
|
32
|
+
export default function useInspectorControlsTabs(
|
|
33
|
+
blockName,
|
|
34
|
+
contentClientIds,
|
|
35
|
+
isSectionBlock,
|
|
36
|
+
hasBlockStyles
|
|
37
|
+
) {
|
|
33
38
|
const tabs = [];
|
|
34
39
|
const {
|
|
35
40
|
bindings: bindingsGroup,
|
|
@@ -76,17 +81,25 @@ export default function useInspectorControlsTabs( blockName ) {
|
|
|
76
81
|
...( hasListFills && hasStyleFills > 1 ? advancedFills : [] ),
|
|
77
82
|
];
|
|
78
83
|
|
|
84
|
+
const hasContentTab = !! (
|
|
85
|
+
contentClientIds && contentClientIds.length > 0
|
|
86
|
+
);
|
|
87
|
+
|
|
79
88
|
// Add the tabs in the order that they will default to if available.
|
|
80
|
-
// List View > Settings > Styles.
|
|
81
|
-
if ( hasListFills ) {
|
|
89
|
+
// List View > Content > Settings > Styles.
|
|
90
|
+
if ( hasListFills && ! isSectionBlock ) {
|
|
82
91
|
tabs.push( TAB_LIST_VIEW );
|
|
83
92
|
}
|
|
84
93
|
|
|
85
|
-
if (
|
|
94
|
+
if ( hasContentTab ) {
|
|
95
|
+
tabs.push( TAB_CONTENT );
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if ( settingsFills.length && ! isSectionBlock ) {
|
|
86
99
|
tabs.push( TAB_SETTINGS );
|
|
87
100
|
}
|
|
88
101
|
|
|
89
|
-
if ( hasStyleFills ) {
|
|
102
|
+
if ( isSectionBlock ? hasBlockStyles : hasStyleFills ) {
|
|
90
103
|
tabs.push( TAB_STYLES );
|
|
91
104
|
}
|
|
92
105
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { cog, styles, listView } from '@wordpress/icons';
|
|
4
|
+
import { cog, styles, listView, page } from '@wordpress/icons';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
export const TAB_SETTINGS = {
|
|
@@ -18,6 +18,13 @@ export const TAB_STYLES = {
|
|
|
18
18
|
icon: styles,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
export const TAB_CONTENT = {
|
|
22
|
+
name: 'content',
|
|
23
|
+
title: __( 'Content' ),
|
|
24
|
+
value: 'content',
|
|
25
|
+
icon: page,
|
|
26
|
+
};
|
|
27
|
+
|
|
21
28
|
export const TAB_LIST_VIEW = {
|
|
22
29
|
name: 'list',
|
|
23
30
|
title: __( 'List View' ),
|