@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.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
|
11
11
|
import { registerDataHook as registerDataHook6 } from "@elementor/editor-v1-adapters";
|
|
12
12
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
13
13
|
import { isProAtLeast } from "@elementor/utils";
|
|
14
|
-
import { __ as
|
|
14
|
+
import { __ as __36 } from "@wordpress/i18n";
|
|
15
15
|
|
|
16
16
|
// src/component-instance-transformer.ts
|
|
17
17
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
@@ -709,58 +709,532 @@ var Components = () => {
|
|
|
709
709
|
return /* @__PURE__ */ React7.createElement(ThemeProvider, null, /* @__PURE__ */ React7.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React7.createElement(ComponentsContent, null)));
|
|
710
710
|
};
|
|
711
711
|
|
|
712
|
-
// src/components/
|
|
712
|
+
// src/components/detach-instance-confirmation-dialog.tsx
|
|
713
713
|
import * as React8 from "react";
|
|
714
|
-
import { closeDialog, openDialog } from "@elementor/editor-ui";
|
|
714
|
+
import { closeDialog, ConfirmationDialog, openDialog } from "@elementor/editor-ui";
|
|
715
|
+
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
716
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
717
|
+
function DetachInstanceConfirmationDialog({
|
|
718
|
+
open,
|
|
719
|
+
onClose,
|
|
720
|
+
onConfirm
|
|
721
|
+
}) {
|
|
722
|
+
return /* @__PURE__ */ React8.createElement(ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React8.createElement(ConfirmationDialog.Title, { icon: AlertTriangleFilledIcon, iconColor: "secondary" }, __4("Detach from Component?", "elementor")), /* @__PURE__ */ React8.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React8.createElement(ConfirmationDialog.ContentText, null, __4(
|
|
723
|
+
"Detaching this instance will break its link to the Component. Changes to the Component will no longer apply. Continue?",
|
|
724
|
+
"elementor"
|
|
725
|
+
))), /* @__PURE__ */ React8.createElement(
|
|
726
|
+
ConfirmationDialog.Actions,
|
|
727
|
+
{
|
|
728
|
+
onClose,
|
|
729
|
+
onConfirm,
|
|
730
|
+
confirmLabel: __4("Detach", "elementor"),
|
|
731
|
+
color: "primary"
|
|
732
|
+
}
|
|
733
|
+
));
|
|
734
|
+
}
|
|
735
|
+
function openDetachConfirmDialog(onConfirm) {
|
|
736
|
+
const handleConfirm = () => {
|
|
737
|
+
closeDialog();
|
|
738
|
+
onConfirm();
|
|
739
|
+
};
|
|
740
|
+
openDialog({
|
|
741
|
+
component: /* @__PURE__ */ React8.createElement(DetachInstanceConfirmationDialog, { open: true, onClose: closeDialog, onConfirm: handleConfirm })
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// src/components/in-edit-mode.tsx
|
|
746
|
+
import * as React9 from "react";
|
|
747
|
+
import { closeDialog as closeDialog2, openDialog as openDialog2 } from "@elementor/editor-ui";
|
|
715
748
|
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
716
749
|
import { Box as Box6, Button, DialogActions, DialogContent, DialogHeader, Icon, Stack as Stack4, Typography as Typography4 } from "@elementor/ui";
|
|
717
|
-
import { __ as
|
|
750
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
718
751
|
var openEditModeDialog = (lockedBy) => {
|
|
719
|
-
|
|
720
|
-
component: /* @__PURE__ */
|
|
752
|
+
openDialog2({
|
|
753
|
+
component: /* @__PURE__ */ React9.createElement(EditModeDialog, { lockedBy })
|
|
721
754
|
});
|
|
722
755
|
};
|
|
723
756
|
var EditModeDialog = ({ lockedBy }) => {
|
|
724
|
-
const content =
|
|
725
|
-
return /* @__PURE__ */
|
|
757
|
+
const content = __5("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
758
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React9.createElement(Box6, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React9.createElement(Icon, { color: "secondary" }, /* @__PURE__ */ React9.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React9.createElement(Typography4, { variant: "subtitle1" }, content))), /* @__PURE__ */ React9.createElement(DialogContent, null, /* @__PURE__ */ React9.createElement(Stack4, { spacing: 2, direction: "column" }, /* @__PURE__ */ React9.createElement(Typography4, { variant: "body2" }, __5(
|
|
726
759
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
727
760
|
"elementor"
|
|
728
|
-
)), /* @__PURE__ */
|
|
761
|
+
)), /* @__PURE__ */ React9.createElement(DialogActions, null, /* @__PURE__ */ React9.createElement(Button, { color: "secondary", variant: "contained", onClick: closeDialog2 }, __5("Close", "elementor"))))));
|
|
729
762
|
};
|
|
730
763
|
|
|
731
764
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
732
|
-
import * as
|
|
765
|
+
import * as React19 from "react";
|
|
733
766
|
import { PencilIcon as PencilIcon2 } from "@elementor/icons";
|
|
734
|
-
import { Box as Box8 } from "@elementor/ui";
|
|
735
|
-
import { __ as
|
|
767
|
+
import { Box as Box8, Stack as Stack11 } from "@elementor/ui";
|
|
768
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
736
769
|
|
|
737
770
|
// src/provider/component-instance-context.tsx
|
|
738
|
-
import * as
|
|
771
|
+
import * as React10 from "react";
|
|
739
772
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
740
773
|
var ComponentInstanceContext = createContext2(null);
|
|
741
774
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
742
|
-
return /* @__PURE__ */
|
|
775
|
+
return /* @__PURE__ */ React10.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
743
776
|
}
|
|
744
777
|
var useComponentId = () => useContext2(ComponentInstanceContext)?.componentId;
|
|
745
778
|
var useComponentInstanceOverrides = () => useContext2(ComponentInstanceContext)?.overrides;
|
|
746
779
|
var useComponentOverridableProps = () => useContext2(ComponentInstanceContext)?.overridableProps;
|
|
747
780
|
|
|
781
|
+
// src/components/instance-editing-panel/detach-action.tsx
|
|
782
|
+
import * as React12 from "react";
|
|
783
|
+
import { useState } from "react";
|
|
784
|
+
import { notify } from "@elementor/editor-notifications";
|
|
785
|
+
import { DetachIcon } from "@elementor/icons";
|
|
786
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
787
|
+
|
|
788
|
+
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
789
|
+
import { getContainer, replaceElement } from "@elementor/editor-elements";
|
|
790
|
+
import { undoable } from "@elementor/editor-v1-adapters";
|
|
791
|
+
import { __dispatch as dispatch, __getState as getState3 } from "@elementor/store";
|
|
792
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
793
|
+
|
|
794
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
795
|
+
import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
|
|
796
|
+
import { z as z3 } from "@elementor/schema";
|
|
797
|
+
|
|
798
|
+
// src/prop-types/component-instance-override-prop-type.ts
|
|
799
|
+
import { createPropUtils } from "@elementor/editor-props";
|
|
800
|
+
import { z } from "@elementor/schema";
|
|
801
|
+
var componentInstanceOverridePropTypeUtil = createPropUtils(
|
|
802
|
+
"override",
|
|
803
|
+
z.object({
|
|
804
|
+
override_key: z.string(),
|
|
805
|
+
override_value: z.unknown(),
|
|
806
|
+
schema_source: z.object({
|
|
807
|
+
type: z.literal("component"),
|
|
808
|
+
id: z.number()
|
|
809
|
+
})
|
|
810
|
+
})
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
// src/prop-types/component-overridable-prop-type.ts
|
|
814
|
+
import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
|
|
815
|
+
import { z as z2 } from "@elementor/schema";
|
|
816
|
+
var componentOverridablePropTypeUtil = createPropUtils2(
|
|
817
|
+
"overridable",
|
|
818
|
+
z2.object({
|
|
819
|
+
override_key: z2.string(),
|
|
820
|
+
origin_value: z2.object({
|
|
821
|
+
$$type: z2.string(),
|
|
822
|
+
value: z2.unknown()
|
|
823
|
+
}).nullable()
|
|
824
|
+
})
|
|
825
|
+
);
|
|
826
|
+
|
|
827
|
+
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
828
|
+
var componentInstanceOverridesPropTypeUtil = createPropUtils3(
|
|
829
|
+
"overrides",
|
|
830
|
+
z3.array(z3.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
|
|
831
|
+
);
|
|
832
|
+
|
|
833
|
+
// src/prop-types/component-instance-prop-type.ts
|
|
834
|
+
import { createPropUtils as createPropUtils4, numberPropTypeUtil } from "@elementor/editor-props";
|
|
835
|
+
import { z as z4 } from "@elementor/schema";
|
|
836
|
+
var componentInstancePropTypeUtil = createPropUtils4(
|
|
837
|
+
"component-instance",
|
|
838
|
+
z4.object({
|
|
839
|
+
component_id: numberPropTypeUtil.schema,
|
|
840
|
+
overrides: z4.optional(componentInstanceOverridesPropTypeUtil.schema)
|
|
841
|
+
})
|
|
842
|
+
);
|
|
843
|
+
|
|
844
|
+
// src/utils/tracking.ts
|
|
845
|
+
import { getMixpanel } from "@elementor/events";
|
|
846
|
+
import { __getState as getState2 } from "@elementor/store";
|
|
847
|
+
var FEATURE_NAME = "Components";
|
|
848
|
+
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
849
|
+
if (source === "system") {
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
const { dispatchEvent, config } = getMixpanel();
|
|
853
|
+
if (!config?.names?.components?.[action]) {
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const name = config.names.components[action];
|
|
857
|
+
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
858
|
+
};
|
|
859
|
+
var onElementDrop = (_args, element) => {
|
|
860
|
+
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
const editorSettings = element.model.get("editor_settings");
|
|
864
|
+
const componentName = editorSettings?.title;
|
|
865
|
+
const componentUID = editorSettings?.component_uid;
|
|
866
|
+
const instanceId = element.id;
|
|
867
|
+
const createdThisSession = selectCreatedThisSession(getState2());
|
|
868
|
+
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
869
|
+
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
870
|
+
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
871
|
+
trackComponentEvent({
|
|
872
|
+
action: "instanceAdded",
|
|
873
|
+
source: "user",
|
|
874
|
+
instance_id: instanceId,
|
|
875
|
+
component_uid: componentUID,
|
|
876
|
+
component_name: componentName,
|
|
877
|
+
is_same_session_reuse: isSameSessionReuse,
|
|
878
|
+
location: locations.widgetPanel,
|
|
879
|
+
secondary_location: secondaryLocations.componentsTab
|
|
880
|
+
});
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// src/utils/detach-component-instance/resolve-detached-instance.ts
|
|
884
|
+
import { generateElementId as generateElementId2 } from "@elementor/editor-elements";
|
|
885
|
+
|
|
886
|
+
// src/utils/detach-component-instance/regenerate-local-style-ids.ts
|
|
887
|
+
import { generateElementId } from "@elementor/editor-elements";
|
|
888
|
+
import { classesPropTypeUtil } from "@elementor/editor-props";
|
|
889
|
+
function regenerateLocalStyleIds(element) {
|
|
890
|
+
const originalStyles = element.styles;
|
|
891
|
+
if (!originalStyles || Object.keys(originalStyles).length === 0) {
|
|
892
|
+
return { styles: void 0, settings: void 0 };
|
|
893
|
+
}
|
|
894
|
+
const newStyles = {};
|
|
895
|
+
const styleIdMapping = {};
|
|
896
|
+
for (const [originalStyleId, style] of Object.entries(originalStyles)) {
|
|
897
|
+
const newStyleId = generateLocalStyleId(element.id);
|
|
898
|
+
newStyles[newStyleId] = { ...style, id: newStyleId };
|
|
899
|
+
styleIdMapping[originalStyleId] = newStyleId;
|
|
900
|
+
}
|
|
901
|
+
const settings = element.settings;
|
|
902
|
+
if (!settings || Object.keys(settings).length === 0) {
|
|
903
|
+
return { styles: newStyles, settings: void 0 };
|
|
904
|
+
}
|
|
905
|
+
const updatedSettings = { ...settings };
|
|
906
|
+
for (const [propKey, propValue] of Object.entries(updatedSettings)) {
|
|
907
|
+
if (isClassesProp(propValue) && propValue.value.length > 0) {
|
|
908
|
+
const updatedClasses = propValue.value.map((classId) => styleIdMapping[classId] ?? classId);
|
|
909
|
+
updatedSettings[propKey] = classesPropTypeUtil.create(updatedClasses);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return {
|
|
913
|
+
styles: newStyles,
|
|
914
|
+
settings: updatedSettings
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
function isClassesProp(prop) {
|
|
918
|
+
return classesPropTypeUtil.isValid(prop);
|
|
919
|
+
}
|
|
920
|
+
function generateLocalStyleId(elementId) {
|
|
921
|
+
return `e-${elementId}-${generateElementId()}`;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// src/consts.ts
|
|
925
|
+
var COMPONENT_WIDGET_TYPE = "e-component";
|
|
926
|
+
|
|
927
|
+
// src/utils/is-component-instance.ts
|
|
928
|
+
function isComponentInstance(elementModel) {
|
|
929
|
+
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// src/utils/detach-component-instance/resolve-overridable-settings.ts
|
|
933
|
+
function resolveOverridableSettings(element, overrideMap) {
|
|
934
|
+
if (isComponentInstance({ widgetType: element.widgetType, elType: element.elType })) {
|
|
935
|
+
return resolveOverridableSettingsForComponentInstance(element, overrideMap);
|
|
936
|
+
}
|
|
937
|
+
return resolveOverridableSettingsForElement(element, overrideMap);
|
|
938
|
+
}
|
|
939
|
+
function resolveOverridableSettingsForElement(element, overrideMap) {
|
|
940
|
+
const updatedSettings = element.settings ? { ...element.settings } : {};
|
|
941
|
+
for (const [settingKey, settingValue] of Object.entries(element.settings ?? {})) {
|
|
942
|
+
updatedSettings[settingKey] = resolvePropValue(settingValue, overrideMap);
|
|
943
|
+
}
|
|
944
|
+
return updatedSettings;
|
|
945
|
+
}
|
|
946
|
+
function resolveOverridableSettingsForComponentInstance(element, overrideMap) {
|
|
947
|
+
const componentInstance = element.settings?.component_instance;
|
|
948
|
+
if (!componentInstancePropTypeUtil.isValid(componentInstance)) {
|
|
949
|
+
return element.settings ?? {};
|
|
950
|
+
}
|
|
951
|
+
const instanceOverrides = componentInstance.value.overrides?.value;
|
|
952
|
+
if (!instanceOverrides?.length) {
|
|
953
|
+
return element.settings ?? {};
|
|
954
|
+
}
|
|
955
|
+
const updatedOverrides = instanceOverrides.map(
|
|
956
|
+
(item) => resolvePropValue(item, overrideMap, { isOverridableOverride: true })
|
|
957
|
+
);
|
|
958
|
+
return {
|
|
959
|
+
...element.settings,
|
|
960
|
+
component_instance: {
|
|
961
|
+
...componentInstance,
|
|
962
|
+
value: {
|
|
963
|
+
...componentInstance.value,
|
|
964
|
+
overrides: {
|
|
965
|
+
...componentInstance.value.overrides,
|
|
966
|
+
value: updatedOverrides
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
function resolvePropValue(propValue, overrideMap, options) {
|
|
973
|
+
const { isOverridableOverride = false } = options ?? {};
|
|
974
|
+
if (!componentOverridablePropTypeUtil.isValid(propValue)) {
|
|
975
|
+
return propValue;
|
|
976
|
+
}
|
|
977
|
+
const overridableKey = propValue.value.override_key;
|
|
978
|
+
const matchingOverride = overrideMap.get(overridableKey);
|
|
979
|
+
const originValue = componentOverridablePropTypeUtil.extract(propValue)?.origin_value;
|
|
980
|
+
if (!matchingOverride) {
|
|
981
|
+
return originValue;
|
|
982
|
+
}
|
|
983
|
+
if (isOverridableOverride) {
|
|
984
|
+
return resolveOverridableOverride(matchingOverride, originValue);
|
|
985
|
+
}
|
|
986
|
+
const matchingOverrideValue = componentInstanceOverridePropTypeUtil.extract(matchingOverride)?.override_value;
|
|
987
|
+
return matchingOverrideValue;
|
|
988
|
+
}
|
|
989
|
+
function resolveOverridableOverride(matchingOverride, originValue) {
|
|
990
|
+
if (!originValue || !componentInstanceOverridePropTypeUtil.isValid(originValue)) {
|
|
991
|
+
return null;
|
|
992
|
+
}
|
|
993
|
+
return componentInstanceOverridePropTypeUtil.create({
|
|
994
|
+
override_value: matchingOverride.value.override_value,
|
|
995
|
+
override_key: originValue.value.override_key,
|
|
996
|
+
schema_source: originValue.value.schema_source
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// src/utils/detach-component-instance/resolve-detached-instance.ts
|
|
1001
|
+
function resolveDetachedInstance(element, overrides) {
|
|
1002
|
+
const overrideMap = createOverrideMap(overrides);
|
|
1003
|
+
return resolveElementRecursive(structuredClone(element), overrideMap);
|
|
1004
|
+
}
|
|
1005
|
+
function resolveElementRecursive(element, overrideMap) {
|
|
1006
|
+
element.id = generateElementId2();
|
|
1007
|
+
if (element.styles) {
|
|
1008
|
+
const { styles, settings } = regenerateLocalStyleIds(element);
|
|
1009
|
+
element.styles = styles;
|
|
1010
|
+
if (settings) {
|
|
1011
|
+
element.settings = { ...element.settings, ...settings };
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (element.settings) {
|
|
1015
|
+
element.settings = resolveOverridableSettings(element, overrideMap);
|
|
1016
|
+
}
|
|
1017
|
+
if (element.elements?.length) {
|
|
1018
|
+
element.elements = element.elements.map((child) => resolveElementRecursive(child, overrideMap));
|
|
1019
|
+
}
|
|
1020
|
+
return element;
|
|
1021
|
+
}
|
|
1022
|
+
function createOverrideMap(overrides) {
|
|
1023
|
+
const map = /* @__PURE__ */ new Map();
|
|
1024
|
+
overrides.forEach((item) => {
|
|
1025
|
+
let override = null;
|
|
1026
|
+
if (componentInstanceOverridePropTypeUtil.isValid(item)) {
|
|
1027
|
+
override = item;
|
|
1028
|
+
} else if (componentOverridablePropTypeUtil.isValid(item)) {
|
|
1029
|
+
override = getOverridableOverride(item);
|
|
1030
|
+
}
|
|
1031
|
+
if (override) {
|
|
1032
|
+
const overrideKey = override.value.override_key;
|
|
1033
|
+
map.set(overrideKey, override);
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
return map;
|
|
1037
|
+
}
|
|
1038
|
+
function getOverridableOverride(propValue) {
|
|
1039
|
+
if (!componentOverridablePropTypeUtil.isValid(propValue)) {
|
|
1040
|
+
return null;
|
|
1041
|
+
}
|
|
1042
|
+
const originValue = componentOverridablePropTypeUtil.extract(propValue)?.origin_value;
|
|
1043
|
+
if (!componentInstanceOverridePropTypeUtil.isValid(originValue)) {
|
|
1044
|
+
return null;
|
|
1045
|
+
}
|
|
1046
|
+
return originValue;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
1050
|
+
async function detachComponentInstance({
|
|
1051
|
+
instanceId,
|
|
1052
|
+
componentId,
|
|
1053
|
+
trackingInfo
|
|
1054
|
+
}) {
|
|
1055
|
+
const instanceContainer = getContainer(instanceId);
|
|
1056
|
+
if (!instanceContainer) {
|
|
1057
|
+
throw new Error(`Instance container with ID "${instanceId}" not found.`);
|
|
1058
|
+
}
|
|
1059
|
+
const componentData = await getComponentDocumentData(componentId);
|
|
1060
|
+
if (!componentData) {
|
|
1061
|
+
throw new Error(`Component with ID "${componentId}" not found.`);
|
|
1062
|
+
}
|
|
1063
|
+
const rootElement = componentData.elements?.[0];
|
|
1064
|
+
if (!rootElement) {
|
|
1065
|
+
throw new Error(`Component with ID "${componentId}" has no root element.`);
|
|
1066
|
+
}
|
|
1067
|
+
const undoableDetach = undoable(
|
|
1068
|
+
{
|
|
1069
|
+
do: () => {
|
|
1070
|
+
const overrides = extractInstanceOverrides(instanceContainer);
|
|
1071
|
+
const detachedInstanceElementData = resolveDetachedInstance(
|
|
1072
|
+
rootElement,
|
|
1073
|
+
overrides
|
|
1074
|
+
);
|
|
1075
|
+
const editedComponentOnDetach = selectCurrentComponentId(getState3());
|
|
1076
|
+
const overridablePropsBeforeDetach = editedComponentOnDetach ? selectOverridableProps(getState3(), editedComponentOnDetach) ?? null : null;
|
|
1077
|
+
const originalInstanceModel = instanceContainer.model.toJSON();
|
|
1078
|
+
const detachedElement = replaceElement({
|
|
1079
|
+
currentElementId: instanceId,
|
|
1080
|
+
newElement: detachedInstanceElementData,
|
|
1081
|
+
withHistory: false
|
|
1082
|
+
});
|
|
1083
|
+
const componentUid = selectComponent(getState3(), componentId)?.uid;
|
|
1084
|
+
trackComponentEvent({
|
|
1085
|
+
action: "detached",
|
|
1086
|
+
source: "user",
|
|
1087
|
+
component_uid: componentUid,
|
|
1088
|
+
instance_id: instanceId,
|
|
1089
|
+
location: trackingInfo.location,
|
|
1090
|
+
secondary_location: trackingInfo.secondaryLocation,
|
|
1091
|
+
trigger: trackingInfo.trigger
|
|
1092
|
+
});
|
|
1093
|
+
return {
|
|
1094
|
+
detachedElement,
|
|
1095
|
+
detachedInstanceElementData,
|
|
1096
|
+
editedComponentOnDetach,
|
|
1097
|
+
overridablePropsBeforeDetach,
|
|
1098
|
+
originalInstanceModel
|
|
1099
|
+
};
|
|
1100
|
+
},
|
|
1101
|
+
undo: (_, {
|
|
1102
|
+
detachedElement,
|
|
1103
|
+
originalInstanceModel,
|
|
1104
|
+
overridablePropsBeforeDetach,
|
|
1105
|
+
editedComponentOnDetach
|
|
1106
|
+
}) => {
|
|
1107
|
+
const restoredInstance = replaceElement({
|
|
1108
|
+
currentElementId: detachedElement.id,
|
|
1109
|
+
newElement: originalInstanceModel,
|
|
1110
|
+
withHistory: false
|
|
1111
|
+
});
|
|
1112
|
+
const currentComponentId = selectCurrentComponentId(getState3());
|
|
1113
|
+
if (currentComponentId && currentComponentId === editedComponentOnDetach && overridablePropsBeforeDetach) {
|
|
1114
|
+
dispatch(
|
|
1115
|
+
slice.actions.setOverridableProps({
|
|
1116
|
+
componentId: currentComponentId,
|
|
1117
|
+
overridableProps: overridablePropsBeforeDetach
|
|
1118
|
+
})
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
return restoredInstance;
|
|
1122
|
+
},
|
|
1123
|
+
redo: (_, doReturn, restoredInstance) => {
|
|
1124
|
+
const { detachedInstanceElementData } = doReturn;
|
|
1125
|
+
const editedComponentOnDetach = selectCurrentComponentId(getState3());
|
|
1126
|
+
const overridablePropsBeforeDetach = editedComponentOnDetach ? selectOverridableProps(getState3(), editedComponentOnDetach) ?? null : null;
|
|
1127
|
+
const detachedElement = replaceElement({
|
|
1128
|
+
currentElementId: restoredInstance.id,
|
|
1129
|
+
newElement: detachedInstanceElementData,
|
|
1130
|
+
withHistory: false
|
|
1131
|
+
});
|
|
1132
|
+
return {
|
|
1133
|
+
...doReturn,
|
|
1134
|
+
detachedElement,
|
|
1135
|
+
editedComponentOnDetach,
|
|
1136
|
+
overridablePropsBeforeDetach
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
title: __6("Detach from Component", "elementor"),
|
|
1142
|
+
subtitle: __6("Instance detached", "elementor")
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1145
|
+
return undoableDetach();
|
|
1146
|
+
}
|
|
1147
|
+
function extractInstanceOverrides(instanceContainer) {
|
|
1148
|
+
const settings = instanceContainer.model.toJSON().settings;
|
|
1149
|
+
const componentInstance = componentInstancePropTypeUtil.extract(
|
|
1150
|
+
settings?.component_instance
|
|
1151
|
+
);
|
|
1152
|
+
const overrides = componentInstanceOverridesPropTypeUtil.extract(componentInstance?.overrides);
|
|
1153
|
+
return overrides ?? [];
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1157
|
+
import * as React11 from "react";
|
|
1158
|
+
import { PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
1159
|
+
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
1160
|
+
import { ComponentsIcon as ComponentsIcon3 } from "@elementor/icons";
|
|
1161
|
+
import { IconButton, Stack as Stack5, Tooltip } from "@elementor/ui";
|
|
1162
|
+
function InstancePanelHeader({ componentName, actions }) {
|
|
1163
|
+
return /* @__PURE__ */ React11.createElement(PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React11.createElement(Stack5, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React11.createElement(ComponentsIcon3, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React11.createElement(EllipsisWithTooltip2, { title: componentName, as: PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1164
|
+
}
|
|
1165
|
+
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1166
|
+
return /* @__PURE__ */ React11.createElement(Tooltip, { title: label }, /* @__PURE__ */ React11.createElement(IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React11.createElement(Icon2, { fontSize: "tiny" })));
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// src/components/instance-editing-panel/detach-action.tsx
|
|
1170
|
+
var DetachAction = ({
|
|
1171
|
+
componentInstanceId,
|
|
1172
|
+
componentId
|
|
1173
|
+
}) => {
|
|
1174
|
+
const [isDetachDialogOpen, setIsDetachDialogOpen] = useState(false);
|
|
1175
|
+
const handleDetachConfirm = async () => {
|
|
1176
|
+
setIsDetachDialogOpen(false);
|
|
1177
|
+
try {
|
|
1178
|
+
await detachComponentInstance({
|
|
1179
|
+
instanceId: componentInstanceId,
|
|
1180
|
+
componentId,
|
|
1181
|
+
trackingInfo: getDetachTrackingInfo()
|
|
1182
|
+
});
|
|
1183
|
+
} catch {
|
|
1184
|
+
notify({
|
|
1185
|
+
type: "error",
|
|
1186
|
+
message: __7("Failed to detach component instance.", "elementor"),
|
|
1187
|
+
id: "detach-component-instance-failed"
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
const handleDetachCancel = () => {
|
|
1192
|
+
setIsDetachDialogOpen(false);
|
|
1193
|
+
};
|
|
1194
|
+
const handleDetachClick = () => {
|
|
1195
|
+
setIsDetachDialogOpen(true);
|
|
1196
|
+
};
|
|
1197
|
+
const detachLabel = __7("Detach from Component", "elementor");
|
|
1198
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(EditComponentAction, { label: detachLabel, icon: DetachIcon, onClick: handleDetachClick }), /* @__PURE__ */ React12.createElement(
|
|
1199
|
+
DetachInstanceConfirmationDialog,
|
|
1200
|
+
{
|
|
1201
|
+
open: isDetachDialogOpen,
|
|
1202
|
+
onClose: handleDetachCancel,
|
|
1203
|
+
onConfirm: handleDetachConfirm
|
|
1204
|
+
}
|
|
1205
|
+
));
|
|
1206
|
+
};
|
|
1207
|
+
function getDetachTrackingInfo() {
|
|
1208
|
+
const extendedWindow = window;
|
|
1209
|
+
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
1210
|
+
if (!config) {
|
|
1211
|
+
return {
|
|
1212
|
+
location: "",
|
|
1213
|
+
trigger: ""
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
return {
|
|
1217
|
+
location: config.locations.components.instanceEditingPanel,
|
|
1218
|
+
trigger: config.triggers.click
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
748
1222
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
749
|
-
import * as
|
|
1223
|
+
import * as React13 from "react";
|
|
750
1224
|
import { ComponentPropListIcon, PencilIcon } from "@elementor/icons";
|
|
751
|
-
import { Button as Button2, Stack as
|
|
752
|
-
import { __ as
|
|
1225
|
+
import { Button as Button2, Stack as Stack6, Typography as Typography5 } from "@elementor/ui";
|
|
1226
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
753
1227
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
754
1228
|
const { canEdit } = useComponentsPermissions();
|
|
755
|
-
const message = canEdit ?
|
|
1229
|
+
const message = canEdit ? __8(
|
|
756
1230
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
757
1231
|
"elementor"
|
|
758
|
-
) :
|
|
1232
|
+
) : __8(
|
|
759
1233
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
760
1234
|
"elementor"
|
|
761
1235
|
);
|
|
762
|
-
return /* @__PURE__ */
|
|
763
|
-
|
|
1236
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1237
|
+
Stack6,
|
|
764
1238
|
{
|
|
765
1239
|
alignItems: "center",
|
|
766
1240
|
justifyContent: "start",
|
|
@@ -769,29 +1243,29 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
769
1243
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
770
1244
|
gap: 1.5
|
|
771
1245
|
},
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
canEdit && !!onEditComponent && /* @__PURE__ */
|
|
1246
|
+
/* @__PURE__ */ React13.createElement(ComponentPropListIcon, { fontSize: "large" }),
|
|
1247
|
+
/* @__PURE__ */ React13.createElement(Typography5, { align: "center", variant: "subtitle2" }, __8("No properties yet", "elementor")),
|
|
1248
|
+
/* @__PURE__ */ React13.createElement(Typography5, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1249
|
+
canEdit && !!onEditComponent && /* @__PURE__ */ React13.createElement(Button2, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React13.createElement(PencilIcon, { fontSize: "small" }), __8("Edit component", "elementor"))
|
|
776
1250
|
);
|
|
777
1251
|
};
|
|
778
1252
|
|
|
779
1253
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
780
|
-
import * as
|
|
1254
|
+
import * as React18 from "react";
|
|
781
1255
|
import { ControlAdornmentsProvider } from "@elementor/editor-controls";
|
|
782
1256
|
import { getFieldIndicators } from "@elementor/editor-editing-panel";
|
|
783
1257
|
import { PanelBody } from "@elementor/editor-panels";
|
|
784
|
-
import { Divider as Divider2, Stack as
|
|
1258
|
+
import { Divider as Divider2, Stack as Stack10 } from "@elementor/ui";
|
|
785
1259
|
|
|
786
1260
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
787
|
-
import * as
|
|
1261
|
+
import * as React17 from "react";
|
|
788
1262
|
import { useId } from "react";
|
|
789
1263
|
import { useStateByElement } from "@elementor/editor-editing-panel";
|
|
790
1264
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
791
|
-
import { Box as Box7, Collapse, ListItemButton as ListItemButton3, ListItemText, Stack as
|
|
1265
|
+
import { Box as Box7, Collapse, ListItemButton as ListItemButton3, ListItemText, Stack as Stack9 } from "@elementor/ui";
|
|
792
1266
|
|
|
793
1267
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
794
|
-
import * as
|
|
1268
|
+
import * as React16 from "react";
|
|
795
1269
|
import {
|
|
796
1270
|
ControlReplacementsProvider,
|
|
797
1271
|
getControlReplacements,
|
|
@@ -809,7 +1283,7 @@ import {
|
|
|
809
1283
|
useElement
|
|
810
1284
|
} from "@elementor/editor-editing-panel";
|
|
811
1285
|
import { getElementSettings, getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
812
|
-
import { Stack as
|
|
1286
|
+
import { Stack as Stack8 } from "@elementor/ui";
|
|
813
1287
|
|
|
814
1288
|
// src/hooks/use-controls-by-widget-type.ts
|
|
815
1289
|
import { getElementType } from "@elementor/editor-elements";
|
|
@@ -842,62 +1316,12 @@ function getControlsByBind(controls) {
|
|
|
842
1316
|
);
|
|
843
1317
|
}
|
|
844
1318
|
|
|
845
|
-
// src/prop-types/component-instance-override-prop-type.ts
|
|
846
|
-
import { createPropUtils } from "@elementor/editor-props";
|
|
847
|
-
import { z } from "@elementor/schema";
|
|
848
|
-
var componentInstanceOverridePropTypeUtil = createPropUtils(
|
|
849
|
-
"override",
|
|
850
|
-
z.object({
|
|
851
|
-
override_key: z.string(),
|
|
852
|
-
override_value: z.unknown(),
|
|
853
|
-
schema_source: z.object({
|
|
854
|
-
type: z.literal("component"),
|
|
855
|
-
id: z.number()
|
|
856
|
-
})
|
|
857
|
-
})
|
|
858
|
-
);
|
|
859
|
-
|
|
860
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
861
|
-
import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
|
|
862
|
-
import { z as z3 } from "@elementor/schema";
|
|
863
|
-
|
|
864
|
-
// src/prop-types/component-overridable-prop-type.ts
|
|
865
|
-
import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
|
|
866
|
-
import { z as z2 } from "@elementor/schema";
|
|
867
|
-
var componentOverridablePropTypeUtil = createPropUtils2(
|
|
868
|
-
"overridable",
|
|
869
|
-
z2.object({
|
|
870
|
-
override_key: z2.string(),
|
|
871
|
-
origin_value: z2.object({
|
|
872
|
-
$$type: z2.string(),
|
|
873
|
-
value: z2.unknown()
|
|
874
|
-
}).nullable()
|
|
875
|
-
})
|
|
876
|
-
);
|
|
877
|
-
|
|
878
|
-
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
879
|
-
var componentInstanceOverridesPropTypeUtil = createPropUtils3(
|
|
880
|
-
"overrides",
|
|
881
|
-
z3.array(z3.union([componentInstanceOverridePropTypeUtil.schema, componentOverridablePropTypeUtil.schema])).optional().default([])
|
|
882
|
-
);
|
|
883
|
-
|
|
884
|
-
// src/prop-types/component-instance-prop-type.ts
|
|
885
|
-
import { createPropUtils as createPropUtils4, numberPropTypeUtil } from "@elementor/editor-props";
|
|
886
|
-
import { z as z4 } from "@elementor/schema";
|
|
887
|
-
var componentInstancePropTypeUtil = createPropUtils4(
|
|
888
|
-
"component-instance",
|
|
889
|
-
z4.object({
|
|
890
|
-
component_id: numberPropTypeUtil.schema,
|
|
891
|
-
overrides: z4.optional(componentInstanceOverridesPropTypeUtil.schema)
|
|
892
|
-
})
|
|
893
|
-
);
|
|
894
|
-
|
|
895
1319
|
// src/provider/overridable-prop-context.tsx
|
|
896
|
-
import * as
|
|
1320
|
+
import * as React14 from "react";
|
|
897
1321
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
898
1322
|
var OverridablePropContext = createContext3(null);
|
|
899
1323
|
function OverridablePropProvider({ children, ...props }) {
|
|
900
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ React14.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
901
1325
|
}
|
|
902
1326
|
var useOverridablePropValue = () => useContext3(OverridablePropContext)?.value;
|
|
903
1327
|
var useComponentInstanceElement = () => useContext3(OverridablePropContext)?.componentInstanceElement;
|
|
@@ -934,40 +1358,40 @@ function getOverrideValue(overrideProp) {
|
|
|
934
1358
|
}
|
|
935
1359
|
|
|
936
1360
|
// src/store/dispatchers.ts
|
|
937
|
-
import { __dispatch as
|
|
1361
|
+
import { __dispatch as dispatch2, __getStore as getStore } from "@elementor/store";
|
|
938
1362
|
function safeDispatch() {
|
|
939
1363
|
return getStore()?.dispatch;
|
|
940
1364
|
}
|
|
941
1365
|
var componentsActions = {
|
|
942
1366
|
add(components) {
|
|
943
|
-
|
|
1367
|
+
dispatch2(slice.actions.add(components));
|
|
944
1368
|
},
|
|
945
1369
|
load(components) {
|
|
946
|
-
|
|
1370
|
+
dispatch2(slice.actions.load(components));
|
|
947
1371
|
},
|
|
948
1372
|
addUnpublished(component) {
|
|
949
|
-
|
|
1373
|
+
dispatch2(slice.actions.addUnpublished(component));
|
|
950
1374
|
},
|
|
951
1375
|
removeUnpublished(uids) {
|
|
952
|
-
|
|
1376
|
+
dispatch2(slice.actions.removeUnpublished(uids));
|
|
953
1377
|
},
|
|
954
1378
|
resetUnpublished() {
|
|
955
|
-
|
|
1379
|
+
dispatch2(slice.actions.resetUnpublished());
|
|
956
1380
|
},
|
|
957
1381
|
removeStyles(id2) {
|
|
958
|
-
|
|
1382
|
+
dispatch2(slice.actions.removeStyles({ id: id2 }));
|
|
959
1383
|
},
|
|
960
1384
|
addStyles(styles) {
|
|
961
|
-
|
|
1385
|
+
dispatch2(slice.actions.addStyles(styles));
|
|
962
1386
|
},
|
|
963
1387
|
addCreatedThisSession(uid) {
|
|
964
|
-
|
|
1388
|
+
dispatch2(slice.actions.addCreatedThisSession(uid));
|
|
965
1389
|
},
|
|
966
1390
|
removeCreatedThisSession(uid) {
|
|
967
|
-
|
|
1391
|
+
dispatch2(slice.actions.removeCreatedThisSession(uid));
|
|
968
1392
|
},
|
|
969
1393
|
archive(componentId) {
|
|
970
|
-
|
|
1394
|
+
dispatch2(slice.actions.archive(componentId));
|
|
971
1395
|
},
|
|
972
1396
|
setCurrentComponentId(id2) {
|
|
973
1397
|
safeDispatch()?.(slice.actions.setCurrentComponentId(id2));
|
|
@@ -976,33 +1400,33 @@ var componentsActions = {
|
|
|
976
1400
|
safeDispatch()?.(slice.actions.setPath(path));
|
|
977
1401
|
},
|
|
978
1402
|
setOverridableProps(componentId, overridableProps) {
|
|
979
|
-
|
|
1403
|
+
dispatch2(slice.actions.setOverridableProps({ componentId, overridableProps }));
|
|
980
1404
|
},
|
|
981
1405
|
rename(componentUid, name) {
|
|
982
|
-
|
|
1406
|
+
dispatch2(slice.actions.rename({ componentUid, name }));
|
|
983
1407
|
},
|
|
984
1408
|
cleanUpdatedComponentNames() {
|
|
985
|
-
|
|
1409
|
+
dispatch2(slice.actions.cleanUpdatedComponentNames());
|
|
986
1410
|
},
|
|
987
1411
|
updateComponentSanitizedAttribute(componentId, attribute) {
|
|
988
|
-
|
|
1412
|
+
dispatch2(slice.actions.updateComponentSanitizedAttribute({ componentId, attribute }));
|
|
989
1413
|
},
|
|
990
1414
|
resetSanitizedComponents() {
|
|
991
|
-
|
|
1415
|
+
dispatch2(slice.actions.resetSanitizedComponents());
|
|
992
1416
|
}
|
|
993
1417
|
};
|
|
994
1418
|
|
|
995
1419
|
// src/store/selectors.ts
|
|
996
|
-
import { __getState as
|
|
1420
|
+
import { __getState as getState4, __getStore as getStore2 } from "@elementor/store";
|
|
997
1421
|
function safeGetState() {
|
|
998
1422
|
return getStore2()?.getState();
|
|
999
1423
|
}
|
|
1000
1424
|
var componentsSelectors = {
|
|
1001
1425
|
getOverridableProps(componentId) {
|
|
1002
|
-
return selectOverridableProps(
|
|
1426
|
+
return selectOverridableProps(getState4(), componentId);
|
|
1003
1427
|
},
|
|
1004
1428
|
getCurrentComponent() {
|
|
1005
|
-
return selectCurrentComponent(
|
|
1429
|
+
return selectCurrentComponent(getState4());
|
|
1006
1430
|
},
|
|
1007
1431
|
getCurrentComponentId() {
|
|
1008
1432
|
const state = safeGetState();
|
|
@@ -1012,19 +1436,19 @@ var componentsSelectors = {
|
|
|
1012
1436
|
return selectCurrentComponentId(state);
|
|
1013
1437
|
},
|
|
1014
1438
|
getUnpublishedComponents() {
|
|
1015
|
-
return selectUnpublishedComponents(
|
|
1439
|
+
return selectUnpublishedComponents(getState4());
|
|
1016
1440
|
},
|
|
1017
1441
|
getUpdatedComponentNames() {
|
|
1018
|
-
return selectUpdatedComponentNames(
|
|
1442
|
+
return selectUpdatedComponentNames(getState4());
|
|
1019
1443
|
},
|
|
1020
1444
|
getArchivedThisSession() {
|
|
1021
|
-
return selectArchivedThisSession(
|
|
1445
|
+
return selectArchivedThisSession(getState4());
|
|
1022
1446
|
},
|
|
1023
1447
|
getComponents() {
|
|
1024
|
-
return selectComponents(
|
|
1448
|
+
return selectComponents(getState4());
|
|
1025
1449
|
},
|
|
1026
1450
|
getComponentByUid(componentUid) {
|
|
1027
|
-
return selectComponentByUid(
|
|
1451
|
+
return selectComponentByUid(getState4(), componentUid);
|
|
1028
1452
|
}
|
|
1029
1453
|
};
|
|
1030
1454
|
|
|
@@ -1059,12 +1483,12 @@ function updateOverridableProp(componentId, propValue, originPropFields) {
|
|
|
1059
1483
|
}
|
|
1060
1484
|
|
|
1061
1485
|
// src/utils/get-container-by-origin-id.ts
|
|
1062
|
-
import { getContainer } from "@elementor/editor-elements";
|
|
1486
|
+
import { getContainer as getContainer2 } from "@elementor/editor-elements";
|
|
1063
1487
|
function getContainerByOriginId(originElementId, instanceElementId) {
|
|
1064
1488
|
if (!instanceElementId) {
|
|
1065
|
-
return
|
|
1489
|
+
return getContainer2(originElementId);
|
|
1066
1490
|
}
|
|
1067
|
-
const instanceContainer =
|
|
1491
|
+
const instanceContainer = getContainer2(instanceElementId);
|
|
1068
1492
|
if (!instanceContainer) {
|
|
1069
1493
|
return null;
|
|
1070
1494
|
}
|
|
@@ -1126,11 +1550,11 @@ function extractInnerOverrideInfo(override) {
|
|
|
1126
1550
|
}
|
|
1127
1551
|
|
|
1128
1552
|
// src/components/control-label.tsx
|
|
1129
|
-
import * as
|
|
1553
|
+
import * as React15 from "react";
|
|
1130
1554
|
import { ControlAdornments, ControlFormLabel } from "@elementor/editor-controls";
|
|
1131
|
-
import { Stack as
|
|
1555
|
+
import { Stack as Stack7 } from "@elementor/ui";
|
|
1132
1556
|
var ControlLabel = ({ children, ...props }) => {
|
|
1133
|
-
return /* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ React15.createElement(Stack7, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React15.createElement(ControlFormLabel, { ...props }, children), /* @__PURE__ */ React15.createElement(ControlAdornments, null));
|
|
1134
1558
|
};
|
|
1135
1559
|
|
|
1136
1560
|
// src/components/errors.ts
|
|
@@ -1144,12 +1568,12 @@ var OverrideControlInnerElementNotFoundError = createError({
|
|
|
1144
1568
|
import { __useSelector as useSelector3 } from "@elementor/store";
|
|
1145
1569
|
|
|
1146
1570
|
// src/utils/get-overridable-prop.ts
|
|
1147
|
-
import { __getState as
|
|
1571
|
+
import { __getState as getState5 } from "@elementor/store";
|
|
1148
1572
|
function getOverridableProp({
|
|
1149
1573
|
componentId,
|
|
1150
1574
|
overrideKey
|
|
1151
1575
|
}) {
|
|
1152
|
-
const overridableProps = selectOverridableProps(
|
|
1576
|
+
const overridableProps = selectOverridableProps(getState5(), componentId);
|
|
1153
1577
|
if (!overridableProps) {
|
|
1154
1578
|
return void 0;
|
|
1155
1579
|
}
|
|
@@ -1239,7 +1663,7 @@ function OverridePropControl({ overrideKey }) {
|
|
|
1239
1663
|
if (!overridableProp) {
|
|
1240
1664
|
return null;
|
|
1241
1665
|
}
|
|
1242
|
-
return /* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ React16.createElement(SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React16.createElement(OverrideControl, { overridableProp }));
|
|
1243
1667
|
}
|
|
1244
1668
|
function OverrideControl({ overridableProp }) {
|
|
1245
1669
|
const componentInstanceElement = useElement();
|
|
@@ -1333,13 +1757,13 @@ function OverrideControl({ overridableProp }) {
|
|
|
1333
1757
|
[overridableProp.overrideKey]: propType
|
|
1334
1758
|
}
|
|
1335
1759
|
});
|
|
1336
|
-
return /* @__PURE__ */
|
|
1760
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1337
1761
|
OverridablePropProvider,
|
|
1338
1762
|
{
|
|
1339
1763
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
1340
1764
|
componentInstanceElement
|
|
1341
1765
|
},
|
|
1342
|
-
/* @__PURE__ */
|
|
1766
|
+
/* @__PURE__ */ React16.createElement(ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React16.createElement(SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React16.createElement(
|
|
1343
1767
|
PropProvider,
|
|
1344
1768
|
{
|
|
1345
1769
|
propType: propTypeSchema,
|
|
@@ -1349,7 +1773,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1349
1773
|
return false;
|
|
1350
1774
|
}
|
|
1351
1775
|
},
|
|
1352
|
-
/* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ React16.createElement(PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React16.createElement(ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React16.createElement(Stack8, { direction: "column", gap: 1, mb: 1.5 }, layout !== "custom" && /* @__PURE__ */ React16.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React16.createElement(OriginalControl, { control, controlProps }))))
|
|
1353
1777
|
)))
|
|
1354
1778
|
);
|
|
1355
1779
|
}
|
|
@@ -1408,7 +1832,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
1408
1832
|
}
|
|
1409
1833
|
function OriginalControl({ control, controlProps }) {
|
|
1410
1834
|
const { value } = control;
|
|
1411
|
-
return /* @__PURE__ */
|
|
1835
|
+
return /* @__PURE__ */ React16.createElement(BaseControl, { type: value.type, props: controlProps });
|
|
1412
1836
|
}
|
|
1413
1837
|
function getControlLayout(control) {
|
|
1414
1838
|
return control.value.meta?.layout || controlsRegistry.getLayout(control.value.type);
|
|
@@ -1443,7 +1867,7 @@ function OverridePropsGroup({ group }) {
|
|
|
1443
1867
|
const labelId = `label-${id2}`;
|
|
1444
1868
|
const contentId = `content-${id2}`;
|
|
1445
1869
|
const title = group.label;
|
|
1446
|
-
return /* @__PURE__ */
|
|
1870
|
+
return /* @__PURE__ */ React17.createElement(Box7, { "aria-label": `${title} section` }, /* @__PURE__ */ React17.createElement(
|
|
1447
1871
|
ListItemButton3,
|
|
1448
1872
|
{
|
|
1449
1873
|
id: labelId,
|
|
@@ -1453,7 +1877,7 @@ function OverridePropsGroup({ group }) {
|
|
|
1453
1877
|
p: 0,
|
|
1454
1878
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
1455
1879
|
},
|
|
1456
|
-
/* @__PURE__ */
|
|
1880
|
+
/* @__PURE__ */ React17.createElement(Stack9, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React17.createElement(
|
|
1457
1881
|
ListItemText,
|
|
1458
1882
|
{
|
|
1459
1883
|
secondary: title,
|
|
@@ -1461,26 +1885,13 @@ function OverridePropsGroup({ group }) {
|
|
|
1461
1885
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
1462
1886
|
}
|
|
1463
1887
|
)),
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
), /* @__PURE__ */
|
|
1888
|
+
/* @__PURE__ */ React17.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
1889
|
+
), /* @__PURE__ */ React17.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React17.createElement(Stack9, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React17.createElement(OverridePropControl, { key: overrideKey, overrideKey })))));
|
|
1466
1890
|
}
|
|
1467
1891
|
|
|
1468
1892
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1469
1893
|
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
1470
|
-
return /* @__PURE__ */
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1474
|
-
import * as React16 from "react";
|
|
1475
|
-
import { PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
1476
|
-
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
1477
|
-
import { ComponentsIcon as ComponentsIcon3 } from "@elementor/icons";
|
|
1478
|
-
import { IconButton, Stack as Stack10, Tooltip } from "@elementor/ui";
|
|
1479
|
-
function InstancePanelHeader({ componentName, actions }) {
|
|
1480
|
-
return /* @__PURE__ */ React16.createElement(PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React16.createElement(Stack10, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React16.createElement(ComponentsIcon3, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React16.createElement(EllipsisWithTooltip2, { title: componentName, as: PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1481
|
-
}
|
|
1482
|
-
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1483
|
-
return /* @__PURE__ */ React16.createElement(Tooltip, { title: label }, /* @__PURE__ */ React16.createElement(IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React16.createElement(Icon2, { fontSize: "tiny" })));
|
|
1894
|
+
return /* @__PURE__ */ React18.createElement(PanelBody, null, /* @__PURE__ */ React18.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") }, isEmpty ? emptyState : /* @__PURE__ */ React18.createElement(Stack10, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React18.createElement(React18.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React18.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React18.createElement(Divider2, null))))));
|
|
1484
1895
|
}
|
|
1485
1896
|
|
|
1486
1897
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -1566,7 +1977,7 @@ function useInstancePanelData() {
|
|
|
1566
1977
|
const component = useComponent(componentId ?? null);
|
|
1567
1978
|
const componentInstanceId = element?.id;
|
|
1568
1979
|
const overridableProps = useSanitizeOverridableProps(componentId ?? null, componentInstanceId);
|
|
1569
|
-
if (!componentId || !overridableProps || !component) {
|
|
1980
|
+
if (!componentId || !overridableProps || !component || !componentInstanceId) {
|
|
1570
1981
|
return null;
|
|
1571
1982
|
}
|
|
1572
1983
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
@@ -1581,32 +1992,28 @@ function useComponentInstanceSettings() {
|
|
|
1581
1992
|
|
|
1582
1993
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
1583
1994
|
function InstanceEditingPanel() {
|
|
1995
|
+
const { canEdit } = useComponentsPermissions();
|
|
1584
1996
|
const data = useInstancePanelData();
|
|
1585
1997
|
if (!data) {
|
|
1586
1998
|
return null;
|
|
1587
1999
|
}
|
|
1588
2000
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
1589
|
-
const panelTitle =
|
|
1590
|
-
|
|
2001
|
+
const panelTitle = __9("Edit %s", "elementor").replace("%s", component.name);
|
|
2002
|
+
const actions = /* @__PURE__ */ React19.createElement(Stack11, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React19.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React19.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: PencilIcon2 }));
|
|
2003
|
+
return /* @__PURE__ */ React19.createElement(Box8, { "data-testid": "instance-editing-panel" }, /* @__PURE__ */ React19.createElement(
|
|
1591
2004
|
ComponentInstanceProvider,
|
|
1592
2005
|
{
|
|
1593
2006
|
componentId,
|
|
1594
2007
|
overrides,
|
|
1595
2008
|
overridableProps
|
|
1596
2009
|
},
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
|
|
1599
|
-
{
|
|
1600
|
-
componentName: component.name,
|
|
1601
|
-
actions: /* @__PURE__ */ React17.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: PencilIcon2 })
|
|
1602
|
-
}
|
|
1603
|
-
),
|
|
1604
|
-
/* @__PURE__ */ React17.createElement(
|
|
2010
|
+
/* @__PURE__ */ React19.createElement(InstancePanelHeader, { componentName: component.name, actions }),
|
|
2011
|
+
/* @__PURE__ */ React19.createElement(
|
|
1605
2012
|
InstancePanelBody,
|
|
1606
2013
|
{
|
|
1607
2014
|
groups,
|
|
1608
2015
|
isEmpty,
|
|
1609
|
-
emptyState: /* @__PURE__ */
|
|
2016
|
+
emptyState: /* @__PURE__ */ React19.createElement(EmptyState2, null),
|
|
1610
2017
|
componentInstanceId
|
|
1611
2018
|
}
|
|
1612
2019
|
)
|
|
@@ -1620,14 +2027,138 @@ import { useLoadedTemplates } from "@elementor/editor-templates";
|
|
|
1620
2027
|
// src/store/actions/load-components-assets.ts
|
|
1621
2028
|
import { isDocumentDirty, setDocumentModifiedStatus } from "@elementor/editor-documents";
|
|
1622
2029
|
|
|
2030
|
+
// src/utils/get-component-documents.ts
|
|
2031
|
+
async function getComponentDocuments(elements, cache = /* @__PURE__ */ new Map()) {
|
|
2032
|
+
const componentIds = await getComponentIds(elements, cache);
|
|
2033
|
+
return getDocumentsMap(componentIds, cache);
|
|
2034
|
+
}
|
|
2035
|
+
async function getComponentIds(elements, cache) {
|
|
2036
|
+
const results = await Promise.all(
|
|
2037
|
+
elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
|
|
2038
|
+
const ids = [];
|
|
2039
|
+
if (isComponentInstance({ widgetType, elType })) {
|
|
2040
|
+
const componentId = settings?.component_instance?.value?.component_id.value;
|
|
2041
|
+
if (!componentId) {
|
|
2042
|
+
return ids;
|
|
2043
|
+
}
|
|
2044
|
+
ids.push(componentId);
|
|
2045
|
+
if (!cache.has(componentId)) {
|
|
2046
|
+
cache.set(componentId, getComponentDocumentData(componentId));
|
|
2047
|
+
}
|
|
2048
|
+
const doc = await cache.get(componentId);
|
|
2049
|
+
childElements = doc?.elements;
|
|
2050
|
+
}
|
|
2051
|
+
if (childElements?.length) {
|
|
2052
|
+
const childIds = await getComponentIds(childElements, cache);
|
|
2053
|
+
ids.push(...childIds);
|
|
2054
|
+
}
|
|
2055
|
+
return ids;
|
|
2056
|
+
})
|
|
2057
|
+
);
|
|
2058
|
+
return [...new Set(results.flat())];
|
|
2059
|
+
}
|
|
2060
|
+
async function getDocumentsMap(ids, cache) {
|
|
2061
|
+
const documents = await Promise.all(
|
|
2062
|
+
ids.map(async (id2) => {
|
|
2063
|
+
const document = await cache.get(id2);
|
|
2064
|
+
if (!document) {
|
|
2065
|
+
return null;
|
|
2066
|
+
}
|
|
2067
|
+
return [id2, document];
|
|
2068
|
+
})
|
|
2069
|
+
);
|
|
2070
|
+
return new Map(documents.filter((document) => document !== null));
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
// src/store/actions/load-components-overridable-props.ts
|
|
2074
|
+
import { __dispatch as dispatch3, __getState as getState6 } from "@elementor/store";
|
|
2075
|
+
function loadComponentsOverridableProps(componentIds) {
|
|
2076
|
+
if (!componentIds.length) {
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2080
|
+
}
|
|
2081
|
+
async function loadComponentOverrides(componentId) {
|
|
2082
|
+
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded(getState6(), componentId);
|
|
2083
|
+
if (isOverridablePropsLoaded) {
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2087
|
+
if (!overridableProps) {
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
dispatch3(
|
|
2091
|
+
slice.actions.setOverridableProps({
|
|
2092
|
+
componentId,
|
|
2093
|
+
overridableProps
|
|
2094
|
+
})
|
|
2095
|
+
);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
// src/store/actions/load-components-styles.ts
|
|
2099
|
+
import { __dispatch as dispatch4, __getState as getState7 } from "@elementor/store";
|
|
2100
|
+
function loadComponentsStyles(documents) {
|
|
2101
|
+
if (!documents.size) {
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
const knownComponents = selectStyles(getState7());
|
|
2105
|
+
const unknownDocuments = new Map([...documents.entries()].filter(([id2]) => !knownComponents[id2]));
|
|
2106
|
+
if (!unknownDocuments.size) {
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
addStyles(unknownDocuments);
|
|
2110
|
+
}
|
|
2111
|
+
function addStyles(documents) {
|
|
2112
|
+
const styles = Object.fromEntries(
|
|
2113
|
+
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2114
|
+
);
|
|
2115
|
+
dispatch4(slice.actions.addStyles(styles));
|
|
2116
|
+
}
|
|
2117
|
+
function extractStylesFromDocument(document) {
|
|
2118
|
+
if (!document.elements?.length) {
|
|
2119
|
+
return [];
|
|
2120
|
+
}
|
|
2121
|
+
return document.elements.flatMap(extractStylesFromElement);
|
|
2122
|
+
}
|
|
2123
|
+
function extractStylesFromElement(element) {
|
|
2124
|
+
return [
|
|
2125
|
+
...Object.values(element.styles ?? {}),
|
|
2126
|
+
...(element.elements ?? []).flatMap(extractStylesFromElement)
|
|
2127
|
+
];
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// src/store/actions/load-components-assets.ts
|
|
2131
|
+
async function loadComponentsAssets(elements) {
|
|
2132
|
+
const documents = await getComponentDocuments(elements);
|
|
2133
|
+
updateDocumentState(documents);
|
|
2134
|
+
loadComponentsStyles(documents);
|
|
2135
|
+
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2136
|
+
}
|
|
2137
|
+
function updateDocumentState(documents) {
|
|
2138
|
+
const isDrafted = [...documents.values()].some(isDocumentDirty);
|
|
2139
|
+
if (isDrafted) {
|
|
2140
|
+
setDocumentModifiedStatus(true);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
// src/components/load-template-components.tsx
|
|
2145
|
+
var LoadTemplateComponents = () => {
|
|
2146
|
+
const templates = useLoadedTemplates();
|
|
2147
|
+
useEffect(() => {
|
|
2148
|
+
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2149
|
+
}, [templates]);
|
|
2150
|
+
return null;
|
|
2151
|
+
};
|
|
2152
|
+
|
|
1623
2153
|
// src/create-component-type.ts
|
|
1624
2154
|
import {
|
|
1625
2155
|
createTemplatedElementView
|
|
1626
2156
|
} from "@elementor/editor-canvas";
|
|
1627
2157
|
import { getCurrentDocument } from "@elementor/editor-documents";
|
|
1628
|
-
import {
|
|
2158
|
+
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2159
|
+
import { __getState as getState8 } from "@elementor/store";
|
|
1629
2160
|
import { hasProInstalled } from "@elementor/utils";
|
|
1630
|
-
import { __ as
|
|
2161
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1631
2162
|
|
|
1632
2163
|
// src/utils/format-component-elements-id.ts
|
|
1633
2164
|
import { hashString } from "@elementor/utils";
|
|
@@ -1697,48 +2228,27 @@ function buildUniqueSelector(element) {
|
|
|
1697
2228
|
return selectors.join(" ");
|
|
1698
2229
|
}
|
|
1699
2230
|
|
|
1700
|
-
// src/utils/tracking.ts
|
|
1701
|
-
import { getMixpanel } from "@elementor/events";
|
|
1702
|
-
import { __getState as getState4 } from "@elementor/store";
|
|
1703
|
-
var FEATURE_NAME = "Components";
|
|
1704
|
-
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
1705
|
-
if (source === "system") {
|
|
1706
|
-
return;
|
|
1707
|
-
}
|
|
1708
|
-
const { dispatchEvent, config } = getMixpanel();
|
|
1709
|
-
if (!config?.names?.components?.[action]) {
|
|
1710
|
-
return;
|
|
1711
|
-
}
|
|
1712
|
-
const name = config.names.components[action];
|
|
1713
|
-
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
1714
|
-
};
|
|
1715
|
-
var onElementDrop = (_args, element) => {
|
|
1716
|
-
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
const editorSettings = element.model.get("editor_settings");
|
|
1720
|
-
const componentName = editorSettings?.title;
|
|
1721
|
-
const componentUID = editorSettings?.component_uid;
|
|
1722
|
-
const instanceId = element.id;
|
|
1723
|
-
const createdThisSession = selectCreatedThisSession(getState4());
|
|
1724
|
-
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
1725
|
-
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
1726
|
-
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
1727
|
-
trackComponentEvent({
|
|
1728
|
-
action: "instanceAdded",
|
|
1729
|
-
source: "user",
|
|
1730
|
-
instance_id: instanceId,
|
|
1731
|
-
component_uid: componentUID,
|
|
1732
|
-
component_name: componentName,
|
|
1733
|
-
is_same_session_reuse: isSameSessionReuse,
|
|
1734
|
-
location: locations.widgetPanel,
|
|
1735
|
-
secondary_location: secondaryLocations.componentsTab
|
|
1736
|
-
});
|
|
1737
|
-
};
|
|
1738
|
-
|
|
1739
2231
|
// src/create-component-type.ts
|
|
1740
|
-
var
|
|
2232
|
+
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
1741
2233
|
var EDIT_COMPONENT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2234
|
+
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
2235
|
+
function notifyComponentEditUpgrade() {
|
|
2236
|
+
notify2({
|
|
2237
|
+
type: "promotion",
|
|
2238
|
+
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
2239
|
+
message: __10("Your Pro subscription has expired. Renew to edit components.", "elementor"),
|
|
2240
|
+
additionalActionProps: [
|
|
2241
|
+
{
|
|
2242
|
+
size: "small",
|
|
2243
|
+
variant: "contained",
|
|
2244
|
+
color: "promotion",
|
|
2245
|
+
href: EDIT_COMPONENT_UPGRADE_URL,
|
|
2246
|
+
target: "_blank",
|
|
2247
|
+
children: __10("Upgrade Now", "elementor")
|
|
2248
|
+
}
|
|
2249
|
+
]
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
1742
2252
|
var updateGroups = (groups, config) => {
|
|
1743
2253
|
const disableMap = new Map(Object.entries(config.disable ?? {}));
|
|
1744
2254
|
const addMap = new Map(Object.entries(config.add ?? {}));
|
|
@@ -1749,7 +2259,7 @@ var updateGroups = (groups, config) => {
|
|
|
1749
2259
|
(action) => disabledActions.includes(action.name) ? { ...action, isEnabled: () => false } : action
|
|
1750
2260
|
);
|
|
1751
2261
|
if (addConfig) {
|
|
1752
|
-
updatedActions.splice(addConfig.index, 0, addConfig.
|
|
2262
|
+
updatedActions.splice(addConfig.index, 0, ...addConfig.actions);
|
|
1753
2263
|
}
|
|
1754
2264
|
return { ...group, actions: updatedActions };
|
|
1755
2265
|
});
|
|
@@ -1848,26 +2358,35 @@ function createComponentView(options) {
|
|
|
1848
2358
|
_getContextMenuConfig() {
|
|
1849
2359
|
const isAdministrator = isUserAdministrator();
|
|
1850
2360
|
const hasPro = hasProInstalled();
|
|
1851
|
-
const proLabel =
|
|
2361
|
+
const proLabel = __10("PRO", "elementor");
|
|
1852
2362
|
const badgeClass = "elementor-context-menu-list__item__shortcut__new-badge";
|
|
1853
2363
|
const proBadge = `<a href="${EDIT_COMPONENT_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}">${proLabel}</a>`;
|
|
2364
|
+
const editComponentAction = {
|
|
2365
|
+
name: "edit component",
|
|
2366
|
+
icon: "eicon-edit",
|
|
2367
|
+
title: () => __10("Edit Component", "elementor"),
|
|
2368
|
+
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
2369
|
+
isEnabled: () => hasPro,
|
|
2370
|
+
callback: (_, eventData) => this.editComponent(eventData)
|
|
2371
|
+
};
|
|
2372
|
+
const detachInstanceAction = {
|
|
2373
|
+
name: "detach instance",
|
|
2374
|
+
icon: "eicon-chain-broken",
|
|
2375
|
+
title: () => __10("Detach from Component", "elementor"),
|
|
2376
|
+
isEnabled: () => true,
|
|
2377
|
+
callback: (_, eventData) => this.detachInstance(eventData)
|
|
2378
|
+
};
|
|
2379
|
+
const actions = isAdministrator ? [editComponentAction, detachInstanceAction] : [detachInstanceAction];
|
|
1854
2380
|
const addedGroup = {
|
|
1855
2381
|
general: {
|
|
1856
2382
|
index: 1,
|
|
1857
|
-
|
|
1858
|
-
name: "edit component",
|
|
1859
|
-
icon: "eicon-edit",
|
|
1860
|
-
title: () => __7("Edit Component", "elementor"),
|
|
1861
|
-
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
1862
|
-
isEnabled: () => hasPro,
|
|
1863
|
-
callback: (_, eventData) => this.editComponent(eventData)
|
|
1864
|
-
}
|
|
2383
|
+
actions
|
|
1865
2384
|
}
|
|
1866
2385
|
};
|
|
1867
2386
|
const disabledGroup = {
|
|
1868
2387
|
clipboard: ["pasteStyle", "resetStyle"]
|
|
1869
2388
|
};
|
|
1870
|
-
return { add:
|
|
2389
|
+
return { add: addedGroup, disable: disabledGroup };
|
|
1871
2390
|
}
|
|
1872
2391
|
async switchDocument() {
|
|
1873
2392
|
const { isAllowedToSwitchDocument, lockedBy } = await apiClient.getComponentLockStatus(
|
|
@@ -1896,9 +2415,36 @@ function createComponentView(options) {
|
|
|
1896
2415
|
trigger
|
|
1897
2416
|
});
|
|
1898
2417
|
}
|
|
2418
|
+
detachInstance({ trigger, location, secondaryLocation }) {
|
|
2419
|
+
const componentId = this.getComponentId();
|
|
2420
|
+
const instanceId = this.model.get("id");
|
|
2421
|
+
if (!componentId || !instanceId) {
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2424
|
+
const handleConfirm = async () => {
|
|
2425
|
+
try {
|
|
2426
|
+
await detachComponentInstance({
|
|
2427
|
+
instanceId,
|
|
2428
|
+
componentId,
|
|
2429
|
+
trackingInfo: { location, secondaryLocation, trigger }
|
|
2430
|
+
});
|
|
2431
|
+
} catch {
|
|
2432
|
+
notify2({
|
|
2433
|
+
type: "error",
|
|
2434
|
+
message: __10("Failed to detach component instance.", "elementor"),
|
|
2435
|
+
id: "detach-component-instance-failed"
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
};
|
|
2439
|
+
options.showDetachConfirmDialog?.(handleConfirm);
|
|
2440
|
+
}
|
|
1899
2441
|
handleDblClick(e) {
|
|
1900
2442
|
e.stopPropagation();
|
|
1901
|
-
if (!isUserAdministrator()
|
|
2443
|
+
if (!isUserAdministrator()) {
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
if (!hasProInstalled()) {
|
|
2447
|
+
notifyComponentEditUpgrade();
|
|
1902
2448
|
return;
|
|
1903
2449
|
}
|
|
1904
2450
|
const { triggers, locations, secondaryLocations } = this.eventsManagerConfig;
|
|
@@ -1963,7 +2509,7 @@ function createComponentModel() {
|
|
|
1963
2509
|
}
|
|
1964
2510
|
const componentUid = editorSettings?.component_uid;
|
|
1965
2511
|
if (componentUid) {
|
|
1966
|
-
const component = selectComponentByUid(
|
|
2512
|
+
const component = selectComponentByUid(getState8(), componentUid);
|
|
1967
2513
|
if (component?.name) {
|
|
1968
2514
|
return component.name;
|
|
1969
2515
|
}
|
|
@@ -1983,134 +2529,6 @@ function createComponentModel() {
|
|
|
1983
2529
|
});
|
|
1984
2530
|
}
|
|
1985
2531
|
|
|
1986
|
-
// src/utils/is-component-instance.ts
|
|
1987
|
-
function isComponentInstance(elementModel) {
|
|
1988
|
-
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
// src/utils/get-component-documents.ts
|
|
1992
|
-
async function getComponentDocuments(elements, cache = /* @__PURE__ */ new Map()) {
|
|
1993
|
-
const componentIds = await getComponentIds(elements, cache);
|
|
1994
|
-
return getDocumentsMap(componentIds, cache);
|
|
1995
|
-
}
|
|
1996
|
-
async function getComponentIds(elements, cache) {
|
|
1997
|
-
const results = await Promise.all(
|
|
1998
|
-
elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
|
|
1999
|
-
const ids = [];
|
|
2000
|
-
if (isComponentInstance({ widgetType, elType })) {
|
|
2001
|
-
const componentId = settings?.component_instance?.value?.component_id.value;
|
|
2002
|
-
if (!componentId) {
|
|
2003
|
-
return ids;
|
|
2004
|
-
}
|
|
2005
|
-
ids.push(componentId);
|
|
2006
|
-
if (!cache.has(componentId)) {
|
|
2007
|
-
cache.set(componentId, getComponentDocumentData(componentId));
|
|
2008
|
-
}
|
|
2009
|
-
const doc = await cache.get(componentId);
|
|
2010
|
-
childElements = doc?.elements;
|
|
2011
|
-
}
|
|
2012
|
-
if (childElements?.length) {
|
|
2013
|
-
const childIds = await getComponentIds(childElements, cache);
|
|
2014
|
-
ids.push(...childIds);
|
|
2015
|
-
}
|
|
2016
|
-
return ids;
|
|
2017
|
-
})
|
|
2018
|
-
);
|
|
2019
|
-
return [...new Set(results.flat())];
|
|
2020
|
-
}
|
|
2021
|
-
async function getDocumentsMap(ids, cache) {
|
|
2022
|
-
const documents = await Promise.all(
|
|
2023
|
-
ids.map(async (id2) => {
|
|
2024
|
-
const document = await cache.get(id2);
|
|
2025
|
-
if (!document) {
|
|
2026
|
-
return null;
|
|
2027
|
-
}
|
|
2028
|
-
return [id2, document];
|
|
2029
|
-
})
|
|
2030
|
-
);
|
|
2031
|
-
return new Map(documents.filter((document) => document !== null));
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
// src/store/actions/load-components-overridable-props.ts
|
|
2035
|
-
import { __dispatch as dispatch2, __getState as getState6 } from "@elementor/store";
|
|
2036
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2037
|
-
if (!componentIds.length) {
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2041
|
-
}
|
|
2042
|
-
async function loadComponentOverrides(componentId) {
|
|
2043
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded(getState6(), componentId);
|
|
2044
|
-
if (isOverridablePropsLoaded) {
|
|
2045
|
-
return;
|
|
2046
|
-
}
|
|
2047
|
-
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2048
|
-
if (!overridableProps) {
|
|
2049
|
-
return;
|
|
2050
|
-
}
|
|
2051
|
-
dispatch2(
|
|
2052
|
-
slice.actions.setOverridableProps({
|
|
2053
|
-
componentId,
|
|
2054
|
-
overridableProps
|
|
2055
|
-
})
|
|
2056
|
-
);
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
// src/store/actions/load-components-styles.ts
|
|
2060
|
-
import { __dispatch as dispatch3, __getState as getState7 } from "@elementor/store";
|
|
2061
|
-
function loadComponentsStyles(documents) {
|
|
2062
|
-
if (!documents.size) {
|
|
2063
|
-
return;
|
|
2064
|
-
}
|
|
2065
|
-
const knownComponents = selectStyles(getState7());
|
|
2066
|
-
const unknownDocuments = new Map([...documents.entries()].filter(([id2]) => !knownComponents[id2]));
|
|
2067
|
-
if (!unknownDocuments.size) {
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
addStyles(unknownDocuments);
|
|
2071
|
-
}
|
|
2072
|
-
function addStyles(documents) {
|
|
2073
|
-
const styles = Object.fromEntries(
|
|
2074
|
-
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2075
|
-
);
|
|
2076
|
-
dispatch3(slice.actions.addStyles(styles));
|
|
2077
|
-
}
|
|
2078
|
-
function extractStylesFromDocument(document) {
|
|
2079
|
-
if (!document.elements?.length) {
|
|
2080
|
-
return [];
|
|
2081
|
-
}
|
|
2082
|
-
return document.elements.flatMap(extractStylesFromElement);
|
|
2083
|
-
}
|
|
2084
|
-
function extractStylesFromElement(element) {
|
|
2085
|
-
return [
|
|
2086
|
-
...Object.values(element.styles ?? {}),
|
|
2087
|
-
...(element.elements ?? []).flatMap(extractStylesFromElement)
|
|
2088
|
-
];
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
// src/store/actions/load-components-assets.ts
|
|
2092
|
-
async function loadComponentsAssets(elements) {
|
|
2093
|
-
const documents = await getComponentDocuments(elements);
|
|
2094
|
-
updateDocumentState(documents);
|
|
2095
|
-
loadComponentsStyles(documents);
|
|
2096
|
-
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2097
|
-
}
|
|
2098
|
-
function updateDocumentState(documents) {
|
|
2099
|
-
const isDrafted = [...documents.values()].some(isDocumentDirty);
|
|
2100
|
-
if (isDrafted) {
|
|
2101
|
-
setDocumentModifiedStatus(true);
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
// src/components/load-template-components.tsx
|
|
2106
|
-
var LoadTemplateComponents = () => {
|
|
2107
|
-
const templates = useLoadedTemplates();
|
|
2108
|
-
useEffect(() => {
|
|
2109
|
-
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2110
|
-
}, [templates]);
|
|
2111
|
-
return null;
|
|
2112
|
-
};
|
|
2113
|
-
|
|
2114
2532
|
// src/extended/init.ts
|
|
2115
2533
|
import { injectIntoLogic, injectIntoTop } from "@elementor/editor";
|
|
2116
2534
|
import { registerControlReplacement } from "@elementor/editor-controls";
|
|
@@ -2124,18 +2542,18 @@ import {
|
|
|
2124
2542
|
import { registerTab } from "@elementor/editor-elements-panel";
|
|
2125
2543
|
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
2126
2544
|
import { registerDataHook as registerDataHook4 } from "@elementor/editor-v1-adapters";
|
|
2127
|
-
import { __ as
|
|
2545
|
+
import { __ as __34 } from "@wordpress/i18n";
|
|
2128
2546
|
|
|
2129
2547
|
// src/extended/components/component-panel-header/component-panel-header.tsx
|
|
2130
|
-
import * as
|
|
2548
|
+
import * as React29 from "react";
|
|
2131
2549
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
2132
2550
|
import { getV1DocumentsManager as getV1DocumentsManager3 } from "@elementor/editor-documents";
|
|
2133
2551
|
import { PanelHeader as PanelHeader3 } from "@elementor/editor-panels";
|
|
2134
2552
|
import { EllipsisWithTooltip as EllipsisWithTooltip4 } from "@elementor/editor-ui";
|
|
2135
2553
|
import { ArrowLeftIcon, ComponentsFilledIcon } from "@elementor/icons";
|
|
2136
|
-
import { __getState as
|
|
2554
|
+
import { __getState as getState9 } from "@elementor/store";
|
|
2137
2555
|
import { Box as Box15, Divider as Divider4, IconButton as IconButton5, Tooltip as Tooltip5, Typography as Typography11 } from "@elementor/ui";
|
|
2138
|
-
import { __ as
|
|
2556
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2139
2557
|
|
|
2140
2558
|
// src/extended/hooks/use-navigate-back.ts
|
|
2141
2559
|
import { useCallback } from "react";
|
|
@@ -2155,11 +2573,11 @@ function useNavigateBack() {
|
|
|
2155
2573
|
}
|
|
2156
2574
|
|
|
2157
2575
|
// src/extended/components/component-introduction.tsx
|
|
2158
|
-
import * as
|
|
2576
|
+
import * as React20 from "react";
|
|
2159
2577
|
import { PopoverContent } from "@elementor/editor-controls";
|
|
2160
2578
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
2161
|
-
import { Box as Box9, Button as Button3, Image, Link as Link2, Popover, Stack as
|
|
2162
|
-
import { __ as
|
|
2579
|
+
import { Box as Box9, Button as Button3, Image, Link as Link2, Popover, Stack as Stack12, Typography as Typography6 } from "@elementor/ui";
|
|
2580
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
2163
2581
|
var ComponentIntroduction = ({
|
|
2164
2582
|
anchorRef,
|
|
2165
2583
|
shouldShowIntroduction,
|
|
@@ -2168,7 +2586,7 @@ var ComponentIntroduction = ({
|
|
|
2168
2586
|
if (!anchorRef.current || !shouldShowIntroduction) {
|
|
2169
2587
|
return null;
|
|
2170
2588
|
}
|
|
2171
|
-
return /* @__PURE__ */
|
|
2589
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2172
2590
|
Popover,
|
|
2173
2591
|
{
|
|
2174
2592
|
anchorEl: anchorRef.current,
|
|
@@ -2183,20 +2601,20 @@ var ComponentIntroduction = ({
|
|
|
2183
2601
|
},
|
|
2184
2602
|
onClose
|
|
2185
2603
|
},
|
|
2186
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ React20.createElement(Box9, { sx: { width: "296px" } }, /* @__PURE__ */ React20.createElement(PopoverHeader, { title: __11("Add your first property", "elementor"), onClose }), /* @__PURE__ */ React20.createElement(
|
|
2187
2605
|
Image,
|
|
2188
2606
|
{
|
|
2189
2607
|
sx: { width: "296px", height: "160px" },
|
|
2190
2608
|
src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
|
|
2191
2609
|
alt: ""
|
|
2192
2610
|
}
|
|
2193
|
-
), /* @__PURE__ */
|
|
2611
|
+
), /* @__PURE__ */ React20.createElement(PopoverContent, null, /* @__PURE__ */ React20.createElement(Stack12, { sx: { p: 2 } }, /* @__PURE__ */ React20.createElement(Typography6, { variant: "body2" }, __11("Properties make instances flexible.", "elementor")), /* @__PURE__ */ React20.createElement(Typography6, { variant: "body2" }, __11(
|
|
2194
2612
|
"Select any Element, then in the General tab, click next to any setting you want users to customize - like text, images, or links.",
|
|
2195
2613
|
"elementor"
|
|
2196
|
-
)), /* @__PURE__ */
|
|
2614
|
+
)), /* @__PURE__ */ React20.createElement(Typography6, { variant: "body2", sx: { mt: 2 } }, __11(
|
|
2197
2615
|
"Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
|
|
2198
2616
|
"elementor"
|
|
2199
|
-
)), /* @__PURE__ */
|
|
2617
|
+
)), /* @__PURE__ */ React20.createElement(
|
|
2200
2618
|
Link2,
|
|
2201
2619
|
{
|
|
2202
2620
|
href: "http://go.elementor.com/components-guide",
|
|
@@ -2205,28 +2623,28 @@ var ComponentIntroduction = ({
|
|
|
2205
2623
|
color: "info.main",
|
|
2206
2624
|
variant: "body2"
|
|
2207
2625
|
},
|
|
2208
|
-
|
|
2209
|
-
), /* @__PURE__ */
|
|
2626
|
+
__11("Learn more", "elementor")
|
|
2627
|
+
), /* @__PURE__ */ React20.createElement(Stack12, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { pt: 1 } }, /* @__PURE__ */ React20.createElement(Button3, { size: "medium", variant: "contained", onClick: onClose }, __11("Got it", "elementor"))))))
|
|
2210
2628
|
);
|
|
2211
2629
|
};
|
|
2212
2630
|
|
|
2213
2631
|
// src/extended/components/component-properties-panel/component-properties-panel.tsx
|
|
2214
|
-
import * as
|
|
2632
|
+
import * as React27 from "react";
|
|
2215
2633
|
import { usePanelActions as useEditingPanelActions } from "@elementor/editor-editing-panel";
|
|
2216
2634
|
import { __createPanel as createPanel, Panel } from "@elementor/editor-panels";
|
|
2217
2635
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
2218
2636
|
import { Alert, Box as Box13, ErrorBoundary } from "@elementor/ui";
|
|
2219
|
-
import { __ as
|
|
2637
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2220
2638
|
|
|
2221
2639
|
// src/extended/components/component-properties-panel/component-properties-panel-content.tsx
|
|
2222
|
-
import * as
|
|
2223
|
-
import { useMemo, useRef, useState as
|
|
2640
|
+
import * as React26 from "react";
|
|
2641
|
+
import { useMemo, useRef, useState as useState5 } from "react";
|
|
2224
2642
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
2225
2643
|
import { PanelBody as PanelBody2, PanelHeader as PanelHeader2, PanelHeaderTitle as PanelHeaderTitle2 } from "@elementor/editor-panels";
|
|
2226
2644
|
import { ComponentPropListIcon as ComponentPropListIcon3, FolderPlusIcon, XIcon as XIcon2 } from "@elementor/icons";
|
|
2227
|
-
import { Divider as Divider3, IconButton as IconButton4, List as List3, Stack as
|
|
2645
|
+
import { Divider as Divider3, IconButton as IconButton4, List as List3, Stack as Stack16, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2228
2646
|
import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
|
|
2229
|
-
import { __ as
|
|
2647
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2230
2648
|
|
|
2231
2649
|
// src/extended/store/actions/add-overridable-group.ts
|
|
2232
2650
|
function addOverridableGroup({
|
|
@@ -2267,7 +2685,7 @@ function addOverridableGroup({
|
|
|
2267
2685
|
|
|
2268
2686
|
// src/extended/store/utils/groups-transformers.ts
|
|
2269
2687
|
import { generateUniqueId } from "@elementor/utils";
|
|
2270
|
-
import { __ as
|
|
2688
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
2271
2689
|
function removePropFromAllGroups(groups, propKey) {
|
|
2272
2690
|
const propKeys = Array.isArray(propKey) ? propKey : [propKey];
|
|
2273
2691
|
return {
|
|
@@ -2336,7 +2754,7 @@ function resolveOrCreateGroup(groups, requestedGroupId) {
|
|
|
2336
2754
|
}
|
|
2337
2755
|
function createGroup(groups, groupId, label) {
|
|
2338
2756
|
const newGroupId = groupId || generateUniqueId("group");
|
|
2339
|
-
const newLabel = label ||
|
|
2757
|
+
const newLabel = label || __12("Default", "elementor");
|
|
2340
2758
|
return {
|
|
2341
2759
|
groups: {
|
|
2342
2760
|
...groups,
|
|
@@ -2431,12 +2849,12 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
2431
2849
|
// src/extended/utils/revert-overridable-settings.ts
|
|
2432
2850
|
import {
|
|
2433
2851
|
getAllDescendants,
|
|
2434
|
-
getContainer as
|
|
2852
|
+
getContainer as getContainer3,
|
|
2435
2853
|
getElementSetting,
|
|
2436
2854
|
updateElementSettings
|
|
2437
2855
|
} from "@elementor/editor-elements";
|
|
2438
2856
|
function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
|
|
2439
|
-
const container =
|
|
2857
|
+
const container = getContainer3(elementId);
|
|
2440
2858
|
if (!container) {
|
|
2441
2859
|
return;
|
|
2442
2860
|
}
|
|
@@ -2528,7 +2946,7 @@ function revertComponentInstanceSettings(settings) {
|
|
|
2528
2946
|
}
|
|
2529
2947
|
function revertAllOverridablesInContainer(container) {
|
|
2530
2948
|
getAllDescendants(container).forEach((element) => {
|
|
2531
|
-
if (element.model.get("widgetType") ===
|
|
2949
|
+
if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE2) {
|
|
2532
2950
|
revertComponentInstanceOverridesInElement(element);
|
|
2533
2951
|
} else {
|
|
2534
2952
|
revertElementSettings(element);
|
|
@@ -2683,15 +3101,15 @@ function updateOverridablePropParams({
|
|
|
2683
3101
|
}
|
|
2684
3102
|
|
|
2685
3103
|
// src/extended/components/component-properties-panel/properties-empty-state.tsx
|
|
2686
|
-
import * as
|
|
2687
|
-
import { useState } from "react";
|
|
3104
|
+
import * as React21 from "react";
|
|
3105
|
+
import { useState as useState2 } from "react";
|
|
2688
3106
|
import { ComponentPropListIcon as ComponentPropListIcon2 } from "@elementor/icons";
|
|
2689
|
-
import { Link as Link3, Stack as
|
|
2690
|
-
import { __ as
|
|
3107
|
+
import { Link as Link3, Stack as Stack13, Typography as Typography7 } from "@elementor/ui";
|
|
3108
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2691
3109
|
function PropertiesEmptyState({ introductionRef }) {
|
|
2692
|
-
const [isOpen, setIsOpen] =
|
|
2693
|
-
return /* @__PURE__ */
|
|
2694
|
-
|
|
3110
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
3111
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
3112
|
+
Stack13,
|
|
2695
3113
|
{
|
|
2696
3114
|
alignItems: "center",
|
|
2697
3115
|
justifyContent: "flex-start",
|
|
@@ -2700,11 +3118,11 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2700
3118
|
sx: { px: 2.5, pt: 10, pb: 5.5 },
|
|
2701
3119
|
gap: 1
|
|
2702
3120
|
},
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
3121
|
+
/* @__PURE__ */ React21.createElement(ComponentPropListIcon2, { fontSize: "large" }),
|
|
3122
|
+
/* @__PURE__ */ React21.createElement(Typography7, { align: "center", variant: "subtitle2" }, __13("Add your first property", "elementor")),
|
|
3123
|
+
/* @__PURE__ */ React21.createElement(Typography7, { align: "center", variant: "caption" }, __13("Make instances flexible while keeping design synced.", "elementor")),
|
|
3124
|
+
/* @__PURE__ */ React21.createElement(Typography7, { align: "center", variant: "caption" }, __13("Select any element, then click + next to a setting to expose it.", "elementor")),
|
|
3125
|
+
/* @__PURE__ */ React21.createElement(
|
|
2708
3126
|
Link3,
|
|
2709
3127
|
{
|
|
2710
3128
|
variant: "caption",
|
|
@@ -2712,9 +3130,9 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2712
3130
|
sx: { textDecorationLine: "underline" },
|
|
2713
3131
|
onClick: () => setIsOpen(true)
|
|
2714
3132
|
},
|
|
2715
|
-
|
|
3133
|
+
__13("Learn more", "elementor")
|
|
2716
3134
|
)
|
|
2717
|
-
), /* @__PURE__ */
|
|
3135
|
+
), /* @__PURE__ */ React21.createElement(
|
|
2718
3136
|
ComponentIntroduction,
|
|
2719
3137
|
{
|
|
2720
3138
|
anchorRef: introductionRef,
|
|
@@ -2725,7 +3143,7 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2725
3143
|
}
|
|
2726
3144
|
|
|
2727
3145
|
// src/extended/components/component-properties-panel/properties-group.tsx
|
|
2728
|
-
import * as
|
|
3146
|
+
import * as React25 from "react";
|
|
2729
3147
|
import { EditableField as EditableField2, EllipsisWithTooltip as EllipsisWithTooltip3, MenuListItem as MenuListItem2 } from "@elementor/editor-ui";
|
|
2730
3148
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
2731
3149
|
import {
|
|
@@ -2735,31 +3153,31 @@ import {
|
|
|
2735
3153
|
IconButton as IconButton3,
|
|
2736
3154
|
List as List2,
|
|
2737
3155
|
Menu,
|
|
2738
|
-
Stack as
|
|
3156
|
+
Stack as Stack15,
|
|
2739
3157
|
Tooltip as Tooltip2,
|
|
2740
3158
|
Typography as Typography10,
|
|
2741
3159
|
usePopupState as usePopupState2
|
|
2742
3160
|
} from "@elementor/ui";
|
|
2743
|
-
import { __ as
|
|
3161
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2744
3162
|
|
|
2745
3163
|
// src/extended/components/component-properties-panel/property-item.tsx
|
|
2746
|
-
import * as
|
|
3164
|
+
import * as React24 from "react";
|
|
2747
3165
|
import { getWidgetsCache as getWidgetsCache2 } from "@elementor/editor-elements";
|
|
2748
3166
|
import { XIcon } from "@elementor/icons";
|
|
2749
3167
|
import { bindPopover, bindTrigger, Box as Box11, IconButton as IconButton2, Popover as Popover2, Typography as Typography9, usePopupState } from "@elementor/ui";
|
|
2750
3168
|
|
|
2751
3169
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2752
|
-
import * as
|
|
2753
|
-
import { useState as
|
|
3170
|
+
import * as React22 from "react";
|
|
3171
|
+
import { useState as useState3 } from "react";
|
|
2754
3172
|
import { Form, MenuListItem } from "@elementor/editor-ui";
|
|
2755
|
-
import { Button as Button4, FormLabel, Grid, Select, Stack as
|
|
2756
|
-
import { __ as
|
|
3173
|
+
import { Button as Button4, FormLabel, Grid, Select, Stack as Stack14, TextField as TextField2, Typography as Typography8 } from "@elementor/ui";
|
|
3174
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2757
3175
|
|
|
2758
3176
|
// src/extended/components/overridable-props/utils/validate-prop-label.ts
|
|
2759
|
-
import { __ as
|
|
3177
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2760
3178
|
var ERROR_MESSAGES = {
|
|
2761
|
-
EMPTY_NAME:
|
|
2762
|
-
DUPLICATE_NAME:
|
|
3179
|
+
EMPTY_NAME: __14("Property name is required", "elementor"),
|
|
3180
|
+
DUPLICATE_NAME: __14("Property name already exists", "elementor")
|
|
2763
3181
|
};
|
|
2764
3182
|
function validatePropLabel(label, existingLabels, currentLabel) {
|
|
2765
3183
|
const trimmedLabel = label.trim();
|
|
@@ -2783,17 +3201,17 @@ function validatePropLabel(label, existingLabels, currentLabel) {
|
|
|
2783
3201
|
|
|
2784
3202
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2785
3203
|
var SIZE = "tiny";
|
|
2786
|
-
var DEFAULT_GROUP = { value: null, label:
|
|
3204
|
+
var DEFAULT_GROUP = { value: null, label: __15("Default", "elementor") };
|
|
2787
3205
|
function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels = [], sx }) {
|
|
2788
3206
|
const selectGroups = groups?.length ? groups : [DEFAULT_GROUP];
|
|
2789
|
-
const [propLabel, setPropLabel] =
|
|
2790
|
-
const [group, setGroup] =
|
|
2791
|
-
const [error, setError] =
|
|
2792
|
-
const name =
|
|
2793
|
-
const groupName =
|
|
3207
|
+
const [propLabel, setPropLabel] = useState3(currentValue?.label ?? null);
|
|
3208
|
+
const [group, setGroup] = useState3(currentValue?.groupId ?? selectGroups[0]?.value ?? null);
|
|
3209
|
+
const [error, setError] = useState3(null);
|
|
3210
|
+
const name = __15("Name", "elementor");
|
|
3211
|
+
const groupName = __15("Group Name", "elementor");
|
|
2794
3212
|
const isCreate = currentValue === void 0;
|
|
2795
|
-
const title = isCreate ?
|
|
2796
|
-
const ctaLabel = isCreate ?
|
|
3213
|
+
const title = isCreate ? __15("Create new property", "elementor") : __15("Update property", "elementor");
|
|
3214
|
+
const ctaLabel = isCreate ? __15("Create", "elementor") : __15("Update", "elementor");
|
|
2797
3215
|
const handleSubmit = () => {
|
|
2798
3216
|
const validationResult = validatePropLabel(propLabel ?? "", existingLabels, currentValue?.label);
|
|
2799
3217
|
if (!validationResult.isValid) {
|
|
@@ -2802,8 +3220,8 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2802
3220
|
}
|
|
2803
3221
|
onSubmit({ label: propLabel ?? "", group });
|
|
2804
3222
|
};
|
|
2805
|
-
return /* @__PURE__ */
|
|
2806
|
-
|
|
3223
|
+
return /* @__PURE__ */ React22.createElement(Form, { onSubmit: handleSubmit, "data-testid": "overridable-prop-form" }, /* @__PURE__ */ React22.createElement(Stack14, { alignItems: "start", sx: { width: "268px", ...sx } }, /* @__PURE__ */ React22.createElement(
|
|
3224
|
+
Stack14,
|
|
2807
3225
|
{
|
|
2808
3226
|
direction: "row",
|
|
2809
3227
|
alignItems: "center",
|
|
@@ -2811,14 +3229,14 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2811
3229
|
px: 1.5,
|
|
2812
3230
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%", mb: 1.5 }
|
|
2813
3231
|
},
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
), /* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ React22.createElement(Typography8, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, title)
|
|
3233
|
+
), /* @__PURE__ */ React22.createElement(Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React22.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(FormLabel, { size: "tiny" }, name)), /* @__PURE__ */ React22.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
2816
3234
|
TextField2,
|
|
2817
3235
|
{
|
|
2818
3236
|
name,
|
|
2819
3237
|
size: SIZE,
|
|
2820
3238
|
fullWidth: true,
|
|
2821
|
-
placeholder:
|
|
3239
|
+
placeholder: __15("Enter value", "elementor"),
|
|
2822
3240
|
value: propLabel ?? "",
|
|
2823
3241
|
onChange: (e) => {
|
|
2824
3242
|
const newValue = e.target.value;
|
|
@@ -2833,7 +3251,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2833
3251
|
error: Boolean(error),
|
|
2834
3252
|
helperText: error
|
|
2835
3253
|
}
|
|
2836
|
-
))), /* @__PURE__ */
|
|
3254
|
+
))), /* @__PURE__ */ React22.createElement(Grid, { container: true, gap: 0.75, alignItems: "start", px: 1.5, mb: 1.5 }, /* @__PURE__ */ React22.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(FormLabel, { size: "tiny" }, groupName)), /* @__PURE__ */ React22.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
2837
3255
|
Select,
|
|
2838
3256
|
{
|
|
2839
3257
|
name: groupName,
|
|
@@ -2849,8 +3267,8 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2849
3267
|
return selectGroups.find(({ value }) => value === selectedValue)?.label ?? selectedValue;
|
|
2850
3268
|
}
|
|
2851
3269
|
},
|
|
2852
|
-
selectGroups.map(({ label: groupLabel, ...props }) => /* @__PURE__ */
|
|
2853
|
-
))), /* @__PURE__ */
|
|
3270
|
+
selectGroups.map(({ label: groupLabel, ...props }) => /* @__PURE__ */ React22.createElement(MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, groupLabel))
|
|
3271
|
+
))), /* @__PURE__ */ React22.createElement(Stack14, { direction: "row", justifyContent: "flex-end", alignSelf: "end", mt: 1.5, py: 1, px: 1.5 }, /* @__PURE__ */ React22.createElement(
|
|
2854
3272
|
Button4,
|
|
2855
3273
|
{
|
|
2856
3274
|
type: "submit",
|
|
@@ -2864,7 +3282,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2864
3282
|
}
|
|
2865
3283
|
|
|
2866
3284
|
// src/extended/components/component-properties-panel/sortable.tsx
|
|
2867
|
-
import * as
|
|
3285
|
+
import * as React23 from "react";
|
|
2868
3286
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
2869
3287
|
import {
|
|
2870
3288
|
Box as Box10,
|
|
@@ -2872,8 +3290,8 @@ import {
|
|
|
2872
3290
|
UnstableSortableItem,
|
|
2873
3291
|
UnstableSortableProvider
|
|
2874
3292
|
} from "@elementor/ui";
|
|
2875
|
-
var SortableProvider = (props) => /* @__PURE__ */
|
|
2876
|
-
var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */
|
|
3293
|
+
var SortableProvider = (props) => /* @__PURE__ */ React23.createElement(UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
|
|
3294
|
+
var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
2877
3295
|
StyledSortableTrigger,
|
|
2878
3296
|
{
|
|
2879
3297
|
...props,
|
|
@@ -2881,9 +3299,9 @@ var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React2
|
|
|
2881
3299
|
className: `sortable-trigger ${triggerClassName ?? ""}`.trim(),
|
|
2882
3300
|
"aria-label": "sort"
|
|
2883
3301
|
},
|
|
2884
|
-
/* @__PURE__ */
|
|
3302
|
+
/* @__PURE__ */ React23.createElement(GripVerticalIcon, { fontSize: "tiny" })
|
|
2885
3303
|
);
|
|
2886
|
-
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */
|
|
3304
|
+
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React23.createElement(
|
|
2887
3305
|
UnstableSortableItem,
|
|
2888
3306
|
{
|
|
2889
3307
|
id: id2,
|
|
@@ -2897,7 +3315,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2897
3315
|
showDropIndication,
|
|
2898
3316
|
isDragOverlay,
|
|
2899
3317
|
isDragPlaceholder
|
|
2900
|
-
}) => /* @__PURE__ */
|
|
3318
|
+
}) => /* @__PURE__ */ React23.createElement(
|
|
2901
3319
|
Box10,
|
|
2902
3320
|
{
|
|
2903
3321
|
...itemProps,
|
|
@@ -2914,7 +3332,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2914
3332
|
triggerProps,
|
|
2915
3333
|
triggerStyle
|
|
2916
3334
|
}),
|
|
2917
|
-
showDropIndication && /* @__PURE__ */
|
|
3335
|
+
showDropIndication && /* @__PURE__ */ React23.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
2918
3336
|
)
|
|
2919
3337
|
}
|
|
2920
3338
|
);
|
|
@@ -2955,7 +3373,7 @@ function PropertyItem({
|
|
|
2955
3373
|
event.stopPropagation();
|
|
2956
3374
|
onDelete(prop.overrideKey);
|
|
2957
3375
|
};
|
|
2958
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(
|
|
2959
3377
|
Box11,
|
|
2960
3378
|
{
|
|
2961
3379
|
...bindTrigger(popoverState),
|
|
@@ -2990,17 +3408,17 @@ function PropertyItem({
|
|
|
2990
3408
|
}
|
|
2991
3409
|
}
|
|
2992
3410
|
},
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3411
|
+
/* @__PURE__ */ React24.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
3412
|
+
/* @__PURE__ */ React24.createElement(
|
|
2995
3413
|
Box11,
|
|
2996
3414
|
{
|
|
2997
3415
|
sx: { display: "flex", alignItems: "center", color: "text.primary", fontSize: 12, padding: 0.25 }
|
|
2998
3416
|
},
|
|
2999
|
-
/* @__PURE__ */
|
|
3417
|
+
/* @__PURE__ */ React24.createElement("i", { className: icon })
|
|
3000
3418
|
),
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
), /* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ React24.createElement(Typography9, { variant: "caption", sx: { color: "text.primary", flexGrow: 1, fontSize: 10 } }, prop.label),
|
|
3420
|
+
/* @__PURE__ */ React24.createElement(IconButton2, { size: "tiny", onClick: handleDelete, "aria-label": "Delete property", sx: { p: 0.25 } }, /* @__PURE__ */ React24.createElement(XIcon, { fontSize: "tiny" }))
|
|
3421
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3004
3422
|
Popover2,
|
|
3005
3423
|
{
|
|
3006
3424
|
...popoverProps,
|
|
@@ -3008,7 +3426,7 @@ function PropertyItem({
|
|
|
3008
3426
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
3009
3427
|
PaperProps: { sx: { width: popoverState.anchorEl?.getBoundingClientRect().width } }
|
|
3010
3428
|
},
|
|
3011
|
-
/* @__PURE__ */
|
|
3429
|
+
/* @__PURE__ */ React24.createElement(
|
|
3012
3430
|
OverridablePropForm,
|
|
3013
3431
|
{
|
|
3014
3432
|
onSubmit: handleSubmit,
|
|
@@ -3059,14 +3477,14 @@ function PropertiesGroup({
|
|
|
3059
3477
|
popupState.close();
|
|
3060
3478
|
onGroupDelete(group.id);
|
|
3061
3479
|
};
|
|
3062
|
-
return /* @__PURE__ */
|
|
3480
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3063
3481
|
Box12,
|
|
3064
3482
|
{
|
|
3065
3483
|
sx: {
|
|
3066
3484
|
opacity: isDragPlaceholder ? 0.5 : 1
|
|
3067
3485
|
}
|
|
3068
3486
|
},
|
|
3069
|
-
/* @__PURE__ */
|
|
3487
|
+
/* @__PURE__ */ React25.createElement(Stack15, { gap: 1 }, /* @__PURE__ */ React25.createElement(
|
|
3070
3488
|
Box12,
|
|
3071
3489
|
{
|
|
3072
3490
|
className: "group-header",
|
|
@@ -3086,8 +3504,8 @@ function PropertiesGroup({
|
|
|
3086
3504
|
}
|
|
3087
3505
|
}
|
|
3088
3506
|
},
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
/* @__PURE__ */
|
|
3507
|
+
/* @__PURE__ */ React25.createElement(SortableTrigger, { triggerClassName: "group-sortable-trigger", ...sortableTriggerProps }),
|
|
3508
|
+
/* @__PURE__ */ React25.createElement(Stack15, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 2 }, isThisGroupEditing ? /* @__PURE__ */ React25.createElement(
|
|
3091
3509
|
Box12,
|
|
3092
3510
|
{
|
|
3093
3511
|
sx: {
|
|
@@ -3105,7 +3523,7 @@ function PropertiesGroup({
|
|
|
3105
3523
|
width: "100%"
|
|
3106
3524
|
}
|
|
3107
3525
|
},
|
|
3108
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ React25.createElement(
|
|
3109
3527
|
EditableField2,
|
|
3110
3528
|
{
|
|
3111
3529
|
ref: editableRef,
|
|
@@ -3116,7 +3534,7 @@ function PropertiesGroup({
|
|
|
3116
3534
|
...getEditableProps()
|
|
3117
3535
|
}
|
|
3118
3536
|
)
|
|
3119
|
-
) : /* @__PURE__ */
|
|
3537
|
+
) : /* @__PURE__ */ React25.createElement(
|
|
3120
3538
|
EllipsisWithTooltip3,
|
|
3121
3539
|
{
|
|
3122
3540
|
title: group.label,
|
|
@@ -3124,18 +3542,18 @@ function PropertiesGroup({
|
|
|
3124
3542
|
variant: "caption",
|
|
3125
3543
|
sx: { color: "text.primary", fontWeight: 400, lineHeight: 1.66 }
|
|
3126
3544
|
}
|
|
3127
|
-
), /* @__PURE__ */
|
|
3545
|
+
), /* @__PURE__ */ React25.createElement(
|
|
3128
3546
|
IconButton3,
|
|
3129
3547
|
{
|
|
3130
3548
|
className: "group-menu",
|
|
3131
3549
|
size: "tiny",
|
|
3132
3550
|
sx: { p: 0.25, visibility: isThisGroupEditing ? "visible" : void 0 },
|
|
3133
|
-
"aria-label":
|
|
3551
|
+
"aria-label": __16("Group actions", "elementor"),
|
|
3134
3552
|
...bindTrigger2(popupState)
|
|
3135
3553
|
},
|
|
3136
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ React25.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
3137
3555
|
))
|
|
3138
|
-
), /* @__PURE__ */
|
|
3556
|
+
), /* @__PURE__ */ React25.createElement(List2, { 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(
|
|
3139
3557
|
PropertyItem,
|
|
3140
3558
|
{
|
|
3141
3559
|
prop,
|
|
@@ -3147,27 +3565,27 @@ function PropertiesGroup({
|
|
|
3147
3565
|
onUpdate: (data) => onPropertyUpdate(prop.overrideKey, data)
|
|
3148
3566
|
}
|
|
3149
3567
|
)))))),
|
|
3150
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ React25.createElement(
|
|
3151
3569
|
Menu,
|
|
3152
3570
|
{
|
|
3153
3571
|
...bindMenu(popupState),
|
|
3154
3572
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
3155
3573
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
3156
3574
|
},
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ React25.createElement(MenuListItem2, { sx: { minWidth: "160px" }, onClick: handleRenameClick }, /* @__PURE__ */ React25.createElement(Typography10, { variant: "caption", sx: { color: "text.primary" } }, __16("Rename", "elementor"))),
|
|
3576
|
+
/* @__PURE__ */ React25.createElement(
|
|
3159
3577
|
Tooltip2,
|
|
3160
3578
|
{
|
|
3161
|
-
title: hasProperties ?
|
|
3579
|
+
title: hasProperties ? __16("To delete the group, first remove all the properties", "elementor") : "",
|
|
3162
3580
|
placement: "right"
|
|
3163
3581
|
},
|
|
3164
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ React25.createElement("span", null, /* @__PURE__ */ React25.createElement(MenuListItem2, { onClick: handleDeleteClick, disabled: hasProperties }, /* @__PURE__ */ React25.createElement(
|
|
3165
3583
|
Typography10,
|
|
3166
3584
|
{
|
|
3167
3585
|
variant: "caption",
|
|
3168
3586
|
sx: { color: hasProperties ? "text.disabled" : "error.light" }
|
|
3169
3587
|
},
|
|
3170
|
-
|
|
3588
|
+
__16("Delete", "elementor")
|
|
3171
3589
|
)))
|
|
3172
3590
|
)
|
|
3173
3591
|
)
|
|
@@ -3175,10 +3593,10 @@ function PropertiesGroup({
|
|
|
3175
3593
|
}
|
|
3176
3594
|
|
|
3177
3595
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3178
|
-
import { useState as
|
|
3596
|
+
import { useState as useState4 } from "react";
|
|
3179
3597
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus2 } from "@elementor/editor-documents";
|
|
3180
3598
|
import { useEditable } from "@elementor/editor-ui";
|
|
3181
|
-
import { __ as
|
|
3599
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
3182
3600
|
|
|
3183
3601
|
// src/extended/store/actions/rename-overridable-group.ts
|
|
3184
3602
|
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
@@ -3199,10 +3617,10 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
3199
3617
|
}
|
|
3200
3618
|
|
|
3201
3619
|
// src/extended/components/component-properties-panel/utils/validate-group-label.ts
|
|
3202
|
-
import { __ as
|
|
3620
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
3203
3621
|
var ERROR_MESSAGES2 = {
|
|
3204
|
-
EMPTY_NAME:
|
|
3205
|
-
DUPLICATE_NAME:
|
|
3622
|
+
EMPTY_NAME: __17("Group name is required", "elementor"),
|
|
3623
|
+
DUPLICATE_NAME: __17("Group name already exists", "elementor")
|
|
3206
3624
|
};
|
|
3207
3625
|
function validateGroupLabel(label, existingGroups) {
|
|
3208
3626
|
const trimmedLabel = label.trim();
|
|
@@ -3218,7 +3636,7 @@ function validateGroupLabel(label, existingGroups) {
|
|
|
3218
3636
|
|
|
3219
3637
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3220
3638
|
function useCurrentEditableItem() {
|
|
3221
|
-
const [editingGroupId, setEditingGroupId] =
|
|
3639
|
+
const [editingGroupId, setEditingGroupId] = useState4(null);
|
|
3222
3640
|
const currentComponentId = useCurrentComponentId();
|
|
3223
3641
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
3224
3642
|
const allGroupsRecord = overridableProps?.groups?.items ?? {};
|
|
@@ -3231,7 +3649,7 @@ function useCurrentEditableItem() {
|
|
|
3231
3649
|
};
|
|
3232
3650
|
const handleSubmit = (newLabel) => {
|
|
3233
3651
|
if (!editingGroupId || !currentComponentId) {
|
|
3234
|
-
throw new Error(
|
|
3652
|
+
throw new Error(__18("Group ID or component ID is missing", "elementor"));
|
|
3235
3653
|
}
|
|
3236
3654
|
renameOverridableGroup({
|
|
3237
3655
|
componentId: currentComponentId,
|
|
@@ -3284,7 +3702,7 @@ function generateUniqueLabel(groups) {
|
|
|
3284
3702
|
function ComponentPropertiesPanelContent({ onClose }) {
|
|
3285
3703
|
const currentComponentId = useCurrentComponentId();
|
|
3286
3704
|
const overridableProps = useSanitizeOverridableProps(currentComponentId);
|
|
3287
|
-
const [isAddingGroup, setIsAddingGroup] =
|
|
3705
|
+
const [isAddingGroup, setIsAddingGroup] = useState5(false);
|
|
3288
3706
|
const introductionRef = useRef(null);
|
|
3289
3707
|
const groupLabelEditable = useCurrentEditableItem();
|
|
3290
3708
|
const groups = useMemo(() => {
|
|
@@ -3344,24 +3762,24 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
3344
3762
|
deleteOverridableGroup({ componentId: currentComponentId, groupId });
|
|
3345
3763
|
setDocumentModifiedStatus3(true);
|
|
3346
3764
|
};
|
|
3347
|
-
return /* @__PURE__ */
|
|
3765
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(PanelHeader2, { sx: { justifyContent: "start", pl: 1.5, pr: 1, py: 1 } }, /* @__PURE__ */ React26.createElement(Stack16, { direction: "row", alignItems: "center", gap: 0.5, flexGrow: 1 }, /* @__PURE__ */ React26.createElement(ComponentPropListIcon3, { fontSize: "tiny" }), /* @__PURE__ */ React26.createElement(PanelHeaderTitle2, { variant: "subtitle2" }, __19("Component properties", "elementor"))), !showEmptyState && /* @__PURE__ */ React26.createElement(Tooltip3, { title: __19("Add new group", "elementor") }, /* @__PURE__ */ React26.createElement(
|
|
3348
3766
|
IconButton4,
|
|
3349
3767
|
{
|
|
3350
3768
|
size: "tiny",
|
|
3351
|
-
"aria-label":
|
|
3769
|
+
"aria-label": __19("Add new group", "elementor"),
|
|
3352
3770
|
onClick: handleAddGroupClick
|
|
3353
3771
|
},
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
)), /* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ React26.createElement(FolderPlusIcon, { fontSize: "tiny" })
|
|
3773
|
+
)), /* @__PURE__ */ React26.createElement(Tooltip3, { title: __19("Close panel", "elementor") }, /* @__PURE__ */ React26.createElement(
|
|
3356
3774
|
IconButton4,
|
|
3357
3775
|
{
|
|
3358
3776
|
ref: introductionRef,
|
|
3359
3777
|
size: "tiny",
|
|
3360
|
-
"aria-label":
|
|
3778
|
+
"aria-label": __19("Close panel", "elementor"),
|
|
3361
3779
|
onClick: onClose
|
|
3362
3780
|
},
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
))), /* @__PURE__ */
|
|
3781
|
+
/* @__PURE__ */ React26.createElement(XIcon2, { fontSize: "tiny" })
|
|
3782
|
+
))), /* @__PURE__ */ React26.createElement(Divider3, null), /* @__PURE__ */ React26.createElement(PanelBody2, null, showEmptyState ? /* @__PURE__ */ React26.createElement(PropertiesEmptyState, { introductionRef }) : /* @__PURE__ */ React26.createElement(List3, { 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(
|
|
3365
3783
|
PropertiesGroup,
|
|
3366
3784
|
{
|
|
3367
3785
|
group,
|
|
@@ -3389,7 +3807,7 @@ var { panel, usePanelActions } = createPanel({
|
|
|
3389
3807
|
function ComponentPropertiesPanel() {
|
|
3390
3808
|
const { close: closePanel } = usePanelActions();
|
|
3391
3809
|
const { open: openEditingPanel } = useEditingPanelActions();
|
|
3392
|
-
return /* @__PURE__ */
|
|
3810
|
+
return /* @__PURE__ */ React27.createElement(ThemeProvider2, null, /* @__PURE__ */ React27.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React27.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React27.createElement(Panel, null, /* @__PURE__ */ React27.createElement(
|
|
3393
3811
|
ComponentPropertiesPanelContent,
|
|
3394
3812
|
{
|
|
3395
3813
|
onClose: () => {
|
|
@@ -3399,18 +3817,18 @@ function ComponentPropertiesPanel() {
|
|
|
3399
3817
|
}
|
|
3400
3818
|
))));
|
|
3401
3819
|
}
|
|
3402
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
3820
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React27.createElement(Box13, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React27.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React27.createElement("strong", null, __20("Something went wrong", "elementor"))));
|
|
3403
3821
|
|
|
3404
3822
|
// src/extended/components/component-panel-header/component-badge.tsx
|
|
3405
|
-
import * as
|
|
3823
|
+
import * as React28 from "react";
|
|
3406
3824
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
3407
3825
|
import { ComponentPropListIcon as ComponentPropListIcon4 } from "@elementor/icons";
|
|
3408
3826
|
import { Badge, Box as Box14, keyframes, styled as styled3, ToggleButton, Tooltip as Tooltip4 } from "@elementor/ui";
|
|
3409
|
-
import { __ as
|
|
3410
|
-
var ComponentsBadge =
|
|
3827
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3828
|
+
var ComponentsBadge = React28.forwardRef(({ overridablePropsCount, onClick }, ref) => {
|
|
3411
3829
|
const prevCount = usePrevious(overridablePropsCount);
|
|
3412
3830
|
const isFirstExposedProperty = prevCount === 0 && overridablePropsCount === 1;
|
|
3413
|
-
return /* @__PURE__ */
|
|
3831
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3414
3832
|
StyledBadge,
|
|
3415
3833
|
{
|
|
3416
3834
|
ref,
|
|
@@ -3419,17 +3837,17 @@ var ComponentsBadge = React26.forwardRef(({ overridablePropsCount, onClick }, re
|
|
|
3419
3837
|
invisible: overridablePropsCount === 0,
|
|
3420
3838
|
animate: isFirstExposedProperty,
|
|
3421
3839
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3422
|
-
badgeContent: /* @__PURE__ */
|
|
3840
|
+
badgeContent: /* @__PURE__ */ React28.createElement(Box14, { sx: { animation: !isFirstExposedProperty ? `${slideUp} 300ms ease-out` : "none" } }, overridablePropsCount)
|
|
3423
3841
|
},
|
|
3424
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ React28.createElement(Tooltip4, { title: __21("Component properties", "elementor") }, /* @__PURE__ */ React28.createElement(
|
|
3425
3843
|
ToggleButton,
|
|
3426
3844
|
{
|
|
3427
3845
|
value: "exposed properties",
|
|
3428
3846
|
size: "tiny",
|
|
3429
3847
|
onClick,
|
|
3430
|
-
"aria-label":
|
|
3848
|
+
"aria-label": __21("Component properties", "elementor")
|
|
3431
3849
|
},
|
|
3432
|
-
/* @__PURE__ */
|
|
3850
|
+
/* @__PURE__ */ React28.createElement(ComponentPropListIcon4, { fontSize: "tiny" })
|
|
3433
3851
|
))
|
|
3434
3852
|
);
|
|
3435
3853
|
});
|
|
@@ -3470,10 +3888,10 @@ var ComponentPanelHeader = () => {
|
|
|
3470
3888
|
const onBack = useNavigateBack();
|
|
3471
3889
|
const componentName = getComponentName();
|
|
3472
3890
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(MESSAGE_KEY);
|
|
3473
|
-
const [shouldShowIntroduction, setShouldShowIntroduction] =
|
|
3891
|
+
const [shouldShowIntroduction, setShouldShowIntroduction] = React29.useState(!isMessageSuppressed);
|
|
3474
3892
|
const { open: openPropertiesPanel } = usePanelActions();
|
|
3475
3893
|
const overridablePropsCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
|
|
3476
|
-
const anchorRef =
|
|
3894
|
+
const anchorRef = React29.useRef(null);
|
|
3477
3895
|
if (!currentComponentId) {
|
|
3478
3896
|
return null;
|
|
3479
3897
|
}
|
|
@@ -3490,7 +3908,7 @@ var ComponentPanelHeader = () => {
|
|
|
3490
3908
|
properties_count: overridablePropsCount
|
|
3491
3909
|
});
|
|
3492
3910
|
};
|
|
3493
|
-
return /* @__PURE__ */
|
|
3911
|
+
return /* @__PURE__ */ React29.createElement(Box15, { "data-testid": "component-panel-header" }, /* @__PURE__ */ React29.createElement(PanelHeader3, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React29.createElement(Tooltip5, { title: __22("Back", "elementor") }, /* @__PURE__ */ React29.createElement(IconButton5, { size: "tiny", onClick: onBack, "aria-label": __22("Back", "elementor") }, /* @__PURE__ */ React29.createElement(ArrowLeftIcon, { fontSize: "tiny" }))), /* @__PURE__ */ React29.createElement(ComponentsFilledIcon, { fontSize: "tiny", stroke: "currentColor" }), /* @__PURE__ */ React29.createElement(
|
|
3494
3912
|
EllipsisWithTooltip4,
|
|
3495
3913
|
{
|
|
3496
3914
|
title: componentName,
|
|
@@ -3498,14 +3916,14 @@ var ComponentPanelHeader = () => {
|
|
|
3498
3916
|
variant: "caption",
|
|
3499
3917
|
sx: { fontWeight: 500, flexGrow: 1 }
|
|
3500
3918
|
}
|
|
3501
|
-
), /* @__PURE__ */
|
|
3919
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3502
3920
|
ComponentsBadge,
|
|
3503
3921
|
{
|
|
3504
3922
|
overridablePropsCount,
|
|
3505
3923
|
ref: anchorRef,
|
|
3506
3924
|
onClick: handleOpenPropertiesPanel
|
|
3507
3925
|
}
|
|
3508
|
-
)), /* @__PURE__ */
|
|
3926
|
+
)), /* @__PURE__ */ React29.createElement(Divider4, null), /* @__PURE__ */ React29.createElement(
|
|
3509
3927
|
ComponentIntroduction,
|
|
3510
3928
|
{
|
|
3511
3929
|
anchorRef,
|
|
@@ -3515,7 +3933,7 @@ var ComponentPanelHeader = () => {
|
|
|
3515
3933
|
));
|
|
3516
3934
|
};
|
|
3517
3935
|
function getComponentName() {
|
|
3518
|
-
const state =
|
|
3936
|
+
const state = getState9();
|
|
3519
3937
|
const path = state[SLICE_NAME].path;
|
|
3520
3938
|
const { instanceTitle } = path.at(-1) ?? {};
|
|
3521
3939
|
if (instanceTitle) {
|
|
@@ -3527,34 +3945,34 @@ function getComponentName() {
|
|
|
3527
3945
|
}
|
|
3528
3946
|
|
|
3529
3947
|
// src/extended/components/components-tab/components.tsx
|
|
3530
|
-
import * as
|
|
3948
|
+
import * as React32 from "react";
|
|
3531
3949
|
import { ThemeProvider as ThemeProvider3 } from "@elementor/editor-ui";
|
|
3532
3950
|
import { List as List4 } from "@elementor/ui";
|
|
3533
3951
|
|
|
3534
3952
|
// src/extended/components/components-tab/component-item.tsx
|
|
3535
|
-
import * as
|
|
3536
|
-
import { useRef as useRef4, useState as
|
|
3953
|
+
import * as React31 from "react";
|
|
3954
|
+
import { useRef as useRef4, useState as useState7 } from "react";
|
|
3537
3955
|
import { endDragElementFromPanel, startDragElementFromPanel } from "@elementor/editor-canvas";
|
|
3538
3956
|
import { dropElement } from "@elementor/editor-elements";
|
|
3539
3957
|
import { MenuListItem as MenuListItem3, useEditable as useEditable2, WarningInfotip } from "@elementor/editor-ui";
|
|
3540
3958
|
import { DotsVerticalIcon as DotsVerticalIcon2 } from "@elementor/icons";
|
|
3541
|
-
import { bindMenu as bindMenu2, bindTrigger as bindTrigger3, IconButton as IconButton6, Menu as Menu2, Stack as
|
|
3542
|
-
import { __ as
|
|
3959
|
+
import { bindMenu as bindMenu2, bindTrigger as bindTrigger3, IconButton as IconButton6, Menu as Menu2, Stack as Stack17, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
3960
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
3543
3961
|
|
|
3544
3962
|
// src/extended/store/actions/archive-component.ts
|
|
3545
3963
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
|
|
3546
|
-
import { notify } from "@elementor/editor-notifications";
|
|
3547
|
-
import { __ as
|
|
3964
|
+
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
3965
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3548
3966
|
var successNotification = (componentId, componentName) => ({
|
|
3549
3967
|
type: "success",
|
|
3550
3968
|
/* translators: %s: component name */
|
|
3551
|
-
message:
|
|
3969
|
+
message: __23("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
3552
3970
|
id: `success-archived-components-notification-${componentId}`
|
|
3553
3971
|
});
|
|
3554
3972
|
var archiveComponent = (componentId, componentName) => {
|
|
3555
3973
|
componentsActions.archive(componentId);
|
|
3556
3974
|
setDocumentModifiedStatus4(true);
|
|
3557
|
-
|
|
3975
|
+
notify3(successNotification(componentId, componentName));
|
|
3558
3976
|
};
|
|
3559
3977
|
|
|
3560
3978
|
// src/extended/store/actions/rename-component.ts
|
|
@@ -3585,21 +4003,21 @@ function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
|
3585
4003
|
return allDescendants.filter((element) => {
|
|
3586
4004
|
const widgetType = element.model.get("widgetType");
|
|
3587
4005
|
const editorSettings = element.model.get("editor_settings");
|
|
3588
|
-
const isMatch = widgetType ===
|
|
4006
|
+
const isMatch = widgetType === COMPONENT_WIDGET_TYPE2 && editorSettings?.component_uid === componentUid;
|
|
3589
4007
|
return isMatch;
|
|
3590
4008
|
});
|
|
3591
4009
|
}
|
|
3592
4010
|
|
|
3593
4011
|
// src/extended/utils/component-form-schema.ts
|
|
3594
4012
|
import { z as z5 } from "@elementor/schema";
|
|
3595
|
-
import { __ as
|
|
4013
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3596
4014
|
var MIN_NAME_LENGTH = 2;
|
|
3597
4015
|
var MAX_NAME_LENGTH = 50;
|
|
3598
|
-
var baseComponentSchema = z5.string().trim().max(MAX_NAME_LENGTH,
|
|
4016
|
+
var baseComponentSchema = z5.string().trim().max(MAX_NAME_LENGTH, __24("Component name is too long. Please keep it under 50 characters.", "elementor"));
|
|
3599
4017
|
var createBaseComponentSchema = (existingNames) => {
|
|
3600
4018
|
return z5.object({
|
|
3601
4019
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
3602
|
-
message:
|
|
4020
|
+
message: __24("Component name already exists", "elementor")
|
|
3603
4021
|
})
|
|
3604
4022
|
});
|
|
3605
4023
|
};
|
|
@@ -3607,9 +4025,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
3607
4025
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
3608
4026
|
return baseSchema.extend({
|
|
3609
4027
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
3610
|
-
message:
|
|
4028
|
+
message: __24("Component name is required.", "elementor")
|
|
3611
4029
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
3612
|
-
message:
|
|
4030
|
+
message: __24("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
3613
4031
|
})
|
|
3614
4032
|
});
|
|
3615
4033
|
};
|
|
@@ -3657,7 +4075,7 @@ var createComponentModel2 = (component) => {
|
|
|
3657
4075
|
|
|
3658
4076
|
// src/extended/utils/get-container-for-new-element.ts
|
|
3659
4077
|
import {
|
|
3660
|
-
getContainer as
|
|
4078
|
+
getContainer as getContainer4,
|
|
3661
4079
|
getCurrentDocumentContainer as getCurrentDocumentContainer2,
|
|
3662
4080
|
getSelectedElements
|
|
3663
4081
|
} from "@elementor/editor-elements";
|
|
@@ -3692,24 +4110,24 @@ function getSelectedElementContainer() {
|
|
|
3692
4110
|
if (selectedElements.length !== 1) {
|
|
3693
4111
|
return void 0;
|
|
3694
4112
|
}
|
|
3695
|
-
return
|
|
4113
|
+
return getContainer4(selectedElements[0].id);
|
|
3696
4114
|
}
|
|
3697
4115
|
|
|
3698
4116
|
// src/extended/components/components-tab/delete-confirmation-dialog.tsx
|
|
3699
|
-
import * as
|
|
3700
|
-
import { ConfirmationDialog } from "@elementor/editor-ui";
|
|
3701
|
-
import { __ as
|
|
4117
|
+
import * as React30 from "react";
|
|
4118
|
+
import { ConfirmationDialog as ConfirmationDialog2 } from "@elementor/editor-ui";
|
|
4119
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3702
4120
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
3703
|
-
return /* @__PURE__ */
|
|
4121
|
+
return /* @__PURE__ */ React30.createElement(ConfirmationDialog2, { open, onClose }, /* @__PURE__ */ React30.createElement(ConfirmationDialog2.Title, null, __25("Delete this component?", "elementor")), /* @__PURE__ */ React30.createElement(ConfirmationDialog2.Content, null, /* @__PURE__ */ React30.createElement(ConfirmationDialog2.ContentText, null, __25(
|
|
3704
4122
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
3705
4123
|
"elementor"
|
|
3706
|
-
))), /* @__PURE__ */
|
|
4124
|
+
))), /* @__PURE__ */ React30.createElement(ConfirmationDialog2.Actions, { onClose, onConfirm }));
|
|
3707
4125
|
}
|
|
3708
4126
|
|
|
3709
4127
|
// src/extended/components/components-tab/component-item.tsx
|
|
3710
4128
|
function ComponentItem2({ component }) {
|
|
3711
4129
|
const itemRef = useRef4(null);
|
|
3712
|
-
const [isDeleteDialogOpen, setIsDeleteDialogOpen] =
|
|
4130
|
+
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState7(false);
|
|
3713
4131
|
const { canRename, canDelete } = useComponentsPermissions();
|
|
3714
4132
|
const shouldShowActions = canRename || canDelete;
|
|
3715
4133
|
const {
|
|
@@ -3749,7 +4167,7 @@ function ComponentItem2({ component }) {
|
|
|
3749
4167
|
const handleDeleteDialogClose = () => {
|
|
3750
4168
|
setIsDeleteDialogOpen(false);
|
|
3751
4169
|
};
|
|
3752
|
-
return /* @__PURE__ */
|
|
4170
|
+
return /* @__PURE__ */ React31.createElement(Stack17, null, /* @__PURE__ */ React31.createElement(
|
|
3753
4171
|
WarningInfotip,
|
|
3754
4172
|
{
|
|
3755
4173
|
open: Boolean(error),
|
|
@@ -3758,7 +4176,7 @@ function ComponentItem2({ component }) {
|
|
|
3758
4176
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
3759
4177
|
offset: [0, -15]
|
|
3760
4178
|
},
|
|
3761
|
-
/* @__PURE__ */
|
|
4179
|
+
/* @__PURE__ */ React31.createElement(
|
|
3762
4180
|
ComponentItem,
|
|
3763
4181
|
{
|
|
3764
4182
|
ref: itemRef,
|
|
@@ -3770,17 +4188,17 @@ function ComponentItem2({ component }) {
|
|
|
3770
4188
|
onClick: handleClick,
|
|
3771
4189
|
isEditing,
|
|
3772
4190
|
error,
|
|
3773
|
-
nameSlot: /* @__PURE__ */
|
|
4191
|
+
nameSlot: /* @__PURE__ */ React31.createElement(
|
|
3774
4192
|
ComponentName,
|
|
3775
4193
|
{
|
|
3776
4194
|
name: component.name,
|
|
3777
4195
|
editable: { ref: editableRef, isEditing, getProps: getEditableProps }
|
|
3778
4196
|
}
|
|
3779
4197
|
),
|
|
3780
|
-
endSlot: shouldShowActions ? /* @__PURE__ */
|
|
4198
|
+
endSlot: shouldShowActions ? /* @__PURE__ */ React31.createElement(IconButton6, { size: "tiny", ...bindTrigger3(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React31.createElement(DotsVerticalIcon2, { fontSize: "tiny" })) : void 0
|
|
3781
4199
|
}
|
|
3782
4200
|
)
|
|
3783
|
-
), shouldShowActions && /* @__PURE__ */
|
|
4201
|
+
), shouldShowActions && /* @__PURE__ */ React31.createElement(
|
|
3784
4202
|
Menu2,
|
|
3785
4203
|
{
|
|
3786
4204
|
...bindMenu2(popupState),
|
|
@@ -3793,7 +4211,7 @@ function ComponentItem2({ component }) {
|
|
|
3793
4211
|
horizontal: "right"
|
|
3794
4212
|
}
|
|
3795
4213
|
},
|
|
3796
|
-
canRename && /* @__PURE__ */
|
|
4214
|
+
canRename && /* @__PURE__ */ React31.createElement(
|
|
3797
4215
|
MenuListItem3,
|
|
3798
4216
|
{
|
|
3799
4217
|
sx: { minWidth: "160px" },
|
|
@@ -3803,18 +4221,18 @@ function ComponentItem2({ component }) {
|
|
|
3803
4221
|
openEditMode();
|
|
3804
4222
|
}
|
|
3805
4223
|
},
|
|
3806
|
-
|
|
4224
|
+
__26("Rename", "elementor")
|
|
3807
4225
|
),
|
|
3808
|
-
canDelete && /* @__PURE__ */
|
|
4226
|
+
canDelete && /* @__PURE__ */ React31.createElement(
|
|
3809
4227
|
MenuListItem3,
|
|
3810
4228
|
{
|
|
3811
4229
|
sx: { minWidth: "160px" },
|
|
3812
4230
|
primaryTypographyProps: { variant: "caption", color: "error.light" },
|
|
3813
4231
|
onClick: handleDeleteClick
|
|
3814
4232
|
},
|
|
3815
|
-
|
|
4233
|
+
__26("Delete", "elementor")
|
|
3816
4234
|
)
|
|
3817
|
-
), /* @__PURE__ */
|
|
4235
|
+
), /* @__PURE__ */ React31.createElement(
|
|
3818
4236
|
DeleteConfirmationDialog,
|
|
3819
4237
|
{
|
|
3820
4238
|
open: isDeleteDialogOpen,
|
|
@@ -3847,43 +4265,43 @@ var validateComponentTitle = (newTitle) => {
|
|
|
3847
4265
|
var ExtendedComponentsList = () => {
|
|
3848
4266
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
3849
4267
|
if (isLoading) {
|
|
3850
|
-
return /* @__PURE__ */
|
|
4268
|
+
return /* @__PURE__ */ React32.createElement(LoadingComponents, null);
|
|
3851
4269
|
}
|
|
3852
4270
|
const isEmpty = !components?.length;
|
|
3853
4271
|
if (isEmpty) {
|
|
3854
|
-
return searchValue.length ? /* @__PURE__ */
|
|
4272
|
+
return searchValue.length ? /* @__PURE__ */ React32.createElement(EmptySearchResult, null) : /* @__PURE__ */ React32.createElement(EmptyState, null);
|
|
3855
4273
|
}
|
|
3856
|
-
return /* @__PURE__ */
|
|
4274
|
+
return /* @__PURE__ */ React32.createElement(List4, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React32.createElement(ComponentItem2, { key: component.uid, component })));
|
|
3857
4275
|
};
|
|
3858
4276
|
var ExtendedComponentsContent = () => {
|
|
3859
4277
|
const { components, isLoading } = useComponents();
|
|
3860
4278
|
const hasComponents = !isLoading && components.length > 0;
|
|
3861
|
-
return /* @__PURE__ */
|
|
4279
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, hasComponents && /* @__PURE__ */ React32.createElement(ComponentSearch, null), /* @__PURE__ */ React32.createElement(ExtendedComponentsList, null));
|
|
3862
4280
|
};
|
|
3863
4281
|
var ExtendedComponents = () => {
|
|
3864
|
-
return /* @__PURE__ */
|
|
4282
|
+
return /* @__PURE__ */ React32.createElement(ThemeProvider3, null, /* @__PURE__ */ React32.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React32.createElement(ExtendedComponentsContent, null)));
|
|
3865
4283
|
};
|
|
3866
4284
|
|
|
3867
4285
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
3868
|
-
import * as
|
|
3869
|
-
import { useEffect as useEffect3, useMemo as useMemo3, useRef as useRef5, useState as
|
|
4286
|
+
import * as React33 from "react";
|
|
4287
|
+
import { useEffect as useEffect3, useMemo as useMemo3, useRef as useRef5, useState as useState9 } from "react";
|
|
3870
4288
|
import { getElementLabel } from "@elementor/editor-elements";
|
|
3871
|
-
import { notify as
|
|
4289
|
+
import { notify as notify5 } from "@elementor/editor-notifications";
|
|
3872
4290
|
import { Form as FormElement, ThemeProvider as ThemeProvider4, useTextFieldAutoSelect } from "@elementor/editor-ui";
|
|
3873
4291
|
import { ComponentsIcon as ComponentsIcon4 } from "@elementor/icons";
|
|
3874
|
-
import { Button as Button5, FormLabel as FormLabel2, Grid as Grid2, Popover as Popover3, Stack as
|
|
3875
|
-
import { __ as
|
|
4292
|
+
import { Button as Button5, FormLabel as FormLabel2, Grid as Grid2, Popover as Popover3, Stack as Stack18, TextField as TextField3, Typography as Typography12 } from "@elementor/ui";
|
|
4293
|
+
import { __ as __29 } from "@wordpress/i18n";
|
|
3876
4294
|
|
|
3877
4295
|
// src/extended/store/actions/create-unpublished-component.ts
|
|
3878
|
-
import { createElements, deleteElement, getContainer as
|
|
4296
|
+
import { createElements, deleteElement, getContainer as getContainer5 } from "@elementor/editor-elements";
|
|
3879
4297
|
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
3880
4298
|
import { generateUniqueId as generateUniqueId3 } from "@elementor/utils";
|
|
3881
|
-
import { __ as
|
|
4299
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
3882
4300
|
|
|
3883
4301
|
// src/extended/utils/replace-element-with-component.ts
|
|
3884
|
-
import { replaceElement } from "@elementor/editor-elements";
|
|
4302
|
+
import { replaceElement as replaceElement2 } from "@elementor/editor-elements";
|
|
3885
4303
|
var replaceElementWithComponent = (element, component) => {
|
|
3886
|
-
return
|
|
4304
|
+
return replaceElement2({
|
|
3887
4305
|
currentElementId: element.id,
|
|
3888
4306
|
newElement: createComponentModel2(component),
|
|
3889
4307
|
withHistory: false
|
|
@@ -3902,7 +4320,7 @@ async function createUnpublishedComponent({
|
|
|
3902
4320
|
const generatedUid = uid ?? generateUniqueId3("component");
|
|
3903
4321
|
const componentBase = { uid: generatedUid, name };
|
|
3904
4322
|
const elementDataWithOverridablesReverted = revertAllOverridablesInElementData(element);
|
|
3905
|
-
const container =
|
|
4323
|
+
const container = getContainer5(element.id);
|
|
3906
4324
|
const modelFromContainer = container?.model?.toJSON?.();
|
|
3907
4325
|
const originalElement = {
|
|
3908
4326
|
model: modelFromContainer ?? element,
|
|
@@ -3934,17 +4352,17 @@ async function createUnpublishedComponent({
|
|
|
3934
4352
|
return { uid: generatedUid, instanceId: componentInstance.id };
|
|
3935
4353
|
}
|
|
3936
4354
|
function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
3937
|
-
const componentContainer =
|
|
4355
|
+
const componentContainer = getContainer5(componentInstanceId);
|
|
3938
4356
|
if (componentContainer) {
|
|
3939
4357
|
deleteElement({ container: componentContainer, options: { useHistory: false } });
|
|
3940
4358
|
}
|
|
3941
|
-
const parentContainer =
|
|
4359
|
+
const parentContainer = getContainer5(originalElement.parentId);
|
|
3942
4360
|
if (!parentContainer) {
|
|
3943
4361
|
return;
|
|
3944
4362
|
}
|
|
3945
4363
|
const clonedModel = structuredClone(originalElement.model);
|
|
3946
4364
|
createElements({
|
|
3947
|
-
title:
|
|
4365
|
+
title: __27("Restore Element", "elementor"),
|
|
3948
4366
|
elements: [
|
|
3949
4367
|
{
|
|
3950
4368
|
container: parentContainer,
|
|
@@ -3958,9 +4376,9 @@ function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
|
3958
4376
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
3959
4377
|
import { isAtomicWidget } from "@elementor/editor-canvas";
|
|
3960
4378
|
import { getAllDescendants as getAllDescendants3, getElementType as getElementType3 } from "@elementor/editor-elements";
|
|
3961
|
-
import { notify as
|
|
4379
|
+
import { notify as notify4 } from "@elementor/editor-notifications";
|
|
3962
4380
|
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
3963
|
-
import { __ as
|
|
4381
|
+
import { __ as __28 } from "@wordpress/i18n";
|
|
3964
4382
|
|
|
3965
4383
|
// src/extended/utils/is-editing-component.ts
|
|
3966
4384
|
function isEditingComponent() {
|
|
@@ -3970,7 +4388,7 @@ function isEditingComponent() {
|
|
|
3970
4388
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
3971
4389
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
3972
4390
|
type: "default",
|
|
3973
|
-
message:
|
|
4391
|
+
message: __28("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
3974
4392
|
id: "non-atomic-element-blocked"
|
|
3975
4393
|
};
|
|
3976
4394
|
function initNonAtomicNestingPrevention() {
|
|
@@ -4002,7 +4420,7 @@ function blockNonAtomicCreate(args) {
|
|
|
4002
4420
|
if (isElementAtomic(elementType)) {
|
|
4003
4421
|
return false;
|
|
4004
4422
|
}
|
|
4005
|
-
|
|
4423
|
+
notify4(NON_ATOMIC_ELEMENT_ALERT);
|
|
4006
4424
|
return true;
|
|
4007
4425
|
}
|
|
4008
4426
|
function blockNonAtomicMove(args) {
|
|
@@ -4018,7 +4436,7 @@ function blockNonAtomicMove(args) {
|
|
|
4018
4436
|
return allElements.some((element) => !isAtomicWidget(element));
|
|
4019
4437
|
});
|
|
4020
4438
|
if (hasNonAtomicElement) {
|
|
4021
|
-
|
|
4439
|
+
notify4(NON_ATOMIC_ELEMENT_ALERT);
|
|
4022
4440
|
}
|
|
4023
4441
|
return hasNonAtomicElement;
|
|
4024
4442
|
}
|
|
@@ -4036,7 +4454,7 @@ function blockNonAtomicPaste(args) {
|
|
|
4036
4454
|
}
|
|
4037
4455
|
const hasNonAtomicElement = hasNonAtomicElementsInTree(data.clipboard.elements);
|
|
4038
4456
|
if (hasNonAtomicElement) {
|
|
4039
|
-
|
|
4457
|
+
notify4(NON_ATOMIC_ELEMENT_ALERT);
|
|
4040
4458
|
}
|
|
4041
4459
|
return hasNonAtomicElement;
|
|
4042
4460
|
}
|
|
@@ -4069,10 +4487,10 @@ function findNonAtomicElementsInElement(element) {
|
|
|
4069
4487
|
}
|
|
4070
4488
|
|
|
4071
4489
|
// src/extended/components/create-component-form/hooks/use-form.ts
|
|
4072
|
-
import { useMemo as useMemo2, useState as
|
|
4490
|
+
import { useMemo as useMemo2, useState as useState8 } from "react";
|
|
4073
4491
|
var useForm = (initialValues) => {
|
|
4074
|
-
const [values, setValues] =
|
|
4075
|
-
const [errors, setErrors] =
|
|
4492
|
+
const [values, setValues] = useState8(initialValues);
|
|
4493
|
+
const [errors, setErrors] = useState8({});
|
|
4076
4494
|
const isValid = useMemo2(() => {
|
|
4077
4495
|
return !Object.values(errors).some((error) => error);
|
|
4078
4496
|
}, [errors]);
|
|
@@ -4149,8 +4567,8 @@ function countNestedElements(container) {
|
|
|
4149
4567
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
4150
4568
|
var MAX_COMPONENTS = 100;
|
|
4151
4569
|
function CreateComponentForm() {
|
|
4152
|
-
const [element, setElement] =
|
|
4153
|
-
const [anchorPosition, setAnchorPosition] =
|
|
4570
|
+
const [element, setElement] = useState9(null);
|
|
4571
|
+
const [anchorPosition, setAnchorPosition] = useState9();
|
|
4154
4572
|
const { components } = useComponents();
|
|
4155
4573
|
const eventData = useRef5(null);
|
|
4156
4574
|
useEffect3(() => {
|
|
@@ -4158,7 +4576,7 @@ function CreateComponentForm() {
|
|
|
4158
4576
|
const openPopup = (event) => {
|
|
4159
4577
|
const { shouldOpen, notification } = shouldOpenForm(event.detail.element, components?.length ?? 0);
|
|
4160
4578
|
if (!shouldOpen) {
|
|
4161
|
-
|
|
4579
|
+
notify5(notification);
|
|
4162
4580
|
return;
|
|
4163
4581
|
}
|
|
4164
4582
|
setElement({ element: event.detail.element, elementLabel: getElementLabel(event.detail.element.id) });
|
|
@@ -4192,15 +4610,15 @@ function CreateComponentForm() {
|
|
|
4192
4610
|
} else {
|
|
4193
4611
|
throw new Error("Failed to find published component");
|
|
4194
4612
|
}
|
|
4195
|
-
|
|
4613
|
+
notify5({
|
|
4196
4614
|
type: "success",
|
|
4197
|
-
message:
|
|
4615
|
+
message: __29("Component created successfully.", "elementor"),
|
|
4198
4616
|
id: `component-saved-successfully-${uid}`
|
|
4199
4617
|
});
|
|
4200
4618
|
resetAndClosePopup();
|
|
4201
4619
|
} catch {
|
|
4202
|
-
const errorMessage =
|
|
4203
|
-
|
|
4620
|
+
const errorMessage = __29("Failed to create component. Please try again.", "elementor");
|
|
4621
|
+
notify5({
|
|
4204
4622
|
type: "error",
|
|
4205
4623
|
message: errorMessage,
|
|
4206
4624
|
id: "component-save-failed"
|
|
@@ -4220,7 +4638,7 @@ function CreateComponentForm() {
|
|
|
4220
4638
|
...eventData.current
|
|
4221
4639
|
});
|
|
4222
4640
|
};
|
|
4223
|
-
return /* @__PURE__ */
|
|
4641
|
+
return /* @__PURE__ */ React33.createElement(ThemeProvider4, null, /* @__PURE__ */ React33.createElement(
|
|
4224
4642
|
Popover3,
|
|
4225
4643
|
{
|
|
4226
4644
|
open: element !== null,
|
|
@@ -4229,7 +4647,7 @@ function CreateComponentForm() {
|
|
|
4229
4647
|
anchorPosition,
|
|
4230
4648
|
"data-testid": "create-component-form"
|
|
4231
4649
|
},
|
|
4232
|
-
element !== null && /* @__PURE__ */
|
|
4650
|
+
element !== null && /* @__PURE__ */ React33.createElement(
|
|
4233
4651
|
Form2,
|
|
4234
4652
|
{
|
|
4235
4653
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -4246,7 +4664,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4246
4664
|
shouldOpen: false,
|
|
4247
4665
|
notification: {
|
|
4248
4666
|
type: "default",
|
|
4249
|
-
message:
|
|
4667
|
+
message: __29(
|
|
4250
4668
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
4251
4669
|
"elementor"
|
|
4252
4670
|
),
|
|
@@ -4260,7 +4678,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4260
4678
|
notification: {
|
|
4261
4679
|
type: "default",
|
|
4262
4680
|
/* translators: %s is the maximum number of components */
|
|
4263
|
-
message:
|
|
4681
|
+
message: __29(
|
|
4264
4682
|
`You've reached the limit of %s components. Please remove an existing one to create a new component.`,
|
|
4265
4683
|
"elementor"
|
|
4266
4684
|
).replace("%s", MAX_COMPONENTS.toString()),
|
|
@@ -4297,14 +4715,14 @@ var Form2 = ({
|
|
|
4297
4715
|
}
|
|
4298
4716
|
};
|
|
4299
4717
|
const texts = {
|
|
4300
|
-
heading:
|
|
4301
|
-
name:
|
|
4302
|
-
cancel:
|
|
4303
|
-
create:
|
|
4718
|
+
heading: __29("Create component", "elementor"),
|
|
4719
|
+
name: __29("Name", "elementor"),
|
|
4720
|
+
cancel: __29("Cancel", "elementor"),
|
|
4721
|
+
create: __29("Create", "elementor")
|
|
4304
4722
|
};
|
|
4305
4723
|
const nameInputId = "component-name";
|
|
4306
|
-
return /* @__PURE__ */
|
|
4307
|
-
|
|
4724
|
+
return /* @__PURE__ */ React33.createElement(FormElement, { onSubmit: handleSubmit }, /* @__PURE__ */ React33.createElement(Stack18, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React33.createElement(
|
|
4725
|
+
Stack18,
|
|
4308
4726
|
{
|
|
4309
4727
|
direction: "row",
|
|
4310
4728
|
alignItems: "center",
|
|
@@ -4312,9 +4730,9 @@ var Form2 = ({
|
|
|
4312
4730
|
px: 1.5,
|
|
4313
4731
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
4314
4732
|
},
|
|
4315
|
-
/* @__PURE__ */
|
|
4316
|
-
/* @__PURE__ */
|
|
4317
|
-
), /* @__PURE__ */
|
|
4733
|
+
/* @__PURE__ */ React33.createElement(ComponentsIcon4, { fontSize: FONT_SIZE }),
|
|
4734
|
+
/* @__PURE__ */ React33.createElement(Typography12, { variant: "caption", sx: { color: "text.primary", fontWeight: "500", lineHeight: 1 } }, texts.heading)
|
|
4735
|
+
), /* @__PURE__ */ React33.createElement(Grid2, { container: true, gap: 0.75, alignItems: "start", p: 1.5 }, /* @__PURE__ */ React33.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(FormLabel2, { htmlFor: nameInputId, size: "tiny" }, texts.name)), /* @__PURE__ */ React33.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(
|
|
4318
4736
|
TextField3,
|
|
4319
4737
|
{
|
|
4320
4738
|
id: nameInputId,
|
|
@@ -4327,12 +4745,12 @@ var Form2 = ({
|
|
|
4327
4745
|
helperText: errors.componentName,
|
|
4328
4746
|
inputRef: nameInputRef
|
|
4329
4747
|
}
|
|
4330
|
-
))), /* @__PURE__ */
|
|
4748
|
+
))), /* @__PURE__ */ React33.createElement(Stack18, { direction: "row", justifyContent: "flex-end", alignSelf: "end", py: 1, px: 1.5 }, /* @__PURE__ */ React33.createElement(Button5, { onClick: closePopup, color: "secondary", variant: "text", size: "small" }, texts.cancel), /* @__PURE__ */ React33.createElement(Button5, { type: "submit", disabled: !isValid, variant: "contained", color: "primary", size: "small" }, texts.create))));
|
|
4331
4749
|
};
|
|
4332
4750
|
|
|
4333
4751
|
// src/extended/components/edit-component/edit-component.tsx
|
|
4334
|
-
import * as
|
|
4335
|
-
import { useEffect as useEffect6, useState as
|
|
4752
|
+
import * as React35 from "react";
|
|
4753
|
+
import { useEffect as useEffect6, useState as useState11 } from "react";
|
|
4336
4754
|
import { getV1DocumentsManager as getV1DocumentsManager5 } from "@elementor/editor-documents";
|
|
4337
4755
|
import { __privateListenTo as listenTo, commandEndEvent as commandEndEvent2 } from "@elementor/editor-v1-adapters";
|
|
4338
4756
|
import { __useSelector as useSelector5 } from "@elementor/store";
|
|
@@ -4354,10 +4772,10 @@ function updateCurrentComponent(params) {
|
|
|
4354
4772
|
}
|
|
4355
4773
|
|
|
4356
4774
|
// src/extended/components/edit-component/component-modal.tsx
|
|
4357
|
-
import * as
|
|
4775
|
+
import * as React34 from "react";
|
|
4358
4776
|
import { useEffect as useEffect5 } from "react";
|
|
4359
4777
|
import { createPortal } from "react-dom";
|
|
4360
|
-
import { __ as
|
|
4778
|
+
import { __ as __30 } from "@wordpress/i18n";
|
|
4361
4779
|
|
|
4362
4780
|
// src/extended/components/edit-component/use-canvas-document.ts
|
|
4363
4781
|
import {
|
|
@@ -4370,10 +4788,10 @@ function useCanvasDocument() {
|
|
|
4370
4788
|
}
|
|
4371
4789
|
|
|
4372
4790
|
// src/extended/components/edit-component/use-element-rect.ts
|
|
4373
|
-
import { useEffect as useEffect4, useState as
|
|
4791
|
+
import { useEffect as useEffect4, useState as useState10 } from "react";
|
|
4374
4792
|
import { throttle } from "@elementor/utils";
|
|
4375
4793
|
function useElementRect(element) {
|
|
4376
|
-
const [rect, setRect] =
|
|
4794
|
+
const [rect, setRect] = useState10(new DOMRect(0, 0, 0, 0));
|
|
4377
4795
|
const onChange = throttle(
|
|
4378
4796
|
() => {
|
|
4379
4797
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -4450,7 +4868,7 @@ function ComponentModal({ topLevelElementDom, onClose }) {
|
|
|
4450
4868
|
return null;
|
|
4451
4869
|
}
|
|
4452
4870
|
return createPortal(
|
|
4453
|
-
/* @__PURE__ */
|
|
4871
|
+
/* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(BlockEditPage, null), /* @__PURE__ */ React34.createElement(Backdrop, { canvas: canvasDocument, element: topLevelElementDom, onClose })),
|
|
4454
4872
|
canvasDocument.body
|
|
4455
4873
|
);
|
|
4456
4874
|
}
|
|
@@ -4479,7 +4897,7 @@ function Backdrop({
|
|
|
4479
4897
|
onClose();
|
|
4480
4898
|
}
|
|
4481
4899
|
};
|
|
4482
|
-
return /* @__PURE__ */
|
|
4900
|
+
return /* @__PURE__ */ React34.createElement(
|
|
4483
4901
|
"div",
|
|
4484
4902
|
{
|
|
4485
4903
|
style: backdropStyle,
|
|
@@ -4487,7 +4905,7 @@ function Backdrop({
|
|
|
4487
4905
|
onKeyDown: handleKeyDown,
|
|
4488
4906
|
role: "button",
|
|
4489
4907
|
tabIndex: 0,
|
|
4490
|
-
"aria-label":
|
|
4908
|
+
"aria-label": __30("Exit component editing mode", "elementor")
|
|
4491
4909
|
}
|
|
4492
4910
|
);
|
|
4493
4911
|
}
|
|
@@ -4527,7 +4945,7 @@ function BlockEditPage() {
|
|
|
4527
4945
|
}
|
|
4528
4946
|
}
|
|
4529
4947
|
`;
|
|
4530
|
-
return /* @__PURE__ */
|
|
4948
|
+
return /* @__PURE__ */ React34.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
4531
4949
|
}
|
|
4532
4950
|
|
|
4533
4951
|
// src/extended/components/edit-component/edit-component.tsx
|
|
@@ -4540,7 +4958,7 @@ function EditComponent() {
|
|
|
4540
4958
|
if (!currentComponentId) {
|
|
4541
4959
|
return null;
|
|
4542
4960
|
}
|
|
4543
|
-
return /* @__PURE__ */
|
|
4961
|
+
return /* @__PURE__ */ React35.createElement(ComponentModal, { topLevelElementDom, onClose });
|
|
4544
4962
|
}
|
|
4545
4963
|
function useHandleDocumentSwitches() {
|
|
4546
4964
|
const documentsManager = getV1DocumentsManager5();
|
|
@@ -4600,7 +5018,7 @@ function getInstanceTitle(instanceId, path) {
|
|
|
4600
5018
|
}
|
|
4601
5019
|
function useComponentDOMElement(id2) {
|
|
4602
5020
|
const { componentContainerDomElement, topLevelElementDom } = getComponentDOMElements(id2);
|
|
4603
|
-
const [currentElementDom, setCurrentElementDom] =
|
|
5021
|
+
const [currentElementDom, setCurrentElementDom] = useState11(topLevelElementDom);
|
|
4604
5022
|
useEffect6(() => {
|
|
4605
5023
|
setCurrentElementDom(topLevelElementDom);
|
|
4606
5024
|
}, [topLevelElementDom]);
|
|
@@ -4632,10 +5050,10 @@ function getComponentDOMElements(id2) {
|
|
|
4632
5050
|
}
|
|
4633
5051
|
|
|
4634
5052
|
// src/extended/components/instance-editing-panel/instance-editing-panel.tsx
|
|
4635
|
-
import * as
|
|
5053
|
+
import * as React36 from "react";
|
|
4636
5054
|
import { PencilIcon as PencilIcon3 } from "@elementor/icons";
|
|
4637
5055
|
import { Box as Box16 } from "@elementor/ui";
|
|
4638
|
-
import { __ as
|
|
5056
|
+
import { __ as __31 } from "@wordpress/i18n";
|
|
4639
5057
|
function ExtendedInstanceEditingPanel() {
|
|
4640
5058
|
const { canEdit } = useComponentsPermissions();
|
|
4641
5059
|
const data = useInstancePanelData();
|
|
@@ -4643,20 +5061,20 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4643
5061
|
return null;
|
|
4644
5062
|
}
|
|
4645
5063
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
4646
|
-
const panelTitle =
|
|
5064
|
+
const panelTitle = __31("Edit %s", "elementor").replace("%s", component.name);
|
|
4647
5065
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
4648
|
-
return /* @__PURE__ */
|
|
5066
|
+
return /* @__PURE__ */ React36.createElement(Box16, { "data-testid": "instance-editing-panel" }, /* @__PURE__ */ React36.createElement(
|
|
4649
5067
|
ComponentInstanceProvider,
|
|
4650
5068
|
{
|
|
4651
5069
|
componentId,
|
|
4652
5070
|
overrides,
|
|
4653
5071
|
overridableProps
|
|
4654
5072
|
},
|
|
4655
|
-
/* @__PURE__ */
|
|
5073
|
+
/* @__PURE__ */ React36.createElement(
|
|
4656
5074
|
InstancePanelHeader,
|
|
4657
5075
|
{
|
|
4658
5076
|
componentName: component.name,
|
|
4659
|
-
actions: canEdit ? /* @__PURE__ */
|
|
5077
|
+
actions: canEdit ? /* @__PURE__ */ React36.createElement(
|
|
4660
5078
|
EditComponentAction,
|
|
4661
5079
|
{
|
|
4662
5080
|
label: panelTitle,
|
|
@@ -4666,12 +5084,12 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4666
5084
|
) : void 0
|
|
4667
5085
|
}
|
|
4668
5086
|
),
|
|
4669
|
-
/* @__PURE__ */
|
|
5087
|
+
/* @__PURE__ */ React36.createElement(
|
|
4670
5088
|
InstancePanelBody,
|
|
4671
5089
|
{
|
|
4672
5090
|
groups,
|
|
4673
5091
|
isEmpty,
|
|
4674
|
-
emptyState: /* @__PURE__ */
|
|
5092
|
+
emptyState: /* @__PURE__ */ React36.createElement(EmptyState2, { onEditComponent: canEdit ? handleEditComponent : void 0 }),
|
|
4675
5093
|
componentInstanceId
|
|
4676
5094
|
}
|
|
4677
5095
|
)
|
|
@@ -4679,7 +5097,7 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4679
5097
|
}
|
|
4680
5098
|
|
|
4681
5099
|
// src/extended/components/overridable-props/overridable-prop-control.tsx
|
|
4682
|
-
import * as
|
|
5100
|
+
import * as React37 from "react";
|
|
4683
5101
|
import {
|
|
4684
5102
|
ControlReplacementsProvider as ControlReplacementsProvider2,
|
|
4685
5103
|
getControlReplacements as getControlReplacements2,
|
|
@@ -4731,7 +5149,7 @@ function OverridablePropControl({
|
|
|
4731
5149
|
});
|
|
4732
5150
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
4733
5151
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
4734
|
-
return /* @__PURE__ */
|
|
5152
|
+
return /* @__PURE__ */ React37.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React37.createElement(
|
|
4735
5153
|
PropProvider2,
|
|
4736
5154
|
{
|
|
4737
5155
|
...propContext,
|
|
@@ -4742,7 +5160,7 @@ function OverridablePropControl({
|
|
|
4742
5160
|
},
|
|
4743
5161
|
placeholder: objectPlaceholder
|
|
4744
5162
|
},
|
|
4745
|
-
/* @__PURE__ */
|
|
5163
|
+
/* @__PURE__ */ React37.createElement(PropKeyProvider2, { bind }, /* @__PURE__ */ React37.createElement(ControlReplacementsProvider2, { replacements: filteredReplacements }, /* @__PURE__ */ React37.createElement(ControlWithReplacements, { OriginalControl: OriginalControl2, props })))
|
|
4746
5164
|
));
|
|
4747
5165
|
}
|
|
4748
5166
|
function ControlWithReplacements({
|
|
@@ -4752,18 +5170,18 @@ function ControlWithReplacements({
|
|
|
4752
5170
|
const { ControlToRender, isReplaced } = useControlReplacement(OriginalControl2);
|
|
4753
5171
|
if (isReplaced) {
|
|
4754
5172
|
const ReplacementControl = ControlToRender;
|
|
4755
|
-
return /* @__PURE__ */
|
|
5173
|
+
return /* @__PURE__ */ React37.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
|
|
4756
5174
|
}
|
|
4757
|
-
return /* @__PURE__ */
|
|
5175
|
+
return /* @__PURE__ */ React37.createElement(OriginalControl2, { ...props });
|
|
4758
5176
|
}
|
|
4759
5177
|
|
|
4760
5178
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
4761
|
-
import * as
|
|
5179
|
+
import * as React39 from "react";
|
|
4762
5180
|
import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
4763
5181
|
import { useElement as useElement4 } from "@elementor/editor-editing-panel";
|
|
4764
5182
|
import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
|
|
4765
5183
|
import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Popover4, Tooltip as Tooltip6, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
4766
|
-
import { __ as
|
|
5184
|
+
import { __ as __33 } from "@wordpress/i18n";
|
|
4767
5185
|
|
|
4768
5186
|
// src/extended/store/actions/set-overridable-prop.ts
|
|
4769
5187
|
import { generateUniqueId as generateUniqueId4 } from "@elementor/utils";
|
|
@@ -4835,11 +5253,11 @@ function setOverridableProp({
|
|
|
4835
5253
|
}
|
|
4836
5254
|
|
|
4837
5255
|
// src/extended/components/overridable-props/indicator.tsx
|
|
4838
|
-
import * as
|
|
5256
|
+
import * as React38 from "react";
|
|
4839
5257
|
import { forwardRef as forwardRef3 } from "react";
|
|
4840
5258
|
import { CheckIcon, PlusIcon } from "@elementor/icons";
|
|
4841
5259
|
import { Box as Box17, styled as styled4 } from "@elementor/ui";
|
|
4842
|
-
import { __ as
|
|
5260
|
+
import { __ as __32 } from "@wordpress/i18n";
|
|
4843
5261
|
var SIZE2 = "tiny";
|
|
4844
5262
|
var IconContainer = styled4(Box17)`
|
|
4845
5263
|
pointer-events: none;
|
|
@@ -4895,16 +5313,16 @@ var Content = styled4(Box17)`
|
|
|
4895
5313
|
}
|
|
4896
5314
|
}
|
|
4897
5315
|
`;
|
|
4898
|
-
var Indicator2 = forwardRef3(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */
|
|
5316
|
+
var Indicator2 = forwardRef3(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React38.createElement(
|
|
4899
5317
|
Content,
|
|
4900
5318
|
{
|
|
4901
5319
|
role: "button",
|
|
4902
5320
|
ref,
|
|
4903
5321
|
...props,
|
|
4904
5322
|
className: isOpen || isOverridable ? "enlarged" : "",
|
|
4905
|
-
"aria-label": isOverridable ?
|
|
5323
|
+
"aria-label": isOverridable ? __32("Overridable property", "elementor") : __32("Make prop overridable", "elementor")
|
|
4906
5324
|
},
|
|
4907
|
-
/* @__PURE__ */
|
|
5325
|
+
/* @__PURE__ */ React38.createElement(IconContainer, { className: "icon" }, isOverridable ? /* @__PURE__ */ React38.createElement(CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React38.createElement(PlusIcon, { fontSize: SIZE2 }))
|
|
4908
5326
|
));
|
|
4909
5327
|
|
|
4910
5328
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
@@ -4915,7 +5333,7 @@ function OverridablePropIndicator() {
|
|
|
4915
5333
|
if (!isPropAllowed(propType) || !componentId || !overridableProps) {
|
|
4916
5334
|
return null;
|
|
4917
5335
|
}
|
|
4918
|
-
return /* @__PURE__ */
|
|
5336
|
+
return /* @__PURE__ */ React39.createElement(Content2, { componentId, overridableProps });
|
|
4919
5337
|
}
|
|
4920
5338
|
function Content2({ componentId, overridableProps }) {
|
|
4921
5339
|
const {
|
|
@@ -4961,7 +5379,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4961
5379
|
popupState.close();
|
|
4962
5380
|
};
|
|
4963
5381
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4964
|
-
return /* @__PURE__ */
|
|
5382
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(Tooltip6, { placement: "top", title: __33("Override Property", "elementor") }, /* @__PURE__ */ React39.createElement(Indicator2, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React39.createElement(
|
|
4965
5383
|
Popover4,
|
|
4966
5384
|
{
|
|
4967
5385
|
disableScrollLock: true,
|
|
@@ -4978,7 +5396,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4978
5396
|
},
|
|
4979
5397
|
...popoverProps
|
|
4980
5398
|
},
|
|
4981
|
-
/* @__PURE__ */
|
|
5399
|
+
/* @__PURE__ */ React39.createElement(
|
|
4982
5400
|
OverridablePropForm,
|
|
4983
5401
|
{
|
|
4984
5402
|
onSubmit: handleSubmit,
|
|
@@ -5001,7 +5419,7 @@ import { getMCPByDomain as getMCPByDomain2 } from "@elementor/editor-mcp";
|
|
|
5001
5419
|
|
|
5002
5420
|
// src/extended/mcp/save-as-component-tool.ts
|
|
5003
5421
|
import { DOCUMENT_STRUCTURE_URI, WIDGET_SCHEMA_URI } from "@elementor/editor-canvas";
|
|
5004
|
-
import { getContainer as
|
|
5422
|
+
import { getContainer as getContainer6, getElementType as getElementType4, getWidgetsCache as getWidgetsCache4 } from "@elementor/editor-elements";
|
|
5005
5423
|
import { getMCPByDomain, toolPrompts } from "@elementor/editor-mcp";
|
|
5006
5424
|
import { AxiosError } from "@elementor/http-client";
|
|
5007
5425
|
import { z as z6 } from "@elementor/schema";
|
|
@@ -5046,7 +5464,7 @@ var handleSaveAsComponent = async (params) => {
|
|
|
5046
5464
|
overridable_props: overridablePropsInput
|
|
5047
5465
|
} = params;
|
|
5048
5466
|
const validElementTypes = getValidElementTypes();
|
|
5049
|
-
const container =
|
|
5467
|
+
const container = getContainer6(elementId);
|
|
5050
5468
|
if (!container) {
|
|
5051
5469
|
throw new Error(ERROR_MESSAGES3.ELEMENT_NOT_FOUND);
|
|
5052
5470
|
}
|
|
@@ -5392,7 +5810,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
5392
5810
|
};
|
|
5393
5811
|
|
|
5394
5812
|
// src/extended/sync/update-archived-component-before-save.ts
|
|
5395
|
-
import { notify as
|
|
5813
|
+
import { notify as notify6 } from "@elementor/editor-notifications";
|
|
5396
5814
|
var failedNotification = (message) => ({
|
|
5397
5815
|
type: "error",
|
|
5398
5816
|
message: `Failed to archive components: ${message}`,
|
|
@@ -5407,7 +5825,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
|
|
|
5407
5825
|
const result = await apiClient.updateArchivedComponents(archivedComponents, status);
|
|
5408
5826
|
const failedIds = result.failedIds.join(", ");
|
|
5409
5827
|
if (failedIds) {
|
|
5410
|
-
|
|
5828
|
+
notify6(failedNotification(failedIds));
|
|
5411
5829
|
}
|
|
5412
5830
|
} catch (error) {
|
|
5413
5831
|
throw new Error(`Failed to update archived components: ${error}`);
|
|
@@ -5571,7 +5989,7 @@ function isPartOfMoveCommand(options) {
|
|
|
5571
5989
|
}
|
|
5572
5990
|
|
|
5573
5991
|
// src/extended/sync/handle-component-edit-mode-container.ts
|
|
5574
|
-
import { createElement as
|
|
5992
|
+
import { createElement as createElement40, selectElement as selectElement2 } from "@elementor/editor-elements";
|
|
5575
5993
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
5576
5994
|
var V4_DEFAULT_CONTAINER_TYPE = "e-flexbox";
|
|
5577
5995
|
function initHandleComponentEditModeContainer() {
|
|
@@ -5621,7 +6039,7 @@ function initRedirectDropIntoComponent() {
|
|
|
5621
6039
|
});
|
|
5622
6040
|
}
|
|
5623
6041
|
function createEmptyTopLevelContainer(container) {
|
|
5624
|
-
const newContainer =
|
|
6042
|
+
const newContainer = createElement40({
|
|
5625
6043
|
container,
|
|
5626
6044
|
model: { elType: V4_DEFAULT_CONTAINER_TYPE }
|
|
5627
6045
|
});
|
|
@@ -5720,7 +6138,7 @@ function initExtended() {
|
|
|
5720
6138
|
});
|
|
5721
6139
|
registerTab({
|
|
5722
6140
|
id: "components",
|
|
5723
|
-
label:
|
|
6141
|
+
label: __34("Components", "elementor"),
|
|
5724
6142
|
component: ExtendedComponents,
|
|
5725
6143
|
priority: PRIORITY
|
|
5726
6144
|
});
|
|
@@ -5840,24 +6258,24 @@ function initCreateComponentShortcut() {
|
|
|
5840
6258
|
|
|
5841
6259
|
// src/populate-store.ts
|
|
5842
6260
|
import { useEffect as useEffect8 } from "react";
|
|
5843
|
-
import { __dispatch as
|
|
6261
|
+
import { __dispatch as dispatch5 } from "@elementor/store";
|
|
5844
6262
|
function PopulateStore() {
|
|
5845
6263
|
useEffect8(() => {
|
|
5846
|
-
|
|
6264
|
+
dispatch5(loadComponents());
|
|
5847
6265
|
}, []);
|
|
5848
6266
|
return null;
|
|
5849
6267
|
}
|
|
5850
6268
|
|
|
5851
6269
|
// src/prevent-circular-nesting.ts
|
|
5852
6270
|
import { getAllDescendants as getAllDescendants5 } from "@elementor/editor-elements";
|
|
5853
|
-
import { notify as
|
|
6271
|
+
import { notify as notify7 } from "@elementor/editor-notifications";
|
|
5854
6272
|
import { blockCommand as blockCommand2 } from "@elementor/editor-v1-adapters";
|
|
5855
|
-
import { __getState as
|
|
5856
|
-
import { __ as
|
|
6273
|
+
import { __getState as getState10 } from "@elementor/store";
|
|
6274
|
+
import { __ as __35 } from "@wordpress/i18n";
|
|
5857
6275
|
var COMPONENT_TYPE = "e-component";
|
|
5858
6276
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
5859
6277
|
type: "default",
|
|
5860
|
-
message:
|
|
6278
|
+
message: __35("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
5861
6279
|
id: "circular-component-nesting-blocked"
|
|
5862
6280
|
};
|
|
5863
6281
|
function initCircularNestingPrevention() {
|
|
@@ -5878,7 +6296,7 @@ function wouldCreateCircularNesting(componentIdToAdd) {
|
|
|
5878
6296
|
if (componentIdToAdd === void 0) {
|
|
5879
6297
|
return false;
|
|
5880
6298
|
}
|
|
5881
|
-
const state =
|
|
6299
|
+
const state = getState10();
|
|
5882
6300
|
const currentComponentId = selectCurrentComponentId(state);
|
|
5883
6301
|
const path = selectPath(state);
|
|
5884
6302
|
if (currentComponentId === null) {
|
|
@@ -5934,7 +6352,7 @@ function blockCircularCreate(args) {
|
|
|
5934
6352
|
}
|
|
5935
6353
|
const isBlocked = wouldCreateCircularNesting(componentId);
|
|
5936
6354
|
if (isBlocked) {
|
|
5937
|
-
|
|
6355
|
+
notify7(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5938
6356
|
}
|
|
5939
6357
|
return isBlocked;
|
|
5940
6358
|
}
|
|
@@ -5954,7 +6372,7 @@ function blockCircularMove(args) {
|
|
|
5954
6372
|
});
|
|
5955
6373
|
});
|
|
5956
6374
|
if (hasCircularComponent) {
|
|
5957
|
-
|
|
6375
|
+
notify7(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5958
6376
|
}
|
|
5959
6377
|
return hasCircularComponent;
|
|
5960
6378
|
}
|
|
@@ -5970,21 +6388,21 @@ function blockCircularPaste(args) {
|
|
|
5970
6388
|
const allComponentIds = extractComponentIdsFromElements(data.clipboard.elements);
|
|
5971
6389
|
const hasCircularComponent = allComponentIds.some(wouldCreateCircularNesting);
|
|
5972
6390
|
if (hasCircularComponent) {
|
|
5973
|
-
|
|
6391
|
+
notify7(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5974
6392
|
}
|
|
5975
6393
|
return hasCircularComponent;
|
|
5976
6394
|
}
|
|
5977
6395
|
|
|
5978
6396
|
// src/store/actions/remove-component-styles.ts
|
|
5979
|
-
import { __dispatch as
|
|
6397
|
+
import { __dispatch as dispatch6 } from "@elementor/store";
|
|
5980
6398
|
function removeComponentStyles(id2) {
|
|
5981
6399
|
apiClient.invalidateComponentConfigCache(id2);
|
|
5982
|
-
|
|
6400
|
+
dispatch6(slice.actions.removeStyles({ id: id2 }));
|
|
5983
6401
|
}
|
|
5984
6402
|
|
|
5985
6403
|
// src/store/components-styles-provider.ts
|
|
5986
6404
|
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
5987
|
-
import { __getState as
|
|
6405
|
+
import { __getState as getState11, __subscribeWithSelector as subscribeWithSelector } from "@elementor/store";
|
|
5988
6406
|
var componentsStylesProvider = createStylesProvider({
|
|
5989
6407
|
key: "components-styles",
|
|
5990
6408
|
priority: 100,
|
|
@@ -5996,10 +6414,10 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
5996
6414
|
),
|
|
5997
6415
|
actions: {
|
|
5998
6416
|
all: () => {
|
|
5999
|
-
return selectFlatStyles(
|
|
6417
|
+
return selectFlatStyles(getState11());
|
|
6000
6418
|
},
|
|
6001
6419
|
get: (id2) => {
|
|
6002
|
-
return selectFlatStyles(
|
|
6420
|
+
return selectFlatStyles(getState11()).find((style) => style.id === id2) ?? null;
|
|
6003
6421
|
}
|
|
6004
6422
|
}
|
|
6005
6423
|
});
|
|
@@ -6031,13 +6449,17 @@ function init() {
|
|
|
6031
6449
|
stylesRepository.register(componentsStylesProvider);
|
|
6032
6450
|
registerSlice(slice);
|
|
6033
6451
|
registerElementType(
|
|
6034
|
-
|
|
6035
|
-
(options) => createComponentType({
|
|
6452
|
+
COMPONENT_WIDGET_TYPE2,
|
|
6453
|
+
(options) => createComponentType({
|
|
6454
|
+
...options,
|
|
6455
|
+
showLockedByModal: openEditModeDialog,
|
|
6456
|
+
showDetachConfirmDialog: openDetachConfirmDialog
|
|
6457
|
+
})
|
|
6036
6458
|
);
|
|
6037
6459
|
window.elementorCommon.__beforeSave = beforeSave2;
|
|
6038
6460
|
injectTab({
|
|
6039
6461
|
id: "components",
|
|
6040
|
-
label:
|
|
6462
|
+
label: __36("Components", "elementor"),
|
|
6041
6463
|
component: Components,
|
|
6042
6464
|
position: 1
|
|
6043
6465
|
});
|
|
@@ -6074,13 +6496,14 @@ function init() {
|
|
|
6074
6496
|
}
|
|
6075
6497
|
}
|
|
6076
6498
|
export {
|
|
6077
|
-
COMPONENT_WIDGET_TYPE,
|
|
6499
|
+
COMPONENT_WIDGET_TYPE2 as COMPONENT_WIDGET_TYPE,
|
|
6078
6500
|
ComponentInstanceProvider,
|
|
6079
6501
|
ComponentItem,
|
|
6080
6502
|
ComponentName,
|
|
6081
6503
|
ComponentSearch,
|
|
6082
6504
|
EmptyState as ComponentsEmptyState,
|
|
6083
6505
|
ComponentsList,
|
|
6506
|
+
DetachAction,
|
|
6084
6507
|
EditComponentAction,
|
|
6085
6508
|
EmptySearchResult,
|
|
6086
6509
|
EmptyState2 as InstanceEmptyState,
|