@elementor/editor-components 3.35.0-481 → 3.35.0-483
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 +408 -349
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +367 -314
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/components-tab/components-list.tsx +2 -39
- package/src/init.ts +3 -0
- package/src/store/actions/create-unpublished-component.ts +3 -1
- package/src/store/actions/delete-overridable-prop.ts +1 -1
- package/src/sync/revert-overridables-on-copy-or-duplicate.ts +66 -0
- package/src/types.ts +6 -0
- package/src/utils/revert-overridable-settings.ts +207 -0
- package/src/components/components-tab/angie-promotion-modal.tsx +0 -72
- package/src/utils/revert-element-overridable-setting.ts +0 -94
package/dist/index.mjs
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
import { injectTab } from "@elementor/editor-elements-panel";
|
|
16
16
|
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
17
17
|
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
18
|
-
import { registerDataHook as
|
|
18
|
+
import { registerDataHook as registerDataHook6 } from "@elementor/editor-v1-adapters";
|
|
19
19
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
20
|
-
import { __ as
|
|
20
|
+
import { __ as __30 } from "@wordpress/i18n";
|
|
21
21
|
|
|
22
22
|
// src/component-instance-transformer.ts
|
|
23
23
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
@@ -710,58 +710,13 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
710
710
|
// src/store/actions/delete-overridable-prop.ts
|
|
711
711
|
import { __dispatch as dispatch3, __getState as getState6 } from "@elementor/store";
|
|
712
712
|
|
|
713
|
-
// src/utils/revert-
|
|
714
|
-
import {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
"override",
|
|
721
|
-
z.object({
|
|
722
|
-
override_key: z.string(),
|
|
723
|
-
override_value: z.unknown(),
|
|
724
|
-
schema_source: z.object({
|
|
725
|
-
type: z.literal("component"),
|
|
726
|
-
id: z.number()
|
|
727
|
-
})
|
|
728
|
-
})
|
|
729
|
-
);
|
|
730
|
-
|
|
731
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
732
|
-
import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
|
|
733
|
-
import { z as z3 } from "@elementor/schema";
|
|
734
|
-
|
|
735
|
-
// src/prop-types/component-overridable-prop-type.ts
|
|
736
|
-
import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
|
|
737
|
-
import { z as z2 } from "@elementor/schema";
|
|
738
|
-
var componentOverridablePropTypeUtil = createPropUtils2(
|
|
739
|
-
"overridable",
|
|
740
|
-
z2.object({
|
|
741
|
-
override_key: z2.string(),
|
|
742
|
-
origin_value: z2.object({
|
|
743
|
-
$$type: z2.string(),
|
|
744
|
-
value: z2.unknown()
|
|
745
|
-
}).nullable()
|
|
746
|
-
})
|
|
747
|
-
);
|
|
748
|
-
|
|
749
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
750
|
-
var componentInstanceOverridesPropTypeUtil = createPropUtils3(
|
|
751
|
-
"overrides",
|
|
752
|
-
z3.array(z3.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
|
|
753
|
-
);
|
|
754
|
-
|
|
755
|
-
// src/prop-types/component-instance-prop-type.ts
|
|
756
|
-
import { createPropUtils as createPropUtils4, numberPropTypeUtil } from "@elementor/editor-props";
|
|
757
|
-
import { z as z4 } from "@elementor/schema";
|
|
758
|
-
var componentInstancePropTypeUtil = createPropUtils4(
|
|
759
|
-
"component-instance",
|
|
760
|
-
z4.object({
|
|
761
|
-
component_id: numberPropTypeUtil.schema,
|
|
762
|
-
overrides: z4.optional(componentInstanceOverridesPropTypeUtil.schema)
|
|
763
|
-
})
|
|
764
|
-
);
|
|
713
|
+
// src/utils/revert-overridable-settings.ts
|
|
714
|
+
import {
|
|
715
|
+
getAllDescendants,
|
|
716
|
+
getContainer,
|
|
717
|
+
getElementSetting,
|
|
718
|
+
updateElementSettings
|
|
719
|
+
} from "@elementor/editor-elements";
|
|
765
720
|
|
|
766
721
|
// src/create-component-type.ts
|
|
767
722
|
import {
|
|
@@ -1007,19 +962,69 @@ function createComponentModel() {
|
|
|
1007
962
|
});
|
|
1008
963
|
}
|
|
1009
964
|
|
|
965
|
+
// src/prop-types/component-instance-override-prop-type.ts
|
|
966
|
+
import { createPropUtils } from "@elementor/editor-props";
|
|
967
|
+
import { z } from "@elementor/schema";
|
|
968
|
+
var componentInstanceOverridePropTypeUtil = createPropUtils(
|
|
969
|
+
"override",
|
|
970
|
+
z.object({
|
|
971
|
+
override_key: z.string(),
|
|
972
|
+
override_value: z.unknown(),
|
|
973
|
+
schema_source: z.object({
|
|
974
|
+
type: z.literal("component"),
|
|
975
|
+
id: z.number()
|
|
976
|
+
})
|
|
977
|
+
})
|
|
978
|
+
);
|
|
979
|
+
|
|
980
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
981
|
+
import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
|
|
982
|
+
import { z as z3 } from "@elementor/schema";
|
|
983
|
+
|
|
984
|
+
// src/prop-types/component-overridable-prop-type.ts
|
|
985
|
+
import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
|
|
986
|
+
import { z as z2 } from "@elementor/schema";
|
|
987
|
+
var componentOverridablePropTypeUtil = createPropUtils2(
|
|
988
|
+
"overridable",
|
|
989
|
+
z2.object({
|
|
990
|
+
override_key: z2.string(),
|
|
991
|
+
origin_value: z2.object({
|
|
992
|
+
$$type: z2.string(),
|
|
993
|
+
value: z2.unknown()
|
|
994
|
+
}).nullable()
|
|
995
|
+
})
|
|
996
|
+
);
|
|
997
|
+
|
|
998
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
999
|
+
var componentInstanceOverridesPropTypeUtil = createPropUtils3(
|
|
1000
|
+
"overrides",
|
|
1001
|
+
z3.array(z3.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
|
|
1002
|
+
);
|
|
1003
|
+
|
|
1004
|
+
// src/prop-types/component-instance-prop-type.ts
|
|
1005
|
+
import { createPropUtils as createPropUtils4, numberPropTypeUtil } from "@elementor/editor-props";
|
|
1006
|
+
import { z as z4 } from "@elementor/schema";
|
|
1007
|
+
var componentInstancePropTypeUtil = createPropUtils4(
|
|
1008
|
+
"component-instance",
|
|
1009
|
+
z4.object({
|
|
1010
|
+
component_id: numberPropTypeUtil.schema,
|
|
1011
|
+
overrides: z4.optional(componentInstanceOverridesPropTypeUtil.schema)
|
|
1012
|
+
})
|
|
1013
|
+
);
|
|
1014
|
+
|
|
1010
1015
|
// src/utils/is-component-instance.ts
|
|
1011
1016
|
function isComponentInstance(elementModel) {
|
|
1012
1017
|
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
1013
1018
|
}
|
|
1014
1019
|
|
|
1015
|
-
// src/utils/revert-
|
|
1020
|
+
// src/utils/revert-overridable-settings.ts
|
|
1016
1021
|
function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
|
|
1017
1022
|
const container = getContainer(elementId);
|
|
1018
1023
|
if (!container) {
|
|
1019
1024
|
return;
|
|
1020
1025
|
}
|
|
1021
1026
|
if (isComponentInstance(container.model.toJSON())) {
|
|
1022
|
-
|
|
1027
|
+
revertComponentInstanceOverridableSetting(elementId, overrideKey);
|
|
1023
1028
|
return;
|
|
1024
1029
|
}
|
|
1025
1030
|
updateElementSettings({
|
|
@@ -1028,17 +1033,17 @@ function revertElementOverridableSetting(elementId, settingKey, originValue, ove
|
|
|
1028
1033
|
withHistory: false
|
|
1029
1034
|
});
|
|
1030
1035
|
}
|
|
1031
|
-
function
|
|
1036
|
+
function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
|
|
1032
1037
|
const setting = getElementSetting(elementId, "component_instance");
|
|
1033
1038
|
const componentInstance = componentInstancePropTypeUtil.extract(setting);
|
|
1034
1039
|
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1035
|
-
if (!overrides) {
|
|
1040
|
+
if (!overrides?.length) {
|
|
1036
1041
|
return;
|
|
1037
1042
|
}
|
|
1038
|
-
const
|
|
1043
|
+
const revertedOverrides = revertComponentInstanceOverrides(overrides, overrideKey);
|
|
1039
1044
|
const updatedSetting = componentInstancePropTypeUtil.create({
|
|
1040
1045
|
...componentInstance,
|
|
1041
|
-
overrides: componentInstanceOverridesPropTypeUtil.create(
|
|
1046
|
+
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
1042
1047
|
});
|
|
1043
1048
|
updateElementSettings({
|
|
1044
1049
|
id: elementId,
|
|
@@ -1046,22 +1051,103 @@ function revertComponentInstanceSetting(elementId, overrideKey) {
|
|
|
1046
1051
|
withHistory: false
|
|
1047
1052
|
});
|
|
1048
1053
|
}
|
|
1049
|
-
function
|
|
1054
|
+
function revertComponentInstanceOverrides(overrides, filterByKey) {
|
|
1050
1055
|
return overrides.map((item) => {
|
|
1051
|
-
|
|
1052
|
-
if (!isOverridable) {
|
|
1056
|
+
if (!componentOverridablePropTypeUtil.isValid(item)) {
|
|
1053
1057
|
return item;
|
|
1054
1058
|
}
|
|
1055
|
-
|
|
1056
|
-
if (!isOriginValueOverride2) {
|
|
1059
|
+
if (!componentInstanceOverridePropTypeUtil.isValid(item.value.origin_value)) {
|
|
1057
1060
|
return null;
|
|
1058
1061
|
}
|
|
1059
|
-
if (item.value.override_key !==
|
|
1062
|
+
if (filterByKey && item.value.override_key !== filterByKey) {
|
|
1060
1063
|
return item;
|
|
1061
1064
|
}
|
|
1062
1065
|
return item.value.origin_value;
|
|
1063
1066
|
}).filter((item) => item !== null);
|
|
1064
1067
|
}
|
|
1068
|
+
function revertOverridablePropsFromSettings(settings) {
|
|
1069
|
+
let hasChanges = false;
|
|
1070
|
+
const revertedSettings = {};
|
|
1071
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
1072
|
+
if (componentOverridablePropTypeUtil.isValid(value)) {
|
|
1073
|
+
revertedSettings[key] = value.value.origin_value;
|
|
1074
|
+
hasChanges = true;
|
|
1075
|
+
} else {
|
|
1076
|
+
revertedSettings[key] = value;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
return { hasChanges, settings: revertedSettings };
|
|
1080
|
+
}
|
|
1081
|
+
function revertAllOverridablesInElementData(elementData) {
|
|
1082
|
+
const revertedElement = { ...elementData };
|
|
1083
|
+
if (isComponentInstance({ widgetType: elementData.widgetType, elType: elementData.elType })) {
|
|
1084
|
+
revertedElement.settings = revertComponentInstanceSettings(elementData.settings);
|
|
1085
|
+
} else if (revertedElement.settings) {
|
|
1086
|
+
const { settings } = revertOverridablePropsFromSettings(revertedElement.settings);
|
|
1087
|
+
revertedElement.settings = settings;
|
|
1088
|
+
}
|
|
1089
|
+
if (revertedElement.elements) {
|
|
1090
|
+
revertedElement.elements = revertedElement.elements.map(revertAllOverridablesInElementData);
|
|
1091
|
+
}
|
|
1092
|
+
return revertedElement;
|
|
1093
|
+
}
|
|
1094
|
+
function revertComponentInstanceSettings(settings) {
|
|
1095
|
+
if (!settings?.component_instance) {
|
|
1096
|
+
return settings;
|
|
1097
|
+
}
|
|
1098
|
+
const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
|
|
1099
|
+
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1100
|
+
if (!overrides?.length) {
|
|
1101
|
+
return settings;
|
|
1102
|
+
}
|
|
1103
|
+
const revertedOverrides = revertComponentInstanceOverrides(overrides);
|
|
1104
|
+
return {
|
|
1105
|
+
...settings,
|
|
1106
|
+
component_instance: componentInstancePropTypeUtil.create({
|
|
1107
|
+
...componentInstance,
|
|
1108
|
+
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
1109
|
+
})
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
function revertAllOverridablesInContainer(container) {
|
|
1113
|
+
getAllDescendants(container).forEach((element) => {
|
|
1114
|
+
if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE) {
|
|
1115
|
+
revertComponentInstanceOverridesInElement(element);
|
|
1116
|
+
} else {
|
|
1117
|
+
revertElementSettings(element);
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
function revertComponentInstanceOverridesInElement(element) {
|
|
1122
|
+
const settings = element.settings?.toJSON() ?? {};
|
|
1123
|
+
const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
|
|
1124
|
+
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1125
|
+
if (!overrides?.length) {
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
const revertedOverrides = revertComponentInstanceOverrides(overrides);
|
|
1129
|
+
const updatedSetting = componentInstancePropTypeUtil.create({
|
|
1130
|
+
...componentInstance,
|
|
1131
|
+
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
1132
|
+
});
|
|
1133
|
+
updateElementSettings({
|
|
1134
|
+
id: element.id,
|
|
1135
|
+
props: { component_instance: updatedSetting },
|
|
1136
|
+
withHistory: false
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
function revertElementSettings(element) {
|
|
1140
|
+
const settings = element.settings?.toJSON() ?? {};
|
|
1141
|
+
const { hasChanges, settings: revertedSettings } = revertOverridablePropsFromSettings(settings);
|
|
1142
|
+
if (!hasChanges) {
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
updateElementSettings({
|
|
1146
|
+
id: element.id,
|
|
1147
|
+
props: revertedSettings,
|
|
1148
|
+
withHistory: false
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1065
1151
|
|
|
1066
1152
|
// src/store/actions/delete-overridable-prop.ts
|
|
1067
1153
|
function deleteOverridableProp({ componentId, propKey, source }) {
|
|
@@ -2114,7 +2200,7 @@ function getComponentName() {
|
|
|
2114
2200
|
}
|
|
2115
2201
|
|
|
2116
2202
|
// src/components/components-tab/components.tsx
|
|
2117
|
-
import * as
|
|
2203
|
+
import * as React18 from "react";
|
|
2118
2204
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
2119
2205
|
|
|
2120
2206
|
// src/hooks/use-components.ts
|
|
@@ -2185,12 +2271,10 @@ var ComponentSearch = () => {
|
|
|
2185
2271
|
};
|
|
2186
2272
|
|
|
2187
2273
|
// src/components/components-tab/components-list.tsx
|
|
2188
|
-
import * as
|
|
2189
|
-
import {
|
|
2190
|
-
import {
|
|
2191
|
-
import {
|
|
2192
|
-
import { Box as Box11, Button as Button4, Divider as Divider3, Link as Link3, List as List3, Stack as Stack9, Typography as Typography9 } from "@elementor/ui";
|
|
2193
|
-
import { __ as __20 } from "@wordpress/i18n";
|
|
2274
|
+
import * as React16 from "react";
|
|
2275
|
+
import { ComponentsIcon as ComponentsIcon2 } from "@elementor/icons";
|
|
2276
|
+
import { Box as Box11, Divider as Divider3, Link as Link3, List as List3, Stack as Stack9, Typography as Typography8 } from "@elementor/ui";
|
|
2277
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2194
2278
|
|
|
2195
2279
|
// src/hooks/use-components-permissions.ts
|
|
2196
2280
|
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
@@ -2206,7 +2290,7 @@ var useComponentsPermissions = () => {
|
|
|
2206
2290
|
|
|
2207
2291
|
// src/store/actions/rename-component.ts
|
|
2208
2292
|
import { getV1DocumentsManager as getV1DocumentsManager4, setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
2209
|
-
import { getAllDescendants } from "@elementor/editor-elements";
|
|
2293
|
+
import { getAllDescendants as getAllDescendants2 } from "@elementor/editor-elements";
|
|
2210
2294
|
import { __dispatch as dispatch8 } from "@elementor/store";
|
|
2211
2295
|
var TITLE_EXTERNAL_CHANGE_COMMAND = "title_external_change";
|
|
2212
2296
|
var renameComponent = (componentUid, newName) => {
|
|
@@ -2229,7 +2313,7 @@ function getDocumentContainer() {
|
|
|
2229
2313
|
return documentsManager?.getCurrent()?.container;
|
|
2230
2314
|
}
|
|
2231
2315
|
function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
2232
|
-
const allDescendants =
|
|
2316
|
+
const allDescendants = getAllDescendants2(documentContainer);
|
|
2233
2317
|
return allDescendants.filter((element) => {
|
|
2234
2318
|
const widgetType = element.model.get("widgetType");
|
|
2235
2319
|
const editorSettings = element.model.get("editor_settings");
|
|
@@ -2238,54 +2322,8 @@ function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
|
2238
2322
|
});
|
|
2239
2323
|
}
|
|
2240
2324
|
|
|
2241
|
-
// src/components/components-tab/angie-promotion-modal.tsx
|
|
2242
|
-
import * as React13 from "react";
|
|
2243
|
-
import {
|
|
2244
|
-
Button as Button3,
|
|
2245
|
-
Card,
|
|
2246
|
-
CardActions,
|
|
2247
|
-
CardContent,
|
|
2248
|
-
CardHeader,
|
|
2249
|
-
CardMedia,
|
|
2250
|
-
ClickAwayListener,
|
|
2251
|
-
CloseButton,
|
|
2252
|
-
Infotip,
|
|
2253
|
-
Typography as Typography7
|
|
2254
|
-
} from "@elementor/ui";
|
|
2255
|
-
import { __ as __15 } from "@wordpress/i18n";
|
|
2256
|
-
var ANGIE_INSTALL_URL = "/wp-admin/plugin-install.php?tab=plugin-information&plugin=angie";
|
|
2257
|
-
var PLACEHOLDER_IMAGE_URL = "https://assets.elementor.com/packages/v1/images/components-angie-promo.svg";
|
|
2258
|
-
var AngiePromotionModal = ({ children, open, onClose }) => {
|
|
2259
|
-
return /* @__PURE__ */ React13.createElement(Infotip, { placement: "right-end", arrow: true, content: /* @__PURE__ */ React13.createElement(AngiePromotionCard, { onClose }), open }, children);
|
|
2260
|
-
};
|
|
2261
|
-
function AngiePromotionCard({ onClose }) {
|
|
2262
|
-
const handleCtaClick = () => {
|
|
2263
|
-
window.open(ANGIE_INSTALL_URL, "_blank");
|
|
2264
|
-
onClose();
|
|
2265
|
-
};
|
|
2266
|
-
return /* @__PURE__ */ React13.createElement(ClickAwayListener, { disableReactTree: true, mouseEvent: "onMouseDown", touchEvent: "onTouchStart", onClickAway: onClose }, /* @__PURE__ */ React13.createElement(Card, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
|
|
2267
|
-
CardHeader,
|
|
2268
|
-
{
|
|
2269
|
-
title: __15("Add new component with AI", "elementor"),
|
|
2270
|
-
titleTypographyProps: { variant: "subtitle2" },
|
|
2271
|
-
action: /* @__PURE__ */ React13.createElement(CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: onClose })
|
|
2272
|
-
}
|
|
2273
|
-
), /* @__PURE__ */ React13.createElement(
|
|
2274
|
-
CardMedia,
|
|
2275
|
-
{
|
|
2276
|
-
component: "img",
|
|
2277
|
-
image: PLACEHOLDER_IMAGE_URL,
|
|
2278
|
-
alt: "",
|
|
2279
|
-
sx: { width: "100%", aspectRatio: "16 / 9" }
|
|
2280
|
-
}
|
|
2281
|
-
), /* @__PURE__ */ React13.createElement(CardContent, null, /* @__PURE__ */ React13.createElement(Typography7, { variant: "body2", color: "text.secondary" }, __15(
|
|
2282
|
-
"Angie our AI assistant can easily create new components and save you the hassle of doing it yourself",
|
|
2283
|
-
"elementor"
|
|
2284
|
-
))), /* @__PURE__ */ React13.createElement(CardActions, { sx: { justifyContent: "flex-end" } }, /* @__PURE__ */ React13.createElement(Button3, { size: "medium", variant: "contained", color: "accent", onClick: handleCtaClick }, __15("Get Angie", "elementor")))));
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
2325
|
// src/components/components-tab/components-item.tsx
|
|
2288
|
-
import * as
|
|
2326
|
+
import * as React14 from "react";
|
|
2289
2327
|
import { useRef as useRef4, useState as useState6 } from "react";
|
|
2290
2328
|
import { endDragElementFromPanel, startDragElementFromPanel } from "@elementor/editor-canvas";
|
|
2291
2329
|
import { dropElement } from "@elementor/editor-elements";
|
|
@@ -2301,20 +2339,20 @@ import {
|
|
|
2301
2339
|
Menu as Menu2,
|
|
2302
2340
|
Stack as Stack7,
|
|
2303
2341
|
styled as styled3,
|
|
2304
|
-
Typography as
|
|
2342
|
+
Typography as Typography7,
|
|
2305
2343
|
usePopupState as usePopupState3
|
|
2306
2344
|
} from "@elementor/ui";
|
|
2307
|
-
import { __ as
|
|
2345
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2308
2346
|
|
|
2309
2347
|
// src/store/actions/archive-component.ts
|
|
2310
2348
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
|
|
2311
2349
|
import { notify } from "@elementor/editor-notifications";
|
|
2312
2350
|
import { __dispatch as dispatch9 } from "@elementor/store";
|
|
2313
|
-
import { __ as
|
|
2351
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2314
2352
|
var successNotification = (componentId, componentName) => ({
|
|
2315
2353
|
type: "success",
|
|
2316
2354
|
/* translators: %s: component name */
|
|
2317
|
-
message:
|
|
2355
|
+
message: __15("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
2318
2356
|
id: `success-archived-components-notification-${componentId}`
|
|
2319
2357
|
});
|
|
2320
2358
|
var archiveComponent = (componentId, componentName) => {
|
|
@@ -2447,14 +2485,14 @@ import { __getState as getState14 } from "@elementor/store";
|
|
|
2447
2485
|
|
|
2448
2486
|
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2449
2487
|
import { z as z5 } from "@elementor/schema";
|
|
2450
|
-
import { __ as
|
|
2488
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2451
2489
|
var MIN_NAME_LENGTH = 2;
|
|
2452
2490
|
var MAX_NAME_LENGTH = 50;
|
|
2453
|
-
var baseComponentSchema = z5.string().trim().max(MAX_NAME_LENGTH,
|
|
2491
|
+
var baseComponentSchema = z5.string().trim().max(MAX_NAME_LENGTH, __16("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
2454
2492
|
var createBaseComponentSchema = (existingNames) => {
|
|
2455
2493
|
return z5.object({
|
|
2456
2494
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
2457
|
-
message:
|
|
2495
|
+
message: __16("Component name already exists", "elementor")
|
|
2458
2496
|
})
|
|
2459
2497
|
});
|
|
2460
2498
|
};
|
|
@@ -2462,9 +2500,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
2462
2500
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2463
2501
|
return baseSchema.extend({
|
|
2464
2502
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2465
|
-
message:
|
|
2503
|
+
message: __16("Component name is required.", "elementor")
|
|
2466
2504
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2467
|
-
message:
|
|
2505
|
+
message: __16("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2468
2506
|
})
|
|
2469
2507
|
});
|
|
2470
2508
|
};
|
|
@@ -2559,14 +2597,14 @@ var createComponentModel2 = (component) => {
|
|
|
2559
2597
|
};
|
|
2560
2598
|
|
|
2561
2599
|
// src/components/components-tab/delete-confirmation-dialog.tsx
|
|
2562
|
-
import * as
|
|
2600
|
+
import * as React13 from "react";
|
|
2563
2601
|
import { ConfirmationDialog } from "@elementor/editor-ui";
|
|
2564
|
-
import { __ as
|
|
2602
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
2565
2603
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
2566
|
-
return /* @__PURE__ */
|
|
2604
|
+
return /* @__PURE__ */ React13.createElement(ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React13.createElement(ConfirmationDialog.Title, null, __17("Delete this component?", "elementor")), /* @__PURE__ */ React13.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React13.createElement(ConfirmationDialog.ContentText, null, __17(
|
|
2567
2605
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
2568
2606
|
"elementor"
|
|
2569
|
-
))), /* @__PURE__ */
|
|
2607
|
+
))), /* @__PURE__ */ React13.createElement(ConfirmationDialog.Actions, { onClose, onConfirm }));
|
|
2570
2608
|
}
|
|
2571
2609
|
|
|
2572
2610
|
// src/components/components-tab/components-item.tsx
|
|
@@ -2612,7 +2650,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2612
2650
|
const handleDeleteDialogClose = () => {
|
|
2613
2651
|
setIsDeleteDialogOpen(false);
|
|
2614
2652
|
};
|
|
2615
|
-
return /* @__PURE__ */
|
|
2653
|
+
return /* @__PURE__ */ React14.createElement(Stack7, null, /* @__PURE__ */ React14.createElement(
|
|
2616
2654
|
WarningInfotip,
|
|
2617
2655
|
{
|
|
2618
2656
|
open: Boolean(error),
|
|
@@ -2621,7 +2659,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2621
2659
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
2622
2660
|
offset: [0, -15]
|
|
2623
2661
|
},
|
|
2624
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ React14.createElement(
|
|
2625
2663
|
ListItemButton,
|
|
2626
2664
|
{
|
|
2627
2665
|
draggable: true,
|
|
@@ -2640,7 +2678,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2640
2678
|
gap: 1
|
|
2641
2679
|
}
|
|
2642
2680
|
},
|
|
2643
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ React14.createElement(
|
|
2644
2682
|
Box9,
|
|
2645
2683
|
{
|
|
2646
2684
|
display: "flex",
|
|
@@ -2650,28 +2688,28 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2650
2688
|
flexGrow: 1,
|
|
2651
2689
|
onClick: handleClick
|
|
2652
2690
|
},
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ React14.createElement(ListItemIcon, { size: "tiny" }, /* @__PURE__ */ React14.createElement(ComponentsIcon, { fontSize: "tiny" })),
|
|
2692
|
+
/* @__PURE__ */ React14.createElement(Indicator, { isActive: isEditing, isError: !!error }, /* @__PURE__ */ React14.createElement(Box9, { display: "flex", flex: 1, minWidth: 0, flexGrow: 1 }, isEditing ? /* @__PURE__ */ React14.createElement(
|
|
2655
2693
|
EditableField2,
|
|
2656
2694
|
{
|
|
2657
2695
|
ref: editableRef,
|
|
2658
|
-
as:
|
|
2696
|
+
as: Typography7,
|
|
2659
2697
|
variant: "caption",
|
|
2660
2698
|
...getEditableProps()
|
|
2661
2699
|
}
|
|
2662
|
-
) : /* @__PURE__ */
|
|
2700
|
+
) : /* @__PURE__ */ React14.createElement(
|
|
2663
2701
|
EllipsisWithTooltip3,
|
|
2664
2702
|
{
|
|
2665
2703
|
title: component.name,
|
|
2666
|
-
as:
|
|
2704
|
+
as: Typography7,
|
|
2667
2705
|
variant: "caption",
|
|
2668
2706
|
color: "text.primary"
|
|
2669
2707
|
}
|
|
2670
2708
|
)))
|
|
2671
2709
|
),
|
|
2672
|
-
shouldShowActions && /* @__PURE__ */
|
|
2710
|
+
shouldShowActions && /* @__PURE__ */ React14.createElement(IconButton5, { size: "tiny", ...bindTrigger3(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React14.createElement(DotsVerticalIcon2, { fontSize: "tiny" }))
|
|
2673
2711
|
)
|
|
2674
|
-
), shouldShowActions && /* @__PURE__ */
|
|
2712
|
+
), shouldShowActions && /* @__PURE__ */ React14.createElement(
|
|
2675
2713
|
Menu2,
|
|
2676
2714
|
{
|
|
2677
2715
|
...bindMenu2(popupState),
|
|
@@ -2684,7 +2722,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2684
2722
|
horizontal: "right"
|
|
2685
2723
|
}
|
|
2686
2724
|
},
|
|
2687
|
-
canRename && /* @__PURE__ */
|
|
2725
|
+
canRename && /* @__PURE__ */ React14.createElement(
|
|
2688
2726
|
MenuListItem3,
|
|
2689
2727
|
{
|
|
2690
2728
|
sx: { minWidth: "160px" },
|
|
@@ -2694,18 +2732,18 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2694
2732
|
openEditMode();
|
|
2695
2733
|
}
|
|
2696
2734
|
},
|
|
2697
|
-
|
|
2735
|
+
__18("Rename", "elementor")
|
|
2698
2736
|
),
|
|
2699
|
-
canDelete && /* @__PURE__ */
|
|
2737
|
+
canDelete && /* @__PURE__ */ React14.createElement(
|
|
2700
2738
|
MenuListItem3,
|
|
2701
2739
|
{
|
|
2702
2740
|
sx: { minWidth: "160px" },
|
|
2703
2741
|
primaryTypographyProps: { variant: "caption", color: "error.light" },
|
|
2704
2742
|
onClick: handleDeleteClick
|
|
2705
2743
|
},
|
|
2706
|
-
|
|
2744
|
+
__18("Delete", "elementor")
|
|
2707
2745
|
)
|
|
2708
|
-
), /* @__PURE__ */
|
|
2746
|
+
), /* @__PURE__ */ React14.createElement(
|
|
2709
2747
|
DeleteConfirmationDialog,
|
|
2710
2748
|
{
|
|
2711
2749
|
open: isDeleteDialogOpen,
|
|
@@ -2756,12 +2794,12 @@ var getIndicatorBorder = ({ isActive, isError, theme }) => {
|
|
|
2756
2794
|
};
|
|
2757
2795
|
|
|
2758
2796
|
// src/components/components-tab/loading-components.tsx
|
|
2759
|
-
import * as
|
|
2797
|
+
import * as React15 from "react";
|
|
2760
2798
|
import { Box as Box10, ListItemButton as ListItemButton2, Skeleton, Stack as Stack8 } from "@elementor/ui";
|
|
2761
2799
|
var ROWS_COUNT = 6;
|
|
2762
2800
|
var rows = Array.from({ length: ROWS_COUNT }, (_, index) => index);
|
|
2763
2801
|
var LoadingComponents = () => {
|
|
2764
|
-
return /* @__PURE__ */
|
|
2802
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2765
2803
|
Stack8,
|
|
2766
2804
|
{
|
|
2767
2805
|
"aria-label": "Loading components",
|
|
@@ -2783,14 +2821,14 @@ var LoadingComponents = () => {
|
|
|
2783
2821
|
}
|
|
2784
2822
|
}
|
|
2785
2823
|
},
|
|
2786
|
-
rows.map((row) => /* @__PURE__ */
|
|
2824
|
+
rows.map((row) => /* @__PURE__ */ React15.createElement(
|
|
2787
2825
|
ListItemButton2,
|
|
2788
2826
|
{
|
|
2789
2827
|
key: row,
|
|
2790
2828
|
sx: { border: "solid 1px", borderColor: "divider", py: 0.5, px: 1 },
|
|
2791
2829
|
shape: "rounded"
|
|
2792
2830
|
},
|
|
2793
|
-
/* @__PURE__ */
|
|
2831
|
+
/* @__PURE__ */ React15.createElement(Box10, { display: "flex", gap: 1, width: "100%" }, /* @__PURE__ */ React15.createElement(Skeleton, { variant: "text", width: "24px", height: "36px" }), /* @__PURE__ */ React15.createElement(Skeleton, { variant: "text", width: "100%", height: "36px" }))
|
|
2794
2832
|
))
|
|
2795
2833
|
);
|
|
2796
2834
|
};
|
|
@@ -2804,16 +2842,16 @@ var SUBTITLE_OVERRIDE_SX = {
|
|
|
2804
2842
|
function ComponentsList() {
|
|
2805
2843
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
2806
2844
|
if (isLoading) {
|
|
2807
|
-
return /* @__PURE__ */
|
|
2845
|
+
return /* @__PURE__ */ React16.createElement(LoadingComponents, null);
|
|
2808
2846
|
}
|
|
2809
2847
|
const isEmpty = !components || components.length === 0;
|
|
2810
2848
|
if (isEmpty) {
|
|
2811
2849
|
if (searchValue.length > 0) {
|
|
2812
|
-
return /* @__PURE__ */
|
|
2850
|
+
return /* @__PURE__ */ React16.createElement(EmptySearchResult, null);
|
|
2813
2851
|
}
|
|
2814
|
-
return /* @__PURE__ */
|
|
2852
|
+
return /* @__PURE__ */ React16.createElement(EmptyState, null);
|
|
2815
2853
|
}
|
|
2816
|
-
return /* @__PURE__ */
|
|
2854
|
+
return /* @__PURE__ */ React16.createElement(List3, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React16.createElement(
|
|
2817
2855
|
ComponentItem,
|
|
2818
2856
|
{
|
|
2819
2857
|
key: component.uid,
|
|
@@ -2825,23 +2863,8 @@ function ComponentsList() {
|
|
|
2825
2863
|
)));
|
|
2826
2864
|
}
|
|
2827
2865
|
var EmptyState = () => {
|
|
2828
|
-
const [isAngieModalOpen, setIsAngieModalOpen] = useState7(false);
|
|
2829
2866
|
const { canCreate } = useComponentsPermissions();
|
|
2830
|
-
|
|
2831
|
-
const sdk = getAngieSdk();
|
|
2832
|
-
if (sdk.isAngieReady()) {
|
|
2833
|
-
sdk.triggerAngie({
|
|
2834
|
-
prompt: __20(
|
|
2835
|
-
"Create a [hero/testimonial/product card/CTA/feature] component for my [business type]. Include [describe what you want]",
|
|
2836
|
-
"elementor"
|
|
2837
|
-
),
|
|
2838
|
-
context: { source: "components-panel-empty-state" }
|
|
2839
|
-
});
|
|
2840
|
-
} else {
|
|
2841
|
-
setIsAngieModalOpen(true);
|
|
2842
|
-
}
|
|
2843
|
-
};
|
|
2844
|
-
return /* @__PURE__ */ React17.createElement(
|
|
2867
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2845
2868
|
Stack9,
|
|
2846
2869
|
{
|
|
2847
2870
|
alignItems: "center",
|
|
@@ -2851,10 +2874,10 @@ var EmptyState = () => {
|
|
|
2851
2874
|
gap: 2,
|
|
2852
2875
|
overflow: "hidden"
|
|
2853
2876
|
},
|
|
2854
|
-
/* @__PURE__ */
|
|
2877
|
+
/* @__PURE__ */ React16.createElement(Stack9, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(ComponentsIcon2, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React16.createElement(Typography8, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, __19("No components yet", "elementor")), /* @__PURE__ */ React16.createElement(Typography8, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 200 } }, __19("Components are reusable blocks that sync across your site.", "elementor"), /* @__PURE__ */ React16.createElement("br", null), canCreate ? __19("Create once, use everywhere.", "elementor") : __19(
|
|
2855
2878
|
"With your current role, you cannot create components. Contact an administrator to create one.",
|
|
2856
2879
|
"elementor"
|
|
2857
|
-
)), /* @__PURE__ */
|
|
2880
|
+
)), /* @__PURE__ */ React16.createElement(
|
|
2858
2881
|
Link3,
|
|
2859
2882
|
{
|
|
2860
2883
|
href: LEARN_MORE_URL,
|
|
@@ -2863,36 +2886,26 @@ var EmptyState = () => {
|
|
|
2863
2886
|
variant: "caption",
|
|
2864
2887
|
color: "info.main"
|
|
2865
2888
|
},
|
|
2866
|
-
|
|
2889
|
+
__19("Learn more about components", "elementor")
|
|
2867
2890
|
)),
|
|
2868
|
-
canCreate && /* @__PURE__ */
|
|
2869
|
-
|
|
2891
|
+
canCreate && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Divider3, { sx: { width: "100%" } }), /* @__PURE__ */ React16.createElement(Stack9, { alignItems: "center", gap: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(
|
|
2892
|
+
Typography8,
|
|
2870
2893
|
{
|
|
2871
2894
|
align: "center",
|
|
2872
2895
|
variant: "subtitle2",
|
|
2873
2896
|
color: "text.secondary",
|
|
2874
2897
|
sx: SUBTITLE_OVERRIDE_SX
|
|
2875
2898
|
},
|
|
2876
|
-
|
|
2877
|
-
), /* @__PURE__ */
|
|
2899
|
+
__19("Create your first one:", "elementor")
|
|
2900
|
+
), /* @__PURE__ */ React16.createElement(Typography8, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 228 } }, __19(
|
|
2878
2901
|
'Right-click any div-block or flexbox on your canvas or structure and select "Create component"',
|
|
2879
2902
|
"elementor"
|
|
2880
|
-
)), /* @__PURE__ */ React17.createElement(Typography9, { align: "center", variant: "caption", color: "secondary" }, __20("Or", "elementor")), /* @__PURE__ */ React17.createElement(AngiePromotionModal, { open: isAngieModalOpen, onClose: () => setIsAngieModalOpen(false) }, /* @__PURE__ */ React17.createElement(
|
|
2881
|
-
Button4,
|
|
2882
|
-
{
|
|
2883
|
-
color: "secondary",
|
|
2884
|
-
variant: "outlined",
|
|
2885
|
-
size: "small",
|
|
2886
|
-
onClick: handleCreateWithAI,
|
|
2887
|
-
endIcon: /* @__PURE__ */ React17.createElement(AIIcon, null)
|
|
2888
|
-
},
|
|
2889
|
-
__20("Create component with AI", "elementor")
|
|
2890
2903
|
))))
|
|
2891
2904
|
);
|
|
2892
2905
|
};
|
|
2893
2906
|
var EmptySearchResult = () => {
|
|
2894
2907
|
const { searchValue, clearSearch } = useSearch();
|
|
2895
|
-
return /* @__PURE__ */
|
|
2908
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2896
2909
|
Stack9,
|
|
2897
2910
|
{
|
|
2898
2911
|
color: "text.secondary",
|
|
@@ -2902,17 +2915,17 @@ var EmptySearchResult = () => {
|
|
|
2902
2915
|
overflow: "hidden",
|
|
2903
2916
|
justifySelf: "center"
|
|
2904
2917
|
},
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ React16.createElement(ComponentsIcon2, null),
|
|
2919
|
+
/* @__PURE__ */ React16.createElement(
|
|
2907
2920
|
Box11,
|
|
2908
2921
|
{
|
|
2909
2922
|
sx: {
|
|
2910
2923
|
width: "100%"
|
|
2911
2924
|
}
|
|
2912
2925
|
},
|
|
2913
|
-
/* @__PURE__ */
|
|
2914
|
-
searchValue && /* @__PURE__ */
|
|
2915
|
-
|
|
2926
|
+
/* @__PURE__ */ React16.createElement(Typography8, { align: "center", variant: "subtitle2", color: "inherit", sx: SUBTITLE_OVERRIDE_SX }, __19("Sorry, nothing matched", "elementor")),
|
|
2927
|
+
searchValue && /* @__PURE__ */ React16.createElement(
|
|
2928
|
+
Typography8,
|
|
2916
2929
|
{
|
|
2917
2930
|
variant: "subtitle2",
|
|
2918
2931
|
color: "inherit",
|
|
@@ -2923,8 +2936,8 @@ var EmptySearchResult = () => {
|
|
|
2923
2936
|
justifyContent: "center"
|
|
2924
2937
|
}
|
|
2925
2938
|
},
|
|
2926
|
-
/* @__PURE__ */
|
|
2927
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201C"),
|
|
2940
|
+
/* @__PURE__ */ React16.createElement(
|
|
2928
2941
|
"span",
|
|
2929
2942
|
{
|
|
2930
2943
|
style: {
|
|
@@ -2935,11 +2948,11 @@ var EmptySearchResult = () => {
|
|
|
2935
2948
|
},
|
|
2936
2949
|
searchValue
|
|
2937
2950
|
),
|
|
2938
|
-
/* @__PURE__ */
|
|
2951
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201D.")
|
|
2939
2952
|
)
|
|
2940
2953
|
),
|
|
2941
|
-
/* @__PURE__ */
|
|
2942
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ React16.createElement(Typography8, { align: "center", variant: "caption", color: "inherit" }, __19("Try something else.", "elementor")),
|
|
2955
|
+
/* @__PURE__ */ React16.createElement(Typography8, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(Link3, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, __19("Clear & try again", "elementor")))
|
|
2943
2956
|
);
|
|
2944
2957
|
};
|
|
2945
2958
|
var useFilteredComponents = () => {
|
|
@@ -2955,12 +2968,12 @@ var useFilteredComponents = () => {
|
|
|
2955
2968
|
};
|
|
2956
2969
|
|
|
2957
2970
|
// src/components/components-tab/components-pro-notification.tsx
|
|
2958
|
-
import * as
|
|
2971
|
+
import * as React17 from "react";
|
|
2959
2972
|
import { InfoAlert } from "@elementor/editor-ui";
|
|
2960
|
-
import { Box as Box12, Typography as
|
|
2961
|
-
import { __ as
|
|
2973
|
+
import { Box as Box12, Typography as Typography9 } from "@elementor/ui";
|
|
2974
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2962
2975
|
function ComponentsProNotification() {
|
|
2963
|
-
return /* @__PURE__ */
|
|
2976
|
+
return /* @__PURE__ */ React17.createElement(Box12, { sx: { px: 2 } }, /* @__PURE__ */ React17.createElement(InfoAlert, null, /* @__PURE__ */ React17.createElement(Typography9, { variant: "caption", component: "span" }, /* @__PURE__ */ React17.createElement(Typography9, { variant: "caption", component: "span", fontWeight: "bold" }, __20("Try Components for free:", "elementor")), " ", __20(
|
|
2964
2977
|
"Soon Components will be part of the Pro subscription, but what you create now will remain on your site.",
|
|
2965
2978
|
"elementor"
|
|
2966
2979
|
))));
|
|
@@ -2970,10 +2983,10 @@ function ComponentsProNotification() {
|
|
|
2970
2983
|
var ComponentsContent = () => {
|
|
2971
2984
|
const { components, isLoading } = useComponents();
|
|
2972
2985
|
const hasComponents = !isLoading && components.length > 0;
|
|
2973
|
-
return /* @__PURE__ */
|
|
2986
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, hasComponents && /* @__PURE__ */ React18.createElement(ComponentSearch, null), hasComponents && !isProUser() && /* @__PURE__ */ React18.createElement(ComponentsProNotification, null), /* @__PURE__ */ React18.createElement(ComponentsList, null));
|
|
2974
2987
|
};
|
|
2975
2988
|
var Components = () => {
|
|
2976
|
-
return /* @__PURE__ */
|
|
2989
|
+
return /* @__PURE__ */ React18.createElement(ThemeProvider2, null, /* @__PURE__ */ React18.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React18.createElement(ComponentsContent, null)));
|
|
2977
2990
|
};
|
|
2978
2991
|
|
|
2979
2992
|
// src/components/consts.ts
|
|
@@ -2981,22 +2994,22 @@ var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
|
2981
2994
|
var OVERRIDABLE_PROP_REPLACEMENT_ID = "overridable-prop";
|
|
2982
2995
|
|
|
2983
2996
|
// src/components/create-component-form/create-component-form.tsx
|
|
2984
|
-
import * as
|
|
2985
|
-
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef5, useState as
|
|
2997
|
+
import * as React19 from "react";
|
|
2998
|
+
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef5, useState as useState8 } from "react";
|
|
2986
2999
|
import { getElementLabel } from "@elementor/editor-elements";
|
|
2987
3000
|
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
2988
3001
|
import { Form as FormElement, ThemeProvider as ThemeProvider3 } from "@elementor/editor-ui";
|
|
2989
3002
|
import { ComponentsIcon as ComponentsIcon3 } from "@elementor/icons";
|
|
2990
3003
|
import { __getState as getState15 } from "@elementor/store";
|
|
2991
|
-
import { Button as
|
|
2992
|
-
import { __ as
|
|
3004
|
+
import { Button as Button3, FormLabel as FormLabel2, Grid as Grid2, Popover as Popover3, Stack as Stack10, TextField as TextField3, Typography as Typography10 } from "@elementor/ui";
|
|
3005
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2993
3006
|
|
|
2994
3007
|
// src/prevent-non-atomic-nesting.ts
|
|
2995
3008
|
import { isAtomicWidget } from "@elementor/editor-canvas";
|
|
2996
|
-
import { getAllDescendants as
|
|
3009
|
+
import { getAllDescendants as getAllDescendants3, getElementType } from "@elementor/editor-elements";
|
|
2997
3010
|
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2998
3011
|
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
2999
|
-
import { __ as
|
|
3012
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3000
3013
|
|
|
3001
3014
|
// src/utils/is-editing-component.ts
|
|
3002
3015
|
import { __getStore as getStore } from "@elementor/store";
|
|
@@ -3011,7 +3024,7 @@ function isEditingComponent() {
|
|
|
3011
3024
|
// src/prevent-non-atomic-nesting.ts
|
|
3012
3025
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
3013
3026
|
type: "default",
|
|
3014
|
-
message:
|
|
3027
|
+
message: __21("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
3015
3028
|
id: "non-atomic-element-blocked"
|
|
3016
3029
|
};
|
|
3017
3030
|
function initNonAtomicNestingPrevention() {
|
|
@@ -3055,7 +3068,7 @@ function blockNonAtomicMove(args) {
|
|
|
3055
3068
|
if (!container) {
|
|
3056
3069
|
return false;
|
|
3057
3070
|
}
|
|
3058
|
-
const allElements =
|
|
3071
|
+
const allElements = getAllDescendants3(container);
|
|
3059
3072
|
return allElements.some((element) => !isAtomicWidget(element));
|
|
3060
3073
|
});
|
|
3061
3074
|
if (hasNonAtomicElement) {
|
|
@@ -3123,10 +3136,11 @@ async function createUnpublishedComponent({
|
|
|
3123
3136
|
}) {
|
|
3124
3137
|
const generatedUid = uid ?? generateUniqueId3("component");
|
|
3125
3138
|
const componentBase = { uid: generatedUid, name };
|
|
3139
|
+
const elementDataWithOverridablesReverted = revertAllOverridablesInElementData(element);
|
|
3126
3140
|
dispatch12(
|
|
3127
3141
|
slice.actions.addUnpublished({
|
|
3128
3142
|
...componentBase,
|
|
3129
|
-
elements: [
|
|
3143
|
+
elements: [elementDataWithOverridablesReverted],
|
|
3130
3144
|
overridableProps
|
|
3131
3145
|
})
|
|
3132
3146
|
);
|
|
@@ -3144,10 +3158,10 @@ async function createUnpublishedComponent({
|
|
|
3144
3158
|
}
|
|
3145
3159
|
|
|
3146
3160
|
// src/components/create-component-form/hooks/use-form.ts
|
|
3147
|
-
import { useMemo as useMemo2, useState as
|
|
3161
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
3148
3162
|
var useForm = (initialValues) => {
|
|
3149
|
-
const [values, setValues] =
|
|
3150
|
-
const [errors, setErrors] =
|
|
3163
|
+
const [values, setValues] = useState7(initialValues);
|
|
3164
|
+
const [errors, setErrors] = useState7({});
|
|
3151
3165
|
const isValid = useMemo2(() => {
|
|
3152
3166
|
return !Object.values(errors).some((error) => error);
|
|
3153
3167
|
}, [errors]);
|
|
@@ -3223,8 +3237,8 @@ function countNestedElements(container) {
|
|
|
3223
3237
|
|
|
3224
3238
|
// src/components/create-component-form/create-component-form.tsx
|
|
3225
3239
|
function CreateComponentForm() {
|
|
3226
|
-
const [element, setElement] =
|
|
3227
|
-
const [anchorPosition, setAnchorPosition] =
|
|
3240
|
+
const [element, setElement] = useState8(null);
|
|
3241
|
+
const [anchorPosition, setAnchorPosition] = useState8();
|
|
3228
3242
|
const eventData = useRef5(null);
|
|
3229
3243
|
useEffect2(() => {
|
|
3230
3244
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
@@ -3233,7 +3247,7 @@ function CreateComponentForm() {
|
|
|
3233
3247
|
if (nonAtomicElements.length > 0) {
|
|
3234
3248
|
notify3({
|
|
3235
3249
|
type: "default",
|
|
3236
|
-
message:
|
|
3250
|
+
message: __22(
|
|
3237
3251
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
3238
3252
|
"elementor"
|
|
3239
3253
|
),
|
|
@@ -3274,12 +3288,12 @@ function CreateComponentForm() {
|
|
|
3274
3288
|
}
|
|
3275
3289
|
notify3({
|
|
3276
3290
|
type: "success",
|
|
3277
|
-
message:
|
|
3291
|
+
message: __22("Component created successfully.", "elementor"),
|
|
3278
3292
|
id: `component-saved-successfully-${uid}`
|
|
3279
3293
|
});
|
|
3280
3294
|
resetAndClosePopup();
|
|
3281
3295
|
} catch {
|
|
3282
|
-
const errorMessage =
|
|
3296
|
+
const errorMessage = __22("Failed to create component. Please try again.", "elementor");
|
|
3283
3297
|
notify3({
|
|
3284
3298
|
type: "error",
|
|
3285
3299
|
message: errorMessage,
|
|
@@ -3299,7 +3313,7 @@ function CreateComponentForm() {
|
|
|
3299
3313
|
...eventData.current
|
|
3300
3314
|
});
|
|
3301
3315
|
};
|
|
3302
|
-
return /* @__PURE__ */
|
|
3316
|
+
return /* @__PURE__ */ React19.createElement(ThemeProvider3, null, /* @__PURE__ */ React19.createElement(
|
|
3303
3317
|
Popover3,
|
|
3304
3318
|
{
|
|
3305
3319
|
open: element !== null,
|
|
@@ -3307,7 +3321,7 @@ function CreateComponentForm() {
|
|
|
3307
3321
|
anchorReference: "anchorPosition",
|
|
3308
3322
|
anchorPosition
|
|
3309
3323
|
},
|
|
3310
|
-
element !== null && /* @__PURE__ */
|
|
3324
|
+
element !== null && /* @__PURE__ */ React19.createElement(
|
|
3311
3325
|
Form2,
|
|
3312
3326
|
{
|
|
3313
3327
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -3343,13 +3357,13 @@ var Form2 = ({
|
|
|
3343
3357
|
}
|
|
3344
3358
|
};
|
|
3345
3359
|
const texts = {
|
|
3346
|
-
heading:
|
|
3347
|
-
name:
|
|
3348
|
-
cancel:
|
|
3349
|
-
create:
|
|
3360
|
+
heading: __22("Create component", "elementor"),
|
|
3361
|
+
name: __22("Name", "elementor"),
|
|
3362
|
+
cancel: __22("Cancel", "elementor"),
|
|
3363
|
+
create: __22("Create", "elementor")
|
|
3350
3364
|
};
|
|
3351
3365
|
const nameInputId = "component-name";
|
|
3352
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ React19.createElement(FormElement, { onSubmit: handleSubmit }, /* @__PURE__ */ React19.createElement(Stack10, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React19.createElement(
|
|
3353
3367
|
Stack10,
|
|
3354
3368
|
{
|
|
3355
3369
|
direction: "row",
|
|
@@ -3358,9 +3372,9 @@ var Form2 = ({
|
|
|
3358
3372
|
px: 1.5,
|
|
3359
3373
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
3360
3374
|
},
|
|
3361
|
-
/* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3363
|
-
), /* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ React19.createElement(ComponentsIcon3, { fontSize: FONT_SIZE }),
|
|
3376
|
+
/* @__PURE__ */ React19.createElement(Typography10, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, texts.heading)
|
|
3377
|
+
), /* @__PURE__ */ React19.createElement(Grid2, { container: true, gap: 0.75, alignItems: "start", p: 1.5 }, /* @__PURE__ */ React19.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React19.createElement(FormLabel2, { htmlFor: nameInputId, size: "tiny" }, texts.name)), /* @__PURE__ */ React19.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React19.createElement(
|
|
3364
3378
|
TextField3,
|
|
3365
3379
|
{
|
|
3366
3380
|
id: nameInputId,
|
|
@@ -3372,12 +3386,12 @@ var Form2 = ({
|
|
|
3372
3386
|
error: Boolean(errors.componentName),
|
|
3373
3387
|
helperText: errors.componentName
|
|
3374
3388
|
}
|
|
3375
|
-
))), /* @__PURE__ */
|
|
3389
|
+
))), /* @__PURE__ */ React19.createElement(Stack10, { direction: "row", justifyContent: "flex-end", alignSelf: "end", py: 1, px: 1.5 }, /* @__PURE__ */ React19.createElement(Button3, { onClick: closePopup, color: "secondary", variant: "text", size: "small" }, texts.cancel), /* @__PURE__ */ React19.createElement(Button3, { type: "submit", disabled: !isValid, variant: "contained", color: "primary", size: "small" }, texts.create))));
|
|
3376
3390
|
};
|
|
3377
3391
|
|
|
3378
3392
|
// src/components/edit-component/edit-component.tsx
|
|
3379
|
-
import * as
|
|
3380
|
-
import { useEffect as useEffect5, useState as
|
|
3393
|
+
import * as React21 from "react";
|
|
3394
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
3381
3395
|
import { getV1DocumentsManager as getV1DocumentsManager5 } from "@elementor/editor-documents";
|
|
3382
3396
|
import { __privateListenTo as listenTo, commandEndEvent as commandEndEvent2 } from "@elementor/editor-v1-adapters";
|
|
3383
3397
|
import { __useSelector as useSelector5 } from "@elementor/store";
|
|
@@ -3399,10 +3413,10 @@ function updateCurrentComponent({
|
|
|
3399
3413
|
}
|
|
3400
3414
|
|
|
3401
3415
|
// src/components/edit-component/component-modal.tsx
|
|
3402
|
-
import * as
|
|
3416
|
+
import * as React20 from "react";
|
|
3403
3417
|
import { useEffect as useEffect4 } from "react";
|
|
3404
3418
|
import { createPortal } from "react-dom";
|
|
3405
|
-
import { __ as
|
|
3419
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3406
3420
|
|
|
3407
3421
|
// src/hooks/use-canvas-document.ts
|
|
3408
3422
|
import {
|
|
@@ -3415,10 +3429,10 @@ function useCanvasDocument() {
|
|
|
3415
3429
|
}
|
|
3416
3430
|
|
|
3417
3431
|
// src/hooks/use-element-rect.ts
|
|
3418
|
-
import { useEffect as useEffect3, useState as
|
|
3432
|
+
import { useEffect as useEffect3, useState as useState9 } from "react";
|
|
3419
3433
|
import { throttle } from "@elementor/utils";
|
|
3420
3434
|
function useElementRect(element) {
|
|
3421
|
-
const [rect, setRect] =
|
|
3435
|
+
const [rect, setRect] = useState9(new DOMRect(0, 0, 0, 0));
|
|
3422
3436
|
const onChange = throttle(
|
|
3423
3437
|
() => {
|
|
3424
3438
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -3495,7 +3509,7 @@ function ComponentModal({ topLevelElementDom, onClose }) {
|
|
|
3495
3509
|
return null;
|
|
3496
3510
|
}
|
|
3497
3511
|
return createPortal(
|
|
3498
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(BlockEditPage, null), /* @__PURE__ */ React20.createElement(Backdrop, { canvas: canvasDocument, element: topLevelElementDom, onClose })),
|
|
3499
3513
|
canvasDocument.body
|
|
3500
3514
|
);
|
|
3501
3515
|
}
|
|
@@ -3524,7 +3538,7 @@ function Backdrop({
|
|
|
3524
3538
|
onClose();
|
|
3525
3539
|
}
|
|
3526
3540
|
};
|
|
3527
|
-
return /* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ React20.createElement(
|
|
3528
3542
|
"div",
|
|
3529
3543
|
{
|
|
3530
3544
|
style: backdropStyle,
|
|
@@ -3532,7 +3546,7 @@ function Backdrop({
|
|
|
3532
3546
|
onKeyDown: handleKeyDown,
|
|
3533
3547
|
role: "button",
|
|
3534
3548
|
tabIndex: 0,
|
|
3535
|
-
"aria-label":
|
|
3549
|
+
"aria-label": __23("Exit component editing mode", "elementor")
|
|
3536
3550
|
}
|
|
3537
3551
|
);
|
|
3538
3552
|
}
|
|
@@ -3572,7 +3586,7 @@ function BlockEditPage() {
|
|
|
3572
3586
|
}
|
|
3573
3587
|
}
|
|
3574
3588
|
`;
|
|
3575
|
-
return /* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ React20.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
3576
3590
|
}
|
|
3577
3591
|
|
|
3578
3592
|
// src/components/edit-component/edit-component.tsx
|
|
@@ -3585,7 +3599,7 @@ function EditComponent() {
|
|
|
3585
3599
|
if (!currentComponentId) {
|
|
3586
3600
|
return null;
|
|
3587
3601
|
}
|
|
3588
|
-
return /* @__PURE__ */
|
|
3602
|
+
return /* @__PURE__ */ React21.createElement(ComponentModal, { topLevelElementDom, onClose });
|
|
3589
3603
|
}
|
|
3590
3604
|
function useHandleDocumentSwitches() {
|
|
3591
3605
|
const documentsManager = getV1DocumentsManager5();
|
|
@@ -3644,7 +3658,7 @@ function getInstanceTitle(instanceId, path) {
|
|
|
3644
3658
|
}
|
|
3645
3659
|
function useComponentDOMElement(id2) {
|
|
3646
3660
|
const { componentContainerDomElement, topLevelElementDom } = getComponentDOMElements(id2);
|
|
3647
|
-
const [currentElementDom, setCurrentElementDom] =
|
|
3661
|
+
const [currentElementDom, setCurrentElementDom] = useState10(topLevelElementDom);
|
|
3648
3662
|
useEffect5(() => {
|
|
3649
3663
|
setCurrentElementDom(topLevelElementDom);
|
|
3650
3664
|
}, [topLevelElementDom]);
|
|
@@ -3676,26 +3690,26 @@ function getComponentDOMElements(id2) {
|
|
|
3676
3690
|
}
|
|
3677
3691
|
|
|
3678
3692
|
// src/components/in-edit-mode.tsx
|
|
3679
|
-
import * as
|
|
3693
|
+
import * as React22 from "react";
|
|
3680
3694
|
import { closeDialog, openDialog } from "@elementor/editor-ui";
|
|
3681
3695
|
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
3682
|
-
import { Box as Box13, Button as
|
|
3683
|
-
import { __ as
|
|
3696
|
+
import { Box as Box13, Button as Button4, DialogActions, DialogContent, DialogHeader, Icon, Stack as Stack11, Typography as Typography11 } from "@elementor/ui";
|
|
3697
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3684
3698
|
var openEditModeDialog = (lockedBy) => {
|
|
3685
3699
|
openDialog({
|
|
3686
|
-
component: /* @__PURE__ */
|
|
3700
|
+
component: /* @__PURE__ */ React22.createElement(EditModeDialog, { lockedBy })
|
|
3687
3701
|
});
|
|
3688
3702
|
};
|
|
3689
3703
|
var EditModeDialog = ({ lockedBy }) => {
|
|
3690
|
-
const content =
|
|
3691
|
-
return /* @__PURE__ */
|
|
3704
|
+
const content = __24("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
3705
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React22.createElement(Box13, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React22.createElement(Icon, { color: "secondary" }, /* @__PURE__ */ React22.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React22.createElement(Typography11, { variant: "subtitle1" }, content))), /* @__PURE__ */ React22.createElement(DialogContent, null, /* @__PURE__ */ React22.createElement(Stack11, { spacing: 2, direction: "column" }, /* @__PURE__ */ React22.createElement(Typography11, { variant: "body2" }, __24(
|
|
3692
3706
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
3693
3707
|
"elementor"
|
|
3694
|
-
)), /* @__PURE__ */
|
|
3708
|
+
)), /* @__PURE__ */ React22.createElement(DialogActions, null, /* @__PURE__ */ React22.createElement(Button4, { color: "secondary", variant: "contained", onClick: closeDialog }, __24("Close", "elementor"))))));
|
|
3695
3709
|
};
|
|
3696
3710
|
|
|
3697
3711
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
3698
|
-
import * as
|
|
3712
|
+
import * as React28 from "react";
|
|
3699
3713
|
import { ControlAdornmentsProvider } from "@elementor/editor-controls";
|
|
3700
3714
|
import { getFieldIndicators } from "@elementor/editor-editing-panel";
|
|
3701
3715
|
import { useSelectedElement as useSelectedElement2 } from "@elementor/editor-elements";
|
|
@@ -3703,7 +3717,7 @@ import { PanelBody as PanelBody2, PanelHeader as PanelHeader3, PanelHeaderTitle
|
|
|
3703
3717
|
import { EllipsisWithTooltip as EllipsisWithTooltip4 } from "@elementor/editor-ui";
|
|
3704
3718
|
import { ComponentsIcon as ComponentsIcon4, PencilIcon as PencilIcon2 } from "@elementor/icons";
|
|
3705
3719
|
import { Divider as Divider4, IconButton as IconButton6, Stack as Stack16, Tooltip as Tooltip5 } from "@elementor/ui";
|
|
3706
|
-
import { __ as
|
|
3720
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
3707
3721
|
|
|
3708
3722
|
// src/hooks/use-component-instance-settings.ts
|
|
3709
3723
|
import { useElement } from "@elementor/editor-editing-panel";
|
|
@@ -3715,20 +3729,20 @@ function useComponentInstanceSettings() {
|
|
|
3715
3729
|
}
|
|
3716
3730
|
|
|
3717
3731
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
3718
|
-
import * as
|
|
3732
|
+
import * as React23 from "react";
|
|
3719
3733
|
import { ComponentPropListIcon as ComponentPropListIcon4, PencilIcon } from "@elementor/icons";
|
|
3720
|
-
import { Button as
|
|
3721
|
-
import { __ as
|
|
3734
|
+
import { Button as Button5, Stack as Stack12, Typography as Typography12 } from "@elementor/ui";
|
|
3735
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3722
3736
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
3723
3737
|
const { canEdit } = useComponentsPermissions();
|
|
3724
|
-
const message = canEdit ?
|
|
3738
|
+
const message = canEdit ? __25(
|
|
3725
3739
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
3726
3740
|
"elementor"
|
|
3727
|
-
) :
|
|
3741
|
+
) : __25(
|
|
3728
3742
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
3729
3743
|
"elementor"
|
|
3730
3744
|
);
|
|
3731
|
-
return /* @__PURE__ */
|
|
3745
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3732
3746
|
Stack12,
|
|
3733
3747
|
{
|
|
3734
3748
|
alignItems: "center",
|
|
@@ -3738,22 +3752,22 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
3738
3752
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
3739
3753
|
gap: 1.5
|
|
3740
3754
|
},
|
|
3741
|
-
/* @__PURE__ */
|
|
3742
|
-
/* @__PURE__ */
|
|
3743
|
-
/* @__PURE__ */
|
|
3744
|
-
canEdit && /* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ React23.createElement(ComponentPropListIcon4, { fontSize: "large" }),
|
|
3756
|
+
/* @__PURE__ */ React23.createElement(Typography12, { align: "center", variant: "subtitle2" }, __25("No properties yet", "elementor")),
|
|
3757
|
+
/* @__PURE__ */ React23.createElement(Typography12, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
3758
|
+
canEdit && /* @__PURE__ */ React23.createElement(Button5, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React23.createElement(PencilIcon, { fontSize: "small" }), __25("Edit component", "elementor"))
|
|
3745
3759
|
);
|
|
3746
3760
|
};
|
|
3747
3761
|
|
|
3748
3762
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
3749
|
-
import * as
|
|
3763
|
+
import * as React27 from "react";
|
|
3750
3764
|
import { useId } from "react";
|
|
3751
3765
|
import { useStateByElement } from "@elementor/editor-editing-panel";
|
|
3752
3766
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
3753
3767
|
import { Box as Box14, Collapse, ListItemButton as ListItemButton3, ListItemText, Stack as Stack15 } from "@elementor/ui";
|
|
3754
3768
|
|
|
3755
3769
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3756
|
-
import * as
|
|
3770
|
+
import * as React26 from "react";
|
|
3757
3771
|
import { ControlReplacementsProvider, PropKeyProvider, PropProvider, useBoundProp } from "@elementor/editor-controls";
|
|
3758
3772
|
import {
|
|
3759
3773
|
BaseControl,
|
|
@@ -3799,11 +3813,11 @@ function getControlsByBind(controls) {
|
|
|
3799
3813
|
}
|
|
3800
3814
|
|
|
3801
3815
|
// src/provider/overridable-prop-context.tsx
|
|
3802
|
-
import * as
|
|
3816
|
+
import * as React24 from "react";
|
|
3803
3817
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
3804
3818
|
var OverridablePropContext = createContext2(null);
|
|
3805
3819
|
function OverridablePropProvider({ children, ...props }) {
|
|
3806
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ React24.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
3807
3821
|
}
|
|
3808
3822
|
var useOverridablePropValue = () => useContext2(OverridablePropContext)?.value;
|
|
3809
3823
|
var useComponentInstanceElement = () => useContext2(OverridablePropContext)?.componentInstanceElement;
|
|
@@ -3897,11 +3911,11 @@ function getPropType({ widgetType, propKey }) {
|
|
|
3897
3911
|
}
|
|
3898
3912
|
|
|
3899
3913
|
// src/components/control-label.tsx
|
|
3900
|
-
import * as
|
|
3914
|
+
import * as React25 from "react";
|
|
3901
3915
|
import { ControlAdornments, ControlFormLabel } from "@elementor/editor-controls";
|
|
3902
3916
|
import { Stack as Stack13 } from "@elementor/ui";
|
|
3903
3917
|
var ControlLabel = ({ children, ...props }) => {
|
|
3904
|
-
return /* @__PURE__ */
|
|
3918
|
+
return /* @__PURE__ */ React25.createElement(Stack13, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React25.createElement(ControlFormLabel, { ...props }, children), /* @__PURE__ */ React25.createElement(ControlAdornments, null));
|
|
3905
3919
|
};
|
|
3906
3920
|
|
|
3907
3921
|
// src/components/errors.ts
|
|
@@ -3913,7 +3927,7 @@ var OverrideControlInnerElementNotFoundError = createError({
|
|
|
3913
3927
|
|
|
3914
3928
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3915
3929
|
function OverridePropControl({ overridableProp, overrides }) {
|
|
3916
|
-
return /* @__PURE__ */
|
|
3930
|
+
return /* @__PURE__ */ React26.createElement(SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(OverrideControl, { overridableProp, overrides }));
|
|
3917
3931
|
}
|
|
3918
3932
|
function OverrideControl({ overridableProp, overrides }) {
|
|
3919
3933
|
const componentInstanceElement = useElement2();
|
|
@@ -3984,13 +3998,13 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3984
3998
|
if (!elementType) {
|
|
3985
3999
|
return null;
|
|
3986
4000
|
}
|
|
3987
|
-
return /* @__PURE__ */
|
|
4001
|
+
return /* @__PURE__ */ React26.createElement(
|
|
3988
4002
|
OverridablePropProvider,
|
|
3989
4003
|
{
|
|
3990
4004
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
3991
4005
|
componentInstanceElement
|
|
3992
4006
|
},
|
|
3993
|
-
/* @__PURE__ */
|
|
4007
|
+
/* @__PURE__ */ React26.createElement(ElementProvider2, { element: { id: elementId, type }, elementType }, /* @__PURE__ */ React26.createElement(SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(
|
|
3994
4008
|
PropProvider,
|
|
3995
4009
|
{
|
|
3996
4010
|
propType: propTypeSchema,
|
|
@@ -4000,7 +4014,7 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
4000
4014
|
return false;
|
|
4001
4015
|
}
|
|
4002
4016
|
},
|
|
4003
|
-
/* @__PURE__ */
|
|
4017
|
+
/* @__PURE__ */ React26.createElement(PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React26.createElement(ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React26.createElement(Stack14, { direction: "column", gap: 1, mb: 1.5 }, layout !== "custom" && /* @__PURE__ */ React26.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React26.createElement(OriginalControl, { control, controlProps }))))
|
|
4004
4018
|
)))
|
|
4005
4019
|
);
|
|
4006
4020
|
}
|
|
@@ -4064,7 +4078,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
4064
4078
|
}
|
|
4065
4079
|
function OriginalControl({ control, controlProps }) {
|
|
4066
4080
|
const { value } = control;
|
|
4067
|
-
return /* @__PURE__ */
|
|
4081
|
+
return /* @__PURE__ */ React26.createElement(BaseControl, { type: value.type, props: controlProps });
|
|
4068
4082
|
}
|
|
4069
4083
|
function getControlLayout(control) {
|
|
4070
4084
|
return control.value.meta?.layout || controlsRegistry.getLayout(control.value.type);
|
|
@@ -4095,7 +4109,7 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
4095
4109
|
const labelId = `label-${id2}`;
|
|
4096
4110
|
const contentId = `content-${id2}`;
|
|
4097
4111
|
const title = group.label;
|
|
4098
|
-
return /* @__PURE__ */
|
|
4112
|
+
return /* @__PURE__ */ React27.createElement(Box14, { "aria-label": `${title} section` }, /* @__PURE__ */ React27.createElement(
|
|
4099
4113
|
ListItemButton3,
|
|
4100
4114
|
{
|
|
4101
4115
|
id: labelId,
|
|
@@ -4105,7 +4119,7 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
4105
4119
|
p: 0,
|
|
4106
4120
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
4107
4121
|
},
|
|
4108
|
-
/* @__PURE__ */
|
|
4122
|
+
/* @__PURE__ */ React27.createElement(Stack15, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React27.createElement(
|
|
4109
4123
|
ListItemText,
|
|
4110
4124
|
{
|
|
4111
4125
|
secondary: title,
|
|
@@ -4113,8 +4127,8 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
4113
4127
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
4114
4128
|
}
|
|
4115
4129
|
)),
|
|
4116
|
-
/* @__PURE__ */
|
|
4117
|
-
), /* @__PURE__ */
|
|
4130
|
+
/* @__PURE__ */ React27.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
4131
|
+
), /* @__PURE__ */ React27.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React27.createElement(Stack15, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React27.createElement(
|
|
4118
4132
|
OverridePropControl,
|
|
4119
4133
|
{
|
|
4120
4134
|
key: overrideKey,
|
|
@@ -4136,23 +4150,23 @@ function InstanceEditingPanel() {
|
|
|
4136
4150
|
if (!componentId || !overridableProps || !component) {
|
|
4137
4151
|
return null;
|
|
4138
4152
|
}
|
|
4139
|
-
const panelTitle =
|
|
4153
|
+
const panelTitle = __26("Edit %s", "elementor").replace("%s", component.name);
|
|
4140
4154
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
4141
4155
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
4142
4156
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
4143
4157
|
const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
4144
|
-
return /* @__PURE__ */
|
|
4158
|
+
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(
|
|
4145
4159
|
OverridePropsGroup,
|
|
4146
4160
|
{
|
|
4147
4161
|
group,
|
|
4148
4162
|
props: overridableProps.props,
|
|
4149
4163
|
overrides
|
|
4150
4164
|
}
|
|
4151
|
-
), /* @__PURE__ */
|
|
4165
|
+
), /* @__PURE__ */ React28.createElement(Divider4, null)))))));
|
|
4152
4166
|
}
|
|
4153
4167
|
|
|
4154
4168
|
// src/components/overridable-props/overridable-prop-control.tsx
|
|
4155
|
-
import * as
|
|
4169
|
+
import * as React29 from "react";
|
|
4156
4170
|
import {
|
|
4157
4171
|
ControlReplacementsProvider as ControlReplacementsProvider2,
|
|
4158
4172
|
PropKeyProvider as PropKeyProvider2,
|
|
@@ -4203,7 +4217,7 @@ function OverridablePropControl({
|
|
|
4203
4217
|
});
|
|
4204
4218
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
4205
4219
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
4206
|
-
return /* @__PURE__ */
|
|
4220
|
+
return /* @__PURE__ */ React29.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React29.createElement(
|
|
4207
4221
|
PropProvider2,
|
|
4208
4222
|
{
|
|
4209
4223
|
...propContext,
|
|
@@ -4214,7 +4228,7 @@ function OverridablePropControl({
|
|
|
4214
4228
|
},
|
|
4215
4229
|
placeholder: objectPlaceholder
|
|
4216
4230
|
},
|
|
4217
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ React29.createElement(PropKeyProvider2, { bind }, /* @__PURE__ */ React29.createElement(ControlReplacementsProvider2, { replacements: filteredReplacements }, /* @__PURE__ */ React29.createElement(ControlWithReplacements, { OriginalControl: OriginalControl2, props })))
|
|
4218
4232
|
));
|
|
4219
4233
|
}
|
|
4220
4234
|
function ControlWithReplacements({
|
|
@@ -4224,18 +4238,18 @@ function ControlWithReplacements({
|
|
|
4224
4238
|
const { ControlToRender, isReplaced } = useControlReplacement(OriginalControl2);
|
|
4225
4239
|
if (isReplaced) {
|
|
4226
4240
|
const ReplacementControl = ControlToRender;
|
|
4227
|
-
return /* @__PURE__ */
|
|
4241
|
+
return /* @__PURE__ */ React29.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
|
|
4228
4242
|
}
|
|
4229
|
-
return /* @__PURE__ */
|
|
4243
|
+
return /* @__PURE__ */ React29.createElement(OriginalControl2, { ...props });
|
|
4230
4244
|
}
|
|
4231
4245
|
|
|
4232
4246
|
// src/components/overridable-props/overridable-prop-indicator.tsx
|
|
4233
|
-
import * as
|
|
4247
|
+
import * as React31 from "react";
|
|
4234
4248
|
import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
4235
4249
|
import { useElement as useElement4 } from "@elementor/editor-editing-panel";
|
|
4236
4250
|
import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
|
|
4237
4251
|
import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Popover4, Tooltip as Tooltip6, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
4238
|
-
import { __ as
|
|
4252
|
+
import { __ as __28 } from "@wordpress/i18n";
|
|
4239
4253
|
|
|
4240
4254
|
// src/store/actions/set-overridable-prop.ts
|
|
4241
4255
|
import { __dispatch as dispatch14, __getState as getState17 } from "@elementor/store";
|
|
@@ -4316,11 +4330,11 @@ function setOverridableProp({
|
|
|
4316
4330
|
}
|
|
4317
4331
|
|
|
4318
4332
|
// src/components/overridable-props/indicator.tsx
|
|
4319
|
-
import * as
|
|
4333
|
+
import * as React30 from "react";
|
|
4320
4334
|
import { forwardRef as forwardRef2 } from "react";
|
|
4321
4335
|
import { CheckIcon, PlusIcon } from "@elementor/icons";
|
|
4322
4336
|
import { Box as Box15, styled as styled4 } from "@elementor/ui";
|
|
4323
|
-
import { __ as
|
|
4337
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
4324
4338
|
var SIZE2 = "tiny";
|
|
4325
4339
|
var IconContainer = styled4(Box15)`
|
|
4326
4340
|
pointer-events: none;
|
|
@@ -4376,13 +4390,13 @@ var Content = styled4(Box15)`
|
|
|
4376
4390
|
}
|
|
4377
4391
|
}
|
|
4378
4392
|
`;
|
|
4379
|
-
var Indicator2 = forwardRef2(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */
|
|
4393
|
+
var Indicator2 = forwardRef2(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React30.createElement(Content, { ref, ...props, className: isOpen || isOverridable ? "enlarged" : "" }, /* @__PURE__ */ React30.createElement(
|
|
4380
4394
|
IconContainer,
|
|
4381
4395
|
{
|
|
4382
4396
|
className: "icon",
|
|
4383
|
-
"aria-label": isOverridable ?
|
|
4397
|
+
"aria-label": isOverridable ? __27("Overridable property", "elementor") : __27("Make prop overridable", "elementor")
|
|
4384
4398
|
},
|
|
4385
|
-
isOverridable ? /* @__PURE__ */
|
|
4399
|
+
isOverridable ? /* @__PURE__ */ React30.createElement(CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React30.createElement(PlusIcon, { fontSize: SIZE2 })
|
|
4386
4400
|
)));
|
|
4387
4401
|
|
|
4388
4402
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
@@ -4406,7 +4420,7 @@ function OverridablePropIndicator() {
|
|
|
4406
4420
|
if (!isPropAllowed(propType) || !componentId || !overridableProps) {
|
|
4407
4421
|
return null;
|
|
4408
4422
|
}
|
|
4409
|
-
return /* @__PURE__ */
|
|
4423
|
+
return /* @__PURE__ */ React31.createElement(Content2, { componentId, overridableProps });
|
|
4410
4424
|
}
|
|
4411
4425
|
function Content2({ componentId, overridableProps }) {
|
|
4412
4426
|
const {
|
|
@@ -4452,7 +4466,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4452
4466
|
popupState.close();
|
|
4453
4467
|
};
|
|
4454
4468
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4455
|
-
return /* @__PURE__ */
|
|
4469
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(Tooltip6, { placement: "top", title: __28("Override Property", "elementor") }, /* @__PURE__ */ React31.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React31.createElement(
|
|
4456
4470
|
Popover4,
|
|
4457
4471
|
{
|
|
4458
4472
|
disableScrollLock: true,
|
|
@@ -4469,7 +4483,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4469
4483
|
},
|
|
4470
4484
|
...popoverProps
|
|
4471
4485
|
},
|
|
4472
|
-
/* @__PURE__ */
|
|
4486
|
+
/* @__PURE__ */ React31.createElement(
|
|
4473
4487
|
OverridablePropForm,
|
|
4474
4488
|
{
|
|
4475
4489
|
onSubmit: handleSubmit,
|
|
@@ -4840,15 +4854,15 @@ function PopulateStore() {
|
|
|
4840
4854
|
}
|
|
4841
4855
|
|
|
4842
4856
|
// src/prevent-circular-nesting.ts
|
|
4843
|
-
import { getAllDescendants as
|
|
4857
|
+
import { getAllDescendants as getAllDescendants4 } from "@elementor/editor-elements";
|
|
4844
4858
|
import { notify as notify4 } from "@elementor/editor-notifications";
|
|
4845
4859
|
import { blockCommand as blockCommand2 } from "@elementor/editor-v1-adapters";
|
|
4846
4860
|
import { __getState as getState19 } from "@elementor/store";
|
|
4847
|
-
import { __ as
|
|
4861
|
+
import { __ as __29 } from "@wordpress/i18n";
|
|
4848
4862
|
var COMPONENT_TYPE = "e-component";
|
|
4849
4863
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
4850
4864
|
type: "default",
|
|
4851
|
-
message:
|
|
4865
|
+
message: __29("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
4852
4866
|
id: "circular-component-nesting-blocked"
|
|
4853
4867
|
};
|
|
4854
4868
|
function initCircularNestingPrevention() {
|
|
@@ -4935,7 +4949,7 @@ function blockCircularMove(args) {
|
|
|
4935
4949
|
if (!container) {
|
|
4936
4950
|
return false;
|
|
4937
4951
|
}
|
|
4938
|
-
const allElements =
|
|
4952
|
+
const allElements = getAllDescendants4(container);
|
|
4939
4953
|
return allElements.some((element) => {
|
|
4940
4954
|
const componentId = extractComponentIdFromContainer(element);
|
|
4941
4955
|
if (componentId === null) {
|
|
@@ -5167,7 +5181,7 @@ var updateExistingComponentsBeforeSave = async ({
|
|
|
5167
5181
|
};
|
|
5168
5182
|
|
|
5169
5183
|
// src/sync/cleanup-overridable-props-on-delete.ts
|
|
5170
|
-
import { getAllDescendants as
|
|
5184
|
+
import { getAllDescendants as getAllDescendants5 } from "@elementor/editor-elements";
|
|
5171
5185
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
5172
5186
|
import { __dispatch as dispatch19, __getState as getState25 } from "@elementor/store";
|
|
5173
5187
|
function initCleanupOverridablePropsOnDelete() {
|
|
@@ -5217,12 +5231,12 @@ function initCleanupOverridablePropsOnDelete() {
|
|
|
5217
5231
|
});
|
|
5218
5232
|
}
|
|
5219
5233
|
function collectDeletedElementIds(containers) {
|
|
5220
|
-
const elementIds = containers.filter(Boolean).flatMap((container) => [container, ...
|
|
5234
|
+
const elementIds = containers.filter(Boolean).flatMap((container) => [container, ...getAllDescendants5(container)]).map((element) => element.model?.get?.("id") ?? element.id).filter((id2) => Boolean(id2));
|
|
5221
5235
|
return elementIds;
|
|
5222
5236
|
}
|
|
5223
5237
|
|
|
5224
5238
|
// src/sync/handle-component-edit-mode-container.ts
|
|
5225
|
-
import { createElement as
|
|
5239
|
+
import { createElement as createElement32, selectElement as selectElement2 } from "@elementor/editor-elements";
|
|
5226
5240
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
5227
5241
|
var V4_DEFAULT_CONTAINER_TYPE = "e-flexbox";
|
|
5228
5242
|
function initHandleComponentEditModeContainer() {
|
|
@@ -5272,7 +5286,7 @@ function initRedirectDropIntoComponent() {
|
|
|
5272
5286
|
});
|
|
5273
5287
|
}
|
|
5274
5288
|
function createEmptyTopLevelContainer(container) {
|
|
5275
|
-
const newContainer =
|
|
5289
|
+
const newContainer = createElement32({
|
|
5276
5290
|
containerId: container.id,
|
|
5277
5291
|
model: { elType: V4_DEFAULT_CONTAINER_TYPE }
|
|
5278
5292
|
});
|
|
@@ -5309,7 +5323,7 @@ function load(result) {
|
|
|
5309
5323
|
}
|
|
5310
5324
|
|
|
5311
5325
|
// src/sync/regenerate-override-keys.ts
|
|
5312
|
-
import { getAllDescendants as
|
|
5326
|
+
import { getAllDescendants as getAllDescendants6, getContainer as getContainer5, updateElementSettings as updateElementSettings3 } from "@elementor/editor-elements";
|
|
5313
5327
|
import { registerDataHook as registerDataHook4 } from "@elementor/editor-v1-adapters";
|
|
5314
5328
|
import { generateUniqueId as generateUniqueId6 } from "@elementor/utils";
|
|
5315
5329
|
function initRegenerateOverrideKeys() {
|
|
@@ -5334,7 +5348,7 @@ function regenerateOverrideKeysRecursive(elementId) {
|
|
|
5334
5348
|
if (!container) {
|
|
5335
5349
|
return;
|
|
5336
5350
|
}
|
|
5337
|
-
|
|
5351
|
+
getAllDescendants6(container).forEach(regenerateOverrideKeys);
|
|
5338
5352
|
}
|
|
5339
5353
|
function regenerateOverrideKeys(element) {
|
|
5340
5354
|
if (!isComponentInstance(element.model.toJSON())) {
|
|
@@ -5387,6 +5401,44 @@ function hasOverrides(settings) {
|
|
|
5387
5401
|
return !!overridesValue?.length;
|
|
5388
5402
|
}
|
|
5389
5403
|
|
|
5404
|
+
// src/sync/revert-overridables-on-copy-or-duplicate.ts
|
|
5405
|
+
import { registerDataHook as registerDataHook5 } from "@elementor/editor-v1-adapters";
|
|
5406
|
+
function initRevertOverridablesOnCopyOrDuplicate() {
|
|
5407
|
+
registerDataHook5("after", "document/elements/duplicate", (_args, result) => {
|
|
5408
|
+
if (!isEditingComponent()) {
|
|
5409
|
+
return;
|
|
5410
|
+
}
|
|
5411
|
+
revertOverridablesForDuplicatedElements(result);
|
|
5412
|
+
});
|
|
5413
|
+
registerDataHook5("after", "document/elements/copy", (args) => {
|
|
5414
|
+
if (!isEditingComponent()) {
|
|
5415
|
+
return;
|
|
5416
|
+
}
|
|
5417
|
+
revertOverridablesInStorage(args.storageKey ?? "clipboard");
|
|
5418
|
+
});
|
|
5419
|
+
}
|
|
5420
|
+
function revertOverridablesForDuplicatedElements(duplicatedElements) {
|
|
5421
|
+
const containers = Array.isArray(duplicatedElements) ? duplicatedElements : [duplicatedElements];
|
|
5422
|
+
containers.forEach((container) => {
|
|
5423
|
+
revertAllOverridablesInContainer(container);
|
|
5424
|
+
});
|
|
5425
|
+
}
|
|
5426
|
+
function revertOverridablesInStorage(storageKey) {
|
|
5427
|
+
const storage = window.elementorCommon?.storage;
|
|
5428
|
+
if (!storage) {
|
|
5429
|
+
return;
|
|
5430
|
+
}
|
|
5431
|
+
const storageData = storage.get(storageKey);
|
|
5432
|
+
if (!storageData?.elements?.length) {
|
|
5433
|
+
return;
|
|
5434
|
+
}
|
|
5435
|
+
const elementsDataWithOverridablesReverted = storageData.elements.map(revertAllOverridablesInElementData);
|
|
5436
|
+
storage.set(storageKey, {
|
|
5437
|
+
...storageData,
|
|
5438
|
+
elements: elementsDataWithOverridablesReverted
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5441
|
+
|
|
5390
5442
|
// src/init.ts
|
|
5391
5443
|
function init() {
|
|
5392
5444
|
stylesRepository.register(componentsStylesProvider);
|
|
@@ -5396,18 +5448,18 @@ function init() {
|
|
|
5396
5448
|
COMPONENT_WIDGET_TYPE,
|
|
5397
5449
|
(options) => createComponentType({ ...options, showLockedByModal: openEditModeDialog })
|
|
5398
5450
|
);
|
|
5399
|
-
|
|
5451
|
+
registerDataHook6("dependency", "editor/documents/close", (args) => {
|
|
5400
5452
|
const document = getV1CurrentDocument();
|
|
5401
5453
|
if (document.config.type === COMPONENT_DOCUMENT_TYPE) {
|
|
5402
5454
|
args.mode = "autosave";
|
|
5403
5455
|
}
|
|
5404
5456
|
return true;
|
|
5405
5457
|
});
|
|
5406
|
-
|
|
5458
|
+
registerDataHook6("after", "preview/drop", onElementDrop);
|
|
5407
5459
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
5408
5460
|
injectTab({
|
|
5409
5461
|
id: "components",
|
|
5410
|
-
label:
|
|
5462
|
+
label: __30("Components", "elementor"),
|
|
5411
5463
|
component: Components,
|
|
5412
5464
|
position: 1
|
|
5413
5465
|
});
|
|
@@ -5427,7 +5479,7 @@ function init() {
|
|
|
5427
5479
|
id: "component-panel-header",
|
|
5428
5480
|
component: ComponentPanelHeader
|
|
5429
5481
|
});
|
|
5430
|
-
|
|
5482
|
+
registerDataHook6("after", "editor/documents/attach-preview", async () => {
|
|
5431
5483
|
const { id: id2, config } = getV1CurrentDocument();
|
|
5432
5484
|
if (id2) {
|
|
5433
5485
|
removeComponentStyles(id2);
|
|
@@ -5460,6 +5512,7 @@ function init() {
|
|
|
5460
5512
|
initNonAtomicNestingPrevention();
|
|
5461
5513
|
initLoadComponentDataAfterInstanceAdded();
|
|
5462
5514
|
initHandleComponentEditModeContainer();
|
|
5515
|
+
initRevertOverridablesOnCopyOrDuplicate();
|
|
5463
5516
|
}
|
|
5464
5517
|
export {
|
|
5465
5518
|
init
|