@elementor/editor-controls 3.33.0-150 → 3.33.0-151
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.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/conditional-control-infotip.tsx +2 -2
- package/src/components/enable-unfiltered-modal.tsx +1 -26
- package/src/controls/svg-media-control.tsx +33 -10
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": "3.33.0-
|
|
4
|
+
"version": "3.33.0-151",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor-current-user": "3.33.0-
|
|
44
|
-
"@elementor/editor-elements": "3.33.0-
|
|
45
|
-
"@elementor/editor-props": "3.33.0-
|
|
46
|
-
"@elementor/editor-responsive": "3.33.0-
|
|
47
|
-
"@elementor/editor-ui": "3.33.0-
|
|
48
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
49
|
-
"@elementor/env": "3.33.0-
|
|
50
|
-
"@elementor/http-client": "3.33.0-
|
|
43
|
+
"@elementor/editor-current-user": "3.33.0-151",
|
|
44
|
+
"@elementor/editor-elements": "3.33.0-151",
|
|
45
|
+
"@elementor/editor-props": "3.33.0-151",
|
|
46
|
+
"@elementor/editor-responsive": "3.33.0-151",
|
|
47
|
+
"@elementor/editor-ui": "3.33.0-151",
|
|
48
|
+
"@elementor/editor-v1-adapters": "3.33.0-151",
|
|
49
|
+
"@elementor/env": "3.33.0-151",
|
|
50
|
+
"@elementor/http-client": "3.33.0-151",
|
|
51
51
|
"@elementor/icons": "^1.51.1",
|
|
52
|
-
"@elementor/locations": "3.33.0-
|
|
53
|
-
"@elementor/mixpanel": "3.33.0-
|
|
54
|
-
"@elementor/query": "3.33.0-
|
|
55
|
-
"@elementor/session": "3.33.0-
|
|
52
|
+
"@elementor/locations": "3.33.0-151",
|
|
53
|
+
"@elementor/mixpanel": "3.33.0-151",
|
|
54
|
+
"@elementor/query": "3.33.0-151",
|
|
55
|
+
"@elementor/session": "3.33.0-151",
|
|
56
56
|
"@elementor/ui": "1.36.12",
|
|
57
|
-
"@elementor/utils": "3.33.0-
|
|
58
|
-
"@elementor/wp-media": "3.33.0-
|
|
57
|
+
"@elementor/utils": "3.33.0-151",
|
|
58
|
+
"@elementor/wp-media": "3.33.0-151",
|
|
59
59
|
"@wordpress/i18n": "^5.13.0",
|
|
60
60
|
"@monaco-editor/react": "^4.7.0"
|
|
61
61
|
},
|
|
@@ -7,7 +7,7 @@ type Props = {
|
|
|
7
7
|
infotipProps?: Partial< InfotipProps >;
|
|
8
8
|
alertProps?: Partial< AlertProps >;
|
|
9
9
|
title?: string;
|
|
10
|
-
description?: string;
|
|
10
|
+
description?: React.ReactNode | string;
|
|
11
11
|
isEnabled?: boolean;
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -45,7 +45,7 @@ export const ConditionalControlInfotip = React.forwardRef(
|
|
|
45
45
|
sx={ { width: 300, px: 1.5, py: 2 } }
|
|
46
46
|
{ ...alertProps }
|
|
47
47
|
>
|
|
48
|
-
<Box sx={ { flexDirection: 'column', display: 'flex' } }>
|
|
48
|
+
<Box sx={ { flexDirection: 'column', display: 'flex', gap: 0.5 } }>
|
|
49
49
|
<AlertTitle>{ title }</AlertTitle>
|
|
50
50
|
<Box>{ description }</Box>
|
|
51
51
|
</Box>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { useCurrentUserCapabilities } from '@elementor/editor-current-user';
|
|
4
3
|
import {
|
|
5
4
|
Button,
|
|
6
5
|
CircularProgress,
|
|
@@ -34,11 +33,6 @@ const ADMIN_CONTENT_TEXT = __(
|
|
|
34
33
|
'Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.',
|
|
35
34
|
'elementor'
|
|
36
35
|
);
|
|
37
|
-
const NON_ADMIN_TITLE_TEXT = __( "Sorry, you can't upload that file yet", 'elementor' );
|
|
38
|
-
const NON_ADMIN_CONTENT_TEXT = __(
|
|
39
|
-
'This is because this file type may pose a security risk. To upload them anyway, ask the site administrator to enable unfiltered file uploads.',
|
|
40
|
-
'elementor'
|
|
41
|
-
);
|
|
42
36
|
|
|
43
37
|
const ADMIN_FAILED_CONTENT_TEXT_PT1 = __( 'Failed to enable unfiltered files upload.', 'elementor' );
|
|
44
38
|
|
|
@@ -51,9 +45,7 @@ const WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
|
51
45
|
|
|
52
46
|
export const EnableUnfilteredModal = ( props: EnableUnfilteredModalProps ) => {
|
|
53
47
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
54
|
-
const { canUser } = useCurrentUserCapabilities();
|
|
55
48
|
const [ isError, setIsError ] = useState( false );
|
|
56
|
-
const canManageOptions = canUser( 'manage_options' );
|
|
57
49
|
|
|
58
50
|
const onClose = ( enabled: boolean ) => {
|
|
59
51
|
props.onClose( enabled );
|
|
@@ -75,7 +67,7 @@ export const EnableUnfilteredModal = ( props: EnableUnfilteredModalProps ) => {
|
|
|
75
67
|
|
|
76
68
|
const dialogProps = { ...props, isPending, handleEnable, isError, onClose };
|
|
77
69
|
|
|
78
|
-
return
|
|
70
|
+
return <AdminDialog { ...dialogProps } />;
|
|
79
71
|
};
|
|
80
72
|
|
|
81
73
|
const AdminDialog = ( { open, onClose, handleEnable, isPending, isError }: LocalModalProps ) => (
|
|
@@ -111,20 +103,3 @@ const AdminDialog = ( { open, onClose, handleEnable, isPending, isError }: Local
|
|
|
111
103
|
</DialogActions>
|
|
112
104
|
</Dialog>
|
|
113
105
|
);
|
|
114
|
-
|
|
115
|
-
const NonAdminDialog = ( { open, onClose }: LocalModalProps ) => (
|
|
116
|
-
<Dialog open={ open } maxWidth={ 'sm' } onClose={ () => onClose( false ) }>
|
|
117
|
-
<DialogHeader logo={ false }>
|
|
118
|
-
<DialogTitle>{ NON_ADMIN_TITLE_TEXT }</DialogTitle>
|
|
119
|
-
</DialogHeader>
|
|
120
|
-
<Divider />
|
|
121
|
-
<DialogContent>
|
|
122
|
-
<DialogContentText>{ NON_ADMIN_CONTENT_TEXT }</DialogContentText>
|
|
123
|
-
</DialogContent>
|
|
124
|
-
<DialogActions>
|
|
125
|
-
<Button size={ 'medium' } onClick={ () => onClose( false ) } variant="contained" color="primary">
|
|
126
|
-
{ __( 'Got it', 'elementor' ) }
|
|
127
|
-
</Button>
|
|
128
|
-
</DialogActions>
|
|
129
|
-
</Dialog>
|
|
130
|
-
);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
+
import { useCurrentUserCapabilities } from '@elementor/editor-current-user';
|
|
3
4
|
import { imageSrcPropTypeUtil } from '@elementor/editor-props';
|
|
4
5
|
import { UploadIcon } from '@elementor/icons';
|
|
5
|
-
import { Button, Card, CardMedia, CardOverlay, CircularProgress, Stack, styled } from '@elementor/ui';
|
|
6
|
+
import { Button, Card, CardMedia, CardOverlay, CircularProgress, Stack, styled, ThemeProvider } from '@elementor/ui';
|
|
6
7
|
import { type OpenOptions, useWpMediaAttachment, useWpMediaFrame } from '@elementor/wp-media';
|
|
7
8
|
import { __ } from '@wordpress/i18n';
|
|
8
9
|
|
|
9
10
|
import { useBoundProp } from '../bound-prop-context';
|
|
11
|
+
import { ConditionalControlInfotip } from '../components/conditional-control-infotip';
|
|
10
12
|
import { EnableUnfilteredModal } from '../components/enable-unfiltered-modal';
|
|
11
13
|
import ControlActions from '../control-actions/control-actions';
|
|
12
14
|
import { createControl } from '../create-control';
|
|
@@ -47,6 +49,8 @@ export const SvgMediaControl = createControl( () => {
|
|
|
47
49
|
const src = attachment?.url ?? url?.value ?? null;
|
|
48
50
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
49
51
|
const [ unfilteredModalOpenState, setUnfilteredModalOpenState ] = useState( false );
|
|
52
|
+
const { canUser } = useCurrentUserCapabilities();
|
|
53
|
+
const canManageOptions = canUser( 'manage_options' );
|
|
50
54
|
|
|
51
55
|
const { open } = useWpMediaFrame( {
|
|
52
56
|
mediaTypes: [ 'svg' ],
|
|
@@ -79,6 +83,18 @@ export const SvgMediaControl = createControl( () => {
|
|
|
79
83
|
}
|
|
80
84
|
};
|
|
81
85
|
|
|
86
|
+
const infotipProps = {
|
|
87
|
+
title: __( "Sorry, you can't upload that file yet.", 'elementor' ),
|
|
88
|
+
description: (
|
|
89
|
+
<>
|
|
90
|
+
{ __( 'To upload them anyway, ask the site administrator to enable unfiltered', 'elementor' ) }
|
|
91
|
+
<br />
|
|
92
|
+
{ __( 'file uploads.', 'elementor' ) }
|
|
93
|
+
</>
|
|
94
|
+
),
|
|
95
|
+
isEnabled: ! canManageOptions,
|
|
96
|
+
};
|
|
97
|
+
|
|
82
98
|
return (
|
|
83
99
|
<Stack gap={ 1 }>
|
|
84
100
|
<EnableUnfilteredModal open={ unfilteredModalOpenState } onClose={ onCloseUnfilteredModal } />
|
|
@@ -112,15 +128,22 @@ export const SvgMediaControl = createControl( () => {
|
|
|
112
128
|
>
|
|
113
129
|
{ __( 'Select SVG', 'elementor' ) }
|
|
114
130
|
</Button>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
<ConditionalControlInfotip { ...infotipProps }>
|
|
132
|
+
<span>
|
|
133
|
+
<ThemeProvider colorScheme={ canManageOptions ? 'light' : 'dark' }>
|
|
134
|
+
<Button
|
|
135
|
+
size="tiny"
|
|
136
|
+
variant="text"
|
|
137
|
+
color="inherit"
|
|
138
|
+
startIcon={ <UploadIcon /> }
|
|
139
|
+
disabled={ canManageOptions ? false : true }
|
|
140
|
+
onClick={ () => canManageOptions && handleClick( MODE_UPLOAD ) }
|
|
141
|
+
>
|
|
142
|
+
{ __( 'Upload', 'elementor' ) }
|
|
143
|
+
</Button>
|
|
144
|
+
</ThemeProvider>
|
|
145
|
+
</span>
|
|
146
|
+
</ConditionalControlInfotip>
|
|
124
147
|
</Stack>
|
|
125
148
|
</CardOverlay>
|
|
126
149
|
</StyledCard>
|