@elementor/editor-components 4.1.0-744 → 4.1.0-746

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-components",
3
3
  "description": "Elementor editor components",
4
- "version": "4.1.0-744",
4
+ "version": "4.1.0-746",
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.1.0-744",
44
- "@elementor/editor-canvas": "4.1.0-744",
45
- "@elementor/editor-controls": "4.1.0-744",
46
- "@elementor/editor-documents": "4.1.0-744",
47
- "@elementor/editor-editing-panel": "4.1.0-744",
48
- "@elementor/editor-elements": "4.1.0-744",
49
- "@elementor/editor-elements-panel": "4.1.0-744",
50
- "@elementor/editor-mcp": "4.1.0-744",
51
- "@elementor/editor-templates": "4.1.0-744",
52
- "@elementor/editor-panels": "4.1.0-744",
53
- "@elementor/editor-props": "4.1.0-744",
54
- "@elementor/editor-styles-repository": "4.1.0-744",
55
- "@elementor/editor-ui": "4.1.0-744",
56
- "@elementor/editor-v1-adapters": "4.1.0-744",
57
- "@elementor/http-client": "4.1.0-744",
43
+ "@elementor/editor": "4.1.0-746",
44
+ "@elementor/editor-canvas": "4.1.0-746",
45
+ "@elementor/editor-controls": "4.1.0-746",
46
+ "@elementor/editor-documents": "4.1.0-746",
47
+ "@elementor/editor-editing-panel": "4.1.0-746",
48
+ "@elementor/editor-elements": "4.1.0-746",
49
+ "@elementor/editor-elements-panel": "4.1.0-746",
50
+ "@elementor/editor-mcp": "4.1.0-746",
51
+ "@elementor/editor-templates": "4.1.0-746",
52
+ "@elementor/editor-panels": "4.1.0-746",
53
+ "@elementor/editor-props": "4.1.0-746",
54
+ "@elementor/editor-styles-repository": "4.1.0-746",
55
+ "@elementor/editor-ui": "4.1.0-746",
56
+ "@elementor/editor-v1-adapters": "4.1.0-746",
57
+ "@elementor/http-client": "4.1.0-746",
58
58
  "@elementor/icons": "^1.68.0",
59
- "@elementor/events": "4.1.0-744",
60
- "@elementor/query": "4.1.0-744",
61
- "@elementor/schema": "4.1.0-744",
62
- "@elementor/store": "4.1.0-744",
59
+ "@elementor/events": "4.1.0-746",
60
+ "@elementor/query": "4.1.0-746",
61
+ "@elementor/schema": "4.1.0-746",
62
+ "@elementor/store": "4.1.0-746",
63
63
  "@elementor/ui": "1.36.17",
64
- "@elementor/utils": "4.1.0-744",
64
+ "@elementor/utils": "4.1.0-746",
65
65
  "@wordpress/i18n": "^5.13.0",
66
- "@elementor/editor-notifications": "4.1.0-744",
67
- "@elementor/editor-current-user": "4.1.0-744"
66
+ "@elementor/editor-notifications": "4.1.0-746",
67
+ "@elementor/editor-current-user": "4.1.0-746"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^18.3.1",
@@ -158,12 +158,20 @@ function OverrideControl( { overridableProp }: InternalProps ) {
158
158
  return null;
159
159
  }
160
160
 
161
- const propValue = resolvedElementSettings[ propKey ];
161
+ const { propValue, placeholderValue } = resolveValueAndPlaceholder(
162
+ matchingOverride,
163
+ settingsWithInnerOverrides,
164
+ propKey
165
+ );
162
166
 
163
167
  const value = {
164
168
  [ overridableProp.overrideKey ]: propValue,
165
169
  } as OverridesSchema;
166
170
 
171
+ const placeholder = {
172
+ [ overridableProp.overrideKey ]: placeholderValue,
173
+ } as OverridesSchema;
174
+
167
175
  const setValue = ( newValue: OverridesSchema ) => {
168
176
  if ( ! overridableProps ) {
169
177
  setInstanceValue( {
@@ -247,6 +255,7 @@ function OverrideControl( { overridableProp }: InternalProps ) {
247
255
  propType={ propTypeSchema }
248
256
  value={ value }
249
257
  setValue={ setValue }
258
+ placeholder={ placeholder }
250
259
  isDisabled={ () => {
251
260
  return false;
252
261
  } }
@@ -270,7 +279,27 @@ function OverrideControl( { overridableProp }: InternalProps ) {
270
279
  );
271
280
  }
272
281
 
273
- // temp solution to allow dynamic values to be overridden, will be removed once placeholder is implemented
282
+ type ElementSettings = Record< string, AnyTransformable | null >;
283
+
284
+ function resolveValueAndPlaceholder(
285
+ matchingOverride: ComponentInstanceOverride | null,
286
+ settingsWithInnerOverrides: ElementSettings,
287
+ propKey: string
288
+ ) {
289
+ const overrideValue = matchingOverride ? resolveOverridePropValue( matchingOverride ) : null;
290
+
291
+ const placeholderSettings = unwrapOverridableSettings( settingsWithInnerOverrides );
292
+ const inheritedValue = placeholderSettings[ propKey ] ?? null;
293
+ const isInheritedDynamic = isDynamicPropValue( inheritedValue );
294
+
295
+ const propValue = isInheritedDynamic && ! matchingOverride ? inheritedValue : overrideValue;
296
+ const placeholderValue = matchingOverride || isInheritedDynamic ? null : inheritedValue;
297
+
298
+ return { propValue, placeholderValue };
299
+ }
300
+
301
+ // Temp solution: when removing an override on a dynamic value, fall back to propType.default
302
+ // instead of null, since we don't have placeholder support for dynamics yet.
274
303
  function getTempNewValueForDynamicProp( propType: PropType, propValue: PropValue, newPropValue: PropValue ) {
275
304
  const isRemovingOverride = newPropValue === null;
276
305