@elementor/editor-components 4.0.0-609 → 4.0.0-621
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 +84 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -20
- 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/utils/is-pro-user.ts +0 -26
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
|
|
@@ -1539,6 +1538,7 @@ import {
|
|
|
1539
1538
|
} from "@elementor/editor-canvas";
|
|
1540
1539
|
import { getCurrentDocument } from "@elementor/editor-documents";
|
|
1541
1540
|
import { __getState as getState5 } from "@elementor/store";
|
|
1541
|
+
import { hasProInstalled } from "@elementor/utils";
|
|
1542
1542
|
import { __ as __7 } from "@wordpress/i18n";
|
|
1543
1543
|
|
|
1544
1544
|
// src/utils/format-component-elements-id.ts
|
|
@@ -1650,6 +1650,7 @@ var onElementDrop = (_args, element) => {
|
|
|
1650
1650
|
|
|
1651
1651
|
// src/create-component-type.ts
|
|
1652
1652
|
var COMPONENT_WIDGET_TYPE = "e-component";
|
|
1653
|
+
var EDIT_COMPONENT_UPGRADE_URL = "https://go.elementor.com/go-pro-components-edit/";
|
|
1653
1654
|
var updateGroups = (groups, config) => {
|
|
1654
1655
|
const disableMap = new Map(Object.entries(config.disable ?? {}));
|
|
1655
1656
|
const addMap = new Map(Object.entries(config.add ?? {}));
|
|
@@ -1758,6 +1759,10 @@ function createComponentView(options) {
|
|
|
1758
1759
|
}
|
|
1759
1760
|
_getContextMenuConfig() {
|
|
1760
1761
|
const isAdministrator = isUserAdministrator();
|
|
1762
|
+
const hasPro = hasProInstalled();
|
|
1763
|
+
const proLabel = __7("PRO", "elementor");
|
|
1764
|
+
const badgeClass = "elementor-context-menu-list__item__shortcut__new-badge";
|
|
1765
|
+
const proBadge = `<a href="${EDIT_COMPONENT_UPGRADE_URL}" target="_blank" onclick="event.stopPropagation()" class="${badgeClass}">${proLabel}</a>`;
|
|
1761
1766
|
const addedGroup = {
|
|
1762
1767
|
general: {
|
|
1763
1768
|
index: 1,
|
|
@@ -1765,7 +1770,8 @@ function createComponentView(options) {
|
|
|
1765
1770
|
name: "edit component",
|
|
1766
1771
|
icon: "eicon-edit",
|
|
1767
1772
|
title: () => __7("Edit Component", "elementor"),
|
|
1768
|
-
|
|
1773
|
+
...!hasPro && { shortcut: proBadge, hasShortcutAction: true },
|
|
1774
|
+
isEnabled: () => hasPro,
|
|
1769
1775
|
callback: (_, eventData) => this.editComponent(eventData)
|
|
1770
1776
|
}
|
|
1771
1777
|
}
|
|
@@ -1786,7 +1792,8 @@ function createComponentView(options) {
|
|
|
1786
1792
|
}
|
|
1787
1793
|
}
|
|
1788
1794
|
editComponent({ trigger, location, secondaryLocation }) {
|
|
1789
|
-
|
|
1795
|
+
const hasPro = hasProInstalled();
|
|
1796
|
+
if (!hasPro || this.isComponentCurrentlyEdited()) {
|
|
1790
1797
|
return;
|
|
1791
1798
|
}
|
|
1792
1799
|
this.switchDocument();
|
|
@@ -1803,8 +1810,7 @@ function createComponentView(options) {
|
|
|
1803
1810
|
}
|
|
1804
1811
|
handleDblClick(e) {
|
|
1805
1812
|
e.stopPropagation();
|
|
1806
|
-
|
|
1807
|
-
if (!isAdministrator) {
|
|
1813
|
+
if (!isUserAdministrator() || !hasProInstalled()) {
|
|
1808
1814
|
return;
|
|
1809
1815
|
}
|
|
1810
1816
|
const { triggers, locations, secondaryLocations } = this.eventsManagerConfig;
|
|
@@ -2118,8 +2124,7 @@ var ComponentIntroduction = ({
|
|
|
2118
2124
|
|
|
2119
2125
|
// src/extended/components/component-properties-panel/component-properties-panel.tsx
|
|
2120
2126
|
import * as React25 from "react";
|
|
2121
|
-
import {
|
|
2122
|
-
import { useSelectedElement as useSelectedElement2 } from "@elementor/editor-elements";
|
|
2127
|
+
import { usePanelActions as useEditingPanelActions } from "@elementor/editor-editing-panel";
|
|
2123
2128
|
import { __createPanel as createPanel, Panel } from "@elementor/editor-panels";
|
|
2124
2129
|
import { ThemeProvider as ThemeProvider2 } from "@elementor/editor-ui";
|
|
2125
2130
|
import { Alert, Box as Box13, ErrorBoundary } from "@elementor/ui";
|
|
@@ -3340,13 +3345,9 @@ var { panel, usePanelActions } = createPanel({
|
|
|
3340
3345
|
component: ComponentPropertiesPanel
|
|
3341
3346
|
});
|
|
3342
3347
|
function ComponentPropertiesPanel() {
|
|
3343
|
-
const { element, elementType } = useSelectedElement2();
|
|
3344
3348
|
const { close: closePanel } = usePanelActions();
|
|
3345
3349
|
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(
|
|
3350
|
+
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
3351
|
ComponentPropertiesPanelContent,
|
|
3351
3352
|
{
|
|
3352
3353
|
onClose: () => {
|
|
@@ -3354,7 +3355,7 @@ function ComponentPropertiesPanel() {
|
|
|
3354
3355
|
openEditingPanel();
|
|
3355
3356
|
}
|
|
3356
3357
|
}
|
|
3357
|
-
))))
|
|
3358
|
+
))));
|
|
3358
3359
|
}
|
|
3359
3360
|
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
3361
|
|