@elementor/editor-controls 4.2.0-886 → 4.2.0-888
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 +44 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/components/restricted-link-infotip.tsx +35 -9
- package/src/controls/link-control.tsx +28 -20
package/dist/index.mjs
CHANGED
|
@@ -4187,18 +4187,23 @@ var UrlControl = createControl(
|
|
|
4187
4187
|
|
|
4188
4188
|
// src/controls/link-control.tsx
|
|
4189
4189
|
import * as React73 from "react";
|
|
4190
|
-
import { useEffect as useEffect13,
|
|
4190
|
+
import { useEffect as useEffect13, useState as useState12 } from "react";
|
|
4191
4191
|
import { getLinkInLinkRestriction } from "@elementor/editor-elements";
|
|
4192
4192
|
import { linkPropTypeUtil } from "@elementor/editor-props";
|
|
4193
|
+
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
4193
4194
|
import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
4194
4195
|
import { useSessionStorage } from "@elementor/session";
|
|
4195
4196
|
import { Collapse, Grid as Grid10, IconButton as IconButton6, Stack as Stack10 } from "@elementor/ui";
|
|
4196
|
-
import {
|
|
4197
|
+
import { useDebouncedCallback } from "@elementor/utils";
|
|
4197
4198
|
import { __ as __25 } from "@wordpress/i18n";
|
|
4198
4199
|
|
|
4199
4200
|
// src/components/restricted-link-infotip.tsx
|
|
4200
4201
|
import * as React69 from "react";
|
|
4201
|
-
import {
|
|
4202
|
+
import {
|
|
4203
|
+
getContainer,
|
|
4204
|
+
getCurrentDocumentId,
|
|
4205
|
+
selectElement
|
|
4206
|
+
} from "@elementor/editor-elements";
|
|
4202
4207
|
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
4203
4208
|
import { Alert, AlertAction, AlertTitle, Box as Box10, Infotip as Infotip2, Link as Link2 } from "@elementor/ui";
|
|
4204
4209
|
import { __ as __23 } from "@wordpress/i18n";
|
|
@@ -4216,12 +4221,25 @@ var INFOTIP_CONTENT = {
|
|
|
4216
4221
|
"elementor"
|
|
4217
4222
|
)
|
|
4218
4223
|
};
|
|
4224
|
+
function isTargetInCurrentDocument(elementId) {
|
|
4225
|
+
if (!elementId) {
|
|
4226
|
+
return false;
|
|
4227
|
+
}
|
|
4228
|
+
const el = getContainer(elementId)?.view?.el;
|
|
4229
|
+
if (!el) {
|
|
4230
|
+
return false;
|
|
4231
|
+
}
|
|
4232
|
+
const targetDocId = el.closest("[data-elementor-id]")?.getAttribute("data-elementor-id");
|
|
4233
|
+
const currentDocId = String(getCurrentDocumentId() ?? "");
|
|
4234
|
+
return !!(targetDocId && currentDocId && targetDocId === currentDocId);
|
|
4235
|
+
}
|
|
4219
4236
|
var RestrictedLinkInfotip = ({
|
|
4220
4237
|
linkInLinkRestriction,
|
|
4221
4238
|
isVisible,
|
|
4222
4239
|
children
|
|
4223
4240
|
}) => {
|
|
4224
4241
|
const { shouldRestrict, reason, elementId } = linkInLinkRestriction;
|
|
4242
|
+
const showTakeMeThereCta = !!(elementId && isTargetInCurrentDocument(elementId));
|
|
4225
4243
|
const handleTakeMeClick = () => {
|
|
4226
4244
|
if (elementId) {
|
|
4227
4245
|
selectElement(elementId);
|
|
@@ -4233,7 +4251,7 @@ var RestrictedLinkInfotip = ({
|
|
|
4233
4251
|
color: "secondary",
|
|
4234
4252
|
icon: /* @__PURE__ */ React69.createElement(InfoCircleFilledIcon, null),
|
|
4235
4253
|
size: "small",
|
|
4236
|
-
action: /* @__PURE__ */ React69.createElement(
|
|
4254
|
+
action: showTakeMeThereCta ? /* @__PURE__ */ React69.createElement(
|
|
4237
4255
|
AlertAction,
|
|
4238
4256
|
{
|
|
4239
4257
|
sx: { width: "fit-content" },
|
|
@@ -4242,7 +4260,7 @@ var RestrictedLinkInfotip = ({
|
|
|
4242
4260
|
onClick: handleTakeMeClick
|
|
4243
4261
|
},
|
|
4244
4262
|
__23("Take me there", "elementor")
|
|
4245
|
-
)
|
|
4263
|
+
) : void 0
|
|
4246
4264
|
},
|
|
4247
4265
|
/* @__PURE__ */ React69.createElement(AlertTitle, null, __23("Nested links", "elementor")),
|
|
4248
4266
|
/* @__PURE__ */ React69.createElement(Box10, { component: "span" }, INFOTIP_CONTENT[reason ?? "descendant"], " ", /* @__PURE__ */ React69.createElement(Link2, { href: learnMoreButton.href, target: "_blank", color: "info.main" }, learnMoreButton.label))
|
|
@@ -4574,28 +4592,31 @@ var LinkControl = createControl((props) => {
|
|
|
4574
4592
|
getLinkInLinkRestriction(elementId, value ?? linkPlaceholder)
|
|
4575
4593
|
);
|
|
4576
4594
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
4577
|
-
const debouncedCheckRestriction =
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4595
|
+
const debouncedCheckRestriction = useDebouncedCallback(() => {
|
|
4596
|
+
const newRestriction = getLinkInLinkRestriction(elementId, value ?? linkPlaceholder);
|
|
4597
|
+
if (newRestriction.shouldRestrict && isActive && !linkPlaceholder) {
|
|
4598
|
+
setIsActive(false);
|
|
4599
|
+
if (value !== null) {
|
|
4600
|
+
setValue(null);
|
|
4582
4601
|
}
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4602
|
+
}
|
|
4603
|
+
setLinkInLinkRestriction((prev) => isSameRestriction(prev, newRestriction) ? prev : newRestriction);
|
|
4604
|
+
}, 300);
|
|
4605
|
+
useListenTo(
|
|
4606
|
+
commandEndEvent("document/elements/set-settings"),
|
|
4607
|
+
() => {
|
|
4608
|
+
debouncedCheckRestriction();
|
|
4609
|
+
},
|
|
4610
|
+
[debouncedCheckRestriction]
|
|
4586
4611
|
);
|
|
4587
4612
|
useEffect13(() => {
|
|
4588
4613
|
debouncedCheckRestriction();
|
|
4589
|
-
const handleInlineLinkChanged = (
|
|
4590
|
-
|
|
4591
|
-
if (customEvent.detail.elementId === elementId) {
|
|
4592
|
-
debouncedCheckRestriction();
|
|
4593
|
-
}
|
|
4614
|
+
const handleInlineLinkChanged = () => {
|
|
4615
|
+
debouncedCheckRestriction();
|
|
4594
4616
|
};
|
|
4595
4617
|
window.addEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
|
|
4596
4618
|
return () => {
|
|
4597
4619
|
window.removeEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
|
|
4598
|
-
debouncedCheckRestriction.cancel();
|
|
4599
4620
|
};
|
|
4600
4621
|
}, [elementId, debouncedCheckRestriction]);
|
|
4601
4622
|
const onEnabledChange = () => {
|
|
@@ -4656,6 +4677,9 @@ var LinkControl = createControl((props) => {
|
|
|
4656
4677
|
}
|
|
4657
4678
|
)), /* @__PURE__ */ React73.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React73.createElement(Grid10, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React73.createElement(Grid10, { item: true }, /* @__PURE__ */ React73.createElement(ControlFormLabel, null, __25("Open in a new tab", "elementor"))), /* @__PURE__ */ React73.createElement(Grid10, { item: true, sx: { marginInlineEnd: -1 } }, /* @__PURE__ */ React73.createElement(SwitchControl, null))))))));
|
|
4658
4679
|
});
|
|
4680
|
+
function isSameRestriction(a, b) {
|
|
4681
|
+
return a.shouldRestrict === b.shouldRestrict && a.reason === b.reason && a.elementId === b.elementId;
|
|
4682
|
+
}
|
|
4659
4683
|
|
|
4660
4684
|
// src/controls/html-tag-control.tsx
|
|
4661
4685
|
import * as React75 from "react";
|
|
@@ -4764,7 +4788,7 @@ var HtmlTagControl = createControl((props) => {
|
|
|
4764
4788
|
|
|
4765
4789
|
// src/controls/query-chips-control.tsx
|
|
4766
4790
|
import * as React76 from "react";
|
|
4767
|
-
import { useMemo as
|
|
4791
|
+
import { useMemo as useMemo10 } from "react";
|
|
4768
4792
|
import {
|
|
4769
4793
|
createArrayPropUtils,
|
|
4770
4794
|
numberPropTypeUtil as numberPropTypeUtil4,
|
|
@@ -4778,8 +4802,8 @@ var SIZE9 = "tiny";
|
|
|
4778
4802
|
var QueryChipsControl = createControl((props) => {
|
|
4779
4803
|
const { queryOptions, placeholder, minInputLength = 2 } = props;
|
|
4780
4804
|
const { value, setValue, disabled } = useBoundProp(queryArrayPropTypeUtil);
|
|
4781
|
-
const selectedChips =
|
|
4782
|
-
const excludeIds =
|
|
4805
|
+
const selectedChips = useMemo10(() => extractChips(value), [value]);
|
|
4806
|
+
const excludeIds = useMemo10(
|
|
4783
4807
|
() => selectedChips.map((chip) => Number(chip.id)).filter((id) => Number.isFinite(id)),
|
|
4784
4808
|
[selectedChips]
|
|
4785
4809
|
);
|
|
@@ -4839,7 +4863,7 @@ function extractChips(value) {
|
|
|
4839
4863
|
|
|
4840
4864
|
// src/controls/query-filter-repeater-control.tsx
|
|
4841
4865
|
import * as React77 from "react";
|
|
4842
|
-
import { useMemo as
|
|
4866
|
+
import { useMemo as useMemo11, useRef as useRef13 } from "react";
|
|
4843
4867
|
import { useSelectedElementSettings } from "@elementor/editor-elements";
|
|
4844
4868
|
import {
|
|
4845
4869
|
extractValue,
|
|
@@ -4860,16 +4884,16 @@ var QueryFilterRepeaterControl = createControl(
|
|
|
4860
4884
|
}) => {
|
|
4861
4885
|
const { propType, value, setValue } = useBoundProp(queryFilterArrayPropTypeUtil);
|
|
4862
4886
|
const { settings } = useSelectedElementSettings();
|
|
4863
|
-
const visibleKeys =
|
|
4887
|
+
const visibleKeys = useMemo11(
|
|
4864
4888
|
() => allowedKeys.filter((key) => isKeyVisible(keyConfig[key]?.visibleWhen, settings)),
|
|
4865
4889
|
[allowedKeys, keyConfig, settings]
|
|
4866
4890
|
);
|
|
4867
|
-
const usedKeys =
|
|
4868
|
-
const nextAvailableKey =
|
|
4891
|
+
const usedKeys = useMemo11(() => getUsedKeys(value ?? []), [value]);
|
|
4892
|
+
const nextAvailableKey = useMemo11(
|
|
4869
4893
|
() => visibleKeys.find((key) => !usedKeys.has(key)) ?? null,
|
|
4870
4894
|
[visibleKeys, usedKeys]
|
|
4871
4895
|
);
|
|
4872
|
-
const getKeySelectOptions =
|
|
4896
|
+
const getKeySelectOptions = useMemo11(
|
|
4873
4897
|
() => (currentKey) => visibleKeys.map((itemKey) => ({
|
|
4874
4898
|
value: itemKey,
|
|
4875
4899
|
label: keyConfig[itemKey]?.label ?? itemKey,
|
|
@@ -4877,7 +4901,7 @@ var QueryFilterRepeaterControl = createControl(
|
|
|
4877
4901
|
})),
|
|
4878
4902
|
[visibleKeys, keyConfig, usedKeys]
|
|
4879
4903
|
);
|
|
4880
|
-
const initialFallback =
|
|
4904
|
+
const initialFallback = useMemo11(() => createItemForKey(visibleKeys[0] ?? ""), [visibleKeys]);
|
|
4881
4905
|
return /* @__PURE__ */ React77.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React77.createElement(ControlRepeater, { initial: initialFallback, propTypeUtil: queryFilterArrayPropTypeUtil }, /* @__PURE__ */ React77.createElement(RepeaterHeader, { label }, /* @__PURE__ */ React77.createElement(AddFilterItemAction, { nextAvailableKey, ariaLabel: label })), /* @__PURE__ */ React77.createElement(ItemsContainer, { isSortable: false }, /* @__PURE__ */ React77.createElement(
|
|
4882
4906
|
Item,
|
|
4883
4907
|
{
|
|
@@ -4969,7 +4993,7 @@ var ItemContent = ({
|
|
|
4969
4993
|
const currentKey = stringPropTypeUtil13.extract(propContext.value?.key);
|
|
4970
4994
|
const currentKeyConfig = currentKey ? keyConfig[currentKey] : void 0;
|
|
4971
4995
|
const valueType = currentKeyConfig?.valueType ?? "chips";
|
|
4972
|
-
const keySelectOptions =
|
|
4996
|
+
const keySelectOptions = useMemo11(() => getKeySelectOptions(currentKey), [getKeySelectOptions, currentKey]);
|
|
4973
4997
|
return /* @__PURE__ */ React77.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React77.createElement(PropProvider, { ...propContext, setValue: handleValueChange }, /* @__PURE__ */ React77.createElement(PopoverGridContainer, { flexWrap: "wrap" }, /* @__PURE__ */ React77.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React77.createElement(ControlFormLabel, null, __28("Type", "elementor"))), /* @__PURE__ */ React77.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React77.createElement(PropKeyProvider, { bind: "key" }, /* @__PURE__ */ React77.createElement(SelectControl, { options: keySelectOptions })))), valueType === "taxonomies" && currentKeyConfig?.staticOptions && /* @__PURE__ */ React77.createElement(PopoverGridContainer, { flexWrap: "wrap" }, /* @__PURE__ */ React77.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React77.createElement(ControlFormLabel, null, currentKeyConfig.label)), /* @__PURE__ */ React77.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React77.createElement(PropKeyProvider, { bind: "taxonomies" }, /* @__PURE__ */ React77.createElement(ChipsControl, { options: currentKeyConfig.staticOptions })))), valueType !== "taxonomies" && currentKeyConfig?.queryEndpoint && /* @__PURE__ */ React77.createElement(PopoverGridContainer, { flexWrap: "wrap" }, /* @__PURE__ */ React77.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React77.createElement(ControlFormLabel, null, currentKeyConfig.label)), /* @__PURE__ */ React77.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React77.createElement(PropKeyProvider, { bind: "values" }, /* @__PURE__ */ React77.createElement(
|
|
4974
4998
|
QueryChipsControl,
|
|
4975
4999
|
{
|
|
@@ -6083,7 +6107,7 @@ var BackgroundClipField = () => {
|
|
|
6083
6107
|
|
|
6084
6108
|
// src/controls/repeatable-control.tsx
|
|
6085
6109
|
import * as React90 from "react";
|
|
6086
|
-
import { useMemo as
|
|
6110
|
+
import { useMemo as useMemo12 } from "react";
|
|
6087
6111
|
import { createArrayPropUtils as createArrayPropUtils2 } from "@elementor/editor-props";
|
|
6088
6112
|
import { Box as Box16 } from "@elementor/ui";
|
|
6089
6113
|
var PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
|
|
@@ -6104,11 +6128,11 @@ var RepeatableControl = createControl(
|
|
|
6104
6128
|
if (!childPropTypeUtil) {
|
|
6105
6129
|
return null;
|
|
6106
6130
|
}
|
|
6107
|
-
const childArrayPropTypeUtil2 =
|
|
6131
|
+
const childArrayPropTypeUtil2 = useMemo12(
|
|
6108
6132
|
() => createArrayPropUtils2(childPropTypeUtil.key, childPropTypeUtil.schema, propKey),
|
|
6109
6133
|
[childPropTypeUtil.key, childPropTypeUtil.schema, propKey]
|
|
6110
6134
|
);
|
|
6111
|
-
const contextValue =
|
|
6135
|
+
const contextValue = useMemo12(
|
|
6112
6136
|
() => ({
|
|
6113
6137
|
...childControlConfig,
|
|
6114
6138
|
placeholder: placeholder || "",
|
|
@@ -6240,7 +6264,7 @@ var getAllProperties = (pattern) => {
|
|
|
6240
6264
|
|
|
6241
6265
|
// src/controls/key-value-control.tsx
|
|
6242
6266
|
import * as React91 from "react";
|
|
6243
|
-
import { useMemo as
|
|
6267
|
+
import { useMemo as useMemo13, useState as useState17 } from "react";
|
|
6244
6268
|
import {
|
|
6245
6269
|
isTransformable,
|
|
6246
6270
|
keyValuePropTypeUtil,
|
|
@@ -6283,7 +6307,7 @@ var KeyValueControl = createControl((props = {}) => {
|
|
|
6283
6307
|
keyHelper: void 0,
|
|
6284
6308
|
valueHelper: void 0
|
|
6285
6309
|
};
|
|
6286
|
-
const [keyRegex, valueRegex, errMsg] =
|
|
6310
|
+
const [keyRegex, valueRegex, errMsg] = useMemo13(
|
|
6287
6311
|
() => [
|
|
6288
6312
|
props.regexKey ? new RegExp(props.regexKey) : void 0,
|
|
6289
6313
|
props.regexValue ? new RegExp(props.regexValue) : void 0,
|
|
@@ -7022,7 +7046,7 @@ var TransformBasePopoverTrigger = ({
|
|
|
7022
7046
|
|
|
7023
7047
|
// src/controls/transition-control/transition-repeater-control.tsx
|
|
7024
7048
|
import * as React108 from "react";
|
|
7025
|
-
import { useEffect as useEffect15, useMemo as
|
|
7049
|
+
import { useEffect as useEffect15, useMemo as useMemo16, useState as useState18 } from "react";
|
|
7026
7050
|
import {
|
|
7027
7051
|
createArrayPropUtils as createArrayPropUtils3,
|
|
7028
7052
|
selectionSizePropTypeUtil as selectionSizePropTypeUtil2
|
|
@@ -7034,7 +7058,7 @@ import { __ as __54 } from "@wordpress/i18n";
|
|
|
7034
7058
|
|
|
7035
7059
|
// src/controls/selection-size-control.tsx
|
|
7036
7060
|
import * as React106 from "react";
|
|
7037
|
-
import { useMemo as
|
|
7061
|
+
import { useMemo as useMemo14, useRef as useRef26 } from "react";
|
|
7038
7062
|
import { selectionSizePropTypeUtil } from "@elementor/editor-props";
|
|
7039
7063
|
import { Grid as Grid29 } from "@elementor/ui";
|
|
7040
7064
|
var SelectionSizeControl = createControl(
|
|
@@ -7042,7 +7066,7 @@ var SelectionSizeControl = createControl(
|
|
|
7042
7066
|
const { value, setValue, propType } = useBoundProp(selectionSizePropTypeUtil);
|
|
7043
7067
|
const rowRef = useRef26(null);
|
|
7044
7068
|
const sizeFieldId = sizeLabel.replace(/\s+/g, "-").toLowerCase();
|
|
7045
|
-
const currentSizeConfig =
|
|
7069
|
+
const currentSizeConfig = useMemo14(() => {
|
|
7046
7070
|
switch (value.selection.$$type) {
|
|
7047
7071
|
case "key-value":
|
|
7048
7072
|
return sizeConfigMap[value?.selection?.value.value.value || ""];
|
|
@@ -7255,7 +7279,7 @@ function subscribeToTransitionEvent() {
|
|
|
7255
7279
|
|
|
7256
7280
|
// src/controls/transition-control/transition-selector.tsx
|
|
7257
7281
|
import * as React107 from "react";
|
|
7258
|
-
import { useMemo as
|
|
7282
|
+
import { useMemo as useMemo15, useRef as useRef27 } from "react";
|
|
7259
7283
|
import { keyValuePropTypeUtil as keyValuePropTypeUtil2 } from "@elementor/editor-props";
|
|
7260
7284
|
import { PromotionAlert, PromotionChip } from "@elementor/editor-ui";
|
|
7261
7285
|
import { ChevronDownIcon as ChevronDownIcon3, VariationsIcon } from "@elementor/icons";
|
|
@@ -7344,7 +7368,7 @@ var TransitionSelector = ({
|
|
|
7344
7368
|
} = value;
|
|
7345
7369
|
const defaultRef = useRef27(null);
|
|
7346
7370
|
const popoverState = usePopupState9({ variant: "popover" });
|
|
7347
|
-
const disabledCategories =
|
|
7371
|
+
const disabledCategories = useMemo15(() => {
|
|
7348
7372
|
return new Set(
|
|
7349
7373
|
transitionProperties.filter((cat) => cat.properties.some((prop) => prop.isDisabled)).map((cat) => cat.label)
|
|
7350
7374
|
);
|
|
@@ -7573,11 +7597,11 @@ var TransitionRepeaterControl = createControl(
|
|
|
7573
7597
|
const [recentlyUsedList, setRecentlyUsedList] = useState18([]);
|
|
7574
7598
|
const proInstalled = hasProInstalled2();
|
|
7575
7599
|
const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
|
|
7576
|
-
const { allDisabled: disabledItems, proDisabled: proDisabledItems } =
|
|
7600
|
+
const { allDisabled: disabledItems, proDisabled: proDisabledItems } = useMemo16(
|
|
7577
7601
|
() => getDisabledItemLabels(value),
|
|
7578
7602
|
[value]
|
|
7579
7603
|
);
|
|
7580
|
-
const allowedTransitionSet =
|
|
7604
|
+
const allowedTransitionSet = useMemo16(() => {
|
|
7581
7605
|
const set = /* @__PURE__ */ new Set();
|
|
7582
7606
|
transitionProperties.forEach((category) => {
|
|
7583
7607
|
category.properties.forEach((prop) => {
|
|
@@ -7603,7 +7627,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
7603
7627
|
useEffect15(() => {
|
|
7604
7628
|
recentlyUsedListGetter().then(setRecentlyUsedList);
|
|
7605
7629
|
}, [recentlyUsedListGetter]);
|
|
7606
|
-
const allPropertiesUsed =
|
|
7630
|
+
const allPropertiesUsed = useMemo16(() => areAllPropertiesUsed(value), [value]);
|
|
7607
7631
|
const isAddItemDisabled = !currentStyleIsNormal || allPropertiesUsed;
|
|
7608
7632
|
return /* @__PURE__ */ React108.createElement(
|
|
7609
7633
|
RepeatableControl,
|
|
@@ -7886,10 +7910,10 @@ var BoundTimeStringControl = ({ bind, ariaLabel }) => {
|
|
|
7886
7910
|
|
|
7887
7911
|
// src/controls/inline-editing-control.tsx
|
|
7888
7912
|
import * as React115 from "react";
|
|
7889
|
-
import { useCallback as useCallback4, useEffect as useEffect17, useMemo as
|
|
7913
|
+
import { useCallback as useCallback4, useEffect as useEffect17, useMemo as useMemo17 } from "react";
|
|
7890
7914
|
import { htmlV3PropTypeUtil, parseHtmlChildren, stringPropTypeUtil as stringPropTypeUtil21 } from "@elementor/editor-props";
|
|
7891
7915
|
import { Box as Box25 } from "@elementor/ui";
|
|
7892
|
-
import { debounce as
|
|
7916
|
+
import { debounce as debounce3 } from "@elementor/utils";
|
|
7893
7917
|
|
|
7894
7918
|
// src/components/inline-editor.tsx
|
|
7895
7919
|
import * as React114 from "react";
|
|
@@ -8065,8 +8089,8 @@ var InlineEditingControl = createControl(
|
|
|
8065
8089
|
}) => {
|
|
8066
8090
|
const { value, setValue, placeholder } = useBoundProp(htmlV3PropTypeUtil);
|
|
8067
8091
|
const content = stringPropTypeUtil21.extract(value?.content ?? null) ?? "";
|
|
8068
|
-
const debouncedParse =
|
|
8069
|
-
() =>
|
|
8092
|
+
const debouncedParse = useMemo17(
|
|
8093
|
+
() => debounce3((html) => {
|
|
8070
8094
|
const parsed = parseHtmlChildren(html);
|
|
8071
8095
|
setValue({
|
|
8072
8096
|
content: parsed.content ? stringPropTypeUtil21.create(parsed.content) : null,
|
|
@@ -8158,9 +8182,9 @@ import { Grid as Grid34, Stack as Stack19 } from "@elementor/ui";
|
|
|
8158
8182
|
import { __ as __57 } from "@wordpress/i18n";
|
|
8159
8183
|
|
|
8160
8184
|
// src/hooks/use-form-field-suggestions.ts
|
|
8161
|
-
import { getContainer, getSelectedElements as getSelectedElements3 } from "@elementor/editor-elements";
|
|
8185
|
+
import { getContainer as getContainer2, getSelectedElements as getSelectedElements3 } from "@elementor/editor-elements";
|
|
8162
8186
|
import { isTransformable as isTransformable3 } from "@elementor/editor-props";
|
|
8163
|
-
import { __privateUseListenTo as
|
|
8187
|
+
import { __privateUseListenTo as useListenTo2, commandEndEvent as commandEndEvent2, v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
8164
8188
|
var FORM_FIELD_WIDGET_TYPES = [
|
|
8165
8189
|
"e-form-input",
|
|
8166
8190
|
"e-form-textarea",
|
|
@@ -8171,12 +8195,12 @@ var FORM_FIELD_WIDGET_TYPES = [
|
|
|
8171
8195
|
"e-form-time-picker"
|
|
8172
8196
|
];
|
|
8173
8197
|
function useFormFieldSuggestions(options) {
|
|
8174
|
-
return
|
|
8198
|
+
return useListenTo2(
|
|
8175
8199
|
[
|
|
8176
8200
|
v1ReadyEvent(),
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8201
|
+
commandEndEvent2("document/elements/create"),
|
|
8202
|
+
commandEndEvent2("document/elements/delete"),
|
|
8203
|
+
commandEndEvent2("document/elements/set-settings")
|
|
8180
8204
|
],
|
|
8181
8205
|
() => {
|
|
8182
8206
|
const selectedElements = getSelectedElements3();
|
|
@@ -8184,7 +8208,7 @@ function useFormFieldSuggestions(options) {
|
|
|
8184
8208
|
if (!formElement) {
|
|
8185
8209
|
return [];
|
|
8186
8210
|
}
|
|
8187
|
-
const container =
|
|
8211
|
+
const container = getContainer2(formElement.id);
|
|
8188
8212
|
if (!container?.children) {
|
|
8189
8213
|
return [];
|
|
8190
8214
|
}
|
|
@@ -8801,8 +8825,8 @@ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
|
|
|
8801
8825
|
|
|
8802
8826
|
// src/components/inline-editor-toolbar.tsx
|
|
8803
8827
|
import * as React128 from "react";
|
|
8804
|
-
import { useEffect as useEffect20, useMemo as
|
|
8805
|
-
import { getContainer as
|
|
8828
|
+
import { useEffect as useEffect20, useMemo as useMemo18, useRef as useRef32, useState as useState22 } from "react";
|
|
8829
|
+
import { getContainer as getContainer3, getElementSetting } from "@elementor/editor-elements";
|
|
8806
8830
|
import {
|
|
8807
8831
|
BoldIcon,
|
|
8808
8832
|
ItalicIcon,
|
|
@@ -8900,7 +8924,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
8900
8924
|
editor,
|
|
8901
8925
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
8902
8926
|
});
|
|
8903
|
-
const formatButtonsList =
|
|
8927
|
+
const formatButtonsList = useMemo18(() => {
|
|
8904
8928
|
const buttons = Object.values(formatButtons);
|
|
8905
8929
|
if (isElementClickable) {
|
|
8906
8930
|
return buttons.filter((button) => button.action !== "link");
|
|
@@ -9013,7 +9037,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
9013
9037
|
);
|
|
9014
9038
|
};
|
|
9015
9039
|
var checkIfElementIsClickable = (elementId) => {
|
|
9016
|
-
const container =
|
|
9040
|
+
const container = getContainer3(elementId);
|
|
9017
9041
|
const type = container?.model.get("widgetType");
|
|
9018
9042
|
const isButton = type === "e-button";
|
|
9019
9043
|
const hasLink = !!getElementSetting(elementId, "link")?.value?.destination;
|
|
@@ -9247,7 +9271,7 @@ var hasValue = (value) => {
|
|
|
9247
9271
|
};
|
|
9248
9272
|
|
|
9249
9273
|
// src/hooks/use-font-families.ts
|
|
9250
|
-
import { useMemo as
|
|
9274
|
+
import { useMemo as useMemo19 } from "react";
|
|
9251
9275
|
import { getElementorConfig } from "@elementor/editor-v1-adapters";
|
|
9252
9276
|
var getFontControlConfig = () => {
|
|
9253
9277
|
const { controls } = getElementorConfig();
|
|
@@ -9255,7 +9279,7 @@ var getFontControlConfig = () => {
|
|
|
9255
9279
|
};
|
|
9256
9280
|
var useFontFamilies = () => {
|
|
9257
9281
|
const { groups, options } = getFontControlConfig();
|
|
9258
|
-
return
|
|
9282
|
+
return useMemo19(() => {
|
|
9259
9283
|
if (!groups || !options) {
|
|
9260
9284
|
return [];
|
|
9261
9285
|
}
|