@tarviks/lexical-rich-editor 1.0.5 → 1.0.7

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var utils = require('@lexical/utils');
4
- var React6 = require('react');
4
+ var React9 = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
7
7
  var useLexicalEditable = require('@lexical/react/useLexicalEditable');
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
50
50
  return Object.freeze(n);
51
51
  }
52
52
 
53
- var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
53
+ var React9__namespace = /*#__PURE__*/_interopNamespace(React9);
54
54
 
55
55
  var __defProp = Object.defineProperty;
56
56
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -84,12 +84,12 @@ var init_ImageResizer = __esm({
84
84
  setShowCaption,
85
85
  captionsEnabled
86
86
  }) => {
87
- const controlWrapperRef = React6.useRef(null);
88
- const userSelect = React6.useRef({
87
+ const controlWrapperRef = React9.useRef(null);
88
+ const userSelect = React9.useRef({
89
89
  priority: "",
90
90
  value: "default"
91
91
  });
92
- const positioningRef = React6.useRef({
92
+ const positioningRef = React9.useRef({
93
93
  currentHeight: 0,
94
94
  currentWidth: 0,
95
95
  direction: 0,
@@ -420,15 +420,15 @@ var init_ImageComponent = __esm({
420
420
  };
421
421
  ImageComponent = ({ src, altText, nodeKey, width, height, maxWidth, resizable, showCaption, caption, captionsEnabled }) => {
422
422
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection.useLexicalNodeSelection(nodeKey);
423
- const [selection, setSelection] = React6.useState(null);
424
- const [isLoadError, setIsLoadError] = React6.useState(false);
425
- const [isResizing, setIsResizing] = React6.useState(false);
423
+ const [selection, setSelection] = React9.useState(null);
424
+ const [isLoadError, setIsLoadError] = React9.useState(false);
425
+ const [isResizing, setIsResizing] = React9.useState(false);
426
426
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
427
- const activeEditorRef = React6.useRef(null);
428
- const buttonRef = React6.useRef(null);
429
- const imageRef = React6.useRef(null);
427
+ const activeEditorRef = React9.useRef(null);
428
+ const buttonRef = React9.useRef(null);
429
+ const imageRef = React9.useRef(null);
430
430
  const isEditable = useLexicalEditable.useLexicalEditable();
431
- const $onDelete = React6.useCallback(
431
+ const $onDelete = React9.useCallback(
432
432
  (payload) => {
433
433
  const deleteSelection = lexical.$getSelection();
434
434
  if (isSelected && lexical.$isNodeSelection(deleteSelection)) {
@@ -444,7 +444,7 @@ var init_ImageComponent = __esm({
444
444
  },
445
445
  [isSelected]
446
446
  );
447
- const $onEnter = React6.useCallback(
447
+ const $onEnter = React9.useCallback(
448
448
  (event) => {
449
449
  const latestSelection = lexical.$getSelection();
450
450
  const buttonElem = buttonRef.current;
@@ -464,7 +464,7 @@ var init_ImageComponent = __esm({
464
464
  },
465
465
  [caption, isSelected, showCaption]
466
466
  );
467
- const $onEscape = React6.useCallback(
467
+ const $onEscape = React9.useCallback(
468
468
  (event) => {
469
469
  if (activeEditorRef.current === caption || buttonRef.current === event.target) {
470
470
  lexical.$setSelection(null);
@@ -481,7 +481,7 @@ var init_ImageComponent = __esm({
481
481
  },
482
482
  [caption, editor, setSelected]
483
483
  );
484
- const onClick = React6.useCallback(
484
+ const onClick = React9.useCallback(
485
485
  (payload) => {
486
486
  const event = payload;
487
487
  if (isResizing) {
@@ -500,7 +500,7 @@ var init_ImageComponent = __esm({
500
500
  },
501
501
  [isResizing, isSelected, setSelected, clearSelection]
502
502
  );
503
- const onRightClick = React6.useCallback(
503
+ const onRightClick = React9.useCallback(
504
504
  (event) => {
505
505
  editor.getEditorState().read(() => {
506
506
  const latestSelection = lexical.$getSelection();
@@ -515,7 +515,7 @@ var init_ImageComponent = __esm({
515
515
  },
516
516
  [editor]
517
517
  );
518
- React6.useEffect(() => {
518
+ React9.useEffect(() => {
519
519
  const rootElement = editor.getRootElement();
520
520
  const unregister = utils.mergeRegister(
521
521
  editor.registerUpdateListener(({ editorState }) => {
@@ -614,7 +614,7 @@ var init_ImageComponent = __esm({
614
614
  };
615
615
  const draggable = isSelected && lexical.$isNodeSelection(selection) && !isResizing;
616
616
  const isFocused = (isSelected || isResizing) && isEditable;
617
- return /* @__PURE__ */ jsxRuntime.jsx(React6.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
617
+ return /* @__PURE__ */ jsxRuntime.jsx(React9.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
618
618
  /* @__PURE__ */ jsxRuntime.jsx("div", { draggable, children: isLoadError ? /* @__PURE__ */ jsxRuntime.jsx(BrokenImage, {}) : /* @__PURE__ */ jsxRuntime.jsx(
619
619
  LazyImage,
620
620
  {
@@ -668,7 +668,7 @@ function parseDimFromStyleOrAttr(img3) {
668
668
  var ImageComponent2, isGoogleDocCheckboxImg, $convertImageElement, ImageNode, $createImageNode, $isImageNode;
669
669
  var init_ImageNode = __esm({
670
670
  "src/Nodes/ImageNode.tsx"() {
671
- ImageComponent2 = React6__namespace.lazy(() => Promise.resolve().then(() => (init_ImageComponent(), ImageComponent_exports)));
671
+ ImageComponent2 = React9__namespace.lazy(() => Promise.resolve().then(() => (init_ImageComponent(), ImageComponent_exports)));
672
672
  isGoogleDocCheckboxImg = (img3) => {
673
673
  return img3.parentElement != null && img3.parentElement.tagName === "LI" && img3.previousSibling === null && img3.getAttribute("aria-roledescription") === "checkbox";
674
674
  };
@@ -912,13 +912,13 @@ var init_InlineImageComponent = __esm({
912
912
  };
913
913
  InlineImageComponent = ({ src, altText, nodeKey, width, height, showCaption, caption, position }) => {
914
914
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection.useLexicalNodeSelection(nodeKey);
915
- const [selection, setSelection] = React6.useState(null);
916
- const activeEditorRef = React6.useRef(null);
917
- const imageRef = React6.useRef(null);
918
- const buttonRef = React6.useRef(null);
915
+ const [selection, setSelection] = React9.useState(null);
916
+ const activeEditorRef = React9.useRef(null);
917
+ const imageRef = React9.useRef(null);
918
+ const buttonRef = React9.useRef(null);
919
919
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
920
920
  const isEditable = useLexicalEditable.useLexicalEditable();
921
- const $onDelete = React6.useCallback(
921
+ const $onDelete = React9.useCallback(
922
922
  (payload) => {
923
923
  const deleteSelection = lexical.$getSelection();
924
924
  if (isSelected && lexical.$isNodeSelection(deleteSelection)) {
@@ -936,7 +936,7 @@ var init_InlineImageComponent = __esm({
936
936
  },
937
937
  [isSelected]
938
938
  );
939
- const $onEnter = React6.useCallback(
939
+ const $onEnter = React9.useCallback(
940
940
  (event) => {
941
941
  const latestSelection = lexical.$getSelection();
942
942
  const buttonElem = buttonRef.current;
@@ -956,7 +956,7 @@ var init_InlineImageComponent = __esm({
956
956
  },
957
957
  [caption, isSelected, showCaption]
958
958
  );
959
- const $onEscape = React6.useCallback(
959
+ const $onEscape = React9.useCallback(
960
960
  (event) => {
961
961
  if (activeEditorRef.current === caption || buttonRef.current === event.target) {
962
962
  lexical.$setSelection(null);
@@ -973,7 +973,7 @@ var init_InlineImageComponent = __esm({
973
973
  },
974
974
  [caption, editor, setSelected]
975
975
  );
976
- React6.useEffect(() => {
976
+ React9.useEffect(() => {
977
977
  let isMounted = true;
978
978
  const unregister = utils.mergeRegister(
979
979
  editor.registerUpdateListener(({ editorState }) => {
@@ -1050,7 +1050,7 @@ var init_InlineImageComponent = __esm({
1050
1050
  ]);
1051
1051
  const draggable = isSelected && lexical.$isNodeSelection(selection);
1052
1052
  const isFocused = isSelected && isEditable;
1053
- return /* @__PURE__ */ jsxRuntime.jsx(React6.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx("span", { draggable, children: /* @__PURE__ */ jsxRuntime.jsx(
1053
+ return /* @__PURE__ */ jsxRuntime.jsx(React9.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx("span", { draggable, children: /* @__PURE__ */ jsxRuntime.jsx(
1054
1054
  LazyImage2,
1055
1055
  {
1056
1056
  className: isFocused ? `focused ${lexical.$isNodeSelection(selection) ? "draggable" : ""}` : null,
@@ -1069,7 +1069,7 @@ var init_InlineImageComponent = __esm({
1069
1069
  var InlineImageComponent2, $convertInlineImageElement, InlineImageNode, $createInlineImageNode, $isInlineImageNode;
1070
1070
  var init_InlineImageNode = __esm({
1071
1071
  "src/Nodes/InlineImageNode.tsx"() {
1072
- InlineImageComponent2 = React6__namespace.lazy(() => Promise.resolve().then(() => (init_InlineImageComponent(), InlineImageComponent_exports)));
1072
+ InlineImageComponent2 = React9__namespace.lazy(() => Promise.resolve().then(() => (init_InlineImageComponent(), InlineImageComponent_exports)));
1073
1073
  $convertInlineImageElement = (domNode) => {
1074
1074
  if (lexical.isHTMLElement(domNode) && domNode.nodeName === "IMG") {
1075
1075
  const { alt: altText, src, width, height } = domNode;
@@ -1364,7 +1364,7 @@ init_InlineImageNode();
1364
1364
  var PageBreakComponent = ({ nodeKey }) => {
1365
1365
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
1366
1366
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection.useLexicalNodeSelection(nodeKey);
1367
- const $onDelete = React6.useCallback(
1367
+ const $onDelete = React9.useCallback(
1368
1368
  (event) => {
1369
1369
  event.preventDefault();
1370
1370
  const deleteSelection = lexical.$getSelection();
@@ -1379,7 +1379,7 @@ var PageBreakComponent = ({ nodeKey }) => {
1379
1379
  },
1380
1380
  [isSelected]
1381
1381
  );
1382
- React6.useEffect(() => {
1382
+ React9.useEffect(() => {
1383
1383
  return utils.mergeRegister(
1384
1384
  editor.registerCommand(
1385
1385
  lexical.CLICK_COMMAND,
@@ -1408,7 +1408,7 @@ var PageBreakComponent = ({ nodeKey }) => {
1408
1408
  )
1409
1409
  );
1410
1410
  }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected]);
1411
- React6.useEffect(() => {
1411
+ React9.useEffect(() => {
1412
1412
  const pbElem = editor.getElementByKey(nodeKey);
1413
1413
  if (pbElem !== null) {
1414
1414
  pbElem.className = isSelected ? "selected" : "";
@@ -1550,7 +1550,7 @@ function VideoResizer({
1550
1550
  onResizeStart,
1551
1551
  onResizeEnd
1552
1552
  }) {
1553
- const resizeState = React6__namespace.useRef(null);
1553
+ const resizeState = React9__namespace.useRef(null);
1554
1554
  const startResize = (e, dir) => {
1555
1555
  e.preventDefault();
1556
1556
  e.stopPropagation();
@@ -1643,9 +1643,9 @@ function YouTubeComponent({
1643
1643
  height,
1644
1644
  editor
1645
1645
  }) {
1646
- const containerRef = React6__namespace.useRef(null);
1647
- const [isHovered, setIsHovered] = React6__namespace.useState(false);
1648
- const [isResizing, setIsResizing] = React6__namespace.useState(false);
1646
+ const containerRef = React9__namespace.useRef(null);
1647
+ const [isHovered, setIsHovered] = React9__namespace.useState(false);
1648
+ const [isResizing, setIsResizing] = React9__namespace.useState(false);
1649
1649
  const handleDelete = (e) => {
1650
1650
  e.preventDefault();
1651
1651
  e.stopPropagation();
@@ -1905,13 +1905,13 @@ function AutocompletePlugin({
1905
1905
  prefixWindow = 300
1906
1906
  }) {
1907
1907
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
1908
- const ghostKeyRef = React6__namespace.useRef(null);
1909
- const idleTimerRef = React6__namespace.useRef(null);
1910
- const inflightRef = React6__namespace.useRef(null);
1911
- const reqCounterRef = React6__namespace.useRef(0);
1912
- const lastTriggerRef = React6__namespace.useRef("");
1913
- const lastShownCtxRef = React6__namespace.useRef("");
1914
- const clearGhost = React6__namespace.useCallback(() => {
1908
+ const ghostKeyRef = React9__namespace.useRef(null);
1909
+ const idleTimerRef = React9__namespace.useRef(null);
1910
+ const inflightRef = React9__namespace.useRef(null);
1911
+ const reqCounterRef = React9__namespace.useRef(0);
1912
+ const lastTriggerRef = React9__namespace.useRef("");
1913
+ const lastShownCtxRef = React9__namespace.useRef("");
1914
+ const clearGhost = React9__namespace.useCallback(() => {
1915
1915
  editor.update(
1916
1916
  () => {
1917
1917
  const key = ghostKeyRef.current;
@@ -1923,7 +1923,7 @@ function AutocompletePlugin({
1923
1923
  { tag: "autocomplete-ghost" }
1924
1924
  );
1925
1925
  }, [editor]);
1926
- const upsertGhost = React6__namespace.useCallback(
1926
+ const upsertGhost = React9__namespace.useCallback(
1927
1927
  (text, insertAtCharOffset) => {
1928
1928
  editor.update(
1929
1929
  () => {
@@ -1987,12 +1987,12 @@ function AutocompletePlugin({
1987
1987
  },
1988
1988
  [editor]
1989
1989
  );
1990
- const cancelInflight = React6__namespace.useCallback(() => {
1990
+ const cancelInflight = React9__namespace.useCallback(() => {
1991
1991
  if (!inflightRef.current) return;
1992
1992
  inflightRef.current.dismiss();
1993
1993
  inflightRef.current = null;
1994
1994
  }, []);
1995
- const resetIdleTimer = React6__namespace.useCallback(
1995
+ const resetIdleTimer = React9__namespace.useCallback(
1996
1996
  (callback) => {
1997
1997
  if (idleTimerRef.current) {
1998
1998
  clearTimeout(idleTimerRef.current);
@@ -2007,7 +2007,7 @@ function AutocompletePlugin({
2007
2007
  },
2008
2008
  [idleMs, cancelInflight, clearGhost]
2009
2009
  );
2010
- const fireQuery = React6__namespace.useCallback(() => {
2010
+ const fireQuery = React9__namespace.useCallback(() => {
2011
2011
  if (!useQuery || isReadOnly) return;
2012
2012
  let context = "";
2013
2013
  let prefix = "";
@@ -2079,7 +2079,7 @@ function AutocompletePlugin({
2079
2079
  upsertGhost,
2080
2080
  onSuggestionShown
2081
2081
  ]);
2082
- React6__namespace.useEffect(() => {
2082
+ React9__namespace.useEffect(() => {
2083
2083
  if (!useQuery || isReadOnly) return;
2084
2084
  return editor.registerUpdateListener(({ tags }) => {
2085
2085
  if (tags.has("history-merge") || tags.has("collaboration")) return;
@@ -2088,7 +2088,7 @@ function AutocompletePlugin({
2088
2088
  resetIdleTimer(fireQuery);
2089
2089
  });
2090
2090
  }, [editor, useQuery, isReadOnly, resetIdleTimer, fireQuery]);
2091
- React6__namespace.useEffect(() => {
2091
+ React9__namespace.useEffect(() => {
2092
2092
  if (!useQuery || isReadOnly) return;
2093
2093
  return editor.registerCommand(
2094
2094
  lexical.SELECTION_CHANGE_COMMAND,
@@ -2112,7 +2112,7 @@ function AutocompletePlugin({
2112
2112
  lexical.COMMAND_PRIORITY_LOW
2113
2113
  );
2114
2114
  }, [editor, useQuery, isReadOnly, resetIdleTimer, fireQuery]);
2115
- React6__namespace.useEffect(() => {
2115
+ React9__namespace.useEffect(() => {
2116
2116
  return editor.registerCommand(
2117
2117
  lexical.KEY_DOWN_COMMAND,
2118
2118
  (e) => {
@@ -2153,7 +2153,7 @@ function AutocompletePlugin({
2153
2153
  lexical.COMMAND_PRIORITY_HIGH
2154
2154
  );
2155
2155
  }, [editor, clearGhost, onSuggestionAccept, prefixWindow]);
2156
- React6__namespace.useEffect(() => {
2156
+ React9__namespace.useEffect(() => {
2157
2157
  return () => {
2158
2158
  cancelInflight();
2159
2159
  if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
@@ -2165,8 +2165,8 @@ function clamp2(n, min, max) {
2165
2165
  return Math.max(min, Math.min(max, n));
2166
2166
  }
2167
2167
  function useFloatingPortalContainer(editor) {
2168
- const [container, setContainer] = React6.useState(null);
2169
- React6.useEffect(() => {
2168
+ const [container, setContainer] = React9.useState(null);
2169
+ React9.useEffect(() => {
2170
2170
  const root = editor.getRootElement();
2171
2171
  if (!root) return;
2172
2172
  const panelOrLayer = root.closest(".ms-Panel-main") || root.closest(".ms-Panel") || root.closest(".ms-Layer") || document.body;
@@ -2204,22 +2204,22 @@ function FloatingCharacterStylesEditor({
2204
2204
  isEditable,
2205
2205
  readOnly
2206
2206
  }) {
2207
- const popupRef = React6.useRef(null);
2208
- const mouseDownRef = React6.useRef(false);
2207
+ const popupRef = React9.useRef(null);
2208
+ const mouseDownRef = React9.useRef(false);
2209
2209
  const theme2 = react.useTheme();
2210
2210
  const disabled = !(isEditable ?? editor.isEditable()) || !!readOnly;
2211
- const format = React6.useCallback(
2211
+ const format = React9.useCallback(
2212
2212
  (type) => {
2213
2213
  if (disabled) return;
2214
2214
  editor.dispatchCommand(lexical.FORMAT_TEXT_COMMAND, type);
2215
2215
  },
2216
2216
  [editor, disabled]
2217
2217
  );
2218
- const toggleLink = React6.useCallback(() => {
2218
+ const toggleLink = React9.useCallback(() => {
2219
2219
  if (disabled) return;
2220
2220
  editor.dispatchCommand(link.TOGGLE_LINK_COMMAND, isLink ? null : "https://");
2221
2221
  }, [editor, disabled, isLink]);
2222
- const updatePosition = React6.useCallback(() => {
2222
+ const updatePosition = React9.useCallback(() => {
2223
2223
  const popupEl = popupRef.current;
2224
2224
  if (!popupEl) return;
2225
2225
  const sel = window.getSelection();
@@ -2235,7 +2235,7 @@ function FloatingCharacterStylesEditor({
2235
2235
  }
2236
2236
  popupEl.classList.add("is-open");
2237
2237
  }, [editor]);
2238
- React6.useEffect(() => {
2238
+ React9.useEffect(() => {
2239
2239
  const onResize = () => editor.getEditorState().read(updatePosition);
2240
2240
  const onScroll = () => editor.getEditorState().read(updatePosition);
2241
2241
  const root = editor.getRootElement();
@@ -2248,7 +2248,7 @@ function FloatingCharacterStylesEditor({
2248
2248
  root?.removeEventListener("scroll", onScroll);
2249
2249
  };
2250
2250
  }, [editor, updatePosition]);
2251
- React6.useEffect(() => {
2251
+ React9.useEffect(() => {
2252
2252
  editor.getEditorState().read(updatePosition);
2253
2253
  return utils.mergeRegister(
2254
2254
  editor.registerUpdateListener(({ editorState }) => {
@@ -2419,18 +2419,18 @@ function getSelectedNode(selection$1) {
2419
2419
  return isBackward ? selection.$isAtNodeEnd(selection$1.focus) ? anchorNode : focusNode : selection.$isAtNodeEnd(selection$1.anchor) ? focusNode : anchorNode;
2420
2420
  }
2421
2421
  function useCharacterStylesPopup(editor, opts) {
2422
- const [isText, setIsText] = React6.useState(false);
2423
- const [isLink, setIsLink] = React6.useState(false);
2424
- const [isBold, setIsBold] = React6.useState(false);
2425
- const [isItalic, setIsItalic] = React6.useState(false);
2426
- const [isUnderline, setIsUnderline] = React6.useState(false);
2427
- const [isStrikethrough, setIsStrikethrough] = React6.useState(false);
2428
- const [isSubscript, setIsSubscript] = React6.useState(false);
2429
- const [isSuperscript, setIsSuperscript] = React6.useState(false);
2430
- const [isCode, setIsCode] = React6.useState(false);
2422
+ const [isText, setIsText] = React9.useState(false);
2423
+ const [isLink, setIsLink] = React9.useState(false);
2424
+ const [isBold, setIsBold] = React9.useState(false);
2425
+ const [isItalic, setIsItalic] = React9.useState(false);
2426
+ const [isUnderline, setIsUnderline] = React9.useState(false);
2427
+ const [isStrikethrough, setIsStrikethrough] = React9.useState(false);
2428
+ const [isSubscript, setIsSubscript] = React9.useState(false);
2429
+ const [isSuperscript, setIsSuperscript] = React9.useState(false);
2430
+ const [isCode, setIsCode] = React9.useState(false);
2431
2431
  const isEditable = opts?.isEditable ?? editor.isEditable();
2432
2432
  const portalContainer = useFloatingPortalContainer(editor);
2433
- const updatePopupState = React6.useCallback(() => {
2433
+ const updatePopupState = React9.useCallback(() => {
2434
2434
  editor.getEditorState().read(() => {
2435
2435
  const selection = lexical.$getSelection();
2436
2436
  const nativeSelection = window.getSelection();
@@ -2457,11 +2457,11 @@ function useCharacterStylesPopup(editor, opts) {
2457
2457
  }
2458
2458
  });
2459
2459
  }, [editor]);
2460
- React6.useEffect(() => {
2460
+ React9.useEffect(() => {
2461
2461
  document.addEventListener("selectionchange", updatePopupState);
2462
2462
  return () => document.removeEventListener("selectionchange", updatePopupState);
2463
2463
  }, [updatePopupState]);
2464
- React6.useEffect(() => editor.registerUpdateListener(updatePopupState), [editor, updatePopupState]);
2464
+ React9.useEffect(() => editor.registerUpdateListener(updatePopupState), [editor, updatePopupState]);
2465
2465
  if (!portalContainer || !isText || isLink) return null;
2466
2466
  return reactDom.createPortal(
2467
2467
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2489,10 +2489,10 @@ function CharacterStylesPopupPlugin(props) {
2489
2489
  }
2490
2490
  var CustomOnChangePlugin = ({ value, onChange }) => {
2491
2491
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
2492
- const initializedRef = React6.useRef(false);
2493
- const onChangeRef = React6.useRef(onChange);
2492
+ const initializedRef = React9.useRef(false);
2493
+ const onChangeRef = React9.useRef(onChange);
2494
2494
  onChangeRef.current = onChange;
2495
- React6.useEffect(() => {
2495
+ React9.useEffect(() => {
2496
2496
  if (!value || initializedRef.current) return;
2497
2497
  initializedRef.current = true;
2498
2498
  editor.update(() => {
@@ -2505,7 +2505,7 @@ var CustomOnChangePlugin = ({ value, onChange }) => {
2505
2505
  lexical.$setSelection(null);
2506
2506
  });
2507
2507
  }, [editor, value]);
2508
- const handleChange = React6.useCallback((editorState) => {
2508
+ const handleChange = React9.useCallback((editorState) => {
2509
2509
  editorState.read(() => {
2510
2510
  onChangeRef.current(html.$generateHtmlFromNodes(editor));
2511
2511
  });
@@ -2580,12 +2580,12 @@ var preventDefault = (event) => {
2580
2580
  event.preventDefault();
2581
2581
  };
2582
2582
  var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMode, setIsLinkEditMode }) => {
2583
- const [editedLinkUrl, setEditedLinkUrl] = React6.useState("https://");
2584
- const [lastSelection, setLastSelection] = React6.useState(null);
2585
- const [linkUrl, setLinkUrl] = React6.useState("");
2586
- const editorRef = React6.useRef(null);
2587
- const inputRef = React6.useRef(null);
2588
- const $updateLinkEditor = React6.useCallback(() => {
2583
+ const [editedLinkUrl, setEditedLinkUrl] = React9.useState("https://");
2584
+ const [lastSelection, setLastSelection] = React9.useState(null);
2585
+ const [linkUrl, setLinkUrl] = React9.useState("");
2586
+ const editorRef = React9.useRef(null);
2587
+ const inputRef = React9.useRef(null);
2588
+ const $updateLinkEditor = React9.useCallback(() => {
2589
2589
  const selection = lexical.$getSelection();
2590
2590
  if (lexical.$isRangeSelection(selection)) {
2591
2591
  const node = getSelectedNode2(selection);
@@ -2625,7 +2625,7 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMod
2625
2625
  }
2626
2626
  return true;
2627
2627
  }, [anchorElem, editor, setIsLinkEditMode, isLinkEditMode, linkUrl]);
2628
- React6.useEffect(() => {
2628
+ React9.useEffect(() => {
2629
2629
  const scrollerElem = anchorElem.parentElement;
2630
2630
  const update = () => {
2631
2631
  editor.getEditorState().read(() => {
@@ -2643,7 +2643,7 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMod
2643
2643
  }
2644
2644
  };
2645
2645
  }, [anchorElem.parentElement, editor, $updateLinkEditor]);
2646
- React6.useEffect(() => {
2646
+ React9.useEffect(() => {
2647
2647
  return utils.mergeRegister(
2648
2648
  editor.registerUpdateListener(({ editorState }) => {
2649
2649
  editorState.read(() => {
@@ -2671,12 +2671,12 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMod
2671
2671
  )
2672
2672
  );
2673
2673
  }, [editor, $updateLinkEditor, setIsLink, isLink]);
2674
- React6.useEffect(() => {
2674
+ React9.useEffect(() => {
2675
2675
  editor.getEditorState().read(() => {
2676
2676
  $updateLinkEditor();
2677
2677
  });
2678
2678
  }, [editor, $updateLinkEditor]);
2679
- React6.useEffect(() => {
2679
+ React9.useEffect(() => {
2680
2680
  if (isLinkEditMode && inputRef.current) {
2681
2681
  inputRef.current.focus();
2682
2682
  }
@@ -2794,9 +2794,9 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMod
2794
2794
  ] }) });
2795
2795
  };
2796
2796
  var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLinkEditMode) => {
2797
- const [activeEditor, setActiveEditor] = React6.useState(editor);
2798
- const [isLink, setIsLink] = React6.useState(false);
2799
- React6.useEffect(() => {
2797
+ const [activeEditor, setActiveEditor] = React9.useState(editor);
2798
+ const [isLink, setIsLink] = React9.useState(false);
2799
+ React9.useEffect(() => {
2800
2800
  function $updateToolbar() {
2801
2801
  const selection = lexical.$getSelection();
2802
2802
  if (lexical.$isRangeSelection(selection)) {
@@ -2896,8 +2896,8 @@ var InsertImageByURL = ({
2896
2896
  onClick,
2897
2897
  disabled
2898
2898
  }) => {
2899
- const [altText, setAltText] = React6.useState("");
2900
- const [src, setSrc] = React6.useState("");
2899
+ const [altText, setAltText] = React9.useState("");
2900
+ const [src, setSrc] = React9.useState("");
2901
2901
  const isDisabled = disabled || src === "";
2902
2902
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 6, padding: "10px 0px 0px 0px" }, children: [
2903
2903
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Enter URL", orientation: "horizontal", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2951,15 +2951,15 @@ var InsertImageDialog = ({
2951
2951
  activeEditor,
2952
2952
  disabled
2953
2953
  }) => {
2954
- const [src, setSrc] = React6.useState("");
2955
- const [altText, setAltText] = React6.useState("");
2956
- const [isOpen, setIsOpen] = React6.useState(false);
2957
- const [selectedValue, setSelectedValue] = React6.useState("Upload");
2958
- const [fileName, setFileName] = React6.useState("");
2959
- const hasModifier = React6.useRef(false);
2954
+ const [src, setSrc] = React9.useState("");
2955
+ const [altText, setAltText] = React9.useState("");
2956
+ const [isOpen, setIsOpen] = React9.useState(false);
2957
+ const [selectedValue, setSelectedValue] = React9.useState("Upload");
2958
+ const [fileName, setFileName] = React9.useState("");
2959
+ const hasModifier = React9.useRef(false);
2960
2960
  const iconColor = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
2961
2961
  const isDisabled = disabled || src === "";
2962
- React6.useEffect(() => {
2962
+ React9.useEffect(() => {
2963
2963
  hasModifier.current = false;
2964
2964
  const handler = (e) => {
2965
2965
  hasModifier.current = e.altKey;
@@ -3103,7 +3103,7 @@ var InsertImageDialog = ({
3103
3103
  };
3104
3104
  var ImagesPlugin = ({ captionsEnabled }) => {
3105
3105
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
3106
- React6.useEffect(() => {
3106
+ React9.useEffect(() => {
3107
3107
  if (!editor.hasNodes([ImageNode])) {
3108
3108
  throw new Error("ImagesPlugin: ImageNode not registered on editor");
3109
3109
  }
@@ -3267,12 +3267,12 @@ var InsertInlineImageDialog = ({
3267
3267
  disabled,
3268
3268
  activeEditor
3269
3269
  }) => {
3270
- const hasModifier = React6.useRef(false);
3271
- const [src, setSrc] = React6.useState("");
3272
- const [isOpen, setIsOpen] = React6.useState(false);
3273
- const [altText, setAltText] = React6.useState("");
3274
- const [fileName, setFileName] = React6.useState("");
3275
- const [position, setPosition] = React6.useState("left");
3270
+ const hasModifier = React9.useRef(false);
3271
+ const [src, setSrc] = React9.useState("");
3272
+ const [isOpen, setIsOpen] = React9.useState(false);
3273
+ const [altText, setAltText] = React9.useState("");
3274
+ const [fileName, setFileName] = React9.useState("");
3275
+ const [position, setPosition] = React9.useState("left");
3276
3276
  const styles = useStyles();
3277
3277
  const iconColor = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
3278
3278
  const isDisabled = disabled || src === "";
@@ -3289,7 +3289,7 @@ var InsertInlineImageDialog = ({
3289
3289
  };
3290
3290
  reader.readAsDataURL(files[0]);
3291
3291
  };
3292
- React6.useEffect(() => {
3292
+ React9.useEffect(() => {
3293
3293
  const handler = (e) => {
3294
3294
  hasModifier.current = e.altKey;
3295
3295
  };
@@ -3443,7 +3443,7 @@ var InsertInlineImageDialog = ({
3443
3443
  };
3444
3444
  var InlineImagePlugin = () => {
3445
3445
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
3446
- React6.useEffect(() => {
3446
+ React9.useEffect(() => {
3447
3447
  if (!editor.hasNodes([InlineImageNode])) {
3448
3448
  throw new Error("ImagesPlugin: ImageNode not registered on editor");
3449
3449
  }
@@ -3567,7 +3567,7 @@ var getDragSelection2 = (event) => {
3567
3567
  var INSERT_PAGE_BREAK = lexical.createCommand();
3568
3568
  function PageBreakPlugin() {
3569
3569
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
3570
- React6.useEffect(() => {
3570
+ React9.useEffect(() => {
3571
3571
  if (!editor.hasNodes([PageBreakNode])) {
3572
3572
  throw new Error(
3573
3573
  "PageBreakPlugin: PageBreakNode is not registered on editor"
@@ -3845,7 +3845,7 @@ function RefApiPlugin({
3845
3845
  setRefErrors
3846
3846
  }) {
3847
3847
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
3848
- React6.useImperativeHandle(
3848
+ React9.useImperativeHandle(
3849
3849
  forwardedRef,
3850
3850
  () => ({
3851
3851
  setValue: (html$1) => {
@@ -4031,28 +4031,28 @@ function SpellPopover({
4031
4031
  onImprove,
4032
4032
  onAcceptGrammar
4033
4033
  }) {
4034
- const ref = React6__namespace.useRef(null);
4034
+ const ref = React9__namespace.useRef(null);
4035
4035
  const type = state.issue.type ?? "spelling";
4036
- const [pos, setPos] = React6__namespace.useState({ left: state.x, top: state.y });
4037
- React6__namespace.useEffect(() => {
4036
+ const [pos, setPos] = React9__namespace.useState({ left: state.x, top: state.y });
4037
+ React9__namespace.useEffect(() => {
4038
4038
  if (!ref.current) return;
4039
4039
  const { offsetHeight: h, offsetWidth: w } = ref.current;
4040
4040
  const top = state.y + h > window.innerHeight - 8 ? state.y - h - 32 : state.y;
4041
4041
  setPos({ left: Math.min(state.x, window.innerWidth - w - 8), top });
4042
4042
  }, [state.x, state.y]);
4043
- React6__namespace.useEffect(() => {
4043
+ React9__namespace.useEffect(() => {
4044
4044
  const h = (e) => {
4045
4045
  if (ref.current && !ref.current.contains(e.target)) onClose();
4046
4046
  };
4047
4047
  document.addEventListener("mousedown", h, true);
4048
4048
  return () => document.removeEventListener("mousedown", h, true);
4049
4049
  }, [onClose]);
4050
- React6__namespace.useEffect(() => {
4050
+ React9__namespace.useEffect(() => {
4051
4051
  const h = () => onClose();
4052
4052
  window.addEventListener("scroll", h, { capture: true, passive: true });
4053
4053
  return () => window.removeEventListener("scroll", h, true);
4054
4054
  }, [onClose]);
4055
- React6__namespace.useEffect(() => {
4055
+ React9__namespace.useEffect(() => {
4056
4056
  const h = (e) => {
4057
4057
  if (e.key === "Escape") onClose();
4058
4058
  };
@@ -4169,17 +4169,17 @@ function SpellCheckPlugin({
4169
4169
  enabled = true
4170
4170
  }) {
4171
4171
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
4172
- const timerRef = React6__namespace.useRef(null);
4173
- const dismissRef = React6__namespace.useRef(null);
4174
- const reqIdRef = React6__namespace.useRef(0);
4175
- const lastTextRef = React6__namespace.useRef("");
4176
- const applyingRef = React6__namespace.useRef(false);
4177
- const grammarCorrectionRef = React6__namespace.useRef(void 0);
4178
- const [popover, setPopover] = React6__namespace.useState(null);
4179
- React6__namespace.useEffect(() => {
4172
+ const timerRef = React9__namespace.useRef(null);
4173
+ const dismissRef = React9__namespace.useRef(null);
4174
+ const reqIdRef = React9__namespace.useRef(0);
4175
+ const lastTextRef = React9__namespace.useRef("");
4176
+ const applyingRef = React9__namespace.useRef(false);
4177
+ const grammarCorrectionRef = React9__namespace.useRef(void 0);
4178
+ const [popover, setPopover] = React9__namespace.useState(null);
4179
+ React9__namespace.useEffect(() => {
4180
4180
  injectCSS();
4181
4181
  }, []);
4182
- const clearErrors = React6__namespace.useCallback(() => {
4182
+ const clearErrors = React9__namespace.useCallback(() => {
4183
4183
  setPopover(null);
4184
4184
  grammarCorrectionRef.current = void 0;
4185
4185
  applyingRef.current = true;
@@ -4195,7 +4195,7 @@ function SpellCheckPlugin({
4195
4195
  }
4196
4196
  );
4197
4197
  }, [editor]);
4198
- const applyIssues = React6__namespace.useCallback(
4198
+ const applyIssues = React9__namespace.useCallback(
4199
4199
  (issues, improvedText, trimOffset = 0) => {
4200
4200
  let savedCharOffset = -1;
4201
4201
  editor.getEditorState().read(() => {
@@ -4338,7 +4338,7 @@ function SpellCheckPlugin({
4338
4338
  },
4339
4339
  [editor]
4340
4340
  );
4341
- React6__namespace.useEffect(() => {
4341
+ React9__namespace.useEffect(() => {
4342
4342
  let currentRoot = null;
4343
4343
  const onClick = (e) => {
4344
4344
  const span = e.target.closest("[data-spell-offset]");
@@ -4382,7 +4382,7 @@ function SpellCheckPlugin({
4382
4382
  if (currentRoot) currentRoot.removeEventListener("click", onClick);
4383
4383
  };
4384
4384
  }, [editor]);
4385
- const handleAccept = React6__namespace.useCallback(
4385
+ const handleAccept = React9__namespace.useCallback(
4386
4386
  (replacement, nodeKey) => {
4387
4387
  let original = "";
4388
4388
  editor.getEditorState().read(() => {
@@ -4408,7 +4408,7 @@ function SpellCheckPlugin({
4408
4408
  },
4409
4409
  [editor, onSpellCheckAccept, popover]
4410
4410
  );
4411
- const handleDismiss = React6__namespace.useCallback(
4411
+ const handleDismiss = React9__namespace.useCallback(
4412
4412
  (nodeKey) => {
4413
4413
  editor.update(
4414
4414
  () => {
@@ -4422,7 +4422,7 @@ function SpellCheckPlugin({
4422
4422
  },
4423
4423
  [editor]
4424
4424
  );
4425
- const handleImprove = React6__namespace.useCallback(
4425
+ const handleImprove = React9__namespace.useCallback(
4426
4426
  (text) => {
4427
4427
  const original = lastTextRef.current;
4428
4428
  applyingRef.current = true;
@@ -4442,7 +4442,7 @@ function SpellCheckPlugin({
4442
4442
  },
4443
4443
  [editor, onSpellCheckAccept]
4444
4444
  );
4445
- const handleAcceptGrammar = React6__namespace.useCallback(
4445
+ const handleAcceptGrammar = React9__namespace.useCallback(
4446
4446
  (corrected) => {
4447
4447
  const original = lastTextRef.current;
4448
4448
  applyingRef.current = true;
@@ -4462,7 +4462,7 @@ function SpellCheckPlugin({
4462
4462
  },
4463
4463
  [editor, onSpellCheckAccept]
4464
4464
  );
4465
- React6__namespace.useEffect(() => {
4465
+ React9__namespace.useEffect(() => {
4466
4466
  if (!enabled || !useSpellCheck) return;
4467
4467
  return editor.registerUpdateListener(({ tags }) => {
4468
4468
  if (applyingRef.current) return;
@@ -4500,13 +4500,13 @@ function SpellCheckPlugin({
4500
4500
  }, idleMs);
4501
4501
  });
4502
4502
  }, [editor, useSpellCheck, enabled, idleMs, applyIssues, clearErrors]);
4503
- React6__namespace.useEffect(() => {
4503
+ React9__namespace.useEffect(() => {
4504
4504
  if (!enabled) {
4505
4505
  clearErrors();
4506
4506
  lastTextRef.current = "";
4507
4507
  }
4508
4508
  }, [enabled, clearErrors]);
4509
- React6__namespace.useEffect(
4509
+ React9__namespace.useEffect(
4510
4510
  () => () => {
4511
4511
  dismissRef.current?.();
4512
4512
  if (timerRef.current) clearTimeout(timerRef.current);
@@ -4527,10 +4527,10 @@ function SpellCheckPlugin({
4527
4527
  }
4528
4528
  function TableActionMenuPlugin({ disabled = false }) {
4529
4529
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
4530
- const [isInTable, setIsInTable] = React6__namespace.useState(false);
4531
- const [anchorRect, setAnchorRect] = React6__namespace.useState(null);
4532
- const [open, setOpen] = React6__namespace.useState(false);
4533
- const updateFromSelection = React6__namespace.useCallback(() => {
4530
+ const [isInTable, setIsInTable] = React9__namespace.useState(false);
4531
+ const [anchorRect, setAnchorRect] = React9__namespace.useState(null);
4532
+ const [open, setOpen] = React9__namespace.useState(false);
4533
+ const updateFromSelection = React9__namespace.useCallback(() => {
4534
4534
  const root = editor.getRootElement();
4535
4535
  if (!root) return;
4536
4536
  editor.getEditorState().read(() => {
@@ -4568,7 +4568,7 @@ function TableActionMenuPlugin({ disabled = false }) {
4568
4568
  setAnchorRect(cellDom.getBoundingClientRect());
4569
4569
  });
4570
4570
  }, [editor]);
4571
- React6__namespace.useEffect(() => {
4571
+ React9__namespace.useEffect(() => {
4572
4572
  return utils.mergeRegister(
4573
4573
  editor.registerCommand(
4574
4574
  lexical.SELECTION_CHANGE_COMMAND,
@@ -4583,7 +4583,7 @@ function TableActionMenuPlugin({ disabled = false }) {
4583
4583
  })
4584
4584
  );
4585
4585
  }, [editor, updateFromSelection]);
4586
- React6__namespace.useEffect(() => {
4586
+ React9__namespace.useEffect(() => {
4587
4587
  return editor.registerCommand(
4588
4588
  lexical.KEY_DOWN_COMMAND,
4589
4589
  (event) => {
@@ -4624,11 +4624,11 @@ function TableActionMenuPlugin({ disabled = false }) {
4624
4624
  lexical.COMMAND_PRIORITY_HIGH
4625
4625
  );
4626
4626
  }, [editor, disabled]);
4627
- React6__namespace.useEffect(() => {
4627
+ React9__namespace.useEffect(() => {
4628
4628
  if (!isInTable && open) setOpen(false);
4629
4629
  }, [isInTable, open]);
4630
4630
  const canShow = isInTable && !!anchorRect && !disabled;
4631
- const handleStyle = React6__namespace.useMemo(() => {
4631
+ const handleStyle = React9__namespace.useMemo(() => {
4632
4632
  if (!anchorRect) return void 0;
4633
4633
  const top = Math.max(8, anchorRect.top + 6);
4634
4634
  const left = Math.max(8, anchorRect.right - 34);
@@ -4642,7 +4642,7 @@ function TableActionMenuPlugin({ disabled = false }) {
4642
4642
  const dangerStyle = {
4643
4643
  color: "var(--colorPaletteRedForeground1)"
4644
4644
  };
4645
- const run = React6__namespace.useCallback(
4645
+ const run = React9__namespace.useCallback(
4646
4646
  (fn) => {
4647
4647
  if (disabled) return;
4648
4648
  editor.focus();
@@ -4737,17 +4737,17 @@ function TableCellResizer({
4737
4737
  editor,
4738
4738
  anchorElem
4739
4739
  }) {
4740
- const targetRef = React6.useRef(null);
4741
- const resizerRef = React6.useRef(null);
4742
- const tableRectRef = React6.useRef(null);
4743
- const mouseStartPosRef = React6.useRef(null);
4744
- const [mouseCurrentPos, updateMouseCurrentPos] = React6.useState(null);
4745
- const [activeCell, updateActiveCell] = React6.useState(null);
4746
- const [isSelectingGrid, updateIsSelectingGrid] = React6.useState(false);
4747
- const [draggingDirection, updateDraggingDirection] = React6.useState(
4740
+ const targetRef = React9.useRef(null);
4741
+ const resizerRef = React9.useRef(null);
4742
+ const tableRectRef = React9.useRef(null);
4743
+ const mouseStartPosRef = React9.useRef(null);
4744
+ const [mouseCurrentPos, updateMouseCurrentPos] = React9.useState(null);
4745
+ const [activeCell, updateActiveCell] = React9.useState(null);
4746
+ const [isSelectingGrid, updateIsSelectingGrid] = React9.useState(false);
4747
+ const [draggingDirection, updateDraggingDirection] = React9.useState(
4748
4748
  null
4749
4749
  );
4750
- React6.useEffect(() => {
4750
+ React9.useEffect(() => {
4751
4751
  return editor.registerCommand(
4752
4752
  lexical.SELECTION_CHANGE_COMMAND,
4753
4753
  () => {
@@ -4770,7 +4770,7 @@ function TableCellResizer({
4770
4770
  lexical.COMMAND_PRIORITY_HIGH
4771
4771
  );
4772
4772
  }, [editor]);
4773
- const resetState = React6.useCallback(() => {
4773
+ const resetState = React9.useCallback(() => {
4774
4774
  updateActiveCell(null);
4775
4775
  targetRef.current = null;
4776
4776
  updateDraggingDirection(null);
@@ -4778,7 +4778,7 @@ function TableCellResizer({
4778
4778
  tableRectRef.current = null;
4779
4779
  updateMouseCurrentPos(null);
4780
4780
  }, []);
4781
- React6.useEffect(() => {
4781
+ React9.useEffect(() => {
4782
4782
  const onMouseMove = (event) => {
4783
4783
  if (draggingDirection) {
4784
4784
  updateMouseCurrentPos({ x: event.clientX, y: event.clientY });
@@ -4822,7 +4822,7 @@ function TableCellResizer({
4822
4822
  };
4823
4823
  }, [activeCell, draggingDirection, editor, resetState, anchorElem]);
4824
4824
  const isHeightChanging = (direction) => direction === "bottom";
4825
- const updateRowHeight = React6.useCallback(
4825
+ const updateRowHeight = React9.useCallback(
4826
4826
  (newHeight) => {
4827
4827
  if (!activeCell) return;
4828
4828
  editor.update(() => {
@@ -4839,7 +4839,7 @@ function TableCellResizer({
4839
4839
  },
4840
4840
  [activeCell, editor]
4841
4841
  );
4842
- const updateColumnWidth = React6.useCallback(
4842
+ const updateColumnWidth = React9.useCallback(
4843
4843
  (newWidth) => {
4844
4844
  if (!activeCell) return;
4845
4845
  editor.update(() => {
@@ -4861,7 +4861,7 @@ function TableCellResizer({
4861
4861
  },
4862
4862
  [activeCell, editor]
4863
4863
  );
4864
- const toggleResize = React6.useCallback(
4864
+ const toggleResize = React9.useCallback(
4865
4865
  (direction) => (event) => {
4866
4866
  event.preventDefault();
4867
4867
  event.stopPropagation();
@@ -4892,7 +4892,7 @@ function TableCellResizer({
4892
4892
  },
4893
4893
  [activeCell, draggingDirection, resetState, updateColumnWidth, updateRowHeight]
4894
4894
  );
4895
- const getResizers = React6.useCallback(() => {
4895
+ const getResizers = React9.useCallback(() => {
4896
4896
  const empty = { bottom: {}, right: {} };
4897
4897
  if (!activeCell) return empty;
4898
4898
  const cellRect = activeCell.elem.getBoundingClientRect();
@@ -4967,7 +4967,7 @@ function TableCellResizerPlugin({
4967
4967
  anchorElem
4968
4968
  }) {
4969
4969
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
4970
- return React6.useMemo(
4970
+ return React9.useMemo(
4971
4971
  () => reactDom.createPortal(/* @__PURE__ */ jsxRuntime.jsx(TableCellResizer, { editor, anchorElem }), anchorElem),
4972
4972
  [editor, anchorElem]
4973
4973
  );
@@ -5106,11 +5106,12 @@ var hsvToRgb = (h, s, v) => {
5106
5106
  b: Math.round((bb + m) * 255)
5107
5107
  };
5108
5108
  };
5109
- function useDrag(onMove, onEnd) {
5110
- const draggingRef = React6__namespace.useRef(false);
5111
- const start = React6__namespace.useCallback(
5109
+ function useDrag(onMove, onEnd, interactingRef) {
5110
+ const draggingRef = React9__namespace.useRef(false);
5111
+ const start = React9__namespace.useCallback(
5112
5112
  (e) => {
5113
5113
  draggingRef.current = true;
5114
+ if (interactingRef) interactingRef.current = true;
5114
5115
  onMove(e.clientX, e.clientY);
5115
5116
  const move = (ev) => {
5116
5117
  if (!draggingRef.current) return;
@@ -5120,24 +5121,66 @@ function useDrag(onMove, onEnd) {
5120
5121
  draggingRef.current = false;
5121
5122
  window.removeEventListener("mousemove", move);
5122
5123
  window.removeEventListener("mouseup", up);
5124
+ if (interactingRef) {
5125
+ const clearFlag = () => {
5126
+ interactingRef.current = false;
5127
+ };
5128
+ window.addEventListener("click", clearFlag, { once: true });
5129
+ setTimeout(() => {
5130
+ window.removeEventListener("click", clearFlag);
5131
+ interactingRef.current = false;
5132
+ }, 0);
5133
+ }
5123
5134
  };
5124
5135
  window.addEventListener("mousemove", move);
5125
5136
  window.addEventListener("mouseup", up);
5126
5137
  },
5127
- [onMove, onEnd]
5138
+ [onMove, onEnd, interactingRef]
5128
5139
  );
5129
5140
  return start;
5130
5141
  }
5131
5142
  var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5132
- const [open, setOpen] = React6__namespace.useState(false);
5133
- const btnRef = React6__namespace.useRef(null);
5134
- const [hex, setHex] = React6__namespace.useState(normalizeHex(value || "#000000"));
5135
- const { r, g, b } = React6__namespace.useMemo(() => hexToRgb(hex), [hex]);
5136
- const hsv = React6__namespace.useMemo(() => rgbToHsv(r, g, b), [r, g, b]);
5137
- const [h, setH] = React6__namespace.useState(hsv.h);
5138
- const [s, setS] = React6__namespace.useState(hsv.s);
5139
- const [v, setV] = React6__namespace.useState(hsv.v);
5140
- React6__namespace.useEffect(() => {
5143
+ const [open, setOpen] = React9__namespace.useState(false);
5144
+ const btnRef = React9__namespace.useRef(null);
5145
+ const interactingRef = React9__namespace.useRef(false);
5146
+ const handleDismiss = React9__namespace.useCallback(() => setOpen(false), []);
5147
+ const preventDismissOnEvent = React9__namespace.useCallback(
5148
+ (ev) => {
5149
+ if (interactingRef.current) return true;
5150
+ return ev.type !== "click";
5151
+ },
5152
+ []
5153
+ );
5154
+ const [, forceReposition] = React9__namespace.useState(0);
5155
+ React9__namespace.useEffect(() => {
5156
+ if (!open) return;
5157
+ let rafId = null;
5158
+ const reposition = () => {
5159
+ if (rafId != null) return;
5160
+ rafId = requestAnimationFrame(() => {
5161
+ rafId = null;
5162
+ forceReposition((n) => n + 1);
5163
+ });
5164
+ };
5165
+ window.addEventListener("scroll", reposition, true);
5166
+ window.addEventListener("resize", reposition);
5167
+ return () => {
5168
+ if (rafId != null) cancelAnimationFrame(rafId);
5169
+ window.removeEventListener("scroll", reposition, true);
5170
+ window.removeEventListener("resize", reposition);
5171
+ };
5172
+ }, [open]);
5173
+ const [hex, setHex] = React9__namespace.useState(normalizeHex(value || "#000000"));
5174
+ const { r, g, b } = React9__namespace.useMemo(() => hexToRgb(hex), [hex]);
5175
+ const hsv = React9__namespace.useMemo(() => rgbToHsv(r, g, b), [r, g, b]);
5176
+ const [h, setH] = React9__namespace.useState(hsv.h);
5177
+ const [s, setS] = React9__namespace.useState(hsv.s);
5178
+ const [v, setV] = React9__namespace.useState(hsv.v);
5179
+ const wasOpenRef = React9__namespace.useRef(open);
5180
+ React9__namespace.useEffect(() => {
5181
+ const justOpened = open && !wasOpenRef.current;
5182
+ wasOpenRef.current = open;
5183
+ if (!justOpened) return;
5141
5184
  const n = normalizeHex(value || "#000000");
5142
5185
  setHex(n);
5143
5186
  const rgb = hexToRgb(n);
@@ -5145,8 +5188,8 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5145
5188
  setH(next.h);
5146
5189
  setS(next.s);
5147
5190
  setV(next.v);
5148
- }, [value]);
5149
- const commitHsv = React6__namespace.useCallback(
5191
+ }, [value, open]);
5192
+ const commitHsv = React9__namespace.useCallback(
5150
5193
  (hh, ss, vv, close) => {
5151
5194
  const rgb = hsvToRgb(hh, ss, vv);
5152
5195
  const nextHex = rgbToHex(rgb.r, rgb.g, rgb.b);
@@ -5156,8 +5199,8 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5156
5199
  },
5157
5200
  [onChange]
5158
5201
  );
5159
- const svRef = React6__namespace.useRef(null);
5160
- const onSVMove = React6__namespace.useCallback(
5202
+ const svRef = React9__namespace.useRef(null);
5203
+ const onSVMove = React9__namespace.useCallback(
5161
5204
  (clientX, clientY) => {
5162
5205
  if (!svRef.current) return;
5163
5206
  const rect = svRef.current.getBoundingClientRect();
@@ -5171,9 +5214,9 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5171
5214
  },
5172
5215
  [h, commitHsv]
5173
5216
  );
5174
- const startSV = useDrag(onSVMove);
5175
- const hueRef = React6__namespace.useRef(null);
5176
- const onHueMove = React6__namespace.useCallback(
5217
+ const startSV = useDrag(onSVMove, void 0, interactingRef);
5218
+ const hueRef = React9__namespace.useRef(null);
5219
+ const onHueMove = React9__namespace.useCallback(
5177
5220
  (clientX) => {
5178
5221
  if (!hueRef.current) return;
5179
5222
  const rect = hueRef.current.getBoundingClientRect();
@@ -5184,10 +5227,10 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5184
5227
  },
5185
5228
  [s, v, commitHsv]
5186
5229
  );
5187
- const startHue = useDrag((x) => onHueMove(x));
5188
- const svThumb = React6__namespace.useMemo(() => ({ left: `${s * 100}%`, top: `${(1 - v) * 100}%` }), [s, v]);
5189
- const hueThumb = React6__namespace.useMemo(() => ({ left: `${h / 360 * 100}%` }), [h]);
5190
- const hueColor = React6__namespace.useMemo(() => {
5230
+ const startHue = useDrag((x) => onHueMove(x), void 0, interactingRef);
5231
+ const svThumb = React9__namespace.useMemo(() => ({ left: `${s * 100}%`, top: `${(1 - v) * 100}%` }), [s, v]);
5232
+ const hueThumb = React9__namespace.useMemo(() => ({ left: `${h / 360 * 100}%` }), [h]);
5233
+ const hueColor = React9__namespace.useMemo(() => {
5191
5234
  const { r: r2, g: g2, b: b2 } = hsvToRgb(h, 1, 1);
5192
5235
  return rgbToHex(r2, g2, b2);
5193
5236
  }, [h]);
@@ -5233,10 +5276,11 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5233
5276
  react.Callout,
5234
5277
  {
5235
5278
  target: btnRef,
5236
- onDismiss: () => setOpen(false),
5279
+ onDismiss: handleDismiss,
5237
5280
  setInitialFocus: true,
5238
5281
  directionalHint: 4,
5239
5282
  className: "aoColorCallout",
5283
+ preventDismissOnEvent,
5240
5284
  children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 10 }, styles: { root: { padding: 12, width: 320 } }, children: [
5241
5285
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aoLexRow", children: [
5242
5286
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aoLexSwatch", style: { background: hex } }),
@@ -5308,8 +5352,8 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
5308
5352
  };
5309
5353
  var ColorPickerPlugin = ({ disabled }) => {
5310
5354
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5311
- const [{ color, bgColor }, setColors] = React6__namespace.default.useState({ color: "#000000", bgColor: "#ffffff" });
5312
- const lastRangeSelectionRef = React6__namespace.default.useRef(null);
5355
+ const [{ color, bgColor }, setColors] = React9__namespace.default.useState({ color: "#000000", bgColor: "#ffffff" });
5356
+ const lastRangeSelectionRef = React9__namespace.default.useRef(null);
5313
5357
  const updateToolbar = () => {
5314
5358
  const selection$1 = lexical.$getSelection();
5315
5359
  if (lexical.$isRangeSelection(selection$1)) {
@@ -5319,7 +5363,7 @@ var ColorPickerPlugin = ({ disabled }) => {
5319
5363
  setColors({ color: c, bgColor: bg });
5320
5364
  }
5321
5365
  };
5322
- React6__namespace.default.useEffect(() => {
5366
+ React9__namespace.default.useEffect(() => {
5323
5367
  return utils.mergeRegister(
5324
5368
  editor.registerUpdateListener(({ editorState }) => {
5325
5369
  editorState.read(() => updateToolbar());
@@ -5408,9 +5452,9 @@ var FONT_FAMILY_OPTIONS = [
5408
5452
  var FontFamilyPlugin = ({ disabled = false }) => {
5409
5453
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5410
5454
  const styles = useStyles2();
5411
- const [fontFamily, setFontFamily] = React6.useState("");
5455
+ const [fontFamily, setFontFamily] = React9.useState("");
5412
5456
  const fg = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
5413
- React6.useEffect(() => {
5457
+ React9.useEffect(() => {
5414
5458
  const readFontFamily = () => {
5415
5459
  const selection$1 = lexical.$getSelection();
5416
5460
  if (lexical.$isRangeSelection(selection$1)) {
@@ -5432,7 +5476,7 @@ var FontFamilyPlugin = ({ disabled = false }) => {
5432
5476
  )
5433
5477
  );
5434
5478
  }, [editor]);
5435
- const handleClick = React6.useCallback(
5479
+ const handleClick = React9.useCallback(
5436
5480
  (option) => {
5437
5481
  if (disabled) return;
5438
5482
  editor.update(() => {
@@ -5535,9 +5579,9 @@ var useStyles3 = reactComponents.makeStyles({
5535
5579
  var FontSizePlugin = ({ disabled }) => {
5536
5580
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5537
5581
  const styles = useStyles3();
5538
- const [fontSize2, setFontSize] = React6__namespace.useState(String(DEFAULT_FONT_SIZE));
5582
+ const [fontSize2, setFontSize] = React9__namespace.useState(String(DEFAULT_FONT_SIZE));
5539
5583
  const fg = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
5540
- React6__namespace.useEffect(() => {
5584
+ React9__namespace.useEffect(() => {
5541
5585
  const readFontSize = () => {
5542
5586
  const selection$1 = lexical.$getSelection();
5543
5587
  if (lexical.$isRangeSelection(selection$1)) {
@@ -5615,9 +5659,9 @@ var FontSizePlugin = ({ disabled }) => {
5615
5659
  };
5616
5660
  var InsertLinkPlugin = ({ disabled }) => {
5617
5661
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5618
- const [isOpen, setIsOpen] = React6.useState(false);
5619
- const [text, setText] = React6.useState("");
5620
- const [link$1, setLink] = React6.useState("");
5662
+ const [isOpen, setIsOpen] = React9.useState(false);
5663
+ const [text, setText] = React9.useState("");
5664
+ const [link$1, setLink] = React9.useState("");
5621
5665
  const iconColor = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
5622
5666
  const insertLink = (text2, link2) => {
5623
5667
  if (disabled) return;
@@ -5715,9 +5759,9 @@ var InsertLinkPlugin = ({ disabled }) => {
5715
5759
  };
5716
5760
  var TableItemPlugin = ({ disabled }) => {
5717
5761
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5718
- const [columns, setColumns] = React6.useState("");
5719
- const [rows, setRows] = React6.useState("");
5720
- const [isOpen, setIsOpen] = React6.useState(false);
5762
+ const [columns, setColumns] = React9.useState("");
5763
+ const [rows, setRows] = React9.useState("");
5764
+ const [isOpen, setIsOpen] = React9.useState(false);
5721
5765
  const iconColor = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
5722
5766
  const onAddTable = () => {
5723
5767
  if (disabled) return;
@@ -5822,8 +5866,8 @@ var TableItemPlugin = ({ disabled }) => {
5822
5866
  );
5823
5867
  };
5824
5868
  var YoutubeUploadPlugin = ({ disabled }) => {
5825
- const [url, setURL] = React6.useState("");
5826
- const [isOpen, setIsOpen] = React6.useState(false);
5869
+ const [url, setURL] = React9.useState("");
5870
+ const [isOpen, setIsOpen] = React9.useState(false);
5827
5871
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5828
5872
  const iconColor = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#424242";
5829
5873
  const onHandleEmbeded = () => {
@@ -5942,22 +5986,22 @@ var ToolBarPlugins = (props) => {
5942
5986
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
5943
5987
  const theme2 = react.useTheme();
5944
5988
  const styles = useStyles4();
5945
- const [selectNodeType, setSelectNodeType] = React6.useState("paragraph");
5946
- const [isEditable, setIsEditable] = React6.useState(() => editor.isEditable());
5947
- const [isBold, setIsBold] = React6.useState(false);
5948
- const [isItalic, setIsItalic] = React6.useState(false);
5949
- const [isUnderline, setIsUnderline] = React6.useState(false);
5950
- const [isStrikethrough, setIsStrikethrough] = React6.useState(false);
5951
- const [isSuperscript, setIsSuperscript] = React6.useState(false);
5952
- const [isSubscript, setIsSubscript] = React6.useState(false);
5953
- const [isHighlight, setIsHighlight] = React6.useState(false);
5954
- const [isUppercase, setIsUppercase] = React6.useState(false);
5955
- const [isLowercase, setIsLowercase] = React6.useState(false);
5956
- const [isCapitalize, setIsCapitalize] = React6.useState(false);
5957
- const [alignment, setAlignment] = React6.useState("left");
5958
- const lastSelectionRef = React6__namespace.default.useRef(null);
5989
+ const [selectNodeType, setSelectNodeType] = React9.useState("paragraph");
5990
+ const [isEditable, setIsEditable] = React9.useState(() => editor.isEditable());
5991
+ const [isBold, setIsBold] = React9.useState(false);
5992
+ const [isItalic, setIsItalic] = React9.useState(false);
5993
+ const [isUnderline, setIsUnderline] = React9.useState(false);
5994
+ const [isStrikethrough, setIsStrikethrough] = React9.useState(false);
5995
+ const [isSuperscript, setIsSuperscript] = React9.useState(false);
5996
+ const [isSubscript, setIsSubscript] = React9.useState(false);
5997
+ const [isHighlight, setIsHighlight] = React9.useState(false);
5998
+ const [isUppercase, setIsUppercase] = React9.useState(false);
5999
+ const [isLowercase, setIsLowercase] = React9.useState(false);
6000
+ const [isCapitalize, setIsCapitalize] = React9.useState(false);
6001
+ const [alignment, setAlignment] = React9.useState("left");
6002
+ const lastSelectionRef = React9__namespace.default.useRef(null);
5959
6003
  const presetGroups = getToolbarGroupsByLevel(props.level);
5960
- const pluginGroups = React6.useMemo(() => sanitizePluginGroups(presetGroups), [presetGroups]);
6004
+ const pluginGroups = React9.useMemo(() => sanitizePluginGroups(presetGroups), [presetGroups]);
5961
6005
  const updateToolbarPlugins = () => {
5962
6006
  const selection = lexical.$getSelection();
5963
6007
  if (!lexical.$isRangeSelection(selection)) {
@@ -6009,7 +6053,7 @@ var ToolBarPlugins = (props) => {
6009
6053
  ["paragraph", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "quote", "code"].includes(type) ? type : "paragraph"
6010
6054
  );
6011
6055
  };
6012
- const applyToBlock = React6__namespace.default.useCallback(
6056
+ const applyToBlock = React9__namespace.default.useCallback(
6013
6057
  (fn) => {
6014
6058
  editor.update(() => {
6015
6059
  const saved = lastSelectionRef.current;
@@ -6029,7 +6073,7 @@ var ToolBarPlugins = (props) => {
6029
6073
  }
6030
6074
  });
6031
6075
  };
6032
- React6__namespace.default.useEffect(() => {
6076
+ React9__namespace.default.useEffect(() => {
6033
6077
  return utils.mergeRegister(
6034
6078
  editor.registerEditableListener((editable) => {
6035
6079
  setIsEditable(editable);
@@ -6490,7 +6534,7 @@ var ToolBarPlugins = (props) => {
6490
6534
  padding: "0px",
6491
6535
  minHeight: 36
6492
6536
  },
6493
- children: pluginGroups.map((group, groupIndex) => /* @__PURE__ */ jsxRuntime.jsx(React6__namespace.default.Fragment, { children: group.map((token, tokenIndex) => {
6537
+ children: pluginGroups.map((group, groupIndex) => /* @__PURE__ */ jsxRuntime.jsx(React9__namespace.default.Fragment, { children: group.map((token, tokenIndex) => {
6494
6538
  try {
6495
6539
  return renderToken(token, groupIndex, tokenIndex);
6496
6540
  } catch {
@@ -6509,7 +6553,7 @@ function isYoutubeLikeNode(node) {
6509
6553
  }
6510
6554
  function YoutubeDeletePlugin() {
6511
6555
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6512
- React6.useEffect(() => {
6556
+ React9.useEffect(() => {
6513
6557
  const removeIfYoutubeAtCursor = (direction) => {
6514
6558
  const selection = lexical.$getSelection();
6515
6559
  if (!lexical.$isRangeSelection(selection)) return false;
@@ -6541,7 +6585,7 @@ function YoutubeDeletePlugin() {
6541
6585
  lexical.COMMAND_PRIORITY_HIGH
6542
6586
  );
6543
6587
  }, [editor]);
6544
- React6.useEffect(() => {
6588
+ React9.useEffect(() => {
6545
6589
  return editor.registerCommand(
6546
6590
  lexical.KEY_DELETE_COMMAND,
6547
6591
  () => {
@@ -6630,14 +6674,14 @@ var theme = {
6630
6674
  };
6631
6675
  function ReadOnlyPlugin({ readonly }) {
6632
6676
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6633
- React6.useEffect(() => {
6677
+ React9.useEffect(() => {
6634
6678
  editor.setEditable(!readonly);
6635
6679
  }, [editor, readonly]);
6636
6680
  return null;
6637
6681
  }
6638
6682
  function BrowserSpellCheckPlugin({ enabled }) {
6639
6683
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6640
- React6.useEffect(() => {
6684
+ React9.useEffect(() => {
6641
6685
  const el = editor.getRootElement();
6642
6686
  if (!el) return;
6643
6687
  el.spellcheck = enabled;
@@ -6650,7 +6694,7 @@ function BrowserSpellCheckPlugin({ enabled }) {
6650
6694
  }
6651
6695
  function WordCountPlugin({ onCountChange }) {
6652
6696
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6653
- React6.useEffect(() => {
6697
+ React9.useEffect(() => {
6654
6698
  return editor.registerUpdateListener(({ editorState }) => {
6655
6699
  editorState.read(() => {
6656
6700
  const text = lexical.$getRoot().getTextContent();
@@ -6663,7 +6707,7 @@ function WordCountPlugin({ onCountChange }) {
6663
6707
  }
6664
6708
  function CharCountPlugin({ onCountChange }) {
6665
6709
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6666
- React6.useEffect(() => {
6710
+ React9.useEffect(() => {
6667
6711
  return editor.registerUpdateListener(({ editorState }) => {
6668
6712
  editorState.read(() => {
6669
6713
  onCountChange(lexical.$getRoot().getTextContent().length);
@@ -6679,7 +6723,7 @@ function FocusEventsPlugin({
6679
6723
  containerRef
6680
6724
  }) {
6681
6725
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
6682
- React6.useEffect(() => {
6726
+ React9.useEffect(() => {
6683
6727
  const root = editor.getRootElement();
6684
6728
  if (!root) return;
6685
6729
  const handleFocusIn = () => {
@@ -6800,33 +6844,33 @@ function _makeQueryFn(fn) {
6800
6844
  };
6801
6845
  };
6802
6846
  }
6803
- var ContentEditorComponent = React6.forwardRef(
6847
+ var ContentEditorComponent = React9.forwardRef(
6804
6848
  (props, ref) => {
6805
6849
  const isReadOnly = !!props.readOnly;
6806
- const resolvedSpellCheck = React6__namespace.default.useMemo(
6850
+ const resolvedSpellCheck = React9__namespace.default.useMemo(
6807
6851
  () => props.spellCheckFn ? _makeSpellCheckFn(props.spellCheckFn) : props.useSpellCheck,
6808
6852
  // eslint-disable-next-line react-hooks/exhaustive-deps
6809
6853
  [props.spellCheckFn, props.useSpellCheck]
6810
6854
  );
6811
- const resolvedQuery = React6__namespace.default.useMemo(
6855
+ const resolvedQuery = React9__namespace.default.useMemo(
6812
6856
  () => props.suggestFn ? _makeQueryFn(props.suggestFn) : props.useQuery,
6813
6857
  // eslint-disable-next-line react-hooks/exhaustive-deps
6814
6858
  [props.suggestFn, props.useQuery]
6815
6859
  );
6816
- const [floatingAnchorElem, setFloatingAnchorElem] = React6.useState(null);
6817
- const [isLinkEditMode, setIsLinkEditMode] = React6.useState(false);
6818
- const [wordCount, setWordCount] = React6.useState(0);
6819
- const handleWordCount = React6.useCallback((count) => setWordCount(count), []);
6820
- const [charCount, setCharCount] = React6.useState(0);
6821
- const handleCharCount = React6.useCallback((count) => setCharCount(count), []);
6822
- const [refErrors, setRefErrors] = React6.useState([]);
6823
- const contentEditableDomRef = React6.useRef(null);
6824
- const previousOverLimitRef = React6.useRef(false);
6825
- const focusedRef = React6.useRef(false);
6860
+ const [floatingAnchorElem, setFloatingAnchorElem] = React9.useState(null);
6861
+ const [isLinkEditMode, setIsLinkEditMode] = React9.useState(false);
6862
+ const [wordCount, setWordCount] = React9.useState(0);
6863
+ const handleWordCount = React9.useCallback((count) => setWordCount(count), []);
6864
+ const [charCount, setCharCount] = React9.useState(0);
6865
+ const handleCharCount = React9.useCallback((count) => setCharCount(count), []);
6866
+ const [refErrors, setRefErrors] = React9.useState([]);
6867
+ const contentEditableDomRef = React9.useRef(null);
6868
+ const previousOverLimitRef = React9.useRef(false);
6869
+ const focusedRef = React9.useRef(false);
6826
6870
  const setFocused = (focused) => {
6827
6871
  focusedRef.current = focused;
6828
6872
  };
6829
- const containerRef = React6.useRef(null);
6873
+ const containerRef = React9.useRef(null);
6830
6874
  const onAnchorRef = (elem) => {
6831
6875
  if (elem) setFloatingAnchorElem(elem);
6832
6876
  };
@@ -6899,7 +6943,7 @@ var ContentEditorComponent = React6.forwardRef(
6899
6943
  e.stopPropagation();
6900
6944
  }
6901
6945
  };
6902
- const [touched, setTouched] = React6.useState(false);
6946
+ const [touched, setTouched] = React9.useState(false);
6903
6947
  const isOverLimit = props.wordLimit !== void 0 && wordCount > props.wordLimit;
6904
6948
  const internalErrors = [];
6905
6949
  if (isOverLimit) {
@@ -6934,7 +6978,7 @@ var ContentEditorComponent = React6.forwardRef(
6934
6978
  const allErrors = [...internalErrors, ...props.errors ?? [], ...refErrors];
6935
6979
  const hasErrors = allErrors.length > 0;
6936
6980
  const hasRedBorder = hasErrors;
6937
- React6.useEffect(() => {
6981
+ React9.useEffect(() => {
6938
6982
  if (props.wordLimit === void 0 || !props.onWordLimitExceeded) return;
6939
6983
  const wasOverLimit = previousOverLimitRef.current;
6940
6984
  if (isOverLimit !== wasOverLimit) {