@elementor/editor-variables 4.2.0-881 → 4.2.0-882
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 +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-manager/hooks/use-variables-manager-state.ts +18 -2
- package/src/components/variables-manager/ui/variable-table-row.tsx +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1034,8 +1034,17 @@ var useVariablesManagerState = () => {
|
|
|
1034
1034
|
}, []);
|
|
1035
1035
|
const handleOnChange = useCallback3(
|
|
1036
1036
|
(newVariables) => {
|
|
1037
|
-
|
|
1038
|
-
|
|
1037
|
+
const hasChanges = Object.entries(newVariables).some(([id, newVar]) => {
|
|
1038
|
+
const existingVar = variables[id];
|
|
1039
|
+
if (!existingVar) {
|
|
1040
|
+
return true;
|
|
1041
|
+
}
|
|
1042
|
+
return existingVar.label !== newVar.label || existingVar.value !== newVar.value || existingVar.order !== newVar.order || existingVar.type !== newVar.type || (existingVar.sync_to_v3 ?? false) !== (newVar.sync_to_v3 ?? false);
|
|
1043
|
+
});
|
|
1044
|
+
if (hasChanges) {
|
|
1045
|
+
setVariables({ ...variables, ...newVariables });
|
|
1046
|
+
setIsDirty(true);
|
|
1047
|
+
}
|
|
1039
1048
|
},
|
|
1040
1049
|
[variables]
|
|
1041
1050
|
);
|
|
@@ -1773,7 +1782,7 @@ var VariableRow = (props) => {
|
|
|
1773
1782
|
value,
|
|
1774
1783
|
onChange,
|
|
1775
1784
|
onPropTypeKeyChange: (type) => {
|
|
1776
|
-
if (!isDisabled) {
|
|
1785
|
+
if (!isDisabled && type !== row.type) {
|
|
1777
1786
|
handleOnChange({
|
|
1778
1787
|
...variables,
|
|
1779
1788
|
[row.id]: { ...variables[row.id], type }
|