@wordpress/edit-site 4.3.2 → 4.4.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/resizable-editor.js +2 -1
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +2 -1
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/global-styles/border-panel.js +100 -79
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +91 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +12 -2
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -1
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +2 -1
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +103 -80
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +87 -13
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +12 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-style/style-rtl.css +39 -0
- package/build-style/style.css +39 -0
- package/package.json +29 -29
- package/src/components/block-editor/resizable-editor.js +6 -2
- package/src/components/editor/global-styles-renderer.js +2 -1
- package/src/components/global-styles/border-panel.js +112 -109
- package/src/components/global-styles/test/use-global-styles-output.js +4 -1
- package/src/components/global-styles/use-global-styles-output.js +112 -17
- package/src/components/global-styles/utils.js +6 -0
- package/src/components/sidebar/navigation-menu-sidebar/index.js +4 -1
- package/src/components/sidebar/style.scss +50 -0
package/build-style/style.css
CHANGED
|
@@ -1542,6 +1542,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1542
1542
|
padding: 16px;
|
|
1543
1543
|
}
|
|
1544
1544
|
|
|
1545
|
+
.edit-site-navigation-sidebar__beta,
|
|
1545
1546
|
.edit-site-global-styles-sidebar__beta {
|
|
1546
1547
|
display: inline-flex;
|
|
1547
1548
|
margin-left: 8px;
|
|
@@ -1555,6 +1556,44 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1555
1556
|
line-height: 1;
|
|
1556
1557
|
}
|
|
1557
1558
|
|
|
1559
|
+
.edit-site-global-styles-sidebar__border-box-control__popover .components-popover__content,
|
|
1560
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top .components-popover__content,
|
|
1561
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right .components-popover__content,
|
|
1562
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom .components-popover__content,
|
|
1563
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left .components-popover__content {
|
|
1564
|
+
width: 282px;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
@media (min-width: 782px) {
|
|
1568
|
+
.edit-site-global-styles-sidebar__border-box-control__popover .components-popover__content,
|
|
1569
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left .components-popover__content {
|
|
1570
|
+
margin-right: 52px !important;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top .components-popover__content,
|
|
1574
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom .components-popover__content {
|
|
1575
|
+
margin-right: 107px !important;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right .components-popover__content {
|
|
1579
|
+
margin-right: 162px !important;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.edit-site-global-styles-sidebar__border-box-control__popover.is-from-top .components-popover__content,
|
|
1583
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top.is-from-top .components-popover__content,
|
|
1584
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right.is-from-top .components-popover__content,
|
|
1585
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom.is-from-top .components-popover__content,
|
|
1586
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left.is-from-top .components-popover__content {
|
|
1587
|
+
margin-top: -52px !important;
|
|
1588
|
+
}
|
|
1589
|
+
.edit-site-global-styles-sidebar__border-box-control__popover.is-from-bottom .components-popover__content,
|
|
1590
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-top.is-from-bottom .components-popover__content,
|
|
1591
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-right.is-from-bottom .components-popover__content,
|
|
1592
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-bottom.is-from-bottom .components-popover__content,
|
|
1593
|
+
.edit-site-global-styles-sidebar__border-box-control__popover-left.is-from-bottom .components-popover__content {
|
|
1594
|
+
margin-bottom: -52px !important;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1558
1597
|
.components-panel__header.edit-site-sidebar__panel-tabs {
|
|
1559
1598
|
justify-content: flex-start;
|
|
1560
1599
|
padding-left: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,33 +27,33 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^8.
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/html-entities": "^3.
|
|
44
|
-
"@wordpress/i18n": "^4.
|
|
45
|
-
"@wordpress/icons": "^8.
|
|
46
|
-
"@wordpress/interface": "^4.
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
48
|
-
"@wordpress/keycodes": "^3.
|
|
49
|
-
"@wordpress/media-utils": "^3.
|
|
50
|
-
"@wordpress/notices": "^3.
|
|
51
|
-
"@wordpress/plugins": "^4.
|
|
52
|
-
"@wordpress/preferences": "^1.
|
|
53
|
-
"@wordpress/reusable-blocks": "^3.
|
|
54
|
-
"@wordpress/style-engine": "^0.
|
|
55
|
-
"@wordpress/url": "^3.
|
|
56
|
-
"@wordpress/viewport": "^4.
|
|
30
|
+
"@wordpress/a11y": "^3.7.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.4.0",
|
|
32
|
+
"@wordpress/block-editor": "^8.6.0",
|
|
33
|
+
"@wordpress/block-library": "^7.4.0",
|
|
34
|
+
"@wordpress/blocks": "^11.6.0",
|
|
35
|
+
"@wordpress/components": "^19.9.0",
|
|
36
|
+
"@wordpress/compose": "^5.5.0",
|
|
37
|
+
"@wordpress/core-data": "^4.5.0",
|
|
38
|
+
"@wordpress/data": "^6.7.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.7.0",
|
|
40
|
+
"@wordpress/editor": "^12.6.0",
|
|
41
|
+
"@wordpress/element": "^4.5.0",
|
|
42
|
+
"@wordpress/hooks": "^3.7.0",
|
|
43
|
+
"@wordpress/html-entities": "^3.7.0",
|
|
44
|
+
"@wordpress/i18n": "^4.7.0",
|
|
45
|
+
"@wordpress/icons": "^8.3.0",
|
|
46
|
+
"@wordpress/interface": "^4.6.0",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^3.5.0",
|
|
48
|
+
"@wordpress/keycodes": "^3.7.0",
|
|
49
|
+
"@wordpress/media-utils": "^3.5.0",
|
|
50
|
+
"@wordpress/notices": "^3.7.0",
|
|
51
|
+
"@wordpress/plugins": "^4.5.0",
|
|
52
|
+
"@wordpress/preferences": "^1.3.0",
|
|
53
|
+
"@wordpress/reusable-blocks": "^3.5.0",
|
|
54
|
+
"@wordpress/style-engine": "^0.6.0",
|
|
55
|
+
"@wordpress/url": "^3.8.0",
|
|
56
|
+
"@wordpress/viewport": "^4.5.0",
|
|
57
57
|
"classnames": "^2.3.1",
|
|
58
58
|
"downloadjs": "^1.4.7",
|
|
59
59
|
"history": "^5.1.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
|
|
72
72
|
}
|
|
@@ -36,7 +36,7 @@ const HANDLE_STYLES_OVERRIDE = {
|
|
|
36
36
|
left: undefined,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
function ResizableEditor( { enableResizing, settings, ...props } ) {
|
|
39
|
+
function ResizableEditor( { enableResizing, settings, children, ...props } ) {
|
|
40
40
|
const deviceType = useSelect(
|
|
41
41
|
( select ) =>
|
|
42
42
|
select( editSiteStore ).__experimentalGetPreviewDeviceType(),
|
|
@@ -182,7 +182,11 @@ function ResizableEditor( { enableResizing, settings, ...props } ) {
|
|
|
182
182
|
name="editor-canvas"
|
|
183
183
|
className="edit-site-visual-editor__editor-canvas"
|
|
184
184
|
{ ...props }
|
|
185
|
-
|
|
185
|
+
>
|
|
186
|
+
{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }
|
|
187
|
+
{ settings.svgFilters }
|
|
188
|
+
{ children }
|
|
189
|
+
</Iframe>
|
|
186
190
|
</ResizableBox>
|
|
187
191
|
);
|
|
188
192
|
}
|
|
@@ -20,7 +20,7 @@ import { store as editSiteStore } from '../../store';
|
|
|
20
20
|
import { useGlobalStylesOutput } from '../global-styles/use-global-styles-output';
|
|
21
21
|
|
|
22
22
|
function useGlobalStylesRenderer() {
|
|
23
|
-
const [ styles, settings ] = useGlobalStylesOutput();
|
|
23
|
+
const [ styles, settings, svgFilters ] = useGlobalStylesOutput();
|
|
24
24
|
const { getSettings } = useSelect( editSiteStore );
|
|
25
25
|
const { updateSettings } = useDispatch( editSiteStore );
|
|
26
26
|
|
|
@@ -37,6 +37,7 @@ function useGlobalStylesRenderer() {
|
|
|
37
37
|
updateSettings( {
|
|
38
38
|
...currentStoreSettings,
|
|
39
39
|
styles: [ ...nonGlobalStyles, ...styles ],
|
|
40
|
+
svgFilters,
|
|
40
41
|
__experimentalFeatures: settings,
|
|
41
42
|
} );
|
|
42
43
|
}, [ styles, settings ] );
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __experimentalBorderRadiusControl as BorderRadiusControl } from '@wordpress/block-editor';
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import {
|
|
6
|
+
__experimentalBorderBoxControl as BorderBoxControl,
|
|
7
|
+
__experimentalHasSplitBorders as hasSplitBorders,
|
|
8
|
+
__experimentalIsDefinedBorder as isDefinedBorder,
|
|
10
9
|
__experimentalToolsPanel as ToolsPanel,
|
|
11
10
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
|
-
__experimentalUnitControl as UnitControl,
|
|
13
|
-
__experimentalUseCustomUnits as useCustomUnits,
|
|
14
11
|
} from '@wordpress/components';
|
|
12
|
+
import { useCallback } from '@wordpress/element';
|
|
15
13
|
import { __ } from '@wordpress/i18n';
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -24,8 +22,6 @@ import {
|
|
|
24
22
|
useStyle,
|
|
25
23
|
} from './hooks';
|
|
26
24
|
|
|
27
|
-
const MIN_BORDER_WIDTH = 0;
|
|
28
|
-
|
|
29
25
|
export function useHasBorderPanel( name ) {
|
|
30
26
|
const controls = [
|
|
31
27
|
useHasBorderColorControl( name ),
|
|
@@ -69,63 +65,45 @@ function useHasBorderWidthControl( name ) {
|
|
|
69
65
|
);
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const createHasValueCallback = ( feature ) => () =>
|
|
77
|
-
!! userBorderStyles?.[ feature ];
|
|
68
|
+
function applyFallbackStyle( border ) {
|
|
69
|
+
if ( ! border ) {
|
|
70
|
+
return border;
|
|
71
|
+
}
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setStyle( value || undefined );
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const units = useCustomUnits( {
|
|
86
|
-
availableUnits: useSetting( 'spacing.units' )[ 0 ] || [
|
|
87
|
-
'px',
|
|
88
|
-
'em',
|
|
89
|
-
'rem',
|
|
90
|
-
],
|
|
91
|
-
} );
|
|
92
|
-
|
|
93
|
-
// Border width.
|
|
94
|
-
const showBorderWidth = useHasBorderWidthControl( name );
|
|
95
|
-
const [ borderWidthValue, setBorderWidth ] = useStyle(
|
|
96
|
-
'border.width',
|
|
97
|
-
name
|
|
98
|
-
);
|
|
73
|
+
if ( ! border.style && ( border.color || border.width ) ) {
|
|
74
|
+
return { ...border, style: 'solid' };
|
|
75
|
+
}
|
|
99
76
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );
|
|
77
|
+
return border;
|
|
78
|
+
}
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
80
|
+
function applyAllFallbackStyles( border ) {
|
|
81
|
+
if ( ! border ) {
|
|
82
|
+
return border;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ( hasSplitBorders( border ) ) {
|
|
86
|
+
return {
|
|
87
|
+
top: applyFallbackStyle( border.top ),
|
|
88
|
+
right: applyFallbackStyle( border.right ),
|
|
89
|
+
bottom: applyFallbackStyle( border.bottom ),
|
|
90
|
+
left: applyFallbackStyle( border.left ),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return applyFallbackStyle( border );
|
|
95
|
+
}
|
|
110
96
|
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
export default function BorderPanel( { name } ) {
|
|
98
|
+
// To better reflect if the user has customized a value we need to
|
|
99
|
+
// ensure the style value being checked is from the `user` origin.
|
|
100
|
+
const [ userBorderStyles ] = useStyle( 'border', name, 'user' );
|
|
101
|
+
const [ border, setBorder ] = useStyle( 'border', name );
|
|
102
|
+
const colors = useColorsPerOrigin( name );
|
|
113
103
|
|
|
114
|
-
// Border color.
|
|
115
104
|
const showBorderColor = useHasBorderColorControl( name );
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];
|
|
119
|
-
|
|
120
|
-
const borderColorSettings = [
|
|
121
|
-
{
|
|
122
|
-
label: __( 'Color' ),
|
|
123
|
-
colors: useColorsPerOrigin( name ),
|
|
124
|
-
colorValue: borderColor,
|
|
125
|
-
onColorChange: handleOnChangeWithStyle( setBorderColor ),
|
|
126
|
-
clearable: false,
|
|
127
|
-
},
|
|
128
|
-
];
|
|
105
|
+
const showBorderStyle = useHasBorderStyleControl( name );
|
|
106
|
+
const showBorderWidth = useHasBorderWidthControl( name );
|
|
129
107
|
|
|
130
108
|
// Border radius.
|
|
131
109
|
const showBorderRadius = useHasBorderRadiusControl( name );
|
|
@@ -141,60 +119,83 @@ export default function BorderPanel( { name } ) {
|
|
|
141
119
|
return !! borderValues;
|
|
142
120
|
};
|
|
143
121
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
122
|
+
const resetBorder = () => {
|
|
123
|
+
if ( hasBorderRadius() ) {
|
|
124
|
+
return setBorder( { radius: userBorderStyles.radius } );
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setBorder( undefined );
|
|
149
128
|
};
|
|
150
129
|
|
|
130
|
+
const resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );
|
|
131
|
+
const onBorderChange = useCallback(
|
|
132
|
+
( newBorder ) => {
|
|
133
|
+
// Ensure we have a visible border style when a border width or
|
|
134
|
+
// color is being selected.
|
|
135
|
+
const newBorderWithStyle = applyAllFallbackStyles( newBorder );
|
|
136
|
+
|
|
137
|
+
// As we can't conditionally generate styles based on if other
|
|
138
|
+
// style properties have been set we need to force split border
|
|
139
|
+
// definitions for user set border styles. Border radius is derived
|
|
140
|
+
// from the same property i.e. `border.radius` if it is a string
|
|
141
|
+
// that is used. The longhand border radii styles are only generated
|
|
142
|
+
// if that property is an object.
|
|
143
|
+
//
|
|
144
|
+
// For borders (color, style, and width) those are all properties on
|
|
145
|
+
// the `border` style property. This means if the theme.json defined
|
|
146
|
+
// split borders and the user condenses them into a flat border or
|
|
147
|
+
// vice-versa we'd get both sets of styles which would conflict.
|
|
148
|
+
const updatedBorder = ! hasSplitBorders( newBorderWithStyle )
|
|
149
|
+
? {
|
|
150
|
+
top: newBorderWithStyle,
|
|
151
|
+
right: newBorderWithStyle,
|
|
152
|
+
bottom: newBorderWithStyle,
|
|
153
|
+
left: newBorderWithStyle,
|
|
154
|
+
}
|
|
155
|
+
: {
|
|
156
|
+
color: null,
|
|
157
|
+
style: null,
|
|
158
|
+
width: null,
|
|
159
|
+
...newBorderWithStyle,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// As radius is maintained separately to color, style, and width
|
|
163
|
+
// maintain its value. Undefined values here will be cleaned when
|
|
164
|
+
// global styles are saved.
|
|
165
|
+
setBorder( { radius: border?.radius, ...updatedBorder } );
|
|
166
|
+
},
|
|
167
|
+
[ setBorder ]
|
|
168
|
+
);
|
|
169
|
+
|
|
151
170
|
return (
|
|
152
171
|
<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>
|
|
153
|
-
{ showBorderWidth && (
|
|
154
|
-
<ToolsPanelItem
|
|
155
|
-
className="single-column"
|
|
156
|
-
hasValue={ createHasValueCallback( 'width' ) }
|
|
157
|
-
label={ __( 'Width' ) }
|
|
158
|
-
onDeselect={ createResetCallback( setBorderWidth ) }
|
|
159
|
-
isShownByDefault={ true }
|
|
160
|
-
>
|
|
161
|
-
<UnitControl
|
|
162
|
-
value={ borderWidthValue }
|
|
163
|
-
label={ __( 'Width' ) }
|
|
164
|
-
min={ MIN_BORDER_WIDTH }
|
|
165
|
-
onChange={ handleOnChangeWithStyle( setBorderWidth ) }
|
|
166
|
-
units={ units }
|
|
167
|
-
/>
|
|
168
|
-
</ToolsPanelItem>
|
|
169
|
-
) }
|
|
170
|
-
{ showBorderStyle && (
|
|
171
|
-
<ToolsPanelItem
|
|
172
|
-
className="single-column"
|
|
173
|
-
hasValue={ createHasValueCallback( 'style' ) }
|
|
174
|
-
label={ __( 'Style' ) }
|
|
175
|
-
onDeselect={ createResetCallback( setBorderStyle ) }
|
|
176
|
-
isShownByDefault={ true }
|
|
177
|
-
>
|
|
178
|
-
<BorderStyleControl
|
|
179
|
-
value={ borderStyle }
|
|
180
|
-
onChange={ handleOnChange( setBorderStyle ) }
|
|
181
|
-
/>
|
|
182
|
-
</ToolsPanelItem>
|
|
183
|
-
) }
|
|
184
|
-
{ showBorderColor && (
|
|
172
|
+
{ ( showBorderWidth || showBorderColor ) && (
|
|
185
173
|
<ToolsPanelItem
|
|
186
|
-
hasValue={
|
|
187
|
-
label={ __( '
|
|
188
|
-
onDeselect={
|
|
174
|
+
hasValue={ () => isDefinedBorder( userBorderStyles ) }
|
|
175
|
+
label={ __( 'Border' ) }
|
|
176
|
+
onDeselect={ () => resetBorder() }
|
|
189
177
|
isShownByDefault={ true }
|
|
190
178
|
>
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
179
|
+
<BorderBoxControl
|
|
180
|
+
colors={ colors }
|
|
181
|
+
enableAlpha={ true }
|
|
182
|
+
onChange={ onBorderChange }
|
|
183
|
+
showStyle={ showBorderStyle }
|
|
184
|
+
value={ border }
|
|
185
|
+
popoverClassNames={ {
|
|
186
|
+
linked:
|
|
187
|
+
'edit-site-global-styles-sidebar__border-box-control__popover',
|
|
188
|
+
top:
|
|
189
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-top',
|
|
190
|
+
right:
|
|
191
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-right',
|
|
192
|
+
bottom:
|
|
193
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-bottom',
|
|
194
|
+
left:
|
|
195
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-left',
|
|
196
|
+
} }
|
|
197
|
+
__experimentalHasMultipleOrigins={ true }
|
|
198
|
+
__experimentalIsRenderedInSidebar={ true }
|
|
198
199
|
/>
|
|
199
200
|
</ToolsPanelItem>
|
|
200
201
|
) }
|
|
@@ -202,12 +203,14 @@ export default function BorderPanel( { name } ) {
|
|
|
202
203
|
<ToolsPanelItem
|
|
203
204
|
hasValue={ hasBorderRadius }
|
|
204
205
|
label={ __( 'Radius' ) }
|
|
205
|
-
onDeselect={
|
|
206
|
+
onDeselect={ () => setBorderRadius( undefined ) }
|
|
206
207
|
isShownByDefault={ true }
|
|
207
208
|
>
|
|
208
209
|
<BorderRadiusControl
|
|
209
210
|
values={ borderRadiusValues }
|
|
210
|
-
onChange={
|
|
211
|
+
onChange={ ( value ) => {
|
|
212
|
+
setBorderRadius( value || undefined );
|
|
213
|
+
} }
|
|
211
214
|
/>
|
|
212
215
|
</ToolsPanelItem>
|
|
213
216
|
) }
|
|
@@ -377,7 +377,10 @@ describe( 'global styles renderer', () => {
|
|
|
377
377
|
};
|
|
378
378
|
|
|
379
379
|
expect( toStyles( tree, blockSelectors ) ).toEqual(
|
|
380
|
-
'
|
|
380
|
+
'body {margin: 0;}' +
|
|
381
|
+
'body{background-color: red;margin: 10px;padding: 10px;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color: hotpink;}' +
|
|
382
|
+
'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
|
|
383
|
+
'.has-white-color{color: var(--wp--preset--color--white) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}h1.has-blue-color,h2.has-blue-color,h3.has-blue-color,h4.has-blue-color,h5.has-blue-color,h6.has-blue-color{color: var(--wp--preset--color--blue) !important;}h1.has-blue-background-color,h2.has-blue-background-color,h3.has-blue-background-color,h4.has-blue-background-color,h5.has-blue-background-color,h6.has-blue-background-color{background-color: var(--wp--preset--color--blue) !important;}h1.has-blue-border-color,h2.has-blue-border-color,h3.has-blue-border-color,h4.has-blue-border-color,h5.has-blue-border-color,h6.has-blue-border-color{border-color: var(--wp--preset--color--blue) !important;}'
|
|
381
384
|
);
|
|
382
385
|
} );
|
|
383
386
|
} );
|