@elementor/editor-components 4.0.0-683 → 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.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { injectTab } from "@elementor/editor-elements-panel";
|
|
|
10
10
|
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
11
11
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
12
12
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
13
|
-
import { __ as
|
|
13
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
14
14
|
|
|
15
15
|
// src/component-instance-transformer.ts
|
|
16
16
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
@@ -76,11 +76,12 @@ var apiClient = {
|
|
|
76
76
|
unlockComponent: async (componentId) => await httpService().post(`${BASE_URL}/unlock`, {
|
|
77
77
|
componentId
|
|
78
78
|
}).then((res) => res.data),
|
|
79
|
-
getOverridableProps: async (
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
getOverridableProps: async (componentIds) => await httpService().get(
|
|
80
|
+
`${BASE_URL}/overridable-props`,
|
|
81
|
+
{
|
|
82
|
+
params: { "componentIds[]": componentIds }
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
).then((res) => res.data),
|
|
84
85
|
updateArchivedComponents: async (componentIds, status) => await httpService().post(
|
|
85
86
|
`${BASE_URL}/archive`,
|
|
86
87
|
{
|
|
@@ -180,6 +181,18 @@ var baseSlice = createSlice({
|
|
|
180
181
|
}
|
|
181
182
|
component.overridableProps = payload.overridableProps;
|
|
182
183
|
},
|
|
184
|
+
loadOverridableProps: (state, { payload }) => {
|
|
185
|
+
const componentIds = Object.keys(payload);
|
|
186
|
+
componentIds.forEach((id) => {
|
|
187
|
+
const componentId = Number(id);
|
|
188
|
+
const overridableProps = payload[componentId];
|
|
189
|
+
const component = state.data.find((comp) => comp.id === componentId);
|
|
190
|
+
if (!component || !overridableProps) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
component.overridableProps = overridableProps;
|
|
194
|
+
});
|
|
195
|
+
},
|
|
183
196
|
rename: (state, { payload }) => {
|
|
184
197
|
const component = state.data.find((comp) => comp.uid === payload.componentUid);
|
|
185
198
|
if (!component) {
|
|
@@ -410,11 +423,10 @@ var componentOverrideTransformer = createTransformer3((override) => {
|
|
|
410
423
|
});
|
|
411
424
|
|
|
412
425
|
// src/components/components-tab/components.tsx
|
|
413
|
-
import * as
|
|
426
|
+
import * as React10 from "react";
|
|
414
427
|
import { useLayoutEffect } from "react";
|
|
415
428
|
import { ThemeProvider } from "@elementor/editor-ui";
|
|
416
429
|
import { Stack as Stack4 } from "@elementor/ui";
|
|
417
|
-
import { hasProInstalled as hasProInstalled2 } from "@elementor/utils";
|
|
418
430
|
|
|
419
431
|
// src/hooks/use-components.ts
|
|
420
432
|
import { __useSelector as useSelector2 } from "@elementor/store";
|
|
@@ -424,6 +436,16 @@ var useComponents = () => {
|
|
|
424
436
|
return { components, isLoading };
|
|
425
437
|
};
|
|
426
438
|
|
|
439
|
+
// src/utils/is-pro-components-supported.ts
|
|
440
|
+
import { hasProInstalled, isProAtLeast } from "@elementor/utils";
|
|
441
|
+
var MIN_PRO_VERSION_FOR_COMPONENTS = "4.0";
|
|
442
|
+
function isProComponentsSupported() {
|
|
443
|
+
return hasProInstalled() && isProAtLeast(MIN_PRO_VERSION_FOR_COMPONENTS);
|
|
444
|
+
}
|
|
445
|
+
function isProOutdatedForComponents() {
|
|
446
|
+
return hasProInstalled() && !isProAtLeast(MIN_PRO_VERSION_FOR_COMPONENTS);
|
|
447
|
+
}
|
|
448
|
+
|
|
427
449
|
// src/components/components-tab/component-search.tsx
|
|
428
450
|
import * as React2 from "react";
|
|
429
451
|
import { SearchIcon } from "@elementor/icons";
|
|
@@ -476,7 +498,6 @@ var ComponentSearch = () => {
|
|
|
476
498
|
import * as React5 from "react";
|
|
477
499
|
import { ComponentsIcon as ComponentsIcon2, CrownFilledIcon } from "@elementor/icons";
|
|
478
500
|
import { Box as Box4, Button, Divider, Link, List, Stack as Stack3, Typography as Typography2 } from "@elementor/ui";
|
|
479
|
-
import { hasProInstalled } from "@elementor/utils";
|
|
480
501
|
import { __ as __2 } from "@wordpress/i18n";
|
|
481
502
|
|
|
482
503
|
// src/hooks/use-components-permissions.ts
|
|
@@ -621,6 +642,7 @@ var LoadingComponents = () => {
|
|
|
621
642
|
// src/components/components-tab/components-list.tsx
|
|
622
643
|
var LEARN_MORE_URL = "http://go.elementor.com/components-guide-article";
|
|
623
644
|
var UPGRADE_URL = "https://go.elementor.com/go-pro-components/";
|
|
645
|
+
var UPDATE_PLUGINS_URL = "/wp-admin/plugins.php";
|
|
624
646
|
var SUBTITLE_OVERRIDE_SX = {
|
|
625
647
|
fontSize: "0.875rem !important",
|
|
626
648
|
fontWeight: "500 !important"
|
|
@@ -635,7 +657,10 @@ function ComponentsList() {
|
|
|
635
657
|
if (searchValue.length) {
|
|
636
658
|
return /* @__PURE__ */ React5.createElement(EmptySearchResult, null);
|
|
637
659
|
}
|
|
638
|
-
|
|
660
|
+
if (isProOutdatedForComponents()) {
|
|
661
|
+
return /* @__PURE__ */ React5.createElement(ProOutdatedEmptyState, null);
|
|
662
|
+
}
|
|
663
|
+
return isProComponentsSupported() ? /* @__PURE__ */ React5.createElement(EmptyState, null) : /* @__PURE__ */ React5.createElement(ProUpgradeEmptyState, null);
|
|
639
664
|
}
|
|
640
665
|
return /* @__PURE__ */ React5.createElement(List, { sx: { display: "flex", flexDirection: "column", gap: 1, px: 2 } }, components.map((component) => /* @__PURE__ */ React5.createElement(ComponentItem, { key: component.uid, component })));
|
|
641
666
|
}
|
|
@@ -666,6 +691,32 @@ var ProUpgradeEmptyState = () => {
|
|
|
666
691
|
)
|
|
667
692
|
);
|
|
668
693
|
};
|
|
694
|
+
var ProOutdatedEmptyState = () => {
|
|
695
|
+
return /* @__PURE__ */ React5.createElement(
|
|
696
|
+
Stack3,
|
|
697
|
+
{
|
|
698
|
+
alignItems: "center",
|
|
699
|
+
justifyContent: "start",
|
|
700
|
+
height: "100%",
|
|
701
|
+
sx: { px: 2, py: 4, maxWidth: 268, m: "auto" },
|
|
702
|
+
gap: 2,
|
|
703
|
+
overflow: "hidden"
|
|
704
|
+
},
|
|
705
|
+
/* @__PURE__ */ React5.createElement(Stack3, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React5.createElement(ComponentsIcon2, { fontSize: "large", sx: { color: "text.secondary" } }), /* @__PURE__ */ React5.createElement(Typography2, { align: "center", variant: "subtitle2", color: "text.secondary", sx: SUBTITLE_OVERRIDE_SX }, __2("Create Reusable Components", "elementor")), /* @__PURE__ */ React5.createElement(Typography2, { align: "center", variant: "caption", color: "secondary" }, __2("Create design elements that sync across your entire site.", "elementor")), /* @__PURE__ */ React5.createElement(Typography2, { align: "center", variant: "caption", color: "secondary", sx: { mt: 1 } }, __2("To create components, update Elementor Pro to the latest version.", "elementor"))),
|
|
706
|
+
/* @__PURE__ */ React5.createElement(
|
|
707
|
+
Button,
|
|
708
|
+
{
|
|
709
|
+
variant: "text",
|
|
710
|
+
color: "info",
|
|
711
|
+
size: "small",
|
|
712
|
+
href: UPDATE_PLUGINS_URL,
|
|
713
|
+
target: "_blank",
|
|
714
|
+
rel: "noopener noreferrer"
|
|
715
|
+
},
|
|
716
|
+
__2("Update Elementor Pro", "elementor")
|
|
717
|
+
)
|
|
718
|
+
);
|
|
719
|
+
};
|
|
669
720
|
var EmptyState = () => {
|
|
670
721
|
const { canCreate } = useComponentsPermissions();
|
|
671
722
|
return /* @__PURE__ */ React5.createElement(
|
|
@@ -808,7 +859,7 @@ function ComponentsUpgradeAlert({ title, description, upgradeUrl }) {
|
|
|
808
859
|
}
|
|
809
860
|
|
|
810
861
|
// src/components/components-tab/components-pro-notification.tsx
|
|
811
|
-
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-
|
|
862
|
+
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-exist-footer/";
|
|
812
863
|
function ComponentsProNotification() {
|
|
813
864
|
return /* @__PURE__ */ React7.createElement(
|
|
814
865
|
ComponentsUpgradeAlert,
|
|
@@ -820,6 +871,54 @@ function ComponentsProNotification() {
|
|
|
820
871
|
);
|
|
821
872
|
}
|
|
822
873
|
|
|
874
|
+
// src/components/components-tab/components-update-notification.tsx
|
|
875
|
+
import * as React9 from "react";
|
|
876
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
877
|
+
|
|
878
|
+
// src/components/components-update-alert.tsx
|
|
879
|
+
import * as React8 from "react";
|
|
880
|
+
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
881
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, Box as Box6, Typography as Typography4 } from "@elementor/ui";
|
|
882
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
883
|
+
var UPDATE_PLUGINS_URL2 = "/wp-admin/plugins.php";
|
|
884
|
+
function ComponentsUpdateAlert({ title, description }) {
|
|
885
|
+
return /* @__PURE__ */ React8.createElement(Box6, { sx: { mt: "auto", position: "sticky", bottom: 0 } }, /* @__PURE__ */ React8.createElement(
|
|
886
|
+
Alert2,
|
|
887
|
+
{
|
|
888
|
+
variant: "standard",
|
|
889
|
+
color: "info",
|
|
890
|
+
icon: /* @__PURE__ */ React8.createElement(InfoCircleFilledIcon, { fontSize: "tiny" }),
|
|
891
|
+
role: "status",
|
|
892
|
+
size: "small",
|
|
893
|
+
action: /* @__PURE__ */ React8.createElement(
|
|
894
|
+
AlertAction2,
|
|
895
|
+
{
|
|
896
|
+
variant: "contained",
|
|
897
|
+
color: "info",
|
|
898
|
+
href: UPDATE_PLUGINS_URL2,
|
|
899
|
+
target: "_blank",
|
|
900
|
+
rel: "noopener noreferrer"
|
|
901
|
+
},
|
|
902
|
+
__5("Upgrade Now", "elementor")
|
|
903
|
+
),
|
|
904
|
+
sx: { m: 2, mt: 1 }
|
|
905
|
+
},
|
|
906
|
+
/* @__PURE__ */ React8.createElement(AlertTitle2, null, title),
|
|
907
|
+
/* @__PURE__ */ React8.createElement(Typography4, { variant: "caption" }, description)
|
|
908
|
+
));
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// src/components/components-tab/components-update-notification.tsx
|
|
912
|
+
function ComponentsUpdateNotification() {
|
|
913
|
+
return /* @__PURE__ */ React9.createElement(
|
|
914
|
+
ComponentsUpdateAlert,
|
|
915
|
+
{
|
|
916
|
+
title: __6("Create new Components", "elementor"),
|
|
917
|
+
description: __6("To create new components, update Elementor Pro to the latest version.", "elementor")
|
|
918
|
+
}
|
|
919
|
+
);
|
|
920
|
+
}
|
|
921
|
+
|
|
823
922
|
// src/components/components-tab/components.tsx
|
|
824
923
|
var FULL_HEIGHT_STYLE_ID = "components-full-height-panel";
|
|
825
924
|
var FULL_HEIGHT_CSS = `
|
|
@@ -860,34 +959,34 @@ var useFullHeightPanel = () => {
|
|
|
860
959
|
var ComponentsContent = () => {
|
|
861
960
|
const { components, isLoading } = useComponents();
|
|
862
961
|
const hasComponents = !isLoading && components.length > 0;
|
|
863
|
-
const
|
|
864
|
-
const
|
|
962
|
+
const showProNotification = !isProComponentsSupported() && hasComponents;
|
|
963
|
+
const isOutdated = isProOutdatedForComponents();
|
|
865
964
|
useFullHeightPanel();
|
|
866
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ React10.createElement(Stack4, { 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)));
|
|
867
966
|
};
|
|
868
967
|
var Components = () => {
|
|
869
|
-
return /* @__PURE__ */
|
|
968
|
+
return /* @__PURE__ */ React10.createElement(ThemeProvider, null, /* @__PURE__ */ React10.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React10.createElement(ComponentsContent, null)));
|
|
870
969
|
};
|
|
871
970
|
|
|
872
971
|
// src/components/detach-instance-confirmation-dialog.tsx
|
|
873
|
-
import * as
|
|
972
|
+
import * as React11 from "react";
|
|
874
973
|
import { closeDialog, ConfirmationDialog, openDialog } from "@elementor/editor-ui";
|
|
875
974
|
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
876
|
-
import { __ as
|
|
975
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
877
976
|
function DetachInstanceConfirmationDialog({
|
|
878
977
|
open,
|
|
879
978
|
onClose,
|
|
880
979
|
onConfirm
|
|
881
980
|
}) {
|
|
882
|
-
return /* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ React11.createElement(ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React11.createElement(ConfirmationDialog.Title, { icon: AlertTriangleFilledIcon, iconColor: "secondary" }, __7("Detach from Component?", "elementor")), /* @__PURE__ */ React11.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React11.createElement(ConfirmationDialog.ContentText, null, __7(
|
|
883
982
|
"Detaching this instance will break its link to the Component. Changes to the Component will no longer apply. Continue?",
|
|
884
983
|
"elementor"
|
|
885
|
-
))), /* @__PURE__ */
|
|
984
|
+
))), /* @__PURE__ */ React11.createElement(
|
|
886
985
|
ConfirmationDialog.Actions,
|
|
887
986
|
{
|
|
888
987
|
onClose,
|
|
889
988
|
onConfirm,
|
|
890
|
-
confirmLabel:
|
|
989
|
+
confirmLabel: __7("Detach", "elementor"),
|
|
891
990
|
color: "primary"
|
|
892
991
|
}
|
|
893
992
|
));
|
|
@@ -898,59 +997,58 @@ function openDetachConfirmDialog(onConfirm) {
|
|
|
898
997
|
onConfirm();
|
|
899
998
|
};
|
|
900
999
|
openDialog({
|
|
901
|
-
component: /* @__PURE__ */
|
|
1000
|
+
component: /* @__PURE__ */ React11.createElement(DetachInstanceConfirmationDialog, { open: true, onClose: closeDialog, onConfirm: handleConfirm })
|
|
902
1001
|
});
|
|
903
1002
|
}
|
|
904
1003
|
|
|
905
1004
|
// src/components/in-edit-mode.tsx
|
|
906
|
-
import * as
|
|
1005
|
+
import * as React12 from "react";
|
|
907
1006
|
import { closeDialog as closeDialog2, openDialog as openDialog2 } from "@elementor/editor-ui";
|
|
908
|
-
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
909
|
-
import { Box as
|
|
910
|
-
import { __ as
|
|
1007
|
+
import { InfoCircleFilledIcon as InfoCircleFilledIcon2 } from "@elementor/icons";
|
|
1008
|
+
import { Box as Box7, Button as Button2, DialogActions, DialogContent, DialogHeader, Icon, Stack as Stack5, Typography as Typography5 } from "@elementor/ui";
|
|
1009
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
911
1010
|
var openEditModeDialog = (lockedBy) => {
|
|
912
1011
|
openDialog2({
|
|
913
|
-
component: /* @__PURE__ */
|
|
1012
|
+
component: /* @__PURE__ */ React12.createElement(EditModeDialog, { lockedBy })
|
|
914
1013
|
});
|
|
915
1014
|
};
|
|
916
1015
|
var EditModeDialog = ({ lockedBy }) => {
|
|
917
|
-
const content =
|
|
918
|
-
return /* @__PURE__ */
|
|
1016
|
+
const content = __8("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
1017
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React12.createElement(Box7, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React12.createElement(Icon, { color: "secondary" }, /* @__PURE__ */ React12.createElement(InfoCircleFilledIcon2, { fontSize: "medium" })), /* @__PURE__ */ React12.createElement(Typography5, { variant: "subtitle1" }, content))), /* @__PURE__ */ React12.createElement(DialogContent, null, /* @__PURE__ */ React12.createElement(Stack5, { spacing: 2, direction: "column" }, /* @__PURE__ */ React12.createElement(Typography5, { variant: "body2" }, __8(
|
|
919
1018
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
920
1019
|
"elementor"
|
|
921
|
-
)), /* @__PURE__ */
|
|
1020
|
+
)), /* @__PURE__ */ React12.createElement(DialogActions, null, /* @__PURE__ */ React12.createElement(Button2, { color: "secondary", variant: "contained", onClick: closeDialog2 }, __8("Close", "elementor"))))));
|
|
922
1021
|
};
|
|
923
1022
|
|
|
924
1023
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
925
|
-
import * as
|
|
1024
|
+
import * as React22 from "react";
|
|
926
1025
|
import { PencilIcon as PencilIcon2 } from "@elementor/icons";
|
|
927
|
-
import { Box as
|
|
928
|
-
import {
|
|
929
|
-
import { __ as __10 } from "@wordpress/i18n";
|
|
1026
|
+
import { Box as Box10, Stack as Stack11 } from "@elementor/ui";
|
|
1027
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
930
1028
|
|
|
931
1029
|
// src/provider/component-instance-context.tsx
|
|
932
|
-
import * as
|
|
1030
|
+
import * as React13 from "react";
|
|
933
1031
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
934
1032
|
var ComponentInstanceContext = createContext2(null);
|
|
935
1033
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
936
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ React13.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
937
1035
|
}
|
|
938
1036
|
var useComponentId = () => useContext2(ComponentInstanceContext)?.componentId;
|
|
939
1037
|
var useComponentInstanceOverrides = () => useContext2(ComponentInstanceContext)?.overrides;
|
|
940
1038
|
var useComponentOverridableProps = () => useContext2(ComponentInstanceContext)?.overridableProps;
|
|
941
1039
|
|
|
942
1040
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
943
|
-
import * as
|
|
1041
|
+
import * as React15 from "react";
|
|
944
1042
|
import { useState } from "react";
|
|
945
1043
|
import { notify } from "@elementor/editor-notifications";
|
|
946
1044
|
import { DetachIcon } from "@elementor/icons";
|
|
947
|
-
import { __ as
|
|
1045
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
948
1046
|
|
|
949
1047
|
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
950
1048
|
import { getContainer, replaceElement } from "@elementor/editor-elements";
|
|
951
1049
|
import { undoable } from "@elementor/editor-v1-adapters";
|
|
952
1050
|
import { __dispatch as dispatch2, __getState as getState3 } from "@elementor/store";
|
|
953
|
-
import { __ as
|
|
1051
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
954
1052
|
|
|
955
1053
|
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
956
1054
|
import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
|
|
@@ -1299,8 +1397,8 @@ async function detachComponentInstance({
|
|
|
1299
1397
|
}
|
|
1300
1398
|
},
|
|
1301
1399
|
{
|
|
1302
|
-
title:
|
|
1303
|
-
subtitle:
|
|
1400
|
+
title: __9("Detach from Component", "elementor"),
|
|
1401
|
+
subtitle: __9("Instance detached", "elementor")
|
|
1304
1402
|
}
|
|
1305
1403
|
);
|
|
1306
1404
|
return undoableDetach();
|
|
@@ -1315,16 +1413,16 @@ function extractInstanceOverrides(instanceContainer) {
|
|
|
1315
1413
|
}
|
|
1316
1414
|
|
|
1317
1415
|
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1318
|
-
import * as
|
|
1416
|
+
import * as React14 from "react";
|
|
1319
1417
|
import { PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
1320
1418
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
1321
1419
|
import { ComponentsIcon as ComponentsIcon3 } from "@elementor/icons";
|
|
1322
1420
|
import { IconButton, Stack as Stack6, Tooltip } from "@elementor/ui";
|
|
1323
1421
|
function InstancePanelHeader({ componentName, actions }) {
|
|
1324
|
-
return /* @__PURE__ */
|
|
1422
|
+
return /* @__PURE__ */ React14.createElement(PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React14.createElement(ComponentsIcon3, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React14.createElement(EllipsisWithTooltip2, { title: componentName, as: PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1325
1423
|
}
|
|
1326
1424
|
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1327
|
-
return /* @__PURE__ */
|
|
1425
|
+
return /* @__PURE__ */ React14.createElement(Tooltip, { title: label }, /* @__PURE__ */ React14.createElement(IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React14.createElement(Icon2, { fontSize: "tiny" })));
|
|
1328
1426
|
}
|
|
1329
1427
|
|
|
1330
1428
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
@@ -1344,7 +1442,7 @@ var DetachAction = ({
|
|
|
1344
1442
|
} catch {
|
|
1345
1443
|
notify({
|
|
1346
1444
|
type: "error",
|
|
1347
|
-
message:
|
|
1445
|
+
message: __10("Failed to detach component instance.", "elementor"),
|
|
1348
1446
|
id: "detach-component-instance-failed"
|
|
1349
1447
|
});
|
|
1350
1448
|
}
|
|
@@ -1355,8 +1453,8 @@ var DetachAction = ({
|
|
|
1355
1453
|
const handleDetachClick = () => {
|
|
1356
1454
|
setIsDetachDialogOpen(true);
|
|
1357
1455
|
};
|
|
1358
|
-
const detachLabel =
|
|
1359
|
-
return /* @__PURE__ */
|
|
1456
|
+
const detachLabel = __10("Detach from Component", "elementor");
|
|
1457
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(EditComponentAction, { label: detachLabel, icon: DetachIcon, onClick: handleDetachClick }), /* @__PURE__ */ React15.createElement(
|
|
1360
1458
|
DetachInstanceConfirmationDialog,
|
|
1361
1459
|
{
|
|
1362
1460
|
open: isDetachDialogOpen,
|
|
@@ -1381,20 +1479,20 @@ function getDetachTrackingInfo() {
|
|
|
1381
1479
|
}
|
|
1382
1480
|
|
|
1383
1481
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
1384
|
-
import * as
|
|
1482
|
+
import * as React16 from "react";
|
|
1385
1483
|
import { ComponentPropListIcon, PencilIcon } from "@elementor/icons";
|
|
1386
|
-
import { Button as Button3, Stack as Stack7, Typography as
|
|
1387
|
-
import { __ as
|
|
1484
|
+
import { Button as Button3, Stack as Stack7, Typography as Typography6 } from "@elementor/ui";
|
|
1485
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1388
1486
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
1389
1487
|
const { canEdit } = useComponentsPermissions();
|
|
1390
|
-
const message = canEdit ?
|
|
1488
|
+
const message = canEdit ? __11(
|
|
1391
1489
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
1392
1490
|
"elementor"
|
|
1393
|
-
) :
|
|
1491
|
+
) : __11(
|
|
1394
1492
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
1395
1493
|
"elementor"
|
|
1396
1494
|
);
|
|
1397
|
-
return /* @__PURE__ */
|
|
1495
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1398
1496
|
Stack7,
|
|
1399
1497
|
{
|
|
1400
1498
|
alignItems: "center",
|
|
@@ -1404,10 +1502,10 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1404
1502
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
1405
1503
|
gap: 1.5
|
|
1406
1504
|
},
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
canEdit && /* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ React16.createElement(ComponentPropListIcon, { fontSize: "large" }),
|
|
1506
|
+
/* @__PURE__ */ React16.createElement(Typography6, { align: "center", variant: "subtitle2" }, __11("No properties yet", "elementor")),
|
|
1507
|
+
/* @__PURE__ */ React16.createElement(Typography6, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1508
|
+
canEdit && /* @__PURE__ */ React16.createElement(
|
|
1411
1509
|
Button3,
|
|
1412
1510
|
{
|
|
1413
1511
|
variant: "outlined",
|
|
@@ -1417,28 +1515,28 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1417
1515
|
disabled: !onEditComponent,
|
|
1418
1516
|
onClick: onEditComponent
|
|
1419
1517
|
},
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
|
|
1518
|
+
/* @__PURE__ */ React16.createElement(PencilIcon, { fontSize: "small" }),
|
|
1519
|
+
__11("Edit component", "elementor")
|
|
1422
1520
|
)
|
|
1423
1521
|
);
|
|
1424
1522
|
};
|
|
1425
1523
|
|
|
1426
1524
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1427
|
-
import * as
|
|
1525
|
+
import * as React21 from "react";
|
|
1428
1526
|
import { ControlAdornmentsProvider } from "@elementor/editor-controls";
|
|
1429
1527
|
import { getFieldIndicators } from "@elementor/editor-editing-panel";
|
|
1430
1528
|
import { PanelBody } from "@elementor/editor-panels";
|
|
1431
|
-
import { Divider as Divider2, Stack as
|
|
1529
|
+
import { Divider as Divider2, Stack as Stack10 } from "@elementor/ui";
|
|
1432
1530
|
|
|
1433
1531
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1434
|
-
import * as
|
|
1532
|
+
import * as React20 from "react";
|
|
1435
1533
|
import { useId } from "react";
|
|
1436
1534
|
import { useStateByElement } from "@elementor/editor-editing-panel";
|
|
1437
1535
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
1438
|
-
import { Box as
|
|
1536
|
+
import { Box as Box9, Collapse, ListItemButton as ListItemButton2, ListItemText, Stack as Stack9 } from "@elementor/ui";
|
|
1439
1537
|
|
|
1440
1538
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1441
|
-
import * as
|
|
1539
|
+
import * as React19 from "react";
|
|
1442
1540
|
import {
|
|
1443
1541
|
ControlReplacementsProvider,
|
|
1444
1542
|
getControlReplacements,
|
|
@@ -1449,6 +1547,7 @@ import {
|
|
|
1449
1547
|
import {
|
|
1450
1548
|
BaseControl,
|
|
1451
1549
|
controlsRegistry,
|
|
1550
|
+
ControlTypeContainer,
|
|
1452
1551
|
createTopLevelObjectType,
|
|
1453
1552
|
ElementProvider,
|
|
1454
1553
|
isDynamicPropValue,
|
|
@@ -1456,7 +1555,7 @@ import {
|
|
|
1456
1555
|
useElement
|
|
1457
1556
|
} from "@elementor/editor-editing-panel";
|
|
1458
1557
|
import { getElementSettings, getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
1459
|
-
import {
|
|
1558
|
+
import { Box as Box8 } from "@elementor/ui";
|
|
1460
1559
|
|
|
1461
1560
|
// src/hooks/use-controls-by-widget-type.ts
|
|
1462
1561
|
import { getElementType } from "@elementor/editor-elements";
|
|
@@ -1490,11 +1589,11 @@ function getControlsByBind(controls) {
|
|
|
1490
1589
|
}
|
|
1491
1590
|
|
|
1492
1591
|
// src/provider/overridable-prop-context.tsx
|
|
1493
|
-
import * as
|
|
1592
|
+
import * as React17 from "react";
|
|
1494
1593
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
1495
1594
|
var OverridablePropContext = createContext3(null);
|
|
1496
1595
|
function OverridablePropProvider({ children, ...props }) {
|
|
1497
|
-
return /* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ React17.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1498
1597
|
}
|
|
1499
1598
|
var useOverridablePropValue = () => useContext3(OverridablePropContext)?.value;
|
|
1500
1599
|
var useComponentInstanceElement = () => useContext3(OverridablePropContext)?.componentInstanceElement;
|
|
@@ -1726,11 +1825,11 @@ function extractInnerOverrideInfo(override) {
|
|
|
1726
1825
|
}
|
|
1727
1826
|
|
|
1728
1827
|
// src/components/control-label.tsx
|
|
1729
|
-
import * as
|
|
1828
|
+
import * as React18 from "react";
|
|
1730
1829
|
import { ControlAdornments, ControlFormLabel } from "@elementor/editor-controls";
|
|
1731
1830
|
import { Stack as Stack8 } from "@elementor/ui";
|
|
1732
1831
|
var ControlLabel = ({ children, ...props }) => {
|
|
1733
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ React18.createElement(Stack8, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React18.createElement(ControlFormLabel, { ...props }, children), /* @__PURE__ */ React18.createElement(ControlAdornments, null));
|
|
1734
1833
|
};
|
|
1735
1834
|
|
|
1736
1835
|
// src/components/errors.ts
|
|
@@ -1832,6 +1931,19 @@ function hasValue(value) {
|
|
|
1832
1931
|
return value !== null && value !== void 0;
|
|
1833
1932
|
}
|
|
1834
1933
|
|
|
1934
|
+
// src/components/instance-editing-panel/utils/correct-exposed-empty-override.ts
|
|
1935
|
+
function correctExposedEmptyOverride(newPropValue, matchingOverride) {
|
|
1936
|
+
const newOverridableValue = componentOverridablePropTypeUtil.extract(newPropValue);
|
|
1937
|
+
const isExposingEmptyOverride = newOverridableValue && matchingOverride === null;
|
|
1938
|
+
if (!isExposingEmptyOverride) {
|
|
1939
|
+
return newPropValue;
|
|
1940
|
+
}
|
|
1941
|
+
return componentOverridablePropTypeUtil.create({
|
|
1942
|
+
override_key: newOverridableValue.override_key,
|
|
1943
|
+
origin_value: null
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1835
1947
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1836
1948
|
function OverridePropControl({ overrideKey }) {
|
|
1837
1949
|
const overridableProps = useComponentOverridableProps();
|
|
@@ -1839,7 +1951,7 @@ function OverridePropControl({ overrideKey }) {
|
|
|
1839
1951
|
if (!overridableProp) {
|
|
1840
1952
|
return null;
|
|
1841
1953
|
}
|
|
1842
|
-
return /* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ React19.createElement(SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React19.createElement(OverrideControl, { overridableProp }));
|
|
1843
1955
|
}
|
|
1844
1956
|
function OverrideControl({ overridableProp }) {
|
|
1845
1957
|
const componentInstanceElement = useElement();
|
|
@@ -1877,11 +1989,12 @@ function OverrideControl({ overridableProp }) {
|
|
|
1877
1989
|
});
|
|
1878
1990
|
return;
|
|
1879
1991
|
}
|
|
1880
|
-
|
|
1992
|
+
let newPropValue = getTempNewValueForDynamicProp(
|
|
1881
1993
|
propType,
|
|
1882
1994
|
propValue,
|
|
1883
1995
|
newValue[overridableProp.overrideKey]
|
|
1884
1996
|
);
|
|
1997
|
+
newPropValue = correctExposedEmptyOverride(newPropValue, matchingOverride);
|
|
1885
1998
|
const newOverrideValue = createOverrideValue({
|
|
1886
1999
|
matchingOverride,
|
|
1887
2000
|
overrideKey: overridableProp.overrideKey,
|
|
@@ -1933,13 +2046,13 @@ function OverrideControl({ overridableProp }) {
|
|
|
1933
2046
|
[overridableProp.overrideKey]: propType
|
|
1934
2047
|
}
|
|
1935
2048
|
});
|
|
1936
|
-
return /* @__PURE__ */
|
|
2049
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1937
2050
|
OverridablePropProvider,
|
|
1938
2051
|
{
|
|
1939
2052
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
1940
2053
|
componentInstanceElement
|
|
1941
2054
|
},
|
|
1942
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ React19.createElement(ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React19.createElement(SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React19.createElement(
|
|
1943
2056
|
PropProvider,
|
|
1944
2057
|
{
|
|
1945
2058
|
propType: propTypeSchema,
|
|
@@ -1949,7 +2062,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1949
2062
|
return false;
|
|
1950
2063
|
}
|
|
1951
2064
|
},
|
|
1952
|
-
/* @__PURE__ */
|
|
2065
|
+
/* @__PURE__ */ React19.createElement(PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React19.createElement(ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React19.createElement(Box8, { mb: 1.5 }, /* @__PURE__ */ React19.createElement(ControlTypeContainer, { layout }, layout !== "custom" && /* @__PURE__ */ React19.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React19.createElement(OriginalControl, { control, controlProps })))))
|
|
1953
2066
|
)))
|
|
1954
2067
|
);
|
|
1955
2068
|
}
|
|
@@ -2008,7 +2121,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
2008
2121
|
}
|
|
2009
2122
|
function OriginalControl({ control, controlProps }) {
|
|
2010
2123
|
const { value } = control;
|
|
2011
|
-
return /* @__PURE__ */
|
|
2124
|
+
return /* @__PURE__ */ React19.createElement(BaseControl, { type: value.type, props: controlProps });
|
|
2012
2125
|
}
|
|
2013
2126
|
function getControlLayout(control) {
|
|
2014
2127
|
return control.value.meta?.layout || controlsRegistry.getLayout(control.value.type);
|
|
@@ -2043,7 +2156,7 @@ function OverridePropsGroup({ group }) {
|
|
|
2043
2156
|
const labelId = `label-${id}`;
|
|
2044
2157
|
const contentId = `content-${id}`;
|
|
2045
2158
|
const title = group.label;
|
|
2046
|
-
return /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ React20.createElement(Box9, { "aria-label": `${title} section` }, /* @__PURE__ */ React20.createElement(
|
|
2047
2160
|
ListItemButton2,
|
|
2048
2161
|
{
|
|
2049
2162
|
id: labelId,
|
|
@@ -2053,7 +2166,7 @@ function OverridePropsGroup({ group }) {
|
|
|
2053
2166
|
p: 0,
|
|
2054
2167
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2055
2168
|
},
|
|
2056
|
-
/* @__PURE__ */
|
|
2169
|
+
/* @__PURE__ */ React20.createElement(Stack9, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React20.createElement(
|
|
2057
2170
|
ListItemText,
|
|
2058
2171
|
{
|
|
2059
2172
|
secondary: title,
|
|
@@ -2061,13 +2174,13 @@ function OverridePropsGroup({ group }) {
|
|
|
2061
2174
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
2062
2175
|
}
|
|
2063
2176
|
)),
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
), /* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ React20.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
2178
|
+
), /* @__PURE__ */ React20.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React20.createElement(Stack9, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React20.createElement(OverridePropControl, { key: overrideKey, overrideKey })))));
|
|
2066
2179
|
}
|
|
2067
2180
|
|
|
2068
2181
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
2069
2182
|
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
2070
|
-
return /* @__PURE__ */
|
|
2183
|
+
return /* @__PURE__ */ React21.createElement(PanelBody, null, /* @__PURE__ */ React21.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") }, isEmpty ? emptyState : /* @__PURE__ */ React21.createElement(Stack10, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React21.createElement(React21.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React21.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React21.createElement(Divider2, null))))));
|
|
2071
2184
|
}
|
|
2072
2185
|
|
|
2073
2186
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -2167,42 +2280,50 @@ function useComponentInstanceSettings() {
|
|
|
2167
2280
|
}
|
|
2168
2281
|
|
|
2169
2282
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
2170
|
-
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2283
|
+
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-footer/";
|
|
2171
2284
|
function InstanceEditingPanel() {
|
|
2172
2285
|
const { canEdit } = useComponentsPermissions();
|
|
2173
2286
|
const data = useInstancePanelData();
|
|
2174
|
-
const hasPro = hasProInstalled3();
|
|
2175
2287
|
if (!data) {
|
|
2176
2288
|
return null;
|
|
2177
2289
|
}
|
|
2178
2290
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
2179
|
-
const panelTitle =
|
|
2180
|
-
const actions = /* @__PURE__ */
|
|
2181
|
-
return /* @__PURE__ */
|
|
2291
|
+
const panelTitle = __12("Edit %s", "elementor").replace("%s", component.name);
|
|
2292
|
+
const actions = /* @__PURE__ */ React22.createElement(Stack11, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React22.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React22.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: PencilIcon2 }));
|
|
2293
|
+
return /* @__PURE__ */ React22.createElement(Box10, { "data-testid": "instance-editing-panel", sx: { display: "flex", flexDirection: "column", height: "100%" } }, /* @__PURE__ */ React22.createElement(
|
|
2182
2294
|
ComponentInstanceProvider,
|
|
2183
2295
|
{
|
|
2184
2296
|
componentId,
|
|
2185
2297
|
overrides,
|
|
2186
2298
|
overridableProps
|
|
2187
2299
|
},
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ React22.createElement(InstancePanelHeader, { componentName: component.name, actions }),
|
|
2301
|
+
/* @__PURE__ */ React22.createElement(
|
|
2190
2302
|
InstancePanelBody,
|
|
2191
2303
|
{
|
|
2192
2304
|
groups,
|
|
2193
2305
|
isEmpty,
|
|
2194
|
-
emptyState: /* @__PURE__ */
|
|
2306
|
+
emptyState: /* @__PURE__ */ React22.createElement(EmptyState2, null),
|
|
2195
2307
|
componentInstanceId
|
|
2196
2308
|
}
|
|
2197
2309
|
)
|
|
2198
|
-
), !
|
|
2310
|
+
), !isProComponentsSupported() && (isProOutdatedForComponents() ? /* @__PURE__ */ React22.createElement(
|
|
2311
|
+
ComponentsUpdateAlert,
|
|
2312
|
+
{
|
|
2313
|
+
title: __12("Edit Component", "elementor"),
|
|
2314
|
+
description: __12(
|
|
2315
|
+
"To edit components, update Elementor Pro to the latest version.",
|
|
2316
|
+
"elementor"
|
|
2317
|
+
)
|
|
2318
|
+
}
|
|
2319
|
+
) : /* @__PURE__ */ React22.createElement(
|
|
2199
2320
|
ComponentsUpgradeAlert,
|
|
2200
2321
|
{
|
|
2201
|
-
title:
|
|
2202
|
-
description:
|
|
2322
|
+
title: __12("Edit components", "elementor"),
|
|
2323
|
+
description: __12("Editing components requires an active Pro subscription.", "elementor"),
|
|
2203
2324
|
upgradeUrl: EDIT_UPGRADE_URL
|
|
2204
2325
|
}
|
|
2205
|
-
));
|
|
2326
|
+
)));
|
|
2206
2327
|
}
|
|
2207
2328
|
|
|
2208
2329
|
// src/components/load-template-components.tsx
|
|
@@ -2257,27 +2378,13 @@ async function getDocumentsMap(ids, cache) {
|
|
|
2257
2378
|
|
|
2258
2379
|
// src/store/actions/load-components-overridable-props.ts
|
|
2259
2380
|
import { __dispatch as dispatch4, __getState as getState6 } from "@elementor/store";
|
|
2260
|
-
function loadComponentsOverridableProps(componentIds) {
|
|
2261
|
-
|
|
2381
|
+
async function loadComponentsOverridableProps(componentIds) {
|
|
2382
|
+
const unloadedIds = componentIds.filter((id) => !selectIsOverridablePropsLoaded(getState6(), id));
|
|
2383
|
+
if (!unloadedIds.length) {
|
|
2262
2384
|
return;
|
|
2263
2385
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
async function loadComponentOverrides(componentId) {
|
|
2267
|
-
const isOverridablePropsLoaded = selectIsOverridablePropsLoaded(getState6(), componentId);
|
|
2268
|
-
if (isOverridablePropsLoaded) {
|
|
2269
|
-
return;
|
|
2270
|
-
}
|
|
2271
|
-
const overridableProps = await apiClient.getOverridableProps(componentId);
|
|
2272
|
-
if (!overridableProps) {
|
|
2273
|
-
return;
|
|
2274
|
-
}
|
|
2275
|
-
dispatch4(
|
|
2276
|
-
slice.actions.setOverridableProps({
|
|
2277
|
-
componentId,
|
|
2278
|
-
overridableProps
|
|
2279
|
-
})
|
|
2280
|
-
);
|
|
2386
|
+
const { data } = await apiClient.getOverridableProps(unloadedIds);
|
|
2387
|
+
dispatch4(slice.actions.loadOverridableProps(data));
|
|
2281
2388
|
}
|
|
2282
2389
|
|
|
2283
2390
|
// src/store/actions/load-components-styles.ts
|
|
@@ -2342,8 +2449,8 @@ import {
|
|
|
2342
2449
|
import { getCurrentDocument } from "@elementor/editor-documents";
|
|
2343
2450
|
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2344
2451
|
import { __getState as getState8 } from "@elementor/store";
|
|
2345
|
-
import { hasProInstalled as
|
|
2346
|
-
import { __ as
|
|
2452
|
+
import { hasProInstalled as hasProInstalled2 } from "@elementor/utils";
|
|
2453
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2347
2454
|
|
|
2348
2455
|
// src/utils/format-component-elements-id.ts
|
|
2349
2456
|
import { hashString } from "@elementor/utils";
|
|
@@ -2415,21 +2522,43 @@ function buildUniqueSelector(element) {
|
|
|
2415
2522
|
|
|
2416
2523
|
// src/create-component-type.ts
|
|
2417
2524
|
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
2418
|
-
var
|
|
2525
|
+
var EDIT_COMPONENT_DB_CLICK_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-canvas-double-click/";
|
|
2526
|
+
var EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-context-menu/";
|
|
2527
|
+
var UPDATE_PLUGINS_URL3 = "/wp-admin/plugins.php";
|
|
2419
2528
|
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
2529
|
+
var COMPONENT_EDIT_UPDATE_NOTIFICATION_ID = "component-edit-update";
|
|
2530
|
+
var COMPONENT_EDIT_UPGRADE_AUTO_HIDE_DURATION = 2e3;
|
|
2420
2531
|
function notifyComponentEditUpgrade() {
|
|
2421
2532
|
notify2({
|
|
2422
2533
|
type: "promotion",
|
|
2423
2534
|
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
2424
|
-
message:
|
|
2535
|
+
message: __13("Editing components requires an active Pro subscription.", "elementor"),
|
|
2536
|
+
autoHideDuration: COMPONENT_EDIT_UPGRADE_AUTO_HIDE_DURATION,
|
|
2425
2537
|
additionalActionProps: [
|
|
2426
2538
|
{
|
|
2427
2539
|
size: "small",
|
|
2428
2540
|
variant: "contained",
|
|
2429
2541
|
color: "promotion",
|
|
2430
|
-
href:
|
|
2542
|
+
href: EDIT_COMPONENT_DB_CLICK_UPGRADE_URL,
|
|
2431
2543
|
target: "_blank",
|
|
2432
|
-
children:
|
|
2544
|
+
children: __13("Upgrade Now", "elementor")
|
|
2545
|
+
}
|
|
2546
|
+
]
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2549
|
+
function notifyComponentEditUpdate() {
|
|
2550
|
+
notify2({
|
|
2551
|
+
type: "info",
|
|
2552
|
+
id: COMPONENT_EDIT_UPDATE_NOTIFICATION_ID,
|
|
2553
|
+
message: __13("To edit components, update Elementor Pro to the latest version.", "elementor"),
|
|
2554
|
+
additionalActionProps: [
|
|
2555
|
+
{
|
|
2556
|
+
size: "small",
|
|
2557
|
+
variant: "contained",
|
|
2558
|
+
color: "info",
|
|
2559
|
+
href: UPDATE_PLUGINS_URL3,
|
|
2560
|
+
target: "_blank",
|
|
2561
|
+
children: __13("Update Now", "elementor")
|
|
2433
2562
|
}
|
|
2434
2563
|
]
|
|
2435
2564
|
});
|
|
@@ -2542,21 +2671,23 @@ function createComponentView(options) {
|
|
|
2542
2671
|
}
|
|
2543
2672
|
_getContextMenuConfig() {
|
|
2544
2673
|
const isAdministrator = isUserAdministrator();
|
|
2545
|
-
const hasPro =
|
|
2674
|
+
const hasPro = hasProInstalled2();
|
|
2675
|
+
const isOutdated = isProOutdatedForComponents();
|
|
2676
|
+
const showPromoBadge = !hasPro && !isOutdated;
|
|
2546
2677
|
const badgeClass = "elementor-context-menu-list__item__shortcut__promotion-badge";
|
|
2547
|
-
const proBadge = `<a href="${
|
|
2678
|
+
const proBadge = `<a href="${EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}"><i class="eicon-upgrade-crown"></i></a>`;
|
|
2548
2679
|
const editComponentAction = {
|
|
2549
2680
|
name: "edit component",
|
|
2550
2681
|
icon: "eicon-edit",
|
|
2551
|
-
title: () =>
|
|
2552
|
-
|
|
2553
|
-
isEnabled: () =>
|
|
2682
|
+
title: () => __13("Edit Component", "elementor"),
|
|
2683
|
+
...showPromoBadge && { shortcut: proBadge, hasShortcutAction: true },
|
|
2684
|
+
isEnabled: () => isProComponentsSupported() || isOutdated,
|
|
2554
2685
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
2555
2686
|
};
|
|
2556
2687
|
const detachInstanceAction = {
|
|
2557
2688
|
name: "detach instance",
|
|
2558
2689
|
icon: "eicon-chain-broken",
|
|
2559
|
-
title: () =>
|
|
2690
|
+
title: () => __13("Detach from Component", "elementor"),
|
|
2560
2691
|
isEnabled: () => true,
|
|
2561
2692
|
callback: (_, eventData) => this.detachInstance(eventData)
|
|
2562
2693
|
};
|
|
@@ -2583,8 +2714,11 @@ function createComponentView(options) {
|
|
|
2583
2714
|
}
|
|
2584
2715
|
}
|
|
2585
2716
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
2586
|
-
|
|
2587
|
-
|
|
2717
|
+
if (isProOutdatedForComponents()) {
|
|
2718
|
+
notifyComponentEditUpdate();
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
if (!isProComponentsSupported() || this.isComponentCurrentlyEdited()) {
|
|
2588
2722
|
return;
|
|
2589
2723
|
}
|
|
2590
2724
|
this.switchDocument();
|
|
@@ -2615,7 +2749,7 @@ function createComponentView(options) {
|
|
|
2615
2749
|
} catch {
|
|
2616
2750
|
notify2({
|
|
2617
2751
|
type: "error",
|
|
2618
|
-
message:
|
|
2752
|
+
message: __13("Failed to detach component instance.", "elementor"),
|
|
2619
2753
|
id: "detach-component-instance-failed"
|
|
2620
2754
|
});
|
|
2621
2755
|
}
|
|
@@ -2627,7 +2761,11 @@ function createComponentView(options) {
|
|
|
2627
2761
|
if (!isUserAdministrator()) {
|
|
2628
2762
|
return;
|
|
2629
2763
|
}
|
|
2630
|
-
if (
|
|
2764
|
+
if (isProOutdatedForComponents()) {
|
|
2765
|
+
notifyComponentEditUpdate();
|
|
2766
|
+
return;
|
|
2767
|
+
}
|
|
2768
|
+
if (!hasProInstalled2()) {
|
|
2631
2769
|
notifyComponentEditUpgrade();
|
|
2632
2770
|
return;
|
|
2633
2771
|
}
|
|
@@ -2728,11 +2866,11 @@ import { getAllDescendants } from "@elementor/editor-elements";
|
|
|
2728
2866
|
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
2729
2867
|
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
2730
2868
|
import { __getState as getState9 } from "@elementor/store";
|
|
2731
|
-
import { __ as
|
|
2869
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2732
2870
|
var COMPONENT_TYPE = "e-component";
|
|
2733
2871
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
2734
2872
|
type: "default",
|
|
2735
|
-
message:
|
|
2873
|
+
message: __14("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
2736
2874
|
id: "circular-component-nesting-blocked"
|
|
2737
2875
|
};
|
|
2738
2876
|
function initCircularNestingPrevention() {
|
|
@@ -2883,9 +3021,9 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
2883
3021
|
import { invalidateDocumentData as invalidateDocumentData2, isDocumentDirty as isDocumentDirty2 } from "@elementor/editor-documents";
|
|
2884
3022
|
import { notify as notify4 } from "@elementor/editor-notifications";
|
|
2885
3023
|
import { AxiosError } from "@elementor/http-client";
|
|
2886
|
-
import { __ as
|
|
3024
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2887
3025
|
var INSUFFICIENT_PERMISSIONS_ERROR_CODE = "insufficient_permissions";
|
|
2888
|
-
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-
|
|
3026
|
+
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-draft-failure/";
|
|
2889
3027
|
var PUBLISH_UPGRADE_NOTIFICATION_ID = "component-publish-upgrade";
|
|
2890
3028
|
async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
2891
3029
|
if (status !== "publish") {
|
|
@@ -2914,7 +3052,7 @@ function notifyPublishUpgrade() {
|
|
|
2914
3052
|
notify4({
|
|
2915
3053
|
type: "promotion",
|
|
2916
3054
|
id: PUBLISH_UPGRADE_NOTIFICATION_ID,
|
|
2917
|
-
message:
|
|
3055
|
+
message: __15(
|
|
2918
3056
|
"You have unpublished component on this page. You need a pro version to publish it.",
|
|
2919
3057
|
"elementor"
|
|
2920
3058
|
),
|
|
@@ -2925,7 +3063,7 @@ function notifyPublishUpgrade() {
|
|
|
2925
3063
|
color: "promotion",
|
|
2926
3064
|
href: PUBLISH_UPGRADE_URL,
|
|
2927
3065
|
target: "_blank",
|
|
2928
|
-
children:
|
|
3066
|
+
children: __15("Upgrade Now", "elementor")
|
|
2929
3067
|
}
|
|
2930
3068
|
]
|
|
2931
3069
|
});
|
|
@@ -2967,7 +3105,7 @@ function init() {
|
|
|
2967
3105
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
2968
3106
|
injectTab({
|
|
2969
3107
|
id: "components",
|
|
2970
|
-
label:
|
|
3108
|
+
label: __16("Components", "elementor"),
|
|
2971
3109
|
component: Components,
|
|
2972
3110
|
position: 1
|
|
2973
3111
|
});
|