@elementor/editor-components 4.0.0-663 → 4.0.0-665
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +1246 -845
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1013 -613
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/detach-instance-confirmation-dialog.tsx +50 -0
- package/src/components/instance-editing-panel/detach-action.tsx +76 -0
- package/src/components/instance-editing-panel/instance-editing-panel.tsx +12 -5
- package/src/components/instance-editing-panel/use-instance-panel-data.ts +2 -2
- package/src/consts.ts +1 -0
- package/src/create-component-type.ts +60 -22
- package/src/index.ts +1 -0
- package/src/init.ts +6 -1
- package/src/types.ts +1 -1
- package/src/utils/detach-component-instance/detach-component-instance.ts +172 -0
- package/src/utils/detach-component-instance/index.ts +1 -0
- package/src/utils/detach-component-instance/regenerate-local-style-ids.ts +53 -0
- package/src/utils/detach-component-instance/resolve-detached-instance.ts +94 -0
- package/src/utils/detach-component-instance/resolve-overridable-settings.ts +121 -0
- package/src/utils/is-component-instance.ts +1 -1
- package/src/utils/tracking.ts +2 -1
package/dist/index.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,15 +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 { notify } from "@elementor/editor-notifications";
|
|
1629
|
-
import { __getState as
|
|
2158
|
+
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2159
|
+
import { __getState as getState8 } from "@elementor/store";
|
|
1630
2160
|
import { hasProInstalled } from "@elementor/utils";
|
|
1631
|
-
import { __ as
|
|
2161
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1632
2162
|
|
|
1633
2163
|
// src/utils/format-component-elements-id.ts
|
|
1634
2164
|
import { hashString } from "@elementor/utils";
|
|
@@ -1690,62 +2220,23 @@ function buildUniqueSelector(element) {
|
|
|
1690
2220
|
current = current.parentElement?.closest("[data-id]") ?? null;
|
|
1691
2221
|
}
|
|
1692
2222
|
if (selectors.length === 0) {
|
|
1693
|
-
const closestElement = element.closest("[data-id]");
|
|
1694
|
-
if (closestElement?.dataset?.id) {
|
|
1695
|
-
return `[data-id="${closestElement.dataset.id}"]`;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
return selectors.join(" ");
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
// src/utils/tracking.ts
|
|
1702
|
-
import { getMixpanel } from "@elementor/events";
|
|
1703
|
-
import { __getState as getState4 } from "@elementor/store";
|
|
1704
|
-
var FEATURE_NAME = "Components";
|
|
1705
|
-
var trackComponentEvent = ({ action, source, ...data }) => {
|
|
1706
|
-
if (source === "system") {
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
const { dispatchEvent, config } = getMixpanel();
|
|
1710
|
-
if (!config?.names?.components?.[action]) {
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
const name = config.names.components[action];
|
|
1714
|
-
dispatchEvent?.(name, { ...data, source, "Feature name": FEATURE_NAME });
|
|
1715
|
-
};
|
|
1716
|
-
var onElementDrop = (_args, element) => {
|
|
1717
|
-
if (!(element?.model?.get("widgetType") === "e-component")) {
|
|
1718
|
-
return;
|
|
1719
|
-
}
|
|
1720
|
-
const editorSettings = element.model.get("editor_settings");
|
|
1721
|
-
const componentName = editorSettings?.title;
|
|
1722
|
-
const componentUID = editorSettings?.component_uid;
|
|
1723
|
-
const instanceId = element.id;
|
|
1724
|
-
const createdThisSession = selectCreatedThisSession(getState4());
|
|
1725
|
-
const isSameSessionReuse = componentUID && createdThisSession.includes(componentUID);
|
|
1726
|
-
const eventsManagerConfig = window.elementorCommon.eventsManager.config;
|
|
1727
|
-
const { locations, secondaryLocations } = eventsManagerConfig;
|
|
1728
|
-
trackComponentEvent({
|
|
1729
|
-
action: "instanceAdded",
|
|
1730
|
-
source: "user",
|
|
1731
|
-
instance_id: instanceId,
|
|
1732
|
-
component_uid: componentUID,
|
|
1733
|
-
component_name: componentName,
|
|
1734
|
-
is_same_session_reuse: isSameSessionReuse,
|
|
1735
|
-
location: locations.widgetPanel,
|
|
1736
|
-
secondary_location: secondaryLocations.componentsTab
|
|
1737
|
-
});
|
|
1738
|
-
};
|
|
2223
|
+
const closestElement = element.closest("[data-id]");
|
|
2224
|
+
if (closestElement?.dataset?.id) {
|
|
2225
|
+
return `[data-id="${closestElement.dataset.id}"]`;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
return selectors.join(" ");
|
|
2229
|
+
}
|
|
1739
2230
|
|
|
1740
2231
|
// src/create-component-type.ts
|
|
1741
|
-
var
|
|
2232
|
+
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
1742
2233
|
var EDIT_COMPONENT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
1743
2234
|
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
1744
2235
|
function notifyComponentEditUpgrade() {
|
|
1745
|
-
|
|
2236
|
+
notify2({
|
|
1746
2237
|
type: "promotion",
|
|
1747
2238
|
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
1748
|
-
message:
|
|
2239
|
+
message: __10("Your Pro subscription has expired. Renew to edit components.", "elementor"),
|
|
1749
2240
|
additionalActionProps: [
|
|
1750
2241
|
{
|
|
1751
2242
|
size: "small",
|
|
@@ -1753,7 +2244,7 @@ function notifyComponentEditUpgrade() {
|
|
|
1753
2244
|
color: "promotion",
|
|
1754
2245
|
href: EDIT_COMPONENT_UPGRADE_URL,
|
|
1755
2246
|
target: "_blank",
|
|
1756
|
-
children:
|
|
2247
|
+
children: __10("Upgrade Now", "elementor")
|
|
1757
2248
|
}
|
|
1758
2249
|
]
|
|
1759
2250
|
});
|
|
@@ -1768,7 +2259,7 @@ var updateGroups = (groups, config) => {
|
|
|
1768
2259
|
(action) => disabledActions.includes(action.name) ? { ...action, isEnabled: () => false } : action
|
|
1769
2260
|
);
|
|
1770
2261
|
if (addConfig) {
|
|
1771
|
-
updatedActions.splice(addConfig.index, 0, addConfig.
|
|
2262
|
+
updatedActions.splice(addConfig.index, 0, ...addConfig.actions);
|
|
1772
2263
|
}
|
|
1773
2264
|
return { ...group, actions: updatedActions };
|
|
1774
2265
|
});
|
|
@@ -1867,26 +2358,35 @@ function createComponentView(options) {
|
|
|
1867
2358
|
_getContextMenuConfig() {
|
|
1868
2359
|
const isAdministrator = isUserAdministrator();
|
|
1869
2360
|
const hasPro = hasProInstalled();
|
|
1870
|
-
const proLabel =
|
|
2361
|
+
const proLabel = __10("PRO", "elementor");
|
|
1871
2362
|
const badgeClass = "elementor-context-menu-list__item__shortcut__new-badge";
|
|
1872
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];
|
|
1873
2380
|
const addedGroup = {
|
|
1874
2381
|
general: {
|
|
1875
2382
|
index: 1,
|
|
1876
|
-
|
|
1877
|
-
name: "edit component",
|
|
1878
|
-
icon: "eicon-edit",
|
|
1879
|
-
title: () => __7("Edit Component", "elementor"),
|
|
1880
|
-
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
1881
|
-
isEnabled: () => hasPro,
|
|
1882
|
-
callback: (_, eventData) => this.editComponent(eventData)
|
|
1883
|
-
}
|
|
2383
|
+
actions
|
|
1884
2384
|
}
|
|
1885
2385
|
};
|
|
1886
2386
|
const disabledGroup = {
|
|
1887
2387
|
clipboard: ["pasteStyle", "resetStyle"]
|
|
1888
2388
|
};
|
|
1889
|
-
return { add:
|
|
2389
|
+
return { add: addedGroup, disable: disabledGroup };
|
|
1890
2390
|
}
|
|
1891
2391
|
async switchDocument() {
|
|
1892
2392
|
const { isAllowedToSwitchDocument, lockedBy } = await apiClient.getComponentLockStatus(
|
|
@@ -1915,6 +2415,29 @@ function createComponentView(options) {
|
|
|
1915
2415
|
trigger
|
|
1916
2416
|
});
|
|
1917
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
|
+
}
|
|
1918
2441
|
handleDblClick(e) {
|
|
1919
2442
|
e.stopPropagation();
|
|
1920
2443
|
if (!isUserAdministrator()) {
|
|
@@ -1986,7 +2509,7 @@ function createComponentModel() {
|
|
|
1986
2509
|
}
|
|
1987
2510
|
const componentUid = editorSettings?.component_uid;
|
|
1988
2511
|
if (componentUid) {
|
|
1989
|
-
const component = selectComponentByUid(
|
|
2512
|
+
const component = selectComponentByUid(getState8(), componentUid);
|
|
1990
2513
|
if (component?.name) {
|
|
1991
2514
|
return component.name;
|
|
1992
2515
|
}
|
|
@@ -2006,134 +2529,6 @@ function createComponentModel() {
|
|
|
2006
2529
|
});
|
|
2007
2530
|
}
|
|
2008
2531
|
|
|
2009
|
-
// src/utils/is-component-instance.ts
|
|
2010
|
-
function isComponentInstance(elementModel) {
|
|
2011
|
-
return [elementModel.widgetType, elementModel.elType].includes(COMPONENT_WIDGET_TYPE);
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
// src/utils/get-component-documents.ts
|
|
2015
|
-
async function getComponentDocuments(elements, cache = /* @__PURE__ */ new Map()) {
|
|
2016
|
-
const componentIds = await getComponentIds(elements, cache);
|
|
2017
|
-
return getDocumentsMap(componentIds, cache);
|
|
2018
|
-
}
|
|
2019
|
-
async function getComponentIds(elements, cache) {
|
|
2020
|
-
const results = await Promise.all(
|
|
2021
|
-
elements.map(async ({ widgetType, elType, elements: childElements, settings }) => {
|
|
2022
|
-
const ids = [];
|
|
2023
|
-
if (isComponentInstance({ widgetType, elType })) {
|
|
2024
|
-
const componentId = settings?.component_instance?.value?.component_id.value;
|
|
2025
|
-
if (!componentId) {
|
|
2026
|
-
return ids;
|
|
2027
|
-
}
|
|
2028
|
-
ids.push(componentId);
|
|
2029
|
-
if (!cache.has(componentId)) {
|
|
2030
|
-
cache.set(componentId, getComponentDocumentData(componentId));
|
|
2031
|
-
}
|
|
2032
|
-
const doc = await cache.get(componentId);
|
|
2033
|
-
childElements = doc?.elements;
|
|
2034
|
-
}
|
|
2035
|
-
if (childElements?.length) {
|
|
2036
|
-
const childIds = await getComponentIds(childElements, cache);
|
|
2037
|
-
ids.push(...childIds);
|
|
2038
|
-
}
|
|
2039
|
-
return ids;
|
|
2040
|
-
})
|
|
2041
|
-
);
|
|
2042
|
-
return [...new Set(results.flat())];
|
|
2043
|
-
}
|
|
2044
|
-
async function getDocumentsMap(ids, cache) {
|
|
2045
|
-
const documents = await Promise.all(
|
|
2046
|
-
ids.map(async (id2) => {
|
|
2047
|
-
const document = await cache.get(id2);
|
|
2048
|
-
if (!document) {
|
|
2049
|
-
return null;
|
|
2050
|
-
}
|
|
2051
|
-
return [id2, document];
|
|
2052
|
-
})
|
|
2053
|
-
);
|
|
2054
|
-
return new Map(documents.filter((document) => document !== null));
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
// src/store/actions/load-components-overridable-props.ts
|
|
2058
|
-
import { __dispatch as dispatch2, __getState as getState6 } from "@elementor/store";
|
|
2059
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2060
|
-
if (!componentIds.length) {
|
|
2061
|
-
return;
|
|
2062
|
-
}
|
|
2063
|
-
return Promise.all(componentIds.map(loadComponentOverrides));
|
|
2064
|
-
}
|
|
2065
|
-
async function loadComponentOverrides(componentId) {
|
|
2066
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded(getState6(), componentId);
|
|
2067
|
-
if (isOverridablePropsLoaded) {
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2071
|
-
if (!overridableProps) {
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
dispatch2(
|
|
2075
|
-
slice.actions.setOverridableProps({
|
|
2076
|
-
componentId,
|
|
2077
|
-
overridableProps
|
|
2078
|
-
})
|
|
2079
|
-
);
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
// src/store/actions/load-components-styles.ts
|
|
2083
|
-
import { __dispatch as dispatch3, __getState as getState7 } from "@elementor/store";
|
|
2084
|
-
function loadComponentsStyles(documents) {
|
|
2085
|
-
if (!documents.size) {
|
|
2086
|
-
return;
|
|
2087
|
-
}
|
|
2088
|
-
const knownComponents = selectStyles(getState7());
|
|
2089
|
-
const unknownDocuments = new Map([...documents.entries()].filter(([id2]) => !knownComponents[id2]));
|
|
2090
|
-
if (!unknownDocuments.size) {
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
addStyles(unknownDocuments);
|
|
2094
|
-
}
|
|
2095
|
-
function addStyles(documents) {
|
|
2096
|
-
const styles = Object.fromEntries(
|
|
2097
|
-
[...documents.entries()].map(([id2, document]) => [id2, extractStylesFromDocument(document)])
|
|
2098
|
-
);
|
|
2099
|
-
dispatch3(slice.actions.addStyles(styles));
|
|
2100
|
-
}
|
|
2101
|
-
function extractStylesFromDocument(document) {
|
|
2102
|
-
if (!document.elements?.length) {
|
|
2103
|
-
return [];
|
|
2104
|
-
}
|
|
2105
|
-
return document.elements.flatMap(extractStylesFromElement);
|
|
2106
|
-
}
|
|
2107
|
-
function extractStylesFromElement(element) {
|
|
2108
|
-
return [
|
|
2109
|
-
...Object.values(element.styles ?? {}),
|
|
2110
|
-
...(element.elements ?? []).flatMap(extractStylesFromElement)
|
|
2111
|
-
];
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
// src/store/actions/load-components-assets.ts
|
|
2115
|
-
async function loadComponentsAssets(elements) {
|
|
2116
|
-
const documents = await getComponentDocuments(elements);
|
|
2117
|
-
updateDocumentState(documents);
|
|
2118
|
-
loadComponentsStyles(documents);
|
|
2119
|
-
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2120
|
-
}
|
|
2121
|
-
function updateDocumentState(documents) {
|
|
2122
|
-
const isDrafted = [...documents.values()].some(isDocumentDirty);
|
|
2123
|
-
if (isDrafted) {
|
|
2124
|
-
setDocumentModifiedStatus(true);
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
// src/components/load-template-components.tsx
|
|
2129
|
-
var LoadTemplateComponents = () => {
|
|
2130
|
-
const templates = useLoadedTemplates();
|
|
2131
|
-
useEffect(() => {
|
|
2132
|
-
loadComponentsAssets(templates.flatMap((elements) => elements ?? []));
|
|
2133
|
-
}, [templates]);
|
|
2134
|
-
return null;
|
|
2135
|
-
};
|
|
2136
|
-
|
|
2137
2532
|
// src/extended/init.ts
|
|
2138
2533
|
import { injectIntoLogic, injectIntoTop } from "@elementor/editor";
|
|
2139
2534
|
import { registerControlReplacement } from "@elementor/editor-controls";
|
|
@@ -2147,18 +2542,18 @@ import {
|
|
|
2147
2542
|
import { registerTab } from "@elementor/editor-elements-panel";
|
|
2148
2543
|
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
2149
2544
|
import { registerDataHook as registerDataHook4 } from "@elementor/editor-v1-adapters";
|
|
2150
|
-
import { __ as
|
|
2545
|
+
import { __ as __34 } from "@wordpress/i18n";
|
|
2151
2546
|
|
|
2152
2547
|
// src/extended/components/component-panel-header/component-panel-header.tsx
|
|
2153
|
-
import * as
|
|
2548
|
+
import * as React29 from "react";
|
|
2154
2549
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
2155
2550
|
import { getV1DocumentsManager as getV1DocumentsManager3 } from "@elementor/editor-documents";
|
|
2156
2551
|
import { PanelHeader as PanelHeader3 } from "@elementor/editor-panels";
|
|
2157
2552
|
import { EllipsisWithTooltip as EllipsisWithTooltip4 } from "@elementor/editor-ui";
|
|
2158
2553
|
import { ArrowLeftIcon, ComponentsFilledIcon } from "@elementor/icons";
|
|
2159
|
-
import { __getState as
|
|
2554
|
+
import { __getState as getState9 } from "@elementor/store";
|
|
2160
2555
|
import { Box as Box15, Divider as Divider4, IconButton as IconButton5, Tooltip as Tooltip5, Typography as Typography11 } from "@elementor/ui";
|
|
2161
|
-
import { __ as
|
|
2556
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2162
2557
|
|
|
2163
2558
|
// src/extended/hooks/use-navigate-back.ts
|
|
2164
2559
|
import { useCallback } from "react";
|
|
@@ -2178,11 +2573,11 @@ function useNavigateBack() {
|
|
|
2178
2573
|
}
|
|
2179
2574
|
|
|
2180
2575
|
// src/extended/components/component-introduction.tsx
|
|
2181
|
-
import * as
|
|
2576
|
+
import * as React20 from "react";
|
|
2182
2577
|
import { PopoverContent } from "@elementor/editor-controls";
|
|
2183
2578
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
2184
|
-
import { Box as Box9, Button as Button3, Image, Link as Link2, Popover, Stack as
|
|
2185
|
-
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";
|
|
2186
2581
|
var ComponentIntroduction = ({
|
|
2187
2582
|
anchorRef,
|
|
2188
2583
|
shouldShowIntroduction,
|
|
@@ -2191,7 +2586,7 @@ var ComponentIntroduction = ({
|
|
|
2191
2586
|
if (!anchorRef.current || !shouldShowIntroduction) {
|
|
2192
2587
|
return null;
|
|
2193
2588
|
}
|
|
2194
|
-
return /* @__PURE__ */
|
|
2589
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2195
2590
|
Popover,
|
|
2196
2591
|
{
|
|
2197
2592
|
anchorEl: anchorRef.current,
|
|
@@ -2206,20 +2601,20 @@ var ComponentIntroduction = ({
|
|
|
2206
2601
|
},
|
|
2207
2602
|
onClose
|
|
2208
2603
|
},
|
|
2209
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ React20.createElement(Box9, { sx: { width: "296px" } }, /* @__PURE__ */ React20.createElement(PopoverHeader, { title: __11("Add your first property", "elementor"), onClose }), /* @__PURE__ */ React20.createElement(
|
|
2210
2605
|
Image,
|
|
2211
2606
|
{
|
|
2212
2607
|
sx: { width: "296px", height: "160px" },
|
|
2213
2608
|
src: "https://assets.elementor.com/packages/v1/images/components-properties-intro.png",
|
|
2214
2609
|
alt: ""
|
|
2215
2610
|
}
|
|
2216
|
-
), /* @__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(
|
|
2217
2612
|
"Select any Element, then in the General tab, click next to any setting you want users to customize - like text, images, or links.",
|
|
2218
2613
|
"elementor"
|
|
2219
|
-
)), /* @__PURE__ */
|
|
2614
|
+
)), /* @__PURE__ */ React20.createElement(Typography6, { variant: "body2", sx: { mt: 2 } }, __11(
|
|
2220
2615
|
"Your properties will appear in the Properties panel, where you can organize and manage them anytime.",
|
|
2221
2616
|
"elementor"
|
|
2222
|
-
)), /* @__PURE__ */
|
|
2617
|
+
)), /* @__PURE__ */ React20.createElement(
|
|
2223
2618
|
Link2,
|
|
2224
2619
|
{
|
|
2225
2620
|
href: "http://go.elementor.com/components-guide",
|
|
@@ -2228,28 +2623,28 @@ var ComponentIntroduction = ({
|
|
|
2228
2623
|
color: "info.main",
|
|
2229
2624
|
variant: "body2"
|
|
2230
2625
|
},
|
|
2231
|
-
|
|
2232
|
-
), /* @__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"))))))
|
|
2233
2628
|
);
|
|
2234
2629
|
};
|
|
2235
2630
|
|
|
2236
2631
|
// src/extended/components/component-properties-panel/component-properties-panel.tsx
|
|
2237
|
-
import * as
|
|
2632
|
+
import * as React27 from "react";
|
|
2238
2633
|
import { usePanelActions as useEditingPanelActions } from "@elementor/editor-editing-panel";
|
|
2239
2634
|
import { __createPanel as createPanel, Panel } from "@elementor/editor-panels";
|
|
2240
2635
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
2241
2636
|
import { Alert, Box as Box13, ErrorBoundary } from "@elementor/ui";
|
|
2242
|
-
import { __ as
|
|
2637
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2243
2638
|
|
|
2244
2639
|
// src/extended/components/component-properties-panel/component-properties-panel-content.tsx
|
|
2245
|
-
import * as
|
|
2246
|
-
import { useMemo, useRef, useState as
|
|
2640
|
+
import * as React26 from "react";
|
|
2641
|
+
import { useMemo, useRef, useState as useState5 } from "react";
|
|
2247
2642
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus3 } from "@elementor/editor-documents";
|
|
2248
2643
|
import { PanelBody as PanelBody2, PanelHeader as PanelHeader2, PanelHeaderTitle as PanelHeaderTitle2 } from "@elementor/editor-panels";
|
|
2249
2644
|
import { ComponentPropListIcon as ComponentPropListIcon3, FolderPlusIcon, XIcon as XIcon2 } from "@elementor/icons";
|
|
2250
|
-
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";
|
|
2251
2646
|
import { generateUniqueId as generateUniqueId2 } from "@elementor/utils";
|
|
2252
|
-
import { __ as
|
|
2647
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2253
2648
|
|
|
2254
2649
|
// src/extended/store/actions/add-overridable-group.ts
|
|
2255
2650
|
function addOverridableGroup({
|
|
@@ -2290,7 +2685,7 @@ function addOverridableGroup({
|
|
|
2290
2685
|
|
|
2291
2686
|
// src/extended/store/utils/groups-transformers.ts
|
|
2292
2687
|
import { generateUniqueId } from "@elementor/utils";
|
|
2293
|
-
import { __ as
|
|
2688
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
2294
2689
|
function removePropFromAllGroups(groups, propKey) {
|
|
2295
2690
|
const propKeys = Array.isArray(propKey) ? propKey : [propKey];
|
|
2296
2691
|
return {
|
|
@@ -2359,7 +2754,7 @@ function resolveOrCreateGroup(groups, requestedGroupId) {
|
|
|
2359
2754
|
}
|
|
2360
2755
|
function createGroup(groups, groupId, label) {
|
|
2361
2756
|
const newGroupId = groupId || generateUniqueId("group");
|
|
2362
|
-
const newLabel = label ||
|
|
2757
|
+
const newLabel = label || __12("Default", "elementor");
|
|
2363
2758
|
return {
|
|
2364
2759
|
groups: {
|
|
2365
2760
|
...groups,
|
|
@@ -2454,12 +2849,12 @@ function deleteOverridableGroup({ componentId, groupId }) {
|
|
|
2454
2849
|
// src/extended/utils/revert-overridable-settings.ts
|
|
2455
2850
|
import {
|
|
2456
2851
|
getAllDescendants,
|
|
2457
|
-
getContainer as
|
|
2852
|
+
getContainer as getContainer3,
|
|
2458
2853
|
getElementSetting,
|
|
2459
2854
|
updateElementSettings
|
|
2460
2855
|
} from "@elementor/editor-elements";
|
|
2461
2856
|
function revertElementOverridableSetting(elementId, settingKey, originValue, overrideKey) {
|
|
2462
|
-
const container =
|
|
2857
|
+
const container = getContainer3(elementId);
|
|
2463
2858
|
if (!container) {
|
|
2464
2859
|
return;
|
|
2465
2860
|
}
|
|
@@ -2551,7 +2946,7 @@ function revertComponentInstanceSettings(settings) {
|
|
|
2551
2946
|
}
|
|
2552
2947
|
function revertAllOverridablesInContainer(container) {
|
|
2553
2948
|
getAllDescendants(container).forEach((element) => {
|
|
2554
|
-
if (element.model.get("widgetType") ===
|
|
2949
|
+
if (element.model.get("widgetType") === COMPONENT_WIDGET_TYPE2) {
|
|
2555
2950
|
revertComponentInstanceOverridesInElement(element);
|
|
2556
2951
|
} else {
|
|
2557
2952
|
revertElementSettings(element);
|
|
@@ -2706,15 +3101,15 @@ function updateOverridablePropParams({
|
|
|
2706
3101
|
}
|
|
2707
3102
|
|
|
2708
3103
|
// src/extended/components/component-properties-panel/properties-empty-state.tsx
|
|
2709
|
-
import * as
|
|
2710
|
-
import { useState } from "react";
|
|
3104
|
+
import * as React21 from "react";
|
|
3105
|
+
import { useState as useState2 } from "react";
|
|
2711
3106
|
import { ComponentPropListIcon as ComponentPropListIcon2 } from "@elementor/icons";
|
|
2712
|
-
import { Link as Link3, Stack as
|
|
2713
|
-
import { __ as
|
|
3107
|
+
import { Link as Link3, Stack as Stack13, Typography as Typography7 } from "@elementor/ui";
|
|
3108
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2714
3109
|
function PropertiesEmptyState({ introductionRef }) {
|
|
2715
|
-
const [isOpen, setIsOpen] =
|
|
2716
|
-
return /* @__PURE__ */
|
|
2717
|
-
|
|
3110
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
3111
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
3112
|
+
Stack13,
|
|
2718
3113
|
{
|
|
2719
3114
|
alignItems: "center",
|
|
2720
3115
|
justifyContent: "flex-start",
|
|
@@ -2723,11 +3118,11 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2723
3118
|
sx: { px: 2.5, pt: 10, pb: 5.5 },
|
|
2724
3119
|
gap: 1
|
|
2725
3120
|
},
|
|
2726
|
-
/* @__PURE__ */
|
|
2727
|
-
/* @__PURE__ */
|
|
2728
|
-
/* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__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(
|
|
2731
3126
|
Link3,
|
|
2732
3127
|
{
|
|
2733
3128
|
variant: "caption",
|
|
@@ -2735,9 +3130,9 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2735
3130
|
sx: { textDecorationLine: "underline" },
|
|
2736
3131
|
onClick: () => setIsOpen(true)
|
|
2737
3132
|
},
|
|
2738
|
-
|
|
3133
|
+
__13("Learn more", "elementor")
|
|
2739
3134
|
)
|
|
2740
|
-
), /* @__PURE__ */
|
|
3135
|
+
), /* @__PURE__ */ React21.createElement(
|
|
2741
3136
|
ComponentIntroduction,
|
|
2742
3137
|
{
|
|
2743
3138
|
anchorRef: introductionRef,
|
|
@@ -2748,7 +3143,7 @@ function PropertiesEmptyState({ introductionRef }) {
|
|
|
2748
3143
|
}
|
|
2749
3144
|
|
|
2750
3145
|
// src/extended/components/component-properties-panel/properties-group.tsx
|
|
2751
|
-
import * as
|
|
3146
|
+
import * as React25 from "react";
|
|
2752
3147
|
import { EditableField as EditableField2, EllipsisWithTooltip as EllipsisWithTooltip3, MenuListItem as MenuListItem2 } from "@elementor/editor-ui";
|
|
2753
3148
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
2754
3149
|
import {
|
|
@@ -2758,31 +3153,31 @@ import {
|
|
|
2758
3153
|
IconButton as IconButton3,
|
|
2759
3154
|
List as List2,
|
|
2760
3155
|
Menu,
|
|
2761
|
-
Stack as
|
|
3156
|
+
Stack as Stack15,
|
|
2762
3157
|
Tooltip as Tooltip2,
|
|
2763
3158
|
Typography as Typography10,
|
|
2764
3159
|
usePopupState as usePopupState2
|
|
2765
3160
|
} from "@elementor/ui";
|
|
2766
|
-
import { __ as
|
|
3161
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2767
3162
|
|
|
2768
3163
|
// src/extended/components/component-properties-panel/property-item.tsx
|
|
2769
|
-
import * as
|
|
3164
|
+
import * as React24 from "react";
|
|
2770
3165
|
import { getWidgetsCache as getWidgetsCache2 } from "@elementor/editor-elements";
|
|
2771
3166
|
import { XIcon } from "@elementor/icons";
|
|
2772
3167
|
import { bindPopover, bindTrigger, Box as Box11, IconButton as IconButton2, Popover as Popover2, Typography as Typography9, usePopupState } from "@elementor/ui";
|
|
2773
3168
|
|
|
2774
3169
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2775
|
-
import * as
|
|
2776
|
-
import { useState as
|
|
3170
|
+
import * as React22 from "react";
|
|
3171
|
+
import { useState as useState3 } from "react";
|
|
2777
3172
|
import { Form, MenuListItem } from "@elementor/editor-ui";
|
|
2778
|
-
import { Button as Button4, FormLabel, Grid, Select, Stack as
|
|
2779
|
-
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";
|
|
2780
3175
|
|
|
2781
3176
|
// src/extended/components/overridable-props/utils/validate-prop-label.ts
|
|
2782
|
-
import { __ as
|
|
3177
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2783
3178
|
var ERROR_MESSAGES = {
|
|
2784
|
-
EMPTY_NAME:
|
|
2785
|
-
DUPLICATE_NAME:
|
|
3179
|
+
EMPTY_NAME: __14("Property name is required", "elementor"),
|
|
3180
|
+
DUPLICATE_NAME: __14("Property name already exists", "elementor")
|
|
2786
3181
|
};
|
|
2787
3182
|
function validatePropLabel(label, existingLabels, currentLabel) {
|
|
2788
3183
|
const trimmedLabel = label.trim();
|
|
@@ -2806,17 +3201,17 @@ function validatePropLabel(label, existingLabels, currentLabel) {
|
|
|
2806
3201
|
|
|
2807
3202
|
// src/extended/components/overridable-props/overridable-prop-form.tsx
|
|
2808
3203
|
var SIZE = "tiny";
|
|
2809
|
-
var DEFAULT_GROUP = { value: null, label:
|
|
3204
|
+
var DEFAULT_GROUP = { value: null, label: __15("Default", "elementor") };
|
|
2810
3205
|
function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels = [], sx }) {
|
|
2811
3206
|
const selectGroups = groups?.length ? groups : [DEFAULT_GROUP];
|
|
2812
|
-
const [propLabel, setPropLabel] =
|
|
2813
|
-
const [group, setGroup] =
|
|
2814
|
-
const [error, setError] =
|
|
2815
|
-
const name =
|
|
2816
|
-
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");
|
|
2817
3212
|
const isCreate = currentValue === void 0;
|
|
2818
|
-
const title = isCreate ?
|
|
2819
|
-
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");
|
|
2820
3215
|
const handleSubmit = () => {
|
|
2821
3216
|
const validationResult = validatePropLabel(propLabel ?? "", existingLabels, currentValue?.label);
|
|
2822
3217
|
if (!validationResult.isValid) {
|
|
@@ -2825,8 +3220,8 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2825
3220
|
}
|
|
2826
3221
|
onSubmit({ label: propLabel ?? "", group });
|
|
2827
3222
|
};
|
|
2828
|
-
return /* @__PURE__ */
|
|
2829
|
-
|
|
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,
|
|
2830
3225
|
{
|
|
2831
3226
|
direction: "row",
|
|
2832
3227
|
alignItems: "center",
|
|
@@ -2834,14 +3229,14 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2834
3229
|
px: 1.5,
|
|
2835
3230
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%", mb: 1.5 }
|
|
2836
3231
|
},
|
|
2837
|
-
/* @__PURE__ */
|
|
2838
|
-
), /* @__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(
|
|
2839
3234
|
TextField2,
|
|
2840
3235
|
{
|
|
2841
3236
|
name,
|
|
2842
3237
|
size: SIZE,
|
|
2843
3238
|
fullWidth: true,
|
|
2844
|
-
placeholder:
|
|
3239
|
+
placeholder: __15("Enter value", "elementor"),
|
|
2845
3240
|
value: propLabel ?? "",
|
|
2846
3241
|
onChange: (e) => {
|
|
2847
3242
|
const newValue = e.target.value;
|
|
@@ -2856,7 +3251,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2856
3251
|
error: Boolean(error),
|
|
2857
3252
|
helperText: error
|
|
2858
3253
|
}
|
|
2859
|
-
))), /* @__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(
|
|
2860
3255
|
Select,
|
|
2861
3256
|
{
|
|
2862
3257
|
name: groupName,
|
|
@@ -2872,8 +3267,8 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2872
3267
|
return selectGroups.find(({ value }) => value === selectedValue)?.label ?? selectedValue;
|
|
2873
3268
|
}
|
|
2874
3269
|
},
|
|
2875
|
-
selectGroups.map(({ label: groupLabel, ...props }) => /* @__PURE__ */
|
|
2876
|
-
))), /* @__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(
|
|
2877
3272
|
Button4,
|
|
2878
3273
|
{
|
|
2879
3274
|
type: "submit",
|
|
@@ -2887,7 +3282,7 @@ function OverridablePropForm({ onSubmit, groups, currentValue, existingLabels =
|
|
|
2887
3282
|
}
|
|
2888
3283
|
|
|
2889
3284
|
// src/extended/components/component-properties-panel/sortable.tsx
|
|
2890
|
-
import * as
|
|
3285
|
+
import * as React23 from "react";
|
|
2891
3286
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
2892
3287
|
import {
|
|
2893
3288
|
Box as Box10,
|
|
@@ -2895,8 +3290,8 @@ import {
|
|
|
2895
3290
|
UnstableSortableItem,
|
|
2896
3291
|
UnstableSortableProvider
|
|
2897
3292
|
} from "@elementor/ui";
|
|
2898
|
-
var SortableProvider = (props) => /* @__PURE__ */
|
|
2899
|
-
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(
|
|
2900
3295
|
StyledSortableTrigger,
|
|
2901
3296
|
{
|
|
2902
3297
|
...props,
|
|
@@ -2904,9 +3299,9 @@ var SortableTrigger = ({ triggerClassName, ...props }) => /* @__PURE__ */ React2
|
|
|
2904
3299
|
className: `sortable-trigger ${triggerClassName ?? ""}`.trim(),
|
|
2905
3300
|
"aria-label": "sort"
|
|
2906
3301
|
},
|
|
2907
|
-
/* @__PURE__ */
|
|
3302
|
+
/* @__PURE__ */ React23.createElement(GripVerticalIcon, { fontSize: "tiny" })
|
|
2908
3303
|
);
|
|
2909
|
-
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */
|
|
3304
|
+
var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React23.createElement(
|
|
2910
3305
|
UnstableSortableItem,
|
|
2911
3306
|
{
|
|
2912
3307
|
id: id2,
|
|
@@ -2920,7 +3315,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2920
3315
|
showDropIndication,
|
|
2921
3316
|
isDragOverlay,
|
|
2922
3317
|
isDragPlaceholder
|
|
2923
|
-
}) => /* @__PURE__ */
|
|
3318
|
+
}) => /* @__PURE__ */ React23.createElement(
|
|
2924
3319
|
Box10,
|
|
2925
3320
|
{
|
|
2926
3321
|
...itemProps,
|
|
@@ -2937,7 +3332,7 @@ var SortableItem = ({ children, id: id2 }) => /* @__PURE__ */ React21.createElem
|
|
|
2937
3332
|
triggerProps,
|
|
2938
3333
|
triggerStyle
|
|
2939
3334
|
}),
|
|
2940
|
-
showDropIndication && /* @__PURE__ */
|
|
3335
|
+
showDropIndication && /* @__PURE__ */ React23.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
2941
3336
|
)
|
|
2942
3337
|
}
|
|
2943
3338
|
);
|
|
@@ -2978,7 +3373,7 @@ function PropertyItem({
|
|
|
2978
3373
|
event.stopPropagation();
|
|
2979
3374
|
onDelete(prop.overrideKey);
|
|
2980
3375
|
};
|
|
2981
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(
|
|
2982
3377
|
Box11,
|
|
2983
3378
|
{
|
|
2984
3379
|
...bindTrigger(popoverState),
|
|
@@ -3013,17 +3408,17 @@ function PropertyItem({
|
|
|
3013
3408
|
}
|
|
3014
3409
|
}
|
|
3015
3410
|
},
|
|
3016
|
-
/* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
3411
|
+
/* @__PURE__ */ React24.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
3412
|
+
/* @__PURE__ */ React24.createElement(
|
|
3018
3413
|
Box11,
|
|
3019
3414
|
{
|
|
3020
3415
|
sx: { display: "flex", alignItems: "center", color: "text.primary", fontSize: 12, padding: 0.25 }
|
|
3021
3416
|
},
|
|
3022
|
-
/* @__PURE__ */
|
|
3417
|
+
/* @__PURE__ */ React24.createElement("i", { className: icon })
|
|
3023
3418
|
),
|
|
3024
|
-
/* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
), /* @__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(
|
|
3027
3422
|
Popover2,
|
|
3028
3423
|
{
|
|
3029
3424
|
...popoverProps,
|
|
@@ -3031,7 +3426,7 @@ function PropertyItem({
|
|
|
3031
3426
|
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
3032
3427
|
PaperProps: { sx: { width: popoverState.anchorEl?.getBoundingClientRect().width } }
|
|
3033
3428
|
},
|
|
3034
|
-
/* @__PURE__ */
|
|
3429
|
+
/* @__PURE__ */ React24.createElement(
|
|
3035
3430
|
OverridablePropForm,
|
|
3036
3431
|
{
|
|
3037
3432
|
onSubmit: handleSubmit,
|
|
@@ -3082,14 +3477,14 @@ function PropertiesGroup({
|
|
|
3082
3477
|
popupState.close();
|
|
3083
3478
|
onGroupDelete(group.id);
|
|
3084
3479
|
};
|
|
3085
|
-
return /* @__PURE__ */
|
|
3480
|
+
return /* @__PURE__ */ React25.createElement(
|
|
3086
3481
|
Box12,
|
|
3087
3482
|
{
|
|
3088
3483
|
sx: {
|
|
3089
3484
|
opacity: isDragPlaceholder ? 0.5 : 1
|
|
3090
3485
|
}
|
|
3091
3486
|
},
|
|
3092
|
-
/* @__PURE__ */
|
|
3487
|
+
/* @__PURE__ */ React25.createElement(Stack15, { gap: 1 }, /* @__PURE__ */ React25.createElement(
|
|
3093
3488
|
Box12,
|
|
3094
3489
|
{
|
|
3095
3490
|
className: "group-header",
|
|
@@ -3109,8 +3504,8 @@ function PropertiesGroup({
|
|
|
3109
3504
|
}
|
|
3110
3505
|
}
|
|
3111
3506
|
},
|
|
3112
|
-
/* @__PURE__ */
|
|
3113
|
-
/* @__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(
|
|
3114
3509
|
Box12,
|
|
3115
3510
|
{
|
|
3116
3511
|
sx: {
|
|
@@ -3128,7 +3523,7 @@ function PropertiesGroup({
|
|
|
3128
3523
|
width: "100%"
|
|
3129
3524
|
}
|
|
3130
3525
|
},
|
|
3131
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ React25.createElement(
|
|
3132
3527
|
EditableField2,
|
|
3133
3528
|
{
|
|
3134
3529
|
ref: editableRef,
|
|
@@ -3139,7 +3534,7 @@ function PropertiesGroup({
|
|
|
3139
3534
|
...getEditableProps()
|
|
3140
3535
|
}
|
|
3141
3536
|
)
|
|
3142
|
-
) : /* @__PURE__ */
|
|
3537
|
+
) : /* @__PURE__ */ React25.createElement(
|
|
3143
3538
|
EllipsisWithTooltip3,
|
|
3144
3539
|
{
|
|
3145
3540
|
title: group.label,
|
|
@@ -3147,18 +3542,18 @@ function PropertiesGroup({
|
|
|
3147
3542
|
variant: "caption",
|
|
3148
3543
|
sx: { color: "text.primary", fontWeight: 400, lineHeight: 1.66 }
|
|
3149
3544
|
}
|
|
3150
|
-
), /* @__PURE__ */
|
|
3545
|
+
), /* @__PURE__ */ React25.createElement(
|
|
3151
3546
|
IconButton3,
|
|
3152
3547
|
{
|
|
3153
3548
|
className: "group-menu",
|
|
3154
3549
|
size: "tiny",
|
|
3155
3550
|
sx: { p: 0.25, visibility: isThisGroupEditing ? "visible" : void 0 },
|
|
3156
|
-
"aria-label":
|
|
3551
|
+
"aria-label": __16("Group actions", "elementor"),
|
|
3157
3552
|
...bindTrigger2(popupState)
|
|
3158
3553
|
},
|
|
3159
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ React25.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
3160
3555
|
))
|
|
3161
|
-
), /* @__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(
|
|
3162
3557
|
PropertyItem,
|
|
3163
3558
|
{
|
|
3164
3559
|
prop,
|
|
@@ -3170,27 +3565,27 @@ function PropertiesGroup({
|
|
|
3170
3565
|
onUpdate: (data) => onPropertyUpdate(prop.overrideKey, data)
|
|
3171
3566
|
}
|
|
3172
3567
|
)))))),
|
|
3173
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ React25.createElement(
|
|
3174
3569
|
Menu,
|
|
3175
3570
|
{
|
|
3176
3571
|
...bindMenu(popupState),
|
|
3177
3572
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
3178
3573
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
3179
3574
|
},
|
|
3180
|
-
/* @__PURE__ */
|
|
3181
|
-
/* @__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(
|
|
3182
3577
|
Tooltip2,
|
|
3183
3578
|
{
|
|
3184
|
-
title: hasProperties ?
|
|
3579
|
+
title: hasProperties ? __16("To delete the group, first remove all the properties", "elementor") : "",
|
|
3185
3580
|
placement: "right"
|
|
3186
3581
|
},
|
|
3187
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ React25.createElement("span", null, /* @__PURE__ */ React25.createElement(MenuListItem2, { onClick: handleDeleteClick, disabled: hasProperties }, /* @__PURE__ */ React25.createElement(
|
|
3188
3583
|
Typography10,
|
|
3189
3584
|
{
|
|
3190
3585
|
variant: "caption",
|
|
3191
3586
|
sx: { color: hasProperties ? "text.disabled" : "error.light" }
|
|
3192
3587
|
},
|
|
3193
|
-
|
|
3588
|
+
__16("Delete", "elementor")
|
|
3194
3589
|
)))
|
|
3195
3590
|
)
|
|
3196
3591
|
)
|
|
@@ -3198,10 +3593,10 @@ function PropertiesGroup({
|
|
|
3198
3593
|
}
|
|
3199
3594
|
|
|
3200
3595
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3201
|
-
import { useState as
|
|
3596
|
+
import { useState as useState4 } from "react";
|
|
3202
3597
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus2 } from "@elementor/editor-documents";
|
|
3203
3598
|
import { useEditable } from "@elementor/editor-ui";
|
|
3204
|
-
import { __ as
|
|
3599
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
3205
3600
|
|
|
3206
3601
|
// src/extended/store/actions/rename-overridable-group.ts
|
|
3207
3602
|
function renameOverridableGroup({ componentId, groupId, label }) {
|
|
@@ -3222,10 +3617,10 @@ function renameOverridableGroup({ componentId, groupId, label }) {
|
|
|
3222
3617
|
}
|
|
3223
3618
|
|
|
3224
3619
|
// src/extended/components/component-properties-panel/utils/validate-group-label.ts
|
|
3225
|
-
import { __ as
|
|
3620
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
3226
3621
|
var ERROR_MESSAGES2 = {
|
|
3227
|
-
EMPTY_NAME:
|
|
3228
|
-
DUPLICATE_NAME:
|
|
3622
|
+
EMPTY_NAME: __17("Group name is required", "elementor"),
|
|
3623
|
+
DUPLICATE_NAME: __17("Group name already exists", "elementor")
|
|
3229
3624
|
};
|
|
3230
3625
|
function validateGroupLabel(label, existingGroups) {
|
|
3231
3626
|
const trimmedLabel = label.trim();
|
|
@@ -3241,7 +3636,7 @@ function validateGroupLabel(label, existingGroups) {
|
|
|
3241
3636
|
|
|
3242
3637
|
// src/extended/components/component-properties-panel/use-current-editable-item.ts
|
|
3243
3638
|
function useCurrentEditableItem() {
|
|
3244
|
-
const [editingGroupId, setEditingGroupId] =
|
|
3639
|
+
const [editingGroupId, setEditingGroupId] = useState4(null);
|
|
3245
3640
|
const currentComponentId = useCurrentComponentId();
|
|
3246
3641
|
const overridableProps = useOverridableProps(currentComponentId);
|
|
3247
3642
|
const allGroupsRecord = overridableProps?.groups?.items ?? {};
|
|
@@ -3254,7 +3649,7 @@ function useCurrentEditableItem() {
|
|
|
3254
3649
|
};
|
|
3255
3650
|
const handleSubmit = (newLabel) => {
|
|
3256
3651
|
if (!editingGroupId || !currentComponentId) {
|
|
3257
|
-
throw new Error(
|
|
3652
|
+
throw new Error(__18("Group ID or component ID is missing", "elementor"));
|
|
3258
3653
|
}
|
|
3259
3654
|
renameOverridableGroup({
|
|
3260
3655
|
componentId: currentComponentId,
|
|
@@ -3307,7 +3702,7 @@ function generateUniqueLabel(groups) {
|
|
|
3307
3702
|
function ComponentPropertiesPanelContent({ onClose }) {
|
|
3308
3703
|
const currentComponentId = useCurrentComponentId();
|
|
3309
3704
|
const overridableProps = useSanitizeOverridableProps(currentComponentId);
|
|
3310
|
-
const [isAddingGroup, setIsAddingGroup] =
|
|
3705
|
+
const [isAddingGroup, setIsAddingGroup] = useState5(false);
|
|
3311
3706
|
const introductionRef = useRef(null);
|
|
3312
3707
|
const groupLabelEditable = useCurrentEditableItem();
|
|
3313
3708
|
const groups = useMemo(() => {
|
|
@@ -3367,24 +3762,24 @@ function ComponentPropertiesPanelContent({ onClose }) {
|
|
|
3367
3762
|
deleteOverridableGroup({ componentId: currentComponentId, groupId });
|
|
3368
3763
|
setDocumentModifiedStatus3(true);
|
|
3369
3764
|
};
|
|
3370
|
-
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(
|
|
3371
3766
|
IconButton4,
|
|
3372
3767
|
{
|
|
3373
3768
|
size: "tiny",
|
|
3374
|
-
"aria-label":
|
|
3769
|
+
"aria-label": __19("Add new group", "elementor"),
|
|
3375
3770
|
onClick: handleAddGroupClick
|
|
3376
3771
|
},
|
|
3377
|
-
/* @__PURE__ */
|
|
3378
|
-
)), /* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ React26.createElement(FolderPlusIcon, { fontSize: "tiny" })
|
|
3773
|
+
)), /* @__PURE__ */ React26.createElement(Tooltip3, { title: __19("Close panel", "elementor") }, /* @__PURE__ */ React26.createElement(
|
|
3379
3774
|
IconButton4,
|
|
3380
3775
|
{
|
|
3381
3776
|
ref: introductionRef,
|
|
3382
3777
|
size: "tiny",
|
|
3383
|
-
"aria-label":
|
|
3778
|
+
"aria-label": __19("Close panel", "elementor"),
|
|
3384
3779
|
onClick: onClose
|
|
3385
3780
|
},
|
|
3386
|
-
/* @__PURE__ */
|
|
3387
|
-
))), /* @__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(
|
|
3388
3783
|
PropertiesGroup,
|
|
3389
3784
|
{
|
|
3390
3785
|
group,
|
|
@@ -3412,7 +3807,7 @@ var { panel, usePanelActions } = createPanel({
|
|
|
3412
3807
|
function ComponentPropertiesPanel() {
|
|
3413
3808
|
const { close: closePanel } = usePanelActions();
|
|
3414
3809
|
const { open: openEditingPanel } = useEditingPanelActions();
|
|
3415
|
-
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(
|
|
3416
3811
|
ComponentPropertiesPanelContent,
|
|
3417
3812
|
{
|
|
3418
3813
|
onClose: () => {
|
|
@@ -3422,18 +3817,18 @@ function ComponentPropertiesPanel() {
|
|
|
3422
3817
|
}
|
|
3423
3818
|
))));
|
|
3424
3819
|
}
|
|
3425
|
-
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"))));
|
|
3426
3821
|
|
|
3427
3822
|
// src/extended/components/component-panel-header/component-badge.tsx
|
|
3428
|
-
import * as
|
|
3823
|
+
import * as React28 from "react";
|
|
3429
3824
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
3430
3825
|
import { ComponentPropListIcon as ComponentPropListIcon4 } from "@elementor/icons";
|
|
3431
3826
|
import { Badge, Box as Box14, keyframes, styled as styled3, ToggleButton, Tooltip as Tooltip4 } from "@elementor/ui";
|
|
3432
|
-
import { __ as
|
|
3433
|
-
var ComponentsBadge =
|
|
3827
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3828
|
+
var ComponentsBadge = React28.forwardRef(({ overridablePropsCount, onClick }, ref) => {
|
|
3434
3829
|
const prevCount = usePrevious(overridablePropsCount);
|
|
3435
3830
|
const isFirstExposedProperty = prevCount === 0 && overridablePropsCount === 1;
|
|
3436
|
-
return /* @__PURE__ */
|
|
3831
|
+
return /* @__PURE__ */ React28.createElement(
|
|
3437
3832
|
StyledBadge,
|
|
3438
3833
|
{
|
|
3439
3834
|
ref,
|
|
@@ -3442,17 +3837,17 @@ var ComponentsBadge = React26.forwardRef(({ overridablePropsCount, onClick }, re
|
|
|
3442
3837
|
invisible: overridablePropsCount === 0,
|
|
3443
3838
|
animate: isFirstExposedProperty,
|
|
3444
3839
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3445
|
-
badgeContent: /* @__PURE__ */
|
|
3840
|
+
badgeContent: /* @__PURE__ */ React28.createElement(Box14, { sx: { animation: !isFirstExposedProperty ? `${slideUp} 300ms ease-out` : "none" } }, overridablePropsCount)
|
|
3446
3841
|
},
|
|
3447
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ React28.createElement(Tooltip4, { title: __21("Component properties", "elementor") }, /* @__PURE__ */ React28.createElement(
|
|
3448
3843
|
ToggleButton,
|
|
3449
3844
|
{
|
|
3450
3845
|
value: "exposed properties",
|
|
3451
3846
|
size: "tiny",
|
|
3452
3847
|
onClick,
|
|
3453
|
-
"aria-label":
|
|
3848
|
+
"aria-label": __21("Component properties", "elementor")
|
|
3454
3849
|
},
|
|
3455
|
-
/* @__PURE__ */
|
|
3850
|
+
/* @__PURE__ */ React28.createElement(ComponentPropListIcon4, { fontSize: "tiny" })
|
|
3456
3851
|
))
|
|
3457
3852
|
);
|
|
3458
3853
|
});
|
|
@@ -3493,10 +3888,10 @@ var ComponentPanelHeader = () => {
|
|
|
3493
3888
|
const onBack = useNavigateBack();
|
|
3494
3889
|
const componentName = getComponentName();
|
|
3495
3890
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(MESSAGE_KEY);
|
|
3496
|
-
const [shouldShowIntroduction, setShouldShowIntroduction] =
|
|
3891
|
+
const [shouldShowIntroduction, setShouldShowIntroduction] = React29.useState(!isMessageSuppressed);
|
|
3497
3892
|
const { open: openPropertiesPanel } = usePanelActions();
|
|
3498
3893
|
const overridablePropsCount = overridableProps ? Object.keys(overridableProps.props).length : 0;
|
|
3499
|
-
const anchorRef =
|
|
3894
|
+
const anchorRef = React29.useRef(null);
|
|
3500
3895
|
if (!currentComponentId) {
|
|
3501
3896
|
return null;
|
|
3502
3897
|
}
|
|
@@ -3513,7 +3908,7 @@ var ComponentPanelHeader = () => {
|
|
|
3513
3908
|
properties_count: overridablePropsCount
|
|
3514
3909
|
});
|
|
3515
3910
|
};
|
|
3516
|
-
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(
|
|
3517
3912
|
EllipsisWithTooltip4,
|
|
3518
3913
|
{
|
|
3519
3914
|
title: componentName,
|
|
@@ -3521,14 +3916,14 @@ var ComponentPanelHeader = () => {
|
|
|
3521
3916
|
variant: "caption",
|
|
3522
3917
|
sx: { fontWeight: 500, flexGrow: 1 }
|
|
3523
3918
|
}
|
|
3524
|
-
), /* @__PURE__ */
|
|
3919
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3525
3920
|
ComponentsBadge,
|
|
3526
3921
|
{
|
|
3527
3922
|
overridablePropsCount,
|
|
3528
3923
|
ref: anchorRef,
|
|
3529
3924
|
onClick: handleOpenPropertiesPanel
|
|
3530
3925
|
}
|
|
3531
|
-
)), /* @__PURE__ */
|
|
3926
|
+
)), /* @__PURE__ */ React29.createElement(Divider4, null), /* @__PURE__ */ React29.createElement(
|
|
3532
3927
|
ComponentIntroduction,
|
|
3533
3928
|
{
|
|
3534
3929
|
anchorRef,
|
|
@@ -3538,7 +3933,7 @@ var ComponentPanelHeader = () => {
|
|
|
3538
3933
|
));
|
|
3539
3934
|
};
|
|
3540
3935
|
function getComponentName() {
|
|
3541
|
-
const state =
|
|
3936
|
+
const state = getState9();
|
|
3542
3937
|
const path = state[SLICE_NAME].path;
|
|
3543
3938
|
const { instanceTitle } = path.at(-1) ?? {};
|
|
3544
3939
|
if (instanceTitle) {
|
|
@@ -3550,34 +3945,34 @@ function getComponentName() {
|
|
|
3550
3945
|
}
|
|
3551
3946
|
|
|
3552
3947
|
// src/extended/components/components-tab/components.tsx
|
|
3553
|
-
import * as
|
|
3948
|
+
import * as React32 from "react";
|
|
3554
3949
|
import { ThemeProvider as ThemeProvider3 } from "@elementor/editor-ui";
|
|
3555
3950
|
import { List as List4 } from "@elementor/ui";
|
|
3556
3951
|
|
|
3557
3952
|
// src/extended/components/components-tab/component-item.tsx
|
|
3558
|
-
import * as
|
|
3559
|
-
import { useRef as useRef4, useState as
|
|
3953
|
+
import * as React31 from "react";
|
|
3954
|
+
import { useRef as useRef4, useState as useState7 } from "react";
|
|
3560
3955
|
import { endDragElementFromPanel, startDragElementFromPanel } from "@elementor/editor-canvas";
|
|
3561
3956
|
import { dropElement } from "@elementor/editor-elements";
|
|
3562
3957
|
import { MenuListItem as MenuListItem3, useEditable as useEditable2, WarningInfotip } from "@elementor/editor-ui";
|
|
3563
3958
|
import { DotsVerticalIcon as DotsVerticalIcon2 } from "@elementor/icons";
|
|
3564
|
-
import { bindMenu as bindMenu2, bindTrigger as bindTrigger3, IconButton as IconButton6, Menu as Menu2, Stack as
|
|
3565
|
-
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";
|
|
3566
3961
|
|
|
3567
3962
|
// src/extended/store/actions/archive-component.ts
|
|
3568
3963
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus4 } from "@elementor/editor-documents";
|
|
3569
|
-
import { notify as
|
|
3570
|
-
import { __ as
|
|
3964
|
+
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
3965
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3571
3966
|
var successNotification = (componentId, componentName) => ({
|
|
3572
3967
|
type: "success",
|
|
3573
3968
|
/* translators: %s: component name */
|
|
3574
|
-
message:
|
|
3969
|
+
message: __23("Successfully deleted component %s", "elementor").replace("%s", componentName),
|
|
3575
3970
|
id: `success-archived-components-notification-${componentId}`
|
|
3576
3971
|
});
|
|
3577
3972
|
var archiveComponent = (componentId, componentName) => {
|
|
3578
3973
|
componentsActions.archive(componentId);
|
|
3579
3974
|
setDocumentModifiedStatus4(true);
|
|
3580
|
-
|
|
3975
|
+
notify3(successNotification(componentId, componentName));
|
|
3581
3976
|
};
|
|
3582
3977
|
|
|
3583
3978
|
// src/extended/store/actions/rename-component.ts
|
|
@@ -3608,21 +4003,21 @@ function findComponentInstancesByUid(documentContainer, componentUid) {
|
|
|
3608
4003
|
return allDescendants.filter((element) => {
|
|
3609
4004
|
const widgetType = element.model.get("widgetType");
|
|
3610
4005
|
const editorSettings = element.model.get("editor_settings");
|
|
3611
|
-
const isMatch = widgetType ===
|
|
4006
|
+
const isMatch = widgetType === COMPONENT_WIDGET_TYPE2 && editorSettings?.component_uid === componentUid;
|
|
3612
4007
|
return isMatch;
|
|
3613
4008
|
});
|
|
3614
4009
|
}
|
|
3615
4010
|
|
|
3616
4011
|
// src/extended/utils/component-form-schema.ts
|
|
3617
4012
|
import { z as z5 } from "@elementor/schema";
|
|
3618
|
-
import { __ as
|
|
4013
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3619
4014
|
var MIN_NAME_LENGTH = 2;
|
|
3620
4015
|
var MAX_NAME_LENGTH = 50;
|
|
3621
|
-
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"));
|
|
3622
4017
|
var createBaseComponentSchema = (existingNames) => {
|
|
3623
4018
|
return z5.object({
|
|
3624
4019
|
componentName: baseComponentSchema.refine((value) => !existingNames.includes(value), {
|
|
3625
|
-
message:
|
|
4020
|
+
message: __24("Component name already exists", "elementor")
|
|
3626
4021
|
})
|
|
3627
4022
|
});
|
|
3628
4023
|
};
|
|
@@ -3630,9 +4025,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
3630
4025
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
3631
4026
|
return baseSchema.extend({
|
|
3632
4027
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
3633
|
-
message:
|
|
4028
|
+
message: __24("Component name is required.", "elementor")
|
|
3634
4029
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
3635
|
-
message:
|
|
4030
|
+
message: __24("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
3636
4031
|
})
|
|
3637
4032
|
});
|
|
3638
4033
|
};
|
|
@@ -3680,7 +4075,7 @@ var createComponentModel2 = (component) => {
|
|
|
3680
4075
|
|
|
3681
4076
|
// src/extended/utils/get-container-for-new-element.ts
|
|
3682
4077
|
import {
|
|
3683
|
-
getContainer as
|
|
4078
|
+
getContainer as getContainer4,
|
|
3684
4079
|
getCurrentDocumentContainer as getCurrentDocumentContainer2,
|
|
3685
4080
|
getSelectedElements
|
|
3686
4081
|
} from "@elementor/editor-elements";
|
|
@@ -3715,24 +4110,24 @@ function getSelectedElementContainer() {
|
|
|
3715
4110
|
if (selectedElements.length !== 1) {
|
|
3716
4111
|
return void 0;
|
|
3717
4112
|
}
|
|
3718
|
-
return
|
|
4113
|
+
return getContainer4(selectedElements[0].id);
|
|
3719
4114
|
}
|
|
3720
4115
|
|
|
3721
4116
|
// src/extended/components/components-tab/delete-confirmation-dialog.tsx
|
|
3722
|
-
import * as
|
|
3723
|
-
import { ConfirmationDialog } from "@elementor/editor-ui";
|
|
3724
|
-
import { __ as
|
|
4117
|
+
import * as React30 from "react";
|
|
4118
|
+
import { ConfirmationDialog as ConfirmationDialog2 } from "@elementor/editor-ui";
|
|
4119
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3725
4120
|
function DeleteConfirmationDialog({ open, onClose, onConfirm }) {
|
|
3726
|
-
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(
|
|
3727
4122
|
"Existing instances on your pages will remain functional. You will no longer find this component in your list.",
|
|
3728
4123
|
"elementor"
|
|
3729
|
-
))), /* @__PURE__ */
|
|
4124
|
+
))), /* @__PURE__ */ React30.createElement(ConfirmationDialog2.Actions, { onClose, onConfirm }));
|
|
3730
4125
|
}
|
|
3731
4126
|
|
|
3732
4127
|
// src/extended/components/components-tab/component-item.tsx
|
|
3733
4128
|
function ComponentItem2({ component }) {
|
|
3734
4129
|
const itemRef = useRef4(null);
|
|
3735
|
-
const [isDeleteDialogOpen, setIsDeleteDialogOpen] =
|
|
4130
|
+
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState7(false);
|
|
3736
4131
|
const { canRename, canDelete } = useComponentsPermissions();
|
|
3737
4132
|
const shouldShowActions = canRename || canDelete;
|
|
3738
4133
|
const {
|
|
@@ -3772,7 +4167,7 @@ function ComponentItem2({ component }) {
|
|
|
3772
4167
|
const handleDeleteDialogClose = () => {
|
|
3773
4168
|
setIsDeleteDialogOpen(false);
|
|
3774
4169
|
};
|
|
3775
|
-
return /* @__PURE__ */
|
|
4170
|
+
return /* @__PURE__ */ React31.createElement(Stack17, null, /* @__PURE__ */ React31.createElement(
|
|
3776
4171
|
WarningInfotip,
|
|
3777
4172
|
{
|
|
3778
4173
|
open: Boolean(error),
|
|
@@ -3781,7 +4176,7 @@ function ComponentItem2({ component }) {
|
|
|
3781
4176
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
3782
4177
|
offset: [0, -15]
|
|
3783
4178
|
},
|
|
3784
|
-
/* @__PURE__ */
|
|
4179
|
+
/* @__PURE__ */ React31.createElement(
|
|
3785
4180
|
ComponentItem,
|
|
3786
4181
|
{
|
|
3787
4182
|
ref: itemRef,
|
|
@@ -3793,17 +4188,17 @@ function ComponentItem2({ component }) {
|
|
|
3793
4188
|
onClick: handleClick,
|
|
3794
4189
|
isEditing,
|
|
3795
4190
|
error,
|
|
3796
|
-
nameSlot: /* @__PURE__ */
|
|
4191
|
+
nameSlot: /* @__PURE__ */ React31.createElement(
|
|
3797
4192
|
ComponentName,
|
|
3798
4193
|
{
|
|
3799
4194
|
name: component.name,
|
|
3800
4195
|
editable: { ref: editableRef, isEditing, getProps: getEditableProps }
|
|
3801
4196
|
}
|
|
3802
4197
|
),
|
|
3803
|
-
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
|
|
3804
4199
|
}
|
|
3805
4200
|
)
|
|
3806
|
-
), shouldShowActions && /* @__PURE__ */
|
|
4201
|
+
), shouldShowActions && /* @__PURE__ */ React31.createElement(
|
|
3807
4202
|
Menu2,
|
|
3808
4203
|
{
|
|
3809
4204
|
...bindMenu2(popupState),
|
|
@@ -3816,7 +4211,7 @@ function ComponentItem2({ component }) {
|
|
|
3816
4211
|
horizontal: "right"
|
|
3817
4212
|
}
|
|
3818
4213
|
},
|
|
3819
|
-
canRename && /* @__PURE__ */
|
|
4214
|
+
canRename && /* @__PURE__ */ React31.createElement(
|
|
3820
4215
|
MenuListItem3,
|
|
3821
4216
|
{
|
|
3822
4217
|
sx: { minWidth: "160px" },
|
|
@@ -3826,18 +4221,18 @@ function ComponentItem2({ component }) {
|
|
|
3826
4221
|
openEditMode();
|
|
3827
4222
|
}
|
|
3828
4223
|
},
|
|
3829
|
-
|
|
4224
|
+
__26("Rename", "elementor")
|
|
3830
4225
|
),
|
|
3831
|
-
canDelete && /* @__PURE__ */
|
|
4226
|
+
canDelete && /* @__PURE__ */ React31.createElement(
|
|
3832
4227
|
MenuListItem3,
|
|
3833
4228
|
{
|
|
3834
4229
|
sx: { minWidth: "160px" },
|
|
3835
4230
|
primaryTypographyProps: { variant: "caption", color: "error.light" },
|
|
3836
4231
|
onClick: handleDeleteClick
|
|
3837
4232
|
},
|
|
3838
|
-
|
|
4233
|
+
__26("Delete", "elementor")
|
|
3839
4234
|
)
|
|
3840
|
-
), /* @__PURE__ */
|
|
4235
|
+
), /* @__PURE__ */ React31.createElement(
|
|
3841
4236
|
DeleteConfirmationDialog,
|
|
3842
4237
|
{
|
|
3843
4238
|
open: isDeleteDialogOpen,
|
|
@@ -3870,43 +4265,43 @@ var validateComponentTitle = (newTitle) => {
|
|
|
3870
4265
|
var ExtendedComponentsList = () => {
|
|
3871
4266
|
const { components, isLoading, searchValue } = useFilteredComponents();
|
|
3872
4267
|
if (isLoading) {
|
|
3873
|
-
return /* @__PURE__ */
|
|
4268
|
+
return /* @__PURE__ */ React32.createElement(LoadingComponents, null);
|
|
3874
4269
|
}
|
|
3875
4270
|
const isEmpty = !components?.length;
|
|
3876
4271
|
if (isEmpty) {
|
|
3877
|
-
return searchValue.length ? /* @__PURE__ */
|
|
4272
|
+
return searchValue.length ? /* @__PURE__ */ React32.createElement(EmptySearchResult, null) : /* @__PURE__ */ React32.createElement(EmptyState, null);
|
|
3878
4273
|
}
|
|
3879
|
-
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 })));
|
|
3880
4275
|
};
|
|
3881
4276
|
var ExtendedComponentsContent = () => {
|
|
3882
4277
|
const { components, isLoading } = useComponents();
|
|
3883
4278
|
const hasComponents = !isLoading && components.length > 0;
|
|
3884
|
-
return /* @__PURE__ */
|
|
4279
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, hasComponents && /* @__PURE__ */ React32.createElement(ComponentSearch, null), /* @__PURE__ */ React32.createElement(ExtendedComponentsList, null));
|
|
3885
4280
|
};
|
|
3886
4281
|
var ExtendedComponents = () => {
|
|
3887
|
-
return /* @__PURE__ */
|
|
4282
|
+
return /* @__PURE__ */ React32.createElement(ThemeProvider3, null, /* @__PURE__ */ React32.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React32.createElement(ExtendedComponentsContent, null)));
|
|
3888
4283
|
};
|
|
3889
4284
|
|
|
3890
4285
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
3891
|
-
import * as
|
|
3892
|
-
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";
|
|
3893
4288
|
import { getElementLabel } from "@elementor/editor-elements";
|
|
3894
|
-
import { notify as
|
|
4289
|
+
import { notify as notify5 } from "@elementor/editor-notifications";
|
|
3895
4290
|
import { Form as FormElement, ThemeProvider as ThemeProvider4, useTextFieldAutoSelect } from "@elementor/editor-ui";
|
|
3896
4291
|
import { ComponentsIcon as ComponentsIcon4 } from "@elementor/icons";
|
|
3897
|
-
import { Button as Button5, FormLabel as FormLabel2, Grid as Grid2, Popover as Popover3, Stack as
|
|
3898
|
-
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";
|
|
3899
4294
|
|
|
3900
4295
|
// src/extended/store/actions/create-unpublished-component.ts
|
|
3901
|
-
import { createElements, deleteElement, getContainer as
|
|
4296
|
+
import { createElements, deleteElement, getContainer as getContainer5 } from "@elementor/editor-elements";
|
|
3902
4297
|
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
3903
4298
|
import { generateUniqueId as generateUniqueId3 } from "@elementor/utils";
|
|
3904
|
-
import { __ as
|
|
4299
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
3905
4300
|
|
|
3906
4301
|
// src/extended/utils/replace-element-with-component.ts
|
|
3907
|
-
import { replaceElement } from "@elementor/editor-elements";
|
|
4302
|
+
import { replaceElement as replaceElement2 } from "@elementor/editor-elements";
|
|
3908
4303
|
var replaceElementWithComponent = (element, component) => {
|
|
3909
|
-
return
|
|
4304
|
+
return replaceElement2({
|
|
3910
4305
|
currentElementId: element.id,
|
|
3911
4306
|
newElement: createComponentModel2(component),
|
|
3912
4307
|
withHistory: false
|
|
@@ -3925,7 +4320,7 @@ async function createUnpublishedComponent({
|
|
|
3925
4320
|
const generatedUid = uid ?? generateUniqueId3("component");
|
|
3926
4321
|
const componentBase = { uid: generatedUid, name };
|
|
3927
4322
|
const elementDataWithOverridablesReverted = revertAllOverridablesInElementData(element);
|
|
3928
|
-
const container =
|
|
4323
|
+
const container = getContainer5(element.id);
|
|
3929
4324
|
const modelFromContainer = container?.model?.toJSON?.();
|
|
3930
4325
|
const originalElement = {
|
|
3931
4326
|
model: modelFromContainer ?? element,
|
|
@@ -3957,17 +4352,17 @@ async function createUnpublishedComponent({
|
|
|
3957
4352
|
return { uid: generatedUid, instanceId: componentInstance.id };
|
|
3958
4353
|
}
|
|
3959
4354
|
function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
3960
|
-
const componentContainer =
|
|
4355
|
+
const componentContainer = getContainer5(componentInstanceId);
|
|
3961
4356
|
if (componentContainer) {
|
|
3962
4357
|
deleteElement({ container: componentContainer, options: { useHistory: false } });
|
|
3963
4358
|
}
|
|
3964
|
-
const parentContainer =
|
|
4359
|
+
const parentContainer = getContainer5(originalElement.parentId);
|
|
3965
4360
|
if (!parentContainer) {
|
|
3966
4361
|
return;
|
|
3967
4362
|
}
|
|
3968
4363
|
const clonedModel = structuredClone(originalElement.model);
|
|
3969
4364
|
createElements({
|
|
3970
|
-
title:
|
|
4365
|
+
title: __27("Restore Element", "elementor"),
|
|
3971
4366
|
elements: [
|
|
3972
4367
|
{
|
|
3973
4368
|
container: parentContainer,
|
|
@@ -3981,9 +4376,9 @@ function restoreOriginalElement(originalElement, componentInstanceId) {
|
|
|
3981
4376
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
3982
4377
|
import { isAtomicWidget } from "@elementor/editor-canvas";
|
|
3983
4378
|
import { getAllDescendants as getAllDescendants3, getElementType as getElementType3 } from "@elementor/editor-elements";
|
|
3984
|
-
import { notify as
|
|
4379
|
+
import { notify as notify4 } from "@elementor/editor-notifications";
|
|
3985
4380
|
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
3986
|
-
import { __ as
|
|
4381
|
+
import { __ as __28 } from "@wordpress/i18n";
|
|
3987
4382
|
|
|
3988
4383
|
// src/extended/utils/is-editing-component.ts
|
|
3989
4384
|
function isEditingComponent() {
|
|
@@ -3993,7 +4388,7 @@ function isEditingComponent() {
|
|
|
3993
4388
|
// src/extended/sync/prevent-non-atomic-nesting.ts
|
|
3994
4389
|
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
3995
4390
|
type: "default",
|
|
3996
|
-
message:
|
|
4391
|
+
message: __28("This widget isn't compatible with components. Use atomic elements instead.", "elementor"),
|
|
3997
4392
|
id: "non-atomic-element-blocked"
|
|
3998
4393
|
};
|
|
3999
4394
|
function initNonAtomicNestingPrevention() {
|
|
@@ -4025,7 +4420,7 @@ function blockNonAtomicCreate(args) {
|
|
|
4025
4420
|
if (isElementAtomic(elementType)) {
|
|
4026
4421
|
return false;
|
|
4027
4422
|
}
|
|
4028
|
-
|
|
4423
|
+
notify4(NON_ATOMIC_ELEMENT_ALERT);
|
|
4029
4424
|
return true;
|
|
4030
4425
|
}
|
|
4031
4426
|
function blockNonAtomicMove(args) {
|
|
@@ -4041,7 +4436,7 @@ function blockNonAtomicMove(args) {
|
|
|
4041
4436
|
return allElements.some((element) => !isAtomicWidget(element));
|
|
4042
4437
|
});
|
|
4043
4438
|
if (hasNonAtomicElement) {
|
|
4044
|
-
|
|
4439
|
+
notify4(NON_ATOMIC_ELEMENT_ALERT);
|
|
4045
4440
|
}
|
|
4046
4441
|
return hasNonAtomicElement;
|
|
4047
4442
|
}
|
|
@@ -4059,7 +4454,7 @@ function blockNonAtomicPaste(args) {
|
|
|
4059
4454
|
}
|
|
4060
4455
|
const hasNonAtomicElement = hasNonAtomicElementsInTree(data.clipboard.elements);
|
|
4061
4456
|
if (hasNonAtomicElement) {
|
|
4062
|
-
|
|
4457
|
+
notify4(NON_ATOMIC_ELEMENT_ALERT);
|
|
4063
4458
|
}
|
|
4064
4459
|
return hasNonAtomicElement;
|
|
4065
4460
|
}
|
|
@@ -4092,10 +4487,10 @@ function findNonAtomicElementsInElement(element) {
|
|
|
4092
4487
|
}
|
|
4093
4488
|
|
|
4094
4489
|
// src/extended/components/create-component-form/hooks/use-form.ts
|
|
4095
|
-
import { useMemo as useMemo2, useState as
|
|
4490
|
+
import { useMemo as useMemo2, useState as useState8 } from "react";
|
|
4096
4491
|
var useForm = (initialValues) => {
|
|
4097
|
-
const [values, setValues] =
|
|
4098
|
-
const [errors, setErrors] =
|
|
4492
|
+
const [values, setValues] = useState8(initialValues);
|
|
4493
|
+
const [errors, setErrors] = useState8({});
|
|
4099
4494
|
const isValid = useMemo2(() => {
|
|
4100
4495
|
return !Object.values(errors).some((error) => error);
|
|
4101
4496
|
}, [errors]);
|
|
@@ -4172,8 +4567,8 @@ function countNestedElements(container) {
|
|
|
4172
4567
|
// src/extended/components/create-component-form/create-component-form.tsx
|
|
4173
4568
|
var MAX_COMPONENTS = 100;
|
|
4174
4569
|
function CreateComponentForm() {
|
|
4175
|
-
const [element, setElement] =
|
|
4176
|
-
const [anchorPosition, setAnchorPosition] =
|
|
4570
|
+
const [element, setElement] = useState9(null);
|
|
4571
|
+
const [anchorPosition, setAnchorPosition] = useState9();
|
|
4177
4572
|
const { components } = useComponents();
|
|
4178
4573
|
const eventData = useRef5(null);
|
|
4179
4574
|
useEffect3(() => {
|
|
@@ -4181,7 +4576,7 @@ function CreateComponentForm() {
|
|
|
4181
4576
|
const openPopup = (event) => {
|
|
4182
4577
|
const { shouldOpen, notification } = shouldOpenForm(event.detail.element, components?.length ?? 0);
|
|
4183
4578
|
if (!shouldOpen) {
|
|
4184
|
-
|
|
4579
|
+
notify5(notification);
|
|
4185
4580
|
return;
|
|
4186
4581
|
}
|
|
4187
4582
|
setElement({ element: event.detail.element, elementLabel: getElementLabel(event.detail.element.id) });
|
|
@@ -4215,15 +4610,15 @@ function CreateComponentForm() {
|
|
|
4215
4610
|
} else {
|
|
4216
4611
|
throw new Error("Failed to find published component");
|
|
4217
4612
|
}
|
|
4218
|
-
|
|
4613
|
+
notify5({
|
|
4219
4614
|
type: "success",
|
|
4220
|
-
message:
|
|
4615
|
+
message: __29("Component created successfully.", "elementor"),
|
|
4221
4616
|
id: `component-saved-successfully-${uid}`
|
|
4222
4617
|
});
|
|
4223
4618
|
resetAndClosePopup();
|
|
4224
4619
|
} catch {
|
|
4225
|
-
const errorMessage =
|
|
4226
|
-
|
|
4620
|
+
const errorMessage = __29("Failed to create component. Please try again.", "elementor");
|
|
4621
|
+
notify5({
|
|
4227
4622
|
type: "error",
|
|
4228
4623
|
message: errorMessage,
|
|
4229
4624
|
id: "component-save-failed"
|
|
@@ -4243,7 +4638,7 @@ function CreateComponentForm() {
|
|
|
4243
4638
|
...eventData.current
|
|
4244
4639
|
});
|
|
4245
4640
|
};
|
|
4246
|
-
return /* @__PURE__ */
|
|
4641
|
+
return /* @__PURE__ */ React33.createElement(ThemeProvider4, null, /* @__PURE__ */ React33.createElement(
|
|
4247
4642
|
Popover3,
|
|
4248
4643
|
{
|
|
4249
4644
|
open: element !== null,
|
|
@@ -4252,7 +4647,7 @@ function CreateComponentForm() {
|
|
|
4252
4647
|
anchorPosition,
|
|
4253
4648
|
"data-testid": "create-component-form"
|
|
4254
4649
|
},
|
|
4255
|
-
element !== null && /* @__PURE__ */
|
|
4650
|
+
element !== null && /* @__PURE__ */ React33.createElement(
|
|
4256
4651
|
Form2,
|
|
4257
4652
|
{
|
|
4258
4653
|
initialValues: { componentName: element.elementLabel },
|
|
@@ -4269,7 +4664,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4269
4664
|
shouldOpen: false,
|
|
4270
4665
|
notification: {
|
|
4271
4666
|
type: "default",
|
|
4272
|
-
message:
|
|
4667
|
+
message: __29(
|
|
4273
4668
|
"Components require atomic elements only. Remove widgets to create this component.",
|
|
4274
4669
|
"elementor"
|
|
4275
4670
|
),
|
|
@@ -4283,7 +4678,7 @@ function shouldOpenForm(element, componentsCount) {
|
|
|
4283
4678
|
notification: {
|
|
4284
4679
|
type: "default",
|
|
4285
4680
|
/* translators: %s is the maximum number of components */
|
|
4286
|
-
message:
|
|
4681
|
+
message: __29(
|
|
4287
4682
|
`You've reached the limit of %s components. Please remove an existing one to create a new component.`,
|
|
4288
4683
|
"elementor"
|
|
4289
4684
|
).replace("%s", MAX_COMPONENTS.toString()),
|
|
@@ -4320,14 +4715,14 @@ var Form2 = ({
|
|
|
4320
4715
|
}
|
|
4321
4716
|
};
|
|
4322
4717
|
const texts = {
|
|
4323
|
-
heading:
|
|
4324
|
-
name:
|
|
4325
|
-
cancel:
|
|
4326
|
-
create:
|
|
4718
|
+
heading: __29("Create component", "elementor"),
|
|
4719
|
+
name: __29("Name", "elementor"),
|
|
4720
|
+
cancel: __29("Cancel", "elementor"),
|
|
4721
|
+
create: __29("Create", "elementor")
|
|
4327
4722
|
};
|
|
4328
4723
|
const nameInputId = "component-name";
|
|
4329
|
-
return /* @__PURE__ */
|
|
4330
|
-
|
|
4724
|
+
return /* @__PURE__ */ React33.createElement(FormElement, { onSubmit: handleSubmit }, /* @__PURE__ */ React33.createElement(Stack18, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React33.createElement(
|
|
4725
|
+
Stack18,
|
|
4331
4726
|
{
|
|
4332
4727
|
direction: "row",
|
|
4333
4728
|
alignItems: "center",
|
|
@@ -4335,9 +4730,9 @@ var Form2 = ({
|
|
|
4335
4730
|
px: 1.5,
|
|
4336
4731
|
sx: { columnGap: 0.5, borderBottom: "1px solid", borderColor: "divider", width: "100%" }
|
|
4337
4732
|
},
|
|
4338
|
-
/* @__PURE__ */
|
|
4339
|
-
/* @__PURE__ */
|
|
4340
|
-
), /* @__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(
|
|
4341
4736
|
TextField3,
|
|
4342
4737
|
{
|
|
4343
4738
|
id: nameInputId,
|
|
@@ -4350,12 +4745,12 @@ var Form2 = ({
|
|
|
4350
4745
|
helperText: errors.componentName,
|
|
4351
4746
|
inputRef: nameInputRef
|
|
4352
4747
|
}
|
|
4353
|
-
))), /* @__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))));
|
|
4354
4749
|
};
|
|
4355
4750
|
|
|
4356
4751
|
// src/extended/components/edit-component/edit-component.tsx
|
|
4357
|
-
import * as
|
|
4358
|
-
import { useEffect as useEffect6, useState as
|
|
4752
|
+
import * as React35 from "react";
|
|
4753
|
+
import { useEffect as useEffect6, useState as useState11 } from "react";
|
|
4359
4754
|
import { getV1DocumentsManager as getV1DocumentsManager5 } from "@elementor/editor-documents";
|
|
4360
4755
|
import { __privateListenTo as listenTo, commandEndEvent as commandEndEvent2 } from "@elementor/editor-v1-adapters";
|
|
4361
4756
|
import { __useSelector as useSelector5 } from "@elementor/store";
|
|
@@ -4377,10 +4772,10 @@ function updateCurrentComponent(params) {
|
|
|
4377
4772
|
}
|
|
4378
4773
|
|
|
4379
4774
|
// src/extended/components/edit-component/component-modal.tsx
|
|
4380
|
-
import * as
|
|
4775
|
+
import * as React34 from "react";
|
|
4381
4776
|
import { useEffect as useEffect5 } from "react";
|
|
4382
4777
|
import { createPortal } from "react-dom";
|
|
4383
|
-
import { __ as
|
|
4778
|
+
import { __ as __30 } from "@wordpress/i18n";
|
|
4384
4779
|
|
|
4385
4780
|
// src/extended/components/edit-component/use-canvas-document.ts
|
|
4386
4781
|
import {
|
|
@@ -4393,10 +4788,10 @@ function useCanvasDocument() {
|
|
|
4393
4788
|
}
|
|
4394
4789
|
|
|
4395
4790
|
// src/extended/components/edit-component/use-element-rect.ts
|
|
4396
|
-
import { useEffect as useEffect4, useState as
|
|
4791
|
+
import { useEffect as useEffect4, useState as useState10 } from "react";
|
|
4397
4792
|
import { throttle } from "@elementor/utils";
|
|
4398
4793
|
function useElementRect(element) {
|
|
4399
|
-
const [rect, setRect] =
|
|
4794
|
+
const [rect, setRect] = useState10(new DOMRect(0, 0, 0, 0));
|
|
4400
4795
|
const onChange = throttle(
|
|
4401
4796
|
() => {
|
|
4402
4797
|
setRect(element?.getBoundingClientRect() ?? new DOMRect(0, 0, 0, 0));
|
|
@@ -4473,7 +4868,7 @@ function ComponentModal({ topLevelElementDom, onClose }) {
|
|
|
4473
4868
|
return null;
|
|
4474
4869
|
}
|
|
4475
4870
|
return createPortal(
|
|
4476
|
-
/* @__PURE__ */
|
|
4871
|
+
/* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(BlockEditPage, null), /* @__PURE__ */ React34.createElement(Backdrop, { canvas: canvasDocument, element: topLevelElementDom, onClose })),
|
|
4477
4872
|
canvasDocument.body
|
|
4478
4873
|
);
|
|
4479
4874
|
}
|
|
@@ -4502,7 +4897,7 @@ function Backdrop({
|
|
|
4502
4897
|
onClose();
|
|
4503
4898
|
}
|
|
4504
4899
|
};
|
|
4505
|
-
return /* @__PURE__ */
|
|
4900
|
+
return /* @__PURE__ */ React34.createElement(
|
|
4506
4901
|
"div",
|
|
4507
4902
|
{
|
|
4508
4903
|
style: backdropStyle,
|
|
@@ -4510,7 +4905,7 @@ function Backdrop({
|
|
|
4510
4905
|
onKeyDown: handleKeyDown,
|
|
4511
4906
|
role: "button",
|
|
4512
4907
|
tabIndex: 0,
|
|
4513
|
-
"aria-label":
|
|
4908
|
+
"aria-label": __30("Exit component editing mode", "elementor")
|
|
4514
4909
|
}
|
|
4515
4910
|
);
|
|
4516
4911
|
}
|
|
@@ -4550,7 +4945,7 @@ function BlockEditPage() {
|
|
|
4550
4945
|
}
|
|
4551
4946
|
}
|
|
4552
4947
|
`;
|
|
4553
|
-
return /* @__PURE__ */
|
|
4948
|
+
return /* @__PURE__ */ React34.createElement("style", { "data-e-style-id": "e-block-v3-document-handles-styles" }, blockV3DocumentHandlesStyles);
|
|
4554
4949
|
}
|
|
4555
4950
|
|
|
4556
4951
|
// src/extended/components/edit-component/edit-component.tsx
|
|
@@ -4563,7 +4958,7 @@ function EditComponent() {
|
|
|
4563
4958
|
if (!currentComponentId) {
|
|
4564
4959
|
return null;
|
|
4565
4960
|
}
|
|
4566
|
-
return /* @__PURE__ */
|
|
4961
|
+
return /* @__PURE__ */ React35.createElement(ComponentModal, { topLevelElementDom, onClose });
|
|
4567
4962
|
}
|
|
4568
4963
|
function useHandleDocumentSwitches() {
|
|
4569
4964
|
const documentsManager = getV1DocumentsManager5();
|
|
@@ -4623,7 +5018,7 @@ function getInstanceTitle(instanceId, path) {
|
|
|
4623
5018
|
}
|
|
4624
5019
|
function useComponentDOMElement(id2) {
|
|
4625
5020
|
const { componentContainerDomElement, topLevelElementDom } = getComponentDOMElements(id2);
|
|
4626
|
-
const [currentElementDom, setCurrentElementDom] =
|
|
5021
|
+
const [currentElementDom, setCurrentElementDom] = useState11(topLevelElementDom);
|
|
4627
5022
|
useEffect6(() => {
|
|
4628
5023
|
setCurrentElementDom(topLevelElementDom);
|
|
4629
5024
|
}, [topLevelElementDom]);
|
|
@@ -4655,10 +5050,10 @@ function getComponentDOMElements(id2) {
|
|
|
4655
5050
|
}
|
|
4656
5051
|
|
|
4657
5052
|
// src/extended/components/instance-editing-panel/instance-editing-panel.tsx
|
|
4658
|
-
import * as
|
|
5053
|
+
import * as React36 from "react";
|
|
4659
5054
|
import { PencilIcon as PencilIcon3 } from "@elementor/icons";
|
|
4660
5055
|
import { Box as Box16 } from "@elementor/ui";
|
|
4661
|
-
import { __ as
|
|
5056
|
+
import { __ as __31 } from "@wordpress/i18n";
|
|
4662
5057
|
function ExtendedInstanceEditingPanel() {
|
|
4663
5058
|
const { canEdit } = useComponentsPermissions();
|
|
4664
5059
|
const data = useInstancePanelData();
|
|
@@ -4666,20 +5061,20 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4666
5061
|
return null;
|
|
4667
5062
|
}
|
|
4668
5063
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
4669
|
-
const panelTitle =
|
|
5064
|
+
const panelTitle = __31("Edit %s", "elementor").replace("%s", component.name);
|
|
4670
5065
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
4671
|
-
return /* @__PURE__ */
|
|
5066
|
+
return /* @__PURE__ */ React36.createElement(Box16, { "data-testid": "instance-editing-panel" }, /* @__PURE__ */ React36.createElement(
|
|
4672
5067
|
ComponentInstanceProvider,
|
|
4673
5068
|
{
|
|
4674
5069
|
componentId,
|
|
4675
5070
|
overrides,
|
|
4676
5071
|
overridableProps
|
|
4677
5072
|
},
|
|
4678
|
-
/* @__PURE__ */
|
|
5073
|
+
/* @__PURE__ */ React36.createElement(
|
|
4679
5074
|
InstancePanelHeader,
|
|
4680
5075
|
{
|
|
4681
5076
|
componentName: component.name,
|
|
4682
|
-
actions: canEdit ? /* @__PURE__ */
|
|
5077
|
+
actions: canEdit ? /* @__PURE__ */ React36.createElement(
|
|
4683
5078
|
EditComponentAction,
|
|
4684
5079
|
{
|
|
4685
5080
|
label: panelTitle,
|
|
@@ -4689,12 +5084,12 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4689
5084
|
) : void 0
|
|
4690
5085
|
}
|
|
4691
5086
|
),
|
|
4692
|
-
/* @__PURE__ */
|
|
5087
|
+
/* @__PURE__ */ React36.createElement(
|
|
4693
5088
|
InstancePanelBody,
|
|
4694
5089
|
{
|
|
4695
5090
|
groups,
|
|
4696
5091
|
isEmpty,
|
|
4697
|
-
emptyState: /* @__PURE__ */
|
|
5092
|
+
emptyState: /* @__PURE__ */ React36.createElement(EmptyState2, { onEditComponent: canEdit ? handleEditComponent : void 0 }),
|
|
4698
5093
|
componentInstanceId
|
|
4699
5094
|
}
|
|
4700
5095
|
)
|
|
@@ -4702,7 +5097,7 @@ function ExtendedInstanceEditingPanel() {
|
|
|
4702
5097
|
}
|
|
4703
5098
|
|
|
4704
5099
|
// src/extended/components/overridable-props/overridable-prop-control.tsx
|
|
4705
|
-
import * as
|
|
5100
|
+
import * as React37 from "react";
|
|
4706
5101
|
import {
|
|
4707
5102
|
ControlReplacementsProvider as ControlReplacementsProvider2,
|
|
4708
5103
|
getControlReplacements as getControlReplacements2,
|
|
@@ -4754,7 +5149,7 @@ function OverridablePropControl({
|
|
|
4754
5149
|
});
|
|
4755
5150
|
const propValue = isComponentInstance2 ? (value.origin_value?.value).override_value : value.origin_value;
|
|
4756
5151
|
const objectPlaceholder = placeholder ? { [bind]: placeholder } : void 0;
|
|
4757
|
-
return /* @__PURE__ */
|
|
5152
|
+
return /* @__PURE__ */ React37.createElement(OverridablePropProvider, { value }, /* @__PURE__ */ React37.createElement(
|
|
4758
5153
|
PropProvider2,
|
|
4759
5154
|
{
|
|
4760
5155
|
...propContext,
|
|
@@ -4765,7 +5160,7 @@ function OverridablePropControl({
|
|
|
4765
5160
|
},
|
|
4766
5161
|
placeholder: objectPlaceholder
|
|
4767
5162
|
},
|
|
4768
|
-
/* @__PURE__ */
|
|
5163
|
+
/* @__PURE__ */ React37.createElement(PropKeyProvider2, { bind }, /* @__PURE__ */ React37.createElement(ControlReplacementsProvider2, { replacements: filteredReplacements }, /* @__PURE__ */ React37.createElement(ControlWithReplacements, { OriginalControl: OriginalControl2, props })))
|
|
4769
5164
|
));
|
|
4770
5165
|
}
|
|
4771
5166
|
function ControlWithReplacements({
|
|
@@ -4775,18 +5170,18 @@ function ControlWithReplacements({
|
|
|
4775
5170
|
const { ControlToRender, isReplaced } = useControlReplacement(OriginalControl2);
|
|
4776
5171
|
if (isReplaced) {
|
|
4777
5172
|
const ReplacementControl = ControlToRender;
|
|
4778
|
-
return /* @__PURE__ */
|
|
5173
|
+
return /* @__PURE__ */ React37.createElement(ReplacementControl, { ...props, OriginalControl: OriginalControl2 });
|
|
4779
5174
|
}
|
|
4780
|
-
return /* @__PURE__ */
|
|
5175
|
+
return /* @__PURE__ */ React37.createElement(OriginalControl2, { ...props });
|
|
4781
5176
|
}
|
|
4782
5177
|
|
|
4783
5178
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
4784
|
-
import * as
|
|
5179
|
+
import * as React39 from "react";
|
|
4785
5180
|
import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
4786
5181
|
import { useElement as useElement4 } from "@elementor/editor-editing-panel";
|
|
4787
5182
|
import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
|
|
4788
5183
|
import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Popover4, Tooltip as Tooltip6, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
4789
|
-
import { __ as
|
|
5184
|
+
import { __ as __33 } from "@wordpress/i18n";
|
|
4790
5185
|
|
|
4791
5186
|
// src/extended/store/actions/set-overridable-prop.ts
|
|
4792
5187
|
import { generateUniqueId as generateUniqueId4 } from "@elementor/utils";
|
|
@@ -4858,11 +5253,11 @@ function setOverridableProp({
|
|
|
4858
5253
|
}
|
|
4859
5254
|
|
|
4860
5255
|
// src/extended/components/overridable-props/indicator.tsx
|
|
4861
|
-
import * as
|
|
5256
|
+
import * as React38 from "react";
|
|
4862
5257
|
import { forwardRef as forwardRef3 } from "react";
|
|
4863
5258
|
import { CheckIcon, PlusIcon } from "@elementor/icons";
|
|
4864
5259
|
import { Box as Box17, styled as styled4 } from "@elementor/ui";
|
|
4865
|
-
import { __ as
|
|
5260
|
+
import { __ as __32 } from "@wordpress/i18n";
|
|
4866
5261
|
var SIZE2 = "tiny";
|
|
4867
5262
|
var IconContainer = styled4(Box17)`
|
|
4868
5263
|
pointer-events: none;
|
|
@@ -4918,16 +5313,16 @@ var Content = styled4(Box17)`
|
|
|
4918
5313
|
}
|
|
4919
5314
|
}
|
|
4920
5315
|
`;
|
|
4921
|
-
var Indicator2 = forwardRef3(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */
|
|
5316
|
+
var Indicator2 = forwardRef3(({ isOpen, isOverridable, ...props }, ref) => /* @__PURE__ */ React38.createElement(
|
|
4922
5317
|
Content,
|
|
4923
5318
|
{
|
|
4924
5319
|
role: "button",
|
|
4925
5320
|
ref,
|
|
4926
5321
|
...props,
|
|
4927
5322
|
className: isOpen || isOverridable ? "enlarged" : "",
|
|
4928
|
-
"aria-label": isOverridable ?
|
|
5323
|
+
"aria-label": isOverridable ? __32("Overridable property", "elementor") : __32("Make prop overridable", "elementor")
|
|
4929
5324
|
},
|
|
4930
|
-
/* @__PURE__ */
|
|
5325
|
+
/* @__PURE__ */ React38.createElement(IconContainer, { className: "icon" }, isOverridable ? /* @__PURE__ */ React38.createElement(CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React38.createElement(PlusIcon, { fontSize: SIZE2 }))
|
|
4931
5326
|
));
|
|
4932
5327
|
|
|
4933
5328
|
// src/extended/components/overridable-props/overridable-prop-indicator.tsx
|
|
@@ -4938,7 +5333,7 @@ function OverridablePropIndicator() {
|
|
|
4938
5333
|
if (!isPropAllowed(propType) || !componentId || !overridableProps) {
|
|
4939
5334
|
return null;
|
|
4940
5335
|
}
|
|
4941
|
-
return /* @__PURE__ */
|
|
5336
|
+
return /* @__PURE__ */ React39.createElement(Content2, { componentId, overridableProps });
|
|
4942
5337
|
}
|
|
4943
5338
|
function Content2({ componentId, overridableProps }) {
|
|
4944
5339
|
const {
|
|
@@ -4984,7 +5379,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
4984
5379
|
popupState.close();
|
|
4985
5380
|
};
|
|
4986
5381
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
4987
|
-
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(
|
|
4988
5383
|
Popover4,
|
|
4989
5384
|
{
|
|
4990
5385
|
disableScrollLock: true,
|
|
@@ -5001,7 +5396,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
5001
5396
|
},
|
|
5002
5397
|
...popoverProps
|
|
5003
5398
|
},
|
|
5004
|
-
/* @__PURE__ */
|
|
5399
|
+
/* @__PURE__ */ React39.createElement(
|
|
5005
5400
|
OverridablePropForm,
|
|
5006
5401
|
{
|
|
5007
5402
|
onSubmit: handleSubmit,
|
|
@@ -5024,7 +5419,7 @@ import { getMCPByDomain as getMCPByDomain2 } from "@elementor/editor-mcp";
|
|
|
5024
5419
|
|
|
5025
5420
|
// src/extended/mcp/save-as-component-tool.ts
|
|
5026
5421
|
import { DOCUMENT_STRUCTURE_URI, WIDGET_SCHEMA_URI } from "@elementor/editor-canvas";
|
|
5027
|
-
import { getContainer as
|
|
5422
|
+
import { getContainer as getContainer6, getElementType as getElementType4, getWidgetsCache as getWidgetsCache4 } from "@elementor/editor-elements";
|
|
5028
5423
|
import { getMCPByDomain, toolPrompts } from "@elementor/editor-mcp";
|
|
5029
5424
|
import { AxiosError } from "@elementor/http-client";
|
|
5030
5425
|
import { z as z6 } from "@elementor/schema";
|
|
@@ -5069,7 +5464,7 @@ var handleSaveAsComponent = async (params) => {
|
|
|
5069
5464
|
overridable_props: overridablePropsInput
|
|
5070
5465
|
} = params;
|
|
5071
5466
|
const validElementTypes = getValidElementTypes();
|
|
5072
|
-
const container =
|
|
5467
|
+
const container = getContainer6(elementId);
|
|
5073
5468
|
if (!container) {
|
|
5074
5469
|
throw new Error(ERROR_MESSAGES3.ELEMENT_NOT_FOUND);
|
|
5075
5470
|
}
|
|
@@ -5415,7 +5810,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
5415
5810
|
};
|
|
5416
5811
|
|
|
5417
5812
|
// src/extended/sync/update-archived-component-before-save.ts
|
|
5418
|
-
import { notify as
|
|
5813
|
+
import { notify as notify6 } from "@elementor/editor-notifications";
|
|
5419
5814
|
var failedNotification = (message) => ({
|
|
5420
5815
|
type: "error",
|
|
5421
5816
|
message: `Failed to archive components: ${message}`,
|
|
@@ -5430,7 +5825,7 @@ var updateArchivedComponentBeforeSave = async (status) => {
|
|
|
5430
5825
|
const result = await apiClient.updateArchivedComponents(archivedComponents, status);
|
|
5431
5826
|
const failedIds = result.failedIds.join(", ");
|
|
5432
5827
|
if (failedIds) {
|
|
5433
|
-
|
|
5828
|
+
notify6(failedNotification(failedIds));
|
|
5434
5829
|
}
|
|
5435
5830
|
} catch (error) {
|
|
5436
5831
|
throw new Error(`Failed to update archived components: ${error}`);
|
|
@@ -5594,7 +5989,7 @@ function isPartOfMoveCommand(options) {
|
|
|
5594
5989
|
}
|
|
5595
5990
|
|
|
5596
5991
|
// src/extended/sync/handle-component-edit-mode-container.ts
|
|
5597
|
-
import { createElement as
|
|
5992
|
+
import { createElement as createElement40, selectElement as selectElement2 } from "@elementor/editor-elements";
|
|
5598
5993
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
5599
5994
|
var V4_DEFAULT_CONTAINER_TYPE = "e-flexbox";
|
|
5600
5995
|
function initHandleComponentEditModeContainer() {
|
|
@@ -5644,7 +6039,7 @@ function initRedirectDropIntoComponent() {
|
|
|
5644
6039
|
});
|
|
5645
6040
|
}
|
|
5646
6041
|
function createEmptyTopLevelContainer(container) {
|
|
5647
|
-
const newContainer =
|
|
6042
|
+
const newContainer = createElement40({
|
|
5648
6043
|
container,
|
|
5649
6044
|
model: { elType: V4_DEFAULT_CONTAINER_TYPE }
|
|
5650
6045
|
});
|
|
@@ -5743,7 +6138,7 @@ function initExtended() {
|
|
|
5743
6138
|
});
|
|
5744
6139
|
registerTab({
|
|
5745
6140
|
id: "components",
|
|
5746
|
-
label:
|
|
6141
|
+
label: __34("Components", "elementor"),
|
|
5747
6142
|
component: ExtendedComponents,
|
|
5748
6143
|
priority: PRIORITY
|
|
5749
6144
|
});
|
|
@@ -5863,24 +6258,24 @@ function initCreateComponentShortcut() {
|
|
|
5863
6258
|
|
|
5864
6259
|
// src/populate-store.ts
|
|
5865
6260
|
import { useEffect as useEffect8 } from "react";
|
|
5866
|
-
import { __dispatch as
|
|
6261
|
+
import { __dispatch as dispatch5 } from "@elementor/store";
|
|
5867
6262
|
function PopulateStore() {
|
|
5868
6263
|
useEffect8(() => {
|
|
5869
|
-
|
|
6264
|
+
dispatch5(loadComponents());
|
|
5870
6265
|
}, []);
|
|
5871
6266
|
return null;
|
|
5872
6267
|
}
|
|
5873
6268
|
|
|
5874
6269
|
// src/prevent-circular-nesting.ts
|
|
5875
6270
|
import { getAllDescendants as getAllDescendants5 } from "@elementor/editor-elements";
|
|
5876
|
-
import { notify as
|
|
6271
|
+
import { notify as notify7 } from "@elementor/editor-notifications";
|
|
5877
6272
|
import { blockCommand as blockCommand2 } from "@elementor/editor-v1-adapters";
|
|
5878
|
-
import { __getState as
|
|
5879
|
-
import { __ as
|
|
6273
|
+
import { __getState as getState10 } from "@elementor/store";
|
|
6274
|
+
import { __ as __35 } from "@wordpress/i18n";
|
|
5880
6275
|
var COMPONENT_TYPE = "e-component";
|
|
5881
6276
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
5882
6277
|
type: "default",
|
|
5883
|
-
message:
|
|
6278
|
+
message: __35("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
5884
6279
|
id: "circular-component-nesting-blocked"
|
|
5885
6280
|
};
|
|
5886
6281
|
function initCircularNestingPrevention() {
|
|
@@ -5901,7 +6296,7 @@ function wouldCreateCircularNesting(componentIdToAdd) {
|
|
|
5901
6296
|
if (componentIdToAdd === void 0) {
|
|
5902
6297
|
return false;
|
|
5903
6298
|
}
|
|
5904
|
-
const state =
|
|
6299
|
+
const state = getState10();
|
|
5905
6300
|
const currentComponentId = selectCurrentComponentId(state);
|
|
5906
6301
|
const path = selectPath(state);
|
|
5907
6302
|
if (currentComponentId === null) {
|
|
@@ -5957,7 +6352,7 @@ function blockCircularCreate(args) {
|
|
|
5957
6352
|
}
|
|
5958
6353
|
const isBlocked = wouldCreateCircularNesting(componentId);
|
|
5959
6354
|
if (isBlocked) {
|
|
5960
|
-
|
|
6355
|
+
notify7(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5961
6356
|
}
|
|
5962
6357
|
return isBlocked;
|
|
5963
6358
|
}
|
|
@@ -5977,7 +6372,7 @@ function blockCircularMove(args) {
|
|
|
5977
6372
|
});
|
|
5978
6373
|
});
|
|
5979
6374
|
if (hasCircularComponent) {
|
|
5980
|
-
|
|
6375
|
+
notify7(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5981
6376
|
}
|
|
5982
6377
|
return hasCircularComponent;
|
|
5983
6378
|
}
|
|
@@ -5993,21 +6388,21 @@ function blockCircularPaste(args) {
|
|
|
5993
6388
|
const allComponentIds = extractComponentIdsFromElements(data.clipboard.elements);
|
|
5994
6389
|
const hasCircularComponent = allComponentIds.some(wouldCreateCircularNesting);
|
|
5995
6390
|
if (hasCircularComponent) {
|
|
5996
|
-
|
|
6391
|
+
notify7(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
5997
6392
|
}
|
|
5998
6393
|
return hasCircularComponent;
|
|
5999
6394
|
}
|
|
6000
6395
|
|
|
6001
6396
|
// src/store/actions/remove-component-styles.ts
|
|
6002
|
-
import { __dispatch as
|
|
6397
|
+
import { __dispatch as dispatch6 } from "@elementor/store";
|
|
6003
6398
|
function removeComponentStyles(id2) {
|
|
6004
6399
|
apiClient.invalidateComponentConfigCache(id2);
|
|
6005
|
-
|
|
6400
|
+
dispatch6(slice.actions.removeStyles({ id: id2 }));
|
|
6006
6401
|
}
|
|
6007
6402
|
|
|
6008
6403
|
// src/store/components-styles-provider.ts
|
|
6009
6404
|
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
6010
|
-
import { __getState as
|
|
6405
|
+
import { __getState as getState11, __subscribeWithSelector as subscribeWithSelector } from "@elementor/store";
|
|
6011
6406
|
var componentsStylesProvider = createStylesProvider({
|
|
6012
6407
|
key: "components-styles",
|
|
6013
6408
|
priority: 100,
|
|
@@ -6019,10 +6414,10 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
6019
6414
|
),
|
|
6020
6415
|
actions: {
|
|
6021
6416
|
all: () => {
|
|
6022
|
-
return selectFlatStyles(
|
|
6417
|
+
return selectFlatStyles(getState11());
|
|
6023
6418
|
},
|
|
6024
6419
|
get: (id2) => {
|
|
6025
|
-
return selectFlatStyles(
|
|
6420
|
+
return selectFlatStyles(getState11()).find((style) => style.id === id2) ?? null;
|
|
6026
6421
|
}
|
|
6027
6422
|
}
|
|
6028
6423
|
});
|
|
@@ -6054,13 +6449,17 @@ function init() {
|
|
|
6054
6449
|
stylesRepository.register(componentsStylesProvider);
|
|
6055
6450
|
registerSlice(slice);
|
|
6056
6451
|
registerElementType(
|
|
6057
|
-
|
|
6058
|
-
(options) => createComponentType({
|
|
6452
|
+
COMPONENT_WIDGET_TYPE2,
|
|
6453
|
+
(options) => createComponentType({
|
|
6454
|
+
...options,
|
|
6455
|
+
showLockedByModal: openEditModeDialog,
|
|
6456
|
+
showDetachConfirmDialog: openDetachConfirmDialog
|
|
6457
|
+
})
|
|
6059
6458
|
);
|
|
6060
6459
|
window.elementorCommon.__beforeSave = beforeSave2;
|
|
6061
6460
|
injectTab({
|
|
6062
6461
|
id: "components",
|
|
6063
|
-
label:
|
|
6462
|
+
label: __36("Components", "elementor"),
|
|
6064
6463
|
component: Components,
|
|
6065
6464
|
position: 1
|
|
6066
6465
|
});
|
|
@@ -6097,13 +6496,14 @@ function init() {
|
|
|
6097
6496
|
}
|
|
6098
6497
|
}
|
|
6099
6498
|
export {
|
|
6100
|
-
COMPONENT_WIDGET_TYPE,
|
|
6499
|
+
COMPONENT_WIDGET_TYPE2 as COMPONENT_WIDGET_TYPE,
|
|
6101
6500
|
ComponentInstanceProvider,
|
|
6102
6501
|
ComponentItem,
|
|
6103
6502
|
ComponentName,
|
|
6104
6503
|
ComponentSearch,
|
|
6105
6504
|
EmptyState as ComponentsEmptyState,
|
|
6106
6505
|
ComponentsList,
|
|
6506
|
+
DetachAction,
|
|
6107
6507
|
EditComponentAction,
|
|
6108
6508
|
EmptySearchResult,
|
|
6109
6509
|
EmptyState2 as InstanceEmptyState,
|