@elementor/editor-components 4.0.0-506 → 4.0.0-509
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 +166 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/instance-editing-panel/instance-editing-panel.tsx +1 -1
- package/src/components/instance-editing-panel/override-prop-control.tsx +11 -6
- package/src/components/instance-editing-panel/use-resolved-origin-value.tsx +132 -0
- package/src/store/store.ts +1 -8
- package/src/sync/publish-draft-components-in-page-before-save.ts +2 -2
- package/src/utils/component-document-data.ts +1 -6
- package/src/utils/switch-to-component.ts +1 -4
package/dist/index.mjs
CHANGED
|
@@ -165,12 +165,6 @@ var slice = createSlice({
|
|
|
165
165
|
}
|
|
166
166
|
component.overridableProps = payload.overridableProps;
|
|
167
167
|
},
|
|
168
|
-
clearOverridableProps: (state, { payload }) => {
|
|
169
|
-
const component = state.data.find((comp) => comp.id === payload.componentId);
|
|
170
|
-
if (component) {
|
|
171
|
-
component.overridableProps = void 0;
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
168
|
rename: (state, { payload }) => {
|
|
175
169
|
const component = state.data.find((comp) => comp.uid === payload.componentUid);
|
|
176
170
|
if (!component) {
|
|
@@ -288,7 +282,6 @@ var selectUpdatedComponentNames = createSelector(
|
|
|
288
282
|
|
|
289
283
|
// src/utils/component-document-data.ts
|
|
290
284
|
import { getV1DocumentsManager } from "@elementor/editor-documents";
|
|
291
|
-
import { __dispatch as dispatch } from "@elementor/store";
|
|
292
285
|
var getComponentDocumentData = async (id2) => {
|
|
293
286
|
const documentManager = getV1DocumentsManager();
|
|
294
287
|
try {
|
|
@@ -297,11 +290,9 @@ var getComponentDocumentData = async (id2) => {
|
|
|
297
290
|
return null;
|
|
298
291
|
}
|
|
299
292
|
};
|
|
300
|
-
var
|
|
293
|
+
var invalidateComponentDocumentData = (id2) => {
|
|
301
294
|
const documentManager = getV1DocumentsManager();
|
|
302
295
|
documentManager.invalidateCache(id2);
|
|
303
|
-
dispatch(slice.actions.removeStyles({ id: id2 }));
|
|
304
|
-
dispatch(slice.actions.clearOverridableProps({ componentId: id2 }));
|
|
305
296
|
};
|
|
306
297
|
|
|
307
298
|
// src/component-instance-transformer.ts
|
|
@@ -400,7 +391,6 @@ async function expandNavigator() {
|
|
|
400
391
|
// src/utils/switch-to-component.ts
|
|
401
392
|
async function switchToComponent(componentId, componentInstanceId, element) {
|
|
402
393
|
const selector = getSelector(element, componentInstanceId);
|
|
403
|
-
invalidateComponentCache(componentId);
|
|
404
394
|
await runCommand2("editor/documents/switch", {
|
|
405
395
|
id: componentId,
|
|
406
396
|
selector,
|
|
@@ -514,7 +504,7 @@ import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
|
|
|
514
504
|
import { __ as __10 } from "@wordpress/i18n";
|
|
515
505
|
|
|
516
506
|
// src/store/actions/add-overridable-group.ts
|
|
517
|
-
import { __dispatch as
|
|
507
|
+
import { __dispatch as dispatch, __getState as getState3 } from "@elementor/store";
|
|
518
508
|
function addOverridableGroup({
|
|
519
509
|
componentId,
|
|
520
510
|
groupId,
|
|
@@ -531,7 +521,7 @@ function addOverridableGroup({
|
|
|
531
521
|
label,
|
|
532
522
|
props: []
|
|
533
523
|
};
|
|
534
|
-
|
|
524
|
+
dispatch(
|
|
535
525
|
slice.actions.setOverridableProps({
|
|
536
526
|
componentId,
|
|
537
527
|
overridableProps: {
|
|
@@ -557,7 +547,7 @@ function addOverridableGroup({
|
|
|
557
547
|
}
|
|
558
548
|
|
|
559
549
|
// src/store/actions/delete-overridable-group.ts
|
|
560
|
-
import { __dispatch as
|
|
550
|
+
import { __dispatch as dispatch2, __getState as getState4 } from "@elementor/store";
|
|
561
551
|
|
|
562
552
|
// src/store/utils/groups-transformers.ts
|
|
563
553
|
import { generateUniqueId } from "@elementor/utils";
|
|
@@ -714,7 +704,7 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
714
704
|
return false;
|
|
715
705
|
}
|
|
716
706
|
const updatedGroups = deleteGroup(overridableProps.groups, groupId);
|
|
717
|
-
|
|
707
|
+
dispatch2(
|
|
718
708
|
slice.actions.setOverridableProps({
|
|
719
709
|
componentId,
|
|
720
710
|
overridableProps: {
|
|
@@ -727,7 +717,7 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
727
717
|
}
|
|
728
718
|
|
|
729
719
|
// src/store/actions/delete-overridable-prop.ts
|
|
730
|
-
import { __dispatch as
|
|
720
|
+
import { __dispatch as dispatch3, __getState as getState6 } from "@elementor/store";
|
|
731
721
|
|
|
732
722
|
// src/utils/revert-overridable-settings.ts
|
|
733
723
|
import {
|
|
@@ -1181,7 +1171,7 @@ function deleteOverridableProp({ componentId, propKey, source }) {
|
|
|
1181
1171
|
revertElementOverridableSetting(prop.elementId, prop.propKey, prop.originValue, propKey);
|
|
1182
1172
|
const { [propKey]: removedProp, ...remainingProps } = overridableProps.props;
|
|
1183
1173
|
const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
|
|
1184
|
-
|
|
1174
|
+
dispatch3(
|
|
1185
1175
|
slice.actions.setOverridableProps({
|
|
1186
1176
|
componentId,
|
|
1187
1177
|
overridableProps: {
|
|
@@ -1204,7 +1194,7 @@ function deleteOverridableProp({ componentId, propKey, source }) {
|
|
|
1204
1194
|
}
|
|
1205
1195
|
|
|
1206
1196
|
// src/store/actions/reorder-group-props.ts
|
|
1207
|
-
import { __dispatch as
|
|
1197
|
+
import { __dispatch as dispatch4, __getState as getState7 } from "@elementor/store";
|
|
1208
1198
|
function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
1209
1199
|
const overridableProps = selectOverridableProps(getState7(), componentId);
|
|
1210
1200
|
if (!overridableProps) {
|
|
@@ -1214,7 +1204,7 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
|
1214
1204
|
if (!group) {
|
|
1215
1205
|
return;
|
|
1216
1206
|
}
|
|
1217
|
-
|
|
1207
|
+
dispatch4(
|
|
1218
1208
|
slice.actions.setOverridableProps({
|
|
1219
1209
|
componentId,
|
|
1220
1210
|
overridableProps: {
|
|
@@ -1235,13 +1225,13 @@ function reorderGroupProps({ componentId, groupId, newPropsOrder }) {
|
|
|
1235
1225
|
}
|
|
1236
1226
|
|
|
1237
1227
|
// src/store/actions/reorder-overridable-groups.ts
|
|
1238
|
-
import { __dispatch as
|
|
1228
|
+
import { __dispatch as dispatch5, __getState as getState8 } from "@elementor/store";
|
|
1239
1229
|
function reorderOverridableGroups({ componentId, newOrder }) {
|
|
1240
1230
|
const overridableProps = selectOverridableProps(getState8(), componentId);
|
|
1241
1231
|
if (!overridableProps) {
|
|
1242
1232
|
return;
|
|
1243
1233
|
}
|
|
1244
|
-
|
|
1234
|
+
dispatch5(
|
|
1245
1235
|
slice.actions.setOverridableProps({
|
|
1246
1236
|
componentId,
|
|
1247
1237
|
overridableProps: {
|
|
@@ -1256,7 +1246,7 @@ function reorderOverridableGroups({ componentId, newOrder }) {
|
|
|
1256
1246
|
}
|
|
1257
1247
|
|
|
1258
1248
|
// src/store/actions/update-overridable-prop-params.ts
|
|
1259
|
-
import { __dispatch as
|
|
1249
|
+
import { __dispatch as dispatch6, __getState as getState9 } from "@elementor/store";
|
|
1260
1250
|
function updateOverridablePropParams({
|
|
1261
1251
|
componentId,
|
|
1262
1252
|
overrideKey,
|
|
@@ -1279,7 +1269,7 @@ function updateOverridablePropParams({
|
|
|
1279
1269
|
groupId: newGroupId
|
|
1280
1270
|
};
|
|
1281
1271
|
const updatedGroups = movePropBetweenGroups(overridableProps.groups, overrideKey, oldGroupId, newGroupId);
|
|
1282
|
-
|
|
1272
|
+
dispatch6(
|
|
1283
1273
|
slice.actions.setOverridableProps({
|
|
1284
1274
|
componentId,
|
|
1285
1275
|
overridableProps: {
|
|
@@ -1863,7 +1853,7 @@ import { useEditable } from "@elementor/editor-ui";
|
|
|
1863
1853
|
import { __ as __9 } from "@wordpress/i18n";
|
|
1864
1854
|
|
|
1865
1855
|
// src/store/actions/rename-overridable-group.ts
|
|
1866
|
-
import { __dispatch as
|
|
1856
|
+
import { __dispatch as dispatch7, __getState as getState10 } from "@elementor/store";
|
|
1867
1857
|
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
1868
1858
|
const overridableProps = selectOverridableProps(getState10(), componentId);
|
|
1869
1859
|
if (!overridableProps) {
|
|
@@ -1874,7 +1864,7 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
1874
1864
|
return false;
|
|
1875
1865
|
}
|
|
1876
1866
|
const updatedGroups = renameGroup(overridableProps.groups, groupId, label);
|
|
1877
|
-
|
|
1867
|
+
dispatch7(
|
|
1878
1868
|
slice.actions.setOverridableProps({
|
|
1879
1869
|
componentId,
|
|
1880
1870
|
overridableProps: {
|
|
@@ -2310,10 +2300,10 @@ var useComponentsPermissions = () => {
|
|
|
2310
2300
|
// src/store/actions/rename-component.ts
|
|
2311
2301
|
import { getV1DocumentsManager as getV1DocumentsManager4, setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
2312
2302
|
import { getAllDescendants as getAllDescendants2 } from "@elementor/editor-elements";
|
|
2313
|
-
import { __dispatch as
|
|
2303
|
+
import { __dispatch as dispatch8 } from "@elementor/store";
|
|
2314
2304
|
var TITLE_EXTERNAL_CHANGE_COMMAND = "title_external_change";
|
|
2315
2305
|
var renameComponent = (componentUid, newName) => {
|
|
2316
|
-
|
|
2306
|
+
dispatch8(slice.actions.rename({ componentUid, name: newName }));
|
|
2317
2307
|
setDocumentModifiedStatus3(true);
|
|
2318
2308
|
refreshComponentInstanceTitles(componentUid);
|
|
2319
2309
|
};
|
|
@@ -2366,7 +2356,7 @@ import { __ as __18 } from "@wordpress/i18n";
|
|
|
2366
2356
|
// src/store/actions/archive-component.ts
|
|
2367
2357
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
|
|
2368
2358
|
import { notify } from "@elementor/editor-notifications";
|
|
2369
|
-
import { __dispatch as
|
|
2359
|
+
import { __dispatch as dispatch9 } from "@elementor/store";
|
|
2370
2360
|
import { __ as __15 } from "@wordpress/i18n";
|
|
2371
2361
|
var successNotification = (componentId, componentName) => ({
|
|
2372
2362
|
type: "success",
|
|
@@ -2375,7 +2365,7 @@ var successNotification = (componentId, componentName) => ({
|
|
|
2375
2365
|
id: `success-archived-components-notification-${componentId}`
|
|
2376
2366
|
});
|
|
2377
2367
|
var archiveComponent = (componentId, componentName) => {
|
|
2378
|
-
|
|
2368
|
+
dispatch9(slice.actions.archive(componentId));
|
|
2379
2369
|
setDocumentModifiedStatus4(true);
|
|
2380
2370
|
notify(successNotification(componentId, componentName));
|
|
2381
2371
|
};
|
|
@@ -2427,7 +2417,7 @@ async function getDocumentsMap(ids, cache) {
|
|
|
2427
2417
|
}
|
|
2428
2418
|
|
|
2429
2419
|
// src/store/actions/load-components-overridable-props.ts
|
|
2430
|
-
import { __dispatch as
|
|
2420
|
+
import { __dispatch as dispatch10, __getState as getState12 } from "@elementor/store";
|
|
2431
2421
|
function loadComponentsOverridableProps(componentIds) {
|
|
2432
2422
|
if (!componentIds.length) {
|
|
2433
2423
|
return;
|
|
@@ -2443,7 +2433,7 @@ async function loadComponentOverrides(componentId) {
|
|
|
2443
2433
|
if (!overridableProps) {
|
|
2444
2434
|
return;
|
|
2445
2435
|
}
|
|
2446
|
-
|
|
2436
|
+
dispatch10(
|
|
2447
2437
|
slice.actions.setOverridableProps({
|
|
2448
2438
|
componentId,
|
|
2449
2439
|
overridableProps
|
|
@@ -2452,7 +2442,7 @@ async function loadComponentOverrides(componentId) {
|
|
|
2452
2442
|
}
|
|
2453
2443
|
|
|
2454
2444
|
// src/store/actions/load-components-styles.ts
|
|
2455
|
-
import { __dispatch as
|
|
2445
|
+
import { __dispatch as dispatch11, __getState as getState13 } from "@elementor/store";
|
|
2456
2446
|
function loadComponentsStyles(documents) {
|
|
2457
2447
|
if (!documents.size) {
|
|
2458
2448
|
return;
|
|
@@ -2468,7 +2458,7 @@ function addStyles(documents) {
|
|
|
2468
2458
|
const styles = Object.fromEntries(
|
|
2469
2459
|
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2470
2460
|
);
|
|
2471
|
-
|
|
2461
|
+
dispatch11(slice.actions.addStyles(styles));
|
|
2472
2462
|
}
|
|
2473
2463
|
function extractStylesFromDocument(document) {
|
|
2474
2464
|
if (!document.elements?.length) {
|
|
@@ -3142,7 +3132,7 @@ function findNonAtomicElementsInElement(element) {
|
|
|
3142
3132
|
// src/store/actions/create-unpublished-component.ts
|
|
3143
3133
|
import { createElements, deleteElement, getContainer as getContainer3 } from "@elementor/editor-elements";
|
|
3144
3134
|
import { __privateRunCommand as runCommand3 } from "@elementor/editor-v1-adapters";
|
|
3145
|
-
import { __dispatch as
|
|
3135
|
+
import { __dispatch as dispatch12 } from "@elementor/store";
|
|
3146
3136
|
import { generateUniqueId as generateUniqueId3 } from "@elementor/utils";
|
|
3147
3137
|
import { __ as __22 } from "@wordpress/i18n";
|
|
3148
3138
|
async function createUnpublishedComponent({
|
|
@@ -3163,14 +3153,14 @@ async function createUnpublishedComponent({
|
|
|
3163
3153
|
parentId: container?.parent?.id ?? "",
|
|
3164
3154
|
index: container?.view?._index ?? 0
|
|
3165
3155
|
};
|
|
3166
|
-
|
|
3156
|
+
dispatch12(
|
|
3167
3157
|
slice.actions.addUnpublished({
|
|
3168
3158
|
...componentBase,
|
|
3169
3159
|
elements: [elementDataWithOverridablesReverted],
|
|
3170
3160
|
overridableProps
|
|
3171
3161
|
})
|
|
3172
3162
|
);
|
|
3173
|
-
|
|
3163
|
+
dispatch12(slice.actions.addCreatedThisSession(generatedUid));
|
|
3174
3164
|
const componentInstance = await replaceElementWithComponent(element, componentBase);
|
|
3175
3165
|
trackComponentEvent({
|
|
3176
3166
|
action: "created",
|
|
@@ -3183,8 +3173,8 @@ async function createUnpublishedComponent({
|
|
|
3183
3173
|
await runCommand3("document/save/auto");
|
|
3184
3174
|
} catch (error) {
|
|
3185
3175
|
restoreOriginalElement(originalElement, componentInstance.id);
|
|
3186
|
-
|
|
3187
|
-
|
|
3176
|
+
dispatch12(slice.actions.removeUnpublished(generatedUid));
|
|
3177
|
+
dispatch12(slice.actions.removeCreatedThisSession(generatedUid));
|
|
3188
3178
|
throw error;
|
|
3189
3179
|
}
|
|
3190
3180
|
return { uid: generatedUid, instanceId: componentInstance.id };
|
|
@@ -3478,12 +3468,12 @@ function updateCurrentComponent({
|
|
|
3478
3468
|
path,
|
|
3479
3469
|
currentComponentId
|
|
3480
3470
|
}) {
|
|
3481
|
-
const
|
|
3482
|
-
if (!
|
|
3471
|
+
const dispatch20 = getStore2()?.dispatch;
|
|
3472
|
+
if (!dispatch20) {
|
|
3483
3473
|
return;
|
|
3484
3474
|
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3475
|
+
dispatch20(slice.actions.setPath(path));
|
|
3476
|
+
dispatch20(slice.actions.setCurrentComponentId(currentComponentId));
|
|
3487
3477
|
}
|
|
3488
3478
|
|
|
3489
3479
|
// src/components/edit-component/component-modal.tsx
|
|
@@ -3897,7 +3887,7 @@ var useOverridablePropValue = () => useContext2(OverridablePropContext)?.value;
|
|
|
3897
3887
|
var useComponentInstanceElement = () => useContext2(OverridablePropContext)?.componentInstanceElement;
|
|
3898
3888
|
|
|
3899
3889
|
// src/store/actions/update-overridable-prop.ts
|
|
3900
|
-
import { __dispatch as
|
|
3890
|
+
import { __dispatch as dispatch13, __getState as getState16 } from "@elementor/store";
|
|
3901
3891
|
|
|
3902
3892
|
// src/utils/resolve-override-prop-value.ts
|
|
3903
3893
|
var resolveOverridePropValue = (originalPropValue) => {
|
|
@@ -3957,7 +3947,7 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
|
3957
3947
|
}
|
|
3958
3948
|
}
|
|
3959
3949
|
};
|
|
3960
|
-
|
|
3950
|
+
dispatch13(
|
|
3961
3951
|
slice.actions.setOverridableProps({
|
|
3962
3952
|
componentId,
|
|
3963
3953
|
overridableProps: newOverridableProps
|
|
@@ -3999,6 +3989,92 @@ var OverrideControlInnerElementNotFoundError = createError({
|
|
|
3999
3989
|
message: `Component inner element not found for override control. The element may have been deleted without updating the overridable props, or the component has not finished rendering yet.`
|
|
4000
3990
|
});
|
|
4001
3991
|
|
|
3992
|
+
// src/components/instance-editing-panel/use-resolved-origin-value.tsx
|
|
3993
|
+
import { __useSelector as useSelector6 } from "@elementor/store";
|
|
3994
|
+
function useResolvedOriginValue(override, overridableProp) {
|
|
3995
|
+
const components = useSelector6(selectData);
|
|
3996
|
+
return resolveOriginValue(components, override, overridableProp);
|
|
3997
|
+
}
|
|
3998
|
+
function resolveOriginValue(components, matchingOverride, overridableProp) {
|
|
3999
|
+
const { originValue: fallbackOriginValue, originPropFields } = overridableProp;
|
|
4000
|
+
if (hasValue(fallbackOriginValue)) {
|
|
4001
|
+
return fallbackOriginValue;
|
|
4002
|
+
}
|
|
4003
|
+
if (matchingOverride) {
|
|
4004
|
+
const result = getOriginFromOverride(components, matchingOverride);
|
|
4005
|
+
if (hasValue(result)) {
|
|
4006
|
+
return result;
|
|
4007
|
+
}
|
|
4008
|
+
}
|
|
4009
|
+
const { elementId, propKey } = originPropFields ?? {};
|
|
4010
|
+
if (elementId && propKey) {
|
|
4011
|
+
return findOriginValueByElementId(components, elementId, propKey);
|
|
4012
|
+
}
|
|
4013
|
+
return null;
|
|
4014
|
+
}
|
|
4015
|
+
function getOriginFromOverride(components, override) {
|
|
4016
|
+
const overridableValue = componentOverridablePropTypeUtil.extract(override);
|
|
4017
|
+
const innerOverride = overridableValue ? componentInstanceOverridePropTypeUtil.extract(overridableValue.origin_value) : componentInstanceOverridePropTypeUtil.extract(override);
|
|
4018
|
+
if (!innerOverride) {
|
|
4019
|
+
return null;
|
|
4020
|
+
}
|
|
4021
|
+
const { schema_source: schemaSource, override_key: overrideKey, override_value: overrideValue } = innerOverride;
|
|
4022
|
+
const componentId = schemaSource?.id;
|
|
4023
|
+
if (!componentId || !overrideKey) {
|
|
4024
|
+
return null;
|
|
4025
|
+
}
|
|
4026
|
+
const prop = getOverridableProp(components, componentId, overrideKey);
|
|
4027
|
+
if (hasValue(prop?.originValue)) {
|
|
4028
|
+
return prop.originValue;
|
|
4029
|
+
}
|
|
4030
|
+
if (prop?.originPropFields?.elementId) {
|
|
4031
|
+
const targetPropKey = prop.originPropFields.propKey ?? prop.propKey;
|
|
4032
|
+
const result = findOriginValueByElementId(components, prop.originPropFields.elementId, targetPropKey);
|
|
4033
|
+
if (hasValue(result)) {
|
|
4034
|
+
return result;
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
const nestedOverridable = componentOverridablePropTypeUtil.extract(overrideValue);
|
|
4038
|
+
if (nestedOverridable) {
|
|
4039
|
+
return getOriginFromOverride(components, componentOverridablePropTypeUtil.create(nestedOverridable));
|
|
4040
|
+
}
|
|
4041
|
+
return null;
|
|
4042
|
+
}
|
|
4043
|
+
function findOriginValueByElementId(components, targetElementId, targetPropKey, visited = /* @__PURE__ */ new Set()) {
|
|
4044
|
+
for (const component of components) {
|
|
4045
|
+
if (visited.has(component.id)) {
|
|
4046
|
+
continue;
|
|
4047
|
+
}
|
|
4048
|
+
visited.add(component.id);
|
|
4049
|
+
const matchingProp = Object.values(component.overridableProps?.props ?? {}).find(
|
|
4050
|
+
({ elementId, propKey }) => elementId === targetElementId && propKey === targetPropKey
|
|
4051
|
+
);
|
|
4052
|
+
if (!matchingProp) {
|
|
4053
|
+
continue;
|
|
4054
|
+
}
|
|
4055
|
+
if (hasValue(matchingProp.originValue)) {
|
|
4056
|
+
return matchingProp.originValue;
|
|
4057
|
+
}
|
|
4058
|
+
if (matchingProp.originPropFields?.elementId) {
|
|
4059
|
+
const innerPropKey = matchingProp.originPropFields.propKey ?? targetPropKey;
|
|
4060
|
+
return findOriginValueByElementId(
|
|
4061
|
+
components,
|
|
4062
|
+
matchingProp.originPropFields.elementId,
|
|
4063
|
+
innerPropKey,
|
|
4064
|
+
visited
|
|
4065
|
+
);
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
return null;
|
|
4069
|
+
}
|
|
4070
|
+
function hasValue(value) {
|
|
4071
|
+
return value !== null && value !== void 0;
|
|
4072
|
+
}
|
|
4073
|
+
function getOverridableProp(components, componentId, overrideKey) {
|
|
4074
|
+
const component = components.find(({ id: id2 }) => id2 === componentId);
|
|
4075
|
+
return component?.overridableProps?.props?.[overrideKey];
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4002
4078
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
4003
4079
|
function OverridePropControl({ overridableProp, overrides }) {
|
|
4004
4080
|
return /* @__PURE__ */ React26.createElement(SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(OverrideControl, { overridableProp, overrides }));
|
|
@@ -4011,6 +4087,8 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4011
4087
|
overridableProp?.originPropFields?.widgetType ?? overridableProp.widgetType
|
|
4012
4088
|
);
|
|
4013
4089
|
const controlReplacements = getControlReplacements();
|
|
4090
|
+
const matchingOverride = getMatchingOverride(overrides, overridableProp.overrideKey);
|
|
4091
|
+
const recursiveOriginValue = useResolvedOriginValue(matchingOverride, overridableProp);
|
|
4014
4092
|
const propType = getPropTypeForComponentOverride(overridableProp);
|
|
4015
4093
|
if (!propType) {
|
|
4016
4094
|
return null;
|
|
@@ -4024,8 +4102,8 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4024
4102
|
if (!componentInstanceId) {
|
|
4025
4103
|
throw new Error("Component ID is required");
|
|
4026
4104
|
}
|
|
4027
|
-
const
|
|
4028
|
-
const propValue =
|
|
4105
|
+
const resolvedOverrideValue = matchingOverride ? resolveOverridePropValue(matchingOverride) : null;
|
|
4106
|
+
const propValue = resolvedOverrideValue ?? recursiveOriginValue ?? overridableProp.originValue;
|
|
4029
4107
|
const value = {
|
|
4030
4108
|
[overridableProp.overrideKey]: propValue
|
|
4031
4109
|
};
|
|
@@ -4093,7 +4171,7 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4093
4171
|
);
|
|
4094
4172
|
}
|
|
4095
4173
|
function getMatchingOverride(overrides, overrideKey) {
|
|
4096
|
-
|
|
4174
|
+
const result = overrides?.find((override) => {
|
|
4097
4175
|
const overridableValue = componentOverridablePropTypeUtil.extract(override);
|
|
4098
4176
|
let comparedOverrideKey = null;
|
|
4099
4177
|
if (overridableValue) {
|
|
@@ -4103,6 +4181,7 @@ function getMatchingOverride(overrides, overrideKey) {
|
|
|
4103
4181
|
}
|
|
4104
4182
|
return comparedOverrideKey === overrideKey;
|
|
4105
4183
|
}) ?? null;
|
|
4184
|
+
return result;
|
|
4106
4185
|
}
|
|
4107
4186
|
function createOverrideValue({
|
|
4108
4187
|
matchingOverride,
|
|
@@ -4229,7 +4308,7 @@ function InstanceEditingPanel() {
|
|
|
4229
4308
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
4230
4309
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
4231
4310
|
const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
4232
|
-
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(PanelHeader3, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React28.createElement(Stack16, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React28.createElement(ComponentsIcon4, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React28.createElement(EllipsisWithTooltip4, { title: component.name, as: PanelHeaderTitle2, sx: { flexGrow: 1 } }), canEdit && /* @__PURE__ */ React28.createElement(Tooltip5, { title: panelTitle }, /* @__PURE__ */ React28.createElement(IconButton6, { size: "tiny", onClick: handleEditComponent, "aria-label": panelTitle }, /* @__PURE__ */ React28.createElement(PencilIcon2, { fontSize: "tiny" }))))), /* @__PURE__ */ React28.createElement(PanelBody2, null, /* @__PURE__ */ React28.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") }, isEmpty ? /* @__PURE__ */ React28.createElement(EmptyState2, { onEditComponent: handleEditComponent }) : /* @__PURE__ */ React28.createElement(Stack16, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React28.createElement(React28.Fragment, { key: group.id }, /* @__PURE__ */ React28.createElement(
|
|
4311
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(PanelHeader3, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React28.createElement(Stack16, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React28.createElement(ComponentsIcon4, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React28.createElement(EllipsisWithTooltip4, { title: component.name, as: PanelHeaderTitle2, sx: { flexGrow: 1 } }), canEdit && /* @__PURE__ */ React28.createElement(Tooltip5, { title: panelTitle }, /* @__PURE__ */ React28.createElement(IconButton6, { size: "tiny", onClick: handleEditComponent, "aria-label": panelTitle }, /* @__PURE__ */ React28.createElement(PencilIcon2, { fontSize: "tiny" }))))), /* @__PURE__ */ React28.createElement(PanelBody2, null, /* @__PURE__ */ React28.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") }, isEmpty ? /* @__PURE__ */ React28.createElement(EmptyState2, { onEditComponent: handleEditComponent }) : /* @__PURE__ */ React28.createElement(Stack16, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React28.createElement(React28.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React28.createElement(
|
|
4233
4312
|
OverridePropsGroup,
|
|
4234
4313
|
{
|
|
4235
4314
|
group,
|
|
@@ -4326,7 +4405,7 @@ import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Po
|
|
|
4326
4405
|
import { __ as __29 } from "@wordpress/i18n";
|
|
4327
4406
|
|
|
4328
4407
|
// src/store/actions/set-overridable-prop.ts
|
|
4329
|
-
import { __dispatch as
|
|
4408
|
+
import { __dispatch as dispatch14, __getState as getState17 } from "@elementor/store";
|
|
4330
4409
|
import { generateUniqueId as generateUniqueId4 } from "@elementor/utils";
|
|
4331
4410
|
function setOverridableProp({
|
|
4332
4411
|
componentId,
|
|
@@ -4378,7 +4457,7 @@ function setOverridableProp({
|
|
|
4378
4457
|
if (isChangingGroups) {
|
|
4379
4458
|
groups = removePropFromGroup(groups, existingOverridableProp.groupId, overridableProp.overrideKey);
|
|
4380
4459
|
}
|
|
4381
|
-
|
|
4460
|
+
dispatch14(
|
|
4382
4461
|
slice.actions.setOverridableProps({
|
|
4383
4462
|
componentId,
|
|
4384
4463
|
overridableProps: {
|
|
@@ -4475,7 +4554,7 @@ var Indicator2 = forwardRef2(({ isOpen, isOverridable, ...props }, ref) => /* @_
|
|
|
4475
4554
|
|
|
4476
4555
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
4477
4556
|
import { __getState as getState18 } from "@elementor/store";
|
|
4478
|
-
function
|
|
4557
|
+
function getOverridableProp2({
|
|
4479
4558
|
componentId,
|
|
4480
4559
|
overrideKey
|
|
4481
4560
|
}) {
|
|
@@ -4539,7 +4618,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4539
4618
|
}
|
|
4540
4619
|
popupState.close();
|
|
4541
4620
|
};
|
|
4542
|
-
const overridableConfig = overridableValue ?
|
|
4621
|
+
const overridableConfig = overridableValue ? getOverridableProp2({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4543
4622
|
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(Tooltip6, { placement: "top", title: __29("Override Property", "elementor") }, /* @__PURE__ */ React31.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React31.createElement(
|
|
4544
4623
|
Popover4,
|
|
4545
4624
|
{
|
|
@@ -4943,10 +5022,10 @@ function initMcp() {
|
|
|
4943
5022
|
|
|
4944
5023
|
// src/populate-store.ts
|
|
4945
5024
|
import { useEffect as useEffect6 } from "react";
|
|
4946
|
-
import { __dispatch as
|
|
5025
|
+
import { __dispatch as dispatch15 } from "@elementor/store";
|
|
4947
5026
|
function PopulateStore() {
|
|
4948
5027
|
useEffect6(() => {
|
|
4949
|
-
|
|
5028
|
+
dispatch15(loadComponents());
|
|
4950
5029
|
}, []);
|
|
4951
5030
|
return null;
|
|
4952
5031
|
}
|
|
@@ -5079,10 +5158,10 @@ function blockCircularPaste(args) {
|
|
|
5079
5158
|
}
|
|
5080
5159
|
|
|
5081
5160
|
// src/store/actions/remove-component-styles.ts
|
|
5082
|
-
import { __dispatch as
|
|
5161
|
+
import { __dispatch as dispatch16 } from "@elementor/store";
|
|
5083
5162
|
function removeComponentStyles(id2) {
|
|
5084
5163
|
apiClient.invalidateComponentConfigCache(id2);
|
|
5085
|
-
|
|
5164
|
+
dispatch16(slice.actions.removeStyles({ id: id2 }));
|
|
5086
5165
|
}
|
|
5087
5166
|
|
|
5088
5167
|
// src/store/components-styles-provider.ts
|
|
@@ -5109,7 +5188,7 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
5109
5188
|
|
|
5110
5189
|
// src/sync/create-components-before-save.ts
|
|
5111
5190
|
import { updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
|
|
5112
|
-
import { __dispatch as
|
|
5191
|
+
import { __dispatch as dispatch17, __getState as getState21 } from "@elementor/store";
|
|
5113
5192
|
async function createComponentsBeforeSave({
|
|
5114
5193
|
elements,
|
|
5115
5194
|
status
|
|
@@ -5121,7 +5200,7 @@ async function createComponentsBeforeSave({
|
|
|
5121
5200
|
try {
|
|
5122
5201
|
const uidToComponentId = await createComponents(unpublishedComponents, status);
|
|
5123
5202
|
updateComponentInstances(elements, uidToComponentId);
|
|
5124
|
-
|
|
5203
|
+
dispatch17(
|
|
5125
5204
|
slice.actions.add(
|
|
5126
5205
|
unpublishedComponents.map((component) => ({
|
|
5127
5206
|
id: uidToComponentId.get(component.uid),
|
|
@@ -5131,10 +5210,10 @@ async function createComponentsBeforeSave({
|
|
|
5131
5210
|
}))
|
|
5132
5211
|
)
|
|
5133
5212
|
);
|
|
5134
|
-
|
|
5213
|
+
dispatch17(slice.actions.resetUnpublished());
|
|
5135
5214
|
} catch (error) {
|
|
5136
5215
|
const failedUids = unpublishedComponents.map((component) => component.uid);
|
|
5137
|
-
|
|
5216
|
+
dispatch17(slice.actions.removeUnpublished(failedUids));
|
|
5138
5217
|
throw new Error(`Failed to publish components: ${error}`);
|
|
5139
5218
|
}
|
|
5140
5219
|
}
|
|
@@ -5204,7 +5283,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
5204
5283
|
return;
|
|
5205
5284
|
}
|
|
5206
5285
|
await apiClient.updateStatuses(draftIds, "publish");
|
|
5207
|
-
draftIds.forEach((id2) =>
|
|
5286
|
+
draftIds.forEach((id2) => invalidateComponentDocumentData(id2));
|
|
5208
5287
|
}
|
|
5209
5288
|
|
|
5210
5289
|
// src/sync/set-component-overridable-props-settings-before-save.ts
|
|
@@ -5247,7 +5326,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
|
|
|
5247
5326
|
};
|
|
5248
5327
|
|
|
5249
5328
|
// src/sync/update-component-title-before-save.ts
|
|
5250
|
-
import { __dispatch as
|
|
5329
|
+
import { __dispatch as dispatch18, __getState as getState24 } from "@elementor/store";
|
|
5251
5330
|
var updateComponentTitleBeforeSave = async (status) => {
|
|
5252
5331
|
const updatedComponentNames = selectUpdatedComponentNames(getState24());
|
|
5253
5332
|
if (!updatedComponentNames.length) {
|
|
@@ -5255,7 +5334,7 @@ var updateComponentTitleBeforeSave = async (status) => {
|
|
|
5255
5334
|
}
|
|
5256
5335
|
const result = await apiClient.updateComponentTitle(updatedComponentNames, status);
|
|
5257
5336
|
if (result.failedIds.length === 0) {
|
|
5258
|
-
|
|
5337
|
+
dispatch18(slice.actions.cleanUpdatedComponentNames());
|
|
5259
5338
|
}
|
|
5260
5339
|
};
|
|
5261
5340
|
|
|
@@ -5283,7 +5362,7 @@ var updateExistingComponentsBeforeSave = async ({
|
|
|
5283
5362
|
// src/sync/cleanup-overridable-props-on-delete.ts
|
|
5284
5363
|
import { getAllDescendants as getAllDescendants5 } from "@elementor/editor-elements";
|
|
5285
5364
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
5286
|
-
import { __dispatch as
|
|
5365
|
+
import { __dispatch as dispatch19, __getState as getState25 } from "@elementor/store";
|
|
5287
5366
|
function initCleanupOverridablePropsOnDelete() {
|
|
5288
5367
|
registerDataHook("dependency", "document/elements/delete", (args) => {
|
|
5289
5368
|
const state = getState25();
|
|
@@ -5317,7 +5396,7 @@ function initCleanupOverridablePropsOnDelete() {
|
|
|
5317
5396
|
for (const propKey of propKeysToDelete) {
|
|
5318
5397
|
updatedGroups = removePropFromAllGroups(updatedGroups, propKey);
|
|
5319
5398
|
}
|
|
5320
|
-
|
|
5399
|
+
dispatch19(
|
|
5321
5400
|
slice.actions.setOverridableProps({
|
|
5322
5401
|
componentId: currentComponentId,
|
|
5323
5402
|
overridableProps: {
|