@tarviks/lexical-rich-editor 1.3.1 → 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.mjs CHANGED
@@ -7,7 +7,7 @@ import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
7
7
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection';
8
8
  import { createCommand, DecoratorNode, COMMAND_PRIORITY_HIGH, TextNode, ElementNode, SELECTION_CHANGE_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, $getSelection, $isRangeSelection, $findMatchingParent, COMMAND_PRIORITY_LOW, KEY_DOWN_COMMAND, $getNodeByKey, $createRangeSelection, $setSelection, $createParagraphNode, $insertNodes, $isRootOrShadowRoot, COMMAND_PRIORITY_EDITOR, PASTE_COMMAND, DRAGSTART_COMMAND, DRAGOVER_COMMAND, DROP_COMMAND, $getRoot, $createTextNode, $isTextNode, $isElementNode, FORMAT_ELEMENT_COMMAND, CLICK_COMMAND, $isNodeSelection, $applyNodeReplacement, FORMAT_TEXT_COMMAND, $isDecoratorNode, $getNearestNodeFromDOMNode, COMMAND_PRIORITY_CRITICAL, REDO_COMMAND, UNDO_COMMAND, getDOMSelection, KEY_ESCAPE_COMMAND, isHTMLElement, getDOMSelectionFromTarget, $isLineBreakNode, SKIP_SELECTION_FOCUS_TAG, createEditor, KEY_ENTER_COMMAND } from 'lexical';
9
9
  import { mergeStyleSets, Stack, css, useTheme, Callout, TextField } from '@fluentui/react';
10
- import { makeStyles, FluentProvider, webLightTheme, Menu, MenuTrigger, MenuPopover, MenuList, MenuGroup, MenuGroupHeader, MenuItem, MenuDivider, Dropdown, Option, Button, ToolbarDivider, MenuItemRadio, Dialog, DialogTrigger, DialogSurface, DialogBody, DialogTitle, DialogContent, Field, Input, DialogActions, MessageBar, MessageBarBody } from '@fluentui/react-components';
10
+ import { makeStyles, FluentProvider, webLightTheme, Menu, MenuTrigger, MenuPopover, MenuList, MenuGroup, MenuGroupHeader, MenuItem, MenuDivider, Dropdown, Option, Button, ToolbarDivider, MenuItemRadio, Field, Input, MessageBar, MessageBarBody } from '@fluentui/react-components';
11
11
  import { CodeHighlightNode, CodeNode, $isCodeHighlightNode } from '@lexical/code';
12
12
  import { LinkNode, AutoLinkNode, $isLinkNode, $isAutoLinkNode, TOGGLE_LINK_COMMAND, $createLinkNode } from '@lexical/link';
13
13
  import { ListNode, ListItemNode, $isListNode, REMOVE_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, $removeList, $insertList, $isListItemNode } from '@lexical/list';
@@ -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
  }
@@ -3130,28 +3146,30 @@ var getSelectedNode2 = (selection) => {
3130
3146
  };
3131
3147
  var VERTICAL_GAP = 10;
3132
3148
  var HORIZONTAL_OFFSET = 5;
3133
- var setFloatingElemPositionForLinkEditor = (targetRect, floatingElem, anchorElem, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET) => {
3134
- const scrollerElem = anchorElem.parentElement;
3135
- if (targetRect === null || !scrollerElem) {
3149
+ var VIEWPORT_MARGIN = 8;
3150
+ var setFloatingElemPositionForLinkEditor = (targetRect, floatingElem, topBoundary = VIEWPORT_MARGIN, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET) => {
3151
+ if (targetRect === null) {
3136
3152
  floatingElem.style.opacity = "0";
3137
3153
  floatingElem.style.transform = "translate(-10000px, -10000px)";
3138
3154
  return;
3139
3155
  }
3140
3156
  const floatingElemRect = floatingElem.getBoundingClientRect();
3141
- const anchorElementRect = anchorElem.getBoundingClientRect();
3142
- const editorScrollerRect = scrollerElem.getBoundingClientRect();
3143
- let top = targetRect.top - verticalGap;
3157
+ let top = targetRect.bottom + verticalGap;
3144
3158
  let left = targetRect.left - horizontalOffset;
3145
- if (top < editorScrollerRect.top) {
3146
- top += floatingElemRect.height + targetRect.height + verticalGap * 2;
3159
+ if (top + floatingElemRect.height > window.innerHeight - VIEWPORT_MARGIN) {
3160
+ top = targetRect.top - floatingElemRect.height - verticalGap;
3147
3161
  }
3148
- if (left + floatingElemRect.width > editorScrollerRect.right) {
3149
- left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
3162
+ if (top < topBoundary) {
3163
+ top = topBoundary;
3150
3164
  }
3151
- top -= anchorElementRect.top;
3152
- left -= anchorElementRect.left;
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;
3153
3169
  floatingElem.style.opacity = "1";
3154
- floatingElem.style.transform = `translate(${left}px, ${top}px)`;
3170
+ floatingElem.style.transform = "none";
3171
+ floatingElem.style.top = `${top}px`;
3172
+ floatingElem.style.left = `${left}px`;
3155
3173
  };
3156
3174
  var SUPPORTED_URL_PROTOCOLS = /* @__PURE__ */ new Set([
3157
3175
  "http:",
@@ -3174,7 +3192,7 @@ var sanitizeUrl = (url) => {
3174
3192
  var preventDefault = (event) => {
3175
3193
  event.preventDefault();
3176
3194
  };
3177
- var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMode, setIsLinkEditMode }) => {
3195
+ var FloatingLinkEditor = ({ editor, isLink, setIsLink, isLinkEditMode, setIsLinkEditMode }) => {
3178
3196
  const [editedLinkUrl, setEditedLinkUrl] = useState("https://");
3179
3197
  const [lastSelection, setLastSelection] = useState(null);
3180
3198
  const [linkUrl, setLinkUrl] = useState("");
@@ -3206,38 +3224,37 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMod
3206
3224
  if (isLink && selection !== null && nativeSelection !== null && rootElement !== null && rootElement.contains(nativeSelection.anchorNode) && editor.isEditable()) {
3207
3225
  const domRect = nativeSelection.focusNode?.parentElement?.getBoundingClientRect();
3208
3226
  if (domRect) {
3209
- domRect.y += 40;
3210
- setFloatingElemPositionForLinkEditor(domRect, editorElem, anchorElem);
3227
+ const toolbarEl = rootElement.closest(".lexical-rich-editor-root")?.querySelector(".editor-toolbar-root");
3228
+ const topBoundary = toolbarEl ? toolbarEl.getBoundingClientRect().bottom + 8 : 8;
3229
+ setFloatingElemPositionForLinkEditor(domRect, editorElem, topBoundary);
3211
3230
  }
3212
3231
  setLastSelection(selection);
3213
3232
  } else if (!activeElement || activeElement.className !== "aoLinkInput") {
3214
3233
  if (rootElement !== null) {
3215
- setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem);
3234
+ setFloatingElemPositionForLinkEditor(null, editorElem);
3216
3235
  }
3217
3236
  setLastSelection(null);
3218
3237
  setIsLinkEditMode(false);
3219
3238
  setLinkUrl("");
3220
3239
  }
3221
3240
  return true;
3222
- }, [anchorElem, editor, setIsLinkEditMode, isLinkEditMode, isLink, linkUrl]);
3241
+ }, [editor, setIsLinkEditMode, isLinkEditMode, isLink, linkUrl]);
3223
3242
  useEffect(() => {
3224
- const scrollerElem = anchorElem.parentElement;
3225
3243
  const update = () => {
3226
3244
  editor.getEditorState().read(() => {
3227
3245
  $updateLinkEditor();
3228
3246
  });
3229
3247
  };
3248
+ const root = editor.getRootElement();
3230
3249
  window.addEventListener("resize", update);
3231
- if (scrollerElem) {
3232
- scrollerElem.addEventListener("scroll", update);
3233
- }
3250
+ window.addEventListener("scroll", update, true);
3251
+ root?.addEventListener("scroll", update, { passive: true });
3234
3252
  return () => {
3235
3253
  window.removeEventListener("resize", update);
3236
- if (scrollerElem) {
3237
- scrollerElem.removeEventListener("scroll", update);
3238
- }
3254
+ window.removeEventListener("scroll", update, true);
3255
+ root?.removeEventListener("scroll", update);
3239
3256
  };
3240
- }, [anchorElem.parentElement, editor, $updateLinkEditor]);
3257
+ }, [editor, $updateLinkEditor]);
3241
3258
  useEffect(() => {
3242
3259
  return mergeRegister(
3243
3260
  editor.registerUpdateListener(({ editorState }) => {
@@ -3403,6 +3420,7 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, anchorElem, isLinkEditMod
3403
3420
  var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLinkEditMode) => {
3404
3421
  const [activeEditor, setActiveEditor] = useState(editor);
3405
3422
  const [isLink, setIsLink] = useState(false);
3423
+ const portalContainer = useFloatingPortalContainer(editor);
3406
3424
  useEffect(() => {
3407
3425
  function $updateToolbar() {
3408
3426
  const selection = $getSelection();
@@ -3450,7 +3468,7 @@ var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLin
3450
3468
  )
3451
3469
  );
3452
3470
  }, [editor]);
3453
- if (!anchorElem || !(anchorElem instanceof HTMLElement)) {
3471
+ if (!anchorElem || !(anchorElem instanceof HTMLElement) || !portalContainer) {
3454
3472
  return null;
3455
3473
  }
3456
3474
  return createPortal(
@@ -3460,12 +3478,11 @@ var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLin
3460
3478
  isLink,
3461
3479
  editor: activeEditor,
3462
3480
  setIsLink,
3463
- anchorElem,
3464
3481
  isLinkEditMode,
3465
3482
  setIsLinkEditMode
3466
3483
  }
3467
3484
  ),
3468
- anchorElem
3485
+ portalContainer
3469
3486
  );
3470
3487
  };
3471
3488
  var FloatingLinkEditorPlugin = ({ anchorElem, isLinkEditMode, setIsLinkEditMode }) => {
@@ -3478,6 +3495,48 @@ var FloatingLinkEditorPlugin = ({ anchorElem, isLinkEditMode, setIsLinkEditMode
3478
3495
  setIsLinkEditMode
3479
3496
  );
3480
3497
  };
3498
+ var AoModal = ({
3499
+ isOpen,
3500
+ onDismiss,
3501
+ title,
3502
+ maxWidth = 280,
3503
+ // Default to a smaller, compact size
3504
+ actions,
3505
+ children
3506
+ }) => {
3507
+ const [editor] = useLexicalComposerContext();
3508
+ const hostElement = useFloatingPortalContainer(editor);
3509
+ if (!isOpen) return null;
3510
+ const modalContent = /* @__PURE__ */ jsx("div", { className: "aoModalBackdrop", onClick: onDismiss, children: /* @__PURE__ */ jsxs(
3511
+ FluentProvider,
3512
+ {
3513
+ theme: webLightTheme,
3514
+ className: "aoModalWrapper aoModalContainer",
3515
+ style: { maxWidth, width: "90vw" },
3516
+ onClick: (e) => e.stopPropagation(),
3517
+ children: [
3518
+ /* @__PURE__ */ jsxs("div", { className: "aoModalHeader", children: [
3519
+ /* @__PURE__ */ jsx("h2", { className: "aoModalTitle", children: title }),
3520
+ /* @__PURE__ */ jsx(
3521
+ "button",
3522
+ {
3523
+ className: "aoModalCloseButton",
3524
+ "aria-label": "Close popup",
3525
+ onClick: onDismiss,
3526
+ children: "\u2715"
3527
+ }
3528
+ )
3529
+ ] }),
3530
+ /* @__PURE__ */ jsx("div", { className: "aoModalBody", children }),
3531
+ actions && /* @__PURE__ */ jsx("div", { className: "aoModalActions", children: actions })
3532
+ ]
3533
+ }
3534
+ ) });
3535
+ if (!hostElement) return null;
3536
+ return createPortal(modalContent, hostElement);
3537
+ };
3538
+
3539
+ // src/Plugins/ImagePlugin.tsx
3481
3540
  init_ImageNode();
3482
3541
  var INSERT_IMAGE_COMMAND = createCommand("INSERT_IMAGE_COMMAND");
3483
3542
  var readClipboardImageAsDataURL = async (event) => {
@@ -3611,108 +3670,105 @@ var InsertImageDialog = ({
3611
3670
  };
3612
3671
  reader.readAsDataURL(file);
3613
3672
  };
3614
- return /* @__PURE__ */ jsxs(
3615
- Dialog,
3616
- {
3617
- open: disabled ? false : isOpen,
3618
- onOpenChange: (_, data) => {
3619
- if (!disabled) setIsOpen(data.open);
3673
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3674
+ /* @__PURE__ */ jsx(
3675
+ Button,
3676
+ {
3677
+ size: "small",
3678
+ title: "Add Image",
3679
+ disabled,
3680
+ icon: /* @__PURE__ */ jsx(ImageAddRegular, { style: { color: iconColor } }),
3681
+ style: {
3682
+ background: isOpen && !disabled ? "#ebebeb" : "none",
3683
+ border: "none",
3684
+ margin: 2,
3685
+ opacity: disabled ? 0.55 : 1,
3686
+ cursor: disabled ? "not-allowed" : "pointer"
3687
+ },
3688
+ onClick: () => {
3689
+ if (disabled) return;
3690
+ setIsOpen((prev) => !prev);
3691
+ setSrc("");
3692
+ setAltText("");
3693
+ setFileName("");
3694
+ }
3620
3695
  },
3621
- children: [
3622
- /* @__PURE__ */ jsx(DialogTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(
3623
- Button,
3624
- {
3625
- size: "small",
3626
- title: "Add Image",
3627
- disabled,
3628
- icon: /* @__PURE__ */ jsx(ImageAddRegular, { style: { color: iconColor } }),
3629
- style: {
3630
- background: isOpen && !disabled ? "#ebebeb" : "none",
3631
- border: "none",
3632
- margin: 2,
3633
- opacity: disabled ? 0.55 : 1,
3634
- cursor: disabled ? "not-allowed" : "pointer"
3635
- },
3636
- onClick: () => {
3637
- if (disabled) return;
3638
- setIsOpen((prev) => !prev);
3639
- setSrc("");
3640
- setAltText("");
3641
- setFileName("");
3642
- }
3643
- },
3644
- "upload-image"
3645
- ) }),
3646
- /* @__PURE__ */ jsx(DialogSurface, { style: { maxWidth: 340 }, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
3647
- /* @__PURE__ */ jsx(DialogTitle, { children: "Insert image" }),
3648
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
3649
- /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
3650
- "label",
3651
- {
3652
- style: {
3653
- cursor: disabled ? "not-allowed" : "pointer",
3654
- display: "flex",
3655
- alignItems: "center",
3656
- gap: 8,
3657
- opacity: disabled ? 0.75 : 1
3658
- },
3659
- children: [
3696
+ "upload-image"
3697
+ ),
3698
+ /* @__PURE__ */ jsx(
3699
+ AoModal,
3700
+ {
3701
+ isOpen: disabled ? false : isOpen,
3702
+ onDismiss: () => !disabled && setIsOpen(false),
3703
+ title: "Insert image",
3704
+ maxWidth: 340,
3705
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
3706
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Add" }),
3707
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
3708
+ ] }),
3709
+ children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
3710
+ /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
3711
+ "label",
3712
+ {
3713
+ style: {
3714
+ cursor: disabled ? "not-allowed" : "pointer",
3715
+ display: "flex",
3716
+ alignItems: "center",
3717
+ gap: 8,
3718
+ opacity: disabled ? 0.75 : 1
3719
+ },
3720
+ children: [
3721
+ /* @__PURE__ */ jsx(
3722
+ "input",
3723
+ {
3724
+ type: "file",
3725
+ accept: "image/*",
3726
+ style: { display: "none" },
3727
+ disabled,
3728
+ onChange: loadImage
3729
+ },
3730
+ "inline-image-upload"
3731
+ ),
3732
+ /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
3660
3733
  /* @__PURE__ */ jsx(
3661
- "input",
3734
+ AttachFilled,
3662
3735
  {
3663
- type: "file",
3664
- accept: "image/*",
3665
- style: { display: "none" },
3666
- disabled,
3667
- onChange: loadImage
3668
- },
3669
- "inline-image-upload"
3670
- ),
3671
- /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
3672
- /* @__PURE__ */ jsx(
3673
- AttachFilled,
3674
- {
3675
- style: {
3676
- fontSize: "16px",
3677
- color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
3678
- marginTop: 2
3679
- }
3736
+ style: {
3737
+ fontSize: "16px",
3738
+ color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
3739
+ marginTop: 2
3680
3740
  }
3681
- ),
3682
- !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
3683
- ] }),
3684
- fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
3685
- ]
3686
- }
3687
- ) }),
3688
- fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
3689
- /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
3690
- Input,
3691
- {
3692
- placeholder: "Alt text",
3693
- appearance: "underline",
3694
- disabled,
3695
- onChange: (_, d) => setAltText(d.value),
3696
- value: altText
3697
- }
3698
- ) }),
3699
- selectedValue === "URL" && /* @__PURE__ */ jsx(
3700
- InsertImageByURL,
3701
- {
3702
- disabled,
3703
- setIsOpen: (open) => setIsOpen(open),
3704
- onClick: (payload) => onClick(payload)
3705
- }
3706
- )
3707
- ] }) }),
3708
- /* @__PURE__ */ jsxs(DialogActions, { children: [
3709
- /* @__PURE__ */ jsx(Button, { size: "small", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Add" }),
3710
- /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
3711
- ] })
3712
- ] }) })
3713
- ]
3714
- }
3715
- );
3741
+ }
3742
+ ),
3743
+ !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
3744
+ ] }),
3745
+ fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
3746
+ ]
3747
+ }
3748
+ ) }),
3749
+ fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
3750
+ /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
3751
+ Input,
3752
+ {
3753
+ placeholder: "Alt text",
3754
+ appearance: "underline",
3755
+ disabled,
3756
+ onChange: (_, d) => setAltText(d.value),
3757
+ value: altText
3758
+ }
3759
+ ) }),
3760
+ selectedValue === "URL" && /* @__PURE__ */ jsx(
3761
+ InsertImageByURL,
3762
+ {
3763
+ disabled,
3764
+ setIsOpen: (open) => setIsOpen(open),
3765
+ onClick: (payload) => onClick(payload)
3766
+ }
3767
+ )
3768
+ ] })
3769
+ }
3770
+ )
3771
+ ] });
3716
3772
  };
3717
3773
  var ImagesPlugin = ({ captionsEnabled }) => {
3718
3774
  const [editor] = useLexicalComposerContext();
@@ -3962,135 +4018,132 @@ var InsertInlineImageDialog = ({
3962
4018
  setFileName("");
3963
4019
  setFileSizeError(null);
3964
4020
  };
3965
- return /* @__PURE__ */ jsxs(
3966
- Dialog,
3967
- {
3968
- open: disabled ? false : isOpen,
3969
- onOpenChange: (_, data) => {
3970
- if (!disabled) setIsOpen(data.open);
4021
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4022
+ /* @__PURE__ */ jsx(
4023
+ Button,
4024
+ {
4025
+ size: "small",
4026
+ title: "Add Inline Image",
4027
+ disabled,
4028
+ icon: /* @__PURE__ */ jsx(ImageEditRegular, { style: { color: iconColor } }),
4029
+ style: {
4030
+ background: isOpen && !disabled ? "#ebebeb" : "none",
4031
+ border: "none",
4032
+ margin: 2,
4033
+ opacity: disabled ? 0.55 : 1,
4034
+ cursor: disabled ? "not-allowed" : "pointer"
4035
+ },
4036
+ onClick: () => {
4037
+ if (disabled) return;
4038
+ setIsOpen((prev) => !prev);
4039
+ setAltText("");
4040
+ setSrc("");
4041
+ setFileName("");
4042
+ }
3971
4043
  },
3972
- children: [
3973
- /* @__PURE__ */ jsx(DialogTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(
3974
- Button,
3975
- {
3976
- size: "small",
3977
- title: "Add Inline Image",
3978
- disabled,
3979
- icon: /* @__PURE__ */ jsx(ImageEditRegular, { style: { color: iconColor } }),
3980
- style: {
3981
- background: isOpen && !disabled ? "#ebebeb" : "none",
3982
- border: "none",
3983
- margin: 2,
3984
- opacity: disabled ? 0.55 : 1,
3985
- cursor: disabled ? "not-allowed" : "pointer"
4044
+ "upload-inline-image"
4045
+ ),
4046
+ /* @__PURE__ */ jsx(
4047
+ AoModal,
4048
+ {
4049
+ isOpen: disabled ? false : isOpen,
4050
+ onDismiss: () => !disabled && setIsOpen(false),
4051
+ title: "Insert inline image",
4052
+ maxWidth: 360,
4053
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
4054
+ /* @__PURE__ */ jsx(
4055
+ Button,
4056
+ {
4057
+ size: "small",
4058
+ disabled: isDisabled,
4059
+ onClick: handleOnClick,
4060
+ children: "Add"
3986
4061
  },
3987
- onClick: () => {
3988
- if (disabled) return;
3989
- setIsOpen((prev) => !prev);
3990
- setAltText("");
3991
- setSrc("");
3992
- setFileName("");
3993
- }
3994
- },
3995
- "upload-inline-image"
3996
- ) }),
3997
- /* @__PURE__ */ jsx(DialogSurface, { style: { maxWidth: 360 }, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
3998
- /* @__PURE__ */ jsx(DialogTitle, { children: "Insert inline image" }),
3999
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
4000
- /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
4001
- "label",
4002
- {
4003
- style: {
4004
- cursor: disabled ? "not-allowed" : "pointer",
4005
- display: "flex",
4006
- alignItems: "center",
4007
- gap: 8,
4008
- opacity: disabled ? 0.75 : 1
4009
- },
4010
- children: [
4062
+ "file-inline-upload-btn"
4063
+ ),
4064
+ /* @__PURE__ */ jsx(
4065
+ Button,
4066
+ {
4067
+ size: "small",
4068
+ disabled,
4069
+ onClick: () => setIsOpen(false),
4070
+ children: "Cancel"
4071
+ },
4072
+ "file-inline-upload-cancel"
4073
+ )
4074
+ ] }),
4075
+ children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
4076
+ /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
4077
+ "label",
4078
+ {
4079
+ style: {
4080
+ cursor: disabled ? "not-allowed" : "pointer",
4081
+ display: "flex",
4082
+ alignItems: "center",
4083
+ gap: 8,
4084
+ opacity: disabled ? 0.75 : 1
4085
+ },
4086
+ children: [
4087
+ /* @__PURE__ */ jsx(
4088
+ "input",
4089
+ {
4090
+ type: "file",
4091
+ accept: "image/*",
4092
+ style: { display: "none" },
4093
+ disabled,
4094
+ onChange: loadImage
4095
+ },
4096
+ "inline-image-upload"
4097
+ ),
4098
+ /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
4011
4099
  /* @__PURE__ */ jsx(
4012
- "input",
4100
+ AttachFilled,
4013
4101
  {
4014
- type: "file",
4015
- accept: "image/*",
4016
- style: { display: "none" },
4017
- disabled,
4018
- onChange: loadImage
4019
- },
4020
- "inline-image-upload"
4021
- ),
4022
- /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
4023
- /* @__PURE__ */ jsx(
4024
- AttachFilled,
4025
- {
4026
- style: {
4027
- fontSize: "16px",
4028
- color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
4029
- marginTop: 2
4030
- }
4102
+ style: {
4103
+ fontSize: "16px",
4104
+ color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
4105
+ marginTop: 2
4031
4106
  }
4032
- ),
4033
- !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
4034
- ] }),
4035
- fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
4036
- ]
4037
- }
4038
- ) }),
4039
- /* @__PURE__ */ jsx(Field, { label: "Position", size: "small", children: /* @__PURE__ */ jsxs(
4040
- Dropdown,
4041
- {
4042
- className: styles.alignDropdown,
4043
- disabled,
4044
- value: position === "full" ? "Full" : position === "right" ? "Right" : "Left",
4045
- selectedOptions: [position ?? "left"],
4046
- listbox: { style: { width: "120px" } },
4047
- root: { style: { borderBottom: "1px solid black" } },
4048
- onOptionSelect: (_, data) => setPosition(data.optionValue),
4049
- children: [
4050
- /* @__PURE__ */ jsx(Option, { value: "left", children: "Left" }, "left"),
4051
- /* @__PURE__ */ jsx(Option, { value: "right", children: "Right" }, "right"),
4052
- /* @__PURE__ */ jsx(Option, { value: "full", children: "Full" }, "full")
4053
- ]
4054
- }
4055
- ) }),
4056
- fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
4057
- /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
4058
- Input,
4059
- {
4060
- placeholder: "Alt text",
4061
- appearance: "underline",
4062
- disabled,
4063
- value: altText,
4064
- onChange: (_, d) => setAltText(d.value)
4065
- }
4066
- ) })
4067
- ] }) }),
4068
- /* @__PURE__ */ jsxs(DialogActions, { children: [
4069
- /* @__PURE__ */ jsx(
4070
- Button,
4071
- {
4072
- size: "small",
4073
- disabled: isDisabled,
4074
- onClick: handleOnClick,
4075
- children: "Add"
4076
- },
4077
- "file-inline-upload-btn"
4078
- ),
4079
- /* @__PURE__ */ jsx(
4080
- Button,
4081
- {
4082
- size: "small",
4083
- disabled,
4084
- onClick: () => setIsOpen(false),
4085
- children: "Cancel"
4086
- },
4087
- "file-inline-upload-cancel"
4088
- )
4089
- ] })
4090
- ] }) })
4091
- ]
4092
- }
4093
- );
4107
+ }
4108
+ ),
4109
+ !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
4110
+ ] }),
4111
+ fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
4112
+ ]
4113
+ }
4114
+ ) }),
4115
+ /* @__PURE__ */ jsx(Field, { label: "Position", size: "small", children: /* @__PURE__ */ jsxs(
4116
+ Dropdown,
4117
+ {
4118
+ className: styles.alignDropdown,
4119
+ disabled,
4120
+ value: position === "full" ? "Full" : position === "right" ? "Right" : "Left",
4121
+ selectedOptions: [position ?? "left"],
4122
+ listbox: { style: { width: "120px" } },
4123
+ root: { style: { borderBottom: "1px solid black" } },
4124
+ onOptionSelect: (_, data) => setPosition(data.optionValue),
4125
+ children: [
4126
+ /* @__PURE__ */ jsx(Option, { value: "left", children: "Left" }, "left"),
4127
+ /* @__PURE__ */ jsx(Option, { value: "right", children: "Right" }, "right"),
4128
+ /* @__PURE__ */ jsx(Option, { value: "full", children: "Full" }, "full")
4129
+ ]
4130
+ }
4131
+ ) }),
4132
+ fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
4133
+ /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
4134
+ Input,
4135
+ {
4136
+ placeholder: "Alt text",
4137
+ appearance: "underline",
4138
+ disabled,
4139
+ value: altText,
4140
+ onChange: (_, d) => setAltText(d.value)
4141
+ }
4142
+ ) })
4143
+ ] })
4144
+ }
4145
+ )
4146
+ ] });
4094
4147
  };
4095
4148
  var InlineImagePlugin = () => {
4096
4149
  const [editor] = useLexicalComposerContext();
@@ -6591,79 +6644,76 @@ var TableItemPlugin = ({ disabled }) => {
6591
6644
  setColumns("");
6592
6645
  setIsOpen(false);
6593
6646
  };
6594
- return /* @__PURE__ */ jsxs(
6595
- Dialog,
6596
- {
6597
- open: disabled ? false : isOpen,
6598
- onOpenChange: (_, data) => {
6599
- if (!disabled) setIsOpen(data.open);
6647
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6648
+ /* @__PURE__ */ jsx(
6649
+ Button,
6650
+ {
6651
+ size: "small",
6652
+ title: "Add table",
6653
+ disabled,
6654
+ icon: /* @__PURE__ */ jsx(TableAddRegular, { style: { color: iconColor } }),
6655
+ style: {
6656
+ background: isOpen && !disabled ? "#ebebeb" : "none",
6657
+ border: "none",
6658
+ margin: 2,
6659
+ opacity: disabled ? 0.55 : 1,
6660
+ cursor: disabled ? "not-allowed" : "pointer"
6661
+ },
6662
+ onClick: () => {
6663
+ if (disabled) return;
6664
+ setIsOpen((prev) => !prev);
6665
+ setRows("");
6666
+ setColumns("");
6667
+ }
6600
6668
  },
6601
- children: [
6602
- /* @__PURE__ */ jsx(DialogTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(
6603
- Button,
6604
- {
6605
- size: "small",
6606
- title: "Add table",
6607
- disabled,
6608
- icon: /* @__PURE__ */ jsx(TableAddRegular, { style: { color: iconColor } }),
6609
- style: {
6610
- background: isOpen && !disabled ? "#ebebeb" : "none",
6611
- border: "none",
6612
- margin: 2,
6613
- opacity: disabled ? 0.55 : 1,
6614
- cursor: disabled ? "not-allowed" : "pointer"
6615
- },
6616
- onClick: () => {
6617
- if (disabled) return;
6618
- setIsOpen((prev) => !prev);
6619
- setRows("");
6620
- setColumns("");
6669
+ "insert-table-nodes"
6670
+ ),
6671
+ /* @__PURE__ */ jsx(
6672
+ AoModal,
6673
+ {
6674
+ isOpen: disabled ? false : isOpen,
6675
+ onDismiss: () => !disabled && setIsOpen(false),
6676
+ title: "Insert table",
6677
+ maxWidth: 300,
6678
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6679
+ /* @__PURE__ */ jsx(
6680
+ Button,
6681
+ {
6682
+ size: "small",
6683
+ appearance: "primary",
6684
+ disabled: disabled || !rows || !columns,
6685
+ onClick: onAddTable,
6686
+ children: "Add"
6621
6687
  }
6622
- },
6623
- "insert-table-nodes"
6624
- ) }),
6625
- /* @__PURE__ */ jsx(DialogSurface, { style: { maxWidth: 300 }, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
6626
- /* @__PURE__ */ jsx(DialogTitle, { children: "Insert table" }),
6627
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
6628
- /* @__PURE__ */ jsx(Field, { label: "Rows", size: "small", children: /* @__PURE__ */ jsx(
6629
- Input,
6630
- {
6631
- autoFocus: !disabled,
6632
- value: rows,
6633
- placeholder: "Rows",
6634
- appearance: "underline",
6635
- disabled,
6636
- onChange: (_, v) => setRows(v.value)
6637
- }
6638
- ) }),
6639
- /* @__PURE__ */ jsx(Field, { label: "Columns", size: "small", children: /* @__PURE__ */ jsx(
6640
- Input,
6641
- {
6642
- value: columns,
6643
- placeholder: "Columns",
6644
- appearance: "underline",
6645
- disabled,
6646
- onChange: (_, v) => setColumns(v.value)
6647
- }
6648
- ) })
6649
- ] }) }),
6650
- /* @__PURE__ */ jsxs(DialogActions, { children: [
6651
- /* @__PURE__ */ jsx(
6652
- Button,
6653
- {
6654
- size: "small",
6655
- appearance: "primary",
6656
- disabled: disabled || !rows || !columns,
6657
- onClick: onAddTable,
6658
- children: "Add"
6659
- }
6660
- ),
6661
- /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6662
- ] })
6663
- ] }) })
6664
- ]
6665
- }
6666
- );
6688
+ ),
6689
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6690
+ ] }),
6691
+ children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
6692
+ /* @__PURE__ */ jsx(Field, { label: "Rows", size: "small", children: /* @__PURE__ */ jsx(
6693
+ Input,
6694
+ {
6695
+ autoFocus: !disabled,
6696
+ value: rows,
6697
+ placeholder: "Rows",
6698
+ appearance: "underline",
6699
+ disabled,
6700
+ onChange: (_, v) => setRows(v.value)
6701
+ }
6702
+ ) }),
6703
+ /* @__PURE__ */ jsx(Field, { label: "Columns", size: "small", children: /* @__PURE__ */ jsx(
6704
+ Input,
6705
+ {
6706
+ value: columns,
6707
+ placeholder: "Columns",
6708
+ appearance: "underline",
6709
+ disabled,
6710
+ onChange: (_, v) => setColumns(v.value)
6711
+ }
6712
+ ) })
6713
+ ] })
6714
+ }
6715
+ )
6716
+ ] });
6667
6717
  };
6668
6718
  var YoutubeUploadPlugin = ({ disabled }) => {
6669
6719
  const [url, setURL] = useState("");
@@ -6683,57 +6733,54 @@ var YoutubeUploadPlugin = ({ disabled }) => {
6683
6733
  setURL("");
6684
6734
  setIsOpen(false);
6685
6735
  };
6686
- return /* @__PURE__ */ jsxs(
6687
- Dialog,
6688
- {
6689
- open: disabled ? false : isOpen,
6690
- onOpenChange: (_, data) => {
6691
- if (!disabled) setIsOpen(data.open);
6736
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6737
+ /* @__PURE__ */ jsx(
6738
+ Button,
6739
+ {
6740
+ title: "Add youtube URL",
6741
+ size: "small",
6742
+ disabled,
6743
+ icon: /* @__PURE__ */ jsx(VideoClipRegular, { style: { color: iconColor } }),
6744
+ style: {
6745
+ background: isOpen && !disabled ? "#ebebeb" : "none",
6746
+ border: "none",
6747
+ margin: 2,
6748
+ opacity: disabled ? 0.55 : 1,
6749
+ cursor: disabled ? "not-allowed" : "pointer"
6750
+ },
6751
+ onClick: () => {
6752
+ if (disabled) return;
6753
+ setIsOpen((prev) => !prev);
6754
+ setURL("");
6755
+ }
6692
6756
  },
6693
- children: [
6694
- /* @__PURE__ */ jsx(DialogTrigger, { disableButtonEnhancement: true, children: /* @__PURE__ */ jsx(
6695
- Button,
6757
+ "upload-video"
6758
+ ),
6759
+ /* @__PURE__ */ jsx(
6760
+ AoModal,
6761
+ {
6762
+ isOpen: disabled ? false : isOpen,
6763
+ onDismiss: () => !disabled && setIsOpen(false),
6764
+ title: "Embed YouTube video",
6765
+ maxWidth: 320,
6766
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6767
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled: disabled || !url, onClick: onHandleEmbeded, children: "Add" }),
6768
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6769
+ ] }),
6770
+ children: /* @__PURE__ */ jsx(Stack, { tokens: { childrenGap: 8 }, children: /* @__PURE__ */ jsx(Field, { label: "URL", size: "small", children: /* @__PURE__ */ jsx(
6771
+ Input,
6696
6772
  {
6697
- title: "Add youtube URL",
6698
- size: "small",
6773
+ autoFocus: !disabled,
6699
6774
  disabled,
6700
- icon: /* @__PURE__ */ jsx(VideoClipRegular, { style: { color: iconColor } }),
6701
- style: {
6702
- background: isOpen && !disabled ? "#ebebeb" : "none",
6703
- border: "none",
6704
- margin: 2,
6705
- opacity: disabled ? 0.55 : 1,
6706
- cursor: disabled ? "not-allowed" : "pointer"
6707
- },
6708
- onClick: () => {
6709
- if (disabled) return;
6710
- setIsOpen((prev) => !prev);
6711
- setURL("");
6712
- }
6713
- },
6714
- "upload-video"
6715
- ) }),
6716
- /* @__PURE__ */ jsx(DialogSurface, { style: { maxWidth: 320 }, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
6717
- /* @__PURE__ */ jsx(DialogTitle, { children: "Embed YouTube video" }),
6718
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Stack, { tokens: { childrenGap: 8 }, children: /* @__PURE__ */ jsx(Field, { label: "URL", size: "small", children: /* @__PURE__ */ jsx(
6719
- Input,
6720
- {
6721
- autoFocus: !disabled,
6722
- disabled,
6723
- value: url,
6724
- appearance: "underline",
6725
- placeholder: "Add Youtube video URL",
6726
- onChange: (_, v) => setURL(v.value)
6727
- }
6728
- ) }) }) }),
6729
- /* @__PURE__ */ jsxs(DialogActions, { children: [
6730
- /* @__PURE__ */ jsx(Button, { size: "small", disabled: disabled || !url, onClick: onHandleEmbeded, children: "Add" }),
6731
- /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6732
- ] })
6733
- ] }) })
6734
- ]
6735
- }
6736
- );
6775
+ value: url,
6776
+ appearance: "underline",
6777
+ placeholder: "Add Youtube video URL",
6778
+ onChange: (_, v) => setURL(v.value)
6779
+ }
6780
+ ) }) })
6781
+ }
6782
+ )
6783
+ ] });
6737
6784
  };
6738
6785
  var TextAlphaListLtrFilled = ({ style }) => /* @__PURE__ */ jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", style, children: [
6739
6786
  /* @__PURE__ */ jsx("path", { d: "M8.75 4a.75.75 0 1 0 0 1.5h7.5a.75.75 0 0 0 0-1.5h-7.5Z" }),
@@ -6815,6 +6862,7 @@ var ToolBarPlugins = (props) => {
6815
6862
  const [isLowercase, setIsLowercase] = useState(false);
6816
6863
  const [isCapitalize, setIsCapitalize] = useState(false);
6817
6864
  const [alignment, setAlignment] = useState("left");
6865
+ const [hasTextSelection, setHasTextSelection] = useState(false);
6818
6866
  const [decoratorOpen, setDecoratorOpen] = useState(false);
6819
6867
  const decoratorSelectingRef = React9__default.useRef(false);
6820
6868
  const presetGroups = props.customToolbar ?? getToolbarGroupsByLevel(props.level);
@@ -6833,8 +6881,10 @@ var ToolBarPlugins = (props) => {
6833
6881
  setIsLowercase(false);
6834
6882
  setIsCapitalize(false);
6835
6883
  setSelectNodeType("paragraph");
6884
+ setHasTextSelection(false);
6836
6885
  return;
6837
6886
  }
6887
+ setHasTextSelection(!selection.isCollapsed());
6838
6888
  setIsBold(selection.hasFormat("bold"));
6839
6889
  setIsItalic(selection.hasFormat("italic"));
6840
6890
  setIsUnderline(selection.hasFormat("underline"));
@@ -7090,7 +7140,7 @@ var ToolBarPlugins = (props) => {
7090
7140
  return /* @__PURE__ */ jsx(
7091
7141
  InsertLinkPlugin,
7092
7142
  {
7093
- disabled: !isEditable || props.readOnly,
7143
+ disabled: !isEditable || props.readOnly || !hasTextSelection,
7094
7144
  setIsLinkEditMode: props.setIsLinkEditMode
7095
7145
  },
7096
7146
  key
@@ -8156,8 +8206,13 @@ var ContentEditorComponent = forwardRef(
8156
8206
  color: "var(--colorNeutralForeground3, grey)",
8157
8207
  position: "absolute",
8158
8208
  top: props.level !== "none" /* None */ ? "17px" : "27px",
8159
- left: pageCanvas.paddingPx,
8160
- right: pageCanvas.paddingPx,
8209
+ left: 0,
8210
+ right: 0,
8211
+ maxWidth: pageCanvas.widthPx,
8212
+ marginLeft: pageCanvas.widthPx !== void 0 ? "auto" : void 0,
8213
+ marginRight: pageCanvas.widthPx !== void 0 ? "auto" : void 0,
8214
+ paddingLeft: pageCanvas.paddingPx,
8215
+ paddingRight: pageCanvas.paddingPx,
8161
8216
  fontSize: "14px",
8162
8217
  pointerEvents: "none",
8163
8218
  userSelect: "none"
@@ -8274,7 +8329,7 @@ var ContentEditorComponent = forwardRef(
8274
8329
  const trimmedErrorMessage = props.errorMessage?.trim() || "";
8275
8330
  const hasValidationError = validationErrors.length > 0 || !!trimmedErrorMessage;
8276
8331
  return /* @__PURE__ */ jsx(FluentProvider, { theme: webLightTheme, style: { height: "100%" }, children: /* @__PURE__ */ jsxs(LexicalComposer, { initialConfig, children: [
8277
- /* @__PURE__ */ jsx("div", { ref: containerRef, className: "lexical-rich-editor-root", style: { height: "100%" }, children: /* @__PURE__ */ jsxs(
8332
+ /* @__PURE__ */ jsx("div", { ref: containerRef, className: "lexical-rich-editor-root", style: { height: "100%", position: "relative" }, children: /* @__PURE__ */ jsxs(
8278
8333
  Stack,
8279
8334
  {
8280
8335
  style: {