@tarviks/lexical-rich-editor 1.3.4 → 1.3.5

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, Field, Input, 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, Popover, PopoverTrigger, PopoverSurface } 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';
@@ -24,7 +24,7 @@ import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
24
24
  import { HeadingNode, QuoteNode, $isHeadingNode, $createQuoteNode, $createHeadingNode } from '@lexical/rich-text';
25
25
  import { TableNode, TableRowNode, TableCellNode, $isTableSelection, $isTableNode, $isTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $deleteTableRowAtSelection, $deleteTableColumnAtSelection, getDOMCellFromTarget, getTableObserverFromTableElement, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $isTableRowNode, $getTableColumnIndexFromTableCellNode, $createTableNodeWithDimensions } from '@lexical/table';
26
26
  import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
27
- import { ChevronDown12Regular, ArrowUpRegular, RowTripleRegular, ArrowDownRegular, ArrowLeftRegular, ColumnTripleRegular, ArrowRightRegular, DeleteRegular, TextCaseUppercaseFilled, TextCaseLowercaseFilled, TextCaseTitleFilled, TextStrikethroughFilled, TextSubscriptFilled, TextSuperscriptFilled, HighlightAccentFilled, TextBulletListLtrFilled, TextNumberListLtrFilled, DocumentPageBreakRegular, CommentQuoteRegular, TextUnderlineFilled, TextItalicFilled, TextBold24Regular, DocumentRegular, TextAlignLeftFilled, TextAlignCenterFilled, TextAlignRightFilled, TextAlignJustifyFilled, VideoClipRegular, ImageEditRegular, AttachFilled, ImageAddRegular, TableAddRegular, LinkAddRegular, TextColorRegular, PaintBucket16Filled, DismissRegular, CheckmarkRegular, EditRegular, CodeFilled, LinkFilled, Dismiss16Regular } from '@fluentui/react-icons';
27
+ import { ChevronDown12Regular, ArrowUpRegular, RowTripleRegular, ArrowDownRegular, ArrowLeftRegular, ColumnTripleRegular, ArrowRightRegular, DeleteRegular, TextCaseUppercaseFilled, TextCaseLowercaseFilled, TextCaseTitleFilled, TextStrikethroughFilled, TextSubscriptFilled, TextSuperscriptFilled, HighlightAccentFilled, TextBulletListLtrFilled, TextNumberListLtrFilled, DocumentPageBreakRegular, CommentQuoteRegular, TextUnderlineFilled, TextItalicFilled, TextBold24Regular, DocumentRegular, TextAlignLeftFilled, TextAlignCenterFilled, TextAlignRightFilled, TextAlignJustifyFilled, VideoClipRegular, AttachFilled, ImageEditRegular, ImageAddRegular, TableAddRegular, LinkAddRegular, TextColorRegular, PaintBucket16Filled, DismissRegular, CheckmarkRegular, EditRegular, CodeFilled, LinkFilled, Dismiss16Regular } from '@fluentui/react-icons';
28
28
  import { $setBlocksType, $patchStyleText, $isAtNodeEnd, $getSelectionStyleValueForProperty } from '@lexical/selection';
29
29
  import { createPortal } from 'react-dom';
30
30
  import { $generateNodesFromDOM, $generateHtmlFromNodes } from '@lexical/html';
@@ -3496,43 +3496,41 @@ var FloatingLinkEditorPlugin = ({ anchorElem, isLinkEditMode, setIsLinkEditMode
3496
3496
  };
3497
3497
  var AoModal = ({
3498
3498
  isOpen,
3499
- onDismiss,
3499
+ onOpenChange,
3500
+ trigger,
3500
3501
  title,
3501
3502
  maxWidth = 280,
3502
- // Default to a smaller, compact size
3503
3503
  actions,
3504
3504
  children
3505
3505
  }) => {
3506
- const [editor] = useLexicalComposerContext();
3507
- const hostElement = useFloatingPortalContainer(editor);
3508
- if (!isOpen) return null;
3509
- const modalContent = /* @__PURE__ */ jsx("div", { className: "aoModalBackdrop", onClick: onDismiss, children: /* @__PURE__ */ jsxs(
3510
- FluentProvider,
3506
+ return /* @__PURE__ */ jsxs(
3507
+ Popover,
3511
3508
  {
3512
- theme: webLightTheme,
3513
- className: "aoModalWrapper aoModalContainer",
3514
- style: { maxWidth, width: "90vw" },
3515
- onClick: (e) => e.stopPropagation(),
3509
+ open: isOpen,
3510
+ onOpenChange: (_, data) => onOpenChange(data.open),
3511
+ positioning: { position: "below", align: "start" },
3516
3512
  children: [
3517
- /* @__PURE__ */ jsxs("div", { className: "aoModalHeader", children: [
3518
- /* @__PURE__ */ jsx("h2", { className: "aoModalTitle", children: title }),
3519
- /* @__PURE__ */ jsx(
3520
- "button",
3521
- {
3522
- className: "aoModalCloseButton",
3523
- "aria-label": "Close popup",
3524
- onClick: onDismiss,
3525
- children: "\u2715"
3526
- }
3527
- )
3528
- ] }),
3529
- /* @__PURE__ */ jsx("div", { className: "aoModalBody", children }),
3530
- actions && /* @__PURE__ */ jsx("div", { className: "aoModalActions", children: actions })
3513
+ /* @__PURE__ */ jsx(PopoverTrigger, { disableButtonEnhancement: true, children: trigger }),
3514
+ /* @__PURE__ */ jsxs(PopoverSurface, { style: { minWidth: 240, maxWidth, width: "90vw" }, children: [
3515
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 8 }, children: [
3516
+ /* @__PURE__ */ jsx("h2", { style: { fontSize: 16, fontWeight: 600, margin: 0 }, children: title }),
3517
+ /* @__PURE__ */ jsx(
3518
+ Button,
3519
+ {
3520
+ appearance: "subtle",
3521
+ size: "small",
3522
+ icon: /* @__PURE__ */ jsx(DismissRegular, {}),
3523
+ "aria-label": "Close popup",
3524
+ onClick: () => onOpenChange(false)
3525
+ }
3526
+ )
3527
+ ] }),
3528
+ /* @__PURE__ */ jsx("div", { children }),
3529
+ actions && /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 12 }, children: actions })
3530
+ ] })
3531
3531
  ]
3532
3532
  }
3533
- ) });
3534
- if (!hostElement) return null;
3535
- return createPortal(modalContent, hostElement);
3533
+ );
3536
3534
  };
3537
3535
 
3538
3536
  // src/Plugins/ImagePlugin.tsx
@@ -3669,105 +3667,104 @@ var InsertImageDialog = ({
3669
3667
  };
3670
3668
  reader.readAsDataURL(file);
3671
3669
  };
3672
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3673
- /* @__PURE__ */ jsx(
3674
- Button,
3675
- {
3676
- size: "small",
3677
- title: "Add Image",
3678
- disabled,
3679
- icon: /* @__PURE__ */ jsx(ImageAddRegular, { style: { color: iconColor } }),
3680
- style: {
3681
- background: isOpen && !disabled ? "#ebebeb" : "none",
3682
- border: "none",
3683
- margin: 2,
3684
- opacity: disabled ? 0.55 : 1,
3685
- cursor: disabled ? "not-allowed" : "pointer"
3686
- },
3687
- onClick: () => {
3688
- if (disabled) return;
3689
- setIsOpen((prev) => !prev);
3670
+ return /* @__PURE__ */ jsx(
3671
+ AoModal,
3672
+ {
3673
+ isOpen: disabled ? false : isOpen,
3674
+ onOpenChange: (open) => {
3675
+ if (disabled) return;
3676
+ setIsOpen(open);
3677
+ if (open) {
3690
3678
  setSrc("");
3691
3679
  setAltText("");
3692
3680
  setFileName("");
3693
3681
  }
3694
3682
  },
3695
- "upload-image"
3696
- ),
3697
- /* @__PURE__ */ jsx(
3698
- AoModal,
3699
- {
3700
- isOpen: disabled ? false : isOpen,
3701
- onDismiss: () => !disabled && setIsOpen(false),
3702
- title: "Insert image",
3703
- maxWidth: 340,
3704
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
3705
- /* @__PURE__ */ jsx(Button, { size: "small", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Add" }),
3706
- /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
3707
- ] }),
3708
- children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
3709
- /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
3710
- "label",
3711
- {
3712
- style: {
3713
- cursor: disabled ? "not-allowed" : "pointer",
3714
- display: "flex",
3715
- alignItems: "center",
3716
- gap: 8,
3717
- opacity: disabled ? 0.75 : 1
3718
- },
3719
- children: [
3683
+ trigger: /* @__PURE__ */ jsx(
3684
+ Button,
3685
+ {
3686
+ size: "small",
3687
+ title: "Add Image",
3688
+ disabled,
3689
+ icon: /* @__PURE__ */ jsx(ImageAddRegular, { style: { color: iconColor } }),
3690
+ style: {
3691
+ background: isOpen && !disabled ? "#ebebeb" : "none",
3692
+ border: "none",
3693
+ margin: 2,
3694
+ opacity: disabled ? 0.55 : 1,
3695
+ cursor: disabled ? "not-allowed" : "pointer"
3696
+ }
3697
+ },
3698
+ "upload-image"
3699
+ ),
3700
+ title: "Insert image",
3701
+ maxWidth: 340,
3702
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
3703
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Add" }),
3704
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
3705
+ ] }),
3706
+ children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
3707
+ /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
3708
+ "label",
3709
+ {
3710
+ style: {
3711
+ cursor: disabled ? "not-allowed" : "pointer",
3712
+ display: "flex",
3713
+ alignItems: "center",
3714
+ gap: 8,
3715
+ opacity: disabled ? 0.75 : 1
3716
+ },
3717
+ children: [
3718
+ /* @__PURE__ */ jsx(
3719
+ "input",
3720
+ {
3721
+ type: "file",
3722
+ accept: "image/*",
3723
+ style: { display: "none" },
3724
+ disabled,
3725
+ onChange: loadImage
3726
+ },
3727
+ "inline-image-upload"
3728
+ ),
3729
+ /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
3720
3730
  /* @__PURE__ */ jsx(
3721
- "input",
3731
+ AttachFilled,
3722
3732
  {
3723
- type: "file",
3724
- accept: "image/*",
3725
- style: { display: "none" },
3726
- disabled,
3727
- onChange: loadImage
3728
- },
3729
- "inline-image-upload"
3730
- ),
3731
- /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
3732
- /* @__PURE__ */ jsx(
3733
- AttachFilled,
3734
- {
3735
- style: {
3736
- fontSize: "16px",
3737
- color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
3738
- marginTop: 2
3739
- }
3733
+ style: {
3734
+ fontSize: "16px",
3735
+ color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
3736
+ marginTop: 2
3740
3737
  }
3741
- ),
3742
- !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
3743
- ] }),
3744
- fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
3745
- ]
3746
- }
3747
- ) }),
3748
- fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
3749
- /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
3750
- Input,
3751
- {
3752
- placeholder: "Alt text",
3753
- appearance: "underline",
3754
- disabled,
3755
- onChange: (_, d) => setAltText(d.value),
3756
- value: altText
3757
- }
3758
- ) }),
3759
- selectedValue === "URL" && /* @__PURE__ */ jsx(
3760
- InsertImageByURL,
3761
- {
3762
- disabled,
3763
- setIsOpen: (open) => setIsOpen(open),
3764
- onClick: (payload) => onClick(payload)
3765
- }
3766
- )
3767
- ] })
3768
- }
3769
- )
3770
- ] });
3738
+ }
3739
+ ),
3740
+ !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
3741
+ ] }),
3742
+ fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
3743
+ ]
3744
+ }
3745
+ ) }),
3746
+ fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
3747
+ /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
3748
+ Input,
3749
+ {
3750
+ placeholder: "Alt text",
3751
+ appearance: "underline",
3752
+ disabled,
3753
+ onChange: (_, d) => setAltText(d.value),
3754
+ value: altText
3755
+ }
3756
+ ) }),
3757
+ selectedValue === "URL" && /* @__PURE__ */ jsx(
3758
+ InsertImageByURL,
3759
+ {
3760
+ disabled,
3761
+ setIsOpen: (open) => setIsOpen(open),
3762
+ onClick: (payload) => onClick(payload)
3763
+ }
3764
+ )
3765
+ ] })
3766
+ }
3767
+ );
3771
3768
  };
3772
3769
  var ImagesPlugin = ({ captionsEnabled }) => {
3773
3770
  const [editor] = useLexicalComposerContext();
@@ -4017,132 +4014,131 @@ var InsertInlineImageDialog = ({
4017
4014
  setFileName("");
4018
4015
  setFileSizeError(null);
4019
4016
  };
4020
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4021
- /* @__PURE__ */ jsx(
4022
- Button,
4023
- {
4024
- size: "small",
4025
- title: "Add Inline Image",
4026
- disabled,
4027
- icon: /* @__PURE__ */ jsx(ImageEditRegular, { style: { color: iconColor } }),
4028
- style: {
4029
- background: isOpen && !disabled ? "#ebebeb" : "none",
4030
- border: "none",
4031
- margin: 2,
4032
- opacity: disabled ? 0.55 : 1,
4033
- cursor: disabled ? "not-allowed" : "pointer"
4034
- },
4035
- onClick: () => {
4036
- if (disabled) return;
4037
- setIsOpen((prev) => !prev);
4017
+ return /* @__PURE__ */ jsx(
4018
+ AoModal,
4019
+ {
4020
+ isOpen: disabled ? false : isOpen,
4021
+ onOpenChange: (open) => {
4022
+ if (disabled) return;
4023
+ setIsOpen(open);
4024
+ if (open) {
4038
4025
  setAltText("");
4039
4026
  setSrc("");
4040
4027
  setFileName("");
4041
4028
  }
4042
4029
  },
4043
- "upload-inline-image"
4044
- ),
4045
- /* @__PURE__ */ jsx(
4046
- AoModal,
4047
- {
4048
- isOpen: disabled ? false : isOpen,
4049
- onDismiss: () => !disabled && setIsOpen(false),
4050
- title: "Insert inline image",
4051
- maxWidth: 360,
4052
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
4053
- /* @__PURE__ */ jsx(
4054
- Button,
4055
- {
4056
- size: "small",
4057
- disabled: isDisabled,
4058
- onClick: handleOnClick,
4059
- children: "Add"
4060
- },
4061
- "file-inline-upload-btn"
4062
- ),
4063
- /* @__PURE__ */ jsx(
4064
- Button,
4065
- {
4066
- size: "small",
4067
- disabled,
4068
- onClick: () => setIsOpen(false),
4069
- children: "Cancel"
4030
+ trigger: /* @__PURE__ */ jsx(
4031
+ Button,
4032
+ {
4033
+ size: "small",
4034
+ title: "Add Inline Image",
4035
+ disabled,
4036
+ icon: /* @__PURE__ */ jsx(ImageEditRegular, { style: { color: iconColor } }),
4037
+ style: {
4038
+ background: isOpen && !disabled ? "#ebebeb" : "none",
4039
+ border: "none",
4040
+ margin: 2,
4041
+ opacity: disabled ? 0.55 : 1,
4042
+ cursor: disabled ? "not-allowed" : "pointer"
4043
+ }
4044
+ },
4045
+ "upload-inline-image"
4046
+ ),
4047
+ title: "Insert inline image",
4048
+ maxWidth: 360,
4049
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
4050
+ /* @__PURE__ */ jsx(
4051
+ Button,
4052
+ {
4053
+ size: "small",
4054
+ disabled: isDisabled,
4055
+ onClick: handleOnClick,
4056
+ children: "Add"
4057
+ },
4058
+ "file-inline-upload-btn"
4059
+ ),
4060
+ /* @__PURE__ */ jsx(
4061
+ Button,
4062
+ {
4063
+ size: "small",
4064
+ disabled,
4065
+ onClick: () => setIsOpen(false),
4066
+ children: "Cancel"
4067
+ },
4068
+ "file-inline-upload-cancel"
4069
+ )
4070
+ ] }),
4071
+ children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
4072
+ /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
4073
+ "label",
4074
+ {
4075
+ style: {
4076
+ cursor: disabled ? "not-allowed" : "pointer",
4077
+ display: "flex",
4078
+ alignItems: "center",
4079
+ gap: 8,
4080
+ opacity: disabled ? 0.75 : 1
4070
4081
  },
4071
- "file-inline-upload-cancel"
4072
- )
4073
- ] }),
4074
- children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
4075
- /* @__PURE__ */ jsx(Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxs(
4076
- "label",
4077
- {
4078
- style: {
4079
- cursor: disabled ? "not-allowed" : "pointer",
4080
- display: "flex",
4081
- alignItems: "center",
4082
- gap: 8,
4083
- opacity: disabled ? 0.75 : 1
4084
- },
4085
- children: [
4082
+ children: [
4083
+ /* @__PURE__ */ jsx(
4084
+ "input",
4085
+ {
4086
+ type: "file",
4087
+ accept: "image/*",
4088
+ style: { display: "none" },
4089
+ disabled,
4090
+ onChange: loadImage
4091
+ },
4092
+ "inline-image-upload"
4093
+ ),
4094
+ /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
4086
4095
  /* @__PURE__ */ jsx(
4087
- "input",
4096
+ AttachFilled,
4088
4097
  {
4089
- type: "file",
4090
- accept: "image/*",
4091
- style: { display: "none" },
4092
- disabled,
4093
- onChange: loadImage
4094
- },
4095
- "inline-image-upload"
4096
- ),
4097
- /* @__PURE__ */ jsxs(Stack, { horizontal: true, children: [
4098
- /* @__PURE__ */ jsx(
4099
- AttachFilled,
4100
- {
4101
- style: {
4102
- fontSize: "16px",
4103
- color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
4104
- marginTop: 2
4105
- }
4098
+ style: {
4099
+ fontSize: "16px",
4100
+ color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
4101
+ marginTop: 2
4106
4102
  }
4107
- ),
4108
- !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
4109
- ] }),
4110
- fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
4111
- ]
4112
- }
4113
- ) }),
4114
- /* @__PURE__ */ jsx(Field, { label: "Position", size: "small", children: /* @__PURE__ */ jsxs(
4115
- Dropdown,
4116
- {
4117
- className: styles.alignDropdown,
4118
- disabled,
4119
- value: position === "full" ? "Full" : position === "right" ? "Right" : "Left",
4120
- selectedOptions: [position ?? "left"],
4121
- listbox: { style: { width: "120px" } },
4122
- root: { style: { borderBottom: "1px solid black" } },
4123
- onOptionSelect: (_, data) => setPosition(data.optionValue),
4124
- children: [
4125
- /* @__PURE__ */ jsx(Option, { value: "left", children: "Left" }, "left"),
4126
- /* @__PURE__ */ jsx(Option, { value: "right", children: "Right" }, "right"),
4127
- /* @__PURE__ */ jsx(Option, { value: "full", children: "Full" }, "full")
4128
- ]
4129
- }
4130
- ) }),
4131
- fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
4132
- /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
4133
- Input,
4134
- {
4135
- placeholder: "Alt text",
4136
- appearance: "underline",
4137
- disabled,
4138
- value: altText,
4139
- onChange: (_, d) => setAltText(d.value)
4140
- }
4141
- ) })
4142
- ] })
4143
- }
4144
- )
4145
- ] });
4103
+ }
4104
+ ),
4105
+ !fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
4106
+ ] }),
4107
+ fileName && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
4108
+ ]
4109
+ }
4110
+ ) }),
4111
+ /* @__PURE__ */ jsx(Field, { label: "Position", size: "small", children: /* @__PURE__ */ jsxs(
4112
+ Dropdown,
4113
+ {
4114
+ className: styles.alignDropdown,
4115
+ disabled,
4116
+ value: position === "full" ? "Full" : position === "right" ? "Right" : "Left",
4117
+ selectedOptions: [position ?? "left"],
4118
+ listbox: { style: { width: "120px" } },
4119
+ root: { style: { borderBottom: "1px solid black" } },
4120
+ onOptionSelect: (_, data) => setPosition(data.optionValue),
4121
+ children: [
4122
+ /* @__PURE__ */ jsx(Option, { value: "left", children: "Left" }, "left"),
4123
+ /* @__PURE__ */ jsx(Option, { value: "right", children: "Right" }, "right"),
4124
+ /* @__PURE__ */ jsx(Option, { value: "full", children: "Full" }, "full")
4125
+ ]
4126
+ }
4127
+ ) }),
4128
+ fileSizeError && /* @__PURE__ */ jsx(MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsx(MessageBarBody, { children: fileSizeError }) }),
4129
+ /* @__PURE__ */ jsx(Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsx(
4130
+ Input,
4131
+ {
4132
+ placeholder: "Alt text",
4133
+ appearance: "underline",
4134
+ disabled,
4135
+ value: altText,
4136
+ onChange: (_, d) => setAltText(d.value)
4137
+ }
4138
+ ) })
4139
+ ] })
4140
+ }
4141
+ );
4146
4142
  };
4147
4143
  var InlineImagePlugin = () => {
4148
4144
  const [editor] = useLexicalComposerContext();
@@ -6643,76 +6639,75 @@ var TableItemPlugin = ({ disabled }) => {
6643
6639
  setColumns("");
6644
6640
  setIsOpen(false);
6645
6641
  };
6646
- return /* @__PURE__ */ jsxs(Fragment, { children: [
6647
- /* @__PURE__ */ jsx(
6648
- Button,
6649
- {
6650
- size: "small",
6651
- title: "Add table",
6652
- disabled,
6653
- icon: /* @__PURE__ */ jsx(TableAddRegular, { style: { color: iconColor } }),
6654
- style: {
6655
- background: isOpen && !disabled ? "#ebebeb" : "none",
6656
- border: "none",
6657
- margin: 2,
6658
- opacity: disabled ? 0.55 : 1,
6659
- cursor: disabled ? "not-allowed" : "pointer"
6660
- },
6661
- onClick: () => {
6662
- if (disabled) return;
6663
- setIsOpen((prev) => !prev);
6642
+ return /* @__PURE__ */ jsx(
6643
+ AoModal,
6644
+ {
6645
+ isOpen: disabled ? false : isOpen,
6646
+ onOpenChange: (open) => {
6647
+ if (disabled) return;
6648
+ setIsOpen(open);
6649
+ if (open) {
6664
6650
  setRows("");
6665
6651
  setColumns("");
6666
6652
  }
6667
6653
  },
6668
- "insert-table-nodes"
6669
- ),
6670
- /* @__PURE__ */ jsx(
6671
- AoModal,
6672
- {
6673
- isOpen: disabled ? false : isOpen,
6674
- onDismiss: () => !disabled && setIsOpen(false),
6675
- title: "Insert table",
6676
- maxWidth: 300,
6677
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6678
- /* @__PURE__ */ jsx(
6679
- Button,
6680
- {
6681
- size: "small",
6682
- appearance: "primary",
6683
- disabled: disabled || !rows || !columns,
6684
- onClick: onAddTable,
6685
- children: "Add"
6686
- }
6687
- ),
6688
- /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6689
- ] }),
6690
- children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
6691
- /* @__PURE__ */ jsx(Field, { label: "Rows", size: "small", children: /* @__PURE__ */ jsx(
6692
- Input,
6693
- {
6694
- autoFocus: !disabled,
6695
- value: rows,
6696
- placeholder: "Rows",
6697
- appearance: "underline",
6698
- disabled,
6699
- onChange: (_, v) => setRows(v.value)
6700
- }
6701
- ) }),
6702
- /* @__PURE__ */ jsx(Field, { label: "Columns", size: "small", children: /* @__PURE__ */ jsx(
6703
- Input,
6704
- {
6705
- value: columns,
6706
- placeholder: "Columns",
6707
- appearance: "underline",
6708
- disabled,
6709
- onChange: (_, v) => setColumns(v.value)
6710
- }
6711
- ) })
6712
- ] })
6713
- }
6714
- )
6715
- ] });
6654
+ trigger: /* @__PURE__ */ jsx(
6655
+ Button,
6656
+ {
6657
+ size: "small",
6658
+ title: "Add table",
6659
+ disabled,
6660
+ icon: /* @__PURE__ */ jsx(TableAddRegular, { style: { color: iconColor } }),
6661
+ style: {
6662
+ background: isOpen && !disabled ? "#ebebeb" : "none",
6663
+ border: "none",
6664
+ margin: 2,
6665
+ opacity: disabled ? 0.55 : 1,
6666
+ cursor: disabled ? "not-allowed" : "pointer"
6667
+ }
6668
+ },
6669
+ "insert-table-nodes"
6670
+ ),
6671
+ title: "Insert table",
6672
+ maxWidth: 300,
6673
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6674
+ /* @__PURE__ */ jsx(
6675
+ Button,
6676
+ {
6677
+ size: "small",
6678
+ appearance: "primary",
6679
+ disabled: disabled || !rows || !columns,
6680
+ onClick: onAddTable,
6681
+ children: "Add"
6682
+ }
6683
+ ),
6684
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6685
+ ] }),
6686
+ children: /* @__PURE__ */ jsxs(Stack, { tokens: { childrenGap: 8 }, children: [
6687
+ /* @__PURE__ */ jsx(Field, { label: "Rows", size: "small", children: /* @__PURE__ */ jsx(
6688
+ Input,
6689
+ {
6690
+ autoFocus: !disabled,
6691
+ value: rows,
6692
+ placeholder: "Rows",
6693
+ appearance: "underline",
6694
+ disabled,
6695
+ onChange: (_, v) => setRows(v.value)
6696
+ }
6697
+ ) }),
6698
+ /* @__PURE__ */ jsx(Field, { label: "Columns", size: "small", children: /* @__PURE__ */ jsx(
6699
+ Input,
6700
+ {
6701
+ value: columns,
6702
+ placeholder: "Columns",
6703
+ appearance: "underline",
6704
+ disabled,
6705
+ onChange: (_, v) => setColumns(v.value)
6706
+ }
6707
+ ) })
6708
+ ] })
6709
+ }
6710
+ );
6716
6711
  };
6717
6712
  var YoutubeUploadPlugin = ({ disabled }) => {
6718
6713
  const [url, setURL] = useState("");
@@ -6732,54 +6727,51 @@ var YoutubeUploadPlugin = ({ disabled }) => {
6732
6727
  setURL("");
6733
6728
  setIsOpen(false);
6734
6729
  };
6735
- return /* @__PURE__ */ jsxs(Fragment, { children: [
6736
- /* @__PURE__ */ jsx(
6737
- Button,
6738
- {
6739
- title: "Add youtube URL",
6740
- size: "small",
6741
- disabled,
6742
- icon: /* @__PURE__ */ jsx(VideoClipRegular, { style: { color: iconColor } }),
6743
- style: {
6744
- background: isOpen && !disabled ? "#ebebeb" : "none",
6745
- border: "none",
6746
- margin: 2,
6747
- opacity: disabled ? 0.55 : 1,
6748
- cursor: disabled ? "not-allowed" : "pointer"
6749
- },
6750
- onClick: () => {
6751
- if (disabled) return;
6752
- setIsOpen((prev) => !prev);
6753
- setURL("");
6754
- }
6730
+ return /* @__PURE__ */ jsx(
6731
+ AoModal,
6732
+ {
6733
+ isOpen: disabled ? false : isOpen,
6734
+ onOpenChange: (open) => {
6735
+ if (disabled) return;
6736
+ setIsOpen(open);
6737
+ if (open) setURL("");
6755
6738
  },
6756
- "upload-video"
6757
- ),
6758
- /* @__PURE__ */ jsx(
6759
- AoModal,
6760
- {
6761
- isOpen: disabled ? false : isOpen,
6762
- onDismiss: () => !disabled && setIsOpen(false),
6763
- title: "Embed YouTube video",
6764
- maxWidth: 320,
6765
- actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6766
- /* @__PURE__ */ jsx(Button, { size: "small", disabled: disabled || !url, onClick: onHandleEmbeded, children: "Add" }),
6767
- /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6768
- ] }),
6769
- children: /* @__PURE__ */ jsx(Stack, { tokens: { childrenGap: 8 }, children: /* @__PURE__ */ jsx(Field, { label: "URL", size: "small", children: /* @__PURE__ */ jsx(
6770
- Input,
6771
- {
6772
- autoFocus: !disabled,
6773
- disabled,
6774
- value: url,
6775
- appearance: "underline",
6776
- placeholder: "Add Youtube video URL",
6777
- onChange: (_, v) => setURL(v.value)
6739
+ trigger: /* @__PURE__ */ jsx(
6740
+ Button,
6741
+ {
6742
+ title: "Add youtube URL",
6743
+ size: "small",
6744
+ disabled,
6745
+ icon: /* @__PURE__ */ jsx(VideoClipRegular, { style: { color: iconColor } }),
6746
+ style: {
6747
+ background: isOpen && !disabled ? "#ebebeb" : "none",
6748
+ border: "none",
6749
+ margin: 2,
6750
+ opacity: disabled ? 0.55 : 1,
6751
+ cursor: disabled ? "not-allowed" : "pointer"
6778
6752
  }
6779
- ) }) })
6780
- }
6781
- )
6782
- ] });
6753
+ },
6754
+ "upload-video"
6755
+ ),
6756
+ title: "Embed YouTube video",
6757
+ maxWidth: 320,
6758
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
6759
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled: disabled || !url, onClick: onHandleEmbeded, children: "Add" }),
6760
+ /* @__PURE__ */ jsx(Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6761
+ ] }),
6762
+ children: /* @__PURE__ */ jsx(Stack, { tokens: { childrenGap: 8 }, children: /* @__PURE__ */ jsx(Field, { label: "URL", size: "small", children: /* @__PURE__ */ jsx(
6763
+ Input,
6764
+ {
6765
+ autoFocus: !disabled,
6766
+ disabled,
6767
+ value: url,
6768
+ appearance: "underline",
6769
+ placeholder: "Add Youtube video URL",
6770
+ onChange: (_, v) => setURL(v.value)
6771
+ }
6772
+ ) }) })
6773
+ }
6774
+ );
6783
6775
  };
6784
6776
  var TextAlphaListLtrFilled = ({ style }) => /* @__PURE__ */ jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", style, children: [
6785
6777
  /* @__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" }),