@elementor/editor-editing-panel 3.32.0-95 → 3.33.0-101
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 +871 -807
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +710 -646
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -19
- package/src/components/custom-css-field.tsx +20 -0
- package/src/components/custom-css-indicator.tsx +16 -0
- package/src/components/custom-css.tsx +21 -4
- package/src/components/section.tsx +9 -2
- package/src/components/style-tab-section.tsx +8 -3
- package/src/components/style-tab.tsx +2 -0
- package/src/styles-inheritance/components/styles-inheritance-section-indicators.tsx +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.33.0-101",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,26 +39,26 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "3.
|
|
43
|
-
"@elementor/editor-canvas": "3.
|
|
44
|
-
"@elementor/editor-controls": "3.
|
|
45
|
-
"@elementor/editor-documents": "3.
|
|
46
|
-
"@elementor/editor-elements": "3.
|
|
47
|
-
"@elementor/editor-panels": "3.
|
|
48
|
-
"@elementor/editor-props": "3.
|
|
49
|
-
"@elementor/editor-responsive": "3.
|
|
50
|
-
"@elementor/editor-styles": "3.
|
|
51
|
-
"@elementor/editor-styles-repository": "3.
|
|
52
|
-
"@elementor/editor-ui": "3.
|
|
53
|
-
"@elementor/editor-v1-adapters": "3.
|
|
42
|
+
"@elementor/editor": "3.33.0-101",
|
|
43
|
+
"@elementor/editor-canvas": "3.33.0-101",
|
|
44
|
+
"@elementor/editor-controls": "3.33.0-101",
|
|
45
|
+
"@elementor/editor-documents": "3.33.0-101",
|
|
46
|
+
"@elementor/editor-elements": "3.33.0-101",
|
|
47
|
+
"@elementor/editor-panels": "3.33.0-101",
|
|
48
|
+
"@elementor/editor-props": "3.33.0-101",
|
|
49
|
+
"@elementor/editor-responsive": "3.33.0-101",
|
|
50
|
+
"@elementor/editor-styles": "3.33.0-101",
|
|
51
|
+
"@elementor/editor-styles-repository": "3.33.0-101",
|
|
52
|
+
"@elementor/editor-ui": "3.33.0-101",
|
|
53
|
+
"@elementor/editor-v1-adapters": "3.33.0-101",
|
|
54
54
|
"@elementor/icons": "1.46.0",
|
|
55
|
-
"@elementor/locations": "3.
|
|
56
|
-
"@elementor/menus": "3.
|
|
57
|
-
"@elementor/schema": "3.
|
|
58
|
-
"@elementor/session": "3.
|
|
55
|
+
"@elementor/locations": "3.33.0-101",
|
|
56
|
+
"@elementor/menus": "3.33.0-101",
|
|
57
|
+
"@elementor/schema": "3.33.0-101",
|
|
58
|
+
"@elementor/session": "3.33.0-101",
|
|
59
59
|
"@elementor/ui": "1.36.12",
|
|
60
|
-
"@elementor/utils": "3.
|
|
61
|
-
"@elementor/wp-media": "3.
|
|
60
|
+
"@elementor/utils": "3.33.0-101",
|
|
61
|
+
"@elementor/wp-media": "3.33.0-101",
|
|
62
62
|
"@wordpress/i18n": "^5.13.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PropsWithChildren } from 'react';
|
|
3
|
+
import { ControlAdornmentsProvider } from '@elementor/editor-controls';
|
|
4
|
+
|
|
5
|
+
import { CustomCssIndicator } from './custom-css-indicator';
|
|
6
|
+
|
|
7
|
+
export const CustomCssField = ( { children }: PropsWithChildren< object > ) => {
|
|
8
|
+
return (
|
|
9
|
+
<ControlAdornmentsProvider
|
|
10
|
+
items={ [
|
|
11
|
+
{
|
|
12
|
+
id: 'custom-css-indicator',
|
|
13
|
+
Adornment: CustomCssIndicator,
|
|
14
|
+
},
|
|
15
|
+
] }
|
|
16
|
+
>
|
|
17
|
+
{ children }
|
|
18
|
+
</ControlAdornmentsProvider>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useCustomCss } from '../hooks/use-custom-css';
|
|
4
|
+
import { StyleIndicator } from './style-indicator';
|
|
5
|
+
|
|
6
|
+
export const CustomCssIndicator = () => {
|
|
7
|
+
const { customCss } = useCustomCss();
|
|
8
|
+
|
|
9
|
+
const hasContent = Boolean( customCss?.raw?.trim() );
|
|
10
|
+
|
|
11
|
+
if ( ! hasContent ) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <StyleIndicator getColor={ ( theme ) => theme.palette.accent.main } />;
|
|
16
|
+
};
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CssEditor } from '@elementor/editor-controls';
|
|
2
|
+
import { ControlAdornments, ControlFormLabel, CssEditor } from '@elementor/editor-controls';
|
|
3
|
+
import { Stack } from '@elementor/ui';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
3
5
|
|
|
4
6
|
import { useCustomCss } from '../hooks/use-custom-css';
|
|
7
|
+
import { CustomCssField } from './custom-css-field';
|
|
5
8
|
import { SectionContent } from './section-content';
|
|
6
9
|
|
|
7
10
|
export const CustomCss = () => {
|
|
8
11
|
const { customCss, setCustomCss } = useCustomCss();
|
|
12
|
+
const [ localState, setLocalState ] = React.useState( {
|
|
13
|
+
value: customCss?.raw || '',
|
|
14
|
+
isValid: true,
|
|
15
|
+
} );
|
|
9
16
|
|
|
10
|
-
const handleChange = ( value: string ) => {
|
|
11
|
-
|
|
17
|
+
const handleChange = ( value: string, isValid: boolean ) => {
|
|
18
|
+
setLocalState( { value, isValid } );
|
|
19
|
+
|
|
20
|
+
if ( isValid ) {
|
|
21
|
+
setCustomCss( value, { history: { propDisplayName: 'Custom CSS' } } );
|
|
22
|
+
}
|
|
12
23
|
};
|
|
13
24
|
|
|
14
25
|
return (
|
|
15
26
|
<SectionContent>
|
|
16
|
-
<
|
|
27
|
+
<CustomCssField>
|
|
28
|
+
<Stack direction="row" alignItems="center" gap={ 1 }>
|
|
29
|
+
<ControlFormLabel>{ __( 'CSS code', 'elementor' ) }</ControlFormLabel>
|
|
30
|
+
<ControlAdornments />
|
|
31
|
+
</Stack>
|
|
32
|
+
</CustomCssField>
|
|
33
|
+
<CssEditor value={ localState.value } onChange={ handleChange } />
|
|
17
34
|
</SectionContent>
|
|
18
35
|
);
|
|
19
36
|
};
|
|
@@ -11,9 +11,10 @@ type Props = PropsWithChildren< {
|
|
|
11
11
|
title: string;
|
|
12
12
|
defaultExpanded?: boolean;
|
|
13
13
|
titleEnd?: CollapsibleValue< ReactNode | string >;
|
|
14
|
+
unmountOnExit?: boolean;
|
|
14
15
|
} >;
|
|
15
16
|
|
|
16
|
-
export function Section( { title, children, defaultExpanded = false, titleEnd }: Props ) {
|
|
17
|
+
export function Section( { title, children, defaultExpanded = false, titleEnd, unmountOnExit = true }: Props ) {
|
|
17
18
|
const [ isOpen, setIsOpen ] = useStateByElement( title, !! defaultExpanded );
|
|
18
19
|
const ref = useRef< HTMLElement >( null );
|
|
19
20
|
|
|
@@ -43,7 +44,13 @@ export function Section( { title, children, defaultExpanded = false, titleEnd }:
|
|
|
43
44
|
</Stack>
|
|
44
45
|
<CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" />
|
|
45
46
|
</ListItemButton>
|
|
46
|
-
<Collapse
|
|
47
|
+
<Collapse
|
|
48
|
+
id={ contentId }
|
|
49
|
+
aria-labelledby={ labelId }
|
|
50
|
+
in={ isOpen }
|
|
51
|
+
timeout="auto"
|
|
52
|
+
unmountOnExit={ unmountOnExit }
|
|
53
|
+
>
|
|
47
54
|
<SectionRefContext.Provider value={ ref }>
|
|
48
55
|
<Stack ref={ ref } gap={ 2.5 } p={ 2 }>
|
|
49
56
|
{ children }
|
|
@@ -10,16 +10,21 @@ type Section = {
|
|
|
10
10
|
title: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
type Props = { section: Section; fields?: string[] };
|
|
13
|
+
type Props = { section: Section; fields?: string[]; unmountOnExit?: boolean };
|
|
14
14
|
|
|
15
|
-
export const StyleTabSection = ( { section, fields = [] }: Props ) => {
|
|
15
|
+
export const StyleTabSection = ( { section, fields = [], unmountOnExit = true }: Props ) => {
|
|
16
16
|
const { component, name, title } = section;
|
|
17
17
|
const tabDefaults = useDefaultPanelSettings();
|
|
18
18
|
const SectionComponent = component;
|
|
19
19
|
const isExpanded = tabDefaults.defaultSectionsExpanded.style?.includes( name );
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<Section
|
|
22
|
+
<Section
|
|
23
|
+
title={ title }
|
|
24
|
+
defaultExpanded={ isExpanded }
|
|
25
|
+
titleEnd={ getStylesInheritanceIndicators( fields ) }
|
|
26
|
+
unmountOnExit={ unmountOnExit }
|
|
27
|
+
>
|
|
23
28
|
<SectionComponent />
|
|
24
29
|
</Section>
|
|
25
30
|
);
|
|
@@ -5,6 +5,7 @@ import { isElementsStylesProvider } from '@elementor/editor-styles-repository';
|
|
|
5
5
|
import { Stack, Tooltip } from '@elementor/ui';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
8
|
+
import { CustomCssIndicator } from '../../components/custom-css-indicator';
|
|
8
9
|
import { StyleIndicator } from '../../components/style-indicator';
|
|
9
10
|
import { useStyle } from '../../contexts/style-context';
|
|
10
11
|
import { useStylesInheritanceSnapshot } from '../../contexts/styles-inheritance-context';
|
|
@@ -18,6 +19,10 @@ export const StylesInheritanceSectionIndicators = ( { fields }: Props ) => {
|
|
|
18
19
|
const { id, meta, provider } = useStyle();
|
|
19
20
|
const snapshot = useStylesInheritanceSnapshot();
|
|
20
21
|
|
|
22
|
+
if ( fields.includes( 'custom_css' ) ) {
|
|
23
|
+
return <CustomCssIndicator />;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
const snapshotFields = Object.fromEntries(
|
|
22
27
|
Object.entries( snapshot ?? {} ).filter( ( [ key ] ) => fields.includes( key as PropKey ) )
|
|
23
28
|
);
|