@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.js
CHANGED
|
@@ -42,9 +42,9 @@ var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
|
42
42
|
var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
43
43
|
var import_editor_panels5 = require("@elementor/editor-panels");
|
|
44
44
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
45
|
-
var
|
|
45
|
+
var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
|
|
46
46
|
var import_store80 = require("@elementor/store");
|
|
47
|
-
var
|
|
47
|
+
var import_i18n30 = require("@wordpress/i18n");
|
|
48
48
|
|
|
49
49
|
// src/component-instance-transformer.ts
|
|
50
50
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
@@ -733,59 +733,9 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
733
733
|
// src/store/actions/delete-overridable-prop.ts
|
|
734
734
|
var import_store15 = require("@elementor/store");
|
|
735
735
|
|
|
736
|
-
// src/utils/revert-
|
|
736
|
+
// src/utils/revert-overridable-settings.ts
|
|
737
737
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
738
738
|
|
|
739
|
-
// src/prop-types/component-instance-override-prop-type.ts
|
|
740
|
-
var import_editor_props = require("@elementor/editor-props");
|
|
741
|
-
var import_schema = require("@elementor/schema");
|
|
742
|
-
var componentInstanceOverridePropTypeUtil = (0, import_editor_props.createPropUtils)(
|
|
743
|
-
"override",
|
|
744
|
-
import_schema.z.object({
|
|
745
|
-
override_key: import_schema.z.string(),
|
|
746
|
-
override_value: import_schema.z.unknown(),
|
|
747
|
-
schema_source: import_schema.z.object({
|
|
748
|
-
type: import_schema.z.literal("component"),
|
|
749
|
-
id: import_schema.z.number()
|
|
750
|
-
})
|
|
751
|
-
})
|
|
752
|
-
);
|
|
753
|
-
|
|
754
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
755
|
-
var import_editor_props3 = require("@elementor/editor-props");
|
|
756
|
-
var import_schema3 = require("@elementor/schema");
|
|
757
|
-
|
|
758
|
-
// src/prop-types/component-overridable-prop-type.ts
|
|
759
|
-
var import_editor_props2 = require("@elementor/editor-props");
|
|
760
|
-
var import_schema2 = require("@elementor/schema");
|
|
761
|
-
var componentOverridablePropTypeUtil = (0, import_editor_props2.createPropUtils)(
|
|
762
|
-
"overridable",
|
|
763
|
-
import_schema2.z.object({
|
|
764
|
-
override_key: import_schema2.z.string(),
|
|
765
|
-
origin_value: import_schema2.z.object({
|
|
766
|
-
$$type: import_schema2.z.string(),
|
|
767
|
-
value: import_schema2.z.unknown()
|
|
768
|
-
}).nullable()
|
|
769
|
-
})
|
|
770
|
-
);
|
|
771
|
-
|
|
772
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
773
|
-
var componentInstanceOverridesPropTypeUtil = (0, import_editor_props3.createPropUtils)(
|
|
774
|
-
"overrides",
|
|
775
|
-
import_schema3.z.array(import_schema3.z.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
|
|
776
|
-
);
|
|
777
|
-
|
|
778
|
-
// src/prop-types/component-instance-prop-type.ts
|
|
779
|
-
var import_editor_props4 = require("@elementor/editor-props");
|
|
780
|
-
var import_schema4 = require("@elementor/schema");
|
|
781
|
-
var componentInstancePropTypeUtil = (0, import_editor_props4.createPropUtils)(
|
|
782
|
-
"component-instance",
|
|
783
|
-
import_schema4.z.object({
|
|
784
|
-
component_id: import_editor_props4.numberPropTypeUtil.schema,
|
|
785
|
-
overrides: import_schema4.z.optional(componentInstanceOverridesPropTypeUtil.schema)
|
|
786
|
-
})
|
|
787
|
-
);
|
|
788
|
-
|
|
789
739
|
// src/create-component-type.ts
|
|
790
740
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
791
741
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
@@ -1028,19 +978,69 @@ function createComponentModel() {
|
|
|
1028
978
|
});
|
|
1029
979
|
}
|
|
1030
980
|
|
|
981
|
+
// src/prop-types/component-instance-override-prop-type.ts
|
|
982
|
+
var import_editor_props = require("@elementor/editor-props");
|
|
983
|
+
var import_schema = require("@elementor/schema");
|
|
984
|
+
var componentInstanceOverridePropTypeUtil = (0, import_editor_props.createPropUtils)(
|
|
985
|
+
"override",
|
|
986
|
+
import_schema.z.object({
|
|
987
|
+
override_key: import_schema.z.string(),
|
|
988
|
+
override_value: import_schema.z.unknown(),
|
|
989
|
+
schema_source: import_schema.z.object({
|
|
990
|
+
type: import_schema.z.literal("component"),
|
|
991
|
+
id: import_schema.z.number()
|
|
992
|
+
})
|
|
993
|
+
})
|
|
994
|
+
);
|
|
995
|
+
|
|
996
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
997
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
998
|
+
var import_schema3 = require("@elementor/schema");
|
|
999
|
+
|
|
1000
|
+
// src/prop-types/component-overridable-prop-type.ts
|
|
1001
|
+
var import_editor_props2 = require("@elementor/editor-props");
|
|
1002
|
+
var import_schema2 = require("@elementor/schema");
|
|
1003
|
+
var componentOverridablePropTypeUtil = (0, import_editor_props2.createPropUtils)(
|
|
1004
|
+
"overridable",
|
|
1005
|
+
import_schema2.z.object({
|
|
1006
|
+
override_key: import_schema2.z.string(),
|
|
1007
|
+
origin_value: import_schema2.z.object({
|
|
1008
|
+
$$type: import_schema2.z.string(),
|
|
1009
|
+
value: import_schema2.z.unknown()
|
|
1010
|
+
}).nullable()
|
|
1011
|
+
})
|
|
1012
|
+
);
|
|
1013
|
+
|
|
1014
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
1015
|
+
var componentInstanceOverridesPropTypeUtil = (0, import_editor_props3.createPropUtils)(
|
|
1016
|
+
"overrides",
|
|
1017
|
+
import_schema3.z.array(import_schema3.z.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
// src/prop-types/component-instance-prop-type.ts
|
|
1021
|
+
var import_editor_props4 = require("@elementor/editor-props");
|
|
1022
|
+
var import_schema4 = require("@elementor/schema");
|
|
1023
|
+
var componentInstancePropTypeUtil = (0, import_editor_props4.createPropUtils)(
|
|
1024
|
+
"component-instance",
|
|
1025
|
+
import_schema4.z.object({
|
|
1026
|
+
component_id: import_editor_props4.numberPropTypeUtil.schema,
|
|
1027
|
+
overrides: import_schema4.z.optional(componentInstanceOverridesPropTypeUtil.schema)
|
|
1028
|
+
})
|
|
1029
|
+
);
|
|
1030
|
+
|
|
1031
1031
|
// src/utils/is-component-instance.ts
|
|
1032
1032
|
function isComponentInstance(elementModel) {
|
|
1033
1033
|
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
|
-
// src/utils/revert-
|
|
1036
|
+
// src/utils/revert-overridable-settings.ts
|
|
1037
1037
|
function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
|
|
1038
1038
|
const container = (0, import_editor_elements2.getContainer)(elementId);
|
|
1039
1039
|
if (!container) {
|
|
1040
1040
|
return;
|
|
1041
1041
|
}
|
|
1042
1042
|
if (isComponentInstance(container.model.toJSON())) {
|
|
1043
|
-
|
|
1043
|
+
revertComponentInstanceOverridableSetting(elementId, overrideKey);
|
|
1044
1044
|
return;
|
|
1045
1045
|
}
|
|
1046
1046
|
(0, import_editor_elements2.updateElementSettings)({
|
|
@@ -1049,17 +1049,17 @@ function revertElementOverridableSetting(elementId, settingKey, originValue, ove
|
|
|
1049
1049
|
withHistory: false
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
|
|
1053
1053
|
const setting = (0, import_editor_elements2.getElementSetting)(elementId, "component_instance");
|
|
1054
1054
|
const componentInstance = componentInstancePropTypeUtil.extract(setting);
|
|
1055
1055
|
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1056
|
-
if (!overrides) {
|
|
1056
|
+
if (!overrides?.length) {
|
|
1057
1057
|
return;
|
|
1058
1058
|
}
|
|
1059
|
-
const
|
|
1059
|
+
const revertedOverrides = revertComponentInstanceOverrides(overrides, overrideKey);
|
|
1060
1060
|
const updatedSetting = componentInstancePropTypeUtil.create({
|
|
1061
1061
|
...componentInstance,
|
|
1062
|
-
overrides: componentInstanceOverridesPropTypeUtil.create(
|
|
1062
|
+
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
1063
1063
|
});
|
|
1064
1064
|
(0, import_editor_elements2.updateElementSettings)({
|
|
1065
1065
|
id: elementId,
|
|
@@ -1067,22 +1067,103 @@ function revertComponentInstanceSetting(elementId, overrideKey) {
|
|
|
1067
1067
|
withHistory: false
|
|
1068
1068
|
});
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function revertComponentInstanceOverrides(overrides, filterByKey) {
|
|
1071
1071
|
return overrides.map((item) => {
|
|
1072
|
-
|
|
1073
|
-
if (!isOverridable) {
|
|
1072
|
+
if (!componentOverridablePropTypeUtil.isValid(item)) {
|
|
1074
1073
|
return item;
|
|
1075
1074
|
}
|
|
1076
|
-
|
|
1077
|
-
if (!isOriginValueOverride2) {
|
|
1075
|
+
if (!componentInstanceOverridePropTypeUtil.isValid(item.value.origin_value)) {
|
|
1078
1076
|
return null;
|
|
1079
1077
|
}
|
|
1080
|
-
if (item.value.override_key !==
|
|
1078
|
+
if (filterByKey && item.value.override_key !== filterByKey) {
|
|
1081
1079
|
return item;
|
|
1082
1080
|
}
|
|
1083
1081
|
return item.value.origin_value;
|
|
1084
1082
|
}).filter((item) => item !== null);
|
|
1085
1083
|
}
|
|
1084
|
+
function revertOverridablePropsFromSettings(settings) {
|
|
1085
|
+
let hasChanges = false;
|
|
1086
|
+
const revertedSettings = {};
|
|
1087
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
1088
|
+
if (componentOverridablePropTypeUtil.isValid(value)) {
|
|
1089
|
+
revertedSettings[key] = value.value.origin_value;
|
|
1090
|
+
hasChanges = true;
|
|
1091
|
+
} else {
|
|
1092
|
+
revertedSettings[key] = value;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return { hasChanges, settings: revertedSettings };
|
|
1096
|
+
}
|
|
1097
|
+
function revertAllOverridablesInElementData(elementData) {
|
|
1098
|
+
const revertedElement = { ...elementData };
|
|
1099
|
+
if (isComponentInstance({ widgetType: elementData.widgetType, elType: elementData.elType })) {
|
|
1100
|
+
revertedElement.settings = revertComponentInstanceSettings(elementData.settings);
|
|
1101
|
+
} else if (revertedElement.settings) {
|
|
1102
|
+
const { settings } = revertOverridablePropsFromSettings(revertedElement.settings);
|
|
1103
|
+
revertedElement.settings = settings;
|
|
1104
|
+
}
|
|
1105
|
+
if (revertedElement.elements) {
|
|
1106
|
+
revertedElement.elements = revertedElement.elements.map(revertAllOverridablesInElementData);
|
|
1107
|
+
}
|
|
1108
|
+
return revertedElement;
|
|
1109
|
+
}
|
|
1110
|
+
function revertComponentInstanceSettings(settings) {
|
|
1111
|
+
if (!settings?.component_instance) {
|
|
1112
|
+
return settings;
|
|
1113
|
+
}
|
|
1114
|
+
const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
|
|
1115
|
+
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1116
|
+
if (!overrides?.length) {
|
|
1117
|
+
return settings;
|
|
1118
|
+
}
|
|
1119
|
+
const revertedOverrides = revertComponentInstanceOverrides(overrides);
|
|
1120
|
+
return {
|
|
1121
|
+
...settings,
|
|
1122
|
+
component_instance: componentInstancePropTypeUtil.create({
|
|
1123
|
+
...componentInstance,
|
|
1124
|
+
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
1125
|
+
})
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
function revertAllOverridablesInContainer(container) {
|
|
1129
|
+
(0, import_editor_elements2.getAllDescendants)(container).forEach((element) => {
|
|
1130
|
+
if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE) {
|
|
1131
|
+
revertComponentInstanceOverridesInElement(element);
|
|
1132
|
+
} else {
|
|
1133
|
+
revertElementSettings(element);
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
function revertComponentInstanceOverridesInElement(element) {
|
|
1138
|
+
const settings = element.settings?.toJSON() ?? {};
|
|
1139
|
+
const componentInstance = componentInstancePropTypeUtil.extract(settings.component_instance);
|
|
1140
|
+
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1141
|
+
if (!overrides?.length) {
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
const revertedOverrides = revertComponentInstanceOverrides(overrides);
|
|
1145
|
+
const updatedSetting = componentInstancePropTypeUtil.create({
|
|
1146
|
+
...componentInstance,
|
|
1147
|
+
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
1148
|
+
});
|
|
1149
|
+
(0, import_editor_elements2.updateElementSettings)({
|
|
1150
|
+
id: element.id,
|
|
1151
|
+
props: { component_instance: updatedSetting },
|
|
1152
|
+
withHistory: false
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
function revertElementSettings(element) {
|
|
1156
|
+
const settings = element.settings?.toJSON() ?? {};
|
|
1157
|
+
const { hasChanges, settings: revertedSettings } = revertOverridablePropsFromSettings(settings);
|
|
1158
|
+
if (!hasChanges) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
(0, import_editor_elements2.updateElementSettings)({
|
|
1162
|
+
id: element.id,
|
|
1163
|
+
props: revertedSettings,
|
|
1164
|
+
withHistory: false
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1086
1167
|
|
|
1087
1168
|
// src/store/actions/delete-overridable-prop.ts
|
|
1088
1169
|
function deleteOverridableProp({ componentId, propKey, source }) {
|
|
@@ -2119,7 +2200,7 @@ function getComponentName() {
|
|
|
2119
2200
|
}
|
|
2120
2201
|
|
|
2121
2202
|
// src/components/components-tab/components.tsx
|
|
2122
|
-
var
|
|
2203
|
+
var React18 = __toESM(require("react"));
|
|
2123
2204
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2124
2205
|
|
|
2125
2206
|
// src/hooks/use-components.ts
|
|
@@ -2190,12 +2271,10 @@ var ComponentSearch = () => {
|
|
|
2190
2271
|
};
|
|
2191
2272
|
|
|
2192
2273
|
// src/components/components-tab/components-list.tsx
|
|
2193
|
-
var
|
|
2194
|
-
var import_react9 = require("react");
|
|
2195
|
-
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
2274
|
+
var React16 = __toESM(require("react"));
|
|
2196
2275
|
var import_icons10 = require("@elementor/icons");
|
|
2197
|
-
var
|
|
2198
|
-
var
|
|
2276
|
+
var import_ui14 = require("@elementor/ui");
|
|
2277
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2199
2278
|
|
|
2200
2279
|
// src/hooks/use-components-permissions.ts
|
|
2201
2280
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
@@ -2243,60 +2322,25 @@ function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
|
2243
2322
|
});
|
|
2244
2323
|
}
|
|
2245
2324
|
|
|
2246
|
-
// src/components/components-tab/angie-promotion-modal.tsx
|
|
2247
|
-
var React13 = __toESM(require("react"));
|
|
2248
|
-
var import_ui12 = require("@elementor/ui");
|
|
2249
|
-
var import_i18n15 = require("@wordpress/i18n");
|
|
2250
|
-
var ANGIE_INSTALL_URL = "/wp-admin/plugin-install.php?tab=plugin-information&plugin=angie";
|
|
2251
|
-
var PLACEHOLDER_IMAGE_URL = "https://assets.elementor.com/packages/v1/images/components-angie-promo.svg";
|
|
2252
|
-
var AngiePromotionModal = ({ children, open, onClose }) => {
|
|
2253
|
-
return /* @__PURE__ */ React13.createElement(import_ui12.Infotip, { placement: "right-end", arrow: true, content: /* @__PURE__ */ React13.createElement(AngiePromotionCard, { onClose }), open }, children);
|
|
2254
|
-
};
|
|
2255
|
-
function AngiePromotionCard({ onClose }) {
|
|
2256
|
-
const handleCtaClick = () => {
|
|
2257
|
-
window.open(ANGIE_INSTALL_URL, "_blank");
|
|
2258
|
-
onClose();
|
|
2259
|
-
};
|
|
2260
|
-
return /* @__PURE__ */ React13.createElement(import_ui12.ClickAwayListener, { disableReactTree: true, mouseEvent: "onMouseDown", touchEvent: "onTouchStart", onClickAway: onClose }, /* @__PURE__ */ React13.createElement(import_ui12.Card, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
|
|
2261
|
-
import_ui12.CardHeader,
|
|
2262
|
-
{
|
|
2263
|
-
title: (0, import_i18n15.__)("Add new component with AI", "elementor"),
|
|
2264
|
-
titleTypographyProps: { variant: "subtitle2" },
|
|
2265
|
-
action: /* @__PURE__ */ React13.createElement(import_ui12.CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: onClose })
|
|
2266
|
-
}
|
|
2267
|
-
), /* @__PURE__ */ React13.createElement(
|
|
2268
|
-
import_ui12.CardMedia,
|
|
2269
|
-
{
|
|
2270
|
-
component: "img",
|
|
2271
|
-
image: PLACEHOLDER_IMAGE_URL,
|
|
2272
|
-
alt: "",
|
|
2273
|
-
sx: { width: "100%", aspectRatio: "16 / 9" }
|
|
2274
|
-
}
|
|
2275
|
-
), /* @__PURE__ */ React13.createElement(import_ui12.CardContent, null, /* @__PURE__ */ React13.createElement(import_ui12.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n15.__)(
|
|
2276
|
-
"Angie our AI assistant can easily create new components and save you the hassle of doing it yourself",
|
|
2277
|
-
"elementor"
|
|
2278
|
-
))), /* @__PURE__ */ React13.createElement(import_ui12.CardActions, { sx: { justifyContent: "flex-end" } }, /* @__PURE__ */ React13.createElement(import_ui12.Button, { size: "medium", variant: "contained", color: "accent", onClick: handleCtaClick }, (0, import_i18n15.__)("Get Angie", "elementor")))));
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
2325
|
// src/components/components-tab/components-item.tsx
|
|
2282
|
-
var
|
|
2326
|
+
var React14 = __toESM(require("react"));
|
|
2283
2327
|
var import_react8 = require("react");
|
|
2284
2328
|
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
2285
2329
|
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2286
2330
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2287
2331
|
var import_icons9 = require("@elementor/icons");
|
|
2288
|
-
var
|
|
2289
|
-
var
|
|
2332
|
+
var import_ui12 = require("@elementor/ui");
|
|
2333
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
2290
2334
|
|
|
2291
2335
|
// src/store/actions/archive-component.ts
|
|
2292
2336
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
2293
2337
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
2294
2338
|
var import_store35 = require("@elementor/store");
|
|
2295
|
-
var
|
|
2339
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2296
2340
|
var successNotification = (componentId, componentName) => ({
|
|
2297
2341
|
type: "success",
|
|
2298
2342
|
/* translators: %s: component name */
|
|
2299
|
-
message: (0,
|
|
2343
|
+
message: (0, import_i18n15.__)("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
2300
2344
|
id: `success-archived-components-notification-${componentId}`
|
|
2301
2345
|
});
|
|
2302
2346
|
var archiveComponent = (componentId, componentName) => {
|
|
@@ -2429,14 +2473,14 @@ var import_store41 = require("@elementor/store");
|
|
|
2429
2473
|
|
|
2430
2474
|
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2431
2475
|
var import_schema5 = require("@elementor/schema");
|
|
2432
|
-
var
|
|
2476
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2433
2477
|
var MIN_NAME_LENGTH = 2;
|
|
2434
2478
|
var MAX_NAME_LENGTH = 50;
|
|
2435
|
-
var baseComponentSchema = import_schema5.z.string().trim().max(MAX_NAME_LENGTH, (0,
|
|
2479
|
+
var baseComponentSchema = import_schema5.z.string().trim().max(MAX_NAME_LENGTH, (0, import_i18n16.__)("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
2436
2480
|
var createBaseComponentSchema = (existingNames) => {
|
|
2437
2481
|
return import_schema5.z.object({
|
|
2438
2482
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
2439
|
-
message: (0,
|
|
2483
|
+
message: (0, import_i18n16.__)("Component name already exists", "elementor")
|
|
2440
2484
|
})
|
|
2441
2485
|
});
|
|
2442
2486
|
};
|
|
@@ -2444,9 +2488,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
2444
2488
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2445
2489
|
return baseSchema.extend({
|
|
2446
2490
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2447
|
-
message: (0,
|
|
2491
|
+
message: (0, import_i18n16.__)("Component name is required.", "elementor")
|
|
2448
2492
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2449
|
-
message: (0,
|
|
2493
|
+
message: (0, import_i18n16.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2450
2494
|
})
|
|
2451
2495
|
});
|
|
2452
2496
|
};
|
|
@@ -2537,14 +2581,14 @@ var createComponentModel2 = (component) => {
|
|
|
2537
2581
|
};
|
|
2538
2582
|
|
|
2539
2583
|
// src/components/components-tab/delete-confirmation-dialog.tsx
|
|
2540
|
-
var
|
|
2584
|
+
var React13 = __toESM(require("react"));
|
|
2541
2585
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2542
|
-
var
|
|
2586
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2543
2587
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
2544
|
-
return /* @__PURE__ */
|
|
2588
|
+
return /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Title, null, (0, import_i18n17.__)("Delete this component?", "elementor")), /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Content, null, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.ContentText, null, (0, import_i18n17.__)(
|
|
2545
2589
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
2546
2590
|
"elementor"
|
|
2547
|
-
))), /* @__PURE__ */
|
|
2591
|
+
))), /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Actions, { onClose, onConfirm }));
|
|
2548
2592
|
}
|
|
2549
2593
|
|
|
2550
2594
|
// src/components/components-tab/components-item.tsx
|
|
@@ -2565,7 +2609,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2565
2609
|
validation: validateComponentTitle
|
|
2566
2610
|
});
|
|
2567
2611
|
const componentModel = createComponentModel2(component);
|
|
2568
|
-
const popupState = (0,
|
|
2612
|
+
const popupState = (0, import_ui12.usePopupState)({
|
|
2569
2613
|
variant: "popover",
|
|
2570
2614
|
disableAutoFocus: true
|
|
2571
2615
|
});
|
|
@@ -2590,7 +2634,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2590
2634
|
const handleDeleteDialogClose = () => {
|
|
2591
2635
|
setIsDeleteDialogOpen(false);
|
|
2592
2636
|
};
|
|
2593
|
-
return /* @__PURE__ */
|
|
2637
|
+
return /* @__PURE__ */ React14.createElement(import_ui12.Stack, null, /* @__PURE__ */ React14.createElement(
|
|
2594
2638
|
import_editor_ui8.WarningInfotip,
|
|
2595
2639
|
{
|
|
2596
2640
|
open: Boolean(error),
|
|
@@ -2599,8 +2643,8 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2599
2643
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
2600
2644
|
offset: [0, -15]
|
|
2601
2645
|
},
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
|
|
2646
|
+
/* @__PURE__ */ React14.createElement(
|
|
2647
|
+
import_ui12.ListItemButton,
|
|
2604
2648
|
{
|
|
2605
2649
|
draggable: true,
|
|
2606
2650
|
onDragStart: (event) => (0, import_editor_canvas5.startDragElementFromPanel)(componentModel, event),
|
|
@@ -2618,8 +2662,8 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2618
2662
|
gap: 1
|
|
2619
2663
|
}
|
|
2620
2664
|
},
|
|
2621
|
-
/* @__PURE__ */
|
|
2622
|
-
|
|
2665
|
+
/* @__PURE__ */ React14.createElement(
|
|
2666
|
+
import_ui12.Box,
|
|
2623
2667
|
{
|
|
2624
2668
|
display: "flex",
|
|
2625
2669
|
alignItems: "center",
|
|
@@ -2628,31 +2672,31 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2628
2672
|
flexGrow: 1,
|
|
2629
2673
|
onClick: handleClick
|
|
2630
2674
|
},
|
|
2631
|
-
/* @__PURE__ */
|
|
2632
|
-
/* @__PURE__ */
|
|
2675
|
+
/* @__PURE__ */ React14.createElement(import_ui12.ListItemIcon, { size: "tiny" }, /* @__PURE__ */ React14.createElement(import_icons9.ComponentsIcon, { fontSize: "tiny" })),
|
|
2676
|
+
/* @__PURE__ */ React14.createElement(Indicator, { isActive: isEditing, isError: !!error }, /* @__PURE__ */ React14.createElement(import_ui12.Box, { display: "flex", flex: 1, minWidth: 0, flexGrow: 1 }, isEditing ? /* @__PURE__ */ React14.createElement(
|
|
2633
2677
|
import_editor_ui8.EditableField,
|
|
2634
2678
|
{
|
|
2635
2679
|
ref: editableRef,
|
|
2636
|
-
as:
|
|
2680
|
+
as: import_ui12.Typography,
|
|
2637
2681
|
variant: "caption",
|
|
2638
2682
|
...getEditableProps()
|
|
2639
2683
|
}
|
|
2640
|
-
) : /* @__PURE__ */
|
|
2684
|
+
) : /* @__PURE__ */ React14.createElement(
|
|
2641
2685
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2642
2686
|
{
|
|
2643
2687
|
title: component.name,
|
|
2644
|
-
as:
|
|
2688
|
+
as: import_ui12.Typography,
|
|
2645
2689
|
variant: "caption",
|
|
2646
2690
|
color: "text.primary"
|
|
2647
2691
|
}
|
|
2648
2692
|
)))
|
|
2649
2693
|
),
|
|
2650
|
-
shouldShowActions && /* @__PURE__ */
|
|
2694
|
+
shouldShowActions && /* @__PURE__ */ React14.createElement(import_ui12.IconButton, { size: "tiny", ...(0, import_ui12.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React14.createElement(import_icons9.DotsVerticalIcon, { fontSize: "tiny" }))
|
|
2651
2695
|
)
|
|
2652
|
-
), shouldShowActions && /* @__PURE__ */
|
|
2653
|
-
|
|
2696
|
+
), shouldShowActions && /* @__PURE__ */ React14.createElement(
|
|
2697
|
+
import_ui12.Menu,
|
|
2654
2698
|
{
|
|
2655
|
-
...(0,
|
|
2699
|
+
...(0, import_ui12.bindMenu)(popupState),
|
|
2656
2700
|
anchorOrigin: {
|
|
2657
2701
|
vertical: "bottom",
|
|
2658
2702
|
horizontal: "right"
|
|
@@ -2662,7 +2706,7 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2662
2706
|
horizontal: "right"
|
|
2663
2707
|
}
|
|
2664
2708
|
},
|
|
2665
|
-
canRename && /* @__PURE__ */
|
|
2709
|
+
canRename && /* @__PURE__ */ React14.createElement(
|
|
2666
2710
|
import_editor_ui8.MenuListItem,
|
|
2667
2711
|
{
|
|
2668
2712
|
sx: { minWidth: "160px" },
|
|
@@ -2672,18 +2716,18 @@ var ComponentItem = ({ component, renameComponent: renameComponent2 }) => {
|
|
|
2672
2716
|
openEditMode();
|
|
2673
2717
|
}
|
|
2674
2718
|
},
|
|
2675
|
-
(0,
|
|
2719
|
+
(0, import_i18n18.__)("Rename", "elementor")
|
|
2676
2720
|
),
|
|
2677
|
-
canDelete && /* @__PURE__ */
|
|
2721
|
+
canDelete && /* @__PURE__ */ React14.createElement(
|
|
2678
2722
|
import_editor_ui8.MenuListItem,
|
|
2679
2723
|
{
|
|
2680
2724
|
sx: { minWidth: "160px" },
|
|
2681
2725
|
primaryTypographyProps: { variant: "caption", color: "error.light" },
|
|
2682
2726
|
onClick: handleDeleteClick
|
|
2683
2727
|
},
|
|
2684
|
-
(0,
|
|
2728
|
+
(0, import_i18n18.__)("Delete", "elementor")
|
|
2685
2729
|
)
|
|
2686
|
-
), /* @__PURE__ */
|
|
2730
|
+
), /* @__PURE__ */ React14.createElement(
|
|
2687
2731
|
DeleteConfirmationDialog,
|
|
2688
2732
|
{
|
|
2689
2733
|
open: isDeleteDialogOpen,
|
|
@@ -2711,7 +2755,7 @@ var validateComponentTitle = (newTitle) => {
|
|
|
2711
2755
|
}
|
|
2712
2756
|
return result.errorMessage;
|
|
2713
2757
|
};
|
|
2714
|
-
var Indicator = (0,
|
|
2758
|
+
var Indicator = (0, import_ui12.styled)(import_ui12.Box, {
|
|
2715
2759
|
shouldForwardProp: (prop) => prop !== "isActive" && prop !== "isError"
|
|
2716
2760
|
})(({ theme, isActive, isError }) => ({
|
|
2717
2761
|
display: "flex",
|
|
@@ -2734,13 +2778,13 @@ var getIndicatorBorder = ({ isActive, isError, theme }) => {
|
|
|
2734
2778
|
};
|
|
2735
2779
|
|
|
2736
2780
|
// src/components/components-tab/loading-components.tsx
|
|
2737
|
-
var
|
|
2738
|
-
var
|
|
2781
|
+
var React15 = __toESM(require("react"));
|
|
2782
|
+
var import_ui13 = require("@elementor/ui");
|
|
2739
2783
|
var ROWS_COUNT = 6;
|
|
2740
2784
|
var rows = Array.from({ length: ROWS_COUNT }, (_, index) => index);
|
|
2741
2785
|
var LoadingComponents = () => {
|
|
2742
|
-
return /* @__PURE__ */
|
|
2743
|
-
|
|
2786
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2787
|
+
import_ui13.Stack,
|
|
2744
2788
|
{
|
|
2745
2789
|
"aria-label": "Loading components",
|
|
2746
2790
|
gap: 1,
|
|
@@ -2761,14 +2805,14 @@ var LoadingComponents = () => {
|
|
|
2761
2805
|
}
|
|
2762
2806
|
}
|
|
2763
2807
|
},
|
|
2764
|
-
rows.map((row) => /* @__PURE__ */
|
|
2765
|
-
|
|
2808
|
+
rows.map((row) => /* @__PURE__ */ React15.createElement(
|
|
2809
|
+
import_ui13.ListItemButton,
|
|
2766
2810
|
{
|
|
2767
2811
|
key: row,
|
|
2768
2812
|
sx: { border: "solid 1px", borderColor: "divider", py: 0.5, px: 1 },
|
|
2769
2813
|
shape: "rounded"
|
|
2770
2814
|
},
|
|
2771
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ React15.createElement(import_ui13.Box, { display: "flex", gap: 1, width: "100%" }, /* @__PURE__ */ React15.createElement(import_ui13.Skeleton, { variant: "text", width: "24px", height: "36px" }), /* @__PURE__ */ React15.createElement(import_ui13.Skeleton, { variant: "text", width: "100%", height: "36px" }))
|
|
2772
2816
|
))
|
|
2773
2817
|
);
|
|
2774
2818
|
};
|
|
@@ -2782,16 +2826,16 @@ var SUBTITLE_OVERRIDE_SX = {
|
|
|
2782
2826
|
function ComponentsList() {
|
|
2783
2827
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
2784
2828
|
if (isLoading) {
|
|
2785
|
-
return /* @__PURE__ */
|
|
2829
|
+
return /* @__PURE__ */ React16.createElement(LoadingComponents, null);
|
|
2786
2830
|
}
|
|
2787
2831
|
const isEmpty = !components || components.length === 0;
|
|
2788
2832
|
if (isEmpty) {
|
|
2789
2833
|
if (searchValue.length > 0) {
|
|
2790
|
-
return /* @__PURE__ */
|
|
2834
|
+
return /* @__PURE__ */ React16.createElement(EmptySearchResult, null);
|
|
2791
2835
|
}
|
|
2792
|
-
return /* @__PURE__ */
|
|
2836
|
+
return /* @__PURE__ */ React16.createElement(EmptyState, null);
|
|
2793
2837
|
}
|
|
2794
|
-
return /* @__PURE__ */
|
|
2838
|
+
return /* @__PURE__ */ React16.createElement(import_ui14.List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React16.createElement(
|
|
2795
2839
|
ComponentItem,
|
|
2796
2840
|
{
|
|
2797
2841
|
key: component.uid,
|
|
@@ -2803,24 +2847,9 @@ function ComponentsList() {
|
|
|
2803
2847
|
)));
|
|
2804
2848
|
}
|
|
2805
2849
|
var EmptyState = () => {
|
|
2806
|
-
const [isAngieModalOpen, setIsAngieModalOpen] = (0, import_react9.useState)(false);
|
|
2807
2850
|
const { canCreate } = useComponentsPermissions();
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
if (sdk.isAngieReady()) {
|
|
2811
|
-
sdk.triggerAngie({
|
|
2812
|
-
prompt: (0, import_i18n20.__)(
|
|
2813
|
-
"Create a [hero/testimonial/product card/CTA/feature] component for my [business type]. Include [describe what you want]",
|
|
2814
|
-
"elementor"
|
|
2815
|
-
),
|
|
2816
|
-
context: { source: "components-panel-empty-state" }
|
|
2817
|
-
});
|
|
2818
|
-
} else {
|
|
2819
|
-
setIsAngieModalOpen(true);
|
|
2820
|
-
}
|
|
2821
|
-
};
|
|
2822
|
-
return /* @__PURE__ */ React17.createElement(
|
|
2823
|
-
import_ui15.Stack,
|
|
2851
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2852
|
+
import_ui14.Stack,
|
|
2824
2853
|
{
|
|
2825
2854
|
alignItems: "center",
|
|
2826
2855
|
justifyContent: "start",
|
|
@@ -2829,11 +2858,11 @@ var EmptyState = () => {
|
|
|
2829
2858
|
gap: 2,
|
|
2830
2859
|
overflow: "hidden"
|
|
2831
2860
|
},
|
|
2832
|
-
/* @__PURE__ */
|
|
2861
|
+
/* @__PURE__ */ React16.createElement(import_ui14.Stack, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(import_icons10.ComponentsIcon, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React16.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, (0, import_i18n19.__)("No components yet", "elementor")), /* @__PURE__ */ React16.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 200 } }, (0, import_i18n19.__)("Components are reusable blocks that sync across your site.", "elementor"), /* @__PURE__ */ React16.createElement("br", null), canCreate ? (0, import_i18n19.__)("Create once, use everywhere.", "elementor") : (0, import_i18n19.__)(
|
|
2833
2862
|
"With your current role, you cannot create components. Contact an administrator to create one.",
|
|
2834
2863
|
"elementor"
|
|
2835
|
-
)), /* @__PURE__ */
|
|
2836
|
-
|
|
2864
|
+
)), /* @__PURE__ */ React16.createElement(
|
|
2865
|
+
import_ui14.Link,
|
|
2837
2866
|
{
|
|
2838
2867
|
href: LEARN_MORE_URL,
|
|
2839
2868
|
target: "_blank",
|
|
@@ -2841,37 +2870,27 @@ var EmptyState = () => {
|
|
|
2841
2870
|
variant: "caption",
|
|
2842
2871
|
color: "info.main"
|
|
2843
2872
|
},
|
|
2844
|
-
(0,
|
|
2873
|
+
(0, import_i18n19.__)("Learn more about components", "elementor")
|
|
2845
2874
|
)),
|
|
2846
|
-
canCreate && /* @__PURE__ */
|
|
2847
|
-
|
|
2875
|
+
canCreate && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(import_ui14.Divider, { sx: { width: "100%" } }), /* @__PURE__ */ React16.createElement(import_ui14.Stack, { alignItems: "center", gap: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(
|
|
2876
|
+
import_ui14.Typography,
|
|
2848
2877
|
{
|
|
2849
2878
|
align: "center",
|
|
2850
2879
|
variant: "subtitle2",
|
|
2851
2880
|
color: "text.secondary",
|
|
2852
2881
|
sx: SUBTITLE_OVERRIDE_SX
|
|
2853
2882
|
},
|
|
2854
|
-
(0,
|
|
2855
|
-
), /* @__PURE__ */
|
|
2883
|
+
(0, import_i18n19.__)("Create your first one:", "elementor")
|
|
2884
|
+
), /* @__PURE__ */ React16.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "secondary", sx: { maxWidth: 228 } }, (0, import_i18n19.__)(
|
|
2856
2885
|
'Right-click any div-block or flexbox on your canvas or structure and select "Create component"',
|
|
2857
2886
|
"elementor"
|
|
2858
|
-
)), /* @__PURE__ */ React17.createElement(import_ui15.Typography, { align: "center", variant: "caption", color: "secondary" }, (0, import_i18n20.__)("Or", "elementor")), /* @__PURE__ */ React17.createElement(AngiePromotionModal, { open: isAngieModalOpen, onClose: () => setIsAngieModalOpen(false) }, /* @__PURE__ */ React17.createElement(
|
|
2859
|
-
import_ui15.Button,
|
|
2860
|
-
{
|
|
2861
|
-
color: "secondary",
|
|
2862
|
-
variant: "outlined",
|
|
2863
|
-
size: "small",
|
|
2864
|
-
onClick: handleCreateWithAI,
|
|
2865
|
-
endIcon: /* @__PURE__ */ React17.createElement(import_icons10.AIIcon, null)
|
|
2866
|
-
},
|
|
2867
|
-
(0, import_i18n20.__)("Create component with AI", "elementor")
|
|
2868
2887
|
))))
|
|
2869
2888
|
);
|
|
2870
2889
|
};
|
|
2871
2890
|
var EmptySearchResult = () => {
|
|
2872
2891
|
const { searchValue, clearSearch } = useSearch();
|
|
2873
|
-
return /* @__PURE__ */
|
|
2874
|
-
|
|
2892
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2893
|
+
import_ui14.Stack,
|
|
2875
2894
|
{
|
|
2876
2895
|
color: "text.secondary",
|
|
2877
2896
|
pt: 5,
|
|
@@ -2880,17 +2899,17 @@ var EmptySearchResult = () => {
|
|
|
2880
2899
|
overflow: "hidden",
|
|
2881
2900
|
justifySelf: "center"
|
|
2882
2901
|
},
|
|
2883
|
-
/* @__PURE__ */
|
|
2884
|
-
/* @__PURE__ */
|
|
2885
|
-
|
|
2902
|
+
/* @__PURE__ */ React16.createElement(import_icons10.ComponentsIcon, null),
|
|
2903
|
+
/* @__PURE__ */ React16.createElement(
|
|
2904
|
+
import_ui14.Box,
|
|
2886
2905
|
{
|
|
2887
2906
|
sx: {
|
|
2888
2907
|
width: "100%"
|
|
2889
2908
|
}
|
|
2890
2909
|
},
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
searchValue && /* @__PURE__ */
|
|
2893
|
-
|
|
2910
|
+
/* @__PURE__ */ React16.createElement(import_ui14.Typography, { align: "center", variant: "subtitle2", color: "inherit", sx: SUBTITLE_OVERRIDE_SX }, (0, import_i18n19.__)("Sorry, nothing matched", "elementor")),
|
|
2911
|
+
searchValue && /* @__PURE__ */ React16.createElement(
|
|
2912
|
+
import_ui14.Typography,
|
|
2894
2913
|
{
|
|
2895
2914
|
variant: "subtitle2",
|
|
2896
2915
|
color: "inherit",
|
|
@@ -2901,8 +2920,8 @@ var EmptySearchResult = () => {
|
|
|
2901
2920
|
justifyContent: "center"
|
|
2902
2921
|
}
|
|
2903
2922
|
},
|
|
2904
|
-
/* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
2923
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201C"),
|
|
2924
|
+
/* @__PURE__ */ React16.createElement(
|
|
2906
2925
|
"span",
|
|
2907
2926
|
{
|
|
2908
2927
|
style: {
|
|
@@ -2913,11 +2932,11 @@ var EmptySearchResult = () => {
|
|
|
2913
2932
|
},
|
|
2914
2933
|
searchValue
|
|
2915
2934
|
),
|
|
2916
|
-
/* @__PURE__ */
|
|
2935
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201D.")
|
|
2917
2936
|
)
|
|
2918
2937
|
),
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ React16.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, (0, import_i18n19.__)("Try something else.", "elementor")),
|
|
2939
|
+
/* @__PURE__ */ React16.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(import_ui14.Link, { color: "secondary", variant: "caption", component: "button", onClick: clearSearch }, (0, import_i18n19.__)("Clear & try again", "elementor")))
|
|
2921
2940
|
);
|
|
2922
2941
|
};
|
|
2923
2942
|
var useFilteredComponents = () => {
|
|
@@ -2933,12 +2952,12 @@ var useFilteredComponents = () => {
|
|
|
2933
2952
|
};
|
|
2934
2953
|
|
|
2935
2954
|
// src/components/components-tab/components-pro-notification.tsx
|
|
2936
|
-
var
|
|
2955
|
+
var React17 = __toESM(require("react"));
|
|
2937
2956
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2938
|
-
var
|
|
2939
|
-
var
|
|
2957
|
+
var import_ui15 = require("@elementor/ui");
|
|
2958
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
2940
2959
|
function ComponentsProNotification() {
|
|
2941
|
-
return /* @__PURE__ */
|
|
2960
|
+
return /* @__PURE__ */ React17.createElement(import_ui15.Box, { sx: { px: 2 } }, /* @__PURE__ */ React17.createElement(import_editor_ui9.InfoAlert, null, /* @__PURE__ */ React17.createElement(import_ui15.Typography, { variant: "caption", component: "span" }, /* @__PURE__ */ React17.createElement(import_ui15.Typography, { variant: "caption", component: "span", fontWeight: "bold" }, (0, import_i18n20.__)("Try Components for free:", "elementor")), " ", (0, import_i18n20.__)(
|
|
2942
2961
|
"Soon Components will be part of the Pro subscription, but what you create now will remain on your site.",
|
|
2943
2962
|
"elementor"
|
|
2944
2963
|
))));
|
|
@@ -2948,10 +2967,10 @@ function ComponentsProNotification() {
|
|
|
2948
2967
|
var ComponentsContent = () => {
|
|
2949
2968
|
const { components, isLoading } = useComponents();
|
|
2950
2969
|
const hasComponents = !isLoading && components.length > 0;
|
|
2951
|
-
return /* @__PURE__ */
|
|
2970
|
+
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));
|
|
2952
2971
|
};
|
|
2953
2972
|
var Components = () => {
|
|
2954
|
-
return /* @__PURE__ */
|
|
2973
|
+
return /* @__PURE__ */ React18.createElement(import_editor_ui10.ThemeProvider, null, /* @__PURE__ */ React18.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React18.createElement(ComponentsContent, null)));
|
|
2955
2974
|
};
|
|
2956
2975
|
|
|
2957
2976
|
// src/components/consts.ts
|
|
@@ -2959,22 +2978,22 @@ var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
|
2959
2978
|
var OVERRIDABLE_PROP_REPLACEMENT_ID = "overridable-prop";
|
|
2960
2979
|
|
|
2961
2980
|
// src/components/create-component-form/create-component-form.tsx
|
|
2962
|
-
var
|
|
2963
|
-
var
|
|
2981
|
+
var React19 = __toESM(require("react"));
|
|
2982
|
+
var import_react10 = require("react");
|
|
2964
2983
|
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
2965
2984
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
2966
2985
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
2967
2986
|
var import_icons11 = require("@elementor/icons");
|
|
2968
2987
|
var import_store47 = require("@elementor/store");
|
|
2969
|
-
var
|
|
2970
|
-
var
|
|
2988
|
+
var import_ui16 = require("@elementor/ui");
|
|
2989
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2971
2990
|
|
|
2972
2991
|
// src/prevent-non-atomic-nesting.ts
|
|
2973
2992
|
var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
2974
2993
|
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2975
2994
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2976
2995
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2977
|
-
var
|
|
2996
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
2978
2997
|
|
|
2979
2998
|
// src/utils/is-editing-component.ts
|
|
2980
2999
|
var import_store43 = require("@elementor/store");
|
|
@@ -2989,7 +3008,7 @@ function isEditingComponent() {
|
|
|
2989
3008
|
// src/prevent-non-atomic-nesting.ts
|
|
2990
3009
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2991
3010
|
type: "default",
|
|
2992
|
-
message: (0,
|
|
3011
|
+
message: (0, import_i18n21.__)("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
2993
3012
|
id: "non-atomic-element-blocked"
|
|
2994
3013
|
};
|
|
2995
3014
|
function initNonAtomicNestingPrevention() {
|
|
@@ -3101,10 +3120,11 @@ async function createUnpublishedComponent({
|
|
|
3101
3120
|
}) {
|
|
3102
3121
|
const generatedUid = uid ?? (0, import_utils4.generateUniqueId)("component");
|
|
3103
3122
|
const componentBase = { uid: generatedUid, name };
|
|
3123
|
+
const elementDataWithOverridablesReverted = revertAllOverridablesInElementData(element);
|
|
3104
3124
|
(0, import_store45.__dispatch)(
|
|
3105
3125
|
slice.actions.addUnpublished({
|
|
3106
3126
|
...componentBase,
|
|
3107
|
-
elements: [
|
|
3127
|
+
elements: [elementDataWithOverridablesReverted],
|
|
3108
3128
|
overridableProps
|
|
3109
3129
|
})
|
|
3110
3130
|
);
|
|
@@ -3122,11 +3142,11 @@ async function createUnpublishedComponent({
|
|
|
3122
3142
|
}
|
|
3123
3143
|
|
|
3124
3144
|
// src/components/create-component-form/hooks/use-form.ts
|
|
3125
|
-
var
|
|
3145
|
+
var import_react9 = require("react");
|
|
3126
3146
|
var useForm = (initialValues) => {
|
|
3127
|
-
const [values, setValues] = (0,
|
|
3128
|
-
const [errors, setErrors] = (0,
|
|
3129
|
-
const isValid = (0,
|
|
3147
|
+
const [values, setValues] = (0, import_react9.useState)(initialValues);
|
|
3148
|
+
const [errors, setErrors] = (0, import_react9.useState)({});
|
|
3149
|
+
const isValid = (0, import_react9.useMemo)(() => {
|
|
3130
3150
|
return !Object.values(errors).some((error) => error);
|
|
3131
3151
|
}, [errors]);
|
|
3132
3152
|
const handleChange = (e, field, validationSchema) => {
|
|
@@ -3201,17 +3221,17 @@ function countNestedElements(container) {
|
|
|
3201
3221
|
|
|
3202
3222
|
// src/components/create-component-form/create-component-form.tsx
|
|
3203
3223
|
function CreateComponentForm() {
|
|
3204
|
-
const [element, setElement] = (0,
|
|
3205
|
-
const [anchorPosition, setAnchorPosition] = (0,
|
|
3206
|
-
const eventData = (0,
|
|
3207
|
-
(0,
|
|
3224
|
+
const [element, setElement] = (0, import_react10.useState)(null);
|
|
3225
|
+
const [anchorPosition, setAnchorPosition] = (0, import_react10.useState)();
|
|
3226
|
+
const eventData = (0, import_react10.useRef)(null);
|
|
3227
|
+
(0, import_react10.useEffect)(() => {
|
|
3208
3228
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
3209
3229
|
const openPopup = (event) => {
|
|
3210
3230
|
const nonAtomicElements = findNonAtomicElementsInElement(event.detail.element);
|
|
3211
3231
|
if (nonAtomicElements.length > 0) {
|
|
3212
3232
|
(0, import_editor_notifications3.notify)({
|
|
3213
3233
|
type: "default",
|
|
3214
|
-
message: (0,
|
|
3234
|
+
message: (0, import_i18n22.__)(
|
|
3215
3235
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
3216
3236
|
"elementor"
|
|
3217
3237
|
),
|
|
@@ -3252,12 +3272,12 @@ function CreateComponentForm() {
|
|
|
3252
3272
|
}
|
|
3253
3273
|
(0, import_editor_notifications3.notify)({
|
|
3254
3274
|
type: "success",
|
|
3255
|
-
message: (0,
|
|
3275
|
+
message: (0, import_i18n22.__)("Component created successfully.", "elementor"),
|
|
3256
3276
|
id: `component-saved-successfully-${uid}`
|
|
3257
3277
|
});
|
|
3258
3278
|
resetAndClosePopup();
|
|
3259
3279
|
} catch {
|
|
3260
|
-
const errorMessage = (0,
|
|
3280
|
+
const errorMessage = (0, import_i18n22.__)("Failed to create component. Please try again.", "elementor");
|
|
3261
3281
|
(0, import_editor_notifications3.notify)({
|
|
3262
3282
|
type: "error",
|
|
3263
3283
|
message: errorMessage,
|
|
@@ -3277,15 +3297,15 @@ function CreateComponentForm() {
|
|
|
3277
3297
|
...eventData.current
|
|
3278
3298
|
});
|
|
3279
3299
|
};
|
|
3280
|
-
return /* @__PURE__ */
|
|
3281
|
-
|
|
3300
|
+
return /* @__PURE__ */ React19.createElement(import_editor_ui11.ThemeProvider, null, /* @__PURE__ */ React19.createElement(
|
|
3301
|
+
import_ui16.Popover,
|
|
3282
3302
|
{
|
|
3283
3303
|
open: element !== null,
|
|
3284
3304
|
onClose: cancelSave,
|
|
3285
3305
|
anchorReference: "anchorPosition",
|
|
3286
3306
|
anchorPosition
|
|
3287
3307
|
},
|
|
3288
|
-
element !== null && /* @__PURE__ */
|
|
3308
|
+
element !== null && /* @__PURE__ */ React19.createElement(
|
|
3289
3309
|
Form2,
|
|
3290
3310
|
{
|
|
3291
3311
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -3303,14 +3323,14 @@ var Form2 = ({
|
|
|
3303
3323
|
}) => {
|
|
3304
3324
|
const { values, errors, isValid, handleChange, validateForm: validateForm2 } = useForm(initialValues);
|
|
3305
3325
|
const { components } = useComponents();
|
|
3306
|
-
const existingComponentNames = (0,
|
|
3326
|
+
const existingComponentNames = (0, import_react10.useMemo)(() => {
|
|
3307
3327
|
return components?.map((component) => component.name) ?? [];
|
|
3308
3328
|
}, [components]);
|
|
3309
|
-
const changeValidationSchema = (0,
|
|
3329
|
+
const changeValidationSchema = (0, import_react10.useMemo)(
|
|
3310
3330
|
() => createBaseComponentSchema(existingComponentNames),
|
|
3311
3331
|
[existingComponentNames]
|
|
3312
3332
|
);
|
|
3313
|
-
const submitValidationSchema = (0,
|
|
3333
|
+
const submitValidationSchema = (0, import_react10.useMemo)(
|
|
3314
3334
|
() => createSubmitComponentSchema(existingComponentNames),
|
|
3315
3335
|
[existingComponentNames]
|
|
3316
3336
|
);
|
|
@@ -3321,14 +3341,14 @@ var Form2 = ({
|
|
|
3321
3341
|
}
|
|
3322
3342
|
};
|
|
3323
3343
|
const texts = {
|
|
3324
|
-
heading: (0,
|
|
3325
|
-
name: (0,
|
|
3326
|
-
cancel: (0,
|
|
3327
|
-
create: (0,
|
|
3344
|
+
heading: (0, import_i18n22.__)("Create component", "elementor"),
|
|
3345
|
+
name: (0, import_i18n22.__)("Name", "elementor"),
|
|
3346
|
+
cancel: (0, import_i18n22.__)("Cancel", "elementor"),
|
|
3347
|
+
create: (0, import_i18n22.__)("Create", "elementor")
|
|
3328
3348
|
};
|
|
3329
3349
|
const nameInputId = "component-name";
|
|
3330
|
-
return /* @__PURE__ */
|
|
3331
|
-
|
|
3350
|
+
return /* @__PURE__ */ React19.createElement(import_editor_ui11.Form, { onSubmit: handleSubmit }, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React19.createElement(
|
|
3351
|
+
import_ui16.Stack,
|
|
3332
3352
|
{
|
|
3333
3353
|
direction: "row",
|
|
3334
3354
|
alignItems: "center",
|
|
@@ -3336,10 +3356,10 @@ var Form2 = ({
|
|
|
3336
3356
|
px: 1.5,
|
|
3337
3357
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
3338
3358
|
},
|
|
3339
|
-
/* @__PURE__ */
|
|
3340
|
-
/* @__PURE__ */
|
|
3341
|
-
), /* @__PURE__ */
|
|
3342
|
-
|
|
3359
|
+
/* @__PURE__ */ React19.createElement(import_icons11.ComponentsIcon, { fontSize: FONT_SIZE }),
|
|
3360
|
+
/* @__PURE__ */ React19.createElement(import_ui16.Typography, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, texts.heading)
|
|
3361
|
+
), /* @__PURE__ */ React19.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "start", p: 1.5 }, /* @__PURE__ */ React19.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React19.createElement(import_ui16.FormLabel, { htmlFor: nameInputId, size: "tiny" }, texts.name)), /* @__PURE__ */ React19.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React19.createElement(
|
|
3362
|
+
import_ui16.TextField,
|
|
3343
3363
|
{
|
|
3344
3364
|
id: nameInputId,
|
|
3345
3365
|
size: FONT_SIZE,
|
|
@@ -3350,12 +3370,12 @@ var Form2 = ({
|
|
|
3350
3370
|
error: Boolean(errors.componentName),
|
|
3351
3371
|
helperText: errors.componentName
|
|
3352
3372
|
}
|
|
3353
|
-
))), /* @__PURE__ */
|
|
3373
|
+
))), /* @__PURE__ */ React19.createElement(import_ui16.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", py: 1, px: 1.5 }, /* @__PURE__ */ React19.createElement(import_ui16.Button, { onClick: closePopup, color: "secondary", variant: "text", size: "small" }, texts.cancel), /* @__PURE__ */ React19.createElement(import_ui16.Button, { type: "submit", disabled: !isValid, variant: "contained", color: "primary", size: "small" }, texts.create))));
|
|
3354
3374
|
};
|
|
3355
3375
|
|
|
3356
3376
|
// src/components/edit-component/edit-component.tsx
|
|
3357
|
-
var
|
|
3358
|
-
var
|
|
3377
|
+
var React21 = __toESM(require("react"));
|
|
3378
|
+
var import_react13 = require("react");
|
|
3359
3379
|
var import_editor_documents11 = require("@elementor/editor-documents");
|
|
3360
3380
|
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
3361
3381
|
var import_store51 = require("@elementor/store");
|
|
@@ -3377,10 +3397,10 @@ function updateCurrentComponent({
|
|
|
3377
3397
|
}
|
|
3378
3398
|
|
|
3379
3399
|
// src/components/edit-component/component-modal.tsx
|
|
3380
|
-
var
|
|
3381
|
-
var
|
|
3400
|
+
var React20 = __toESM(require("react"));
|
|
3401
|
+
var import_react12 = require("react");
|
|
3382
3402
|
var import_react_dom = require("react-dom");
|
|
3383
|
-
var
|
|
3403
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3384
3404
|
|
|
3385
3405
|
// src/hooks/use-canvas-document.ts
|
|
3386
3406
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
@@ -3389,10 +3409,10 @@ function useCanvasDocument() {
|
|
|
3389
3409
|
}
|
|
3390
3410
|
|
|
3391
3411
|
// src/hooks/use-element-rect.ts
|
|
3392
|
-
var
|
|
3412
|
+
var import_react11 = require("react");
|
|
3393
3413
|
var import_utils5 = require("@elementor/utils");
|
|
3394
3414
|
function useElementRect(element) {
|
|
3395
|
-
const [rect, setRect] = (0,
|
|
3415
|
+
const [rect, setRect] = (0, import_react11.useState)(new DOMRect(0, 0, 0, 0));
|
|
3396
3416
|
const onChange = (0, import_utils5.throttle)(
|
|
3397
3417
|
() => {
|
|
3398
3418
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -3403,7 +3423,7 @@ function useElementRect(element) {
|
|
|
3403
3423
|
useScrollListener({ element, onChange });
|
|
3404
3424
|
useResizeListener({ element, onChange });
|
|
3405
3425
|
useMutationsListener({ element, onChange });
|
|
3406
|
-
(0,
|
|
3426
|
+
(0, import_react11.useEffect)(
|
|
3407
3427
|
() => () => {
|
|
3408
3428
|
onChange.cancel();
|
|
3409
3429
|
},
|
|
@@ -3412,7 +3432,7 @@ function useElementRect(element) {
|
|
|
3412
3432
|
return rect;
|
|
3413
3433
|
}
|
|
3414
3434
|
function useScrollListener({ element, onChange }) {
|
|
3415
|
-
(0,
|
|
3435
|
+
(0, import_react11.useEffect)(() => {
|
|
3416
3436
|
if (!element) {
|
|
3417
3437
|
return;
|
|
3418
3438
|
}
|
|
@@ -3424,7 +3444,7 @@ function useScrollListener({ element, onChange }) {
|
|
|
3424
3444
|
}, [element, onChange]);
|
|
3425
3445
|
}
|
|
3426
3446
|
function useResizeListener({ element, onChange }) {
|
|
3427
|
-
(0,
|
|
3447
|
+
(0, import_react11.useEffect)(() => {
|
|
3428
3448
|
if (!element) {
|
|
3429
3449
|
return;
|
|
3430
3450
|
}
|
|
@@ -3439,7 +3459,7 @@ function useResizeListener({ element, onChange }) {
|
|
|
3439
3459
|
}, [element, onChange]);
|
|
3440
3460
|
}
|
|
3441
3461
|
function useMutationsListener({ element, onChange }) {
|
|
3442
|
-
(0,
|
|
3462
|
+
(0, import_react11.useEffect)(() => {
|
|
3443
3463
|
if (!element) {
|
|
3444
3464
|
return;
|
|
3445
3465
|
}
|
|
@@ -3454,7 +3474,7 @@ function useMutationsListener({ element, onChange }) {
|
|
|
3454
3474
|
// src/components/edit-component/component-modal.tsx
|
|
3455
3475
|
function ComponentModal({ topLevelElementDom, onClose }) {
|
|
3456
3476
|
const canvasDocument = useCanvasDocument();
|
|
3457
|
-
(0,
|
|
3477
|
+
(0, import_react12.useEffect)(() => {
|
|
3458
3478
|
const handleEsc = (event) => {
|
|
3459
3479
|
if (event.key === "Escape") {
|
|
3460
3480
|
onClose();
|
|
@@ -3469,7 +3489,7 @@ function ComponentModal({ topLevelElementDom, onClose }) {
|
|
|
3469
3489
|
return null;
|
|
3470
3490
|
}
|
|
3471
3491
|
return (0, import_react_dom.createPortal)(
|
|
3472
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(BlockEditPage, null), /* @__PURE__ */ React20.createElement(Backdrop, { canvas: canvasDocument, element: topLevelElementDom, onClose })),
|
|
3473
3493
|
canvasDocument.body
|
|
3474
3494
|
);
|
|
3475
3495
|
}
|
|
@@ -3498,7 +3518,7 @@ function Backdrop({
|
|
|
3498
3518
|
onClose();
|
|
3499
3519
|
}
|
|
3500
3520
|
};
|
|
3501
|
-
return /* @__PURE__ */
|
|
3521
|
+
return /* @__PURE__ */ React20.createElement(
|
|
3502
3522
|
"div",
|
|
3503
3523
|
{
|
|
3504
3524
|
style: backdropStyle,
|
|
@@ -3506,7 +3526,7 @@ function Backdrop({
|
|
|
3506
3526
|
onKeyDown: handleKeyDown,
|
|
3507
3527
|
role: "button",
|
|
3508
3528
|
tabIndex: 0,
|
|
3509
|
-
"aria-label": (0,
|
|
3529
|
+
"aria-label": (0, import_i18n23.__)("Exit component editing mode", "elementor")
|
|
3510
3530
|
}
|
|
3511
3531
|
);
|
|
3512
3532
|
}
|
|
@@ -3546,7 +3566,7 @@ function BlockEditPage() {
|
|
|
3546
3566
|
}
|
|
3547
3567
|
}
|
|
3548
3568
|
`;
|
|
3549
|
-
return /* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ React20.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
3550
3570
|
}
|
|
3551
3571
|
|
|
3552
3572
|
// src/components/edit-component/edit-component.tsx
|
|
@@ -3559,13 +3579,13 @@ function EditComponent() {
|
|
|
3559
3579
|
if (!currentComponentId) {
|
|
3560
3580
|
return null;
|
|
3561
3581
|
}
|
|
3562
|
-
return /* @__PURE__ */
|
|
3582
|
+
return /* @__PURE__ */ React21.createElement(ComponentModal, { topLevelElementDom, onClose });
|
|
3563
3583
|
}
|
|
3564
3584
|
function useHandleDocumentSwitches() {
|
|
3565
3585
|
const documentsManager = (0, import_editor_documents11.getV1DocumentsManager)();
|
|
3566
3586
|
const currentComponentId = useCurrentComponentId();
|
|
3567
3587
|
const path = (0, import_store51.__useSelector)(selectPath);
|
|
3568
|
-
(0,
|
|
3588
|
+
(0, import_react13.useEffect)(() => {
|
|
3569
3589
|
return (0, import_editor_v1_adapters7.__privateListenTo)((0, import_editor_v1_adapters7.commandEndEvent)("editor/documents/open"), () => {
|
|
3570
3590
|
const nextDocument = documentsManager.getCurrent();
|
|
3571
3591
|
if (nextDocument.id === currentComponentId) {
|
|
@@ -3618,11 +3638,11 @@ function getInstanceTitle(instanceId, path) {
|
|
|
3618
3638
|
}
|
|
3619
3639
|
function useComponentDOMElement(id2) {
|
|
3620
3640
|
const { componentContainerDomElement, topLevelElementDom } = getComponentDOMElements(id2);
|
|
3621
|
-
const [currentElementDom, setCurrentElementDom] = (0,
|
|
3622
|
-
(0,
|
|
3641
|
+
const [currentElementDom, setCurrentElementDom] = (0, import_react13.useState)(topLevelElementDom);
|
|
3642
|
+
(0, import_react13.useEffect)(() => {
|
|
3623
3643
|
setCurrentElementDom(topLevelElementDom);
|
|
3624
3644
|
}, [topLevelElementDom]);
|
|
3625
|
-
(0,
|
|
3645
|
+
(0, import_react13.useEffect)(() => {
|
|
3626
3646
|
if (!componentContainerDomElement) {
|
|
3627
3647
|
return;
|
|
3628
3648
|
}
|
|
@@ -3650,34 +3670,34 @@ function getComponentDOMElements(id2) {
|
|
|
3650
3670
|
}
|
|
3651
3671
|
|
|
3652
3672
|
// src/components/in-edit-mode.tsx
|
|
3653
|
-
var
|
|
3673
|
+
var React22 = __toESM(require("react"));
|
|
3654
3674
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3655
3675
|
var import_icons12 = require("@elementor/icons");
|
|
3656
|
-
var
|
|
3657
|
-
var
|
|
3676
|
+
var import_ui17 = require("@elementor/ui");
|
|
3677
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3658
3678
|
var openEditModeDialog = (lockedBy) => {
|
|
3659
3679
|
(0, import_editor_ui12.openDialog)({
|
|
3660
|
-
component: /* @__PURE__ */
|
|
3680
|
+
component: /* @__PURE__ */ React22.createElement(EditModeDialog, { lockedBy })
|
|
3661
3681
|
});
|
|
3662
3682
|
};
|
|
3663
3683
|
var EditModeDialog = ({ lockedBy }) => {
|
|
3664
|
-
const content = (0,
|
|
3665
|
-
return /* @__PURE__ */
|
|
3684
|
+
const content = (0, import_i18n24.__)("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
3685
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(import_ui17.DialogHeader, { logo: false }, /* @__PURE__ */ React22.createElement(import_ui17.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React22.createElement(import_ui17.Icon, { color: "secondary" }, /* @__PURE__ */ React22.createElement(import_icons12.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React22.createElement(import_ui17.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React22.createElement(import_ui17.DialogContent, null, /* @__PURE__ */ React22.createElement(import_ui17.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React22.createElement(import_ui17.Typography, { variant: "body2" }, (0, import_i18n24.__)(
|
|
3666
3686
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
3667
3687
|
"elementor"
|
|
3668
|
-
)), /* @__PURE__ */
|
|
3688
|
+
)), /* @__PURE__ */ React22.createElement(import_ui17.DialogActions, null, /* @__PURE__ */ React22.createElement(import_ui17.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui12.closeDialog }, (0, import_i18n24.__)("Close", "elementor"))))));
|
|
3669
3689
|
};
|
|
3670
3690
|
|
|
3671
3691
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
3672
|
-
var
|
|
3692
|
+
var React28 = __toESM(require("react"));
|
|
3673
3693
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
3674
3694
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
3675
3695
|
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
3676
3696
|
var import_editor_panels4 = require("@elementor/editor-panels");
|
|
3677
3697
|
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
3678
3698
|
var import_icons14 = require("@elementor/icons");
|
|
3679
|
-
var
|
|
3680
|
-
var
|
|
3699
|
+
var import_ui22 = require("@elementor/ui");
|
|
3700
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3681
3701
|
|
|
3682
3702
|
// src/hooks/use-component-instance-settings.ts
|
|
3683
3703
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
@@ -3689,21 +3709,21 @@ function useComponentInstanceSettings() {
|
|
|
3689
3709
|
}
|
|
3690
3710
|
|
|
3691
3711
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
3692
|
-
var
|
|
3712
|
+
var React23 = __toESM(require("react"));
|
|
3693
3713
|
var import_icons13 = require("@elementor/icons");
|
|
3694
|
-
var
|
|
3695
|
-
var
|
|
3714
|
+
var import_ui18 = require("@elementor/ui");
|
|
3715
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3696
3716
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
3697
3717
|
const { canEdit } = useComponentsPermissions();
|
|
3698
|
-
const message = canEdit ? (0,
|
|
3718
|
+
const message = canEdit ? (0, import_i18n25.__)(
|
|
3699
3719
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
3700
3720
|
"elementor"
|
|
3701
|
-
) : (0,
|
|
3721
|
+
) : (0, import_i18n25.__)(
|
|
3702
3722
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
3703
3723
|
"elementor"
|
|
3704
3724
|
);
|
|
3705
|
-
return /* @__PURE__ */
|
|
3706
|
-
|
|
3725
|
+
return /* @__PURE__ */ React23.createElement(
|
|
3726
|
+
import_ui18.Stack,
|
|
3707
3727
|
{
|
|
3708
3728
|
alignItems: "center",
|
|
3709
3729
|
justifyContent: "start",
|
|
@@ -3712,26 +3732,26 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
3712
3732
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
3713
3733
|
gap: 1.5
|
|
3714
3734
|
},
|
|
3715
|
-
/* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3717
|
-
/* @__PURE__ */
|
|
3718
|
-
canEdit && /* @__PURE__ */
|
|
3735
|
+
/* @__PURE__ */ React23.createElement(import_icons13.ComponentPropListIcon, { fontSize: "large" }),
|
|
3736
|
+
/* @__PURE__ */ React23.createElement(import_ui18.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n25.__)("No properties yet", "elementor")),
|
|
3737
|
+
/* @__PURE__ */ React23.createElement(import_ui18.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
3738
|
+
canEdit && /* @__PURE__ */ React23.createElement(import_ui18.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React23.createElement(import_icons13.PencilIcon, { fontSize: "small" }), (0, import_i18n25.__)("Edit component", "elementor"))
|
|
3719
3739
|
);
|
|
3720
3740
|
};
|
|
3721
3741
|
|
|
3722
3742
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
3723
|
-
var
|
|
3724
|
-
var
|
|
3743
|
+
var React27 = __toESM(require("react"));
|
|
3744
|
+
var import_react15 = require("react");
|
|
3725
3745
|
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
3726
3746
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3727
|
-
var
|
|
3747
|
+
var import_ui21 = require("@elementor/ui");
|
|
3728
3748
|
|
|
3729
3749
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3730
|
-
var
|
|
3750
|
+
var React26 = __toESM(require("react"));
|
|
3731
3751
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
3732
3752
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
3733
3753
|
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
3734
|
-
var
|
|
3754
|
+
var import_ui20 = require("@elementor/ui");
|
|
3735
3755
|
|
|
3736
3756
|
// src/hooks/use-controls-by-widget-type.ts
|
|
3737
3757
|
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
@@ -3765,14 +3785,14 @@ function getControlsByBind(controls) {
|
|
|
3765
3785
|
}
|
|
3766
3786
|
|
|
3767
3787
|
// src/provider/overridable-prop-context.tsx
|
|
3768
|
-
var
|
|
3769
|
-
var
|
|
3770
|
-
var OverridablePropContext = (0,
|
|
3788
|
+
var React24 = __toESM(require("react"));
|
|
3789
|
+
var import_react14 = require("react");
|
|
3790
|
+
var OverridablePropContext = (0, import_react14.createContext)(null);
|
|
3771
3791
|
function OverridablePropProvider({ children, ...props }) {
|
|
3772
|
-
return /* @__PURE__ */
|
|
3792
|
+
return /* @__PURE__ */ React24.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
3773
3793
|
}
|
|
3774
|
-
var useOverridablePropValue = () => (0,
|
|
3775
|
-
var useComponentInstanceElement = () => (0,
|
|
3794
|
+
var useOverridablePropValue = () => (0, import_react14.useContext)(OverridablePropContext)?.value;
|
|
3795
|
+
var useComponentInstanceElement = () => (0, import_react14.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
3776
3796
|
|
|
3777
3797
|
// src/store/actions/update-overridable-prop.ts
|
|
3778
3798
|
var import_store53 = require("@elementor/store");
|
|
@@ -3863,11 +3883,11 @@ function getPropType({ widgetType, propKey }) {
|
|
|
3863
3883
|
}
|
|
3864
3884
|
|
|
3865
3885
|
// src/components/control-label.tsx
|
|
3866
|
-
var
|
|
3886
|
+
var React25 = __toESM(require("react"));
|
|
3867
3887
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
3868
|
-
var
|
|
3888
|
+
var import_ui19 = require("@elementor/ui");
|
|
3869
3889
|
var ControlLabel = ({ children, ...props }) => {
|
|
3870
|
-
return /* @__PURE__ */
|
|
3890
|
+
return /* @__PURE__ */ React25.createElement(import_ui19.Stack, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React25.createElement(import_editor_controls2.ControlFormLabel, { ...props }, children), /* @__PURE__ */ React25.createElement(import_editor_controls2.ControlAdornments, null));
|
|
3871
3891
|
};
|
|
3872
3892
|
|
|
3873
3893
|
// src/components/errors.ts
|
|
@@ -3879,7 +3899,7 @@ var OverrideControlInnerElementNotFoundError = (0, import_utils7.createError)({
|
|
|
3879
3899
|
|
|
3880
3900
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
3881
3901
|
function OverridePropControl({ overridableProp, overrides }) {
|
|
3882
|
-
return /* @__PURE__ */
|
|
3902
|
+
return /* @__PURE__ */ React26.createElement(import_editor_editing_panel3.SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(OverrideControl, { overridableProp, overrides }));
|
|
3883
3903
|
}
|
|
3884
3904
|
function OverrideControl({ overridableProp, overrides }) {
|
|
3885
3905
|
const componentInstanceElement = (0, import_editor_editing_panel3.useElement)();
|
|
@@ -3950,13 +3970,13 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3950
3970
|
if (!elementType) {
|
|
3951
3971
|
return null;
|
|
3952
3972
|
}
|
|
3953
|
-
return /* @__PURE__ */
|
|
3973
|
+
return /* @__PURE__ */ React26.createElement(
|
|
3954
3974
|
OverridablePropProvider,
|
|
3955
3975
|
{
|
|
3956
3976
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
3957
3977
|
componentInstanceElement
|
|
3958
3978
|
},
|
|
3959
|
-
/* @__PURE__ */
|
|
3979
|
+
/* @__PURE__ */ React26.createElement(import_editor_editing_panel3.ElementProvider, { element: { id: elementId, type }, elementType }, /* @__PURE__ */ React26.createElement(import_editor_editing_panel3.SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React26.createElement(
|
|
3960
3980
|
import_editor_controls3.PropProvider,
|
|
3961
3981
|
{
|
|
3962
3982
|
propType: propTypeSchema,
|
|
@@ -3966,7 +3986,7 @@ function OverrideControl({ overridableProp, overrides }) {
|
|
|
3966
3986
|
return false;
|
|
3967
3987
|
}
|
|
3968
3988
|
},
|
|
3969
|
-
/* @__PURE__ */
|
|
3989
|
+
/* @__PURE__ */ React26.createElement(import_editor_controls3.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React26.createElement(import_editor_controls3.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React26.createElement(import_ui20.Stack, { direction: "column", gap: 1, mb: 1.5 }, layout !== "custom" && /* @__PURE__ */ React26.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React26.createElement(OriginalControl, { control, controlProps }))))
|
|
3970
3990
|
)))
|
|
3971
3991
|
);
|
|
3972
3992
|
}
|
|
@@ -4030,7 +4050,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
4030
4050
|
}
|
|
4031
4051
|
function OriginalControl({ control, controlProps }) {
|
|
4032
4052
|
const { value } = control;
|
|
4033
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ React26.createElement(import_editor_editing_panel3.BaseControl, { type: value.type, props: controlProps });
|
|
4034
4054
|
}
|
|
4035
4055
|
function getControlLayout(control) {
|
|
4036
4056
|
return control.value.meta?.layout || import_editor_editing_panel3.controlsRegistry.getLayout(control.value.type);
|
|
@@ -4057,12 +4077,12 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
4057
4077
|
const handleClick = () => {
|
|
4058
4078
|
setIsOpen(!isOpen);
|
|
4059
4079
|
};
|
|
4060
|
-
const id2 = (0,
|
|
4080
|
+
const id2 = (0, import_react15.useId)();
|
|
4061
4081
|
const labelId = `label-${id2}`;
|
|
4062
4082
|
const contentId = `content-${id2}`;
|
|
4063
4083
|
const title = group.label;
|
|
4064
|
-
return /* @__PURE__ */
|
|
4065
|
-
|
|
4084
|
+
return /* @__PURE__ */ React27.createElement(import_ui21.Box, { "aria-label": `${title} section` }, /* @__PURE__ */ React27.createElement(
|
|
4085
|
+
import_ui21.ListItemButton,
|
|
4066
4086
|
{
|
|
4067
4087
|
id: labelId,
|
|
4068
4088
|
"aria-controls": contentId,
|
|
@@ -4071,16 +4091,16 @@ function OverridePropsGroup({ group, props, overrides }) {
|
|
|
4071
4091
|
p: 0,
|
|
4072
4092
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
4073
4093
|
},
|
|
4074
|
-
/* @__PURE__ */
|
|
4075
|
-
|
|
4094
|
+
/* @__PURE__ */ React27.createElement(import_ui21.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React27.createElement(
|
|
4095
|
+
import_ui21.ListItemText,
|
|
4076
4096
|
{
|
|
4077
4097
|
secondary: title,
|
|
4078
4098
|
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
4079
4099
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
4080
4100
|
}
|
|
4081
4101
|
)),
|
|
4082
|
-
/* @__PURE__ */
|
|
4083
|
-
), /* @__PURE__ */
|
|
4102
|
+
/* @__PURE__ */ React27.createElement(import_editor_ui13.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
4103
|
+
), /* @__PURE__ */ React27.createElement(import_ui21.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React27.createElement(import_ui21.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React27.createElement(
|
|
4084
4104
|
OverridePropControl,
|
|
4085
4105
|
{
|
|
4086
4106
|
key: overrideKey,
|
|
@@ -4102,23 +4122,23 @@ function InstanceEditingPanel() {
|
|
|
4102
4122
|
if (!componentId || !overridableProps || !component) {
|
|
4103
4123
|
return null;
|
|
4104
4124
|
}
|
|
4105
|
-
const panelTitle = (0,
|
|
4125
|
+
const panelTitle = (0, import_i18n26.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
4106
4126
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
4107
4127
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
4108
4128
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
4109
4129
|
const isEmpty = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
4110
|
-
return /* @__PURE__ */
|
|
4130
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(import_editor_panels4.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React28.createElement(import_ui22.Stack, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React28.createElement(import_icons14.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React28.createElement(import_editor_ui14.EllipsisWithTooltip, { title: component.name, as: import_editor_panels4.PanelHeaderTitle, sx: { flexGrow: 1 } }), canEdit && /* @__PURE__ */ React28.createElement(import_ui22.Tooltip, { title: panelTitle }, /* @__PURE__ */ React28.createElement(import_ui22.IconButton, { size: "tiny", onClick: handleEditComponent, "aria-label": panelTitle }, /* @__PURE__ */ React28.createElement(import_icons14.PencilIcon, { fontSize: "tiny" }))))), /* @__PURE__ */ React28.createElement(import_editor_panels4.PanelBody, null, /* @__PURE__ */ React28.createElement(import_editor_controls4.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel5.getFieldIndicators)("settings") }, isEmpty ? /* @__PURE__ */ React28.createElement(EmptyState2, { onEditComponent: handleEditComponent }) : /* @__PURE__ */ React28.createElement(import_ui22.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React28.createElement(React28.Fragment, { key: group.id }, /* @__PURE__ */ React28.createElement(
|
|
4111
4131
|
OverridePropsGroup,
|
|
4112
4132
|
{
|
|
4113
4133
|
group,
|
|
4114
4134
|
props: overridableProps.props,
|
|
4115
4135
|
overrides
|
|
4116
4136
|
}
|
|
4117
|
-
), /* @__PURE__ */
|
|
4137
|
+
), /* @__PURE__ */ React28.createElement(import_ui22.Divider, null)))))));
|
|
4118
4138
|
}
|
|
4119
4139
|
|
|
4120
4140
|
// src/components/overridable-props/overridable-prop-control.tsx
|
|
4121
|
-
var
|
|
4141
|
+
var React29 = __toESM(require("react"));
|
|
4122
4142
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
4123
4143
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
4124
4144
|
function OverridablePropControl({
|
|
@@ -4163,7 +4183,7 @@ function OverridablePropControl({
|
|
|
4163
4183
|
});
|
|
4164
4184
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
4165
4185
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
4166
|
-
return /* @__PURE__ */
|
|
4186
|
+
return /* @__PURE__ */ React29.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React29.createElement(
|
|
4167
4187
|
import_editor_controls5.PropProvider,
|
|
4168
4188
|
{
|
|
4169
4189
|
...propContext,
|
|
@@ -4174,7 +4194,7 @@ function OverridablePropControl({
|
|
|
4174
4194
|
},
|
|
4175
4195
|
placeholder: objectPlaceholder
|
|
4176
4196
|
},
|
|
4177
|
-
/* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ React29.createElement(import_editor_controls5.PropKeyProvider, { bind }, /* @__PURE__ */ React29.createElement(import_editor_controls5.ControlReplacementsProvider, { replacements: filteredReplacements }, /* @__PURE__ */ React29.createElement(ControlWithReplacements, { OriginalControl: OriginalControl2, props })))
|
|
4178
4198
|
));
|
|
4179
4199
|
}
|
|
4180
4200
|
function ControlWithReplacements({
|
|
@@ -4184,18 +4204,18 @@ function ControlWithReplacements({
|
|
|
4184
4204
|
const { ControlToRender, isReplaced } = (0, import_editor_controls5.useControlReplacement)(OriginalControl2);
|
|
4185
4205
|
if (isReplaced) {
|
|
4186
4206
|
const ReplacementControl = ControlToRender;
|
|
4187
|
-
return /* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ React29.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
|
|
4188
4208
|
}
|
|
4189
|
-
return /* @__PURE__ */
|
|
4209
|
+
return /* @__PURE__ */ React29.createElement(OriginalControl2, { ...props });
|
|
4190
4210
|
}
|
|
4191
4211
|
|
|
4192
4212
|
// src/components/overridable-props/overridable-prop-indicator.tsx
|
|
4193
|
-
var
|
|
4213
|
+
var React31 = __toESM(require("react"));
|
|
4194
4214
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
4195
4215
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
4196
4216
|
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
4197
|
-
var
|
|
4198
|
-
var
|
|
4217
|
+
var import_ui24 = require("@elementor/ui");
|
|
4218
|
+
var import_i18n28 = require("@wordpress/i18n");
|
|
4199
4219
|
|
|
4200
4220
|
// src/store/actions/set-overridable-prop.ts
|
|
4201
4221
|
var import_store58 = require("@elementor/store");
|
|
@@ -4276,13 +4296,13 @@ function setOverridableProp({
|
|
|
4276
4296
|
}
|
|
4277
4297
|
|
|
4278
4298
|
// src/components/overridable-props/indicator.tsx
|
|
4279
|
-
var
|
|
4280
|
-
var
|
|
4299
|
+
var React30 = __toESM(require("react"));
|
|
4300
|
+
var import_react16 = require("react");
|
|
4281
4301
|
var import_icons15 = require("@elementor/icons");
|
|
4282
|
-
var
|
|
4283
|
-
var
|
|
4302
|
+
var import_ui23 = require("@elementor/ui");
|
|
4303
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
4284
4304
|
var SIZE2 = "tiny";
|
|
4285
|
-
var IconContainer = (0,
|
|
4305
|
+
var IconContainer = (0, import_ui23.styled)(import_ui23.Box)`
|
|
4286
4306
|
pointer-events: none;
|
|
4287
4307
|
opacity: 0;
|
|
4288
4308
|
transition: opacity 0.2s ease-in-out;
|
|
@@ -4299,7 +4319,7 @@ var IconContainer = (0, import_ui24.styled)(import_ui24.Box)`
|
|
|
4299
4319
|
stroke-width: 2px;
|
|
4300
4320
|
}
|
|
4301
4321
|
`;
|
|
4302
|
-
var Content = (0,
|
|
4322
|
+
var Content = (0, import_ui23.styled)(import_ui23.Box)`
|
|
4303
4323
|
position: relative;
|
|
4304
4324
|
display: flex;
|
|
4305
4325
|
align-items: center;
|
|
@@ -4336,13 +4356,13 @@ var Content = (0, import_ui24.styled)(import_ui24.Box)`
|
|
|
4336
4356
|
}
|
|
4337
4357
|
}
|
|
4338
4358
|
`;
|
|
4339
|
-
var Indicator2 = (0,
|
|
4359
|
+
var Indicator2 = (0, import_react16.forwardRef)(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React30.createElement(Content, { ref, ...props, className: isOpen || isOverridable ? "enlarged" : "" }, /* @__PURE__ */ React30.createElement(
|
|
4340
4360
|
IconContainer,
|
|
4341
4361
|
{
|
|
4342
4362
|
className: "icon",
|
|
4343
|
-
"aria-label": isOverridable ? (0,
|
|
4363
|
+
"aria-label": isOverridable ? (0, import_i18n27.__)("Overridable property", "elementor") : (0, import_i18n27.__)("Make prop overridable", "elementor")
|
|
4344
4364
|
},
|
|
4345
|
-
isOverridable ? /* @__PURE__ */
|
|
4365
|
+
isOverridable ? /* @__PURE__ */ React30.createElement(import_icons15.CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React30.createElement(import_icons15.PlusIcon, { fontSize: SIZE2 })
|
|
4346
4366
|
)));
|
|
4347
4367
|
|
|
4348
4368
|
// src/components/overridable-props/utils/get-overridable-prop.ts
|
|
@@ -4366,7 +4386,7 @@ function OverridablePropIndicator() {
|
|
|
4366
4386
|
if (!isPropAllowed(propType) || !componentId || !overridableProps) {
|
|
4367
4387
|
return null;
|
|
4368
4388
|
}
|
|
4369
|
-
return /* @__PURE__ */
|
|
4389
|
+
return /* @__PURE__ */ React31.createElement(Content2, { componentId, overridableProps });
|
|
4370
4390
|
}
|
|
4371
4391
|
function Content2({ componentId, overridableProps }) {
|
|
4372
4392
|
const {
|
|
@@ -4380,11 +4400,11 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4380
4400
|
componentOverridablePropTypeUtil
|
|
4381
4401
|
);
|
|
4382
4402
|
const overridableValue = boundPropOverridableValue ?? contextOverridableValue;
|
|
4383
|
-
const popupState = (0,
|
|
4403
|
+
const popupState = (0, import_ui24.usePopupState)({
|
|
4384
4404
|
variant: "popover"
|
|
4385
4405
|
});
|
|
4386
|
-
const triggerProps = (0,
|
|
4387
|
-
const popoverProps = (0,
|
|
4406
|
+
const triggerProps = (0, import_ui24.bindTrigger)(popupState);
|
|
4407
|
+
const popoverProps = (0, import_ui24.bindPopover)(popupState);
|
|
4388
4408
|
const { elType } = (0, import_editor_elements16.getWidgetsCache)()?.[elementType.key] ?? { elType: "widget" };
|
|
4389
4409
|
const handleSubmit = ({ label, group }) => {
|
|
4390
4410
|
const propTypeDefault = propType.default ?? {};
|
|
@@ -4412,8 +4432,8 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4412
4432
|
popupState.close();
|
|
4413
4433
|
};
|
|
4414
4434
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4415
|
-
return /* @__PURE__ */
|
|
4416
|
-
|
|
4435
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(import_ui24.Tooltip, { placement: "top", title: (0, import_i18n28.__)("Override Property", "elementor") }, /* @__PURE__ */ React31.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React31.createElement(
|
|
4436
|
+
import_ui24.Popover,
|
|
4417
4437
|
{
|
|
4418
4438
|
disableScrollLock: true,
|
|
4419
4439
|
anchorOrigin: {
|
|
@@ -4429,7 +4449,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4429
4449
|
},
|
|
4430
4450
|
...popoverProps
|
|
4431
4451
|
},
|
|
4432
|
-
/* @__PURE__ */
|
|
4452
|
+
/* @__PURE__ */ React31.createElement(
|
|
4433
4453
|
OverridablePropForm,
|
|
4434
4454
|
{
|
|
4435
4455
|
onSubmit: handleSubmit,
|
|
@@ -4448,12 +4468,12 @@ function isPropAllowed(propType) {
|
|
|
4448
4468
|
}
|
|
4449
4469
|
|
|
4450
4470
|
// src/mcp/index.ts
|
|
4451
|
-
var
|
|
4471
|
+
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
4452
4472
|
|
|
4453
4473
|
// src/mcp/save-as-component-tool.ts
|
|
4454
4474
|
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
4455
4475
|
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
4456
|
-
var
|
|
4476
|
+
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
4457
4477
|
var import_http_client2 = require("@elementor/http-client");
|
|
4458
4478
|
var import_schema6 = require("@elementor/schema");
|
|
4459
4479
|
var import_utils9 = require("@elementor/utils");
|
|
@@ -4626,7 +4646,7 @@ function getValidElementTypes() {
|
|
|
4626
4646
|
}, []);
|
|
4627
4647
|
}
|
|
4628
4648
|
var generatePrompt = () => {
|
|
4629
|
-
const saveAsComponentPrompt = (0,
|
|
4649
|
+
const saveAsComponentPrompt = (0, import_editor_mcp.toolPrompts)("save-as-component");
|
|
4630
4650
|
saveAsComponentPrompt.description(`
|
|
4631
4651
|
Save an existing element as a reusable component in the Elementor editor.
|
|
4632
4652
|
|
|
@@ -4770,7 +4790,7 @@ Component with overridable properties:
|
|
|
4770
4790
|
return saveAsComponentPrompt.prompt();
|
|
4771
4791
|
};
|
|
4772
4792
|
var initSaveAsComponentTool = () => {
|
|
4773
|
-
return (0,
|
|
4793
|
+
return (0, import_editor_mcp.getMCPByDomain)("components").addTool({
|
|
4774
4794
|
name: "save-as-component",
|
|
4775
4795
|
schema: InputSchema,
|
|
4776
4796
|
outputSchema: OutputSchema,
|
|
@@ -4781,7 +4801,7 @@ var initSaveAsComponentTool = () => {
|
|
|
4781
4801
|
|
|
4782
4802
|
// src/mcp/index.ts
|
|
4783
4803
|
function initMcp() {
|
|
4784
|
-
const { setMCPDescription } = (0,
|
|
4804
|
+
const { setMCPDescription } = (0, import_editor_mcp2.getMCPByDomain)("components");
|
|
4785
4805
|
setMCPDescription(
|
|
4786
4806
|
`Elementor Editor Components MCP - Tools for creating and managing reusable components.
|
|
4787
4807
|
Components are reusable blocks of content that can be used multiple times across the pages, its a widget which contains a set of elements and styles.`
|
|
@@ -4790,10 +4810,10 @@ function initMcp() {
|
|
|
4790
4810
|
}
|
|
4791
4811
|
|
|
4792
4812
|
// src/populate-store.ts
|
|
4793
|
-
var
|
|
4813
|
+
var import_react17 = require("react");
|
|
4794
4814
|
var import_store63 = require("@elementor/store");
|
|
4795
4815
|
function PopulateStore() {
|
|
4796
|
-
(0,
|
|
4816
|
+
(0, import_react17.useEffect)(() => {
|
|
4797
4817
|
(0, import_store63.__dispatch)(loadComponents());
|
|
4798
4818
|
}, []);
|
|
4799
4819
|
return null;
|
|
@@ -4804,11 +4824,11 @@ var import_editor_elements18 = require("@elementor/editor-elements");
|
|
|
4804
4824
|
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
4805
4825
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
4806
4826
|
var import_store64 = require("@elementor/store");
|
|
4807
|
-
var
|
|
4827
|
+
var import_i18n29 = require("@wordpress/i18n");
|
|
4808
4828
|
var COMPONENT_TYPE = "e-component";
|
|
4809
4829
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
4810
4830
|
type: "default",
|
|
4811
|
-
message: (0,
|
|
4831
|
+
message: (0, import_i18n29.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
4812
4832
|
id: "circular-component-nesting-blocked"
|
|
4813
4833
|
};
|
|
4814
4834
|
function initCircularNestingPrevention() {
|
|
@@ -5347,6 +5367,44 @@ function hasOverrides(settings) {
|
|
|
5347
5367
|
return !!overridesValue?.length;
|
|
5348
5368
|
}
|
|
5349
5369
|
|
|
5370
|
+
// src/sync/revert-overridables-on-copy-or-duplicate.ts
|
|
5371
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
5372
|
+
function initRevertOverridablesOnCopyOrDuplicate() {
|
|
5373
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/duplicate", (_args, result) => {
|
|
5374
|
+
if (!isEditingComponent()) {
|
|
5375
|
+
return;
|
|
5376
|
+
}
|
|
5377
|
+
revertOverridablesForDuplicatedElements(result);
|
|
5378
|
+
});
|
|
5379
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/copy", (args) => {
|
|
5380
|
+
if (!isEditingComponent()) {
|
|
5381
|
+
return;
|
|
5382
|
+
}
|
|
5383
|
+
revertOverridablesInStorage(args.storageKey ?? "clipboard");
|
|
5384
|
+
});
|
|
5385
|
+
}
|
|
5386
|
+
function revertOverridablesForDuplicatedElements(duplicatedElements) {
|
|
5387
|
+
const containers = Array.isArray(duplicatedElements) ? duplicatedElements : [duplicatedElements];
|
|
5388
|
+
containers.forEach((container) => {
|
|
5389
|
+
revertAllOverridablesInContainer(container);
|
|
5390
|
+
});
|
|
5391
|
+
}
|
|
5392
|
+
function revertOverridablesInStorage(storageKey) {
|
|
5393
|
+
const storage = window.elementorCommon?.storage;
|
|
5394
|
+
if (!storage) {
|
|
5395
|
+
return;
|
|
5396
|
+
}
|
|
5397
|
+
const storageData = storage.get(storageKey);
|
|
5398
|
+
if (!storageData?.elements?.length) {
|
|
5399
|
+
return;
|
|
5400
|
+
}
|
|
5401
|
+
const elementsDataWithOverridablesReverted = storageData.elements.map(revertAllOverridablesInElementData);
|
|
5402
|
+
storage.set(storageKey, {
|
|
5403
|
+
...storageData,
|
|
5404
|
+
elements: elementsDataWithOverridablesReverted
|
|
5405
|
+
});
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5350
5408
|
// src/init.ts
|
|
5351
5409
|
function init() {
|
|
5352
5410
|
import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
|
|
@@ -5356,18 +5414,18 @@ function init() {
|
|
|
5356
5414
|
COMPONENT_WIDGET_TYPE,
|
|
5357
5415
|
(options) => createComponentType({ ...options, showLockedByModal: openEditModeDialog })
|
|
5358
5416
|
);
|
|
5359
|
-
(0,
|
|
5417
|
+
(0, import_editor_v1_adapters14.registerDataHook)("dependency", "editor/documents/close", (args) => {
|
|
5360
5418
|
const document = (0, import_editor_documents13.getV1CurrentDocument)();
|
|
5361
5419
|
if (document.config.type === COMPONENT_DOCUMENT_TYPE) {
|
|
5362
5420
|
args.mode = "autosave";
|
|
5363
5421
|
}
|
|
5364
5422
|
return true;
|
|
5365
5423
|
});
|
|
5366
|
-
(0,
|
|
5424
|
+
(0, import_editor_v1_adapters14.registerDataHook)("after", "preview/drop", onElementDrop);
|
|
5367
5425
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
5368
5426
|
(0, import_editor_elements_panel.injectTab)({
|
|
5369
5427
|
id: "components",
|
|
5370
|
-
label: (0,
|
|
5428
|
+
label: (0, import_i18n30.__)("Components", "elementor"),
|
|
5371
5429
|
component: Components,
|
|
5372
5430
|
position: 1
|
|
5373
5431
|
});
|
|
@@ -5387,7 +5445,7 @@ function init() {
|
|
|
5387
5445
|
id: "component-panel-header",
|
|
5388
5446
|
component: ComponentPanelHeader
|
|
5389
5447
|
});
|
|
5390
|
-
(0,
|
|
5448
|
+
(0, import_editor_v1_adapters14.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
5391
5449
|
const { id: id2, config } = (0, import_editor_documents13.getV1CurrentDocument)();
|
|
5392
5450
|
if (id2) {
|
|
5393
5451
|
removeComponentStyles(id2);
|
|
@@ -5420,6 +5478,7 @@ function init() {
|
|
|
5420
5478
|
initNonAtomicNestingPrevention();
|
|
5421
5479
|
initLoadComponentDataAfterInstanceAdded();
|
|
5422
5480
|
initHandleComponentEditModeContainer();
|
|
5481
|
+
initRevertOverridablesOnCopyOrDuplicate();
|
|
5423
5482
|
}
|
|
5424
5483
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5425
5484
|
0 && (module.exports = {
|