@elementor/editor-components 4.0.0-682 → 4.0.0-beta5
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +287 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +270 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/api.ts +8 -7
- package/src/components/components-tab/components-list.tsx +47 -2
- package/src/components/components-tab/components-pro-notification.tsx +1 -1
- package/src/components/components-tab/components-update-notification.tsx +13 -0
- package/src/components/components-tab/components.tsx +5 -4
- package/src/components/components-update-alert.tsx +40 -0
- package/src/components/instance-editing-panel/instance-editing-panel.tsx +19 -10
- package/src/components/instance-editing-panel/override-prop-control.tsx +14 -6
- package/src/components/instance-editing-panel/utils/correct-exposed-empty-override.ts +28 -0
- package/src/create-component-type.ts +45 -7
- package/src/store/actions/load-components-overridable-props.ts +5 -22
- package/src/store/extensible-slice.ts +19 -0
- package/src/sync/publish-draft-components-in-page-before-save.ts +1 -1
- package/src/utils/is-pro-components-supported.ts +11 -0
package/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
|
94
94
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
95
95
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
96
96
|
var import_store36 = require("@elementor/store");
|
|
97
|
-
var
|
|
97
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
98
98
|
|
|
99
99
|
// src/component-instance-transformer.ts
|
|
100
100
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
@@ -156,11 +156,12 @@ var apiClient = {
|
|
|
156
156
|
unlockComponent: async (componentId) => await (0, import_http_client.httpService)().post(`${BASE_URL}/unlock`, {
|
|
157
157
|
componentId
|
|
158
158
|
}).then((res) => res.data),
|
|
159
|
-
getOverridableProps: async (
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
getOverridableProps: async (componentIds) => await (0, import_http_client.httpService)().get(
|
|
160
|
+
`${BASE_URL}/overridable-props`,
|
|
161
|
+
{
|
|
162
|
+
params: { "componentIds[]": componentIds }
|
|
162
163
|
}
|
|
163
|
-
|
|
164
|
+
).then((res) => res.data),
|
|
164
165
|
updateArchivedComponents: async (componentIds, status) => await (0, import_http_client.httpService)().post(
|
|
165
166
|
`${BASE_URL}/archive`,
|
|
166
167
|
{
|
|
@@ -260,6 +261,18 @@ var baseSlice = (0, import_store2.__createSlice)({
|
|
|
260
261
|
}
|
|
261
262
|
component.overridableProps = payload.overridableProps;
|
|
262
263
|
},
|
|
264
|
+
loadOverridableProps: (state, { payload }) => {
|
|
265
|
+
const componentIds = Object.keys(payload);
|
|
266
|
+
componentIds.forEach((id) => {
|
|
267
|
+
const componentId = Number(id);
|
|
268
|
+
const overridableProps = payload[componentId];
|
|
269
|
+
const component = state.data.find((comp) => comp.id === componentId);
|
|
270
|
+
if (!component || !overridableProps) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
component.overridableProps = overridableProps;
|
|
274
|
+
});
|
|
275
|
+
},
|
|
263
276
|
rename: (state, { payload }) => {
|
|
264
277
|
const component = state.data.find((comp) => comp.uid === payload.componentUid);
|
|
265
278
|
if (!component) {
|
|
@@ -490,11 +503,10 @@ var componentOverrideTransformer = (0, import_editor_canvas3.createTransformer)(
|
|
|
490
503
|
});
|
|
491
504
|
|
|
492
505
|
// src/components/components-tab/components.tsx
|
|
493
|
-
var
|
|
506
|
+
var React10 = __toESM(require("react"));
|
|
494
507
|
var import_react3 = require("react");
|
|
495
508
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
496
|
-
var
|
|
497
|
-
var import_utils3 = require("@elementor/utils");
|
|
509
|
+
var import_ui7 = require("@elementor/ui");
|
|
498
510
|
|
|
499
511
|
// src/hooks/use-components.ts
|
|
500
512
|
var import_store6 = require("@elementor/store");
|
|
@@ -504,6 +516,16 @@ var useComponents = () => {
|
|
|
504
516
|
return { components, isLoading };
|
|
505
517
|
};
|
|
506
518
|
|
|
519
|
+
// src/utils/is-pro-components-supported.ts
|
|
520
|
+
var import_utils = require("@elementor/utils");
|
|
521
|
+
var MIN_PRO_VERSION_FOR_COMPONENTS = "4.0";
|
|
522
|
+
function isProComponentsSupported() {
|
|
523
|
+
return (0, import_utils.hasProInstalled)() && (0, import_utils.isProAtLeast)(MIN_PRO_VERSION_FOR_COMPONENTS);
|
|
524
|
+
}
|
|
525
|
+
function isProOutdatedForComponents() {
|
|
526
|
+
return (0, import_utils.hasProInstalled)() && !(0, import_utils.isProAtLeast)(MIN_PRO_VERSION_FOR_COMPONENTS);
|
|
527
|
+
}
|
|
528
|
+
|
|
507
529
|
// src/components/components-tab/component-search.tsx
|
|
508
530
|
var React2 = __toESM(require("react"));
|
|
509
531
|
var import_icons = require("@elementor/icons");
|
|
@@ -513,13 +535,13 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
513
535
|
// src/components/components-tab/search-provider.tsx
|
|
514
536
|
var React = __toESM(require("react"));
|
|
515
537
|
var import_react = require("react");
|
|
516
|
-
var
|
|
538
|
+
var import_utils2 = require("@elementor/utils");
|
|
517
539
|
var SearchContext = (0, import_react.createContext)(void 0);
|
|
518
540
|
var SearchProvider = ({
|
|
519
541
|
children,
|
|
520
542
|
localStorageKey
|
|
521
543
|
}) => {
|
|
522
|
-
const { debouncedValue, handleChange, inputValue } = (0,
|
|
544
|
+
const { debouncedValue, handleChange, inputValue } = (0, import_utils2.useSearchState)({ localStorageKey });
|
|
523
545
|
const clearSearch = () => {
|
|
524
546
|
handleChange("");
|
|
525
547
|
};
|
|
@@ -556,7 +578,6 @@ var ComponentSearch = () => {
|
|
|
556
578
|
var React5 = __toESM(require("react"));
|
|
557
579
|
var import_icons3 = require("@elementor/icons");
|
|
558
580
|
var import_ui4 = require("@elementor/ui");
|
|
559
|
-
var import_utils2 = require("@elementor/utils");
|
|
560
581
|
var import_i18n2 = require("@wordpress/i18n");
|
|
561
582
|
|
|
562
583
|
// src/hooks/use-components-permissions.ts
|
|
@@ -701,6 +722,7 @@ var LoadingComponents = () => {
|
|
|
701
722
|
// src/components/components-tab/components-list.tsx
|
|
702
723
|
var LEARN_MORE_URL = "http://go.elementor.com/components-guide-article";
|
|
703
724
|
var UPGRADE_URL = "https://go.elementor.com/go-pro-components/";
|
|
725
|
+
var UPDATE_PLUGINS_URL = "/wp-admin/plugins.php";
|
|
704
726
|
var SUBTITLE_OVERRIDE_SX = {
|
|
705
727
|
fontSize: "0.875rem !important",
|
|
706
728
|
fontWeight: "500 !important"
|
|
@@ -715,7 +737,10 @@ function ComponentsList() {
|
|
|
715
737
|
if (searchValue.length) {
|
|
716
738
|
return /* @__PURE__ */ React5.createElement(EmptySearchResult, null);
|
|
717
739
|
}
|
|
718
|
-
|
|
740
|
+
if (isProOutdatedForComponents()) {
|
|
741
|
+
return /* @__PURE__ */ React5.createElement(ProOutdatedEmptyState, null);
|
|
742
|
+
}
|
|
743
|
+
return isProComponentsSupported() ? /* @__PURE__ */ React5.createElement(EmptyState, null) : /* @__PURE__ */ React5.createElement(ProUpgradeEmptyState, null);
|
|
719
744
|
}
|
|
720
745
|
return /* @__PURE__ */ React5.createElement(import_ui4.List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React5.createElement(ComponentItem, { key: component.uid, component })));
|
|
721
746
|
}
|
|
@@ -746,6 +771,32 @@ var ProUpgradeEmptyState = () => {
|
|
|
746
771
|
)
|
|
747
772
|
);
|
|
748
773
|
};
|
|
774
|
+
var ProOutdatedEmptyState = () => {
|
|
775
|
+
return /* @__PURE__ */ React5.createElement(
|
|
776
|
+
import_ui4.Stack,
|
|
777
|
+
{
|
|
778
|
+
alignItems: "center",
|
|
779
|
+
justifyContent: "start",
|
|
780
|
+
height: "100%",
|
|
781
|
+
sx: { px: 2, py: 4, maxWidth: 268, m: "auto" },
|
|
782
|
+
gap: 2,
|
|
783
|
+
overflow: "hidden"
|
|
784
|
+
},
|
|
785
|
+
/* @__PURE__ */ React5.createElement(import_ui4.Stack, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React5.createElement(import_icons3.ComponentsIcon, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React5.createElement(import_ui4.Typography, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, (0, import_i18n2.__)("Create Reusable Components", "elementor")), /* @__PURE__ */ React5.createElement(import_ui4.Typography, { align: "center", variant: "caption", color: "secondary" }, (0, import_i18n2.__)("Create design elements that sync across your entire site.", "elementor")), /* @__PURE__ */ React5.createElement(import_ui4.Typography, { align: "center", variant: "caption", color: "secondary", sx: { mt: 1 } }, (0, import_i18n2.__)("To create components, update Elementor Pro to the latest version.", "elementor"))),
|
|
786
|
+
/* @__PURE__ */ React5.createElement(
|
|
787
|
+
import_ui4.Button,
|
|
788
|
+
{
|
|
789
|
+
variant: "text",
|
|
790
|
+
color: "info",
|
|
791
|
+
size: "small",
|
|
792
|
+
href: UPDATE_PLUGINS_URL,
|
|
793
|
+
target: "_blank",
|
|
794
|
+
rel: "noopener noreferrer"
|
|
795
|
+
},
|
|
796
|
+
(0, import_i18n2.__)("Update Elementor Pro", "elementor")
|
|
797
|
+
)
|
|
798
|
+
);
|
|
799
|
+
};
|
|
749
800
|
var EmptyState = () => {
|
|
750
801
|
const { canCreate } = useComponentsPermissions();
|
|
751
802
|
return /* @__PURE__ */ React5.createElement(
|
|
@@ -888,7 +939,7 @@ function ComponentsUpgradeAlert({ title, description, upgradeUrl }) {
|
|
|
888
939
|
}
|
|
889
940
|
|
|
890
941
|
// src/components/components-tab/components-pro-notification.tsx
|
|
891
|
-
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-
|
|
942
|
+
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-exist-footer/";
|
|
892
943
|
function ComponentsProNotification() {
|
|
893
944
|
return /* @__PURE__ */ React7.createElement(
|
|
894
945
|
ComponentsUpgradeAlert,
|
|
@@ -900,6 +951,54 @@ function ComponentsProNotification() {
|
|
|
900
951
|
);
|
|
901
952
|
}
|
|
902
953
|
|
|
954
|
+
// src/components/components-tab/components-update-notification.tsx
|
|
955
|
+
var React9 = __toESM(require("react"));
|
|
956
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
957
|
+
|
|
958
|
+
// src/components/components-update-alert.tsx
|
|
959
|
+
var React8 = __toESM(require("react"));
|
|
960
|
+
var import_icons5 = require("@elementor/icons");
|
|
961
|
+
var import_ui6 = require("@elementor/ui");
|
|
962
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
963
|
+
var UPDATE_PLUGINS_URL2 = "/wp-admin/plugins.php";
|
|
964
|
+
function ComponentsUpdateAlert({ title, description }) {
|
|
965
|
+
return /* @__PURE__ */ React8.createElement(import_ui6.Box, { sx: { mt: "auto", position: "sticky", bottom: 0 } }, /* @__PURE__ */ React8.createElement(
|
|
966
|
+
import_ui6.Alert,
|
|
967
|
+
{
|
|
968
|
+
variant: "standard",
|
|
969
|
+
color: "info",
|
|
970
|
+
icon: /* @__PURE__ */ React8.createElement(import_icons5.InfoCircleFilledIcon, { fontSize: "tiny" }),
|
|
971
|
+
role: "status",
|
|
972
|
+
size: "small",
|
|
973
|
+
action: /* @__PURE__ */ React8.createElement(
|
|
974
|
+
import_ui6.AlertAction,
|
|
975
|
+
{
|
|
976
|
+
variant: "contained",
|
|
977
|
+
color: "info",
|
|
978
|
+
href: UPDATE_PLUGINS_URL2,
|
|
979
|
+
target: "_blank",
|
|
980
|
+
rel: "noopener noreferrer"
|
|
981
|
+
},
|
|
982
|
+
(0, import_i18n5.__)("Upgrade Now", "elementor")
|
|
983
|
+
),
|
|
984
|
+
sx: { m: 2, mt: 1 }
|
|
985
|
+
},
|
|
986
|
+
/* @__PURE__ */ React8.createElement(import_ui6.AlertTitle, null, title),
|
|
987
|
+
/* @__PURE__ */ React8.createElement(import_ui6.Typography, { variant: "caption" }, description)
|
|
988
|
+
));
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// src/components/components-tab/components-update-notification.tsx
|
|
992
|
+
function ComponentsUpdateNotification() {
|
|
993
|
+
return /* @__PURE__ */ React9.createElement(
|
|
994
|
+
ComponentsUpdateAlert,
|
|
995
|
+
{
|
|
996
|
+
title: (0, import_i18n6.__)("Create new Components", "elementor"),
|
|
997
|
+
description: (0, import_i18n6.__)("To create new components, update Elementor Pro to the latest version.", "elementor")
|
|
998
|
+
}
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
903
1002
|
// src/components/components-tab/components.tsx
|
|
904
1003
|
var FULL_HEIGHT_STYLE_ID = "components-full-height-panel";
|
|
905
1004
|
var FULL_HEIGHT_CSS = `
|
|
@@ -940,34 +1039,34 @@ var useFullHeightPanel = () => {
|
|
|
940
1039
|
var ComponentsContent = () => {
|
|
941
1040
|
const { components, isLoading } = useComponents();
|
|
942
1041
|
const hasComponents = !isLoading && components.length > 0;
|
|
943
|
-
const
|
|
944
|
-
const
|
|
1042
|
+
const showProNotification = !isProComponentsSupported() && hasComponents;
|
|
1043
|
+
const isOutdated = isProOutdatedForComponents();
|
|
945
1044
|
useFullHeightPanel();
|
|
946
|
-
return /* @__PURE__ */
|
|
1045
|
+
return /* @__PURE__ */ React10.createElement(import_ui7.Stack, { justifyContent: "space-between", sx: { flex: 1, minHeight: 0 } }, hasComponents && /* @__PURE__ */ React10.createElement(ComponentSearch, null), /* @__PURE__ */ React10.createElement(ComponentsList, null), showProNotification && (isOutdated ? /* @__PURE__ */ React10.createElement(ComponentsUpdateNotification, null) : /* @__PURE__ */ React10.createElement(ComponentsProNotification, null)));
|
|
947
1046
|
};
|
|
948
1047
|
var Components = () => {
|
|
949
|
-
return /* @__PURE__ */
|
|
1048
|
+
return /* @__PURE__ */ React10.createElement(import_editor_ui2.ThemeProvider, null, /* @__PURE__ */ React10.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React10.createElement(ComponentsContent, null)));
|
|
950
1049
|
};
|
|
951
1050
|
|
|
952
1051
|
// src/components/detach-instance-confirmation-dialog.tsx
|
|
953
|
-
var
|
|
1052
|
+
var React11 = __toESM(require("react"));
|
|
954
1053
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
955
|
-
var
|
|
956
|
-
var
|
|
1054
|
+
var import_icons6 = require("@elementor/icons");
|
|
1055
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
957
1056
|
function DetachInstanceConfirmationDialog({
|
|
958
1057
|
open,
|
|
959
1058
|
onClose,
|
|
960
1059
|
onConfirm
|
|
961
1060
|
}) {
|
|
962
|
-
return /* @__PURE__ */
|
|
1061
|
+
return /* @__PURE__ */ React11.createElement(import_editor_ui3.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React11.createElement(import_editor_ui3.ConfirmationDialog.Title, { icon: import_icons6.AlertTriangleFilledIcon, iconColor: "secondary" }, (0, import_i18n7.__)("Detach from Component?", "elementor")), /* @__PURE__ */ React11.createElement(import_editor_ui3.ConfirmationDialog.Content, null, /* @__PURE__ */ React11.createElement(import_editor_ui3.ConfirmationDialog.ContentText, null, (0, import_i18n7.__)(
|
|
963
1062
|
"Detaching this instance will break its link to the Component. Changes to the Component will no longer apply. Continue?",
|
|
964
1063
|
"elementor"
|
|
965
|
-
))), /* @__PURE__ */
|
|
1064
|
+
))), /* @__PURE__ */ React11.createElement(
|
|
966
1065
|
import_editor_ui3.ConfirmationDialog.Actions,
|
|
967
1066
|
{
|
|
968
1067
|
onClose,
|
|
969
1068
|
onConfirm,
|
|
970
|
-
confirmLabel: (0,
|
|
1069
|
+
confirmLabel: (0, import_i18n7.__)("Detach", "elementor"),
|
|
971
1070
|
color: "primary"
|
|
972
1071
|
}
|
|
973
1072
|
));
|
|
@@ -978,59 +1077,58 @@ function openDetachConfirmDialog(onConfirm) {
|
|
|
978
1077
|
onConfirm();
|
|
979
1078
|
};
|
|
980
1079
|
(0, import_editor_ui3.openDialog)({
|
|
981
|
-
component: /* @__PURE__ */
|
|
1080
|
+
component: /* @__PURE__ */ React11.createElement(DetachInstanceConfirmationDialog, { open: true, onClose: import_editor_ui3.closeDialog, onConfirm: handleConfirm })
|
|
982
1081
|
});
|
|
983
1082
|
}
|
|
984
1083
|
|
|
985
1084
|
// src/components/in-edit-mode.tsx
|
|
986
|
-
var
|
|
1085
|
+
var React12 = __toESM(require("react"));
|
|
987
1086
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
988
|
-
var
|
|
989
|
-
var
|
|
990
|
-
var
|
|
1087
|
+
var import_icons7 = require("@elementor/icons");
|
|
1088
|
+
var import_ui8 = require("@elementor/ui");
|
|
1089
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
991
1090
|
var openEditModeDialog = (lockedBy) => {
|
|
992
1091
|
(0, import_editor_ui4.openDialog)({
|
|
993
|
-
component: /* @__PURE__ */
|
|
1092
|
+
component: /* @__PURE__ */ React12.createElement(EditModeDialog, { lockedBy })
|
|
994
1093
|
});
|
|
995
1094
|
};
|
|
996
1095
|
var EditModeDialog = ({ lockedBy }) => {
|
|
997
|
-
const content = (0,
|
|
998
|
-
return /* @__PURE__ */
|
|
1096
|
+
const content = (0, import_i18n8.__)("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
1097
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(import_ui8.DialogHeader, { logo: false }, /* @__PURE__ */ React12.createElement(import_ui8.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React12.createElement(import_ui8.Icon, { color: "secondary" }, /* @__PURE__ */ React12.createElement(import_icons7.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React12.createElement(import_ui8.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React12.createElement(import_ui8.DialogContent, null, /* @__PURE__ */ React12.createElement(import_ui8.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React12.createElement(import_ui8.Typography, { variant: "body2" }, (0, import_i18n8.__)(
|
|
999
1098
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
1000
1099
|
"elementor"
|
|
1001
|
-
)), /* @__PURE__ */
|
|
1100
|
+
)), /* @__PURE__ */ React12.createElement(import_ui8.DialogActions, null, /* @__PURE__ */ React12.createElement(import_ui8.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui4.closeDialog }, (0, import_i18n8.__)("Close", "elementor"))))));
|
|
1002
1101
|
};
|
|
1003
1102
|
|
|
1004
1103
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
1005
|
-
var
|
|
1006
|
-
var
|
|
1007
|
-
var
|
|
1008
|
-
var
|
|
1009
|
-
var import_i18n10 = require("@wordpress/i18n");
|
|
1104
|
+
var React22 = __toESM(require("react"));
|
|
1105
|
+
var import_icons11 = require("@elementor/icons");
|
|
1106
|
+
var import_ui15 = require("@elementor/ui");
|
|
1107
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1010
1108
|
|
|
1011
1109
|
// src/provider/component-instance-context.tsx
|
|
1012
|
-
var
|
|
1110
|
+
var React13 = __toESM(require("react"));
|
|
1013
1111
|
var import_react4 = require("react");
|
|
1014
1112
|
var ComponentInstanceContext = (0, import_react4.createContext)(null);
|
|
1015
1113
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
1016
|
-
return /* @__PURE__ */
|
|
1114
|
+
return /* @__PURE__ */ React13.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
1017
1115
|
}
|
|
1018
1116
|
var useComponentId = () => (0, import_react4.useContext)(ComponentInstanceContext)?.componentId;
|
|
1019
1117
|
var useComponentInstanceOverrides = () => (0, import_react4.useContext)(ComponentInstanceContext)?.overrides;
|
|
1020
1118
|
var useComponentOverridableProps = () => (0, import_react4.useContext)(ComponentInstanceContext)?.overridableProps;
|
|
1021
1119
|
|
|
1022
1120
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
1023
|
-
var
|
|
1121
|
+
var React15 = __toESM(require("react"));
|
|
1024
1122
|
var import_react5 = require("react");
|
|
1025
1123
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
1026
|
-
var
|
|
1027
|
-
var
|
|
1124
|
+
var import_icons9 = require("@elementor/icons");
|
|
1125
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1028
1126
|
|
|
1029
1127
|
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
1030
1128
|
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
1031
1129
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1032
1130
|
var import_store10 = require("@elementor/store");
|
|
1033
|
-
var
|
|
1131
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1034
1132
|
|
|
1035
1133
|
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
1036
1134
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
@@ -1379,8 +1477,8 @@ async function detachComponentInstance({
|
|
|
1379
1477
|
}
|
|
1380
1478
|
},
|
|
1381
1479
|
{
|
|
1382
|
-
title: (0,
|
|
1383
|
-
subtitle: (0,
|
|
1480
|
+
title: (0, import_i18n9.__)("Detach from Component", "elementor"),
|
|
1481
|
+
subtitle: (0, import_i18n9.__)("Instance detached", "elementor")
|
|
1384
1482
|
}
|
|
1385
1483
|
);
|
|
1386
1484
|
return undoableDetach();
|
|
@@ -1395,16 +1493,16 @@ function extractInstanceOverrides(instanceContainer) {
|
|
|
1395
1493
|
}
|
|
1396
1494
|
|
|
1397
1495
|
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1398
|
-
var
|
|
1496
|
+
var React14 = __toESM(require("react"));
|
|
1399
1497
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
1400
1498
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1401
|
-
var
|
|
1402
|
-
var
|
|
1499
|
+
var import_icons8 = require("@elementor/icons");
|
|
1500
|
+
var import_ui9 = require("@elementor/ui");
|
|
1403
1501
|
function InstancePanelHeader({ componentName, actions }) {
|
|
1404
|
-
return /* @__PURE__ */
|
|
1502
|
+
return /* @__PURE__ */ React14.createElement(import_editor_panels.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React14.createElement(import_ui9.Stack, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React14.createElement(import_icons8.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React14.createElement(import_editor_ui5.EllipsisWithTooltip, { title: componentName, as: import_editor_panels.PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1405
1503
|
}
|
|
1406
1504
|
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1407
|
-
return /* @__PURE__ */
|
|
1505
|
+
return /* @__PURE__ */ React14.createElement(import_ui9.Tooltip, { title: label }, /* @__PURE__ */ React14.createElement(import_ui9.IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React14.createElement(Icon2, { fontSize: "tiny" })));
|
|
1408
1506
|
}
|
|
1409
1507
|
|
|
1410
1508
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
@@ -1424,7 +1522,7 @@ var DetachAction = ({
|
|
|
1424
1522
|
} catch {
|
|
1425
1523
|
(0, import_editor_notifications.notify)({
|
|
1426
1524
|
type: "error",
|
|
1427
|
-
message: (0,
|
|
1525
|
+
message: (0, import_i18n10.__)("Failed to detach component instance.", "elementor"),
|
|
1428
1526
|
id: "detach-component-instance-failed"
|
|
1429
1527
|
});
|
|
1430
1528
|
}
|
|
@@ -1435,8 +1533,8 @@ var DetachAction = ({
|
|
|
1435
1533
|
const handleDetachClick = () => {
|
|
1436
1534
|
setIsDetachDialogOpen(true);
|
|
1437
1535
|
};
|
|
1438
|
-
const detachLabel = (0,
|
|
1439
|
-
return /* @__PURE__ */
|
|
1536
|
+
const detachLabel = (0, import_i18n10.__)("Detach from Component", "elementor");
|
|
1537
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(EditComponentAction, { label: detachLabel, icon: import_icons9.DetachIcon, onClick: handleDetachClick }), /* @__PURE__ */ React15.createElement(
|
|
1440
1538
|
DetachInstanceConfirmationDialog,
|
|
1441
1539
|
{
|
|
1442
1540
|
open: isDetachDialogOpen,
|
|
@@ -1461,21 +1559,21 @@ function getDetachTrackingInfo() {
|
|
|
1461
1559
|
}
|
|
1462
1560
|
|
|
1463
1561
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
1464
|
-
var
|
|
1465
|
-
var
|
|
1466
|
-
var
|
|
1467
|
-
var
|
|
1562
|
+
var React16 = __toESM(require("react"));
|
|
1563
|
+
var import_icons10 = require("@elementor/icons");
|
|
1564
|
+
var import_ui10 = require("@elementor/ui");
|
|
1565
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1468
1566
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
1469
1567
|
const { canEdit } = useComponentsPermissions();
|
|
1470
|
-
const message = canEdit ? (0,
|
|
1568
|
+
const message = canEdit ? (0, import_i18n11.__)(
|
|
1471
1569
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
1472
1570
|
"elementor"
|
|
1473
|
-
) : (0,
|
|
1571
|
+
) : (0, import_i18n11.__)(
|
|
1474
1572
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
1475
1573
|
"elementor"
|
|
1476
1574
|
);
|
|
1477
|
-
return /* @__PURE__ */
|
|
1478
|
-
|
|
1575
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1576
|
+
import_ui10.Stack,
|
|
1479
1577
|
{
|
|
1480
1578
|
alignItems: "center",
|
|
1481
1579
|
justifyContent: "start",
|
|
@@ -1484,11 +1582,11 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1484
1582
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
1485
1583
|
gap: 1.5
|
|
1486
1584
|
},
|
|
1487
|
-
/* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
canEdit && /* @__PURE__ */
|
|
1491
|
-
|
|
1585
|
+
/* @__PURE__ */ React16.createElement(import_icons10.ComponentPropListIcon, { fontSize: "large" }),
|
|
1586
|
+
/* @__PURE__ */ React16.createElement(import_ui10.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n11.__)("No properties yet", "elementor")),
|
|
1587
|
+
/* @__PURE__ */ React16.createElement(import_ui10.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1588
|
+
canEdit && /* @__PURE__ */ React16.createElement(
|
|
1589
|
+
import_ui10.Button,
|
|
1492
1590
|
{
|
|
1493
1591
|
variant: "outlined",
|
|
1494
1592
|
color: "secondary",
|
|
@@ -1497,32 +1595,32 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1497
1595
|
disabled: !onEditComponent,
|
|
1498
1596
|
onClick: onEditComponent
|
|
1499
1597
|
},
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
(0,
|
|
1598
|
+
/* @__PURE__ */ React16.createElement(import_icons10.PencilIcon, { fontSize: "small" }),
|
|
1599
|
+
(0, import_i18n11.__)("Edit component", "elementor")
|
|
1502
1600
|
)
|
|
1503
1601
|
);
|
|
1504
1602
|
};
|
|
1505
1603
|
|
|
1506
1604
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1507
|
-
var
|
|
1605
|
+
var React21 = __toESM(require("react"));
|
|
1508
1606
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
1509
1607
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
1510
1608
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
1511
|
-
var
|
|
1609
|
+
var import_ui14 = require("@elementor/ui");
|
|
1512
1610
|
|
|
1513
1611
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1514
|
-
var
|
|
1612
|
+
var React20 = __toESM(require("react"));
|
|
1515
1613
|
var import_react7 = require("react");
|
|
1516
1614
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1517
1615
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1518
|
-
var
|
|
1616
|
+
var import_ui13 = require("@elementor/ui");
|
|
1519
1617
|
|
|
1520
1618
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1521
|
-
var
|
|
1619
|
+
var React19 = __toESM(require("react"));
|
|
1522
1620
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
1523
1621
|
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
1524
1622
|
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1525
|
-
var
|
|
1623
|
+
var import_ui12 = require("@elementor/ui");
|
|
1526
1624
|
|
|
1527
1625
|
// src/hooks/use-controls-by-widget-type.ts
|
|
1528
1626
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
@@ -1556,11 +1654,11 @@ function getControlsByBind(controls) {
|
|
|
1556
1654
|
}
|
|
1557
1655
|
|
|
1558
1656
|
// src/provider/overridable-prop-context.tsx
|
|
1559
|
-
var
|
|
1657
|
+
var React17 = __toESM(require("react"));
|
|
1560
1658
|
var import_react6 = require("react");
|
|
1561
1659
|
var OverridablePropContext = (0, import_react6.createContext)(null);
|
|
1562
1660
|
function OverridablePropProvider({ children, ...props }) {
|
|
1563
|
-
return /* @__PURE__ */
|
|
1661
|
+
return /* @__PURE__ */ React17.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1564
1662
|
}
|
|
1565
1663
|
var useOverridablePropValue = () => (0, import_react6.useContext)(OverridablePropContext)?.value;
|
|
1566
1664
|
var useComponentInstanceElement = () => (0, import_react6.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
@@ -1792,16 +1890,16 @@ function extractInnerOverrideInfo(override) {
|
|
|
1792
1890
|
}
|
|
1793
1891
|
|
|
1794
1892
|
// src/components/control-label.tsx
|
|
1795
|
-
var
|
|
1893
|
+
var React18 = __toESM(require("react"));
|
|
1796
1894
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
1797
|
-
var
|
|
1895
|
+
var import_ui11 = require("@elementor/ui");
|
|
1798
1896
|
var ControlLabel = ({ children, ...props }) => {
|
|
1799
|
-
return /* @__PURE__ */
|
|
1897
|
+
return /* @__PURE__ */ React18.createElement(import_ui11.Stack, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React18.createElement(import_editor_controls.ControlFormLabel, { ...props }, children), /* @__PURE__ */ React18.createElement(import_editor_controls.ControlAdornments, null));
|
|
1800
1898
|
};
|
|
1801
1899
|
|
|
1802
1900
|
// src/components/errors.ts
|
|
1803
|
-
var
|
|
1804
|
-
var OverrideControlInnerElementNotFoundError = (0,
|
|
1901
|
+
var import_utils3 = require("@elementor/utils");
|
|
1902
|
+
var OverrideControlInnerElementNotFoundError = (0, import_utils3.createError)({
|
|
1805
1903
|
code: "override_control_inner_element_not_found",
|
|
1806
1904
|
message: `Component inner element not found for override control. The element may have been deleted without updating the overridable props, or the component has not finished rendering yet.`
|
|
1807
1905
|
});
|
|
@@ -1898,6 +1996,19 @@ function hasValue(value) {
|
|
|
1898
1996
|
return value !== null && value !== void 0;
|
|
1899
1997
|
}
|
|
1900
1998
|
|
|
1999
|
+
// src/components/instance-editing-panel/utils/correct-exposed-empty-override.ts
|
|
2000
|
+
function correctExposedEmptyOverride(newPropValue, matchingOverride) {
|
|
2001
|
+
const newOverridableValue = componentOverridablePropTypeUtil.extract(newPropValue);
|
|
2002
|
+
const isExposingEmptyOverride = newOverridableValue && matchingOverride === null;
|
|
2003
|
+
if (!isExposingEmptyOverride) {
|
|
2004
|
+
return newPropValue;
|
|
2005
|
+
}
|
|
2006
|
+
return componentOverridablePropTypeUtil.create({
|
|
2007
|
+
override_key: newOverridableValue.override_key,
|
|
2008
|
+
origin_value: null
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
|
|
1901
2012
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1902
2013
|
function OverridePropControl({ overrideKey }) {
|
|
1903
2014
|
const overridableProps = useComponentOverridableProps();
|
|
@@ -1905,7 +2016,7 @@ function OverridePropControl({ overrideKey }) {
|
|
|
1905
2016
|
if (!overridableProp) {
|
|
1906
2017
|
return null;
|
|
1907
2018
|
}
|
|
1908
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ React19.createElement(import_editor_editing_panel.SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React19.createElement(OverrideControl, { overridableProp }));
|
|
1909
2020
|
}
|
|
1910
2021
|
function OverrideControl({ overridableProp }) {
|
|
1911
2022
|
const componentInstanceElement = (0, import_editor_editing_panel.useElement)();
|
|
@@ -1943,11 +2054,12 @@ function OverrideControl({ overridableProp }) {
|
|
|
1943
2054
|
});
|
|
1944
2055
|
return;
|
|
1945
2056
|
}
|
|
1946
|
-
|
|
2057
|
+
let newPropValue = getTempNewValueForDynamicProp(
|
|
1947
2058
|
propType,
|
|
1948
2059
|
propValue,
|
|
1949
2060
|
newValue[overridableProp.overrideKey]
|
|
1950
2061
|
);
|
|
2062
|
+
newPropValue = correctExposedEmptyOverride(newPropValue, matchingOverride);
|
|
1951
2063
|
const newOverrideValue = createOverrideValue({
|
|
1952
2064
|
matchingOverride,
|
|
1953
2065
|
overrideKey: overridableProp.overrideKey,
|
|
@@ -1999,13 +2111,13 @@ function OverrideControl({ overridableProp }) {
|
|
|
1999
2111
|
[overridableProp.overrideKey]: propType
|
|
2000
2112
|
}
|
|
2001
2113
|
});
|
|
2002
|
-
return /* @__PURE__ */
|
|
2114
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2003
2115
|
OverridablePropProvider,
|
|
2004
2116
|
{
|
|
2005
2117
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
2006
2118
|
componentInstanceElement
|
|
2007
2119
|
},
|
|
2008
|
-
/* @__PURE__ */
|
|
2120
|
+
/* @__PURE__ */ React19.createElement(import_editor_editing_panel.ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React19.createElement(import_editor_editing_panel.SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React19.createElement(
|
|
2009
2121
|
import_editor_controls2.PropProvider,
|
|
2010
2122
|
{
|
|
2011
2123
|
propType: propTypeSchema,
|
|
@@ -2015,7 +2127,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
2015
2127
|
return false;
|
|
2016
2128
|
}
|
|
2017
2129
|
},
|
|
2018
|
-
/* @__PURE__ */
|
|
2130
|
+
/* @__PURE__ */ React19.createElement(import_editor_controls2.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React19.createElement(import_editor_controls2.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React19.createElement(import_ui12.Box, { mb: 1.5 }, /* @__PURE__ */ React19.createElement(import_editor_editing_panel.ControlTypeContainer, { layout }, layout !== "custom" && /* @__PURE__ */ React19.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React19.createElement(OriginalControl, { control, controlProps })))))
|
|
2019
2131
|
)))
|
|
2020
2132
|
);
|
|
2021
2133
|
}
|
|
@@ -2074,7 +2186,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
2074
2186
|
}
|
|
2075
2187
|
function OriginalControl({ control, controlProps }) {
|
|
2076
2188
|
const { value } = control;
|
|
2077
|
-
return /* @__PURE__ */
|
|
2189
|
+
return /* @__PURE__ */ React19.createElement(import_editor_editing_panel.BaseControl, { type: value.type, props: controlProps });
|
|
2078
2190
|
}
|
|
2079
2191
|
function getControlLayout(control) {
|
|
2080
2192
|
return control.value.meta?.layout || import_editor_editing_panel.controlsRegistry.getLayout(control.value.type);
|
|
@@ -2109,8 +2221,8 @@ function OverridePropsGroup({ group }) {
|
|
|
2109
2221
|
const labelId = `label-${id}`;
|
|
2110
2222
|
const contentId = `content-${id}`;
|
|
2111
2223
|
const title = group.label;
|
|
2112
|
-
return /* @__PURE__ */
|
|
2113
|
-
|
|
2224
|
+
return /* @__PURE__ */ React20.createElement(import_ui13.Box, { "aria-label": `${title} section` }, /* @__PURE__ */ React20.createElement(
|
|
2225
|
+
import_ui13.ListItemButton,
|
|
2114
2226
|
{
|
|
2115
2227
|
id: labelId,
|
|
2116
2228
|
"aria-controls": contentId,
|
|
@@ -2119,21 +2231,21 @@ function OverridePropsGroup({ group }) {
|
|
|
2119
2231
|
p: 0,
|
|
2120
2232
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2121
2233
|
},
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
|
|
2234
|
+
/* @__PURE__ */ React20.createElement(import_ui13.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React20.createElement(
|
|
2235
|
+
import_ui13.ListItemText,
|
|
2124
2236
|
{
|
|
2125
2237
|
secondary: title,
|
|
2126
2238
|
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
2127
2239
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
2128
2240
|
}
|
|
2129
2241
|
)),
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
), /* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ React20.createElement(import_editor_ui6.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
2243
|
+
), /* @__PURE__ */ React20.createElement(import_ui13.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React20.createElement(import_ui13.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React20.createElement(OverridePropControl, { key: overrideKey, overrideKey })))));
|
|
2132
2244
|
}
|
|
2133
2245
|
|
|
2134
2246
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
2135
2247
|
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
2136
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ React21.createElement(import_editor_panels2.PanelBody, null, /* @__PURE__ */ React21.createElement(import_editor_controls3.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel3.getFieldIndicators)("settings") }, isEmpty ? emptyState : /* @__PURE__ */ React21.createElement(import_ui14.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React21.createElement(React21.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React21.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React21.createElement(import_ui14.Divider, null))))));
|
|
2137
2249
|
}
|
|
2138
2250
|
|
|
2139
2251
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -2233,42 +2345,50 @@ function useComponentInstanceSettings() {
|
|
|
2233
2345
|
}
|
|
2234
2346
|
|
|
2235
2347
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
2236
|
-
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2348
|
+
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-footer/";
|
|
2237
2349
|
function InstanceEditingPanel() {
|
|
2238
2350
|
const { canEdit } = useComponentsPermissions();
|
|
2239
2351
|
const data = useInstancePanelData();
|
|
2240
|
-
const hasPro = (0, import_utils5.hasProInstalled)();
|
|
2241
2352
|
if (!data) {
|
|
2242
2353
|
return null;
|
|
2243
2354
|
}
|
|
2244
2355
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
2245
|
-
const panelTitle = (0,
|
|
2246
|
-
const actions = /* @__PURE__ */
|
|
2247
|
-
return /* @__PURE__ */
|
|
2356
|
+
const panelTitle = (0, import_i18n12.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
2357
|
+
const actions = /* @__PURE__ */ React22.createElement(import_ui15.Stack, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React22.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React22.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: import_icons11.PencilIcon }));
|
|
2358
|
+
return /* @__PURE__ */ React22.createElement(import_ui15.Box, { "data-testid": "instance-editing-panel", sx: { display: "flex", flexDirection: "column", height: "100%" } }, /* @__PURE__ */ React22.createElement(
|
|
2248
2359
|
ComponentInstanceProvider,
|
|
2249
2360
|
{
|
|
2250
2361
|
componentId,
|
|
2251
2362
|
overrides,
|
|
2252
2363
|
overridableProps
|
|
2253
2364
|
},
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2365
|
+
/* @__PURE__ */ React22.createElement(InstancePanelHeader, { componentName: component.name, actions }),
|
|
2366
|
+
/* @__PURE__ */ React22.createElement(
|
|
2256
2367
|
InstancePanelBody,
|
|
2257
2368
|
{
|
|
2258
2369
|
groups,
|
|
2259
2370
|
isEmpty,
|
|
2260
|
-
emptyState: /* @__PURE__ */
|
|
2371
|
+
emptyState: /* @__PURE__ */ React22.createElement(EmptyState2, null),
|
|
2261
2372
|
componentInstanceId
|
|
2262
2373
|
}
|
|
2263
2374
|
)
|
|
2264
|
-
), !
|
|
2375
|
+
), !isProComponentsSupported() && (isProOutdatedForComponents() ? /* @__PURE__ */ React22.createElement(
|
|
2376
|
+
ComponentsUpdateAlert,
|
|
2377
|
+
{
|
|
2378
|
+
title: (0, import_i18n12.__)("Edit Component", "elementor"),
|
|
2379
|
+
description: (0, import_i18n12.__)(
|
|
2380
|
+
"To edit components, update Elementor Pro to the latest version.",
|
|
2381
|
+
"elementor"
|
|
2382
|
+
)
|
|
2383
|
+
}
|
|
2384
|
+
) : /* @__PURE__ */ React22.createElement(
|
|
2265
2385
|
ComponentsUpgradeAlert,
|
|
2266
2386
|
{
|
|
2267
|
-
title: (0,
|
|
2268
|
-
description: (0,
|
|
2387
|
+
title: (0, import_i18n12.__)("Edit components", "elementor"),
|
|
2388
|
+
description: (0, import_i18n12.__)("Editing components requires an active Pro subscription.", "elementor"),
|
|
2269
2389
|
upgradeUrl: EDIT_UPGRADE_URL
|
|
2270
2390
|
}
|
|
2271
|
-
));
|
|
2391
|
+
)));
|
|
2272
2392
|
}
|
|
2273
2393
|
|
|
2274
2394
|
// src/components/load-template-components.tsx
|
|
@@ -2323,27 +2443,13 @@ async function getDocumentsMap(ids, cache) {
|
|
|
2323
2443
|
|
|
2324
2444
|
// src/store/actions/load-components-overridable-props.ts
|
|
2325
2445
|
var import_store23 = require("@elementor/store");
|
|
2326
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2327
|
-
|
|
2446
|
+
async function loadComponentsOverridableProps(componentIds) {
|
|
2447
|
+
const unloadedIds = componentIds.filter((id) => !selectIsOverridablePropsLoaded((0, import_store23.__getState)(), id));
|
|
2448
|
+
if (!unloadedIds.length) {
|
|
2328
2449
|
return;
|
|
2329
2450
|
}
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
async function loadComponentOverrides(componentId) {
|
|
2333
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded((0, import_store23.__getState)(), componentId);
|
|
2334
|
-
if (isOverridablePropsLoaded) {
|
|
2335
|
-
return;
|
|
2336
|
-
}
|
|
2337
|
-
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2338
|
-
if (!overridableProps) {
|
|
2339
|
-
return;
|
|
2340
|
-
}
|
|
2341
|
-
(0, import_store23.__dispatch)(
|
|
2342
|
-
slice.actions.setOverridableProps({
|
|
2343
|
-
componentId,
|
|
2344
|
-
overridableProps
|
|
2345
|
-
})
|
|
2346
|
-
);
|
|
2451
|
+
const { data } = await apiClient.getOverridableProps(unloadedIds);
|
|
2452
|
+
(0, import_store23.__dispatch)(slice.actions.loadOverridableProps(data));
|
|
2347
2453
|
}
|
|
2348
2454
|
|
|
2349
2455
|
// src/store/actions/load-components-styles.ts
|
|
@@ -2406,16 +2512,16 @@ var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
|
2406
2512
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
2407
2513
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2408
2514
|
var import_store27 = require("@elementor/store");
|
|
2409
|
-
var
|
|
2410
|
-
var
|
|
2515
|
+
var import_utils5 = require("@elementor/utils");
|
|
2516
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2411
2517
|
|
|
2412
2518
|
// src/utils/format-component-elements-id.ts
|
|
2413
|
-
var
|
|
2519
|
+
var import_utils4 = require("@elementor/utils");
|
|
2414
2520
|
var ELEMENT_ID_LENGTH = 7;
|
|
2415
2521
|
function formatComponentElementsId(elements, path) {
|
|
2416
2522
|
return elements.map((element) => {
|
|
2417
2523
|
const nestingPath = [...path, element.id];
|
|
2418
|
-
const id = (0,
|
|
2524
|
+
const id = (0, import_utils4.hashString)(nestingPath.join("_"), ELEMENT_ID_LENGTH);
|
|
2419
2525
|
return {
|
|
2420
2526
|
...element,
|
|
2421
2527
|
id,
|
|
@@ -2479,21 +2585,43 @@ function buildUniqueSelector(element) {
|
|
|
2479
2585
|
|
|
2480
2586
|
// src/create-component-type.ts
|
|
2481
2587
|
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
2482
|
-
var
|
|
2588
|
+
var EDIT_COMPONENT_DB_CLICK_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-canvas-double-click/";
|
|
2589
|
+
var EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-context-menu/";
|
|
2590
|
+
var UPDATE_PLUGINS_URL3 = "/wp-admin/plugins.php";
|
|
2483
2591
|
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
2592
|
+
var COMPONENT_EDIT_UPDATE_NOTIFICATION_ID = "component-edit-update";
|
|
2593
|
+
var COMPONENT_EDIT_UPGRADE_AUTO_HIDE_DURATION = 2e3;
|
|
2484
2594
|
function notifyComponentEditUpgrade() {
|
|
2485
2595
|
(0, import_editor_notifications2.notify)({
|
|
2486
2596
|
type: "promotion",
|
|
2487
2597
|
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
2488
|
-
message: (0,
|
|
2598
|
+
message: (0, import_i18n13.__)("Editing components requires an active Pro subscription.", "elementor"),
|
|
2599
|
+
autoHideDuration: COMPONENT_EDIT_UPGRADE_AUTO_HIDE_DURATION,
|
|
2489
2600
|
additionalActionProps: [
|
|
2490
2601
|
{
|
|
2491
2602
|
size: "small",
|
|
2492
2603
|
variant: "contained",
|
|
2493
2604
|
color: "promotion",
|
|
2494
|
-
href:
|
|
2605
|
+
href: EDIT_COMPONENT_DB_CLICK_UPGRADE_URL,
|
|
2495
2606
|
target: "_blank",
|
|
2496
|
-
children: (0,
|
|
2607
|
+
children: (0, import_i18n13.__)("Upgrade Now", "elementor")
|
|
2608
|
+
}
|
|
2609
|
+
]
|
|
2610
|
+
});
|
|
2611
|
+
}
|
|
2612
|
+
function notifyComponentEditUpdate() {
|
|
2613
|
+
(0, import_editor_notifications2.notify)({
|
|
2614
|
+
type: "info",
|
|
2615
|
+
id: COMPONENT_EDIT_UPDATE_NOTIFICATION_ID,
|
|
2616
|
+
message: (0, import_i18n13.__)("To edit components, update Elementor Pro to the latest version.", "elementor"),
|
|
2617
|
+
additionalActionProps: [
|
|
2618
|
+
{
|
|
2619
|
+
size: "small",
|
|
2620
|
+
variant: "contained",
|
|
2621
|
+
color: "info",
|
|
2622
|
+
href: UPDATE_PLUGINS_URL3,
|
|
2623
|
+
target: "_blank",
|
|
2624
|
+
children: (0, import_i18n13.__)("Update Now", "elementor")
|
|
2497
2625
|
}
|
|
2498
2626
|
]
|
|
2499
2627
|
});
|
|
@@ -2606,21 +2734,23 @@ function createComponentView(options) {
|
|
|
2606
2734
|
}
|
|
2607
2735
|
_getContextMenuConfig() {
|
|
2608
2736
|
const isAdministrator = isUserAdministrator();
|
|
2609
|
-
const hasPro = (0,
|
|
2737
|
+
const hasPro = (0, import_utils5.hasProInstalled)();
|
|
2738
|
+
const isOutdated = isProOutdatedForComponents();
|
|
2739
|
+
const showPromoBadge = !hasPro && !isOutdated;
|
|
2610
2740
|
const badgeClass = "elementor-context-menu-list__item__shortcut__promotion-badge";
|
|
2611
|
-
const proBadge = `<a href="${
|
|
2741
|
+
const proBadge = `<a href="${EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}"><i class="eicon-upgrade-crown"></i></a>`;
|
|
2612
2742
|
const editComponentAction = {
|
|
2613
2743
|
name: "edit component",
|
|
2614
2744
|
icon: "eicon-edit",
|
|
2615
|
-
title: () => (0,
|
|
2616
|
-
|
|
2617
|
-
isEnabled: () =>
|
|
2745
|
+
title: () => (0, import_i18n13.__)("Edit Component", "elementor"),
|
|
2746
|
+
...showPromoBadge && { shortcut: proBadge, hasShortcutAction: true },
|
|
2747
|
+
isEnabled: () => isProComponentsSupported() || isOutdated,
|
|
2618
2748
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
2619
2749
|
};
|
|
2620
2750
|
const detachInstanceAction = {
|
|
2621
2751
|
name: "detach instance",
|
|
2622
2752
|
icon: "eicon-chain-broken",
|
|
2623
|
-
title: () => (0,
|
|
2753
|
+
title: () => (0, import_i18n13.__)("Detach from Component", "elementor"),
|
|
2624
2754
|
isEnabled: () => true,
|
|
2625
2755
|
callback: (_, eventData) => this.detachInstance(eventData)
|
|
2626
2756
|
};
|
|
@@ -2647,8 +2777,11 @@ function createComponentView(options) {
|
|
|
2647
2777
|
}
|
|
2648
2778
|
}
|
|
2649
2779
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
2650
|
-
|
|
2651
|
-
|
|
2780
|
+
if (isProOutdatedForComponents()) {
|
|
2781
|
+
notifyComponentEditUpdate();
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
if (!isProComponentsSupported() || this.isComponentCurrentlyEdited()) {
|
|
2652
2785
|
return;
|
|
2653
2786
|
}
|
|
2654
2787
|
this.switchDocument();
|
|
@@ -2679,7 +2812,7 @@ function createComponentView(options) {
|
|
|
2679
2812
|
} catch {
|
|
2680
2813
|
(0, import_editor_notifications2.notify)({
|
|
2681
2814
|
type: "error",
|
|
2682
|
-
message: (0,
|
|
2815
|
+
message: (0, import_i18n13.__)("Failed to detach component instance.", "elementor"),
|
|
2683
2816
|
id: "detach-component-instance-failed"
|
|
2684
2817
|
});
|
|
2685
2818
|
}
|
|
@@ -2691,7 +2824,11 @@ function createComponentView(options) {
|
|
|
2691
2824
|
if (!isUserAdministrator()) {
|
|
2692
2825
|
return;
|
|
2693
2826
|
}
|
|
2694
|
-
if (
|
|
2827
|
+
if (isProOutdatedForComponents()) {
|
|
2828
|
+
notifyComponentEditUpdate();
|
|
2829
|
+
return;
|
|
2830
|
+
}
|
|
2831
|
+
if (!(0, import_utils5.hasProInstalled)()) {
|
|
2695
2832
|
notifyComponentEditUpgrade();
|
|
2696
2833
|
return;
|
|
2697
2834
|
}
|
|
@@ -2792,11 +2929,11 @@ var import_editor_elements9 = require("@elementor/editor-elements");
|
|
|
2792
2929
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
2793
2930
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2794
2931
|
var import_store30 = require("@elementor/store");
|
|
2795
|
-
var
|
|
2932
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2796
2933
|
var COMPONENT_TYPE = "e-component";
|
|
2797
2934
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
2798
2935
|
type: "default",
|
|
2799
|
-
message: (0,
|
|
2936
|
+
message: (0, import_i18n14.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
2800
2937
|
id: "circular-component-nesting-blocked"
|
|
2801
2938
|
};
|
|
2802
2939
|
function initCircularNestingPrevention() {
|
|
@@ -2947,9 +3084,9 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
2947
3084
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2948
3085
|
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
2949
3086
|
var import_http_client2 = require("@elementor/http-client");
|
|
2950
|
-
var
|
|
3087
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2951
3088
|
var INSUFFICIENT_PERMISSIONS_ERROR_CODE = "insufficient_permissions";
|
|
2952
|
-
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-
|
|
3089
|
+
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-draft-failure/";
|
|
2953
3090
|
var PUBLISH_UPGRADE_NOTIFICATION_ID = "component-publish-upgrade";
|
|
2954
3091
|
async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
2955
3092
|
if (status !== "publish") {
|
|
@@ -2978,7 +3115,7 @@ function notifyPublishUpgrade() {
|
|
|
2978
3115
|
(0, import_editor_notifications4.notify)({
|
|
2979
3116
|
type: "promotion",
|
|
2980
3117
|
id: PUBLISH_UPGRADE_NOTIFICATION_ID,
|
|
2981
|
-
message: (0,
|
|
3118
|
+
message: (0, import_i18n15.__)(
|
|
2982
3119
|
"You have unpublished component on this page. You need a pro version to publish it.",
|
|
2983
3120
|
"elementor"
|
|
2984
3121
|
),
|
|
@@ -2989,7 +3126,7 @@ function notifyPublishUpgrade() {
|
|
|
2989
3126
|
color: "promotion",
|
|
2990
3127
|
href: PUBLISH_UPGRADE_URL,
|
|
2991
3128
|
target: "_blank",
|
|
2992
|
-
children: (0,
|
|
3129
|
+
children: (0, import_i18n15.__)("Upgrade Now", "elementor")
|
|
2993
3130
|
}
|
|
2994
3131
|
]
|
|
2995
3132
|
});
|
|
@@ -3031,7 +3168,7 @@ function init() {
|
|
|
3031
3168
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
3032
3169
|
(0, import_editor_elements_panel.injectTab)({
|
|
3033
3170
|
id: "components",
|
|
3034
|
-
label: (0,
|
|
3171
|
+
label: (0, import_i18n16.__)("Components", "elementor"),
|
|
3035
3172
|
component: Components,
|
|
3036
3173
|
position: 1
|
|
3037
3174
|
});
|