@elementor/editor-components 4.4.0-1137 → 4.4.0-1138
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 +47 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/instance-editing-panel/override-prop-control.tsx +28 -2
- package/src/components/instance-editing-panel/override-props-group-constants.ts +1 -0
- package/src/components/instance-editing-panel/override-props-group.tsx +6 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-components",
|
|
3
3
|
"description": "Elementor editor components",
|
|
4
|
-
"version": "4.4.0-
|
|
4
|
+
"version": "4.4.0-1138",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,31 +40,31 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor": "4.4.0-
|
|
44
|
-
"@elementor/editor-canvas": "4.4.0-
|
|
45
|
-
"@elementor/editor-controls": "4.4.0-
|
|
46
|
-
"@elementor/editor-documents": "4.4.0-
|
|
47
|
-
"@elementor/editor-editing-panel": "4.4.0-
|
|
48
|
-
"@elementor/editor-elements": "4.4.0-
|
|
49
|
-
"@elementor/editor-elements-panel": "4.4.0-
|
|
50
|
-
"@elementor/editor-mcp": "4.4.0-
|
|
51
|
-
"@elementor/editor-templates": "4.4.0-
|
|
52
|
-
"@elementor/editor-panels": "4.4.0-
|
|
53
|
-
"@elementor/editor-props": "4.4.0-
|
|
54
|
-
"@elementor/editor-ui": "4.4.0-
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.4.0-
|
|
56
|
-
"@elementor/http-client": "4.4.0-
|
|
43
|
+
"@elementor/editor": "4.4.0-1138",
|
|
44
|
+
"@elementor/editor-canvas": "4.4.0-1138",
|
|
45
|
+
"@elementor/editor-controls": "4.4.0-1138",
|
|
46
|
+
"@elementor/editor-documents": "4.4.0-1138",
|
|
47
|
+
"@elementor/editor-editing-panel": "4.4.0-1138",
|
|
48
|
+
"@elementor/editor-elements": "4.4.0-1138",
|
|
49
|
+
"@elementor/editor-elements-panel": "4.4.0-1138",
|
|
50
|
+
"@elementor/editor-mcp": "4.4.0-1138",
|
|
51
|
+
"@elementor/editor-templates": "4.4.0-1138",
|
|
52
|
+
"@elementor/editor-panels": "4.4.0-1138",
|
|
53
|
+
"@elementor/editor-props": "4.4.0-1138",
|
|
54
|
+
"@elementor/editor-ui": "4.4.0-1138",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.4.0-1138",
|
|
56
|
+
"@elementor/http-client": "4.4.0-1138",
|
|
57
57
|
"@elementor/icons": "~1.78.1",
|
|
58
|
-
"@elementor/events": "4.4.0-
|
|
59
|
-
"@elementor/query": "4.4.0-
|
|
60
|
-
"@elementor/schema": "4.4.0-
|
|
61
|
-
"@elementor/store": "4.4.0-
|
|
58
|
+
"@elementor/events": "4.4.0-1138",
|
|
59
|
+
"@elementor/query": "4.4.0-1138",
|
|
60
|
+
"@elementor/schema": "4.4.0-1138",
|
|
61
|
+
"@elementor/store": "4.4.0-1138",
|
|
62
62
|
"@elementor/ui": "1.41.3",
|
|
63
|
-
"@elementor/utils": "4.4.0-
|
|
63
|
+
"@elementor/utils": "4.4.0-1138",
|
|
64
64
|
"@wordpress/i18n": "^5.13.0",
|
|
65
|
-
"@elementor/editor-notifications": "4.4.0-
|
|
66
|
-
"@elementor/editor-current-user": "4.4.0-
|
|
67
|
-
"@elementor/editor-embedded-documents-manager": "4.4.0-
|
|
65
|
+
"@elementor/editor-notifications": "4.4.0-1138",
|
|
66
|
+
"@elementor/editor-current-user": "4.4.0-1138",
|
|
67
|
+
"@elementor/editor-embedded-documents-manager": "4.4.0-1138"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "^18.3.1",
|
|
@@ -19,7 +19,13 @@ import {
|
|
|
19
19
|
useElement,
|
|
20
20
|
} from '@elementor/editor-editing-panel';
|
|
21
21
|
import { type Control } from '@elementor/editor-elements';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
type AnyTransformable,
|
|
24
|
+
type CreateOptions,
|
|
25
|
+
isEmpty,
|
|
26
|
+
type PropType,
|
|
27
|
+
type PropValue,
|
|
28
|
+
} from '@elementor/editor-props';
|
|
23
29
|
import { Box } from '@elementor/ui';
|
|
24
30
|
|
|
25
31
|
import { useControlsByWidgetType } from '../../hooks/use-controls-by-widget-type';
|
|
@@ -136,6 +142,14 @@ function OverrideControl( { overridableProp }: InternalProps ) {
|
|
|
136
142
|
overridableProp.label
|
|
137
143
|
);
|
|
138
144
|
|
|
145
|
+
// When there's a real inherited (base) value, let the control's bound placeholder show it,
|
|
146
|
+
// instead of the control definition's own placeholder (instance panel only).
|
|
147
|
+
// `controlProps` is the control definition's own props object (shared with the normal editing
|
|
148
|
+
// panel via the widgets cache), so it must never be mutated here — build a derived object instead.
|
|
149
|
+
const effectiveControlProps = hasInheritedValue( resolvedBaseValue )
|
|
150
|
+
? omitPlaceholder( controlProps )
|
|
151
|
+
: controlProps;
|
|
152
|
+
|
|
139
153
|
const propTypeSchema = createTopLevelObjectType( {
|
|
140
154
|
schema: { [ overridableProp.overrideKey ]: propType },
|
|
141
155
|
} );
|
|
@@ -213,7 +227,7 @@ function OverrideControl( { overridableProp }: InternalProps ) {
|
|
|
213
227
|
<Box mb={ 1.5 }>
|
|
214
228
|
<ControlTypeContainer layout={ layout }>
|
|
215
229
|
{ layout !== 'custom' && <ControlLabel>{ overridableProp.label }</ControlLabel> }
|
|
216
|
-
<OriginalControl control={ control } controlProps={
|
|
230
|
+
<OriginalControl control={ control } controlProps={ effectiveControlProps } />
|
|
217
231
|
</ControlTypeContainer>
|
|
218
232
|
</Box>
|
|
219
233
|
</ControlReplacementsProvider>
|
|
@@ -241,6 +255,18 @@ function resolveOverrideValues(
|
|
|
241
255
|
return { propValue, baseValue };
|
|
242
256
|
}
|
|
243
257
|
|
|
258
|
+
// An empty inherited value (e.g. an empty string, or an object whose fields are all empty) isn't
|
|
259
|
+
// worth showing as a placeholder, so the control's own placeholder is kept instead.
|
|
260
|
+
function hasInheritedValue( baseValue: AnyTransformable | null ): boolean {
|
|
261
|
+
return !! baseValue && ! isEmpty( baseValue );
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function omitPlaceholder( controlProps: Record< string, unknown > ): Record< string, unknown > {
|
|
265
|
+
const { placeholder: _placeholder, ...rest } = controlProps;
|
|
266
|
+
|
|
267
|
+
return rest;
|
|
268
|
+
}
|
|
269
|
+
|
|
244
270
|
// Temp solution: when removing an override on a dynamic value, fall back to propType.default
|
|
245
271
|
// instead of null, since we don't have placeholder support for dynamics yet.
|
|
246
272
|
function getTempNewValueForDynamicProp( propType: PropType, propValue: PropValue, newPropValue: PropValue ) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const OVERRIDE_PROPS_GROUP_CONTENT_CLASS = 'e-override-props-group__content';
|
|
@@ -6,6 +6,7 @@ import { Box, Collapse, ListItemButton, ListItemText, Stack } from '@elementor/u
|
|
|
6
6
|
|
|
7
7
|
import { type OverridablePropsGroup } from '../../types';
|
|
8
8
|
import { OverridePropControl } from './override-prop-control';
|
|
9
|
+
import { OVERRIDE_PROPS_GROUP_CONTENT_CLASS } from './override-props-group-constants';
|
|
9
10
|
|
|
10
11
|
type Props = {
|
|
11
12
|
group: OverridablePropsGroup;
|
|
@@ -25,7 +26,10 @@ export function OverridePropsGroup( { group }: Props ) {
|
|
|
25
26
|
const title = group.label;
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<Box
|
|
29
|
+
<Box
|
|
30
|
+
aria-label={ `${ title } section` }
|
|
31
|
+
sx={ { [ `&:has(.${ OVERRIDE_PROPS_GROUP_CONTENT_CLASS }:empty)` ]: { display: 'none' } } }
|
|
32
|
+
>
|
|
29
33
|
<ListItemButton
|
|
30
34
|
id={ labelId }
|
|
31
35
|
aria-controls={ contentId }
|
|
@@ -44,7 +48,7 @@ export function OverridePropsGroup( { group }: Props ) {
|
|
|
44
48
|
<CollapseIcon open={ isOpen } color="secondary" fontSize="tiny" />
|
|
45
49
|
</ListItemButton>
|
|
46
50
|
<Collapse id={ contentId } aria-labelledby={ labelId } in={ isOpen } timeout="auto">
|
|
47
|
-
<Stack direction="column" gap={ 1 } p={ 2 }>
|
|
51
|
+
<Stack className={ OVERRIDE_PROPS_GROUP_CONTENT_CLASS } direction="column" gap={ 1 } p={ 2 }>
|
|
48
52
|
{ group.props.map( ( overrideKey ) => (
|
|
49
53
|
<OverridePropControl key={ overrideKey } overrideKey={ overrideKey } />
|
|
50
54
|
) ) }
|