@elementor/editor-components 4.0.0-663 → 4.0.0-664
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.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +1246 -845
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1013 -613
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/detach-instance-confirmation-dialog.tsx +50 -0
- package/src/components/instance-editing-panel/detach-action.tsx +76 -0
- package/src/components/instance-editing-panel/instance-editing-panel.tsx +12 -5
- package/src/components/instance-editing-panel/use-instance-panel-data.ts +2 -2
- package/src/consts.ts +1 -0
- package/src/create-component-type.ts +60 -22
- package/src/index.ts +1 -0
- package/src/init.ts +6 -1
- package/src/types.ts +1 -1
- package/src/utils/detach-component-instance/detach-component-instance.ts +172 -0
- package/src/utils/detach-component-instance/index.ts +1 -0
- package/src/utils/detach-component-instance/regenerate-local-style-ids.ts +53 -0
- package/src/utils/detach-component-instance/resolve-detached-instance.ts +94 -0
- package/src/utils/detach-component-instance/resolve-overridable-settings.ts +121 -0
- package/src/utils/is-component-instance.ts +1 -1
- package/src/utils/tracking.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -30,13 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
COMPONENT_WIDGET_TYPE: () =>
|
|
33
|
+
COMPONENT_WIDGET_TYPE: () => COMPONENT_WIDGET_TYPE2,
|
|
34
34
|
ComponentInstanceProvider: () => ComponentInstanceProvider,
|
|
35
35
|
ComponentItem: () => ComponentItem,
|
|
36
36
|
ComponentName: () => ComponentName,
|
|
37
37
|
ComponentSearch: () => ComponentSearch,
|
|
38
38
|
ComponentsEmptyState: () => EmptyState,
|
|
39
39
|
ComponentsList: () => ComponentsList,
|
|
40
|
+
DetachAction: () => DetachAction,
|
|
40
41
|
EditComponentAction: () => EditComponentAction,
|
|
41
42
|
EmptySearchResult: () => EmptySearchResult,
|
|
42
43
|
InstanceEmptyState: () => EmptyState2,
|
|
@@ -90,10 +91,10 @@ var import_editor_documents14 = require("@elementor/editor-documents");
|
|
|
90
91
|
var import_editor_editing_panel9 = require("@elementor/editor-editing-panel");
|
|
91
92
|
var import_editor_elements_panel2 = require("@elementor/editor-elements-panel");
|
|
92
93
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
93
|
-
var
|
|
94
|
-
var
|
|
94
|
+
var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
|
|
95
|
+
var import_store46 = require("@elementor/store");
|
|
95
96
|
var import_utils13 = require("@elementor/utils");
|
|
96
|
-
var
|
|
97
|
+
var import_i18n36 = require("@wordpress/i18n");
|
|
97
98
|
|
|
98
99
|
// src/component-instance-transformer.ts
|
|
99
100
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
@@ -787,124 +788,91 @@ var Components = () => {
|
|
|
787
788
|
return /* @__PURE__ */ React7.createElement(import_editor_ui3.ThemeProvider, null, /* @__PURE__ */ React7.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React7.createElement(ComponentsContent, null)));
|
|
788
789
|
};
|
|
789
790
|
|
|
790
|
-
// src/components/
|
|
791
|
+
// src/components/detach-instance-confirmation-dialog.tsx
|
|
791
792
|
var React8 = __toESM(require("react"));
|
|
792
793
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
793
794
|
var import_icons4 = require("@elementor/icons");
|
|
794
|
-
var import_ui6 = require("@elementor/ui");
|
|
795
795
|
var import_i18n4 = require("@wordpress/i18n");
|
|
796
|
-
|
|
796
|
+
function DetachInstanceConfirmationDialog({
|
|
797
|
+
open,
|
|
798
|
+
onClose,
|
|
799
|
+
onConfirm
|
|
800
|
+
}) {
|
|
801
|
+
return /* @__PURE__ */ React8.createElement(import_editor_ui4.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React8.createElement(import_editor_ui4.ConfirmationDialog.Title, { icon: import_icons4.AlertTriangleFilledIcon, iconColor: "secondary" }, (0, import_i18n4.__)("Detach from Component?", "elementor")), /* @__PURE__ */ React8.createElement(import_editor_ui4.ConfirmationDialog.Content, null, /* @__PURE__ */ React8.createElement(import_editor_ui4.ConfirmationDialog.ContentText, null, (0, import_i18n4.__)(
|
|
802
|
+
"Detaching this instance will break its link to the Component. Changes to the Component will no longer apply. Continue?",
|
|
803
|
+
"elementor"
|
|
804
|
+
))), /* @__PURE__ */ React8.createElement(
|
|
805
|
+
import_editor_ui4.ConfirmationDialog.Actions,
|
|
806
|
+
{
|
|
807
|
+
onClose,
|
|
808
|
+
onConfirm,
|
|
809
|
+
confirmLabel: (0, import_i18n4.__)("Detach", "elementor"),
|
|
810
|
+
color: "primary"
|
|
811
|
+
}
|
|
812
|
+
));
|
|
813
|
+
}
|
|
814
|
+
function openDetachConfirmDialog(onConfirm) {
|
|
815
|
+
const handleConfirm = () => {
|
|
816
|
+
(0, import_editor_ui4.closeDialog)();
|
|
817
|
+
onConfirm();
|
|
818
|
+
};
|
|
797
819
|
(0, import_editor_ui4.openDialog)({
|
|
798
|
-
component: /* @__PURE__ */ React8.createElement(
|
|
820
|
+
component: /* @__PURE__ */ React8.createElement(DetachInstanceConfirmationDialog, { open: true, onClose: import_editor_ui4.closeDialog, onConfirm: handleConfirm })
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// src/components/in-edit-mode.tsx
|
|
825
|
+
var React9 = __toESM(require("react"));
|
|
826
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
827
|
+
var import_icons5 = require("@elementor/icons");
|
|
828
|
+
var import_ui6 = require("@elementor/ui");
|
|
829
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
830
|
+
var openEditModeDialog = (lockedBy) => {
|
|
831
|
+
(0, import_editor_ui5.openDialog)({
|
|
832
|
+
component: /* @__PURE__ */ React9.createElement(EditModeDialog, { lockedBy })
|
|
799
833
|
});
|
|
800
834
|
};
|
|
801
835
|
var EditModeDialog = ({ lockedBy }) => {
|
|
802
|
-
const content = (0,
|
|
803
|
-
return /* @__PURE__ */
|
|
836
|
+
const content = (0, import_i18n5.__)("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
837
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(import_ui6.DialogHeader, { logo: false }, /* @__PURE__ */ React9.createElement(import_ui6.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React9.createElement(import_ui6.Icon, { color: "secondary" }, /* @__PURE__ */ React9.createElement(import_icons5.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React9.createElement(import_ui6.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React9.createElement(import_ui6.DialogContent, null, /* @__PURE__ */ React9.createElement(import_ui6.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React9.createElement(import_ui6.Typography, { variant: "body2" }, (0, import_i18n5.__)(
|
|
804
838
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
805
839
|
"elementor"
|
|
806
|
-
)), /* @__PURE__ */
|
|
840
|
+
)), /* @__PURE__ */ React9.createElement(import_ui6.DialogActions, null, /* @__PURE__ */ React9.createElement(import_ui6.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui5.closeDialog }, (0, import_i18n5.__)("Close", "elementor"))))));
|
|
807
841
|
};
|
|
808
842
|
|
|
809
843
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
810
|
-
var
|
|
811
|
-
var
|
|
844
|
+
var React19 = __toESM(require("react"));
|
|
845
|
+
var import_icons9 = require("@elementor/icons");
|
|
812
846
|
var import_ui13 = require("@elementor/ui");
|
|
813
|
-
var
|
|
847
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
814
848
|
|
|
815
849
|
// src/provider/component-instance-context.tsx
|
|
816
|
-
var
|
|
850
|
+
var React10 = __toESM(require("react"));
|
|
817
851
|
var import_react3 = require("react");
|
|
818
852
|
var ComponentInstanceContext = (0, import_react3.createContext)(null);
|
|
819
853
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
820
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ React10.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
821
855
|
}
|
|
822
856
|
var useComponentId = () => (0, import_react3.useContext)(ComponentInstanceContext)?.componentId;
|
|
823
857
|
var useComponentInstanceOverrides = () => (0, import_react3.useContext)(ComponentInstanceContext)?.overrides;
|
|
824
858
|
var useComponentOverridableProps = () => (0, import_react3.useContext)(ComponentInstanceContext)?.overridableProps;
|
|
825
859
|
|
|
826
|
-
// src/components/instance-editing-panel/
|
|
827
|
-
var
|
|
828
|
-
var
|
|
829
|
-
var
|
|
830
|
-
var
|
|
831
|
-
var
|
|
832
|
-
const { canEdit } = useComponentsPermissions();
|
|
833
|
-
const message = canEdit ? (0, import_i18n5.__)(
|
|
834
|
-
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
835
|
-
"elementor"
|
|
836
|
-
) : (0, import_i18n5.__)(
|
|
837
|
-
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
838
|
-
"elementor"
|
|
839
|
-
);
|
|
840
|
-
return /* @__PURE__ */ React10.createElement(
|
|
841
|
-
import_ui7.Stack,
|
|
842
|
-
{
|
|
843
|
-
alignItems: "center",
|
|
844
|
-
justifyContent: "start",
|
|
845
|
-
height: "100%",
|
|
846
|
-
color: "text.secondary",
|
|
847
|
-
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
848
|
-
gap: 1.5
|
|
849
|
-
},
|
|
850
|
-
/* @__PURE__ */ React10.createElement(import_icons5.ComponentPropListIcon, { fontSize: "large" }),
|
|
851
|
-
/* @__PURE__ */ React10.createElement(import_ui7.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n5.__)("No properties yet", "elementor")),
|
|
852
|
-
/* @__PURE__ */ React10.createElement(import_ui7.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
853
|
-
canEdit && !!onEditComponent && /* @__PURE__ */ React10.createElement(import_ui7.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React10.createElement(import_icons5.PencilIcon, { fontSize: "small" }), (0, import_i18n5.__)("Edit component", "elementor"))
|
|
854
|
-
);
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
858
|
-
var React15 = __toESM(require("react"));
|
|
859
|
-
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
860
|
-
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
861
|
-
var import_editor_panels = require("@elementor/editor-panels");
|
|
862
|
-
var import_ui11 = require("@elementor/ui");
|
|
863
|
-
|
|
864
|
-
// src/components/instance-editing-panel/override-props-group.tsx
|
|
865
|
-
var React14 = __toESM(require("react"));
|
|
866
|
-
var import_react5 = require("react");
|
|
867
|
-
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
868
|
-
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
869
|
-
var import_ui10 = require("@elementor/ui");
|
|
860
|
+
// src/components/instance-editing-panel/detach-action.tsx
|
|
861
|
+
var React12 = __toESM(require("react"));
|
|
862
|
+
var import_react4 = require("react");
|
|
863
|
+
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
864
|
+
var import_icons7 = require("@elementor/icons");
|
|
865
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
870
866
|
|
|
871
|
-
// src/
|
|
872
|
-
var
|
|
873
|
-
var
|
|
874
|
-
var
|
|
875
|
-
var
|
|
876
|
-
var import_ui9 = require("@elementor/ui");
|
|
867
|
+
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
868
|
+
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
869
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
870
|
+
var import_store9 = require("@elementor/store");
|
|
871
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
877
872
|
|
|
878
|
-
// src/
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
const elementType = (0, import_editor_elements.getElementType)(type);
|
|
882
|
-
if (!elementType) {
|
|
883
|
-
return {};
|
|
884
|
-
}
|
|
885
|
-
const controls = iterateControls(elementType.controls);
|
|
886
|
-
return getControlsByBind(controls);
|
|
887
|
-
}
|
|
888
|
-
function iterateControls(controls) {
|
|
889
|
-
return controls.map((control) => {
|
|
890
|
-
if (control.type === "control" && "bind" in control.value) {
|
|
891
|
-
return control;
|
|
892
|
-
}
|
|
893
|
-
if (control.type === "section") {
|
|
894
|
-
return iterateControls(control.value.items);
|
|
895
|
-
}
|
|
896
|
-
return null;
|
|
897
|
-
}).filter(Boolean).flat();
|
|
898
|
-
}
|
|
899
|
-
function getControlsByBind(controls) {
|
|
900
|
-
return controls.reduce(
|
|
901
|
-
(controlsByBind, control) => ({
|
|
902
|
-
...controlsByBind,
|
|
903
|
-
[control.value.bind]: control
|
|
904
|
-
}),
|
|
905
|
-
{}
|
|
906
|
-
);
|
|
907
|
-
}
|
|
873
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
874
|
+
var import_editor_props3 = require("@elementor/editor-props");
|
|
875
|
+
var import_schema3 = require("@elementor/schema");
|
|
908
876
|
|
|
909
877
|
// src/prop-types/component-instance-override-prop-type.ts
|
|
910
878
|
var import_editor_props = require("@elementor/editor-props");
|
|
@@ -921,10 +889,6 @@ var componentInstanceOverridePropTypeUtil = (0, import_editor_props.createPropUt
|
|
|
921
889
|
})
|
|
922
890
|
);
|
|
923
891
|
|
|
924
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
925
|
-
var import_editor_props3 = require("@elementor/editor-props");
|
|
926
|
-
var import_schema3 = require("@elementor/schema");
|
|
927
|
-
|
|
928
892
|
// src/prop-types/component-overridable-prop-type.ts
|
|
929
893
|
var import_editor_props2 = require("@elementor/editor-props");
|
|
930
894
|
var import_schema2 = require("@elementor/schema");
|
|
@@ -956,117 +920,578 @@ var componentInstancePropTypeUtil = (0, import_editor_props4.createPropUtils)(
|
|
|
956
920
|
})
|
|
957
921
|
);
|
|
958
922
|
|
|
959
|
-
// src/
|
|
960
|
-
var
|
|
961
|
-
var
|
|
962
|
-
var
|
|
963
|
-
|
|
964
|
-
|
|
923
|
+
// src/utils/tracking.ts
|
|
924
|
+
var import_events = require("@elementor/events");
|
|
925
|
+
var import_store7 = require("@elementor/store");
|
|
926
|
+
var FEATURE_NAME = "Components";
|
|
927
|
+
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
928
|
+
if (source === "system") {
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
932
|
+
if (!config?.names?.components?.[action]) {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
const name = config.names.components[action];
|
|
936
|
+
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
937
|
+
};
|
|
938
|
+
var onElementDrop = (_args, element) => {
|
|
939
|
+
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
const editorSettings = element.model.get("editor_settings");
|
|
943
|
+
const componentName = editorSettings?.title;
|
|
944
|
+
const componentUID = editorSettings?.component_uid;
|
|
945
|
+
const instanceId = element.id;
|
|
946
|
+
const createdThisSession = selectCreatedThisSession((0, import_store7.__getState)());
|
|
947
|
+
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
948
|
+
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
949
|
+
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
950
|
+
trackComponentEvent({
|
|
951
|
+
action: "instanceAdded",
|
|
952
|
+
source: "user",
|
|
953
|
+
instance_id: instanceId,
|
|
954
|
+
component_uid: componentUID,
|
|
955
|
+
component_name: componentName,
|
|
956
|
+
is_same_session_reuse: isSameSessionReuse,
|
|
957
|
+
location: locations.widgetPanel,
|
|
958
|
+
secondary_location: secondaryLocations.componentsTab
|
|
959
|
+
});
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// src/utils/detach-component-instance/resolve-detached-instance.ts
|
|
963
|
+
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
964
|
+
|
|
965
|
+
// src/utils/detach-component-instance/regenerate-local-style-ids.ts
|
|
966
|
+
var import_editor_elements = require("@elementor/editor-elements");
|
|
967
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
968
|
+
function regenerateLocalStyleIds(element) {
|
|
969
|
+
const originalStyles = element.styles;
|
|
970
|
+
if (!originalStyles || Object.keys(originalStyles).length === 0) {
|
|
971
|
+
return { styles: void 0, settings: void 0 };
|
|
972
|
+
}
|
|
973
|
+
const newStyles = {};
|
|
974
|
+
const styleIdMapping = {};
|
|
975
|
+
for (const [originalStyleId, style] of Object.entries(originalStyles)) {
|
|
976
|
+
const newStyleId = generateLocalStyleId(element.id);
|
|
977
|
+
newStyles[newStyleId] = { ...style, id: newStyleId };
|
|
978
|
+
styleIdMapping[originalStyleId] = newStyleId;
|
|
979
|
+
}
|
|
980
|
+
const settings = element.settings;
|
|
981
|
+
if (!settings || Object.keys(settings).length === 0) {
|
|
982
|
+
return { styles: newStyles, settings: void 0 };
|
|
983
|
+
}
|
|
984
|
+
const updatedSettings = { ...settings };
|
|
985
|
+
for (const [propKey, propValue] of Object.entries(updatedSettings)) {
|
|
986
|
+
if (isClassesProp(propValue) && propValue.value.length > 0) {
|
|
987
|
+
const updatedClasses = propValue.value.map((classId) => styleIdMapping[classId] ?? classId);
|
|
988
|
+
updatedSettings[propKey] = import_editor_props5.classesPropTypeUtil.create(updatedClasses);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return {
|
|
992
|
+
styles: newStyles,
|
|
993
|
+
settings: updatedSettings
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
function isClassesProp(prop) {
|
|
997
|
+
return import_editor_props5.classesPropTypeUtil.isValid(prop);
|
|
998
|
+
}
|
|
999
|
+
function generateLocalStyleId(elementId) {
|
|
1000
|
+
return `e-${elementId}-${(0, import_editor_elements.generateElementId)()}`;
|
|
965
1001
|
}
|
|
966
|
-
var useOverridablePropValue = () => (0, import_react4.useContext)(OverridablePropContext)?.value;
|
|
967
|
-
var useComponentInstanceElement = () => (0, import_react4.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
968
1002
|
|
|
969
|
-
// src/
|
|
970
|
-
var
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1003
|
+
// src/consts.ts
|
|
1004
|
+
var COMPONENT_WIDGET_TYPE = "e-component";
|
|
1005
|
+
|
|
1006
|
+
// src/utils/is-component-instance.ts
|
|
1007
|
+
function isComponentInstance(elementModel) {
|
|
1008
|
+
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// src/utils/detach-component-instance/resolve-overridable-settings.ts
|
|
1012
|
+
function resolveOverridableSettings(element, overrideMap) {
|
|
1013
|
+
if (isComponentInstance({ widgetType: element.widgetType, elType: element.elType })) {
|
|
1014
|
+
return resolveOverridableSettingsForComponentInstance(element, overrideMap);
|
|
974
1015
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1016
|
+
return resolveOverridableSettingsForElement(element, overrideMap);
|
|
1017
|
+
}
|
|
1018
|
+
function resolveOverridableSettingsForElement(element, overrideMap) {
|
|
1019
|
+
const updatedSettings = element.settings ? { ...element.settings } : {};
|
|
1020
|
+
for (const [settingKey, settingValue] of Object.entries(element.settings ?? {})) {
|
|
1021
|
+
updatedSettings[settingKey] = resolvePropValue(settingValue, overrideMap);
|
|
978
1022
|
}
|
|
979
|
-
return
|
|
980
|
-
}
|
|
981
|
-
function
|
|
982
|
-
const
|
|
983
|
-
if (!
|
|
984
|
-
return
|
|
1023
|
+
return updatedSettings;
|
|
1024
|
+
}
|
|
1025
|
+
function resolveOverridableSettingsForComponentInstance(element, overrideMap) {
|
|
1026
|
+
const componentInstance = element.settings?.component_instance;
|
|
1027
|
+
if (!componentInstancePropTypeUtil.isValid(componentInstance)) {
|
|
1028
|
+
return element.settings ?? {};
|
|
985
1029
|
}
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
return
|
|
1030
|
+
const instanceOverrides = componentInstance.value.overrides?.value;
|
|
1031
|
+
if (!instanceOverrides?.length) {
|
|
1032
|
+
return element.settings ?? {};
|
|
989
1033
|
}
|
|
990
|
-
|
|
1034
|
+
const updatedOverrides = instanceOverrides.map(
|
|
1035
|
+
(item) => resolvePropValue(item, overrideMap, { isOverridableOverride: true })
|
|
1036
|
+
);
|
|
1037
|
+
return {
|
|
1038
|
+
...element.settings,
|
|
1039
|
+
component_instance: {
|
|
1040
|
+
...componentInstance,
|
|
1041
|
+
value: {
|
|
1042
|
+
...componentInstance.value,
|
|
1043
|
+
overrides: {
|
|
1044
|
+
...componentInstance.value.overrides,
|
|
1045
|
+
value: updatedOverrides
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
991
1050
|
}
|
|
992
|
-
function
|
|
993
|
-
const
|
|
994
|
-
if (!
|
|
1051
|
+
function resolvePropValue(propValue, overrideMap, options) {
|
|
1052
|
+
const { isOverridableOverride = false } = options ?? {};
|
|
1053
|
+
if (!componentOverridablePropTypeUtil.isValid(propValue)) {
|
|
1054
|
+
return propValue;
|
|
1055
|
+
}
|
|
1056
|
+
const overridableKey = propValue.value.override_key;
|
|
1057
|
+
const matchingOverride = overrideMap.get(overridableKey);
|
|
1058
|
+
const originValue = componentOverridablePropTypeUtil.extract(propValue)?.origin_value;
|
|
1059
|
+
if (!matchingOverride) {
|
|
1060
|
+
return originValue;
|
|
1061
|
+
}
|
|
1062
|
+
if (isOverridableOverride) {
|
|
1063
|
+
return resolveOverridableOverride(matchingOverride, originValue);
|
|
1064
|
+
}
|
|
1065
|
+
const matchingOverrideValue = componentInstanceOverridePropTypeUtil.extract(matchingOverride)?.override_value;
|
|
1066
|
+
return matchingOverrideValue;
|
|
1067
|
+
}
|
|
1068
|
+
function resolveOverridableOverride(matchingOverride, originValue) {
|
|
1069
|
+
if (!originValue || !componentInstanceOverridePropTypeUtil.isValid(originValue)) {
|
|
995
1070
|
return null;
|
|
996
1071
|
}
|
|
997
|
-
return
|
|
1072
|
+
return componentInstanceOverridePropTypeUtil.create({
|
|
1073
|
+
override_value: matchingOverride.value.override_value,
|
|
1074
|
+
override_key: originValue.value.override_key,
|
|
1075
|
+
schema_source: originValue.value.schema_source
|
|
1076
|
+
});
|
|
998
1077
|
}
|
|
999
1078
|
|
|
1000
|
-
// src/
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
return (
|
|
1079
|
+
// src/utils/detach-component-instance/resolve-detached-instance.ts
|
|
1080
|
+
function resolveDetachedInstance(element, overrides) {
|
|
1081
|
+
const overrideMap = createOverrideMap(overrides);
|
|
1082
|
+
return resolveElementRecursive(structuredClone(element), overrideMap);
|
|
1004
1083
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
(0, import_store7.__dispatch)(slice.actions.addUnpublished(component));
|
|
1014
|
-
},
|
|
1015
|
-
removeUnpublished(uids) {
|
|
1016
|
-
(0, import_store7.__dispatch)(slice.actions.removeUnpublished(uids));
|
|
1017
|
-
},
|
|
1018
|
-
resetUnpublished() {
|
|
1019
|
-
(0, import_store7.__dispatch)(slice.actions.resetUnpublished());
|
|
1020
|
-
},
|
|
1021
|
-
removeStyles(id2) {
|
|
1022
|
-
(0, import_store7.__dispatch)(slice.actions.removeStyles({ id: id2 }));
|
|
1023
|
-
},
|
|
1024
|
-
addStyles(styles) {
|
|
1025
|
-
(0, import_store7.__dispatch)(slice.actions.addStyles(styles));
|
|
1026
|
-
},
|
|
1027
|
-
addCreatedThisSession(uid) {
|
|
1028
|
-
(0, import_store7.__dispatch)(slice.actions.addCreatedThisSession(uid));
|
|
1029
|
-
},
|
|
1030
|
-
removeCreatedThisSession(uid) {
|
|
1031
|
-
(0, import_store7.__dispatch)(slice.actions.removeCreatedThisSession(uid));
|
|
1032
|
-
},
|
|
1033
|
-
archive(componentId) {
|
|
1034
|
-
(0, import_store7.__dispatch)(slice.actions.archive(componentId));
|
|
1035
|
-
},
|
|
1036
|
-
setCurrentComponentId(id2) {
|
|
1037
|
-
safeDispatch()?.(slice.actions.setCurrentComponentId(id2));
|
|
1038
|
-
},
|
|
1039
|
-
setPath(path) {
|
|
1040
|
-
safeDispatch()?.(slice.actions.setPath(path));
|
|
1041
|
-
},
|
|
1042
|
-
setOverridableProps(componentId, overridableProps) {
|
|
1043
|
-
(0, import_store7.__dispatch)(slice.actions.setOverridableProps({ componentId, overridableProps }));
|
|
1044
|
-
},
|
|
1045
|
-
rename(componentUid, name) {
|
|
1046
|
-
(0, import_store7.__dispatch)(slice.actions.rename({ componentUid, name }));
|
|
1047
|
-
},
|
|
1048
|
-
cleanUpdatedComponentNames() {
|
|
1049
|
-
(0, import_store7.__dispatch)(slice.actions.cleanUpdatedComponentNames());
|
|
1050
|
-
},
|
|
1051
|
-
updateComponentSanitizedAttribute(componentId, attribute) {
|
|
1052
|
-
(0, import_store7.__dispatch)(slice.actions.updateComponentSanitizedAttribute({ componentId, attribute }));
|
|
1053
|
-
},
|
|
1054
|
-
resetSanitizedComponents() {
|
|
1055
|
-
(0, import_store7.__dispatch)(slice.actions.resetSanitizedComponents());
|
|
1084
|
+
function resolveElementRecursive(element, overrideMap) {
|
|
1085
|
+
element.id = (0, import_editor_elements2.generateElementId)();
|
|
1086
|
+
if (element.styles) {
|
|
1087
|
+
const { styles, settings } = regenerateLocalStyleIds(element);
|
|
1088
|
+
element.styles = styles;
|
|
1089
|
+
if (settings) {
|
|
1090
|
+
element.settings = { ...element.settings, ...settings };
|
|
1091
|
+
}
|
|
1056
1092
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1093
|
+
if (element.settings) {
|
|
1094
|
+
element.settings = resolveOverridableSettings(element, overrideMap);
|
|
1095
|
+
}
|
|
1096
|
+
if (element.elements?.length) {
|
|
1097
|
+
element.elements = element.elements.map((child) => resolveElementRecursive(child, overrideMap));
|
|
1098
|
+
}
|
|
1099
|
+
return element;
|
|
1100
|
+
}
|
|
1101
|
+
function createOverrideMap(overrides) {
|
|
1102
|
+
const map = /* @__PURE__ */ new Map();
|
|
1103
|
+
overrides.forEach((item) => {
|
|
1104
|
+
let override = null;
|
|
1105
|
+
if (componentInstanceOverridePropTypeUtil.isValid(item)) {
|
|
1106
|
+
override = item;
|
|
1107
|
+
} else if (componentOverridablePropTypeUtil.isValid(item)) {
|
|
1108
|
+
override = getOverridableOverride(item);
|
|
1109
|
+
}
|
|
1110
|
+
if (override) {
|
|
1111
|
+
const overrideKey = override.value.override_key;
|
|
1112
|
+
map.set(overrideKey, override);
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
return map;
|
|
1116
|
+
}
|
|
1117
|
+
function getOverridableOverride(propValue) {
|
|
1118
|
+
if (!componentOverridablePropTypeUtil.isValid(propValue)) {
|
|
1119
|
+
return null;
|
|
1120
|
+
}
|
|
1121
|
+
const originValue = componentOverridablePropTypeUtil.extract(propValue)?.origin_value;
|
|
1122
|
+
if (!componentInstanceOverridePropTypeUtil.isValid(originValue)) {
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
1125
|
+
return originValue;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
1129
|
+
async function detachComponentInstance({
|
|
1130
|
+
instanceId,
|
|
1131
|
+
componentId,
|
|
1132
|
+
trackingInfo
|
|
1133
|
+
}) {
|
|
1134
|
+
const instanceContainer = (0, import_editor_elements3.getContainer)(instanceId);
|
|
1135
|
+
if (!instanceContainer) {
|
|
1136
|
+
throw new Error(`Instance container with ID "${instanceId}" not found.`);
|
|
1137
|
+
}
|
|
1138
|
+
const componentData = await getComponentDocumentData(componentId);
|
|
1139
|
+
if (!componentData) {
|
|
1140
|
+
throw new Error(`Component with ID "${componentId}" not found.`);
|
|
1141
|
+
}
|
|
1142
|
+
const rootElement = componentData.elements?.[0];
|
|
1143
|
+
if (!rootElement) {
|
|
1144
|
+
throw new Error(`Component with ID "${componentId}" has no root element.`);
|
|
1145
|
+
}
|
|
1146
|
+
const undoableDetach = (0, import_editor_v1_adapters2.undoable)(
|
|
1147
|
+
{
|
|
1148
|
+
do: () => {
|
|
1149
|
+
const overrides = extractInstanceOverrides(instanceContainer);
|
|
1150
|
+
const detachedInstanceElementData = resolveDetachedInstance(
|
|
1151
|
+
rootElement,
|
|
1152
|
+
overrides
|
|
1153
|
+
);
|
|
1154
|
+
const editedComponentOnDetach = selectCurrentComponentId((0, import_store9.__getState)());
|
|
1155
|
+
const overridablePropsBeforeDetach = editedComponentOnDetach ? selectOverridableProps((0, import_store9.__getState)(), editedComponentOnDetach) ?? null : null;
|
|
1156
|
+
const originalInstanceModel = instanceContainer.model.toJSON();
|
|
1157
|
+
const detachedElement = (0, import_editor_elements3.replaceElement)({
|
|
1158
|
+
currentElementId: instanceId,
|
|
1159
|
+
newElement: detachedInstanceElementData,
|
|
1160
|
+
withHistory: false
|
|
1161
|
+
});
|
|
1162
|
+
const componentUid = selectComponent((0, import_store9.__getState)(), componentId)?.uid;
|
|
1163
|
+
trackComponentEvent({
|
|
1164
|
+
action: "detached",
|
|
1165
|
+
source: "user",
|
|
1166
|
+
component_uid: componentUid,
|
|
1167
|
+
instance_id: instanceId,
|
|
1168
|
+
location: trackingInfo.location,
|
|
1169
|
+
secondary_location: trackingInfo.secondaryLocation,
|
|
1170
|
+
trigger: trackingInfo.trigger
|
|
1171
|
+
});
|
|
1172
|
+
return {
|
|
1173
|
+
detachedElement,
|
|
1174
|
+
detachedInstanceElementData,
|
|
1175
|
+
editedComponentOnDetach,
|
|
1176
|
+
overridablePropsBeforeDetach,
|
|
1177
|
+
originalInstanceModel
|
|
1178
|
+
};
|
|
1179
|
+
},
|
|
1180
|
+
undo: (_, {
|
|
1181
|
+
detachedElement,
|
|
1182
|
+
originalInstanceModel,
|
|
1183
|
+
overridablePropsBeforeDetach,
|
|
1184
|
+
editedComponentOnDetach
|
|
1185
|
+
}) => {
|
|
1186
|
+
const restoredInstance = (0, import_editor_elements3.replaceElement)({
|
|
1187
|
+
currentElementId: detachedElement.id,
|
|
1188
|
+
newElement: originalInstanceModel,
|
|
1189
|
+
withHistory: false
|
|
1190
|
+
});
|
|
1191
|
+
const currentComponentId = selectCurrentComponentId((0, import_store9.__getState)());
|
|
1192
|
+
if (currentComponentId && currentComponentId === editedComponentOnDetach && overridablePropsBeforeDetach) {
|
|
1193
|
+
(0, import_store9.__dispatch)(
|
|
1194
|
+
slice.actions.setOverridableProps({
|
|
1195
|
+
componentId: currentComponentId,
|
|
1196
|
+
overridableProps: overridablePropsBeforeDetach
|
|
1197
|
+
})
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
return restoredInstance;
|
|
1201
|
+
},
|
|
1202
|
+
redo: (_, doReturn, restoredInstance) => {
|
|
1203
|
+
const { detachedInstanceElementData } = doReturn;
|
|
1204
|
+
const editedComponentOnDetach = selectCurrentComponentId((0, import_store9.__getState)());
|
|
1205
|
+
const overridablePropsBeforeDetach = editedComponentOnDetach ? selectOverridableProps((0, import_store9.__getState)(), editedComponentOnDetach) ?? null : null;
|
|
1206
|
+
const detachedElement = (0, import_editor_elements3.replaceElement)({
|
|
1207
|
+
currentElementId: restoredInstance.id,
|
|
1208
|
+
newElement: detachedInstanceElementData,
|
|
1209
|
+
withHistory: false
|
|
1210
|
+
});
|
|
1211
|
+
return {
|
|
1212
|
+
...doReturn,
|
|
1213
|
+
detachedElement,
|
|
1214
|
+
editedComponentOnDetach,
|
|
1215
|
+
overridablePropsBeforeDetach
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
title: (0, import_i18n6.__)("Detach from Component", "elementor"),
|
|
1221
|
+
subtitle: (0, import_i18n6.__)("Instance detached", "elementor")
|
|
1222
|
+
}
|
|
1223
|
+
);
|
|
1224
|
+
return undoableDetach();
|
|
1225
|
+
}
|
|
1226
|
+
function extractInstanceOverrides(instanceContainer) {
|
|
1227
|
+
const settings = instanceContainer.model.toJSON().settings;
|
|
1228
|
+
const componentInstance = componentInstancePropTypeUtil.extract(
|
|
1229
|
+
settings?.component_instance
|
|
1230
|
+
);
|
|
1231
|
+
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1232
|
+
return overrides ?? [];
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1236
|
+
var React11 = __toESM(require("react"));
|
|
1237
|
+
var import_editor_panels = require("@elementor/editor-panels");
|
|
1238
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1239
|
+
var import_icons6 = require("@elementor/icons");
|
|
1240
|
+
var import_ui7 = require("@elementor/ui");
|
|
1241
|
+
function InstancePanelHeader({ componentName, actions }) {
|
|
1242
|
+
return /* @__PURE__ */ React11.createElement(import_editor_panels.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React11.createElement(import_ui7.Stack, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React11.createElement(import_icons6.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React11.createElement(import_editor_ui6.EllipsisWithTooltip, { title: componentName, as: import_editor_panels.PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1243
|
+
}
|
|
1244
|
+
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1245
|
+
return /* @__PURE__ */ React11.createElement(import_ui7.Tooltip, { title: label }, /* @__PURE__ */ React11.createElement(import_ui7.IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React11.createElement(Icon2, { fontSize: "tiny" })));
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// src/components/instance-editing-panel/detach-action.tsx
|
|
1249
|
+
var DetachAction = ({
|
|
1250
|
+
componentInstanceId,
|
|
1251
|
+
componentId
|
|
1252
|
+
}) => {
|
|
1253
|
+
const [isDetachDialogOpen, setIsDetachDialogOpen] = (0, import_react4.useState)(false);
|
|
1254
|
+
const handleDetachConfirm = async () => {
|
|
1255
|
+
setIsDetachDialogOpen(false);
|
|
1256
|
+
try {
|
|
1257
|
+
await detachComponentInstance({
|
|
1258
|
+
instanceId: componentInstanceId,
|
|
1259
|
+
componentId,
|
|
1260
|
+
trackingInfo: getDetachTrackingInfo()
|
|
1261
|
+
});
|
|
1262
|
+
} catch {
|
|
1263
|
+
(0, import_editor_notifications.notify)({
|
|
1264
|
+
type: "error",
|
|
1265
|
+
message: (0, import_i18n7.__)("Failed to detach component instance.", "elementor"),
|
|
1266
|
+
id: "detach-component-instance-failed"
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
const handleDetachCancel = () => {
|
|
1271
|
+
setIsDetachDialogOpen(false);
|
|
1272
|
+
};
|
|
1273
|
+
const handleDetachClick = () => {
|
|
1274
|
+
setIsDetachDialogOpen(true);
|
|
1275
|
+
};
|
|
1276
|
+
const detachLabel = (0, import_i18n7.__)("Detach from Component", "elementor");
|
|
1277
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(EditComponentAction, { label: detachLabel, icon: import_icons7.DetachIcon, onClick: handleDetachClick }), /* @__PURE__ */ React12.createElement(
|
|
1278
|
+
DetachInstanceConfirmationDialog,
|
|
1279
|
+
{
|
|
1280
|
+
open: isDetachDialogOpen,
|
|
1281
|
+
onClose: handleDetachCancel,
|
|
1282
|
+
onConfirm: handleDetachConfirm
|
|
1283
|
+
}
|
|
1284
|
+
));
|
|
1285
|
+
};
|
|
1286
|
+
function getDetachTrackingInfo() {
|
|
1287
|
+
const extendedWindow = window;
|
|
1288
|
+
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
1289
|
+
if (!config) {
|
|
1290
|
+
return {
|
|
1291
|
+
location: "",
|
|
1292
|
+
trigger: ""
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
return {
|
|
1296
|
+
location: config.locations.components.instanceEditingPanel,
|
|
1297
|
+
trigger: config.triggers.click
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// src/components/instance-editing-panel/empty-state.tsx
|
|
1302
|
+
var React13 = __toESM(require("react"));
|
|
1303
|
+
var import_icons8 = require("@elementor/icons");
|
|
1304
|
+
var import_ui8 = require("@elementor/ui");
|
|
1305
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1306
|
+
var EmptyState2 = ({ onEditComponent }) => {
|
|
1307
|
+
const { canEdit } = useComponentsPermissions();
|
|
1308
|
+
const message = canEdit ? (0, import_i18n8.__)(
|
|
1309
|
+
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
1310
|
+
"elementor"
|
|
1311
|
+
) : (0, import_i18n8.__)(
|
|
1312
|
+
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
1313
|
+
"elementor"
|
|
1314
|
+
);
|
|
1315
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1316
|
+
import_ui8.Stack,
|
|
1317
|
+
{
|
|
1318
|
+
alignItems: "center",
|
|
1319
|
+
justifyContent: "start",
|
|
1320
|
+
height: "100%",
|
|
1321
|
+
color: "text.secondary",
|
|
1322
|
+
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
1323
|
+
gap: 1.5
|
|
1324
|
+
},
|
|
1325
|
+
/* @__PURE__ */ React13.createElement(import_icons8.ComponentPropListIcon, { fontSize: "large" }),
|
|
1326
|
+
/* @__PURE__ */ React13.createElement(import_ui8.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n8.__)("No properties yet", "elementor")),
|
|
1327
|
+
/* @__PURE__ */ React13.createElement(import_ui8.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1328
|
+
canEdit && !!onEditComponent && /* @__PURE__ */ React13.createElement(import_ui8.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React13.createElement(import_icons8.PencilIcon, { fontSize: "small" }), (0, import_i18n8.__)("Edit component", "elementor"))
|
|
1329
|
+
);
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1333
|
+
var React18 = __toESM(require("react"));
|
|
1334
|
+
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
1335
|
+
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
1336
|
+
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
1337
|
+
var import_ui12 = require("@elementor/ui");
|
|
1338
|
+
|
|
1339
|
+
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1340
|
+
var React17 = __toESM(require("react"));
|
|
1341
|
+
var import_react6 = require("react");
|
|
1342
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1343
|
+
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
1344
|
+
var import_ui11 = require("@elementor/ui");
|
|
1345
|
+
|
|
1346
|
+
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1347
|
+
var React16 = __toESM(require("react"));
|
|
1348
|
+
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
1349
|
+
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
1350
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1351
|
+
var import_ui10 = require("@elementor/ui");
|
|
1352
|
+
|
|
1353
|
+
// src/hooks/use-controls-by-widget-type.ts
|
|
1354
|
+
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1355
|
+
function useControlsByWidgetType(type) {
|
|
1356
|
+
const elementType = (0, import_editor_elements4.getElementType)(type);
|
|
1357
|
+
if (!elementType) {
|
|
1358
|
+
return {};
|
|
1359
|
+
}
|
|
1360
|
+
const controls = iterateControls(elementType.controls);
|
|
1361
|
+
return getControlsByBind(controls);
|
|
1362
|
+
}
|
|
1363
|
+
function iterateControls(controls) {
|
|
1364
|
+
return controls.map((control) => {
|
|
1365
|
+
if (control.type === "control" && "bind" in control.value) {
|
|
1366
|
+
return control;
|
|
1367
|
+
}
|
|
1368
|
+
if (control.type === "section") {
|
|
1369
|
+
return iterateControls(control.value.items);
|
|
1370
|
+
}
|
|
1371
|
+
return null;
|
|
1372
|
+
}).filter(Boolean).flat();
|
|
1373
|
+
}
|
|
1374
|
+
function getControlsByBind(controls) {
|
|
1375
|
+
return controls.reduce(
|
|
1376
|
+
(controlsByBind, control) => ({
|
|
1377
|
+
...controlsByBind,
|
|
1378
|
+
[control.value.bind]: control
|
|
1379
|
+
}),
|
|
1380
|
+
{}
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// src/provider/overridable-prop-context.tsx
|
|
1385
|
+
var React14 = __toESM(require("react"));
|
|
1386
|
+
var import_react5 = require("react");
|
|
1387
|
+
var OverridablePropContext = (0, import_react5.createContext)(null);
|
|
1388
|
+
function OverridablePropProvider({ children, ...props }) {
|
|
1389
|
+
return /* @__PURE__ */ React14.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1390
|
+
}
|
|
1391
|
+
var useOverridablePropValue = () => (0, import_react5.useContext)(OverridablePropContext)?.value;
|
|
1392
|
+
var useComponentInstanceElement = () => (0, import_react5.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
1393
|
+
|
|
1394
|
+
// src/utils/resolve-override-prop-value.ts
|
|
1395
|
+
var resolveOverridePropValue = (originalPropValue) => {
|
|
1396
|
+
const isOverridable = componentOverridablePropTypeUtil.isValid(originalPropValue);
|
|
1397
|
+
if (isOverridable) {
|
|
1398
|
+
return getOverridableValue(originalPropValue);
|
|
1399
|
+
}
|
|
1400
|
+
const isOverride = componentInstanceOverridePropTypeUtil.isValid(originalPropValue);
|
|
1401
|
+
if (isOverride) {
|
|
1402
|
+
return getOverrideValue(originalPropValue);
|
|
1403
|
+
}
|
|
1404
|
+
return originalPropValue;
|
|
1405
|
+
};
|
|
1406
|
+
function getOverridableValue(overridableProp) {
|
|
1407
|
+
const overridableValue = componentOverridablePropTypeUtil.extract(overridableProp);
|
|
1408
|
+
if (!overridableValue) {
|
|
1409
|
+
return null;
|
|
1410
|
+
}
|
|
1411
|
+
const isOverride = componentInstanceOverridePropTypeUtil.isValid(overridableValue.origin_value);
|
|
1412
|
+
if (isOverride) {
|
|
1413
|
+
return getOverrideValue(overridableValue.origin_value);
|
|
1414
|
+
}
|
|
1415
|
+
return overridableValue.origin_value;
|
|
1416
|
+
}
|
|
1417
|
+
function getOverrideValue(overrideProp) {
|
|
1418
|
+
const overrideValue = componentInstanceOverridePropTypeUtil.extract(overrideProp);
|
|
1419
|
+
if (!overrideValue) {
|
|
1420
|
+
return null;
|
|
1421
|
+
}
|
|
1422
|
+
return overrideValue.override_value;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
// src/store/dispatchers.ts
|
|
1426
|
+
var import_store11 = require("@elementor/store");
|
|
1427
|
+
function safeDispatch() {
|
|
1428
|
+
return (0, import_store11.__getStore)()?.dispatch;
|
|
1429
|
+
}
|
|
1430
|
+
var componentsActions = {
|
|
1431
|
+
add(components) {
|
|
1432
|
+
(0, import_store11.__dispatch)(slice.actions.add(components));
|
|
1433
|
+
},
|
|
1434
|
+
load(components) {
|
|
1435
|
+
(0, import_store11.__dispatch)(slice.actions.load(components));
|
|
1436
|
+
},
|
|
1437
|
+
addUnpublished(component) {
|
|
1438
|
+
(0, import_store11.__dispatch)(slice.actions.addUnpublished(component));
|
|
1439
|
+
},
|
|
1440
|
+
removeUnpublished(uids) {
|
|
1441
|
+
(0, import_store11.__dispatch)(slice.actions.removeUnpublished(uids));
|
|
1442
|
+
},
|
|
1443
|
+
resetUnpublished() {
|
|
1444
|
+
(0, import_store11.__dispatch)(slice.actions.resetUnpublished());
|
|
1445
|
+
},
|
|
1446
|
+
removeStyles(id2) {
|
|
1447
|
+
(0, import_store11.__dispatch)(slice.actions.removeStyles({ id: id2 }));
|
|
1448
|
+
},
|
|
1449
|
+
addStyles(styles) {
|
|
1450
|
+
(0, import_store11.__dispatch)(slice.actions.addStyles(styles));
|
|
1451
|
+
},
|
|
1452
|
+
addCreatedThisSession(uid) {
|
|
1453
|
+
(0, import_store11.__dispatch)(slice.actions.addCreatedThisSession(uid));
|
|
1454
|
+
},
|
|
1455
|
+
removeCreatedThisSession(uid) {
|
|
1456
|
+
(0, import_store11.__dispatch)(slice.actions.removeCreatedThisSession(uid));
|
|
1457
|
+
},
|
|
1458
|
+
archive(componentId) {
|
|
1459
|
+
(0, import_store11.__dispatch)(slice.actions.archive(componentId));
|
|
1460
|
+
},
|
|
1461
|
+
setCurrentComponentId(id2) {
|
|
1462
|
+
safeDispatch()?.(slice.actions.setCurrentComponentId(id2));
|
|
1463
|
+
},
|
|
1464
|
+
setPath(path) {
|
|
1465
|
+
safeDispatch()?.(slice.actions.setPath(path));
|
|
1466
|
+
},
|
|
1467
|
+
setOverridableProps(componentId, overridableProps) {
|
|
1468
|
+
(0, import_store11.__dispatch)(slice.actions.setOverridableProps({ componentId, overridableProps }));
|
|
1469
|
+
},
|
|
1470
|
+
rename(componentUid, name) {
|
|
1471
|
+
(0, import_store11.__dispatch)(slice.actions.rename({ componentUid, name }));
|
|
1472
|
+
},
|
|
1473
|
+
cleanUpdatedComponentNames() {
|
|
1474
|
+
(0, import_store11.__dispatch)(slice.actions.cleanUpdatedComponentNames());
|
|
1475
|
+
},
|
|
1476
|
+
updateComponentSanitizedAttribute(componentId, attribute) {
|
|
1477
|
+
(0, import_store11.__dispatch)(slice.actions.updateComponentSanitizedAttribute({ componentId, attribute }));
|
|
1478
|
+
},
|
|
1479
|
+
resetSanitizedComponents() {
|
|
1480
|
+
(0, import_store11.__dispatch)(slice.actions.resetSanitizedComponents());
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1059
1484
|
// src/store/selectors.ts
|
|
1060
|
-
var
|
|
1485
|
+
var import_store13 = require("@elementor/store");
|
|
1061
1486
|
function safeGetState() {
|
|
1062
|
-
return (0,
|
|
1487
|
+
return (0, import_store13.__getStore)()?.getState();
|
|
1063
1488
|
}
|
|
1064
1489
|
var componentsSelectors = {
|
|
1065
1490
|
getOverridableProps(componentId) {
|
|
1066
|
-
return selectOverridableProps((0,
|
|
1491
|
+
return selectOverridableProps((0, import_store13.__getState)(), componentId);
|
|
1067
1492
|
},
|
|
1068
1493
|
getCurrentComponent() {
|
|
1069
|
-
return selectCurrentComponent((0,
|
|
1494
|
+
return selectCurrentComponent((0, import_store13.__getState)());
|
|
1070
1495
|
},
|
|
1071
1496
|
getCurrentComponentId() {
|
|
1072
1497
|
const state = safeGetState();
|
|
@@ -1076,19 +1501,19 @@ var componentsSelectors = {
|
|
|
1076
1501
|
return selectCurrentComponentId(state);
|
|
1077
1502
|
},
|
|
1078
1503
|
getUnpublishedComponents() {
|
|
1079
|
-
return selectUnpublishedComponents((0,
|
|
1504
|
+
return selectUnpublishedComponents((0, import_store13.__getState)());
|
|
1080
1505
|
},
|
|
1081
1506
|
getUpdatedComponentNames() {
|
|
1082
|
-
return selectUpdatedComponentNames((0,
|
|
1507
|
+
return selectUpdatedComponentNames((0, import_store13.__getState)());
|
|
1083
1508
|
},
|
|
1084
1509
|
getArchivedThisSession() {
|
|
1085
|
-
return selectArchivedThisSession((0,
|
|
1510
|
+
return selectArchivedThisSession((0, import_store13.__getState)());
|
|
1086
1511
|
},
|
|
1087
1512
|
getComponents() {
|
|
1088
|
-
return selectComponents((0,
|
|
1513
|
+
return selectComponents((0, import_store13.__getState)());
|
|
1089
1514
|
},
|
|
1090
1515
|
getComponentByUid(componentUid) {
|
|
1091
|
-
return selectComponentByUid((0,
|
|
1516
|
+
return selectComponentByUid((0, import_store13.__getState)(), componentUid);
|
|
1092
1517
|
}
|
|
1093
1518
|
};
|
|
1094
1519
|
|
|
@@ -1123,12 +1548,12 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
|
1123
1548
|
}
|
|
1124
1549
|
|
|
1125
1550
|
// src/utils/get-container-by-origin-id.ts
|
|
1126
|
-
var
|
|
1551
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1127
1552
|
function getContainerByOriginId(originElementId, instanceElementId) {
|
|
1128
1553
|
if (!instanceElementId) {
|
|
1129
|
-
return (0,
|
|
1554
|
+
return (0, import_editor_elements5.getContainer)(originElementId);
|
|
1130
1555
|
}
|
|
1131
|
-
const instanceContainer = (0,
|
|
1556
|
+
const instanceContainer = (0, import_editor_elements5.getContainer)(instanceElementId);
|
|
1132
1557
|
if (!instanceContainer) {
|
|
1133
1558
|
return null;
|
|
1134
1559
|
}
|
|
@@ -1141,7 +1566,7 @@ function getContainerByOriginId(originElementId, instanceElementId) {
|
|
|
1141
1566
|
}
|
|
1142
1567
|
|
|
1143
1568
|
// src/utils/get-prop-type-for-component-override.ts
|
|
1144
|
-
var
|
|
1569
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1145
1570
|
var getPropTypeForComponentOverride = (overridableProp) => {
|
|
1146
1571
|
if (overridableProp.originPropFields) {
|
|
1147
1572
|
return getPropType(overridableProp.originPropFields);
|
|
@@ -1153,7 +1578,7 @@ var getPropTypeForComponentOverride = (overridableProp) => {
|
|
|
1153
1578
|
});
|
|
1154
1579
|
};
|
|
1155
1580
|
function getPropType({ widgetType, propKey }) {
|
|
1156
|
-
const widgetPropsSchema = (0,
|
|
1581
|
+
const widgetPropsSchema = (0, import_editor_elements6.getWidgetsCache)()?.[widgetType]?.atomic_props_schema;
|
|
1157
1582
|
return widgetPropsSchema?.[propKey];
|
|
1158
1583
|
}
|
|
1159
1584
|
|
|
@@ -1190,11 +1615,11 @@ function extractInnerOverrideInfo(override) {
|
|
|
1190
1615
|
}
|
|
1191
1616
|
|
|
1192
1617
|
// src/components/control-label.tsx
|
|
1193
|
-
var
|
|
1618
|
+
var React15 = __toESM(require("react"));
|
|
1194
1619
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
1195
|
-
var
|
|
1620
|
+
var import_ui9 = require("@elementor/ui");
|
|
1196
1621
|
var ControlLabel = ({ children, ...props }) => {
|
|
1197
|
-
return /* @__PURE__ */
|
|
1622
|
+
return /* @__PURE__ */ React15.createElement(import_ui9.Stack, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React15.createElement(import_editor_controls.ControlFormLabel, { ...props }, children), /* @__PURE__ */ React15.createElement(import_editor_controls.ControlAdornments, null));
|
|
1198
1623
|
};
|
|
1199
1624
|
|
|
1200
1625
|
// src/components/errors.ts
|
|
@@ -1205,15 +1630,15 @@ var OverrideControlInnerElementNotFoundError = (0, import_utils2.createError)({
|
|
|
1205
1630
|
});
|
|
1206
1631
|
|
|
1207
1632
|
// src/components/instance-editing-panel/use-resolved-origin-value.tsx
|
|
1208
|
-
var
|
|
1633
|
+
var import_store17 = require("@elementor/store");
|
|
1209
1634
|
|
|
1210
1635
|
// src/utils/get-overridable-prop.ts
|
|
1211
|
-
var
|
|
1636
|
+
var import_store15 = require("@elementor/store");
|
|
1212
1637
|
function getOverridableProp({
|
|
1213
1638
|
componentId,
|
|
1214
1639
|
overrideKey
|
|
1215
1640
|
}) {
|
|
1216
|
-
const overridableProps = selectOverridableProps((0,
|
|
1641
|
+
const overridableProps = selectOverridableProps((0, import_store15.__getState)(), componentId);
|
|
1217
1642
|
if (!overridableProps) {
|
|
1218
1643
|
return void 0;
|
|
1219
1644
|
}
|
|
@@ -1222,7 +1647,7 @@ function getOverridableProp({
|
|
|
1222
1647
|
|
|
1223
1648
|
// src/components/instance-editing-panel/use-resolved-origin-value.tsx
|
|
1224
1649
|
function useResolvedOriginValue(override, overridableProp) {
|
|
1225
|
-
const components = (0,
|
|
1650
|
+
const components = (0, import_store17.__useSelector)(selectData);
|
|
1226
1651
|
return resolveOriginValue(components, override, overridableProp);
|
|
1227
1652
|
}
|
|
1228
1653
|
function resolveOriginValue(components, matchingOverride, overridableProp) {
|
|
@@ -1303,7 +1728,7 @@ function OverridePropControl({ overrideKey }) {
|
|
|
1303
1728
|
if (!overridableProp) {
|
|
1304
1729
|
return null;
|
|
1305
1730
|
}
|
|
1306
|
-
return /* @__PURE__ */
|
|
1731
|
+
return /* @__PURE__ */ React16.createElement(import_editor_editing_panel.SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React16.createElement(OverrideControl, { overridableProp }));
|
|
1307
1732
|
}
|
|
1308
1733
|
function OverrideControl({ overridableProp }) {
|
|
1309
1734
|
const componentInstanceElement = (0, import_editor_editing_panel.useElement)();
|
|
@@ -1387,23 +1812,23 @@ function OverrideControl({ overridableProp }) {
|
|
|
1387
1812
|
}
|
|
1388
1813
|
const elementId = element.id;
|
|
1389
1814
|
const type = elType === "widget" ? widgetType : elType;
|
|
1390
|
-
const elementType = (0,
|
|
1815
|
+
const elementType = (0, import_editor_elements7.getElementType)(type);
|
|
1391
1816
|
if (!elementType) {
|
|
1392
1817
|
return null;
|
|
1393
1818
|
}
|
|
1394
|
-
const settings = (0,
|
|
1819
|
+
const settings = (0, import_editor_elements7.getElementSettings)(elementId, Object.keys(elementType.propsSchema));
|
|
1395
1820
|
const propTypeSchema = (0, import_editor_editing_panel.createTopLevelObjectType)({
|
|
1396
1821
|
schema: {
|
|
1397
1822
|
[overridableProp.overrideKey]: propType
|
|
1398
1823
|
}
|
|
1399
1824
|
});
|
|
1400
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1401
1826
|
OverridablePropProvider,
|
|
1402
1827
|
{
|
|
1403
1828
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
1404
1829
|
componentInstanceElement
|
|
1405
1830
|
},
|
|
1406
|
-
/* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ React16.createElement(import_editor_editing_panel.ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React16.createElement(import_editor_editing_panel.SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React16.createElement(
|
|
1407
1832
|
import_editor_controls2.PropProvider,
|
|
1408
1833
|
{
|
|
1409
1834
|
propType: propTypeSchema,
|
|
@@ -1413,7 +1838,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1413
1838
|
return false;
|
|
1414
1839
|
}
|
|
1415
1840
|
},
|
|
1416
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ React16.createElement(import_editor_controls2.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React16.createElement(import_editor_controls2.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React16.createElement(import_ui10.Stack, { direction: "column", gap: 1, mb: 1.5 }, layout !== "custom" && /* @__PURE__ */ React16.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React16.createElement(OriginalControl, { control, controlProps }))))
|
|
1417
1842
|
)))
|
|
1418
1843
|
);
|
|
1419
1844
|
}
|
|
@@ -1472,7 +1897,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
1472
1897
|
}
|
|
1473
1898
|
function OriginalControl({ control, controlProps }) {
|
|
1474
1899
|
const { value } = control;
|
|
1475
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ React16.createElement(import_editor_editing_panel.BaseControl, { type: value.type, props: controlProps });
|
|
1476
1901
|
}
|
|
1477
1902
|
function getControlLayout(control) {
|
|
1478
1903
|
return control.value.meta?.layout || import_editor_editing_panel.controlsRegistry.getLayout(control.value.type);
|
|
@@ -1503,12 +1928,12 @@ function OverridePropsGroup({ group }) {
|
|
|
1503
1928
|
const handleClick = () => {
|
|
1504
1929
|
setIsOpen(!isOpen);
|
|
1505
1930
|
};
|
|
1506
|
-
const id2 = (0,
|
|
1931
|
+
const id2 = (0, import_react6.useId)();
|
|
1507
1932
|
const labelId = `label-${id2}`;
|
|
1508
1933
|
const contentId = `content-${id2}`;
|
|
1509
1934
|
const title = group.label;
|
|
1510
|
-
return /* @__PURE__ */
|
|
1511
|
-
|
|
1935
|
+
return /* @__PURE__ */ React17.createElement(import_ui11.Box, { "aria-label": `${title} section` }, /* @__PURE__ */ React17.createElement(
|
|
1936
|
+
import_ui11.ListItemButton,
|
|
1512
1937
|
{
|
|
1513
1938
|
id: labelId,
|
|
1514
1939
|
"aria-controls": contentId,
|
|
@@ -1517,34 +1942,21 @@ function OverridePropsGroup({ group }) {
|
|
|
1517
1942
|
p: 0,
|
|
1518
1943
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
1519
1944
|
},
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
|
|
1945
|
+
/* @__PURE__ */ React17.createElement(import_ui11.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React17.createElement(
|
|
1946
|
+
import_ui11.ListItemText,
|
|
1522
1947
|
{
|
|
1523
1948
|
secondary: title,
|
|
1524
1949
|
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
1525
1950
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
1526
1951
|
}
|
|
1527
1952
|
)),
|
|
1528
|
-
/* @__PURE__ */
|
|
1529
|
-
), /* @__PURE__ */
|
|
1953
|
+
/* @__PURE__ */ React17.createElement(import_editor_ui7.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
1954
|
+
), /* @__PURE__ */ React17.createElement(import_ui11.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React17.createElement(import_ui11.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React17.createElement(OverridePropControl, { key: overrideKey, overrideKey })))));
|
|
1530
1955
|
}
|
|
1531
1956
|
|
|
1532
1957
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1533
1958
|
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
1534
|
-
return /* @__PURE__ */
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1538
|
-
var React16 = __toESM(require("react"));
|
|
1539
|
-
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
1540
|
-
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1541
|
-
var import_icons6 = require("@elementor/icons");
|
|
1542
|
-
var import_ui12 = require("@elementor/ui");
|
|
1543
|
-
function InstancePanelHeader({ componentName, actions }) {
|
|
1544
|
-
return /* @__PURE__ */ React16.createElement(import_editor_panels2.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React16.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React16.createElement(import_icons6.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React16.createElement(import_editor_ui6.EllipsisWithTooltip, { title: componentName, as: import_editor_panels2.PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1545
|
-
}
|
|
1546
|
-
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1547
|
-
return /* @__PURE__ */ React16.createElement(import_ui12.Tooltip, { title: label }, /* @__PURE__ */ React16.createElement(import_ui12.IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React16.createElement(Icon2, { fontSize: "tiny" })));
|
|
1959
|
+
return /* @__PURE__ */ React18.createElement(import_editor_panels2.PanelBody, null, /* @__PURE__ */ React18.createElement(import_editor_controls3.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel3.getFieldIndicators)("settings") }, isEmpty ? emptyState : /* @__PURE__ */ React18.createElement(import_ui12.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React18.createElement(React18.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React18.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React18.createElement(import_ui12.Divider, null))))));
|
|
1548
1960
|
}
|
|
1549
1961
|
|
|
1550
1962
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -1630,7 +2042,7 @@ function useInstancePanelData() {
|
|
|
1630
2042
|
const component = useComponent(componentId ?? null);
|
|
1631
2043
|
const componentInstanceId = element?.id;
|
|
1632
2044
|
const overridableProps = useSanitizeOverridableProps(componentId ?? null, componentInstanceId);
|
|
1633
|
-
if (!componentId || !overridableProps || !component) {
|
|
2045
|
+
if (!componentId || !overridableProps || !component || !componentInstanceId) {
|
|
1634
2046
|
return null;
|
|
1635
2047
|
}
|
|
1636
2048
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
@@ -1645,32 +2057,28 @@ function useComponentInstanceSettings() {
|
|
|
1645
2057
|
|
|
1646
2058
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
1647
2059
|
function InstanceEditingPanel() {
|
|
2060
|
+
const { canEdit } = useComponentsPermissions();
|
|
1648
2061
|
const data = useInstancePanelData();
|
|
1649
2062
|
if (!data) {
|
|
1650
2063
|
return null;
|
|
1651
2064
|
}
|
|
1652
2065
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
1653
|
-
const panelTitle = (0,
|
|
1654
|
-
|
|
2066
|
+
const panelTitle = (0, import_i18n9.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
2067
|
+
const actions = /* @__PURE__ */ React19.createElement(import_ui13.Stack, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React19.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React19.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: import_icons9.PencilIcon }));
|
|
2068
|
+
return /* @__PURE__ */ React19.createElement(import_ui13.Box, { "data-testid": "instance-editing-panel" }, /* @__PURE__ */ React19.createElement(
|
|
1655
2069
|
ComponentInstanceProvider,
|
|
1656
2070
|
{
|
|
1657
2071
|
componentId,
|
|
1658
2072
|
overrides,
|
|
1659
2073
|
overridableProps
|
|
1660
2074
|
},
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
|
|
1663
|
-
{
|
|
1664
|
-
componentName: component.name,
|
|
1665
|
-
actions: /* @__PURE__ */ React17.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: import_icons7.PencilIcon })
|
|
1666
|
-
}
|
|
1667
|
-
),
|
|
1668
|
-
/* @__PURE__ */ React17.createElement(
|
|
2075
|
+
/* @__PURE__ */ React19.createElement(InstancePanelHeader, { componentName: component.name, actions }),
|
|
2076
|
+
/* @__PURE__ */ React19.createElement(
|
|
1669
2077
|
InstancePanelBody,
|
|
1670
2078
|
{
|
|
1671
2079
|
groups,
|
|
1672
2080
|
isEmpty,
|
|
1673
|
-
emptyState: /* @__PURE__ */
|
|
2081
|
+
emptyState: /* @__PURE__ */ React19.createElement(EmptyState2, null),
|
|
1674
2082
|
componentInstanceId
|
|
1675
2083
|
}
|
|
1676
2084
|
)
|
|
@@ -1678,19 +2086,142 @@ function InstanceEditingPanel() {
|
|
|
1678
2086
|
}
|
|
1679
2087
|
|
|
1680
2088
|
// src/components/load-template-components.tsx
|
|
1681
|
-
var
|
|
2089
|
+
var import_react7 = require("react");
|
|
1682
2090
|
var import_editor_templates = require("@elementor/editor-templates");
|
|
1683
2091
|
|
|
1684
2092
|
// src/store/actions/load-components-assets.ts
|
|
1685
|
-
var
|
|
2093
|
+
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
2094
|
+
|
|
2095
|
+
// src/utils/get-component-documents.ts
|
|
2096
|
+
async function getComponentDocuments(elements, cache = /* @__PURE__ */ new Map()) {
|
|
2097
|
+
const componentIds = await getComponentIds(elements, cache);
|
|
2098
|
+
return getDocumentsMap(componentIds, cache);
|
|
2099
|
+
}
|
|
2100
|
+
async function getComponentIds(elements, cache) {
|
|
2101
|
+
const results = await Promise.all(
|
|
2102
|
+
elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
|
|
2103
|
+
const ids = [];
|
|
2104
|
+
if (isComponentInstance({ widgetType, elType })) {
|
|
2105
|
+
const componentId = settings?.component_instance?.value?.component_id.value;
|
|
2106
|
+
if (!componentId) {
|
|
2107
|
+
return ids;
|
|
2108
|
+
}
|
|
2109
|
+
ids.push(componentId);
|
|
2110
|
+
if (!cache.has(componentId)) {
|
|
2111
|
+
cache.set(componentId, getComponentDocumentData(componentId));
|
|
2112
|
+
}
|
|
2113
|
+
const doc = await cache.get(componentId);
|
|
2114
|
+
childElements = doc?.elements;
|
|
2115
|
+
}
|
|
2116
|
+
if (childElements?.length) {
|
|
2117
|
+
const childIds = await getComponentIds(childElements, cache);
|
|
2118
|
+
ids.push(...childIds);
|
|
2119
|
+
}
|
|
2120
|
+
return ids;
|
|
2121
|
+
})
|
|
2122
|
+
);
|
|
2123
|
+
return [...new Set(results.flat())];
|
|
2124
|
+
}
|
|
2125
|
+
async function getDocumentsMap(ids, cache) {
|
|
2126
|
+
const documents = await Promise.all(
|
|
2127
|
+
ids.map(async (id2) => {
|
|
2128
|
+
const document = await cache.get(id2);
|
|
2129
|
+
if (!document) {
|
|
2130
|
+
return null;
|
|
2131
|
+
}
|
|
2132
|
+
return [id2, document];
|
|
2133
|
+
})
|
|
2134
|
+
);
|
|
2135
|
+
return new Map(documents.filter((document) => document !== null));
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
// src/store/actions/load-components-overridable-props.ts
|
|
2139
|
+
var import_store22 = require("@elementor/store");
|
|
2140
|
+
function loadComponentsOverridableProps(componentIds) {
|
|
2141
|
+
if (!componentIds.length) {
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2145
|
+
}
|
|
2146
|
+
async function loadComponentOverrides(componentId) {
|
|
2147
|
+
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0, import_store22.__getState)(), componentId);
|
|
2148
|
+
if (isOverridablePropsLoaded) {
|
|
2149
|
+
return;
|
|
2150
|
+
}
|
|
2151
|
+
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2152
|
+
if (!overridableProps) {
|
|
2153
|
+
return;
|
|
2154
|
+
}
|
|
2155
|
+
(0, import_store22.__dispatch)(
|
|
2156
|
+
slice.actions.setOverridableProps({
|
|
2157
|
+
componentId,
|
|
2158
|
+
overridableProps
|
|
2159
|
+
})
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
// src/store/actions/load-components-styles.ts
|
|
2164
|
+
var import_store24 = require("@elementor/store");
|
|
2165
|
+
function loadComponentsStyles(documents) {
|
|
2166
|
+
if (!documents.size) {
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
const knownComponents = selectStyles((0, import_store24.__getState)());
|
|
2170
|
+
const unknownDocuments = new Map([...documents.entries()].filter(([id2]) => !knownComponents[id2]));
|
|
2171
|
+
if (!unknownDocuments.size) {
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
addStyles(unknownDocuments);
|
|
2175
|
+
}
|
|
2176
|
+
function addStyles(documents) {
|
|
2177
|
+
const styles = Object.fromEntries(
|
|
2178
|
+
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2179
|
+
);
|
|
2180
|
+
(0, import_store24.__dispatch)(slice.actions.addStyles(styles));
|
|
2181
|
+
}
|
|
2182
|
+
function extractStylesFromDocument(document) {
|
|
2183
|
+
if (!document.elements?.length) {
|
|
2184
|
+
return [];
|
|
2185
|
+
}
|
|
2186
|
+
return document.elements.flatMap(extractStylesFromElement);
|
|
2187
|
+
}
|
|
2188
|
+
function extractStylesFromElement(element) {
|
|
2189
|
+
return [
|
|
2190
|
+
...Object.values(element.styles ?? {}),
|
|
2191
|
+
...(element.elements ?? []).flatMap(extractStylesFromElement)
|
|
2192
|
+
];
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
// src/store/actions/load-components-assets.ts
|
|
2196
|
+
async function loadComponentsAssets(elements) {
|
|
2197
|
+
const documents = await getComponentDocuments(elements);
|
|
2198
|
+
updateDocumentState(documents);
|
|
2199
|
+
loadComponentsStyles(documents);
|
|
2200
|
+
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2201
|
+
}
|
|
2202
|
+
function updateDocumentState(documents) {
|
|
2203
|
+
const isDrafted = [...documents.values()].some(import_editor_documents2.isDocumentDirty);
|
|
2204
|
+
if (isDrafted) {
|
|
2205
|
+
(0, import_editor_documents2.setDocumentModifiedStatus)(true);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
// src/components/load-template-components.tsx
|
|
2210
|
+
var LoadTemplateComponents = () => {
|
|
2211
|
+
const templates = (0, import_editor_templates.useLoadedTemplates)();
|
|
2212
|
+
(0, import_react7.useEffect)(() => {
|
|
2213
|
+
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2214
|
+
}, [templates]);
|
|
2215
|
+
return null;
|
|
2216
|
+
};
|
|
1686
2217
|
|
|
1687
2218
|
// src/create-component-type.ts
|
|
1688
2219
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
1689
|
-
var
|
|
1690
|
-
var
|
|
1691
|
-
var
|
|
2220
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
2221
|
+
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2222
|
+
var import_store26 = require("@elementor/store");
|
|
1692
2223
|
var import_utils4 = require("@elementor/utils");
|
|
1693
|
-
var
|
|
2224
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1694
2225
|
|
|
1695
2226
|
// src/utils/format-component-elements-id.ts
|
|
1696
2227
|
var import_utils3 = require("@elementor/utils");
|
|
@@ -1709,27 +2240,27 @@ function formatComponentElementsId(elements, path) {
|
|
|
1709
2240
|
}
|
|
1710
2241
|
|
|
1711
2242
|
// src/utils/switch-to-component.ts
|
|
1712
|
-
var
|
|
1713
|
-
var
|
|
1714
|
-
var
|
|
2243
|
+
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
2244
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2245
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
1715
2246
|
async function switchToComponent(componentId, componentInstanceId, element) {
|
|
1716
2247
|
const selector = getSelector(element, componentInstanceId);
|
|
1717
|
-
(0,
|
|
1718
|
-
await (0,
|
|
2248
|
+
(0, import_editor_documents3.invalidateDocumentData)(componentId);
|
|
2249
|
+
await (0, import_editor_documents3.switchToDocument)(componentId, {
|
|
1719
2250
|
selector,
|
|
1720
2251
|
mode: "autosave",
|
|
1721
2252
|
setAsInitial: false,
|
|
1722
2253
|
shouldScroll: false
|
|
1723
2254
|
});
|
|
1724
|
-
const currentDocumentContainer = (0,
|
|
2255
|
+
const currentDocumentContainer = (0, import_editor_elements8.getCurrentDocumentContainer)();
|
|
1725
2256
|
const topLevelElement = currentDocumentContainer?.children?.[0];
|
|
1726
2257
|
if (topLevelElement) {
|
|
1727
|
-
(0,
|
|
2258
|
+
(0, import_editor_elements8.selectElement)(topLevelElement.id);
|
|
1728
2259
|
expandNavigator();
|
|
1729
2260
|
}
|
|
1730
2261
|
}
|
|
1731
2262
|
async function expandNavigator() {
|
|
1732
|
-
await (0,
|
|
2263
|
+
await (0, import_editor_v1_adapters3.__privateRunCommand)("navigator/expand-all");
|
|
1733
2264
|
}
|
|
1734
2265
|
function getSelector(element, componentInstanceId) {
|
|
1735
2266
|
if (element) {
|
|
@@ -1760,54 +2291,15 @@ function buildUniqueSelector(element) {
|
|
|
1760
2291
|
return selectors.join(" ");
|
|
1761
2292
|
}
|
|
1762
2293
|
|
|
1763
|
-
// src/utils/tracking.ts
|
|
1764
|
-
var import_events = require("@elementor/events");
|
|
1765
|
-
var import_store18 = require("@elementor/store");
|
|
1766
|
-
var FEATURE_NAME = "Components";
|
|
1767
|
-
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
1768
|
-
if (source === "system") {
|
|
1769
|
-
return;
|
|
1770
|
-
}
|
|
1771
|
-
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
1772
|
-
if (!config?.names?.components?.[action]) {
|
|
1773
|
-
return;
|
|
1774
|
-
}
|
|
1775
|
-
const name = config.names.components[action];
|
|
1776
|
-
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
1777
|
-
};
|
|
1778
|
-
var onElementDrop = (_args, element) => {
|
|
1779
|
-
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
1780
|
-
return;
|
|
1781
|
-
}
|
|
1782
|
-
const editorSettings = element.model.get("editor_settings");
|
|
1783
|
-
const componentName = editorSettings?.title;
|
|
1784
|
-
const componentUID = editorSettings?.component_uid;
|
|
1785
|
-
const instanceId = element.id;
|
|
1786
|
-
const createdThisSession = selectCreatedThisSession((0, import_store18.__getState)());
|
|
1787
|
-
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
1788
|
-
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
1789
|
-
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
1790
|
-
trackComponentEvent({
|
|
1791
|
-
action: "instanceAdded",
|
|
1792
|
-
source: "user",
|
|
1793
|
-
instance_id: instanceId,
|
|
1794
|
-
component_uid: componentUID,
|
|
1795
|
-
component_name: componentName,
|
|
1796
|
-
is_same_session_reuse: isSameSessionReuse,
|
|
1797
|
-
location: locations.widgetPanel,
|
|
1798
|
-
secondary_location: secondaryLocations.componentsTab
|
|
1799
|
-
});
|
|
1800
|
-
};
|
|
1801
|
-
|
|
1802
2294
|
// src/create-component-type.ts
|
|
1803
|
-
var
|
|
2295
|
+
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
1804
2296
|
var EDIT_COMPONENT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
1805
2297
|
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
1806
2298
|
function notifyComponentEditUpgrade() {
|
|
1807
|
-
(0,
|
|
2299
|
+
(0, import_editor_notifications2.notify)({
|
|
1808
2300
|
type: "promotion",
|
|
1809
2301
|
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
1810
|
-
message: (0,
|
|
2302
|
+
message: (0, import_i18n10.__)("Your Pro subscription has expired. Renew to edit components.", "elementor"),
|
|
1811
2303
|
additionalActionProps: [
|
|
1812
2304
|
{
|
|
1813
2305
|
size: "small",
|
|
@@ -1815,7 +2307,7 @@ function notifyComponentEditUpgrade() {
|
|
|
1815
2307
|
color: "promotion",
|
|
1816
2308
|
href: EDIT_COMPONENT_UPGRADE_URL,
|
|
1817
2309
|
target: "_blank",
|
|
1818
|
-
children: (0,
|
|
2310
|
+
children: (0, import_i18n10.__)("Upgrade Now", "elementor")
|
|
1819
2311
|
}
|
|
1820
2312
|
]
|
|
1821
2313
|
});
|
|
@@ -1830,7 +2322,7 @@ var updateGroups = (groups, config) => {
|
|
|
1830
2322
|
(action) => disabledActions.includes(action.name) ? { ...action, isEnabled: () => false } : action
|
|
1831
2323
|
);
|
|
1832
2324
|
if (addConfig) {
|
|
1833
|
-
updatedActions.splice(addConfig.index, 0, addConfig.
|
|
2325
|
+
updatedActions.splice(addConfig.index, 0, ...addConfig.actions);
|
|
1834
2326
|
}
|
|
1835
2327
|
return { ...group, actions: updatedActions };
|
|
1836
2328
|
});
|
|
@@ -1857,7 +2349,7 @@ function createComponentView(options) {
|
|
|
1857
2349
|
eventsManagerConfig = legacyWindow.elementorCommon.eventsManager.config;
|
|
1858
2350
|
#componentRenderContext;
|
|
1859
2351
|
isComponentCurrentlyEdited() {
|
|
1860
|
-
const currentDocument = (0,
|
|
2352
|
+
const currentDocument = (0, import_editor_documents4.getCurrentDocument)();
|
|
1861
2353
|
return currentDocument?.id === this.getComponentId();
|
|
1862
2354
|
}
|
|
1863
2355
|
getRenderContext() {
|
|
@@ -1929,26 +2421,35 @@ function createComponentView(options) {
|
|
|
1929
2421
|
_getContextMenuConfig() {
|
|
1930
2422
|
const isAdministrator = isUserAdministrator();
|
|
1931
2423
|
const hasPro = (0, import_utils4.hasProInstalled)();
|
|
1932
|
-
const proLabel = (0,
|
|
2424
|
+
const proLabel = (0, import_i18n10.__)("PRO", "elementor");
|
|
1933
2425
|
const badgeClass = "elementor-context-menu-list__item__shortcut__new-badge";
|
|
1934
2426
|
const proBadge = `<a href="${EDIT_COMPONENT_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}">${proLabel}</a>`;
|
|
2427
|
+
const editComponentAction = {
|
|
2428
|
+
name: "edit component",
|
|
2429
|
+
icon: "eicon-edit",
|
|
2430
|
+
title: () => (0, import_i18n10.__)("Edit Component", "elementor"),
|
|
2431
|
+
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
2432
|
+
isEnabled: () => hasPro,
|
|
2433
|
+
callback: (_, eventData) => this.editComponent(eventData)
|
|
2434
|
+
};
|
|
2435
|
+
const detachInstanceAction = {
|
|
2436
|
+
name: "detach instance",
|
|
2437
|
+
icon: "eicon-chain-broken",
|
|
2438
|
+
title: () => (0, import_i18n10.__)("Detach from Component", "elementor"),
|
|
2439
|
+
isEnabled: () => true,
|
|
2440
|
+
callback: (_, eventData) => this.detachInstance(eventData)
|
|
2441
|
+
};
|
|
2442
|
+
const actions = isAdministrator ? [editComponentAction, detachInstanceAction] : [detachInstanceAction];
|
|
1935
2443
|
const addedGroup = {
|
|
1936
2444
|
general: {
|
|
1937
2445
|
index: 1,
|
|
1938
|
-
|
|
1939
|
-
name: "edit component",
|
|
1940
|
-
icon: "eicon-edit",
|
|
1941
|
-
title: () => (0, import_i18n7.__)("Edit Component", "elementor"),
|
|
1942
|
-
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
1943
|
-
isEnabled: () => hasPro,
|
|
1944
|
-
callback: (_, eventData) => this.editComponent(eventData)
|
|
1945
|
-
}
|
|
2446
|
+
actions
|
|
1946
2447
|
}
|
|
1947
2448
|
};
|
|
1948
2449
|
const disabledGroup = {
|
|
1949
2450
|
clipboard: ["pasteStyle", "resetStyle"]
|
|
1950
2451
|
};
|
|
1951
|
-
return { add:
|
|
2452
|
+
return { add: addedGroup, disable: disabledGroup };
|
|
1952
2453
|
}
|
|
1953
2454
|
async switchDocument() {
|
|
1954
2455
|
const { isAllowedToSwitchDocument, lockedBy } = await apiClient.getComponentLockStatus(
|
|
@@ -1977,6 +2478,29 @@ function createComponentView(options) {
|
|
|
1977
2478
|
trigger
|
|
1978
2479
|
});
|
|
1979
2480
|
}
|
|
2481
|
+
detachInstance({ trigger, location, secondaryLocation }) {
|
|
2482
|
+
const componentId = this.getComponentId();
|
|
2483
|
+
const instanceId = this.model.get("id");
|
|
2484
|
+
if (!componentId || !instanceId) {
|
|
2485
|
+
return;
|
|
2486
|
+
}
|
|
2487
|
+
const handleConfirm = async () => {
|
|
2488
|
+
try {
|
|
2489
|
+
await detachComponentInstance({
|
|
2490
|
+
instanceId,
|
|
2491
|
+
componentId,
|
|
2492
|
+
trackingInfo: { location, secondaryLocation, trigger }
|
|
2493
|
+
});
|
|
2494
|
+
} catch {
|
|
2495
|
+
(0, import_editor_notifications2.notify)({
|
|
2496
|
+
type: "error",
|
|
2497
|
+
message: (0, import_i18n10.__)("Failed to detach component instance.", "elementor"),
|
|
2498
|
+
id: "detach-component-instance-failed"
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
};
|
|
2502
|
+
options.showDetachConfirmDialog?.(handleConfirm);
|
|
2503
|
+
}
|
|
1980
2504
|
handleDblClick(e) {
|
|
1981
2505
|
e.stopPropagation();
|
|
1982
2506
|
if (!isUserAdministrator()) {
|
|
@@ -2048,7 +2572,7 @@ function createComponentModel() {
|
|
|
2048
2572
|
}
|
|
2049
2573
|
const componentUid = editorSettings?.component_uid;
|
|
2050
2574
|
if (componentUid) {
|
|
2051
|
-
const component = selectComponentByUid((0,
|
|
2575
|
+
const component = selectComponentByUid((0, import_store26.__getState)(), componentUid);
|
|
2052
2576
|
if (component?.name) {
|
|
2053
2577
|
return component.name;
|
|
2054
2578
|
}
|
|
@@ -2056,146 +2580,18 @@ function createComponentModel() {
|
|
|
2056
2580
|
return window.elementor.getElementData(this).title;
|
|
2057
2581
|
},
|
|
2058
2582
|
getComponentId() {
|
|
2059
|
-
return this.get("componentId") || null;
|
|
2060
|
-
},
|
|
2061
|
-
getComponentName() {
|
|
2062
|
-
return this.getTitle();
|
|
2063
|
-
},
|
|
2064
|
-
getComponentUid() {
|
|
2065
|
-
const editorSettings = this.get("editor_settings");
|
|
2066
|
-
return editorSettings?.component_uid || null;
|
|
2067
|
-
}
|
|
2068
|
-
});
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
// src/utils/is-component-instance.ts
|
|
2072
|
-
function isComponentInstance(elementModel) {
|
|
2073
|
-
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
// src/utils/get-component-documents.ts
|
|
2077
|
-
async function getComponentDocuments(elements, cache = /* @__PURE__ */ new Map()) {
|
|
2078
|
-
const componentIds = await getComponentIds(elements, cache);
|
|
2079
|
-
return getDocumentsMap(componentIds, cache);
|
|
2080
|
-
}
|
|
2081
|
-
async function getComponentIds(elements, cache) {
|
|
2082
|
-
const results = await Promise.all(
|
|
2083
|
-
elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
|
|
2084
|
-
const ids = [];
|
|
2085
|
-
if (isComponentInstance({ widgetType, elType })) {
|
|
2086
|
-
const componentId = settings?.component_instance?.value?.component_id.value;
|
|
2087
|
-
if (!componentId) {
|
|
2088
|
-
return ids;
|
|
2089
|
-
}
|
|
2090
|
-
ids.push(componentId);
|
|
2091
|
-
if (!cache.has(componentId)) {
|
|
2092
|
-
cache.set(componentId, getComponentDocumentData(componentId));
|
|
2093
|
-
}
|
|
2094
|
-
const doc = await cache.get(componentId);
|
|
2095
|
-
childElements = doc?.elements;
|
|
2096
|
-
}
|
|
2097
|
-
if (childElements?.length) {
|
|
2098
|
-
const childIds = await getComponentIds(childElements, cache);
|
|
2099
|
-
ids.push(...childIds);
|
|
2100
|
-
}
|
|
2101
|
-
return ids;
|
|
2102
|
-
})
|
|
2103
|
-
);
|
|
2104
|
-
return [...new Set(results.flat())];
|
|
2105
|
-
}
|
|
2106
|
-
async function getDocumentsMap(ids, cache) {
|
|
2107
|
-
const documents = await Promise.all(
|
|
2108
|
-
ids.map(async (id2) => {
|
|
2109
|
-
const document = await cache.get(id2);
|
|
2110
|
-
if (!document) {
|
|
2111
|
-
return null;
|
|
2112
|
-
}
|
|
2113
|
-
return [id2, document];
|
|
2114
|
-
})
|
|
2115
|
-
);
|
|
2116
|
-
return new Map(documents.filter((document) => document !== null));
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
// src/store/actions/load-components-overridable-props.ts
|
|
2120
|
-
var import_store22 = require("@elementor/store");
|
|
2121
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2122
|
-
if (!componentIds.length) {
|
|
2123
|
-
return;
|
|
2124
|
-
}
|
|
2125
|
-
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2126
|
-
}
|
|
2127
|
-
async function loadComponentOverrides(componentId) {
|
|
2128
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0, import_store22.__getState)(), componentId);
|
|
2129
|
-
if (isOverridablePropsLoaded) {
|
|
2130
|
-
return;
|
|
2131
|
-
}
|
|
2132
|
-
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2133
|
-
if (!overridableProps) {
|
|
2134
|
-
return;
|
|
2135
|
-
}
|
|
2136
|
-
(0, import_store22.__dispatch)(
|
|
2137
|
-
slice.actions.setOverridableProps({
|
|
2138
|
-
componentId,
|
|
2139
|
-
overridableProps
|
|
2140
|
-
})
|
|
2141
|
-
);
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
// src/store/actions/load-components-styles.ts
|
|
2145
|
-
var import_store24 = require("@elementor/store");
|
|
2146
|
-
function loadComponentsStyles(documents) {
|
|
2147
|
-
if (!documents.size) {
|
|
2148
|
-
return;
|
|
2149
|
-
}
|
|
2150
|
-
const knownComponents = selectStyles((0, import_store24.__getState)());
|
|
2151
|
-
const unknownDocuments = new Map([...documents.entries()].filter(([id2]) => !knownComponents[id2]));
|
|
2152
|
-
if (!unknownDocuments.size) {
|
|
2153
|
-
return;
|
|
2154
|
-
}
|
|
2155
|
-
addStyles(unknownDocuments);
|
|
2156
|
-
}
|
|
2157
|
-
function addStyles(documents) {
|
|
2158
|
-
const styles = Object.fromEntries(
|
|
2159
|
-
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2160
|
-
);
|
|
2161
|
-
(0, import_store24.__dispatch)(slice.actions.addStyles(styles));
|
|
2162
|
-
}
|
|
2163
|
-
function extractStylesFromDocument(document) {
|
|
2164
|
-
if (!document.elements?.length) {
|
|
2165
|
-
return [];
|
|
2166
|
-
}
|
|
2167
|
-
return document.elements.flatMap(extractStylesFromElement);
|
|
2168
|
-
}
|
|
2169
|
-
function extractStylesFromElement(element) {
|
|
2170
|
-
return [
|
|
2171
|
-
...Object.values(element.styles ?? {}),
|
|
2172
|
-
...(element.elements ?? []).flatMap(extractStylesFromElement)
|
|
2173
|
-
];
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
// src/store/actions/load-components-assets.ts
|
|
2177
|
-
async function loadComponentsAssets(elements) {
|
|
2178
|
-
const documents = await getComponentDocuments(elements);
|
|
2179
|
-
updateDocumentState(documents);
|
|
2180
|
-
loadComponentsStyles(documents);
|
|
2181
|
-
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2182
|
-
}
|
|
2183
|
-
function updateDocumentState(documents) {
|
|
2184
|
-
const isDrafted = [...documents.values()].some(import_editor_documents4.isDocumentDirty);
|
|
2185
|
-
if (isDrafted) {
|
|
2186
|
-
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
2187
|
-
}
|
|
2583
|
+
return this.get("componentId") || null;
|
|
2584
|
+
},
|
|
2585
|
+
getComponentName() {
|
|
2586
|
+
return this.getTitle();
|
|
2587
|
+
},
|
|
2588
|
+
getComponentUid() {
|
|
2589
|
+
const editorSettings = this.get("editor_settings");
|
|
2590
|
+
return editorSettings?.component_uid || null;
|
|
2591
|
+
}
|
|
2592
|
+
});
|
|
2188
2593
|
}
|
|
2189
2594
|
|
|
2190
|
-
// src/components/load-template-components.tsx
|
|
2191
|
-
var LoadTemplateComponents = () => {
|
|
2192
|
-
const templates = (0, import_editor_templates.useLoadedTemplates)();
|
|
2193
|
-
(0, import_react6.useEffect)(() => {
|
|
2194
|
-
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2195
|
-
}, [templates]);
|
|
2196
|
-
return null;
|
|
2197
|
-
};
|
|
2198
|
-
|
|
2199
2595
|
// src/extended/init.ts
|
|
2200
2596
|
var import_editor = require("@elementor/editor");
|
|
2201
2597
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
@@ -2203,28 +2599,28 @@ var import_editor_documents13 = require("@elementor/editor-documents");
|
|
|
2203
2599
|
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
2204
2600
|
var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
2205
2601
|
var import_editor_panels6 = require("@elementor/editor-panels");
|
|
2206
|
-
var
|
|
2207
|
-
var
|
|
2602
|
+
var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
|
|
2603
|
+
var import_i18n34 = require("@wordpress/i18n");
|
|
2208
2604
|
|
|
2209
2605
|
// src/extended/components/component-panel-header/component-panel-header.tsx
|
|
2210
|
-
var
|
|
2606
|
+
var React29 = __toESM(require("react"));
|
|
2211
2607
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2212
2608
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
2213
2609
|
var import_editor_panels5 = require("@elementor/editor-panels");
|
|
2214
|
-
var
|
|
2215
|
-
var
|
|
2216
|
-
var
|
|
2610
|
+
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
2611
|
+
var import_icons16 = require("@elementor/icons");
|
|
2612
|
+
var import_store32 = require("@elementor/store");
|
|
2217
2613
|
var import_ui23 = require("@elementor/ui");
|
|
2218
|
-
var
|
|
2614
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2219
2615
|
|
|
2220
2616
|
// src/extended/hooks/use-navigate-back.ts
|
|
2221
|
-
var
|
|
2617
|
+
var import_react8 = require("react");
|
|
2222
2618
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2223
|
-
var
|
|
2619
|
+
var import_store28 = require("@elementor/store");
|
|
2224
2620
|
function useNavigateBack() {
|
|
2225
|
-
const path = (0,
|
|
2621
|
+
const path = (0, import_store28.__useSelector)(selectPath);
|
|
2226
2622
|
const documentsManager = (0, import_editor_documents5.getV1DocumentsManager)();
|
|
2227
|
-
return (0,
|
|
2623
|
+
return (0, import_react8.useCallback)(() => {
|
|
2228
2624
|
const { componentId: prevComponentId, instanceId: prevComponentInstanceId } = path.at(-2) ?? {};
|
|
2229
2625
|
if (prevComponentId && prevComponentInstanceId) {
|
|
2230
2626
|
switchToComponent(prevComponentId, prevComponentInstanceId);
|
|
@@ -2235,11 +2631,11 @@ function useNavigateBack() {
|
|
|
2235
2631
|
}
|
|
2236
2632
|
|
|
2237
2633
|
// src/extended/components/component-introduction.tsx
|
|
2238
|
-
var
|
|
2634
|
+
var React20 = __toESM(require("react"));
|
|
2239
2635
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2240
|
-
var
|
|
2636
|
+
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2241
2637
|
var import_ui14 = require("@elementor/ui");
|
|
2242
|
-
var
|
|
2638
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2243
2639
|
var ComponentIntroduction = ({
|
|
2244
2640
|
anchorRef,
|
|
2245
2641
|
shouldShowIntroduction,
|
|
@@ -2248,7 +2644,7 @@ var ComponentIntroduction = ({
|
|
|
2248
2644
|
if (!anchorRef.current || !shouldShowIntroduction) {
|
|
2249
2645
|
return null;
|
|
2250
2646
|
}
|
|
2251
|
-
return /* @__PURE__ */
|
|
2647
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2252
2648
|
import_ui14.Popover,
|
|
2253
2649
|
{
|
|
2254
2650
|
anchorEl: anchorRef.current,
|
|
@@ -2263,20 +2659,20 @@ var ComponentIntroduction = ({
|
|
|
2263
2659
|
},
|
|
2264
2660
|
onClose
|
|
2265
2661
|
},
|
|
2266
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ React20.createElement(import_ui14.Box, { sx: { width: "296px" } }, /* @__PURE__ */ React20.createElement(import_editor_ui8.PopoverHeader, { title: (0, import_i18n11.__)("Add your first property", "elementor"), onClose }), /* @__PURE__ */ React20.createElement(
|
|
2267
2663
|
import_ui14.Image,
|
|
2268
2664
|
{
|
|
2269
2665
|
sx: { width: "296px", height: "160px" },
|
|
2270
2666
|
src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
|
|
2271
2667
|
alt: ""
|
|
2272
2668
|
}
|
|
2273
|
-
), /* @__PURE__ */
|
|
2669
|
+
), /* @__PURE__ */ React20.createElement(import_editor_controls4.PopoverContent, null, /* @__PURE__ */ React20.createElement(import_ui14.Stack, { sx: { p: 2 } }, /* @__PURE__ */ React20.createElement(import_ui14.Typography, { variant: "body2" }, (0, import_i18n11.__)("Properties make instances flexible.", "elementor")), /* @__PURE__ */ React20.createElement(import_ui14.Typography, { variant: "body2" }, (0, import_i18n11.__)(
|
|
2274
2670
|
"Select any Element, then in the General tab, click next to any setting you want users to customize - like text, images, or links.",
|
|
2275
2671
|
"elementor"
|
|
2276
|
-
)), /* @__PURE__ */
|
|
2672
|
+
)), /* @__PURE__ */ React20.createElement(import_ui14.Typography, { variant: "body2", sx: { mt: 2 } }, (0, import_i18n11.__)(
|
|
2277
2673
|
"Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
|
|
2278
2674
|
"elementor"
|
|
2279
|
-
)), /* @__PURE__ */
|
|
2675
|
+
)), /* @__PURE__ */ React20.createElement(
|
|
2280
2676
|
import_ui14.Link,
|
|
2281
2677
|
{
|
|
2282
2678
|
href: "http://go.elementor.com/components-guide",
|
|
@@ -2285,28 +2681,28 @@ var ComponentIntroduction = ({
|
|
|
2285
2681
|
color: "info.main",
|
|
2286
2682
|
variant: "body2"
|
|
2287
2683
|
},
|
|
2288
|
-
(0,
|
|
2289
|
-
), /* @__PURE__ */
|
|
2684
|
+
(0, import_i18n11.__)("Learn more", "elementor")
|
|
2685
|
+
), /* @__PURE__ */ React20.createElement(import_ui14.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { pt: 1 } }, /* @__PURE__ */ React20.createElement(import_ui14.Button, { size: "medium", variant: "contained", onClick: onClose }, (0, import_i18n11.__)("Got it", "elementor"))))))
|
|
2290
2686
|
);
|
|
2291
2687
|
};
|
|
2292
2688
|
|
|
2293
2689
|
// src/extended/components/component-properties-panel/component-properties-panel.tsx
|
|
2294
|
-
var
|
|
2690
|
+
var React27 = __toESM(require("react"));
|
|
2295
2691
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
2296
2692
|
var import_editor_panels4 = require("@elementor/editor-panels");
|
|
2297
|
-
var
|
|
2693
|
+
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
2298
2694
|
var import_ui21 = require("@elementor/ui");
|
|
2299
|
-
var
|
|
2695
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
2300
2696
|
|
|
2301
2697
|
// src/extended/components/component-properties-panel/component-properties-panel-content.tsx
|
|
2302
|
-
var
|
|
2303
|
-
var
|
|
2698
|
+
var React26 = __toESM(require("react"));
|
|
2699
|
+
var import_react12 = require("react");
|
|
2304
2700
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
2305
2701
|
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
2306
|
-
var
|
|
2702
|
+
var import_icons14 = require("@elementor/icons");
|
|
2307
2703
|
var import_ui20 = require("@elementor/ui");
|
|
2308
2704
|
var import_utils6 = require("@elementor/utils");
|
|
2309
|
-
var
|
|
2705
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2310
2706
|
|
|
2311
2707
|
// src/extended/store/actions/add-overridable-group.ts
|
|
2312
2708
|
function addOverridableGroup({
|
|
@@ -2347,7 +2743,7 @@ function addOverridableGroup({
|
|
|
2347
2743
|
|
|
2348
2744
|
// src/extended/store/utils/groups-transformers.ts
|
|
2349
2745
|
var import_utils5 = require("@elementor/utils");
|
|
2350
|
-
var
|
|
2746
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2351
2747
|
function removePropFromAllGroups(groups, propKey) {
|
|
2352
2748
|
const propKeys = Array.isArray(propKey) ? propKey : [propKey];
|
|
2353
2749
|
return {
|
|
@@ -2416,7 +2812,7 @@ function resolveOrCreateGroup(groups, requestedGroupId) {
|
|
|
2416
2812
|
}
|
|
2417
2813
|
function createGroup(groups, groupId, label) {
|
|
2418
2814
|
const newGroupId = groupId || (0, import_utils5.generateUniqueId)("group");
|
|
2419
|
-
const newLabel = label || (0,
|
|
2815
|
+
const newLabel = label || (0, import_i18n12.__)("Default", "elementor");
|
|
2420
2816
|
return {
|
|
2421
2817
|
groups: {
|
|
2422
2818
|
...groups,
|
|
@@ -2509,9 +2905,9 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
2509
2905
|
}
|
|
2510
2906
|
|
|
2511
2907
|
// src/extended/utils/revert-overridable-settings.ts
|
|
2512
|
-
var
|
|
2908
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2513
2909
|
function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
|
|
2514
|
-
const container = (0,
|
|
2910
|
+
const container = (0, import_editor_elements9.getContainer)(elementId);
|
|
2515
2911
|
if (!container) {
|
|
2516
2912
|
return;
|
|
2517
2913
|
}
|
|
@@ -2519,14 +2915,14 @@ function revertElementOverridableSetting(elementId, settingKey, originValue, ove
|
|
|
2519
2915
|
revertComponentInstanceOverridableSetting(elementId, overrideKey);
|
|
2520
2916
|
return;
|
|
2521
2917
|
}
|
|
2522
|
-
(0,
|
|
2918
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2523
2919
|
id: elementId,
|
|
2524
2920
|
props: { [settingKey]: originValue ?? null },
|
|
2525
2921
|
withHistory: false
|
|
2526
2922
|
});
|
|
2527
2923
|
}
|
|
2528
2924
|
function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
|
|
2529
|
-
const setting = (0,
|
|
2925
|
+
const setting = (0, import_editor_elements9.getElementSetting)(elementId, "component_instance");
|
|
2530
2926
|
const componentInstance = componentInstancePropTypeUtil.extract(setting);
|
|
2531
2927
|
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
2532
2928
|
if (!overrides?.length) {
|
|
@@ -2537,7 +2933,7 @@ function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
|
|
|
2537
2933
|
...componentInstance,
|
|
2538
2934
|
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
2539
2935
|
});
|
|
2540
|
-
(0,
|
|
2936
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2541
2937
|
id: elementId,
|
|
2542
2938
|
props: { component_instance: updatedSetting },
|
|
2543
2939
|
withHistory: false
|
|
@@ -2602,8 +2998,8 @@ function revertComponentInstanceSettings(settings) {
|
|
|
2602
2998
|
};
|
|
2603
2999
|
}
|
|
2604
3000
|
function revertAllOverridablesInContainer(container) {
|
|
2605
|
-
(0,
|
|
2606
|
-
if (element.model.get("widgetType") ===
|
|
3001
|
+
(0, import_editor_elements9.getAllDescendants)(container).forEach((element) => {
|
|
3002
|
+
if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE2) {
|
|
2607
3003
|
revertComponentInstanceOverridesInElement(element);
|
|
2608
3004
|
} else {
|
|
2609
3005
|
revertElementSettings(element);
|
|
@@ -2622,7 +3018,7 @@ function revertComponentInstanceOverridesInElement(element) {
|
|
|
2622
3018
|
...componentInstance,
|
|
2623
3019
|
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
2624
3020
|
});
|
|
2625
|
-
(0,
|
|
3021
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2626
3022
|
id: element.id,
|
|
2627
3023
|
props: { component_instance: updatedSetting },
|
|
2628
3024
|
withHistory: false
|
|
@@ -2634,7 +3030,7 @@ function revertElementSettings(element) {
|
|
|
2634
3030
|
if (!hasChanges) {
|
|
2635
3031
|
return;
|
|
2636
3032
|
}
|
|
2637
|
-
(0,
|
|
3033
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2638
3034
|
id: element.id,
|
|
2639
3035
|
props: revertedSettings,
|
|
2640
3036
|
withHistory: false
|
|
@@ -2758,14 +3154,14 @@ function updateOverridablePropParams({
|
|
|
2758
3154
|
}
|
|
2759
3155
|
|
|
2760
3156
|
// src/extended/components/component-properties-panel/properties-empty-state.tsx
|
|
2761
|
-
var
|
|
2762
|
-
var
|
|
2763
|
-
var
|
|
3157
|
+
var React21 = __toESM(require("react"));
|
|
3158
|
+
var import_react9 = require("react");
|
|
3159
|
+
var import_icons10 = require("@elementor/icons");
|
|
2764
3160
|
var import_ui15 = require("@elementor/ui");
|
|
2765
|
-
var
|
|
3161
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2766
3162
|
function PropertiesEmptyState({ introductionRef }) {
|
|
2767
|
-
const [isOpen, setIsOpen] = (0,
|
|
2768
|
-
return /* @__PURE__ */
|
|
3163
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
3164
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2769
3165
|
import_ui15.Stack,
|
|
2770
3166
|
{
|
|
2771
3167
|
alignItems: "center",
|
|
@@ -2775,11 +3171,11 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2775
3171
|
sx: { px: 2.5, pt: 10, pb: 5.5 },
|
|
2776
3172
|
gap: 1
|
|
2777
3173
|
},
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
/* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
3174
|
+
/* @__PURE__ */ React21.createElement(import_icons10.ComponentPropListIcon, { fontSize: "large" }),
|
|
3175
|
+
/* @__PURE__ */ React21.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n13.__)("Add your first property", "elementor")),
|
|
3176
|
+
/* @__PURE__ */ React21.createElement(import_ui15.Typography, { align: "center", variant: "caption" }, (0, import_i18n13.__)("Make instances flexible while keeping design synced.", "elementor")),
|
|
3177
|
+
/* @__PURE__ */ React21.createElement(import_ui15.Typography, { align: "center", variant: "caption" }, (0, import_i18n13.__)("Select any element, then click + next to a setting to expose it.", "elementor")),
|
|
3178
|
+
/* @__PURE__ */ React21.createElement(
|
|
2783
3179
|
import_ui15.Link,
|
|
2784
3180
|
{
|
|
2785
3181
|
variant: "caption",
|
|
@@ -2787,9 +3183,9 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2787
3183
|
sx: { textDecorationLine: "underline" },
|
|
2788
3184
|
onClick: () => setIsOpen(true)
|
|
2789
3185
|
},
|
|
2790
|
-
(0,
|
|
3186
|
+
(0, import_i18n13.__)("Learn more", "elementor")
|
|
2791
3187
|
)
|
|
2792
|
-
), /* @__PURE__ */
|
|
3188
|
+
), /* @__PURE__ */ React21.createElement(
|
|
2793
3189
|
ComponentIntroduction,
|
|
2794
3190
|
{
|
|
2795
3191
|
anchorRef: introductionRef,
|
|
@@ -2800,30 +3196,30 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2800
3196
|
}
|
|
2801
3197
|
|
|
2802
3198
|
// src/extended/components/component-properties-panel/properties-group.tsx
|
|
2803
|
-
var
|
|
2804
|
-
var
|
|
2805
|
-
var
|
|
3199
|
+
var React25 = __toESM(require("react"));
|
|
3200
|
+
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
3201
|
+
var import_icons13 = require("@elementor/icons");
|
|
2806
3202
|
var import_ui19 = require("@elementor/ui");
|
|
2807
|
-
var
|
|
3203
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2808
3204
|
|
|
2809
3205
|
// src/extended/components/component-properties-panel/property-item.tsx
|
|
2810
|
-
var
|
|
2811
|
-
var
|
|
2812
|
-
var
|
|
3206
|
+
var React24 = __toESM(require("react"));
|
|
3207
|
+
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
3208
|
+
var import_icons12 = require("@elementor/icons");
|
|
2813
3209
|
var import_ui18 = require("@elementor/ui");
|
|
2814
3210
|
|
|
2815
3211
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2816
|
-
var
|
|
2817
|
-
var
|
|
2818
|
-
var
|
|
3212
|
+
var React22 = __toESM(require("react"));
|
|
3213
|
+
var import_react10 = require("react");
|
|
3214
|
+
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2819
3215
|
var import_ui16 = require("@elementor/ui");
|
|
2820
|
-
var
|
|
3216
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2821
3217
|
|
|
2822
3218
|
// src/extended/components/overridable-props/utils/validate-prop-label.ts
|
|
2823
|
-
var
|
|
3219
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2824
3220
|
var ERROR_MESSAGES = {
|
|
2825
|
-
EMPTY_NAME: (0,
|
|
2826
|
-
DUPLICATE_NAME: (0,
|
|
3221
|
+
EMPTY_NAME: (0, import_i18n14.__)("Property name is required", "elementor"),
|
|
3222
|
+
DUPLICATE_NAME: (0, import_i18n14.__)("Property name already exists", "elementor")
|
|
2827
3223
|
};
|
|
2828
3224
|
function validatePropLabel(label, existingLabels, currentLabel) {
|
|
2829
3225
|
const trimmedLabel = label.trim();
|
|
@@ -2847,17 +3243,17 @@ function validatePropLabel(label, existingLabels, currentLabel) {
|
|
|
2847
3243
|
|
|
2848
3244
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2849
3245
|
var SIZE = "tiny";
|
|
2850
|
-
var DEFAULT_GROUP = { value: null, label: (0,
|
|
3246
|
+
var DEFAULT_GROUP = { value: null, label: (0, import_i18n15.__)("Default", "elementor") };
|
|
2851
3247
|
function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels = [], sx }) {
|
|
2852
3248
|
const selectGroups = groups?.length ? groups : [DEFAULT_GROUP];
|
|
2853
|
-
const [propLabel, setPropLabel] = (0,
|
|
2854
|
-
const [group, setGroup] = (0,
|
|
2855
|
-
const [error, setError] = (0,
|
|
2856
|
-
const name = (0,
|
|
2857
|
-
const groupName = (0,
|
|
3249
|
+
const [propLabel, setPropLabel] = (0, import_react10.useState)(currentValue?.label ?? null);
|
|
3250
|
+
const [group, setGroup] = (0, import_react10.useState)(currentValue?.groupId ?? selectGroups[0]?.value ?? null);
|
|
3251
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
3252
|
+
const name = (0, import_i18n15.__)("Name", "elementor");
|
|
3253
|
+
const groupName = (0, import_i18n15.__)("Group Name", "elementor");
|
|
2858
3254
|
const isCreate = currentValue === void 0;
|
|
2859
|
-
const title = isCreate ? (0,
|
|
2860
|
-
const ctaLabel = isCreate ? (0,
|
|
3255
|
+
const title = isCreate ? (0, import_i18n15.__)("Create new property", "elementor") : (0, import_i18n15.__)("Update property", "elementor");
|
|
3256
|
+
const ctaLabel = isCreate ? (0, import_i18n15.__)("Create", "elementor") : (0, import_i18n15.__)("Update", "elementor");
|
|
2861
3257
|
const handleSubmit = () => {
|
|
2862
3258
|
const validationResult = validatePropLabel(propLabel ?? "", existingLabels, currentValue?.label);
|
|
2863
3259
|
if (!validationResult.isValid) {
|
|
@@ -2866,7 +3262,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2866
3262
|
}
|
|
2867
3263
|
onSubmit({ label: propLabel ?? "", group });
|
|
2868
3264
|
};
|
|
2869
|
-
return /* @__PURE__ */
|
|
3265
|
+
return /* @__PURE__ */ React22.createElement(import_editor_ui9.Form, { onSubmit: handleSubmit, "data-testid": "overridable-prop-form" }, /* @__PURE__ */ React22.createElement(import_ui16.Stack, { alignItems: "start", sx: { width: "268px", ...sx } }, /* @__PURE__ */ React22.createElement(
|
|
2870
3266
|
import_ui16.Stack,
|
|
2871
3267
|
{
|
|
2872
3268
|
direction: "row",
|
|
@@ -2875,14 +3271,14 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2875
3271
|
px: 1.5,
|
|
2876
3272
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%", mb: 1.5 }
|
|
2877
3273
|
},
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
), /* @__PURE__ */
|
|
3274
|
+
/* @__PURE__ */ React22.createElement(import_ui16.Typography, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, title)
|
|
3275
|
+
), /* @__PURE__ */ React22.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React22.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(import_ui16.FormLabel, { size: "tiny" }, name)), /* @__PURE__ */ React22.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
2880
3276
|
import_ui16.TextField,
|
|
2881
3277
|
{
|
|
2882
3278
|
name,
|
|
2883
3279
|
size: SIZE,
|
|
2884
3280
|
fullWidth: true,
|
|
2885
|
-
placeholder: (0,
|
|
3281
|
+
placeholder: (0, import_i18n15.__)("Enter value", "elementor"),
|
|
2886
3282
|
value: propLabel ?? "",
|
|
2887
3283
|
onChange: (e) => {
|
|
2888
3284
|
const newValue = e.target.value;
|
|
@@ -2897,7 +3293,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2897
3293
|
error: Boolean(error),
|
|
2898
3294
|
helperText: error
|
|
2899
3295
|
}
|
|
2900
|
-
))), /* @__PURE__ */
|
|
3296
|
+
))), /* @__PURE__ */ React22.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React22.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(import_ui16.FormLabel, { size: "tiny" }, groupName)), /* @__PURE__ */ React22.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
2901
3297
|
import_ui16.Select,
|
|
2902
3298
|
{
|
|
2903
3299
|
name: groupName,
|
|
@@ -2913,8 +3309,8 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2913
3309
|
return selectGroups.find(({ value }) => value === selectedValue)?.label ?? selectedValue;
|
|
2914
3310
|
}
|
|
2915
3311
|
},
|
|
2916
|
-
selectGroups.map(({ label: groupLabel, ...props }) => /* @__PURE__ */
|
|
2917
|
-
))), /* @__PURE__ */
|
|
3312
|
+
selectGroups.map(({ label: groupLabel, ...props }) => /* @__PURE__ */ React22.createElement(import_editor_ui9.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, groupLabel))
|
|
3313
|
+
))), /* @__PURE__ */ React22.createElement(import_ui16.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", mt: 1.5, py: 1, px: 1.5 }, /* @__PURE__ */ React22.createElement(
|
|
2918
3314
|
import_ui16.Button,
|
|
2919
3315
|
{
|
|
2920
3316
|
type: "submit",
|
|
@@ -2928,11 +3324,11 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2928
3324
|
}
|
|
2929
3325
|
|
|
2930
3326
|
// src/extended/components/component-properties-panel/sortable.tsx
|
|
2931
|
-
var
|
|
2932
|
-
var
|
|
3327
|
+
var React23 = __toESM(require("react"));
|
|
3328
|
+
var import_icons11 = require("@elementor/icons");
|
|
2933
3329
|
var import_ui17 = require("@elementor/ui");
|
|
2934
|
-
var SortableProvider = (props) => /* @__PURE__ */
|
|
2935
|
-
var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */
|
|
3330
|
+
var SortableProvider = (props) => /* @__PURE__ */ React23.createElement(import_ui17.UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
|
|
3331
|
+
var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
2936
3332
|
StyledSortableTrigger,
|
|
2937
3333
|
{
|
|
2938
3334
|
...props,
|
|
@@ -2940,9 +3336,9 @@ var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React2
|
|
|
2940
3336
|
className: `sortable-trigger ${triggerClassName ?? ""}`.trim(),
|
|
2941
3337
|
"aria-label": "sort"
|
|
2942
3338
|
},
|
|
2943
|
-
/* @__PURE__ */
|
|
3339
|
+
/* @__PURE__ */ React23.createElement(import_icons11.GripVerticalIcon, { fontSize: "tiny" })
|
|
2944
3340
|
);
|
|
2945
|
-
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */
|
|
3341
|
+
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React23.createElement(
|
|
2946
3342
|
import_ui17.UnstableSortableItem,
|
|
2947
3343
|
{
|
|
2948
3344
|
id: id2,
|
|
@@ -2956,7 +3352,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2956
3352
|
showDropIndication,
|
|
2957
3353
|
isDragOverlay,
|
|
2958
3354
|
isDragPlaceholder
|
|
2959
|
-
}) => /* @__PURE__ */
|
|
3355
|
+
}) => /* @__PURE__ */ React23.createElement(
|
|
2960
3356
|
import_ui17.Box,
|
|
2961
3357
|
{
|
|
2962
3358
|
...itemProps,
|
|
@@ -2973,7 +3369,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2973
3369
|
triggerProps,
|
|
2974
3370
|
triggerStyle
|
|
2975
3371
|
}),
|
|
2976
|
-
showDropIndication && /* @__PURE__ */
|
|
3372
|
+
showDropIndication && /* @__PURE__ */ React23.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
2977
3373
|
)
|
|
2978
3374
|
}
|
|
2979
3375
|
);
|
|
@@ -3014,7 +3410,7 @@ function PropertyItem({
|
|
|
3014
3410
|
event.stopPropagation();
|
|
3015
3411
|
onDelete(prop.overrideKey);
|
|
3016
3412
|
};
|
|
3017
|
-
return /* @__PURE__ */
|
|
3413
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(
|
|
3018
3414
|
import_ui18.Box,
|
|
3019
3415
|
{
|
|
3020
3416
|
...(0, import_ui18.bindTrigger)(popoverState),
|
|
@@ -3049,17 +3445,17 @@ function PropertyItem({
|
|
|
3049
3445
|
}
|
|
3050
3446
|
}
|
|
3051
3447
|
},
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ React24.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
3449
|
+
/* @__PURE__ */ React24.createElement(
|
|
3054
3450
|
import_ui18.Box,
|
|
3055
3451
|
{
|
|
3056
3452
|
sx: { display: "flex", alignItems: "center", color: "text.primary", fontSize: 12, padding: 0.25 }
|
|
3057
3453
|
},
|
|
3058
|
-
/* @__PURE__ */
|
|
3454
|
+
/* @__PURE__ */ React24.createElement("i", { className: icon })
|
|
3059
3455
|
),
|
|
3060
|
-
/* @__PURE__ */
|
|
3061
|
-
/* @__PURE__ */
|
|
3062
|
-
), /* @__PURE__ */
|
|
3456
|
+
/* @__PURE__ */ React24.createElement(import_ui18.Typography, { variant: "caption", sx: { color: "text.primary", flexGrow: 1, fontSize: 10 } }, prop.label),
|
|
3457
|
+
/* @__PURE__ */ React24.createElement(import_ui18.IconButton, { size: "tiny", onClick: handleDelete, "aria-label": "Delete property", sx: { p: 0.25 } }, /* @__PURE__ */ React24.createElement(import_icons12.XIcon, { fontSize: "tiny" }))
|
|
3458
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3063
3459
|
import_ui18.Popover,
|
|
3064
3460
|
{
|
|
3065
3461
|
...popoverProps,
|
|
@@ -3067,7 +3463,7 @@ function PropertyItem({
|
|
|
3067
3463
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
3068
3464
|
PaperProps: { sx: { width: popoverState.anchorEl?.getBoundingClientRect().width } }
|
|
3069
3465
|
},
|
|
3070
|
-
/* @__PURE__ */
|
|
3466
|
+
/* @__PURE__ */ React24.createElement(
|
|
3071
3467
|
OverridablePropForm,
|
|
3072
3468
|
{
|
|
3073
3469
|
onSubmit: handleSubmit,
|
|
@@ -3081,7 +3477,7 @@ function PropertyItem({
|
|
|
3081
3477
|
}
|
|
3082
3478
|
function getElementIcon(prop) {
|
|
3083
3479
|
const elType = prop.elType === "widget" ? prop.widgetType : prop.elType;
|
|
3084
|
-
const widgetsCache = (0,
|
|
3480
|
+
const widgetsCache = (0, import_editor_elements10.getWidgetsCache)();
|
|
3085
3481
|
if (!widgetsCache) {
|
|
3086
3482
|
return "eicon-apps";
|
|
3087
3483
|
}
|
|
@@ -3118,14 +3514,14 @@ function PropertiesGroup({
|
|
|
3118
3514
|
popupState.close();
|
|
3119
3515
|
onGroupDelete(group.id);
|
|
3120
3516
|
};
|
|
3121
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3122
3518
|
import_ui19.Box,
|
|
3123
3519
|
{
|
|
3124
3520
|
sx: {
|
|
3125
3521
|
opacity: isDragPlaceholder ? 0.5 : 1
|
|
3126
3522
|
}
|
|
3127
3523
|
},
|
|
3128
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ React25.createElement(import_ui19.Stack, { gap: 1 }, /* @__PURE__ */ React25.createElement(
|
|
3129
3525
|
import_ui19.Box,
|
|
3130
3526
|
{
|
|
3131
3527
|
className: "group-header",
|
|
@@ -3145,8 +3541,8 @@ function PropertiesGroup({
|
|
|
3145
3541
|
}
|
|
3146
3542
|
}
|
|
3147
3543
|
},
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3544
|
+
/* @__PURE__ */ React25.createElement(SortableTrigger, { triggerClassName: "group-sortable-trigger", ...sortableTriggerProps }),
|
|
3545
|
+
/* @__PURE__ */ React25.createElement(import_ui19.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, isThisGroupEditing ? /* @__PURE__ */ React25.createElement(
|
|
3150
3546
|
import_ui19.Box,
|
|
3151
3547
|
{
|
|
3152
3548
|
sx: {
|
|
@@ -3164,8 +3560,8 @@ function PropertiesGroup({
|
|
|
3164
3560
|
width: "100%"
|
|
3165
3561
|
}
|
|
3166
3562
|
},
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
|
|
3563
|
+
/* @__PURE__ */ React25.createElement(
|
|
3564
|
+
import_editor_ui10.EditableField,
|
|
3169
3565
|
{
|
|
3170
3566
|
ref: editableRef,
|
|
3171
3567
|
as: import_ui19.Typography,
|
|
@@ -3175,26 +3571,26 @@ function PropertiesGroup({
|
|
|
3175
3571
|
...getEditableProps()
|
|
3176
3572
|
}
|
|
3177
3573
|
)
|
|
3178
|
-
) : /* @__PURE__ */
|
|
3179
|
-
|
|
3574
|
+
) : /* @__PURE__ */ React25.createElement(
|
|
3575
|
+
import_editor_ui10.EllipsisWithTooltip,
|
|
3180
3576
|
{
|
|
3181
3577
|
title: group.label,
|
|
3182
3578
|
as: import_ui19.Typography,
|
|
3183
3579
|
variant: "caption",
|
|
3184
3580
|
sx: { color: "text.primary", fontWeight: 400, lineHeight: 1.66 }
|
|
3185
3581
|
}
|
|
3186
|
-
), /* @__PURE__ */
|
|
3582
|
+
), /* @__PURE__ */ React25.createElement(
|
|
3187
3583
|
import_ui19.IconButton,
|
|
3188
3584
|
{
|
|
3189
3585
|
className: "group-menu",
|
|
3190
3586
|
size: "tiny",
|
|
3191
3587
|
sx: { p: 0.25, visibility: isThisGroupEditing ? "visible" : void 0 },
|
|
3192
|
-
"aria-label": (0,
|
|
3588
|
+
"aria-label": (0, import_i18n16.__)("Group actions", "elementor"),
|
|
3193
3589
|
...(0, import_ui19.bindTrigger)(popupState)
|
|
3194
3590
|
},
|
|
3195
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ React25.createElement(import_icons13.DotsVerticalIcon, { fontSize: "tiny" })
|
|
3196
3592
|
))
|
|
3197
|
-
), /* @__PURE__ */
|
|
3593
|
+
), /* @__PURE__ */ React25.createElement(import_ui19.List, { sx: { p: 0, display: "flex", flexDirection: "column", gap: 1 } }, /* @__PURE__ */ React25.createElement(SortableProvider, { value: group.props, onChange: onPropsReorder }, groupProps.map((prop) => /* @__PURE__ */ React25.createElement(SortableItem, { key: prop.overrideKey, id: prop.overrideKey }, ({ triggerProps, triggerStyle, isDragPlaceholder: isItemDragPlaceholder }) => /* @__PURE__ */ React25.createElement(
|
|
3198
3594
|
PropertyItem,
|
|
3199
3595
|
{
|
|
3200
3596
|
prop,
|
|
@@ -3206,27 +3602,27 @@ function PropertiesGroup({
|
|
|
3206
3602
|
onUpdate: (data) => onPropertyUpdate(prop.overrideKey, data)
|
|
3207
3603
|
}
|
|
3208
3604
|
)))))),
|
|
3209
|
-
/* @__PURE__ */
|
|
3605
|
+
/* @__PURE__ */ React25.createElement(
|
|
3210
3606
|
import_ui19.Menu,
|
|
3211
3607
|
{
|
|
3212
3608
|
...(0, import_ui19.bindMenu)(popupState),
|
|
3213
3609
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
3214
3610
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
3215
3611
|
},
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3612
|
+
/* @__PURE__ */ React25.createElement(import_editor_ui10.MenuListItem, { sx: { minWidth: "160px" }, onClick: handleRenameClick }, /* @__PURE__ */ React25.createElement(import_ui19.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n16.__)("Rename", "elementor"))),
|
|
3613
|
+
/* @__PURE__ */ React25.createElement(
|
|
3218
3614
|
import_ui19.Tooltip,
|
|
3219
3615
|
{
|
|
3220
|
-
title: hasProperties ? (0,
|
|
3616
|
+
title: hasProperties ? (0, import_i18n16.__)("To delete the group, first remove all the properties", "elementor") : "",
|
|
3221
3617
|
placement: "right"
|
|
3222
3618
|
},
|
|
3223
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ React25.createElement("span", null, /* @__PURE__ */ React25.createElement(import_editor_ui10.MenuListItem, { onClick: handleDeleteClick, disabled: hasProperties }, /* @__PURE__ */ React25.createElement(
|
|
3224
3620
|
import_ui19.Typography,
|
|
3225
3621
|
{
|
|
3226
3622
|
variant: "caption",
|
|
3227
3623
|
sx: { color: hasProperties ? "text.disabled" : "error.light" }
|
|
3228
3624
|
},
|
|
3229
|
-
(0,
|
|
3625
|
+
(0, import_i18n16.__)("Delete", "elementor")
|
|
3230
3626
|
)))
|
|
3231
3627
|
)
|
|
3232
3628
|
)
|
|
@@ -3234,10 +3630,10 @@ function PropertiesGroup({
|
|
|
3234
3630
|
}
|
|
3235
3631
|
|
|
3236
3632
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3237
|
-
var
|
|
3633
|
+
var import_react11 = require("react");
|
|
3238
3634
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
3239
|
-
var
|
|
3240
|
-
var
|
|
3635
|
+
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3636
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
3241
3637
|
|
|
3242
3638
|
// src/extended/store/actions/rename-overridable-group.ts
|
|
3243
3639
|
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
@@ -3258,10 +3654,10 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
3258
3654
|
}
|
|
3259
3655
|
|
|
3260
3656
|
// src/extended/components/component-properties-panel/utils/validate-group-label.ts
|
|
3261
|
-
var
|
|
3657
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
3262
3658
|
var ERROR_MESSAGES2 = {
|
|
3263
|
-
EMPTY_NAME: (0,
|
|
3264
|
-
DUPLICATE_NAME: (0,
|
|
3659
|
+
EMPTY_NAME: (0, import_i18n17.__)("Group name is required", "elementor"),
|
|
3660
|
+
DUPLICATE_NAME: (0, import_i18n17.__)("Group name already exists", "elementor")
|
|
3265
3661
|
};
|
|
3266
3662
|
function validateGroupLabel(label, existingGroups) {
|
|
3267
3663
|
const trimmedLabel = label.trim();
|
|
@@ -3277,7 +3673,7 @@ function validateGroupLabel(label, existingGroups) {
|
|
|
3277
3673
|
|
|
3278
3674
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3279
3675
|
function useCurrentEditableItem() {
|
|
3280
|
-
const [editingGroupId, setEditingGroupId] = (0,
|
|
3676
|
+
const [editingGroupId, setEditingGroupId] = (0, import_react11.useState)(null);
|
|
3281
3677
|
const currentComponentId = useCurrentComponentId();
|
|
3282
3678
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
3283
3679
|
const allGroupsRecord = overridableProps?.groups?.items ?? {};
|
|
@@ -3290,7 +3686,7 @@ function useCurrentEditableItem() {
|
|
|
3290
3686
|
};
|
|
3291
3687
|
const handleSubmit = (newLabel) => {
|
|
3292
3688
|
if (!editingGroupId || !currentComponentId) {
|
|
3293
|
-
throw new Error((0,
|
|
3689
|
+
throw new Error((0, import_i18n18.__)("Group ID or component ID is missing", "elementor"));
|
|
3294
3690
|
}
|
|
3295
3691
|
renameOverridableGroup({
|
|
3296
3692
|
componentId: currentComponentId,
|
|
@@ -3305,7 +3701,7 @@ function useCurrentEditableItem() {
|
|
|
3305
3701
|
isEditing,
|
|
3306
3702
|
error,
|
|
3307
3703
|
getProps: getEditableProps
|
|
3308
|
-
} = (0,
|
|
3704
|
+
} = (0, import_editor_ui11.useEditable)({
|
|
3309
3705
|
value: currentGroup?.label ?? "",
|
|
3310
3706
|
onSubmit: handleSubmit,
|
|
3311
3707
|
validation: validateLabel
|
|
@@ -3343,16 +3739,16 @@ function generateUniqueLabel(groups) {
|
|
|
3343
3739
|
function ComponentPropertiesPanelContent({ onClose }) {
|
|
3344
3740
|
const currentComponentId = useCurrentComponentId();
|
|
3345
3741
|
const overridableProps = useSanitizeOverridableProps(currentComponentId);
|
|
3346
|
-
const [isAddingGroup, setIsAddingGroup] = (0,
|
|
3347
|
-
const introductionRef = (0,
|
|
3742
|
+
const [isAddingGroup, setIsAddingGroup] = (0, import_react12.useState)(false);
|
|
3743
|
+
const introductionRef = (0, import_react12.useRef)(null);
|
|
3348
3744
|
const groupLabelEditable = useCurrentEditableItem();
|
|
3349
|
-
const groups = (0,
|
|
3745
|
+
const groups = (0, import_react12.useMemo)(() => {
|
|
3350
3746
|
if (!overridableProps) {
|
|
3351
3747
|
return [];
|
|
3352
3748
|
}
|
|
3353
3749
|
return overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(Boolean);
|
|
3354
3750
|
}, [overridableProps]);
|
|
3355
|
-
const allGroupsForSelect = (0,
|
|
3751
|
+
const allGroupsForSelect = (0, import_react12.useMemo)(
|
|
3356
3752
|
() => groups.map((group) => ({ value: group.id, label: group.label })),
|
|
3357
3753
|
[groups]
|
|
3358
3754
|
);
|
|
@@ -3403,24 +3799,24 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
3403
3799
|
deleteOverridableGroup({ componentId: currentComponentId, groupId });
|
|
3404
3800
|
(0, import_editor_documents7.setDocumentModifiedStatus)(true);
|
|
3405
3801
|
};
|
|
3406
|
-
return /* @__PURE__ */
|
|
3802
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(import_editor_panels3.PanelHeader, { sx: { justifyContent: "start", pl: 1.5, pr: 1, py: 1 } }, /* @__PURE__ */ React26.createElement(import_ui20.Stack, { direction: "row", alignItems: "center", gap: 0.5, flexGrow: 1 }, /* @__PURE__ */ React26.createElement(import_icons14.ComponentPropListIcon, { fontSize: "tiny" }), /* @__PURE__ */ React26.createElement(import_editor_panels3.PanelHeaderTitle, { variant: "subtitle2" }, (0, import_i18n19.__)("Component properties", "elementor"))), !showEmptyState && /* @__PURE__ */ React26.createElement(import_ui20.Tooltip, { title: (0, import_i18n19.__)("Add new group", "elementor") }, /* @__PURE__ */ React26.createElement(
|
|
3407
3803
|
import_ui20.IconButton,
|
|
3408
3804
|
{
|
|
3409
3805
|
size: "tiny",
|
|
3410
|
-
"aria-label": (0,
|
|
3806
|
+
"aria-label": (0, import_i18n19.__)("Add new group", "elementor"),
|
|
3411
3807
|
onClick: handleAddGroupClick
|
|
3412
3808
|
},
|
|
3413
|
-
/* @__PURE__ */
|
|
3414
|
-
)), /* @__PURE__ */
|
|
3809
|
+
/* @__PURE__ */ React26.createElement(import_icons14.FolderPlusIcon, { fontSize: "tiny" })
|
|
3810
|
+
)), /* @__PURE__ */ React26.createElement(import_ui20.Tooltip, { title: (0, import_i18n19.__)("Close panel", "elementor") }, /* @__PURE__ */ React26.createElement(
|
|
3415
3811
|
import_ui20.IconButton,
|
|
3416
3812
|
{
|
|
3417
3813
|
ref: introductionRef,
|
|
3418
3814
|
size: "tiny",
|
|
3419
|
-
"aria-label": (0,
|
|
3815
|
+
"aria-label": (0, import_i18n19.__)("Close panel", "elementor"),
|
|
3420
3816
|
onClick: onClose
|
|
3421
3817
|
},
|
|
3422
|
-
/* @__PURE__ */
|
|
3423
|
-
))), /* @__PURE__ */
|
|
3818
|
+
/* @__PURE__ */ React26.createElement(import_icons14.XIcon, { fontSize: "tiny" })
|
|
3819
|
+
))), /* @__PURE__ */ React26.createElement(import_ui20.Divider, null), /* @__PURE__ */ React26.createElement(import_editor_panels3.PanelBody, null, showEmptyState ? /* @__PURE__ */ React26.createElement(PropertiesEmptyState, { introductionRef }) : /* @__PURE__ */ React26.createElement(import_ui20.List, { sx: { p: 2, display: "flex", flexDirection: "column", gap: 2 } }, /* @__PURE__ */ React26.createElement(SortableProvider, { value: groupIds, onChange: handleGroupsReorder }, groups.map((group) => /* @__PURE__ */ React26.createElement(SortableItem, { key: group.id, id: group.id }, ({ triggerProps, triggerStyle, isDragPlaceholder }) => /* @__PURE__ */ React26.createElement(
|
|
3424
3820
|
PropertiesGroup,
|
|
3425
3821
|
{
|
|
3426
3822
|
group,
|
|
@@ -3448,7 +3844,7 @@ var { panel, usePanelActions } = (0, import_editor_panels4.__createPanel)({
|
|
|
3448
3844
|
function ComponentPropertiesPanel() {
|
|
3449
3845
|
const { close: closePanel } = usePanelActions();
|
|
3450
3846
|
const { open: openEditingPanel } = (0, import_editor_editing_panel5.usePanelActions)();
|
|
3451
|
-
return /* @__PURE__ */
|
|
3847
|
+
return /* @__PURE__ */ React27.createElement(import_editor_ui12.ThemeProvider, null, /* @__PURE__ */ React27.createElement(import_ui21.ErrorBoundary, { fallback: /* @__PURE__ */ React27.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React27.createElement(import_editor_panels4.Panel, null, /* @__PURE__ */ React27.createElement(
|
|
3452
3848
|
ComponentPropertiesPanelContent,
|
|
3453
3849
|
{
|
|
3454
3850
|
onClose: () => {
|
|
@@ -3458,18 +3854,18 @@ function ComponentPropertiesPanel() {
|
|
|
3458
3854
|
}
|
|
3459
3855
|
))));
|
|
3460
3856
|
}
|
|
3461
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
3857
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React27.createElement(import_ui21.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React27.createElement(import_ui21.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React27.createElement("strong", null, (0, import_i18n20.__)("Something went wrong", "elementor"))));
|
|
3462
3858
|
|
|
3463
3859
|
// src/extended/components/component-panel-header/component-badge.tsx
|
|
3464
|
-
var
|
|
3465
|
-
var
|
|
3466
|
-
var
|
|
3860
|
+
var React28 = __toESM(require("react"));
|
|
3861
|
+
var import_react13 = require("react");
|
|
3862
|
+
var import_icons15 = require("@elementor/icons");
|
|
3467
3863
|
var import_ui22 = require("@elementor/ui");
|
|
3468
|
-
var
|
|
3469
|
-
var ComponentsBadge =
|
|
3864
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
3865
|
+
var ComponentsBadge = React28.forwardRef(({ overridablePropsCount, onClick }, ref) => {
|
|
3470
3866
|
const prevCount = usePrevious(overridablePropsCount);
|
|
3471
3867
|
const isFirstExposedProperty = prevCount === 0 && overridablePropsCount === 1;
|
|
3472
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3473
3869
|
StyledBadge,
|
|
3474
3870
|
{
|
|
3475
3871
|
ref,
|
|
@@ -3478,17 +3874,17 @@ var ComponentsBadge = React26.forwardRef(({ overridablePropsCount, onClick }, re
|
|
|
3478
3874
|
invisible: overridablePropsCount === 0,
|
|
3479
3875
|
animate: isFirstExposedProperty,
|
|
3480
3876
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3481
|
-
badgeContent: /* @__PURE__ */
|
|
3877
|
+
badgeContent: /* @__PURE__ */ React28.createElement(import_ui22.Box, { sx: { animation: !isFirstExposedProperty ? `${slideUp} 300ms ease-out` : "none" } }, overridablePropsCount)
|
|
3482
3878
|
},
|
|
3483
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ React28.createElement(import_ui22.Tooltip, { title: (0, import_i18n21.__)("Component properties", "elementor") }, /* @__PURE__ */ React28.createElement(
|
|
3484
3880
|
import_ui22.ToggleButton,
|
|
3485
3881
|
{
|
|
3486
3882
|
value: "exposed properties",
|
|
3487
3883
|
size: "tiny",
|
|
3488
3884
|
onClick,
|
|
3489
|
-
"aria-label": (0,
|
|
3885
|
+
"aria-label": (0, import_i18n21.__)("Component properties", "elementor")
|
|
3490
3886
|
},
|
|
3491
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ React28.createElement(import_icons15.ComponentPropListIcon, { fontSize: "tiny" })
|
|
3492
3888
|
))
|
|
3493
3889
|
);
|
|
3494
3890
|
});
|
|
@@ -3505,8 +3901,8 @@ var StyledBadge = (0, import_ui22.styled)(import_ui22.Badge, { shouldForwardProp
|
|
|
3505
3901
|
})
|
|
3506
3902
|
);
|
|
3507
3903
|
function usePrevious(value) {
|
|
3508
|
-
const ref = (0,
|
|
3509
|
-
(0,
|
|
3904
|
+
const ref = (0, import_react13.useRef)(value);
|
|
3905
|
+
(0, import_react13.useEffect)(() => {
|
|
3510
3906
|
ref.current = value;
|
|
3511
3907
|
}, [value]);
|
|
3512
3908
|
return ref.current;
|
|
@@ -3529,10 +3925,10 @@ var ComponentPanelHeader = () => {
|
|
|
3529
3925
|
const onBack = useNavigateBack();
|
|
3530
3926
|
const componentName = getComponentName();
|
|
3531
3927
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(MESSAGE_KEY);
|
|
3532
|
-
const [shouldShowIntroduction, setShouldShowIntroduction] =
|
|
3928
|
+
const [shouldShowIntroduction, setShouldShowIntroduction] = React29.useState(!isMessageSuppressed);
|
|
3533
3929
|
const { open: openPropertiesPanel } = usePanelActions();
|
|
3534
3930
|
const overridablePropsCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
|
|
3535
|
-
const anchorRef =
|
|
3931
|
+
const anchorRef = React29.useRef(null);
|
|
3536
3932
|
if (!currentComponentId) {
|
|
3537
3933
|
return null;
|
|
3538
3934
|
}
|
|
@@ -3549,22 +3945,22 @@ var ComponentPanelHeader = () => {
|
|
|
3549
3945
|
properties_count: overridablePropsCount
|
|
3550
3946
|
});
|
|
3551
3947
|
};
|
|
3552
|
-
return /* @__PURE__ */
|
|
3553
|
-
|
|
3948
|
+
return /* @__PURE__ */ React29.createElement(import_ui23.Box, { "data-testid": "component-panel-header" }, /* @__PURE__ */ React29.createElement(import_editor_panels5.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React29.createElement(import_ui23.Tooltip, { title: (0, import_i18n22.__)("Back", "elementor") }, /* @__PURE__ */ React29.createElement(import_ui23.IconButton, { size: "tiny", onClick: onBack, "aria-label": (0, import_i18n22.__)("Back", "elementor") }, /* @__PURE__ */ React29.createElement(import_icons16.ArrowLeftIcon, { fontSize: "tiny" }))), /* @__PURE__ */ React29.createElement(import_icons16.ComponentsFilledIcon, { fontSize: "tiny", stroke: "currentColor" }), /* @__PURE__ */ React29.createElement(
|
|
3949
|
+
import_editor_ui13.EllipsisWithTooltip,
|
|
3554
3950
|
{
|
|
3555
3951
|
title: componentName,
|
|
3556
3952
|
as: import_ui23.Typography,
|
|
3557
3953
|
variant: "caption",
|
|
3558
3954
|
sx: { fontWeight: 500, flexGrow: 1 }
|
|
3559
3955
|
}
|
|
3560
|
-
), /* @__PURE__ */
|
|
3956
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3561
3957
|
ComponentsBadge,
|
|
3562
3958
|
{
|
|
3563
3959
|
overridablePropsCount,
|
|
3564
3960
|
ref: anchorRef,
|
|
3565
3961
|
onClick: handleOpenPropertiesPanel
|
|
3566
3962
|
}
|
|
3567
|
-
)), /* @__PURE__ */
|
|
3963
|
+
)), /* @__PURE__ */ React29.createElement(import_ui23.Divider, null), /* @__PURE__ */ React29.createElement(
|
|
3568
3964
|
ComponentIntroduction,
|
|
3569
3965
|
{
|
|
3570
3966
|
anchorRef,
|
|
@@ -3574,7 +3970,7 @@ var ComponentPanelHeader = () => {
|
|
|
3574
3970
|
));
|
|
3575
3971
|
};
|
|
3576
3972
|
function getComponentName() {
|
|
3577
|
-
const state = (0,
|
|
3973
|
+
const state = (0, import_store32.__getState)();
|
|
3578
3974
|
const path = state[SLICE_NAME].path;
|
|
3579
3975
|
const { instanceTitle } = path.at(-1) ?? {};
|
|
3580
3976
|
if (instanceTitle) {
|
|
@@ -3586,39 +3982,39 @@ function getComponentName() {
|
|
|
3586
3982
|
}
|
|
3587
3983
|
|
|
3588
3984
|
// src/extended/components/components-tab/components.tsx
|
|
3589
|
-
var
|
|
3590
|
-
var
|
|
3985
|
+
var React32 = __toESM(require("react"));
|
|
3986
|
+
var import_editor_ui16 = require("@elementor/editor-ui");
|
|
3591
3987
|
var import_ui25 = require("@elementor/ui");
|
|
3592
3988
|
|
|
3593
3989
|
// src/extended/components/components-tab/component-item.tsx
|
|
3594
|
-
var
|
|
3595
|
-
var
|
|
3990
|
+
var React31 = __toESM(require("react"));
|
|
3991
|
+
var import_react14 = require("react");
|
|
3596
3992
|
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
3597
|
-
var
|
|
3598
|
-
var
|
|
3599
|
-
var
|
|
3993
|
+
var import_editor_elements13 = require("@elementor/editor-elements");
|
|
3994
|
+
var import_editor_ui15 = require("@elementor/editor-ui");
|
|
3995
|
+
var import_icons17 = require("@elementor/icons");
|
|
3600
3996
|
var import_ui24 = require("@elementor/ui");
|
|
3601
|
-
var
|
|
3997
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3602
3998
|
|
|
3603
3999
|
// src/extended/store/actions/archive-component.ts
|
|
3604
4000
|
var import_editor_documents9 = require("@elementor/editor-documents");
|
|
3605
|
-
var
|
|
3606
|
-
var
|
|
4001
|
+
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
4002
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3607
4003
|
var successNotification = (componentId, componentName) => ({
|
|
3608
4004
|
type: "success",
|
|
3609
4005
|
/* translators: %s: component name */
|
|
3610
|
-
message: (0,
|
|
4006
|
+
message: (0, import_i18n23.__)("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
3611
4007
|
id: `success-archived-components-notification-${componentId}`
|
|
3612
4008
|
});
|
|
3613
4009
|
var archiveComponent = (componentId, componentName) => {
|
|
3614
4010
|
componentsActions.archive(componentId);
|
|
3615
4011
|
(0, import_editor_documents9.setDocumentModifiedStatus)(true);
|
|
3616
|
-
(0,
|
|
4012
|
+
(0, import_editor_notifications3.notify)(successNotification(componentId, componentName));
|
|
3617
4013
|
};
|
|
3618
4014
|
|
|
3619
4015
|
// src/extended/store/actions/rename-component.ts
|
|
3620
4016
|
var import_editor_documents10 = require("@elementor/editor-documents");
|
|
3621
|
-
var
|
|
4017
|
+
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
3622
4018
|
var TITLE_EXTERNAL_CHANGE_COMMAND = "title_external_change";
|
|
3623
4019
|
var renameComponent = (componentUid, newName) => {
|
|
3624
4020
|
componentsActions.rename(componentUid, newName);
|
|
@@ -3640,25 +4036,25 @@ function getDocumentContainer() {
|
|
|
3640
4036
|
return documentsManager?.getCurrent()?.container;
|
|
3641
4037
|
}
|
|
3642
4038
|
function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
3643
|
-
const allDescendants = (0,
|
|
4039
|
+
const allDescendants = (0, import_editor_elements11.getAllDescendants)(documentContainer);
|
|
3644
4040
|
return allDescendants.filter((element) => {
|
|
3645
4041
|
const widgetType = element.model.get("widgetType");
|
|
3646
4042
|
const editorSettings = element.model.get("editor_settings");
|
|
3647
|
-
const isMatch = widgetType ===
|
|
4043
|
+
const isMatch = widgetType === COMPONENT_WIDGET_TYPE2 && editorSettings?.component_uid === componentUid;
|
|
3648
4044
|
return isMatch;
|
|
3649
4045
|
});
|
|
3650
4046
|
}
|
|
3651
4047
|
|
|
3652
4048
|
// src/extended/utils/component-form-schema.ts
|
|
3653
4049
|
var import_schema5 = require("@elementor/schema");
|
|
3654
|
-
var
|
|
4050
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3655
4051
|
var MIN_NAME_LENGTH = 2;
|
|
3656
4052
|
var MAX_NAME_LENGTH = 50;
|
|
3657
|
-
var baseComponentSchema = import_schema5.z.string().trim().max(MAX_NAME_LENGTH, (0,
|
|
4053
|
+
var baseComponentSchema = import_schema5.z.string().trim().max(MAX_NAME_LENGTH, (0, import_i18n24.__)("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
3658
4054
|
var createBaseComponentSchema = (existingNames) => {
|
|
3659
4055
|
return import_schema5.z.object({
|
|
3660
4056
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
3661
|
-
message: (0,
|
|
4057
|
+
message: (0, import_i18n24.__)("Component name already exists", "elementor")
|
|
3662
4058
|
})
|
|
3663
4059
|
});
|
|
3664
4060
|
};
|
|
@@ -3666,9 +4062,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
3666
4062
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
3667
4063
|
return baseSchema.extend({
|
|
3668
4064
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
3669
|
-
message: (0,
|
|
4065
|
+
message: (0, import_i18n24.__)("Component name is required.", "elementor")
|
|
3670
4066
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
3671
|
-
message: (0,
|
|
4067
|
+
message: (0, import_i18n24.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
3672
4068
|
})
|
|
3673
4069
|
});
|
|
3674
4070
|
};
|
|
@@ -3715,9 +4111,9 @@ var createComponentModel2 = (component) => {
|
|
|
3715
4111
|
};
|
|
3716
4112
|
|
|
3717
4113
|
// src/extended/utils/get-container-for-new-element.ts
|
|
3718
|
-
var
|
|
4114
|
+
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
3719
4115
|
var getContainerForNewElement = () => {
|
|
3720
|
-
const currentDocumentContainer = (0,
|
|
4116
|
+
const currentDocumentContainer = (0, import_editor_elements12.getCurrentDocumentContainer)();
|
|
3721
4117
|
const selectedElement = getSelectedElementContainer();
|
|
3722
4118
|
let container, options;
|
|
3723
4119
|
if (selectedElement) {
|
|
@@ -3743,28 +4139,28 @@ var getContainerForNewElement = () => {
|
|
|
3743
4139
|
return { container: container ?? currentDocumentContainer, options };
|
|
3744
4140
|
};
|
|
3745
4141
|
function getSelectedElementContainer() {
|
|
3746
|
-
const selectedElements = (0,
|
|
4142
|
+
const selectedElements = (0, import_editor_elements12.getSelectedElements)();
|
|
3747
4143
|
if (selectedElements.length !== 1) {
|
|
3748
4144
|
return void 0;
|
|
3749
4145
|
}
|
|
3750
|
-
return (0,
|
|
4146
|
+
return (0, import_editor_elements12.getContainer)(selectedElements[0].id);
|
|
3751
4147
|
}
|
|
3752
4148
|
|
|
3753
4149
|
// src/extended/components/components-tab/delete-confirmation-dialog.tsx
|
|
3754
|
-
var
|
|
3755
|
-
var
|
|
3756
|
-
var
|
|
4150
|
+
var React30 = __toESM(require("react"));
|
|
4151
|
+
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
4152
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3757
4153
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
3758
|
-
return /* @__PURE__ */
|
|
4154
|
+
return /* @__PURE__ */ React30.createElement(import_editor_ui14.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React30.createElement(import_editor_ui14.ConfirmationDialog.Title, null, (0, import_i18n25.__)("Delete this component?", "elementor")), /* @__PURE__ */ React30.createElement(import_editor_ui14.ConfirmationDialog.Content, null, /* @__PURE__ */ React30.createElement(import_editor_ui14.ConfirmationDialog.ContentText, null, (0, import_i18n25.__)(
|
|
3759
4155
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
3760
4156
|
"elementor"
|
|
3761
|
-
))), /* @__PURE__ */
|
|
4157
|
+
))), /* @__PURE__ */ React30.createElement(import_editor_ui14.ConfirmationDialog.Actions, { onClose, onConfirm }));
|
|
3762
4158
|
}
|
|
3763
4159
|
|
|
3764
4160
|
// src/extended/components/components-tab/component-item.tsx
|
|
3765
4161
|
function ComponentItem2({ component }) {
|
|
3766
|
-
const itemRef = (0,
|
|
3767
|
-
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0,
|
|
4162
|
+
const itemRef = (0, import_react14.useRef)(null);
|
|
4163
|
+
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, import_react14.useState)(false);
|
|
3768
4164
|
const { canRename, canDelete } = useComponentsPermissions();
|
|
3769
4165
|
const shouldShowActions = canRename || canDelete;
|
|
3770
4166
|
const {
|
|
@@ -3773,7 +4169,7 @@ function ComponentItem2({ component }) {
|
|
|
3773
4169
|
openEditMode,
|
|
3774
4170
|
error,
|
|
3775
4171
|
getProps: getEditableProps
|
|
3776
|
-
} = (0,
|
|
4172
|
+
} = (0, import_editor_ui15.useEditable)({
|
|
3777
4173
|
value: component.name,
|
|
3778
4174
|
onSubmit: (newName) => renameComponent(component.uid, newName),
|
|
3779
4175
|
validation: validateComponentTitle
|
|
@@ -3804,8 +4200,8 @@ function ComponentItem2({ component }) {
|
|
|
3804
4200
|
const handleDeleteDialogClose = () => {
|
|
3805
4201
|
setIsDeleteDialogOpen(false);
|
|
3806
4202
|
};
|
|
3807
|
-
return /* @__PURE__ */
|
|
3808
|
-
|
|
4203
|
+
return /* @__PURE__ */ React31.createElement(import_ui24.Stack, null, /* @__PURE__ */ React31.createElement(
|
|
4204
|
+
import_editor_ui15.WarningInfotip,
|
|
3809
4205
|
{
|
|
3810
4206
|
open: Boolean(error),
|
|
3811
4207
|
text: error ?? "",
|
|
@@ -3813,7 +4209,7 @@ function ComponentItem2({ component }) {
|
|
|
3813
4209
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
3814
4210
|
offset: [0, -15]
|
|
3815
4211
|
},
|
|
3816
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ React31.createElement(
|
|
3817
4213
|
ComponentItem,
|
|
3818
4214
|
{
|
|
3819
4215
|
ref: itemRef,
|
|
@@ -3825,17 +4221,17 @@ function ComponentItem2({ component }) {
|
|
|
3825
4221
|
onClick: handleClick,
|
|
3826
4222
|
isEditing,
|
|
3827
4223
|
error,
|
|
3828
|
-
nameSlot: /* @__PURE__ */
|
|
4224
|
+
nameSlot: /* @__PURE__ */ React31.createElement(
|
|
3829
4225
|
ComponentName,
|
|
3830
4226
|
{
|
|
3831
4227
|
name: component.name,
|
|
3832
4228
|
editable: { ref: editableRef, isEditing, getProps: getEditableProps }
|
|
3833
4229
|
}
|
|
3834
4230
|
),
|
|
3835
|
-
endSlot: shouldShowActions ? /* @__PURE__ */
|
|
4231
|
+
endSlot: shouldShowActions ? /* @__PURE__ */ React31.createElement(import_ui24.IconButton, { size: "tiny", ...(0, import_ui24.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React31.createElement(import_icons17.DotsVerticalIcon, { fontSize: "tiny" })) : void 0
|
|
3836
4232
|
}
|
|
3837
4233
|
)
|
|
3838
|
-
), shouldShowActions && /* @__PURE__ */
|
|
4234
|
+
), shouldShowActions && /* @__PURE__ */ React31.createElement(
|
|
3839
4235
|
import_ui24.Menu,
|
|
3840
4236
|
{
|
|
3841
4237
|
...(0, import_ui24.bindMenu)(popupState),
|
|
@@ -3848,8 +4244,8 @@ function ComponentItem2({ component }) {
|
|
|
3848
4244
|
horizontal: "right"
|
|
3849
4245
|
}
|
|
3850
4246
|
},
|
|
3851
|
-
canRename && /* @__PURE__ */
|
|
3852
|
-
|
|
4247
|
+
canRename && /* @__PURE__ */ React31.createElement(
|
|
4248
|
+
import_editor_ui15.MenuListItem,
|
|
3853
4249
|
{
|
|
3854
4250
|
sx: { minWidth: "160px" },
|
|
3855
4251
|
primaryTypographyProps: { variant: "caption", color: "text.primary" },
|
|
@@ -3858,18 +4254,18 @@ function ComponentItem2({ component }) {
|
|
|
3858
4254
|
openEditMode();
|
|
3859
4255
|
}
|
|
3860
4256
|
},
|
|
3861
|
-
(0,
|
|
4257
|
+
(0, import_i18n26.__)("Rename", "elementor")
|
|
3862
4258
|
),
|
|
3863
|
-
canDelete && /* @__PURE__ */
|
|
3864
|
-
|
|
4259
|
+
canDelete && /* @__PURE__ */ React31.createElement(
|
|
4260
|
+
import_editor_ui15.MenuListItem,
|
|
3865
4261
|
{
|
|
3866
4262
|
sx: { minWidth: "160px" },
|
|
3867
4263
|
primaryTypographyProps: { variant: "caption", color: "error.light" },
|
|
3868
4264
|
onClick: handleDeleteClick
|
|
3869
4265
|
},
|
|
3870
|
-
(0,
|
|
4266
|
+
(0, import_i18n26.__)("Delete", "elementor")
|
|
3871
4267
|
)
|
|
3872
|
-
), /* @__PURE__ */
|
|
4268
|
+
), /* @__PURE__ */ React31.createElement(
|
|
3873
4269
|
DeleteConfirmationDialog,
|
|
3874
4270
|
{
|
|
3875
4271
|
open: isDeleteDialogOpen,
|
|
@@ -3884,7 +4280,7 @@ var addComponentToPage = (model) => {
|
|
|
3884
4280
|
throw new Error(`Can't find container to drop new component instance at`);
|
|
3885
4281
|
}
|
|
3886
4282
|
loadComponentsAssets([model]);
|
|
3887
|
-
(0,
|
|
4283
|
+
(0, import_editor_elements13.dropElement)({
|
|
3888
4284
|
containerId: container.id,
|
|
3889
4285
|
model,
|
|
3890
4286
|
options: { ...options, useHistory: false, scrollIntoView: true }
|
|
@@ -3902,43 +4298,43 @@ var validateComponentTitle = (newTitle) => {
|
|
|
3902
4298
|
var ExtendedComponentsList = () => {
|
|
3903
4299
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
3904
4300
|
if (isLoading) {
|
|
3905
|
-
return /* @__PURE__ */
|
|
4301
|
+
return /* @__PURE__ */ React32.createElement(LoadingComponents, null);
|
|
3906
4302
|
}
|
|
3907
4303
|
const isEmpty = !components?.length;
|
|
3908
4304
|
if (isEmpty) {
|
|
3909
|
-
return searchValue.length ? /* @__PURE__ */
|
|
4305
|
+
return searchValue.length ? /* @__PURE__ */ React32.createElement(EmptySearchResult, null) : /* @__PURE__ */ React32.createElement(EmptyState, null);
|
|
3910
4306
|
}
|
|
3911
|
-
return /* @__PURE__ */
|
|
4307
|
+
return /* @__PURE__ */ React32.createElement(import_ui25.List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React32.createElement(ComponentItem2, { key: component.uid, component })));
|
|
3912
4308
|
};
|
|
3913
4309
|
var ExtendedComponentsContent = () => {
|
|
3914
4310
|
const { components, isLoading } = useComponents();
|
|
3915
4311
|
const hasComponents = !isLoading && components.length > 0;
|
|
3916
|
-
return /* @__PURE__ */
|
|
4312
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, hasComponents && /* @__PURE__ */ React32.createElement(ComponentSearch, null), /* @__PURE__ */ React32.createElement(ExtendedComponentsList, null));
|
|
3917
4313
|
};
|
|
3918
4314
|
var ExtendedComponents = () => {
|
|
3919
|
-
return /* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ React32.createElement(import_editor_ui16.ThemeProvider, null, /* @__PURE__ */ React32.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React32.createElement(ExtendedComponentsContent, null)));
|
|
3920
4316
|
};
|
|
3921
4317
|
|
|
3922
4318
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
3923
|
-
var
|
|
3924
|
-
var
|
|
3925
|
-
var
|
|
3926
|
-
var
|
|
3927
|
-
var
|
|
3928
|
-
var
|
|
4319
|
+
var React33 = __toESM(require("react"));
|
|
4320
|
+
var import_react16 = require("react");
|
|
4321
|
+
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
4322
|
+
var import_editor_notifications5 = require("@elementor/editor-notifications");
|
|
4323
|
+
var import_editor_ui17 = require("@elementor/editor-ui");
|
|
4324
|
+
var import_icons18 = require("@elementor/icons");
|
|
3929
4325
|
var import_ui26 = require("@elementor/ui");
|
|
3930
|
-
var
|
|
4326
|
+
var import_i18n29 = require("@wordpress/i18n");
|
|
3931
4327
|
|
|
3932
4328
|
// src/extended/store/actions/create-unpublished-component.ts
|
|
3933
|
-
var
|
|
3934
|
-
var
|
|
4329
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
4330
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
3935
4331
|
var import_utils7 = require("@elementor/utils");
|
|
3936
|
-
var
|
|
4332
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
3937
4333
|
|
|
3938
4334
|
// src/extended/utils/replace-element-with-component.ts
|
|
3939
|
-
var
|
|
4335
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
3940
4336
|
var replaceElementWithComponent = (element, component) => {
|
|
3941
|
-
return (0,
|
|
4337
|
+
return (0, import_editor_elements14.replaceElement)({
|
|
3942
4338
|
currentElementId: element.id,
|
|
3943
4339
|
newElement: createComponentModel2(component),
|
|
3944
4340
|
withHistory: false
|
|
@@ -3957,7 +4353,7 @@ async function createUnpublishedComponent({
|
|
|
3957
4353
|
const generatedUid = uid ?? (0, import_utils7.generateUniqueId)("component");
|
|
3958
4354
|
const componentBase = { uid: generatedUid, name };
|
|
3959
4355
|
const elementDataWithOverridablesReverted = revertAllOverridablesInElementData(element);
|
|
3960
|
-
const container = (0,
|
|
4356
|
+
const container = (0, import_editor_elements15.getContainer)(element.id);
|
|
3961
4357
|
const modelFromContainer = container?.model?.toJSON?.();
|
|
3962
4358
|
const originalElement = {
|
|
3963
4359
|
model: modelFromContainer ?? element,
|
|
@@ -3979,7 +4375,7 @@ async function createUnpublishedComponent({
|
|
|
3979
4375
|
...eventData
|
|
3980
4376
|
});
|
|
3981
4377
|
try {
|
|
3982
|
-
await (0,
|
|
4378
|
+
await (0, import_editor_v1_adapters4.__privateRunCommand)("document/save/auto");
|
|
3983
4379
|
} catch (error) {
|
|
3984
4380
|
restoreOriginalElement(originalElement, componentInstance.id);
|
|
3985
4381
|
componentsActions.removeUnpublished(generatedUid);
|
|
@@ -3989,17 +4385,17 @@ async function createUnpublishedComponent({
|
|
|
3989
4385
|
return { uid: generatedUid, instanceId: componentInstance.id };
|
|
3990
4386
|
}
|
|
3991
4387
|
function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
3992
|
-
const componentContainer = (0,
|
|
4388
|
+
const componentContainer = (0, import_editor_elements15.getContainer)(componentInstanceId);
|
|
3993
4389
|
if (componentContainer) {
|
|
3994
|
-
(0,
|
|
4390
|
+
(0, import_editor_elements15.deleteElement)({ container: componentContainer, options: { useHistory: false } });
|
|
3995
4391
|
}
|
|
3996
|
-
const parentContainer = (0,
|
|
4392
|
+
const parentContainer = (0, import_editor_elements15.getContainer)(originalElement.parentId);
|
|
3997
4393
|
if (!parentContainer) {
|
|
3998
4394
|
return;
|
|
3999
4395
|
}
|
|
4000
4396
|
const clonedModel = structuredClone(originalElement.model);
|
|
4001
|
-
(0,
|
|
4002
|
-
title: (0,
|
|
4397
|
+
(0, import_editor_elements15.createElements)({
|
|
4398
|
+
title: (0, import_i18n27.__)("Restore Element", "elementor"),
|
|
4003
4399
|
elements: [
|
|
4004
4400
|
{
|
|
4005
4401
|
container: parentContainer,
|
|
@@ -4012,10 +4408,10 @@ function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
|
4012
4408
|
|
|
4013
4409
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
4014
4410
|
var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
4015
|
-
var
|
|
4016
|
-
var
|
|
4017
|
-
var
|
|
4018
|
-
var
|
|
4411
|
+
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
4412
|
+
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
4413
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
4414
|
+
var import_i18n28 = require("@wordpress/i18n");
|
|
4019
4415
|
|
|
4020
4416
|
// src/extended/utils/is-editing-component.ts
|
|
4021
4417
|
function isEditingComponent() {
|
|
@@ -4025,25 +4421,25 @@ function isEditingComponent() {
|
|
|
4025
4421
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
4026
4422
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
4027
4423
|
type: "default",
|
|
4028
|
-
message: (0,
|
|
4424
|
+
message: (0, import_i18n28.__)("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
4029
4425
|
id: "non-atomic-element-blocked"
|
|
4030
4426
|
};
|
|
4031
4427
|
function initNonAtomicNestingPrevention() {
|
|
4032
|
-
(0,
|
|
4428
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
4033
4429
|
command: "document/elements/create",
|
|
4034
4430
|
condition: blockNonAtomicCreate
|
|
4035
4431
|
});
|
|
4036
|
-
(0,
|
|
4432
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
4037
4433
|
command: "document/elements/move",
|
|
4038
4434
|
condition: blockNonAtomicMove
|
|
4039
4435
|
});
|
|
4040
|
-
(0,
|
|
4436
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
4041
4437
|
command: "document/elements/paste",
|
|
4042
4438
|
condition: blockNonAtomicPaste
|
|
4043
4439
|
});
|
|
4044
4440
|
}
|
|
4045
4441
|
function isElementAtomic(elementType) {
|
|
4046
|
-
return (0,
|
|
4442
|
+
return (0, import_editor_elements16.getElementType)(elementType) !== null;
|
|
4047
4443
|
}
|
|
4048
4444
|
function blockNonAtomicCreate(args) {
|
|
4049
4445
|
if (!isEditingComponent()) {
|
|
@@ -4057,7 +4453,7 @@ function blockNonAtomicCreate(args) {
|
|
|
4057
4453
|
if (isElementAtomic(elementType)) {
|
|
4058
4454
|
return false;
|
|
4059
4455
|
}
|
|
4060
|
-
(0,
|
|
4456
|
+
(0, import_editor_notifications4.notify)(NON_ATOMIC_ELEMENT_ALERT);
|
|
4061
4457
|
return true;
|
|
4062
4458
|
}
|
|
4063
4459
|
function blockNonAtomicMove(args) {
|
|
@@ -4069,11 +4465,11 @@ function blockNonAtomicMove(args) {
|
|
|
4069
4465
|
if (!container) {
|
|
4070
4466
|
return false;
|
|
4071
4467
|
}
|
|
4072
|
-
const allElements = (0,
|
|
4468
|
+
const allElements = (0, import_editor_elements16.getAllDescendants)(container);
|
|
4073
4469
|
return allElements.some((element) => !(0, import_editor_canvas6.isAtomicWidget)(element));
|
|
4074
4470
|
});
|
|
4075
4471
|
if (hasNonAtomicElement) {
|
|
4076
|
-
(0,
|
|
4472
|
+
(0, import_editor_notifications4.notify)(NON_ATOMIC_ELEMENT_ALERT);
|
|
4077
4473
|
}
|
|
4078
4474
|
return hasNonAtomicElement;
|
|
4079
4475
|
}
|
|
@@ -4091,7 +4487,7 @@ function blockNonAtomicPaste(args) {
|
|
|
4091
4487
|
}
|
|
4092
4488
|
const hasNonAtomicElement = hasNonAtomicElementsInTree(data.clipboard.elements);
|
|
4093
4489
|
if (hasNonAtomicElement) {
|
|
4094
|
-
(0,
|
|
4490
|
+
(0, import_editor_notifications4.notify)(NON_ATOMIC_ELEMENT_ALERT);
|
|
4095
4491
|
}
|
|
4096
4492
|
return hasNonAtomicElement;
|
|
4097
4493
|
}
|
|
@@ -4124,11 +4520,11 @@ function findNonAtomicElementsInElement(element) {
|
|
|
4124
4520
|
}
|
|
4125
4521
|
|
|
4126
4522
|
// src/extended/components/create-component-form/hooks/use-form.ts
|
|
4127
|
-
var
|
|
4523
|
+
var import_react15 = require("react");
|
|
4128
4524
|
var useForm = (initialValues) => {
|
|
4129
|
-
const [values, setValues] = (0,
|
|
4130
|
-
const [errors, setErrors] = (0,
|
|
4131
|
-
const isValid = (0,
|
|
4525
|
+
const [values, setValues] = (0, import_react15.useState)(initialValues);
|
|
4526
|
+
const [errors, setErrors] = (0, import_react15.useState)({});
|
|
4527
|
+
const isValid = (0, import_react15.useMemo)(() => {
|
|
4132
4528
|
return !Object.values(errors).some((error) => error);
|
|
4133
4529
|
}, [errors]);
|
|
4134
4530
|
const handleChange = (e, field, validationSchema) => {
|
|
@@ -4204,19 +4600,19 @@ function countNestedElements(container) {
|
|
|
4204
4600
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
4205
4601
|
var MAX_COMPONENTS = 100;
|
|
4206
4602
|
function CreateComponentForm() {
|
|
4207
|
-
const [element, setElement] = (0,
|
|
4208
|
-
const [anchorPosition, setAnchorPosition] = (0,
|
|
4603
|
+
const [element, setElement] = (0, import_react16.useState)(null);
|
|
4604
|
+
const [anchorPosition, setAnchorPosition] = (0, import_react16.useState)();
|
|
4209
4605
|
const { components } = useComponents();
|
|
4210
|
-
const eventData = (0,
|
|
4211
|
-
(0,
|
|
4606
|
+
const eventData = (0, import_react16.useRef)(null);
|
|
4607
|
+
(0, import_react16.useEffect)(() => {
|
|
4212
4608
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT2 = "elementor/editor/open-save-as-component-form";
|
|
4213
4609
|
const openPopup = (event) => {
|
|
4214
4610
|
const { shouldOpen, notification } = shouldOpenForm(event.detail.element, components?.length ?? 0);
|
|
4215
4611
|
if (!shouldOpen) {
|
|
4216
|
-
(0,
|
|
4612
|
+
(0, import_editor_notifications5.notify)(notification);
|
|
4217
4613
|
return;
|
|
4218
4614
|
}
|
|
4219
|
-
setElement({ element: event.detail.element, elementLabel: (0,
|
|
4615
|
+
setElement({ element: event.detail.element, elementLabel: (0, import_editor_elements17.getElementLabel)(event.detail.element.id) });
|
|
4220
4616
|
setAnchorPosition(event.detail.anchorPosition);
|
|
4221
4617
|
eventData.current = getComponentEventData(event.detail.element, event.detail.options);
|
|
4222
4618
|
trackComponentEvent({
|
|
@@ -4247,15 +4643,15 @@ function CreateComponentForm() {
|
|
|
4247
4643
|
} else {
|
|
4248
4644
|
throw new Error("Failed to find published component");
|
|
4249
4645
|
}
|
|
4250
|
-
(0,
|
|
4646
|
+
(0, import_editor_notifications5.notify)({
|
|
4251
4647
|
type: "success",
|
|
4252
|
-
message: (0,
|
|
4648
|
+
message: (0, import_i18n29.__)("Component created successfully.", "elementor"),
|
|
4253
4649
|
id: `component-saved-successfully-${uid}`
|
|
4254
4650
|
});
|
|
4255
4651
|
resetAndClosePopup();
|
|
4256
4652
|
} catch {
|
|
4257
|
-
const errorMessage = (0,
|
|
4258
|
-
(0,
|
|
4653
|
+
const errorMessage = (0, import_i18n29.__)("Failed to create component. Please try again.", "elementor");
|
|
4654
|
+
(0, import_editor_notifications5.notify)({
|
|
4259
4655
|
type: "error",
|
|
4260
4656
|
message: errorMessage,
|
|
4261
4657
|
id: "component-save-failed"
|
|
@@ -4275,7 +4671,7 @@ function CreateComponentForm() {
|
|
|
4275
4671
|
...eventData.current
|
|
4276
4672
|
});
|
|
4277
4673
|
};
|
|
4278
|
-
return /* @__PURE__ */
|
|
4674
|
+
return /* @__PURE__ */ React33.createElement(import_editor_ui17.ThemeProvider, null, /* @__PURE__ */ React33.createElement(
|
|
4279
4675
|
import_ui26.Popover,
|
|
4280
4676
|
{
|
|
4281
4677
|
open: element !== null,
|
|
@@ -4284,7 +4680,7 @@ function CreateComponentForm() {
|
|
|
4284
4680
|
anchorPosition,
|
|
4285
4681
|
"data-testid": "create-component-form"
|
|
4286
4682
|
},
|
|
4287
|
-
element !== null && /* @__PURE__ */
|
|
4683
|
+
element !== null && /* @__PURE__ */ React33.createElement(
|
|
4288
4684
|
Form2,
|
|
4289
4685
|
{
|
|
4290
4686
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -4301,7 +4697,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4301
4697
|
shouldOpen: false,
|
|
4302
4698
|
notification: {
|
|
4303
4699
|
type: "default",
|
|
4304
|
-
message: (0,
|
|
4700
|
+
message: (0, import_i18n29.__)(
|
|
4305
4701
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
4306
4702
|
"elementor"
|
|
4307
4703
|
),
|
|
@@ -4315,7 +4711,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4315
4711
|
notification: {
|
|
4316
4712
|
type: "default",
|
|
4317
4713
|
/* translators: %s is the maximum number of components */
|
|
4318
|
-
message: (0,
|
|
4714
|
+
message: (0, import_i18n29.__)(
|
|
4319
4715
|
`You've reached the limit of %s components. Please remove an existing one to create a new component.`,
|
|
4320
4716
|
"elementor"
|
|
4321
4717
|
).replace("%s", MAX_COMPONENTS.toString()),
|
|
@@ -4332,16 +4728,16 @@ var Form2 = ({
|
|
|
4332
4728
|
closePopup
|
|
4333
4729
|
}) => {
|
|
4334
4730
|
const { values, errors, isValid, handleChange, validateForm: validateForm2 } = useForm(initialValues);
|
|
4335
|
-
const nameInputRef = (0,
|
|
4731
|
+
const nameInputRef = (0, import_editor_ui17.useTextFieldAutoSelect)();
|
|
4336
4732
|
const { components } = useComponents();
|
|
4337
|
-
const existingComponentNames = (0,
|
|
4733
|
+
const existingComponentNames = (0, import_react16.useMemo)(() => {
|
|
4338
4734
|
return components?.map((component) => component.name) ?? [];
|
|
4339
4735
|
}, [components]);
|
|
4340
|
-
const changeValidationSchema = (0,
|
|
4736
|
+
const changeValidationSchema = (0, import_react16.useMemo)(
|
|
4341
4737
|
() => createBaseComponentSchema(existingComponentNames),
|
|
4342
4738
|
[existingComponentNames]
|
|
4343
4739
|
);
|
|
4344
|
-
const submitValidationSchema = (0,
|
|
4740
|
+
const submitValidationSchema = (0, import_react16.useMemo)(
|
|
4345
4741
|
() => createSubmitComponentSchema(existingComponentNames),
|
|
4346
4742
|
[existingComponentNames]
|
|
4347
4743
|
);
|
|
@@ -4352,13 +4748,13 @@ var Form2 = ({
|
|
|
4352
4748
|
}
|
|
4353
4749
|
};
|
|
4354
4750
|
const texts = {
|
|
4355
|
-
heading: (0,
|
|
4356
|
-
name: (0,
|
|
4357
|
-
cancel: (0,
|
|
4358
|
-
create: (0,
|
|
4751
|
+
heading: (0, import_i18n29.__)("Create component", "elementor"),
|
|
4752
|
+
name: (0, import_i18n29.__)("Name", "elementor"),
|
|
4753
|
+
cancel: (0, import_i18n29.__)("Cancel", "elementor"),
|
|
4754
|
+
create: (0, import_i18n29.__)("Create", "elementor")
|
|
4359
4755
|
};
|
|
4360
4756
|
const nameInputId = "component-name";
|
|
4361
|
-
return /* @__PURE__ */
|
|
4757
|
+
return /* @__PURE__ */ React33.createElement(import_editor_ui17.Form, { onSubmit: handleSubmit }, /* @__PURE__ */ React33.createElement(import_ui26.Stack, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React33.createElement(
|
|
4362
4758
|
import_ui26.Stack,
|
|
4363
4759
|
{
|
|
4364
4760
|
direction: "row",
|
|
@@ -4367,9 +4763,9 @@ var Form2 = ({
|
|
|
4367
4763
|
px: 1.5,
|
|
4368
4764
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
4369
4765
|
},
|
|
4370
|
-
/* @__PURE__ */
|
|
4371
|
-
/* @__PURE__ */
|
|
4372
|
-
), /* @__PURE__ */
|
|
4766
|
+
/* @__PURE__ */ React33.createElement(import_icons18.ComponentsIcon, { fontSize: FONT_SIZE }),
|
|
4767
|
+
/* @__PURE__ */ React33.createElement(import_ui26.Typography, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, texts.heading)
|
|
4768
|
+
), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { container: true, gap: 0.75, alignItems: "start", p: 1.5 }, /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(import_ui26.FormLabel, { htmlFor: nameInputId, size: "tiny" }, texts.name)), /* @__PURE__ */ React33.createElement(import_ui26.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(
|
|
4373
4769
|
import_ui26.TextField,
|
|
4374
4770
|
{
|
|
4375
4771
|
id: nameInputId,
|
|
@@ -4382,15 +4778,15 @@ var Form2 = ({
|
|
|
4382
4778
|
helperText: errors.componentName,
|
|
4383
4779
|
inputRef: nameInputRef
|
|
4384
4780
|
}
|
|
4385
|
-
))), /* @__PURE__ */
|
|
4781
|
+
))), /* @__PURE__ */ React33.createElement(import_ui26.Stack, { direction: "row", justifyContent: "flex-end", alignSelf: "end", py: 1, px: 1.5 }, /* @__PURE__ */ React33.createElement(import_ui26.Button, { onClick: closePopup, color: "secondary", variant: "text", size: "small" }, texts.cancel), /* @__PURE__ */ React33.createElement(import_ui26.Button, { type: "submit", disabled: !isValid, variant: "contained", color: "primary", size: "small" }, texts.create))));
|
|
4386
4782
|
};
|
|
4387
4783
|
|
|
4388
4784
|
// src/extended/components/edit-component/edit-component.tsx
|
|
4389
|
-
var
|
|
4390
|
-
var
|
|
4785
|
+
var React35 = __toESM(require("react"));
|
|
4786
|
+
var import_react19 = require("react");
|
|
4391
4787
|
var import_editor_documents11 = require("@elementor/editor-documents");
|
|
4392
|
-
var
|
|
4393
|
-
var
|
|
4788
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
4789
|
+
var import_store34 = require("@elementor/store");
|
|
4394
4790
|
var import_utils9 = require("@elementor/utils");
|
|
4395
4791
|
|
|
4396
4792
|
// src/extended/consts.ts
|
|
@@ -4409,22 +4805,22 @@ function updateCurrentComponent(params) {
|
|
|
4409
4805
|
}
|
|
4410
4806
|
|
|
4411
4807
|
// src/extended/components/edit-component/component-modal.tsx
|
|
4412
|
-
var
|
|
4413
|
-
var
|
|
4808
|
+
var React34 = __toESM(require("react"));
|
|
4809
|
+
var import_react18 = require("react");
|
|
4414
4810
|
var import_react_dom = require("react-dom");
|
|
4415
|
-
var
|
|
4811
|
+
var import_i18n30 = require("@wordpress/i18n");
|
|
4416
4812
|
|
|
4417
4813
|
// src/extended/components/edit-component/use-canvas-document.ts
|
|
4418
|
-
var
|
|
4814
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
4419
4815
|
function useCanvasDocument() {
|
|
4420
|
-
return (0,
|
|
4816
|
+
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters6.getCanvasIframeDocument)());
|
|
4421
4817
|
}
|
|
4422
4818
|
|
|
4423
4819
|
// src/extended/components/edit-component/use-element-rect.ts
|
|
4424
|
-
var
|
|
4820
|
+
var import_react17 = require("react");
|
|
4425
4821
|
var import_utils8 = require("@elementor/utils");
|
|
4426
4822
|
function useElementRect(element) {
|
|
4427
|
-
const [rect, setRect] = (0,
|
|
4823
|
+
const [rect, setRect] = (0, import_react17.useState)(new DOMRect(0, 0, 0, 0));
|
|
4428
4824
|
const onChange = (0, import_utils8.throttle)(
|
|
4429
4825
|
() => {
|
|
4430
4826
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -4435,7 +4831,7 @@ function useElementRect(element) {
|
|
|
4435
4831
|
useScrollListener({ element, onChange });
|
|
4436
4832
|
useResizeListener({ element, onChange });
|
|
4437
4833
|
useMutationsListener({ element, onChange });
|
|
4438
|
-
(0,
|
|
4834
|
+
(0, import_react17.useEffect)(
|
|
4439
4835
|
() => () => {
|
|
4440
4836
|
onChange.cancel();
|
|
4441
4837
|
},
|
|
@@ -4444,7 +4840,7 @@ function useElementRect(element) {
|
|
|
4444
4840
|
return rect;
|
|
4445
4841
|
}
|
|
4446
4842
|
function useScrollListener({ element, onChange }) {
|
|
4447
|
-
(0,
|
|
4843
|
+
(0, import_react17.useEffect)(() => {
|
|
4448
4844
|
if (!element) {
|
|
4449
4845
|
return;
|
|
4450
4846
|
}
|
|
@@ -4456,7 +4852,7 @@ function useScrollListener({ element, onChange }) {
|
|
|
4456
4852
|
}, [element, onChange]);
|
|
4457
4853
|
}
|
|
4458
4854
|
function useResizeListener({ element, onChange }) {
|
|
4459
|
-
(0,
|
|
4855
|
+
(0, import_react17.useEffect)(() => {
|
|
4460
4856
|
if (!element) {
|
|
4461
4857
|
return;
|
|
4462
4858
|
}
|
|
@@ -4471,7 +4867,7 @@ function useResizeListener({ element, onChange }) {
|
|
|
4471
4867
|
}, [element, onChange]);
|
|
4472
4868
|
}
|
|
4473
4869
|
function useMutationsListener({ element, onChange }) {
|
|
4474
|
-
(0,
|
|
4870
|
+
(0, import_react17.useEffect)(() => {
|
|
4475
4871
|
if (!element) {
|
|
4476
4872
|
return;
|
|
4477
4873
|
}
|
|
@@ -4486,7 +4882,7 @@ function useMutationsListener({ element, onChange }) {
|
|
|
4486
4882
|
// src/extended/components/edit-component/component-modal.tsx
|
|
4487
4883
|
function ComponentModal({ topLevelElementDom, onClose }) {
|
|
4488
4884
|
const canvasDocument = useCanvasDocument();
|
|
4489
|
-
(0,
|
|
4885
|
+
(0, import_react18.useEffect)(() => {
|
|
4490
4886
|
const handleEsc = (event) => {
|
|
4491
4887
|
if (event.key === "Escape") {
|
|
4492
4888
|
onClose();
|
|
@@ -4501,7 +4897,7 @@ function ComponentModal({ topLevelElementDom, onClose }) {
|
|
|
4501
4897
|
return null;
|
|
4502
4898
|
}
|
|
4503
4899
|
return (0, import_react_dom.createPortal)(
|
|
4504
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(BlockEditPage, null), /* @__PURE__ */ React34.createElement(Backdrop, { canvas: canvasDocument, element: topLevelElementDom, onClose })),
|
|
4505
4901
|
canvasDocument.body
|
|
4506
4902
|
);
|
|
4507
4903
|
}
|
|
@@ -4530,7 +4926,7 @@ function Backdrop({
|
|
|
4530
4926
|
onClose();
|
|
4531
4927
|
}
|
|
4532
4928
|
};
|
|
4533
|
-
return /* @__PURE__ */
|
|
4929
|
+
return /* @__PURE__ */ React34.createElement(
|
|
4534
4930
|
"div",
|
|
4535
4931
|
{
|
|
4536
4932
|
style: backdropStyle,
|
|
@@ -4538,7 +4934,7 @@ function Backdrop({
|
|
|
4538
4934
|
onKeyDown: handleKeyDown,
|
|
4539
4935
|
role: "button",
|
|
4540
4936
|
tabIndex: 0,
|
|
4541
|
-
"aria-label": (0,
|
|
4937
|
+
"aria-label": (0, import_i18n30.__)("Exit component editing mode", "elementor")
|
|
4542
4938
|
}
|
|
4543
4939
|
);
|
|
4544
4940
|
}
|
|
@@ -4578,7 +4974,7 @@ function BlockEditPage() {
|
|
|
4578
4974
|
}
|
|
4579
4975
|
}
|
|
4580
4976
|
`;
|
|
4581
|
-
return /* @__PURE__ */
|
|
4977
|
+
return /* @__PURE__ */ React34.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
4582
4978
|
}
|
|
4583
4979
|
|
|
4584
4980
|
// src/extended/components/edit-component/edit-component.tsx
|
|
@@ -4591,14 +4987,14 @@ function EditComponent() {
|
|
|
4591
4987
|
if (!currentComponentId) {
|
|
4592
4988
|
return null;
|
|
4593
4989
|
}
|
|
4594
|
-
return /* @__PURE__ */
|
|
4990
|
+
return /* @__PURE__ */ React35.createElement(ComponentModal, { topLevelElementDom, onClose });
|
|
4595
4991
|
}
|
|
4596
4992
|
function useHandleDocumentSwitches() {
|
|
4597
4993
|
const documentsManager = (0, import_editor_documents11.getV1DocumentsManager)();
|
|
4598
4994
|
const currentComponentId = useCurrentComponentId();
|
|
4599
|
-
const path = (0,
|
|
4600
|
-
(0,
|
|
4601
|
-
return (0,
|
|
4995
|
+
const path = (0, import_store34.__useSelector)(selectPath);
|
|
4996
|
+
(0, import_react19.useEffect)(() => {
|
|
4997
|
+
return (0, import_editor_v1_adapters7.__privateListenTo)((0, import_editor_v1_adapters7.commandEndEvent)("editor/documents/open"), () => {
|
|
4602
4998
|
const nextDocument = documentsManager.getCurrent();
|
|
4603
4999
|
if (nextDocument.id === currentComponentId) {
|
|
4604
5000
|
return;
|
|
@@ -4651,11 +5047,11 @@ function getInstanceTitle(instanceId, path) {
|
|
|
4651
5047
|
}
|
|
4652
5048
|
function useComponentDOMElement(id2) {
|
|
4653
5049
|
const { componentContainerDomElement, topLevelElementDom } = getComponentDOMElements(id2);
|
|
4654
|
-
const [currentElementDom, setCurrentElementDom] = (0,
|
|
4655
|
-
(0,
|
|
5050
|
+
const [currentElementDom, setCurrentElementDom] = (0, import_react19.useState)(topLevelElementDom);
|
|
5051
|
+
(0, import_react19.useEffect)(() => {
|
|
4656
5052
|
setCurrentElementDom(topLevelElementDom);
|
|
4657
5053
|
}, [topLevelElementDom]);
|
|
4658
|
-
(0,
|
|
5054
|
+
(0, import_react19.useEffect)(() => {
|
|
4659
5055
|
if (!componentContainerDomElement) {
|
|
4660
5056
|
return;
|
|
4661
5057
|
}
|
|
@@ -4683,10 +5079,10 @@ function getComponentDOMElements(id2) {
|
|
|
4683
5079
|
}
|
|
4684
5080
|
|
|
4685
5081
|
// src/extended/components/instance-editing-panel/instance-editing-panel.tsx
|
|
4686
|
-
var
|
|
4687
|
-
var
|
|
5082
|
+
var React36 = __toESM(require("react"));
|
|
5083
|
+
var import_icons19 = require("@elementor/icons");
|
|
4688
5084
|
var import_ui27 = require("@elementor/ui");
|
|
4689
|
-
var
|
|
5085
|
+
var import_i18n31 = require("@wordpress/i18n");
|
|
4690
5086
|
function ExtendedInstanceEditingPanel() {
|
|
4691
5087
|
const { canEdit } = useComponentsPermissions();
|
|
4692
5088
|
const data = useInstancePanelData();
|
|
@@ -4694,35 +5090,35 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4694
5090
|
return null;
|
|
4695
5091
|
}
|
|
4696
5092
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
4697
|
-
const panelTitle = (0,
|
|
5093
|
+
const panelTitle = (0, import_i18n31.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
4698
5094
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
4699
|
-
return /* @__PURE__ */
|
|
5095
|
+
return /* @__PURE__ */ React36.createElement(import_ui27.Box, { "data-testid": "instance-editing-panel" }, /* @__PURE__ */ React36.createElement(
|
|
4700
5096
|
ComponentInstanceProvider,
|
|
4701
5097
|
{
|
|
4702
5098
|
componentId,
|
|
4703
5099
|
overrides,
|
|
4704
5100
|
overridableProps
|
|
4705
5101
|
},
|
|
4706
|
-
/* @__PURE__ */
|
|
5102
|
+
/* @__PURE__ */ React36.createElement(
|
|
4707
5103
|
InstancePanelHeader,
|
|
4708
5104
|
{
|
|
4709
5105
|
componentName: component.name,
|
|
4710
|
-
actions: canEdit ? /* @__PURE__ */
|
|
5106
|
+
actions: canEdit ? /* @__PURE__ */ React36.createElement(
|
|
4711
5107
|
EditComponentAction,
|
|
4712
5108
|
{
|
|
4713
5109
|
label: panelTitle,
|
|
4714
5110
|
onClick: handleEditComponent,
|
|
4715
|
-
icon:
|
|
5111
|
+
icon: import_icons19.PencilIcon
|
|
4716
5112
|
}
|
|
4717
5113
|
) : void 0
|
|
4718
5114
|
}
|
|
4719
5115
|
),
|
|
4720
|
-
/* @__PURE__ */
|
|
5116
|
+
/* @__PURE__ */ React36.createElement(
|
|
4721
5117
|
InstancePanelBody,
|
|
4722
5118
|
{
|
|
4723
5119
|
groups,
|
|
4724
5120
|
isEmpty,
|
|
4725
|
-
emptyState: /* @__PURE__ */
|
|
5121
|
+
emptyState: /* @__PURE__ */ React36.createElement(EmptyState2, { onEditComponent: canEdit ? handleEditComponent : void 0 }),
|
|
4726
5122
|
componentInstanceId
|
|
4727
5123
|
}
|
|
4728
5124
|
)
|
|
@@ -4730,7 +5126,7 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4730
5126
|
}
|
|
4731
5127
|
|
|
4732
5128
|
// src/extended/components/overridable-props/overridable-prop-control.tsx
|
|
4733
|
-
var
|
|
5129
|
+
var React37 = __toESM(require("react"));
|
|
4734
5130
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
4735
5131
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
4736
5132
|
function OverridablePropControl({
|
|
@@ -4775,7 +5171,7 @@ function OverridablePropControl({
|
|
|
4775
5171
|
});
|
|
4776
5172
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
4777
5173
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
4778
|
-
return /* @__PURE__ */
|
|
5174
|
+
return /* @__PURE__ */ React37.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React37.createElement(
|
|
4779
5175
|
import_editor_controls5.PropProvider,
|
|
4780
5176
|
{
|
|
4781
5177
|
...propContext,
|
|
@@ -4786,7 +5182,7 @@ function OverridablePropControl({
|
|
|
4786
5182
|
},
|
|
4787
5183
|
placeholder: objectPlaceholder
|
|
4788
5184
|
},
|
|
4789
|
-
/* @__PURE__ */
|
|
5185
|
+
/* @__PURE__ */ React37.createElement(import_editor_controls5.PropKeyProvider, { bind }, /* @__PURE__ */ React37.createElement(import_editor_controls5.ControlReplacementsProvider, { replacements: filteredReplacements }, /* @__PURE__ */ React37.createElement(ControlWithReplacements, { OriginalControl: OriginalControl2, props })))
|
|
4790
5186
|
));
|
|
4791
5187
|
}
|
|
4792
5188
|
function ControlWithReplacements({
|
|
@@ -4796,18 +5192,18 @@ function ControlWithReplacements({
|
|
|
4796
5192
|
const { ControlToRender, isReplaced } = (0, import_editor_controls5.useControlReplacement)(OriginalControl2);
|
|
4797
5193
|
if (isReplaced) {
|
|
4798
5194
|
const ReplacementControl = ControlToRender;
|
|
4799
|
-
return /* @__PURE__ */
|
|
5195
|
+
return /* @__PURE__ */ React37.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
|
|
4800
5196
|
}
|
|
4801
|
-
return /* @__PURE__ */
|
|
5197
|
+
return /* @__PURE__ */ React37.createElement(OriginalControl2, { ...props });
|
|
4802
5198
|
}
|
|
4803
5199
|
|
|
4804
5200
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
4805
|
-
var
|
|
5201
|
+
var React39 = __toESM(require("react"));
|
|
4806
5202
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
4807
5203
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
4808
|
-
var
|
|
5204
|
+
var import_editor_elements18 = require("@elementor/editor-elements");
|
|
4809
5205
|
var import_ui29 = require("@elementor/ui");
|
|
4810
|
-
var
|
|
5206
|
+
var import_i18n33 = require("@wordpress/i18n");
|
|
4811
5207
|
|
|
4812
5208
|
// src/extended/store/actions/set-overridable-prop.ts
|
|
4813
5209
|
var import_utils10 = require("@elementor/utils");
|
|
@@ -4879,11 +5275,11 @@ function setOverridableProp({
|
|
|
4879
5275
|
}
|
|
4880
5276
|
|
|
4881
5277
|
// src/extended/components/overridable-props/indicator.tsx
|
|
4882
|
-
var
|
|
4883
|
-
var
|
|
4884
|
-
var
|
|
5278
|
+
var React38 = __toESM(require("react"));
|
|
5279
|
+
var import_react20 = require("react");
|
|
5280
|
+
var import_icons20 = require("@elementor/icons");
|
|
4885
5281
|
var import_ui28 = require("@elementor/ui");
|
|
4886
|
-
var
|
|
5282
|
+
var import_i18n32 = require("@wordpress/i18n");
|
|
4887
5283
|
var SIZE2 = "tiny";
|
|
4888
5284
|
var IconContainer = (0, import_ui28.styled)(import_ui28.Box)`
|
|
4889
5285
|
pointer-events: none;
|
|
@@ -4939,16 +5335,16 @@ var Content = (0, import_ui28.styled)(import_ui28.Box)`
|
|
|
4939
5335
|
}
|
|
4940
5336
|
}
|
|
4941
5337
|
`;
|
|
4942
|
-
var Indicator2 = (0,
|
|
5338
|
+
var Indicator2 = (0, import_react20.forwardRef)(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React38.createElement(
|
|
4943
5339
|
Content,
|
|
4944
5340
|
{
|
|
4945
5341
|
role: "button",
|
|
4946
5342
|
ref,
|
|
4947
5343
|
...props,
|
|
4948
5344
|
className: isOpen || isOverridable ? "enlarged" : "",
|
|
4949
|
-
"aria-label": isOverridable ? (0,
|
|
5345
|
+
"aria-label": isOverridable ? (0, import_i18n32.__)("Overridable property", "elementor") : (0, import_i18n32.__)("Make prop overridable", "elementor")
|
|
4950
5346
|
},
|
|
4951
|
-
/* @__PURE__ */
|
|
5347
|
+
/* @__PURE__ */ React38.createElement(IconContainer, { className: "icon" }, isOverridable ? /* @__PURE__ */ React38.createElement(import_icons20.CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React38.createElement(import_icons20.PlusIcon, { fontSize: SIZE2 }))
|
|
4952
5348
|
));
|
|
4953
5349
|
|
|
4954
5350
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
@@ -4959,7 +5355,7 @@ function OverridablePropIndicator() {
|
|
|
4959
5355
|
if (!isPropAllowed(propType) || !componentId || !overridableProps) {
|
|
4960
5356
|
return null;
|
|
4961
5357
|
}
|
|
4962
|
-
return /* @__PURE__ */
|
|
5358
|
+
return /* @__PURE__ */ React39.createElement(Content2, { componentId, overridableProps });
|
|
4963
5359
|
}
|
|
4964
5360
|
function Content2({ componentId, overridableProps }) {
|
|
4965
5361
|
const {
|
|
@@ -4978,7 +5374,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4978
5374
|
});
|
|
4979
5375
|
const triggerProps = (0, import_ui29.bindTrigger)(popupState);
|
|
4980
5376
|
const popoverProps = (0, import_ui29.bindPopover)(popupState);
|
|
4981
|
-
const { elType } = (0,
|
|
5377
|
+
const { elType } = (0, import_editor_elements18.getWidgetsCache)()?.[elementType.key] ?? { elType: "widget" };
|
|
4982
5378
|
const handleSubmit = ({ label, group }) => {
|
|
4983
5379
|
const propTypeDefault = propType.default ?? {};
|
|
4984
5380
|
const originValue = resolveOverridePropValue(overridableValue?.origin_value) ?? value ?? propTypeDefault;
|
|
@@ -5005,7 +5401,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
5005
5401
|
popupState.close();
|
|
5006
5402
|
};
|
|
5007
5403
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
5008
|
-
return /* @__PURE__ */
|
|
5404
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(import_ui29.Tooltip, { placement: "top", title: (0, import_i18n33.__)("Override Property", "elementor") }, /* @__PURE__ */ React39.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React39.createElement(
|
|
5009
5405
|
import_ui29.Popover,
|
|
5010
5406
|
{
|
|
5011
5407
|
disableScrollLock: true,
|
|
@@ -5022,7 +5418,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
5022
5418
|
},
|
|
5023
5419
|
...popoverProps
|
|
5024
5420
|
},
|
|
5025
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ React39.createElement(
|
|
5026
5422
|
OverridablePropForm,
|
|
5027
5423
|
{
|
|
5028
5424
|
onSubmit: handleSubmit,
|
|
@@ -5045,7 +5441,7 @@ var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
|
5045
5441
|
|
|
5046
5442
|
// src/extended/mcp/save-as-component-tool.ts
|
|
5047
5443
|
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
5048
|
-
var
|
|
5444
|
+
var import_editor_elements19 = require("@elementor/editor-elements");
|
|
5049
5445
|
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
5050
5446
|
var import_http_client2 = require("@elementor/http-client");
|
|
5051
5447
|
var import_schema6 = require("@elementor/schema");
|
|
@@ -5090,7 +5486,7 @@ var handleSaveAsComponent = async (params) => {
|
|
|
5090
5486
|
overridable_props: overridablePropsInput
|
|
5091
5487
|
} = params;
|
|
5092
5488
|
const validElementTypes = getValidElementTypes();
|
|
5093
|
-
const container = (0,
|
|
5489
|
+
const container = (0, import_editor_elements19.getContainer)(elementId);
|
|
5094
5490
|
if (!container) {
|
|
5095
5491
|
throw new Error(ERROR_MESSAGES3.ELEMENT_NOT_FOUND);
|
|
5096
5492
|
}
|
|
@@ -5156,7 +5552,7 @@ function enrichOverridableProps(input, rootElement, propertGroups) {
|
|
|
5156
5552
|
}
|
|
5157
5553
|
const elType = element.elType;
|
|
5158
5554
|
const widgetType = element.widgetType || element.elType;
|
|
5159
|
-
const elementType = (0,
|
|
5555
|
+
const elementType = (0, import_editor_elements19.getElementType)(widgetType);
|
|
5160
5556
|
if (!elementType) {
|
|
5161
5557
|
throw new Error(
|
|
5162
5558
|
`Element type "${widgetType}" is not atomic or does not have a settings schema. Cannot expose property "${propKey}" for element "${elementId}".`
|
|
@@ -5227,7 +5623,7 @@ function findElementById(root, targetId) {
|
|
|
5227
5623
|
return null;
|
|
5228
5624
|
}
|
|
5229
5625
|
function getValidElementTypes() {
|
|
5230
|
-
const types = (0,
|
|
5626
|
+
const types = (0, import_editor_elements19.getWidgetsCache)();
|
|
5231
5627
|
if (!types) {
|
|
5232
5628
|
return [];
|
|
5233
5629
|
}
|
|
@@ -5436,7 +5832,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
5436
5832
|
};
|
|
5437
5833
|
|
|
5438
5834
|
// src/extended/sync/update-archived-component-before-save.ts
|
|
5439
|
-
var
|
|
5835
|
+
var import_editor_notifications6 = require("@elementor/editor-notifications");
|
|
5440
5836
|
var failedNotification = (message) => ({
|
|
5441
5837
|
type: "error",
|
|
5442
5838
|
message: `Failed to archive components: ${message}`,
|
|
@@ -5451,7 +5847,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
|
|
|
5451
5847
|
const result = await apiClient.updateArchivedComponents(archivedComponents, status);
|
|
5452
5848
|
const failedIds = result.failedIds.join(", ");
|
|
5453
5849
|
if (failedIds) {
|
|
5454
|
-
(0,
|
|
5850
|
+
(0, import_editor_notifications6.notify)(failedNotification(failedIds));
|
|
5455
5851
|
}
|
|
5456
5852
|
} catch (error) {
|
|
5457
5853
|
throw new Error(`Failed to update archived components: ${error}`);
|
|
@@ -5471,7 +5867,7 @@ var updateComponentTitleBeforeSave = async (status) => {
|
|
|
5471
5867
|
};
|
|
5472
5868
|
|
|
5473
5869
|
// src/extended/sync/create-components-before-save.ts
|
|
5474
|
-
var
|
|
5870
|
+
var import_editor_elements20 = require("@elementor/editor-elements");
|
|
5475
5871
|
async function createComponentsBeforeSave({
|
|
5476
5872
|
elements,
|
|
5477
5873
|
status
|
|
@@ -5538,7 +5934,7 @@ function shouldUpdateElement(element, uidToComponentId) {
|
|
|
5538
5934
|
return { shouldUpdate: false, newComponentId: null };
|
|
5539
5935
|
}
|
|
5540
5936
|
function updateElementComponentId(elementId, componentId) {
|
|
5541
|
-
(0,
|
|
5937
|
+
(0, import_editor_elements20.updateElementSettings)({
|
|
5542
5938
|
id: elementId,
|
|
5543
5939
|
props: {
|
|
5544
5940
|
component_instance: {
|
|
@@ -5574,10 +5970,10 @@ var updateExistingComponentsBeforeSave = async ({
|
|
|
5574
5970
|
};
|
|
5575
5971
|
|
|
5576
5972
|
// src/extended/sync/cleanup-overridable-props-on-delete.ts
|
|
5577
|
-
var
|
|
5578
|
-
var
|
|
5973
|
+
var import_editor_elements21 = require("@elementor/editor-elements");
|
|
5974
|
+
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
5579
5975
|
function initCleanupOverridablePropsOnDelete() {
|
|
5580
|
-
(0,
|
|
5976
|
+
(0, import_editor_v1_adapters8.registerDataHook)("dependency", "document/elements/delete", (args, options) => {
|
|
5581
5977
|
if (isPartOfMoveCommand(options)) {
|
|
5582
5978
|
return true;
|
|
5583
5979
|
}
|
|
@@ -5606,7 +6002,7 @@ function initCleanupOverridablePropsOnDelete() {
|
|
|
5606
6002
|
});
|
|
5607
6003
|
}
|
|
5608
6004
|
function collectDeletedElementIds(containers) {
|
|
5609
|
-
const elementIds = containers.filter(Boolean).flatMap((container) => [container, ...(0,
|
|
6005
|
+
const elementIds = containers.filter(Boolean).flatMap((container) => [container, ...(0, import_editor_elements21.getAllDescendants)(container)]).map((element) => element.model?.get?.("id") ?? element.id).filter((id2) => Boolean(id2));
|
|
5610
6006
|
return elementIds;
|
|
5611
6007
|
}
|
|
5612
6008
|
function isPartOfMoveCommand(options) {
|
|
@@ -5615,15 +6011,15 @@ function isPartOfMoveCommand(options) {
|
|
|
5615
6011
|
}
|
|
5616
6012
|
|
|
5617
6013
|
// src/extended/sync/handle-component-edit-mode-container.ts
|
|
5618
|
-
var
|
|
5619
|
-
var
|
|
6014
|
+
var import_editor_elements22 = require("@elementor/editor-elements");
|
|
6015
|
+
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
5620
6016
|
var V4_DEFAULT_CONTAINER_TYPE = "e-flexbox";
|
|
5621
6017
|
function initHandleComponentEditModeContainer() {
|
|
5622
6018
|
initRedirectDropIntoComponent();
|
|
5623
6019
|
initHandleTopLevelElementDelete();
|
|
5624
6020
|
}
|
|
5625
6021
|
function initHandleTopLevelElementDelete() {
|
|
5626
|
-
(0,
|
|
6022
|
+
(0, import_editor_v1_adapters9.registerDataHook)("after", "document/elements/delete", (args) => {
|
|
5627
6023
|
if (!isEditingComponent()) {
|
|
5628
6024
|
return;
|
|
5629
6025
|
}
|
|
@@ -5641,7 +6037,7 @@ function initHandleTopLevelElementDelete() {
|
|
|
5641
6037
|
});
|
|
5642
6038
|
}
|
|
5643
6039
|
function initRedirectDropIntoComponent() {
|
|
5644
|
-
(0,
|
|
6040
|
+
(0, import_editor_v1_adapters9.registerDataHook)("dependency", "preview/drop", (args) => {
|
|
5645
6041
|
if (!isEditingComponent()) {
|
|
5646
6042
|
return true;
|
|
5647
6043
|
}
|
|
@@ -5665,11 +6061,11 @@ function initRedirectDropIntoComponent() {
|
|
|
5665
6061
|
});
|
|
5666
6062
|
}
|
|
5667
6063
|
function createEmptyTopLevelContainer(container) {
|
|
5668
|
-
const newContainer = (0,
|
|
6064
|
+
const newContainer = (0, import_editor_elements22.createElement)({
|
|
5669
6065
|
container,
|
|
5670
6066
|
model: { elType: V4_DEFAULT_CONTAINER_TYPE }
|
|
5671
6067
|
});
|
|
5672
|
-
(0,
|
|
6068
|
+
(0, import_editor_elements22.selectElement)(newContainer.id);
|
|
5673
6069
|
}
|
|
5674
6070
|
function getComponentContainer(container) {
|
|
5675
6071
|
const topLevelElement = container.children?.[0];
|
|
@@ -5687,15 +6083,15 @@ function isComponent(container) {
|
|
|
5687
6083
|
}
|
|
5688
6084
|
|
|
5689
6085
|
// src/extended/sync/revert-overridables-on-copy-or-duplicate.ts
|
|
5690
|
-
var
|
|
6086
|
+
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
5691
6087
|
function initRevertOverridablesOnCopyOrDuplicate() {
|
|
5692
|
-
(0,
|
|
6088
|
+
(0, import_editor_v1_adapters10.registerDataHook)("after", "document/elements/duplicate", (_args, result) => {
|
|
5693
6089
|
if (!isEditingComponent()) {
|
|
5694
6090
|
return;
|
|
5695
6091
|
}
|
|
5696
6092
|
revertOverridablesForDuplicatedElements(result);
|
|
5697
6093
|
});
|
|
5698
|
-
(0,
|
|
6094
|
+
(0, import_editor_v1_adapters10.registerDataHook)("after", "document/elements/copy", (args) => {
|
|
5699
6095
|
if (!isEditingComponent()) {
|
|
5700
6096
|
return;
|
|
5701
6097
|
}
|
|
@@ -5725,7 +6121,7 @@ function revertOverridablesInStorage(storageKey) {
|
|
|
5725
6121
|
}
|
|
5726
6122
|
|
|
5727
6123
|
// src/extended/sync/sanitize-overridable-props.ts
|
|
5728
|
-
var
|
|
6124
|
+
var import_react21 = require("react");
|
|
5729
6125
|
|
|
5730
6126
|
// src/extended/store/actions/update-component-sanitized-attribute.ts
|
|
5731
6127
|
function updateComponentSanitizedAttribute(componentId, attribute) {
|
|
@@ -5737,7 +6133,7 @@ function SanitizeOverridableProps() {
|
|
|
5737
6133
|
const currentComponentId = useCurrentComponentId();
|
|
5738
6134
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
5739
6135
|
const isSanitized = useIsSanitizedComponent(currentComponentId, "overridableProps");
|
|
5740
|
-
(0,
|
|
6136
|
+
(0, import_react21.useEffect)(() => {
|
|
5741
6137
|
if (isSanitized || !overridableProps || !currentComponentId) {
|
|
5742
6138
|
return;
|
|
5743
6139
|
}
|
|
@@ -5764,19 +6160,19 @@ function initExtended() {
|
|
|
5764
6160
|
});
|
|
5765
6161
|
(0, import_editor_elements_panel.registerTab)({
|
|
5766
6162
|
id: "components",
|
|
5767
|
-
label: (0,
|
|
6163
|
+
label: (0, import_i18n34.__)("Components", "elementor"),
|
|
5768
6164
|
component: ExtendedComponents,
|
|
5769
6165
|
priority: PRIORITY
|
|
5770
6166
|
});
|
|
5771
6167
|
(0, import_editor_panels6.__registerPanel)(panel);
|
|
5772
|
-
(0,
|
|
6168
|
+
(0, import_editor_v1_adapters11.registerDataHook)("dependency", "editor/documents/close", (args) => {
|
|
5773
6169
|
const document = (0, import_editor_documents13.getV1CurrentDocument)();
|
|
5774
6170
|
if (document.config.type === COMPONENT_DOCUMENT_TYPE) {
|
|
5775
6171
|
args.mode = "autosave";
|
|
5776
6172
|
}
|
|
5777
6173
|
return true;
|
|
5778
6174
|
});
|
|
5779
|
-
(0,
|
|
6175
|
+
(0, import_editor_v1_adapters11.registerDataHook)("after", "preview/drop", onElementDrop);
|
|
5780
6176
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
5781
6177
|
(0, import_editor.injectIntoTop)({
|
|
5782
6178
|
id: "create-component-popup",
|
|
@@ -5813,24 +6209,24 @@ function initExtended() {
|
|
|
5813
6209
|
}
|
|
5814
6210
|
|
|
5815
6211
|
// src/extended/shortcuts/create-component-shortcut.ts
|
|
5816
|
-
var
|
|
6212
|
+
var import_editor_elements23 = require("@elementor/editor-elements");
|
|
5817
6213
|
var import_utils12 = require("@elementor/utils");
|
|
5818
6214
|
var CREATE_COMPONENT_SHORTCUT_KEYS = "ctrl+shift+k";
|
|
5819
6215
|
var OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
5820
6216
|
function isCreateComponentAllowed() {
|
|
5821
|
-
const selectedElements = (0,
|
|
6217
|
+
const selectedElements = (0, import_editor_elements23.getSelectedElements)();
|
|
5822
6218
|
if (selectedElements.length !== 1) {
|
|
5823
6219
|
return { allowed: false };
|
|
5824
6220
|
}
|
|
5825
6221
|
const element = selectedElements[0];
|
|
5826
|
-
const elementType = (0,
|
|
6222
|
+
const elementType = (0, import_editor_elements23.getElementType)(element.type);
|
|
5827
6223
|
if (!elementType) {
|
|
5828
6224
|
return { allowed: false };
|
|
5829
6225
|
}
|
|
5830
6226
|
if (!(0, import_utils12.isProActive)()) {
|
|
5831
6227
|
return { allowed: false };
|
|
5832
6228
|
}
|
|
5833
|
-
const widgetsCache = (0,
|
|
6229
|
+
const widgetsCache = (0, import_editor_elements23.getWidgetsCache)();
|
|
5834
6230
|
const elementConfig = widgetsCache?.[element.type];
|
|
5835
6231
|
if (!elementConfig?.atomic_props_schema || !elementConfig?.show_in_panel || elementConfig?.elType === "widget") {
|
|
5836
6232
|
return { allowed: false };
|
|
@@ -5883,37 +6279,37 @@ function initCreateComponentShortcut() {
|
|
|
5883
6279
|
}
|
|
5884
6280
|
|
|
5885
6281
|
// src/populate-store.ts
|
|
5886
|
-
var
|
|
5887
|
-
var
|
|
6282
|
+
var import_react22 = require("react");
|
|
6283
|
+
var import_store39 = require("@elementor/store");
|
|
5888
6284
|
function PopulateStore() {
|
|
5889
|
-
(0,
|
|
5890
|
-
(0,
|
|
6285
|
+
(0, import_react22.useEffect)(() => {
|
|
6286
|
+
(0, import_store39.__dispatch)(loadComponents());
|
|
5891
6287
|
}, []);
|
|
5892
6288
|
return null;
|
|
5893
6289
|
}
|
|
5894
6290
|
|
|
5895
6291
|
// src/prevent-circular-nesting.ts
|
|
5896
|
-
var
|
|
5897
|
-
var
|
|
5898
|
-
var
|
|
5899
|
-
var
|
|
5900
|
-
var
|
|
6292
|
+
var import_editor_elements24 = require("@elementor/editor-elements");
|
|
6293
|
+
var import_editor_notifications7 = require("@elementor/editor-notifications");
|
|
6294
|
+
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
6295
|
+
var import_store40 = require("@elementor/store");
|
|
6296
|
+
var import_i18n35 = require("@wordpress/i18n");
|
|
5901
6297
|
var COMPONENT_TYPE = "e-component";
|
|
5902
6298
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
5903
6299
|
type: "default",
|
|
5904
|
-
message: (0,
|
|
6300
|
+
message: (0, import_i18n35.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
5905
6301
|
id: "circular-component-nesting-blocked"
|
|
5906
6302
|
};
|
|
5907
6303
|
function initCircularNestingPrevention() {
|
|
5908
|
-
(0,
|
|
6304
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
5909
6305
|
command: "document/elements/create",
|
|
5910
6306
|
condition: blockCircularCreate
|
|
5911
6307
|
});
|
|
5912
|
-
(0,
|
|
6308
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
5913
6309
|
command: "document/elements/move",
|
|
5914
6310
|
condition: blockCircularMove
|
|
5915
6311
|
});
|
|
5916
|
-
(0,
|
|
6312
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
5917
6313
|
command: "document/elements/paste",
|
|
5918
6314
|
condition: blockCircularPaste
|
|
5919
6315
|
});
|
|
@@ -5922,7 +6318,7 @@ function wouldCreateCircularNesting(componentIdToAdd) {
|
|
|
5922
6318
|
if (componentIdToAdd === void 0) {
|
|
5923
6319
|
return false;
|
|
5924
6320
|
}
|
|
5925
|
-
const state = (0,
|
|
6321
|
+
const state = (0, import_store40.__getState)();
|
|
5926
6322
|
const currentComponentId = selectCurrentComponentId(state);
|
|
5927
6323
|
const path = selectPath(state);
|
|
5928
6324
|
if (currentComponentId === null) {
|
|
@@ -5978,7 +6374,7 @@ function blockCircularCreate(args) {
|
|
|
5978
6374
|
}
|
|
5979
6375
|
const isBlocked = wouldCreateCircularNesting(componentId);
|
|
5980
6376
|
if (isBlocked) {
|
|
5981
|
-
(0,
|
|
6377
|
+
(0, import_editor_notifications7.notify)(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5982
6378
|
}
|
|
5983
6379
|
return isBlocked;
|
|
5984
6380
|
}
|
|
@@ -5988,7 +6384,7 @@ function blockCircularMove(args) {
|
|
|
5988
6384
|
if (!container) {
|
|
5989
6385
|
return false;
|
|
5990
6386
|
}
|
|
5991
|
-
const allElements = (0,
|
|
6387
|
+
const allElements = (0, import_editor_elements24.getAllDescendants)(container);
|
|
5992
6388
|
return allElements.some((element) => {
|
|
5993
6389
|
const componentId = extractComponentIdFromContainer(element);
|
|
5994
6390
|
if (componentId === null) {
|
|
@@ -5998,7 +6394,7 @@ function blockCircularMove(args) {
|
|
|
5998
6394
|
});
|
|
5999
6395
|
});
|
|
6000
6396
|
if (hasCircularComponent) {
|
|
6001
|
-
(0,
|
|
6397
|
+
(0, import_editor_notifications7.notify)(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
6002
6398
|
}
|
|
6003
6399
|
return hasCircularComponent;
|
|
6004
6400
|
}
|
|
@@ -6014,25 +6410,25 @@ function blockCircularPaste(args) {
|
|
|
6014
6410
|
const allComponentIds = extractComponentIdsFromElements(data.clipboard.elements);
|
|
6015
6411
|
const hasCircularComponent = allComponentIds.some(wouldCreateCircularNesting);
|
|
6016
6412
|
if (hasCircularComponent) {
|
|
6017
|
-
(0,
|
|
6413
|
+
(0, import_editor_notifications7.notify)(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
6018
6414
|
}
|
|
6019
6415
|
return hasCircularComponent;
|
|
6020
6416
|
}
|
|
6021
6417
|
|
|
6022
6418
|
// src/store/actions/remove-component-styles.ts
|
|
6023
|
-
var
|
|
6419
|
+
var import_store42 = require("@elementor/store");
|
|
6024
6420
|
function removeComponentStyles(id2) {
|
|
6025
6421
|
apiClient.invalidateComponentConfigCache(id2);
|
|
6026
|
-
(0,
|
|
6422
|
+
(0, import_store42.__dispatch)(slice.actions.removeStyles({ id: id2 }));
|
|
6027
6423
|
}
|
|
6028
6424
|
|
|
6029
6425
|
// src/store/components-styles-provider.ts
|
|
6030
6426
|
var import_editor_styles_repository = require("@elementor/editor-styles-repository");
|
|
6031
|
-
var
|
|
6427
|
+
var import_store44 = require("@elementor/store");
|
|
6032
6428
|
var componentsStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
|
|
6033
6429
|
key: "components-styles",
|
|
6034
6430
|
priority: 100,
|
|
6035
|
-
subscribe: (cb) => (0,
|
|
6431
|
+
subscribe: (cb) => (0, import_store44.__subscribeWithSelector)(
|
|
6036
6432
|
(state) => state[SLICE_NAME],
|
|
6037
6433
|
() => {
|
|
6038
6434
|
cb();
|
|
@@ -6040,10 +6436,10 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
6040
6436
|
),
|
|
6041
6437
|
actions: {
|
|
6042
6438
|
all: () => {
|
|
6043
|
-
return selectFlatStyles((0,
|
|
6439
|
+
return selectFlatStyles((0, import_store44.__getState)());
|
|
6044
6440
|
},
|
|
6045
6441
|
get: (id2) => {
|
|
6046
|
-
return selectFlatStyles((0,
|
|
6442
|
+
return selectFlatStyles((0, import_store44.__getState)()).find((style) => style.id === id2) ?? null;
|
|
6047
6443
|
}
|
|
6048
6444
|
}
|
|
6049
6445
|
});
|
|
@@ -6055,12 +6451,12 @@ var beforeSave2 = ({ container, status }) => {
|
|
|
6055
6451
|
};
|
|
6056
6452
|
|
|
6057
6453
|
// src/sync/load-component-data-after-instance-added.ts
|
|
6058
|
-
var
|
|
6454
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
6059
6455
|
function initLoadComponentDataAfterInstanceAdded() {
|
|
6060
|
-
(0,
|
|
6456
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/paste", (_args, result) => {
|
|
6061
6457
|
load(result);
|
|
6062
6458
|
});
|
|
6063
|
-
(0,
|
|
6459
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/import", (_args, result) => {
|
|
6064
6460
|
load(result);
|
|
6065
6461
|
});
|
|
6066
6462
|
}
|
|
@@ -6073,15 +6469,19 @@ function load(result) {
|
|
|
6073
6469
|
var PRO_EXTENDED_MIGRATION_VERSION = "4.0.0";
|
|
6074
6470
|
function init() {
|
|
6075
6471
|
import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
|
|
6076
|
-
(0,
|
|
6472
|
+
(0, import_store46.__registerSlice)(slice);
|
|
6077
6473
|
(0, import_editor_canvas8.registerElementType)(
|
|
6078
|
-
|
|
6079
|
-
(options) => createComponentType({
|
|
6474
|
+
COMPONENT_WIDGET_TYPE2,
|
|
6475
|
+
(options) => createComponentType({
|
|
6476
|
+
...options,
|
|
6477
|
+
showLockedByModal: openEditModeDialog,
|
|
6478
|
+
showDetachConfirmDialog: openDetachConfirmDialog
|
|
6479
|
+
})
|
|
6080
6480
|
);
|
|
6081
6481
|
window.elementorCommon.__beforeSave = beforeSave2;
|
|
6082
6482
|
(0, import_editor_elements_panel2.injectTab)({
|
|
6083
6483
|
id: "components",
|
|
6084
|
-
label: (0,
|
|
6484
|
+
label: (0, import_i18n36.__)("Components", "elementor"),
|
|
6085
6485
|
component: Components,
|
|
6086
6486
|
position: 1
|
|
6087
6487
|
});
|
|
@@ -6089,7 +6489,7 @@ function init() {
|
|
|
6089
6489
|
id: "components-populate-store",
|
|
6090
6490
|
component: PopulateStore
|
|
6091
6491
|
});
|
|
6092
|
-
(0,
|
|
6492
|
+
(0, import_editor_v1_adapters14.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
6093
6493
|
const { id: id2, config } = (0, import_editor_documents14.getV1CurrentDocument)();
|
|
6094
6494
|
if (id2) {
|
|
6095
6495
|
removeComponentStyles(id2);
|
|
@@ -6126,6 +6526,7 @@ function init() {
|
|
|
6126
6526
|
ComponentSearch,
|
|
6127
6527
|
ComponentsEmptyState,
|
|
6128
6528
|
ComponentsList,
|
|
6529
|
+
DetachAction,
|
|
6129
6530
|
EditComponentAction,
|
|
6130
6531
|
EmptySearchResult,
|
|
6131
6532
|
InstanceEmptyState,
|