@elementor/editor-controls 4.1.0-744 → 4.1.0-746
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 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +87 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/bound-prop-context/prop-key-context.tsx +10 -1
- package/src/bound-prop-context/use-bound-prop.ts +4 -1
- package/src/components/inline-editor.tsx +4 -0
- package/src/controls/image-media-control.tsx +3 -2
- package/src/controls/inline-editing-control.tsx +13 -2
- package/src/controls/link-control.tsx +15 -26
- package/src/controls/query-control.tsx +38 -37
- package/src/controls/switch-control.tsx +2 -2
- package/src/controls/text-area-control.tsx +4 -2
- package/src/controls/text-control.tsx +4 -2
- package/src/controls/url-control.tsx +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -19,7 +19,7 @@ type ImageControlProps = {
|
|
|
19
19
|
};
|
|
20
20
|
declare const ImageControl: ControlComponent$1<({ sizes, label }: ImageControlProps) => React$1.JSX.Element>;
|
|
21
21
|
|
|
22
|
-
declare const TextControl: ControlComponent$1<({ placeholder, error, inputValue, inputDisabled, helperText, sx, ariaLabel, }: {
|
|
22
|
+
declare const TextControl: ControlComponent$1<({ placeholder: propPlaceholder, error, inputValue, inputDisabled, helperText, sx, ariaLabel, }: {
|
|
23
23
|
placeholder?: string;
|
|
24
24
|
error?: boolean;
|
|
25
25
|
inputValue?: string;
|
|
@@ -33,7 +33,7 @@ type Props$b = {
|
|
|
33
33
|
placeholder?: string;
|
|
34
34
|
ariaLabel?: string;
|
|
35
35
|
};
|
|
36
|
-
declare const TextAreaControl: ControlComponent$1<({ placeholder, ariaLabel }: Props$b) => React$1.JSX.Element>;
|
|
36
|
+
declare const TextAreaControl: ControlComponent$1<({ placeholder: propPlaceholder, ariaLabel }: Props$b) => React$1.JSX.Element>;
|
|
37
37
|
|
|
38
38
|
declare const lengthUnits: readonly ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
39
39
|
declare const angleUnits: readonly ["deg", "rad", "grad", "turn"];
|
|
@@ -249,7 +249,7 @@ type ItemSelectorProps = {
|
|
|
249
249
|
};
|
|
250
250
|
declare const ItemSelector: ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle, onDebounce, icon, disabledItems, id, footer, categoryItemContentTemplate, }: ItemSelectorProps) => React$1.JSX.Element;
|
|
251
251
|
|
|
252
|
-
declare const UrlControl: ControlComponent$1<({ placeholder, ariaLabel }: {
|
|
252
|
+
declare const UrlControl: ControlComponent$1<({ placeholder: propPlaceholder, ariaLabel }: {
|
|
253
253
|
placeholder?: string;
|
|
254
254
|
ariaLabel?: string;
|
|
255
255
|
}) => React$1.JSX.Element>;
|
|
@@ -631,6 +631,7 @@ declare const PopoverGridContainer: React$1.ForwardRefExoticComponent<{
|
|
|
631
631
|
type InlineEditorProps = {
|
|
632
632
|
value: string | null;
|
|
633
633
|
setValue: (value: string | null) => void;
|
|
634
|
+
placeholder?: string | null;
|
|
634
635
|
editorProps?: EditorProps;
|
|
635
636
|
elementClasses?: string;
|
|
636
637
|
sx?: SxProps<Theme>;
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ type ImageControlProps = {
|
|
|
19
19
|
};
|
|
20
20
|
declare const ImageControl: ControlComponent$1<({ sizes, label }: ImageControlProps) => React$1.JSX.Element>;
|
|
21
21
|
|
|
22
|
-
declare const TextControl: ControlComponent$1<({ placeholder, error, inputValue, inputDisabled, helperText, sx, ariaLabel, }: {
|
|
22
|
+
declare const TextControl: ControlComponent$1<({ placeholder: propPlaceholder, error, inputValue, inputDisabled, helperText, sx, ariaLabel, }: {
|
|
23
23
|
placeholder?: string;
|
|
24
24
|
error?: boolean;
|
|
25
25
|
inputValue?: string;
|
|
@@ -33,7 +33,7 @@ type Props$b = {
|
|
|
33
33
|
placeholder?: string;
|
|
34
34
|
ariaLabel?: string;
|
|
35
35
|
};
|
|
36
|
-
declare const TextAreaControl: ControlComponent$1<({ placeholder, ariaLabel }: Props$b) => React$1.JSX.Element>;
|
|
36
|
+
declare const TextAreaControl: ControlComponent$1<({ placeholder: propPlaceholder, ariaLabel }: Props$b) => React$1.JSX.Element>;
|
|
37
37
|
|
|
38
38
|
declare const lengthUnits: readonly ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
39
39
|
declare const angleUnits: readonly ["deg", "rad", "grad", "turn"];
|
|
@@ -249,7 +249,7 @@ type ItemSelectorProps = {
|
|
|
249
249
|
};
|
|
250
250
|
declare const ItemSelector: ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle, onDebounce, icon, disabledItems, id, footer, categoryItemContentTemplate, }: ItemSelectorProps) => React$1.JSX.Element;
|
|
251
251
|
|
|
252
|
-
declare const UrlControl: ControlComponent$1<({ placeholder, ariaLabel }: {
|
|
252
|
+
declare const UrlControl: ControlComponent$1<({ placeholder: propPlaceholder, ariaLabel }: {
|
|
253
253
|
placeholder?: string;
|
|
254
254
|
ariaLabel?: string;
|
|
255
255
|
}) => React$1.JSX.Element>;
|
|
@@ -631,6 +631,7 @@ declare const PopoverGridContainer: React$1.ForwardRefExoticComponent<{
|
|
|
631
631
|
type InlineEditorProps = {
|
|
632
632
|
value: string | null;
|
|
633
633
|
setValue: (value: string | null) => void;
|
|
634
|
+
placeholder?: string | null;
|
|
634
635
|
editorProps?: EditorProps;
|
|
635
636
|
elementClasses?: string;
|
|
636
637
|
sx?: SxProps<Theme>;
|
package/dist/index.js
CHANGED
|
@@ -221,11 +221,20 @@ var ArrayPropKeyProvider = ({ children, bind }) => {
|
|
|
221
221
|
return context?.setValue(newValue, options, { bind });
|
|
222
222
|
};
|
|
223
223
|
const value = context.value?.[Number(bind)];
|
|
224
|
+
const placeholder = context.placeholder?.[Number(bind)];
|
|
224
225
|
const propType = context.propType.item_prop_type;
|
|
225
226
|
return /* @__PURE__ */ React2.createElement(
|
|
226
227
|
PropKeyContext.Provider,
|
|
227
228
|
{
|
|
228
|
-
value: {
|
|
229
|
+
value: {
|
|
230
|
+
...context,
|
|
231
|
+
value,
|
|
232
|
+
setValue,
|
|
233
|
+
bind,
|
|
234
|
+
propType,
|
|
235
|
+
path: [...path ?? [], bind],
|
|
236
|
+
placeholder: placeholder ?? void 0
|
|
237
|
+
}
|
|
229
238
|
},
|
|
230
239
|
children
|
|
231
240
|
);
|
|
@@ -266,7 +275,9 @@ function useBoundProp(propTypeUtil) {
|
|
|
266
275
|
return propKeyContext?.setValue(propTypeUtil?.create(value2, options), {}, meta);
|
|
267
276
|
}
|
|
268
277
|
const propType = resolveUnionPropType(propKeyContext.propType, propTypeUtil.key);
|
|
269
|
-
const
|
|
278
|
+
const hasPlaceholder = propKeyContext.placeholder !== void 0 && propKeyContext.placeholder !== null;
|
|
279
|
+
const fallbackValue = hasPlaceholder ? null : propType.default;
|
|
280
|
+
const value = propTypeUtil.extract(propKeyContext.value ?? fallbackValue ?? null);
|
|
270
281
|
const placeholder = propTypeUtil.extract(propKeyContext.placeholder ?? null);
|
|
271
282
|
return {
|
|
272
283
|
...propKeyContext,
|
|
@@ -474,10 +485,11 @@ function ControlActions({ children }) {
|
|
|
474
485
|
|
|
475
486
|
// src/controls/image-media-control.tsx
|
|
476
487
|
var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
|
|
477
|
-
const { value, setValue, propType } = useBoundProp(import_editor_props.imageSrcPropTypeUtil);
|
|
488
|
+
const { value, setValue, propType, placeholder } = useBoundProp(import_editor_props.imageSrcPropTypeUtil);
|
|
478
489
|
const { id, url } = value ?? {};
|
|
479
490
|
const { data: attachment, isFetching } = (0, import_wp_media.useWpMediaAttachment)(id?.value || null);
|
|
480
|
-
const
|
|
491
|
+
const { data: placeholderAttachment } = (0, import_wp_media.useWpMediaAttachment)(placeholder?.id?.value || null);
|
|
492
|
+
const src = attachment?.url ?? url?.value ?? placeholderAttachment?.url ?? null;
|
|
481
493
|
const { open } = (0, import_wp_media.useWpMediaFrame)({
|
|
482
494
|
mediaTypes,
|
|
483
495
|
multiple: false,
|
|
@@ -586,7 +598,7 @@ var import_editor_props4 = require("@elementor/editor-props");
|
|
|
586
598
|
var import_ui7 = require("@elementor/ui");
|
|
587
599
|
var TextControl = createControl(
|
|
588
600
|
({
|
|
589
|
-
placeholder,
|
|
601
|
+
placeholder: propPlaceholder,
|
|
590
602
|
error,
|
|
591
603
|
inputValue,
|
|
592
604
|
inputDisabled,
|
|
@@ -594,8 +606,9 @@ var TextControl = createControl(
|
|
|
594
606
|
sx,
|
|
595
607
|
ariaLabel
|
|
596
608
|
}) => {
|
|
597
|
-
const { value, setValue, disabled } = useBoundProp(import_editor_props4.stringPropTypeUtil);
|
|
609
|
+
const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(import_editor_props4.stringPropTypeUtil);
|
|
598
610
|
const handleChange = (event) => setValue(event.target.value);
|
|
611
|
+
const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
|
|
599
612
|
return /* @__PURE__ */ React14.createElement(ControlActions, null, /* @__PURE__ */ React14.createElement(
|
|
600
613
|
import_ui7.TextField,
|
|
601
614
|
{
|
|
@@ -620,11 +633,12 @@ var TextControl = createControl(
|
|
|
620
633
|
var React15 = __toESM(require("react"));
|
|
621
634
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
622
635
|
var import_ui8 = require("@elementor/ui");
|
|
623
|
-
var TextAreaControl = createControl(({ placeholder, ariaLabel }) => {
|
|
624
|
-
const { value, setValue, disabled } = useBoundProp(import_editor_props5.stringPropTypeUtil);
|
|
636
|
+
var TextAreaControl = createControl(({ placeholder: propPlaceholder, ariaLabel }) => {
|
|
637
|
+
const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(import_editor_props5.stringPropTypeUtil);
|
|
625
638
|
const handleChange = (event) => {
|
|
626
639
|
setValue(event.target.value);
|
|
627
640
|
};
|
|
641
|
+
const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
|
|
628
642
|
return /* @__PURE__ */ React15.createElement(ControlActions, null, /* @__PURE__ */ React15.createElement(
|
|
629
643
|
import_ui8.TextField,
|
|
630
644
|
{
|
|
@@ -3290,9 +3304,10 @@ var React60 = __toESM(require("react"));
|
|
|
3290
3304
|
var import_editor_props21 = require("@elementor/editor-props");
|
|
3291
3305
|
var import_ui45 = require("@elementor/ui");
|
|
3292
3306
|
var UrlControl = createControl(
|
|
3293
|
-
({ placeholder, ariaLabel }) => {
|
|
3294
|
-
const { value, setValue, disabled } = useBoundProp(import_editor_props21.urlPropTypeUtil);
|
|
3307
|
+
({ placeholder: propPlaceholder, ariaLabel }) => {
|
|
3308
|
+
const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(import_editor_props21.urlPropTypeUtil);
|
|
3295
3309
|
const handleChange = (event) => setValue(event.target.value);
|
|
3310
|
+
const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
|
|
3296
3311
|
return /* @__PURE__ */ React60.createElement(ControlActions, null, /* @__PURE__ */ React60.createElement(
|
|
3297
3312
|
import_ui45.TextField,
|
|
3298
3313
|
{
|
|
@@ -3519,45 +3534,41 @@ function factoryFilter(newValue, options, minInputLength) {
|
|
|
3519
3534
|
|
|
3520
3535
|
// src/controls/query-control.tsx
|
|
3521
3536
|
var QueryControl = createControl((props) => {
|
|
3522
|
-
const { value, setValue } = useBoundProp();
|
|
3537
|
+
const { value: queryValue, setValue: setQueryValue } = useBoundProp(import_editor_props22.queryPropTypeUtil);
|
|
3538
|
+
const { value: urlValue, setValue: setUrlValue, placeholder: urlPlaceholder } = useBoundProp(import_editor_props22.urlPropTypeUtil);
|
|
3523
3539
|
const {
|
|
3524
3540
|
allowCustomValues = true,
|
|
3525
3541
|
queryOptions: { url, params = {} },
|
|
3526
|
-
placeholder,
|
|
3542
|
+
placeholder = (0, import_i18n22.__)("Search", "elementor"),
|
|
3527
3543
|
minInputLength = 2,
|
|
3528
3544
|
onSetValue,
|
|
3529
3545
|
ariaLabel
|
|
3530
3546
|
} = props || {};
|
|
3531
|
-
const normalizedPlaceholder = placeholder || (0, import_i18n22.__)("Search", "elementor");
|
|
3532
3547
|
const [options, setOptions] = (0, import_react33.useState)(
|
|
3533
|
-
generateFirstLoadedOption(
|
|
3548
|
+
generateFirstLoadedOption(queryValue)
|
|
3534
3549
|
);
|
|
3535
3550
|
const onOptionChange = (newValue) => {
|
|
3536
3551
|
if (newValue === null) {
|
|
3537
|
-
|
|
3552
|
+
setQueryValue(null);
|
|
3538
3553
|
onSetValue?.(null);
|
|
3539
3554
|
return;
|
|
3540
3555
|
}
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
id: import_editor_props22.numberPropTypeUtil.create(newValue),
|
|
3545
|
-
label: import_editor_props22.stringPropTypeUtil.create(findMatchingOption(options, newValue)?.label || null)
|
|
3546
|
-
}
|
|
3556
|
+
const newQueryValue = {
|
|
3557
|
+
id: import_editor_props22.numberPropTypeUtil.create(newValue),
|
|
3558
|
+
label: import_editor_props22.stringPropTypeUtil.create(findMatchingOption(options, newValue)?.label || null)
|
|
3547
3559
|
};
|
|
3548
|
-
|
|
3549
|
-
onSetValue?.(
|
|
3560
|
+
setQueryValue(newQueryValue);
|
|
3561
|
+
onSetValue?.(import_editor_props22.queryPropTypeUtil.create(newQueryValue));
|
|
3550
3562
|
};
|
|
3551
3563
|
const onTextChange = (newValue) => {
|
|
3552
|
-
|
|
3553
|
-
|
|
3564
|
+
const trimmedValue = newValue?.trim() || "";
|
|
3565
|
+
if (!trimmedValue) {
|
|
3566
|
+
setUrlValue(null);
|
|
3554
3567
|
onSetValue?.(null);
|
|
3555
3568
|
return;
|
|
3556
3569
|
}
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
setValue(valueToSave);
|
|
3560
|
-
onSetValue?.(valueToSave);
|
|
3570
|
+
setUrlValue(trimmedValue);
|
|
3571
|
+
onSetValue?.(import_editor_props22.urlPropTypeUtil.create(trimmedValue));
|
|
3561
3572
|
updateOptions(newValue);
|
|
3562
3573
|
};
|
|
3563
3574
|
const updateOptions = (newValue) => {
|
|
@@ -3576,14 +3587,15 @@ var QueryControl = createControl((props) => {
|
|
|
3576
3587
|
),
|
|
3577
3588
|
[url]
|
|
3578
3589
|
);
|
|
3590
|
+
const displayValue = queryValue?.id?.value ?? urlValue;
|
|
3579
3591
|
return /* @__PURE__ */ React63.createElement(ControlActions, null, /* @__PURE__ */ React63.createElement(
|
|
3580
3592
|
Autocomplete2,
|
|
3581
3593
|
{
|
|
3582
3594
|
options,
|
|
3583
3595
|
allowCustomValues,
|
|
3584
|
-
placeholder:
|
|
3596
|
+
placeholder: urlPlaceholder ?? placeholder,
|
|
3585
3597
|
startAdornment: /* @__PURE__ */ React63.createElement(import_icons14.SearchIcon, { fontSize: "tiny" }),
|
|
3586
|
-
value:
|
|
3598
|
+
value: displayValue,
|
|
3587
3599
|
onOptionChange,
|
|
3588
3600
|
onTextChange,
|
|
3589
3601
|
minInputLength,
|
|
@@ -3611,16 +3623,14 @@ function formatOptions(options) {
|
|
|
3611
3623
|
(a, b) => a[compareKey] && b[compareKey] ? a[compareKey].localeCompare(b[compareKey]) : 0
|
|
3612
3624
|
);
|
|
3613
3625
|
}
|
|
3614
|
-
function generateFirstLoadedOption(
|
|
3615
|
-
const
|
|
3616
|
-
const label =
|
|
3617
|
-
const
|
|
3618
|
-
|
|
3619
|
-
{
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
}
|
|
3623
|
-
] : [];
|
|
3626
|
+
function generateFirstLoadedOption(queryValue) {
|
|
3627
|
+
const id = queryValue?.id?.value;
|
|
3628
|
+
const label = queryValue?.label?.value;
|
|
3629
|
+
const option = [];
|
|
3630
|
+
if (id && label) {
|
|
3631
|
+
option.push({ id: id.toString(), label });
|
|
3632
|
+
}
|
|
3633
|
+
return option;
|
|
3624
3634
|
}
|
|
3625
3635
|
|
|
3626
3636
|
// src/controls/switch-control.tsx
|
|
@@ -3628,14 +3638,14 @@ var React64 = __toESM(require("react"));
|
|
|
3628
3638
|
var import_editor_props23 = require("@elementor/editor-props");
|
|
3629
3639
|
var import_ui48 = require("@elementor/ui");
|
|
3630
3640
|
var SwitchControl = createControl(() => {
|
|
3631
|
-
const { value, setValue, disabled } = useBoundProp(import_editor_props23.booleanPropTypeUtil);
|
|
3641
|
+
const { value, setValue, disabled, placeholder } = useBoundProp(import_editor_props23.booleanPropTypeUtil);
|
|
3632
3642
|
const handleChange = (event) => {
|
|
3633
3643
|
setValue(event.target.checked);
|
|
3634
3644
|
};
|
|
3635
3645
|
return /* @__PURE__ */ React64.createElement(import_ui48.Box, { sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React64.createElement(
|
|
3636
3646
|
import_ui48.Switch,
|
|
3637
3647
|
{
|
|
3638
|
-
checked: !!value,
|
|
3648
|
+
checked: !!(value || placeholder),
|
|
3639
3649
|
onChange: handleChange,
|
|
3640
3650
|
size: "small",
|
|
3641
3651
|
disabled,
|
|
@@ -3650,8 +3660,9 @@ var SwitchControl = createControl(() => {
|
|
|
3650
3660
|
var SIZE7 = "tiny";
|
|
3651
3661
|
var LinkControl = createControl((props) => {
|
|
3652
3662
|
const { value, path, setValue, ...propContext } = useBoundProp(import_editor_props24.linkPropTypeUtil);
|
|
3663
|
+
const linkPlaceholder = propContext.placeholder;
|
|
3653
3664
|
const [linkSessionValue, setLinkSessionValue] = (0, import_session.useSessionStorage)(path.join("/"));
|
|
3654
|
-
const [isActive, setIsActive] = (0, import_react34.useState)(!!value);
|
|
3665
|
+
const [isActive, setIsActive] = (0, import_react34.useState)(!!value || !!linkPlaceholder);
|
|
3655
3666
|
const {
|
|
3656
3667
|
allowCustomValues = true,
|
|
3657
3668
|
queryOptions,
|
|
@@ -3662,18 +3673,18 @@ var LinkControl = createControl((props) => {
|
|
|
3662
3673
|
ariaLabel
|
|
3663
3674
|
} = props || {};
|
|
3664
3675
|
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, import_react34.useState)(
|
|
3665
|
-
(0, import_editor_elements2.getLinkInLinkRestriction)(elementId, value)
|
|
3676
|
+
(0, import_editor_elements2.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder)
|
|
3666
3677
|
);
|
|
3667
3678
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
3668
3679
|
const debouncedCheckRestriction = (0, import_react34.useMemo)(
|
|
3669
3680
|
() => (0, import_utils5.debounce)(() => {
|
|
3670
|
-
const newRestriction = (0, import_editor_elements2.getLinkInLinkRestriction)(elementId, value);
|
|
3671
|
-
if (newRestriction.shouldRestrict && isActive) {
|
|
3681
|
+
const newRestriction = (0, import_editor_elements2.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder);
|
|
3682
|
+
if (newRestriction.shouldRestrict && isActive && !linkPlaceholder) {
|
|
3672
3683
|
setIsActive(false);
|
|
3673
3684
|
}
|
|
3674
3685
|
setLinkInLinkRestriction(newRestriction);
|
|
3675
3686
|
}, 300),
|
|
3676
|
-
[elementId, isActive, value]
|
|
3687
|
+
[elementId, isActive, value, linkPlaceholder]
|
|
3677
3688
|
);
|
|
3678
3689
|
(0, import_react34.useEffect)(() => {
|
|
3679
3690
|
debouncedCheckRestriction();
|
|
@@ -3690,7 +3701,7 @@ var LinkControl = createControl((props) => {
|
|
|
3690
3701
|
};
|
|
3691
3702
|
}, [elementId, debouncedCheckRestriction]);
|
|
3692
3703
|
const onEnabledChange = () => {
|
|
3693
|
-
setLinkInLinkRestriction((0, import_editor_elements2.getLinkInLinkRestriction)(elementId, value));
|
|
3704
|
+
setLinkInLinkRestriction((0, import_editor_elements2.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
|
|
3694
3705
|
if (linkInLinkRestriction.shouldRestrict && !isActive) {
|
|
3695
3706
|
return;
|
|
3696
3707
|
}
|
|
@@ -3726,13 +3737,14 @@ var LinkControl = createControl((props) => {
|
|
|
3726
3737
|
},
|
|
3727
3738
|
/* @__PURE__ */ React65.createElement(ControlLabel, null, label),
|
|
3728
3739
|
/* @__PURE__ */ React65.createElement(RestrictedLinkInfotip, { isVisible: !isActive, linkInLinkRestriction }, /* @__PURE__ */ React65.createElement(
|
|
3729
|
-
|
|
3740
|
+
import_ui49.IconButton,
|
|
3730
3741
|
{
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
}
|
|
3742
|
+
size: SIZE7,
|
|
3743
|
+
onClick: onEnabledChange,
|
|
3744
|
+
"aria-label": (0, import_i18n23.__)("Toggle link", "elementor"),
|
|
3745
|
+
disabled: shouldDisableAddingLink
|
|
3746
|
+
},
|
|
3747
|
+
isActive ? /* @__PURE__ */ React65.createElement(import_icons15.MinusIcon, { fontSize: SIZE7 }) : /* @__PURE__ */ React65.createElement(import_icons15.PlusIcon, { fontSize: SIZE7 })
|
|
3736
3748
|
))
|
|
3737
3749
|
), /* @__PURE__ */ React65.createElement(import_ui49.Collapse, { in: isActive, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React65.createElement(import_ui49.Stack, { gap: 1.5 }, /* @__PURE__ */ React65.createElement(PropKeyProvider, { bind: "destination" }, /* @__PURE__ */ React65.createElement(
|
|
3738
3750
|
QueryControl,
|
|
@@ -3746,9 +3758,6 @@ var LinkControl = createControl((props) => {
|
|
|
3746
3758
|
}
|
|
3747
3759
|
)), /* @__PURE__ */ React65.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React65.createElement(import_ui49.Grid, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React65.createElement(import_ui49.Grid, { item: true }, /* @__PURE__ */ React65.createElement(ControlFormLabel, null, (0, import_i18n23.__)("Open in a new tab", "elementor"))), /* @__PURE__ */ React65.createElement(import_ui49.Grid, { item: true, sx: { marginInlineEnd: -1 } }, /* @__PURE__ */ React65.createElement(SwitchControl, null))))))));
|
|
3748
3760
|
});
|
|
3749
|
-
var ToggleIconControl = ({ disabled, active, onIconClick, label }) => {
|
|
3750
|
-
return /* @__PURE__ */ React65.createElement(import_ui49.IconButton, { size: SIZE7, onClick: onIconClick, "aria-label": label, disabled }, active ? /* @__PURE__ */ React65.createElement(import_icons15.MinusIcon, { fontSize: SIZE7 }) : /* @__PURE__ */ React65.createElement(import_icons15.PlusIcon, { fontSize: SIZE7 }));
|
|
3751
|
-
};
|
|
3752
3761
|
|
|
3753
3762
|
// src/controls/html-tag-control.tsx
|
|
3754
3763
|
var React67 = __toESM(require("react"));
|
|
@@ -6515,6 +6524,7 @@ var InlineEditor = React100.forwardRef((props, ref) => {
|
|
|
6515
6524
|
const {
|
|
6516
6525
|
value,
|
|
6517
6526
|
setValue,
|
|
6527
|
+
placeholder = null,
|
|
6518
6528
|
editorProps = {},
|
|
6519
6529
|
elementClasses = "",
|
|
6520
6530
|
autofocus = false,
|
|
@@ -6600,7 +6610,9 @@ var InlineEditor = React100.forwardRef((props, ref) => {
|
|
|
6600
6610
|
},
|
|
6601
6611
|
attributes: {
|
|
6602
6612
|
...editorProps.attributes ?? {},
|
|
6603
|
-
role: "textbox"
|
|
6613
|
+
role: "textbox",
|
|
6614
|
+
...placeholder ? { "data-placeholder": placeholder } : {},
|
|
6615
|
+
...value === null || value === "" ? { class: "is-empty" } : {}
|
|
6604
6616
|
}
|
|
6605
6617
|
},
|
|
6606
6618
|
onCreate: onEditorCreate ? ({ editor: mountedEditor }) => onEditorCreate(mountedEditor) : void 0,
|
|
@@ -6640,7 +6652,7 @@ var InlineEditingControl = createControl(
|
|
|
6640
6652
|
attributes,
|
|
6641
6653
|
props
|
|
6642
6654
|
}) => {
|
|
6643
|
-
const { value, setValue } = useBoundProp(import_editor_props53.htmlV3PropTypeUtil);
|
|
6655
|
+
const { value, setValue, placeholder } = useBoundProp(import_editor_props53.htmlV3PropTypeUtil);
|
|
6644
6656
|
const content = import_editor_props53.stringPropTypeUtil.extract(value?.content ?? null) ?? "";
|
|
6645
6657
|
const debouncedParse = (0, import_react57.useMemo)(
|
|
6646
6658
|
() => (0, import_utils8.debounce)((html) => {
|
|
@@ -6692,6 +6704,13 @@ var InlineEditingControl = createControl(
|
|
|
6692
6704
|
"& .elementor-inline-editor-reset": {
|
|
6693
6705
|
margin: 0,
|
|
6694
6706
|
padding: 0
|
|
6707
|
+
},
|
|
6708
|
+
"&.is-empty::before": {
|
|
6709
|
+
content: "attr(data-placeholder)",
|
|
6710
|
+
color: "text.tertiary",
|
|
6711
|
+
pointerEvents: "none",
|
|
6712
|
+
position: "absolute",
|
|
6713
|
+
opacity: 0.6
|
|
6695
6714
|
}
|
|
6696
6715
|
},
|
|
6697
6716
|
".strip-styles *": {
|
|
@@ -6702,7 +6721,14 @@ var InlineEditingControl = createControl(
|
|
|
6702
6721
|
...attributes,
|
|
6703
6722
|
...props
|
|
6704
6723
|
},
|
|
6705
|
-
/* @__PURE__ */ React101.createElement(
|
|
6724
|
+
/* @__PURE__ */ React101.createElement(
|
|
6725
|
+
InlineEditor,
|
|
6726
|
+
{
|
|
6727
|
+
value: content,
|
|
6728
|
+
setValue: handleChange,
|
|
6729
|
+
placeholder: placeholder?.content?.value ?? null
|
|
6730
|
+
}
|
|
6731
|
+
)
|
|
6706
6732
|
));
|
|
6707
6733
|
}
|
|
6708
6734
|
);
|