@elementor/editor-controls 0.19.0 → 0.20.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 +23 -0
- package/dist/index.js +12 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/src/components/text-field-inner-selection.tsx +4 -3
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx +4 -3
- package/src/controls/equal-unequal-sizes-control.tsx +1 -0
- package/src/controls/font-family-control/font-family-control.tsx +4 -3
- package/src/controls/link-control.tsx +2 -2
- package/src/controls/select-control.tsx +4 -3
- package/src/hooks/use-sync-external-state.tsx +1 -0
- package/src/utils/link-restriction.ts +0 -47
package/dist/index.mjs
CHANGED
|
@@ -285,7 +285,7 @@ function ControlActions({ children }) {
|
|
|
285
285
|
if (items.length === 0) {
|
|
286
286
|
return children;
|
|
287
287
|
}
|
|
288
|
-
const menuItems = items.map(({ MenuItem
|
|
288
|
+
const menuItems = items.map(({ MenuItem, id }) => /* @__PURE__ */ React7.createElement(MenuItem, { key: id }));
|
|
289
289
|
return /* @__PURE__ */ React7.createElement(FloatingBarContainer, null, /* @__PURE__ */ React7.createElement(UnstableFloatingActionBar, { actions: menuItems }, children));
|
|
290
290
|
}
|
|
291
291
|
|
|
@@ -334,7 +334,8 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
|
|
|
334
334
|
// src/controls/select-control.tsx
|
|
335
335
|
import * as React9 from "react";
|
|
336
336
|
import { stringPropTypeUtil } from "@elementor/editor-props";
|
|
337
|
-
import {
|
|
337
|
+
import { MenuListItem } from "@elementor/editor-ui";
|
|
338
|
+
import { Select } from "@elementor/ui";
|
|
338
339
|
var SelectControl = createControl(({ options, onChange }) => {
|
|
339
340
|
const { value, setValue } = useBoundProp(stringPropTypeUtil);
|
|
340
341
|
const handleChange = (event) => {
|
|
@@ -352,7 +353,7 @@ var SelectControl = createControl(({ options, onChange }) => {
|
|
|
352
353
|
onChange: handleChange,
|
|
353
354
|
fullWidth: true
|
|
354
355
|
},
|
|
355
|
-
options.map(({ label, ...props }) => /* @__PURE__ */ React9.createElement(
|
|
356
|
+
options.map(({ label, ...props }) => /* @__PURE__ */ React9.createElement(MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, label))
|
|
356
357
|
));
|
|
357
358
|
});
|
|
358
359
|
|
|
@@ -416,7 +417,8 @@ import { InputAdornment as InputAdornment2 } from "@elementor/ui";
|
|
|
416
417
|
// src/components/text-field-inner-selection.tsx
|
|
417
418
|
import * as React13 from "react";
|
|
418
419
|
import { forwardRef, useId } from "react";
|
|
419
|
-
import {
|
|
420
|
+
import { MenuListItem as MenuListItem2 } from "@elementor/editor-ui";
|
|
421
|
+
import { bindMenu, bindTrigger, Button as Button2, InputAdornment, Menu, TextField as TextField3, usePopupState } from "@elementor/ui";
|
|
420
422
|
var TextFieldInnerSelection = forwardRef(
|
|
421
423
|
({ placeholder, type, value, onChange, endAdornment, startAdornment }, ref) => {
|
|
422
424
|
return /* @__PURE__ */ React13.createElement(
|
|
@@ -459,7 +461,7 @@ var SelectionEndAdornment = ({
|
|
|
459
461
|
...bindTrigger(popupState)
|
|
460
462
|
},
|
|
461
463
|
value.toUpperCase()
|
|
462
|
-
), /* @__PURE__ */ React13.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options.map((option, index) => /* @__PURE__ */ React13.createElement(
|
|
464
|
+
), /* @__PURE__ */ React13.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options.map((option, index) => /* @__PURE__ */ React13.createElement(MenuListItem2, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
463
465
|
};
|
|
464
466
|
|
|
465
467
|
// src/hooks/use-sync-external-state.tsx
|
|
@@ -1223,6 +1225,7 @@ function EqualUnequalSizesControl({
|
|
|
1223
1225
|
},
|
|
1224
1226
|
...bindPopover2(popupState),
|
|
1225
1227
|
slotProps: {
|
|
1228
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
1226
1229
|
paper: { sx: { mt: 0.5, width: controlRef.current?.getBoundingClientRect().width } }
|
|
1227
1230
|
}
|
|
1228
1231
|
},
|
|
@@ -1338,8 +1341,8 @@ import {
|
|
|
1338
1341
|
IconButton as IconButton2,
|
|
1339
1342
|
InputAdornment as InputAdornment3,
|
|
1340
1343
|
Link,
|
|
1341
|
-
ListSubheader,
|
|
1342
1344
|
MenuList,
|
|
1345
|
+
MenuSubheader,
|
|
1343
1346
|
Popover as Popover3,
|
|
1344
1347
|
Stack as Stack8,
|
|
1345
1348
|
styled as styled4,
|
|
@@ -1482,6 +1485,7 @@ var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
|
1482
1485
|
() => {
|
|
1483
1486
|
virtualizer.scrollToIndex(fontListItems.findIndex((item) => item.value === fontFamily));
|
|
1484
1487
|
},
|
|
1488
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
1485
1489
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1486
1490
|
[fontFamily]
|
|
1487
1491
|
);
|
|
@@ -1512,7 +1516,7 @@ var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
|
1512
1516
|
const tabIndexFallback = !selectedItem ? 0 : -1;
|
|
1513
1517
|
if (item.type === "category") {
|
|
1514
1518
|
return /* @__PURE__ */ React28.createElement(
|
|
1515
|
-
|
|
1519
|
+
MenuSubheader,
|
|
1516
1520
|
{
|
|
1517
1521
|
key: virtualRow.key,
|
|
1518
1522
|
style: {
|
|
@@ -1610,6 +1614,7 @@ var UrlControl = createControl(({ placeholder }) => {
|
|
|
1610
1614
|
// src/controls/link-control.tsx
|
|
1611
1615
|
import * as React31 from "react";
|
|
1612
1616
|
import { useMemo, useState as useState4 } from "react";
|
|
1617
|
+
import { getAncestorWithAnchorTag, getDescendantWithAnchorTag } from "@elementor/editor-elements";
|
|
1613
1618
|
import {
|
|
1614
1619
|
booleanPropTypeUtil,
|
|
1615
1620
|
linkPropTypeUtil,
|
|
@@ -1736,36 +1741,6 @@ function _factoryFilter(newValue, options, minInputLength) {
|
|
|
1736
1741
|
);
|
|
1737
1742
|
}
|
|
1738
1743
|
|
|
1739
|
-
// src/utils/link-restriction.ts
|
|
1740
|
-
import { getContainer } from "@elementor/editor-elements";
|
|
1741
|
-
function getLinkRestriction(elementId) {
|
|
1742
|
-
if (getAncestorAnchor(elementId)) {
|
|
1743
|
-
return {
|
|
1744
|
-
shouldRestrict: true,
|
|
1745
|
-
restrictReason: "ancestor"
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
if (getDescendantAnchor(elementId)) {
|
|
1749
|
-
return {
|
|
1750
|
-
shouldRestrict: true,
|
|
1751
|
-
restrictReason: "descendant"
|
|
1752
|
-
};
|
|
1753
|
-
}
|
|
1754
|
-
return { shouldRestrict: false };
|
|
1755
|
-
}
|
|
1756
|
-
function getAncestorAnchor(elementId) {
|
|
1757
|
-
const element = getElementView(elementId);
|
|
1758
|
-
return element?.closest("a") || null;
|
|
1759
|
-
}
|
|
1760
|
-
function getDescendantAnchor(elementId) {
|
|
1761
|
-
const element = getElementView(elementId);
|
|
1762
|
-
return element?.querySelector("a") || null;
|
|
1763
|
-
}
|
|
1764
|
-
function getElementView(id) {
|
|
1765
|
-
const elementContainer = getContainer(id);
|
|
1766
|
-
return elementContainer?.view?.el || null;
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
1744
|
// src/controls/link-control.tsx
|
|
1770
1745
|
var SIZE3 = "tiny";
|
|
1771
1746
|
var LinkControl = createControl((props) => {
|
|
@@ -1783,7 +1758,7 @@ var LinkControl = createControl((props) => {
|
|
|
1783
1758
|
generateFirstLoadedOption(value)
|
|
1784
1759
|
);
|
|
1785
1760
|
const onEnabledChange = () => {
|
|
1786
|
-
const
|
|
1761
|
+
const shouldRestrict = getAncestorWithAnchorTag(elementId) || getDescendantWithAnchorTag(elementId);
|
|
1787
1762
|
if (shouldRestrict && !isEnabled) {
|
|
1788
1763
|
return;
|
|
1789
1764
|
}
|
|
@@ -2245,8 +2220,9 @@ var BackgroundImageOverlayAttachment = () => {
|
|
|
2245
2220
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
2246
2221
|
import * as React37 from "react";
|
|
2247
2222
|
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil9 } from "@elementor/editor-props";
|
|
2223
|
+
import { MenuListItem as MenuListItem3 } from "@elementor/editor-ui";
|
|
2248
2224
|
import { LetterXIcon, LetterYIcon } from "@elementor/icons";
|
|
2249
|
-
import { Grid as Grid10,
|
|
2225
|
+
import { Grid as Grid10, Select as Select2 } from "@elementor/ui";
|
|
2250
2226
|
import { __ as __14 } from "@wordpress/i18n";
|
|
2251
2227
|
var backgroundPositionOptions = [
|
|
2252
2228
|
{ label: __14("Center center", "elementor"), value: "center center" },
|
|
@@ -2280,7 +2256,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2280
2256
|
onChange: handlePositionChange,
|
|
2281
2257
|
fullWidth: true
|
|
2282
2258
|
},
|
|
2283
|
-
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React37.createElement(
|
|
2259
|
+
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React37.createElement(MenuListItem3, { key: value, value: value ?? "" }, label))
|
|
2284
2260
|
)))), isCustom ? /* @__PURE__ */ React37.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 12 }, /* @__PURE__ */ React37.createElement(Grid10, { container: true, spacing: 1.5 }, /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React37.createElement(SizeControl, { startIcon: /* @__PURE__ */ React37.createElement(LetterXIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ React37.createElement(SizeControl, { startIcon: /* @__PURE__ */ React37.createElement(LetterYIcon, { fontSize: "tiny" }) })))))) : null);
|
|
2285
2261
|
};
|
|
2286
2262
|
|