@maily-to/core 0.2.2 → 0.2.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.
@@ -85,8 +85,8 @@ __export(src_exports, {
85
85
  module.exports = __toCommonJS(src_exports);
86
86
 
87
87
  // src/editor/index.tsx
88
- var import_react65 = require("@tiptap/react");
89
- var import_react66 = require("react");
88
+ var import_react66 = require("@tiptap/react");
89
+ var import_react67 = require("react");
90
90
 
91
91
  // src/editor/components/column-menu/columns-bubble-menu.tsx
92
92
  var import_react8 = require("@tiptap/react");
@@ -426,7 +426,7 @@ function getColumnWidths(editor) {
426
426
 
427
427
  // src/editor/components/column-menu/use-columns-state.tsx
428
428
  var import_react = require("@tiptap/react");
429
- var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
429
+ var import_fast_deep_equal = __toESM(require("fast-deep-equal"), 1);
430
430
  var useColumnsState = (editor) => {
431
431
  const states = (0, import_react.useEditorState)({
432
432
  editor,
@@ -474,8 +474,8 @@ function Divider(props) {
474
474
  }
475
475
 
476
476
  // src/editor/components/ui/tooltip.tsx
477
- var React = __toESM(require("react"));
478
- var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
477
+ var React = __toESM(require("react"), 1);
478
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
479
479
  var import_jsx_runtime2 = require("react/jsx-runtime");
480
480
  var TooltipProvider = TooltipPrimitive.Provider;
481
481
  var Tooltip = TooltipPrimitive.Root;
@@ -500,7 +500,7 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
500
500
  var import_lucide_react = require("lucide-react");
501
501
 
502
502
  // src/editor/components/base-button.tsx
503
- var React2 = __toESM(require("react"));
503
+ var React2 = __toESM(require("react"), 1);
504
504
  var import_react_slot = require("@radix-ui/react-slot");
505
505
  var import_jsx_runtime3 = require("react/jsx-runtime");
506
506
  var BaseButton = React2.forwardRef(
@@ -675,8 +675,8 @@ You can check out the documentation for more information: https://github.com/ari
675
675
  }
676
676
 
677
677
  // src/editor/components/popover.tsx
678
- var React3 = __toESM(require("react"));
679
- var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
678
+ var React3 = __toESM(require("react"), 1);
679
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
680
680
  var import_jsx_runtime6 = require("react/jsx-runtime");
681
681
  var Popover = PopoverPrimitive.Root;
682
682
  var PopoverTrigger = PopoverPrimitive.Trigger;
@@ -1296,7 +1296,7 @@ var import_react10 = require("react");
1296
1296
 
1297
1297
  // src/editor/plugins/drag-handle/drag-handle-plugin.ts
1298
1298
  var import_state2 = require("@tiptap/pm/state");
1299
- var import_tippy2 = __toESM(require("tippy.js"));
1299
+ var import_tippy2 = __toESM(require("tippy.js"), 1);
1300
1300
  var import_y_prosemirror = require("y-prosemirror");
1301
1301
  var import_model2 = require("@tiptap/pm/model");
1302
1302
  function getSelectionRanges(state, range, depth) {
@@ -1990,7 +1990,7 @@ var import_tippy3 = require("tippy.js");
1990
1990
 
1991
1991
  // src/editor/components/html-menu/use-html-state.ts
1992
1992
  var import_react13 = require("@tiptap/react");
1993
- var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"));
1993
+ var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"), 1);
1994
1994
  var useHtmlState = (editor) => {
1995
1995
  const states = (0, import_react13.useEditorState)({
1996
1996
  editor,
@@ -2103,7 +2103,7 @@ function HTMLBubbleMenu(props) {
2103
2103
  }
2104
2104
 
2105
2105
  // src/editor/nodes/logo/logo.ts
2106
- var import_extension_image = __toESM(require("@tiptap/extension-image"));
2106
+ var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
2107
2107
  var import_react23 = require("@tiptap/react");
2108
2108
 
2109
2109
  // src/editor/nodes/section/section.ts
@@ -2564,10 +2564,24 @@ var useEvent = (handler) => {
2564
2564
  }, []);
2565
2565
  };
2566
2566
 
2567
+ // src/editor/utils/aspect-ratio.ts
2568
+ function getAspectRatio(width, height) {
2569
+ return width / height;
2570
+ }
2571
+ function getNewHeight(width, aspectRatio) {
2572
+ if (width <= 0 || aspectRatio <= 0) {
2573
+ return 0;
2574
+ }
2575
+ return width / aspectRatio;
2576
+ }
2577
+ function getNewWidth(height, aspectRatio) {
2578
+ return height * aspectRatio;
2579
+ }
2580
+
2567
2581
  // src/editor/nodes/image/image-view.tsx
2568
2582
  var import_jsx_runtime17 = require("react/jsx-runtime");
2569
2583
  var MIN_WIDTH = 20;
2570
- var MAX_WIDTH = 600;
2584
+ var IMAGE_MAX_WIDTH = 600;
2571
2585
  function ImageView(props) {
2572
2586
  const { node, updateAttributes: updateAttributes2, selected, editor } = props;
2573
2587
  const [status, setStatus] = (0, import_react18.useState)("idle");
@@ -2585,7 +2599,10 @@ function ImageView(props) {
2585
2599
  if (!imgRef.current || !imageParent || !selected) {
2586
2600
  return;
2587
2601
  }
2588
- const imageParentWidth = Math.max(imageParent.offsetWidth, MAX_WIDTH);
2602
+ const imageParentWidth = Math.max(
2603
+ imageParent.offsetWidth,
2604
+ IMAGE_MAX_WIDTH
2605
+ );
2589
2606
  event.preventDefault();
2590
2607
  const direction = event.currentTarget.dataset.direction || "--";
2591
2608
  const initialXPosition = event.clientX;
@@ -2597,7 +2614,8 @@ function ImageView(props) {
2597
2614
  const removeListeners = () => {
2598
2615
  window.removeEventListener("mousemove", mouseMoveHandler);
2599
2616
  window.removeEventListener("mouseup", removeListeners);
2600
- updateAttributes2({ width: newWidth, height: newHeight });
2617
+ const aspectRatio = getAspectRatio(newWidth, newHeight);
2618
+ updateAttributes2({ width: newWidth, height: newHeight, aspectRatio });
2601
2619
  setResizingStyle(void 0);
2602
2620
  };
2603
2621
  const mouseMoveHandler = (event2) => {
@@ -2643,17 +2661,29 @@ function ImageView(props) {
2643
2661
  },
2644
2662
  [handleMouseDown, isPlaceholderImage]
2645
2663
  );
2646
- let { alignment = "center", width, height, src } = node.attrs || {};
2664
+ let {
2665
+ alignment = "center",
2666
+ width,
2667
+ height,
2668
+ src,
2669
+ borderRadius: borderRadius2
2670
+ } = node.attrs || {};
2647
2671
  const _a = node.attrs || {}, {
2648
2672
  externalLink,
2649
2673
  isExternalLinkVariable,
2650
2674
  isSrcVariable,
2651
- showIfKey
2675
+ showIfKey,
2676
+ aspectRatio: defaultAspectRatio,
2677
+ borderRadius: _,
2678
+ lockAspectRatio
2652
2679
  } = _a, attrs = __objRest(_a, [
2653
2680
  "externalLink",
2654
2681
  "isExternalLinkVariable",
2655
2682
  "isSrcVariable",
2656
- "showIfKey"
2683
+ "showIfKey",
2684
+ "aspectRatio",
2685
+ "borderRadius",
2686
+ "lockAspectRatio"
2657
2687
  ]);
2658
2688
  const hasImageSrc = !!attrs.src;
2659
2689
  const isDroppable = !!onImageUpload && editor.isEditable && !hasImageSrc && !isSrcVariable && status === "idle";
@@ -2700,14 +2730,15 @@ function ImageView(props) {
2700
2730
  return;
2701
2731
  }
2702
2732
  const wrapperWidth = wrapper.offsetWidth;
2703
- const aspectRatio = naturalWidth / naturalHeight;
2733
+ const aspectRatio = getAspectRatio(naturalWidth, naturalHeight);
2704
2734
  const calculatedHeight = Math.min(
2705
- wrapperWidth / aspectRatio,
2735
+ getNewHeight(wrapperWidth, aspectRatio),
2706
2736
  naturalHeight
2707
2737
  );
2708
2738
  updateAttributes2({
2709
2739
  width: Math.min(wrapperWidth, naturalWidth),
2710
- height: Math.min(calculatedHeight, naturalHeight)
2740
+ height: Math.min(calculatedHeight, naturalHeight),
2741
+ aspectRatio
2711
2742
  });
2712
2743
  };
2713
2744
  img.onerror = () => {
@@ -2777,7 +2808,8 @@ function ImageView(props) {
2777
2808
  position: "relative",
2778
2809
  // Weird! Basically tiptap/prose wraps this in a span and the line height causes an annoying buffer.
2779
2810
  lineHeight: "0px",
2780
- display: "block"
2811
+ display: "block",
2812
+ maxWidth: "100%"
2781
2813
  }), {
2782
2814
  center: { marginLeft: "auto", marginRight: "auto" },
2783
2815
  left: { marginRight: "auto" },
@@ -2819,7 +2851,8 @@ function ImageView(props) {
2819
2851
  ref: imgRef,
2820
2852
  style: __spreadProps(__spreadValues({}, resizingStyle), {
2821
2853
  cursor: "default",
2822
- marginBottom: 0
2854
+ marginBottom: 0,
2855
+ borderRadius: borderRadius2
2823
2856
  }),
2824
2857
  draggable: editor.isEditable,
2825
2858
  className: cn(
@@ -3169,6 +3202,30 @@ var LogoExtension = import_extension_image.default.extend({
3169
3202
  }
3170
3203
  });
3171
3204
 
3205
+ // src/editor/utils/border-radius.ts
3206
+ var borderRadius = [
3207
+ {
3208
+ name: "Sharp",
3209
+ value: 0
3210
+ },
3211
+ {
3212
+ name: "Smooth",
3213
+ value: 8
3214
+ },
3215
+ {
3216
+ name: "Smoother",
3217
+ value: 16
3218
+ },
3219
+ {
3220
+ name: "Rounded",
3221
+ value: 24
3222
+ },
3223
+ {
3224
+ name: "Circle",
3225
+ value: 9999
3226
+ }
3227
+ ];
3228
+
3172
3229
  // src/editor/components/image-menu/image-bubble-menu.tsx
3173
3230
  var import_react32 = require("@tiptap/react");
3174
3231
  var import_lucide_react23 = require("lucide-react");
@@ -3325,7 +3382,7 @@ var inlineImage = {
3325
3382
  icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.ImageIcon, { className: "mly-h-4 mly-w-4" }),
3326
3383
  command: ({ editor, range }) => {
3327
3384
  editor.chain().focus().deleteRange(range).setInlineImage({
3328
- src: ""
3385
+ src: "https://maily.to/brand/logo.png"
3329
3386
  }).command((props) => {
3330
3387
  const { tr, state, view, editor: editor2 } = props;
3331
3388
  const { from } = range;
@@ -4153,7 +4210,7 @@ var DEFAULT_SLASH_COMMANDS = [
4153
4210
 
4154
4211
  // src/editor/provider.tsx
4155
4212
  var import_jsx_runtime32 = require("react/jsx-runtime");
4156
- var DEFAULT_PLACEHOLDER_URL = "maily.to/";
4213
+ var DEFAULT_PLACEHOLDER_URL = "https://maily.to/";
4157
4214
  var MailyContext = (0, import_react24.createContext)({
4158
4215
  placeholderUrl: DEFAULT_PLACEHOLDER_URL,
4159
4216
  blocks: DEFAULT_SLASH_COMMANDS
@@ -4177,7 +4234,7 @@ var import_react30 = require("react");
4177
4234
  var import_core7 = require("@tiptap/core");
4178
4235
  var import_state5 = require("@tiptap/pm/state");
4179
4236
  var import_react28 = require("@tiptap/react");
4180
- var import_suggestion = __toESM(require("@tiptap/suggestion"));
4237
+ var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
4181
4238
 
4182
4239
  // src/editor/nodes/variable/variable-suggestions-popover.tsx
4183
4240
  var import_lucide_react20 = require("lucide-react");
@@ -4574,9 +4631,8 @@ var VariableExtension = import_core7.Node.create({
4574
4631
 
4575
4632
  // src/editor/components/ui/link-input-popover.tsx
4576
4633
  var import_jsx_runtime35 = require("react/jsx-runtime");
4577
- var LINK_PROTOCOL_REGEX = /https?:\/\//;
4578
4634
  function LinkInputPopover(props) {
4579
- var _a, _b, _c;
4635
+ var _a, _b;
4580
4636
  const {
4581
4637
  defaultValue = "",
4582
4638
  onValueChange,
@@ -4585,22 +4641,16 @@ function LinkInputPopover(props) {
4585
4641
  editor,
4586
4642
  isVariable
4587
4643
  } = props;
4588
- const defaultProtocol = (_a = defaultValue.match(LINK_PROTOCOL_REGEX)) == null ? void 0 : _a[0];
4589
- const defaultUrlWithoutProtocol = defaultValue.replace(
4590
- LINK_PROTOCOL_REGEX,
4591
- ""
4592
- );
4593
4644
  const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
4594
- const [protocol, setProtocol] = (0, import_react29.useState)(defaultProtocol || "https://");
4595
4645
  const [isEditing, setIsEditing] = (0, import_react29.useState)(!isVariable);
4596
4646
  const linkInputRef = (0, import_react29.useRef)(null);
4597
4647
  const { placeholderUrl = DEFAULT_PLACEHOLDER_URL } = useMailyContext();
4598
4648
  const options = useVariableOptions(editor);
4599
4649
  const renderVariable = options == null ? void 0 : options.renderVariable;
4600
4650
  const variables = options == null ? void 0 : options.variables;
4601
- const variableTriggerCharacter = (_c = (_b = options == null ? void 0 : options.suggestion) == null ? void 0 : _b.char) != null ? _c : DEFAULT_VARIABLE_TRIGGER_CHAR;
4651
+ const variableTriggerCharacter = (_b = (_a = options == null ? void 0 : options.suggestion) == null ? void 0 : _a.char) != null ? _b : DEFAULT_VARIABLE_TRIGGER_CHAR;
4602
4652
  const autoCompleteOptions = (0, import_react30.useMemo)(() => {
4603
- const withoutTrigger = defaultUrlWithoutProtocol.replace(
4653
+ const withoutTrigger = defaultValue.replace(
4604
4654
  new RegExp(variableTriggerCharacter, "g"),
4605
4655
  ""
4606
4656
  );
@@ -4609,7 +4659,7 @@ function LinkInputPopover(props) {
4609
4659
  from: "bubble-variable",
4610
4660
  editor
4611
4661
  }).map((variable) => variable.name);
4612
- }, [variables, variableTriggerCharacter, defaultUrlWithoutProtocol, editor]);
4662
+ }, [variables, variableTriggerCharacter, defaultValue, editor]);
4613
4663
  const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4614
4664
  BaseButton,
4615
4665
  {
@@ -4617,130 +4667,105 @@ function LinkInputPopover(props) {
4617
4667
  size: "sm",
4618
4668
  type: "button",
4619
4669
  className: "mly-size-7",
4620
- "data-state": !!defaultUrlWithoutProtocol,
4670
+ "data-state": !!defaultValue,
4621
4671
  children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Icon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-midnight-gray" })
4622
4672
  }
4623
4673
  ) });
4624
- const normalizeProtocol = (value, p = protocol) => {
4625
- value = value == null ? void 0 : value.replace(LINK_PROTOCOL_REGEX, "");
4626
- return p + value;
4627
- };
4628
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
4629
- tooltip ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
4630
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
4631
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
4632
- ] }) : popoverButton,
4633
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4634
- PopoverContent,
4635
- {
4636
- align: "end",
4637
- side: "top",
4638
- className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
4639
- sideOffset: 8,
4640
- onCloseAutoFocus: (e) => e.preventDefault(),
4641
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4642
- "form",
4674
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4675
+ Popover,
4676
+ {
4677
+ open: isOpen,
4678
+ onOpenChange: (open) => {
4679
+ setIsOpen(open);
4680
+ if (open) {
4681
+ setTimeout(() => {
4682
+ var _a2;
4683
+ (_a2 = linkInputRef.current) == null ? void 0 : _a2.focus();
4684
+ }, 0);
4685
+ }
4686
+ },
4687
+ children: [
4688
+ tooltip ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { children: [
4689
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
4690
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
4691
+ ] }) : popoverButton,
4692
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4693
+ PopoverContent,
4643
4694
  {
4644
- onSubmit: (e) => {
4645
- e.preventDefault();
4646
- const input = linkInputRef.current;
4647
- if (!input) {
4648
- return;
4649
- }
4650
- let value = normalizeProtocol(input.value);
4651
- onValueChange == null ? void 0 : onValueChange(value);
4652
- setIsOpen(false);
4653
- },
4654
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
4655
- !isEditing && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-flex mly-h-8 mly-items-center mly-rounded-lg mly-border mly-border-gray-300 mly-bg-white mly-px-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4656
- "button",
4657
- {
4658
- onClick: () => {
4659
- setIsEditing(true);
4660
- setTimeout(() => {
4661
- var _a2;
4662
- (_a2 = linkInputRef.current) == null ? void 0 : _a2.focus();
4663
- }, 0);
4664
- },
4665
- children: renderVariable({
4666
- variable: {
4667
- name: defaultUrlWithoutProtocol,
4668
- valid: true
4669
- },
4670
- fallback: "",
4671
- from: "bubble-variable",
4672
- editor
4673
- })
4674
- }
4675
- ) }),
4676
- isEditing && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
4677
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-relative", children: [
4678
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4679
- "select",
4695
+ align: "end",
4696
+ side: "top",
4697
+ className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
4698
+ sideOffset: 8,
4699
+ onCloseAutoFocus: (e) => e.preventDefault(),
4700
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4701
+ "form",
4702
+ {
4703
+ onSubmit: (e) => {
4704
+ e.preventDefault();
4705
+ const input = linkInputRef.current;
4706
+ if (!input) {
4707
+ return;
4708
+ }
4709
+ onValueChange == null ? void 0 : onValueChange(input.value);
4710
+ setIsOpen(false);
4711
+ },
4712
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
4713
+ !isEditing && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-flex mly-h-8 mly-items-center mly-rounded-lg mly-border mly-border-gray-300 mly-bg-white mly-px-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4714
+ "button",
4680
4715
  {
4681
- className: "hover:text-accent-foreground mly-peer mly-inline-flex mly-h-full mly-appearance-none mly-items-center mly-rounded-none mly-rounded-s-lg mly-border mly-border-gray-300 mly-bg-gray-50 mly-pe-8 mly-ps-3 mly-text-sm mly-text-gray-700 mly-transition-shadow hover:mly-bg-gray-100 focus:mly-z-10 focus-visible:mly-outline-none disabled:mly-pointer-events-none disabled:mly-cursor-not-allowed disabled:mly-opacity-50",
4682
- "aria-label": "Protocol",
4683
- value: protocol,
4684
- onChange: (e) => {
4685
- var _a2;
4686
- const protocol2 = e.target.value;
4687
- setProtocol(protocol2);
4688
- const newValue = normalizeProtocol(
4689
- ((_a2 = linkInputRef.current) == null ? void 0 : _a2.value) || "",
4690
- protocol2
4691
- );
4692
- onValueChange == null ? void 0 : onValueChange(newValue);
4716
+ onClick: () => {
4717
+ setIsEditing(true);
4718
+ setTimeout(() => {
4719
+ var _a2;
4720
+ (_a2 = linkInputRef.current) == null ? void 0 : _a2.focus();
4721
+ }, 0);
4693
4722
  },
4694
- children: [
4695
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "https://", children: "https://" }),
4696
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "http://", children: "http://" })
4697
- ]
4698
- }
4699
- ),
4700
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly-pointer-events-none mly-absolute mly-inset-y-0 mly-right-0 mly-z-10 mly-flex mly-h-full mly-w-9 mly-items-center mly-justify-center mly-text-gray-600 peer-disabled:mly-opacity-50", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4701
- import_lucide_react22.ChevronDownIcon,
4702
- {
4703
- size: 16,
4704
- strokeWidth: 2,
4705
- "aria-hidden": "true",
4706
- role: "img"
4723
+ children: renderVariable({
4724
+ variable: {
4725
+ name: defaultValue,
4726
+ valid: true
4727
+ },
4728
+ fallback: "",
4729
+ from: "bubble-variable",
4730
+ editor
4731
+ })
4707
4732
  }
4708
- ) })
4709
- ] }),
4710
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4711
- InputAutocomplete,
4712
- {
4713
- editor,
4714
- value: defaultUrlWithoutProtocol,
4715
- onValueChange: (value) => {
4716
- let newValue = normalizeProtocol(value);
4717
- onValueChange == null ? void 0 : onValueChange(newValue);
4718
- },
4719
- autoCompleteOptions,
4720
- ref: linkInputRef,
4721
- placeholder: placeholderUrl,
4722
- className: "-mly-ms-px mly-block mly-h-8 mly-w-52 mly-rounded-lg mly-rounded-s-none mly-border mly-border-gray-300 mly-px-2 mly-py-1.5 mly-pr-6 mly-text-sm mly-shadow-sm mly-outline-none placeholder:mly-text-gray-400",
4723
- triggerChar: variableTriggerCharacter,
4724
- onSelectOption: (value) => {
4725
- var _a2;
4726
- const isVariable2 = (_a2 = autoCompleteOptions.includes(value)) != null ? _a2 : false;
4727
- if (isVariable2) {
4728
- setIsEditing(false);
4729
- } else {
4730
- value = normalizeProtocol(value);
4733
+ ) }),
4734
+ isEditing && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-relative", children: [
4735
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-left-1.5 mly-z-10 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react22.LinkIcon, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) }),
4736
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4737
+ InputAutocomplete,
4738
+ {
4739
+ editor,
4740
+ value: defaultValue,
4741
+ onValueChange: (value) => {
4742
+ onValueChange == null ? void 0 : onValueChange(value);
4743
+ },
4744
+ autoCompleteOptions,
4745
+ ref: linkInputRef,
4746
+ placeholder: placeholderUrl,
4747
+ className: "-mly-ms-px mly-block mly-h-8 mly-w-56 mly-rounded-lg mly-border mly-border-gray-300 mly-px-2 mly-py-1.5 mly-pl-6 mly-pr-6 mly-text-sm mly-shadow-sm mly-outline-none placeholder:mly-text-gray-400",
4748
+ triggerChar: variableTriggerCharacter,
4749
+ onSelectOption: (value) => {
4750
+ var _a2;
4751
+ const isVariable2 = (_a2 = autoCompleteOptions.includes(value)) != null ? _a2 : false;
4752
+ if (isVariable2) {
4753
+ setIsEditing(false);
4754
+ }
4755
+ onValueChange == null ? void 0 : onValueChange(value, isVariable2);
4756
+ setIsOpen(false);
4757
+ }
4731
4758
  }
4732
- onValueChange == null ? void 0 : onValueChange(value, isVariable2);
4733
- setIsOpen(false);
4734
- }
4735
- }
4736
- )
4737
- ] })
4738
- ] })
4759
+ )
4760
+ ] })
4761
+ ] })
4762
+ }
4763
+ )
4739
4764
  }
4740
4765
  )
4741
- }
4742
- )
4743
- ] });
4766
+ ]
4767
+ }
4768
+ );
4744
4769
  }
4745
4770
 
4746
4771
  // src/editor/components/image-menu/image-size.tsx
@@ -4764,24 +4789,27 @@ function ImageSize(props) {
4764
4789
 
4765
4790
  // src/editor/components/image-menu/use-image-state.tsx
4766
4791
  var import_react31 = require("@tiptap/react");
4767
- var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"));
4792
+ var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"), 1);
4768
4793
  var useImageState = (editor) => {
4769
4794
  const states = (0, import_react31.useEditorState)({
4770
4795
  editor,
4771
4796
  selector: ({ editor: editor2 }) => {
4772
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
4797
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
4773
4798
  return {
4774
4799
  width: String(editor2.getAttributes("image").width),
4775
4800
  height: String(editor2.getAttributes("image").height),
4776
4801
  isImageActive: editor2.isActive("image"),
4777
4802
  isLogoActive: editor2.isActive("logo"),
4778
4803
  alignment: ((_a = editor2.getAttributes("image")) == null ? void 0 : _a.alignment) || ((_b = editor2.getAttributes("logo")) == null ? void 0 : _b.alignment),
4779
- logoSize: ((_c = editor2.getAttributes("logo")) == null ? void 0 : _c.size) || DEFAULT_LOGO_SIZE,
4780
- imageSrc: ((_d = editor2.getAttributes("image")) == null ? void 0 : _d.src) || ((_e = editor2.getAttributes("logo")) == null ? void 0 : _e.src) || "",
4781
- isSrcVariable: (_i = (_h = (_f = editor2.getAttributes("image")) == null ? void 0 : _f.isSrcVariable) != null ? _h : (_g = editor2.getAttributes("logo")) == null ? void 0 : _g.isSrcVariable) != null ? _i : false,
4782
- imageExternalLink: ((_j = editor2.getAttributes("image")) == null ? void 0 : _j.externalLink) || "",
4783
- isExternalLinkVariable: (_k = editor2.getAttributes("image")) == null ? void 0 : _k.isExternalLinkVariable,
4784
- currentShowIfKey: ((_l = editor2.getAttributes("image")) == null ? void 0 : _l.showIfKey) || ((_m = editor2.getAttributes("logo")) == null ? void 0 : _m.showIfKey) || ""
4804
+ borderRadius: (_c = editor2.getAttributes("image")) == null ? void 0 : _c.borderRadius,
4805
+ logoSize: ((_d = editor2.getAttributes("logo")) == null ? void 0 : _d.size) || DEFAULT_LOGO_SIZE,
4806
+ imageSrc: ((_e = editor2.getAttributes("image")) == null ? void 0 : _e.src) || ((_f = editor2.getAttributes("logo")) == null ? void 0 : _f.src) || "",
4807
+ isSrcVariable: (_j = (_i = (_g = editor2.getAttributes("image")) == null ? void 0 : _g.isSrcVariable) != null ? _i : (_h = editor2.getAttributes("logo")) == null ? void 0 : _h.isSrcVariable) != null ? _j : false,
4808
+ imageExternalLink: ((_k = editor2.getAttributes("image")) == null ? void 0 : _k.externalLink) || "",
4809
+ isExternalLinkVariable: (_l = editor2.getAttributes("image")) == null ? void 0 : _l.isExternalLinkVariable,
4810
+ lockAspectRatio: (_m = editor2.getAttributes("image")) == null ? void 0 : _m.lockAspectRatio,
4811
+ aspectRatio: (_n = editor2.getAttributes("image")) == null ? void 0 : _n.aspectRatio,
4812
+ currentShowIfKey: ((_o = editor2.getAttributes("image")) == null ? void 0 : _o.showIfKey) || ((_p = editor2.getAttributes("logo")) == null ? void 0 : _p.showIfKey) || ""
4785
4813
  };
4786
4814
  },
4787
4815
  equalityFn: import_fast_deep_equal3.default
@@ -4814,6 +4842,7 @@ function ImageBubbleMenu(props) {
4814
4842
  maxWidth: "100%"
4815
4843
  }
4816
4844
  });
4845
+ const { lockAspectRatio } = state;
4817
4846
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4818
4847
  import_react32.BubbleMenu,
4819
4848
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
@@ -4893,6 +4922,24 @@ function ImageBubbleMenu(props) {
4893
4922
  ] }),
4894
4923
  state.isImageActive && state.imageSrc && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
4895
4924
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Divider, {}),
4925
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4926
+ Select,
4927
+ {
4928
+ label: "Border Radius",
4929
+ value: state == null ? void 0 : state.borderRadius,
4930
+ options: borderRadius.map((value) => ({
4931
+ value: String(value.value),
4932
+ label: value.name
4933
+ })),
4934
+ onValueChange: (value) => {
4935
+ editor == null ? void 0 : editor.chain().updateAttributes("image", {
4936
+ borderRadius: Number(value)
4937
+ }).run();
4938
+ },
4939
+ tooltip: "Border Radius",
4940
+ className: "mly-capitalize"
4941
+ }
4942
+ ),
4896
4943
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
4897
4944
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4898
4945
  ImageSize,
@@ -4900,7 +4947,14 @@ function ImageBubbleMenu(props) {
4900
4947
  dimension: "width",
4901
4948
  value: (_c = state == null ? void 0 : state.width) != null ? _c : "",
4902
4949
  onValueChange: (value) => {
4903
- editor == null ? void 0 : editor.chain().updateAttributes("image", { width: value || null }).run();
4950
+ const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
4951
+ editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
4952
+ width: String(width)
4953
+ }, lockAspectRatio && value ? {
4954
+ height: String(
4955
+ getNewHeight(width, state.aspectRatio)
4956
+ )
4957
+ } : {})).run();
4904
4958
  }
4905
4959
  }
4906
4960
  ),
@@ -4910,9 +4964,33 @@ function ImageBubbleMenu(props) {
4910
4964
  dimension: "height",
4911
4965
  value: (_d = state == null ? void 0 : state.height) != null ? _d : "",
4912
4966
  onValueChange: (value) => {
4913
- editor == null ? void 0 : editor.chain().updateAttributes("image", { height: value || null }).run();
4967
+ const height = Number(value) || 0;
4968
+ editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
4969
+ height: String(height)
4970
+ }, lockAspectRatio && value ? {
4971
+ width: String(
4972
+ getNewWidth(height, state.aspectRatio)
4973
+ )
4974
+ } : {})).run();
4914
4975
  }
4915
4976
  }
4977
+ ),
4978
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4979
+ BubbleMenuButton,
4980
+ {
4981
+ isActive: () => lockAspectRatio,
4982
+ command: () => {
4983
+ const width = Number(state.width) || 0;
4984
+ const height = Number(state.height) || 0;
4985
+ const aspectRatio = width / height;
4986
+ editor == null ? void 0 : editor.chain().updateAttributes("image", {
4987
+ lockAspectRatio: !lockAspectRatio,
4988
+ aspectRatio
4989
+ }).run();
4990
+ },
4991
+ icon: lockAspectRatio ? import_lucide_react23.LockIcon : import_lucide_react23.LockOpenIcon,
4992
+ tooltip: "Lock Aspect Ratio"
4993
+ }
4916
4994
  )
4917
4995
  ] })
4918
4996
  ] }),
@@ -5054,7 +5132,7 @@ var InlineImageExtension = import_core8.Node.create({
5054
5132
 
5055
5133
  // src/editor/components/inline-image-menu/use-inline-image-state.tsx
5056
5134
  var import_react33 = require("@tiptap/react");
5057
- var import_fast_deep_equal4 = __toESM(require("fast-deep-equal"));
5135
+ var import_fast_deep_equal4 = __toESM(require("fast-deep-equal"), 1);
5058
5136
  var useInlineImageState = (editor) => {
5059
5137
  const states = (0, import_react33.useEditorState)({
5060
5138
  editor,
@@ -5162,7 +5240,7 @@ var import_tippy6 = require("tippy.js");
5162
5240
 
5163
5241
  // src/editor/components/repeat-menu/use-repeat-state.ts
5164
5242
  var import_react35 = require("@tiptap/react");
5165
- var import_fast_deep_equal5 = __toESM(require("fast-deep-equal"));
5243
+ var import_fast_deep_equal5 = __toESM(require("fast-deep-equal"), 1);
5166
5244
  var useRepeatState = (editor) => {
5167
5245
  const states = (0, import_react35.useEditorState)({
5168
5246
  editor,
@@ -5530,7 +5608,7 @@ function ColorPicker(props) {
5530
5608
 
5531
5609
  // src/editor/components/section-menu/use-section-state.tsx
5532
5610
  var import_react38 = require("@tiptap/react");
5533
- var import_fast_deep_equal6 = __toESM(require("fast-deep-equal"));
5611
+ var import_fast_deep_equal6 = __toESM(require("fast-deep-equal"), 1);
5534
5612
  var useSectionState = (editor) => {
5535
5613
  const states = (0, import_react38.useEditorState)({
5536
5614
  editor,
@@ -5831,7 +5909,7 @@ var import_react42 = require("@tiptap/react");
5831
5909
 
5832
5910
  // src/editor/components/spacer-menu/use-spacer-state.ts
5833
5911
  var import_react41 = require("@tiptap/react");
5834
- var import_fast_deep_equal7 = __toESM(require("fast-deep-equal"));
5912
+ var import_fast_deep_equal7 = __toESM(require("fast-deep-equal"), 1);
5835
5913
  var useSpacerState = (editor) => {
5836
5914
  const states = (0, import_react41.useEditorState)({
5837
5915
  editor,
@@ -6048,7 +6126,7 @@ var HorizontalRule = import_extension_horizontal_rule.HorizontalRule.extend({
6048
6126
  });
6049
6127
 
6050
6128
  // src/editor/utils/is-custom-node-selected.ts
6051
- var import_extension_image3 = __toESM(require("@tiptap/extension-image"));
6129
+ var import_extension_image3 = __toESM(require("@tiptap/extension-image"), 1);
6052
6130
 
6053
6131
  // src/editor/nodes/spacer.ts
6054
6132
  var import_core12 = require("@tiptap/core");
@@ -6137,7 +6215,7 @@ var import_react45 = require("@tiptap/react");
6137
6215
  var import_react44 = require("@tiptap/react");
6138
6216
 
6139
6217
  // src/editor/components/input.tsx
6140
- var React5 = __toESM(require("react"));
6218
+ var React5 = __toESM(require("react"), 1);
6141
6219
  var import_jsx_runtime46 = require("react/jsx-runtime");
6142
6220
  var Input = React5.forwardRef(
6143
6221
  (_a, ref) => {
@@ -6159,7 +6237,7 @@ var Input = React5.forwardRef(
6159
6237
  Input.displayName = "Input";
6160
6238
 
6161
6239
  // src/editor/components/textarea.tsx
6162
- var React6 = __toESM(require("react"));
6240
+ var React6 = __toESM(require("react"), 1);
6163
6241
  var import_jsx_runtime47 = require("react/jsx-runtime");
6164
6242
  var Textarea = React6.forwardRef(
6165
6243
  (_a, ref) => {
@@ -7052,8 +7130,9 @@ var ButtonExtension = import_core14.Node.create({
7052
7130
  });
7053
7131
 
7054
7132
  // src/editor/nodes/image/image.ts
7055
- var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
7133
+ var import_extension_image2 = __toESM(require("@tiptap/extension-image"), 1);
7056
7134
  var import_react50 = require("@tiptap/react");
7135
+ var DEFAULT_IMAGE_BORDER_RADIUS = 0;
7057
7136
  var ImageExtension = import_extension_image2.default.extend({
7058
7137
  addAttributes() {
7059
7138
  var _a;
@@ -7117,6 +7196,17 @@ var ImageExtension = import_extension_image2.default.extend({
7117
7196
  };
7118
7197
  }
7119
7198
  },
7199
+ borderRadius: {
7200
+ default: DEFAULT_IMAGE_BORDER_RADIUS,
7201
+ parseHTML: (element) => {
7202
+ return Number(element.getAttribute("data-border-radius"));
7203
+ },
7204
+ renderHTML: (attributes) => {
7205
+ return {
7206
+ "data-border-radius": attributes.borderRadius
7207
+ };
7208
+ }
7209
+ },
7120
7210
  // Later we will remove this attribute
7121
7211
  // and use the `src` attribute instead when implement
7122
7212
  // the URL variable feature
@@ -7134,6 +7224,34 @@ var ImageExtension = import_extension_image2.default.extend({
7134
7224
  };
7135
7225
  }
7136
7226
  },
7227
+ aspectRatio: {
7228
+ default: null,
7229
+ parseHTML: (element) => {
7230
+ return element.getAttribute("data-aspect-ratio") || null;
7231
+ },
7232
+ renderHTML: (attributes) => {
7233
+ if (!(attributes == null ? void 0 : attributes.aspectRatio)) {
7234
+ return {};
7235
+ }
7236
+ return {
7237
+ "data-aspect-ratio": attributes == null ? void 0 : attributes.aspectRatio
7238
+ };
7239
+ }
7240
+ },
7241
+ lockAspectRatio: {
7242
+ default: true,
7243
+ parseHTML: (element) => {
7244
+ return element.getAttribute("data-lock-aspect-ratio") === "true";
7245
+ },
7246
+ renderHTML: (attributes) => {
7247
+ if (!attributes.lockAspectRatio) {
7248
+ return {};
7249
+ }
7250
+ return {
7251
+ "data-lock-aspect-ratio": "true"
7252
+ };
7253
+ }
7254
+ },
7137
7255
  showIfKey: {
7138
7256
  default: DEFAULT_SECTION_SHOW_IF_KEY,
7139
7257
  parseHTML: (element) => {
@@ -7158,10 +7276,10 @@ var ImageExtension = import_extension_image2.default.extend({
7158
7276
  });
7159
7277
 
7160
7278
  // src/editor/nodes/html/html.tsx
7161
- var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"));
7279
+ var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
7162
7280
  var import_state7 = require("@tiptap/pm/state");
7163
- var import_react59 = require("@tiptap/react");
7164
- var import_xml = __toESM(require("highlight.js/lib/languages/xml"));
7281
+ var import_react60 = require("@tiptap/react");
7282
+ var import_xml = __toESM(require("highlight.js/lib/languages/xml"), 1);
7165
7283
  var import_lowlight = require("lowlight");
7166
7284
 
7167
7285
  // src/editor/nodes/html/html-view.tsx
@@ -7211,7 +7329,24 @@ function HTMLCodeBlockView(props) {
7211
7329
  "mly-not-prose mly-rounded-lg mly-border mly-border-gray-200 mly-p-2",
7212
7330
  isEmpty && "mly-min-h-[42px]"
7213
7331
  ),
7214
- dangerouslySetInnerHTML: { __html: html2 },
7332
+ ref: (node2) => {
7333
+ if (!node2 || (node2 == null ? void 0 : node2.shadowRoot)) {
7334
+ return;
7335
+ }
7336
+ const shadow = node2.attachShadow({ mode: "open" });
7337
+ const sheet = new CSSStyleSheet();
7338
+ sheet.replaceSync(`
7339
+ * { font-family: 'Inter', sans-serif; }
7340
+ blockquote, h1, h2, h3, img, li, ol, p, ul {
7341
+ margin-top: 0;
7342
+ margin-bottom: 0;
7343
+ }
7344
+ `);
7345
+ shadow.adoptedStyleSheets = [sheet];
7346
+ const container = document.createElement("div");
7347
+ container.innerHTML = html2;
7348
+ shadow.appendChild(container);
7349
+ },
7215
7350
  contentEditable: false,
7216
7351
  onClick: () => {
7217
7352
  if (!isEmpty) {
@@ -7229,7 +7364,7 @@ function HTMLCodeBlockView(props) {
7229
7364
  }
7230
7365
 
7231
7366
  // src/editor/extensions/color.ts
7232
- var import_extension_color = __toESM(require("@tiptap/extension-color"));
7367
+ var import_extension_color = __toESM(require("@tiptap/extension-color"), 1);
7233
7368
  var Color = import_extension_color.default.extend({
7234
7369
  addStorage() {
7235
7370
  return {
@@ -7240,16 +7375,16 @@ var Color = import_extension_color.default.extend({
7240
7375
 
7241
7376
  // src/editor/extensions/maily-kit.tsx
7242
7377
  var import_core17 = require("@tiptap/core");
7243
- var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
7244
- var import_extension_list_item = __toESM(require("@tiptap/extension-list-item"));
7245
- var import_extension_paragraph2 = __toESM(require("@tiptap/extension-paragraph"));
7246
- var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
7247
- var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"));
7248
- var import_extension_heading2 = __toESM(require("@tiptap/extension-heading"));
7249
- var import_extension_underline = __toESM(require("@tiptap/extension-underline"));
7250
- var import_extension_document = __toESM(require("@tiptap/extension-document"));
7251
- var import_extension_focus = __toESM(require("@tiptap/extension-focus"));
7252
- var import_extension_dropcursor = __toESM(require("@tiptap/extension-dropcursor"));
7378
+ var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
7379
+ var import_extension_list_item = __toESM(require("@tiptap/extension-list-item"), 1);
7380
+ var import_extension_paragraph2 = __toESM(require("@tiptap/extension-paragraph"), 1);
7381
+ var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"), 1);
7382
+ var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"), 1);
7383
+ var import_extension_heading2 = __toESM(require("@tiptap/extension-heading"), 1);
7384
+ var import_extension_underline = __toESM(require("@tiptap/extension-underline"), 1);
7385
+ var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
7386
+ var import_extension_focus = __toESM(require("@tiptap/extension-focus"), 1);
7387
+ var import_extension_dropcursor = __toESM(require("@tiptap/extension-dropcursor"), 1);
7253
7388
 
7254
7389
  // src/editor/nodes/footer.ts
7255
7390
  var import_core15 = require("@tiptap/core");
@@ -7292,7 +7427,7 @@ var Footer = import_core15.Node.create({
7292
7427
  });
7293
7428
 
7294
7429
  // src/editor/nodes/link.ts
7295
- var import_extension_link = __toESM(require("@tiptap/extension-link"));
7430
+ var import_extension_link = __toESM(require("@tiptap/extension-link"), 1);
7296
7431
  var LinkExtension = import_extension_link.default.extend({
7297
7432
  addAttributes() {
7298
7433
  var _a;
@@ -7313,7 +7448,7 @@ var LinkExtension = import_extension_link.default.extend({
7313
7448
  });
7314
7449
 
7315
7450
  // src/editor/nodes/heading/heading.ts
7316
- var import_extension_heading = __toESM(require("@tiptap/extension-heading"));
7451
+ var import_extension_heading = __toESM(require("@tiptap/extension-heading"), 1);
7317
7452
  var HeadingExtension = import_extension_heading.default.extend({
7318
7453
  addAttributes() {
7319
7454
  var _a;
@@ -7337,7 +7472,7 @@ var HeadingExtension = import_extension_heading.default.extend({
7337
7472
  });
7338
7473
 
7339
7474
  // src/editor/nodes/paragraph/paragraph.ts
7340
- var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"));
7475
+ var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
7341
7476
  var ParagraphExtension = import_extension_paragraph.default.extend({
7342
7477
  addAttributes() {
7343
7478
  var _a;
@@ -7590,7 +7725,7 @@ var MailyKit = import_core17.Extension.create({
7590
7725
  });
7591
7726
 
7592
7727
  // src/editor/extensions/placeholder.ts
7593
- var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"));
7728
+ var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"), 1);
7594
7729
  var PlaceholderExtension = import_extension_placeholder.default.configure({
7595
7730
  placeholder: ({ node }) => {
7596
7731
  if (node.type.name === "heading") {
@@ -7609,7 +7744,7 @@ var PlaceholderExtension = import_extension_placeholder.default.configure({
7609
7744
 
7610
7745
  // src/editor/extensions/slash-command/slash-command.ts
7611
7746
  var import_core18 = require("@tiptap/core");
7612
- var import_suggestion2 = __toESM(require("@tiptap/suggestion"));
7747
+ var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
7613
7748
  var SlashCommandExtension = import_core18.Extension.create({
7614
7749
  name: "slash-command",
7615
7750
  addOptions() {
@@ -7632,16 +7767,118 @@ var SlashCommandExtension = import_core18.Extension.create({
7632
7767
  });
7633
7768
 
7634
7769
  // src/editor/extensions/slash-command/slash-command-view.tsx
7635
- var import_react55 = require("@tiptap/react");
7636
- var import_react56 = require("react");
7637
- var import_tippy8 = __toESM(require("tippy.js"));
7770
+ var import_react56 = require("@tiptap/react");
7771
+ var import_react57 = require("react");
7772
+ var import_tippy8 = __toESM(require("tippy.js"), 1);
7773
+
7774
+ // src/editor/extensions/slash-command/slash-command-item.tsx
7638
7775
  var import_lucide_react28 = require("lucide-react");
7776
+ var import_react55 = require("react");
7639
7777
  var import_jsx_runtime53 = require("react/jsx-runtime");
7640
- var CommandList = (0, import_react56.forwardRef)(function CommandList2(props, ref) {
7641
- const { items: groups, command, editor } = props;
7642
- const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react56.useState)(0);
7643
- const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react56.useState)(0);
7644
- const selectItem = (0, import_react56.useCallback)(
7778
+ function SlashCommandItem(props) {
7779
+ var _a;
7780
+ const {
7781
+ item,
7782
+ groupIndex,
7783
+ commandIndex,
7784
+ selectedGroupIndex,
7785
+ selectedCommandIndex,
7786
+ editor,
7787
+ activeCommandRef,
7788
+ selectItem
7789
+ } = props;
7790
+ const [open, setOpen] = (0, import_react55.useState)(false);
7791
+ const [isHovered, setIsHovered] = (0, import_react55.useState)(false);
7792
+ const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
7793
+ const isSubCommand = item && "commands" in item;
7794
+ const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && (isActive || isHovered);
7795
+ const hasRenderFunction = typeof item.render === "function";
7796
+ const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
7797
+ let value = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
7798
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
7799
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "mly-grow", children: [
7800
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly-font-medium", children: item.title }),
7801
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly-text-xs mly-text-gray-400", children: item.description })
7802
+ ] }),
7803
+ isSubCommand && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mly-block mly-px-1 mly-text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.ChevronRightIcon, { className: "mly-size-3.5 mly-stroke-[2.5]" }) })
7804
+ ] });
7805
+ if (renderFunctionValue !== null && renderFunctionValue !== true) {
7806
+ value = renderFunctionValue;
7807
+ }
7808
+ const openTimerRef = (0, import_react55.useRef)(0);
7809
+ const handleDelayedOpen = (0, import_react55.useCallback)(() => {
7810
+ window.clearTimeout(openTimerRef.current);
7811
+ const delay = 200;
7812
+ openTimerRef.current = window.setTimeout(() => {
7813
+ setOpen(true);
7814
+ openTimerRef.current = 0;
7815
+ }, delay);
7816
+ }, [setOpen]);
7817
+ (0, import_react55.useEffect)(() => {
7818
+ if (shouldOpenTooltip) {
7819
+ handleDelayedOpen();
7820
+ } else {
7821
+ window.clearTimeout(openTimerRef.current);
7822
+ openTimerRef.current = 0;
7823
+ setOpen(false);
7824
+ }
7825
+ }, [shouldOpenTooltip]);
7826
+ (0, import_react55.useEffect)(() => {
7827
+ return () => {
7828
+ if (openTimerRef.current) {
7829
+ window.clearTimeout(openTimerRef.current);
7830
+ openTimerRef.current = 0;
7831
+ }
7832
+ };
7833
+ }, []);
7834
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Tooltip, { open, children: [
7835
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7836
+ "button",
7837
+ {
7838
+ className: cn(
7839
+ "mly-flex mly-w-full mly-items-center mly-gap-2 mly-rounded-md mly-px-2 mly-py-1 mly-text-left mly-text-sm mly-text-gray-900 hover:mly-bg-gray-100 hover:mly-text-gray-900",
7840
+ isActive ? "mly-bg-gray-100 mly-text-gray-900" : "mly-bg-transparent"
7841
+ ),
7842
+ onClick: () => selectItem(groupIndex, commandIndex),
7843
+ onMouseEnter: () => setIsHovered(true),
7844
+ onMouseLeave: () => setIsHovered(false),
7845
+ type: "button",
7846
+ ref: isActive ? activeCommandRef : null,
7847
+ children: value
7848
+ }
7849
+ ) }),
7850
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7851
+ TooltipContent,
7852
+ {
7853
+ side: "right",
7854
+ sideOffset: 10,
7855
+ className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
7856
+ children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
7857
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("figure", { className: "mly-relative mly-aspect-[2.5] mly-w-full mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7858
+ "img",
7859
+ {
7860
+ src: item == null ? void 0 : item.preview,
7861
+ alt: item == null ? void 0 : item.title,
7862
+ className: "mly-absolute mly-inset-0 mly-h-full mly-w-full mly-object-cover"
7863
+ }
7864
+ ) }),
7865
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly-mt-2 mly-px-0.5 mly-text-gray-500", children: item.description })
7866
+ ] })
7867
+ }
7868
+ )
7869
+ ] }, `${groupIndex}-${commandIndex}`);
7870
+ }
7871
+
7872
+ // src/editor/extensions/slash-command/slash-command-view.tsx
7873
+ var import_jsx_runtime54 = require("react/jsx-runtime");
7874
+ var CommandList = (0, import_react57.forwardRef)(function CommandList2(props, ref) {
7875
+ const { items: groups, command, editor, range, query } = props;
7876
+ const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react57.useState)(0);
7877
+ const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react57.useState)(0);
7878
+ const prevQuery = (0, import_react57.useRef)("");
7879
+ const prevSelectedGroupIndex = (0, import_react57.useRef)(0);
7880
+ const prevSelectedCommandIndex = (0, import_react57.useRef)(0);
7881
+ const selectItem = (0, import_react57.useCallback)(
7645
7882
  (groupIndex, commandIndex) => {
7646
7883
  const item = groups[groupIndex].commands[commandIndex];
7647
7884
  if (!item) {
@@ -7651,71 +7888,104 @@ var CommandList = (0, import_react56.forwardRef)(function CommandList2(props, re
7651
7888
  },
7652
7889
  [command]
7653
7890
  );
7654
- (0, import_react56.useImperativeHandle)(ref, () => ({
7891
+ (0, import_react57.useImperativeHandle)(ref, () => ({
7655
7892
  onKeyDown: ({ event }) => {
7656
- var _a, _b;
7657
- const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
7893
+ var _a, _b, _c, _d;
7894
+ const navigationKeys = [
7895
+ "ArrowUp",
7896
+ "ArrowDown",
7897
+ "Enter",
7898
+ "ArrowLeft",
7899
+ "ArrowRight"
7900
+ ];
7658
7901
  if (navigationKeys.includes(event.key)) {
7659
- if (event.key === "ArrowUp") {
7660
- if (!groups.length) {
7661
- return false;
7662
- }
7663
- let newCommandIndex = selectedCommandIndex - 1;
7664
- let newGroupIndex = selectedGroupIndex;
7665
- if (newCommandIndex < 0) {
7666
- newGroupIndex = selectedGroupIndex - 1;
7667
- newCommandIndex = ((_a = groups[newGroupIndex]) == null ? void 0 : _a.commands.length) - 1 || 0;
7668
- }
7669
- if (newGroupIndex < 0) {
7670
- newGroupIndex = groups.length - 1;
7671
- newCommandIndex = ((_b = groups[newGroupIndex]) == null ? void 0 : _b.commands.length) - 1 || 0;
7672
- }
7673
- setSelectedGroupIndex(newGroupIndex);
7674
- setSelectedCommandIndex(newCommandIndex);
7675
- return true;
7676
- }
7677
- if (event.key === "ArrowDown") {
7678
- if (!groups.length) {
7679
- return false;
7680
- }
7681
- const commands = groups[selectedGroupIndex].commands;
7682
- let newCommandIndex = selectedCommandIndex + 1;
7683
- let newGroupIndex = selectedGroupIndex;
7684
- if (commands.length - 1 < newCommandIndex) {
7685
- newCommandIndex = 0;
7686
- newGroupIndex = selectedGroupIndex + 1;
7687
- }
7688
- if (groups.length - 1 < newGroupIndex) {
7689
- newGroupIndex = 0;
7690
- }
7691
- setSelectedGroupIndex(newGroupIndex);
7692
- setSelectedCommandIndex(newCommandIndex);
7693
- return true;
7694
- }
7695
- if (event.key === "Enter") {
7696
- if (!groups.length) {
7902
+ let newCommandIndex = selectedCommandIndex;
7903
+ let newGroupIndex = selectedGroupIndex;
7904
+ switch (event.key) {
7905
+ case "ArrowLeft":
7906
+ event.preventDefault();
7907
+ const group = groups == null ? void 0 : groups[selectedGroupIndex];
7908
+ const isInsideSubCommand = group && "id" in group;
7909
+ if (!isInsideSubCommand) {
7910
+ return false;
7911
+ }
7912
+ editor.chain().focus().insertContentAt(range, `/${prevQuery.current}`).run();
7913
+ setTimeout(() => {
7914
+ setSelectedGroupIndex(prevSelectedGroupIndex.current);
7915
+ setSelectedCommandIndex(prevSelectedCommandIndex.current);
7916
+ }, 0);
7917
+ return true;
7918
+ case "ArrowRight":
7919
+ event.preventDefault();
7920
+ const command2 = (_b = (_a = groups == null ? void 0 : groups[selectedGroupIndex]) == null ? void 0 : _a.commands) == null ? void 0 : _b[selectedCommandIndex];
7921
+ const isSelectingSubCommand = command2 && "commands" in command2;
7922
+ if (!isSelectingSubCommand) {
7923
+ return false;
7924
+ }
7925
+ selectItem(selectedGroupIndex, selectedCommandIndex);
7926
+ prevQuery.current = query;
7927
+ prevSelectedGroupIndex.current = selectedGroupIndex;
7928
+ prevSelectedCommandIndex.current = selectedCommandIndex;
7929
+ return true;
7930
+ case "Enter":
7931
+ if (!groups.length) {
7932
+ return false;
7933
+ }
7934
+ selectItem(selectedGroupIndex, selectedCommandIndex);
7935
+ prevQuery.current = query;
7936
+ prevSelectedGroupIndex.current = selectedGroupIndex;
7937
+ prevSelectedCommandIndex.current = selectedCommandIndex;
7938
+ return true;
7939
+ case "ArrowUp":
7940
+ if (!groups.length) {
7941
+ return false;
7942
+ }
7943
+ newCommandIndex = selectedCommandIndex - 1;
7944
+ newGroupIndex = selectedGroupIndex;
7945
+ if (newCommandIndex < 0) {
7946
+ newGroupIndex = selectedGroupIndex - 1;
7947
+ newCommandIndex = ((_c = groups[newGroupIndex]) == null ? void 0 : _c.commands.length) - 1 || 0;
7948
+ }
7949
+ if (newGroupIndex < 0) {
7950
+ newGroupIndex = groups.length - 1;
7951
+ newCommandIndex = ((_d = groups[newGroupIndex]) == null ? void 0 : _d.commands.length) - 1 || 0;
7952
+ }
7953
+ setSelectedGroupIndex(newGroupIndex);
7954
+ setSelectedCommandIndex(newCommandIndex);
7955
+ return true;
7956
+ case "ArrowDown":
7957
+ if (!groups.length) {
7958
+ return false;
7959
+ }
7960
+ const commands = groups[selectedGroupIndex].commands;
7961
+ newCommandIndex = selectedCommandIndex + 1;
7962
+ newGroupIndex = selectedGroupIndex;
7963
+ if (commands.length - 1 < newCommandIndex) {
7964
+ newCommandIndex = 0;
7965
+ newGroupIndex = selectedGroupIndex + 1;
7966
+ }
7967
+ if (groups.length - 1 < newGroupIndex) {
7968
+ newGroupIndex = 0;
7969
+ }
7970
+ setSelectedGroupIndex(newGroupIndex);
7971
+ setSelectedCommandIndex(newCommandIndex);
7972
+ return true;
7973
+ default:
7697
7974
  return false;
7698
- }
7699
- selectItem(selectedGroupIndex, selectedCommandIndex);
7700
- return true;
7701
7975
  }
7702
- return false;
7703
7976
  }
7704
7977
  }
7705
7978
  }));
7706
- (0, import_react56.useEffect)(() => {
7707
- setSelectedGroupIndex(0);
7708
- setSelectedCommandIndex(0);
7709
- }, [groups]);
7710
- const commandListContainer = (0, import_react56.useRef)(null);
7711
- const activeCommandRef = (0, import_react56.useRef)(null);
7712
- (0, import_react56.useLayoutEffect)(() => {
7979
+ const commandListContainer = (0, import_react57.useRef)(null);
7980
+ const activeCommandRef = (0, import_react57.useRef)(null);
7981
+ (0, import_react57.useLayoutEffect)(() => {
7713
7982
  const container = commandListContainer == null ? void 0 : commandListContainer.current;
7714
7983
  const activeCommandContainer = activeCommandRef == null ? void 0 : activeCommandRef.current;
7715
7984
  if (!container || !activeCommandContainer) {
7716
7985
  return;
7717
7986
  }
7718
7987
  const { offsetTop, offsetHeight } = activeCommandContainer;
7988
+ container.style.transition = "none";
7719
7989
  container.scrollTop = offsetTop - offsetHeight;
7720
7990
  }, [
7721
7991
  selectedGroupIndex,
@@ -7723,15 +7993,26 @@ var CommandList = (0, import_react56.forwardRef)(function CommandList2(props, re
7723
7993
  commandListContainer,
7724
7994
  activeCommandRef
7725
7995
  ]);
7726
- return groups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "mly-z-50 mly-w-72 mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200 mly-bg-white mly-shadow-md mly-transition-all", children: [
7727
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7996
+ (0, import_react57.useEffect)(() => {
7997
+ setSelectedGroupIndex(0);
7998
+ setSelectedCommandIndex(0);
7999
+ }, [groups]);
8000
+ (0, import_react57.useEffect)(() => {
8001
+ return () => {
8002
+ prevQuery.current = "";
8003
+ prevSelectedGroupIndex.current = 0;
8004
+ prevSelectedCommandIndex.current = 0;
8005
+ };
8006
+ }, []);
8007
+ return groups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mly-z-50 mly-w-72 mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200 mly-bg-white mly-shadow-md mly-transition-all", children: [
8008
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
7728
8009
  "div",
7729
8010
  {
7730
8011
  id: "slash-command",
7731
8012
  ref: commandListContainer,
7732
- className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto mly-scroll-smooth",
7733
- children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react56.Fragment, { children: [
7734
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
8013
+ className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto",
8014
+ children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react57.Fragment, { children: [
8015
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
7735
8016
  "span",
7736
8017
  {
7737
8018
  className: cn(
@@ -7741,72 +8022,35 @@ var CommandList = (0, import_react56.forwardRef)(function CommandList2(props, re
7741
8022
  children: group.title
7742
8023
  }
7743
8024
  ),
7744
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mly-space-y-0.5 mly-p-1", children: group.commands.map((item, commandIndex) => {
7745
- var _a;
7746
- const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
7747
- const isSubCommand = "commands" in item;
7748
- const hasRenderFunction = typeof item.render === "function";
7749
- const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
7750
- let value = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
7751
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
7752
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "mly-grow", children: [
7753
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly-font-medium", children: item.title }),
7754
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly-text-xs mly-text-gray-400", children: item.description })
7755
- ] }),
7756
- isSubCommand && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "mly-block mly-px-1 mly-text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react28.ChevronRightIcon, { className: "mly-size-3.5 mly-stroke-[2.5]" }) })
7757
- ] });
7758
- if (renderFunctionValue !== null && renderFunctionValue !== true) {
7759
- value = renderFunctionValue;
7760
- }
7761
- const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && isActive;
7762
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Tooltip, { open: shouldOpenTooltip, children: [
7763
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7764
- "button",
7765
- {
7766
- className: cn(
7767
- "mly-flex mly-w-full mly-items-center mly-gap-2 mly-rounded-md mly-px-2 mly-py-1 mly-text-left mly-text-sm mly-text-gray-900 hover:mly-bg-gray-100 hover:mly-text-gray-900",
7768
- isActive ? "mly-bg-gray-100 mly-text-gray-900" : "mly-bg-transparent"
7769
- ),
7770
- onClick: () => selectItem(groupIndex, commandIndex),
7771
- type: "button",
7772
- ref: isActive ? activeCommandRef : null,
7773
- children: value
7774
- }
7775
- ) }),
7776
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7777
- TooltipContent,
7778
- {
7779
- side: "right",
7780
- sideOffset: 10,
7781
- className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
7782
- children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
7783
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("figure", { className: "mly-relative mly-aspect-[2.5] mly-w-full mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
7784
- "img",
7785
- {
7786
- src: item == null ? void 0 : item.preview,
7787
- alt: item == null ? void 0 : item.title,
7788
- className: "mly-absolute mly-inset-0 mly-h-full mly-w-full mly-object-cover"
7789
- }
7790
- ) }),
7791
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "mly-mt-2 mly-px-0.5 mly-text-gray-500", children: item.description })
7792
- ] })
7793
- }
7794
- )
7795
- ] }, commandIndex);
8025
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mly-space-y-0.5 mly-p-1", children: group.commands.map((item, commandIndex) => {
8026
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
8027
+ SlashCommandItem,
8028
+ {
8029
+ item,
8030
+ groupIndex,
8031
+ commandIndex,
8032
+ selectedGroupIndex,
8033
+ selectedCommandIndex,
8034
+ selectItem: () => selectItem(groupIndex, commandIndex),
8035
+ editor,
8036
+ activeCommandRef
8037
+ },
8038
+ commandIndex
8039
+ );
7796
8040
  }) })
7797
8041
  ] }, groupIndex))
7798
8042
  }
7799
8043
  ),
7800
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mly-border-t mly-border-gray-200 mly-px-1 mly-py-3 mly-pl-4", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "mly-flex mly-items-center", children: [
7801
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
7802
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2191" }),
7803
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("kbd", { className: "mly-ml-1 mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2193" }),
8044
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mly-border-t mly-border-gray-200 mly-px-1 mly-py-3 mly-pl-4", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "mly-flex mly-items-center", children: [
8045
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
8046
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2191" }),
8047
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "mly-ml-1 mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2193" }),
7804
8048
  " ",
7805
8049
  "to navigate"
7806
8050
  ] }),
7807
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { "aria-hidden": "true", className: "mly-select-none mly-px-1", children: "\xB7" }),
7808
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
7809
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-1.5 mly-font-medium", children: "Enter" }),
8051
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": "true", className: "mly-select-none mly-px-1", children: "\xB7" }),
8052
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
8053
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-1.5 mly-font-medium", children: "Enter" }),
7810
8054
  " ",
7811
8055
  "to select"
7812
8056
  ] })
@@ -7895,7 +8139,7 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
7895
8139
  let popup = null;
7896
8140
  return {
7897
8141
  onStart: (props) => {
7898
- component = new import_react55.ReactRenderer(CommandList, {
8142
+ component = new import_react56.ReactRenderer(CommandList, {
7899
8143
  props,
7900
8144
  editor: props.editor
7901
8145
  });
@@ -7909,24 +8153,36 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
7909
8153
  });
7910
8154
  },
7911
8155
  onUpdate: (props) => {
8156
+ var _a;
8157
+ const currentPopup = popup == null ? void 0 : popup[0];
8158
+ if (!currentPopup || ((_a = currentPopup == null ? void 0 : currentPopup.state) == null ? void 0 : _a.isDestroyed)) {
8159
+ return;
8160
+ }
7912
8161
  component == null ? void 0 : component.updateProps(props);
7913
- popup && popup[0].setProps({
8162
+ currentPopup.setProps({
7914
8163
  getReferenceClientRect: props.clientRect
7915
8164
  });
7916
8165
  },
7917
8166
  onKeyDown: (props) => {
7918
- var _a;
8167
+ var _a, _b;
7919
8168
  if (props.event.key === "Escape") {
7920
- popup == null ? void 0 : popup[0].hide();
8169
+ const currentPopup = popup == null ? void 0 : popup[0];
8170
+ if (!((_a = currentPopup == null ? void 0 : currentPopup.state) == null ? void 0 : _a.isDestroyed)) {
8171
+ currentPopup == null ? void 0 : currentPopup.destroy();
8172
+ }
8173
+ component == null ? void 0 : component.destroy();
7921
8174
  return true;
7922
8175
  }
7923
- return (_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props);
8176
+ return (_b = component == null ? void 0 : component.ref) == null ? void 0 : _b.onKeyDown(props);
7924
8177
  },
7925
8178
  onExit: () => {
7926
8179
  if (!popup || !(popup == null ? void 0 : popup[0]) || !component) {
7927
8180
  return;
7928
8181
  }
7929
- popup == null ? void 0 : popup[0].destroy();
8182
+ const currentPopup = popup == null ? void 0 : popup[0];
8183
+ if (!currentPopup.state.isDestroyed) {
8184
+ currentPopup.destroy();
8185
+ }
7930
8186
  component == null ? void 0 : component.destroy();
7931
8187
  }
7932
8188
  };
@@ -7935,16 +8191,16 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
7935
8191
  }
7936
8192
 
7937
8193
  // src/editor/nodes/variable/variable-suggestions.tsx
7938
- var import_react57 = require("@tiptap/react");
7939
- var import_react58 = require("react");
7940
- var import_tippy9 = __toESM(require("tippy.js"));
7941
- var import_jsx_runtime54 = require("react/jsx-runtime");
7942
- var VariableList = (0, import_react58.forwardRef)((props, ref) => {
8194
+ var import_react58 = require("@tiptap/react");
8195
+ var import_react59 = require("react");
8196
+ var import_tippy9 = __toESM(require("tippy.js"), 1);
8197
+ var import_jsx_runtime55 = require("react/jsx-runtime");
8198
+ var VariableList = (0, import_react59.forwardRef)((props, ref) => {
7943
8199
  var _a;
7944
8200
  const { items = [], editor } = props;
7945
- const popoverRef = (0, import_react58.useRef)(null);
8201
+ const popoverRef = (0, import_react59.useRef)(null);
7946
8202
  const VariableSuggestionPopoverComponent = (_a = useVariableOptions(editor)) == null ? void 0 : _a.variableSuggestionsPopover;
7947
- (0, import_react58.useImperativeHandle)(ref, () => ({
8203
+ (0, import_react59.useImperativeHandle)(ref, () => ({
7948
8204
  onKeyDown: ({ event }) => {
7949
8205
  if (!popoverRef.current) {
7950
8206
  return false;
@@ -7967,7 +8223,7 @@ var VariableList = (0, import_react58.forwardRef)((props, ref) => {
7967
8223
  return false;
7968
8224
  }
7969
8225
  }));
7970
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
8226
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
7971
8227
  VariableSuggestionPopoverComponent,
7972
8228
  {
7973
8229
  items,
@@ -8000,7 +8256,7 @@ function getVariableSuggestions(char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
8000
8256
  let popup = null;
8001
8257
  return {
8002
8258
  onStart: (props) => {
8003
- component = new import_react57.ReactRenderer(VariableList, {
8259
+ component = new import_react58.ReactRenderer(VariableList, {
8004
8260
  props,
8005
8261
  editor: props.editor
8006
8262
  });
@@ -8074,7 +8330,7 @@ var HTMLCodeBlockExtension = import_extension_code_block_lowlight.default.extend
8074
8330
  });
8075
8331
  },
8076
8332
  addNodeView() {
8077
- return (0, import_react59.ReactNodeViewRenderer)(HTMLCodeBlockView, {
8333
+ return (0, import_react60.ReactNodeViewRenderer)(HTMLCodeBlockView, {
8078
8334
  className: "mly-relative",
8079
8335
  attrs: ({ node }) => {
8080
8336
  var _a;
@@ -8149,17 +8405,17 @@ var isCustomNodeSelected = (editor, node) => {
8149
8405
  };
8150
8406
 
8151
8407
  // src/editor/components/text-menu/text-bubble-menu.tsx
8152
- var import_react63 = require("@tiptap/react");
8408
+ var import_react64 = require("@tiptap/react");
8153
8409
 
8154
8410
  // src/editor/components/text-menu/text-bubble-content.tsx
8155
8411
  var import_lucide_react29 = require("lucide-react");
8156
8412
 
8157
8413
  // src/editor/components/text-menu/use-text-menu-state.tsx
8158
- var import_react60 = require("@tiptap/react");
8159
- var import_fast_deep_equal8 = __toESM(require("fast-deep-equal"));
8414
+ var import_react61 = require("@tiptap/react");
8415
+ var import_fast_deep_equal8 = __toESM(require("fast-deep-equal"), 1);
8160
8416
  var DEFAULT_TEXT_COLOR = "#374151";
8161
8417
  var useTextMenuState = (editor) => {
8162
- const states = (0, import_react60.useEditorState)({
8418
+ const states = (0, import_react61.useEditorState)({
8163
8419
  editor,
8164
8420
  selector: (ctx) => {
8165
8421
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -8181,7 +8437,7 @@ var useTextMenuState = (editor) => {
8181
8437
  };
8182
8438
 
8183
8439
  // src/editor/components/text-menu/text-bubble-content.tsx
8184
- var import_jsx_runtime55 = require("react/jsx-runtime");
8440
+ var import_jsx_runtime56 = require("react/jsx-runtime");
8185
8441
  function TextBubbleContent(props) {
8186
8442
  var _a, _b, _c, _d;
8187
8443
  const { editor, showListMenu = true } = props;
@@ -8225,9 +8481,9 @@ function TextBubbleContent(props) {
8225
8481
  tooltip: "Code"
8226
8482
  }
8227
8483
  ];
8228
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
8229
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(BubbleMenuButton, __spreadValues({}, item), index)),
8230
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8484
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
8485
+ items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BubbleMenuButton, __spreadValues({}, item), index)),
8486
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8231
8487
  AlignmentSwitch,
8232
8488
  {
8233
8489
  alignment: state.textAlign,
@@ -8236,8 +8492,8 @@ function TextBubbleContent(props) {
8236
8492
  }
8237
8493
  }
8238
8494
  ),
8239
- !state.isListActive && showListMenu && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
8240
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8495
+ !state.isListActive && showListMenu && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
8496
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8241
8497
  BubbleMenuButton,
8242
8498
  {
8243
8499
  icon: import_lucide_react29.List,
@@ -8247,7 +8503,7 @@ function TextBubbleContent(props) {
8247
8503
  tooltip: "Bullet List"
8248
8504
  }
8249
8505
  ),
8250
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8506
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8251
8507
  BubbleMenuButton,
8252
8508
  {
8253
8509
  icon: import_lucide_react29.ListOrdered,
@@ -8258,13 +8514,12 @@ function TextBubbleContent(props) {
8258
8514
  }
8259
8515
  )
8260
8516
  ] }),
8261
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8517
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8262
8518
  LinkInputPopover,
8263
8519
  {
8264
8520
  defaultValue: (_d = state == null ? void 0 : state.linkUrl) != null ? _d : "",
8265
8521
  onValueChange: (value, isVariable) => {
8266
- const defaultValueWithoutProtocol = value.replace(/https?:\/\//, "");
8267
- if (!defaultValueWithoutProtocol) {
8522
+ if (!value) {
8268
8523
  editor == null ? void 0 : editor.chain().focus().extendMarkRange("link").unsetLink().unsetUnderline().run();
8269
8524
  return;
8270
8525
  }
@@ -8275,8 +8530,8 @@ function TextBubbleContent(props) {
8275
8530
  isVariable: state.isUrlVariable
8276
8531
  }
8277
8532
  ),
8278
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Divider, {}),
8279
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8533
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Divider, {}),
8534
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8280
8535
  ColorPicker,
8281
8536
  {
8282
8537
  color: state.currentTextColor,
@@ -8285,16 +8540,16 @@ function TextBubbleContent(props) {
8285
8540
  },
8286
8541
  tooltip: "Text Color",
8287
8542
  suggestedColors,
8288
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8543
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8289
8544
  BaseButton,
8290
8545
  {
8291
8546
  variant: "ghost",
8292
8547
  size: "sm",
8293
8548
  type: "button",
8294
8549
  className: "!mly-h-7 mly-w-7 mly-shrink-0 mly-p-0",
8295
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
8296
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-slate-700", children: "A" }),
8297
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
8550
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
8551
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-slate-700", children: "A" }),
8552
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8298
8553
  "div",
8299
8554
  {
8300
8555
  className: "mly-h-[2px] mly-w-3",
@@ -8311,34 +8566,34 @@ function TextBubbleContent(props) {
8311
8566
 
8312
8567
  // src/editor/components/text-menu/turn-into-block.tsx
8313
8568
  var import_lucide_react30 = require("lucide-react");
8314
- var import_react61 = require("react");
8315
- var import_jsx_runtime56 = require("react/jsx-runtime");
8569
+ var import_react62 = require("react");
8570
+ var import_jsx_runtime57 = require("react/jsx-runtime");
8316
8571
  var isOption = (option) => option.type === "option";
8317
8572
  var isCategory = (option) => option.type === "category";
8318
8573
  function TurnIntoBlock(props) {
8319
8574
  const { options } = props;
8320
- const activeItem = (0, import_react61.useMemo)(
8575
+ const activeItem = (0, import_react62.useMemo)(
8321
8576
  () => options.find((option) => option.type === "option" && option.isActive()),
8322
8577
  [options]
8323
8578
  );
8324
8579
  const { icon: ActiveIcon = import_lucide_react30.PilcrowIcon } = activeItem || {};
8325
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Popover, { children: [
8326
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Tooltip, { children: [
8327
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
8580
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Popover, { children: [
8581
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Tooltip, { children: [
8582
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
8328
8583
  PopoverTrigger,
8329
8584
  {
8330
8585
  className: cn(
8331
8586
  "mly-flex mly-aspect-square mly-h-7 mly-items-center mly-justify-center mly-gap-1 mly-rounded-md mly-px-1.5 mly-text-sm data-[state=open]:mly-bg-soft-gray hover:mly-bg-soft-gray focus-visible:mly-relative focus-visible:mly-z-10 focus-visible:mly-outline-none focus-visible:mly-ring-2 focus-visible:mly-ring-gray-400 focus-visible:mly-ring-offset-2"
8332
8587
  ),
8333
8588
  children: [
8334
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ActiveIcon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
8335
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react30.ChevronDownIcon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" })
8589
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ActiveIcon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
8590
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.ChevronDownIcon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" })
8336
8591
  ]
8337
8592
  }
8338
8593
  ) }),
8339
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TooltipContent, { sideOffset: 8, children: "Turn into" })
8594
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipContent, { sideOffset: 8, children: "Turn into" })
8340
8595
  ] }),
8341
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8596
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
8342
8597
  PopoverContent,
8343
8598
  {
8344
8599
  align: "start",
@@ -8347,21 +8602,21 @@ function TurnIntoBlock(props) {
8347
8602
  className: "mly-flex mly-w-[160px] mly-flex-col mly-rounded-md mly-p-1",
8348
8603
  children: options.map((option, index) => {
8349
8604
  if (isOption(option)) {
8350
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
8605
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
8351
8606
  BaseButton,
8352
8607
  {
8353
8608
  onClick: option.onClick,
8354
8609
  variant: "ghost",
8355
8610
  className: "mly-h-auto mly-justify-start mly-gap-2 !mly-rounded mly-px-2 mly-py-1 mly-text-sm mly-font-normal mly-text-midnight-gray",
8356
8611
  children: [
8357
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(option.icon, { className: "mly-size-[15px] mly-shrink-0" }),
8612
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(option.icon, { className: "mly-size-[15px] mly-shrink-0" }),
8358
8613
  option.label
8359
8614
  ]
8360
8615
  },
8361
8616
  option.id
8362
8617
  );
8363
8618
  } else if (isCategory(option)) {
8364
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
8619
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
8365
8620
  "label",
8366
8621
  {
8367
8622
  className: cn(
@@ -8380,10 +8635,10 @@ function TurnIntoBlock(props) {
8380
8635
  }
8381
8636
 
8382
8637
  // src/editor/components/text-menu/use-turn-into-block-options.tsx
8383
- var import_react62 = require("@tiptap/react");
8638
+ var import_react63 = require("@tiptap/react");
8384
8639
  var import_lucide_react31 = require("lucide-react");
8385
8640
  function useTurnIntoBlockOptions(editor) {
8386
- return (0, import_react62.useEditorState)({
8641
+ return (0, import_react63.useEditorState)({
8387
8642
  editor,
8388
8643
  selector: ({ editor: editor2 }) => [
8389
8644
  {
@@ -8466,7 +8721,7 @@ function useTurnIntoBlockOptions(editor) {
8466
8721
  }
8467
8722
 
8468
8723
  // src/editor/components/text-menu/text-bubble-menu.tsx
8469
- var import_jsx_runtime57 = require("react/jsx-runtime");
8724
+ var import_jsx_runtime58 = require("react/jsx-runtime");
8470
8725
  function TextBubbleMenu(props) {
8471
8726
  const { editor, appendTo } = props;
8472
8727
  if (!editor) {
@@ -8517,23 +8772,23 @@ function TextBubbleMenu(props) {
8517
8772
  }
8518
8773
  });
8519
8774
  const turnIntoBlockOptions = useTurnIntoBlockOptions(editor);
8520
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
8521
- import_react63.BubbleMenu,
8775
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
8776
+ import_react64.BubbleMenu,
8522
8777
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
8523
8778
  className: "mly-flex mly-gap-0.5 mly-rounded-lg mly-border mly-border-gray-200 mly-bg-white mly-p-0.5 mly-shadow-md",
8524
- children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(TooltipProvider, { children: [
8525
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TurnIntoBlock, { options: turnIntoBlockOptions }),
8526
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Divider, { className: "mly-mx-0" }),
8527
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TextBubbleContent, { editor })
8779
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(TooltipProvider, { children: [
8780
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TurnIntoBlock, { options: turnIntoBlockOptions }),
8781
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Divider, { className: "mly-mx-0" }),
8782
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TextBubbleContent, { editor })
8528
8783
  ] })
8529
8784
  })
8530
8785
  );
8531
8786
  }
8532
8787
 
8533
8788
  // src/editor/components/variable-menu/variable-bubble-menu.tsx
8534
- var import_react64 = require("@tiptap/react");
8789
+ var import_react65 = require("@tiptap/react");
8535
8790
  var import_tippy10 = require("tippy.js");
8536
- var import_jsx_runtime58 = require("react/jsx-runtime");
8791
+ var import_jsx_runtime59 = require("react/jsx-runtime");
8537
8792
  function VariableBubbleMenu(props) {
8538
8793
  const { editor, appendTo } = props;
8539
8794
  if (!editor) {
@@ -8556,11 +8811,11 @@ function VariableBubbleMenu(props) {
8556
8811
  placement: "top-start"
8557
8812
  }
8558
8813
  });
8559
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
8560
- import_react64.BubbleMenu,
8814
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
8815
+ import_react65.BubbleMenu,
8561
8816
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
8562
8817
  className: "mly-flex mly-gap-0.5 mly-rounded-lg mly-border mly-border-slate-200 mly-bg-white mly-p-0.5 mly-shadow-md",
8563
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TextBubbleContent, { showListMenu: false, editor }) })
8818
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextBubbleContent, { showListMenu: false, editor }) })
8564
8819
  })
8565
8820
  );
8566
8821
  }
@@ -8614,7 +8869,7 @@ function replaceDeprecatedNode(json) {
8614
8869
  }
8615
8870
 
8616
8871
  // src/editor/index.tsx
8617
- var import_jsx_runtime59 = require("react/jsx-runtime");
8872
+ var import_jsx_runtime60 = require("react/jsx-runtime");
8618
8873
  function Editor13(props) {
8619
8874
  const {
8620
8875
  config: {
@@ -8635,7 +8890,7 @@ function Editor13(props) {
8635
8890
  editable = true,
8636
8891
  placeholderUrl = DEFAULT_PLACEHOLDER_URL
8637
8892
  } = props;
8638
- const formattedContent = (0, import_react66.useMemo)(() => {
8893
+ const formattedContent = (0, import_react67.useMemo)(() => {
8639
8894
  if (contentJson) {
8640
8895
  const json = (contentJson == null ? void 0 : contentJson.type) === "doc" ? contentJson : {
8641
8896
  type: "doc",
@@ -8656,8 +8911,8 @@ function Editor13(props) {
8656
8911
  };
8657
8912
  }
8658
8913
  }, [contentHtml, contentJson, replaceDeprecatedNode]);
8659
- const menuContainerRef = (0, import_react66.useRef)(null);
8660
- const editor = (0, import_react65.useEditor)({
8914
+ const menuContainerRef = (0, import_react67.useRef)(null);
8915
+ const editor = (0, import_react66.useEditor)({
8661
8916
  editorProps: {
8662
8917
  attributes: {
8663
8918
  class: cn(`mly-prose mly-w-full`, contentClassName),
@@ -8682,7 +8937,7 @@ function Editor13(props) {
8682
8937
  if (!editor) {
8683
8938
  return null;
8684
8939
  }
8685
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(MailyProvider, { placeholderUrl, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8940
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MailyProvider, { placeholderUrl, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
8686
8941
  "div",
8687
8942
  {
8688
8943
  className: cn(
@@ -8692,8 +8947,8 @@ function Editor13(props) {
8692
8947
  ),
8693
8948
  ref: menuContainerRef,
8694
8949
  children: [
8695
- hasMenuBar && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(EditorMenuBar, { config: props.config, editor }),
8696
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
8950
+ hasMenuBar && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EditorMenuBar, { config: props.config, editor }),
8951
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
8697
8952
  "div",
8698
8953
  {
8699
8954
  className: cn(
@@ -8701,17 +8956,17 @@ function Editor13(props) {
8701
8956
  bodyClassName
8702
8957
  ),
8703
8958
  children: [
8704
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextBubbleMenu, { editor, appendTo: menuContainerRef }),
8705
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ImageBubbleMenu, { editor, appendTo: menuContainerRef }),
8706
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SpacerBubbleMenu, { editor, appendTo: menuContainerRef }),
8707
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react65.EditorContent, { editor }),
8708
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
8709
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
8710
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ContentMenu, { editor }),
8711
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(VariableBubbleMenu, { editor, appendTo: menuContainerRef }),
8712
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RepeatBubbleMenu, { editor, appendTo: menuContainerRef }),
8713
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(HTMLBubbleMenu, { editor, appendTo: menuContainerRef }),
8714
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(InlineImageBubbleMenu, { editor, appendTo: menuContainerRef })
8959
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TextBubbleMenu, { editor, appendTo: menuContainerRef }),
8960
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ImageBubbleMenu, { editor, appendTo: menuContainerRef }),
8961
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SpacerBubbleMenu, { editor, appendTo: menuContainerRef }),
8962
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react66.EditorContent, { editor }),
8963
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
8964
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
8965
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ContentMenu, { editor }),
8966
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(VariableBubbleMenu, { editor, appendTo: menuContainerRef }),
8967
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RepeatBubbleMenu, { editor, appendTo: menuContainerRef }),
8968
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(HTMLBubbleMenu, { editor, appendTo: menuContainerRef }),
8969
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(InlineImageBubbleMenu, { editor, appendTo: menuContainerRef })
8715
8970
  ]
8716
8971
  }
8717
8972
  )
@@ -8723,4 +8978,4 @@ function Editor13(props) {
8723
8978
  0 && (module.exports = {
8724
8979
  Editor
8725
8980
  });
8726
- //# sourceMappingURL=index.js.map
8981
+ //# sourceMappingURL=index.cjs.map