@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 CHANGED
@@ -279,12 +279,12 @@ type SelectOption = {
279
279
  value: StringPropValue['value'];
280
280
  disabled?: boolean;
281
281
  };
282
- type Props$5 = {
282
+ type Props$5 = ControlProps<{
283
283
  options: SelectOption[];
284
284
  onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
285
285
  fallbackLabels?: Record<string, string>;
286
- };
287
- declare const HtmlTagControl: ControlComponent$1<({ options, onChange, fallbackLabels }: Props$5) => React$1.JSX.Element>;
286
+ }>;
287
+ declare const HtmlTagControl: ControlComponent$1<(props: Props$5) => React$1.JSX.Element>;
288
288
 
289
289
  type Props$4 = {
290
290
  queryOptions: {
package/dist/index.d.ts CHANGED
@@ -279,12 +279,12 @@ type SelectOption = {
279
279
  value: StringPropValue['value'];
280
280
  disabled?: boolean;
281
281
  };
282
- type Props$5 = {
282
+ type Props$5 = ControlProps<{
283
283
  options: SelectOption[];
284
284
  onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
285
285
  fallbackLabels?: Record<string, string>;
286
- };
287
- declare const HtmlTagControl: ControlComponent$1<({ options, onChange, fallbackLabels }: Props$5) => React$1.JSX.Element>;
286
+ }>;
287
+ declare const HtmlTagControl: ControlComponent$1<(props: Props$5) => React$1.JSX.Element>;
288
288
 
289
289
  type Props$4 = {
290
290
  queryOptions: {
package/dist/index.js CHANGED
@@ -3813,14 +3813,20 @@ var ConditionalControlInfotip = React66.forwardRef(
3813
3813
 
3814
3814
  // src/controls/html-tag-control.tsx
3815
3815
  var StyledSelect = (0, import_ui52.styled)(import_ui52.Select)(() => ({ ".MuiSelect-select.Mui-disabled": { cursor: "not-allowed" } }));
3816
- var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} }) => {
3816
+ var HtmlTagControl = createControl((props) => {
3817
+ const {
3818
+ options,
3819
+ onChange,
3820
+ fallbackLabels = {},
3821
+ context: { elementId }
3822
+ } = props;
3817
3823
  const { value, setValue, disabled, placeholder } = useBoundProp(import_editor_props25.stringPropTypeUtil);
3818
3824
  const handleChange = (event) => {
3819
3825
  const newValue = event.target.value || null;
3820
3826
  onChange?.(newValue, value);
3821
3827
  setValue(newValue);
3822
3828
  };
3823
- const elementLabel = (0, import_editor_elements3.getElementLabel)() ?? "element";
3829
+ const elementLabel = (0, import_editor_elements3.getElementLabel)(elementId) ?? "element";
3824
3830
  const infoTipProps = {
3825
3831
  title: (0, import_i18n24.__)("HTML Tag", "elementor"),
3826
3832
  /* translators: %s is the element name. */
@@ -3854,7 +3860,7 @@ var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} })
3854
3860
  disabled,
3855
3861
  fullWidth: true
3856
3862
  },
3857
- options.map(({ label, ...props }) => /* @__PURE__ */ React67.createElement(import_editor_ui7.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, label))
3863
+ options.map(({ label, ...itemProps }) => /* @__PURE__ */ React67.createElement(import_editor_ui7.MenuListItem, { key: itemProps.value, ...itemProps, value: itemProps.value ?? "" }, label))
3858
3864
  )));
3859
3865
  });
3860
3866
 
@@ -6515,6 +6521,14 @@ function isEmpty(value = "") {
6515
6521
  pseudoElement.innerHTML = value;
6516
6522
  return !pseudoElement.textContent?.length;
6517
6523
  }
6524
+ function htmlToPlainText(html) {
6525
+ if (!html) {
6526
+ return "";
6527
+ }
6528
+ const normalizedHtml = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>\s*<p[^>]*>/gi, "\n");
6529
+ const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
6530
+ return doc.body.textContent ?? "";
6531
+ }
6518
6532
 
6519
6533
  // src/components/inline-editor.tsx
6520
6534
  var ITALIC_KEYBOARD_SHORTCUT = "i";
@@ -6611,7 +6625,7 @@ var InlineEditor = React100.forwardRef((props, ref) => {
6611
6625
  attributes: {
6612
6626
  ...editorProps.attributes ?? {},
6613
6627
  role: "textbox",
6614
- ...placeholder ? { "data-placeholder": placeholder } : {},
6628
+ ...placeholder ? { "data-placeholder": htmlToPlainText(placeholder) } : {},
6615
6629
  ...value === null || value === "" ? { class: "is-empty" } : {}
6616
6630
  }
6617
6631
  },