@elementor/editor-controls 0.27.0 → 0.28.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/CHANGELOG.md +14 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/controls/image-control.tsx +19 -14
- package/src/controls/link-control.tsx +17 -6
package/dist/index.mjs
CHANGED
|
@@ -381,11 +381,11 @@ var SelectControl = createControl(({ options, onChange }) => {
|
|
|
381
381
|
|
|
382
382
|
// src/controls/image-control.tsx
|
|
383
383
|
var ImageControl = createControl(
|
|
384
|
-
({ sizes, resolutionLabel = __2("Image resolution", "elementor") }) => {
|
|
384
|
+
({ sizes, resolutionLabel = __2("Image resolution", "elementor"), showMode = "all" }) => {
|
|
385
385
|
const propContext = useBoundProp(imagePropTypeUtil);
|
|
386
386
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
387
387
|
const mediaTypes = allowSvgUpload ? ["image", "svg"] : ["image"];
|
|
388
|
-
return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(Stack2, { gap: 1.5 }, /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", __2("Image", "elementor"), " "), /* @__PURE__ */ React10.createElement(ImageMediaControl, { mediaTypes })), /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(Grid, { container: true, gap: 1.5, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React10.createElement(SelectControl, { options: sizes }))))));
|
|
388
|
+
return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(Stack2, { gap: 1.5 }, ["all", "media"].includes(showMode) ? /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", __2("Image", "elementor"), " "), /* @__PURE__ */ React10.createElement(ImageMediaControl, { mediaTypes })) : null, ["all", "sizes"].includes(showMode) ? /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(Grid, { container: true, gap: 1.5, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlFormLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 6, sx: { overflow: "hidden" } }, /* @__PURE__ */ React10.createElement(SelectControl, { options: sizes })))) : null));
|
|
389
389
|
}
|
|
390
390
|
);
|
|
391
391
|
|
|
@@ -1724,7 +1724,7 @@ import { InfoTipCard } from "@elementor/editor-ui";
|
|
|
1724
1724
|
import { httpService as httpService2 } from "@elementor/http";
|
|
1725
1725
|
import { AlertTriangleIcon, MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
1726
1726
|
import { useSessionStorage } from "@elementor/session";
|
|
1727
|
-
import { Box as Box4, Collapse,
|
|
1727
|
+
import { Box as Box4, Collapse, Grid as Grid7, IconButton as IconButton4, Infotip, Stack as Stack10, Switch } from "@elementor/ui";
|
|
1728
1728
|
import { debounce as debounce2 } from "@elementor/utils";
|
|
1729
1729
|
import { __ as __9 } from "@wordpress/i18n";
|
|
1730
1730
|
|
|
@@ -1867,9 +1867,18 @@ var LinkControl = createControl((props) => {
|
|
|
1867
1867
|
if (linkInLinkRestriction.shouldRestrict && !isActive) {
|
|
1868
1868
|
return;
|
|
1869
1869
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1870
|
+
const newState = !isActive;
|
|
1871
|
+
setIsActive(newState);
|
|
1872
|
+
if (!newState && value !== null) {
|
|
1873
|
+
setValue(null);
|
|
1874
|
+
}
|
|
1875
|
+
if (newState && linkSessionValue?.value) {
|
|
1876
|
+
setValue(linkSessionValue.value);
|
|
1877
|
+
}
|
|
1878
|
+
setLinkSessionValue({
|
|
1879
|
+
value: newState ? value : linkSessionValue?.value,
|
|
1880
|
+
meta: { isEnabled: newState }
|
|
1881
|
+
});
|
|
1873
1882
|
};
|
|
1874
1883
|
const onOptionChange = (newValue) => {
|
|
1875
1884
|
const valueToSave = newValue ? {
|
|
@@ -1884,7 +1893,7 @@ var LinkControl = createControl((props) => {
|
|
|
1884
1893
|
const valueToSave = newValue ? {
|
|
1885
1894
|
...value,
|
|
1886
1895
|
destination: urlPropTypeUtil2.create(newValue),
|
|
1887
|
-
label:
|
|
1896
|
+
label: stringPropTypeUtil7.create("")
|
|
1888
1897
|
} : null;
|
|
1889
1898
|
onSaveNewValue(valueToSave);
|
|
1890
1899
|
updateOptions(newValue);
|
|
@@ -1909,7 +1918,7 @@ var LinkControl = createControl((props) => {
|
|
|
1909
1918
|
),
|
|
1910
1919
|
[endpoint]
|
|
1911
1920
|
);
|
|
1912
|
-
return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React34.createElement(Stack10, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(
|
|
1921
|
+
return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React34.createElement(Stack10, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(
|
|
1913
1922
|
Stack10,
|
|
1914
1923
|
{
|
|
1915
1924
|
direction: "row",
|
|
@@ -2088,7 +2097,7 @@ import {
|
|
|
2088
2097
|
DialogContentText,
|
|
2089
2098
|
DialogHeader,
|
|
2090
2099
|
DialogTitle,
|
|
2091
|
-
Divider as
|
|
2100
|
+
Divider as Divider3
|
|
2092
2101
|
} from "@elementor/ui";
|
|
2093
2102
|
import { __ as __11 } from "@wordpress/i18n";
|
|
2094
2103
|
var ADMIN_TITLE_TEXT = __11("Enable Unfiltered Uploads", "elementor");
|
|
@@ -2131,7 +2140,7 @@ var EnableUnfilteredModal = (props) => {
|
|
|
2131
2140
|
const dialogProps = { ...props, isPending, handleEnable, isError, onClose };
|
|
2132
2141
|
return canManageOptions ? /* @__PURE__ */ React36.createElement(AdminDialog, { ...dialogProps }) : /* @__PURE__ */ React36.createElement(NonAdminDialog, { ...dialogProps });
|
|
2133
2142
|
};
|
|
2134
|
-
var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @__PURE__ */ React36.createElement(Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React36.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React36.createElement(DialogTitle, null, ADMIN_TITLE_TEXT)), /* @__PURE__ */ React36.createElement(
|
|
2143
|
+
var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @__PURE__ */ React36.createElement(Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React36.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React36.createElement(DialogTitle, null, ADMIN_TITLE_TEXT)), /* @__PURE__ */ React36.createElement(Divider3, null), /* @__PURE__ */ React36.createElement(DialogContent, null, /* @__PURE__ */ React36.createElement(DialogContentText, null, isError ? /* @__PURE__ */ React36.createElement(React36.Fragment, null, ADMIN_FAILED_CONTENT_TEXT_PT1, " ", /* @__PURE__ */ React36.createElement("br", null), " ", ADMIN_FAILED_CONTENT_TEXT_PT2) : ADMIN_CONTENT_TEXT)), /* @__PURE__ */ React36.createElement(DialogActions, null, /* @__PURE__ */ React36.createElement(Button3, { size: "medium", color: "secondary", onClick: () => onClose(false) }, __11("Cancel", "elementor")), /* @__PURE__ */ React36.createElement(
|
|
2135
2144
|
Button3,
|
|
2136
2145
|
{
|
|
2137
2146
|
size: "medium",
|
|
@@ -2142,7 +2151,7 @@ var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @_
|
|
|
2142
2151
|
},
|
|
2143
2152
|
isPending ? /* @__PURE__ */ React36.createElement(CircularProgress2, { size: 24 }) : __11("Enable", "elementor")
|
|
2144
2153
|
)));
|
|
2145
|
-
var NonAdminDialog = ({ open, onClose }) => /* @__PURE__ */ React36.createElement(Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React36.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React36.createElement(DialogTitle, null, NON_ADMIN_TITLE_TEXT)), /* @__PURE__ */ React36.createElement(
|
|
2154
|
+
var NonAdminDialog = ({ open, onClose }) => /* @__PURE__ */ React36.createElement(Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React36.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React36.createElement(DialogTitle, null, NON_ADMIN_TITLE_TEXT)), /* @__PURE__ */ React36.createElement(Divider3, null), /* @__PURE__ */ React36.createElement(DialogContent, null, /* @__PURE__ */ React36.createElement(DialogContentText, null, NON_ADMIN_CONTENT_TEXT)), /* @__PURE__ */ React36.createElement(DialogActions, null, /* @__PURE__ */ React36.createElement(Button3, { size: "medium", onClick: () => onClose(false), variant: "contained", color: "primary" }, __11("Got it", "elementor"))));
|
|
2146
2155
|
|
|
2147
2156
|
// src/controls/svg-media-control.tsx
|
|
2148
2157
|
var TILE_SIZE = 8;
|