@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/extensions/index.cjs +128 -64
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +11 -0
- package/dist/extensions/index.d.ts +11 -0
- package/dist/extensions/index.mjs +128 -64
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +287 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +287 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -21
package/dist/index.mjs
CHANGED
|
@@ -5643,7 +5643,8 @@ function ImageView(props) {
|
|
|
5643
5643
|
newHeight = IMAGE_MAX_HEIGHT;
|
|
5644
5644
|
}
|
|
5645
5645
|
if (node.attrs.lockAspectRatio) {
|
|
5646
|
-
|
|
5646
|
+
const aspectRatio = node.attrs.aspectRatio && isFinite(node.attrs.aspectRatio) && node.attrs.aspectRatio > 0 ? node.attrs.aspectRatio : currentWidth / currentHeight;
|
|
5647
|
+
newHeight = getNewHeight(newWidth, aspectRatio);
|
|
5647
5648
|
}
|
|
5648
5649
|
setResizingStyle({ width: newWidth, height: newHeight });
|
|
5649
5650
|
if (!event2.buttons) {
|
|
@@ -5819,8 +5820,8 @@ function ImageView(props) {
|
|
|
5819
5820
|
"data-drag-handle": editor.isEditable,
|
|
5820
5821
|
className: cn("mly-image-drop-zone", isDraggingOver && "mly-drag-over"),
|
|
5821
5822
|
style: __spreadValues(__spreadProps(__spreadValues({}, hasImageSrc && status === "loaded" ? __spreadValues({
|
|
5822
|
-
width: width ? `${width}px` : void 0,
|
|
5823
|
-
height: height ? `${height}px` : void 0
|
|
5823
|
+
width: width && width !== "auto" ? `${width}px` : void 0,
|
|
5824
|
+
height: height && height !== "auto" ? `${height}px` : void 0
|
|
5824
5825
|
}, resizingStyle) : {}), {
|
|
5825
5826
|
overflow: "hidden",
|
|
5826
5827
|
position: "relative",
|
|
@@ -5872,8 +5873,8 @@ function ImageView(props) {
|
|
|
5872
5873
|
objectFit: "fill",
|
|
5873
5874
|
marginBottom: 0,
|
|
5874
5875
|
borderRadius: borderRadius2,
|
|
5875
|
-
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width ? `${width}px` : "auto",
|
|
5876
|
-
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height ? `${height}px` : "auto"
|
|
5876
|
+
width: (resizingStyle == null ? void 0 : resizingStyle.width) ? `${resizingStyle.width}px` : width && width !== "auto" ? `${width}px` : "auto",
|
|
5877
|
+
height: (resizingStyle == null ? void 0 : resizingStyle.height) ? `${resizingStyle.height}px` : height && height !== "auto" ? `${height}px` : "auto"
|
|
5877
5878
|
}),
|
|
5878
5879
|
draggable: editor.isEditable,
|
|
5879
5880
|
className: cn(
|
|
@@ -8023,10 +8024,13 @@ function ImageBubbleMenu(props) {
|
|
|
8023
8024
|
const width = Math.min(Number(value) || 0, IMAGE_MAX_WIDTH);
|
|
8024
8025
|
const currentHeight = Number(state.height) || 0;
|
|
8025
8026
|
const currentWidth = Number(state.width) || 0;
|
|
8026
|
-
const
|
|
8027
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8028
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8029
|
+
const isHeightAuto = !state.height || state.height === "auto";
|
|
8030
|
+
const shouldUpdateHeight = (lockAspectRatio || isHeightAuto) && value && (hasValidAspectRatio || currentHeight > 0);
|
|
8027
8031
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8028
8032
|
width: String(width)
|
|
8029
|
-
},
|
|
8033
|
+
}, shouldUpdateHeight ? {
|
|
8030
8034
|
height: String(
|
|
8031
8035
|
getNewHeight(width, currentAspectRatio)
|
|
8032
8036
|
)
|
|
@@ -8043,10 +8047,13 @@ function ImageBubbleMenu(props) {
|
|
|
8043
8047
|
const height = Number(value) || 0;
|
|
8044
8048
|
const currentHeight = Number(state.height) || 0;
|
|
8045
8049
|
const currentWidth = Number(state.width) || 0;
|
|
8046
|
-
const
|
|
8050
|
+
const hasValidAspectRatio = state.aspectRatio && isFinite(state.aspectRatio) && state.aspectRatio > 0;
|
|
8051
|
+
const currentAspectRatio = hasValidAspectRatio ? state.aspectRatio : currentHeight > 0 ? currentWidth / currentHeight : 1;
|
|
8052
|
+
const isWidthAuto = !state.width || state.width === "auto";
|
|
8053
|
+
const shouldUpdateWidth = (lockAspectRatio || isWidthAuto) && value && (hasValidAspectRatio || currentWidth > 0);
|
|
8047
8054
|
editor == null ? void 0 : editor.chain().updateAttributes("image", __spreadValues({
|
|
8048
8055
|
height: String(height)
|
|
8049
|
-
},
|
|
8056
|
+
}, shouldUpdateWidth ? {
|
|
8050
8057
|
width: String(
|
|
8051
8058
|
getNewWidth(height, currentAspectRatio)
|
|
8052
8059
|
)
|
|
@@ -8172,8 +8179,8 @@ var InlineImageExtension = Node5.create({
|
|
|
8172
8179
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
8173
8180
|
const attrs = mergeAttributes4(this.options.HTMLAttributes, HTMLAttributes2, {
|
|
8174
8181
|
"data-type": this.name,
|
|
8175
|
-
class: "mly:
|
|
8176
|
-
style:
|
|
8182
|
+
class: "mly:relative",
|
|
8183
|
+
style: `display: inline; --mly-inline-image-height: ${HTMLAttributes2.height}px; --mly-inline-image-width: ${HTMLAttributes2.width}px; margin:0; vertical-align: middle;`,
|
|
8177
8184
|
draggable: "false",
|
|
8178
8185
|
loading: "lazy"
|
|
8179
8186
|
});
|
|
@@ -10400,6 +10407,59 @@ import Dropcursor from "@tiptap/extension-dropcursor";
|
|
|
10400
10407
|
|
|
10401
10408
|
// src/editor/nodes/footer.ts
|
|
10402
10409
|
import { mergeAttributes as mergeAttributes9, Node as Node10 } from "@tiptap/core";
|
|
10410
|
+
|
|
10411
|
+
// src/editor/nodes/paragraph/paragraph.ts
|
|
10412
|
+
import TiptapParagraph from "@tiptap/extension-paragraph";
|
|
10413
|
+
var allowedTextDirection = ["ltr", "rtl"];
|
|
10414
|
+
var DEFAULT_TEXT_DIRECTION = "ltr";
|
|
10415
|
+
var ParagraphExtension = TiptapParagraph.extend({
|
|
10416
|
+
addAttributes() {
|
|
10417
|
+
var _a;
|
|
10418
|
+
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
10419
|
+
textDirection: {
|
|
10420
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
10421
|
+
parseHTML: (element) => {
|
|
10422
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
10423
|
+
},
|
|
10424
|
+
renderHTML(attributes) {
|
|
10425
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
10426
|
+
return {};
|
|
10427
|
+
}
|
|
10428
|
+
return {
|
|
10429
|
+
"data-text-direction": attributes.textDirection,
|
|
10430
|
+
dir: attributes.textDirection
|
|
10431
|
+
};
|
|
10432
|
+
}
|
|
10433
|
+
},
|
|
10434
|
+
showIfKey: {
|
|
10435
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
10436
|
+
parseHTML: (element) => {
|
|
10437
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
10438
|
+
},
|
|
10439
|
+
renderHTML(attributes) {
|
|
10440
|
+
if (!attributes.showIfKey) {
|
|
10441
|
+
return {};
|
|
10442
|
+
}
|
|
10443
|
+
return {
|
|
10444
|
+
"data-show-if-key": attributes.showIfKey
|
|
10445
|
+
};
|
|
10446
|
+
}
|
|
10447
|
+
}
|
|
10448
|
+
});
|
|
10449
|
+
},
|
|
10450
|
+
addCommands() {
|
|
10451
|
+
var _a;
|
|
10452
|
+
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
10453
|
+
setTextDirection: (direction) => ({ commands }) => {
|
|
10454
|
+
return commands.updateAttributes(this.name, {
|
|
10455
|
+
textDirection: direction
|
|
10456
|
+
});
|
|
10457
|
+
}
|
|
10458
|
+
});
|
|
10459
|
+
}
|
|
10460
|
+
});
|
|
10461
|
+
|
|
10462
|
+
// src/editor/nodes/footer.ts
|
|
10403
10463
|
var Footer = Node10.create({
|
|
10404
10464
|
name: "footer",
|
|
10405
10465
|
group: "block",
|
|
@@ -10414,6 +10474,21 @@ var Footer = Node10.create({
|
|
|
10414
10474
|
};
|
|
10415
10475
|
},
|
|
10416
10476
|
parseHTML: (element) => element == null ? void 0 : element.getAttribute("data-maily-component")
|
|
10477
|
+
},
|
|
10478
|
+
textDirection: {
|
|
10479
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
10480
|
+
parseHTML: (element) => {
|
|
10481
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
10482
|
+
},
|
|
10483
|
+
renderHTML(attributes) {
|
|
10484
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
10485
|
+
return {};
|
|
10486
|
+
}
|
|
10487
|
+
return {
|
|
10488
|
+
"data-text-direction": attributes.textDirection,
|
|
10489
|
+
dir: attributes.textDirection
|
|
10490
|
+
};
|
|
10491
|
+
}
|
|
10417
10492
|
}
|
|
10418
10493
|
};
|
|
10419
10494
|
},
|
|
@@ -10421,6 +10496,11 @@ var Footer = Node10.create({
|
|
|
10421
10496
|
return {
|
|
10422
10497
|
setFooter: () => ({ commands }) => {
|
|
10423
10498
|
return commands.setNode(this.name);
|
|
10499
|
+
},
|
|
10500
|
+
setFooterTextDirection: (direction) => ({ commands }) => {
|
|
10501
|
+
return commands.updateAttributes("footer", {
|
|
10502
|
+
textDirection: direction
|
|
10503
|
+
});
|
|
10424
10504
|
}
|
|
10425
10505
|
};
|
|
10426
10506
|
},
|
|
@@ -10465,30 +10545,21 @@ var HeadingExtension = TiptapHeading.extend({
|
|
|
10465
10545
|
addAttributes() {
|
|
10466
10546
|
var _a;
|
|
10467
10547
|
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
10468
|
-
|
|
10469
|
-
default:
|
|
10548
|
+
textDirection: {
|
|
10549
|
+
default: DEFAULT_TEXT_DIRECTION,
|
|
10470
10550
|
parseHTML: (element) => {
|
|
10471
|
-
return element.getAttribute("data-
|
|
10551
|
+
return element.getAttribute("data-text-direction") || element.getAttribute("dir") || DEFAULT_TEXT_DIRECTION;
|
|
10472
10552
|
},
|
|
10473
10553
|
renderHTML(attributes) {
|
|
10474
|
-
if (!attributes.
|
|
10554
|
+
if (!attributes.textDirection || attributes.textDirection === DEFAULT_TEXT_DIRECTION) {
|
|
10475
10555
|
return {};
|
|
10476
10556
|
}
|
|
10477
10557
|
return {
|
|
10478
|
-
"data-
|
|
10558
|
+
"data-text-direction": attributes.textDirection,
|
|
10559
|
+
dir: attributes.textDirection
|
|
10479
10560
|
};
|
|
10480
10561
|
}
|
|
10481
|
-
}
|
|
10482
|
-
});
|
|
10483
|
-
}
|
|
10484
|
-
});
|
|
10485
|
-
|
|
10486
|
-
// src/editor/nodes/paragraph/paragraph.ts
|
|
10487
|
-
import TiptapParagraph from "@tiptap/extension-paragraph";
|
|
10488
|
-
var ParagraphExtension = TiptapParagraph.extend({
|
|
10489
|
-
addAttributes() {
|
|
10490
|
-
var _a;
|
|
10491
|
-
return __spreadProps(__spreadValues({}, ((_a = this == null ? void 0 : this.parent) == null ? void 0 : _a.call(this)) || {}), {
|
|
10562
|
+
},
|
|
10492
10563
|
showIfKey: {
|
|
10493
10564
|
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
10494
10565
|
parseHTML: (element) => {
|
|
@@ -11468,6 +11539,124 @@ import {
|
|
|
11468
11539
|
UnderlineIcon as UnderlineIcon2
|
|
11469
11540
|
} from "lucide-react";
|
|
11470
11541
|
|
|
11542
|
+
// src/editor/components/icons/text-direction-icon.tsx
|
|
11543
|
+
import { jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
11544
|
+
function LtrIcon(props) {
|
|
11545
|
+
return /* @__PURE__ */ jsxs33(
|
|
11546
|
+
"svg",
|
|
11547
|
+
__spreadProps(__spreadValues({
|
|
11548
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11549
|
+
width: "16",
|
|
11550
|
+
height: "16",
|
|
11551
|
+
viewBox: "0 0 24 24",
|
|
11552
|
+
fill: "none",
|
|
11553
|
+
stroke: "currentColor",
|
|
11554
|
+
strokeWidth: "2",
|
|
11555
|
+
strokeLinecap: "round",
|
|
11556
|
+
strokeLinejoin: "round"
|
|
11557
|
+
}, props), {
|
|
11558
|
+
children: [
|
|
11559
|
+
/* @__PURE__ */ jsx56("path", { d: "M11 5h6" }),
|
|
11560
|
+
/* @__PURE__ */ jsx56("path", { d: "M11 5v14" }),
|
|
11561
|
+
/* @__PURE__ */ jsx56("path", { d: "M15 5v14" }),
|
|
11562
|
+
/* @__PURE__ */ jsx56("path", { d: "M6 18l-3-3 3-3" }),
|
|
11563
|
+
/* @__PURE__ */ jsx56("path", { d: "M3 15h5" })
|
|
11564
|
+
]
|
|
11565
|
+
})
|
|
11566
|
+
);
|
|
11567
|
+
}
|
|
11568
|
+
function RtlIcon(props) {
|
|
11569
|
+
return /* @__PURE__ */ jsxs33(
|
|
11570
|
+
"svg",
|
|
11571
|
+
__spreadProps(__spreadValues({
|
|
11572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11573
|
+
width: "16",
|
|
11574
|
+
height: "16",
|
|
11575
|
+
viewBox: "0 0 24 24",
|
|
11576
|
+
fill: "none",
|
|
11577
|
+
stroke: "currentColor",
|
|
11578
|
+
strokeWidth: "2",
|
|
11579
|
+
strokeLinecap: "round",
|
|
11580
|
+
strokeLinejoin: "round"
|
|
11581
|
+
}, props), {
|
|
11582
|
+
children: [
|
|
11583
|
+
/* @__PURE__ */ jsx56("path", { d: "M8 5h6" }),
|
|
11584
|
+
/* @__PURE__ */ jsx56("path", { d: "M10 5v14" }),
|
|
11585
|
+
/* @__PURE__ */ jsx56("path", { d: "M14 5v14" }),
|
|
11586
|
+
/* @__PURE__ */ jsx56("path", { d: "M18 18l3-3-3-3" }),
|
|
11587
|
+
/* @__PURE__ */ jsx56("path", { d: "M16 15h5" })
|
|
11588
|
+
]
|
|
11589
|
+
})
|
|
11590
|
+
);
|
|
11591
|
+
}
|
|
11592
|
+
|
|
11593
|
+
// src/editor/components/text-direction-switch.tsx
|
|
11594
|
+
import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
11595
|
+
function TextDirectionSwitch(props) {
|
|
11596
|
+
const { direction: rawDirection, onDirectionChange } = props;
|
|
11597
|
+
const direction = allowedTextDirection.includes(
|
|
11598
|
+
rawDirection
|
|
11599
|
+
) ? rawDirection : "ltr";
|
|
11600
|
+
const directions = {
|
|
11601
|
+
ltr: {
|
|
11602
|
+
icon: LtrIcon,
|
|
11603
|
+
tooltip: "Left to Right",
|
|
11604
|
+
onClick: () => {
|
|
11605
|
+
onDirectionChange("ltr");
|
|
11606
|
+
}
|
|
11607
|
+
},
|
|
11608
|
+
rtl: {
|
|
11609
|
+
icon: RtlIcon,
|
|
11610
|
+
tooltip: "Right to Left",
|
|
11611
|
+
onClick: () => {
|
|
11612
|
+
onDirectionChange("rtl");
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
};
|
|
11616
|
+
const activeDirection = directions[direction];
|
|
11617
|
+
return /* @__PURE__ */ jsxs34(Popover, { children: [
|
|
11618
|
+
/* @__PURE__ */ jsxs34(Tooltip, { children: [
|
|
11619
|
+
/* @__PURE__ */ jsx57(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx57(
|
|
11620
|
+
PopoverTrigger,
|
|
11621
|
+
{
|
|
11622
|
+
className: cn(
|
|
11623
|
+
"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"
|
|
11624
|
+
),
|
|
11625
|
+
children: /* @__PURE__ */ jsx57(activeDirection.icon, { className: "mly:h-3 mly:w-3 mly:stroke-[2.5]" })
|
|
11626
|
+
}
|
|
11627
|
+
) }),
|
|
11628
|
+
/* @__PURE__ */ jsx57(TooltipContent, { sideOffset: 8, children: "Text Direction" })
|
|
11629
|
+
] }),
|
|
11630
|
+
/* @__PURE__ */ jsx57(
|
|
11631
|
+
PopoverContent,
|
|
11632
|
+
{
|
|
11633
|
+
className: "mly:flex mly:w-max mly:gap-0.5 mly:rounded-lg mly:p-0.5!",
|
|
11634
|
+
side: "top",
|
|
11635
|
+
sideOffset: 8,
|
|
11636
|
+
align: "center",
|
|
11637
|
+
onOpenAutoFocus: (e) => {
|
|
11638
|
+
e.preventDefault();
|
|
11639
|
+
},
|
|
11640
|
+
onCloseAutoFocus: (e) => {
|
|
11641
|
+
e.preventDefault();
|
|
11642
|
+
},
|
|
11643
|
+
children: Object.entries(directions).map(([key, value]) => {
|
|
11644
|
+
return /* @__PURE__ */ jsx57(
|
|
11645
|
+
BubbleMenuButton,
|
|
11646
|
+
{
|
|
11647
|
+
icon: value.icon,
|
|
11648
|
+
tooltip: value.tooltip,
|
|
11649
|
+
command: value.onClick,
|
|
11650
|
+
isActive: () => key === direction
|
|
11651
|
+
},
|
|
11652
|
+
key
|
|
11653
|
+
);
|
|
11654
|
+
})
|
|
11655
|
+
}
|
|
11656
|
+
)
|
|
11657
|
+
] });
|
|
11658
|
+
}
|
|
11659
|
+
|
|
11471
11660
|
// src/editor/components/text-menu/use-text-menu-state.tsx
|
|
11472
11661
|
import { useEditorState as useEditorState8 } from "@tiptap/react";
|
|
11473
11662
|
import deepEql8 from "fast-deep-equal";
|
|
@@ -11476,17 +11665,20 @@ var useTextMenuState = (editor) => {
|
|
|
11476
11665
|
const states = useEditorState8({
|
|
11477
11666
|
editor,
|
|
11478
11667
|
selector: (ctx) => {
|
|
11479
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
11668
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
11480
11669
|
return {
|
|
11481
11670
|
currentTextColor: ctx.editor.getAttributes("textStyle").color || DEFAULT_TEXT_COLOR,
|
|
11482
11671
|
linkUrl: (_a = ctx.editor) == null ? void 0 : _a.getAttributes("link").href,
|
|
11483
11672
|
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",
|
|
11673
|
+
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,
|
|
11674
|
+
isFooterActive: ctx.editor.isActive("footer"),
|
|
11675
|
+
footerTextDirection: ((_i = ctx.editor.getAttributes("footer")) == null ? void 0 : _i.textDirection) || DEFAULT_TEXT_DIRECTION,
|
|
11484
11676
|
isListActive: ctx.editor.isActive("bulletList") || ctx.editor.isActive("orderedList"),
|
|
11485
|
-
isUrlVariable: (
|
|
11677
|
+
isUrlVariable: (_j = ctx.editor.getAttributes("link").isUrlVariable) != null ? _j : false,
|
|
11486
11678
|
isHeadingActive: ctx.editor.isActive("heading"),
|
|
11487
|
-
headingShowIfKey: ((
|
|
11679
|
+
headingShowIfKey: ((_k = ctx.editor.getAttributes("heading")) == null ? void 0 : _k.showIfKey) || "",
|
|
11488
11680
|
isParagraphActive: ctx.editor.isActive("paragraph"),
|
|
11489
|
-
paragraphShowIfKey: ((
|
|
11681
|
+
paragraphShowIfKey: ((_l = ctx.editor.getAttributes("paragraph")) == null ? void 0 : _l.showIfKey) || ""
|
|
11490
11682
|
};
|
|
11491
11683
|
},
|
|
11492
11684
|
equalityFn: deepEql8
|
|
@@ -11495,7 +11687,7 @@ var useTextMenuState = (editor) => {
|
|
|
11495
11687
|
};
|
|
11496
11688
|
|
|
11497
11689
|
// src/editor/components/text-menu/text-bubble-content.tsx
|
|
11498
|
-
import { Fragment as Fragment9, jsx as
|
|
11690
|
+
import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
11499
11691
|
function TextBubbleContent(props) {
|
|
11500
11692
|
var _a, _b, _c, _d;
|
|
11501
11693
|
const { editor, showListMenu = true } = props;
|
|
@@ -11539,9 +11731,9 @@ function TextBubbleContent(props) {
|
|
|
11539
11731
|
tooltip: "Code"
|
|
11540
11732
|
}
|
|
11541
11733
|
];
|
|
11542
|
-
return /* @__PURE__ */
|
|
11543
|
-
items.map((item, index) => /* @__PURE__ */
|
|
11544
|
-
/* @__PURE__ */
|
|
11734
|
+
return /* @__PURE__ */ jsxs35(Fragment9, { children: [
|
|
11735
|
+
items.map((item, index) => /* @__PURE__ */ jsx58(BubbleMenuButton, __spreadValues({}, item), index)),
|
|
11736
|
+
/* @__PURE__ */ jsx58(
|
|
11545
11737
|
AlignmentSwitch,
|
|
11546
11738
|
{
|
|
11547
11739
|
alignment: state.textAlign,
|
|
@@ -11550,8 +11742,23 @@ function TextBubbleContent(props) {
|
|
|
11550
11742
|
}
|
|
11551
11743
|
}
|
|
11552
11744
|
),
|
|
11553
|
-
|
|
11554
|
-
|
|
11745
|
+
/* @__PURE__ */ jsx58(
|
|
11746
|
+
TextDirectionSwitch,
|
|
11747
|
+
{
|
|
11748
|
+
direction: state.textDirection,
|
|
11749
|
+
onDirectionChange: (direction) => {
|
|
11750
|
+
if (state.isFooterActive) {
|
|
11751
|
+
editor == null ? void 0 : editor.chain().focus().setFooterTextDirection(direction).run();
|
|
11752
|
+
} else if (state.isHeadingActive) {
|
|
11753
|
+
editor == null ? void 0 : editor.chain().focus().updateAttributes("heading", { textDirection: direction }).run();
|
|
11754
|
+
} else {
|
|
11755
|
+
editor == null ? void 0 : editor.chain().focus().setTextDirection(direction).run();
|
|
11756
|
+
}
|
|
11757
|
+
}
|
|
11758
|
+
}
|
|
11759
|
+
),
|
|
11760
|
+
!state.isListActive && showListMenu && /* @__PURE__ */ jsxs35(Fragment9, { children: [
|
|
11761
|
+
/* @__PURE__ */ jsx58(
|
|
11555
11762
|
BubbleMenuButton,
|
|
11556
11763
|
{
|
|
11557
11764
|
icon: List2,
|
|
@@ -11561,7 +11768,7 @@ function TextBubbleContent(props) {
|
|
|
11561
11768
|
tooltip: "Bullet List"
|
|
11562
11769
|
}
|
|
11563
11770
|
),
|
|
11564
|
-
/* @__PURE__ */
|
|
11771
|
+
/* @__PURE__ */ jsx58(
|
|
11565
11772
|
BubbleMenuButton,
|
|
11566
11773
|
{
|
|
11567
11774
|
icon: ListOrdered2,
|
|
@@ -11572,7 +11779,7 @@ function TextBubbleContent(props) {
|
|
|
11572
11779
|
}
|
|
11573
11780
|
)
|
|
11574
11781
|
] }),
|
|
11575
|
-
/* @__PURE__ */
|
|
11782
|
+
/* @__PURE__ */ jsx58(
|
|
11576
11783
|
LinkInputPopover,
|
|
11577
11784
|
{
|
|
11578
11785
|
defaultValue: (_d = state == null ? void 0 : state.linkUrl) != null ? _d : "",
|
|
@@ -11588,8 +11795,8 @@ function TextBubbleContent(props) {
|
|
|
11588
11795
|
isVariable: state.isUrlVariable
|
|
11589
11796
|
}
|
|
11590
11797
|
),
|
|
11591
|
-
/* @__PURE__ */
|
|
11592
|
-
/* @__PURE__ */
|
|
11798
|
+
/* @__PURE__ */ jsx58(Divider, {}),
|
|
11799
|
+
/* @__PURE__ */ jsx58(
|
|
11593
11800
|
ColorPicker,
|
|
11594
11801
|
{
|
|
11595
11802
|
color: state.currentTextColor,
|
|
@@ -11598,16 +11805,16 @@ function TextBubbleContent(props) {
|
|
|
11598
11805
|
},
|
|
11599
11806
|
tooltip: "Text Color",
|
|
11600
11807
|
suggestedColors,
|
|
11601
|
-
children: /* @__PURE__ */
|
|
11808
|
+
children: /* @__PURE__ */ jsx58(
|
|
11602
11809
|
BaseButton,
|
|
11603
11810
|
{
|
|
11604
11811
|
variant: "ghost",
|
|
11605
11812
|
size: "sm",
|
|
11606
11813
|
type: "button",
|
|
11607
11814
|
className: "mly:h-7 mly:w-7 mly:shrink-0 mly:p-0",
|
|
11608
|
-
children: /* @__PURE__ */
|
|
11609
|
-
/* @__PURE__ */
|
|
11610
|
-
/* @__PURE__ */
|
|
11815
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "mly:flex mly:flex-col mly:items-center mly:justify-center mly:gap-px", children: [
|
|
11816
|
+
/* @__PURE__ */ jsx58("span", { className: "mly:font-bolder mly:font-mono mly:text-xs mly:text-slate-700", children: "A" }),
|
|
11817
|
+
/* @__PURE__ */ jsx58(
|
|
11611
11818
|
"div",
|
|
11612
11819
|
{
|
|
11613
11820
|
className: "mly:h-[2px] mly:w-3",
|
|
@@ -11625,7 +11832,7 @@ function TextBubbleContent(props) {
|
|
|
11625
11832
|
// src/editor/components/text-menu/turn-into-block.tsx
|
|
11626
11833
|
import { ChevronDownIcon as ChevronDownIcon2, PilcrowIcon } from "lucide-react";
|
|
11627
11834
|
import { useMemo as useMemo12 } from "react";
|
|
11628
|
-
import { jsx as
|
|
11835
|
+
import { jsx as jsx59, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
11629
11836
|
var isOption = (option) => option.type === "option";
|
|
11630
11837
|
var isCategory = (option) => option.type === "category";
|
|
11631
11838
|
function TurnIntoBlock(props) {
|
|
@@ -11635,23 +11842,23 @@ function TurnIntoBlock(props) {
|
|
|
11635
11842
|
[options]
|
|
11636
11843
|
);
|
|
11637
11844
|
const { icon: ActiveIcon = PilcrowIcon } = activeItem || {};
|
|
11638
|
-
return /* @__PURE__ */
|
|
11639
|
-
/* @__PURE__ */
|
|
11640
|
-
/* @__PURE__ */
|
|
11845
|
+
return /* @__PURE__ */ jsxs36(Popover, { children: [
|
|
11846
|
+
/* @__PURE__ */ jsxs36(Tooltip, { children: [
|
|
11847
|
+
/* @__PURE__ */ jsx59(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs36(
|
|
11641
11848
|
PopoverTrigger,
|
|
11642
11849
|
{
|
|
11643
11850
|
className: cn(
|
|
11644
11851
|
"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"
|
|
11645
11852
|
),
|
|
11646
11853
|
children: [
|
|
11647
|
-
/* @__PURE__ */
|
|
11648
|
-
/* @__PURE__ */
|
|
11854
|
+
/* @__PURE__ */ jsx59(ActiveIcon, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" }),
|
|
11855
|
+
/* @__PURE__ */ jsx59(ChevronDownIcon2, { className: "mly:h-3 mly:w-3 mly:shrink-0 mly:stroke-[2.5]" })
|
|
11649
11856
|
]
|
|
11650
11857
|
}
|
|
11651
11858
|
) }),
|
|
11652
|
-
/* @__PURE__ */
|
|
11859
|
+
/* @__PURE__ */ jsx59(TooltipContent, { sideOffset: 8, children: "Turn into" })
|
|
11653
11860
|
] }),
|
|
11654
|
-
/* @__PURE__ */
|
|
11861
|
+
/* @__PURE__ */ jsx59(
|
|
11655
11862
|
PopoverContent,
|
|
11656
11863
|
{
|
|
11657
11864
|
align: "start",
|
|
@@ -11660,21 +11867,21 @@ function TurnIntoBlock(props) {
|
|
|
11660
11867
|
className: "mly:flex mly:w-[160px] mly:flex-col mly:rounded-md mly:p-1",
|
|
11661
11868
|
children: options.map((option, index) => {
|
|
11662
11869
|
if (isOption(option)) {
|
|
11663
|
-
return /* @__PURE__ */
|
|
11870
|
+
return /* @__PURE__ */ jsxs36(
|
|
11664
11871
|
BaseButton,
|
|
11665
11872
|
{
|
|
11666
11873
|
onClick: option.onClick,
|
|
11667
11874
|
variant: "ghost",
|
|
11668
11875
|
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",
|
|
11669
11876
|
children: [
|
|
11670
|
-
/* @__PURE__ */
|
|
11877
|
+
/* @__PURE__ */ jsx59(option.icon, { className: "mly:size-[15px] mly:shrink-0" }),
|
|
11671
11878
|
option.label
|
|
11672
11879
|
]
|
|
11673
11880
|
},
|
|
11674
11881
|
option.id
|
|
11675
11882
|
);
|
|
11676
11883
|
} else if (isCategory(option)) {
|
|
11677
|
-
return /* @__PURE__ */
|
|
11884
|
+
return /* @__PURE__ */ jsx59(
|
|
11678
11885
|
"label",
|
|
11679
11886
|
{
|
|
11680
11887
|
className: cn(
|
|
@@ -11787,7 +11994,7 @@ function useTurnIntoBlockOptions(editor) {
|
|
|
11787
11994
|
}
|
|
11788
11995
|
|
|
11789
11996
|
// src/editor/components/text-menu/text-bubble-menu.tsx
|
|
11790
|
-
import { jsx as
|
|
11997
|
+
import { jsx as jsx60, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
11791
11998
|
function TextBubbleMenu(props) {
|
|
11792
11999
|
const { editor, appendTo } = props;
|
|
11793
12000
|
if (!editor) {
|
|
@@ -11838,14 +12045,14 @@ function TextBubbleMenu(props) {
|
|
|
11838
12045
|
}
|
|
11839
12046
|
});
|
|
11840
12047
|
const turnIntoBlockOptions = useTurnIntoBlockOptions(editor);
|
|
11841
|
-
return /* @__PURE__ */
|
|
12048
|
+
return /* @__PURE__ */ jsx60(
|
|
11842
12049
|
BubbleMenu8,
|
|
11843
12050
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
11844
12051
|
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",
|
|
11845
|
-
children: /* @__PURE__ */
|
|
11846
|
-
/* @__PURE__ */
|
|
11847
|
-
/* @__PURE__ */
|
|
11848
|
-
/* @__PURE__ */
|
|
12052
|
+
children: /* @__PURE__ */ jsxs37(TooltipProvider, { children: [
|
|
12053
|
+
/* @__PURE__ */ jsx60(TurnIntoBlock, { options: turnIntoBlockOptions }),
|
|
12054
|
+
/* @__PURE__ */ jsx60(Divider, { className: "mly:mx-0" }),
|
|
12055
|
+
/* @__PURE__ */ jsx60(TextBubbleContent, { editor })
|
|
11849
12056
|
] })
|
|
11850
12057
|
})
|
|
11851
12058
|
);
|
|
@@ -11854,7 +12061,7 @@ function TextBubbleMenu(props) {
|
|
|
11854
12061
|
// src/editor/components/variable-menu/variable-bubble-menu.tsx
|
|
11855
12062
|
import { BubbleMenu as BubbleMenu9 } from "@tiptap/react";
|
|
11856
12063
|
import { sticky as sticky7 } from "tippy.js";
|
|
11857
|
-
import { jsx as
|
|
12064
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
11858
12065
|
function VariableBubbleMenu(props) {
|
|
11859
12066
|
const { editor, appendTo } = props;
|
|
11860
12067
|
if (!editor) {
|
|
@@ -11877,11 +12084,11 @@ function VariableBubbleMenu(props) {
|
|
|
11877
12084
|
placement: "top-start"
|
|
11878
12085
|
}
|
|
11879
12086
|
});
|
|
11880
|
-
return /* @__PURE__ */
|
|
12087
|
+
return /* @__PURE__ */ jsx61(
|
|
11881
12088
|
BubbleMenu9,
|
|
11882
12089
|
__spreadProps(__spreadValues({}, bubbleMenuProps), {
|
|
11883
12090
|
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",
|
|
11884
|
-
children: /* @__PURE__ */
|
|
12091
|
+
children: /* @__PURE__ */ jsx61(TooltipProvider, { children: /* @__PURE__ */ jsx61(TextBubbleContent, { showListMenu: false, editor }) })
|
|
11885
12092
|
})
|
|
11886
12093
|
);
|
|
11887
12094
|
}
|
|
@@ -11967,7 +12174,7 @@ function replaceDeprecatedNode(json) {
|
|
|
11967
12174
|
}
|
|
11968
12175
|
|
|
11969
12176
|
// src/editor/index.tsx
|
|
11970
|
-
import { jsx as
|
|
12177
|
+
import { jsx as jsx62, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
11971
12178
|
function Editor13(props) {
|
|
11972
12179
|
const {
|
|
11973
12180
|
config: {
|
|
@@ -12040,7 +12247,7 @@ function Editor13(props) {
|
|
|
12040
12247
|
if (!editor) {
|
|
12041
12248
|
return null;
|
|
12042
12249
|
}
|
|
12043
|
-
return /* @__PURE__ */
|
|
12250
|
+
return /* @__PURE__ */ jsx62(MailyProvider, { placeholderUrl, children: /* @__PURE__ */ jsxs38(
|
|
12044
12251
|
"div",
|
|
12045
12252
|
{
|
|
12046
12253
|
id: "mly-editor",
|
|
@@ -12051,8 +12258,8 @@ function Editor13(props) {
|
|
|
12051
12258
|
),
|
|
12052
12259
|
ref: menuContainerRef,
|
|
12053
12260
|
children: [
|
|
12054
|
-
hasMenuBar && /* @__PURE__ */
|
|
12055
|
-
/* @__PURE__ */
|
|
12261
|
+
hasMenuBar && /* @__PURE__ */ jsx62(EditorMenuBar, { config: props.config, editor }),
|
|
12262
|
+
/* @__PURE__ */ jsxs38(
|
|
12056
12263
|
"div",
|
|
12057
12264
|
{
|
|
12058
12265
|
className: cn(
|
|
@@ -12060,17 +12267,17 @@ function Editor13(props) {
|
|
|
12060
12267
|
bodyClassName
|
|
12061
12268
|
),
|
|
12062
12269
|
children: [
|
|
12063
|
-
/* @__PURE__ */
|
|
12064
|
-
/* @__PURE__ */
|
|
12065
|
-
/* @__PURE__ */
|
|
12066
|
-
/* @__PURE__ */
|
|
12067
|
-
/* @__PURE__ */
|
|
12068
|
-
/* @__PURE__ */
|
|
12069
|
-
!hideContextMenu && /* @__PURE__ */
|
|
12070
|
-
/* @__PURE__ */
|
|
12071
|
-
/* @__PURE__ */
|
|
12072
|
-
/* @__PURE__ */
|
|
12073
|
-
/* @__PURE__ */
|
|
12270
|
+
/* @__PURE__ */ jsx62(TextBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12271
|
+
/* @__PURE__ */ jsx62(ImageBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12272
|
+
/* @__PURE__ */ jsx62(SpacerBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12273
|
+
/* @__PURE__ */ jsx62(EditorContent, { editor }),
|
|
12274
|
+
/* @__PURE__ */ jsx62(SectionBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12275
|
+
/* @__PURE__ */ jsx62(ColumnsBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12276
|
+
!hideContextMenu && /* @__PURE__ */ jsx62(ContentMenu, { editor }),
|
|
12277
|
+
/* @__PURE__ */ jsx62(VariableBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12278
|
+
/* @__PURE__ */ jsx62(RepeatBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12279
|
+
/* @__PURE__ */ jsx62(HTMLBubbleMenu, { editor, appendTo: menuContainerRef }),
|
|
12280
|
+
/* @__PURE__ */ jsx62(InlineImageBubbleMenu, { editor, appendTo: menuContainerRef })
|
|
12074
12281
|
]
|
|
12075
12282
|
}
|
|
12076
12283
|
)
|