@tarviks/lexical-rich-editor 1.3.2 → 1.3.3
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.css +2 -3
- package/dist/index.css.map +1 -1
- package/dist/index.js +291 -302
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -152
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mergeRegister, $wrapNodeInElement, $insertNodeToNearestRoot, $getNearestNodeOfType, $findMatchingParent as $findMatchingParent$1, calculateZoomLevel } from '@lexical/utils';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as React9 from 'react';
|
|
3
|
+
import React9__default, { forwardRef, useState, useCallback, useRef, useEffect, useMemo, useImperativeHandle, Suspense } from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
6
6
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
@@ -642,7 +642,7 @@ function parseDimFromStyleOrAttr(img3) {
|
|
|
642
642
|
var ImageComponent2, isGoogleDocCheckboxImg, $convertImageElement, ImageNode, $createImageNode, $isImageNode;
|
|
643
643
|
var init_ImageNode = __esm({
|
|
644
644
|
"src/Nodes/ImageNode.tsx"() {
|
|
645
|
-
ImageComponent2 =
|
|
645
|
+
ImageComponent2 = React9.lazy(() => Promise.resolve().then(() => (init_ImageComponent(), ImageComponent_exports)));
|
|
646
646
|
isGoogleDocCheckboxImg = (img3) => {
|
|
647
647
|
return img3.parentElement != null && img3.parentElement.tagName === "LI" && img3.previousSibling === null && img3.getAttribute("aria-roledescription") === "checkbox";
|
|
648
648
|
};
|
|
@@ -1061,7 +1061,7 @@ var init_InlineImageComponent = __esm({
|
|
|
1061
1061
|
var InlineImageComponent2, $convertInlineImageElement, InlineImageNode, $createInlineImageNode, $isInlineImageNode;
|
|
1062
1062
|
var init_InlineImageNode = __esm({
|
|
1063
1063
|
"src/Nodes/InlineImageNode.tsx"() {
|
|
1064
|
-
InlineImageComponent2 =
|
|
1064
|
+
InlineImageComponent2 = React9.lazy(() => Promise.resolve().then(() => (init_InlineImageComponent(), InlineImageComponent_exports)));
|
|
1065
1065
|
$convertInlineImageElement = (domNode) => {
|
|
1066
1066
|
if (isHTMLElement(domNode) && domNode.nodeName === "IMG") {
|
|
1067
1067
|
const { alt: altText, src, width, height } = domNode;
|
|
@@ -1702,7 +1702,7 @@ function VideoResizer({
|
|
|
1702
1702
|
onResizeStart,
|
|
1703
1703
|
onResizeEnd
|
|
1704
1704
|
}) {
|
|
1705
|
-
const resizeState =
|
|
1705
|
+
const resizeState = React9.useRef(null);
|
|
1706
1706
|
const startResize = (e, dir) => {
|
|
1707
1707
|
e.preventDefault();
|
|
1708
1708
|
e.stopPropagation();
|
|
@@ -1829,15 +1829,15 @@ function YouTubeComponent({
|
|
|
1829
1829
|
height,
|
|
1830
1830
|
editor
|
|
1831
1831
|
}) {
|
|
1832
|
-
const wrapperRef =
|
|
1833
|
-
const containerRef =
|
|
1834
|
-
const iframeRef =
|
|
1835
|
-
const isResizingRef =
|
|
1832
|
+
const wrapperRef = React9.useRef(null);
|
|
1833
|
+
const containerRef = React9.useRef(null);
|
|
1834
|
+
const iframeRef = React9.useRef(null);
|
|
1835
|
+
const isResizingRef = React9.useRef(false);
|
|
1836
1836
|
const [isNodeSelected, setNodeSelected, clearNodeSelection] = useLexicalNodeSelection(nodeKey);
|
|
1837
|
-
const [isHovered, setIsHovered] =
|
|
1838
|
-
const [isResizing, setIsResizing] =
|
|
1839
|
-
const [isPlaying, setIsPlaying] =
|
|
1840
|
-
|
|
1837
|
+
const [isHovered, setIsHovered] = React9.useState(false);
|
|
1838
|
+
const [isResizing, setIsResizing] = React9.useState(false);
|
|
1839
|
+
const [isPlaying, setIsPlaying] = React9.useState(false);
|
|
1840
|
+
React9.useEffect(() => {
|
|
1841
1841
|
return mergeRegister(
|
|
1842
1842
|
editor.registerCommand(
|
|
1843
1843
|
FORMAT_ELEMENT_COMMAND,
|
|
@@ -2226,13 +2226,13 @@ function AutocompletePlugin({
|
|
|
2226
2226
|
prefixWindow = 300
|
|
2227
2227
|
}) {
|
|
2228
2228
|
const [editor] = useLexicalComposerContext();
|
|
2229
|
-
const ghostKeyRef =
|
|
2230
|
-
const idleTimerRef =
|
|
2231
|
-
const inflightRef =
|
|
2232
|
-
const reqCounterRef =
|
|
2233
|
-
const lastTriggerRef =
|
|
2234
|
-
const lastShownCtxRef =
|
|
2235
|
-
const clearGhost =
|
|
2229
|
+
const ghostKeyRef = React9.useRef(null);
|
|
2230
|
+
const idleTimerRef = React9.useRef(null);
|
|
2231
|
+
const inflightRef = React9.useRef(null);
|
|
2232
|
+
const reqCounterRef = React9.useRef(0);
|
|
2233
|
+
const lastTriggerRef = React9.useRef("");
|
|
2234
|
+
const lastShownCtxRef = React9.useRef("");
|
|
2235
|
+
const clearGhost = React9.useCallback(() => {
|
|
2236
2236
|
editor.update(
|
|
2237
2237
|
() => {
|
|
2238
2238
|
const key = ghostKeyRef.current;
|
|
@@ -2244,7 +2244,7 @@ function AutocompletePlugin({
|
|
|
2244
2244
|
{ tag: "autocomplete-ghost" }
|
|
2245
2245
|
);
|
|
2246
2246
|
}, [editor]);
|
|
2247
|
-
const upsertGhost =
|
|
2247
|
+
const upsertGhost = React9.useCallback(
|
|
2248
2248
|
(text, insertAtCharOffset) => {
|
|
2249
2249
|
editor.update(
|
|
2250
2250
|
() => {
|
|
@@ -2308,12 +2308,12 @@ function AutocompletePlugin({
|
|
|
2308
2308
|
},
|
|
2309
2309
|
[editor]
|
|
2310
2310
|
);
|
|
2311
|
-
const cancelInflight =
|
|
2311
|
+
const cancelInflight = React9.useCallback(() => {
|
|
2312
2312
|
if (!inflightRef.current) return;
|
|
2313
2313
|
inflightRef.current.dismiss();
|
|
2314
2314
|
inflightRef.current = null;
|
|
2315
2315
|
}, []);
|
|
2316
|
-
const resetIdleTimer =
|
|
2316
|
+
const resetIdleTimer = React9.useCallback(
|
|
2317
2317
|
(callback) => {
|
|
2318
2318
|
if (idleTimerRef.current) {
|
|
2319
2319
|
clearTimeout(idleTimerRef.current);
|
|
@@ -2328,7 +2328,7 @@ function AutocompletePlugin({
|
|
|
2328
2328
|
},
|
|
2329
2329
|
[idleMs, cancelInflight, clearGhost]
|
|
2330
2330
|
);
|
|
2331
|
-
const fireQuery =
|
|
2331
|
+
const fireQuery = React9.useCallback(() => {
|
|
2332
2332
|
if (!useQuery || isReadOnly) return;
|
|
2333
2333
|
let context = "";
|
|
2334
2334
|
let prefix = "";
|
|
@@ -2400,7 +2400,7 @@ function AutocompletePlugin({
|
|
|
2400
2400
|
upsertGhost,
|
|
2401
2401
|
onSuggestionShown
|
|
2402
2402
|
]);
|
|
2403
|
-
|
|
2403
|
+
React9.useEffect(() => {
|
|
2404
2404
|
if (!useQuery || isReadOnly) return;
|
|
2405
2405
|
return editor.registerUpdateListener(({ tags }) => {
|
|
2406
2406
|
if (tags.has("history-merge") || tags.has("collaboration")) return;
|
|
@@ -2409,7 +2409,7 @@ function AutocompletePlugin({
|
|
|
2409
2409
|
resetIdleTimer(fireQuery);
|
|
2410
2410
|
});
|
|
2411
2411
|
}, [editor, useQuery, isReadOnly, resetIdleTimer, fireQuery]);
|
|
2412
|
-
|
|
2412
|
+
React9.useEffect(() => {
|
|
2413
2413
|
if (!useQuery || isReadOnly) return;
|
|
2414
2414
|
return editor.registerCommand(
|
|
2415
2415
|
SELECTION_CHANGE_COMMAND,
|
|
@@ -2433,7 +2433,7 @@ function AutocompletePlugin({
|
|
|
2433
2433
|
COMMAND_PRIORITY_LOW
|
|
2434
2434
|
);
|
|
2435
2435
|
}, [editor, useQuery, isReadOnly, resetIdleTimer, fireQuery]);
|
|
2436
|
-
|
|
2436
|
+
React9.useEffect(() => {
|
|
2437
2437
|
return editor.registerCommand(
|
|
2438
2438
|
KEY_DOWN_COMMAND,
|
|
2439
2439
|
(e) => {
|
|
@@ -2474,7 +2474,7 @@ function AutocompletePlugin({
|
|
|
2474
2474
|
COMMAND_PRIORITY_HIGH
|
|
2475
2475
|
);
|
|
2476
2476
|
}, [editor, clearGhost, onSuggestionAccept, prefixWindow]);
|
|
2477
|
-
|
|
2477
|
+
React9.useEffect(() => {
|
|
2478
2478
|
return () => {
|
|
2479
2479
|
cancelInflight();
|
|
2480
2480
|
if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
|
|
@@ -2482,9 +2482,6 @@ function AutocompletePlugin({
|
|
|
2482
2482
|
}, [cancelInflight]);
|
|
2483
2483
|
return null;
|
|
2484
2484
|
}
|
|
2485
|
-
function clamp2(n, min, max) {
|
|
2486
|
-
return Math.max(min, Math.min(max, n));
|
|
2487
|
-
}
|
|
2488
2485
|
function useFloatingPortalContainer(editor) {
|
|
2489
2486
|
const [container, setContainer] = useState(null);
|
|
2490
2487
|
useEffect(() => {
|
|
@@ -2502,6 +2499,22 @@ function useFloatingPortalContainer(editor) {
|
|
|
2502
2499
|
}, [editor]);
|
|
2503
2500
|
return container;
|
|
2504
2501
|
}
|
|
2502
|
+
function getFixedPositionOrigin(fromElement) {
|
|
2503
|
+
let node = fromElement.parentElement;
|
|
2504
|
+
while (node && node !== document.body && node !== document.documentElement) {
|
|
2505
|
+
const style = getComputedStyle(node);
|
|
2506
|
+
const createsContainingBlock = style.transform && style.transform !== "none" || style.perspective && style.perspective !== "none" || style.filter && style.filter !== "none" || style.backdropFilter && style.backdropFilter !== "none" || style.willChange && /transform|perspective|filter/.test(style.willChange) || style.contain && /paint|layout|strict|content/.test(style.contain);
|
|
2507
|
+
if (createsContainingBlock) {
|
|
2508
|
+
const rect = node.getBoundingClientRect();
|
|
2509
|
+
return { top: rect.top, left: rect.left };
|
|
2510
|
+
}
|
|
2511
|
+
node = node.parentElement;
|
|
2512
|
+
}
|
|
2513
|
+
return { top: 0, left: 0 };
|
|
2514
|
+
}
|
|
2515
|
+
function clamp2(n, min, max) {
|
|
2516
|
+
return Math.max(min, Math.min(max, n));
|
|
2517
|
+
}
|
|
2505
2518
|
function setPopupPositionFixed(popupEl, rect, topBoundary) {
|
|
2506
2519
|
const GAP = 8;
|
|
2507
2520
|
const MARGIN = 8;
|
|
@@ -2509,6 +2522,9 @@ function setPopupPositionFixed(popupEl, rect, topBoundary) {
|
|
|
2509
2522
|
let left = rect.left;
|
|
2510
2523
|
if (top < topBoundary) top = rect.bottom + GAP;
|
|
2511
2524
|
left = clamp2(left, MARGIN, window.innerWidth - popupEl.offsetWidth - MARGIN);
|
|
2525
|
+
const origin = getFixedPositionOrigin(popupEl);
|
|
2526
|
+
top -= origin.top;
|
|
2527
|
+
left -= origin.left;
|
|
2512
2528
|
popupEl.style.top = `${top}px`;
|
|
2513
2529
|
popupEl.style.left = `${left}px`;
|
|
2514
2530
|
}
|
|
@@ -3131,23 +3147,6 @@ var getSelectedNode2 = (selection) => {
|
|
|
3131
3147
|
var VERTICAL_GAP = 10;
|
|
3132
3148
|
var HORIZONTAL_OFFSET = 5;
|
|
3133
3149
|
var VIEWPORT_MARGIN = 8;
|
|
3134
|
-
function useFloatingPortalContainer2(editor) {
|
|
3135
|
-
const [container, setContainer] = useState(null);
|
|
3136
|
-
useEffect(() => {
|
|
3137
|
-
const root = editor.getRootElement();
|
|
3138
|
-
if (!root) return;
|
|
3139
|
-
const panelOrLayer = root.closest(".ms-Panel-main") || root.closest(".ms-Panel") || root.closest(".ms-Layer") || document.body;
|
|
3140
|
-
const host = document.createElement("div");
|
|
3141
|
-
host.className = "lexical-floating-ui-host";
|
|
3142
|
-
panelOrLayer.appendChild(host);
|
|
3143
|
-
setContainer(host);
|
|
3144
|
-
return () => {
|
|
3145
|
-
host.remove();
|
|
3146
|
-
setContainer(null);
|
|
3147
|
-
};
|
|
3148
|
-
}, [editor]);
|
|
3149
|
-
return container;
|
|
3150
|
-
}
|
|
3151
3150
|
var setFloatingElemPositionForLinkEditor = (targetRect, floatingElem, topBoundary = VIEWPORT_MARGIN, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET) => {
|
|
3152
3151
|
if (targetRect === null) {
|
|
3153
3152
|
floatingElem.style.opacity = "0";
|
|
@@ -3164,6 +3163,9 @@ var setFloatingElemPositionForLinkEditor = (targetRect, floatingElem, topBoundar
|
|
|
3164
3163
|
top = topBoundary;
|
|
3165
3164
|
}
|
|
3166
3165
|
left = Math.max(VIEWPORT_MARGIN, Math.min(left, window.innerWidth - floatingElemRect.width - VIEWPORT_MARGIN));
|
|
3166
|
+
const origin = getFixedPositionOrigin(floatingElem);
|
|
3167
|
+
top -= origin.top;
|
|
3168
|
+
left -= origin.left;
|
|
3167
3169
|
floatingElem.style.opacity = "1";
|
|
3168
3170
|
floatingElem.style.transform = "none";
|
|
3169
3171
|
floatingElem.style.top = `${top}px`;
|
|
@@ -3418,7 +3420,7 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, isLinkEditMode, setIsLink
|
|
|
3418
3420
|
var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLinkEditMode) => {
|
|
3419
3421
|
const [activeEditor, setActiveEditor] = useState(editor);
|
|
3420
3422
|
const [isLink, setIsLink] = useState(false);
|
|
3421
|
-
const portalContainer =
|
|
3423
|
+
const portalContainer = useFloatingPortalContainer(editor);
|
|
3422
3424
|
useEffect(() => {
|
|
3423
3425
|
function $updateToolbar() {
|
|
3424
3426
|
const selection = $getSelection();
|
|
@@ -3493,7 +3495,6 @@ var FloatingLinkEditorPlugin = ({ anchorElem, isLinkEditMode, setIsLinkEditMode
|
|
|
3493
3495
|
setIsLinkEditMode
|
|
3494
3496
|
);
|
|
3495
3497
|
};
|
|
3496
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React10.useLayoutEffect : React10.useEffect;
|
|
3497
3498
|
var AoModal = ({
|
|
3498
3499
|
isOpen,
|
|
3499
3500
|
onDismiss,
|
|
@@ -3503,18 +3504,8 @@ var AoModal = ({
|
|
|
3503
3504
|
actions,
|
|
3504
3505
|
children
|
|
3505
3506
|
}) => {
|
|
3506
|
-
const [
|
|
3507
|
-
const
|
|
3508
|
-
useIsomorphicLayoutEffect(() => {
|
|
3509
|
-
if (isOpen && mountRef.current) {
|
|
3510
|
-
const root = mountRef.current.closest(".lexical-rich-editor-root");
|
|
3511
|
-
if (root) {
|
|
3512
|
-
setHostElement(root);
|
|
3513
|
-
} else {
|
|
3514
|
-
setHostElement(mountRef.current.parentElement);
|
|
3515
|
-
}
|
|
3516
|
-
}
|
|
3517
|
-
}, [isOpen]);
|
|
3507
|
+
const [editor] = useLexicalComposerContext();
|
|
3508
|
+
const hostElement = useFloatingPortalContainer(editor);
|
|
3518
3509
|
if (!isOpen) return null;
|
|
3519
3510
|
const modalContent = /* @__PURE__ */ jsx("div", { className: "aoModalBackdrop", onClick: onDismiss, children: /* @__PURE__ */ jsxs(
|
|
3520
3511
|
FluentProvider,
|
|
@@ -3541,10 +3532,8 @@ var AoModal = ({
|
|
|
3541
3532
|
]
|
|
3542
3533
|
}
|
|
3543
3534
|
) });
|
|
3544
|
-
if (hostElement)
|
|
3545
|
-
|
|
3546
|
-
}
|
|
3547
|
-
return /* @__PURE__ */ jsx("div", { ref: mountRef, style: { display: "none" } });
|
|
3535
|
+
if (!hostElement) return null;
|
|
3536
|
+
return createPortal(modalContent, hostElement);
|
|
3548
3537
|
};
|
|
3549
3538
|
|
|
3550
3539
|
// src/Plugins/ImagePlugin.tsx
|
|
@@ -4417,8 +4406,8 @@ function RefApiPlugin({
|
|
|
4417
4406
|
focusedRef
|
|
4418
4407
|
}) {
|
|
4419
4408
|
const [editor] = useLexicalComposerContext();
|
|
4420
|
-
const cleanBaselineRef =
|
|
4421
|
-
|
|
4409
|
+
const cleanBaselineRef = React9__default.useRef(null);
|
|
4410
|
+
React9__default.useEffect(() => {
|
|
4422
4411
|
const capture = () => {
|
|
4423
4412
|
if (cleanBaselineRef.current === null) {
|
|
4424
4413
|
cleanBaselineRef.current = getUserContentSignature(editor);
|
|
@@ -4632,28 +4621,28 @@ function SpellPopover({
|
|
|
4632
4621
|
onImprove,
|
|
4633
4622
|
onAcceptGrammar
|
|
4634
4623
|
}) {
|
|
4635
|
-
const ref =
|
|
4624
|
+
const ref = React9.useRef(null);
|
|
4636
4625
|
const type = state.issue.type ?? "spelling";
|
|
4637
|
-
const [pos, setPos] =
|
|
4638
|
-
|
|
4626
|
+
const [pos, setPos] = React9.useState({ left: state.x, top: state.y });
|
|
4627
|
+
React9.useEffect(() => {
|
|
4639
4628
|
if (!ref.current) return;
|
|
4640
4629
|
const { offsetHeight: h, offsetWidth: w } = ref.current;
|
|
4641
4630
|
const top = state.y + h > window.innerHeight - 8 ? state.y - h - 32 : state.y;
|
|
4642
4631
|
setPos({ left: Math.min(state.x, window.innerWidth - w - 8), top });
|
|
4643
4632
|
}, [state.x, state.y]);
|
|
4644
|
-
|
|
4633
|
+
React9.useEffect(() => {
|
|
4645
4634
|
const h = (e) => {
|
|
4646
4635
|
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
4647
4636
|
};
|
|
4648
4637
|
document.addEventListener("mousedown", h, true);
|
|
4649
4638
|
return () => document.removeEventListener("mousedown", h, true);
|
|
4650
4639
|
}, [onClose]);
|
|
4651
|
-
|
|
4640
|
+
React9.useEffect(() => {
|
|
4652
4641
|
const h = () => onClose();
|
|
4653
4642
|
window.addEventListener("scroll", h, { capture: true, passive: true });
|
|
4654
4643
|
return () => window.removeEventListener("scroll", h, true);
|
|
4655
4644
|
}, [onClose]);
|
|
4656
|
-
|
|
4645
|
+
React9.useEffect(() => {
|
|
4657
4646
|
const h = (e) => {
|
|
4658
4647
|
if (e.key === "Escape") onClose();
|
|
4659
4648
|
};
|
|
@@ -4770,17 +4759,17 @@ function SpellCheckPlugin({
|
|
|
4770
4759
|
enabled = true
|
|
4771
4760
|
}) {
|
|
4772
4761
|
const [editor] = useLexicalComposerContext();
|
|
4773
|
-
const timerRef =
|
|
4774
|
-
const dismissRef =
|
|
4775
|
-
const reqIdRef =
|
|
4776
|
-
const lastTextRef =
|
|
4777
|
-
const applyingRef =
|
|
4778
|
-
const grammarCorrectionRef =
|
|
4779
|
-
const [popover, setPopover] =
|
|
4780
|
-
|
|
4762
|
+
const timerRef = React9.useRef(null);
|
|
4763
|
+
const dismissRef = React9.useRef(null);
|
|
4764
|
+
const reqIdRef = React9.useRef(0);
|
|
4765
|
+
const lastTextRef = React9.useRef("");
|
|
4766
|
+
const applyingRef = React9.useRef(false);
|
|
4767
|
+
const grammarCorrectionRef = React9.useRef(void 0);
|
|
4768
|
+
const [popover, setPopover] = React9.useState(null);
|
|
4769
|
+
React9.useEffect(() => {
|
|
4781
4770
|
injectCSS();
|
|
4782
4771
|
}, []);
|
|
4783
|
-
const clearErrors =
|
|
4772
|
+
const clearErrors = React9.useCallback(() => {
|
|
4784
4773
|
setPopover(null);
|
|
4785
4774
|
grammarCorrectionRef.current = void 0;
|
|
4786
4775
|
applyingRef.current = true;
|
|
@@ -4796,7 +4785,7 @@ function SpellCheckPlugin({
|
|
|
4796
4785
|
}
|
|
4797
4786
|
);
|
|
4798
4787
|
}, [editor]);
|
|
4799
|
-
const applyIssues =
|
|
4788
|
+
const applyIssues = React9.useCallback(
|
|
4800
4789
|
(issues, improvedText, trimOffset = 0) => {
|
|
4801
4790
|
let savedCharOffset = -1;
|
|
4802
4791
|
editor.getEditorState().read(() => {
|
|
@@ -4939,7 +4928,7 @@ function SpellCheckPlugin({
|
|
|
4939
4928
|
},
|
|
4940
4929
|
[editor]
|
|
4941
4930
|
);
|
|
4942
|
-
|
|
4931
|
+
React9.useEffect(() => {
|
|
4943
4932
|
let currentRoot = null;
|
|
4944
4933
|
const onClick = (e) => {
|
|
4945
4934
|
const span = e.target.closest("[data-spell-offset]");
|
|
@@ -4983,7 +4972,7 @@ function SpellCheckPlugin({
|
|
|
4983
4972
|
if (currentRoot) currentRoot.removeEventListener("click", onClick);
|
|
4984
4973
|
};
|
|
4985
4974
|
}, [editor]);
|
|
4986
|
-
const handleAccept =
|
|
4975
|
+
const handleAccept = React9.useCallback(
|
|
4987
4976
|
(replacement, nodeKey) => {
|
|
4988
4977
|
let original = "";
|
|
4989
4978
|
editor.getEditorState().read(() => {
|
|
@@ -5009,7 +4998,7 @@ function SpellCheckPlugin({
|
|
|
5009
4998
|
},
|
|
5010
4999
|
[editor, onSpellCheckAccept, popover]
|
|
5011
5000
|
);
|
|
5012
|
-
const handleDismiss =
|
|
5001
|
+
const handleDismiss = React9.useCallback(
|
|
5013
5002
|
(nodeKey) => {
|
|
5014
5003
|
editor.update(
|
|
5015
5004
|
() => {
|
|
@@ -5023,7 +5012,7 @@ function SpellCheckPlugin({
|
|
|
5023
5012
|
},
|
|
5024
5013
|
[editor]
|
|
5025
5014
|
);
|
|
5026
|
-
const handleImprove =
|
|
5015
|
+
const handleImprove = React9.useCallback(
|
|
5027
5016
|
(text) => {
|
|
5028
5017
|
const original = lastTextRef.current;
|
|
5029
5018
|
applyingRef.current = true;
|
|
@@ -5043,7 +5032,7 @@ function SpellCheckPlugin({
|
|
|
5043
5032
|
},
|
|
5044
5033
|
[editor, onSpellCheckAccept]
|
|
5045
5034
|
);
|
|
5046
|
-
const handleAcceptGrammar =
|
|
5035
|
+
const handleAcceptGrammar = React9.useCallback(
|
|
5047
5036
|
(corrected) => {
|
|
5048
5037
|
const original = lastTextRef.current;
|
|
5049
5038
|
applyingRef.current = true;
|
|
@@ -5063,7 +5052,7 @@ function SpellCheckPlugin({
|
|
|
5063
5052
|
},
|
|
5064
5053
|
[editor, onSpellCheckAccept]
|
|
5065
5054
|
);
|
|
5066
|
-
|
|
5055
|
+
React9.useEffect(() => {
|
|
5067
5056
|
if (!enabled || !useSpellCheck) return;
|
|
5068
5057
|
return editor.registerUpdateListener(({ tags }) => {
|
|
5069
5058
|
if (applyingRef.current) return;
|
|
@@ -5101,13 +5090,13 @@ function SpellCheckPlugin({
|
|
|
5101
5090
|
}, idleMs);
|
|
5102
5091
|
});
|
|
5103
5092
|
}, [editor, useSpellCheck, enabled, idleMs, applyIssues, clearErrors]);
|
|
5104
|
-
|
|
5093
|
+
React9.useEffect(() => {
|
|
5105
5094
|
if (!enabled) {
|
|
5106
5095
|
clearErrors();
|
|
5107
5096
|
lastTextRef.current = "";
|
|
5108
5097
|
}
|
|
5109
5098
|
}, [enabled, clearErrors]);
|
|
5110
|
-
|
|
5099
|
+
React9.useEffect(
|
|
5111
5100
|
() => () => {
|
|
5112
5101
|
dismissRef.current?.();
|
|
5113
5102
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
@@ -5128,13 +5117,13 @@ function SpellCheckPlugin({
|
|
|
5128
5117
|
}
|
|
5129
5118
|
function TableActionMenuPlugin({ disabled = false }) {
|
|
5130
5119
|
const [editor] = useLexicalComposerContext();
|
|
5131
|
-
const [isInTable, setIsInTable] =
|
|
5132
|
-
const [anchorRect, setAnchorRect] =
|
|
5133
|
-
const [contentRight, setContentRight] =
|
|
5134
|
-
const [open, setOpen] =
|
|
5135
|
-
const openRef =
|
|
5136
|
-
const savedAnchorRef =
|
|
5137
|
-
const measureContentRight =
|
|
5120
|
+
const [isInTable, setIsInTable] = React9.useState(false);
|
|
5121
|
+
const [anchorRect, setAnchorRect] = React9.useState(null);
|
|
5122
|
+
const [contentRight, setContentRight] = React9.useState(null);
|
|
5123
|
+
const [open, setOpen] = React9.useState(false);
|
|
5124
|
+
const openRef = React9.useRef(false);
|
|
5125
|
+
const savedAnchorRef = React9.useRef(null);
|
|
5126
|
+
const measureContentRight = React9.useCallback((cellDom) => {
|
|
5138
5127
|
try {
|
|
5139
5128
|
const range = document.createRange();
|
|
5140
5129
|
range.selectNodeContents(cellDom);
|
|
@@ -5144,7 +5133,7 @@ function TableActionMenuPlugin({ disabled = false }) {
|
|
|
5144
5133
|
return null;
|
|
5145
5134
|
}
|
|
5146
5135
|
}, []);
|
|
5147
|
-
const updateFromSelection =
|
|
5136
|
+
const updateFromSelection = React9.useCallback(() => {
|
|
5148
5137
|
if (openRef.current) return;
|
|
5149
5138
|
const root = editor.getRootElement();
|
|
5150
5139
|
if (!root) return;
|
|
@@ -5195,7 +5184,7 @@ function TableActionMenuPlugin({ disabled = false }) {
|
|
|
5195
5184
|
}
|
|
5196
5185
|
});
|
|
5197
5186
|
}, [editor, measureContentRight]);
|
|
5198
|
-
|
|
5187
|
+
React9.useEffect(() => {
|
|
5199
5188
|
return mergeRegister(
|
|
5200
5189
|
editor.registerCommand(
|
|
5201
5190
|
SELECTION_CHANGE_COMMAND,
|
|
@@ -5210,7 +5199,7 @@ function TableActionMenuPlugin({ disabled = false }) {
|
|
|
5210
5199
|
})
|
|
5211
5200
|
);
|
|
5212
5201
|
}, [editor, updateFromSelection]);
|
|
5213
|
-
|
|
5202
|
+
React9.useEffect(() => {
|
|
5214
5203
|
return editor.registerCommand(
|
|
5215
5204
|
KEY_DOWN_COMMAND,
|
|
5216
5205
|
(event) => {
|
|
@@ -5252,7 +5241,7 @@ function TableActionMenuPlugin({ disabled = false }) {
|
|
|
5252
5241
|
);
|
|
5253
5242
|
}, [editor, disabled]);
|
|
5254
5243
|
const canShow = isInTable && !!anchorRect && !disabled;
|
|
5255
|
-
const handleStyle =
|
|
5244
|
+
const handleStyle = React9.useMemo(() => {
|
|
5256
5245
|
if (!anchorRect) return void 0;
|
|
5257
5246
|
const top = Math.max(8, anchorRect.top + 6);
|
|
5258
5247
|
const clampedCellRight = Math.min(anchorRect.right, window.innerWidth - 8);
|
|
@@ -5267,7 +5256,7 @@ function TableActionMenuPlugin({ disabled = false }) {
|
|
|
5267
5256
|
const dangerStyle = {
|
|
5268
5257
|
color: "var(--colorPaletteRedForeground1)"
|
|
5269
5258
|
};
|
|
5270
|
-
const run =
|
|
5259
|
+
const run = React9.useCallback(
|
|
5271
5260
|
(fn) => {
|
|
5272
5261
|
if (disabled) return;
|
|
5273
5262
|
openRef.current = false;
|
|
@@ -5828,22 +5817,22 @@ var hsvToRgb = (h, s, v) => {
|
|
|
5828
5817
|
};
|
|
5829
5818
|
};
|
|
5830
5819
|
var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange }) => {
|
|
5831
|
-
const [open, setOpen] =
|
|
5832
|
-
const btnRef =
|
|
5833
|
-
const setOpenAndNotify =
|
|
5820
|
+
const [open, setOpen] = React9.useState(false);
|
|
5821
|
+
const btnRef = React9.useRef(null);
|
|
5822
|
+
const setOpenAndNotify = React9.useCallback(
|
|
5834
5823
|
(next) => {
|
|
5835
5824
|
setOpen(next);
|
|
5836
5825
|
onOpenChange?.(next);
|
|
5837
5826
|
},
|
|
5838
5827
|
[onOpenChange]
|
|
5839
5828
|
);
|
|
5840
|
-
const handleDismiss =
|
|
5841
|
-
const preventDismissOnEvent =
|
|
5829
|
+
const handleDismiss = React9.useCallback(() => setOpenAndNotify(false), [setOpenAndNotify]);
|
|
5830
|
+
const preventDismissOnEvent = React9.useCallback(
|
|
5842
5831
|
(ev) => ev.type !== "click",
|
|
5843
5832
|
[]
|
|
5844
5833
|
);
|
|
5845
|
-
const [, forceReposition] =
|
|
5846
|
-
|
|
5834
|
+
const [, forceReposition] = React9.useState(0);
|
|
5835
|
+
React9.useEffect(() => {
|
|
5847
5836
|
if (!open) return;
|
|
5848
5837
|
let rafId = null;
|
|
5849
5838
|
const reposition = () => {
|
|
@@ -5861,15 +5850,15 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5861
5850
|
window.removeEventListener("resize", reposition);
|
|
5862
5851
|
};
|
|
5863
5852
|
}, [open]);
|
|
5864
|
-
const appliedHex =
|
|
5865
|
-
const [hex, setHexState] =
|
|
5866
|
-
const [hexText, setHexText] =
|
|
5867
|
-
const { r, g, b } =
|
|
5868
|
-
const hsv =
|
|
5869
|
-
const [h, setH] =
|
|
5870
|
-
const [s, setS] =
|
|
5871
|
-
const [v, setV] =
|
|
5872
|
-
const commit =
|
|
5853
|
+
const appliedHex = React9.useMemo(() => normalizeHex(value || "#000000"), [value]);
|
|
5854
|
+
const [hex, setHexState] = React9.useState(appliedHex);
|
|
5855
|
+
const [hexText, setHexText] = React9.useState(appliedHex);
|
|
5856
|
+
const { r, g, b } = React9.useMemo(() => hexToRgb(hex), [hex]);
|
|
5857
|
+
const hsv = React9.useMemo(() => rgbToHsv(r, g, b), [r, g, b]);
|
|
5858
|
+
const [h, setH] = React9.useState(hsv.h);
|
|
5859
|
+
const [s, setS] = React9.useState(hsv.s);
|
|
5860
|
+
const [v, setV] = React9.useState(hsv.v);
|
|
5861
|
+
const commit = React9.useCallback(
|
|
5873
5862
|
(nextHex) => {
|
|
5874
5863
|
const rgb = hexToRgb(nextHex);
|
|
5875
5864
|
const next = rgbToHsv(rgb.r, rgb.g, rgb.b);
|
|
@@ -5882,7 +5871,7 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5882
5871
|
},
|
|
5883
5872
|
[onChange]
|
|
5884
5873
|
);
|
|
5885
|
-
const commitFromHsv =
|
|
5874
|
+
const commitFromHsv = React9.useCallback(
|
|
5886
5875
|
(hh, ss, vv) => {
|
|
5887
5876
|
const rgb = hsvToRgb(hh, ss, vv);
|
|
5888
5877
|
const nextHex = rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
@@ -5895,8 +5884,8 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5895
5884
|
},
|
|
5896
5885
|
[onChange]
|
|
5897
5886
|
);
|
|
5898
|
-
const wasOpenRef =
|
|
5899
|
-
|
|
5887
|
+
const wasOpenRef = React9.useRef(open);
|
|
5888
|
+
React9.useEffect(() => {
|
|
5900
5889
|
const justOpened = open && !wasOpenRef.current;
|
|
5901
5890
|
wasOpenRef.current = open;
|
|
5902
5891
|
if (!justOpened) return;
|
|
@@ -5908,8 +5897,8 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5908
5897
|
setS(next.s);
|
|
5909
5898
|
setV(next.v);
|
|
5910
5899
|
}, [appliedHex, open]);
|
|
5911
|
-
const svRef =
|
|
5912
|
-
const svPointFromEvent =
|
|
5900
|
+
const svRef = React9.useRef(null);
|
|
5901
|
+
const svPointFromEvent = React9.useCallback((clientX, clientY) => {
|
|
5913
5902
|
if (!svRef.current) return null;
|
|
5914
5903
|
const rect = svRef.current.getBoundingClientRect();
|
|
5915
5904
|
const x = clamp3(clientX - rect.left, 0, rect.width);
|
|
@@ -5918,9 +5907,9 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5918
5907
|
const vv = rect.height === 0 ? 0 : 1 - y / rect.height;
|
|
5919
5908
|
return { ss, vv };
|
|
5920
5909
|
}, []);
|
|
5921
|
-
const hRef =
|
|
5910
|
+
const hRef = React9.useRef(h);
|
|
5922
5911
|
hRef.current = h;
|
|
5923
|
-
const handleSVPointerDown =
|
|
5912
|
+
const handleSVPointerDown = React9.useCallback(
|
|
5924
5913
|
(e) => {
|
|
5925
5914
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
5926
5915
|
const pt = svPointFromEvent(e.clientX, e.clientY);
|
|
@@ -5928,7 +5917,7 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5928
5917
|
},
|
|
5929
5918
|
[svPointFromEvent, commitFromHsv]
|
|
5930
5919
|
);
|
|
5931
|
-
const handleSVPointerMove =
|
|
5920
|
+
const handleSVPointerMove = React9.useCallback(
|
|
5932
5921
|
(e) => {
|
|
5933
5922
|
if (e.buttons !== 1) return;
|
|
5934
5923
|
const pt = svPointFromEvent(e.clientX, e.clientY);
|
|
@@ -5936,18 +5925,18 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5936
5925
|
},
|
|
5937
5926
|
[svPointFromEvent, commitFromHsv]
|
|
5938
5927
|
);
|
|
5939
|
-
const hueRef =
|
|
5940
|
-
const sRef =
|
|
5928
|
+
const hueRef = React9.useRef(null);
|
|
5929
|
+
const sRef = React9.useRef(s);
|
|
5941
5930
|
sRef.current = s;
|
|
5942
|
-
const vRef =
|
|
5931
|
+
const vRef = React9.useRef(v);
|
|
5943
5932
|
vRef.current = v;
|
|
5944
|
-
const huePointFromEvent =
|
|
5933
|
+
const huePointFromEvent = React9.useCallback((clientX) => {
|
|
5945
5934
|
if (!hueRef.current) return null;
|
|
5946
5935
|
const rect = hueRef.current.getBoundingClientRect();
|
|
5947
5936
|
const x = clamp3(clientX - rect.left, 0, rect.width);
|
|
5948
5937
|
return rect.width === 0 ? 0 : x / rect.width * 360;
|
|
5949
5938
|
}, []);
|
|
5950
|
-
const handleHuePointerDown =
|
|
5939
|
+
const handleHuePointerDown = React9.useCallback(
|
|
5951
5940
|
(e) => {
|
|
5952
5941
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
5953
5942
|
const hh = huePointFromEvent(e.clientX);
|
|
@@ -5955,7 +5944,7 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5955
5944
|
},
|
|
5956
5945
|
[huePointFromEvent, commitFromHsv]
|
|
5957
5946
|
);
|
|
5958
|
-
const handleHuePointerMove =
|
|
5947
|
+
const handleHuePointerMove = React9.useCallback(
|
|
5959
5948
|
(e) => {
|
|
5960
5949
|
if (e.buttons !== 1) return;
|
|
5961
5950
|
const hh = huePointFromEvent(e.clientX);
|
|
@@ -5963,7 +5952,7 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5963
5952
|
},
|
|
5964
5953
|
[huePointFromEvent, commitFromHsv]
|
|
5965
5954
|
);
|
|
5966
|
-
const handleHexChange =
|
|
5955
|
+
const handleHexChange = React9.useCallback(
|
|
5967
5956
|
(_, val) => {
|
|
5968
5957
|
const next = val ?? "";
|
|
5969
5958
|
setHexText(next);
|
|
@@ -5971,12 +5960,12 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
5971
5960
|
},
|
|
5972
5961
|
[commit]
|
|
5973
5962
|
);
|
|
5974
|
-
const handleHexBlur =
|
|
5963
|
+
const handleHexBlur = React9.useCallback(() => {
|
|
5975
5964
|
commit(normalizeHex(hexText));
|
|
5976
5965
|
}, [hexText, commit]);
|
|
5977
|
-
const svThumb =
|
|
5978
|
-
const hueThumb =
|
|
5979
|
-
const hueColor =
|
|
5966
|
+
const svThumb = React9.useMemo(() => ({ left: `${s * 100}%`, top: `${(1 - v) * 100}%` }), [s, v]);
|
|
5967
|
+
const hueThumb = React9.useMemo(() => ({ left: `${h / 360 * 100}%` }), [h]);
|
|
5968
|
+
const hueColor = React9.useMemo(() => {
|
|
5980
5969
|
const { r: r2, g: g2, b: b2 } = hsvToRgb(h, 1, 1);
|
|
5981
5970
|
return rgbToHex(r2, g2, b2);
|
|
5982
5971
|
}, [h]);
|
|
@@ -6222,8 +6211,8 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon, onOpenChange
|
|
|
6222
6211
|
};
|
|
6223
6212
|
var ColorPickerPlugin = ({ disabled }) => {
|
|
6224
6213
|
const [editor] = useLexicalComposerContext();
|
|
6225
|
-
const [{ color, bgColor }, setColors] =
|
|
6226
|
-
const lastRangeSelectionRef =
|
|
6214
|
+
const [{ color, bgColor }, setColors] = React9__default.useState({ color: "#000000", bgColor: "#ffffff" });
|
|
6215
|
+
const lastRangeSelectionRef = React9__default.useRef(null);
|
|
6227
6216
|
const updateToolbar = () => {
|
|
6228
6217
|
const selection = $getSelection();
|
|
6229
6218
|
if ($isRangeSelection(selection)) {
|
|
@@ -6233,7 +6222,7 @@ var ColorPickerPlugin = ({ disabled }) => {
|
|
|
6233
6222
|
setColors({ color: c, bgColor: bg });
|
|
6234
6223
|
}
|
|
6235
6224
|
};
|
|
6236
|
-
|
|
6225
|
+
React9__default.useEffect(() => {
|
|
6237
6226
|
return mergeRegister(
|
|
6238
6227
|
editor.registerUpdateListener(({ editorState }) => {
|
|
6239
6228
|
editorState.read(() => updateToolbar());
|
|
@@ -6248,7 +6237,7 @@ var ColorPickerPlugin = ({ disabled }) => {
|
|
|
6248
6237
|
)
|
|
6249
6238
|
);
|
|
6250
6239
|
}, [editor]);
|
|
6251
|
-
const wasEditorActiveRef =
|
|
6240
|
+
const wasEditorActiveRef = React9__default.useRef(false);
|
|
6252
6241
|
const handleOpenChange = (open) => {
|
|
6253
6242
|
if (open) {
|
|
6254
6243
|
const root = editor.getRootElement();
|
|
@@ -6466,9 +6455,9 @@ var useStyles3 = makeStyles({
|
|
|
6466
6455
|
var FontSizePlugin = ({ disabled }) => {
|
|
6467
6456
|
const [editor] = useLexicalComposerContext();
|
|
6468
6457
|
const styles = useStyles3();
|
|
6469
|
-
const [fontSize2, setFontSize] =
|
|
6458
|
+
const [fontSize2, setFontSize] = React9.useState(String(DEFAULT_FONT_SIZE));
|
|
6470
6459
|
const fg = disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#333333";
|
|
6471
|
-
|
|
6460
|
+
React9.useEffect(() => {
|
|
6472
6461
|
const readFontSize = () => {
|
|
6473
6462
|
const selection = $getSelection();
|
|
6474
6463
|
if ($isRangeSelection(selection)) {
|
|
@@ -6875,7 +6864,7 @@ var ToolBarPlugins = (props) => {
|
|
|
6875
6864
|
const [alignment, setAlignment] = useState("left");
|
|
6876
6865
|
const [hasTextSelection, setHasTextSelection] = useState(false);
|
|
6877
6866
|
const [decoratorOpen, setDecoratorOpen] = useState(false);
|
|
6878
|
-
const decoratorSelectingRef =
|
|
6867
|
+
const decoratorSelectingRef = React9__default.useRef(false);
|
|
6879
6868
|
const presetGroups = props.customToolbar ?? getToolbarGroupsByLevel(props.level);
|
|
6880
6869
|
const pluginGroups = useMemo(() => sanitizePluginGroups(presetGroups), [presetGroups]);
|
|
6881
6870
|
const updateToolbarPlugins = () => {
|
|
@@ -6947,7 +6936,7 @@ var ToolBarPlugins = (props) => {
|
|
|
6947
6936
|
}
|
|
6948
6937
|
});
|
|
6949
6938
|
};
|
|
6950
|
-
|
|
6939
|
+
React9__default.useEffect(() => {
|
|
6951
6940
|
return mergeRegister(
|
|
6952
6941
|
editor.registerEditableListener((editable) => {
|
|
6953
6942
|
setIsEditable(editable);
|
|
@@ -7821,7 +7810,7 @@ var ToolBarPlugins = (props) => {
|
|
|
7821
7810
|
padding: "0px",
|
|
7822
7811
|
minHeight: 36
|
|
7823
7812
|
},
|
|
7824
|
-
children: pluginGroups.map((group, groupIndex) => /* @__PURE__ */ jsx(
|
|
7813
|
+
children: pluginGroups.map((group, groupIndex) => /* @__PURE__ */ jsx(React9__default.Fragment, { children: group.map((token, tokenIndex) => {
|
|
7825
7814
|
try {
|
|
7826
7815
|
return renderToken(token, groupIndex, tokenIndex);
|
|
7827
7816
|
} catch {
|
|
@@ -8148,12 +8137,12 @@ function EditorReadyPlugin({ onReady }) {
|
|
|
8148
8137
|
var ContentEditorComponent = forwardRef(
|
|
8149
8138
|
(props, ref) => {
|
|
8150
8139
|
const isReadOnly = !!props.readOnly;
|
|
8151
|
-
const resolvedSpellCheck =
|
|
8140
|
+
const resolvedSpellCheck = React9__default.useMemo(
|
|
8152
8141
|
() => props.spellCheckFn ? _makeSpellCheckFn(props.spellCheckFn) : props.useSpellCheck,
|
|
8153
8142
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8154
8143
|
[props.spellCheckFn, props.useSpellCheck]
|
|
8155
8144
|
);
|
|
8156
|
-
const resolvedQuery =
|
|
8145
|
+
const resolvedQuery = React9__default.useMemo(
|
|
8157
8146
|
() => props.suggestFn ? _makeQueryFn(props.suggestFn) : props.useQuery,
|
|
8158
8147
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8159
8148
|
[props.suggestFn, props.useQuery]
|
|
@@ -8181,7 +8170,7 @@ var ContentEditorComponent = forwardRef(
|
|
|
8181
8170
|
const onAnchorRef = (elem) => {
|
|
8182
8171
|
if (elem) setFloatingAnchorElem(elem);
|
|
8183
8172
|
};
|
|
8184
|
-
const initialConfig =
|
|
8173
|
+
const initialConfig = React9__default.useMemo(() => {
|
|
8185
8174
|
const config = {
|
|
8186
8175
|
namespace: props.namespace ?? "",
|
|
8187
8176
|
theme,
|
|
@@ -8271,7 +8260,7 @@ var ContentEditorComponent = forwardRef(
|
|
|
8271
8260
|
previousOverLimitRef.current = isOverLimit;
|
|
8272
8261
|
}
|
|
8273
8262
|
}, [isOverLimit, wordCount, props.wordLimit, props.onWordLimitExceeded]);
|
|
8274
|
-
const validationErrors =
|
|
8263
|
+
const validationErrors = React9__default.useMemo(() => {
|
|
8275
8264
|
const errors = [];
|
|
8276
8265
|
const custom = props.validationMessages ?? {};
|
|
8277
8266
|
const { words, chars, images, links, tables } = metrics;
|