@elementor/editor-components 3.35.0-333 → 3.35.0-334

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": "3.35.0-333",
4
+ "version": "3.35.0-334",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,28 +40,28 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor": "3.35.0-333",
44
- "@elementor/editor-canvas": "3.35.0-333",
45
- "@elementor/editor-controls": "3.35.0-333",
46
- "@elementor/editor-documents": "3.35.0-333",
47
- "@elementor/editor-editing-panel": "3.35.0-333",
48
- "@elementor/editor-elements": "3.35.0-333",
49
- "@elementor/editor-elements-panel": "3.35.0-333",
50
- "@elementor/editor-mcp": "3.35.0-333",
51
- "@elementor/editor-props": "3.35.0-333",
52
- "@elementor/editor-styles-repository": "3.35.0-333",
53
- "@elementor/editor-ui": "3.35.0-333",
54
- "@elementor/editor-v1-adapters": "3.35.0-333",
55
- "@elementor/http-client": "3.35.0-333",
43
+ "@elementor/editor": "3.35.0-334",
44
+ "@elementor/editor-canvas": "3.35.0-334",
45
+ "@elementor/editor-controls": "3.35.0-334",
46
+ "@elementor/editor-documents": "3.35.0-334",
47
+ "@elementor/editor-editing-panel": "3.35.0-334",
48
+ "@elementor/editor-elements": "3.35.0-334",
49
+ "@elementor/editor-elements-panel": "3.35.0-334",
50
+ "@elementor/editor-mcp": "3.35.0-334",
51
+ "@elementor/editor-props": "3.35.0-334",
52
+ "@elementor/editor-styles-repository": "3.35.0-334",
53
+ "@elementor/editor-ui": "3.35.0-334",
54
+ "@elementor/editor-v1-adapters": "3.35.0-334",
55
+ "@elementor/http-client": "3.35.0-334",
56
56
  "@elementor/icons": "^1.62.0",
57
- "@elementor/mixpanel": "3.35.0-333",
58
- "@elementor/query": "3.35.0-333",
59
- "@elementor/schema": "3.35.0-333",
60
- "@elementor/store": "3.35.0-333",
57
+ "@elementor/mixpanel": "3.35.0-334",
58
+ "@elementor/query": "3.35.0-334",
59
+ "@elementor/schema": "3.35.0-334",
60
+ "@elementor/store": "3.35.0-334",
61
61
  "@elementor/ui": "1.36.17",
62
- "@elementor/utils": "3.35.0-333",
62
+ "@elementor/utils": "3.35.0-334",
63
63
  "@wordpress/i18n": "^5.13.0",
64
- "@elementor/editor-notifications": "3.35.0-333"
64
+ "@elementor/editor-notifications": "3.35.0-334"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": "^18.3.1",
@@ -9,6 +9,7 @@ import {
9
9
  componentOverridablePropTypeUtil,
10
10
  type ComponentOverridablePropValue,
11
11
  } from '../../prop-types/component-overridable-prop-type';
12
+ import { OverridablePropProvider } from '../../provider/overridable-prop-context';
12
13
  import { updateOverridablePropOriginValue } from '../../store/actions/update-overridable-prop-origin-value';
13
14
  import { selectCurrentComponentId } from '../../store/store';
14
15
 
@@ -50,18 +51,20 @@ export function OverridablePropControl< T extends object >( {
50
51
  : undefined;
51
52
 
52
53
  return (
53
- <PropProvider
54
- { ...propContext }
55
- propType={ propType }
56
- setValue={ setOverridableValue }
57
- value={ { [ bind ]: value.origin_value } }
58
- placeholder={ objectPlaceholder }
59
- >
60
- <PropKeyProvider bind={ bind }>
61
- <ControlReplacementsProvider replacements={ [] }>
62
- <OriginalControl { ...( props as T ) } />
63
- </ControlReplacementsProvider>
64
- </PropKeyProvider>
65
- </PropProvider>
54
+ <OverridablePropProvider value={ value }>
55
+ <PropProvider
56
+ { ...propContext }
57
+ propType={ propType }
58
+ setValue={ setOverridableValue }
59
+ value={ { [ bind ]: value.origin_value } }
60
+ placeholder={ objectPlaceholder }
61
+ >
62
+ <PropKeyProvider bind={ bind }>
63
+ <ControlReplacementsProvider replacements={ [] }>
64
+ <OriginalControl { ...( props as T ) } />
65
+ </ControlReplacementsProvider>
66
+ </PropKeyProvider>
67
+ </PropProvider>
68
+ </OverridablePropProvider>
66
69
  );
67
70
  }
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { useBoundProp } from '@elementor/editor-controls';
3
- import { getV1CurrentDocument } from '@elementor/editor-documents';
4
3
  import { useElement } from '@elementor/editor-editing-panel';
5
4
  import { getWidgetsCache } from '@elementor/editor-elements';
6
5
  import { type TransformablePropValue } from '@elementor/editor-props';
@@ -9,10 +8,10 @@ import { bindPopover, bindTrigger, Popover, Tooltip, usePopupState } from '@elem
9
8
  import { __ } from '@wordpress/i18n';
10
9
 
11
10
  import { componentOverridablePropTypeUtil } from '../../prop-types/component-overridable-prop-type';
11
+ import { useOverridablePropValue } from '../../provider/overridable-prop-context';
12
12
  import { setOverridableProp } from '../../store/actions/set-overridable-prop';
13
- import { selectOverridableProps } from '../../store/store';
13
+ import { selectCurrentComponentId, selectOverridableProps } from '../../store/store';
14
14
  import { type OverridableProps } from '../../types';
15
- import { COMPONENT_DOCUMENT_TYPE } from '../consts';
16
15
  import { Indicator } from './indicator';
17
16
  import { OverridablePropForm } from './overridable-prop-form';
18
17
  import { getOverridableProp } from './utils/get-overridable-prop';
@@ -21,19 +20,15 @@ const FORBIDDEN_KEYS = [ '_cssid', 'attributes' ];
21
20
 
22
21
  export function OverridablePropIndicator() {
23
22
  const { bind } = useBoundProp();
24
- const currentDocument = getV1CurrentDocument();
23
+ const componentId = selectCurrentComponentId( getState() );
25
24
 
26
- if ( currentDocument.config.type !== COMPONENT_DOCUMENT_TYPE || ! currentDocument.id ) {
25
+ if ( ! isPropAllowed( bind ) || ! componentId ) {
27
26
  return null;
28
27
  }
29
28
 
30
- if ( ! isPropAllowed( bind ) ) {
31
- return null;
32
- }
33
-
34
- const overridableProps = selectOverridableProps( getState(), currentDocument.id );
29
+ const overridableProps = selectOverridableProps( getState(), componentId );
35
30
 
36
- return <Content componentId={ currentDocument.id } overridableProps={ overridableProps } />;
31
+ return <Content componentId={ componentId } overridableProps={ overridableProps } />;
37
32
  }
38
33
 
39
34
  type Props = {
@@ -46,7 +41,17 @@ export function Content( { componentId, overridableProps }: Props ) {
46
41
  elementType,
47
42
  } = useElement();
48
43
  const { value, bind, propType } = useBoundProp();
49
- const { value: overridableValue, setValue: setOverridableValue } = useBoundProp( componentOverridablePropTypeUtil );
44
+
45
+ const contextOverridableValue = useOverridablePropValue();
46
+ const { value: boundPropOverridableValue, setValue: setOverridableValue } = useBoundProp(
47
+ componentOverridablePropTypeUtil
48
+ );
49
+
50
+ /**
51
+ * This is intended to handle custom layout controls, such as <LinkControl />, which has <ControlLabel /> nested within it
52
+ * i.e. its bound prop value would be the one manipulated by the new <PropProvider /> thus won't be considered overridable
53
+ */
54
+ const overridableValue = boundPropOverridableValue ?? contextOverridableValue;
50
55
 
51
56
  const popupState = usePopupState( {
52
57
  variant: 'popover',
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { createContext, type PropsWithChildren, useContext } from 'react';
3
+
4
+ import { type ComponentOverridablePropValue } from '../prop-types/component-overridable-prop-type';
5
+
6
+ type OverridablePropData = {
7
+ value: ComponentOverridablePropValue;
8
+ };
9
+
10
+ const OverridablePropContext = createContext< OverridablePropData | null >( null );
11
+
12
+ export function OverridablePropProvider( { children, ...props }: PropsWithChildren< OverridablePropData > ) {
13
+ return <OverridablePropContext.Provider value={ props }>{ children }</OverridablePropContext.Provider>;
14
+ }
15
+
16
+ export const useOverridablePropValue = () => useContext( OverridablePropContext )?.value;