@elementor/editor-components 4.0.0-609 → 4.0.0-619
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 +84 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/instance-editing-panel/override-prop-control.tsx +5 -3
- package/src/components/instance-editing-panel/use-instance-panel-data.ts +5 -11
- package/src/create-component-type.ts +15 -13
- package/src/extended/components/component-properties-panel/component-properties-panel.tsx +9 -17
- package/src/index.ts +1 -0
- package/src/utils/is-pro-user.ts +6 -21
package/dist/index.mjs
CHANGED
|
@@ -807,7 +807,7 @@ import {
|
|
|
807
807
|
SettingsField,
|
|
808
808
|
useElement
|
|
809
809
|
} from "@elementor/editor-editing-panel";
|
|
810
|
-
import { getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
810
|
+
import { getElementSettings, getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
811
811
|
import { Stack as Stack7 } from "@elementor/ui";
|
|
812
812
|
|
|
813
813
|
// src/hooks/use-controls-by-widget-type.ts
|
|
@@ -1239,6 +1239,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1239
1239
|
if (!elementType) {
|
|
1240
1240
|
return null;
|
|
1241
1241
|
}
|
|
1242
|
+
const settings = getElementSettings(elementId, Object.keys(elementType.propsSchema));
|
|
1242
1243
|
const propTypeSchema = createTopLevelObjectType({
|
|
1243
1244
|
schema: {
|
|
1244
1245
|
[overridableProp.overrideKey]: propType
|
|
@@ -1250,7 +1251,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
1250
1251
|
value: componentOverridablePropTypeUtil.extract(matchingOverride) ?? void 0,
|
|
1251
1252
|
componentInstanceElement
|
|
1252
1253
|
},
|
|
1253
|
-
/* @__PURE__ */ React13.createElement(ElementProvider, { element: { id: elementId, type }, elementType }, /* @__PURE__ */ React13.createElement(SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React13.createElement(
|
|
1254
|
+
/* @__PURE__ */ React13.createElement(ElementProvider, { element: { id: elementId, type }, elementType, settings }, /* @__PURE__ */ React13.createElement(SettingsField, { bind: propKey, propDisplayName: overridableProp.label }, /* @__PURE__ */ React13.createElement(
|
|
1254
1255
|
PropProvider,
|
|
1255
1256
|
{
|
|
1256
1257
|
propType: propTypeSchema,
|
|
@@ -1396,7 +1397,6 @@ function EditComponentAction({ label, onClick, disabled = false, icon: Icon2 })
|
|
|
1396
1397
|
|
|
1397
1398
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
1398
1399
|
import { useElement as useElement2 } from "@elementor/editor-editing-panel";
|
|
1399
|
-
import { useElementSetting, useSelectedElement } from "@elementor/editor-elements";
|
|
1400
1400
|
|
|
1401
1401
|
// src/utils/filter-valid-overridable-props.ts
|
|
1402
1402
|
function filterValidOverridableProps(overridableProps, instanceElementId) {
|
|
@@ -1472,11 +1472,11 @@ function useSanitizeOverridableProps(componentId, instanceElementId) {
|
|
|
1472
1472
|
|
|
1473
1473
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
1474
1474
|
function useInstancePanelData() {
|
|
1475
|
-
const settings = useComponentInstanceSettings();
|
|
1475
|
+
const { element, settings } = useComponentInstanceSettings();
|
|
1476
1476
|
const componentId = settings?.component_id?.value;
|
|
1477
1477
|
const overrides = settings?.overrides?.value;
|
|
1478
1478
|
const component = useComponent(componentId ?? null);
|
|
1479
|
-
const componentInstanceId =
|
|
1479
|
+
const componentInstanceId = element?.id;
|
|
1480
1480
|
const overridableProps = useSanitizeOverridableProps(componentId ?? null, componentInstanceId);
|
|
1481
1481
|
if (!componentId || !overridableProps || !component) {
|
|
1482
1482
|
return null;
|
|
@@ -1487,9 +1487,8 @@ function useInstancePanelData() {
|
|
|
1487
1487
|
return { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId };
|
|
1488
1488
|
}
|
|
1489
1489
|
function useComponentInstanceSettings() {
|
|
1490
|
-
const { element } = useElement2();
|
|
1491
|
-
|
|
1492
|
-
return componentInstancePropTypeUtil.extract(settings);
|
|
1490
|
+
const { element, settings } = useElement2();
|
|
1491
|
+
return { element, settings: componentInstancePropTypeUtil.extract(settings.component_instance) };
|
|
1493
1492
|
}
|
|
1494
1493
|
|
|
1495
1494
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
@@ -1557,6 +1556,17 @@ function formatComponentElementsId(elements, path) {
|
|
|
1557
1556
|
});
|
|
1558
1557
|
}
|
|
1559
1558
|
|
|
1559
|
+
// src/utils/is-pro-user.ts
|
|
1560
|
+
function hasProInstalled() {
|
|
1561
|
+
return window.elementor?.helpers?.hasPro?.() ?? false;
|
|
1562
|
+
}
|
|
1563
|
+
function isProActive() {
|
|
1564
|
+
if (!hasProInstalled()) {
|
|
1565
|
+
return false;
|
|
1566
|
+
}
|
|
1567
|
+
return window.elementorPro?.config?.isActive ?? false;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1560
1570
|
// src/utils/switch-to-component.ts
|
|
1561
1571
|
import { invalidateDocumentData, switchToDocument } from "@elementor/editor-documents";
|
|
1562
1572
|
import { getCurrentDocumentContainer, selectElement } from "@elementor/editor-elements";
|
|
@@ -1650,6 +1660,7 @@ var onElementDrop = (_args, element) => {
|
|
|
1650
1660
|
|
|
1651
1661
|
// src/create-component-type.ts
|
|
1652
1662
|
var COMPONENT_WIDGET_TYPE = "e-component";
|
|
1663
|
+
var EDIT_COMPONENT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
1653
1664
|
var updateGroups = (groups, config) => {
|
|
1654
1665
|
const disableMap = new Map(Object.entries(config.disable ?? {}));
|
|
1655
1666
|
const addMap = new Map(Object.entries(config.add ?? {}));
|
|
@@ -1758,6 +1769,10 @@ function createComponentView(options) {
|
|
|
1758
1769
|
}
|
|
1759
1770
|
_getContextMenuConfig() {
|
|
1760
1771
|
const isAdministrator = isUserAdministrator();
|
|
1772
|
+
const hasPro = hasProInstalled();
|
|
1773
|
+
const proLabel = __7("PRO", "elementor");
|
|
1774
|
+
const badgeClass = "elementor-context-menu-list__item__shortcut__new-badge";
|
|
1775
|
+
const proBadge = `<a href="${EDIT_COMPONENT_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}">${proLabel}</a>`;
|
|
1761
1776
|
const addedGroup = {
|
|
1762
1777
|
general: {
|
|
1763
1778
|
index: 1,
|
|
@@ -1765,7 +1780,8 @@ function createComponentView(options) {
|
|
|
1765
1780
|
name: "edit component",
|
|
1766
1781
|
icon: "eicon-edit",
|
|
1767
1782
|
title: () => __7("Edit Component", "elementor"),
|
|
1768
|
-
|
|
1783
|
+
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
1784
|
+
isEnabled: () => hasPro,
|
|
1769
1785
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
1770
1786
|
}
|
|
1771
1787
|
}
|
|
@@ -1786,7 +1802,8 @@ function createComponentView(options) {
|
|
|
1786
1802
|
}
|
|
1787
1803
|
}
|
|
1788
1804
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
1789
|
-
|
|
1805
|
+
const hasPro = hasProInstalled();
|
|
1806
|
+
if (!hasPro || this.isComponentCurrentlyEdited()) {
|
|
1790
1807
|
return;
|
|
1791
1808
|
}
|
|
1792
1809
|
this.switchDocument();
|
|
@@ -1803,8 +1820,7 @@ function createComponentView(options) {
|
|
|
1803
1820
|
}
|
|
1804
1821
|
handleDblClick(e) {
|
|
1805
1822
|
e.stopPropagation();
|
|
1806
|
-
|
|
1807
|
-
if (!isAdministrator) {
|
|
1823
|
+
if (!isUserAdministrator() || !hasProInstalled()) {
|
|
1808
1824
|
return;
|
|
1809
1825
|
}
|
|
1810
1826
|
const { triggers, locations, secondaryLocations } = this.eventsManagerConfig;
|
|
@@ -2118,8 +2134,7 @@ var ComponentIntroduction = ({
|
|
|
2118
2134
|
|
|
2119
2135
|
// src/extended/components/component-properties-panel/component-properties-panel.tsx
|
|
2120
2136
|
import * as React25 from "react";
|
|
2121
|
-
import {
|
|
2122
|
-
import { useSelectedElement as useSelectedElement2 } from "@elementor/editor-elements";
|
|
2137
|
+
import { usePanelActions as useEditingPanelActions } from "@elementor/editor-editing-panel";
|
|
2123
2138
|
import { __createPanel as createPanel, Panel } from "@elementor/editor-panels";
|
|
2124
2139
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
2125
2140
|
import { Alert, Box as Box13, ErrorBoundary } from "@elementor/ui";
|
|
@@ -3340,13 +3355,9 @@ var { panel, usePanelActions } = createPanel({
|
|
|
3340
3355
|
component: ComponentPropertiesPanel
|
|
3341
3356
|
});
|
|
3342
3357
|
function ComponentPropertiesPanel() {
|
|
3343
|
-
const { element, elementType } = useSelectedElement2();
|
|
3344
3358
|
const { close: closePanel } = usePanelActions();
|
|
3345
3359
|
const { open: openEditingPanel } = useEditingPanelActions();
|
|
3346
|
-
|
|
3347
|
-
return null;
|
|
3348
|
-
}
|
|
3349
|
-
return /* @__PURE__ */ React25.createElement(ThemeProvider2, null, /* @__PURE__ */ React25.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React25.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React25.createElement(ElementProvider2, { element, elementType }, /* @__PURE__ */ React25.createElement(Panel, null, /* @__PURE__ */ React25.createElement(
|
|
3360
|
+
return /* @__PURE__ */ React25.createElement(ThemeProvider2, null, /* @__PURE__ */ React25.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React25.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React25.createElement(Panel, null, /* @__PURE__ */ React25.createElement(
|
|
3350
3361
|
ComponentPropertiesPanelContent,
|
|
3351
3362
|
{
|
|
3352
3363
|
onClose: () => {
|
|
@@ -3354,7 +3365,7 @@ function ComponentPropertiesPanel() {
|
|
|
3354
3365
|
openEditingPanel();
|
|
3355
3366
|
}
|
|
3356
3367
|
}
|
|
3357
|
-
))))
|
|
3368
|
+
))));
|
|
3358
3369
|
}
|
|
3359
3370
|
var ErrorBoundaryFallback = () => /* @__PURE__ */ React25.createElement(Box13, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React25.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React25.createElement("strong", null, __17("Something went wrong", "elementor"))));
|
|
3360
3371
|
|
|
@@ -5996,6 +6007,8 @@ function init() {
|
|
|
5996
6007
|
initExtended();
|
|
5997
6008
|
}
|
|
5998
6009
|
export {
|
|
5999
|
-
|
|
6010
|
+
hasProInstalled,
|
|
6011
|
+
init,
|
|
6012
|
+
isProActive
|
|
6000
6013
|
};
|
|
6001
6014
|
//# sourceMappingURL=index.mjs.map
|