@wordpress/edit-site 4.13.1-next.957ca95e4c.0 → 4.14.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/CHANGELOG.md +2 -0
- package/build/components/block-editor/index.js +20 -10
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +8 -1
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/index.js +9 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +6 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +4 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +41 -29
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/index.js +41 -5
- package/build/components/header/index.js.map +1 -1
- package/build/components/list/header.js +15 -2
- package/build/components/list/header.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +10 -4
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +8 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +16 -0
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/index.js +4 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +20 -9
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +9 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/index.js +10 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +6 -2
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +42 -30
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/index.js +42 -7
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/list/header.js +14 -2
- package/build-module/components/list/header.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +11 -5
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +7 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +16 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +28 -16
- package/build-style/style.css +28 -16
- package/package.json +29 -29
- package/src/components/block-editor/index.js +34 -16
- package/src/components/block-editor/resizable-editor.js +10 -3
- package/src/components/code-editor/style.scss +2 -3
- package/src/components/editor/index.js +12 -5
- package/src/components/global-styles/gradients-palette-panel.js +25 -12
- package/src/components/global-styles/hooks.js +5 -3
- package/src/components/global-styles/use-global-styles-output.js +66 -57
- package/src/components/header/index.js +61 -21
- package/src/components/header/style.scss +9 -0
- package/src/components/list/header.js +15 -5
- package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
- package/src/components/sidebar/index.js +23 -20
- package/src/components/template-part-converter/convert-to-template-part.js +14 -1
- package/src/index.js +4 -0
- package/src/style.scss +1 -0
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { omit, unionBy } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -80,31 +79,50 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
80
79
|
);
|
|
81
80
|
|
|
82
81
|
const blockPatterns = useMemo(
|
|
83
|
-
() =>
|
|
84
|
-
|
|
82
|
+
() =>
|
|
83
|
+
[
|
|
84
|
+
...( settingsBlockPatterns || [] ),
|
|
85
|
+
...( restBlockPatterns || [] ),
|
|
86
|
+
]
|
|
87
|
+
.filter(
|
|
88
|
+
( x, index, arr ) =>
|
|
89
|
+
index === arr.findIndex( ( y ) => x.name === y.name )
|
|
90
|
+
)
|
|
91
|
+
.filter( ( { postTypes } ) => {
|
|
92
|
+
return (
|
|
93
|
+
! postTypes ||
|
|
94
|
+
( Array.isArray( postTypes ) &&
|
|
95
|
+
postTypes.includes( templateType ) )
|
|
96
|
+
);
|
|
97
|
+
} ),
|
|
98
|
+
[ settingsBlockPatterns, restBlockPatterns, templateType ]
|
|
85
99
|
);
|
|
86
100
|
|
|
87
101
|
const blockPatternCategories = useMemo(
|
|
88
102
|
() =>
|
|
89
|
-
|
|
90
|
-
settingsBlockPatternCategories,
|
|
91
|
-
restBlockPatternCategories,
|
|
92
|
-
|
|
103
|
+
[
|
|
104
|
+
...( settingsBlockPatternCategories || [] ),
|
|
105
|
+
...( restBlockPatternCategories || [] ),
|
|
106
|
+
].filter(
|
|
107
|
+
( x, index, arr ) =>
|
|
108
|
+
index === arr.findIndex( ( y ) => x.name === y.name )
|
|
93
109
|
),
|
|
94
110
|
[ settingsBlockPatternCategories, restBlockPatternCategories ]
|
|
95
111
|
);
|
|
96
112
|
|
|
97
|
-
const settings = useMemo(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
const settings = useMemo( () => {
|
|
114
|
+
const {
|
|
115
|
+
__experimentalAdditionalBlockPatterns,
|
|
116
|
+
__experimentalAdditionalBlockPatternCategories,
|
|
117
|
+
...restStoredSettings
|
|
118
|
+
} = storedSettings;
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
...restStoredSettings,
|
|
103
122
|
__experimentalBlockPatterns: blockPatterns,
|
|
104
123
|
__experimentalBlockPatternCategories: blockPatternCategories,
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
);
|
|
124
|
+
};
|
|
125
|
+
}, [ storedSettings, blockPatterns, blockPatternCategories ] );
|
|
108
126
|
|
|
109
127
|
const [ blocks, onInput, onChange ] = useEntityBlockEditor(
|
|
110
128
|
'postType',
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
__unstableEditorStyles as EditorStyles,
|
|
9
9
|
__unstableIframe as Iframe,
|
|
10
10
|
__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,
|
|
11
|
+
store as blockEditorStore,
|
|
11
12
|
} from '@wordpress/block-editor';
|
|
12
13
|
import { useSelect } from '@wordpress/data';
|
|
13
14
|
import { useMergeRefs } from '@wordpress/compose';
|
|
@@ -37,9 +38,14 @@ const HANDLE_STYLES_OVERRIDE = {
|
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
function ResizableEditor( { enableResizing, settings, children, ...props } ) {
|
|
40
|
-
const deviceType = useSelect(
|
|
41
|
-
( select ) =>
|
|
42
|
-
|
|
41
|
+
const { deviceType, isZoomOutMode } = useSelect(
|
|
42
|
+
( select ) => ( {
|
|
43
|
+
deviceType:
|
|
44
|
+
select( editSiteStore ).__experimentalGetPreviewDeviceType(),
|
|
45
|
+
isZoomOutMode:
|
|
46
|
+
select( blockEditorStore ).__unstableGetEditorMode() ===
|
|
47
|
+
'zoom-out',
|
|
48
|
+
} ),
|
|
43
49
|
[]
|
|
44
50
|
);
|
|
45
51
|
const deviceStyles = useResizeCanvas( deviceType );
|
|
@@ -163,6 +169,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
|
|
|
163
169
|
} }
|
|
164
170
|
>
|
|
165
171
|
<Iframe
|
|
172
|
+
isZoomedOut={ isZoomOutMode }
|
|
166
173
|
style={ enableResizing ? { height } : deviceStyles }
|
|
167
174
|
head={
|
|
168
175
|
<>
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
&__body {
|
|
8
8
|
width: 100%;
|
|
9
|
-
padding:
|
|
9
|
+
padding: $grid-unit-15;
|
|
10
10
|
max-width: $break-xlarge;
|
|
11
11
|
margin-left: auto;
|
|
12
12
|
margin-right: auto;
|
|
13
13
|
|
|
14
14
|
@include break-large() {
|
|
15
|
-
padding: $grid-unit-
|
|
16
|
-
padding: 0 $grid-unit-30 $grid-unit-30 $grid-unit-30;
|
|
15
|
+
padding: $grid-unit-30;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
BlockContextProvider,
|
|
10
10
|
BlockBreadcrumb,
|
|
11
11
|
BlockStyles,
|
|
12
|
+
store as blockEditorStore,
|
|
12
13
|
} from '@wordpress/block-editor';
|
|
13
14
|
import {
|
|
14
15
|
InterfaceSkeleton,
|
|
@@ -77,6 +78,7 @@ function Editor( { onError } ) {
|
|
|
77
78
|
nextShortcut,
|
|
78
79
|
editorMode,
|
|
79
80
|
showIconLabels,
|
|
81
|
+
blockEditorMode,
|
|
80
82
|
} = useSelect( ( select ) => {
|
|
81
83
|
const {
|
|
82
84
|
isInserterOpened,
|
|
@@ -89,6 +91,7 @@ function Editor( { onError } ) {
|
|
|
89
91
|
getEditorMode,
|
|
90
92
|
} = select( editSiteStore );
|
|
91
93
|
const { hasFinishedResolution, getEntityRecord } = select( coreStore );
|
|
94
|
+
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
92
95
|
const postType = getEditedPostType();
|
|
93
96
|
const postId = getEditedPostId();
|
|
94
97
|
|
|
@@ -125,6 +128,7 @@ function Editor( { onError } ) {
|
|
|
125
128
|
'core/edit-site',
|
|
126
129
|
'showIconLabels'
|
|
127
130
|
),
|
|
131
|
+
blockEditorMode: __unstableGetEditorMode(),
|
|
128
132
|
};
|
|
129
133
|
}, [] );
|
|
130
134
|
const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
|
|
@@ -320,11 +324,14 @@ function Editor( { onError } ) {
|
|
|
320
324
|
</>
|
|
321
325
|
}
|
|
322
326
|
footer={
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
327
|
+
blockEditorMode !==
|
|
328
|
+
'zoom-out' ? (
|
|
329
|
+
<BlockBreadcrumb
|
|
330
|
+
rootLabelText={ __(
|
|
331
|
+
'Template'
|
|
332
|
+
) }
|
|
333
|
+
/>
|
|
334
|
+
) : undefined
|
|
328
335
|
}
|
|
329
336
|
shortcuts={ {
|
|
330
337
|
previous: previousShortcut,
|
|
@@ -45,7 +45,18 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
45
45
|
'color.defaultGradients',
|
|
46
46
|
name
|
|
47
47
|
);
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
const [ customDuotone ] = useSetting( 'color.duotone.custom' ) || [];
|
|
50
|
+
const [ defaultDuotone ] = useSetting( 'color.duotone.default' ) || [];
|
|
51
|
+
const [ themeDuotone ] = useSetting( 'color.duotone.theme' ) || [];
|
|
52
|
+
const [ defaultDuotoneEnabled ] = useSetting( 'color.defaultDuotone' );
|
|
53
|
+
|
|
54
|
+
const duotonePalette = [
|
|
55
|
+
...( customDuotone || [] ),
|
|
56
|
+
...( themeDuotone || [] ),
|
|
57
|
+
...( defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [] ),
|
|
58
|
+
];
|
|
59
|
+
|
|
49
60
|
return (
|
|
50
61
|
<VStack
|
|
51
62
|
className="edit-site-global-styles-gradient-palette-panel"
|
|
@@ -80,17 +91,19 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
80
91
|
) }
|
|
81
92
|
slugPrefix="custom-"
|
|
82
93
|
/>
|
|
83
|
-
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
{ !! duotonePalette && !! duotonePalette.length && (
|
|
95
|
+
<div>
|
|
96
|
+
<Subtitle>{ __( 'Duotone' ) }</Subtitle>
|
|
97
|
+
<Spacer margin={ 3 } />
|
|
98
|
+
<DuotonePicker
|
|
99
|
+
duotonePalette={ duotonePalette }
|
|
100
|
+
disableCustomDuotone={ true }
|
|
101
|
+
disableCustomColors={ true }
|
|
102
|
+
clearable={ false }
|
|
103
|
+
onChange={ noop }
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
) }
|
|
94
107
|
</VStack>
|
|
95
108
|
);
|
|
96
109
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get,
|
|
4
|
+
import { get, set, isEqual } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -48,7 +48,8 @@ export function useSetting( path, blockName, source = 'all' ) {
|
|
|
48
48
|
|
|
49
49
|
const setSetting = ( newValue ) => {
|
|
50
50
|
setUserConfig( ( currentConfig ) => {
|
|
51
|
-
|
|
51
|
+
// Deep clone `currentConfig` to avoid mutating it later.
|
|
52
|
+
const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
|
|
52
53
|
const pathToSet = PATHS_WITH_MERGE[ path ]
|
|
53
54
|
? fullPath + '.custom'
|
|
54
55
|
: fullPath;
|
|
@@ -109,7 +110,8 @@ export function useStyle( path, blockName, source = 'all' ) {
|
|
|
109
110
|
|
|
110
111
|
const setStyle = ( newValue ) => {
|
|
111
112
|
setUserConfig( ( currentConfig ) => {
|
|
112
|
-
|
|
113
|
+
// Deep clone `currentConfig` to avoid mutating it later.
|
|
114
|
+
const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
|
|
113
115
|
set(
|
|
114
116
|
newUserConfig,
|
|
115
117
|
finalPath,
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
first,
|
|
6
|
-
forEach,
|
|
7
|
-
get,
|
|
8
|
-
isEmpty,
|
|
9
|
-
kebabCase,
|
|
10
|
-
pickBy,
|
|
11
|
-
reduce,
|
|
12
|
-
set,
|
|
13
|
-
} from 'lodash';
|
|
4
|
+
import { get, isEmpty, kebabCase, pickBy, reduce, set } from 'lodash';
|
|
14
5
|
|
|
15
6
|
/**
|
|
16
7
|
* WordPress dependencies
|
|
@@ -208,7 +199,7 @@ export function getStylesDeclarations(
|
|
|
208
199
|
return declarations;
|
|
209
200
|
}
|
|
210
201
|
const pathToValue = value;
|
|
211
|
-
if (
|
|
202
|
+
if ( pathToValue[ 0 ] === 'elements' || useEngine ) {
|
|
212
203
|
return declarations;
|
|
213
204
|
}
|
|
214
205
|
|
|
@@ -330,8 +321,8 @@ export function getLayoutStyles( {
|
|
|
330
321
|
if ( gapValue && tree?.settings?.layout?.definitions ) {
|
|
331
322
|
Object.values( tree.settings.layout.definitions ).forEach(
|
|
332
323
|
( { className, name, spacingStyles } ) => {
|
|
333
|
-
// Allow
|
|
334
|
-
if ( ! hasBlockGapSupport && '
|
|
324
|
+
// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
|
|
325
|
+
if ( ! hasBlockGapSupport && 'flex' !== name ) {
|
|
335
326
|
return;
|
|
336
327
|
}
|
|
337
328
|
|
|
@@ -457,7 +448,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
457
448
|
} );
|
|
458
449
|
}
|
|
459
450
|
|
|
460
|
-
|
|
451
|
+
Object.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {
|
|
461
452
|
if ( !! tree.styles?.elements[ name ] ) {
|
|
462
453
|
nodes.push( {
|
|
463
454
|
styles: tree.styles?.elements[ name ],
|
|
@@ -467,42 +458,53 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
467
458
|
} );
|
|
468
459
|
|
|
469
460
|
// Iterate over blocks: they can have styles & elements.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
nodes.push( {
|
|
474
|
-
duotoneSelector: blockSelectors[ blockName ].duotoneSelector,
|
|
475
|
-
fallbackGapValue: blockSelectors[ blockName ].fallbackGapValue,
|
|
476
|
-
hasLayoutSupport: blockSelectors[ blockName ].hasLayoutSupport,
|
|
477
|
-
selector: blockSelectors[ blockName ].selector,
|
|
478
|
-
styles: blockStyles,
|
|
479
|
-
featureSelectors: blockSelectors[ blockName ].featureSelectors,
|
|
480
|
-
} );
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
forEach( node?.elements, ( value, elementName ) => {
|
|
461
|
+
Object.entries( tree.styles?.blocks ?? {} ).forEach(
|
|
462
|
+
( [ blockName, node ] ) => {
|
|
463
|
+
const blockStyles = pickStyleKeys( node );
|
|
484
464
|
if (
|
|
485
|
-
!!
|
|
486
|
-
!! blockSelectors?.[ blockName ]
|
|
487
|
-
!! ELEMENTS?.[ elementName ]
|
|
465
|
+
!! blockStyles &&
|
|
466
|
+
!! blockSelectors?.[ blockName ]?.selector
|
|
488
467
|
) {
|
|
489
468
|
nodes.push( {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
} )
|
|
501
|
-
.join( ',' ),
|
|
469
|
+
duotoneSelector:
|
|
470
|
+
blockSelectors[ blockName ].duotoneSelector,
|
|
471
|
+
fallbackGapValue:
|
|
472
|
+
blockSelectors[ blockName ].fallbackGapValue,
|
|
473
|
+
hasLayoutSupport:
|
|
474
|
+
blockSelectors[ blockName ].hasLayoutSupport,
|
|
475
|
+
selector: blockSelectors[ blockName ].selector,
|
|
476
|
+
styles: blockStyles,
|
|
477
|
+
featureSelectors:
|
|
478
|
+
blockSelectors[ blockName ].featureSelectors,
|
|
502
479
|
} );
|
|
503
480
|
}
|
|
504
|
-
|
|
505
|
-
|
|
481
|
+
|
|
482
|
+
Object.entries( node?.elements ?? {} ).forEach(
|
|
483
|
+
( [ elementName, value ] ) => {
|
|
484
|
+
if (
|
|
485
|
+
!! value &&
|
|
486
|
+
!! blockSelectors?.[ blockName ] &&
|
|
487
|
+
!! ELEMENTS?.[ elementName ]
|
|
488
|
+
) {
|
|
489
|
+
nodes.push( {
|
|
490
|
+
styles: value,
|
|
491
|
+
selector: blockSelectors[ blockName ].selector
|
|
492
|
+
.split( ',' )
|
|
493
|
+
.map( ( sel ) => {
|
|
494
|
+
const elementSelectors =
|
|
495
|
+
ELEMENTS[ elementName ].split( ',' );
|
|
496
|
+
return elementSelectors.map(
|
|
497
|
+
( elementSelector ) =>
|
|
498
|
+
sel + ' ' + elementSelector
|
|
499
|
+
);
|
|
500
|
+
} )
|
|
501
|
+
.join( ',' ),
|
|
502
|
+
} );
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
);
|
|
506
508
|
|
|
507
509
|
return nodes;
|
|
508
510
|
};
|
|
@@ -537,17 +539,19 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
537
539
|
}
|
|
538
540
|
|
|
539
541
|
// Blocks.
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
542
|
+
Object.entries( tree.settings?.blocks ?? {} ).forEach(
|
|
543
|
+
( [ blockName, node ] ) => {
|
|
544
|
+
const blockPresets = pickPresets( node );
|
|
545
|
+
const blockCustom = node.custom;
|
|
546
|
+
if ( ! isEmpty( blockPresets ) || !! blockCustom ) {
|
|
547
|
+
nodes.push( {
|
|
548
|
+
presets: blockPresets,
|
|
549
|
+
custom: blockCustom,
|
|
550
|
+
selector: blockSelectors[ blockName ].selector,
|
|
551
|
+
} );
|
|
552
|
+
}
|
|
549
553
|
}
|
|
550
|
-
|
|
554
|
+
);
|
|
551
555
|
|
|
552
556
|
return nodes;
|
|
553
557
|
};
|
|
@@ -601,8 +605,13 @@ export const toStyles = (
|
|
|
601
605
|
}
|
|
602
606
|
|
|
603
607
|
if ( useRootPaddingAlign ) {
|
|
604
|
-
ruleset +=
|
|
605
|
-
|
|
608
|
+
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
609
|
+
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
610
|
+
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
|
|
611
|
+
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
612
|
+
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
613
|
+
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
614
|
+
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
|
|
606
615
|
}
|
|
607
616
|
|
|
608
617
|
ruleset += '}';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -7,11 +12,12 @@ import {
|
|
|
7
12
|
ToolSelector,
|
|
8
13
|
__experimentalPreviewOptions as PreviewOptions,
|
|
9
14
|
NavigableToolbar,
|
|
15
|
+
store as blockEditorStore,
|
|
10
16
|
} from '@wordpress/block-editor';
|
|
11
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
18
|
import { PinnedItems } from '@wordpress/interface';
|
|
13
19
|
import { _x, __ } from '@wordpress/i18n';
|
|
14
|
-
import { listView, plus, external } from '@wordpress/icons';
|
|
20
|
+
import { listView, plus, external, chevronUpDown } from '@wordpress/icons';
|
|
15
21
|
import {
|
|
16
22
|
Button,
|
|
17
23
|
ToolbarItem,
|
|
@@ -55,6 +61,7 @@ export default function Header( {
|
|
|
55
61
|
isLoaded,
|
|
56
62
|
isVisualMode,
|
|
57
63
|
settings,
|
|
64
|
+
blockEditorMode,
|
|
58
65
|
} = useSelect( ( select ) => {
|
|
59
66
|
const {
|
|
60
67
|
__experimentalGetPreviewDeviceType,
|
|
@@ -69,6 +76,7 @@ export default function Header( {
|
|
|
69
76
|
const { __experimentalGetTemplateInfo: getTemplateInfo } =
|
|
70
77
|
select( editorStore );
|
|
71
78
|
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
79
|
+
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
72
80
|
|
|
73
81
|
const postType = getEditedPostType();
|
|
74
82
|
const postId = getEditedPostId();
|
|
@@ -88,6 +96,7 @@ export default function Header( {
|
|
|
88
96
|
),
|
|
89
97
|
isVisualMode: getEditorMode() === 'visual',
|
|
90
98
|
settings: getSettings(),
|
|
99
|
+
blockEditorMode: __unstableGetEditorMode(),
|
|
91
100
|
};
|
|
92
101
|
}, [] );
|
|
93
102
|
|
|
@@ -96,6 +105,7 @@ export default function Header( {
|
|
|
96
105
|
setIsInserterOpened,
|
|
97
106
|
setIsListViewOpened,
|
|
98
107
|
} = useDispatch( editSiteStore );
|
|
108
|
+
const { __unstableSetEditorMode } = useDispatch( blockEditorStore );
|
|
99
109
|
|
|
100
110
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
101
111
|
|
|
@@ -122,6 +132,10 @@ export default function Header( {
|
|
|
122
132
|
);
|
|
123
133
|
const shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );
|
|
124
134
|
|
|
135
|
+
const isZoomedOutViewExperimentEnabled =
|
|
136
|
+
window?.__experimentalEnableZoomedOutView && isVisualMode;
|
|
137
|
+
const isZoomedOutView = blockEditorMode === 'zoom-out';
|
|
138
|
+
|
|
125
139
|
return (
|
|
126
140
|
<div className="edit-site-header">
|
|
127
141
|
<NavigableToolbar
|
|
@@ -169,8 +183,8 @@ export default function Header( {
|
|
|
169
183
|
<ToolbarItem
|
|
170
184
|
as={ Button }
|
|
171
185
|
className="edit-site-header-toolbar__list-view-toggle"
|
|
186
|
+
disabled={ ! isVisualMode && isZoomedOutView }
|
|
172
187
|
icon={ listView }
|
|
173
|
-
disabled={ ! isVisualMode }
|
|
174
188
|
isPressed={ isListViewOpen }
|
|
175
189
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
176
190
|
label={ __( 'List View' ) }
|
|
@@ -181,6 +195,25 @@ export default function Header( {
|
|
|
181
195
|
showIconLabels ? 'tertiary' : undefined
|
|
182
196
|
}
|
|
183
197
|
/>
|
|
198
|
+
{ isZoomedOutViewExperimentEnabled && (
|
|
199
|
+
<ToolbarItem
|
|
200
|
+
as={ Button }
|
|
201
|
+
className="edit-site-header-toolbar__zoom-out-view-toggle"
|
|
202
|
+
icon={ chevronUpDown }
|
|
203
|
+
isPressed={ isZoomedOutView }
|
|
204
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
205
|
+
label={ __( 'Zoom-out View' ) }
|
|
206
|
+
onClick={ () => {
|
|
207
|
+
setPreviewDeviceType( 'desktop' );
|
|
208
|
+
setIsListViewOpened( false );
|
|
209
|
+
__unstableSetEditorMode(
|
|
210
|
+
isZoomedOutView
|
|
211
|
+
? 'edit'
|
|
212
|
+
: 'zoom-out'
|
|
213
|
+
);
|
|
214
|
+
} }
|
|
215
|
+
/>
|
|
216
|
+
) }
|
|
184
217
|
</>
|
|
185
218
|
) }
|
|
186
219
|
</div>
|
|
@@ -209,26 +242,33 @@ export default function Header( {
|
|
|
209
242
|
<div className="edit-site-header_end">
|
|
210
243
|
<div className="edit-site-header__actions">
|
|
211
244
|
{ ! isFocusMode && (
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
245
|
+
<div
|
|
246
|
+
className={ classnames(
|
|
247
|
+
'edit-site-header__actions__preview-options',
|
|
248
|
+
{ 'is-zoomed-out': isZoomedOutView }
|
|
249
|
+
) }
|
|
215
250
|
>
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
251
|
+
<PreviewOptions
|
|
252
|
+
deviceType={ deviceType }
|
|
253
|
+
setDeviceType={ setPreviewDeviceType }
|
|
254
|
+
>
|
|
255
|
+
<MenuGroup>
|
|
256
|
+
<MenuItem
|
|
257
|
+
href={ settings?.siteUrl }
|
|
258
|
+
target="_blank"
|
|
259
|
+
icon={ external }
|
|
260
|
+
>
|
|
261
|
+
{ __( 'View site' ) }
|
|
262
|
+
<VisuallyHidden as="span">
|
|
263
|
+
{
|
|
264
|
+
/* translators: accessibility text */
|
|
265
|
+
__( '(opens in a new tab)' )
|
|
266
|
+
}
|
|
267
|
+
</VisuallyHidden>
|
|
268
|
+
</MenuItem>
|
|
269
|
+
</MenuGroup>
|
|
270
|
+
</PreviewOptions>
|
|
271
|
+
</div>
|
|
232
272
|
) }
|
|
233
273
|
<SaveButton
|
|
234
274
|
openEntitiesSavedStates={ openEntitiesSavedStates }
|
|
@@ -135,6 +135,15 @@ body.is-navigation-sidebar-open {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
.edit-site-header__actions__preview-options {
|
|
139
|
+
opacity: 1;
|
|
140
|
+
transition: opacity 0.3s;
|
|
141
|
+
|
|
142
|
+
&.is-zoomed-out {
|
|
143
|
+
opacity: 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
138
147
|
.edit-site-header__actions-more-menu {
|
|
139
148
|
margin-left: -4px;
|
|
140
149
|
|
|
@@ -9,10 +9,18 @@ import { __experimentalHeading as Heading } from '@wordpress/components';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import AddNewTemplate from '../add-new-template';
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
12
13
|
|
|
13
14
|
export default function Header( { templateType } ) {
|
|
14
|
-
const postType = useSelect(
|
|
15
|
-
( select ) =>
|
|
15
|
+
const { canCreate, postType } = useSelect(
|
|
16
|
+
( select ) => {
|
|
17
|
+
const { supportsTemplatePartsMode } =
|
|
18
|
+
select( editSiteStore ).getSettings();
|
|
19
|
+
return {
|
|
20
|
+
postType: select( coreStore ).getPostType( templateType ),
|
|
21
|
+
canCreate: ! supportsTemplatePartsMode,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
16
24
|
[ templateType ]
|
|
17
25
|
);
|
|
18
26
|
|
|
@@ -26,9 +34,11 @@ export default function Header( { templateType } ) {
|
|
|
26
34
|
{ postType.labels?.name }
|
|
27
35
|
</Heading>
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
37
|
+
{ canCreate && (
|
|
38
|
+
<div className="edit-site-list-header__right">
|
|
39
|
+
<AddNewTemplate templateType={ templateType } />
|
|
40
|
+
</div>
|
|
41
|
+
) }
|
|
32
42
|
</header>
|
|
33
43
|
);
|
|
34
44
|
}
|