@tarviks/lexical-rich-editor 1.3.4 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3164,33 +3164,6 @@ var getSelectedNode2 = (selection$1) => {
3164
3164
  return selection.$isAtNodeEnd(anchor) ? anchorNode : focusNode;
3165
3165
  }
3166
3166
  };
3167
- var VERTICAL_GAP = 10;
3168
- var HORIZONTAL_OFFSET = 5;
3169
- var VIEWPORT_MARGIN = 8;
3170
- var setFloatingElemPositionForLinkEditor = (targetRect, floatingElem, topBoundary = VIEWPORT_MARGIN, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET) => {
3171
- if (targetRect === null) {
3172
- floatingElem.style.opacity = "0";
3173
- floatingElem.style.transform = "translate(-10000px, -10000px)";
3174
- return;
3175
- }
3176
- const floatingElemRect = floatingElem.getBoundingClientRect();
3177
- let top = targetRect.bottom + verticalGap;
3178
- let left = targetRect.left - horizontalOffset;
3179
- if (top + floatingElemRect.height > window.innerHeight - VIEWPORT_MARGIN) {
3180
- top = targetRect.top - floatingElemRect.height - verticalGap;
3181
- }
3182
- if (top < topBoundary) {
3183
- top = topBoundary;
3184
- }
3185
- left = Math.max(VIEWPORT_MARGIN, Math.min(left, window.innerWidth - floatingElemRect.width - VIEWPORT_MARGIN));
3186
- const origin = getFixedPositionOrigin(floatingElem);
3187
- top -= origin.top;
3188
- left -= origin.left;
3189
- floatingElem.style.opacity = "1";
3190
- floatingElem.style.transform = "none";
3191
- floatingElem.style.top = `${top}px`;
3192
- floatingElem.style.left = `${left}px`;
3193
- };
3194
3167
  var SUPPORTED_URL_PROTOCOLS = /* @__PURE__ */ new Set([
3195
3168
  "http:",
3196
3169
  "https:",
@@ -3216,7 +3189,7 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, isLinkEditMode, setIsLink
3216
3189
  const [editedLinkUrl, setEditedLinkUrl] = React9.useState("https://");
3217
3190
  const [lastSelection, setLastSelection] = React9.useState(null);
3218
3191
  const [linkUrl, setLinkUrl] = React9.useState("");
3219
- const editorRef = React9.useRef(null);
3192
+ const [target, setTarget] = React9.useState(null);
3220
3193
  const inputRef = React9.useRef(null);
3221
3194
  const $updateLinkEditor = React9.useCallback(() => {
3222
3195
  const selection = lexical.$getSelection();
@@ -3234,25 +3207,17 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, isLinkEditMode, setIsLink
3234
3207
  setEditedLinkUrl(linkUrl);
3235
3208
  }
3236
3209
  }
3237
- const editorElem = editorRef.current;
3238
3210
  const nativeSelection = lexical.getDOMSelection(editor._window);
3239
3211
  const activeElement = document.activeElement;
3240
- if (editorElem === null) {
3241
- return;
3242
- }
3243
3212
  const rootElement = editor.getRootElement();
3244
3213
  if (isLink && selection !== null && nativeSelection !== null && rootElement !== null && rootElement.contains(nativeSelection.anchorNode) && editor.isEditable()) {
3245
3214
  const domRect = nativeSelection.focusNode?.parentElement?.getBoundingClientRect();
3246
3215
  if (domRect) {
3247
- const toolbarEl = rootElement.closest(".lexical-rich-editor-root")?.querySelector(".editor-toolbar-root");
3248
- const topBoundary = toolbarEl ? toolbarEl.getBoundingClientRect().bottom + 8 : 8;
3249
- setFloatingElemPositionForLinkEditor(domRect, editorElem, topBoundary);
3216
+ setTarget({ getBoundingClientRect: () => domRect });
3250
3217
  }
3251
3218
  setLastSelection(selection);
3252
- } else if (!activeElement || activeElement.className !== "aoLinkInput") {
3253
- if (rootElement !== null) {
3254
- setFloatingElemPositionForLinkEditor(null, editorElem);
3255
- }
3219
+ } else if (!(activeElement instanceof HTMLInputElement) || activeElement !== inputRef.current) {
3220
+ setTarget(null);
3256
3221
  setLastSelection(null);
3257
3222
  setIsLinkEditMode(false);
3258
3223
  setLinkUrl("");
@@ -3348,99 +3313,119 @@ var FloatingLinkEditor = ({ editor, isLink, setIsLink, isLinkEditMode, setIsLink
3348
3313
  setIsLinkEditMode(false);
3349
3314
  }
3350
3315
  };
3351
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: editorRef, className: "aoLinkEditor", children: !isLink ? null : isLinkEditMode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3352
- /* @__PURE__ */ jsxRuntime.jsx(
3353
- "input",
3354
- {
3355
- ref: inputRef,
3356
- className: "aoLinkInput",
3357
- value: editedLinkUrl,
3358
- onChange: (event) => {
3359
- setEditedLinkUrl(event.target.value);
3360
- },
3361
- onKeyDown: (event) => {
3362
- monitorInputInteraction(event);
3363
- }
3364
- }
3365
- ),
3366
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aoLinkInputActions", children: [
3367
- /* @__PURE__ */ jsxRuntime.jsx(
3368
- "div",
3369
- {
3370
- className: "aoLinkCancel",
3371
- role: "button",
3372
- tabIndex: 0,
3373
- title: "Cancel",
3374
- "aria-label": "Cancel",
3375
- onMouseDown: preventDefault,
3376
- onClick: () => {
3377
- setIsLinkEditMode(false);
3378
- },
3379
- children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DismissRegular, { fontSize: 16 })
3380
- }
3381
- ),
3382
- /* @__PURE__ */ jsxRuntime.jsx(
3383
- "div",
3384
- {
3385
- className: "aoLinkConfirm",
3386
- role: "button",
3387
- tabIndex: 0,
3388
- title: "Confirm",
3389
- "aria-label": "Confirm",
3390
- onMouseDown: preventDefault,
3391
- onClick: handleLinkSubmission,
3392
- children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CheckmarkRegular, { fontSize: 16 })
3393
- }
3394
- )
3395
- ] })
3396
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aoLinkView", children: [
3397
- /* @__PURE__ */ jsxRuntime.jsx(
3398
- "a",
3399
- {
3400
- href: sanitizeUrl(linkUrl),
3401
- target: "_blank",
3402
- rel: "noopener noreferrer",
3403
- children: linkUrl
3404
- }
3405
- ),
3406
- /* @__PURE__ */ jsxRuntime.jsx(
3407
- "div",
3408
- {
3409
- className: "aoLinkEdit",
3410
- role: "button",
3411
- tabIndex: 0,
3412
- title: "Edit link",
3413
- "aria-label": "Edit link",
3414
- onMouseDown: preventDefault,
3415
- onClick: (event) => {
3416
- event.preventDefault();
3417
- setEditedLinkUrl(linkUrl);
3418
- setIsLinkEditMode(true);
3419
- },
3420
- children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.EditRegular, { fontSize: 16 })
3421
- }
3422
- ),
3423
- /* @__PURE__ */ jsxRuntime.jsx(
3424
- "div",
3425
- {
3426
- className: "aoLinkTrash",
3427
- role: "button",
3428
- tabIndex: 0,
3429
- title: "Remove link",
3430
- "aria-label": "Remove link",
3431
- onMouseDown: preventDefault,
3432
- onClick: () => {
3433
- editor.dispatchCommand(link.TOGGLE_LINK_COMMAND, null);
3434
- },
3435
- children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DeleteRegular, { fontSize: 16 })
3436
- }
3437
- )
3438
- ] }) });
3316
+ return /* @__PURE__ */ jsxRuntime.jsx(
3317
+ reactComponents.Popover,
3318
+ {
3319
+ open: isLink && !!target,
3320
+ onOpenChange: (_, data) => {
3321
+ if (!data.open) setIsLink(false);
3322
+ },
3323
+ positioning: { target: target ?? void 0, position: "below", align: "start" },
3324
+ unstable_disableAutoFocus: true,
3325
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.PopoverSurface, { style: { display: "flex", alignItems: "center", gap: 6, padding: 8, maxWidth: 360 }, children: isLinkEditMode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3326
+ /* @__PURE__ */ jsxRuntime.jsx(
3327
+ "input",
3328
+ {
3329
+ ref: inputRef,
3330
+ value: editedLinkUrl,
3331
+ style: {
3332
+ flex: 1,
3333
+ minWidth: 180,
3334
+ border: "none",
3335
+ outline: "none",
3336
+ background: "#f1f1f1",
3337
+ borderRadius: 15,
3338
+ padding: "8px 12px",
3339
+ fontSize: 14
3340
+ },
3341
+ onChange: (event) => {
3342
+ setEditedLinkUrl(event.target.value);
3343
+ },
3344
+ onKeyDown: (event) => {
3345
+ monitorInputInteraction(event);
3346
+ }
3347
+ }
3348
+ ),
3349
+ /* @__PURE__ */ jsxRuntime.jsx(
3350
+ reactComponents.Button,
3351
+ {
3352
+ appearance: "subtle",
3353
+ size: "small",
3354
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DismissRegular, { fontSize: 16 }),
3355
+ title: "Cancel",
3356
+ "aria-label": "Cancel",
3357
+ onMouseDown: preventDefault,
3358
+ onClick: () => {
3359
+ setIsLinkEditMode(false);
3360
+ }
3361
+ }
3362
+ ),
3363
+ /* @__PURE__ */ jsxRuntime.jsx(
3364
+ reactComponents.Button,
3365
+ {
3366
+ appearance: "primary",
3367
+ size: "small",
3368
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CheckmarkRegular, { fontSize: 16 }),
3369
+ title: "Confirm",
3370
+ "aria-label": "Confirm",
3371
+ onMouseDown: preventDefault,
3372
+ onClick: handleLinkSubmission
3373
+ }
3374
+ )
3375
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3376
+ /* @__PURE__ */ jsxRuntime.jsx(
3377
+ "a",
3378
+ {
3379
+ href: sanitizeUrl(linkUrl),
3380
+ target: "_blank",
3381
+ rel: "noopener noreferrer",
3382
+ style: {
3383
+ padding: "0 8px",
3384
+ overflow: "hidden",
3385
+ textOverflow: "ellipsis",
3386
+ whiteSpace: "nowrap",
3387
+ maxWidth: 260
3388
+ },
3389
+ children: linkUrl
3390
+ }
3391
+ ),
3392
+ /* @__PURE__ */ jsxRuntime.jsx(
3393
+ reactComponents.Button,
3394
+ {
3395
+ appearance: "subtle",
3396
+ size: "small",
3397
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.EditRegular, { fontSize: 16 }),
3398
+ title: "Edit link",
3399
+ "aria-label": "Edit link",
3400
+ onMouseDown: preventDefault,
3401
+ onClick: (event) => {
3402
+ event.preventDefault();
3403
+ setEditedLinkUrl(linkUrl);
3404
+ setIsLinkEditMode(true);
3405
+ }
3406
+ }
3407
+ ),
3408
+ /* @__PURE__ */ jsxRuntime.jsx(
3409
+ reactComponents.Button,
3410
+ {
3411
+ appearance: "subtle",
3412
+ size: "small",
3413
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DeleteRegular, { fontSize: 16 }),
3414
+ title: "Remove link",
3415
+ "aria-label": "Remove link",
3416
+ onMouseDown: preventDefault,
3417
+ onClick: () => {
3418
+ editor.dispatchCommand(link.TOGGLE_LINK_COMMAND, null);
3419
+ }
3420
+ }
3421
+ )
3422
+ ] }) })
3423
+ }
3424
+ );
3439
3425
  };
3440
- var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLinkEditMode) => {
3426
+ var useFloatingLinkEditorToolbar = (editor, isLinkEditMode, setIsLinkEditMode) => {
3441
3427
  const [activeEditor, setActiveEditor] = React9.useState(editor);
3442
3428
  const [isLink, setIsLink] = React9.useState(false);
3443
- const portalContainer = useFloatingPortalContainer(editor);
3444
3429
  React9.useEffect(() => {
3445
3430
  function $updateToolbar() {
3446
3431
  const selection = lexical.$getSelection();
@@ -3488,72 +3473,62 @@ var useFloatingLinkEditorToolbar = (editor, anchorElem, isLinkEditMode, setIsLin
3488
3473
  )
3489
3474
  );
3490
3475
  }, [editor]);
3491
- if (!anchorElem || !(anchorElem instanceof HTMLElement) || !portalContainer) {
3492
- return null;
3493
- }
3494
- return reactDom.createPortal(
3495
- /* @__PURE__ */ jsxRuntime.jsx(
3496
- FloatingLinkEditor,
3497
- {
3498
- isLink,
3499
- editor: activeEditor,
3500
- setIsLink,
3501
- isLinkEditMode,
3502
- setIsLinkEditMode
3503
- }
3504
- ),
3505
- portalContainer
3476
+ return /* @__PURE__ */ jsxRuntime.jsx(
3477
+ FloatingLinkEditor,
3478
+ {
3479
+ isLink,
3480
+ editor: activeEditor,
3481
+ setIsLink,
3482
+ isLinkEditMode,
3483
+ setIsLinkEditMode
3484
+ }
3506
3485
  );
3507
3486
  };
3508
- var FloatingLinkEditorPlugin = ({ anchorElem, isLinkEditMode, setIsLinkEditMode }) => {
3487
+ var FloatingLinkEditorPlugin = ({ isLinkEditMode, setIsLinkEditMode }) => {
3509
3488
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
3510
- const validAnchorElem = anchorElem && anchorElem instanceof HTMLElement ? anchorElem : document.body;
3511
3489
  return useFloatingLinkEditorToolbar(
3512
3490
  editor,
3513
- validAnchorElem,
3514
3491
  isLinkEditMode,
3515
3492
  setIsLinkEditMode
3516
3493
  );
3517
3494
  };
3518
3495
  var AoModal = ({
3519
3496
  isOpen,
3520
- onDismiss,
3497
+ onOpenChange,
3498
+ trigger,
3521
3499
  title,
3522
3500
  maxWidth = 280,
3523
- // Default to a smaller, compact size
3524
3501
  actions,
3525
3502
  children
3526
3503
  }) => {
3527
- const [editor] = LexicalComposerContext.useLexicalComposerContext();
3528
- const hostElement = useFloatingPortalContainer(editor);
3529
- if (!isOpen) return null;
3530
- const modalContent = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aoModalBackdrop", onClick: onDismiss, children: /* @__PURE__ */ jsxRuntime.jsxs(
3531
- reactComponents.FluentProvider,
3504
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3505
+ reactComponents.Popover,
3532
3506
  {
3533
- theme: reactComponents.webLightTheme,
3534
- className: "aoModalWrapper aoModalContainer",
3535
- style: { maxWidth, width: "90vw" },
3536
- onClick: (e) => e.stopPropagation(),
3507
+ open: isOpen,
3508
+ onOpenChange: (_, data) => onOpenChange(data.open),
3509
+ positioning: { position: "below", align: "start" },
3537
3510
  children: [
3538
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aoModalHeader", children: [
3539
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "aoModalTitle", children: title }),
3540
- /* @__PURE__ */ jsxRuntime.jsx(
3541
- "button",
3542
- {
3543
- className: "aoModalCloseButton",
3544
- "aria-label": "Close popup",
3545
- onClick: onDismiss,
3546
- children: "\u2715"
3547
- }
3548
- )
3549
- ] }),
3550
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aoModalBody", children }),
3551
- actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aoModalActions", children: actions })
3511
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.PopoverTrigger, { disableButtonEnhancement: true, children: trigger }),
3512
+ /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.PopoverSurface, { style: { minWidth: 240, maxWidth, width: "90vw" }, children: [
3513
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 8 }, children: [
3514
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { fontSize: 16, fontWeight: 600, margin: 0 }, children: title }),
3515
+ /* @__PURE__ */ jsxRuntime.jsx(
3516
+ reactComponents.Button,
3517
+ {
3518
+ appearance: "subtle",
3519
+ size: "small",
3520
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.DismissRegular, {}),
3521
+ "aria-label": "Close popup",
3522
+ onClick: () => onOpenChange(false)
3523
+ }
3524
+ )
3525
+ ] }),
3526
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children }),
3527
+ actions && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 12 }, children: actions })
3528
+ ] })
3552
3529
  ]
3553
3530
  }
3554
- ) });
3555
- if (!hostElement) return null;
3556
- return reactDom.createPortal(modalContent, hostElement);
3531
+ );
3557
3532
  };
3558
3533
 
3559
3534
  // src/Plugins/ImagePlugin.tsx
@@ -3690,105 +3665,104 @@ var InsertImageDialog = ({
3690
3665
  };
3691
3666
  reader.readAsDataURL(file);
3692
3667
  };
3693
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3694
- /* @__PURE__ */ jsxRuntime.jsx(
3695
- reactComponents.Button,
3696
- {
3697
- size: "small",
3698
- title: "Add Image",
3699
- disabled,
3700
- icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ImageAddRegular, { style: { color: iconColor } }),
3701
- style: {
3702
- background: isOpen && !disabled ? "#ebebeb" : "none",
3703
- border: "none",
3704
- margin: 2,
3705
- opacity: disabled ? 0.55 : 1,
3706
- cursor: disabled ? "not-allowed" : "pointer"
3707
- },
3708
- onClick: () => {
3709
- if (disabled) return;
3710
- setIsOpen((prev) => !prev);
3668
+ return /* @__PURE__ */ jsxRuntime.jsx(
3669
+ AoModal,
3670
+ {
3671
+ isOpen: disabled ? false : isOpen,
3672
+ onOpenChange: (open) => {
3673
+ if (disabled) return;
3674
+ setIsOpen(open);
3675
+ if (open) {
3711
3676
  setSrc("");
3712
3677
  setAltText("");
3713
3678
  setFileName("");
3714
3679
  }
3715
3680
  },
3716
- "upload-image"
3717
- ),
3718
- /* @__PURE__ */ jsxRuntime.jsx(
3719
- AoModal,
3720
- {
3721
- isOpen: disabled ? false : isOpen,
3722
- onDismiss: () => !disabled && setIsOpen(false),
3723
- title: "Insert image",
3724
- maxWidth: 340,
3725
- actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3726
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Add" }),
3727
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
3728
- ] }),
3729
- children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 8 }, children: [
3730
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(
3731
- "label",
3732
- {
3733
- style: {
3734
- cursor: disabled ? "not-allowed" : "pointer",
3735
- display: "flex",
3736
- alignItems: "center",
3737
- gap: 8,
3738
- opacity: disabled ? 0.75 : 1
3739
- },
3740
- children: [
3681
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
3682
+ reactComponents.Button,
3683
+ {
3684
+ size: "small",
3685
+ title: "Add Image",
3686
+ disabled,
3687
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ImageAddRegular, { style: { color: iconColor } }),
3688
+ style: {
3689
+ background: isOpen && !disabled ? "#ebebeb" : "none",
3690
+ border: "none",
3691
+ margin: 2,
3692
+ opacity: disabled ? 0.55 : 1,
3693
+ cursor: disabled ? "not-allowed" : "pointer"
3694
+ }
3695
+ },
3696
+ "upload-image"
3697
+ ),
3698
+ title: "Insert image",
3699
+ maxWidth: 340,
3700
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3701
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled: isDisabled, onClick: () => onClick({ altText, src }), children: "Add" }),
3702
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
3703
+ ] }),
3704
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 8 }, children: [
3705
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(
3706
+ "label",
3707
+ {
3708
+ style: {
3709
+ cursor: disabled ? "not-allowed" : "pointer",
3710
+ display: "flex",
3711
+ alignItems: "center",
3712
+ gap: 8,
3713
+ opacity: disabled ? 0.75 : 1
3714
+ },
3715
+ children: [
3716
+ /* @__PURE__ */ jsxRuntime.jsx(
3717
+ "input",
3718
+ {
3719
+ type: "file",
3720
+ accept: "image/*",
3721
+ style: { display: "none" },
3722
+ disabled,
3723
+ onChange: loadImage
3724
+ },
3725
+ "inline-image-upload"
3726
+ ),
3727
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { horizontal: true, children: [
3741
3728
  /* @__PURE__ */ jsxRuntime.jsx(
3742
- "input",
3729
+ reactIcons.AttachFilled,
3743
3730
  {
3744
- type: "file",
3745
- accept: "image/*",
3746
- style: { display: "none" },
3747
- disabled,
3748
- onChange: loadImage
3749
- },
3750
- "inline-image-upload"
3751
- ),
3752
- /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { horizontal: true, children: [
3753
- /* @__PURE__ */ jsxRuntime.jsx(
3754
- reactIcons.AttachFilled,
3755
- {
3756
- style: {
3757
- fontSize: "16px",
3758
- color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
3759
- marginTop: 2
3760
- }
3731
+ style: {
3732
+ fontSize: "16px",
3733
+ color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
3734
+ marginTop: 2
3761
3735
  }
3762
- ),
3763
- !fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
3764
- ] }),
3765
- fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
3766
- ]
3767
- }
3768
- ) }),
3769
- fileSizeError && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBarBody, { children: fileSizeError }) }),
3770
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
3771
- reactComponents.Input,
3772
- {
3773
- placeholder: "Alt text",
3774
- appearance: "underline",
3775
- disabled,
3776
- onChange: (_, d) => setAltText(d.value),
3777
- value: altText
3778
- }
3779
- ) }),
3780
- selectedValue === "URL" && /* @__PURE__ */ jsxRuntime.jsx(
3781
- InsertImageByURL,
3782
- {
3783
- disabled,
3784
- setIsOpen: (open) => setIsOpen(open),
3785
- onClick: (payload) => onClick(payload)
3786
- }
3787
- )
3788
- ] })
3789
- }
3790
- )
3791
- ] });
3736
+ }
3737
+ ),
3738
+ !fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
3739
+ ] }),
3740
+ fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
3741
+ ]
3742
+ }
3743
+ ) }),
3744
+ fileSizeError && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBarBody, { children: fileSizeError }) }),
3745
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
3746
+ reactComponents.Input,
3747
+ {
3748
+ placeholder: "Alt text",
3749
+ appearance: "underline",
3750
+ disabled,
3751
+ onChange: (_, d) => setAltText(d.value),
3752
+ value: altText
3753
+ }
3754
+ ) }),
3755
+ selectedValue === "URL" && /* @__PURE__ */ jsxRuntime.jsx(
3756
+ InsertImageByURL,
3757
+ {
3758
+ disabled,
3759
+ setIsOpen: (open) => setIsOpen(open),
3760
+ onClick: (payload) => onClick(payload)
3761
+ }
3762
+ )
3763
+ ] })
3764
+ }
3765
+ );
3792
3766
  };
3793
3767
  var ImagesPlugin = ({ captionsEnabled }) => {
3794
3768
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
@@ -4038,132 +4012,131 @@ var InsertInlineImageDialog = ({
4038
4012
  setFileName("");
4039
4013
  setFileSizeError(null);
4040
4014
  };
4041
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4042
- /* @__PURE__ */ jsxRuntime.jsx(
4043
- reactComponents.Button,
4044
- {
4045
- size: "small",
4046
- title: "Add Inline Image",
4047
- disabled,
4048
- icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ImageEditRegular, { style: { color: iconColor } }),
4049
- style: {
4050
- background: isOpen && !disabled ? "#ebebeb" : "none",
4051
- border: "none",
4052
- margin: 2,
4053
- opacity: disabled ? 0.55 : 1,
4054
- cursor: disabled ? "not-allowed" : "pointer"
4055
- },
4056
- onClick: () => {
4057
- if (disabled) return;
4058
- setIsOpen((prev) => !prev);
4015
+ return /* @__PURE__ */ jsxRuntime.jsx(
4016
+ AoModal,
4017
+ {
4018
+ isOpen: disabled ? false : isOpen,
4019
+ onOpenChange: (open) => {
4020
+ if (disabled) return;
4021
+ setIsOpen(open);
4022
+ if (open) {
4059
4023
  setAltText("");
4060
4024
  setSrc("");
4061
4025
  setFileName("");
4062
4026
  }
4063
4027
  },
4064
- "upload-inline-image"
4065
- ),
4066
- /* @__PURE__ */ jsxRuntime.jsx(
4067
- AoModal,
4068
- {
4069
- isOpen: disabled ? false : isOpen,
4070
- onDismiss: () => !disabled && setIsOpen(false),
4071
- title: "Insert inline image",
4072
- maxWidth: 360,
4073
- actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4074
- /* @__PURE__ */ jsxRuntime.jsx(
4075
- reactComponents.Button,
4076
- {
4077
- size: "small",
4078
- disabled: isDisabled,
4079
- onClick: handleOnClick,
4080
- children: "Add"
4081
- },
4082
- "file-inline-upload-btn"
4083
- ),
4084
- /* @__PURE__ */ jsxRuntime.jsx(
4085
- reactComponents.Button,
4086
- {
4087
- size: "small",
4088
- disabled,
4089
- onClick: () => setIsOpen(false),
4090
- children: "Cancel"
4028
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
4029
+ reactComponents.Button,
4030
+ {
4031
+ size: "small",
4032
+ title: "Add Inline Image",
4033
+ disabled,
4034
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ImageEditRegular, { style: { color: iconColor } }),
4035
+ style: {
4036
+ background: isOpen && !disabled ? "#ebebeb" : "none",
4037
+ border: "none",
4038
+ margin: 2,
4039
+ opacity: disabled ? 0.55 : 1,
4040
+ cursor: disabled ? "not-allowed" : "pointer"
4041
+ }
4042
+ },
4043
+ "upload-inline-image"
4044
+ ),
4045
+ title: "Insert inline image",
4046
+ maxWidth: 360,
4047
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4048
+ /* @__PURE__ */ jsxRuntime.jsx(
4049
+ reactComponents.Button,
4050
+ {
4051
+ size: "small",
4052
+ disabled: isDisabled,
4053
+ onClick: handleOnClick,
4054
+ children: "Add"
4055
+ },
4056
+ "file-inline-upload-btn"
4057
+ ),
4058
+ /* @__PURE__ */ jsxRuntime.jsx(
4059
+ reactComponents.Button,
4060
+ {
4061
+ size: "small",
4062
+ disabled,
4063
+ onClick: () => setIsOpen(false),
4064
+ children: "Cancel"
4065
+ },
4066
+ "file-inline-upload-cancel"
4067
+ )
4068
+ ] }),
4069
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 8 }, children: [
4070
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(
4071
+ "label",
4072
+ {
4073
+ style: {
4074
+ cursor: disabled ? "not-allowed" : "pointer",
4075
+ display: "flex",
4076
+ alignItems: "center",
4077
+ gap: 8,
4078
+ opacity: disabled ? 0.75 : 1
4091
4079
  },
4092
- "file-inline-upload-cancel"
4093
- )
4094
- ] }),
4095
- children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 8 }, children: [
4096
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Upload", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(
4097
- "label",
4098
- {
4099
- style: {
4100
- cursor: disabled ? "not-allowed" : "pointer",
4101
- display: "flex",
4102
- alignItems: "center",
4103
- gap: 8,
4104
- opacity: disabled ? 0.75 : 1
4105
- },
4106
- children: [
4080
+ children: [
4081
+ /* @__PURE__ */ jsxRuntime.jsx(
4082
+ "input",
4083
+ {
4084
+ type: "file",
4085
+ accept: "image/*",
4086
+ style: { display: "none" },
4087
+ disabled,
4088
+ onChange: loadImage
4089
+ },
4090
+ "inline-image-upload"
4091
+ ),
4092
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { horizontal: true, children: [
4107
4093
  /* @__PURE__ */ jsxRuntime.jsx(
4108
- "input",
4094
+ reactIcons.AttachFilled,
4109
4095
  {
4110
- type: "file",
4111
- accept: "image/*",
4112
- style: { display: "none" },
4113
- disabled,
4114
- onChange: loadImage
4115
- },
4116
- "inline-image-upload"
4117
- ),
4118
- /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { horizontal: true, children: [
4119
- /* @__PURE__ */ jsxRuntime.jsx(
4120
- reactIcons.AttachFilled,
4121
- {
4122
- style: {
4123
- fontSize: "16px",
4124
- color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
4125
- marginTop: 2
4126
- }
4096
+ style: {
4097
+ fontSize: "16px",
4098
+ color: disabled ? "var(--colorNeutralForegroundDisabled, #A6A6A6)" : "#808080",
4099
+ marginTop: 2
4127
4100
  }
4128
- ),
4129
- !fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
4130
- ] }),
4131
- fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
4132
- ]
4133
- }
4134
- ) }),
4135
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Position", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(
4136
- reactComponents.Dropdown,
4137
- {
4138
- className: styles.alignDropdown,
4139
- disabled,
4140
- value: position === "full" ? "Full" : position === "right" ? "Right" : "Left",
4141
- selectedOptions: [position ?? "left"],
4142
- listbox: { style: { width: "120px" } },
4143
- root: { style: { borderBottom: "1px solid black" } },
4144
- onOptionSelect: (_, data) => setPosition(data.optionValue),
4145
- children: [
4146
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Option, { value: "left", children: "Left" }, "left"),
4147
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Option, { value: "right", children: "Right" }, "right"),
4148
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Option, { value: "full", children: "Full" }, "full")
4149
- ]
4150
- }
4151
- ) }),
4152
- fileSizeError && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBarBody, { children: fileSizeError }) }),
4153
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
4154
- reactComponents.Input,
4155
- {
4156
- placeholder: "Alt text",
4157
- appearance: "underline",
4158
- disabled,
4159
- value: altText,
4160
- onChange: (_, d) => setAltText(d.value)
4161
- }
4162
- ) })
4163
- ] })
4164
- }
4165
- )
4166
- ] });
4101
+ }
4102
+ ),
4103
+ !fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: "Upload File" })
4104
+ ] }),
4105
+ fileName && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: "#808080" }, children: fileName })
4106
+ ]
4107
+ }
4108
+ ) }),
4109
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Position", size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs(
4110
+ reactComponents.Dropdown,
4111
+ {
4112
+ className: styles.alignDropdown,
4113
+ disabled,
4114
+ value: position === "full" ? "Full" : position === "right" ? "Right" : "Left",
4115
+ selectedOptions: [position ?? "left"],
4116
+ listbox: { style: { width: "120px" } },
4117
+ root: { style: { borderBottom: "1px solid black" } },
4118
+ onOptionSelect: (_, data) => setPosition(data.optionValue),
4119
+ children: [
4120
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Option, { value: "left", children: "Left" }, "left"),
4121
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Option, { value: "right", children: "Right" }, "right"),
4122
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Option, { value: "full", children: "Full" }, "full")
4123
+ ]
4124
+ }
4125
+ ) }),
4126
+ fileSizeError && /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBar, { intent: "error", style: { marginTop: 4 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.MessageBarBody, { children: fileSizeError }) }),
4127
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Alt Text", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
4128
+ reactComponents.Input,
4129
+ {
4130
+ placeholder: "Alt text",
4131
+ appearance: "underline",
4132
+ disabled,
4133
+ value: altText,
4134
+ onChange: (_, d) => setAltText(d.value)
4135
+ }
4136
+ ) })
4137
+ ] })
4138
+ }
4139
+ );
4167
4140
  };
4168
4141
  var InlineImagePlugin = () => {
4169
4142
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
@@ -6664,76 +6637,75 @@ var TableItemPlugin = ({ disabled }) => {
6664
6637
  setColumns("");
6665
6638
  setIsOpen(false);
6666
6639
  };
6667
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6668
- /* @__PURE__ */ jsxRuntime.jsx(
6669
- reactComponents.Button,
6670
- {
6671
- size: "small",
6672
- title: "Add table",
6673
- disabled,
6674
- icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.TableAddRegular, { style: { color: iconColor } }),
6675
- style: {
6676
- background: isOpen && !disabled ? "#ebebeb" : "none",
6677
- border: "none",
6678
- margin: 2,
6679
- opacity: disabled ? 0.55 : 1,
6680
- cursor: disabled ? "not-allowed" : "pointer"
6681
- },
6682
- onClick: () => {
6683
- if (disabled) return;
6684
- setIsOpen((prev) => !prev);
6640
+ return /* @__PURE__ */ jsxRuntime.jsx(
6641
+ AoModal,
6642
+ {
6643
+ isOpen: disabled ? false : isOpen,
6644
+ onOpenChange: (open) => {
6645
+ if (disabled) return;
6646
+ setIsOpen(open);
6647
+ if (open) {
6685
6648
  setRows("");
6686
6649
  setColumns("");
6687
6650
  }
6688
6651
  },
6689
- "insert-table-nodes"
6690
- ),
6691
- /* @__PURE__ */ jsxRuntime.jsx(
6692
- AoModal,
6693
- {
6694
- isOpen: disabled ? false : isOpen,
6695
- onDismiss: () => !disabled && setIsOpen(false),
6696
- title: "Insert table",
6697
- maxWidth: 300,
6698
- actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6699
- /* @__PURE__ */ jsxRuntime.jsx(
6700
- reactComponents.Button,
6701
- {
6702
- size: "small",
6703
- appearance: "primary",
6704
- disabled: disabled || !rows || !columns,
6705
- onClick: onAddTable,
6706
- children: "Add"
6707
- }
6708
- ),
6709
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6710
- ] }),
6711
- children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 8 }, children: [
6712
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Rows", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
6713
- reactComponents.Input,
6714
- {
6715
- autoFocus: !disabled,
6716
- value: rows,
6717
- placeholder: "Rows",
6718
- appearance: "underline",
6719
- disabled,
6720
- onChange: (_, v) => setRows(v.value)
6721
- }
6722
- ) }),
6723
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Columns", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
6724
- reactComponents.Input,
6725
- {
6726
- value: columns,
6727
- placeholder: "Columns",
6728
- appearance: "underline",
6729
- disabled,
6730
- onChange: (_, v) => setColumns(v.value)
6731
- }
6732
- ) })
6733
- ] })
6734
- }
6735
- )
6736
- ] });
6652
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
6653
+ reactComponents.Button,
6654
+ {
6655
+ size: "small",
6656
+ title: "Add table",
6657
+ disabled,
6658
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.TableAddRegular, { style: { color: iconColor } }),
6659
+ style: {
6660
+ background: isOpen && !disabled ? "#ebebeb" : "none",
6661
+ border: "none",
6662
+ margin: 2,
6663
+ opacity: disabled ? 0.55 : 1,
6664
+ cursor: disabled ? "not-allowed" : "pointer"
6665
+ }
6666
+ },
6667
+ "insert-table-nodes"
6668
+ ),
6669
+ title: "Insert table",
6670
+ maxWidth: 300,
6671
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6672
+ /* @__PURE__ */ jsxRuntime.jsx(
6673
+ reactComponents.Button,
6674
+ {
6675
+ size: "small",
6676
+ appearance: "primary",
6677
+ disabled: disabled || !rows || !columns,
6678
+ onClick: onAddTable,
6679
+ children: "Add"
6680
+ }
6681
+ ),
6682
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6683
+ ] }),
6684
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.Stack, { tokens: { childrenGap: 8 }, children: [
6685
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Rows", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
6686
+ reactComponents.Input,
6687
+ {
6688
+ autoFocus: !disabled,
6689
+ value: rows,
6690
+ placeholder: "Rows",
6691
+ appearance: "underline",
6692
+ disabled,
6693
+ onChange: (_, v) => setRows(v.value)
6694
+ }
6695
+ ) }),
6696
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "Columns", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
6697
+ reactComponents.Input,
6698
+ {
6699
+ value: columns,
6700
+ placeholder: "Columns",
6701
+ appearance: "underline",
6702
+ disabled,
6703
+ onChange: (_, v) => setColumns(v.value)
6704
+ }
6705
+ ) })
6706
+ ] })
6707
+ }
6708
+ );
6737
6709
  };
6738
6710
  var YoutubeUploadPlugin = ({ disabled }) => {
6739
6711
  const [url, setURL] = React9.useState("");
@@ -6753,54 +6725,51 @@ var YoutubeUploadPlugin = ({ disabled }) => {
6753
6725
  setURL("");
6754
6726
  setIsOpen(false);
6755
6727
  };
6756
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6757
- /* @__PURE__ */ jsxRuntime.jsx(
6758
- reactComponents.Button,
6759
- {
6760
- title: "Add youtube URL",
6761
- size: "small",
6762
- disabled,
6763
- icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.VideoClipRegular, { style: { color: iconColor } }),
6764
- style: {
6765
- background: isOpen && !disabled ? "#ebebeb" : "none",
6766
- border: "none",
6767
- margin: 2,
6768
- opacity: disabled ? 0.55 : 1,
6769
- cursor: disabled ? "not-allowed" : "pointer"
6770
- },
6771
- onClick: () => {
6772
- if (disabled) return;
6773
- setIsOpen((prev) => !prev);
6774
- setURL("");
6775
- }
6728
+ return /* @__PURE__ */ jsxRuntime.jsx(
6729
+ AoModal,
6730
+ {
6731
+ isOpen: disabled ? false : isOpen,
6732
+ onOpenChange: (open) => {
6733
+ if (disabled) return;
6734
+ setIsOpen(open);
6735
+ if (open) setURL("");
6776
6736
  },
6777
- "upload-video"
6778
- ),
6779
- /* @__PURE__ */ jsxRuntime.jsx(
6780
- AoModal,
6781
- {
6782
- isOpen: disabled ? false : isOpen,
6783
- onDismiss: () => !disabled && setIsOpen(false),
6784
- title: "Embed YouTube video",
6785
- maxWidth: 320,
6786
- actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6787
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled: disabled || !url, onClick: onHandleEmbeded, children: "Add" }),
6788
- /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6789
- ] }),
6790
- children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { tokens: { childrenGap: 8 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "URL", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
6791
- reactComponents.Input,
6792
- {
6793
- autoFocus: !disabled,
6794
- disabled,
6795
- value: url,
6796
- appearance: "underline",
6797
- placeholder: "Add Youtube video URL",
6798
- onChange: (_, v) => setURL(v.value)
6737
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(
6738
+ reactComponents.Button,
6739
+ {
6740
+ title: "Add youtube URL",
6741
+ size: "small",
6742
+ disabled,
6743
+ icon: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.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"
6799
6750
  }
6800
- ) }) })
6801
- }
6802
- )
6803
- ] });
6751
+ },
6752
+ "upload-video"
6753
+ ),
6754
+ title: "Embed YouTube video",
6755
+ maxWidth: 320,
6756
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6757
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled: disabled || !url, onClick: onHandleEmbeded, children: "Add" }),
6758
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Button, { size: "small", disabled, onClick: () => setIsOpen(false), children: "Cancel" })
6759
+ ] }),
6760
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { tokens: { childrenGap: 8 }, children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Field, { label: "URL", size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
6761
+ reactComponents.Input,
6762
+ {
6763
+ autoFocus: !disabled,
6764
+ disabled,
6765
+ value: url,
6766
+ appearance: "underline",
6767
+ placeholder: "Add Youtube video URL",
6768
+ onChange: (_, v) => setURL(v.value)
6769
+ }
6770
+ ) }) })
6771
+ }
6772
+ );
6804
6773
  };
6805
6774
  var TextAlphaListLtrFilled = ({ style }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", style, children: [
6806
6775
  /* @__PURE__ */ jsxRuntime.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" }),