@elementor/editor-controls 0.27.0 → 0.28.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 +14 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/controls/image-control.tsx +19 -14
- package/src/controls/link-control.tsx +17 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-controls",
|
|
3
3
|
"description": "This package contains the controls model and utils for the Elementor editor",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.28.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@elementor/editor-current-user": "0.3.0",
|
|
44
44
|
"@elementor/editor-elements": "0.8.1",
|
|
45
45
|
"@elementor/editor-props": "0.12.0",
|
|
46
|
-
"@elementor/editor-ui": "0.8.
|
|
46
|
+
"@elementor/editor-ui": "0.8.1",
|
|
47
47
|
"@elementor/env": "0.3.5",
|
|
48
48
|
"@elementor/http": "0.1.4",
|
|
49
|
-
"@elementor/icons": "1.
|
|
49
|
+
"@elementor/icons": "1.40.1",
|
|
50
50
|
"@elementor/query": "0.2.4",
|
|
51
51
|
"@elementor/session": "0.1.0",
|
|
52
|
-
"@elementor/ui": "1.
|
|
52
|
+
"@elementor/ui": "1.34.2",
|
|
53
53
|
"@elementor/utils": "0.4.0",
|
|
54
54
|
"@elementor/wp-media": "0.6.0",
|
|
55
55
|
"@tanstack/react-virtual": "3.13.3",
|
|
@@ -14,10 +14,11 @@ import { SelectControl } from './select-control';
|
|
|
14
14
|
type ImageControlProps = {
|
|
15
15
|
sizes: { label: string; value: string }[];
|
|
16
16
|
resolutionLabel?: string;
|
|
17
|
+
showMode?: 'all' | 'media' | 'sizes';
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export const ImageControl = createControl(
|
|
20
|
-
( { sizes, resolutionLabel = __( 'Image resolution', 'elementor' ) }: ImageControlProps ) => {
|
|
21
|
+
( { sizes, resolutionLabel = __( 'Image resolution', 'elementor' ), showMode = 'all' }: ImageControlProps ) => {
|
|
21
22
|
const propContext = useBoundProp( imagePropTypeUtil );
|
|
22
23
|
|
|
23
24
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
@@ -26,20 +27,24 @@ export const ImageControl = createControl(
|
|
|
26
27
|
return (
|
|
27
28
|
<PropProvider { ...propContext }>
|
|
28
29
|
<Stack gap={ 1.5 }>
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
{ [ 'all', 'media' ].includes( showMode ) ? (
|
|
31
|
+
<PropKeyProvider bind={ 'src' }>
|
|
32
|
+
<ControlFormLabel> { __( 'Image', 'elementor' ) } </ControlFormLabel>
|
|
33
|
+
<ImageMediaControl mediaTypes={ mediaTypes } />
|
|
34
|
+
</PropKeyProvider>
|
|
35
|
+
) : null }
|
|
36
|
+
{ [ 'all', 'sizes' ].includes( showMode ) ? (
|
|
37
|
+
<PropKeyProvider bind={ 'size' }>
|
|
38
|
+
<Grid container gap={ 1.5 } alignItems="center" flexWrap="nowrap">
|
|
39
|
+
<Grid item xs={ 6 }>
|
|
40
|
+
<ControlFormLabel> { resolutionLabel } </ControlFormLabel>
|
|
41
|
+
</Grid>
|
|
42
|
+
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
43
|
+
<SelectControl options={ sizes } />
|
|
44
|
+
</Grid>
|
|
37
45
|
</Grid>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</Grid>
|
|
41
|
-
</Grid>
|
|
42
|
-
</PropKeyProvider>
|
|
46
|
+
</PropKeyProvider>
|
|
47
|
+
) : null }
|
|
43
48
|
</Stack>
|
|
44
49
|
</PropProvider>
|
|
45
50
|
);
|
|
@@ -13,7 +13,7 @@ import { InfoTipCard } from '@elementor/editor-ui';
|
|
|
13
13
|
import { type HttpResponse, httpService } from '@elementor/http';
|
|
14
14
|
import { AlertTriangleIcon, MinusIcon, PlusIcon } from '@elementor/icons';
|
|
15
15
|
import { useSessionStorage } from '@elementor/session';
|
|
16
|
-
import { Box, Collapse,
|
|
16
|
+
import { Box, Collapse, Grid, IconButton, Infotip, Stack, Switch } from '@elementor/ui';
|
|
17
17
|
import { debounce } from '@elementor/utils';
|
|
18
18
|
import { __ } from '@wordpress/i18n';
|
|
19
19
|
|
|
@@ -81,9 +81,21 @@ export const LinkControl = createControl( ( props: Props ) => {
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const newState = ! isActive;
|
|
85
|
+
setIsActive( newState );
|
|
86
|
+
|
|
87
|
+
if ( ! newState && value !== null ) {
|
|
88
|
+
setValue( null );
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if ( newState && linkSessionValue?.value ) {
|
|
92
|
+
setValue( linkSessionValue.value );
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
setLinkSessionValue( {
|
|
96
|
+
value: newState ? value : linkSessionValue?.value,
|
|
97
|
+
meta: { isEnabled: newState },
|
|
98
|
+
} );
|
|
87
99
|
};
|
|
88
100
|
|
|
89
101
|
const onOptionChange = ( newValue: number | null ) => {
|
|
@@ -105,7 +117,7 @@ export const LinkControl = createControl( ( props: Props ) => {
|
|
|
105
117
|
? {
|
|
106
118
|
...value,
|
|
107
119
|
destination: urlPropTypeUtil.create( newValue ),
|
|
108
|
-
label:
|
|
120
|
+
label: stringPropTypeUtil.create( '' ),
|
|
109
121
|
}
|
|
110
122
|
: null;
|
|
111
123
|
|
|
@@ -143,7 +155,6 @@ export const LinkControl = createControl( ( props: Props ) => {
|
|
|
143
155
|
return (
|
|
144
156
|
<PropProvider { ...propContext } value={ value } setValue={ setValue }>
|
|
145
157
|
<Stack gap={ 1.5 }>
|
|
146
|
-
<Divider />
|
|
147
158
|
<Stack
|
|
148
159
|
direction="row"
|
|
149
160
|
sx={ {
|