@elementor/editor-controls 4.1.0-747 → 4.1.0-749
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/inline-editor.tsx +2 -2
- package/src/controls/html-tag-control.tsx +14 -6
- package/src/utils/inline-editing.ts +11 -0
package/dist/index.mjs
CHANGED
|
@@ -3744,14 +3744,20 @@ var ConditionalControlInfotip = React66.forwardRef(
|
|
|
3744
3744
|
|
|
3745
3745
|
// src/controls/html-tag-control.tsx
|
|
3746
3746
|
var StyledSelect = styled6(Select2)(() => ({ ".MuiSelect-select.Mui-disabled": { cursor: "not-allowed" } }));
|
|
3747
|
-
var HtmlTagControl = createControl((
|
|
3747
|
+
var HtmlTagControl = createControl((props) => {
|
|
3748
|
+
const {
|
|
3749
|
+
options,
|
|
3750
|
+
onChange,
|
|
3751
|
+
fallbackLabels = {},
|
|
3752
|
+
context: { elementId }
|
|
3753
|
+
} = props;
|
|
3748
3754
|
const { value, setValue, disabled, placeholder } = useBoundProp(stringPropTypeUtil8);
|
|
3749
3755
|
const handleChange = (event) => {
|
|
3750
3756
|
const newValue = event.target.value || null;
|
|
3751
3757
|
onChange?.(newValue, value);
|
|
3752
3758
|
setValue(newValue);
|
|
3753
3759
|
};
|
|
3754
|
-
const elementLabel = getElementLabel() ?? "element";
|
|
3760
|
+
const elementLabel = getElementLabel(elementId) ?? "element";
|
|
3755
3761
|
const infoTipProps = {
|
|
3756
3762
|
title: __24("HTML Tag", "elementor"),
|
|
3757
3763
|
/* translators: %s is the element name. */
|
|
@@ -3785,7 +3791,7 @@ var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} })
|
|
|
3785
3791
|
disabled,
|
|
3786
3792
|
fullWidth: true
|
|
3787
3793
|
},
|
|
3788
|
-
options.map(({ label, ...
|
|
3794
|
+
options.map(({ label, ...itemProps }) => /* @__PURE__ */ React67.createElement(MenuListItem3, { key: itemProps.value, ...itemProps, value: itemProps.value ?? "" }, label))
|
|
3789
3795
|
)));
|
|
3790
3796
|
});
|
|
3791
3797
|
|
|
@@ -6496,6 +6502,14 @@ function isEmpty(value = "") {
|
|
|
6496
6502
|
pseudoElement.innerHTML = value;
|
|
6497
6503
|
return !pseudoElement.textContent?.length;
|
|
6498
6504
|
}
|
|
6505
|
+
function htmlToPlainText(html) {
|
|
6506
|
+
if (!html) {
|
|
6507
|
+
return "";
|
|
6508
|
+
}
|
|
6509
|
+
const normalizedHtml = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>\s*<p[^>]*>/gi, "\n");
|
|
6510
|
+
const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
|
|
6511
|
+
return doc.body.textContent ?? "";
|
|
6512
|
+
}
|
|
6499
6513
|
|
|
6500
6514
|
// src/components/inline-editor.tsx
|
|
6501
6515
|
var ITALIC_KEYBOARD_SHORTCUT = "i";
|
|
@@ -6592,7 +6606,7 @@ var InlineEditor = React100.forwardRef((props, ref) => {
|
|
|
6592
6606
|
attributes: {
|
|
6593
6607
|
...editorProps.attributes ?? {},
|
|
6594
6608
|
role: "textbox",
|
|
6595
|
-
...placeholder ? { "data-placeholder": placeholder } : {},
|
|
6609
|
+
...placeholder ? { "data-placeholder": htmlToPlainText(placeholder) } : {},
|
|
6596
6610
|
...value === null || value === "" ? { class: "is-empty" } : {}
|
|
6597
6611
|
}
|
|
6598
6612
|
},
|