@elementor/editor-controls 3.33.0-294 → 3.33.0-295

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
@@ -5914,6 +5914,7 @@ import { htmlPropTypeUtil } from "@elementor/editor-props";
5914
5914
 
5915
5915
  // src/components/inline-editor.tsx
5916
5916
  import * as React99 from "react";
5917
+ import { useEffect as useEffect9, useRef as useRef24 } from "react";
5917
5918
  import { Box as Box21 } from "@elementor/ui";
5918
5919
  import Bold from "@tiptap/extension-bold";
5919
5920
  import Document from "@tiptap/extension-document";
@@ -5923,6 +5924,16 @@ import Strike from "@tiptap/extension-strike";
5923
5924
  import Text from "@tiptap/extension-text";
5924
5925
  import Underline from "@tiptap/extension-underline";
5925
5926
  import { EditorContent, useEditor } from "@tiptap/react";
5927
+ var useOnUpdate = (callback, dependencies) => {
5928
+ const hasMounted = useRef24(false);
5929
+ useEffect9(() => {
5930
+ if (hasMounted.current) {
5931
+ callback();
5932
+ } else {
5933
+ hasMounted.current = true;
5934
+ }
5935
+ }, dependencies);
5936
+ };
5926
5937
  var InlineEditor = React99.forwardRef(
5927
5938
  ({ value, setValue, attributes = {}, sx }, ref) => {
5928
5939
  const editor = useEditor({
@@ -5946,6 +5957,15 @@ var InlineEditor = React99.forwardRef(
5946
5957
  content: value,
5947
5958
  onUpdate: ({ editor: updatedEditor }) => setValue(updatedEditor.getHTML())
5948
5959
  });
5960
+ useOnUpdate(() => {
5961
+ if (!editor) {
5962
+ return;
5963
+ }
5964
+ const currentContent = editor.getHTML();
5965
+ if (currentContent !== value) {
5966
+ editor.commands.setContent(value, { emitUpdate: false });
5967
+ }
5968
+ }, [editor, value]);
5949
5969
  return /* @__PURE__ */ React99.createElement(
5950
5970
  Box21,
5951
5971
  {
@@ -5998,7 +6018,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
5998
6018
 
5999
6019
  // src/components/repeater/repeater.tsx
6000
6020
  import * as React102 from "react";
6001
- import { useEffect as useEffect9, useState as useState16 } from "react";
6021
+ import { useEffect as useEffect10, useState as useState16 } from "react";
6002
6022
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
6003
6023
  import {
6004
6024
  bindPopover as bindPopover7,
@@ -6170,7 +6190,7 @@ var usePopover = (openOnMount, onOpen) => {
6170
6190
  const [ref, setRef] = useState16(null);
6171
6191
  const popoverState = usePopupState8({ variant: "popover" });
6172
6192
  const popoverProps = bindPopover7(popoverState);
6173
- useEffect9(() => {
6193
+ useEffect10(() => {
6174
6194
  if (openOnMount && ref) {
6175
6195
  popoverState.open(ref);
6176
6196
  onOpen?.();