@elementor/editor-components 3.35.5 → 3.35.7
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 +60 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -22
- package/src/components/load-template-components.tsx +14 -0
- package/src/init.ts +6 -0
- package/src/store/actions/delete-overridable-prop.ts +31 -17
- package/src/store/utils/groups-transformers.ts +4 -2
- package/src/sync/cleanup-overridable-props-on-delete.ts +24 -24
- package/src/utils/tracking.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -549,6 +549,7 @@ import { __dispatch as dispatch2, __getState as getState4 } from "@elementor/sto
|
|
|
549
549
|
import { generateUniqueId } from "@elementor/utils";
|
|
550
550
|
import { __ } from "@wordpress/i18n";
|
|
551
551
|
function removePropFromAllGroups(groups, propKey) {
|
|
552
|
+
const propKeys = Array.isArray(propKey) ? propKey : [propKey];
|
|
552
553
|
return {
|
|
553
554
|
...groups,
|
|
554
555
|
items: Object.fromEntries(
|
|
@@ -556,7 +557,7 @@ function removePropFromAllGroups(groups, propKey) {
|
|
|
556
557
|
groupId,
|
|
557
558
|
{
|
|
558
559
|
...group,
|
|
559
|
-
props: group.props.filter((p) => p
|
|
560
|
+
props: group.props.filter((p) => !propKeys.includes(p))
|
|
560
561
|
}
|
|
561
562
|
])
|
|
562
563
|
)
|
|
@@ -1157,15 +1158,25 @@ function revertElementSettings(element) {
|
|
|
1157
1158
|
// src/store/actions/delete-overridable-prop.ts
|
|
1158
1159
|
function deleteOverridableProp({ componentId, propKey, source }) {
|
|
1159
1160
|
const overridableProps = selectOverridableProps(getState6(), componentId);
|
|
1160
|
-
if (!overridableProps) {
|
|
1161
|
+
if (!overridableProps || Object.keys(overridableProps.props).length === 0) {
|
|
1161
1162
|
return;
|
|
1162
1163
|
}
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1164
|
+
const propKeysToDelete = Array.isArray(propKey) ? propKey : [propKey];
|
|
1165
|
+
const deletedProps = [];
|
|
1166
|
+
for (const key of propKeysToDelete) {
|
|
1167
|
+
const prop = overridableProps.props[key];
|
|
1168
|
+
if (!prop) {
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
deletedProps.push(prop);
|
|
1172
|
+
revertElementOverridableSetting(prop.elementId, prop.propKey, prop.originValue, key);
|
|
1173
|
+
}
|
|
1174
|
+
if (deletedProps.length === 0) {
|
|
1165
1175
|
return;
|
|
1166
1176
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1177
|
+
const remainingProps = Object.fromEntries(
|
|
1178
|
+
Object.entries(overridableProps.props).filter(([key]) => !propKeysToDelete.includes(key))
|
|
1179
|
+
);
|
|
1169
1180
|
const updatedGroups = removePropFromAllGroups(overridableProps.groups, propKey);
|
|
1170
1181
|
dispatch3(
|
|
1171
1182
|
slice.actions.setOverridableProps({
|
|
@@ -1178,15 +1189,17 @@ function deleteOverridableProp({ componentId, propKey, source }) {
|
|
|
1178
1189
|
})
|
|
1179
1190
|
);
|
|
1180
1191
|
const currentComponent = selectCurrentComponent(getState6());
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1192
|
+
for (const prop of deletedProps) {
|
|
1193
|
+
trackComponentEvent({
|
|
1194
|
+
action: "propertyRemoved",
|
|
1195
|
+
source,
|
|
1196
|
+
component_uid: currentComponent?.uid,
|
|
1197
|
+
property_id: prop.overrideKey,
|
|
1198
|
+
property_path: prop.propKey,
|
|
1199
|
+
property_name: prop.label,
|
|
1200
|
+
element_type: prop.widgetType ?? prop.elType
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1190
1203
|
}
|
|
1191
1204
|
|
|
1192
1205
|
// src/store/actions/reorder-group-props.ts
|
|
@@ -3464,12 +3477,12 @@ function updateCurrentComponent({
|
|
|
3464
3477
|
path,
|
|
3465
3478
|
currentComponentId
|
|
3466
3479
|
}) {
|
|
3467
|
-
const
|
|
3468
|
-
if (!
|
|
3480
|
+
const dispatch19 = getStore2()?.dispatch;
|
|
3481
|
+
if (!dispatch19) {
|
|
3469
3482
|
return;
|
|
3470
3483
|
}
|
|
3471
|
-
|
|
3472
|
-
|
|
3484
|
+
dispatch19(slice.actions.setPath(path));
|
|
3485
|
+
dispatch19(slice.actions.setCurrentComponentId(currentComponentId));
|
|
3473
3486
|
}
|
|
3474
3487
|
|
|
3475
3488
|
// src/components/edit-component/component-modal.tsx
|
|
@@ -4324,6 +4337,17 @@ function InstanceEditingPanel() {
|
|
|
4324
4337
|
), /* @__PURE__ */ React28.createElement(Divider4, null)))))));
|
|
4325
4338
|
}
|
|
4326
4339
|
|
|
4340
|
+
// src/components/load-template-components.tsx
|
|
4341
|
+
import { useEffect as useEffect6 } from "react";
|
|
4342
|
+
import { useLoadedTemplates } from "@elementor/editor-templates";
|
|
4343
|
+
var LoadTemplateComponents = () => {
|
|
4344
|
+
const templates = useLoadedTemplates();
|
|
4345
|
+
useEffect6(() => {
|
|
4346
|
+
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
4347
|
+
}, [templates]);
|
|
4348
|
+
return null;
|
|
4349
|
+
};
|
|
4350
|
+
|
|
4327
4351
|
// src/components/overridable-props/overridable-prop-control.tsx
|
|
4328
4352
|
import * as React29 from "react";
|
|
4329
4353
|
import {
|
|
@@ -5003,10 +5027,10 @@ function initMcp() {
|
|
|
5003
5027
|
}
|
|
5004
5028
|
|
|
5005
5029
|
// src/populate-store.ts
|
|
5006
|
-
import { useEffect as
|
|
5030
|
+
import { useEffect as useEffect7 } from "react";
|
|
5007
5031
|
import { __dispatch as dispatch15 } from "@elementor/store";
|
|
5008
5032
|
function PopulateStore() {
|
|
5009
|
-
|
|
5033
|
+
useEffect7(() => {
|
|
5010
5034
|
dispatch15(loadComponents());
|
|
5011
5035
|
}, []);
|
|
5012
5036
|
return null;
|
|
@@ -5344,9 +5368,12 @@ var updateExistingComponentsBeforeSave = async ({
|
|
|
5344
5368
|
// src/sync/cleanup-overridable-props-on-delete.ts
|
|
5345
5369
|
import { getAllDescendants as getAllDescendants5 } from "@elementor/editor-elements";
|
|
5346
5370
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
5347
|
-
import {
|
|
5371
|
+
import { __getState as getState25 } from "@elementor/store";
|
|
5348
5372
|
function initCleanupOverridablePropsOnDelete() {
|
|
5349
|
-
registerDataHook("dependency", "document/elements/delete", (args) => {
|
|
5373
|
+
registerDataHook("dependency", "document/elements/delete", (args, options) => {
|
|
5374
|
+
if (isPartOfMoveCommand(options)) {
|
|
5375
|
+
return true;
|
|
5376
|
+
}
|
|
5350
5377
|
const state = getState25();
|
|
5351
5378
|
if (!state) {
|
|
5352
5379
|
return true;
|
|
@@ -5371,23 +5398,7 @@ function initCleanupOverridablePropsOnDelete() {
|
|
|
5371
5398
|
if (propKeysToDelete.length === 0) {
|
|
5372
5399
|
return true;
|
|
5373
5400
|
}
|
|
5374
|
-
|
|
5375
|
-
Object.entries(overridableProps.props).filter(([propKey]) => !propKeysToDelete.includes(propKey))
|
|
5376
|
-
);
|
|
5377
|
-
let updatedGroups = overridableProps.groups;
|
|
5378
|
-
for (const propKey of propKeysToDelete) {
|
|
5379
|
-
updatedGroups = removePropFromAllGroups(updatedGroups, propKey);
|
|
5380
|
-
}
|
|
5381
|
-
dispatch19(
|
|
5382
|
-
slice.actions.setOverridableProps({
|
|
5383
|
-
componentId: currentComponentId,
|
|
5384
|
-
overridableProps: {
|
|
5385
|
-
...overridableProps,
|
|
5386
|
-
props: remainingProps,
|
|
5387
|
-
groups: updatedGroups
|
|
5388
|
-
}
|
|
5389
|
-
})
|
|
5390
|
-
);
|
|
5401
|
+
deleteOverridableProp({ componentId: currentComponentId, propKey: propKeysToDelete, source: "system" });
|
|
5391
5402
|
return true;
|
|
5392
5403
|
});
|
|
5393
5404
|
}
|
|
@@ -5395,6 +5406,10 @@ function collectDeletedElementIds(containers) {
|
|
|
5395
5406
|
const elementIds = containers.filter(Boolean).flatMap((container) => [container, ...getAllDescendants5(container)]).map((element) => element.model?.get?.("id") ?? element.id).filter((id2) => Boolean(id2));
|
|
5396
5407
|
return elementIds;
|
|
5397
5408
|
}
|
|
5409
|
+
function isPartOfMoveCommand(options) {
|
|
5410
|
+
const isMoveCommandInTrace = options?.commandsCurrentTrace?.includes("document/elements/move") || options?.commandsCurrentTrace?.includes("document/repeater/move");
|
|
5411
|
+
return Boolean(isMoveCommandInTrace);
|
|
5412
|
+
}
|
|
5398
5413
|
|
|
5399
5414
|
// src/sync/handle-component-edit-mode-container.ts
|
|
5400
5415
|
import { createElement as createElement32, selectElement as selectElement2 } from "@elementor/editor-elements";
|
|
@@ -5568,6 +5583,10 @@ function init() {
|
|
|
5568
5583
|
}
|
|
5569
5584
|
await loadComponentsAssets(config?.elements ?? []);
|
|
5570
5585
|
});
|
|
5586
|
+
injectIntoLogic({
|
|
5587
|
+
id: "templates",
|
|
5588
|
+
component: LoadTemplateComponents
|
|
5589
|
+
});
|
|
5571
5590
|
registerFieldIndicator({
|
|
5572
5591
|
fieldType: FIELD_TYPE.SETTINGS,
|
|
5573
5592
|
id: "component-overridable-prop",
|