@elementor/editor-editing-panel 1.4.1 → 1.5.1
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 +27 -0
- package/dist/index.js +487 -470
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +416 -399
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/conditional-tooltip-wrapper.tsx +13 -7
- package/src/components/css-class-selector.tsx +1 -3
- package/src/components/style-sections/background-section/background-section.tsx +4 -9
- package/src/components/style-sections/layout-section/layout-section.tsx +12 -0
- package/src/dynamics/dynamic-control.tsx +2 -3
- package/src/hooks/use-computed-style.ts +29 -0
- package/src/components/style-sections/background-section/background-color-field.tsx +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@elementor/editor": "0.17.2",
|
|
43
|
-
"@elementor/editor-controls": "0.
|
|
44
|
-
"@elementor/editor-elements": "0.3.
|
|
43
|
+
"@elementor/editor-controls": "0.4.0",
|
|
44
|
+
"@elementor/editor-elements": "0.3.4",
|
|
45
45
|
"@elementor/menus": "0.1.2",
|
|
46
46
|
"@elementor/editor-props": "0.5.0",
|
|
47
47
|
"@elementor/editor-panels": "0.10.2",
|
|
48
48
|
"@elementor/editor-responsive": "0.12.4",
|
|
49
49
|
"@elementor/editor-styles": "0.3.2",
|
|
50
|
-
"@elementor/editor-styles-repository": "0.
|
|
50
|
+
"@elementor/editor-styles-repository": "0.3.1",
|
|
51
51
|
"@elementor/editor-v1-adapters": "0.8.5",
|
|
52
52
|
"@elementor/icons": "^1.20.0",
|
|
53
53
|
"@elementor/schema": "0.1.2",
|
|
@@ -32,21 +32,27 @@ export const ConditionalTooltipWrapper = ( { maxWidth, title }: ConditionalToolt
|
|
|
32
32
|
if ( isOverflown ) {
|
|
33
33
|
return (
|
|
34
34
|
<Tooltip title={ title } placement="top">
|
|
35
|
-
<Content maxWidth={ maxWidth } ref={ elRef }
|
|
35
|
+
<Content maxWidth={ maxWidth } ref={ elRef }>
|
|
36
|
+
{ title }
|
|
37
|
+
</Content>
|
|
36
38
|
</Tooltip>
|
|
37
39
|
);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
return
|
|
42
|
+
return (
|
|
43
|
+
<Content maxWidth={ maxWidth } ref={ elRef }>
|
|
44
|
+
{ title }
|
|
45
|
+
</Content>
|
|
46
|
+
);
|
|
41
47
|
};
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
type ContentProps = React.PropsWithChildren< Omit< ConditionalTooltipWrapperProps, 'title' > >;
|
|
50
|
+
|
|
51
|
+
const Content = React.forwardRef( ( { maxWidth, ...tooltipProps }: ContentProps, ref ) => (
|
|
44
52
|
<Box
|
|
45
53
|
ref={ ref }
|
|
46
54
|
position="relative"
|
|
47
55
|
sx={ { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth } }
|
|
48
|
-
{ ...
|
|
49
|
-
|
|
50
|
-
{ title }
|
|
51
|
-
</Box>
|
|
56
|
+
{ ...tooltipProps }
|
|
57
|
+
/>
|
|
52
58
|
) );
|
|
@@ -102,9 +102,7 @@ function useOptions() {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function useAppliedOptions( options: Option[], appliedIds: StyleDefinitionID[] ) {
|
|
105
|
-
const applied = appliedIds
|
|
106
|
-
.map( ( id ) => options.find( ( option ) => option.value === id ) )
|
|
107
|
-
.filter( ( option ) => !! option );
|
|
105
|
+
const applied = options.filter( ( option ) => appliedIds.includes( option.value ) );
|
|
108
106
|
|
|
109
107
|
const hasElementsProviderStyleApplied = applied.some(
|
|
110
108
|
( option ) => option.provider === ELEMENTS_STYLES_PROVIDER_KEY
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Stack } from '@elementor/ui';
|
|
2
|
+
import { BackgroundControl } from '@elementor/editor-controls';
|
|
4
3
|
|
|
5
4
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
6
|
-
import { BackgroundColorField } from './background-color-field';
|
|
7
5
|
|
|
8
6
|
export const BackgroundSection = () => {
|
|
9
7
|
return (
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
</StylesField>
|
|
14
|
-
<BackgroundColorField />
|
|
15
|
-
</Stack>
|
|
8
|
+
<StylesField bind="background">
|
|
9
|
+
<BackgroundControl />
|
|
10
|
+
</StylesField>
|
|
16
11
|
);
|
|
17
12
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ControlLabel } from '@elementor/editor-controls';
|
|
3
|
+
import { useParentElement } from '@elementor/editor-elements';
|
|
3
4
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
4
5
|
import { Divider, Stack } from '@elementor/ui';
|
|
5
6
|
import { __ } from '@wordpress/i18n';
|
|
6
7
|
|
|
8
|
+
import { useElement } from '../../../contexts/element-context';
|
|
9
|
+
import { useComputedStyle } from '../../../hooks/use-computed-style';
|
|
7
10
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
8
11
|
import { AlignItemsField } from './align-items-field';
|
|
9
12
|
import { AlignSelfChild } from './align-self-child-field';
|
|
@@ -17,11 +20,15 @@ import { WrapField } from './wrap-field';
|
|
|
17
20
|
|
|
18
21
|
export const LayoutSection = () => {
|
|
19
22
|
const [ display ] = useStylesField< StringPropValue >( 'display' );
|
|
23
|
+
const { element } = useElement();
|
|
24
|
+
const parent = useParentElement( element.id );
|
|
25
|
+
const parentStyle = useComputedStyle( parent?.id || null );
|
|
20
26
|
|
|
21
27
|
return (
|
|
22
28
|
<Stack gap={ 2 }>
|
|
23
29
|
<DisplayField />
|
|
24
30
|
{ 'flex' === display?.value && <FlexFields /> }
|
|
31
|
+
{ 'flex' === parentStyle?.display && <FlexChildFields /> }
|
|
25
32
|
</Stack>
|
|
26
33
|
);
|
|
27
34
|
};
|
|
@@ -34,6 +41,11 @@ const FlexFields = () => (
|
|
|
34
41
|
<Divider />
|
|
35
42
|
<GapControlField />
|
|
36
43
|
<WrapField />
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const FlexChildFields = () => (
|
|
48
|
+
<>
|
|
37
49
|
<Divider />
|
|
38
50
|
<ControlLabel>{ __( 'Flex child', 'elementor' ) }</ControlLabel>
|
|
39
51
|
<AlignSelfChild />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BoundPropProvider, useBoundProp } from '@elementor/editor-controls';
|
|
3
|
-
import {
|
|
3
|
+
import { type PropKey, type PropValue } from '@elementor/editor-props';
|
|
4
4
|
|
|
5
5
|
import { useDynamicTag } from './hooks/use-dynamic-tag';
|
|
6
6
|
import { dynamicPropTypeUtil } from './utils';
|
|
@@ -27,8 +27,7 @@ export const DynamicControl = ( { bind, children }: DynamicControlProps ) => {
|
|
|
27
27
|
name,
|
|
28
28
|
settings: {
|
|
29
29
|
...settings,
|
|
30
|
-
|
|
31
|
-
[ bind ]: isTransformable( newValue ) ? newValue.value : newValue,
|
|
30
|
+
[ bind ]: newValue,
|
|
32
31
|
},
|
|
33
32
|
} );
|
|
34
33
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __privateUseListenTo as useListenTo, commandEndEvent, windowEvent } from '@elementor/editor-v1-adapters';
|
|
2
|
+
|
|
3
|
+
import { type ExtendedWindow } from '../sync/types';
|
|
4
|
+
|
|
5
|
+
export function useComputedStyle( elementId: string | null ) {
|
|
6
|
+
return useListenTo(
|
|
7
|
+
[
|
|
8
|
+
windowEvent( 'elementor/device-mode/change' ),
|
|
9
|
+
commandEndEvent( 'document/elements/reset-style' ),
|
|
10
|
+
commandEndEvent( 'document/elements/settings' ),
|
|
11
|
+
commandEndEvent( 'document/elements/paste-style' ),
|
|
12
|
+
],
|
|
13
|
+
() => {
|
|
14
|
+
if ( ! elementId ) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const extendedWindow: ExtendedWindow = window;
|
|
19
|
+
const element = extendedWindow.elementor?.getContainer?.( elementId );
|
|
20
|
+
|
|
21
|
+
if ( ! element?.view?.el ) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const resp = window.getComputedStyle( element.view.el );
|
|
26
|
+
return resp;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ColorControl, ControlLabel } from '@elementor/editor-controls';
|
|
3
|
-
import { Grid } from '@elementor/ui';
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
6
|
-
import { StylesField } from '../../../controls-registry/styles-field';
|
|
7
|
-
|
|
8
|
-
export const BackgroundColorField = () => {
|
|
9
|
-
return (
|
|
10
|
-
<StylesField bind="background-color">
|
|
11
|
-
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
12
|
-
<Grid item xs={ 6 }>
|
|
13
|
-
<ControlLabel>{ __( 'Color', 'elementor' ) }</ControlLabel>
|
|
14
|
-
</Grid>
|
|
15
|
-
<Grid item xs={ 6 }>
|
|
16
|
-
<ColorControl />
|
|
17
|
-
</Grid>
|
|
18
|
-
</Grid>
|
|
19
|
-
</StylesField>
|
|
20
|
-
);
|
|
21
|
-
};
|