@maily-to/core 0.3.4 → 0.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.cjs CHANGED
@@ -5648,7 +5648,8 @@ function ImageView(props) {
5648
5648
  newHeight = IMAGE_MAX_HEIGHT;
5649
5649
  }
5650
5650
  if (node.attrs.lockAspectRatio) {
5651
- newHeight = getNewHeight(newWidth, node.attrs.aspectRatio);
5651
+ const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
5652
+ newHeight = getNewHeight(newWidth, aspectRatio);
5652
5653
  }
5653
5654
  setResizingStyle({ width: newWidth, height: newHeight });
5654
5655
  if (!event2.buttons) {
@@ -5824,8 +5825,8 @@ function ImageView(props) {
5824
5825
  "data-drag-handle": editor.isEditable,
5825
5826
  className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
5826
5827
  style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
5827
- width: width ? `${width}px` : void 0,
5828
- height: height ? `${height}px` : void 0
5828
+ width: width && width !== "auto" ? `${width}px` : void 0,
5829
+ height: height && height !== "auto" ? `${height}px` : void 0
5829
5830
  }, resizingStyle) : {}), {
5830
5831
  overflow: "hidden",
5831
5832
  position: "relative",
@@ -5877,8 +5878,8 @@ function ImageView(props) {
5877
5878
  objectFit: "fill",
5878
5879
  marginBottom: 0,
5879
5880
  borderRadius: borderRadius2,
5880
- width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
5881
- height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
5881
+ width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
5882
+ height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
5882
5883
  }),
5883
5884
  draggable: editor.isEditable,
5884
5885
  className: cn(
@@ -7998,10 +7999,13 @@ function ImageBubbleMenu(props) {
7998
7999
  const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
7999
8000
  const currentHeight = Number(state.height) || 0;
8000
8001
  const currentWidth = Number(state.width) || 0;
8001
- const currentAspectRatio = state.aspectRatio || currentWidth / currentHeight || 1;
8002
+ const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
8003
+ const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
8004
+ const isHeightAuto = !state.height || state.height === "auto";
8005
+ const shouldUpdateHeight = (lockAspectRatio || isHeightAuto) && value && (hasValidAspectRatio || currentHeight > 0);
8002
8006
  editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
8003
8007
  width: String(width)
8004
- }, lockAspectRatio && value ? {
8008
+ }, shouldUpdateHeight ? {
8005
8009
  height: String(
8006
8010
  getNewHeight(width, currentAspectRatio)
8007
8011
  )
@@ -8018,10 +8022,13 @@ function ImageBubbleMenu(props) {
8018
8022
  const height = Number(value) || 0;
8019
8023
  const currentHeight = Number(state.height) || 0;
8020
8024
  const currentWidth = Number(state.width) || 0;
8021
- const currentAspectRatio = state.aspectRatio || currentWidth / currentHeight || 1;
8025
+ const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
8026
+ const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
8027
+ const isWidthAuto = !state.width || state.width === "auto";
8028
+ const shouldUpdateWidth = (lockAspectRatio || isWidthAuto) && value && (hasValidAspectRatio || currentWidth > 0);
8022
8029
  editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
8023
8030
  height: String(height)
8024
- }, lockAspectRatio && value ? {
8031
+ }, shouldUpdateWidth ? {
8025
8032
  width: String(
8026
8033
  getNewWidth(height, currentAspectRatio)
8027
8034
  )
@@ -8147,8 +8154,8 @@ var InlineImageExtension = import_core8.Node.create({
8147
8154
  renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
8148
8155
  const attrs = (0, import_core8.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes2, {
8149
8156
  "data-type": this.name,
8150
- class: "mly:inline mly:relative",
8151
- style: `--mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
8157
+ class: "mly:relative",
8158
+ style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
8152
8159
  draggable: "false",
8153
8160
  loading: "lazy"
8154
8161
  });
@@ -10373,6 +10380,59 @@ var import_extension_dropcursor = __toESM(require("@tiptap/extension-dropcursor"
10373
10380
 
10374
10381
  // src/editor/nodes/footer.ts
10375
10382
  var import_core15 = require("@tiptap/core");
10383
+
10384
+ // src/editor/nodes/paragraph/paragraph.ts
10385
+ var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
10386
+ var allowedTextDirection = ["ltr", "rtl"];
10387
+ var DEFAULT_TEXT_DIRECTION = "ltr";
10388
+ var ParagraphExtension = import_extension_paragraph.default.extend({
10389
+ addAttributes() {
10390
+ var _a;
10391
+ return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
10392
+ textDirection: {
10393
+ default: DEFAULT_TEXT_DIRECTION,
10394
+ parseHTML: (element) => {
10395
+ return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
10396
+ },
10397
+ renderHTML(attributes) {
10398
+ if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
10399
+ return {};
10400
+ }
10401
+ return {
10402
+ "data-text-direction": attributes.textDirection,
10403
+ dir: attributes.textDirection
10404
+ };
10405
+ }
10406
+ },
10407
+ showIfKey: {
10408
+ default: DEFAULT_SECTION_SHOW_IF_KEY,
10409
+ parseHTML: (element) => {
10410
+ return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
10411
+ },
10412
+ renderHTML(attributes) {
10413
+ if (!attributes.showIfKey) {
10414
+ return {};
10415
+ }
10416
+ return {
10417
+ "data-show-if-key": attributes.showIfKey
10418
+ };
10419
+ }
10420
+ }
10421
+ });
10422
+ },
10423
+ addCommands() {
10424
+ var _a;
10425
+ return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
10426
+ setTextDirection: (direction) => ({ commands }) => {
10427
+ return commands.updateAttributes(this.name, {
10428
+ textDirection: direction
10429
+ });
10430
+ }
10431
+ });
10432
+ }
10433
+ });
10434
+
10435
+ // src/editor/nodes/footer.ts
10376
10436
  var Footer = import_core15.Node.create({
10377
10437
  name: "footer",
10378
10438
  group: "block",
@@ -10387,6 +10447,21 @@ var Footer = import_core15.Node.create({
10387
10447
  };
10388
10448
  },
10389
10449
  parseHTML: (element) => element == null ? void 0 : element.getAttribute("data-maily-component")
10450
+ },
10451
+ textDirection: {
10452
+ default: DEFAULT_TEXT_DIRECTION,
10453
+ parseHTML: (element) => {
10454
+ return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
10455
+ },
10456
+ renderHTML(attributes) {
10457
+ if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
10458
+ return {};
10459
+ }
10460
+ return {
10461
+ "data-text-direction": attributes.textDirection,
10462
+ dir: attributes.textDirection
10463
+ };
10464
+ }
10390
10465
  }
10391
10466
  };
10392
10467
  },
@@ -10394,6 +10469,11 @@ var Footer = import_core15.Node.create({
10394
10469
  return {
10395
10470
  setFooter: () => ({ commands }) => {
10396
10471
  return commands.setNode(this.name);
10472
+ },
10473
+ setFooterTextDirection: (direction) => ({ commands }) => {
10474
+ return commands.updateAttributes("footer", {
10475
+ textDirection: direction
10476
+ });
10397
10477
  }
10398
10478
  };
10399
10479
  },
@@ -10438,30 +10518,21 @@ var HeadingExtension = import_extension_heading.default.extend({
10438
10518
  addAttributes() {
10439
10519
  var _a;
10440
10520
  return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
10441
- showIfKey: {
10442
- default: DEFAULT_SECTION_SHOW_IF_KEY,
10521
+ textDirection: {
10522
+ default: DEFAULT_TEXT_DIRECTION,
10443
10523
  parseHTML: (element) => {
10444
- return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
10524
+ return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
10445
10525
  },
10446
10526
  renderHTML(attributes) {
10447
- if (!attributes.showIfKey) {
10527
+ if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
10448
10528
  return {};
10449
10529
  }
10450
10530
  return {
10451
- "data-show-if-key": attributes.showIfKey
10531
+ "data-text-direction": attributes.textDirection,
10532
+ dir: attributes.textDirection
10452
10533
  };
10453
10534
  }
10454
- }
10455
- });
10456
- }
10457
- });
10458
-
10459
- // src/editor/nodes/paragraph/paragraph.ts
10460
- var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
10461
- var ParagraphExtension = import_extension_paragraph.default.extend({
10462
- addAttributes() {
10463
- var _a;
10464
- return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
10535
+ },
10465
10536
  showIfKey: {
10466
10537
  default: DEFAULT_SECTION_SHOW_IF_KEY,
10467
10538
  parseHTML: (element) => {
@@ -11424,6 +11495,124 @@ var import_react64 = require("@tiptap/react");
11424
11495
  // src/editor/components/text-menu/text-bubble-content.tsx
11425
11496
  var import_lucide_react29 = require("lucide-react");
11426
11497
 
11498
+ // src/editor/components/icons/text-direction-icon.tsx
11499
+ var import_jsx_runtime56 = require("react/jsx-runtime");
11500
+ function LtrIcon(props) {
11501
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11502
+ "svg",
11503
+ __spreadProps(__spreadValues({
11504
+ xmlns: "http://www.w3.org/2000/svg",
11505
+ width: "16",
11506
+ height: "16",
11507
+ viewBox: "0 0 24 24",
11508
+ fill: "none",
11509
+ stroke: "currentColor",
11510
+ strokeWidth: "2",
11511
+ strokeLinecap: "round",
11512
+ strokeLinejoin: "round"
11513
+ }, props), {
11514
+ children: [
11515
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M11 5h6" }),
11516
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M11 5v14" }),
11517
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M15 5v14" }),
11518
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M6 18l-3-3 3-3" }),
11519
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M3 15h5" })
11520
+ ]
11521
+ })
11522
+ );
11523
+ }
11524
+ function RtlIcon(props) {
11525
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
11526
+ "svg",
11527
+ __spreadProps(__spreadValues({
11528
+ xmlns: "http://www.w3.org/2000/svg",
11529
+ width: "16",
11530
+ height: "16",
11531
+ viewBox: "0 0 24 24",
11532
+ fill: "none",
11533
+ stroke: "currentColor",
11534
+ strokeWidth: "2",
11535
+ strokeLinecap: "round",
11536
+ strokeLinejoin: "round"
11537
+ }, props), {
11538
+ children: [
11539
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M8 5h6" }),
11540
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M10 5v14" }),
11541
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M14 5v14" }),
11542
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M18 18l3-3-3-3" }),
11543
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M16 15h5" })
11544
+ ]
11545
+ })
11546
+ );
11547
+ }
11548
+
11549
+ // src/editor/components/text-direction-switch.tsx
11550
+ var import_jsx_runtime57 = require("react/jsx-runtime");
11551
+ function TextDirectionSwitch(props) {
11552
+ const { direction: rawDirection, onDirectionChange } = props;
11553
+ const direction = allowedTextDirection.includes(
11554
+ rawDirection
11555
+ ) ? rawDirection : "ltr";
11556
+ const directions = {
11557
+ ltr: {
11558
+ icon: LtrIcon,
11559
+ tooltip: "Left to Right",
11560
+ onClick: () => {
11561
+ onDirectionChange("ltr");
11562
+ }
11563
+ },
11564
+ rtl: {
11565
+ icon: RtlIcon,
11566
+ tooltip: "Right to Left",
11567
+ onClick: () => {
11568
+ onDirectionChange("rtl");
11569
+ }
11570
+ }
11571
+ };
11572
+ const activeDirection = directions[direction];
11573
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Popover, { children: [
11574
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Tooltip, { children: [
11575
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11576
+ PopoverTrigger,
11577
+ {
11578
+ className: cn(
11579
+ "mly:flex mly:size-7 mly:items-center mly:justify-center mly:gap-1 mly:rounded-md mly:px-1.5 mly:text-sm mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"
11580
+ ),
11581
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(activeDirection.icon, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5]" })
11582
+ }
11583
+ ) }),
11584
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipContent, { sideOffset: 8, children: "Text Direction" })
11585
+ ] }),
11586
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11587
+ PopoverContent,
11588
+ {
11589
+ className: "mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",
11590
+ side: "top",
11591
+ sideOffset: 8,
11592
+ align: "center",
11593
+ onOpenAutoFocus: (e) => {
11594
+ e.preventDefault();
11595
+ },
11596
+ onCloseAutoFocus: (e) => {
11597
+ e.preventDefault();
11598
+ },
11599
+ children: Object.entries(directions).map(([key, value]) => {
11600
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11601
+ BubbleMenuButton,
11602
+ {
11603
+ icon: value.icon,
11604
+ tooltip: value.tooltip,
11605
+ command: value.onClick,
11606
+ isActive: () => key === direction
11607
+ },
11608
+ key
11609
+ );
11610
+ })
11611
+ }
11612
+ )
11613
+ ] });
11614
+ }
11615
+
11427
11616
  // src/editor/components/text-menu/use-text-menu-state.tsx
11428
11617
  var import_react61 = require("@tiptap/react");
11429
11618
  var import_fast_deep_equal8 = __toESM(require("fast-deep-equal"), 1);
@@ -11432,17 +11621,20 @@ var useTextMenuState = (editor) => {
11432
11621
  const states = (0, import_react61.useEditorState)({
11433
11622
  editor,
11434
11623
  selector: (ctx) => {
11435
- var _a, _b, _c, _d, _e, _f, _g, _h;
11624
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
11436
11625
  return {
11437
11626
  currentTextColor: ctx.editor.getAttributes("textStyle").color || DEFAULT_TEXT_COLOR,
11438
11627
  linkUrl: (_a = ctx.editor) == null ? void 0 : _a.getAttributes("link").href,
11439
11628
  textAlign: ((_b = ctx.editor) == null ? void 0 : _b.isActive({ textAlign: "left" })) ? "left" : ((_c = ctx.editor) == null ? void 0 : _c.isActive({ textAlign: "center" })) ? "center" : ((_d = ctx.editor) == null ? void 0 : _d.isActive({ textAlign: "right" })) ? "right" : ((_e = ctx.editor) == null ? void 0 : _e.isActive({ textAlign: "justify" })) ? "justify" : "left",
11629
+ textDirection: ((_f = ctx.editor.getAttributes("paragraph")) == null ? void 0 : _f.textDirection) || ((_g = ctx.editor.getAttributes("heading")) == null ? void 0 : _g.textDirection) || ((_h = ctx.editor.getAttributes("footer")) == null ? void 0 : _h.textDirection) || DEFAULT_TEXT_DIRECTION,
11630
+ isFooterActive: ctx.editor.isActive("footer"),
11631
+ footerTextDirection: ((_i = ctx.editor.getAttributes("footer")) == null ? void 0 : _i.textDirection) || DEFAULT_TEXT_DIRECTION,
11440
11632
  isListActive: ctx.editor.isActive("bulletList") || ctx.editor.isActive("orderedList"),
11441
- isUrlVariable: (_f = ctx.editor.getAttributes("link").isUrlVariable) != null ? _f : false,
11633
+ isUrlVariable: (_j = ctx.editor.getAttributes("link").isUrlVariable) != null ? _j : false,
11442
11634
  isHeadingActive: ctx.editor.isActive("heading"),
11443
- headingShowIfKey: ((_g = ctx.editor.getAttributes("heading")) == null ? void 0 : _g.showIfKey) || "",
11635
+ headingShowIfKey: ((_k = ctx.editor.getAttributes("heading")) == null ? void 0 : _k.showIfKey) || "",
11444
11636
  isParagraphActive: ctx.editor.isActive("paragraph"),
11445
- paragraphShowIfKey: ((_h = ctx.editor.getAttributes("paragraph")) == null ? void 0 : _h.showIfKey) || ""
11637
+ paragraphShowIfKey: ((_l = ctx.editor.getAttributes("paragraph")) == null ? void 0 : _l.showIfKey) || ""
11446
11638
  };
11447
11639
  },
11448
11640
  equalityFn: import_fast_deep_equal8.default
@@ -11451,7 +11643,7 @@ var useTextMenuState = (editor) => {
11451
11643
  };
11452
11644
 
11453
11645
  // src/editor/components/text-menu/text-bubble-content.tsx
11454
- var import_jsx_runtime56 = require("react/jsx-runtime");
11646
+ var import_jsx_runtime58 = require("react/jsx-runtime");
11455
11647
  function TextBubbleContent(props) {
11456
11648
  var _a, _b, _c, _d;
11457
11649
  const { editor, showListMenu = true } = props;
@@ -11495,9 +11687,9 @@ function TextBubbleContent(props) {
11495
11687
  tooltip: "Code"
11496
11688
  }
11497
11689
  ];
11498
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
11499
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BubbleMenuButton, __spreadValues({}, item), index)),
11500
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11690
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
11691
+ items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(BubbleMenuButton, __spreadValues({}, item), index)),
11692
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11501
11693
  AlignmentSwitch,
11502
11694
  {
11503
11695
  alignment: state.textAlign,
@@ -11506,8 +11698,23 @@ function TextBubbleContent(props) {
11506
11698
  }
11507
11699
  }
11508
11700
  ),
11509
- !state.isListActive && showListMenu && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
11510
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11701
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11702
+ TextDirectionSwitch,
11703
+ {
11704
+ direction: state.textDirection,
11705
+ onDirectionChange: (direction) => {
11706
+ if (state.isFooterActive) {
11707
+ editor == null ? void 0 : editor.chain().focus().setFooterTextDirection(direction).run();
11708
+ } else if (state.isHeadingActive) {
11709
+ editor == null ? void 0 : editor.chain().focus().updateAttributes("heading", { textDirection: direction }).run();
11710
+ } else {
11711
+ editor == null ? void 0 : editor.chain().focus().setTextDirection(direction).run();
11712
+ }
11713
+ }
11714
+ }
11715
+ ),
11716
+ !state.isListActive && showListMenu && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
11717
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11511
11718
  BubbleMenuButton,
11512
11719
  {
11513
11720
  icon: import_lucide_react29.List,
@@ -11517,7 +11724,7 @@ function TextBubbleContent(props) {
11517
11724
  tooltip: "Bullet List"
11518
11725
  }
11519
11726
  ),
11520
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11727
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11521
11728
  BubbleMenuButton,
11522
11729
  {
11523
11730
  icon: import_lucide_react29.ListOrdered,
@@ -11528,7 +11735,7 @@ function TextBubbleContent(props) {
11528
11735
  }
11529
11736
  )
11530
11737
  ] }),
11531
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11738
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11532
11739
  LinkInputPopover,
11533
11740
  {
11534
11741
  defaultValue: (_d = state == null ? void 0 : state.linkUrl) != null ? _d : "",
@@ -11544,8 +11751,8 @@ function TextBubbleContent(props) {
11544
11751
  isVariable: state.isUrlVariable
11545
11752
  }
11546
11753
  ),
11547
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Divider, {}),
11548
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11754
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Divider, {}),
11755
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11549
11756
  ColorPicker,
11550
11757
  {
11551
11758
  color: state.currentTextColor,
@@ -11554,16 +11761,16 @@ function TextBubbleContent(props) {
11554
11761
  },
11555
11762
  tooltip: "Text Color",
11556
11763
  suggestedColors,
11557
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11764
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11558
11765
  BaseButton,
11559
11766
  {
11560
11767
  variant: "ghost",
11561
11768
  size: "sm",
11562
11769
  type: "button",
11563
11770
  className: "mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",
11564
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px", children: [
11565
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mly:font-bolder mly:font-mono mly:text-xs mly:text-slate-700", children: "A" }),
11566
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
11771
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px", children: [
11772
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "mly:font-bolder mly:font-mono mly:text-xs mly:text-slate-700", children: "A" }),
11773
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11567
11774
  "div",
11568
11775
  {
11569
11776
  className: "mly:h-[2px] mly:w-3",
@@ -11581,7 +11788,7 @@ function TextBubbleContent(props) {
11581
11788
  // src/editor/components/text-menu/turn-into-block.tsx
11582
11789
  var import_lucide_react30 = require("lucide-react");
11583
11790
  var import_react62 = require("react");
11584
- var import_jsx_runtime57 = require("react/jsx-runtime");
11791
+ var import_jsx_runtime59 = require("react/jsx-runtime");
11585
11792
  var isOption = (option) => option.type === "option";
11586
11793
  var isCategory = (option) => option.type === "category";
11587
11794
  function TurnIntoBlock(props) {
@@ -11591,23 +11798,23 @@ function TurnIntoBlock(props) {
11591
11798
  [options]
11592
11799
  );
11593
11800
  const { icon: ActiveIcon = import_lucide_react30.PilcrowIcon } = activeItem || {};
11594
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Popover, { children: [
11595
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Tooltip, { children: [
11596
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11801
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Popover, { children: [
11802
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Tooltip, { children: [
11803
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
11597
11804
  PopoverTrigger,
11598
11805
  {
11599
11806
  className: cn(
11600
11807
  "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 mly:data-[state=open]:bg-soft-gray mly:hover:bg-soft-gray mly:focus-visible:relative mly:focus-visible:z-10 mly:focus-visible:outline-hidden mly:focus-visible:ring-2 mly:focus-visible:ring-gray-400 mly:focus-visible:ring-offset-2"
11601
11808
  ),
11602
11809
  children: [
11603
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ActiveIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
11604
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.ChevronDownIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" })
11810
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActiveIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
11811
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_lucide_react30.ChevronDownIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" })
11605
11812
  ]
11606
11813
  }
11607
11814
  ) }),
11608
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TooltipContent, { sideOffset: 8, children: "Turn into" })
11815
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipContent, { sideOffset: 8, children: "Turn into" })
11609
11816
  ] }),
11610
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11817
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11611
11818
  PopoverContent,
11612
11819
  {
11613
11820
  align: "start",
@@ -11616,21 +11823,21 @@ function TurnIntoBlock(props) {
11616
11823
  className: "mly:flex mly:w-[160px] mly:flex-col mly:rounded-md mly:p-1",
11617
11824
  children: options.map((option, index) => {
11618
11825
  if (isOption(option)) {
11619
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
11826
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
11620
11827
  BaseButton,
11621
11828
  {
11622
11829
  onClick: option.onClick,
11623
11830
  variant: "ghost",
11624
11831
  className: "mly:mb-0.5 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",
11625
11832
  children: [
11626
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(option.icon, { className: "mly:size-[15px] mly:shrink-0" }),
11833
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(option.icon, { className: "mly:size-[15px] mly:shrink-0" }),
11627
11834
  option.label
11628
11835
  ]
11629
11836
  },
11630
11837
  option.id
11631
11838
  );
11632
11839
  } else if (isCategory(option)) {
11633
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
11840
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
11634
11841
  "label",
11635
11842
  {
11636
11843
  className: cn(
@@ -11735,7 +11942,7 @@ function useTurnIntoBlockOptions(editor) {
11735
11942
  }
11736
11943
 
11737
11944
  // src/editor/components/text-menu/text-bubble-menu.tsx
11738
- var import_jsx_runtime58 = require("react/jsx-runtime");
11945
+ var import_jsx_runtime60 = require("react/jsx-runtime");
11739
11946
  function TextBubbleMenu(props) {
11740
11947
  const { editor, appendTo } = props;
11741
11948
  if (!editor) {
@@ -11786,14 +11993,14 @@ function TextBubbleMenu(props) {
11786
11993
  }
11787
11994
  });
11788
11995
  const turnIntoBlockOptions = useTurnIntoBlockOptions(editor);
11789
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
11996
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
11790
11997
  import_react64.BubbleMenu,
11791
11998
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
11792
11999
  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",
11793
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(TooltipProvider, { children: [
11794
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TurnIntoBlock, { options: turnIntoBlockOptions }),
11795
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Divider, { className: "mly:mx-0" }),
11796
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TextBubbleContent, { editor })
12000
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(TooltipProvider, { children: [
12001
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TurnIntoBlock, { options: turnIntoBlockOptions }),
12002
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Divider, { className: "mly:mx-0" }),
12003
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TextBubbleContent, { editor })
11797
12004
  ] })
11798
12005
  })
11799
12006
  );
@@ -11802,7 +12009,7 @@ function TextBubbleMenu(props) {
11802
12009
  // src/editor/components/variable-menu/variable-bubble-menu.tsx
11803
12010
  var import_react65 = require("@tiptap/react");
11804
12011
  var import_tippy10 = require("tippy.js");
11805
- var import_jsx_runtime59 = require("react/jsx-runtime");
12012
+ var import_jsx_runtime61 = require("react/jsx-runtime");
11806
12013
  function VariableBubbleMenu(props) {
11807
12014
  const { editor, appendTo } = props;
11808
12015
  if (!editor) {
@@ -11825,11 +12032,11 @@ function VariableBubbleMenu(props) {
11825
12032
  placement: "top-start"
11826
12033
  }
11827
12034
  });
11828
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
12035
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
11829
12036
  import_react65.BubbleMenu,
11830
12037
  __spreadProps(__spreadValues({}, bubbleMenuProps), {
11831
12038
  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",
11832
- children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextBubbleContent, { showListMenu: false, editor }) })
12039
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TextBubbleContent, { showListMenu: false, editor }) })
11833
12040
  })
11834
12041
  );
11835
12042
  }
@@ -11915,7 +12122,7 @@ function replaceDeprecatedNode(json) {
11915
12122
  }
11916
12123
 
11917
12124
  // src/editor/index.tsx
11918
- var import_jsx_runtime60 = require("react/jsx-runtime");
12125
+ var import_jsx_runtime62 = require("react/jsx-runtime");
11919
12126
  function Editor13(props) {
11920
12127
  const {
11921
12128
  config: {
@@ -11988,7 +12195,7 @@ function Editor13(props) {
11988
12195
  if (!editor) {
11989
12196
  return null;
11990
12197
  }
11991
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MailyProvider, { placeholderUrl, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12198
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(MailyProvider, { placeholderUrl, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
11992
12199
  "div",
11993
12200
  {
11994
12201
  id: "mly-editor",
@@ -11999,8 +12206,8 @@ function Editor13(props) {
11999
12206
  ),
12000
12207
  ref: menuContainerRef,
12001
12208
  children: [
12002
- hasMenuBar && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EditorMenuBar, { config: props.config, editor }),
12003
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
12209
+ hasMenuBar && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(EditorMenuBar, { config: props.config, editor }),
12210
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
12004
12211
  "div",
12005
12212
  {
12006
12213
  className: cn(
@@ -12008,17 +12215,17 @@ function Editor13(props) {
12008
12215
  bodyClassName
12009
12216
  ),
12010
12217
  children: [
12011
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TextBubbleMenu, { editor, appendTo: menuContainerRef }),
12012
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ImageBubbleMenu, { editor, appendTo: menuContainerRef }),
12013
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SpacerBubbleMenu, { editor, appendTo: menuContainerRef }),
12014
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react66.EditorContent, { editor }),
12015
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
12016
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
12017
- !hideContextMenu && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ContentMenu, { editor }),
12018
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(VariableBubbleMenu, { editor, appendTo: menuContainerRef }),
12019
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RepeatBubbleMenu, { editor, appendTo: menuContainerRef }),
12020
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(HTMLBubbleMenu, { editor, appendTo: menuContainerRef }),
12021
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(InlineImageBubbleMenu, { editor, appendTo: menuContainerRef })
12218
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TextBubbleMenu, { editor, appendTo: menuContainerRef }),
12219
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ImageBubbleMenu, { editor, appendTo: menuContainerRef }),
12220
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SpacerBubbleMenu, { editor, appendTo: menuContainerRef }),
12221
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react66.EditorContent, { editor }),
12222
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
12223
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
12224
+ !hideContextMenu && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ContentMenu, { editor }),
12225
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(VariableBubbleMenu, { editor, appendTo: menuContainerRef }),
12226
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RepeatBubbleMenu, { editor, appendTo: menuContainerRef }),
12227
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HTMLBubbleMenu, { editor, appendTo: menuContainerRef }),
12228
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(InlineImageBubbleMenu, { editor, appendTo: menuContainerRef })
12022
12229
  ]
12023
12230
  }
12024
12231
  )