@elementor/editor-components 4.0.0-683 → 4.0.0
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.js +265 -127
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +248 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- 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/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";
|
|
@@ -410,11 +410,10 @@ var componentOverrideTransformer = createTransformer3((override) => {
|
|
|
410
410
|
});
|
|
411
411
|
|
|
412
412
|
// src/components/components-tab/components.tsx
|
|
413
|
-
import * as
|
|
413
|
+
import * as React10 from "react";
|
|
414
414
|
import { useLayoutEffect } from "react";
|
|
415
415
|
import { ThemeProvider } from "@elementor/editor-ui";
|
|
416
416
|
import { Stack as Stack4 } from "@elementor/ui";
|
|
417
|
-
import { hasProInstalled as hasProInstalled2 } from "@elementor/utils";
|
|
418
417
|
|
|
419
418
|
// src/hooks/use-components.ts
|
|
420
419
|
import { __useSelector as useSelector2 } from "@elementor/store";
|
|
@@ -424,6 +423,16 @@ var useComponents = () => {
|
|
|
424
423
|
return { components, isLoading };
|
|
425
424
|
};
|
|
426
425
|
|
|
426
|
+
// src/utils/is-pro-components-supported.ts
|
|
427
|
+
import { hasProInstalled, isProAtLeast } from "@elementor/utils";
|
|
428
|
+
var MIN_PRO_VERSION_FOR_COMPONENTS = "4.0";
|
|
429
|
+
function isProComponentsSupported() {
|
|
430
|
+
return hasProInstalled() && isProAtLeast(MIN_PRO_VERSION_FOR_COMPONENTS);
|
|
431
|
+
}
|
|
432
|
+
function isProOutdatedForComponents() {
|
|
433
|
+
return hasProInstalled() && !isProAtLeast(MIN_PRO_VERSION_FOR_COMPONENTS);
|
|
434
|
+
}
|
|
435
|
+
|
|
427
436
|
// src/components/components-tab/component-search.tsx
|
|
428
437
|
import * as React2 from "react";
|
|
429
438
|
import { SearchIcon } from "@elementor/icons";
|
|
@@ -476,7 +485,6 @@ var ComponentSearch = () => {
|
|
|
476
485
|
import * as React5 from "react";
|
|
477
486
|
import { ComponentsIcon as ComponentsIcon2, CrownFilledIcon } from "@elementor/icons";
|
|
478
487
|
import { Box as Box4, Button, Divider, Link, List, Stack as Stack3, Typography as Typography2 } from "@elementor/ui";
|
|
479
|
-
import { hasProInstalled } from "@elementor/utils";
|
|
480
488
|
import { __ as __2 } from "@wordpress/i18n";
|
|
481
489
|
|
|
482
490
|
// src/hooks/use-components-permissions.ts
|
|
@@ -621,6 +629,7 @@ var LoadingComponents = () => {
|
|
|
621
629
|
// src/components/components-tab/components-list.tsx
|
|
622
630
|
var LEARN_MORE_URL = "http://go.elementor.com/components-guide-article";
|
|
623
631
|
var UPGRADE_URL = "https://go.elementor.com/go-pro-components/";
|
|
632
|
+
var UPDATE_PLUGINS_URL = "/wp-admin/plugins.php";
|
|
624
633
|
var SUBTITLE_OVERRIDE_SX = {
|
|
625
634
|
fontSize: "0.875rem !important",
|
|
626
635
|
fontWeight: "500 !important"
|
|
@@ -635,7 +644,10 @@ function ComponentsList() {
|
|
|
635
644
|
if (searchValue.length) {
|
|
636
645
|
return /* @__PURE__ */ React5.createElement(EmptySearchResult, null);
|
|
637
646
|
}
|
|
638
|
-
|
|
647
|
+
if (isProOutdatedForComponents()) {
|
|
648
|
+
return /* @__PURE__ */ React5.createElement(ProOutdatedEmptyState, null);
|
|
649
|
+
}
|
|
650
|
+
return isProComponentsSupported() ? /* @__PURE__ */ React5.createElement(EmptyState, null) : /* @__PURE__ */ React5.createElement(ProUpgradeEmptyState, null);
|
|
639
651
|
}
|
|
640
652
|
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
653
|
}
|
|
@@ -666,6 +678,32 @@ var ProUpgradeEmptyState = () => {
|
|
|
666
678
|
)
|
|
667
679
|
);
|
|
668
680
|
};
|
|
681
|
+
var ProOutdatedEmptyState = () => {
|
|
682
|
+
return /* @__PURE__ */ React5.createElement(
|
|
683
|
+
Stack3,
|
|
684
|
+
{
|
|
685
|
+
alignItems: "center",
|
|
686
|
+
justifyContent: "start",
|
|
687
|
+
height: "100%",
|
|
688
|
+
sx: { px: 2, py: 4, maxWidth: 268, m: "auto" },
|
|
689
|
+
gap: 2,
|
|
690
|
+
overflow: "hidden"
|
|
691
|
+
},
|
|
692
|
+
/* @__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"))),
|
|
693
|
+
/* @__PURE__ */ React5.createElement(
|
|
694
|
+
Button,
|
|
695
|
+
{
|
|
696
|
+
variant: "text",
|
|
697
|
+
color: "info",
|
|
698
|
+
size: "small",
|
|
699
|
+
href: UPDATE_PLUGINS_URL,
|
|
700
|
+
target: "_blank",
|
|
701
|
+
rel: "noopener noreferrer"
|
|
702
|
+
},
|
|
703
|
+
__2("Update Elementor Pro", "elementor")
|
|
704
|
+
)
|
|
705
|
+
);
|
|
706
|
+
};
|
|
669
707
|
var EmptyState = () => {
|
|
670
708
|
const { canCreate } = useComponentsPermissions();
|
|
671
709
|
return /* @__PURE__ */ React5.createElement(
|
|
@@ -808,7 +846,7 @@ function ComponentsUpgradeAlert({ title, description, upgradeUrl }) {
|
|
|
808
846
|
}
|
|
809
847
|
|
|
810
848
|
// src/components/components-tab/components-pro-notification.tsx
|
|
811
|
-
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-
|
|
849
|
+
var UPGRADE_URL2 = "https://go.elementor.com/go-pro-components-exist-footer/";
|
|
812
850
|
function ComponentsProNotification() {
|
|
813
851
|
return /* @__PURE__ */ React7.createElement(
|
|
814
852
|
ComponentsUpgradeAlert,
|
|
@@ -820,6 +858,54 @@ function ComponentsProNotification() {
|
|
|
820
858
|
);
|
|
821
859
|
}
|
|
822
860
|
|
|
861
|
+
// src/components/components-tab/components-update-notification.tsx
|
|
862
|
+
import * as React9 from "react";
|
|
863
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
864
|
+
|
|
865
|
+
// src/components/components-update-alert.tsx
|
|
866
|
+
import * as React8 from "react";
|
|
867
|
+
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
868
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, Box as Box6, Typography as Typography4 } from "@elementor/ui";
|
|
869
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
870
|
+
var UPDATE_PLUGINS_URL2 = "/wp-admin/plugins.php";
|
|
871
|
+
function ComponentsUpdateAlert({ title, description }) {
|
|
872
|
+
return /* @__PURE__ */ React8.createElement(Box6, { sx: { mt: "auto", position: "sticky", bottom: 0 } }, /* @__PURE__ */ React8.createElement(
|
|
873
|
+
Alert2,
|
|
874
|
+
{
|
|
875
|
+
variant: "standard",
|
|
876
|
+
color: "info",
|
|
877
|
+
icon: /* @__PURE__ */ React8.createElement(InfoCircleFilledIcon, { fontSize: "tiny" }),
|
|
878
|
+
role: "status",
|
|
879
|
+
size: "small",
|
|
880
|
+
action: /* @__PURE__ */ React8.createElement(
|
|
881
|
+
AlertAction2,
|
|
882
|
+
{
|
|
883
|
+
variant: "contained",
|
|
884
|
+
color: "info",
|
|
885
|
+
href: UPDATE_PLUGINS_URL2,
|
|
886
|
+
target: "_blank",
|
|
887
|
+
rel: "noopener noreferrer"
|
|
888
|
+
},
|
|
889
|
+
__5("Upgrade Now", "elementor")
|
|
890
|
+
),
|
|
891
|
+
sx: { m: 2, mt: 1 }
|
|
892
|
+
},
|
|
893
|
+
/* @__PURE__ */ React8.createElement(AlertTitle2, null, title),
|
|
894
|
+
/* @__PURE__ */ React8.createElement(Typography4, { variant: "caption" }, description)
|
|
895
|
+
));
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// src/components/components-tab/components-update-notification.tsx
|
|
899
|
+
function ComponentsUpdateNotification() {
|
|
900
|
+
return /* @__PURE__ */ React9.createElement(
|
|
901
|
+
ComponentsUpdateAlert,
|
|
902
|
+
{
|
|
903
|
+
title: __6("Create new Components", "elementor"),
|
|
904
|
+
description: __6("To create new components, update Elementor Pro to the latest version.", "elementor")
|
|
905
|
+
}
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
|
|
823
909
|
// src/components/components-tab/components.tsx
|
|
824
910
|
var FULL_HEIGHT_STYLE_ID = "components-full-height-panel";
|
|
825
911
|
var FULL_HEIGHT_CSS = `
|
|
@@ -860,34 +946,34 @@ var useFullHeightPanel = () => {
|
|
|
860
946
|
var ComponentsContent = () => {
|
|
861
947
|
const { components, isLoading } = useComponents();
|
|
862
948
|
const hasComponents = !isLoading && components.length > 0;
|
|
863
|
-
const
|
|
864
|
-
const
|
|
949
|
+
const showProNotification = !isProComponentsSupported() && hasComponents;
|
|
950
|
+
const isOutdated = isProOutdatedForComponents();
|
|
865
951
|
useFullHeightPanel();
|
|
866
|
-
return /* @__PURE__ */
|
|
952
|
+
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
953
|
};
|
|
868
954
|
var Components = () => {
|
|
869
|
-
return /* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */ React10.createElement(ThemeProvider, null, /* @__PURE__ */ React10.createElement(SearchProvider, { localStorageKey: "elementor-components-search" }, /* @__PURE__ */ React10.createElement(ComponentsContent, null)));
|
|
870
956
|
};
|
|
871
957
|
|
|
872
958
|
// src/components/detach-instance-confirmation-dialog.tsx
|
|
873
|
-
import * as
|
|
959
|
+
import * as React11 from "react";
|
|
874
960
|
import { closeDialog, ConfirmationDialog, openDialog } from "@elementor/editor-ui";
|
|
875
961
|
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
876
|
-
import { __ as
|
|
962
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
877
963
|
function DetachInstanceConfirmationDialog({
|
|
878
964
|
open,
|
|
879
965
|
onClose,
|
|
880
966
|
onConfirm
|
|
881
967
|
}) {
|
|
882
|
-
return /* @__PURE__ */
|
|
968
|
+
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
969
|
"Detaching this instance will break its link to the Component. Changes to the Component will no longer apply. Continue?",
|
|
884
970
|
"elementor"
|
|
885
|
-
))), /* @__PURE__ */
|
|
971
|
+
))), /* @__PURE__ */ React11.createElement(
|
|
886
972
|
ConfirmationDialog.Actions,
|
|
887
973
|
{
|
|
888
974
|
onClose,
|
|
889
975
|
onConfirm,
|
|
890
|
-
confirmLabel:
|
|
976
|
+
confirmLabel: __7("Detach", "elementor"),
|
|
891
977
|
color: "primary"
|
|
892
978
|
}
|
|
893
979
|
));
|
|
@@ -898,59 +984,58 @@ function openDetachConfirmDialog(onConfirm) {
|
|
|
898
984
|
onConfirm();
|
|
899
985
|
};
|
|
900
986
|
openDialog({
|
|
901
|
-
component: /* @__PURE__ */
|
|
987
|
+
component: /* @__PURE__ */ React11.createElement(DetachInstanceConfirmationDialog, { open: true, onClose: closeDialog, onConfirm: handleConfirm })
|
|
902
988
|
});
|
|
903
989
|
}
|
|
904
990
|
|
|
905
991
|
// src/components/in-edit-mode.tsx
|
|
906
|
-
import * as
|
|
992
|
+
import * as React12 from "react";
|
|
907
993
|
import { closeDialog as closeDialog2, openDialog as openDialog2 } from "@elementor/editor-ui";
|
|
908
|
-
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
909
|
-
import { Box as
|
|
910
|
-
import { __ as
|
|
994
|
+
import { InfoCircleFilledIcon as InfoCircleFilledIcon2 } from "@elementor/icons";
|
|
995
|
+
import { Box as Box7, Button as Button2, DialogActions, DialogContent, DialogHeader, Icon, Stack as Stack5, Typography as Typography5 } from "@elementor/ui";
|
|
996
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
911
997
|
var openEditModeDialog = (lockedBy) => {
|
|
912
998
|
openDialog2({
|
|
913
|
-
component: /* @__PURE__ */
|
|
999
|
+
component: /* @__PURE__ */ React12.createElement(EditModeDialog, { lockedBy })
|
|
914
1000
|
});
|
|
915
1001
|
};
|
|
916
1002
|
var EditModeDialog = ({ lockedBy }) => {
|
|
917
|
-
const content =
|
|
918
|
-
return /* @__PURE__ */
|
|
1003
|
+
const content = __8("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
1004
|
+
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
1005
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
920
1006
|
"elementor"
|
|
921
|
-
)), /* @__PURE__ */
|
|
1007
|
+
)), /* @__PURE__ */ React12.createElement(DialogActions, null, /* @__PURE__ */ React12.createElement(Button2, { color: "secondary", variant: "contained", onClick: closeDialog2 }, __8("Close", "elementor"))))));
|
|
922
1008
|
};
|
|
923
1009
|
|
|
924
1010
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
925
|
-
import * as
|
|
1011
|
+
import * as React22 from "react";
|
|
926
1012
|
import { PencilIcon as PencilIcon2 } from "@elementor/icons";
|
|
927
|
-
import { Box as
|
|
928
|
-
import {
|
|
929
|
-
import { __ as __10 } from "@wordpress/i18n";
|
|
1013
|
+
import { Box as Box10, Stack as Stack11 } from "@elementor/ui";
|
|
1014
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
930
1015
|
|
|
931
1016
|
// src/provider/component-instance-context.tsx
|
|
932
|
-
import * as
|
|
1017
|
+
import * as React13 from "react";
|
|
933
1018
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
934
1019
|
var ComponentInstanceContext = createContext2(null);
|
|
935
1020
|
function ComponentInstanceProvider({ children, ...props }) {
|
|
936
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ React13.createElement(ComponentInstanceContext.Provider, { value: props }, children);
|
|
937
1022
|
}
|
|
938
1023
|
var useComponentId = () => useContext2(ComponentInstanceContext)?.componentId;
|
|
939
1024
|
var useComponentInstanceOverrides = () => useContext2(ComponentInstanceContext)?.overrides;
|
|
940
1025
|
var useComponentOverridableProps = () => useContext2(ComponentInstanceContext)?.overridableProps;
|
|
941
1026
|
|
|
942
1027
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
943
|
-
import * as
|
|
1028
|
+
import * as React15 from "react";
|
|
944
1029
|
import { useState } from "react";
|
|
945
1030
|
import { notify } from "@elementor/editor-notifications";
|
|
946
1031
|
import { DetachIcon } from "@elementor/icons";
|
|
947
|
-
import { __ as
|
|
1032
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
948
1033
|
|
|
949
1034
|
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
950
1035
|
import { getContainer, replaceElement } from "@elementor/editor-elements";
|
|
951
1036
|
import { undoable } from "@elementor/editor-v1-adapters";
|
|
952
1037
|
import { __dispatch as dispatch2, __getState as getState3 } from "@elementor/store";
|
|
953
|
-
import { __ as
|
|
1038
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
954
1039
|
|
|
955
1040
|
// src/prop-types/component-instance-overrides-prop-type.ts
|
|
956
1041
|
import { createPropUtils as createPropUtils3 } from "@elementor/editor-props";
|
|
@@ -1299,8 +1384,8 @@ async function detachComponentInstance({
|
|
|
1299
1384
|
}
|
|
1300
1385
|
},
|
|
1301
1386
|
{
|
|
1302
|
-
title:
|
|
1303
|
-
subtitle:
|
|
1387
|
+
title: __9("Detach from Component", "elementor"),
|
|
1388
|
+
subtitle: __9("Instance detached", "elementor")
|
|
1304
1389
|
}
|
|
1305
1390
|
);
|
|
1306
1391
|
return undoableDetach();
|
|
@@ -1315,16 +1400,16 @@ function extractInstanceOverrides(instanceContainer) {
|
|
|
1315
1400
|
}
|
|
1316
1401
|
|
|
1317
1402
|
// src/components/instance-editing-panel/instance-panel-header.tsx
|
|
1318
|
-
import * as
|
|
1403
|
+
import * as React14 from "react";
|
|
1319
1404
|
import { PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
1320
1405
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
1321
1406
|
import { ComponentsIcon as ComponentsIcon3 } from "@elementor/icons";
|
|
1322
1407
|
import { IconButton, Stack as Stack6, Tooltip } from "@elementor/ui";
|
|
1323
1408
|
function InstancePanelHeader({ componentName, actions }) {
|
|
1324
|
-
return /* @__PURE__ */
|
|
1409
|
+
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
1410
|
}
|
|
1326
1411
|
function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 }) {
|
|
1327
|
-
return /* @__PURE__ */
|
|
1412
|
+
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
1413
|
}
|
|
1329
1414
|
|
|
1330
1415
|
// src/components/instance-editing-panel/detach-action.tsx
|
|
@@ -1344,7 +1429,7 @@ var DetachAction = ({
|
|
|
1344
1429
|
} catch {
|
|
1345
1430
|
notify({
|
|
1346
1431
|
type: "error",
|
|
1347
|
-
message:
|
|
1432
|
+
message: __10("Failed to detach component instance.", "elementor"),
|
|
1348
1433
|
id: "detach-component-instance-failed"
|
|
1349
1434
|
});
|
|
1350
1435
|
}
|
|
@@ -1355,8 +1440,8 @@ var DetachAction = ({
|
|
|
1355
1440
|
const handleDetachClick = () => {
|
|
1356
1441
|
setIsDetachDialogOpen(true);
|
|
1357
1442
|
};
|
|
1358
|
-
const detachLabel =
|
|
1359
|
-
return /* @__PURE__ */
|
|
1443
|
+
const detachLabel = __10("Detach from Component", "elementor");
|
|
1444
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(EditComponentAction, { label: detachLabel, icon: DetachIcon, onClick: handleDetachClick }), /* @__PURE__ */ React15.createElement(
|
|
1360
1445
|
DetachInstanceConfirmationDialog,
|
|
1361
1446
|
{
|
|
1362
1447
|
open: isDetachDialogOpen,
|
|
@@ -1381,20 +1466,20 @@ function getDetachTrackingInfo() {
|
|
|
1381
1466
|
}
|
|
1382
1467
|
|
|
1383
1468
|
// src/components/instance-editing-panel/empty-state.tsx
|
|
1384
|
-
import * as
|
|
1469
|
+
import * as React16 from "react";
|
|
1385
1470
|
import { ComponentPropListIcon, PencilIcon } from "@elementor/icons";
|
|
1386
|
-
import { Button as Button3, Stack as Stack7, Typography as
|
|
1387
|
-
import { __ as
|
|
1471
|
+
import { Button as Button3, Stack as Stack7, Typography as Typography6 } from "@elementor/ui";
|
|
1472
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1388
1473
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
1389
1474
|
const { canEdit } = useComponentsPermissions();
|
|
1390
|
-
const message = canEdit ?
|
|
1475
|
+
const message = canEdit ? __11(
|
|
1391
1476
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
1392
1477
|
"elementor"
|
|
1393
|
-
) :
|
|
1478
|
+
) : __11(
|
|
1394
1479
|
"With your current role, you cannot edit this component. Contact an administrator to add properties.",
|
|
1395
1480
|
"elementor"
|
|
1396
1481
|
);
|
|
1397
|
-
return /* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1398
1483
|
Stack7,
|
|
1399
1484
|
{
|
|
1400
1485
|
alignItems: "center",
|
|
@@ -1404,10 +1489,10 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1404
1489
|
sx: { p: 2.5, pt: 8, pb: 5.5, mt: 1 },
|
|
1405
1490
|
gap: 1.5
|
|
1406
1491
|
},
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
canEdit && /* @__PURE__ */
|
|
1492
|
+
/* @__PURE__ */ React16.createElement(ComponentPropListIcon, { fontSize: "large" }),
|
|
1493
|
+
/* @__PURE__ */ React16.createElement(Typography6, { align: "center", variant: "subtitle2" }, __11("No properties yet", "elementor")),
|
|
1494
|
+
/* @__PURE__ */ React16.createElement(Typography6, { align: "center", variant: "caption", maxWidth: "170px" }, message),
|
|
1495
|
+
canEdit && /* @__PURE__ */ React16.createElement(
|
|
1411
1496
|
Button3,
|
|
1412
1497
|
{
|
|
1413
1498
|
variant: "outlined",
|
|
@@ -1417,28 +1502,28 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
1417
1502
|
disabled: !onEditComponent,
|
|
1418
1503
|
onClick: onEditComponent
|
|
1419
1504
|
},
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
|
|
1505
|
+
/* @__PURE__ */ React16.createElement(PencilIcon, { fontSize: "small" }),
|
|
1506
|
+
__11("Edit component", "elementor")
|
|
1422
1507
|
)
|
|
1423
1508
|
);
|
|
1424
1509
|
};
|
|
1425
1510
|
|
|
1426
1511
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
1427
|
-
import * as
|
|
1512
|
+
import * as React21 from "react";
|
|
1428
1513
|
import { ControlAdornmentsProvider } from "@elementor/editor-controls";
|
|
1429
1514
|
import { getFieldIndicators } from "@elementor/editor-editing-panel";
|
|
1430
1515
|
import { PanelBody } from "@elementor/editor-panels";
|
|
1431
|
-
import { Divider as Divider2, Stack as
|
|
1516
|
+
import { Divider as Divider2, Stack as Stack10 } from "@elementor/ui";
|
|
1432
1517
|
|
|
1433
1518
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
1434
|
-
import * as
|
|
1519
|
+
import * as React20 from "react";
|
|
1435
1520
|
import { useId } from "react";
|
|
1436
1521
|
import { useStateByElement } from "@elementor/editor-editing-panel";
|
|
1437
1522
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
1438
|
-
import { Box as
|
|
1523
|
+
import { Box as Box9, Collapse, ListItemButton as ListItemButton2, ListItemText, Stack as Stack9 } from "@elementor/ui";
|
|
1439
1524
|
|
|
1440
1525
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1441
|
-
import * as
|
|
1526
|
+
import * as React19 from "react";
|
|
1442
1527
|
import {
|
|
1443
1528
|
ControlReplacementsProvider,
|
|
1444
1529
|
getControlReplacements,
|
|
@@ -1449,6 +1534,7 @@ import {
|
|
|
1449
1534
|
import {
|
|
1450
1535
|
BaseControl,
|
|
1451
1536
|
controlsRegistry,
|
|
1537
|
+
ControlTypeContainer,
|
|
1452
1538
|
createTopLevelObjectType,
|
|
1453
1539
|
ElementProvider,
|
|
1454
1540
|
isDynamicPropValue,
|
|
@@ -1456,7 +1542,7 @@ import {
|
|
|
1456
1542
|
useElement
|
|
1457
1543
|
} from "@elementor/editor-editing-panel";
|
|
1458
1544
|
import { getElementSettings, getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
1459
|
-
import {
|
|
1545
|
+
import { Box as Box8 } from "@elementor/ui";
|
|
1460
1546
|
|
|
1461
1547
|
// src/hooks/use-controls-by-widget-type.ts
|
|
1462
1548
|
import { getElementType } from "@elementor/editor-elements";
|
|
@@ -1490,11 +1576,11 @@ function getControlsByBind(controls) {
|
|
|
1490
1576
|
}
|
|
1491
1577
|
|
|
1492
1578
|
// src/provider/overridable-prop-context.tsx
|
|
1493
|
-
import * as
|
|
1579
|
+
import * as React17 from "react";
|
|
1494
1580
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
1495
1581
|
var OverridablePropContext = createContext3(null);
|
|
1496
1582
|
function OverridablePropProvider({ children, ...props }) {
|
|
1497
|
-
return /* @__PURE__ */
|
|
1583
|
+
return /* @__PURE__ */ React17.createElement(OverridablePropContext.Provider, { value: props }, children);
|
|
1498
1584
|
}
|
|
1499
1585
|
var useOverridablePropValue = () => useContext3(OverridablePropContext)?.value;
|
|
1500
1586
|
var useComponentInstanceElement = () => useContext3(OverridablePropContext)?.componentInstanceElement;
|
|
@@ -1726,11 +1812,11 @@ function extractInnerOverrideInfo(override) {
|
|
|
1726
1812
|
}
|
|
1727
1813
|
|
|
1728
1814
|
// src/components/control-label.tsx
|
|
1729
|
-
import * as
|
|
1815
|
+
import * as React18 from "react";
|
|
1730
1816
|
import { ControlAdornments, ControlFormLabel } from "@elementor/editor-controls";
|
|
1731
1817
|
import { Stack as Stack8 } from "@elementor/ui";
|
|
1732
1818
|
var ControlLabel = ({ children, ...props }) => {
|
|
1733
|
-
return /* @__PURE__ */
|
|
1819
|
+
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
1820
|
};
|
|
1735
1821
|
|
|
1736
1822
|
// src/components/errors.ts
|
|
@@ -1832,6 +1918,19 @@ function hasValue(value) {
|
|
|
1832
1918
|
return value !== null && value !== void 0;
|
|
1833
1919
|
}
|
|
1834
1920
|
|
|
1921
|
+
// src/components/instance-editing-panel/utils/correct-exposed-empty-override.ts
|
|
1922
|
+
function correctExposedEmptyOverride(newPropValue, matchingOverride) {
|
|
1923
|
+
const newOverridableValue = componentOverridablePropTypeUtil.extract(newPropValue);
|
|
1924
|
+
const isExposingEmptyOverride = newOverridableValue && matchingOverride === null;
|
|
1925
|
+
if (!isExposingEmptyOverride) {
|
|
1926
|
+
return newPropValue;
|
|
1927
|
+
}
|
|
1928
|
+
return componentOverridablePropTypeUtil.create({
|
|
1929
|
+
override_key: newOverridableValue.override_key,
|
|
1930
|
+
origin_value: null
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1835
1934
|
// src/components/instance-editing-panel/override-prop-control.tsx
|
|
1836
1935
|
function OverridePropControl({ overrideKey }) {
|
|
1837
1936
|
const overridableProps = useComponentOverridableProps();
|
|
@@ -1839,7 +1938,7 @@ function OverridePropControl({ overrideKey }) {
|
|
|
1839
1938
|
if (!overridableProp) {
|
|
1840
1939
|
return null;
|
|
1841
1940
|
}
|
|
1842
|
-
return /* @__PURE__ */
|
|
1941
|
+
return /* @__PURE__ */ React19.createElement(SettingsField, { bind: "component_instance", propDisplayName: overridableProp.label }, /* @__PURE__ */ React19.createElement(OverrideControl, { overridableProp }));
|
|
1843
1942
|
}
|
|
1844
1943
|
function OverrideControl({ overridableProp }) {
|
|
1845
1944
|
const componentInstanceElement = useElement();
|
|
@@ -1877,11 +1976,12 @@ function OverrideControl({ overridableProp }) {
|
|
|
1877
1976
|
});
|
|
1878
1977
|
return;
|
|
1879
1978
|
}
|
|
1880
|
-
|
|
1979
|
+
let newPropValue = getTempNewValueForDynamicProp(
|
|
1881
1980
|
propType,
|
|
1882
1981
|
propValue,
|
|
1883
1982
|
newValue[overridableProp.overrideKey]
|
|
1884
1983
|
);
|
|
1984
|
+
newPropValue = correctExposedEmptyOverride(newPropValue, matchingOverride);
|
|
1885
1985
|
const newOverrideValue = createOverrideValue({
|
|
1886
1986
|
matchingOverride,
|
|
1887
1987
|
overrideKey: overridableProp.overrideKey,
|
|
@@ -1933,13 +2033,13 @@ function OverrideControl({ overridableProp }) {
|
|
|
1933
2033
|
[overridableProp.overrideKey]: propType
|
|
1934
2034
|
}
|
|
1935
2035
|
});
|
|
1936
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1937
2037
|
OverridablePropProvider,
|
|
1938
2038
|
{
|
|
1939
2039
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
1940
2040
|
componentInstanceElement
|
|
1941
2041
|
},
|
|
1942
|
-
/* @__PURE__ */
|
|
2042
|
+
/* @__PURE__ */ React19.createElement(ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React19.createElement(SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React19.createElement(
|
|
1943
2043
|
PropProvider,
|
|
1944
2044
|
{
|
|
1945
2045
|
propType: propTypeSchema,
|
|
@@ -1949,7 +2049,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1949
2049
|
return false;
|
|
1950
2050
|
}
|
|
1951
2051
|
},
|
|
1952
|
-
/* @__PURE__ */
|
|
2052
|
+
/* @__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
2053
|
)))
|
|
1954
2054
|
);
|
|
1955
2055
|
}
|
|
@@ -2008,7 +2108,7 @@ function getControlParams(controls, originPropFields, label) {
|
|
|
2008
2108
|
}
|
|
2009
2109
|
function OriginalControl({ control, controlProps }) {
|
|
2010
2110
|
const { value } = control;
|
|
2011
|
-
return /* @__PURE__ */
|
|
2111
|
+
return /* @__PURE__ */ React19.createElement(BaseControl, { type: value.type, props: controlProps });
|
|
2012
2112
|
}
|
|
2013
2113
|
function getControlLayout(control) {
|
|
2014
2114
|
return control.value.meta?.layout || controlsRegistry.getLayout(control.value.type);
|
|
@@ -2043,7 +2143,7 @@ function OverridePropsGroup({ group }) {
|
|
|
2043
2143
|
const labelId = `label-${id}`;
|
|
2044
2144
|
const contentId = `content-${id}`;
|
|
2045
2145
|
const title = group.label;
|
|
2046
|
-
return /* @__PURE__ */
|
|
2146
|
+
return /* @__PURE__ */ React20.createElement(Box9, { "aria-label": `${title} section` }, /* @__PURE__ */ React20.createElement(
|
|
2047
2147
|
ListItemButton2,
|
|
2048
2148
|
{
|
|
2049
2149
|
id: labelId,
|
|
@@ -2053,7 +2153,7 @@ function OverridePropsGroup({ group }) {
|
|
|
2053
2153
|
p: 0,
|
|
2054
2154
|
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2055
2155
|
},
|
|
2056
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ React20.createElement(Stack9, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React20.createElement(
|
|
2057
2157
|
ListItemText,
|
|
2058
2158
|
{
|
|
2059
2159
|
secondary: title,
|
|
@@ -2061,13 +2161,13 @@ function OverridePropsGroup({ group }) {
|
|
|
2061
2161
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
2062
2162
|
}
|
|
2063
2163
|
)),
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
), /* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ React20.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
2165
|
+
), /* @__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
2166
|
}
|
|
2067
2167
|
|
|
2068
2168
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
2069
2169
|
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
2070
|
-
return /* @__PURE__ */
|
|
2170
|
+
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
2171
|
}
|
|
2072
2172
|
|
|
2073
2173
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -2167,42 +2267,50 @@ function useComponentInstanceSettings() {
|
|
|
2167
2267
|
}
|
|
2168
2268
|
|
|
2169
2269
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
2170
|
-
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
2270
|
+
var EDIT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-footer/";
|
|
2171
2271
|
function InstanceEditingPanel() {
|
|
2172
2272
|
const { canEdit } = useComponentsPermissions();
|
|
2173
2273
|
const data = useInstancePanelData();
|
|
2174
|
-
const hasPro = hasProInstalled3();
|
|
2175
2274
|
if (!data) {
|
|
2176
2275
|
return null;
|
|
2177
2276
|
}
|
|
2178
2277
|
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
2179
|
-
const panelTitle =
|
|
2180
|
-
const actions = /* @__PURE__ */
|
|
2181
|
-
return /* @__PURE__ */
|
|
2278
|
+
const panelTitle = __12("Edit %s", "elementor").replace("%s", component.name);
|
|
2279
|
+
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 }));
|
|
2280
|
+
return /* @__PURE__ */ React22.createElement(Box10, { "data-testid": "instance-editing-panel", sx: { display: "flex", flexDirection: "column", height: "100%" } }, /* @__PURE__ */ React22.createElement(
|
|
2182
2281
|
ComponentInstanceProvider,
|
|
2183
2282
|
{
|
|
2184
2283
|
componentId,
|
|
2185
2284
|
overrides,
|
|
2186
2285
|
overridableProps
|
|
2187
2286
|
},
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
2287
|
+
/* @__PURE__ */ React22.createElement(InstancePanelHeader, { componentName: component.name, actions }),
|
|
2288
|
+
/* @__PURE__ */ React22.createElement(
|
|
2190
2289
|
InstancePanelBody,
|
|
2191
2290
|
{
|
|
2192
2291
|
groups,
|
|
2193
2292
|
isEmpty,
|
|
2194
|
-
emptyState: /* @__PURE__ */
|
|
2293
|
+
emptyState: /* @__PURE__ */ React22.createElement(EmptyState2, null),
|
|
2195
2294
|
componentInstanceId
|
|
2196
2295
|
}
|
|
2197
2296
|
)
|
|
2198
|
-
), !
|
|
2297
|
+
), !isProComponentsSupported() && (isProOutdatedForComponents() ? /* @__PURE__ */ React22.createElement(
|
|
2298
|
+
ComponentsUpdateAlert,
|
|
2299
|
+
{
|
|
2300
|
+
title: __12("Edit Component", "elementor"),
|
|
2301
|
+
description: __12(
|
|
2302
|
+
"To edit components, update Elementor Pro to the latest version.",
|
|
2303
|
+
"elementor"
|
|
2304
|
+
)
|
|
2305
|
+
}
|
|
2306
|
+
) : /* @__PURE__ */ React22.createElement(
|
|
2199
2307
|
ComponentsUpgradeAlert,
|
|
2200
2308
|
{
|
|
2201
|
-
title:
|
|
2202
|
-
description:
|
|
2309
|
+
title: __12("Edit components", "elementor"),
|
|
2310
|
+
description: __12("Editing components requires an active Pro subscription.", "elementor"),
|
|
2203
2311
|
upgradeUrl: EDIT_UPGRADE_URL
|
|
2204
2312
|
}
|
|
2205
|
-
));
|
|
2313
|
+
)));
|
|
2206
2314
|
}
|
|
2207
2315
|
|
|
2208
2316
|
// src/components/load-template-components.tsx
|
|
@@ -2342,8 +2450,8 @@ import {
|
|
|
2342
2450
|
import { getCurrentDocument } from "@elementor/editor-documents";
|
|
2343
2451
|
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2344
2452
|
import { __getState as getState8 } from "@elementor/store";
|
|
2345
|
-
import { hasProInstalled as
|
|
2346
|
-
import { __ as
|
|
2453
|
+
import { hasProInstalled as hasProInstalled2 } from "@elementor/utils";
|
|
2454
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2347
2455
|
|
|
2348
2456
|
// src/utils/format-component-elements-id.ts
|
|
2349
2457
|
import { hashString } from "@elementor/utils";
|
|
@@ -2415,21 +2523,43 @@ function buildUniqueSelector(element) {
|
|
|
2415
2523
|
|
|
2416
2524
|
// src/create-component-type.ts
|
|
2417
2525
|
var COMPONENT_WIDGET_TYPE2 = "e-component";
|
|
2418
|
-
var
|
|
2526
|
+
var EDIT_COMPONENT_DB_CLICK_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-canvas-double-click/";
|
|
2527
|
+
var EDIT_COMPONENT_CONTEXT_MENU_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-edit-context-menu/";
|
|
2528
|
+
var UPDATE_PLUGINS_URL3 = "/wp-admin/plugins.php";
|
|
2419
2529
|
var COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID = "component-edit-upgrade";
|
|
2530
|
+
var COMPONENT_EDIT_UPDATE_NOTIFICATION_ID = "component-edit-update";
|
|
2531
|
+
var COMPONENT_EDIT_UPGRADE_AUTO_HIDE_DURATION = 2e3;
|
|
2420
2532
|
function notifyComponentEditUpgrade() {
|
|
2421
2533
|
notify2({
|
|
2422
2534
|
type: "promotion",
|
|
2423
2535
|
id: COMPONENT_EDIT_UPGRADE_NOTIFICATION_ID,
|
|
2424
|
-
message:
|
|
2536
|
+
message: __13("Editing components requires an active Pro subscription.", "elementor"),
|
|
2537
|
+
autoHideDuration: COMPONENT_EDIT_UPGRADE_AUTO_HIDE_DURATION,
|
|
2425
2538
|
additionalActionProps: [
|
|
2426
2539
|
{
|
|
2427
2540
|
size: "small",
|
|
2428
2541
|
variant: "contained",
|
|
2429
2542
|
color: "promotion",
|
|
2430
|
-
href:
|
|
2543
|
+
href: EDIT_COMPONENT_DB_CLICK_UPGRADE_URL,
|
|
2431
2544
|
target: "_blank",
|
|
2432
|
-
children:
|
|
2545
|
+
children: __13("Upgrade Now", "elementor")
|
|
2546
|
+
}
|
|
2547
|
+
]
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
function notifyComponentEditUpdate() {
|
|
2551
|
+
notify2({
|
|
2552
|
+
type: "info",
|
|
2553
|
+
id: COMPONENT_EDIT_UPDATE_NOTIFICATION_ID,
|
|
2554
|
+
message: __13("To edit components, update Elementor Pro to the latest version.", "elementor"),
|
|
2555
|
+
additionalActionProps: [
|
|
2556
|
+
{
|
|
2557
|
+
size: "small",
|
|
2558
|
+
variant: "contained",
|
|
2559
|
+
color: "info",
|
|
2560
|
+
href: UPDATE_PLUGINS_URL3,
|
|
2561
|
+
target: "_blank",
|
|
2562
|
+
children: __13("Update Now", "elementor")
|
|
2433
2563
|
}
|
|
2434
2564
|
]
|
|
2435
2565
|
});
|
|
@@ -2542,21 +2672,23 @@ function createComponentView(options) {
|
|
|
2542
2672
|
}
|
|
2543
2673
|
_getContextMenuConfig() {
|
|
2544
2674
|
const isAdministrator = isUserAdministrator();
|
|
2545
|
-
const hasPro =
|
|
2675
|
+
const hasPro = hasProInstalled2();
|
|
2676
|
+
const isOutdated = isProOutdatedForComponents();
|
|
2677
|
+
const showPromoBadge = !hasPro && !isOutdated;
|
|
2546
2678
|
const badgeClass = "elementor-context-menu-list__item__shortcut__promotion-badge";
|
|
2547
|
-
const proBadge = `<a href="${
|
|
2679
|
+
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
2680
|
const editComponentAction = {
|
|
2549
2681
|
name: "edit component",
|
|
2550
2682
|
icon: "eicon-edit",
|
|
2551
|
-
title: () =>
|
|
2552
|
-
|
|
2553
|
-
isEnabled: () =>
|
|
2683
|
+
title: () => __13("Edit Component", "elementor"),
|
|
2684
|
+
...showPromoBadge && { shortcut: proBadge, hasShortcutAction: true },
|
|
2685
|
+
isEnabled: () => isProComponentsSupported() || isOutdated,
|
|
2554
2686
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
2555
2687
|
};
|
|
2556
2688
|
const detachInstanceAction = {
|
|
2557
2689
|
name: "detach instance",
|
|
2558
2690
|
icon: "eicon-chain-broken",
|
|
2559
|
-
title: () =>
|
|
2691
|
+
title: () => __13("Detach from Component", "elementor"),
|
|
2560
2692
|
isEnabled: () => true,
|
|
2561
2693
|
callback: (_, eventData) => this.detachInstance(eventData)
|
|
2562
2694
|
};
|
|
@@ -2583,8 +2715,11 @@ function createComponentView(options) {
|
|
|
2583
2715
|
}
|
|
2584
2716
|
}
|
|
2585
2717
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
2586
|
-
|
|
2587
|
-
|
|
2718
|
+
if (isProOutdatedForComponents()) {
|
|
2719
|
+
notifyComponentEditUpdate();
|
|
2720
|
+
return;
|
|
2721
|
+
}
|
|
2722
|
+
if (!isProComponentsSupported() || this.isComponentCurrentlyEdited()) {
|
|
2588
2723
|
return;
|
|
2589
2724
|
}
|
|
2590
2725
|
this.switchDocument();
|
|
@@ -2615,7 +2750,7 @@ function createComponentView(options) {
|
|
|
2615
2750
|
} catch {
|
|
2616
2751
|
notify2({
|
|
2617
2752
|
type: "error",
|
|
2618
|
-
message:
|
|
2753
|
+
message: __13("Failed to detach component instance.", "elementor"),
|
|
2619
2754
|
id: "detach-component-instance-failed"
|
|
2620
2755
|
});
|
|
2621
2756
|
}
|
|
@@ -2627,7 +2762,11 @@ function createComponentView(options) {
|
|
|
2627
2762
|
if (!isUserAdministrator()) {
|
|
2628
2763
|
return;
|
|
2629
2764
|
}
|
|
2630
|
-
if (
|
|
2765
|
+
if (isProOutdatedForComponents()) {
|
|
2766
|
+
notifyComponentEditUpdate();
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
if (!hasProInstalled2()) {
|
|
2631
2770
|
notifyComponentEditUpgrade();
|
|
2632
2771
|
return;
|
|
2633
2772
|
}
|
|
@@ -2728,11 +2867,11 @@ import { getAllDescendants } from "@elementor/editor-elements";
|
|
|
2728
2867
|
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
2729
2868
|
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
2730
2869
|
import { __getState as getState9 } from "@elementor/store";
|
|
2731
|
-
import { __ as
|
|
2870
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2732
2871
|
var COMPONENT_TYPE = "e-component";
|
|
2733
2872
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
2734
2873
|
type: "default",
|
|
2735
|
-
message:
|
|
2874
|
+
message: __14("Can't add this component - components that contain each other can't be nested.", "elementor"),
|
|
2736
2875
|
id: "circular-component-nesting-blocked"
|
|
2737
2876
|
};
|
|
2738
2877
|
function initCircularNestingPrevention() {
|
|
@@ -2883,9 +3022,9 @@ var componentsStylesProvider = createStylesProvider({
|
|
|
2883
3022
|
import { invalidateDocumentData as invalidateDocumentData2, isDocumentDirty as isDocumentDirty2 } from "@elementor/editor-documents";
|
|
2884
3023
|
import { notify as notify4 } from "@elementor/editor-notifications";
|
|
2885
3024
|
import { AxiosError } from "@elementor/http-client";
|
|
2886
|
-
import { __ as
|
|
3025
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2887
3026
|
var INSUFFICIENT_PERMISSIONS_ERROR_CODE = "insufficient_permissions";
|
|
2888
|
-
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-
|
|
3027
|
+
var PUBLISH_UPGRADE_URL = "https://go.elementor.com/go-pro-components-Instance-draft-failure/";
|
|
2889
3028
|
var PUBLISH_UPGRADE_NOTIFICATION_ID = "component-publish-upgrade";
|
|
2890
3029
|
async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
2891
3030
|
if (status !== "publish") {
|
|
@@ -2914,7 +3053,7 @@ function notifyPublishUpgrade() {
|
|
|
2914
3053
|
notify4({
|
|
2915
3054
|
type: "promotion",
|
|
2916
3055
|
id: PUBLISH_UPGRADE_NOTIFICATION_ID,
|
|
2917
|
-
message:
|
|
3056
|
+
message: __15(
|
|
2918
3057
|
"You have unpublished component on this page. You need a pro version to publish it.",
|
|
2919
3058
|
"elementor"
|
|
2920
3059
|
),
|
|
@@ -2925,7 +3064,7 @@ function notifyPublishUpgrade() {
|
|
|
2925
3064
|
color: "promotion",
|
|
2926
3065
|
href: PUBLISH_UPGRADE_URL,
|
|
2927
3066
|
target: "_blank",
|
|
2928
|
-
children:
|
|
3067
|
+
children: __15("Upgrade Now", "elementor")
|
|
2929
3068
|
}
|
|
2930
3069
|
]
|
|
2931
3070
|
});
|
|
@@ -2967,7 +3106,7 @@ function init() {
|
|
|
2967
3106
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
2968
3107
|
injectTab({
|
|
2969
3108
|
id: "components",
|
|
2970
|
-
label:
|
|
3109
|
+
label: __16("Components", "elementor"),
|
|
2971
3110
|
component: Components,
|
|
2972
3111
|
position: 1
|
|
2973
3112
|
});
|