@elementor/editor-editing-panel 4.2.0-beta1 → 4.3.0-1000
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/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +297 -267
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/css-classes/css-class-menu.tsx +3 -0
- package/src/components/style-sections/layout-section/grid-auto-flow-field.tsx +12 -5
- package/src/components/style-sections/layout-section/grid-outline-field.tsx +22 -7
- package/src/components/style-sections/position-section/position-section.tsx +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-1000",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.
|
|
43
|
-
"@elementor/editor-canvas": "4.
|
|
44
|
-
"@elementor/editor-controls": "4.
|
|
45
|
-
"@elementor/editor-documents": "4.
|
|
46
|
-
"@elementor/editor-elements": "4.
|
|
47
|
-
"@elementor/editor-interactions": "4.
|
|
48
|
-
"@elementor/editor-notifications": "4.
|
|
49
|
-
"@elementor/editor-panels": "4.
|
|
50
|
-
"@elementor/editor-props": "4.
|
|
51
|
-
"@elementor/editor-responsive": "4.
|
|
52
|
-
"@elementor/editor-styles": "4.
|
|
53
|
-
"@elementor/editor-styles-repository": "4.
|
|
54
|
-
"@elementor/editor-ui": "4.
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.
|
|
56
|
-
"@elementor/http-client": "4.
|
|
42
|
+
"@elementor/editor": "4.3.0-1000",
|
|
43
|
+
"@elementor/editor-canvas": "4.3.0-1000",
|
|
44
|
+
"@elementor/editor-controls": "4.3.0-1000",
|
|
45
|
+
"@elementor/editor-documents": "4.3.0-1000",
|
|
46
|
+
"@elementor/editor-elements": "4.3.0-1000",
|
|
47
|
+
"@elementor/editor-interactions": "4.3.0-1000",
|
|
48
|
+
"@elementor/editor-notifications": "4.3.0-1000",
|
|
49
|
+
"@elementor/editor-panels": "4.3.0-1000",
|
|
50
|
+
"@elementor/editor-props": "4.3.0-1000",
|
|
51
|
+
"@elementor/editor-responsive": "4.3.0-1000",
|
|
52
|
+
"@elementor/editor-styles": "4.3.0-1000",
|
|
53
|
+
"@elementor/editor-styles-repository": "4.3.0-1000",
|
|
54
|
+
"@elementor/editor-ui": "4.3.0-1000",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.3.0-1000",
|
|
56
|
+
"@elementor/http-client": "4.3.0-1000",
|
|
57
57
|
"@elementor/icons": "~1.75.1",
|
|
58
|
-
"@elementor/editor-variables": "4.
|
|
59
|
-
"@elementor/locations": "4.
|
|
60
|
-
"@elementor/menus": "4.
|
|
61
|
-
"@elementor/query": "4.
|
|
62
|
-
"@elementor/schema": "4.
|
|
63
|
-
"@elementor/session": "4.
|
|
58
|
+
"@elementor/editor-variables": "4.3.0-1000",
|
|
59
|
+
"@elementor/locations": "4.3.0-1000",
|
|
60
|
+
"@elementor/menus": "4.3.0-1000",
|
|
61
|
+
"@elementor/query": "4.3.0-1000",
|
|
62
|
+
"@elementor/schema": "4.3.0-1000",
|
|
63
|
+
"@elementor/session": "4.3.0-1000",
|
|
64
64
|
"@elementor/ui": "1.37.5",
|
|
65
|
-
"@elementor/utils": "4.
|
|
66
|
-
"@elementor/wp-media": "4.
|
|
65
|
+
"@elementor/utils": "4.3.0-1000",
|
|
66
|
+
"@elementor/wp-media": "4.3.0-1000",
|
|
67
67
|
"@wordpress/i18n": "^5.13.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ControlToggleButtonGroup, type ToggleButtonGroupItem } from '@elementor/editor-controls';
|
|
2
|
+
import { ControlToggleButtonGroup, type ToggleButtonGroupItem, useBoundProp } from '@elementor/editor-controls';
|
|
3
3
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
4
4
|
import { ArrowDownSmallIcon, ArrowRightIcon, LayoutDashboardIcon } from '@elementor/icons';
|
|
5
5
|
import { Grid, ToggleButton, Tooltip, withDirection } from '@elementor/ui';
|
|
@@ -32,9 +32,9 @@ const directionOptions: ToggleButtonGroupItem< AutoFlowDirection >[] = [
|
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
34
|
|
|
35
|
-
const parseAutoFlow = ( value: string | null ): { direction: AutoFlowDirection; dense: boolean } => {
|
|
35
|
+
const parseAutoFlow = ( value: string | null ): { direction: AutoFlowDirection | null; dense: boolean } => {
|
|
36
36
|
if ( ! value ) {
|
|
37
|
-
return { direction:
|
|
37
|
+
return { direction: null, dense: false };
|
|
38
38
|
}
|
|
39
39
|
const dense = value.includes( 'dense' );
|
|
40
40
|
const direction = value.replace( /\s*dense\s*/, '' ).trim() as AutoFlowDirection;
|
|
@@ -46,21 +46,25 @@ const composeAutoFlow = ( direction: AutoFlowDirection, dense: boolean ): string
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
const GridAutoFlowFieldContent = () => {
|
|
49
|
-
const { value, setValue } = useStylesField< StringPropValue | null >( 'grid-auto-flow', {
|
|
49
|
+
const { value, setValue, canEdit } = useStylesField< StringPropValue | null >( 'grid-auto-flow', {
|
|
50
50
|
history: { propDisplayName: AUTO_FLOW_LABEL },
|
|
51
51
|
} );
|
|
52
|
+
const { placeholder } = useBoundProp();
|
|
52
53
|
|
|
53
54
|
const { direction, dense } = parseAutoFlow( value?.value ?? null );
|
|
55
|
+
const directionPlaceholder = parseAutoFlow( ( placeholder as StringPropValue | null )?.value ?? null ).direction;
|
|
54
56
|
|
|
55
57
|
const handleDirectionChange = ( newDirection: AutoFlowDirection | null ) => {
|
|
56
58
|
if ( ! newDirection ) {
|
|
59
|
+
setValue( null );
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
62
|
setValue( { $$type: 'string', value: composeAutoFlow( newDirection, dense ) } );
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
const handleDenseToggle = () => {
|
|
63
|
-
|
|
66
|
+
const nextDirection = direction ?? 'row';
|
|
67
|
+
setValue( { $$type: 'string', value: composeAutoFlow( nextDirection, ! dense ) } );
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
return (
|
|
@@ -70,9 +74,11 @@ const GridAutoFlowFieldContent = () => {
|
|
|
70
74
|
<ControlToggleButtonGroup
|
|
71
75
|
items={ directionOptions }
|
|
72
76
|
value={ direction }
|
|
77
|
+
placeholder={ directionPlaceholder }
|
|
73
78
|
onChange={ handleDirectionChange }
|
|
74
79
|
exclusive={ true }
|
|
75
80
|
fullWidth={ true }
|
|
81
|
+
disabled={ ! canEdit }
|
|
76
82
|
/>
|
|
77
83
|
</Grid>
|
|
78
84
|
<Grid item>
|
|
@@ -83,6 +89,7 @@ const GridAutoFlowFieldContent = () => {
|
|
|
83
89
|
onChange={ handleDenseToggle }
|
|
84
90
|
size="tiny"
|
|
85
91
|
aria-label={ DENSE_LABEL }
|
|
92
|
+
disabled={ ! canEdit }
|
|
86
93
|
>
|
|
87
94
|
<LayoutDashboardIcon fontSize="tiny" />
|
|
88
95
|
</ToggleButton>
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { updateElementEditorSettings, useElementEditorSettings } from '@elementor/editor-elements';
|
|
3
|
+
import { Box, Switch } from '@elementor/ui';
|
|
3
4
|
import { __ } from '@wordpress/i18n';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { useElement } from '../../../contexts/element-context';
|
|
6
7
|
import { StylesFieldLayout } from '../../styles-field-layout';
|
|
7
8
|
|
|
8
9
|
const GRID_OUTLINE_LABEL = __( 'Show Grid Outline', 'elementor' );
|
|
9
10
|
|
|
10
11
|
export const GridOutlineField = () => {
|
|
12
|
+
const { element } = useElement();
|
|
13
|
+
const settings = useElementEditorSettings( element.id );
|
|
14
|
+
const value = settings?.grid_outline ?? true;
|
|
15
|
+
|
|
11
16
|
return (
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
<StylesFieldLayout label={ GRID_OUTLINE_LABEL }>
|
|
18
|
+
<Box sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
19
|
+
<Switch
|
|
20
|
+
aria-label={ GRID_OUTLINE_LABEL }
|
|
21
|
+
checked={ value }
|
|
22
|
+
onChange={ ( event: React.ChangeEvent< HTMLInputElement > ) => {
|
|
23
|
+
updateElementEditorSettings( {
|
|
24
|
+
elementId: element.id,
|
|
25
|
+
settings: { grid_outline: event.target.checked },
|
|
26
|
+
} );
|
|
27
|
+
} }
|
|
28
|
+
size="small"
|
|
29
|
+
/>
|
|
30
|
+
</Box>
|
|
31
|
+
</StylesFieldLayout>
|
|
17
32
|
);
|
|
18
33
|
};
|
|
@@ -6,6 +6,7 @@ import { styled } from '@elementor/ui';
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
8
8
|
import { useStyle } from '../../../contexts/style-context';
|
|
9
|
+
import { useInheritedValues } from '../../../contexts/styles-inheritance-context';
|
|
9
10
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
10
11
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
11
12
|
import { PanelDivider } from '../../panel-divider';
|
|
@@ -38,6 +39,10 @@ const DEPENDENT_PROP_NAMES: Array< keyof DependentValues > = [
|
|
|
38
39
|
|
|
39
40
|
export const PositionSection = () => {
|
|
40
41
|
const { value: position } = useStylesField< StringPropValue >( 'position', withHistoryLabel( POSITION_LABEL ) );
|
|
42
|
+
const inheritedPosition = useInheritedValues( [ 'position' ] ).position as StringPropValue | null;
|
|
43
|
+
const resolvedPosition = position ?? inheritedPosition ?? null;
|
|
44
|
+
const isPositionUnsetOrStatic = ! resolvedPosition || resolvedPosition.value === POSITION_STATIC;
|
|
45
|
+
|
|
41
46
|
const positionPrevRef = useRef( position );
|
|
42
47
|
const { values: dependentValues, setValues: setDependentValues } =
|
|
43
48
|
useStylesFields< DependentValues >( DEPENDENT_PROP_NAMES );
|
|
@@ -55,19 +60,19 @@ export const PositionSection = () => {
|
|
|
55
60
|
clearHistory();
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
if (
|
|
63
|
+
if ( isPositionUnsetOrStatic && dependentValues?.[ 'z-index' ] ) {
|
|
59
64
|
setDependentValues( { 'z-index': null }, withHistoryLabel( DIMENSIONS_LABEL ) );
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
positionPrevRef.current = position;
|
|
63
68
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
-
}, [ position?.value ] );
|
|
69
|
+
}, [ position?.value, isPositionUnsetOrStatic ] );
|
|
65
70
|
|
|
66
71
|
return (
|
|
67
72
|
<StyledSectionContent>
|
|
68
73
|
<PositionField />
|
|
69
74
|
<DimensionsField />
|
|
70
|
-
<ZIndexField disabled={
|
|
75
|
+
<ZIndexField disabled={ isPositionUnsetOrStatic } />
|
|
71
76
|
<PanelDivider />
|
|
72
77
|
<OffsetField />
|
|
73
78
|
</StyledSectionContent>
|