@elementor/editor-components 4.0.0-671 → 4.0.0-673
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 +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +259 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/components-tab/components-list.tsx +47 -4
- package/src/components/components-tab/components-pro-notification.tsx +9 -15
- package/src/components/components-tab/components.tsx +7 -3
- package/src/components/components-tab/loading-components.tsx +26 -14
- package/src/components/components-upgrade-alert.tsx +39 -0
- package/src/components/instance-editing-panel/instance-editing-panel.tsx +13 -1
- package/src/create-component-type.ts +3 -4
- package/src/index.ts +1 -6
- package/src/sync/publish-draft-components-in-page-before-save.ts +42 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(index_exports, {
|
|
|
35
35
|
ComponentItem: () => ComponentItem,
|
|
36
36
|
ComponentName: () => ComponentName,
|
|
37
37
|
ComponentSearch: () => ComponentSearch,
|
|
38
|
-
ComponentsEmptyState: () => EmptyState,
|
|
39
38
|
ComponentsList: () => ComponentsList,
|
|
40
39
|
DetachAction: () => DetachAction,
|
|
41
40
|
EditComponentAction: () => EditComponentAction,
|
|
@@ -93,7 +92,7 @@ var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
|
93
92
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
94
93
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
95
94
|
var import_store35 = require("@elementor/store");
|
|
96
|
-
var
|
|
95
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
97
96
|
|
|
98
97
|
// src/component-instance-transformer.ts
|
|
99
98
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
@@ -453,8 +452,10 @@ var componentOverrideTransformer = (0, import_editor_canvas3.createTransformer)(
|
|
|
453
452
|
});
|
|
454
453
|
|
|
455
454
|
// src/components/components-tab/components.tsx
|
|
456
|
-
var
|
|
457
|
-
var
|
|
455
|
+
var React8 = __toESM(require("react"));
|
|
456
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
457
|
+
var import_ui6 = require("@elementor/ui");
|
|
458
|
+
var import_utils3 = require("@elementor/utils");
|
|
458
459
|
|
|
459
460
|
// src/hooks/use-components.ts
|
|
460
461
|
var import_store5 = require("@elementor/store");
|
|
@@ -516,6 +517,7 @@ var ComponentSearch = () => {
|
|
|
516
517
|
var React5 = __toESM(require("react"));
|
|
517
518
|
var import_icons3 = require("@elementor/icons");
|
|
518
519
|
var import_ui4 = require("@elementor/ui");
|
|
520
|
+
var import_utils2 = require("@elementor/utils");
|
|
519
521
|
var import_i18n2 = require("@wordpress/i18n");
|
|
520
522
|
|
|
521
523
|
// src/hooks/use-components-permissions.ts
|
|
@@ -607,44 +609,59 @@ function ComponentName({ name, editable }) {
|
|
|
607
609
|
// src/components/components-tab/loading-components.tsx
|
|
608
610
|
var React4 = __toESM(require("react"));
|
|
609
611
|
var import_ui3 = require("@elementor/ui");
|
|
610
|
-
var ROWS = Array.from({ length:
|
|
612
|
+
var ROWS = Array.from({ length: 3 }, (_, index) => index);
|
|
613
|
+
var STAGGER_DELAY_MS = 80;
|
|
611
614
|
var LoadingComponents = () => {
|
|
612
615
|
return /* @__PURE__ */ React4.createElement(
|
|
613
616
|
import_ui3.Stack,
|
|
614
617
|
{
|
|
615
618
|
"aria-label": "Loading components",
|
|
616
|
-
gap: 1,
|
|
619
|
+
gap: 1.5,
|
|
617
620
|
sx: {
|
|
618
621
|
pointerEvents: "none",
|
|
619
622
|
position: "relative",
|
|
620
623
|
maxHeight: "300px",
|
|
621
624
|
overflow: "hidden",
|
|
625
|
+
px: 1,
|
|
622
626
|
"&:after": {
|
|
623
627
|
position: "absolute",
|
|
624
|
-
|
|
628
|
+
bottom: 0,
|
|
625
629
|
content: '""',
|
|
626
630
|
left: 0,
|
|
627
631
|
width: "100%",
|
|
628
|
-
height: "
|
|
629
|
-
|
|
630
|
-
|
|
632
|
+
height: "40%",
|
|
633
|
+
pointerEvents: "none",
|
|
634
|
+
zIndex: 1
|
|
631
635
|
}
|
|
632
636
|
}
|
|
633
637
|
},
|
|
634
638
|
ROWS.map((row) => /* @__PURE__ */ React4.createElement(
|
|
635
|
-
import_ui3.
|
|
639
|
+
import_ui3.Box,
|
|
636
640
|
{
|
|
637
641
|
key: row,
|
|
638
|
-
|
|
639
|
-
|
|
642
|
+
display: "flex",
|
|
643
|
+
alignItems: "center",
|
|
644
|
+
gap: 1.5,
|
|
645
|
+
sx: {
|
|
646
|
+
py: 0.75,
|
|
647
|
+
px: 1.5,
|
|
648
|
+
opacity: 0,
|
|
649
|
+
animation: `e-loading-fade-in 0.4s ease-out ${row * STAGGER_DELAY_MS}ms forwards`,
|
|
650
|
+
"@keyframes e-loading-fade-in": {
|
|
651
|
+
from: { opacity: 0, transform: "translateY(4px)" },
|
|
652
|
+
to: { opacity: 1, transform: "translateY(0)" }
|
|
653
|
+
}
|
|
654
|
+
}
|
|
640
655
|
},
|
|
641
|
-
/* @__PURE__ */ React4.createElement(import_ui3.
|
|
656
|
+
/* @__PURE__ */ React4.createElement(import_ui3.Skeleton, { animation: "wave", variant: "rounded", width: 24, height: 24 }),
|
|
657
|
+
/* @__PURE__ */ React4.createElement(import_ui3.Skeleton, { animation: "wave", variant: "rounded", width: "60%", height: 14 })
|
|
642
658
|
))
|
|
643
659
|
);
|
|
644
660
|
};
|
|
645
661
|
|
|
646
662
|
// src/components/components-tab/components-list.tsx
|
|
647
663
|
var LEARN_MORE_URL = "http://go.elementor.com/components-guide-article";
|
|
664
|
+
var UPGRADE_URL = "https://go.elementor.com/go-pro-components/";
|
|
648
665
|
var SUBTITLE_OVERRIDE_SX = {
|
|
649
666
|
fontSize: "0.875rem !important",
|
|
650
667
|
fontWeight: "500 !important"
|
|
@@ -656,10 +673,40 @@ function ComponentsList() {
|
|
|
656
673
|
}
|
|
657
674
|
const isEmpty = !components?.length;
|
|
658
675
|
if (isEmpty) {
|
|
659
|
-
|
|
676
|
+
if (searchValue.length) {
|
|
677
|
+
return /* @__PURE__ */ React5.createElement(EmptySearchResult, null);
|
|
678
|
+
}
|
|
679
|
+
return (0, import_utils2.hasProInstalled)() ? /* @__PURE__ */ React5.createElement(EmptyState, null) : /* @__PURE__ */ React5.createElement(ProUpgradeEmptyState, null);
|
|
660
680
|
}
|
|
661
681
|
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 })));
|
|
662
682
|
}
|
|
683
|
+
var ProUpgradeEmptyState = () => {
|
|
684
|
+
return /* @__PURE__ */ React5.createElement(
|
|
685
|
+
import_ui4.Stack,
|
|
686
|
+
{
|
|
687
|
+
alignItems: "center",
|
|
688
|
+
justifyContent: "start",
|
|
689
|
+
height: "100%",
|
|
690
|
+
sx: { px: 2, py: 4 },
|
|
691
|
+
gap: 2,
|
|
692
|
+
overflow: "hidden"
|
|
693
|
+
},
|
|
694
|
+
/* @__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", sx: { maxWidth: 200 } }, (0, import_i18n2.__)("Create design elements that sync across your entire site.", "elementor"))),
|
|
695
|
+
/* @__PURE__ */ React5.createElement(
|
|
696
|
+
import_ui4.Button,
|
|
697
|
+
{
|
|
698
|
+
variant: "contained",
|
|
699
|
+
color: "promotion",
|
|
700
|
+
size: "small",
|
|
701
|
+
startIcon: /* @__PURE__ */ React5.createElement(import_icons3.CrownFilledIcon, null),
|
|
702
|
+
href: UPGRADE_URL,
|
|
703
|
+
target: "_blank",
|
|
704
|
+
rel: "noopener noreferrer"
|
|
705
|
+
},
|
|
706
|
+
(0, import_i18n2.__)("Upgrade now", "elementor")
|
|
707
|
+
)
|
|
708
|
+
);
|
|
709
|
+
};
|
|
663
710
|
var EmptyState = () => {
|
|
664
711
|
const { canCreate } = useComponentsPermissions();
|
|
665
712
|
return /* @__PURE__ */ React5.createElement(
|
|
@@ -766,108 +813,148 @@ var useFilteredComponents = () => {
|
|
|
766
813
|
};
|
|
767
814
|
|
|
768
815
|
// src/components/components-tab/components-pro-notification.tsx
|
|
816
|
+
var React7 = __toESM(require("react"));
|
|
817
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
818
|
+
|
|
819
|
+
// src/components/components-upgrade-alert.tsx
|
|
769
820
|
var React6 = __toESM(require("react"));
|
|
770
|
-
var
|
|
821
|
+
var import_icons4 = require("@elementor/icons");
|
|
771
822
|
var import_ui5 = require("@elementor/ui");
|
|
772
823
|
var import_i18n3 = require("@wordpress/i18n");
|
|
824
|
+
function ComponentsUpgradeAlert({ title, description, upgradeUrl }) {
|
|
825
|
+
return /* @__PURE__ */ React6.createElement(import_ui5.Box, { sx: { mt: "auto" } }, /* @__PURE__ */ React6.createElement(
|
|
826
|
+
import_ui5.Alert,
|
|
827
|
+
{
|
|
828
|
+
variant: "standard",
|
|
829
|
+
color: "promotion",
|
|
830
|
+
icon: /* @__PURE__ */ React6.createElement(import_icons4.CrownFilledIcon, { fontSize: "tiny" }),
|
|
831
|
+
role: "status",
|
|
832
|
+
size: "small",
|
|
833
|
+
action: /* @__PURE__ */ React6.createElement(
|
|
834
|
+
import_ui5.AlertAction,
|
|
835
|
+
{
|
|
836
|
+
variant: "contained",
|
|
837
|
+
color: "promotion",
|
|
838
|
+
href: upgradeUrl,
|
|
839
|
+
target: "_blank",
|
|
840
|
+
rel: "noopener noreferrer"
|
|
841
|
+
},
|
|
842
|
+
(0, import_i18n3.__)("Upgrade now", "elementor")
|
|
843
|
+
),
|
|
844
|
+
sx: { m: 2, mt: 1 }
|
|
845
|
+
},
|
|
846
|
+
/* @__PURE__ */ React6.createElement(import_ui5.AlertTitle, null, title),
|
|
847
|
+
/* @__PURE__ */ React6.createElement(import_ui5.Typography, { variant: "caption" }, description)
|
|
848
|
+
));
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// src/components/components-tab/components-pro-notification.tsx
|
|
852
|
+
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-create/";
|
|
773
853
|
function ComponentsProNotification() {
|
|
774
|
-
return /* @__PURE__ */
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
854
|
+
return /* @__PURE__ */ React7.createElement(
|
|
855
|
+
ComponentsUpgradeAlert,
|
|
856
|
+
{
|
|
857
|
+
title: (0, import_i18n4.__)("Create new components", "elementor"),
|
|
858
|
+
description: (0, import_i18n4.__)("Creating new components requires an active Pro subscription.", "elementor"),
|
|
859
|
+
upgradeUrl: UPGRADE_URL2
|
|
860
|
+
}
|
|
861
|
+
);
|
|
778
862
|
}
|
|
779
863
|
|
|
780
864
|
// src/components/components-tab/components.tsx
|
|
781
865
|
var ComponentsContent = () => {
|
|
782
866
|
const { components, isLoading } = useComponents();
|
|
783
867
|
const hasComponents = !isLoading && components.length > 0;
|
|
784
|
-
|
|
868
|
+
const hasPro = (0, import_utils3.hasProInstalled)();
|
|
869
|
+
const showProNotification = !hasPro && hasComponents;
|
|
870
|
+
return /* @__PURE__ */ React8.createElement(import_ui6.Stack, { sx: { height: "100%" } }, hasComponents && /* @__PURE__ */ React8.createElement(ComponentSearch, null), /* @__PURE__ */ React8.createElement(ComponentsList, null), showProNotification && /* @__PURE__ */ React8.createElement(ComponentsProNotification, null));
|
|
785
871
|
};
|
|
786
872
|
var Components = () => {
|
|
787
|
-
return /* @__PURE__ */
|
|
873
|
+
return /* @__PURE__ */ React8.createElement(import_editor_ui2.ThemeProvider, null, /* @__PURE__ */ React8.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React8.createElement(ComponentsContent, null)));
|
|
788
874
|
};
|
|
789
875
|
|
|
790
876
|
// src/components/detach-instance-confirmation-dialog.tsx
|
|
791
|
-
var
|
|
792
|
-
var
|
|
793
|
-
var
|
|
794
|
-
var
|
|
877
|
+
var React9 = __toESM(require("react"));
|
|
878
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
879
|
+
var import_icons5 = require("@elementor/icons");
|
|
880
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
795
881
|
function DetachInstanceConfirmationDialog({
|
|
796
882
|
open,
|
|
797
883
|
onClose,
|
|
798
884
|
onConfirm
|
|
799
885
|
}) {
|
|
800
|
-
return /* @__PURE__ */
|
|
886
|
+
return /* @__PURE__ */ React9.createElement(import_editor_ui3.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React9.createElement(import_editor_ui3.ConfirmationDialog.Title, { icon: import_icons5.AlertTriangleFilledIcon, iconColor: "secondary" }, (0, import_i18n5.__)("Detach from Component?", "elementor")), /* @__PURE__ */ React9.createElement(import_editor_ui3.ConfirmationDialog.Content, null, /* @__PURE__ */ React9.createElement(import_editor_ui3.ConfirmationDialog.ContentText, null, (0, import_i18n5.__)(
|
|
801
887
|
"Detaching this instance will break its link to the Component. Changes to the Component will no longer apply. Continue?",
|
|
802
888
|
"elementor"
|
|
803
|
-
))), /* @__PURE__ */
|
|
804
|
-
|
|
889
|
+
))), /* @__PURE__ */ React9.createElement(
|
|
890
|
+
import_editor_ui3.ConfirmationDialog.Actions,
|
|
805
891
|
{
|
|
806
892
|
onClose,
|
|
807
893
|
onConfirm,
|
|
808
|
-
confirmLabel: (0,
|
|
894
|
+
confirmLabel: (0, import_i18n5.__)("Detach", "elementor"),
|
|
809
895
|
color: "primary"
|
|
810
896
|
}
|
|
811
897
|
));
|
|
812
898
|
}
|
|
813
899
|
function openDetachConfirmDialog(onConfirm) {
|
|
814
900
|
const handleConfirm = () => {
|
|
815
|
-
(0,
|
|
901
|
+
(0, import_editor_ui3.closeDialog)();
|
|
816
902
|
onConfirm();
|
|
817
903
|
};
|
|
818
|
-
(0,
|
|
819
|
-
component: /* @__PURE__ */
|
|
904
|
+
(0, import_editor_ui3.openDialog)({
|
|
905
|
+
component: /* @__PURE__ */ React9.createElement(DetachInstanceConfirmationDialog, { open: true, onClose: import_editor_ui3.closeDialog, onConfirm: handleConfirm })
|
|
820
906
|
});
|
|
821
907
|
}
|
|
822
908
|
|
|
823
909
|
// src/components/in-edit-mode.tsx
|
|
824
|
-
var
|
|
825
|
-
var
|
|
826
|
-
var
|
|
827
|
-
var
|
|
828
|
-
var
|
|
910
|
+
var React10 = __toESM(require("react"));
|
|
911
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
912
|
+
var import_icons6 = require("@elementor/icons");
|
|
913
|
+
var import_ui7 = require("@elementor/ui");
|
|
914
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
829
915
|
var openEditModeDialog = (lockedBy) => {
|
|
830
|
-
(0,
|
|
831
|
-
component: /* @__PURE__ */
|
|
916
|
+
(0, import_editor_ui4.openDialog)({
|
|
917
|
+
component: /* @__PURE__ */ React10.createElement(EditModeDialog, { lockedBy })
|
|
832
918
|
});
|
|
833
919
|
};
|
|
834
920
|
var EditModeDialog = ({ lockedBy }) => {
|
|
835
|
-
const content = (0,
|
|
836
|
-
return /* @__PURE__ */
|
|
921
|
+
const content = (0, import_i18n6.__)("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
922
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(import_ui7.DialogHeader, { logo: false }, /* @__PURE__ */ React10.createElement(import_ui7.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React10.createElement(import_ui7.Icon, { color: "secondary" }, /* @__PURE__ */ React10.createElement(import_icons6.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React10.createElement(import_ui7.Typography, { variant: "subtitle1" }, content))), /* @__PURE__ */ React10.createElement(import_ui7.DialogContent, null, /* @__PURE__ */ React10.createElement(import_ui7.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React10.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n6.__)(
|
|
837
923
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
838
924
|
"elementor"
|
|
839
|
-
)), /* @__PURE__ */
|
|
925
|
+
)), /* @__PURE__ */ React10.createElement(import_ui7.DialogActions, null, /* @__PURE__ */ React10.createElement(import_ui7.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui4.closeDialog }, (0, import_i18n6.__)("Close", "elementor"))))));
|
|
840
926
|
};
|
|
841
927
|
|
|
842
928
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
843
|
-
var
|
|
844
|
-
var
|
|
845
|
-
var
|
|
846
|
-
var
|
|
929
|
+
var React20 = __toESM(require("react"));
|
|
930
|
+
var import_icons10 = require("@elementor/icons");
|
|
931
|
+
var import_ui14 = require("@elementor/ui");
|
|
932
|
+
var import_utils5 = require("@elementor/utils");
|
|
933
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
847
934
|
|
|
848
935
|
// src/provider/component-instance-context.tsx
|
|
849
|
-
var
|
|
936
|
+
var React11 = __toESM(require("react"));
|
|
850
937
|
var import_react3 = require("react");
|
|
851
938
|
var ComponentInstanceContext = (0, import_react3.createContext)(null);
|
|
852
939
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
853
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ React11.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
854
941
|
}
|
|
855
942
|
var useComponentId = () => (0, import_react3.useContext)(ComponentInstanceContext)?.componentId;
|
|
856
943
|
var useComponentInstanceOverrides = () => (0, import_react3.useContext)(ComponentInstanceContext)?.overrides;
|
|
857
944
|
var useComponentOverridableProps = () => (0, import_react3.useContext)(ComponentInstanceContext)?.overridableProps;
|
|
858
945
|
|
|
859
946
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
860
|
-
var
|
|
947
|
+
var React13 = __toESM(require("react"));
|
|
861
948
|
var import_react4 = require("react");
|
|
862
949
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
863
|
-
var
|
|
864
|
-
var
|
|
950
|
+
var import_icons8 = require("@elementor/icons");
|
|
951
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
865
952
|
|
|
866
953
|
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
867
954
|
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
868
955
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
869
956
|
var import_store9 = require("@elementor/store");
|
|
870
|
-
var
|
|
957
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
871
958
|
|
|
872
959
|
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
873
960
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
@@ -1216,8 +1303,8 @@ async function detachComponentInstance({
|
|
|
1216
1303
|
}
|
|
1217
1304
|
},
|
|
1218
1305
|
{
|
|
1219
|
-
title: (0,
|
|
1220
|
-
subtitle: (0,
|
|
1306
|
+
title: (0, import_i18n7.__)("Detach from Component", "elementor"),
|
|
1307
|
+
subtitle: (0, import_i18n7.__)("Instance detached", "elementor")
|
|
1221
1308
|
}
|
|
1222
1309
|
);
|
|
1223
1310
|
return undoableDetach();
|
|
@@ -1232,16 +1319,16 @@ function extractInstanceOverrides(instanceContainer) {
|
|
|
1232
1319
|
}
|
|
1233
1320
|
|
|
1234
1321
|
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1235
|
-
var
|
|
1322
|
+
var React12 = __toESM(require("react"));
|
|
1236
1323
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
1237
|
-
var
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1324
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1325
|
+
var import_icons7 = require("@elementor/icons");
|
|
1326
|
+
var import_ui8 = require("@elementor/ui");
|
|
1240
1327
|
function InstancePanelHeader({ componentName, actions }) {
|
|
1241
|
-
return /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ React12.createElement(import_editor_panels.PanelHeader, { sx: { justifyContent: "start", px: 2 } }, /* @__PURE__ */ React12.createElement(import_ui8.Stack, { direction: "row", alignItems: "center", flexGrow: 1, gap: 1, maxWidth: "100%" }, /* @__PURE__ */ React12.createElement(import_icons7.ComponentsIcon, { fontSize: "small", sx: { color: "text.tertiary" } }), /* @__PURE__ */ React12.createElement(import_editor_ui5.EllipsisWithTooltip, { title: componentName, as: import_editor_panels.PanelHeaderTitle, sx: { flexGrow: 1 } }), actions));
|
|
1242
1329
|
}
|
|
1243
1330
|
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1244
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ React12.createElement(import_ui8.Tooltip, { title: label }, /* @__PURE__ */ React12.createElement(import_ui8.IconButton, { size: "tiny", onClick, "aria-label": label, disabled }, /* @__PURE__ */ React12.createElement(Icon2, { fontSize: "tiny" })));
|
|
1245
1332
|
}
|
|
1246
1333
|
|
|
1247
1334
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
@@ -1261,7 +1348,7 @@ var DetachAction = ({
|
|
|
1261
1348
|
} catch {
|
|
1262
1349
|
(0, import_editor_notifications.notify)({
|
|
1263
1350
|
type: "error",
|
|
1264
|
-
message: (0,
|
|
1351
|
+
message: (0, import_i18n8.__)("Failed to detach component instance.", "elementor"),
|
|
1265
1352
|
id: "detach-component-instance-failed"
|
|
1266
1353
|
});
|
|
1267
1354
|
}
|
|
@@ -1272,8 +1359,8 @@ var DetachAction = ({
|
|
|
1272
1359
|
const handleDetachClick = () => {
|
|
1273
1360
|
setIsDetachDialogOpen(true);
|
|
1274
1361
|
};
|
|
1275
|
-
const detachLabel = (0,
|
|
1276
|
-
return /* @__PURE__ */
|
|
1362
|
+
const detachLabel = (0, import_i18n8.__)("Detach from Component", "elementor");
|
|
1363
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(EditComponentAction, { label: detachLabel, icon: import_icons8.DetachIcon, onClick: handleDetachClick }), /* @__PURE__ */ React13.createElement(
|
|
1277
1364
|
DetachInstanceConfirmationDialog,
|
|
1278
1365
|
{
|
|
1279
1366
|
open: isDetachDialogOpen,
|
|
@@ -1298,21 +1385,21 @@ function getDetachTrackingInfo() {
|
|
|
1298
1385
|
}
|
|
1299
1386
|
|
|
1300
1387
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
1301
|
-
var
|
|
1302
|
-
var
|
|
1303
|
-
var
|
|
1304
|
-
var
|
|
1388
|
+
var React14 = __toESM(require("react"));
|
|
1389
|
+
var import_icons9 = require("@elementor/icons");
|
|
1390
|
+
var import_ui9 = require("@elementor/ui");
|
|
1391
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1305
1392
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
1306
1393
|
const { canEdit } = useComponentsPermissions();
|
|
1307
|
-
const message = canEdit ? (0,
|
|
1394
|
+
const message = canEdit ? (0, import_i18n9.__)(
|
|
1308
1395
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
1309
1396
|
"elementor"
|
|
1310
|
-
) : (0,
|
|
1397
|
+
) : (0, import_i18n9.__)(
|
|
1311
1398
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
1312
1399
|
"elementor"
|
|
1313
1400
|
);
|
|
1314
|
-
return /* @__PURE__ */
|
|
1315
|
-
|
|
1401
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1402
|
+
import_ui9.Stack,
|
|
1316
1403
|
{
|
|
1317
1404
|
alignItems: "center",
|
|
1318
1405
|
justifyContent: "start",
|
|
@@ -1321,33 +1408,33 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1321
1408
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
1322
1409
|
gap: 1.5
|
|
1323
1410
|
},
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
canEdit && !!onEditComponent && /* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ React14.createElement(import_icons9.ComponentPropListIcon, { fontSize: "large" }),
|
|
1412
|
+
/* @__PURE__ */ React14.createElement(import_ui9.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n9.__)("No properties yet", "elementor")),
|
|
1413
|
+
/* @__PURE__ */ React14.createElement(import_ui9.Typography, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1414
|
+
canEdit && !!onEditComponent && /* @__PURE__ */ React14.createElement(import_ui9.Button, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React14.createElement(import_icons9.PencilIcon, { fontSize: "small" }), (0, import_i18n9.__)("Edit component", "elementor"))
|
|
1328
1415
|
);
|
|
1329
1416
|
};
|
|
1330
1417
|
|
|
1331
1418
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1332
|
-
var
|
|
1419
|
+
var React19 = __toESM(require("react"));
|
|
1333
1420
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
1334
1421
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
1335
1422
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
1336
|
-
var
|
|
1423
|
+
var import_ui13 = require("@elementor/ui");
|
|
1337
1424
|
|
|
1338
1425
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1339
|
-
var
|
|
1426
|
+
var React18 = __toESM(require("react"));
|
|
1340
1427
|
var import_react6 = require("react");
|
|
1341
1428
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1342
|
-
var
|
|
1343
|
-
var
|
|
1429
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1430
|
+
var import_ui12 = require("@elementor/ui");
|
|
1344
1431
|
|
|
1345
1432
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1346
|
-
var
|
|
1433
|
+
var React17 = __toESM(require("react"));
|
|
1347
1434
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
1348
1435
|
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
1349
1436
|
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
1350
|
-
var
|
|
1437
|
+
var import_ui11 = require("@elementor/ui");
|
|
1351
1438
|
|
|
1352
1439
|
// src/hooks/use-controls-by-widget-type.ts
|
|
1353
1440
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
@@ -1381,11 +1468,11 @@ function getControlsByBind(controls) {
|
|
|
1381
1468
|
}
|
|
1382
1469
|
|
|
1383
1470
|
// src/provider/overridable-prop-context.tsx
|
|
1384
|
-
var
|
|
1471
|
+
var React15 = __toESM(require("react"));
|
|
1385
1472
|
var import_react5 = require("react");
|
|
1386
1473
|
var OverridablePropContext = (0, import_react5.createContext)(null);
|
|
1387
1474
|
function OverridablePropProvider({ children, ...props }) {
|
|
1388
|
-
return /* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ React15.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1389
1476
|
}
|
|
1390
1477
|
var useOverridablePropValue = () => (0, import_react5.useContext)(OverridablePropContext)?.value;
|
|
1391
1478
|
var useComponentInstanceElement = () => (0, import_react5.useContext)(OverridablePropContext)?.componentInstanceElement;
|
|
@@ -1614,16 +1701,16 @@ function extractInnerOverrideInfo(override) {
|
|
|
1614
1701
|
}
|
|
1615
1702
|
|
|
1616
1703
|
// src/components/control-label.tsx
|
|
1617
|
-
var
|
|
1704
|
+
var React16 = __toESM(require("react"));
|
|
1618
1705
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
1619
|
-
var
|
|
1706
|
+
var import_ui10 = require("@elementor/ui");
|
|
1620
1707
|
var ControlLabel = ({ children, ...props }) => {
|
|
1621
|
-
return /* @__PURE__ */
|
|
1708
|
+
return /* @__PURE__ */ React16.createElement(import_ui10.Stack, { direction: "row", alignItems: "center", justifyItems: "start", gap: 0.25 }, /* @__PURE__ */ React16.createElement(import_editor_controls.ControlFormLabel, { ...props }, children), /* @__PURE__ */ React16.createElement(import_editor_controls.ControlAdornments, null));
|
|
1622
1709
|
};
|
|
1623
1710
|
|
|
1624
1711
|
// src/components/errors.ts
|
|
1625
|
-
var
|
|
1626
|
-
var OverrideControlInnerElementNotFoundError = (0,
|
|
1712
|
+
var import_utils4 = require("@elementor/utils");
|
|
1713
|
+
var OverrideControlInnerElementNotFoundError = (0, import_utils4.createError)({
|
|
1627
1714
|
code: "override_control_inner_element_not_found",
|
|
1628
1715
|
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.`
|
|
1629
1716
|
});
|
|
@@ -1727,7 +1814,7 @@ function OverridePropControl({ overrideKey }) {
|
|
|
1727
1814
|
if (!overridableProp) {
|
|
1728
1815
|
return null;
|
|
1729
1816
|
}
|
|
1730
|
-
return /* @__PURE__ */
|
|
1817
|
+
return /* @__PURE__ */ React17.createElement(import_editor_editing_panel.SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React17.createElement(OverrideControl, { overridableProp }));
|
|
1731
1818
|
}
|
|
1732
1819
|
function OverrideControl({ overridableProp }) {
|
|
1733
1820
|
const componentInstanceElement = (0, import_editor_editing_panel.useElement)();
|
|
@@ -1821,13 +1908,13 @@ function OverrideControl({ overridableProp }) {
|
|
|
1821
1908
|
[overridableProp.overrideKey]: propType
|
|
1822
1909
|
}
|
|
1823
1910
|
});
|
|
1824
|
-
return /* @__PURE__ */
|
|
1911
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1825
1912
|
OverridablePropProvider,
|
|
1826
1913
|
{
|
|
1827
1914
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
1828
1915
|
componentInstanceElement
|
|
1829
1916
|
},
|
|
1830
|
-
/* @__PURE__ */
|
|
1917
|
+
/* @__PURE__ */ React17.createElement(import_editor_editing_panel.ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React17.createElement(import_editor_editing_panel.SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React17.createElement(
|
|
1831
1918
|
import_editor_controls2.PropProvider,
|
|
1832
1919
|
{
|
|
1833
1920
|
propType: propTypeSchema,
|
|
@@ -1837,7 +1924,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1837
1924
|
return false;
|
|
1838
1925
|
}
|
|
1839
1926
|
},
|
|
1840
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ React17.createElement(import_editor_controls2.PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React17.createElement(import_editor_controls2.ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React17.createElement(import_ui11.Stack, { direction: "column", gap: 1, mb: 1.5 }, layout !== "custom" && /* @__PURE__ */ React17.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React17.createElement(OriginalControl, { control, controlProps }))))
|
|
1841
1928
|
)))
|
|
1842
1929
|
);
|
|
1843
1930
|
}
|
|
@@ -1896,7 +1983,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
1896
1983
|
}
|
|
1897
1984
|
function OriginalControl({ control, controlProps }) {
|
|
1898
1985
|
const { value } = control;
|
|
1899
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ React17.createElement(import_editor_editing_panel.BaseControl, { type: value.type, props: controlProps });
|
|
1900
1987
|
}
|
|
1901
1988
|
function getControlLayout(control) {
|
|
1902
1989
|
return control.value.meta?.layout || import_editor_editing_panel.controlsRegistry.getLayout(control.value.type);
|
|
@@ -1931,8 +2018,8 @@ function OverridePropsGroup({ group }) {
|
|
|
1931
2018
|
const labelId = `label-${id}`;
|
|
1932
2019
|
const contentId = `content-${id}`;
|
|
1933
2020
|
const title = group.label;
|
|
1934
|
-
return /* @__PURE__ */
|
|
1935
|
-
|
|
2021
|
+
return /* @__PURE__ */ React18.createElement(import_ui12.Box, { "aria-label": `${title} section` }, /* @__PURE__ */ React18.createElement(
|
|
2022
|
+
import_ui12.ListItemButton,
|
|
1936
2023
|
{
|
|
1937
2024
|
id: labelId,
|
|
1938
2025
|
"aria-controls": contentId,
|
|
@@ -1941,21 +2028,21 @@ function OverridePropsGroup({ group }) {
|
|
|
1941
2028
|
p: 0,
|
|
1942
2029
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
1943
2030
|
},
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
|
|
2031
|
+
/* @__PURE__ */ React18.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React18.createElement(
|
|
2032
|
+
import_ui12.ListItemText,
|
|
1946
2033
|
{
|
|
1947
2034
|
secondary: title,
|
|
1948
2035
|
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
1949
2036
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
1950
2037
|
}
|
|
1951
2038
|
)),
|
|
1952
|
-
/* @__PURE__ */
|
|
1953
|
-
), /* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ React18.createElement(import_editor_ui6.CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
2040
|
+
), /* @__PURE__ */ React18.createElement(import_ui12.Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React18.createElement(import_ui12.Stack, { direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React18.createElement(OverridePropControl, { key: overrideKey, overrideKey })))));
|
|
1954
2041
|
}
|
|
1955
2042
|
|
|
1956
2043
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1957
2044
|
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
1958
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ React19.createElement(import_editor_panels2.PanelBody, null, /* @__PURE__ */ React19.createElement(import_editor_controls3.ControlAdornmentsProvider, { items: (0, import_editor_editing_panel3.getFieldIndicators)("settings") }, isEmpty ? emptyState : /* @__PURE__ */ React19.createElement(import_ui13.Stack, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React19.createElement(React19.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React19.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React19.createElement(import_ui13.Divider, null))))));
|
|
1959
2046
|
}
|
|
1960
2047
|
|
|
1961
2048
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -2055,32 +2142,41 @@ function useComponentInstanceSettings() {
|
|
|
2055
2142
|
}
|
|
2056
2143
|
|
|
2057
2144
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
2145
|
+
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2058
2146
|
function InstanceEditingPanel() {
|
|
2059
2147
|
const { canEdit } = useComponentsPermissions();
|
|
2060
2148
|
const data = useInstancePanelData();
|
|
2149
|
+
const hasPro = (0, import_utils5.hasProInstalled)();
|
|
2061
2150
|
if (!data) {
|
|
2062
2151
|
return null;
|
|
2063
2152
|
}
|
|
2064
2153
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
2065
|
-
const panelTitle = (0,
|
|
2066
|
-
const actions = /* @__PURE__ */
|
|
2067
|
-
return /* @__PURE__ */
|
|
2154
|
+
const panelTitle = (0, import_i18n10.__)("Edit %s", "elementor").replace("%s", component.name);
|
|
2155
|
+
const actions = /* @__PURE__ */ React20.createElement(import_ui14.Stack, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React20.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React20.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: import_icons10.PencilIcon }));
|
|
2156
|
+
return /* @__PURE__ */ React20.createElement(import_ui14.Box, { "data-testid": "instance-editing-panel", sx: { display: "flex", flexDirection: "column", height: "100%" } }, /* @__PURE__ */ React20.createElement(
|
|
2068
2157
|
ComponentInstanceProvider,
|
|
2069
2158
|
{
|
|
2070
2159
|
componentId,
|
|
2071
2160
|
overrides,
|
|
2072
2161
|
overridableProps
|
|
2073
2162
|
},
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2163
|
+
/* @__PURE__ */ React20.createElement(InstancePanelHeader, { componentName: component.name, actions }),
|
|
2164
|
+
/* @__PURE__ */ React20.createElement(
|
|
2076
2165
|
InstancePanelBody,
|
|
2077
2166
|
{
|
|
2078
2167
|
groups,
|
|
2079
2168
|
isEmpty,
|
|
2080
|
-
emptyState: /* @__PURE__ */
|
|
2169
|
+
emptyState: /* @__PURE__ */ React20.createElement(EmptyState2, null),
|
|
2081
2170
|
componentInstanceId
|
|
2082
2171
|
}
|
|
2083
2172
|
)
|
|
2173
|
+
), !hasPro && /* @__PURE__ */ React20.createElement(
|
|
2174
|
+
ComponentsUpgradeAlert,
|
|
2175
|
+
{
|
|
2176
|
+
title: (0, import_i18n10.__)("Edit components", "elementor"),
|
|
2177
|
+
description: (0, import_i18n10.__)("Editing components requires an active Pro subscription.", "elementor"),
|
|
2178
|
+
upgradeUrl: EDIT_UPGRADE_URL
|
|
2179
|
+
}
|
|
2084
2180
|
));
|
|
2085
2181
|
}
|
|
2086
2182
|
|
|
@@ -2219,16 +2315,16 @@ var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
|
2219
2315
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
2220
2316
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2221
2317
|
var import_store26 = require("@elementor/store");
|
|
2222
|
-
var
|
|
2223
|
-
var
|
|
2318
|
+
var import_utils7 = require("@elementor/utils");
|
|
2319
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2224
2320
|
|
|
2225
2321
|
// src/utils/format-component-elements-id.ts
|
|
2226
|
-
var
|
|
2322
|
+
var import_utils6 = require("@elementor/utils");
|
|
2227
2323
|
var ELEMENT_ID_LENGTH = 7;
|
|
2228
2324
|
function formatComponentElementsId(elements, path) {
|
|
2229
2325
|
return elements.map((element) => {
|
|
2230
2326
|
const nestingPath = [...path, element.id];
|
|
2231
|
-
const id = (0,
|
|
2327
|
+
const id = (0, import_utils6.hashString)(nestingPath.join("_"), ELEMENT_ID_LENGTH);
|
|
2232
2328
|
return {
|
|
2233
2329
|
...element,
|
|
2234
2330
|
id,
|
|
@@ -2298,7 +2394,7 @@ function notifyComponentEditUpgrade() {
|
|
|
2298
2394
|
(0, import_editor_notifications2.notify)({
|
|
2299
2395
|
type: "promotion",
|
|
2300
2396
|
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
2301
|
-
message: (0,
|
|
2397
|
+
message: (0, import_i18n11.__)("Editing components requires an active Pro subscription.", "elementor"),
|
|
2302
2398
|
additionalActionProps: [
|
|
2303
2399
|
{
|
|
2304
2400
|
size: "small",
|
|
@@ -2306,7 +2402,7 @@ function notifyComponentEditUpgrade() {
|
|
|
2306
2402
|
color: "promotion",
|
|
2307
2403
|
href: EDIT_COMPONENT_UPGRADE_URL,
|
|
2308
2404
|
target: "_blank",
|
|
2309
|
-
children: (0,
|
|
2405
|
+
children: (0, import_i18n11.__)("Upgrade Now", "elementor")
|
|
2310
2406
|
}
|
|
2311
2407
|
]
|
|
2312
2408
|
});
|
|
@@ -2419,14 +2515,13 @@ function createComponentView(options) {
|
|
|
2419
2515
|
}
|
|
2420
2516
|
_getContextMenuConfig() {
|
|
2421
2517
|
const isAdministrator = isUserAdministrator();
|
|
2422
|
-
const hasPro = (0,
|
|
2423
|
-
const
|
|
2424
|
-
const
|
|
2425
|
-
const proBadge = `<a href="${EDIT_COMPONENT_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}">${proLabel}</a>`;
|
|
2518
|
+
const hasPro = (0, import_utils7.hasProInstalled)();
|
|
2519
|
+
const badgeClass = "elementor-context-menu-list__item__shortcut__promotion-badge";
|
|
2520
|
+
const proBadge = `<a href="${EDIT_COMPONENT_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}"><i class="eicon-upgrade-crown"></i></a>`;
|
|
2426
2521
|
const editComponentAction = {
|
|
2427
2522
|
name: "edit component",
|
|
2428
2523
|
icon: "eicon-edit",
|
|
2429
|
-
title: () => (0,
|
|
2524
|
+
title: () => (0, import_i18n11.__)("Edit Component", "elementor"),
|
|
2430
2525
|
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
2431
2526
|
isEnabled: () => hasPro,
|
|
2432
2527
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
@@ -2434,7 +2529,7 @@ function createComponentView(options) {
|
|
|
2434
2529
|
const detachInstanceAction = {
|
|
2435
2530
|
name: "detach instance",
|
|
2436
2531
|
icon: "eicon-chain-broken",
|
|
2437
|
-
title: () => (0,
|
|
2532
|
+
title: () => (0, import_i18n11.__)("Detach from Component", "elementor"),
|
|
2438
2533
|
isEnabled: () => true,
|
|
2439
2534
|
callback: (_, eventData) => this.detachInstance(eventData)
|
|
2440
2535
|
};
|
|
@@ -2461,7 +2556,7 @@ function createComponentView(options) {
|
|
|
2461
2556
|
}
|
|
2462
2557
|
}
|
|
2463
2558
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
2464
|
-
const hasPro = (0,
|
|
2559
|
+
const hasPro = (0, import_utils7.hasProInstalled)();
|
|
2465
2560
|
if (!hasPro || this.isComponentCurrentlyEdited()) {
|
|
2466
2561
|
return;
|
|
2467
2562
|
}
|
|
@@ -2493,7 +2588,7 @@ function createComponentView(options) {
|
|
|
2493
2588
|
} catch {
|
|
2494
2589
|
(0, import_editor_notifications2.notify)({
|
|
2495
2590
|
type: "error",
|
|
2496
|
-
message: (0,
|
|
2591
|
+
message: (0, import_i18n11.__)("Failed to detach component instance.", "elementor"),
|
|
2497
2592
|
id: "detach-component-instance-failed"
|
|
2498
2593
|
});
|
|
2499
2594
|
}
|
|
@@ -2505,7 +2600,7 @@ function createComponentView(options) {
|
|
|
2505
2600
|
if (!isUserAdministrator()) {
|
|
2506
2601
|
return;
|
|
2507
2602
|
}
|
|
2508
|
-
if (!(0,
|
|
2603
|
+
if (!(0, import_utils7.hasProInstalled)()) {
|
|
2509
2604
|
notifyComponentEditUpgrade();
|
|
2510
2605
|
return;
|
|
2511
2606
|
}
|
|
@@ -2606,11 +2701,11 @@ var import_editor_elements9 = require("@elementor/editor-elements");
|
|
|
2606
2701
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
2607
2702
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2608
2703
|
var import_store29 = require("@elementor/store");
|
|
2609
|
-
var
|
|
2704
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2610
2705
|
var COMPONENT_TYPE = "e-component";
|
|
2611
2706
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
2612
2707
|
type: "default",
|
|
2613
|
-
message: (0,
|
|
2708
|
+
message: (0, import_i18n12.__)("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
2614
2709
|
id: "circular-component-nesting-blocked"
|
|
2615
2710
|
};
|
|
2616
2711
|
function initCircularNestingPrevention() {
|
|
@@ -2759,6 +2854,12 @@ var componentsStylesProvider = (0, import_editor_styles_repository.createStylesP
|
|
|
2759
2854
|
|
|
2760
2855
|
// src/sync/publish-draft-components-in-page-before-save.ts
|
|
2761
2856
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2857
|
+
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
2858
|
+
var import_http_client2 = require("@elementor/http-client");
|
|
2859
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2860
|
+
var INSUFFICIENT_PERMISSIONS_ERROR_CODE = "insufficient_permissions";
|
|
2861
|
+
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2862
|
+
var PUBLISH_UPGRADE_NOTIFICATION_ID = "component-publish-upgrade";
|
|
2762
2863
|
async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
2763
2864
|
if (status !== "publish") {
|
|
2764
2865
|
return;
|
|
@@ -2768,9 +2869,40 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
2768
2869
|
if (draftIds.length === 0) {
|
|
2769
2870
|
return;
|
|
2770
2871
|
}
|
|
2771
|
-
|
|
2872
|
+
try {
|
|
2873
|
+
await apiClient.updateStatuses(draftIds, "publish");
|
|
2874
|
+
} catch (error) {
|
|
2875
|
+
if (isInsufficientPermissionsError(error)) {
|
|
2876
|
+
notifyPublishUpgrade();
|
|
2877
|
+
return;
|
|
2878
|
+
}
|
|
2879
|
+
throw error;
|
|
2880
|
+
}
|
|
2772
2881
|
draftIds.forEach((id) => (0, import_editor_documents5.invalidateDocumentData)(id));
|
|
2773
2882
|
}
|
|
2883
|
+
function isInsufficientPermissionsError(error) {
|
|
2884
|
+
return error instanceof import_http_client2.AxiosError && error.response?.data?.code === INSUFFICIENT_PERMISSIONS_ERROR_CODE;
|
|
2885
|
+
}
|
|
2886
|
+
function notifyPublishUpgrade() {
|
|
2887
|
+
(0, import_editor_notifications4.notify)({
|
|
2888
|
+
type: "promotion",
|
|
2889
|
+
id: PUBLISH_UPGRADE_NOTIFICATION_ID,
|
|
2890
|
+
message: (0, import_i18n13.__)(
|
|
2891
|
+
"You have unpublished component on this page. You need a pro version to publish it.",
|
|
2892
|
+
"elementor"
|
|
2893
|
+
),
|
|
2894
|
+
additionalActionProps: [
|
|
2895
|
+
{
|
|
2896
|
+
size: "small",
|
|
2897
|
+
variant: "contained",
|
|
2898
|
+
color: "promotion",
|
|
2899
|
+
href: PUBLISH_UPGRADE_URL,
|
|
2900
|
+
target: "_blank",
|
|
2901
|
+
children: (0, import_i18n13.__)("Upgrade Now", "elementor")
|
|
2902
|
+
}
|
|
2903
|
+
]
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2774
2906
|
|
|
2775
2907
|
// src/sync/before-save.ts
|
|
2776
2908
|
var beforeSave = ({ container, status }) => {
|
|
@@ -2808,7 +2940,7 @@ function init() {
|
|
|
2808
2940
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
2809
2941
|
(0, import_editor_elements_panel.injectTab)({
|
|
2810
2942
|
id: "components",
|
|
2811
|
-
label: (0,
|
|
2943
|
+
label: (0, import_i18n14.__)("Components", "elementor"),
|
|
2812
2944
|
component: Components,
|
|
2813
2945
|
position: 1
|
|
2814
2946
|
});
|
|
@@ -2845,7 +2977,6 @@ function init() {
|
|
|
2845
2977
|
ComponentItem,
|
|
2846
2978
|
ComponentName,
|
|
2847
2979
|
ComponentSearch,
|
|
2848
|
-
ComponentsEmptyState,
|
|
2849
2980
|
ComponentsList,
|
|
2850
2981
|
DetachAction,
|
|
2851
2982
|
EditComponentAction,
|