@elementor/editor-components 4.0.0-662 → 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 +1267 -843
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1026 -603
- 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 +87 -23
- 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,18 +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
|
|
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");
|
|
1691
2223
|
var import_utils4 = require("@elementor/utils");
|
|
1692
|
-
var
|
|
2224
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1693
2225
|
|
|
1694
2226
|
// src/utils/format-component-elements-id.ts
|
|
1695
2227
|
var import_utils3 = require("@elementor/utils");
|
|
@@ -1708,27 +2240,27 @@ function formatComponentElementsId(elements, path) {
|
|
|
1708
2240
|
}
|
|
1709
2241
|
|
|
1710
2242
|
// src/utils/switch-to-component.ts
|
|
1711
|
-
var
|
|
1712
|
-
var
|
|
1713
|
-
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");
|
|
1714
2246
|
async function switchToComponent(componentId, componentInstanceId, element) {
|
|
1715
2247
|
const selector = getSelector(element, componentInstanceId);
|
|
1716
|
-
(0,
|
|
1717
|
-
await (0,
|
|
2248
|
+
(0, import_editor_documents3.invalidateDocumentData)(componentId);
|
|
2249
|
+
await (0, import_editor_documents3.switchToDocument)(componentId, {
|
|
1718
2250
|
selector,
|
|
1719
2251
|
mode: "autosave",
|
|
1720
2252
|
setAsInitial: false,
|
|
1721
2253
|
shouldScroll: false
|
|
1722
2254
|
});
|
|
1723
|
-
const currentDocumentContainer = (0,
|
|
2255
|
+
const currentDocumentContainer = (0, import_editor_elements8.getCurrentDocumentContainer)();
|
|
1724
2256
|
const topLevelElement = currentDocumentContainer?.children?.[0];
|
|
1725
2257
|
if (topLevelElement) {
|
|
1726
|
-
(0,
|
|
2258
|
+
(0, import_editor_elements8.selectElement)(topLevelElement.id);
|
|
1727
2259
|
expandNavigator();
|
|
1728
2260
|
}
|
|
1729
2261
|
}
|
|
1730
2262
|
async function expandNavigator() {
|
|
1731
|
-
await (0,
|
|
2263
|
+
await (0, import_editor_v1_adapters3.__privateRunCommand)("navigator/expand-all");
|
|
1732
2264
|
}
|
|
1733
2265
|
function getSelector(element, componentInstanceId) {
|
|
1734
2266
|
if (element) {
|
|
@@ -1759,48 +2291,27 @@ function buildUniqueSelector(element) {
|
|
|
1759
2291
|
return selectors.join(" ");
|
|
1760
2292
|
}
|
|
1761
2293
|
|
|
1762
|
-
// src/utils/tracking.ts
|
|
1763
|
-
var import_events = require("@elementor/events");
|
|
1764
|
-
var import_store18 = require("@elementor/store");
|
|
1765
|
-
var FEATURE_NAME = "Components";
|
|
1766
|
-
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
1767
|
-
if (source === "system") {
|
|
1768
|
-
return;
|
|
1769
|
-
}
|
|
1770
|
-
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
1771
|
-
if (!config?.names?.components?.[action]) {
|
|
1772
|
-
return;
|
|
1773
|
-
}
|
|
1774
|
-
const name = config.names.components[action];
|
|
1775
|
-
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
1776
|
-
};
|
|
1777
|
-
var onElementDrop = (_args, element) => {
|
|
1778
|
-
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
1779
|
-
return;
|
|
1780
|
-
}
|
|
1781
|
-
const editorSettings = element.model.get("editor_settings");
|
|
1782
|
-
const componentName = editorSettings?.title;
|
|
1783
|
-
const componentUID = editorSettings?.component_uid;
|
|
1784
|
-
const instanceId = element.id;
|
|
1785
|
-
const createdThisSession = selectCreatedThisSession((0, import_store18.__getState)());
|
|
1786
|
-
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
1787
|
-
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
1788
|
-
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
1789
|
-
trackComponentEvent({
|
|
1790
|
-
action: "instanceAdded",
|
|
1791
|
-
source: "user",
|
|
1792
|
-
instance_id: instanceId,
|
|
1793
|
-
component_uid: componentUID,
|
|
1794
|
-
component_name: componentName,
|
|
1795
|
-
is_same_session_reuse: isSameSessionReuse,
|
|
1796
|
-
location: locations.widgetPanel,
|
|
1797
|
-
secondary_location: secondaryLocations.componentsTab
|
|
1798
|
-
});
|
|
1799
|
-
};
|
|
1800
|
-
|
|
1801
2294
|
// src/create-component-type.ts
|
|
1802
|
-
var
|
|
2295
|
+
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
1803
2296
|
var EDIT_COMPONENT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2297
|
+
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
2298
|
+
function notifyComponentEditUpgrade() {
|
|
2299
|
+
(0, import_editor_notifications2.notify)({
|
|
2300
|
+
type: "promotion",
|
|
2301
|
+
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
2302
|
+
message: (0, import_i18n10.__)("Your Pro subscription has expired. Renew to edit components.", "elementor"),
|
|
2303
|
+
additionalActionProps: [
|
|
2304
|
+
{
|
|
2305
|
+
size: "small",
|
|
2306
|
+
variant: "contained",
|
|
2307
|
+
color: "promotion",
|
|
2308
|
+
href: EDIT_COMPONENT_UPGRADE_URL,
|
|
2309
|
+
target: "_blank",
|
|
2310
|
+
children: (0, import_i18n10.__)("Upgrade Now", "elementor")
|
|
2311
|
+
}
|
|
2312
|
+
]
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
1804
2315
|
var updateGroups = (groups, config) => {
|
|
1805
2316
|
const disableMap = new Map(Object.entries(config.disable ?? {}));
|
|
1806
2317
|
const addMap = new Map(Object.entries(config.add ?? {}));
|
|
@@ -1811,7 +2322,7 @@ var updateGroups = (groups, config) => {
|
|
|
1811
2322
|
(action) => disabledActions.includes(action.name) ? { ...action, isEnabled: () => false } : action
|
|
1812
2323
|
);
|
|
1813
2324
|
if (addConfig) {
|
|
1814
|
-
updatedActions.splice(addConfig.index, 0, addConfig.
|
|
2325
|
+
updatedActions.splice(addConfig.index, 0, ...addConfig.actions);
|
|
1815
2326
|
}
|
|
1816
2327
|
return { ...group, actions: updatedActions };
|
|
1817
2328
|
});
|
|
@@ -1838,7 +2349,7 @@ function createComponentView(options) {
|
|
|
1838
2349
|
eventsManagerConfig = legacyWindow.elementorCommon.eventsManager.config;
|
|
1839
2350
|
#componentRenderContext;
|
|
1840
2351
|
isComponentCurrentlyEdited() {
|
|
1841
|
-
const currentDocument = (0,
|
|
2352
|
+
const currentDocument = (0, import_editor_documents4.getCurrentDocument)();
|
|
1842
2353
|
return currentDocument?.id === this.getComponentId();
|
|
1843
2354
|
}
|
|
1844
2355
|
getRenderContext() {
|
|
@@ -1910,26 +2421,35 @@ function createComponentView(options) {
|
|
|
1910
2421
|
_getContextMenuConfig() {
|
|
1911
2422
|
const isAdministrator = isUserAdministrator();
|
|
1912
2423
|
const hasPro = (0, import_utils4.hasProInstalled)();
|
|
1913
|
-
const proLabel = (0,
|
|
2424
|
+
const proLabel = (0, import_i18n10.__)("PRO", "elementor");
|
|
1914
2425
|
const badgeClass = "elementor-context-menu-list__item__shortcut__new-badge";
|
|
1915
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];
|
|
1916
2443
|
const addedGroup = {
|
|
1917
2444
|
general: {
|
|
1918
2445
|
index: 1,
|
|
1919
|
-
|
|
1920
|
-
name: "edit component",
|
|
1921
|
-
icon: "eicon-edit",
|
|
1922
|
-
title: () => (0, import_i18n7.__)("Edit Component", "elementor"),
|
|
1923
|
-
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
1924
|
-
isEnabled: () => hasPro,
|
|
1925
|
-
callback: (_, eventData) => this.editComponent(eventData)
|
|
1926
|
-
}
|
|
2446
|
+
actions
|
|
1927
2447
|
}
|
|
1928
2448
|
};
|
|
1929
2449
|
const disabledGroup = {
|
|
1930
2450
|
clipboard: ["pasteStyle", "resetStyle"]
|
|
1931
2451
|
};
|
|
1932
|
-
return { add:
|
|
2452
|
+
return { add: addedGroup, disable: disabledGroup };
|
|
1933
2453
|
}
|
|
1934
2454
|
async switchDocument() {
|
|
1935
2455
|
const { isAllowedToSwitchDocument, lockedBy } = await apiClient.getComponentLockStatus(
|
|
@@ -1958,9 +2478,36 @@ function createComponentView(options) {
|
|
|
1958
2478
|
trigger
|
|
1959
2479
|
});
|
|
1960
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
|
+
}
|
|
1961
2504
|
handleDblClick(e) {
|
|
1962
2505
|
e.stopPropagation();
|
|
1963
|
-
if (!isUserAdministrator()
|
|
2506
|
+
if (!isUserAdministrator()) {
|
|
2507
|
+
return;
|
|
2508
|
+
}
|
|
2509
|
+
if (!(0, import_utils4.hasProInstalled)()) {
|
|
2510
|
+
notifyComponentEditUpgrade();
|
|
1964
2511
|
return;
|
|
1965
2512
|
}
|
|
1966
2513
|
const { triggers, locations, secondaryLocations } = this.eventsManagerConfig;
|
|
@@ -2025,154 +2572,26 @@ function createComponentModel() {
|
|
|
2025
2572
|
}
|
|
2026
2573
|
const componentUid = editorSettings?.component_uid;
|
|
2027
2574
|
if (componentUid) {
|
|
2028
|
-
const component = selectComponentByUid((0,
|
|
2575
|
+
const component = selectComponentByUid((0, import_store26.__getState)(), componentUid);
|
|
2029
2576
|
if (component?.name) {
|
|
2030
2577
|
return component.name;
|
|
2031
2578
|
}
|
|
2032
2579
|
}
|
|
2033
2580
|
return window.elementor.getElementData(this).title;
|
|
2034
2581
|
},
|
|
2035
|
-
getComponentId() {
|
|
2036
|
-
return this.get("componentId") || null;
|
|
2037
|
-
},
|
|
2038
|
-
getComponentName() {
|
|
2039
|
-
return this.getTitle();
|
|
2040
|
-
},
|
|
2041
|
-
getComponentUid() {
|
|
2042
|
-
const editorSettings = this.get("editor_settings");
|
|
2043
|
-
return editorSettings?.component_uid || null;
|
|
2044
|
-
}
|
|
2045
|
-
});
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
// src/utils/is-component-instance.ts
|
|
2049
|
-
function isComponentInstance(elementModel) {
|
|
2050
|
-
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
// src/utils/get-component-documents.ts
|
|
2054
|
-
async function getComponentDocuments(elements, cache = /* @__PURE__ */ new Map()) {
|
|
2055
|
-
const componentIds = await getComponentIds(elements, cache);
|
|
2056
|
-
return getDocumentsMap(componentIds, cache);
|
|
2057
|
-
}
|
|
2058
|
-
async function getComponentIds(elements, cache) {
|
|
2059
|
-
const results = await Promise.all(
|
|
2060
|
-
elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
|
|
2061
|
-
const ids = [];
|
|
2062
|
-
if (isComponentInstance({ widgetType, elType })) {
|
|
2063
|
-
const componentId = settings?.component_instance?.value?.component_id.value;
|
|
2064
|
-
if (!componentId) {
|
|
2065
|
-
return ids;
|
|
2066
|
-
}
|
|
2067
|
-
ids.push(componentId);
|
|
2068
|
-
if (!cache.has(componentId)) {
|
|
2069
|
-
cache.set(componentId, getComponentDocumentData(componentId));
|
|
2070
|
-
}
|
|
2071
|
-
const doc = await cache.get(componentId);
|
|
2072
|
-
childElements = doc?.elements;
|
|
2073
|
-
}
|
|
2074
|
-
if (childElements?.length) {
|
|
2075
|
-
const childIds = await getComponentIds(childElements, cache);
|
|
2076
|
-
ids.push(...childIds);
|
|
2077
|
-
}
|
|
2078
|
-
return ids;
|
|
2079
|
-
})
|
|
2080
|
-
);
|
|
2081
|
-
return [...new Set(results.flat())];
|
|
2082
|
-
}
|
|
2083
|
-
async function getDocumentsMap(ids, cache) {
|
|
2084
|
-
const documents = await Promise.all(
|
|
2085
|
-
ids.map(async (id2) => {
|
|
2086
|
-
const document = await cache.get(id2);
|
|
2087
|
-
if (!document) {
|
|
2088
|
-
return null;
|
|
2089
|
-
}
|
|
2090
|
-
return [id2, document];
|
|
2091
|
-
})
|
|
2092
|
-
);
|
|
2093
|
-
return new Map(documents.filter((document) => document !== null));
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
// src/store/actions/load-components-overridable-props.ts
|
|
2097
|
-
var import_store22 = require("@elementor/store");
|
|
2098
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2099
|
-
if (!componentIds.length) {
|
|
2100
|
-
return;
|
|
2101
|
-
}
|
|
2102
|
-
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2103
|
-
}
|
|
2104
|
-
async function loadComponentOverrides(componentId) {
|
|
2105
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0, import_store22.__getState)(), componentId);
|
|
2106
|
-
if (isOverridablePropsLoaded) {
|
|
2107
|
-
return;
|
|
2108
|
-
}
|
|
2109
|
-
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2110
|
-
if (!overridableProps) {
|
|
2111
|
-
return;
|
|
2112
|
-
}
|
|
2113
|
-
(0, import_store22.__dispatch)(
|
|
2114
|
-
slice.actions.setOverridableProps({
|
|
2115
|
-
componentId,
|
|
2116
|
-
overridableProps
|
|
2117
|
-
})
|
|
2118
|
-
);
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
// src/store/actions/load-components-styles.ts
|
|
2122
|
-
var import_store24 = require("@elementor/store");
|
|
2123
|
-
function loadComponentsStyles(documents) {
|
|
2124
|
-
if (!documents.size) {
|
|
2125
|
-
return;
|
|
2126
|
-
}
|
|
2127
|
-
const knownComponents = selectStyles((0, import_store24.__getState)());
|
|
2128
|
-
const unknownDocuments = new Map([...documents.entries()].filter(([id2]) => !knownComponents[id2]));
|
|
2129
|
-
if (!unknownDocuments.size) {
|
|
2130
|
-
return;
|
|
2131
|
-
}
|
|
2132
|
-
addStyles(unknownDocuments);
|
|
2133
|
-
}
|
|
2134
|
-
function addStyles(documents) {
|
|
2135
|
-
const styles = Object.fromEntries(
|
|
2136
|
-
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2137
|
-
);
|
|
2138
|
-
(0, import_store24.__dispatch)(slice.actions.addStyles(styles));
|
|
2139
|
-
}
|
|
2140
|
-
function extractStylesFromDocument(document) {
|
|
2141
|
-
if (!document.elements?.length) {
|
|
2142
|
-
return [];
|
|
2143
|
-
}
|
|
2144
|
-
return document.elements.flatMap(extractStylesFromElement);
|
|
2145
|
-
}
|
|
2146
|
-
function extractStylesFromElement(element) {
|
|
2147
|
-
return [
|
|
2148
|
-
...Object.values(element.styles ?? {}),
|
|
2149
|
-
...(element.elements ?? []).flatMap(extractStylesFromElement)
|
|
2150
|
-
];
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
// src/store/actions/load-components-assets.ts
|
|
2154
|
-
async function loadComponentsAssets(elements) {
|
|
2155
|
-
const documents = await getComponentDocuments(elements);
|
|
2156
|
-
updateDocumentState(documents);
|
|
2157
|
-
loadComponentsStyles(documents);
|
|
2158
|
-
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2159
|
-
}
|
|
2160
|
-
function updateDocumentState(documents) {
|
|
2161
|
-
const isDrafted = [...documents.values()].some(import_editor_documents4.isDocumentDirty);
|
|
2162
|
-
if (isDrafted) {
|
|
2163
|
-
(0, import_editor_documents4.setDocumentModifiedStatus)(true);
|
|
2164
|
-
}
|
|
2582
|
+
getComponentId() {
|
|
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
|
+
});
|
|
2165
2593
|
}
|
|
2166
2594
|
|
|
2167
|
-
// src/components/load-template-components.tsx
|
|
2168
|
-
var LoadTemplateComponents = () => {
|
|
2169
|
-
const templates = (0, import_editor_templates.useLoadedTemplates)();
|
|
2170
|
-
(0, import_react6.useEffect)(() => {
|
|
2171
|
-
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2172
|
-
}, [templates]);
|
|
2173
|
-
return null;
|
|
2174
|
-
};
|
|
2175
|
-
|
|
2176
2595
|
// src/extended/init.ts
|
|
2177
2596
|
var import_editor = require("@elementor/editor");
|
|
2178
2597
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
@@ -2180,28 +2599,28 @@ var import_editor_documents13 = require("@elementor/editor-documents");
|
|
|
2180
2599
|
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
2181
2600
|
var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
2182
2601
|
var import_editor_panels6 = require("@elementor/editor-panels");
|
|
2183
|
-
var
|
|
2184
|
-
var
|
|
2602
|
+
var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
|
|
2603
|
+
var import_i18n34 = require("@wordpress/i18n");
|
|
2185
2604
|
|
|
2186
2605
|
// src/extended/components/component-panel-header/component-panel-header.tsx
|
|
2187
|
-
var
|
|
2606
|
+
var React29 = __toESM(require("react"));
|
|
2188
2607
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2189
2608
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
2190
2609
|
var import_editor_panels5 = require("@elementor/editor-panels");
|
|
2191
|
-
var
|
|
2192
|
-
var
|
|
2193
|
-
var
|
|
2610
|
+
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
2611
|
+
var import_icons16 = require("@elementor/icons");
|
|
2612
|
+
var import_store32 = require("@elementor/store");
|
|
2194
2613
|
var import_ui23 = require("@elementor/ui");
|
|
2195
|
-
var
|
|
2614
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2196
2615
|
|
|
2197
2616
|
// src/extended/hooks/use-navigate-back.ts
|
|
2198
|
-
var
|
|
2617
|
+
var import_react8 = require("react");
|
|
2199
2618
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2200
|
-
var
|
|
2619
|
+
var import_store28 = require("@elementor/store");
|
|
2201
2620
|
function useNavigateBack() {
|
|
2202
|
-
const path = (0,
|
|
2621
|
+
const path = (0, import_store28.__useSelector)(selectPath);
|
|
2203
2622
|
const documentsManager = (0, import_editor_documents5.getV1DocumentsManager)();
|
|
2204
|
-
return (0,
|
|
2623
|
+
return (0, import_react8.useCallback)(() => {
|
|
2205
2624
|
const { componentId: prevComponentId, instanceId: prevComponentInstanceId } = path.at(-2) ?? {};
|
|
2206
2625
|
if (prevComponentId && prevComponentInstanceId) {
|
|
2207
2626
|
switchToComponent(prevComponentId, prevComponentInstanceId);
|
|
@@ -2212,11 +2631,11 @@ function useNavigateBack() {
|
|
|
2212
2631
|
}
|
|
2213
2632
|
|
|
2214
2633
|
// src/extended/components/component-introduction.tsx
|
|
2215
|
-
var
|
|
2634
|
+
var React20 = __toESM(require("react"));
|
|
2216
2635
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2217
|
-
var
|
|
2636
|
+
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2218
2637
|
var import_ui14 = require("@elementor/ui");
|
|
2219
|
-
var
|
|
2638
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2220
2639
|
var ComponentIntroduction = ({
|
|
2221
2640
|
anchorRef,
|
|
2222
2641
|
shouldShowIntroduction,
|
|
@@ -2225,7 +2644,7 @@ var ComponentIntroduction = ({
|
|
|
2225
2644
|
if (!anchorRef.current || !shouldShowIntroduction) {
|
|
2226
2645
|
return null;
|
|
2227
2646
|
}
|
|
2228
|
-
return /* @__PURE__ */
|
|
2647
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2229
2648
|
import_ui14.Popover,
|
|
2230
2649
|
{
|
|
2231
2650
|
anchorEl: anchorRef.current,
|
|
@@ -2240,20 +2659,20 @@ var ComponentIntroduction = ({
|
|
|
2240
2659
|
},
|
|
2241
2660
|
onClose
|
|
2242
2661
|
},
|
|
2243
|
-
/* @__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(
|
|
2244
2663
|
import_ui14.Image,
|
|
2245
2664
|
{
|
|
2246
2665
|
sx: { width: "296px", height: "160px" },
|
|
2247
2666
|
src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
|
|
2248
2667
|
alt: ""
|
|
2249
2668
|
}
|
|
2250
|
-
), /* @__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.__)(
|
|
2251
2670
|
"Select any Element, then in the General tab, click next to any setting you want users to customize - like text, images, or links.",
|
|
2252
2671
|
"elementor"
|
|
2253
|
-
)), /* @__PURE__ */
|
|
2672
|
+
)), /* @__PURE__ */ React20.createElement(import_ui14.Typography, { variant: "body2", sx: { mt: 2 } }, (0, import_i18n11.__)(
|
|
2254
2673
|
"Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
|
|
2255
2674
|
"elementor"
|
|
2256
|
-
)), /* @__PURE__ */
|
|
2675
|
+
)), /* @__PURE__ */ React20.createElement(
|
|
2257
2676
|
import_ui14.Link,
|
|
2258
2677
|
{
|
|
2259
2678
|
href: "http://go.elementor.com/components-guide",
|
|
@@ -2262,28 +2681,28 @@ var ComponentIntroduction = ({
|
|
|
2262
2681
|
color: "info.main",
|
|
2263
2682
|
variant: "body2"
|
|
2264
2683
|
},
|
|
2265
|
-
(0,
|
|
2266
|
-
), /* @__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"))))))
|
|
2267
2686
|
);
|
|
2268
2687
|
};
|
|
2269
2688
|
|
|
2270
2689
|
// src/extended/components/component-properties-panel/component-properties-panel.tsx
|
|
2271
|
-
var
|
|
2690
|
+
var React27 = __toESM(require("react"));
|
|
2272
2691
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
2273
2692
|
var import_editor_panels4 = require("@elementor/editor-panels");
|
|
2274
|
-
var
|
|
2693
|
+
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
2275
2694
|
var import_ui21 = require("@elementor/ui");
|
|
2276
|
-
var
|
|
2695
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
2277
2696
|
|
|
2278
2697
|
// src/extended/components/component-properties-panel/component-properties-panel-content.tsx
|
|
2279
|
-
var
|
|
2280
|
-
var
|
|
2698
|
+
var React26 = __toESM(require("react"));
|
|
2699
|
+
var import_react12 = require("react");
|
|
2281
2700
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
2282
2701
|
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
2283
|
-
var
|
|
2702
|
+
var import_icons14 = require("@elementor/icons");
|
|
2284
2703
|
var import_ui20 = require("@elementor/ui");
|
|
2285
2704
|
var import_utils6 = require("@elementor/utils");
|
|
2286
|
-
var
|
|
2705
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2287
2706
|
|
|
2288
2707
|
// src/extended/store/actions/add-overridable-group.ts
|
|
2289
2708
|
function addOverridableGroup({
|
|
@@ -2324,7 +2743,7 @@ function addOverridableGroup({
|
|
|
2324
2743
|
|
|
2325
2744
|
// src/extended/store/utils/groups-transformers.ts
|
|
2326
2745
|
var import_utils5 = require("@elementor/utils");
|
|
2327
|
-
var
|
|
2746
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2328
2747
|
function removePropFromAllGroups(groups, propKey) {
|
|
2329
2748
|
const propKeys = Array.isArray(propKey) ? propKey : [propKey];
|
|
2330
2749
|
return {
|
|
@@ -2393,7 +2812,7 @@ function resolveOrCreateGroup(groups, requestedGroupId) {
|
|
|
2393
2812
|
}
|
|
2394
2813
|
function createGroup(groups, groupId, label) {
|
|
2395
2814
|
const newGroupId = groupId || (0, import_utils5.generateUniqueId)("group");
|
|
2396
|
-
const newLabel = label || (0,
|
|
2815
|
+
const newLabel = label || (0, import_i18n12.__)("Default", "elementor");
|
|
2397
2816
|
return {
|
|
2398
2817
|
groups: {
|
|
2399
2818
|
...groups,
|
|
@@ -2486,9 +2905,9 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
2486
2905
|
}
|
|
2487
2906
|
|
|
2488
2907
|
// src/extended/utils/revert-overridable-settings.ts
|
|
2489
|
-
var
|
|
2908
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2490
2909
|
function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
|
|
2491
|
-
const container = (0,
|
|
2910
|
+
const container = (0, import_editor_elements9.getContainer)(elementId);
|
|
2492
2911
|
if (!container) {
|
|
2493
2912
|
return;
|
|
2494
2913
|
}
|
|
@@ -2496,14 +2915,14 @@ function revertElementOverridableSetting(elementId, settingKey, originValue, ove
|
|
|
2496
2915
|
revertComponentInstanceOverridableSetting(elementId, overrideKey);
|
|
2497
2916
|
return;
|
|
2498
2917
|
}
|
|
2499
|
-
(0,
|
|
2918
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2500
2919
|
id: elementId,
|
|
2501
2920
|
props: { [settingKey]: originValue ?? null },
|
|
2502
2921
|
withHistory: false
|
|
2503
2922
|
});
|
|
2504
2923
|
}
|
|
2505
2924
|
function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
|
|
2506
|
-
const setting = (0,
|
|
2925
|
+
const setting = (0, import_editor_elements9.getElementSetting)(elementId, "component_instance");
|
|
2507
2926
|
const componentInstance = componentInstancePropTypeUtil.extract(setting);
|
|
2508
2927
|
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
2509
2928
|
if (!overrides?.length) {
|
|
@@ -2514,7 +2933,7 @@ function revertComponentInstanceOverridableSetting(elementId, overrideKey) {
|
|
|
2514
2933
|
...componentInstance,
|
|
2515
2934
|
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
2516
2935
|
});
|
|
2517
|
-
(0,
|
|
2936
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2518
2937
|
id: elementId,
|
|
2519
2938
|
props: { component_instance: updatedSetting },
|
|
2520
2939
|
withHistory: false
|
|
@@ -2579,8 +2998,8 @@ function revertComponentInstanceSettings(settings) {
|
|
|
2579
2998
|
};
|
|
2580
2999
|
}
|
|
2581
3000
|
function revertAllOverridablesInContainer(container) {
|
|
2582
|
-
(0,
|
|
2583
|
-
if (element.model.get("widgetType") ===
|
|
3001
|
+
(0, import_editor_elements9.getAllDescendants)(container).forEach((element) => {
|
|
3002
|
+
if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE2) {
|
|
2584
3003
|
revertComponentInstanceOverridesInElement(element);
|
|
2585
3004
|
} else {
|
|
2586
3005
|
revertElementSettings(element);
|
|
@@ -2599,7 +3018,7 @@ function revertComponentInstanceOverridesInElement(element) {
|
|
|
2599
3018
|
...componentInstance,
|
|
2600
3019
|
overrides: componentInstanceOverridesPropTypeUtil.create(revertedOverrides)
|
|
2601
3020
|
});
|
|
2602
|
-
(0,
|
|
3021
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2603
3022
|
id: element.id,
|
|
2604
3023
|
props: { component_instance: updatedSetting },
|
|
2605
3024
|
withHistory: false
|
|
@@ -2611,7 +3030,7 @@ function revertElementSettings(element) {
|
|
|
2611
3030
|
if (!hasChanges) {
|
|
2612
3031
|
return;
|
|
2613
3032
|
}
|
|
2614
|
-
(0,
|
|
3033
|
+
(0, import_editor_elements9.updateElementSettings)({
|
|
2615
3034
|
id: element.id,
|
|
2616
3035
|
props: revertedSettings,
|
|
2617
3036
|
withHistory: false
|
|
@@ -2735,14 +3154,14 @@ function updateOverridablePropParams({
|
|
|
2735
3154
|
}
|
|
2736
3155
|
|
|
2737
3156
|
// src/extended/components/component-properties-panel/properties-empty-state.tsx
|
|
2738
|
-
var
|
|
2739
|
-
var
|
|
2740
|
-
var
|
|
3157
|
+
var React21 = __toESM(require("react"));
|
|
3158
|
+
var import_react9 = require("react");
|
|
3159
|
+
var import_icons10 = require("@elementor/icons");
|
|
2741
3160
|
var import_ui15 = require("@elementor/ui");
|
|
2742
|
-
var
|
|
3161
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2743
3162
|
function PropertiesEmptyState({ introductionRef }) {
|
|
2744
|
-
const [isOpen, setIsOpen] = (0,
|
|
2745
|
-
return /* @__PURE__ */
|
|
3163
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
3164
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2746
3165
|
import_ui15.Stack,
|
|
2747
3166
|
{
|
|
2748
3167
|
alignItems: "center",
|
|
@@ -2752,11 +3171,11 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2752
3171
|
sx: { px: 2.5, pt: 10, pb: 5.5 },
|
|
2753
3172
|
gap: 1
|
|
2754
3173
|
},
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__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(
|
|
2760
3179
|
import_ui15.Link,
|
|
2761
3180
|
{
|
|
2762
3181
|
variant: "caption",
|
|
@@ -2764,9 +3183,9 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2764
3183
|
sx: { textDecorationLine: "underline" },
|
|
2765
3184
|
onClick: () => setIsOpen(true)
|
|
2766
3185
|
},
|
|
2767
|
-
(0,
|
|
3186
|
+
(0, import_i18n13.__)("Learn more", "elementor")
|
|
2768
3187
|
)
|
|
2769
|
-
), /* @__PURE__ */
|
|
3188
|
+
), /* @__PURE__ */ React21.createElement(
|
|
2770
3189
|
ComponentIntroduction,
|
|
2771
3190
|
{
|
|
2772
3191
|
anchorRef: introductionRef,
|
|
@@ -2777,30 +3196,30 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2777
3196
|
}
|
|
2778
3197
|
|
|
2779
3198
|
// src/extended/components/component-properties-panel/properties-group.tsx
|
|
2780
|
-
var
|
|
2781
|
-
var
|
|
2782
|
-
var
|
|
3199
|
+
var React25 = __toESM(require("react"));
|
|
3200
|
+
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
3201
|
+
var import_icons13 = require("@elementor/icons");
|
|
2783
3202
|
var import_ui19 = require("@elementor/ui");
|
|
2784
|
-
var
|
|
3203
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2785
3204
|
|
|
2786
3205
|
// src/extended/components/component-properties-panel/property-item.tsx
|
|
2787
|
-
var
|
|
2788
|
-
var
|
|
2789
|
-
var
|
|
3206
|
+
var React24 = __toESM(require("react"));
|
|
3207
|
+
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
3208
|
+
var import_icons12 = require("@elementor/icons");
|
|
2790
3209
|
var import_ui18 = require("@elementor/ui");
|
|
2791
3210
|
|
|
2792
3211
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2793
|
-
var
|
|
2794
|
-
var
|
|
2795
|
-
var
|
|
3212
|
+
var React22 = __toESM(require("react"));
|
|
3213
|
+
var import_react10 = require("react");
|
|
3214
|
+
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2796
3215
|
var import_ui16 = require("@elementor/ui");
|
|
2797
|
-
var
|
|
3216
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2798
3217
|
|
|
2799
3218
|
// src/extended/components/overridable-props/utils/validate-prop-label.ts
|
|
2800
|
-
var
|
|
3219
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2801
3220
|
var ERROR_MESSAGES = {
|
|
2802
|
-
EMPTY_NAME: (0,
|
|
2803
|
-
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")
|
|
2804
3223
|
};
|
|
2805
3224
|
function validatePropLabel(label, existingLabels, currentLabel) {
|
|
2806
3225
|
const trimmedLabel = label.trim();
|
|
@@ -2824,17 +3243,17 @@ function validatePropLabel(label, existingLabels, currentLabel) {
|
|
|
2824
3243
|
|
|
2825
3244
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2826
3245
|
var SIZE = "tiny";
|
|
2827
|
-
var DEFAULT_GROUP = { value: null, label: (0,
|
|
3246
|
+
var DEFAULT_GROUP = { value: null, label: (0, import_i18n15.__)("Default", "elementor") };
|
|
2828
3247
|
function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels = [], sx }) {
|
|
2829
3248
|
const selectGroups = groups?.length ? groups : [DEFAULT_GROUP];
|
|
2830
|
-
const [propLabel, setPropLabel] = (0,
|
|
2831
|
-
const [group, setGroup] = (0,
|
|
2832
|
-
const [error, setError] = (0,
|
|
2833
|
-
const name = (0,
|
|
2834
|
-
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");
|
|
2835
3254
|
const isCreate = currentValue === void 0;
|
|
2836
|
-
const title = isCreate ? (0,
|
|
2837
|
-
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");
|
|
2838
3257
|
const handleSubmit = () => {
|
|
2839
3258
|
const validationResult = validatePropLabel(propLabel ?? "", existingLabels, currentValue?.label);
|
|
2840
3259
|
if (!validationResult.isValid) {
|
|
@@ -2843,7 +3262,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2843
3262
|
}
|
|
2844
3263
|
onSubmit({ label: propLabel ?? "", group });
|
|
2845
3264
|
};
|
|
2846
|
-
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(
|
|
2847
3266
|
import_ui16.Stack,
|
|
2848
3267
|
{
|
|
2849
3268
|
direction: "row",
|
|
@@ -2852,14 +3271,14 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2852
3271
|
px: 1.5,
|
|
2853
3272
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%", mb: 1.5 }
|
|
2854
3273
|
},
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
), /* @__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(
|
|
2857
3276
|
import_ui16.TextField,
|
|
2858
3277
|
{
|
|
2859
3278
|
name,
|
|
2860
3279
|
size: SIZE,
|
|
2861
3280
|
fullWidth: true,
|
|
2862
|
-
placeholder: (0,
|
|
3281
|
+
placeholder: (0, import_i18n15.__)("Enter value", "elementor"),
|
|
2863
3282
|
value: propLabel ?? "",
|
|
2864
3283
|
onChange: (e) => {
|
|
2865
3284
|
const newValue = e.target.value;
|
|
@@ -2874,7 +3293,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2874
3293
|
error: Boolean(error),
|
|
2875
3294
|
helperText: error
|
|
2876
3295
|
}
|
|
2877
|
-
))), /* @__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(
|
|
2878
3297
|
import_ui16.Select,
|
|
2879
3298
|
{
|
|
2880
3299
|
name: groupName,
|
|
@@ -2890,8 +3309,8 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2890
3309
|
return selectGroups.find(({ value }) => value === selectedValue)?.label ?? selectedValue;
|
|
2891
3310
|
}
|
|
2892
3311
|
},
|
|
2893
|
-
selectGroups.map(({ label: groupLabel, ...props }) => /* @__PURE__ */
|
|
2894
|
-
))), /* @__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(
|
|
2895
3314
|
import_ui16.Button,
|
|
2896
3315
|
{
|
|
2897
3316
|
type: "submit",
|
|
@@ -2905,11 +3324,11 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2905
3324
|
}
|
|
2906
3325
|
|
|
2907
3326
|
// src/extended/components/component-properties-panel/sortable.tsx
|
|
2908
|
-
var
|
|
2909
|
-
var
|
|
3327
|
+
var React23 = __toESM(require("react"));
|
|
3328
|
+
var import_icons11 = require("@elementor/icons");
|
|
2910
3329
|
var import_ui17 = require("@elementor/ui");
|
|
2911
|
-
var SortableProvider = (props) => /* @__PURE__ */
|
|
2912
|
-
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(
|
|
2913
3332
|
StyledSortableTrigger,
|
|
2914
3333
|
{
|
|
2915
3334
|
...props,
|
|
@@ -2917,9 +3336,9 @@ var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React2
|
|
|
2917
3336
|
className: `sortable-trigger ${triggerClassName ?? ""}`.trim(),
|
|
2918
3337
|
"aria-label": "sort"
|
|
2919
3338
|
},
|
|
2920
|
-
/* @__PURE__ */
|
|
3339
|
+
/* @__PURE__ */ React23.createElement(import_icons11.GripVerticalIcon, { fontSize: "tiny" })
|
|
2921
3340
|
);
|
|
2922
|
-
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */
|
|
3341
|
+
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React23.createElement(
|
|
2923
3342
|
import_ui17.UnstableSortableItem,
|
|
2924
3343
|
{
|
|
2925
3344
|
id: id2,
|
|
@@ -2933,7 +3352,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2933
3352
|
showDropIndication,
|
|
2934
3353
|
isDragOverlay,
|
|
2935
3354
|
isDragPlaceholder
|
|
2936
|
-
}) => /* @__PURE__ */
|
|
3355
|
+
}) => /* @__PURE__ */ React23.createElement(
|
|
2937
3356
|
import_ui17.Box,
|
|
2938
3357
|
{
|
|
2939
3358
|
...itemProps,
|
|
@@ -2950,7 +3369,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2950
3369
|
triggerProps,
|
|
2951
3370
|
triggerStyle
|
|
2952
3371
|
}),
|
|
2953
|
-
showDropIndication && /* @__PURE__ */
|
|
3372
|
+
showDropIndication && /* @__PURE__ */ React23.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
2954
3373
|
)
|
|
2955
3374
|
}
|
|
2956
3375
|
);
|
|
@@ -2991,7 +3410,7 @@ function PropertyItem({
|
|
|
2991
3410
|
event.stopPropagation();
|
|
2992
3411
|
onDelete(prop.overrideKey);
|
|
2993
3412
|
};
|
|
2994
|
-
return /* @__PURE__ */
|
|
3413
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(
|
|
2995
3414
|
import_ui18.Box,
|
|
2996
3415
|
{
|
|
2997
3416
|
...(0, import_ui18.bindTrigger)(popoverState),
|
|
@@ -3026,17 +3445,17 @@ function PropertyItem({
|
|
|
3026
3445
|
}
|
|
3027
3446
|
}
|
|
3028
3447
|
},
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ React24.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
3449
|
+
/* @__PURE__ */ React24.createElement(
|
|
3031
3450
|
import_ui18.Box,
|
|
3032
3451
|
{
|
|
3033
3452
|
sx: { display: "flex", alignItems: "center", color: "text.primary", fontSize: 12, padding: 0.25 }
|
|
3034
3453
|
},
|
|
3035
|
-
/* @__PURE__ */
|
|
3454
|
+
/* @__PURE__ */ React24.createElement("i", { className: icon })
|
|
3036
3455
|
),
|
|
3037
|
-
/* @__PURE__ */
|
|
3038
|
-
/* @__PURE__ */
|
|
3039
|
-
), /* @__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(
|
|
3040
3459
|
import_ui18.Popover,
|
|
3041
3460
|
{
|
|
3042
3461
|
...popoverProps,
|
|
@@ -3044,7 +3463,7 @@ function PropertyItem({
|
|
|
3044
3463
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
3045
3464
|
PaperProps: { sx: { width: popoverState.anchorEl?.getBoundingClientRect().width } }
|
|
3046
3465
|
},
|
|
3047
|
-
/* @__PURE__ */
|
|
3466
|
+
/* @__PURE__ */ React24.createElement(
|
|
3048
3467
|
OverridablePropForm,
|
|
3049
3468
|
{
|
|
3050
3469
|
onSubmit: handleSubmit,
|
|
@@ -3058,7 +3477,7 @@ function PropertyItem({
|
|
|
3058
3477
|
}
|
|
3059
3478
|
function getElementIcon(prop) {
|
|
3060
3479
|
const elType = prop.elType === "widget" ? prop.widgetType : prop.elType;
|
|
3061
|
-
const widgetsCache = (0,
|
|
3480
|
+
const widgetsCache = (0, import_editor_elements10.getWidgetsCache)();
|
|
3062
3481
|
if (!widgetsCache) {
|
|
3063
3482
|
return "eicon-apps";
|
|
3064
3483
|
}
|
|
@@ -3095,14 +3514,14 @@ function PropertiesGroup({
|
|
|
3095
3514
|
popupState.close();
|
|
3096
3515
|
onGroupDelete(group.id);
|
|
3097
3516
|
};
|
|
3098
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3099
3518
|
import_ui19.Box,
|
|
3100
3519
|
{
|
|
3101
3520
|
sx: {
|
|
3102
3521
|
opacity: isDragPlaceholder ? 0.5 : 1
|
|
3103
3522
|
}
|
|
3104
3523
|
},
|
|
3105
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ React25.createElement(import_ui19.Stack, { gap: 1 }, /* @__PURE__ */ React25.createElement(
|
|
3106
3525
|
import_ui19.Box,
|
|
3107
3526
|
{
|
|
3108
3527
|
className: "group-header",
|
|
@@ -3122,8 +3541,8 @@ function PropertiesGroup({
|
|
|
3122
3541
|
}
|
|
3123
3542
|
}
|
|
3124
3543
|
},
|
|
3125
|
-
/* @__PURE__ */
|
|
3126
|
-
/* @__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(
|
|
3127
3546
|
import_ui19.Box,
|
|
3128
3547
|
{
|
|
3129
3548
|
sx: {
|
|
@@ -3141,8 +3560,8 @@ function PropertiesGroup({
|
|
|
3141
3560
|
width: "100%"
|
|
3142
3561
|
}
|
|
3143
3562
|
},
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
|
|
3563
|
+
/* @__PURE__ */ React25.createElement(
|
|
3564
|
+
import_editor_ui10.EditableField,
|
|
3146
3565
|
{
|
|
3147
3566
|
ref: editableRef,
|
|
3148
3567
|
as: import_ui19.Typography,
|
|
@@ -3152,26 +3571,26 @@ function PropertiesGroup({
|
|
|
3152
3571
|
...getEditableProps()
|
|
3153
3572
|
}
|
|
3154
3573
|
)
|
|
3155
|
-
) : /* @__PURE__ */
|
|
3156
|
-
|
|
3574
|
+
) : /* @__PURE__ */ React25.createElement(
|
|
3575
|
+
import_editor_ui10.EllipsisWithTooltip,
|
|
3157
3576
|
{
|
|
3158
3577
|
title: group.label,
|
|
3159
3578
|
as: import_ui19.Typography,
|
|
3160
3579
|
variant: "caption",
|
|
3161
3580
|
sx: { color: "text.primary", fontWeight: 400, lineHeight: 1.66 }
|
|
3162
3581
|
}
|
|
3163
|
-
), /* @__PURE__ */
|
|
3582
|
+
), /* @__PURE__ */ React25.createElement(
|
|
3164
3583
|
import_ui19.IconButton,
|
|
3165
3584
|
{
|
|
3166
3585
|
className: "group-menu",
|
|
3167
3586
|
size: "tiny",
|
|
3168
3587
|
sx: { p: 0.25, visibility: isThisGroupEditing ? "visible" : void 0 },
|
|
3169
|
-
"aria-label": (0,
|
|
3588
|
+
"aria-label": (0, import_i18n16.__)("Group actions", "elementor"),
|
|
3170
3589
|
...(0, import_ui19.bindTrigger)(popupState)
|
|
3171
3590
|
},
|
|
3172
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ React25.createElement(import_icons13.DotsVerticalIcon, { fontSize: "tiny" })
|
|
3173
3592
|
))
|
|
3174
|
-
), /* @__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(
|
|
3175
3594
|
PropertyItem,
|
|
3176
3595
|
{
|
|
3177
3596
|
prop,
|
|
@@ -3183,27 +3602,27 @@ function PropertiesGroup({
|
|
|
3183
3602
|
onUpdate: (data) => onPropertyUpdate(prop.overrideKey, data)
|
|
3184
3603
|
}
|
|
3185
3604
|
)))))),
|
|
3186
|
-
/* @__PURE__ */
|
|
3605
|
+
/* @__PURE__ */ React25.createElement(
|
|
3187
3606
|
import_ui19.Menu,
|
|
3188
3607
|
{
|
|
3189
3608
|
...(0, import_ui19.bindMenu)(popupState),
|
|
3190
3609
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
3191
3610
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
3192
3611
|
},
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__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(
|
|
3195
3614
|
import_ui19.Tooltip,
|
|
3196
3615
|
{
|
|
3197
|
-
title: hasProperties ? (0,
|
|
3616
|
+
title: hasProperties ? (0, import_i18n16.__)("To delete the group, first remove all the properties", "elementor") : "",
|
|
3198
3617
|
placement: "right"
|
|
3199
3618
|
},
|
|
3200
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ React25.createElement("span", null, /* @__PURE__ */ React25.createElement(import_editor_ui10.MenuListItem, { onClick: handleDeleteClick, disabled: hasProperties }, /* @__PURE__ */ React25.createElement(
|
|
3201
3620
|
import_ui19.Typography,
|
|
3202
3621
|
{
|
|
3203
3622
|
variant: "caption",
|
|
3204
3623
|
sx: { color: hasProperties ? "text.disabled" : "error.light" }
|
|
3205
3624
|
},
|
|
3206
|
-
(0,
|
|
3625
|
+
(0, import_i18n16.__)("Delete", "elementor")
|
|
3207
3626
|
)))
|
|
3208
3627
|
)
|
|
3209
3628
|
)
|
|
@@ -3211,10 +3630,10 @@ function PropertiesGroup({
|
|
|
3211
3630
|
}
|
|
3212
3631
|
|
|
3213
3632
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3214
|
-
var
|
|
3633
|
+
var import_react11 = require("react");
|
|
3215
3634
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
3216
|
-
var
|
|
3217
|
-
var
|
|
3635
|
+
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3636
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
3218
3637
|
|
|
3219
3638
|
// src/extended/store/actions/rename-overridable-group.ts
|
|
3220
3639
|
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
@@ -3235,10 +3654,10 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
3235
3654
|
}
|
|
3236
3655
|
|
|
3237
3656
|
// src/extended/components/component-properties-panel/utils/validate-group-label.ts
|
|
3238
|
-
var
|
|
3657
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
3239
3658
|
var ERROR_MESSAGES2 = {
|
|
3240
|
-
EMPTY_NAME: (0,
|
|
3241
|
-
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")
|
|
3242
3661
|
};
|
|
3243
3662
|
function validateGroupLabel(label, existingGroups) {
|
|
3244
3663
|
const trimmedLabel = label.trim();
|
|
@@ -3254,7 +3673,7 @@ function validateGroupLabel(label, existingGroups) {
|
|
|
3254
3673
|
|
|
3255
3674
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3256
3675
|
function useCurrentEditableItem() {
|
|
3257
|
-
const [editingGroupId, setEditingGroupId] = (0,
|
|
3676
|
+
const [editingGroupId, setEditingGroupId] = (0, import_react11.useState)(null);
|
|
3258
3677
|
const currentComponentId = useCurrentComponentId();
|
|
3259
3678
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
3260
3679
|
const allGroupsRecord = overridableProps?.groups?.items ?? {};
|
|
@@ -3267,7 +3686,7 @@ function useCurrentEditableItem() {
|
|
|
3267
3686
|
};
|
|
3268
3687
|
const handleSubmit = (newLabel) => {
|
|
3269
3688
|
if (!editingGroupId || !currentComponentId) {
|
|
3270
|
-
throw new Error((0,
|
|
3689
|
+
throw new Error((0, import_i18n18.__)("Group ID or component ID is missing", "elementor"));
|
|
3271
3690
|
}
|
|
3272
3691
|
renameOverridableGroup({
|
|
3273
3692
|
componentId: currentComponentId,
|
|
@@ -3282,7 +3701,7 @@ function useCurrentEditableItem() {
|
|
|
3282
3701
|
isEditing,
|
|
3283
3702
|
error,
|
|
3284
3703
|
getProps: getEditableProps
|
|
3285
|
-
} = (0,
|
|
3704
|
+
} = (0, import_editor_ui11.useEditable)({
|
|
3286
3705
|
value: currentGroup?.label ?? "",
|
|
3287
3706
|
onSubmit: handleSubmit,
|
|
3288
3707
|
validation: validateLabel
|
|
@@ -3320,16 +3739,16 @@ function generateUniqueLabel(groups) {
|
|
|
3320
3739
|
function ComponentPropertiesPanelContent({ onClose }) {
|
|
3321
3740
|
const currentComponentId = useCurrentComponentId();
|
|
3322
3741
|
const overridableProps = useSanitizeOverridableProps(currentComponentId);
|
|
3323
|
-
const [isAddingGroup, setIsAddingGroup] = (0,
|
|
3324
|
-
const introductionRef = (0,
|
|
3742
|
+
const [isAddingGroup, setIsAddingGroup] = (0, import_react12.useState)(false);
|
|
3743
|
+
const introductionRef = (0, import_react12.useRef)(null);
|
|
3325
3744
|
const groupLabelEditable = useCurrentEditableItem();
|
|
3326
|
-
const groups = (0,
|
|
3745
|
+
const groups = (0, import_react12.useMemo)(() => {
|
|
3327
3746
|
if (!overridableProps) {
|
|
3328
3747
|
return [];
|
|
3329
3748
|
}
|
|
3330
3749
|
return overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(Boolean);
|
|
3331
3750
|
}, [overridableProps]);
|
|
3332
|
-
const allGroupsForSelect = (0,
|
|
3751
|
+
const allGroupsForSelect = (0, import_react12.useMemo)(
|
|
3333
3752
|
() => groups.map((group) => ({ value: group.id, label: group.label })),
|
|
3334
3753
|
[groups]
|
|
3335
3754
|
);
|
|
@@ -3380,24 +3799,24 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
3380
3799
|
deleteOverridableGroup({ componentId: currentComponentId, groupId });
|
|
3381
3800
|
(0, import_editor_documents7.setDocumentModifiedStatus)(true);
|
|
3382
3801
|
};
|
|
3383
|
-
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(
|
|
3384
3803
|
import_ui20.IconButton,
|
|
3385
3804
|
{
|
|
3386
3805
|
size: "tiny",
|
|
3387
|
-
"aria-label": (0,
|
|
3806
|
+
"aria-label": (0, import_i18n19.__)("Add new group", "elementor"),
|
|
3388
3807
|
onClick: handleAddGroupClick
|
|
3389
3808
|
},
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
)), /* @__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(
|
|
3392
3811
|
import_ui20.IconButton,
|
|
3393
3812
|
{
|
|
3394
3813
|
ref: introductionRef,
|
|
3395
3814
|
size: "tiny",
|
|
3396
|
-
"aria-label": (0,
|
|
3815
|
+
"aria-label": (0, import_i18n19.__)("Close panel", "elementor"),
|
|
3397
3816
|
onClick: onClose
|
|
3398
3817
|
},
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
))), /* @__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(
|
|
3401
3820
|
PropertiesGroup,
|
|
3402
3821
|
{
|
|
3403
3822
|
group,
|
|
@@ -3425,7 +3844,7 @@ var { panel, usePanelActions } = (0, import_editor_panels4.__createPanel)({
|
|
|
3425
3844
|
function ComponentPropertiesPanel() {
|
|
3426
3845
|
const { close: closePanel } = usePanelActions();
|
|
3427
3846
|
const { open: openEditingPanel } = (0, import_editor_editing_panel5.usePanelActions)();
|
|
3428
|
-
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(
|
|
3429
3848
|
ComponentPropertiesPanelContent,
|
|
3430
3849
|
{
|
|
3431
3850
|
onClose: () => {
|
|
@@ -3435,18 +3854,18 @@ function ComponentPropertiesPanel() {
|
|
|
3435
3854
|
}
|
|
3436
3855
|
))));
|
|
3437
3856
|
}
|
|
3438
|
-
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"))));
|
|
3439
3858
|
|
|
3440
3859
|
// src/extended/components/component-panel-header/component-badge.tsx
|
|
3441
|
-
var
|
|
3442
|
-
var
|
|
3443
|
-
var
|
|
3860
|
+
var React28 = __toESM(require("react"));
|
|
3861
|
+
var import_react13 = require("react");
|
|
3862
|
+
var import_icons15 = require("@elementor/icons");
|
|
3444
3863
|
var import_ui22 = require("@elementor/ui");
|
|
3445
|
-
var
|
|
3446
|
-
var ComponentsBadge =
|
|
3864
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
3865
|
+
var ComponentsBadge = React28.forwardRef(({ overridablePropsCount, onClick }, ref) => {
|
|
3447
3866
|
const prevCount = usePrevious(overridablePropsCount);
|
|
3448
3867
|
const isFirstExposedProperty = prevCount === 0 && overridablePropsCount === 1;
|
|
3449
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3450
3869
|
StyledBadge,
|
|
3451
3870
|
{
|
|
3452
3871
|
ref,
|
|
@@ -3455,17 +3874,17 @@ var ComponentsBadge = React26.forwardRef(({ overridablePropsCount, onClick }, re
|
|
|
3455
3874
|
invisible: overridablePropsCount === 0,
|
|
3456
3875
|
animate: isFirstExposedProperty,
|
|
3457
3876
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3458
|
-
badgeContent: /* @__PURE__ */
|
|
3877
|
+
badgeContent: /* @__PURE__ */ React28.createElement(import_ui22.Box, { sx: { animation: !isFirstExposedProperty ? `${slideUp} 300ms ease-out` : "none" } }, overridablePropsCount)
|
|
3459
3878
|
},
|
|
3460
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ React28.createElement(import_ui22.Tooltip, { title: (0, import_i18n21.__)("Component properties", "elementor") }, /* @__PURE__ */ React28.createElement(
|
|
3461
3880
|
import_ui22.ToggleButton,
|
|
3462
3881
|
{
|
|
3463
3882
|
value: "exposed properties",
|
|
3464
3883
|
size: "tiny",
|
|
3465
3884
|
onClick,
|
|
3466
|
-
"aria-label": (0,
|
|
3885
|
+
"aria-label": (0, import_i18n21.__)("Component properties", "elementor")
|
|
3467
3886
|
},
|
|
3468
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ React28.createElement(import_icons15.ComponentPropListIcon, { fontSize: "tiny" })
|
|
3469
3888
|
))
|
|
3470
3889
|
);
|
|
3471
3890
|
});
|
|
@@ -3482,8 +3901,8 @@ var StyledBadge = (0, import_ui22.styled)(import_ui22.Badge, { shouldForwardProp
|
|
|
3482
3901
|
})
|
|
3483
3902
|
);
|
|
3484
3903
|
function usePrevious(value) {
|
|
3485
|
-
const ref = (0,
|
|
3486
|
-
(0,
|
|
3904
|
+
const ref = (0, import_react13.useRef)(value);
|
|
3905
|
+
(0, import_react13.useEffect)(() => {
|
|
3487
3906
|
ref.current = value;
|
|
3488
3907
|
}, [value]);
|
|
3489
3908
|
return ref.current;
|
|
@@ -3506,10 +3925,10 @@ var ComponentPanelHeader = () => {
|
|
|
3506
3925
|
const onBack = useNavigateBack();
|
|
3507
3926
|
const componentName = getComponentName();
|
|
3508
3927
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(MESSAGE_KEY);
|
|
3509
|
-
const [shouldShowIntroduction, setShouldShowIntroduction] =
|
|
3928
|
+
const [shouldShowIntroduction, setShouldShowIntroduction] = React29.useState(!isMessageSuppressed);
|
|
3510
3929
|
const { open: openPropertiesPanel } = usePanelActions();
|
|
3511
3930
|
const overridablePropsCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
|
|
3512
|
-
const anchorRef =
|
|
3931
|
+
const anchorRef = React29.useRef(null);
|
|
3513
3932
|
if (!currentComponentId) {
|
|
3514
3933
|
return null;
|
|
3515
3934
|
}
|
|
@@ -3526,22 +3945,22 @@ var ComponentPanelHeader = () => {
|
|
|
3526
3945
|
properties_count: overridablePropsCount
|
|
3527
3946
|
});
|
|
3528
3947
|
};
|
|
3529
|
-
return /* @__PURE__ */
|
|
3530
|
-
|
|
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,
|
|
3531
3950
|
{
|
|
3532
3951
|
title: componentName,
|
|
3533
3952
|
as: import_ui23.Typography,
|
|
3534
3953
|
variant: "caption",
|
|
3535
3954
|
sx: { fontWeight: 500, flexGrow: 1 }
|
|
3536
3955
|
}
|
|
3537
|
-
), /* @__PURE__ */
|
|
3956
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3538
3957
|
ComponentsBadge,
|
|
3539
3958
|
{
|
|
3540
3959
|
overridablePropsCount,
|
|
3541
3960
|
ref: anchorRef,
|
|
3542
3961
|
onClick: handleOpenPropertiesPanel
|
|
3543
3962
|
}
|
|
3544
|
-
)), /* @__PURE__ */
|
|
3963
|
+
)), /* @__PURE__ */ React29.createElement(import_ui23.Divider, null), /* @__PURE__ */ React29.createElement(
|
|
3545
3964
|
ComponentIntroduction,
|
|
3546
3965
|
{
|
|
3547
3966
|
anchorRef,
|
|
@@ -3551,7 +3970,7 @@ var ComponentPanelHeader = () => {
|
|
|
3551
3970
|
));
|
|
3552
3971
|
};
|
|
3553
3972
|
function getComponentName() {
|
|
3554
|
-
const state = (0,
|
|
3973
|
+
const state = (0, import_store32.__getState)();
|
|
3555
3974
|
const path = state[SLICE_NAME].path;
|
|
3556
3975
|
const { instanceTitle } = path.at(-1) ?? {};
|
|
3557
3976
|
if (instanceTitle) {
|
|
@@ -3563,39 +3982,39 @@ function getComponentName() {
|
|
|
3563
3982
|
}
|
|
3564
3983
|
|
|
3565
3984
|
// src/extended/components/components-tab/components.tsx
|
|
3566
|
-
var
|
|
3567
|
-
var
|
|
3985
|
+
var React32 = __toESM(require("react"));
|
|
3986
|
+
var import_editor_ui16 = require("@elementor/editor-ui");
|
|
3568
3987
|
var import_ui25 = require("@elementor/ui");
|
|
3569
3988
|
|
|
3570
3989
|
// src/extended/components/components-tab/component-item.tsx
|
|
3571
|
-
var
|
|
3572
|
-
var
|
|
3990
|
+
var React31 = __toESM(require("react"));
|
|
3991
|
+
var import_react14 = require("react");
|
|
3573
3992
|
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
3574
|
-
var
|
|
3575
|
-
var
|
|
3576
|
-
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");
|
|
3577
3996
|
var import_ui24 = require("@elementor/ui");
|
|
3578
|
-
var
|
|
3997
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3579
3998
|
|
|
3580
3999
|
// src/extended/store/actions/archive-component.ts
|
|
3581
4000
|
var import_editor_documents9 = require("@elementor/editor-documents");
|
|
3582
|
-
var
|
|
3583
|
-
var
|
|
4001
|
+
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
4002
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3584
4003
|
var successNotification = (componentId, componentName) => ({
|
|
3585
4004
|
type: "success",
|
|
3586
4005
|
/* translators: %s: component name */
|
|
3587
|
-
message: (0,
|
|
4006
|
+
message: (0, import_i18n23.__)("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
3588
4007
|
id: `success-archived-components-notification-${componentId}`
|
|
3589
4008
|
});
|
|
3590
4009
|
var archiveComponent = (componentId, componentName) => {
|
|
3591
4010
|
componentsActions.archive(componentId);
|
|
3592
4011
|
(0, import_editor_documents9.setDocumentModifiedStatus)(true);
|
|
3593
|
-
(0,
|
|
4012
|
+
(0, import_editor_notifications3.notify)(successNotification(componentId, componentName));
|
|
3594
4013
|
};
|
|
3595
4014
|
|
|
3596
4015
|
// src/extended/store/actions/rename-component.ts
|
|
3597
4016
|
var import_editor_documents10 = require("@elementor/editor-documents");
|
|
3598
|
-
var
|
|
4017
|
+
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
3599
4018
|
var TITLE_EXTERNAL_CHANGE_COMMAND = "title_external_change";
|
|
3600
4019
|
var renameComponent = (componentUid, newName) => {
|
|
3601
4020
|
componentsActions.rename(componentUid, newName);
|
|
@@ -3617,25 +4036,25 @@ function getDocumentContainer() {
|
|
|
3617
4036
|
return documentsManager?.getCurrent()?.container;
|
|
3618
4037
|
}
|
|
3619
4038
|
function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
3620
|
-
const allDescendants = (0,
|
|
4039
|
+
const allDescendants = (0, import_editor_elements11.getAllDescendants)(documentContainer);
|
|
3621
4040
|
return allDescendants.filter((element) => {
|
|
3622
4041
|
const widgetType = element.model.get("widgetType");
|
|
3623
4042
|
const editorSettings = element.model.get("editor_settings");
|
|
3624
|
-
const isMatch = widgetType ===
|
|
4043
|
+
const isMatch = widgetType === COMPONENT_WIDGET_TYPE2 && editorSettings?.component_uid === componentUid;
|
|
3625
4044
|
return isMatch;
|
|
3626
4045
|
});
|
|
3627
4046
|
}
|
|
3628
4047
|
|
|
3629
4048
|
// src/extended/utils/component-form-schema.ts
|
|
3630
4049
|
var import_schema5 = require("@elementor/schema");
|
|
3631
|
-
var
|
|
4050
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3632
4051
|
var MIN_NAME_LENGTH = 2;
|
|
3633
4052
|
var MAX_NAME_LENGTH = 50;
|
|
3634
|
-
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"));
|
|
3635
4054
|
var createBaseComponentSchema = (existingNames) => {
|
|
3636
4055
|
return import_schema5.z.object({
|
|
3637
4056
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
3638
|
-
message: (0,
|
|
4057
|
+
message: (0, import_i18n24.__)("Component name already exists", "elementor")
|
|
3639
4058
|
})
|
|
3640
4059
|
});
|
|
3641
4060
|
};
|
|
@@ -3643,9 +4062,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
3643
4062
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
3644
4063
|
return baseSchema.extend({
|
|
3645
4064
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
3646
|
-
message: (0,
|
|
4065
|
+
message: (0, import_i18n24.__)("Component name is required.", "elementor")
|
|
3647
4066
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
3648
|
-
message: (0,
|
|
4067
|
+
message: (0, import_i18n24.__)("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
3649
4068
|
})
|
|
3650
4069
|
});
|
|
3651
4070
|
};
|
|
@@ -3692,9 +4111,9 @@ var createComponentModel2 = (component) => {
|
|
|
3692
4111
|
};
|
|
3693
4112
|
|
|
3694
4113
|
// src/extended/utils/get-container-for-new-element.ts
|
|
3695
|
-
var
|
|
4114
|
+
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
3696
4115
|
var getContainerForNewElement = () => {
|
|
3697
|
-
const currentDocumentContainer = (0,
|
|
4116
|
+
const currentDocumentContainer = (0, import_editor_elements12.getCurrentDocumentContainer)();
|
|
3698
4117
|
const selectedElement = getSelectedElementContainer();
|
|
3699
4118
|
let container, options;
|
|
3700
4119
|
if (selectedElement) {
|
|
@@ -3720,28 +4139,28 @@ var getContainerForNewElement = () => {
|
|
|
3720
4139
|
return { container: container ?? currentDocumentContainer, options };
|
|
3721
4140
|
};
|
|
3722
4141
|
function getSelectedElementContainer() {
|
|
3723
|
-
const selectedElements = (0,
|
|
4142
|
+
const selectedElements = (0, import_editor_elements12.getSelectedElements)();
|
|
3724
4143
|
if (selectedElements.length !== 1) {
|
|
3725
4144
|
return void 0;
|
|
3726
4145
|
}
|
|
3727
|
-
return (0,
|
|
4146
|
+
return (0, import_editor_elements12.getContainer)(selectedElements[0].id);
|
|
3728
4147
|
}
|
|
3729
4148
|
|
|
3730
4149
|
// src/extended/components/components-tab/delete-confirmation-dialog.tsx
|
|
3731
|
-
var
|
|
3732
|
-
var
|
|
3733
|
-
var
|
|
4150
|
+
var React30 = __toESM(require("react"));
|
|
4151
|
+
var import_editor_ui14 = require("@elementor/editor-ui");
|
|
4152
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3734
4153
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
3735
|
-
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.__)(
|
|
3736
4155
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
3737
4156
|
"elementor"
|
|
3738
|
-
))), /* @__PURE__ */
|
|
4157
|
+
))), /* @__PURE__ */ React30.createElement(import_editor_ui14.ConfirmationDialog.Actions, { onClose, onConfirm }));
|
|
3739
4158
|
}
|
|
3740
4159
|
|
|
3741
4160
|
// src/extended/components/components-tab/component-item.tsx
|
|
3742
4161
|
function ComponentItem2({ component }) {
|
|
3743
|
-
const itemRef = (0,
|
|
3744
|
-
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0,
|
|
4162
|
+
const itemRef = (0, import_react14.useRef)(null);
|
|
4163
|
+
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, import_react14.useState)(false);
|
|
3745
4164
|
const { canRename, canDelete } = useComponentsPermissions();
|
|
3746
4165
|
const shouldShowActions = canRename || canDelete;
|
|
3747
4166
|
const {
|
|
@@ -3750,7 +4169,7 @@ function ComponentItem2({ component }) {
|
|
|
3750
4169
|
openEditMode,
|
|
3751
4170
|
error,
|
|
3752
4171
|
getProps: getEditableProps
|
|
3753
|
-
} = (0,
|
|
4172
|
+
} = (0, import_editor_ui15.useEditable)({
|
|
3754
4173
|
value: component.name,
|
|
3755
4174
|
onSubmit: (newName) => renameComponent(component.uid, newName),
|
|
3756
4175
|
validation: validateComponentTitle
|
|
@@ -3781,8 +4200,8 @@ function ComponentItem2({ component }) {
|
|
|
3781
4200
|
const handleDeleteDialogClose = () => {
|
|
3782
4201
|
setIsDeleteDialogOpen(false);
|
|
3783
4202
|
};
|
|
3784
|
-
return /* @__PURE__ */
|
|
3785
|
-
|
|
4203
|
+
return /* @__PURE__ */ React31.createElement(import_ui24.Stack, null, /* @__PURE__ */ React31.createElement(
|
|
4204
|
+
import_editor_ui15.WarningInfotip,
|
|
3786
4205
|
{
|
|
3787
4206
|
open: Boolean(error),
|
|
3788
4207
|
text: error ?? "",
|
|
@@ -3790,7 +4209,7 @@ function ComponentItem2({ component }) {
|
|
|
3790
4209
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
3791
4210
|
offset: [0, -15]
|
|
3792
4211
|
},
|
|
3793
|
-
/* @__PURE__ */
|
|
4212
|
+
/* @__PURE__ */ React31.createElement(
|
|
3794
4213
|
ComponentItem,
|
|
3795
4214
|
{
|
|
3796
4215
|
ref: itemRef,
|
|
@@ -3802,17 +4221,17 @@ function ComponentItem2({ component }) {
|
|
|
3802
4221
|
onClick: handleClick,
|
|
3803
4222
|
isEditing,
|
|
3804
4223
|
error,
|
|
3805
|
-
nameSlot: /* @__PURE__ */
|
|
4224
|
+
nameSlot: /* @__PURE__ */ React31.createElement(
|
|
3806
4225
|
ComponentName,
|
|
3807
4226
|
{
|
|
3808
4227
|
name: component.name,
|
|
3809
4228
|
editable: { ref: editableRef, isEditing, getProps: getEditableProps }
|
|
3810
4229
|
}
|
|
3811
4230
|
),
|
|
3812
|
-
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
|
|
3813
4232
|
}
|
|
3814
4233
|
)
|
|
3815
|
-
), shouldShowActions && /* @__PURE__ */
|
|
4234
|
+
), shouldShowActions && /* @__PURE__ */ React31.createElement(
|
|
3816
4235
|
import_ui24.Menu,
|
|
3817
4236
|
{
|
|
3818
4237
|
...(0, import_ui24.bindMenu)(popupState),
|
|
@@ -3825,8 +4244,8 @@ function ComponentItem2({ component }) {
|
|
|
3825
4244
|
horizontal: "right"
|
|
3826
4245
|
}
|
|
3827
4246
|
},
|
|
3828
|
-
canRename && /* @__PURE__ */
|
|
3829
|
-
|
|
4247
|
+
canRename && /* @__PURE__ */ React31.createElement(
|
|
4248
|
+
import_editor_ui15.MenuListItem,
|
|
3830
4249
|
{
|
|
3831
4250
|
sx: { minWidth: "160px" },
|
|
3832
4251
|
primaryTypographyProps: { variant: "caption", color: "text.primary" },
|
|
@@ -3835,18 +4254,18 @@ function ComponentItem2({ component }) {
|
|
|
3835
4254
|
openEditMode();
|
|
3836
4255
|
}
|
|
3837
4256
|
},
|
|
3838
|
-
(0,
|
|
4257
|
+
(0, import_i18n26.__)("Rename", "elementor")
|
|
3839
4258
|
),
|
|
3840
|
-
canDelete && /* @__PURE__ */
|
|
3841
|
-
|
|
4259
|
+
canDelete && /* @__PURE__ */ React31.createElement(
|
|
4260
|
+
import_editor_ui15.MenuListItem,
|
|
3842
4261
|
{
|
|
3843
4262
|
sx: { minWidth: "160px" },
|
|
3844
4263
|
primaryTypographyProps: { variant: "caption", color: "error.light" },
|
|
3845
4264
|
onClick: handleDeleteClick
|
|
3846
4265
|
},
|
|
3847
|
-
(0,
|
|
4266
|
+
(0, import_i18n26.__)("Delete", "elementor")
|
|
3848
4267
|
)
|
|
3849
|
-
), /* @__PURE__ */
|
|
4268
|
+
), /* @__PURE__ */ React31.createElement(
|
|
3850
4269
|
DeleteConfirmationDialog,
|
|
3851
4270
|
{
|
|
3852
4271
|
open: isDeleteDialogOpen,
|
|
@@ -3861,7 +4280,7 @@ var addComponentToPage = (model) => {
|
|
|
3861
4280
|
throw new Error(`Can't find container to drop new component instance at`);
|
|
3862
4281
|
}
|
|
3863
4282
|
loadComponentsAssets([model]);
|
|
3864
|
-
(0,
|
|
4283
|
+
(0, import_editor_elements13.dropElement)({
|
|
3865
4284
|
containerId: container.id,
|
|
3866
4285
|
model,
|
|
3867
4286
|
options: { ...options, useHistory: false, scrollIntoView: true }
|
|
@@ -3879,43 +4298,43 @@ var validateComponentTitle = (newTitle) => {
|
|
|
3879
4298
|
var ExtendedComponentsList = () => {
|
|
3880
4299
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
3881
4300
|
if (isLoading) {
|
|
3882
|
-
return /* @__PURE__ */
|
|
4301
|
+
return /* @__PURE__ */ React32.createElement(LoadingComponents, null);
|
|
3883
4302
|
}
|
|
3884
4303
|
const isEmpty = !components?.length;
|
|
3885
4304
|
if (isEmpty) {
|
|
3886
|
-
return searchValue.length ? /* @__PURE__ */
|
|
4305
|
+
return searchValue.length ? /* @__PURE__ */ React32.createElement(EmptySearchResult, null) : /* @__PURE__ */ React32.createElement(EmptyState, null);
|
|
3887
4306
|
}
|
|
3888
|
-
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 })));
|
|
3889
4308
|
};
|
|
3890
4309
|
var ExtendedComponentsContent = () => {
|
|
3891
4310
|
const { components, isLoading } = useComponents();
|
|
3892
4311
|
const hasComponents = !isLoading && components.length > 0;
|
|
3893
|
-
return /* @__PURE__ */
|
|
4312
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, hasComponents && /* @__PURE__ */ React32.createElement(ComponentSearch, null), /* @__PURE__ */ React32.createElement(ExtendedComponentsList, null));
|
|
3894
4313
|
};
|
|
3895
4314
|
var ExtendedComponents = () => {
|
|
3896
|
-
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)));
|
|
3897
4316
|
};
|
|
3898
4317
|
|
|
3899
4318
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
3900
|
-
var
|
|
3901
|
-
var
|
|
3902
|
-
var
|
|
3903
|
-
var
|
|
3904
|
-
var
|
|
3905
|
-
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");
|
|
3906
4325
|
var import_ui26 = require("@elementor/ui");
|
|
3907
|
-
var
|
|
4326
|
+
var import_i18n29 = require("@wordpress/i18n");
|
|
3908
4327
|
|
|
3909
4328
|
// src/extended/store/actions/create-unpublished-component.ts
|
|
3910
|
-
var
|
|
3911
|
-
var
|
|
4329
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
4330
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
3912
4331
|
var import_utils7 = require("@elementor/utils");
|
|
3913
|
-
var
|
|
4332
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
3914
4333
|
|
|
3915
4334
|
// src/extended/utils/replace-element-with-component.ts
|
|
3916
|
-
var
|
|
4335
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
3917
4336
|
var replaceElementWithComponent = (element, component) => {
|
|
3918
|
-
return (0,
|
|
4337
|
+
return (0, import_editor_elements14.replaceElement)({
|
|
3919
4338
|
currentElementId: element.id,
|
|
3920
4339
|
newElement: createComponentModel2(component),
|
|
3921
4340
|
withHistory: false
|
|
@@ -3934,7 +4353,7 @@ async function createUnpublishedComponent({
|
|
|
3934
4353
|
const generatedUid = uid ?? (0, import_utils7.generateUniqueId)("component");
|
|
3935
4354
|
const componentBase = { uid: generatedUid, name };
|
|
3936
4355
|
const elementDataWithOverridablesReverted = revertAllOverridablesInElementData(element);
|
|
3937
|
-
const container = (0,
|
|
4356
|
+
const container = (0, import_editor_elements15.getContainer)(element.id);
|
|
3938
4357
|
const modelFromContainer = container?.model?.toJSON?.();
|
|
3939
4358
|
const originalElement = {
|
|
3940
4359
|
model: modelFromContainer ?? element,
|
|
@@ -3956,7 +4375,7 @@ async function createUnpublishedComponent({
|
|
|
3956
4375
|
...eventData
|
|
3957
4376
|
});
|
|
3958
4377
|
try {
|
|
3959
|
-
await (0,
|
|
4378
|
+
await (0, import_editor_v1_adapters4.__privateRunCommand)("document/save/auto");
|
|
3960
4379
|
} catch (error) {
|
|
3961
4380
|
restoreOriginalElement(originalElement, componentInstance.id);
|
|
3962
4381
|
componentsActions.removeUnpublished(generatedUid);
|
|
@@ -3966,17 +4385,17 @@ async function createUnpublishedComponent({
|
|
|
3966
4385
|
return { uid: generatedUid, instanceId: componentInstance.id };
|
|
3967
4386
|
}
|
|
3968
4387
|
function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
3969
|
-
const componentContainer = (0,
|
|
4388
|
+
const componentContainer = (0, import_editor_elements15.getContainer)(componentInstanceId);
|
|
3970
4389
|
if (componentContainer) {
|
|
3971
|
-
(0,
|
|
4390
|
+
(0, import_editor_elements15.deleteElement)({ container: componentContainer, options: { useHistory: false } });
|
|
3972
4391
|
}
|
|
3973
|
-
const parentContainer = (0,
|
|
4392
|
+
const parentContainer = (0, import_editor_elements15.getContainer)(originalElement.parentId);
|
|
3974
4393
|
if (!parentContainer) {
|
|
3975
4394
|
return;
|
|
3976
4395
|
}
|
|
3977
4396
|
const clonedModel = structuredClone(originalElement.model);
|
|
3978
|
-
(0,
|
|
3979
|
-
title: (0,
|
|
4397
|
+
(0, import_editor_elements15.createElements)({
|
|
4398
|
+
title: (0, import_i18n27.__)("Restore Element", "elementor"),
|
|
3980
4399
|
elements: [
|
|
3981
4400
|
{
|
|
3982
4401
|
container: parentContainer,
|
|
@@ -3989,10 +4408,10 @@ function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
|
3989
4408
|
|
|
3990
4409
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
3991
4410
|
var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
3992
|
-
var
|
|
3993
|
-
var
|
|
3994
|
-
var
|
|
3995
|
-
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");
|
|
3996
4415
|
|
|
3997
4416
|
// src/extended/utils/is-editing-component.ts
|
|
3998
4417
|
function isEditingComponent() {
|
|
@@ -4002,25 +4421,25 @@ function isEditingComponent() {
|
|
|
4002
4421
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
4003
4422
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
4004
4423
|
type: "default",
|
|
4005
|
-
message: (0,
|
|
4424
|
+
message: (0, import_i18n28.__)("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
4006
4425
|
id: "non-atomic-element-blocked"
|
|
4007
4426
|
};
|
|
4008
4427
|
function initNonAtomicNestingPrevention() {
|
|
4009
|
-
(0,
|
|
4428
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
4010
4429
|
command: "document/elements/create",
|
|
4011
4430
|
condition: blockNonAtomicCreate
|
|
4012
4431
|
});
|
|
4013
|
-
(0,
|
|
4432
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
4014
4433
|
command: "document/elements/move",
|
|
4015
4434
|
condition: blockNonAtomicMove
|
|
4016
4435
|
});
|
|
4017
|
-
(0,
|
|
4436
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
4018
4437
|
command: "document/elements/paste",
|
|
4019
4438
|
condition: blockNonAtomicPaste
|
|
4020
4439
|
});
|
|
4021
4440
|
}
|
|
4022
4441
|
function isElementAtomic(elementType) {
|
|
4023
|
-
return (0,
|
|
4442
|
+
return (0, import_editor_elements16.getElementType)(elementType) !== null;
|
|
4024
4443
|
}
|
|
4025
4444
|
function blockNonAtomicCreate(args) {
|
|
4026
4445
|
if (!isEditingComponent()) {
|
|
@@ -4034,7 +4453,7 @@ function blockNonAtomicCreate(args) {
|
|
|
4034
4453
|
if (isElementAtomic(elementType)) {
|
|
4035
4454
|
return false;
|
|
4036
4455
|
}
|
|
4037
|
-
(0,
|
|
4456
|
+
(0, import_editor_notifications4.notify)(NON_ATOMIC_ELEMENT_ALERT);
|
|
4038
4457
|
return true;
|
|
4039
4458
|
}
|
|
4040
4459
|
function blockNonAtomicMove(args) {
|
|
@@ -4046,11 +4465,11 @@ function blockNonAtomicMove(args) {
|
|
|
4046
4465
|
if (!container) {
|
|
4047
4466
|
return false;
|
|
4048
4467
|
}
|
|
4049
|
-
const allElements = (0,
|
|
4468
|
+
const allElements = (0, import_editor_elements16.getAllDescendants)(container);
|
|
4050
4469
|
return allElements.some((element) => !(0, import_editor_canvas6.isAtomicWidget)(element));
|
|
4051
4470
|
});
|
|
4052
4471
|
if (hasNonAtomicElement) {
|
|
4053
|
-
(0,
|
|
4472
|
+
(0, import_editor_notifications4.notify)(NON_ATOMIC_ELEMENT_ALERT);
|
|
4054
4473
|
}
|
|
4055
4474
|
return hasNonAtomicElement;
|
|
4056
4475
|
}
|
|
@@ -4068,7 +4487,7 @@ function blockNonAtomicPaste(args) {
|
|
|
4068
4487
|
}
|
|
4069
4488
|
const hasNonAtomicElement = hasNonAtomicElementsInTree(data.clipboard.elements);
|
|
4070
4489
|
if (hasNonAtomicElement) {
|
|
4071
|
-
(0,
|
|
4490
|
+
(0, import_editor_notifications4.notify)(NON_ATOMIC_ELEMENT_ALERT);
|
|
4072
4491
|
}
|
|
4073
4492
|
return hasNonAtomicElement;
|
|
4074
4493
|
}
|
|
@@ -4101,11 +4520,11 @@ function findNonAtomicElementsInElement(element) {
|
|
|
4101
4520
|
}
|
|
4102
4521
|
|
|
4103
4522
|
// src/extended/components/create-component-form/hooks/use-form.ts
|
|
4104
|
-
var
|
|
4523
|
+
var import_react15 = require("react");
|
|
4105
4524
|
var useForm = (initialValues) => {
|
|
4106
|
-
const [values, setValues] = (0,
|
|
4107
|
-
const [errors, setErrors] = (0,
|
|
4108
|
-
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)(() => {
|
|
4109
4528
|
return !Object.values(errors).some((error) => error);
|
|
4110
4529
|
}, [errors]);
|
|
4111
4530
|
const handleChange = (e, field, validationSchema) => {
|
|
@@ -4181,19 +4600,19 @@ function countNestedElements(container) {
|
|
|
4181
4600
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
4182
4601
|
var MAX_COMPONENTS = 100;
|
|
4183
4602
|
function CreateComponentForm() {
|
|
4184
|
-
const [element, setElement] = (0,
|
|
4185
|
-
const [anchorPosition, setAnchorPosition] = (0,
|
|
4603
|
+
const [element, setElement] = (0, import_react16.useState)(null);
|
|
4604
|
+
const [anchorPosition, setAnchorPosition] = (0, import_react16.useState)();
|
|
4186
4605
|
const { components } = useComponents();
|
|
4187
|
-
const eventData = (0,
|
|
4188
|
-
(0,
|
|
4606
|
+
const eventData = (0, import_react16.useRef)(null);
|
|
4607
|
+
(0, import_react16.useEffect)(() => {
|
|
4189
4608
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT2 = "elementor/editor/open-save-as-component-form";
|
|
4190
4609
|
const openPopup = (event) => {
|
|
4191
4610
|
const { shouldOpen, notification } = shouldOpenForm(event.detail.element, components?.length ?? 0);
|
|
4192
4611
|
if (!shouldOpen) {
|
|
4193
|
-
(0,
|
|
4612
|
+
(0, import_editor_notifications5.notify)(notification);
|
|
4194
4613
|
return;
|
|
4195
4614
|
}
|
|
4196
|
-
setElement({ element: event.detail.element, elementLabel: (0,
|
|
4615
|
+
setElement({ element: event.detail.element, elementLabel: (0, import_editor_elements17.getElementLabel)(event.detail.element.id) });
|
|
4197
4616
|
setAnchorPosition(event.detail.anchorPosition);
|
|
4198
4617
|
eventData.current = getComponentEventData(event.detail.element, event.detail.options);
|
|
4199
4618
|
trackComponentEvent({
|
|
@@ -4224,15 +4643,15 @@ function CreateComponentForm() {
|
|
|
4224
4643
|
} else {
|
|
4225
4644
|
throw new Error("Failed to find published component");
|
|
4226
4645
|
}
|
|
4227
|
-
(0,
|
|
4646
|
+
(0, import_editor_notifications5.notify)({
|
|
4228
4647
|
type: "success",
|
|
4229
|
-
message: (0,
|
|
4648
|
+
message: (0, import_i18n29.__)("Component created successfully.", "elementor"),
|
|
4230
4649
|
id: `component-saved-successfully-${uid}`
|
|
4231
4650
|
});
|
|
4232
4651
|
resetAndClosePopup();
|
|
4233
4652
|
} catch {
|
|
4234
|
-
const errorMessage = (0,
|
|
4235
|
-
(0,
|
|
4653
|
+
const errorMessage = (0, import_i18n29.__)("Failed to create component. Please try again.", "elementor");
|
|
4654
|
+
(0, import_editor_notifications5.notify)({
|
|
4236
4655
|
type: "error",
|
|
4237
4656
|
message: errorMessage,
|
|
4238
4657
|
id: "component-save-failed"
|
|
@@ -4252,7 +4671,7 @@ function CreateComponentForm() {
|
|
|
4252
4671
|
...eventData.current
|
|
4253
4672
|
});
|
|
4254
4673
|
};
|
|
4255
|
-
return /* @__PURE__ */
|
|
4674
|
+
return /* @__PURE__ */ React33.createElement(import_editor_ui17.ThemeProvider, null, /* @__PURE__ */ React33.createElement(
|
|
4256
4675
|
import_ui26.Popover,
|
|
4257
4676
|
{
|
|
4258
4677
|
open: element !== null,
|
|
@@ -4261,7 +4680,7 @@ function CreateComponentForm() {
|
|
|
4261
4680
|
anchorPosition,
|
|
4262
4681
|
"data-testid": "create-component-form"
|
|
4263
4682
|
},
|
|
4264
|
-
element !== null && /* @__PURE__ */
|
|
4683
|
+
element !== null && /* @__PURE__ */ React33.createElement(
|
|
4265
4684
|
Form2,
|
|
4266
4685
|
{
|
|
4267
4686
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -4278,7 +4697,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4278
4697
|
shouldOpen: false,
|
|
4279
4698
|
notification: {
|
|
4280
4699
|
type: "default",
|
|
4281
|
-
message: (0,
|
|
4700
|
+
message: (0, import_i18n29.__)(
|
|
4282
4701
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
4283
4702
|
"elementor"
|
|
4284
4703
|
),
|
|
@@ -4292,7 +4711,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4292
4711
|
notification: {
|
|
4293
4712
|
type: "default",
|
|
4294
4713
|
/* translators: %s is the maximum number of components */
|
|
4295
|
-
message: (0,
|
|
4714
|
+
message: (0, import_i18n29.__)(
|
|
4296
4715
|
`You've reached the limit of %s components. Please remove an existing one to create a new component.`,
|
|
4297
4716
|
"elementor"
|
|
4298
4717
|
).replace("%s", MAX_COMPONENTS.toString()),
|
|
@@ -4309,16 +4728,16 @@ var Form2 = ({
|
|
|
4309
4728
|
closePopup
|
|
4310
4729
|
}) => {
|
|
4311
4730
|
const { values, errors, isValid, handleChange, validateForm: validateForm2 } = useForm(initialValues);
|
|
4312
|
-
const nameInputRef = (0,
|
|
4731
|
+
const nameInputRef = (0, import_editor_ui17.useTextFieldAutoSelect)();
|
|
4313
4732
|
const { components } = useComponents();
|
|
4314
|
-
const existingComponentNames = (0,
|
|
4733
|
+
const existingComponentNames = (0, import_react16.useMemo)(() => {
|
|
4315
4734
|
return components?.map((component) => component.name) ?? [];
|
|
4316
4735
|
}, [components]);
|
|
4317
|
-
const changeValidationSchema = (0,
|
|
4736
|
+
const changeValidationSchema = (0, import_react16.useMemo)(
|
|
4318
4737
|
() => createBaseComponentSchema(existingComponentNames),
|
|
4319
4738
|
[existingComponentNames]
|
|
4320
4739
|
);
|
|
4321
|
-
const submitValidationSchema = (0,
|
|
4740
|
+
const submitValidationSchema = (0, import_react16.useMemo)(
|
|
4322
4741
|
() => createSubmitComponentSchema(existingComponentNames),
|
|
4323
4742
|
[existingComponentNames]
|
|
4324
4743
|
);
|
|
@@ -4329,13 +4748,13 @@ var Form2 = ({
|
|
|
4329
4748
|
}
|
|
4330
4749
|
};
|
|
4331
4750
|
const texts = {
|
|
4332
|
-
heading: (0,
|
|
4333
|
-
name: (0,
|
|
4334
|
-
cancel: (0,
|
|
4335
|
-
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")
|
|
4336
4755
|
};
|
|
4337
4756
|
const nameInputId = "component-name";
|
|
4338
|
-
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(
|
|
4339
4758
|
import_ui26.Stack,
|
|
4340
4759
|
{
|
|
4341
4760
|
direction: "row",
|
|
@@ -4344,9 +4763,9 @@ var Form2 = ({
|
|
|
4344
4763
|
px: 1.5,
|
|
4345
4764
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
4346
4765
|
},
|
|
4347
|
-
/* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4349
|
-
), /* @__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(
|
|
4350
4769
|
import_ui26.TextField,
|
|
4351
4770
|
{
|
|
4352
4771
|
id: nameInputId,
|
|
@@ -4359,15 +4778,15 @@ var Form2 = ({
|
|
|
4359
4778
|
helperText: errors.componentName,
|
|
4360
4779
|
inputRef: nameInputRef
|
|
4361
4780
|
}
|
|
4362
|
-
))), /* @__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))));
|
|
4363
4782
|
};
|
|
4364
4783
|
|
|
4365
4784
|
// src/extended/components/edit-component/edit-component.tsx
|
|
4366
|
-
var
|
|
4367
|
-
var
|
|
4785
|
+
var React35 = __toESM(require("react"));
|
|
4786
|
+
var import_react19 = require("react");
|
|
4368
4787
|
var import_editor_documents11 = require("@elementor/editor-documents");
|
|
4369
|
-
var
|
|
4370
|
-
var
|
|
4788
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
4789
|
+
var import_store34 = require("@elementor/store");
|
|
4371
4790
|
var import_utils9 = require("@elementor/utils");
|
|
4372
4791
|
|
|
4373
4792
|
// src/extended/consts.ts
|
|
@@ -4386,22 +4805,22 @@ function updateCurrentComponent(params) {
|
|
|
4386
4805
|
}
|
|
4387
4806
|
|
|
4388
4807
|
// src/extended/components/edit-component/component-modal.tsx
|
|
4389
|
-
var
|
|
4390
|
-
var
|
|
4808
|
+
var React34 = __toESM(require("react"));
|
|
4809
|
+
var import_react18 = require("react");
|
|
4391
4810
|
var import_react_dom = require("react-dom");
|
|
4392
|
-
var
|
|
4811
|
+
var import_i18n30 = require("@wordpress/i18n");
|
|
4393
4812
|
|
|
4394
4813
|
// src/extended/components/edit-component/use-canvas-document.ts
|
|
4395
|
-
var
|
|
4814
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
4396
4815
|
function useCanvasDocument() {
|
|
4397
|
-
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)());
|
|
4398
4817
|
}
|
|
4399
4818
|
|
|
4400
4819
|
// src/extended/components/edit-component/use-element-rect.ts
|
|
4401
|
-
var
|
|
4820
|
+
var import_react17 = require("react");
|
|
4402
4821
|
var import_utils8 = require("@elementor/utils");
|
|
4403
4822
|
function useElementRect(element) {
|
|
4404
|
-
const [rect, setRect] = (0,
|
|
4823
|
+
const [rect, setRect] = (0, import_react17.useState)(new DOMRect(0, 0, 0, 0));
|
|
4405
4824
|
const onChange = (0, import_utils8.throttle)(
|
|
4406
4825
|
() => {
|
|
4407
4826
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -4412,7 +4831,7 @@ function useElementRect(element) {
|
|
|
4412
4831
|
useScrollListener({ element, onChange });
|
|
4413
4832
|
useResizeListener({ element, onChange });
|
|
4414
4833
|
useMutationsListener({ element, onChange });
|
|
4415
|
-
(0,
|
|
4834
|
+
(0, import_react17.useEffect)(
|
|
4416
4835
|
() => () => {
|
|
4417
4836
|
onChange.cancel();
|
|
4418
4837
|
},
|
|
@@ -4421,7 +4840,7 @@ function useElementRect(element) {
|
|
|
4421
4840
|
return rect;
|
|
4422
4841
|
}
|
|
4423
4842
|
function useScrollListener({ element, onChange }) {
|
|
4424
|
-
(0,
|
|
4843
|
+
(0, import_react17.useEffect)(() => {
|
|
4425
4844
|
if (!element) {
|
|
4426
4845
|
return;
|
|
4427
4846
|
}
|
|
@@ -4433,7 +4852,7 @@ function useScrollListener({ element, onChange }) {
|
|
|
4433
4852
|
}, [element, onChange]);
|
|
4434
4853
|
}
|
|
4435
4854
|
function useResizeListener({ element, onChange }) {
|
|
4436
|
-
(0,
|
|
4855
|
+
(0, import_react17.useEffect)(() => {
|
|
4437
4856
|
if (!element) {
|
|
4438
4857
|
return;
|
|
4439
4858
|
}
|
|
@@ -4448,7 +4867,7 @@ function useResizeListener({ element, onChange }) {
|
|
|
4448
4867
|
}, [element, onChange]);
|
|
4449
4868
|
}
|
|
4450
4869
|
function useMutationsListener({ element, onChange }) {
|
|
4451
|
-
(0,
|
|
4870
|
+
(0, import_react17.useEffect)(() => {
|
|
4452
4871
|
if (!element) {
|
|
4453
4872
|
return;
|
|
4454
4873
|
}
|
|
@@ -4463,7 +4882,7 @@ function useMutationsListener({ element, onChange }) {
|
|
|
4463
4882
|
// src/extended/components/edit-component/component-modal.tsx
|
|
4464
4883
|
function ComponentModal({ topLevelElementDom, onClose }) {
|
|
4465
4884
|
const canvasDocument = useCanvasDocument();
|
|
4466
|
-
(0,
|
|
4885
|
+
(0, import_react18.useEffect)(() => {
|
|
4467
4886
|
const handleEsc = (event) => {
|
|
4468
4887
|
if (event.key === "Escape") {
|
|
4469
4888
|
onClose();
|
|
@@ -4478,7 +4897,7 @@ function ComponentModal({ topLevelElementDom, onClose }) {
|
|
|
4478
4897
|
return null;
|
|
4479
4898
|
}
|
|
4480
4899
|
return (0, import_react_dom.createPortal)(
|
|
4481
|
-
/* @__PURE__ */
|
|
4900
|
+
/* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(BlockEditPage, null), /* @__PURE__ */ React34.createElement(Backdrop, { canvas: canvasDocument, element: topLevelElementDom, onClose })),
|
|
4482
4901
|
canvasDocument.body
|
|
4483
4902
|
);
|
|
4484
4903
|
}
|
|
@@ -4507,7 +4926,7 @@ function Backdrop({
|
|
|
4507
4926
|
onClose();
|
|
4508
4927
|
}
|
|
4509
4928
|
};
|
|
4510
|
-
return /* @__PURE__ */
|
|
4929
|
+
return /* @__PURE__ */ React34.createElement(
|
|
4511
4930
|
"div",
|
|
4512
4931
|
{
|
|
4513
4932
|
style: backdropStyle,
|
|
@@ -4515,7 +4934,7 @@ function Backdrop({
|
|
|
4515
4934
|
onKeyDown: handleKeyDown,
|
|
4516
4935
|
role: "button",
|
|
4517
4936
|
tabIndex: 0,
|
|
4518
|
-
"aria-label": (0,
|
|
4937
|
+
"aria-label": (0, import_i18n30.__)("Exit component editing mode", "elementor")
|
|
4519
4938
|
}
|
|
4520
4939
|
);
|
|
4521
4940
|
}
|
|
@@ -4555,7 +4974,7 @@ function BlockEditPage() {
|
|
|
4555
4974
|
}
|
|
4556
4975
|
}
|
|
4557
4976
|
`;
|
|
4558
|
-
return /* @__PURE__ */
|
|
4977
|
+
return /* @__PURE__ */ React34.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
4559
4978
|
}
|
|
4560
4979
|
|
|
4561
4980
|
// src/extended/components/edit-component/edit-component.tsx
|
|
@@ -4568,14 +4987,14 @@ function EditComponent() {
|
|
|
4568
4987
|
if (!currentComponentId) {
|
|
4569
4988
|
return null;
|
|
4570
4989
|
}
|
|
4571
|
-
return /* @__PURE__ */
|
|
4990
|
+
return /* @__PURE__ */ React35.createElement(ComponentModal, { topLevelElementDom, onClose });
|
|
4572
4991
|
}
|
|
4573
4992
|
function useHandleDocumentSwitches() {
|
|
4574
4993
|
const documentsManager = (0, import_editor_documents11.getV1DocumentsManager)();
|
|
4575
4994
|
const currentComponentId = useCurrentComponentId();
|
|
4576
|
-
const path = (0,
|
|
4577
|
-
(0,
|
|
4578
|
-
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"), () => {
|
|
4579
4998
|
const nextDocument = documentsManager.getCurrent();
|
|
4580
4999
|
if (nextDocument.id === currentComponentId) {
|
|
4581
5000
|
return;
|
|
@@ -4628,11 +5047,11 @@ function getInstanceTitle(instanceId, path) {
|
|
|
4628
5047
|
}
|
|
4629
5048
|
function useComponentDOMElement(id2) {
|
|
4630
5049
|
const { componentContainerDomElement, topLevelElementDom } = getComponentDOMElements(id2);
|
|
4631
|
-
const [currentElementDom, setCurrentElementDom] = (0,
|
|
4632
|
-
(0,
|
|
5050
|
+
const [currentElementDom, setCurrentElementDom] = (0, import_react19.useState)(topLevelElementDom);
|
|
5051
|
+
(0, import_react19.useEffect)(() => {
|
|
4633
5052
|
setCurrentElementDom(topLevelElementDom);
|
|
4634
5053
|
}, [topLevelElementDom]);
|
|
4635
|
-
(0,
|
|
5054
|
+
(0, import_react19.useEffect)(() => {
|
|
4636
5055
|
if (!componentContainerDomElement) {
|
|
4637
5056
|
return;
|
|
4638
5057
|
}
|
|
@@ -4660,10 +5079,10 @@ function getComponentDOMElements(id2) {
|
|
|
4660
5079
|
}
|
|
4661
5080
|
|
|
4662
5081
|
// src/extended/components/instance-editing-panel/instance-editing-panel.tsx
|
|
4663
|
-
var
|
|
4664
|
-
var
|
|
5082
|
+
var React36 = __toESM(require("react"));
|
|
5083
|
+
var import_icons19 = require("@elementor/icons");
|
|
4665
5084
|
var import_ui27 = require("@elementor/ui");
|
|
4666
|
-
var
|
|
5085
|
+
var import_i18n31 = require("@wordpress/i18n");
|
|
4667
5086
|
function ExtendedInstanceEditingPanel() {
|
|
4668
5087
|
const { canEdit } = useComponentsPermissions();
|
|
4669
5088
|
const data = useInstancePanelData();
|
|
@@ -4671,35 +5090,35 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4671
5090
|
return null;
|
|
4672
5091
|
}
|
|
4673
5092
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
4674
|
-
const panelTitle = (0,
|
|
5093
|
+
const panelTitle = (0, import_i18n31.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
4675
5094
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
4676
|
-
return /* @__PURE__ */
|
|
5095
|
+
return /* @__PURE__ */ React36.createElement(import_ui27.Box, { "data-testid": "instance-editing-panel" }, /* @__PURE__ */ React36.createElement(
|
|
4677
5096
|
ComponentInstanceProvider,
|
|
4678
5097
|
{
|
|
4679
5098
|
componentId,
|
|
4680
5099
|
overrides,
|
|
4681
5100
|
overridableProps
|
|
4682
5101
|
},
|
|
4683
|
-
/* @__PURE__ */
|
|
5102
|
+
/* @__PURE__ */ React36.createElement(
|
|
4684
5103
|
InstancePanelHeader,
|
|
4685
5104
|
{
|
|
4686
5105
|
componentName: component.name,
|
|
4687
|
-
actions: canEdit ? /* @__PURE__ */
|
|
5106
|
+
actions: canEdit ? /* @__PURE__ */ React36.createElement(
|
|
4688
5107
|
EditComponentAction,
|
|
4689
5108
|
{
|
|
4690
5109
|
label: panelTitle,
|
|
4691
5110
|
onClick: handleEditComponent,
|
|
4692
|
-
icon:
|
|
5111
|
+
icon: import_icons19.PencilIcon
|
|
4693
5112
|
}
|
|
4694
5113
|
) : void 0
|
|
4695
5114
|
}
|
|
4696
5115
|
),
|
|
4697
|
-
/* @__PURE__ */
|
|
5116
|
+
/* @__PURE__ */ React36.createElement(
|
|
4698
5117
|
InstancePanelBody,
|
|
4699
5118
|
{
|
|
4700
5119
|
groups,
|
|
4701
5120
|
isEmpty,
|
|
4702
|
-
emptyState: /* @__PURE__ */
|
|
5121
|
+
emptyState: /* @__PURE__ */ React36.createElement(EmptyState2, { onEditComponent: canEdit ? handleEditComponent : void 0 }),
|
|
4703
5122
|
componentInstanceId
|
|
4704
5123
|
}
|
|
4705
5124
|
)
|
|
@@ -4707,7 +5126,7 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4707
5126
|
}
|
|
4708
5127
|
|
|
4709
5128
|
// src/extended/components/overridable-props/overridable-prop-control.tsx
|
|
4710
|
-
var
|
|
5129
|
+
var React37 = __toESM(require("react"));
|
|
4711
5130
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
4712
5131
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
4713
5132
|
function OverridablePropControl({
|
|
@@ -4752,7 +5171,7 @@ function OverridablePropControl({
|
|
|
4752
5171
|
});
|
|
4753
5172
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
4754
5173
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
4755
|
-
return /* @__PURE__ */
|
|
5174
|
+
return /* @__PURE__ */ React37.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React37.createElement(
|
|
4756
5175
|
import_editor_controls5.PropProvider,
|
|
4757
5176
|
{
|
|
4758
5177
|
...propContext,
|
|
@@ -4763,7 +5182,7 @@ function OverridablePropControl({
|
|
|
4763
5182
|
},
|
|
4764
5183
|
placeholder: objectPlaceholder
|
|
4765
5184
|
},
|
|
4766
|
-
/* @__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 })))
|
|
4767
5186
|
));
|
|
4768
5187
|
}
|
|
4769
5188
|
function ControlWithReplacements({
|
|
@@ -4773,18 +5192,18 @@ function ControlWithReplacements({
|
|
|
4773
5192
|
const { ControlToRender, isReplaced } = (0, import_editor_controls5.useControlReplacement)(OriginalControl2);
|
|
4774
5193
|
if (isReplaced) {
|
|
4775
5194
|
const ReplacementControl = ControlToRender;
|
|
4776
|
-
return /* @__PURE__ */
|
|
5195
|
+
return /* @__PURE__ */ React37.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
|
|
4777
5196
|
}
|
|
4778
|
-
return /* @__PURE__ */
|
|
5197
|
+
return /* @__PURE__ */ React37.createElement(OriginalControl2, { ...props });
|
|
4779
5198
|
}
|
|
4780
5199
|
|
|
4781
5200
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
4782
|
-
var
|
|
5201
|
+
var React39 = __toESM(require("react"));
|
|
4783
5202
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
4784
5203
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
4785
|
-
var
|
|
5204
|
+
var import_editor_elements18 = require("@elementor/editor-elements");
|
|
4786
5205
|
var import_ui29 = require("@elementor/ui");
|
|
4787
|
-
var
|
|
5206
|
+
var import_i18n33 = require("@wordpress/i18n");
|
|
4788
5207
|
|
|
4789
5208
|
// src/extended/store/actions/set-overridable-prop.ts
|
|
4790
5209
|
var import_utils10 = require("@elementor/utils");
|
|
@@ -4856,11 +5275,11 @@ function setOverridableProp({
|
|
|
4856
5275
|
}
|
|
4857
5276
|
|
|
4858
5277
|
// src/extended/components/overridable-props/indicator.tsx
|
|
4859
|
-
var
|
|
4860
|
-
var
|
|
4861
|
-
var
|
|
5278
|
+
var React38 = __toESM(require("react"));
|
|
5279
|
+
var import_react20 = require("react");
|
|
5280
|
+
var import_icons20 = require("@elementor/icons");
|
|
4862
5281
|
var import_ui28 = require("@elementor/ui");
|
|
4863
|
-
var
|
|
5282
|
+
var import_i18n32 = require("@wordpress/i18n");
|
|
4864
5283
|
var SIZE2 = "tiny";
|
|
4865
5284
|
var IconContainer = (0, import_ui28.styled)(import_ui28.Box)`
|
|
4866
5285
|
pointer-events: none;
|
|
@@ -4916,16 +5335,16 @@ var Content = (0, import_ui28.styled)(import_ui28.Box)`
|
|
|
4916
5335
|
}
|
|
4917
5336
|
}
|
|
4918
5337
|
`;
|
|
4919
|
-
var Indicator2 = (0,
|
|
5338
|
+
var Indicator2 = (0, import_react20.forwardRef)(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React38.createElement(
|
|
4920
5339
|
Content,
|
|
4921
5340
|
{
|
|
4922
5341
|
role: "button",
|
|
4923
5342
|
ref,
|
|
4924
5343
|
...props,
|
|
4925
5344
|
className: isOpen || isOverridable ? "enlarged" : "",
|
|
4926
|
-
"aria-label": isOverridable ? (0,
|
|
5345
|
+
"aria-label": isOverridable ? (0, import_i18n32.__)("Overridable property", "elementor") : (0, import_i18n32.__)("Make prop overridable", "elementor")
|
|
4927
5346
|
},
|
|
4928
|
-
/* @__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 }))
|
|
4929
5348
|
));
|
|
4930
5349
|
|
|
4931
5350
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
@@ -4936,7 +5355,7 @@ function OverridablePropIndicator() {
|
|
|
4936
5355
|
if (!isPropAllowed(propType) || !componentId || !overridableProps) {
|
|
4937
5356
|
return null;
|
|
4938
5357
|
}
|
|
4939
|
-
return /* @__PURE__ */
|
|
5358
|
+
return /* @__PURE__ */ React39.createElement(Content2, { componentId, overridableProps });
|
|
4940
5359
|
}
|
|
4941
5360
|
function Content2({ componentId, overridableProps }) {
|
|
4942
5361
|
const {
|
|
@@ -4955,7 +5374,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4955
5374
|
});
|
|
4956
5375
|
const triggerProps = (0, import_ui29.bindTrigger)(popupState);
|
|
4957
5376
|
const popoverProps = (0, import_ui29.bindPopover)(popupState);
|
|
4958
|
-
const { elType } = (0,
|
|
5377
|
+
const { elType } = (0, import_editor_elements18.getWidgetsCache)()?.[elementType.key] ?? { elType: "widget" };
|
|
4959
5378
|
const handleSubmit = ({ label, group }) => {
|
|
4960
5379
|
const propTypeDefault = propType.default ?? {};
|
|
4961
5380
|
const originValue = resolveOverridePropValue(overridableValue?.origin_value) ?? value ?? propTypeDefault;
|
|
@@ -4982,7 +5401,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4982
5401
|
popupState.close();
|
|
4983
5402
|
};
|
|
4984
5403
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4985
|
-
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(
|
|
4986
5405
|
import_ui29.Popover,
|
|
4987
5406
|
{
|
|
4988
5407
|
disableScrollLock: true,
|
|
@@ -4999,7 +5418,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4999
5418
|
},
|
|
5000
5419
|
...popoverProps
|
|
5001
5420
|
},
|
|
5002
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ React39.createElement(
|
|
5003
5422
|
OverridablePropForm,
|
|
5004
5423
|
{
|
|
5005
5424
|
onSubmit: handleSubmit,
|
|
@@ -5022,7 +5441,7 @@ var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
|
5022
5441
|
|
|
5023
5442
|
// src/extended/mcp/save-as-component-tool.ts
|
|
5024
5443
|
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
5025
|
-
var
|
|
5444
|
+
var import_editor_elements19 = require("@elementor/editor-elements");
|
|
5026
5445
|
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
5027
5446
|
var import_http_client2 = require("@elementor/http-client");
|
|
5028
5447
|
var import_schema6 = require("@elementor/schema");
|
|
@@ -5067,7 +5486,7 @@ var handleSaveAsComponent = async (params) => {
|
|
|
5067
5486
|
overridable_props: overridablePropsInput
|
|
5068
5487
|
} = params;
|
|
5069
5488
|
const validElementTypes = getValidElementTypes();
|
|
5070
|
-
const container = (0,
|
|
5489
|
+
const container = (0, import_editor_elements19.getContainer)(elementId);
|
|
5071
5490
|
if (!container) {
|
|
5072
5491
|
throw new Error(ERROR_MESSAGES3.ELEMENT_NOT_FOUND);
|
|
5073
5492
|
}
|
|
@@ -5133,7 +5552,7 @@ function enrichOverridableProps(input, rootElement, propertGroups) {
|
|
|
5133
5552
|
}
|
|
5134
5553
|
const elType = element.elType;
|
|
5135
5554
|
const widgetType = element.widgetType || element.elType;
|
|
5136
|
-
const elementType = (0,
|
|
5555
|
+
const elementType = (0, import_editor_elements19.getElementType)(widgetType);
|
|
5137
5556
|
if (!elementType) {
|
|
5138
5557
|
throw new Error(
|
|
5139
5558
|
`Element type "${widgetType}" is not atomic or does not have a settings schema. Cannot expose property "${propKey}" for element "${elementId}".`
|
|
@@ -5204,7 +5623,7 @@ function findElementById(root, targetId) {
|
|
|
5204
5623
|
return null;
|
|
5205
5624
|
}
|
|
5206
5625
|
function getValidElementTypes() {
|
|
5207
|
-
const types = (0,
|
|
5626
|
+
const types = (0, import_editor_elements19.getWidgetsCache)();
|
|
5208
5627
|
if (!types) {
|
|
5209
5628
|
return [];
|
|
5210
5629
|
}
|
|
@@ -5413,7 +5832,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
5413
5832
|
};
|
|
5414
5833
|
|
|
5415
5834
|
// src/extended/sync/update-archived-component-before-save.ts
|
|
5416
|
-
var
|
|
5835
|
+
var import_editor_notifications6 = require("@elementor/editor-notifications");
|
|
5417
5836
|
var failedNotification = (message) => ({
|
|
5418
5837
|
type: "error",
|
|
5419
5838
|
message: `Failed to archive components: ${message}`,
|
|
@@ -5428,7 +5847,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
|
|
|
5428
5847
|
const result = await apiClient.updateArchivedComponents(archivedComponents, status);
|
|
5429
5848
|
const failedIds = result.failedIds.join(", ");
|
|
5430
5849
|
if (failedIds) {
|
|
5431
|
-
(0,
|
|
5850
|
+
(0, import_editor_notifications6.notify)(failedNotification(failedIds));
|
|
5432
5851
|
}
|
|
5433
5852
|
} catch (error) {
|
|
5434
5853
|
throw new Error(`Failed to update archived components: ${error}`);
|
|
@@ -5448,7 +5867,7 @@ var updateComponentTitleBeforeSave = async (status) => {
|
|
|
5448
5867
|
};
|
|
5449
5868
|
|
|
5450
5869
|
// src/extended/sync/create-components-before-save.ts
|
|
5451
|
-
var
|
|
5870
|
+
var import_editor_elements20 = require("@elementor/editor-elements");
|
|
5452
5871
|
async function createComponentsBeforeSave({
|
|
5453
5872
|
elements,
|
|
5454
5873
|
status
|
|
@@ -5515,7 +5934,7 @@ function shouldUpdateElement(element, uidToComponentId) {
|
|
|
5515
5934
|
return { shouldUpdate: false, newComponentId: null };
|
|
5516
5935
|
}
|
|
5517
5936
|
function updateElementComponentId(elementId, componentId) {
|
|
5518
|
-
(0,
|
|
5937
|
+
(0, import_editor_elements20.updateElementSettings)({
|
|
5519
5938
|
id: elementId,
|
|
5520
5939
|
props: {
|
|
5521
5940
|
component_instance: {
|
|
@@ -5551,10 +5970,10 @@ var updateExistingComponentsBeforeSave = async ({
|
|
|
5551
5970
|
};
|
|
5552
5971
|
|
|
5553
5972
|
// src/extended/sync/cleanup-overridable-props-on-delete.ts
|
|
5554
|
-
var
|
|
5555
|
-
var
|
|
5973
|
+
var import_editor_elements21 = require("@elementor/editor-elements");
|
|
5974
|
+
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
5556
5975
|
function initCleanupOverridablePropsOnDelete() {
|
|
5557
|
-
(0,
|
|
5976
|
+
(0, import_editor_v1_adapters8.registerDataHook)("dependency", "document/elements/delete", (args, options) => {
|
|
5558
5977
|
if (isPartOfMoveCommand(options)) {
|
|
5559
5978
|
return true;
|
|
5560
5979
|
}
|
|
@@ -5583,7 +6002,7 @@ function initCleanupOverridablePropsOnDelete() {
|
|
|
5583
6002
|
});
|
|
5584
6003
|
}
|
|
5585
6004
|
function collectDeletedElementIds(containers) {
|
|
5586
|
-
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));
|
|
5587
6006
|
return elementIds;
|
|
5588
6007
|
}
|
|
5589
6008
|
function isPartOfMoveCommand(options) {
|
|
@@ -5592,15 +6011,15 @@ function isPartOfMoveCommand(options) {
|
|
|
5592
6011
|
}
|
|
5593
6012
|
|
|
5594
6013
|
// src/extended/sync/handle-component-edit-mode-container.ts
|
|
5595
|
-
var
|
|
5596
|
-
var
|
|
6014
|
+
var import_editor_elements22 = require("@elementor/editor-elements");
|
|
6015
|
+
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
5597
6016
|
var V4_DEFAULT_CONTAINER_TYPE = "e-flexbox";
|
|
5598
6017
|
function initHandleComponentEditModeContainer() {
|
|
5599
6018
|
initRedirectDropIntoComponent();
|
|
5600
6019
|
initHandleTopLevelElementDelete();
|
|
5601
6020
|
}
|
|
5602
6021
|
function initHandleTopLevelElementDelete() {
|
|
5603
|
-
(0,
|
|
6022
|
+
(0, import_editor_v1_adapters9.registerDataHook)("after", "document/elements/delete", (args) => {
|
|
5604
6023
|
if (!isEditingComponent()) {
|
|
5605
6024
|
return;
|
|
5606
6025
|
}
|
|
@@ -5618,7 +6037,7 @@ function initHandleTopLevelElementDelete() {
|
|
|
5618
6037
|
});
|
|
5619
6038
|
}
|
|
5620
6039
|
function initRedirectDropIntoComponent() {
|
|
5621
|
-
(0,
|
|
6040
|
+
(0, import_editor_v1_adapters9.registerDataHook)("dependency", "preview/drop", (args) => {
|
|
5622
6041
|
if (!isEditingComponent()) {
|
|
5623
6042
|
return true;
|
|
5624
6043
|
}
|
|
@@ -5642,11 +6061,11 @@ function initRedirectDropIntoComponent() {
|
|
|
5642
6061
|
});
|
|
5643
6062
|
}
|
|
5644
6063
|
function createEmptyTopLevelContainer(container) {
|
|
5645
|
-
const newContainer = (0,
|
|
6064
|
+
const newContainer = (0, import_editor_elements22.createElement)({
|
|
5646
6065
|
container,
|
|
5647
6066
|
model: { elType: V4_DEFAULT_CONTAINER_TYPE }
|
|
5648
6067
|
});
|
|
5649
|
-
(0,
|
|
6068
|
+
(0, import_editor_elements22.selectElement)(newContainer.id);
|
|
5650
6069
|
}
|
|
5651
6070
|
function getComponentContainer(container) {
|
|
5652
6071
|
const topLevelElement = container.children?.[0];
|
|
@@ -5664,15 +6083,15 @@ function isComponent(container) {
|
|
|
5664
6083
|
}
|
|
5665
6084
|
|
|
5666
6085
|
// src/extended/sync/revert-overridables-on-copy-or-duplicate.ts
|
|
5667
|
-
var
|
|
6086
|
+
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
5668
6087
|
function initRevertOverridablesOnCopyOrDuplicate() {
|
|
5669
|
-
(0,
|
|
6088
|
+
(0, import_editor_v1_adapters10.registerDataHook)("after", "document/elements/duplicate", (_args, result) => {
|
|
5670
6089
|
if (!isEditingComponent()) {
|
|
5671
6090
|
return;
|
|
5672
6091
|
}
|
|
5673
6092
|
revertOverridablesForDuplicatedElements(result);
|
|
5674
6093
|
});
|
|
5675
|
-
(0,
|
|
6094
|
+
(0, import_editor_v1_adapters10.registerDataHook)("after", "document/elements/copy", (args) => {
|
|
5676
6095
|
if (!isEditingComponent()) {
|
|
5677
6096
|
return;
|
|
5678
6097
|
}
|
|
@@ -5702,7 +6121,7 @@ function revertOverridablesInStorage(storageKey) {
|
|
|
5702
6121
|
}
|
|
5703
6122
|
|
|
5704
6123
|
// src/extended/sync/sanitize-overridable-props.ts
|
|
5705
|
-
var
|
|
6124
|
+
var import_react21 = require("react");
|
|
5706
6125
|
|
|
5707
6126
|
// src/extended/store/actions/update-component-sanitized-attribute.ts
|
|
5708
6127
|
function updateComponentSanitizedAttribute(componentId, attribute) {
|
|
@@ -5714,7 +6133,7 @@ function SanitizeOverridableProps() {
|
|
|
5714
6133
|
const currentComponentId = useCurrentComponentId();
|
|
5715
6134
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
5716
6135
|
const isSanitized = useIsSanitizedComponent(currentComponentId, "overridableProps");
|
|
5717
|
-
(0,
|
|
6136
|
+
(0, import_react21.useEffect)(() => {
|
|
5718
6137
|
if (isSanitized || !overridableProps || !currentComponentId) {
|
|
5719
6138
|
return;
|
|
5720
6139
|
}
|
|
@@ -5741,19 +6160,19 @@ function initExtended() {
|
|
|
5741
6160
|
});
|
|
5742
6161
|
(0, import_editor_elements_panel.registerTab)({
|
|
5743
6162
|
id: "components",
|
|
5744
|
-
label: (0,
|
|
6163
|
+
label: (0, import_i18n34.__)("Components", "elementor"),
|
|
5745
6164
|
component: ExtendedComponents,
|
|
5746
6165
|
priority: PRIORITY
|
|
5747
6166
|
});
|
|
5748
6167
|
(0, import_editor_panels6.__registerPanel)(panel);
|
|
5749
|
-
(0,
|
|
6168
|
+
(0, import_editor_v1_adapters11.registerDataHook)("dependency", "editor/documents/close", (args) => {
|
|
5750
6169
|
const document = (0, import_editor_documents13.getV1CurrentDocument)();
|
|
5751
6170
|
if (document.config.type === COMPONENT_DOCUMENT_TYPE) {
|
|
5752
6171
|
args.mode = "autosave";
|
|
5753
6172
|
}
|
|
5754
6173
|
return true;
|
|
5755
6174
|
});
|
|
5756
|
-
(0,
|
|
6175
|
+
(0, import_editor_v1_adapters11.registerDataHook)("after", "preview/drop", onElementDrop);
|
|
5757
6176
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
5758
6177
|
(0, import_editor.injectIntoTop)({
|
|
5759
6178
|
id: "create-component-popup",
|
|
@@ -5790,24 +6209,24 @@ function initExtended() {
|
|
|
5790
6209
|
}
|
|
5791
6210
|
|
|
5792
6211
|
// src/extended/shortcuts/create-component-shortcut.ts
|
|
5793
|
-
var
|
|
6212
|
+
var import_editor_elements23 = require("@elementor/editor-elements");
|
|
5794
6213
|
var import_utils12 = require("@elementor/utils");
|
|
5795
6214
|
var CREATE_COMPONENT_SHORTCUT_KEYS = "ctrl+shift+k";
|
|
5796
6215
|
var OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
5797
6216
|
function isCreateComponentAllowed() {
|
|
5798
|
-
const selectedElements = (0,
|
|
6217
|
+
const selectedElements = (0, import_editor_elements23.getSelectedElements)();
|
|
5799
6218
|
if (selectedElements.length !== 1) {
|
|
5800
6219
|
return { allowed: false };
|
|
5801
6220
|
}
|
|
5802
6221
|
const element = selectedElements[0];
|
|
5803
|
-
const elementType = (0,
|
|
6222
|
+
const elementType = (0, import_editor_elements23.getElementType)(element.type);
|
|
5804
6223
|
if (!elementType) {
|
|
5805
6224
|
return { allowed: false };
|
|
5806
6225
|
}
|
|
5807
6226
|
if (!(0, import_utils12.isProActive)()) {
|
|
5808
6227
|
return { allowed: false };
|
|
5809
6228
|
}
|
|
5810
|
-
const widgetsCache = (0,
|
|
6229
|
+
const widgetsCache = (0, import_editor_elements23.getWidgetsCache)();
|
|
5811
6230
|
const elementConfig = widgetsCache?.[element.type];
|
|
5812
6231
|
if (!elementConfig?.atomic_props_schema || !elementConfig?.show_in_panel || elementConfig?.elType === "widget") {
|
|
5813
6232
|
return { allowed: false };
|
|
@@ -5860,37 +6279,37 @@ function initCreateComponentShortcut() {
|
|
|
5860
6279
|
}
|
|
5861
6280
|
|
|
5862
6281
|
// src/populate-store.ts
|
|
5863
|
-
var
|
|
5864
|
-
var
|
|
6282
|
+
var import_react22 = require("react");
|
|
6283
|
+
var import_store39 = require("@elementor/store");
|
|
5865
6284
|
function PopulateStore() {
|
|
5866
|
-
(0,
|
|
5867
|
-
(0,
|
|
6285
|
+
(0, import_react22.useEffect)(() => {
|
|
6286
|
+
(0, import_store39.__dispatch)(loadComponents());
|
|
5868
6287
|
}, []);
|
|
5869
6288
|
return null;
|
|
5870
6289
|
}
|
|
5871
6290
|
|
|
5872
6291
|
// src/prevent-circular-nesting.ts
|
|
5873
|
-
var
|
|
5874
|
-
var
|
|
5875
|
-
var
|
|
5876
|
-
var
|
|
5877
|
-
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");
|
|
5878
6297
|
var COMPONENT_TYPE = "e-component";
|
|
5879
6298
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
5880
6299
|
type: "default",
|
|
5881
|
-
message: (0,
|
|
6300
|
+
message: (0, import_i18n35.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
5882
6301
|
id: "circular-component-nesting-blocked"
|
|
5883
6302
|
};
|
|
5884
6303
|
function initCircularNestingPrevention() {
|
|
5885
|
-
(0,
|
|
6304
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
5886
6305
|
command: "document/elements/create",
|
|
5887
6306
|
condition: blockCircularCreate
|
|
5888
6307
|
});
|
|
5889
|
-
(0,
|
|
6308
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
5890
6309
|
command: "document/elements/move",
|
|
5891
6310
|
condition: blockCircularMove
|
|
5892
6311
|
});
|
|
5893
|
-
(0,
|
|
6312
|
+
(0, import_editor_v1_adapters12.blockCommand)({
|
|
5894
6313
|
command: "document/elements/paste",
|
|
5895
6314
|
condition: blockCircularPaste
|
|
5896
6315
|
});
|
|
@@ -5899,7 +6318,7 @@ function wouldCreateCircularNesting(componentIdToAdd) {
|
|
|
5899
6318
|
if (componentIdToAdd === void 0) {
|
|
5900
6319
|
return false;
|
|
5901
6320
|
}
|
|
5902
|
-
const state = (0,
|
|
6321
|
+
const state = (0, import_store40.__getState)();
|
|
5903
6322
|
const currentComponentId = selectCurrentComponentId(state);
|
|
5904
6323
|
const path = selectPath(state);
|
|
5905
6324
|
if (currentComponentId === null) {
|
|
@@ -5955,7 +6374,7 @@ function blockCircularCreate(args) {
|
|
|
5955
6374
|
}
|
|
5956
6375
|
const isBlocked = wouldCreateCircularNesting(componentId);
|
|
5957
6376
|
if (isBlocked) {
|
|
5958
|
-
(0,
|
|
6377
|
+
(0, import_editor_notifications7.notify)(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5959
6378
|
}
|
|
5960
6379
|
return isBlocked;
|
|
5961
6380
|
}
|
|
@@ -5965,7 +6384,7 @@ function blockCircularMove(args) {
|
|
|
5965
6384
|
if (!container) {
|
|
5966
6385
|
return false;
|
|
5967
6386
|
}
|
|
5968
|
-
const allElements = (0,
|
|
6387
|
+
const allElements = (0, import_editor_elements24.getAllDescendants)(container);
|
|
5969
6388
|
return allElements.some((element) => {
|
|
5970
6389
|
const componentId = extractComponentIdFromContainer(element);
|
|
5971
6390
|
if (componentId === null) {
|
|
@@ -5975,7 +6394,7 @@ function blockCircularMove(args) {
|
|
|
5975
6394
|
});
|
|
5976
6395
|
});
|
|
5977
6396
|
if (hasCircularComponent) {
|
|
5978
|
-
(0,
|
|
6397
|
+
(0, import_editor_notifications7.notify)(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5979
6398
|
}
|
|
5980
6399
|
return hasCircularComponent;
|
|
5981
6400
|
}
|
|
@@ -5991,25 +6410,25 @@ function blockCircularPaste(args) {
|
|
|
5991
6410
|
const allComponentIds = extractComponentIdsFromElements(data.clipboard.elements);
|
|
5992
6411
|
const hasCircularComponent = allComponentIds.some(wouldCreateCircularNesting);
|
|
5993
6412
|
if (hasCircularComponent) {
|
|
5994
|
-
(0,
|
|
6413
|
+
(0, import_editor_notifications7.notify)(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5995
6414
|
}
|
|
5996
6415
|
return hasCircularComponent;
|
|
5997
6416
|
}
|
|
5998
6417
|
|
|
5999
6418
|
// src/store/actions/remove-component-styles.ts
|
|
6000
|
-
var
|
|
6419
|
+
var import_store42 = require("@elementor/store");
|
|
6001
6420
|
function removeComponentStyles(id2) {
|
|
6002
6421
|
apiClient.invalidateComponentConfigCache(id2);
|
|
6003
|
-
(0,
|
|
6422
|
+
(0, import_store42.__dispatch)(slice.actions.removeStyles({ id: id2 }));
|
|
6004
6423
|
}
|
|
6005
6424
|
|
|
6006
6425
|
// src/store/components-styles-provider.ts
|
|
6007
6426
|
var import_editor_styles_repository = require("@elementor/editor-styles-repository");
|
|
6008
|
-
var
|
|
6427
|
+
var import_store44 = require("@elementor/store");
|
|
6009
6428
|
var componentsStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
|
|
6010
6429
|
key: "components-styles",
|
|
6011
6430
|
priority: 100,
|
|
6012
|
-
subscribe: (cb) => (0,
|
|
6431
|
+
subscribe: (cb) => (0, import_store44.__subscribeWithSelector)(
|
|
6013
6432
|
(state) => state[SLICE_NAME],
|
|
6014
6433
|
() => {
|
|
6015
6434
|
cb();
|
|
@@ -6017,10 +6436,10 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
6017
6436
|
),
|
|
6018
6437
|
actions: {
|
|
6019
6438
|
all: () => {
|
|
6020
|
-
return selectFlatStyles((0,
|
|
6439
|
+
return selectFlatStyles((0, import_store44.__getState)());
|
|
6021
6440
|
},
|
|
6022
6441
|
get: (id2) => {
|
|
6023
|
-
return selectFlatStyles((0,
|
|
6442
|
+
return selectFlatStyles((0, import_store44.__getState)()).find((style) => style.id === id2) ?? null;
|
|
6024
6443
|
}
|
|
6025
6444
|
}
|
|
6026
6445
|
});
|
|
@@ -6032,12 +6451,12 @@ var beforeSave2 = ({ container, status }) => {
|
|
|
6032
6451
|
};
|
|
6033
6452
|
|
|
6034
6453
|
// src/sync/load-component-data-after-instance-added.ts
|
|
6035
|
-
var
|
|
6454
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
6036
6455
|
function initLoadComponentDataAfterInstanceAdded() {
|
|
6037
|
-
(0,
|
|
6456
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/paste", (_args, result) => {
|
|
6038
6457
|
load(result);
|
|
6039
6458
|
});
|
|
6040
|
-
(0,
|
|
6459
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/import", (_args, result) => {
|
|
6041
6460
|
load(result);
|
|
6042
6461
|
});
|
|
6043
6462
|
}
|
|
@@ -6050,15 +6469,19 @@ function load(result) {
|
|
|
6050
6469
|
var PRO_EXTENDED_MIGRATION_VERSION = "4.0.0";
|
|
6051
6470
|
function init() {
|
|
6052
6471
|
import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
|
|
6053
|
-
(0,
|
|
6472
|
+
(0, import_store46.__registerSlice)(slice);
|
|
6054
6473
|
(0, import_editor_canvas8.registerElementType)(
|
|
6055
|
-
|
|
6056
|
-
(options) => createComponentType({
|
|
6474
|
+
COMPONENT_WIDGET_TYPE2,
|
|
6475
|
+
(options) => createComponentType({
|
|
6476
|
+
...options,
|
|
6477
|
+
showLockedByModal: openEditModeDialog,
|
|
6478
|
+
showDetachConfirmDialog: openDetachConfirmDialog
|
|
6479
|
+
})
|
|
6057
6480
|
);
|
|
6058
6481
|
window.elementorCommon.__beforeSave = beforeSave2;
|
|
6059
6482
|
(0, import_editor_elements_panel2.injectTab)({
|
|
6060
6483
|
id: "components",
|
|
6061
|
-
label: (0,
|
|
6484
|
+
label: (0, import_i18n36.__)("Components", "elementor"),
|
|
6062
6485
|
component: Components,
|
|
6063
6486
|
position: 1
|
|
6064
6487
|
});
|
|
@@ -6066,7 +6489,7 @@ function init() {
|
|
|
6066
6489
|
id: "components-populate-store",
|
|
6067
6490
|
component: PopulateStore
|
|
6068
6491
|
});
|
|
6069
|
-
(0,
|
|
6492
|
+
(0, import_editor_v1_adapters14.registerDataHook)("after", "editor/documents/attach-preview", async () => {
|
|
6070
6493
|
const { id: id2, config } = (0, import_editor_documents14.getV1CurrentDocument)();
|
|
6071
6494
|
if (id2) {
|
|
6072
6495
|
removeComponentStyles(id2);
|
|
@@ -6103,6 +6526,7 @@ function init() {
|
|
|
6103
6526
|
ComponentSearch,
|
|
6104
6527
|
ComponentsEmptyState,
|
|
6105
6528
|
ComponentsList,
|
|
6529
|
+
DetachAction,
|
|
6106
6530
|
EditComponentAction,
|
|
6107
6531
|
EmptySearchResult,
|
|
6108
6532
|
InstanceEmptyState,
|