@elementor/editor-controls 4.3.0-1047 → 4.3.0-1048

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.mjs CHANGED
@@ -7944,10 +7944,9 @@ var BoundTimeStringControl = ({ bind, ariaLabel }) => {
7944
7944
 
7945
7945
  // src/controls/inline-editing-control.tsx
7946
7946
  import * as React115 from "react";
7947
- import { useCallback as useCallback4, useEffect as useEffect18, useMemo as useMemo17 } from "react";
7948
- import { htmlV3PropTypeUtil, parseHtmlChildren, stringPropTypeUtil as stringPropTypeUtil20 } from "@elementor/editor-props";
7947
+ import { useCallback as useCallback4 } from "react";
7948
+ import { escapedHtmlPropTypeUtil as escapedHtmlPropTypeUtil2 } from "@elementor/editor-props";
7949
7949
  import { Box as Box25 } from "@elementor/ui";
7950
- import { debounce as debounce3 } from "@elementor/utils";
7951
7950
 
7952
7951
  // src/components/inline-editor.tsx
7953
7952
  import * as React114 from "react";
@@ -7968,6 +7967,7 @@ import Underline from "@tiptap/extension-underline";
7968
7967
  import { EditorContent, useEditor } from "@tiptap/react";
7969
7968
 
7970
7969
  // src/utils/inline-editing.ts
7970
+ import { escapedHtmlPropTypeUtil, htmlV3PropTypeUtil, stringPropTypeUtil as stringPropTypeUtil20 } from "@elementor/editor-props";
7971
7971
  function isEmpty(value = "") {
7972
7972
  if (!value) {
7973
7973
  return true;
@@ -7984,6 +7984,13 @@ function htmlToPlainText(html) {
7984
7984
  const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
7985
7985
  return doc.body.textContent ?? "";
7986
7986
  }
7987
+ function extractInlineHtmlContent(propValue) {
7988
+ if (escapedHtmlPropTypeUtil.isValid(propValue)) {
7989
+ return escapedHtmlPropTypeUtil.extract(propValue) ?? "";
7990
+ }
7991
+ const htmlV3 = htmlV3PropTypeUtil.extract(propValue);
7992
+ return stringPropTypeUtil20.extract(htmlV3?.content ?? null) ?? "";
7993
+ }
7987
7994
 
7988
7995
  // src/components/inline-editor.tsx
7989
7996
  var ITALIC_KEYBOARD_SHORTCUT = "i";
@@ -8114,37 +8121,22 @@ var useOnUpdate = (callback, dependencies) => {
8114
8121
  };
8115
8122
 
8116
8123
  // src/controls/inline-editing-control.tsx
8117
- var CHILDREN_PARSE_DEBOUNCE_MS = 300;
8118
8124
  var InlineEditingControl = createControl(
8119
8125
  ({
8120
8126
  sx,
8121
8127
  attributes,
8122
8128
  props
8123
8129
  }) => {
8124
- const { value, setValue, placeholder } = useBoundProp(htmlV3PropTypeUtil);
8125
- const content = stringPropTypeUtil20.extract(value?.content ?? null) ?? "";
8126
- const debouncedParse = useMemo17(
8127
- () => debounce3((html) => {
8128
- const parsed = parseHtmlChildren(html);
8129
- setValue({
8130
- content: parsed.content ? stringPropTypeUtil20.create(parsed.content) : null,
8131
- children: parsed.children
8132
- });
8133
- }, CHILDREN_PARSE_DEBOUNCE_MS),
8134
- [setValue]
8135
- );
8130
+ const { setValue, placeholder, value } = useBoundProp(escapedHtmlPropTypeUtil2);
8131
+ const { value: rawValue } = usePropKeyContext();
8132
+ const content = value ?? extractInlineHtmlContent(rawValue);
8136
8133
  const handleChange = useCallback4(
8137
8134
  (newValue) => {
8138
8135
  const html = newValue ?? "";
8139
- setValue({
8140
- content: html ? stringPropTypeUtil20.create(html) : null,
8141
- children: value?.children ?? []
8142
- });
8143
- debouncedParse(html);
8136
+ setValue(html);
8144
8137
  },
8145
- [setValue, value?.children, debouncedParse]
8138
+ [setValue]
8146
8139
  );
8147
- useEffect18(() => () => debouncedParse.cancel(), [debouncedParse]);
8148
8140
  return /* @__PURE__ */ React115.createElement(ControlActions, null, /* @__PURE__ */ React115.createElement(
8149
8141
  Box25,
8150
8142
  {
@@ -8190,14 +8182,7 @@ var InlineEditingControl = createControl(
8190
8182
  ...attributes,
8191
8183
  ...props
8192
8184
  },
8193
- /* @__PURE__ */ React115.createElement(
8194
- InlineEditor,
8195
- {
8196
- value: content,
8197
- setValue: handleChange,
8198
- placeholder: placeholder?.content?.value ?? null
8199
- }
8200
- )
8185
+ /* @__PURE__ */ React115.createElement(InlineEditor, { value: content, setValue: handleChange, placeholder: placeholder ?? null })
8201
8186
  ));
8202
8187
  }
8203
8188
  );
@@ -8303,7 +8288,7 @@ function useFormFieldSuggestions(options) {
8303
8288
 
8304
8289
  // src/controls/email-form-action-control/email-chips-field.tsx
8305
8290
  import * as React116 from "react";
8306
- import { useMemo as useMemo18, useState as useState19 } from "react";
8291
+ import { useMemo as useMemo17, useState as useState19 } from "react";
8307
8292
  import { stringArrayPropTypeUtil as stringArrayPropTypeUtil3, stringPropTypeUtil as stringPropTypeUtil22 } from "@elementor/editor-props";
8308
8293
  import { Autocomplete as Autocomplete4, Grid as Grid32, TextField as TextField11 } from "@elementor/ui";
8309
8294
 
@@ -8344,7 +8329,7 @@ var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
8344
8329
  const [inputValue, setInputValue] = useState19("");
8345
8330
  const items2 = value || [];
8346
8331
  const selectedValues = items2.map((item) => stringPropTypeUtil22.extract(item)).filter((val) => val !== null);
8347
- const suggestionOptions = useMemo18(
8332
+ const suggestionOptions = useMemo17(
8348
8333
  () => suggestions.map((suggestion) => `[${suggestion.value}]`),
8349
8334
  [suggestions]
8350
8335
  );
@@ -8699,7 +8684,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
8699
8684
 
8700
8685
  // src/components/repeater/repeater.tsx
8701
8686
  import * as React126 from "react";
8702
- import { useEffect as useEffect19, useState as useState21 } from "react";
8687
+ import { useEffect as useEffect18, useState as useState21 } from "react";
8703
8688
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon5, XIcon as XIcon4 } from "@elementor/icons";
8704
8689
  import {
8705
8690
  bindPopover as bindPopover8,
@@ -8908,7 +8893,7 @@ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
8908
8893
  const [ref, setRef] = useState21(null);
8909
8894
  const popoverState = usePopupState10({ variant: "popover" });
8910
8895
  const popoverProps = bindPopover8(popoverState);
8911
- useEffect19(() => {
8896
+ useEffect18(() => {
8912
8897
  if (openOnMount && ref) {
8913
8898
  popoverState.open(ref);
8914
8899
  onOpen?.();
@@ -8928,7 +8913,7 @@ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
8928
8913
 
8929
8914
  // src/components/inline-editor-toolbar.tsx
8930
8915
  import * as React128 from "react";
8931
- import { useEffect as useEffect21, useMemo as useMemo19, useRef as useRef32, useState as useState22 } from "react";
8916
+ import { useEffect as useEffect20, useMemo as useMemo18, useRef as useRef32, useState as useState22 } from "react";
8932
8917
  import { getContainer as getContainer3, getElementSetting } from "@elementor/editor-elements";
8933
8918
  import {
8934
8919
  BoldIcon,
@@ -8954,7 +8939,7 @@ import { __ as __64 } from "@wordpress/i18n";
8954
8939
 
8955
8940
  // src/components/url-popover.tsx
8956
8941
  import * as React127 from "react";
8957
- import { useEffect as useEffect20, useRef as useRef31 } from "react";
8942
+ import { useEffect as useEffect19, useRef as useRef31 } from "react";
8958
8943
  import { ExternalLinkIcon } from "@elementor/icons";
8959
8944
  import { bindPopover as bindPopover9, Popover as Popover8, Stack as Stack23, TextField as TextField13, ToggleButton as ToggleButton2, Tooltip as Tooltip13 } from "@elementor/ui";
8960
8945
  import { __ as __63 } from "@wordpress/i18n";
@@ -8968,7 +8953,7 @@ var UrlPopover = ({
8968
8953
  onToggleNewTab
8969
8954
  }) => {
8970
8955
  const inputRef = useRef31(null);
8971
- useEffect20(() => {
8956
+ useEffect19(() => {
8972
8957
  if (popupState.isOpen) {
8973
8958
  requestAnimationFrame(() => inputRef.current?.focus());
8974
8959
  }
@@ -9027,7 +9012,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
9027
9012
  editor,
9028
9013
  selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
9029
9014
  });
9030
- const formatButtonsList = useMemo19(() => {
9015
+ const formatButtonsList = useMemo18(() => {
9031
9016
  const buttons = Object.values(formatButtons);
9032
9017
  if (isElementClickable) {
9033
9018
  return buttons.filter((button) => button.action !== "link");
@@ -9064,7 +9049,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
9064
9049
  }
9065
9050
  linkPopupState.close();
9066
9051
  };
9067
- useEffect21(() => {
9052
+ useEffect20(() => {
9068
9053
  editor?.commands?.focus();
9069
9054
  }, [editor]);
9070
9055
  return /* @__PURE__ */ React128.createElement(
@@ -9374,7 +9359,7 @@ var hasValue = (value) => {
9374
9359
  };
9375
9360
 
9376
9361
  // src/hooks/use-font-families.ts
9377
- import { useMemo as useMemo20 } from "react";
9362
+ import { useMemo as useMemo19 } from "react";
9378
9363
  import { getElementorConfig } from "@elementor/editor-v1-adapters";
9379
9364
  var getFontControlConfig = () => {
9380
9365
  const { controls } = getElementorConfig();
@@ -9382,7 +9367,7 @@ var getFontControlConfig = () => {
9382
9367
  };
9383
9368
  var useFontFamilies = () => {
9384
9369
  const { groups, options } = getFontControlConfig();
9385
- return useMemo20(() => {
9370
+ return useMemo19(() => {
9386
9371
  if (!groups || !options) {
9387
9372
  return [];
9388
9373
  }