@elementor/editor-editing-panel 3.35.0-447 → 3.35.0-448
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 +25 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/controls-registry/settings-field.tsx +35 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "3.35.0-
|
|
3
|
+
"version": "3.35.0-448",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "3.35.0-
|
|
43
|
-
"@elementor/editor-canvas": "3.35.0-
|
|
44
|
-
"@elementor/editor-controls": "3.35.0-
|
|
45
|
-
"@elementor/editor-documents": "3.35.0-
|
|
46
|
-
"@elementor/editor-elements": "3.35.0-
|
|
47
|
-
"@elementor/editor-interactions": "3.35.0-
|
|
48
|
-
"@elementor/editor-panels": "3.35.0-
|
|
49
|
-
"@elementor/editor-props": "3.35.0-
|
|
50
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
51
|
-
"@elementor/editor-styles": "3.35.0-
|
|
52
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
53
|
-
"@elementor/editor-ui": "3.35.0-
|
|
54
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
42
|
+
"@elementor/editor": "3.35.0-448",
|
|
43
|
+
"@elementor/editor-canvas": "3.35.0-448",
|
|
44
|
+
"@elementor/editor-controls": "3.35.0-448",
|
|
45
|
+
"@elementor/editor-documents": "3.35.0-448",
|
|
46
|
+
"@elementor/editor-elements": "3.35.0-448",
|
|
47
|
+
"@elementor/editor-interactions": "3.35.0-448",
|
|
48
|
+
"@elementor/editor-panels": "3.35.0-448",
|
|
49
|
+
"@elementor/editor-props": "3.35.0-448",
|
|
50
|
+
"@elementor/editor-responsive": "3.35.0-448",
|
|
51
|
+
"@elementor/editor-styles": "3.35.0-448",
|
|
52
|
+
"@elementor/editor-styles-repository": "3.35.0-448",
|
|
53
|
+
"@elementor/editor-ui": "3.35.0-448",
|
|
54
|
+
"@elementor/editor-v1-adapters": "3.35.0-448",
|
|
55
55
|
"@elementor/icons": "^1.63.0",
|
|
56
|
-
"@elementor/locations": "3.35.0-
|
|
57
|
-
"@elementor/menus": "3.35.0-
|
|
58
|
-
"@elementor/schema": "3.35.0-
|
|
59
|
-
"@elementor/session": "3.35.0-
|
|
56
|
+
"@elementor/locations": "3.35.0-448",
|
|
57
|
+
"@elementor/menus": "3.35.0-448",
|
|
58
|
+
"@elementor/schema": "3.35.0-448",
|
|
59
|
+
"@elementor/session": "3.35.0-448",
|
|
60
60
|
"@elementor/ui": "1.36.17",
|
|
61
|
-
"@elementor/utils": "3.35.0-
|
|
62
|
-
"@elementor/wp-media": "3.35.0-
|
|
61
|
+
"@elementor/utils": "3.35.0-448",
|
|
62
|
+
"@elementor/wp-media": "3.35.0-448",
|
|
63
63
|
"@wordpress/i18n": "^5.13.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -12,8 +12,10 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
type CreateOptions,
|
|
14
14
|
isDependencyMet,
|
|
15
|
+
migratePropValue,
|
|
15
16
|
type PropKey,
|
|
16
17
|
type Props,
|
|
18
|
+
type PropsSchema,
|
|
17
19
|
type PropType,
|
|
18
20
|
type PropValue,
|
|
19
21
|
} from '@elementor/editor-props';
|
|
@@ -40,7 +42,11 @@ export const SettingsField = ( { bind, children, propDisplayName }: SettingsFiel
|
|
|
40
42
|
|
|
41
43
|
const elementSettingValues = useElementSettings< PropValue >( elementId, Object.keys( propsSchema ) ) as Values;
|
|
42
44
|
|
|
43
|
-
const
|
|
45
|
+
const migratedValues = useMemo( () => {
|
|
46
|
+
return migratePropValues( elementSettingValues, propsSchema );
|
|
47
|
+
}, [ elementSettingValues, propsSchema ] );
|
|
48
|
+
|
|
49
|
+
const value = { [ bind ]: migratedValues?.[ bind ] ?? null };
|
|
44
50
|
|
|
45
51
|
const propType = createTopLevelObjectType( { schema: propsSchema } );
|
|
46
52
|
|
|
@@ -54,7 +60,7 @@ export const SettingsField = ( { bind, children, propDisplayName }: SettingsFiel
|
|
|
54
60
|
const { withHistory = true } = meta ?? {};
|
|
55
61
|
const dependents = extractOrderedDependencies( dependenciesPerTargetMapping );
|
|
56
62
|
|
|
57
|
-
const settings = getUpdatedValues( newValue, dependents, propsSchema,
|
|
63
|
+
const settings = getUpdatedValues( newValue, dependents, propsSchema, migratedValues, elementId );
|
|
58
64
|
if ( withHistory ) {
|
|
59
65
|
undoableUpdateElementProp( settings );
|
|
60
66
|
} else {
|
|
@@ -62,7 +68,7 @@ export const SettingsField = ( { bind, children, propDisplayName }: SettingsFiel
|
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
70
|
|
|
65
|
-
const isDisabled = ( prop: PropType ) => ! isDependencyMet( prop?.dependencies,
|
|
71
|
+
const isDisabled = ( prop: PropType ) => ! isDependencyMet( prop?.dependencies, migratedValues ).isMet;
|
|
66
72
|
|
|
67
73
|
return (
|
|
68
74
|
<PropProvider propType={ propType } value={ value } setValue={ setValue } isDisabled={ isDisabled }>
|
|
@@ -103,3 +109,29 @@ function useUndoableUpdateElementProp( {
|
|
|
103
109
|
);
|
|
104
110
|
}, [ elementId, propDisplayName ] );
|
|
105
111
|
}
|
|
112
|
+
|
|
113
|
+
function migratePropValues( values: Values, schema: PropsSchema ): Values {
|
|
114
|
+
if ( ! values ) {
|
|
115
|
+
return values;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const migrated: Values = {};
|
|
119
|
+
|
|
120
|
+
for ( const [ key, value ] of Object.entries( values ) ) {
|
|
121
|
+
if ( value === null || value === undefined ) {
|
|
122
|
+
migrated[ key ] = value;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const propType = schema[ key ];
|
|
127
|
+
|
|
128
|
+
if ( ! propType ) {
|
|
129
|
+
migrated[ key ] = value;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
migrated[ key ] = migratePropValue( value, propType ) as Values[ string ];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return migrated;
|
|
137
|
+
}
|