@maily-to/core 0.0.27 → 0.1.1
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/blocks/index.d.mts +21 -4
- package/dist/blocks/index.d.ts +21 -4
- package/dist/blocks/index.js +30 -8
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/index.mjs +29 -8
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.d.mts +32 -11
- package/dist/extensions/index.d.ts +32 -11
- package/dist/extensions/index.js +1321 -468
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +1266 -407
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.d.mts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +3416 -1992
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3638 -2207
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
- package/readme.md +83 -6
package/dist/extensions/index.js
CHANGED
|
@@ -90,12 +90,14 @@ __export(extensions_exports, {
|
|
|
90
90
|
DEFAULT_SECTION_PADDING_RIGHT: () => DEFAULT_SECTION_PADDING_RIGHT,
|
|
91
91
|
DEFAULT_SECTION_PADDING_TOP: () => DEFAULT_SECTION_PADDING_TOP,
|
|
92
92
|
DEFAULT_SECTION_SHOW_IF_KEY: () => DEFAULT_SECTION_SHOW_IF_KEY,
|
|
93
|
+
DEFAULT_SPACER_HEIGHT: () => DEFAULT_SPACER_HEIGHT,
|
|
93
94
|
Footer: () => Footer,
|
|
94
95
|
HorizontalRule: () => HorizontalRule,
|
|
95
96
|
ImageExtension: () => ImageExtension,
|
|
96
97
|
LinkExtension: () => LinkExtension,
|
|
97
98
|
LogoExtension: () => LogoExtension,
|
|
98
99
|
MailyKit: () => MailyKit,
|
|
100
|
+
PlaceholderExtension: () => PlaceholderExtension,
|
|
99
101
|
RepeatExtension: () => RepeatExtension,
|
|
100
102
|
SectionExtension: () => SectionExtension,
|
|
101
103
|
SlashCommandExtension: () => SlashCommandExtension,
|
|
@@ -107,7 +109,6 @@ __export(extensions_exports, {
|
|
|
107
109
|
allowedButtonVariant: () => allowedButtonVariant,
|
|
108
110
|
allowedLogoAlignment: () => allowedLogoAlignment,
|
|
109
111
|
allowedLogoSize: () => allowedLogoSize,
|
|
110
|
-
allowedSpacerSize: () => allowedSpacerSize,
|
|
111
112
|
getSlashCommandSuggestions: () => getSlashCommandSuggestions,
|
|
112
113
|
getVariableSuggestions: () => getVariableSuggestions,
|
|
113
114
|
logoSizes: () => logoSizes
|
|
@@ -119,7 +120,6 @@ var import_core12 = require("@tiptap/core");
|
|
|
119
120
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"));
|
|
120
121
|
var import_extension_list_item = __toESM(require("@tiptap/extension-list-item"));
|
|
121
122
|
var import_extension_paragraph2 = __toESM(require("@tiptap/extension-paragraph"));
|
|
122
|
-
var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"));
|
|
123
123
|
var import_extension_text_align = __toESM(require("@tiptap/extension-text-align"));
|
|
124
124
|
var import_extension_text_style = __toESM(require("@tiptap/extension-text-style"));
|
|
125
125
|
var import_extension_heading2 = __toESM(require("@tiptap/extension-heading"));
|
|
@@ -545,12 +545,7 @@ var SectionExtension = import_core3.Node.create({
|
|
|
545
545
|
});
|
|
546
546
|
|
|
547
547
|
// src/editor/nodes/spacer.ts
|
|
548
|
-
var
|
|
549
|
-
var DEFAULT_HEIGHT = "sm";
|
|
550
|
-
function getHeightStyle(height) {
|
|
551
|
-
const heights = { sm: "8px", md: "16px", lg: "32px", xl: "64px" };
|
|
552
|
-
return `width: 100%; height: ${heights[height] || heights[DEFAULT_HEIGHT]}`;
|
|
553
|
-
}
|
|
548
|
+
var DEFAULT_SPACER_HEIGHT = 8;
|
|
554
549
|
var Spacer = import_core4.Node.create({
|
|
555
550
|
name: "spacer",
|
|
556
551
|
priority: 1e3,
|
|
@@ -559,8 +554,8 @@ var Spacer = import_core4.Node.create({
|
|
|
559
554
|
addAttributes() {
|
|
560
555
|
return {
|
|
561
556
|
height: {
|
|
562
|
-
default:
|
|
563
|
-
parseHTML: (element) => element.getAttribute("data-height"),
|
|
557
|
+
default: DEFAULT_SPACER_HEIGHT,
|
|
558
|
+
parseHTML: (element) => Number(element.getAttribute("data-height")),
|
|
564
559
|
renderHTML: (attributes) => {
|
|
565
560
|
return {
|
|
566
561
|
"data-height": attributes.height
|
|
@@ -594,9 +589,6 @@ var Spacer = import_core4.Node.create({
|
|
|
594
589
|
});
|
|
595
590
|
},
|
|
596
591
|
setSpacerSize: (height) => ({ commands }) => {
|
|
597
|
-
if (!allowedSpacerSize.includes(height)) {
|
|
598
|
-
throw new Error("Invalid spacer height");
|
|
599
|
-
}
|
|
600
592
|
return commands.updateAttributes("spacer", { height });
|
|
601
593
|
},
|
|
602
594
|
setSpacerShowIfKey: (showIfKey) => ({ commands }) => {
|
|
@@ -609,7 +601,6 @@ var Spacer = import_core4.Node.create({
|
|
|
609
601
|
},
|
|
610
602
|
renderHTML({ HTMLAttributes: HTMLAttributes2, node }) {
|
|
611
603
|
const { height } = node.attrs;
|
|
612
|
-
HTMLAttributes2.style = getHeightStyle(height);
|
|
613
604
|
return [
|
|
614
605
|
"div",
|
|
615
606
|
(0, import_core4.mergeAttributes)(
|
|
@@ -619,8 +610,9 @@ var Spacer = import_core4.Node.create({
|
|
|
619
610
|
this.options.HTMLAttributes,
|
|
620
611
|
HTMLAttributes2,
|
|
621
612
|
{
|
|
622
|
-
class: "spacer mly-relative mly-z-50",
|
|
623
|
-
contenteditable: false
|
|
613
|
+
class: "spacer mly-relative mly-full mly-z-50",
|
|
614
|
+
contenteditable: false,
|
|
615
|
+
style: `height: ${height}px;--spacer-height: ${height}px;`
|
|
624
616
|
}
|
|
625
617
|
)
|
|
626
618
|
];
|
|
@@ -1205,7 +1197,7 @@ var ColumnsExtension = import_core9.Node.create({
|
|
|
1205
1197
|
|
|
1206
1198
|
// src/editor/nodes/button/button.tsx
|
|
1207
1199
|
var import_core10 = require("@tiptap/core");
|
|
1208
|
-
var
|
|
1200
|
+
var import_react18 = require("@tiptap/react");
|
|
1209
1201
|
|
|
1210
1202
|
// src/editor/components/alignment-switch.tsx
|
|
1211
1203
|
var import_lucide_react = require("lucide-react");
|
|
@@ -1270,7 +1262,7 @@ var TooltipContent = React5.forwardRef((_a, ref) => {
|
|
|
1270
1262
|
ref,
|
|
1271
1263
|
sideOffset,
|
|
1272
1264
|
className: cn(
|
|
1273
|
-
"mly-z-50 mly-overflow-hidden mly-rounded-md mly-border mly-bg-white mly-px-2 mly-py-1 mly-text-xs mly-animate-in mly-fade-in-0 mly-zoom-in-95",
|
|
1265
|
+
"mly-z-50 mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200 mly-bg-white mly-px-2 mly-py-1 mly-text-xs mly-animate-in mly-fade-in-0 mly-zoom-in-95",
|
|
1274
1266
|
className
|
|
1275
1267
|
)
|
|
1276
1268
|
}, props)
|
|
@@ -1329,37 +1321,71 @@ function BubbleMenuButton(item) {
|
|
|
1329
1321
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1330
1322
|
function AlignmentSwitch(props) {
|
|
1331
1323
|
const { alignment = "left", onAlignmentChange } = props;
|
|
1332
|
-
const
|
|
1324
|
+
const alignments = {
|
|
1333
1325
|
left: {
|
|
1334
1326
|
icon: import_lucide_react.AlignLeft,
|
|
1335
1327
|
tooltip: "Align Left",
|
|
1336
1328
|
onClick: () => {
|
|
1337
|
-
onAlignmentChange("
|
|
1329
|
+
onAlignmentChange("left");
|
|
1338
1330
|
}
|
|
1339
1331
|
},
|
|
1340
1332
|
center: {
|
|
1341
1333
|
icon: import_lucide_react.AlignCenter,
|
|
1342
1334
|
tooltip: "Align Center",
|
|
1343
1335
|
onClick: () => {
|
|
1344
|
-
onAlignmentChange("
|
|
1336
|
+
onAlignmentChange("center");
|
|
1345
1337
|
}
|
|
1346
1338
|
},
|
|
1347
1339
|
right: {
|
|
1348
1340
|
icon: import_lucide_react.AlignRight,
|
|
1349
1341
|
tooltip: "Align Right",
|
|
1350
1342
|
onClick: () => {
|
|
1351
|
-
onAlignmentChange("
|
|
1343
|
+
onAlignmentChange("right");
|
|
1352
1344
|
}
|
|
1353
1345
|
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
{
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1346
|
+
};
|
|
1347
|
+
const activeAlignment = alignments[alignment];
|
|
1348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Popover, { children: [
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tooltip, { children: [
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1351
|
+
PopoverTrigger,
|
|
1352
|
+
{
|
|
1353
|
+
className: cn(
|
|
1354
|
+
"mly-flex mly-size-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"
|
|
1355
|
+
),
|
|
1356
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(activeAlignment.icon, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5]" })
|
|
1357
|
+
}
|
|
1358
|
+
) }),
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipContent, { sideOffset: 8, children: "Alignment" })
|
|
1360
|
+
] }),
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1362
|
+
PopoverContent,
|
|
1363
|
+
{
|
|
1364
|
+
className: "mly-flex mly-w-max mly-gap-0.5 mly-rounded-lg !mly-p-0.5",
|
|
1365
|
+
side: "top",
|
|
1366
|
+
sideOffset: 8,
|
|
1367
|
+
align: "center",
|
|
1368
|
+
onOpenAutoFocus: (e) => {
|
|
1369
|
+
e.preventDefault();
|
|
1370
|
+
},
|
|
1371
|
+
onCloseAutoFocus: (e) => {
|
|
1372
|
+
e.preventDefault();
|
|
1373
|
+
},
|
|
1374
|
+
children: Object.entries(alignments).map(([key, value]) => {
|
|
1375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1376
|
+
BubbleMenuButton,
|
|
1377
|
+
{
|
|
1378
|
+
icon: value.icon,
|
|
1379
|
+
tooltip: value.tooltip,
|
|
1380
|
+
command: value.onClick,
|
|
1381
|
+
isActive: () => key === alignment
|
|
1382
|
+
},
|
|
1383
|
+
key
|
|
1384
|
+
);
|
|
1385
|
+
})
|
|
1386
|
+
}
|
|
1387
|
+
)
|
|
1388
|
+
] });
|
|
1363
1389
|
}
|
|
1364
1390
|
|
|
1365
1391
|
// src/editor/components/ui/color-picker.tsx
|
|
@@ -1489,12 +1515,15 @@ function Divider(props) {
|
|
|
1489
1515
|
}
|
|
1490
1516
|
|
|
1491
1517
|
// src/editor/components/ui/link-input-popover.tsx
|
|
1492
|
-
var
|
|
1518
|
+
var import_lucide_react13 = require("lucide-react");
|
|
1493
1519
|
var import_react9 = require("react");
|
|
1494
1520
|
|
|
1495
1521
|
// src/editor/provider.tsx
|
|
1496
1522
|
var import_react4 = require("react");
|
|
1497
1523
|
|
|
1524
|
+
// src/editor/extensions/slash-command/default-slash-commands.tsx
|
|
1525
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1526
|
+
|
|
1498
1527
|
// src/blocks/button.tsx
|
|
1499
1528
|
var import_lucide_react2 = require("lucide-react");
|
|
1500
1529
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -1515,21 +1544,35 @@ var linkCard = {
|
|
|
1515
1544
|
command: ({ editor, range }) => {
|
|
1516
1545
|
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
1517
1546
|
},
|
|
1518
|
-
|
|
1547
|
+
render: (editor) => {
|
|
1519
1548
|
return editor.extensionManager.extensions.findIndex(
|
|
1520
1549
|
(ext) => ext.name === "linkCard"
|
|
1521
|
-
) === -1;
|
|
1550
|
+
) === -1 ? null : true;
|
|
1522
1551
|
}
|
|
1523
1552
|
};
|
|
1524
1553
|
|
|
1525
|
-
// src/blocks/
|
|
1554
|
+
// src/blocks/code.tsx
|
|
1526
1555
|
var import_lucide_react3 = require("lucide-react");
|
|
1527
1556
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1557
|
+
var htmlCodeBlock = {
|
|
1558
|
+
title: "Custom HTML",
|
|
1559
|
+
description: "Insert a custom HTML block",
|
|
1560
|
+
searchTerms: ["html", "code", "custom"],
|
|
1561
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.CodeXmlIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1562
|
+
command: ({ editor, range }) => {
|
|
1563
|
+
editor.chain().focus().deleteRange(range).setHtmlCodeBlock({ language: "html" }).run();
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1567
|
+
// src/blocks/image.tsx
|
|
1568
|
+
var import_state2 = require("@tiptap/pm/state");
|
|
1569
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1570
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1528
1571
|
var image = {
|
|
1529
1572
|
title: "Image",
|
|
1530
1573
|
description: "Full width image",
|
|
1531
1574
|
searchTerms: ["image"],
|
|
1532
|
-
icon: /* @__PURE__ */ (0,
|
|
1575
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1533
1576
|
command: ({ editor, range }) => {
|
|
1534
1577
|
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
1535
1578
|
}
|
|
@@ -1538,23 +1581,45 @@ var logo = {
|
|
|
1538
1581
|
title: "Logo",
|
|
1539
1582
|
description: "Add your brand logo",
|
|
1540
1583
|
searchTerms: ["image", "logo"],
|
|
1541
|
-
icon: /* @__PURE__ */ (0,
|
|
1584
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1542
1585
|
command: ({ editor, range }) => {
|
|
1543
1586
|
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
1544
1587
|
}
|
|
1545
1588
|
};
|
|
1589
|
+
var inlineImage = {
|
|
1590
|
+
title: "Inline Image",
|
|
1591
|
+
description: "Inline image",
|
|
1592
|
+
searchTerms: ["image", "inline"],
|
|
1593
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1594
|
+
command: ({ editor, range }) => {
|
|
1595
|
+
editor.chain().focus().deleteRange(range).setInlineImage({
|
|
1596
|
+
src: ""
|
|
1597
|
+
}).command((props) => {
|
|
1598
|
+
const { tr, state, view, editor: editor2 } = props;
|
|
1599
|
+
const { from } = range;
|
|
1600
|
+
const node = state.doc.nodeAt(from);
|
|
1601
|
+
if (!node) {
|
|
1602
|
+
return false;
|
|
1603
|
+
}
|
|
1604
|
+
const selection = import_state2.TextSelection.create(
|
|
1605
|
+
tr.doc,
|
|
1606
|
+
from,
|
|
1607
|
+
from + node.nodeSize
|
|
1608
|
+
);
|
|
1609
|
+
tr.setSelection(selection);
|
|
1610
|
+
return true;
|
|
1611
|
+
}).run();
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1546
1614
|
|
|
1547
1615
|
// src/blocks/layout.tsx
|
|
1548
|
-
var
|
|
1549
|
-
var
|
|
1616
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1617
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1550
1618
|
var columns = {
|
|
1551
1619
|
title: "Columns",
|
|
1552
1620
|
description: "Add columns to email.",
|
|
1553
1621
|
searchTerms: ["layout", "columns"],
|
|
1554
|
-
icon: /* @__PURE__ */ (0,
|
|
1555
|
-
shouldBeHidden: (editor) => {
|
|
1556
|
-
return editor.isActive("columns");
|
|
1557
|
-
},
|
|
1622
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.ColumnsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1558
1623
|
command: ({ editor, range }) => {
|
|
1559
1624
|
editor.chain().focus().deleteRange(range).setColumns().focus(editor.state.selection.head - 2).run();
|
|
1560
1625
|
}
|
|
@@ -1563,7 +1628,7 @@ var section = {
|
|
|
1563
1628
|
title: "Section",
|
|
1564
1629
|
description: "Add a section to email.",
|
|
1565
1630
|
searchTerms: ["layout", "section"],
|
|
1566
|
-
icon: /* @__PURE__ */ (0,
|
|
1631
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.RectangleHorizontal, { className: "mly-h-4 mly-w-4" }),
|
|
1567
1632
|
command: ({ editor, range }) => {
|
|
1568
1633
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
1569
1634
|
}
|
|
@@ -1572,10 +1637,7 @@ var repeat = {
|
|
|
1572
1637
|
title: "Repeat",
|
|
1573
1638
|
description: "Loop over an array of items.",
|
|
1574
1639
|
searchTerms: ["repeat", "for", "loop"],
|
|
1575
|
-
icon: /* @__PURE__ */ (0,
|
|
1576
|
-
shouldBeHidden: (editor) => {
|
|
1577
|
-
return editor.isActive("repeat");
|
|
1578
|
-
},
|
|
1640
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
1579
1641
|
command: ({ editor, range }) => {
|
|
1580
1642
|
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
1581
1643
|
}
|
|
@@ -1584,7 +1646,7 @@ var spacer = {
|
|
|
1584
1646
|
title: "Spacer",
|
|
1585
1647
|
description: "Add space between blocks.",
|
|
1586
1648
|
searchTerms: ["space", "gap", "divider"],
|
|
1587
|
-
icon: /* @__PURE__ */ (0,
|
|
1649
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.MoveVertical, { className: "mly-h-4 mly-w-4" }),
|
|
1588
1650
|
command: ({ editor, range }) => {
|
|
1589
1651
|
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
1590
1652
|
}
|
|
@@ -1593,20 +1655,20 @@ var divider = {
|
|
|
1593
1655
|
title: "Divider",
|
|
1594
1656
|
description: "Add a horizontal divider.",
|
|
1595
1657
|
searchTerms: ["divider", "line"],
|
|
1596
|
-
icon: /* @__PURE__ */ (0,
|
|
1658
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Minus, { className: "mly-h-4 mly-w-4" }),
|
|
1597
1659
|
command: ({ editor, range }) => {
|
|
1598
1660
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
1599
1661
|
}
|
|
1600
1662
|
};
|
|
1601
1663
|
|
|
1602
1664
|
// src/blocks/list.tsx
|
|
1603
|
-
var
|
|
1604
|
-
var
|
|
1665
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1666
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1605
1667
|
var bulletList = {
|
|
1606
1668
|
title: "Bullet List",
|
|
1607
1669
|
description: "Create a simple bullet list.",
|
|
1608
1670
|
searchTerms: ["unordered", "point"],
|
|
1609
|
-
icon: /* @__PURE__ */ (0,
|
|
1671
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.List, { className: "mly-h-4 mly-w-4" }),
|
|
1610
1672
|
command: ({ editor, range }) => {
|
|
1611
1673
|
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
1612
1674
|
}
|
|
@@ -1615,20 +1677,20 @@ var orderedList = {
|
|
|
1615
1677
|
title: "Numbered List",
|
|
1616
1678
|
description: "Create a list with numbering.",
|
|
1617
1679
|
searchTerms: ["ordered"],
|
|
1618
|
-
icon: /* @__PURE__ */ (0,
|
|
1680
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.ListOrdered, { className: "mly-h-4 mly-w-4" }),
|
|
1619
1681
|
command: ({ editor, range }) => {
|
|
1620
1682
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
1621
1683
|
}
|
|
1622
1684
|
};
|
|
1623
1685
|
|
|
1624
1686
|
// src/blocks/typography.tsx
|
|
1625
|
-
var
|
|
1626
|
-
var
|
|
1687
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1688
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1627
1689
|
var text = {
|
|
1628
1690
|
title: "Text",
|
|
1629
1691
|
description: "Just start typing with plain text.",
|
|
1630
1692
|
searchTerms: ["p", "paragraph"],
|
|
1631
|
-
icon: /* @__PURE__ */ (0,
|
|
1693
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Text, { className: "mly-h-4 mly-w-4" }),
|
|
1632
1694
|
command: ({ editor, range }) => {
|
|
1633
1695
|
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
1634
1696
|
}
|
|
@@ -1637,7 +1699,7 @@ var heading1 = {
|
|
|
1637
1699
|
title: "Heading 1",
|
|
1638
1700
|
description: "Big heading.",
|
|
1639
1701
|
searchTerms: ["title", "big", "large"],
|
|
1640
|
-
icon: /* @__PURE__ */ (0,
|
|
1702
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
1641
1703
|
command: ({ editor, range }) => {
|
|
1642
1704
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
1643
1705
|
}
|
|
@@ -1646,7 +1708,7 @@ var heading2 = {
|
|
|
1646
1708
|
title: "Heading 2",
|
|
1647
1709
|
description: "Medium heading.",
|
|
1648
1710
|
searchTerms: ["subtitle", "medium"],
|
|
1649
|
-
icon: /* @__PURE__ */ (0,
|
|
1711
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Heading2, { className: "mly-h-4 mly-w-4" }),
|
|
1650
1712
|
command: ({ editor, range }) => {
|
|
1651
1713
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
1652
1714
|
}
|
|
@@ -1655,7 +1717,7 @@ var heading3 = {
|
|
|
1655
1717
|
title: "Heading 3",
|
|
1656
1718
|
description: "Small heading.",
|
|
1657
1719
|
searchTerms: ["subtitle", "small"],
|
|
1658
|
-
icon: /* @__PURE__ */ (0,
|
|
1720
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Heading3, { className: "mly-h-4 mly-w-4" }),
|
|
1659
1721
|
command: ({ editor, range }) => {
|
|
1660
1722
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
1661
1723
|
}
|
|
@@ -1664,7 +1726,7 @@ var hardBreak = {
|
|
|
1664
1726
|
title: "Hard Break",
|
|
1665
1727
|
description: "Add a break between lines.",
|
|
1666
1728
|
searchTerms: ["break", "line"],
|
|
1667
|
-
icon: /* @__PURE__ */ (0,
|
|
1729
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.DivideIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1668
1730
|
command: ({ editor, range }) => {
|
|
1669
1731
|
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
1670
1732
|
}
|
|
@@ -1673,7 +1735,7 @@ var blockquote = {
|
|
|
1673
1735
|
title: "Blockquote",
|
|
1674
1736
|
description: "Add blockquote.",
|
|
1675
1737
|
searchTerms: ["quote", "blockquote"],
|
|
1676
|
-
icon: /* @__PURE__ */ (0,
|
|
1738
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.TextQuote, { className: "mly-h-4 mly-w-4" }),
|
|
1677
1739
|
command: ({ editor, range }) => {
|
|
1678
1740
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
1679
1741
|
}
|
|
@@ -1682,7 +1744,7 @@ var footer = {
|
|
|
1682
1744
|
title: "Footer",
|
|
1683
1745
|
description: "Add a footer text to email.",
|
|
1684
1746
|
searchTerms: ["footer", "text"],
|
|
1685
|
-
icon: /* @__PURE__ */ (0,
|
|
1747
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1686
1748
|
command: ({ editor, range }) => {
|
|
1687
1749
|
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
1688
1750
|
}
|
|
@@ -1691,114 +1753,748 @@ var clearLine = {
|
|
|
1691
1753
|
title: "Clear Line",
|
|
1692
1754
|
description: "Clear the current line.",
|
|
1693
1755
|
searchTerms: ["clear", "line"],
|
|
1694
|
-
icon: /* @__PURE__ */ (0,
|
|
1756
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.EraserIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1695
1757
|
command: ({ editor, range }) => {
|
|
1696
1758
|
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
1697
1759
|
}
|
|
1698
1760
|
};
|
|
1699
1761
|
|
|
1700
|
-
// src/editor/
|
|
1762
|
+
// src/editor/components/icons/logo-with-cover-image.tsx
|
|
1763
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1764
|
+
function LogoWithCoverImageIcon(props) {
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1766
|
+
"svg",
|
|
1767
|
+
__spreadProps(__spreadValues({
|
|
1768
|
+
width: "14",
|
|
1769
|
+
height: "14",
|
|
1770
|
+
viewBox: "0 0 14 14",
|
|
1771
|
+
fill: "none",
|
|
1772
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1773
|
+
}, props), {
|
|
1774
|
+
children: [
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1776
|
+
"path",
|
|
1777
|
+
{
|
|
1778
|
+
fillRule: "evenodd",
|
|
1779
|
+
clipRule: "evenodd",
|
|
1780
|
+
d: "M4.97634 1.4502H9.02405C9.70389 1.4502 10.2476 1.45019 10.687 1.48609C11.1379 1.52293 11.527 1.6003 11.8849 1.78263C12.4588 2.07504 12.9254 2.54164 13.2178 3.11553C13.4001 3.47338 13.4775 3.86253 13.5143 4.31342C13.5502 4.75277 13.5502 5.29652 13.5502 5.97637V8.02403C13.5502 8.70388 13.5502 9.24763 13.5143 9.68698C13.4775 10.1379 13.4001 10.527 13.2178 10.8849C12.9254 11.4588 12.4588 11.9254 11.8849 12.2178C11.527 12.4001 11.1379 12.4775 10.687 12.5143C10.2476 12.5502 9.70387 12.5502 9.02402 12.5502H4.97636C4.29651 12.5502 3.75276 12.5502 3.31341 12.5143C2.86252 12.4775 2.47337 12.4001 2.11552 12.2178C1.54163 11.9254 1.07504 11.4588 0.782626 10.8849C0.600293 10.527 0.522922 10.1379 0.486083 9.68698C0.450187 9.24764 0.45019 8.70389 0.450195 8.02405V5.97635C0.45019 5.29651 0.450187 4.75276 0.486083 4.31342C0.522922 3.86253 0.600293 3.47338 0.782626 3.11553C1.07504 2.54164 1.54163 2.07504 2.11552 1.78263C2.47337 1.6003 2.86252 1.52293 3.31341 1.48609C3.75276 1.45019 4.2965 1.4502 4.97634 1.4502ZM3.40298 2.58243C3.02012 2.61372 2.79184 2.67259 2.61491 2.76274C2.248 2.94969 1.94968 3.248 1.76273 3.61492C1.67258 3.79185 1.61371 4.02013 1.58243 4.40299C1.55062 4.79228 1.55019 5.29106 1.55019 6.0002V8.0002C1.55019 8.70934 1.55062 9.20812 1.58243 9.59741C1.61371 9.98028 1.67258 10.2086 1.76273 10.3855C1.94968 10.7524 2.248 11.0507 2.61491 11.2377C2.79184 11.3278 3.02012 11.3867 3.40298 11.418C3.79227 11.4498 4.29105 11.4502 5.00019 11.4502H9.00019C9.70933 11.4502 10.2081 11.4498 10.5974 11.418C10.9803 11.3867 11.2086 11.3278 11.3855 11.2377C11.7524 11.0507 12.0507 10.7524 12.2377 10.3855C12.3278 10.2086 12.3867 9.98028 12.418 9.59741C12.4498 9.20812 12.4502 8.70934 12.4502 8.0002V6.0002C12.4502 5.29106 12.4498 4.79228 12.418 4.40299C12.3867 4.02013 12.3278 3.79185 12.2377 3.61492C12.0507 3.248 11.7524 2.94969 11.3855 2.76274C11.2086 2.67259 10.9803 2.61372 10.5974 2.58243C10.2081 2.55063 9.70933 2.5502 9.00019 2.5502H5.00019C4.29105 2.5502 3.79227 2.55063 3.40298 2.58243Z",
|
|
1781
|
+
fill: "currentColor"
|
|
1782
|
+
}
|
|
1783
|
+
),
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1785
|
+
"path",
|
|
1786
|
+
{
|
|
1787
|
+
fillRule: "evenodd",
|
|
1788
|
+
clipRule: "evenodd",
|
|
1789
|
+
d: "M4.1999 0.450195C4.50366 0.450195 4.7499 0.696438 4.7499 1.00019V2.75019C4.7499 3.05395 4.50366 3.30019 4.1999 3.30019C3.89614 3.30019 3.6499 3.05395 3.6499 2.75019V1.00019C3.6499 0.696438 3.89614 0.450195 4.1999 0.450195Z",
|
|
1790
|
+
fill: "currentColor"
|
|
1791
|
+
}
|
|
1792
|
+
),
|
|
1793
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1794
|
+
"path",
|
|
1795
|
+
{
|
|
1796
|
+
fillRule: "evenodd",
|
|
1797
|
+
clipRule: "evenodd",
|
|
1798
|
+
d: "M9.8 0.450195C10.1037 0.450195 10.35 0.696438 10.35 1.00019V2.75019C10.35 3.05395 10.1037 3.30019 9.8 3.30019C9.49625 3.30019 9.25 3.05395 9.25 2.75019V1.00019C9.25 0.696438 9.49625 0.450195 9.8 0.450195Z",
|
|
1799
|
+
fill: "currentColor"
|
|
1800
|
+
}
|
|
1801
|
+
),
|
|
1802
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("mask", { id: "path-4-inside-1_1046_19527", fill: "white", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "3", y: "4", width: "8", height: "3", rx: "0.5" }) }),
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1804
|
+
"rect",
|
|
1805
|
+
{
|
|
1806
|
+
x: "3",
|
|
1807
|
+
y: "4",
|
|
1808
|
+
width: "8",
|
|
1809
|
+
height: "3",
|
|
1810
|
+
rx: "0.5",
|
|
1811
|
+
stroke: "black",
|
|
1812
|
+
strokeWidth: "2",
|
|
1813
|
+
mask: "url(#path-4-inside-1_1046_19527)"
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1817
|
+
"rect",
|
|
1818
|
+
{
|
|
1819
|
+
x: "6.25",
|
|
1820
|
+
y: "8.25",
|
|
1821
|
+
width: "4.5",
|
|
1822
|
+
height: "0.5",
|
|
1823
|
+
rx: "0.25",
|
|
1824
|
+
stroke: "black",
|
|
1825
|
+
strokeWidth: "0.5"
|
|
1826
|
+
}
|
|
1827
|
+
),
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "3", y: "8", width: "2", height: "1", rx: "0.5", fill: "currentColor" })
|
|
1829
|
+
]
|
|
1830
|
+
})
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// src/editor/components/icons/logo-with-text-horizon.tsx
|
|
1835
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1836
|
+
function LogoWithTextHorizonIcon(props) {
|
|
1837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1838
|
+
"svg",
|
|
1839
|
+
__spreadProps(__spreadValues({
|
|
1840
|
+
width: "14",
|
|
1841
|
+
height: "14",
|
|
1842
|
+
viewBox: "0 0 14 14",
|
|
1843
|
+
fill: "none",
|
|
1844
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1845
|
+
}, props), {
|
|
1846
|
+
children: [
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1848
|
+
"path",
|
|
1849
|
+
{
|
|
1850
|
+
fillRule: "evenodd",
|
|
1851
|
+
clipRule: "evenodd",
|
|
1852
|
+
d: "M4.97634 1.4502H9.02405C9.70389 1.4502 10.2476 1.45019 10.687 1.48609C11.1379 1.52293 11.527 1.6003 11.8849 1.78263C12.4588 2.07504 12.9254 2.54164 13.2178 3.11553C13.4001 3.47338 13.4775 3.86253 13.5143 4.31342C13.5502 4.75277 13.5502 5.29652 13.5502 5.97637V8.02403C13.5502 8.70388 13.5502 9.24763 13.5143 9.68698C13.4775 10.1379 13.4001 10.527 13.2178 10.8849C12.9254 11.4588 12.4588 11.9254 11.8849 12.2178C11.527 12.4001 11.1379 12.4775 10.687 12.5143C10.2476 12.5502 9.70387 12.5502 9.02402 12.5502H4.97636C4.29651 12.5502 3.75276 12.5502 3.31341 12.5143C2.86252 12.4775 2.47337 12.4001 2.11552 12.2178C1.54163 11.9254 1.07504 11.4588 0.782626 10.8849C0.600293 10.527 0.522922 10.1379 0.486083 9.68698C0.450187 9.24764 0.45019 8.70389 0.450195 8.02405V5.97635C0.45019 5.29651 0.450187 4.75276 0.486083 4.31342C0.522922 3.86253 0.600293 3.47338 0.782626 3.11553C1.07504 2.54164 1.54163 2.07504 2.11552 1.78263C2.47337 1.6003 2.86252 1.52293 3.31341 1.48609C3.75276 1.45019 4.2965 1.4502 4.97634 1.4502ZM3.40298 2.58243C3.02012 2.61372 2.79184 2.67259 2.61491 2.76274C2.248 2.94969 1.94968 3.248 1.76273 3.61492C1.67258 3.79185 1.61371 4.02013 1.58243 4.40299C1.55062 4.79228 1.55019 5.29106 1.55019 6.0002V8.0002C1.55019 8.70934 1.55062 9.20812 1.58243 9.59741C1.61371 9.98028 1.67258 10.2086 1.76273 10.3855C1.94968 10.7524 2.248 11.0507 2.61491 11.2377C2.79184 11.3278 3.02012 11.3867 3.40298 11.418C3.79227 11.4498 4.29105 11.4502 5.00019 11.4502H9.00019C9.70933 11.4502 10.2081 11.4498 10.5974 11.418C10.9803 11.3867 11.2086 11.3278 11.3855 11.2377C11.7524 11.0507 12.0507 10.7524 12.2377 10.3855C12.3278 10.2086 12.3867 9.98028 12.418 9.59741C12.4498 9.20812 12.4502 8.70934 12.4502 8.0002V6.0002C12.4502 5.29106 12.4498 4.79228 12.418 4.40299C12.3867 4.02013 12.3278 3.79185 12.2377 3.61492C12.0507 3.248 11.7524 2.94969 11.3855 2.76274C11.2086 2.67259 10.9803 2.61372 10.5974 2.58243C10.2081 2.55063 9.70933 2.5502 9.00019 2.5502H5.00019C4.29105 2.5502 3.79227 2.55063 3.40298 2.58243Z",
|
|
1853
|
+
fill: "currentColor"
|
|
1854
|
+
}
|
|
1855
|
+
),
|
|
1856
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1857
|
+
"rect",
|
|
1858
|
+
{
|
|
1859
|
+
x: "6.25",
|
|
1860
|
+
y: "6.75",
|
|
1861
|
+
width: "4.5",
|
|
1862
|
+
height: "0.5",
|
|
1863
|
+
rx: "0.25",
|
|
1864
|
+
stroke: "black",
|
|
1865
|
+
strokeWidth: "0.5"
|
|
1866
|
+
}
|
|
1867
|
+
),
|
|
1868
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "3", y: "6.5", width: "2", height: "1", rx: "0.5", fill: "currentColor" }),
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1870
|
+
"path",
|
|
1871
|
+
{
|
|
1872
|
+
fillRule: "evenodd",
|
|
1873
|
+
clipRule: "evenodd",
|
|
1874
|
+
d: "M4.1999 0.450195C4.50366 0.450195 4.7499 0.696438 4.7499 1.00019V2.75019C4.7499 3.05395 4.50366 3.30019 4.1999 3.30019C3.89614 3.30019 3.6499 3.05395 3.6499 2.75019V1.00019C3.6499 0.696438 3.89614 0.450195 4.1999 0.450195Z",
|
|
1875
|
+
fill: "currentColor"
|
|
1876
|
+
}
|
|
1877
|
+
),
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1879
|
+
"path",
|
|
1880
|
+
{
|
|
1881
|
+
fillRule: "evenodd",
|
|
1882
|
+
clipRule: "evenodd",
|
|
1883
|
+
d: "M9.8 0.450195C10.1037 0.450195 10.35 0.696438 10.35 1.00019V2.75019C10.35 3.05395 10.1037 3.30019 9.8 3.30019C9.49625 3.30019 9.25 3.05395 9.25 2.75019V1.00019C9.25 0.696438 9.49625 0.450195 9.8 0.450195Z",
|
|
1884
|
+
fill: "currentColor"
|
|
1885
|
+
}
|
|
1886
|
+
)
|
|
1887
|
+
]
|
|
1888
|
+
})
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
// src/editor/components/icons/logo-with-text-vertical.tsx
|
|
1893
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1894
|
+
function LogoWithTextVerticalIcon(props) {
|
|
1895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1896
|
+
"svg",
|
|
1897
|
+
__spreadProps(__spreadValues({
|
|
1898
|
+
width: "14",
|
|
1899
|
+
height: "14",
|
|
1900
|
+
viewBox: "0 0 14 14",
|
|
1901
|
+
fill: "none",
|
|
1902
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1903
|
+
}, props), {
|
|
1904
|
+
children: [
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1906
|
+
"path",
|
|
1907
|
+
{
|
|
1908
|
+
fillRule: "evenodd",
|
|
1909
|
+
clipRule: "evenodd",
|
|
1910
|
+
d: "M4.97634 1.4502H9.02405C9.70389 1.4502 10.2476 1.45019 10.687 1.48609C11.1379 1.52293 11.527 1.6003 11.8849 1.78263C12.4588 2.07504 12.9254 2.54164 13.2178 3.11553C13.4001 3.47338 13.4775 3.86253 13.5143 4.31342C13.5502 4.75277 13.5502 5.29652 13.5502 5.97637V8.02403C13.5502 8.70388 13.5502 9.24763 13.5143 9.68698C13.4775 10.1379 13.4001 10.527 13.2178 10.8849C12.9254 11.4588 12.4588 11.9254 11.8849 12.2178C11.527 12.4001 11.1379 12.4775 10.687 12.5143C10.2476 12.5502 9.70387 12.5502 9.02402 12.5502H4.97636C4.29651 12.5502 3.75276 12.5502 3.31341 12.5143C2.86252 12.4775 2.47337 12.4001 2.11552 12.2178C1.54163 11.9254 1.07504 11.4588 0.782626 10.8849C0.600293 10.527 0.522922 10.1379 0.486083 9.68698C0.450187 9.24764 0.45019 8.70389 0.450195 8.02405V5.97635C0.45019 5.29651 0.450187 4.75276 0.486083 4.31342C0.522922 3.86253 0.600293 3.47338 0.782626 3.11553C1.07504 2.54164 1.54163 2.07504 2.11552 1.78263C2.47337 1.6003 2.86252 1.52293 3.31341 1.48609C3.75276 1.45019 4.2965 1.4502 4.97634 1.4502ZM3.40298 2.58243C3.02012 2.61372 2.79184 2.67259 2.61491 2.76274C2.248 2.94969 1.94968 3.248 1.76273 3.61492C1.67258 3.79185 1.61371 4.02013 1.58243 4.40299C1.55062 4.79228 1.55019 5.29106 1.55019 6.0002V8.0002C1.55019 8.70934 1.55062 9.20812 1.58243 9.59741C1.61371 9.98028 1.67258 10.2086 1.76273 10.3855C1.94968 10.7524 2.248 11.0507 2.61491 11.2377C2.79184 11.3278 3.02012 11.3867 3.40298 11.418C3.79227 11.4498 4.29105 11.4502 5.00019 11.4502H9.00019C9.70933 11.4502 10.2081 11.4498 10.5974 11.418C10.9803 11.3867 11.2086 11.3278 11.3855 11.2377C11.7524 11.0507 12.0507 10.7524 12.2377 10.3855C12.3278 10.2086 12.3867 9.98028 12.418 9.59741C12.4498 9.20812 12.4502 8.70934 12.4502 8.0002V6.0002C12.4502 5.29106 12.4498 4.79228 12.418 4.40299C12.3867 4.02013 12.3278 3.79185 12.2377 3.61492C12.0507 3.248 11.7524 2.94969 11.3855 2.76274C11.2086 2.67259 10.9803 2.61372 10.5974 2.58243C10.2081 2.55063 9.70933 2.5502 9.00019 2.5502H5.00019C4.29105 2.5502 3.79227 2.55063 3.40298 2.58243Z",
|
|
1911
|
+
fill: "currentColor"
|
|
1912
|
+
}
|
|
1913
|
+
),
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1915
|
+
"rect",
|
|
1916
|
+
{
|
|
1917
|
+
x: "4.25",
|
|
1918
|
+
y: "8.25",
|
|
1919
|
+
width: "5.5",
|
|
1920
|
+
height: "0.5",
|
|
1921
|
+
rx: "0.25",
|
|
1922
|
+
stroke: "black",
|
|
1923
|
+
strokeWidth: "0.5"
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "6", y: "6", width: "2", height: "1", rx: "0.5", fill: "currentColor" }),
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1928
|
+
"path",
|
|
1929
|
+
{
|
|
1930
|
+
fillRule: "evenodd",
|
|
1931
|
+
clipRule: "evenodd",
|
|
1932
|
+
d: "M4.1999 0.450195C4.50366 0.450195 4.7499 0.696438 4.7499 1.00019V2.75019C4.7499 3.05395 4.50366 3.30019 4.1999 3.30019C3.89614 3.30019 3.6499 3.05395 3.6499 2.75019V1.00019C3.6499 0.696438 3.89614 0.450195 4.1999 0.450195Z",
|
|
1933
|
+
fill: "currentColor"
|
|
1934
|
+
}
|
|
1935
|
+
),
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1937
|
+
"path",
|
|
1938
|
+
{
|
|
1939
|
+
fillRule: "evenodd",
|
|
1940
|
+
clipRule: "evenodd",
|
|
1941
|
+
d: "M9.8 0.450195C10.1037 0.450195 10.35 0.696438 10.35 1.00019V2.75019C10.35 3.05395 10.1037 3.30019 9.8 3.30019C9.49625 3.30019 9.25 3.05395 9.25 2.75019V1.00019C9.25 0.696438 9.49625 0.450195 9.8 0.450195Z",
|
|
1942
|
+
fill: "currentColor"
|
|
1943
|
+
}
|
|
1944
|
+
)
|
|
1945
|
+
]
|
|
1946
|
+
})
|
|
1947
|
+
);
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
// src/blocks/headers.tsx
|
|
1951
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1952
|
+
var headerLogoWithTextHorizontal = {
|
|
1953
|
+
title: "Logo with Text (Horizontal)",
|
|
1954
|
+
description: "Logo and a text horizontally",
|
|
1955
|
+
searchTerms: ["logo", "text"],
|
|
1956
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LogoWithTextHorizonIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1957
|
+
command: ({ editor, range }) => {
|
|
1958
|
+
editor.chain().deleteRange(range).insertContent({
|
|
1959
|
+
type: "columns",
|
|
1960
|
+
attrs: { showIfKey: null, gap: 8 },
|
|
1961
|
+
content: [
|
|
1962
|
+
{
|
|
1963
|
+
type: "column",
|
|
1964
|
+
attrs: {
|
|
1965
|
+
columnId: "36de3eda-0677-47c3-a8b7-e071dec9ce30",
|
|
1966
|
+
width: "auto",
|
|
1967
|
+
verticalAlign: "middle"
|
|
1968
|
+
},
|
|
1969
|
+
content: [
|
|
1970
|
+
{
|
|
1971
|
+
type: "image",
|
|
1972
|
+
attrs: {
|
|
1973
|
+
src: "https://maily.to/brand/logo.png",
|
|
1974
|
+
alt: null,
|
|
1975
|
+
title: null,
|
|
1976
|
+
width: "32",
|
|
1977
|
+
height: "32",
|
|
1978
|
+
alignment: "left",
|
|
1979
|
+
externalLink: null,
|
|
1980
|
+
isExternalLinkVariable: false,
|
|
1981
|
+
isSrcVariable: false,
|
|
1982
|
+
showIfKey: null
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
]
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
type: "column",
|
|
1989
|
+
attrs: {
|
|
1990
|
+
columnId: "6feb593e-374a-4479-a1c7-872c60c2f4e0",
|
|
1991
|
+
width: "auto",
|
|
1992
|
+
verticalAlign: "bottom"
|
|
1993
|
+
},
|
|
1994
|
+
content: [
|
|
1995
|
+
{
|
|
1996
|
+
type: "heading",
|
|
1997
|
+
attrs: {
|
|
1998
|
+
textAlign: "right",
|
|
1999
|
+
level: 3,
|
|
2000
|
+
showIfKey: null
|
|
2001
|
+
},
|
|
2002
|
+
content: [
|
|
2003
|
+
{
|
|
2004
|
+
type: "text",
|
|
2005
|
+
marks: [{ type: "bold" }],
|
|
2006
|
+
text: "Weekly Newsletter"
|
|
2007
|
+
}
|
|
2008
|
+
]
|
|
2009
|
+
}
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
]
|
|
2013
|
+
}).run();
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
var headerLogoWithTextVertical = {
|
|
2017
|
+
title: "Logo with Text (Vertical)",
|
|
2018
|
+
description: "Logo and a text vertically",
|
|
2019
|
+
searchTerms: ["logo", "text"],
|
|
2020
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LogoWithTextVerticalIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2021
|
+
command: ({ editor, range }) => {
|
|
2022
|
+
editor.chain().deleteRange(range).insertContent([
|
|
2023
|
+
{
|
|
2024
|
+
type: "image",
|
|
2025
|
+
attrs: {
|
|
2026
|
+
src: "https://maily.to/brand/logo.png",
|
|
2027
|
+
alt: null,
|
|
2028
|
+
title: null,
|
|
2029
|
+
width: "48",
|
|
2030
|
+
height: "48",
|
|
2031
|
+
alignment: "center",
|
|
2032
|
+
externalLink: null,
|
|
2033
|
+
isExternalLinkVariable: false,
|
|
2034
|
+
isSrcVariable: false,
|
|
2035
|
+
showIfKey: null
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
2038
|
+
{ type: "spacer", attrs: { height: 8, showIfKey: null } },
|
|
2039
|
+
{
|
|
2040
|
+
type: "heading",
|
|
2041
|
+
attrs: { textAlign: "center", level: 2, showIfKey: null },
|
|
2042
|
+
content: [{ type: "text", text: "Maily" }]
|
|
2043
|
+
}
|
|
2044
|
+
]).run();
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
var headerLogoWithCoverImage = {
|
|
2048
|
+
title: "Logo with Cover Image",
|
|
2049
|
+
description: "Logo and a cover image",
|
|
2050
|
+
searchTerms: ["logo", "cover", "image"],
|
|
2051
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LogoWithCoverImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2052
|
+
command: ({ editor, range }) => {
|
|
2053
|
+
const todayFormatted = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
2054
|
+
year: "numeric",
|
|
2055
|
+
month: "short",
|
|
2056
|
+
day: "numeric"
|
|
2057
|
+
});
|
|
2058
|
+
editor.chain().deleteRange(range).insertContent([
|
|
2059
|
+
{
|
|
2060
|
+
type: "image",
|
|
2061
|
+
attrs: {
|
|
2062
|
+
src: "https://maily.to/og-image.png",
|
|
2063
|
+
alt: null,
|
|
2064
|
+
title: null,
|
|
2065
|
+
width: 600,
|
|
2066
|
+
height: 314,
|
|
2067
|
+
alignment: "center",
|
|
2068
|
+
externalLink: null,
|
|
2069
|
+
isExternalLinkVariable: false,
|
|
2070
|
+
isSrcVariable: false,
|
|
2071
|
+
showIfKey: null
|
|
2072
|
+
}
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
type: "columns",
|
|
2076
|
+
attrs: { showIfKey: null, gap: 8 },
|
|
2077
|
+
content: [
|
|
2078
|
+
{
|
|
2079
|
+
type: "column",
|
|
2080
|
+
attrs: {
|
|
2081
|
+
columnId: "36de3eda-0677-47c3-a8b7-e071dec9ce30",
|
|
2082
|
+
width: "auto",
|
|
2083
|
+
verticalAlign: "middle"
|
|
2084
|
+
},
|
|
2085
|
+
content: [
|
|
2086
|
+
{
|
|
2087
|
+
type: "image",
|
|
2088
|
+
attrs: {
|
|
2089
|
+
src: "https://maily.to/brand/logo.png",
|
|
2090
|
+
alt: null,
|
|
2091
|
+
title: null,
|
|
2092
|
+
width: "48",
|
|
2093
|
+
height: "48",
|
|
2094
|
+
alignment: "left",
|
|
2095
|
+
externalLink: null,
|
|
2096
|
+
isExternalLinkVariable: false,
|
|
2097
|
+
isSrcVariable: false,
|
|
2098
|
+
showIfKey: null
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
]
|
|
2102
|
+
},
|
|
2103
|
+
{
|
|
2104
|
+
type: "column",
|
|
2105
|
+
attrs: {
|
|
2106
|
+
columnId: "6feb593e-374a-4479-a1c7-872c60c2f4e0",
|
|
2107
|
+
width: "auto",
|
|
2108
|
+
verticalAlign: "middle"
|
|
2109
|
+
},
|
|
2110
|
+
content: [
|
|
2111
|
+
{
|
|
2112
|
+
type: "paragraph",
|
|
2113
|
+
attrs: { textAlign: "right", showIfKey: null },
|
|
2114
|
+
content: [
|
|
2115
|
+
{
|
|
2116
|
+
type: "text",
|
|
2117
|
+
marks: [{ type: "bold" }],
|
|
2118
|
+
text: "Weekly Newsletter"
|
|
2119
|
+
},
|
|
2120
|
+
{ type: "hardBreak" },
|
|
2121
|
+
{
|
|
2122
|
+
type: "text",
|
|
2123
|
+
marks: [
|
|
2124
|
+
{ type: "textStyle", attrs: { color: "#929292" } }
|
|
2125
|
+
],
|
|
2126
|
+
text: todayFormatted
|
|
2127
|
+
}
|
|
2128
|
+
]
|
|
2129
|
+
}
|
|
2130
|
+
]
|
|
2131
|
+
}
|
|
2132
|
+
]
|
|
2133
|
+
}
|
|
2134
|
+
]).run();
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
|
|
2138
|
+
// src/blocks/footers.tsx
|
|
2139
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2140
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2141
|
+
var footerCopyrightText = {
|
|
2142
|
+
title: "Footer Copyright",
|
|
2143
|
+
description: "Copyright text for the footer.",
|
|
2144
|
+
searchTerms: ["footer", "copyright"],
|
|
2145
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.CopyrightIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2146
|
+
command: ({ editor, range }) => {
|
|
2147
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2148
|
+
editor.chain().focus().deleteRange(range).insertContent({
|
|
2149
|
+
type: "paragraph",
|
|
2150
|
+
attrs: { textAlign: "center", showIfKey: null },
|
|
2151
|
+
content: [
|
|
2152
|
+
{
|
|
2153
|
+
type: "text",
|
|
2154
|
+
marks: [{ type: "textStyle", attrs: { color: "#AAAAAA" } }],
|
|
2155
|
+
text: `Maily \xA9 ${currentYear}. All rights reserved.`
|
|
2156
|
+
}
|
|
2157
|
+
]
|
|
2158
|
+
}).run();
|
|
2159
|
+
}
|
|
2160
|
+
};
|
|
2161
|
+
var footerCommunityFeedbackCta = {
|
|
2162
|
+
title: "Footer Community Feedback CTA",
|
|
2163
|
+
description: "Community feedback CTA for the footer.",
|
|
2164
|
+
searchTerms: ["footer", "community", "feedback", "cta"],
|
|
2165
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.RectangleHorizontalIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2166
|
+
command: ({ editor, range }) => {
|
|
2167
|
+
editor.chain().focus().deleteRange(range).insertContent([
|
|
2168
|
+
{
|
|
2169
|
+
type: "image",
|
|
2170
|
+
attrs: {
|
|
2171
|
+
src: "https://maily.to/brand/logo.png",
|
|
2172
|
+
alt: null,
|
|
2173
|
+
title: null,
|
|
2174
|
+
width: "42",
|
|
2175
|
+
height: "42",
|
|
2176
|
+
alignment: "left",
|
|
2177
|
+
externalLink: null,
|
|
2178
|
+
isExternalLinkVariable: false,
|
|
2179
|
+
isSrcVariable: false,
|
|
2180
|
+
showIfKey: null
|
|
2181
|
+
}
|
|
2182
|
+
},
|
|
2183
|
+
{ type: "spacer", attrs: { height: 16, showIfKey: null } },
|
|
2184
|
+
{
|
|
2185
|
+
type: "footer",
|
|
2186
|
+
attrs: { textAlign: null, "maily-component": "footer" },
|
|
2187
|
+
content: [
|
|
2188
|
+
{
|
|
2189
|
+
type: "text",
|
|
2190
|
+
marks: [{ type: "textStyle", attrs: { color: "" } }],
|
|
2191
|
+
text: "Enjoyed this month\u2019s update?"
|
|
2192
|
+
},
|
|
2193
|
+
{ type: "hardBreak" },
|
|
2194
|
+
{
|
|
2195
|
+
type: "text",
|
|
2196
|
+
marks: [{ type: "textStyle", attrs: { color: "" } }],
|
|
2197
|
+
text: "And, as always, we'd love your feedback \u2013 simply reply to the email or reach out via the Discord community!"
|
|
2198
|
+
}
|
|
2199
|
+
]
|
|
2200
|
+
}
|
|
2201
|
+
]).run();
|
|
2202
|
+
}
|
|
2203
|
+
};
|
|
2204
|
+
var footerCompanySignature = {
|
|
2205
|
+
title: "Footer Company Signature",
|
|
2206
|
+
description: "Company signature for the footer.",
|
|
2207
|
+
searchTerms: ["footer", "company", "signature"],
|
|
2208
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.LayoutTemplateIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2209
|
+
command: ({ editor, range }) => {
|
|
2210
|
+
editor.chain().focus().deleteRange(range).insertContent([
|
|
2211
|
+
{ type: "horizontalRule" },
|
|
2212
|
+
{
|
|
2213
|
+
type: "image",
|
|
2214
|
+
attrs: {
|
|
2215
|
+
src: "https://maily.to/brand/logo.png",
|
|
2216
|
+
alt: null,
|
|
2217
|
+
title: null,
|
|
2218
|
+
width: "48",
|
|
2219
|
+
height: "48",
|
|
2220
|
+
alignment: "center",
|
|
2221
|
+
externalLink: null,
|
|
2222
|
+
isExternalLinkVariable: false,
|
|
2223
|
+
isSrcVariable: false,
|
|
2224
|
+
showIfKey: null
|
|
2225
|
+
}
|
|
2226
|
+
},
|
|
2227
|
+
{ type: "spacer", attrs: { height: 16, showIfKey: null } },
|
|
2228
|
+
{
|
|
2229
|
+
type: "heading",
|
|
2230
|
+
attrs: { textAlign: "center", level: 3, showIfKey: null },
|
|
2231
|
+
content: [{ type: "text", text: "Maily" }]
|
|
2232
|
+
},
|
|
2233
|
+
{ type: "spacer", attrs: { height: 4, showIfKey: null } },
|
|
2234
|
+
{
|
|
2235
|
+
type: "footer",
|
|
2236
|
+
attrs: { textAlign: "center", "maily-component": "footer" },
|
|
2237
|
+
content: [
|
|
2238
|
+
{
|
|
2239
|
+
type: "text",
|
|
2240
|
+
marks: [{ type: "textStyle", attrs: { color: "" } }],
|
|
2241
|
+
text: "1234 Example Street, Example, DE 19801, United States"
|
|
2242
|
+
},
|
|
2243
|
+
{ type: "hardBreak" },
|
|
2244
|
+
{
|
|
2245
|
+
type: "text",
|
|
2246
|
+
marks: [
|
|
2247
|
+
{
|
|
2248
|
+
type: "link",
|
|
2249
|
+
attrs: {
|
|
2250
|
+
href: "https://maily.to",
|
|
2251
|
+
target: "_blank",
|
|
2252
|
+
rel: "noopener noreferrer nofollow",
|
|
2253
|
+
class: "mly-no-underline",
|
|
2254
|
+
isUrlVariable: false
|
|
2255
|
+
}
|
|
2256
|
+
},
|
|
2257
|
+
{ type: "textStyle", attrs: { color: "#64748b" } },
|
|
2258
|
+
{ type: "underline" }
|
|
2259
|
+
],
|
|
2260
|
+
text: "VISIT COMPANY"
|
|
2261
|
+
},
|
|
2262
|
+
{
|
|
2263
|
+
type: "text",
|
|
2264
|
+
marks: [{ type: "textStyle", attrs: { color: "#64748b" } }],
|
|
2265
|
+
text: " | "
|
|
2266
|
+
},
|
|
2267
|
+
{
|
|
2268
|
+
type: "text",
|
|
2269
|
+
marks: [
|
|
2270
|
+
{
|
|
2271
|
+
type: "link",
|
|
2272
|
+
attrs: {
|
|
2273
|
+
href: "https://maily.to",
|
|
2274
|
+
target: "_blank",
|
|
2275
|
+
rel: "noopener noreferrer nofollow",
|
|
2276
|
+
class: "mly-no-underline",
|
|
2277
|
+
isUrlVariable: false
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
{ type: "textStyle", attrs: { color: "#64748b" } },
|
|
2281
|
+
{ type: "underline" }
|
|
2282
|
+
],
|
|
2283
|
+
text: "VISIT OUR BLOG"
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
type: "text",
|
|
2287
|
+
marks: [{ type: "textStyle", attrs: { color: "#64748b" } }],
|
|
2288
|
+
text: " | "
|
|
2289
|
+
},
|
|
2290
|
+
{
|
|
2291
|
+
type: "text",
|
|
2292
|
+
marks: [
|
|
2293
|
+
{
|
|
2294
|
+
type: "link",
|
|
2295
|
+
attrs: {
|
|
2296
|
+
href: "https://maily.to",
|
|
2297
|
+
target: "_blank",
|
|
2298
|
+
rel: "noopener noreferrer nofollow",
|
|
2299
|
+
class: "mly-no-underline",
|
|
2300
|
+
isUrlVariable: false
|
|
2301
|
+
}
|
|
2302
|
+
},
|
|
2303
|
+
{ type: "textStyle", attrs: { color: "#64748b" } },
|
|
2304
|
+
{ type: "underline" }
|
|
2305
|
+
],
|
|
2306
|
+
text: "UNSUBSCRIBE"
|
|
2307
|
+
}
|
|
2308
|
+
]
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
type: "paragraph",
|
|
2312
|
+
attrs: { textAlign: "center", showIfKey: null },
|
|
2313
|
+
content: [
|
|
2314
|
+
{
|
|
2315
|
+
type: "inlineImage",
|
|
2316
|
+
attrs: {
|
|
2317
|
+
height: 20,
|
|
2318
|
+
width: 20,
|
|
2319
|
+
src: "https://cdn.usemaily.com/images/icons/linkedin.png",
|
|
2320
|
+
isSrcVariable: false,
|
|
2321
|
+
alt: null,
|
|
2322
|
+
title: null,
|
|
2323
|
+
externalLink: "https://www.linkedin.com/in/arikchakma/",
|
|
2324
|
+
isExternalLinkVariable: false
|
|
2325
|
+
}
|
|
2326
|
+
},
|
|
2327
|
+
{ type: "text", text: " " },
|
|
2328
|
+
{
|
|
2329
|
+
type: "inlineImage",
|
|
2330
|
+
attrs: {
|
|
2331
|
+
height: 20,
|
|
2332
|
+
width: 20,
|
|
2333
|
+
src: "https://cdn.usemaily.com/images/icons/youtube.png",
|
|
2334
|
+
isSrcVariable: false,
|
|
2335
|
+
alt: null,
|
|
2336
|
+
title: null,
|
|
2337
|
+
externalLink: "https://www.youtube.com/arikchakma",
|
|
2338
|
+
isExternalLinkVariable: false
|
|
2339
|
+
}
|
|
2340
|
+
},
|
|
2341
|
+
{ type: "text", text: " " },
|
|
2342
|
+
{
|
|
2343
|
+
type: "inlineImage",
|
|
2344
|
+
attrs: {
|
|
2345
|
+
height: 20,
|
|
2346
|
+
width: 20,
|
|
2347
|
+
src: "https://cdn.usemaily.com/images/icons/twitter.png",
|
|
2348
|
+
isSrcVariable: false,
|
|
2349
|
+
alt: null,
|
|
2350
|
+
title: null,
|
|
2351
|
+
externalLink: "https://x.com/imarikchakma",
|
|
2352
|
+
isExternalLinkVariable: false
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
]
|
|
2356
|
+
}
|
|
2357
|
+
]).run();
|
|
2358
|
+
}
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
// src/editor/extensions/slash-command/default-slash-commands.tsx
|
|
2362
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1701
2363
|
var DEFAULT_SLASH_COMMANDS = [
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
2364
|
+
{
|
|
2365
|
+
title: "Blocks",
|
|
2366
|
+
commands: [
|
|
2367
|
+
text,
|
|
2368
|
+
heading1,
|
|
2369
|
+
heading2,
|
|
2370
|
+
heading3,
|
|
2371
|
+
bulletList,
|
|
2372
|
+
orderedList,
|
|
2373
|
+
image,
|
|
2374
|
+
logo,
|
|
2375
|
+
inlineImage,
|
|
2376
|
+
columns,
|
|
2377
|
+
section,
|
|
2378
|
+
repeat,
|
|
2379
|
+
divider,
|
|
2380
|
+
spacer,
|
|
2381
|
+
button,
|
|
2382
|
+
linkCard,
|
|
2383
|
+
hardBreak,
|
|
2384
|
+
blockquote,
|
|
2385
|
+
footer,
|
|
2386
|
+
clearLine
|
|
2387
|
+
]
|
|
2388
|
+
},
|
|
2389
|
+
{
|
|
2390
|
+
title: "Components",
|
|
2391
|
+
commands: [
|
|
2392
|
+
{
|
|
2393
|
+
id: "headers",
|
|
2394
|
+
title: "Headers",
|
|
2395
|
+
description: "Add pre-designed headers block",
|
|
2396
|
+
searchTerms: ["header", "headers"],
|
|
2397
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
2398
|
+
preview: "https://cdn.usemaily.com/previews/header-preview-xyz.png",
|
|
2399
|
+
commands: [
|
|
2400
|
+
headerLogoWithTextVertical,
|
|
2401
|
+
headerLogoWithTextHorizontal,
|
|
2402
|
+
headerLogoWithCoverImage
|
|
2403
|
+
]
|
|
2404
|
+
},
|
|
2405
|
+
{
|
|
2406
|
+
id: "footers",
|
|
2407
|
+
title: "Footers",
|
|
2408
|
+
description: "Add pre-designed footers block",
|
|
2409
|
+
searchTerms: ["footers"],
|
|
2410
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2411
|
+
commands: [
|
|
2412
|
+
footerCopyrightText,
|
|
2413
|
+
footerCommunityFeedbackCta,
|
|
2414
|
+
footerCompanySignature
|
|
2415
|
+
]
|
|
2416
|
+
},
|
|
2417
|
+
htmlCodeBlock
|
|
2418
|
+
]
|
|
2419
|
+
}
|
|
1721
2420
|
];
|
|
1722
2421
|
|
|
1723
2422
|
// src/editor/nodes/variable/variable-view.tsx
|
|
1724
2423
|
var import_react3 = require("@tiptap/react");
|
|
1725
|
-
var
|
|
1726
|
-
var
|
|
2424
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2425
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1727
2426
|
function VariableView(props) {
|
|
1728
2427
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
1729
2428
|
const { id, fallback, required } = node.attrs;
|
|
1730
2429
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
1731
|
-
return /* @__PURE__ */ (0,
|
|
2430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1732
2431
|
import_react3.NodeViewWrapper,
|
|
1733
2432
|
{
|
|
1734
2433
|
className: "react-component mly-inline-block mly-leading-none",
|
|
1735
2434
|
draggable: "false",
|
|
1736
|
-
children: /* @__PURE__ */ (0,
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
{
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
},
|
|
1746
|
-
children: renderVariable({
|
|
2435
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2436
|
+
Popover,
|
|
2437
|
+
{
|
|
2438
|
+
onOpenChange: (open) => {
|
|
2439
|
+
editor.storage.variable.popover = open;
|
|
2440
|
+
},
|
|
2441
|
+
children: [
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PopoverTrigger, { children: renderVariable({
|
|
1747
2443
|
variable: { name: id, required, valid: true },
|
|
1748
2444
|
fallback,
|
|
1749
2445
|
editor,
|
|
1750
2446
|
from: "content-variable"
|
|
1751
|
-
})
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
})
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
2447
|
+
}) }),
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2449
|
+
PopoverContent,
|
|
2450
|
+
{
|
|
2451
|
+
align: "start",
|
|
2452
|
+
side: "bottom",
|
|
2453
|
+
className: "mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
2454
|
+
sideOffset: 8,
|
|
2455
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2456
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
2458
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "mly-relative", children: [
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-inline-block mly-px-2 mly-text-xs mly-text-midnight-gray", children: "Variable" }),
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2461
|
+
"input",
|
|
2462
|
+
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2463
|
+
value: id != null ? id : "",
|
|
2464
|
+
onChange: (e) => {
|
|
2465
|
+
updateAttributes2({
|
|
2466
|
+
id: e.target.value
|
|
2467
|
+
});
|
|
2468
|
+
},
|
|
2469
|
+
placeholder: "ie. name...",
|
|
2470
|
+
className: "mly-h-7 mly-w-36 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
|
|
2471
|
+
})
|
|
2472
|
+
)
|
|
2473
|
+
] }),
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Divider, { className: "mly-mx-1.5" }),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "mly-relative", children: [
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2478
|
+
"input",
|
|
2479
|
+
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2480
|
+
value: fallback != null ? fallback : "",
|
|
2481
|
+
onChange: (e) => {
|
|
2482
|
+
updateAttributes2({
|
|
2483
|
+
fallback: e.target.value
|
|
2484
|
+
});
|
|
2485
|
+
},
|
|
2486
|
+
placeholder: "ie. John Doe...",
|
|
2487
|
+
className: "mly-h-7 mly-w-32 mly-rounded-md mly-bg-soft-gray mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray focus:mly-bg-soft-gray focus:mly-outline-none"
|
|
2488
|
+
})
|
|
2489
|
+
),
|
|
2490
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
2491
|
+
] })
|
|
2492
|
+
] }) })
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
2495
|
+
]
|
|
2496
|
+
}
|
|
2497
|
+
)
|
|
1802
2498
|
}
|
|
1803
2499
|
);
|
|
1804
2500
|
}
|
|
@@ -1806,13 +2502,13 @@ var DefaultRenderVariable = (props) => {
|
|
|
1806
2502
|
const { variable, fallback, from } = props;
|
|
1807
2503
|
const { name, required, valid } = variable;
|
|
1808
2504
|
if (from === "button-variable") {
|
|
1809
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
2505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mly-inline-grid mly-h-7 mly-max-w-xs mly-grid-cols-[12px_1fr] mly-items-center mly-gap-1.5 mly-rounded-md mly-border mly-border-[var(--button-var-border-color)] mly-px-2 mly-font-mono mly-text-sm", children: [
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1812
2508
|
] });
|
|
1813
2509
|
}
|
|
1814
2510
|
if (from === "bubble-variable") {
|
|
1815
|
-
return /* @__PURE__ */ (0,
|
|
2511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1816
2512
|
"div",
|
|
1817
2513
|
{
|
|
1818
2514
|
className: cn(
|
|
@@ -1820,28 +2516,28 @@ var DefaultRenderVariable = (props) => {
|
|
|
1820
2516
|
!valid && "mly-border-rose-400 mly-bg-rose-50 mly-text-rose-600 hover:mly-bg-rose-100"
|
|
1821
2517
|
),
|
|
1822
2518
|
children: [
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
2519
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1825
2521
|
]
|
|
1826
2522
|
}
|
|
1827
2523
|
);
|
|
1828
2524
|
}
|
|
1829
|
-
return /* @__PURE__ */ (0,
|
|
2525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1830
2526
|
"span",
|
|
1831
2527
|
{
|
|
1832
2528
|
tabIndex: -1,
|
|
1833
2529
|
className: "mly-inline-flex mly-items-center mly-gap-[var(--variable-icon-gap)] mly-rounded-full mly-border mly-px-1.5 mly-py-0.5 mly-leading-none",
|
|
1834
2530
|
children: [
|
|
1835
|
-
/* @__PURE__ */ (0,
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Braces, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1836
2532
|
name,
|
|
1837
|
-
required && !fallback && /* @__PURE__ */ (0,
|
|
2533
|
+
required && !fallback && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.AlertTriangle, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5]" })
|
|
1838
2534
|
]
|
|
1839
2535
|
}
|
|
1840
2536
|
);
|
|
1841
2537
|
};
|
|
1842
2538
|
|
|
1843
2539
|
// src/editor/provider.tsx
|
|
1844
|
-
var
|
|
2540
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1845
2541
|
var DEFAULT_PLACEHOLDER_URL = "maily.to/";
|
|
1846
2542
|
var DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
|
|
1847
2543
|
var DEFAULT_VARIABLES = [];
|
|
@@ -1862,9 +2558,9 @@ function useMailyContext() {
|
|
|
1862
2558
|
}
|
|
1863
2559
|
|
|
1864
2560
|
// src/editor/nodes/variable/variable-popover.tsx
|
|
1865
|
-
var
|
|
2561
|
+
var import_lucide_react11 = require("lucide-react");
|
|
1866
2562
|
var import_react5 = require("react");
|
|
1867
|
-
var
|
|
2563
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1868
2564
|
var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
1869
2565
|
const { items, onSelectItem } = props;
|
|
1870
2566
|
const [selectedIndex, setSelectedIndex] = (0, import_react5.useState)(0);
|
|
@@ -1910,17 +2606,17 @@ var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
1910
2606
|
onSelectItem(item);
|
|
1911
2607
|
}
|
|
1912
2608
|
}));
|
|
1913
|
-
return /* @__PURE__ */ (0,
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
1915
|
-
/* @__PURE__ */ (0,
|
|
1916
|
-
/* @__PURE__ */ (0,
|
|
2609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mly-z-50 mly-w-64 mly-rounded-lg mly-border mly-border-gray-200 mly-bg-white mly-shadow-md mly-transition-all", children: [
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mly-flex mly-items-center mly-justify-between mly-gap-2 mly-border-b mly-border-gray-200 mly-bg-soft-gray/40 mly-px-1 mly-py-1.5 mly-text-gray-500", children: [
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mly-text-xs mly-uppercase", children: "Variables" }),
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.Braces, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
1917
2613
|
] }),
|
|
1918
|
-
/* @__PURE__ */ (0,
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1919
2615
|
"div",
|
|
1920
2616
|
{
|
|
1921
2617
|
ref: scrollContainerRef,
|
|
1922
2618
|
className: "mly-max-h-52 mly-overflow-y-auto mly-scrollbar-thin mly-scrollbar-track-transparent mly-scrollbar-thumb-gray-200",
|
|
1923
|
-
children: /* @__PURE__ */ (0,
|
|
2619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mly-flex mly-w-fit mly-min-w-full mly-flex-col mly-gap-0.5 mly-p-1", children: (items == null ? void 0 : items.length) ? items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1924
2620
|
"button",
|
|
1925
2621
|
{
|
|
1926
2622
|
ref: (el) => itemRefs.current[index] = el,
|
|
@@ -1930,27 +2626,27 @@ var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
1930
2626
|
index === selectedIndex ? "mly-bg-soft-gray" : "mly-bg-white"
|
|
1931
2627
|
),
|
|
1932
2628
|
children: [
|
|
1933
|
-
/* @__PURE__ */ (0,
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.Braces, { className: "mly-size-3 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1934
2630
|
item.name
|
|
1935
2631
|
]
|
|
1936
2632
|
},
|
|
1937
2633
|
index
|
|
1938
|
-
)) : /* @__PURE__ */ (0,
|
|
2634
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mly-flex mly-h-7 mly-w-full mly-items-center mly-gap-2 mly-rounded-md mly-px-2 mly-py-1 mly-text-left mly-font-mono mly-text-[13px] mly-text-gray-900 hover:mly-bg-soft-gray", children: "No result" }) })
|
|
1939
2635
|
}
|
|
1940
2636
|
),
|
|
1941
|
-
/* @__PURE__ */ (0,
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
1944
|
-
/* @__PURE__ */ (0,
|
|
1945
|
-
/* @__PURE__ */ (0,
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mly-flex mly-items-center mly-justify-between mly-gap-2 mly-border-t mly-border-gray-200 mly-px-1 mly-py-1.5 mly-text-gray-500", children: [
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1", children: [
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.ArrowDownIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.ArrowUpIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mly-text-xs mly-text-gray-500", children: "Navigate" })
|
|
1946
2642
|
] }),
|
|
1947
|
-
/* @__PURE__ */ (0,
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.CornerDownLeftIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
1948
2644
|
] })
|
|
1949
2645
|
] });
|
|
1950
2646
|
});
|
|
1951
2647
|
function VariableIcon(props) {
|
|
1952
2648
|
const { className, children } = props;
|
|
1953
|
-
return /* @__PURE__ */ (0,
|
|
2649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1954
2650
|
"div",
|
|
1955
2651
|
{
|
|
1956
2652
|
className: cn(
|
|
@@ -1985,9 +2681,9 @@ function useOutsideClick(ref, callback) {
|
|
|
1985
2681
|
}
|
|
1986
2682
|
|
|
1987
2683
|
// src/editor/components/ui/input-autocomplete.tsx
|
|
1988
|
-
var
|
|
2684
|
+
var import_lucide_react12 = require("lucide-react");
|
|
1989
2685
|
var import_react8 = require("react");
|
|
1990
|
-
var
|
|
2686
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1991
2687
|
var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
1992
2688
|
const _a = props, {
|
|
1993
2689
|
value = "",
|
|
@@ -2012,9 +2708,9 @@ var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
2012
2708
|
onOutsideClick == null ? void 0 : onOutsideClick();
|
|
2013
2709
|
});
|
|
2014
2710
|
const isTriggeringVariable = value.startsWith(triggerChar);
|
|
2015
|
-
return /* @__PURE__ */ (0,
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("mly-relative"), ref: containerRef, children: [
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "mly-relative", children: [
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2018
2714
|
"input",
|
|
2019
2715
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2020
2716
|
placeholder: "e.g. items",
|
|
@@ -2026,7 +2722,7 @@ var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
2026
2722
|
onValueChange(e.target.value);
|
|
2027
2723
|
},
|
|
2028
2724
|
className: cn(
|
|
2029
|
-
"mly-h-7 mly-w-40 mly-rounded-md mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray hover:mly-bg-soft-gray focus:mly-bg-soft-gray focus:mly-outline-none",
|
|
2725
|
+
"mly-h-7 mly-w-40 mly-rounded-md mly-bg-white mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray hover:mly-bg-soft-gray focus:mly-bg-soft-gray focus:mly-outline-none",
|
|
2030
2726
|
className
|
|
2031
2727
|
),
|
|
2032
2728
|
onKeyDown: (e) => {
|
|
@@ -2048,9 +2744,9 @@ var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
2048
2744
|
spellCheck: false
|
|
2049
2745
|
})
|
|
2050
2746
|
),
|
|
2051
|
-
/* @__PURE__ */ (0,
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react12.CornerDownLeft, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
2052
2748
|
] }),
|
|
2053
|
-
isTriggeringVariable && /* @__PURE__ */ (0,
|
|
2749
|
+
isTriggeringVariable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mly-absolute mly-left-0 mly-top-8", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2054
2750
|
VariablePopover,
|
|
2055
2751
|
{
|
|
2056
2752
|
items: autoCompleteOptions.map((option) => {
|
|
@@ -2092,7 +2788,7 @@ You can check out the documentation for more information: https://github.com/ari
|
|
|
2092
2788
|
|
|
2093
2789
|
// src/editor/components/ui/link-input-popover.tsx
|
|
2094
2790
|
var import_react10 = require("react");
|
|
2095
|
-
var
|
|
2791
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2096
2792
|
var LINK_PROTOCOL_REGEX = /https?:\/\//;
|
|
2097
2793
|
function LinkInputPopover(props) {
|
|
2098
2794
|
var _a;
|
|
@@ -2100,7 +2796,7 @@ function LinkInputPopover(props) {
|
|
|
2100
2796
|
defaultValue = "",
|
|
2101
2797
|
onValueChange,
|
|
2102
2798
|
tooltip,
|
|
2103
|
-
icon: Icon =
|
|
2799
|
+
icon: Icon = import_lucide_react13.Link,
|
|
2104
2800
|
editor,
|
|
2105
2801
|
isVariable
|
|
2106
2802
|
} = props;
|
|
@@ -2130,7 +2826,7 @@ function LinkInputPopover(props) {
|
|
|
2130
2826
|
editor
|
|
2131
2827
|
}).map((variable) => variable.name);
|
|
2132
2828
|
}, [variables, defaultUrlWithoutProtocol, editor]);
|
|
2133
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
2829
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2134
2830
|
BaseButton,
|
|
2135
2831
|
{
|
|
2136
2832
|
variant: "ghost",
|
|
@@ -2138,19 +2834,19 @@ function LinkInputPopover(props) {
|
|
|
2138
2834
|
type: "button",
|
|
2139
2835
|
className: "mly-size-7",
|
|
2140
2836
|
"data-state": !!defaultUrlWithoutProtocol,
|
|
2141
|
-
children: /* @__PURE__ */ (0,
|
|
2837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-midnight-gray" })
|
|
2142
2838
|
}
|
|
2143
2839
|
) });
|
|
2144
2840
|
const normalizeProtocol = (value, p = protocol) => {
|
|
2145
2841
|
value = value == null ? void 0 : value.replace(LINK_PROTOCOL_REGEX, "");
|
|
2146
2842
|
return p + value;
|
|
2147
2843
|
};
|
|
2148
|
-
return /* @__PURE__ */ (0,
|
|
2149
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2845
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Tooltip, { children: [
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2152
2848
|
] }) : popoverButton,
|
|
2153
|
-
/* @__PURE__ */ (0,
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2154
2850
|
PopoverContent,
|
|
2155
2851
|
{
|
|
2156
2852
|
align: "end",
|
|
@@ -2158,7 +2854,7 @@ function LinkInputPopover(props) {
|
|
|
2158
2854
|
className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
|
|
2159
2855
|
sideOffset: 8,
|
|
2160
2856
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2161
|
-
children: /* @__PURE__ */ (0,
|
|
2857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2162
2858
|
"form",
|
|
2163
2859
|
{
|
|
2164
2860
|
onSubmit: (e) => {
|
|
@@ -2171,8 +2867,8 @@ function LinkInputPopover(props) {
|
|
|
2171
2867
|
onValueChange == null ? void 0 : onValueChange(value);
|
|
2172
2868
|
setIsOpen(false);
|
|
2173
2869
|
},
|
|
2174
|
-
children: /* @__PURE__ */ (0,
|
|
2175
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
2870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
2871
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)(
|
|
2176
2872
|
"button",
|
|
2177
2873
|
{
|
|
2178
2874
|
onClick: () => {
|
|
@@ -2193,9 +2889,9 @@ function LinkInputPopover(props) {
|
|
|
2193
2889
|
})
|
|
2194
2890
|
}
|
|
2195
2891
|
) }),
|
|
2196
|
-
isEditing && /* @__PURE__ */ (0,
|
|
2197
|
-
/* @__PURE__ */ (0,
|
|
2198
|
-
/* @__PURE__ */ (0,
|
|
2892
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mly-relative", children: [
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2199
2895
|
"select",
|
|
2200
2896
|
{
|
|
2201
2897
|
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",
|
|
@@ -2212,13 +2908,13 @@ function LinkInputPopover(props) {
|
|
|
2212
2908
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
2213
2909
|
},
|
|
2214
2910
|
children: [
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "https://", children: "https://" }),
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "http://", children: "http://" })
|
|
2217
2913
|
]
|
|
2218
2914
|
}
|
|
2219
2915
|
),
|
|
2220
|
-
/* @__PURE__ */ (0,
|
|
2221
|
-
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)(
|
|
2917
|
+
import_lucide_react13.ChevronDownIcon,
|
|
2222
2918
|
{
|
|
2223
2919
|
size: 16,
|
|
2224
2920
|
strokeWidth: 2,
|
|
@@ -2227,7 +2923,7 @@ function LinkInputPopover(props) {
|
|
|
2227
2923
|
}
|
|
2228
2924
|
) })
|
|
2229
2925
|
] }),
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2926
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2231
2927
|
InputAutocomplete,
|
|
2232
2928
|
{
|
|
2233
2929
|
value: defaultUrlWithoutProtocol,
|
|
@@ -2264,8 +2960,8 @@ function LinkInputPopover(props) {
|
|
|
2264
2960
|
|
|
2265
2961
|
// src/editor/components/ui/select.tsx
|
|
2266
2962
|
var import_react11 = require("react");
|
|
2267
|
-
var
|
|
2268
|
-
var
|
|
2963
|
+
var import_lucide_react14 = require("lucide-react");
|
|
2964
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2269
2965
|
function Select(props) {
|
|
2270
2966
|
const {
|
|
2271
2967
|
label,
|
|
@@ -2278,10 +2974,10 @@ function Select(props) {
|
|
|
2278
2974
|
iconClassName
|
|
2279
2975
|
} = props;
|
|
2280
2976
|
const selectId = `mly${(0, import_react11.useId)()}`;
|
|
2281
|
-
const content = /* @__PURE__ */ (0,
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2283
|
-
Icon && /* @__PURE__ */ (0,
|
|
2284
|
-
/* @__PURE__ */ (0,
|
|
2977
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
2979
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mly-pointer-events-none mly-absolute mly-inset-y-0 mly-left-2 mly-z-20 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { className: cn("mly-size-3", iconClassName) }) }),
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2285
2981
|
"select",
|
|
2286
2982
|
{
|
|
2287
2983
|
id: selectId,
|
|
@@ -2292,11 +2988,11 @@ function Select(props) {
|
|
|
2292
2988
|
),
|
|
2293
2989
|
value,
|
|
2294
2990
|
onChange: (event) => onValueChange(event.target.value),
|
|
2295
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
2991
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
2296
2992
|
}
|
|
2297
2993
|
),
|
|
2298
|
-
/* @__PURE__ */ (0,
|
|
2299
|
-
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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-7 mly-items-center mly-justify-center mly-text-gray-600 peer-disabled:mly-opacity-50", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2995
|
+
import_lucide_react14.ChevronDownIcon,
|
|
2300
2996
|
{
|
|
2301
2997
|
size: 16,
|
|
2302
2998
|
strokeWidth: 2,
|
|
@@ -2308,27 +3004,25 @@ function Select(props) {
|
|
|
2308
3004
|
if (!tooltip) {
|
|
2309
3005
|
return content;
|
|
2310
3006
|
}
|
|
2311
|
-
return /* @__PURE__ */ (0,
|
|
2312
|
-
/* @__PURE__ */ (0,
|
|
2313
|
-
/* @__PURE__ */ (0,
|
|
3007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
3008
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: content }),
|
|
3009
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2314
3010
|
] });
|
|
2315
3011
|
}
|
|
2316
3012
|
|
|
2317
3013
|
// src/editor/nodes/button/button-view.tsx
|
|
2318
|
-
var
|
|
3014
|
+
var import_react16 = require("@tiptap/react");
|
|
2319
3015
|
|
|
2320
3016
|
// src/editor/components/show-popover.tsx
|
|
2321
|
-
var
|
|
3017
|
+
var import_lucide_react15 = require("lucide-react");
|
|
2322
3018
|
var import_react12 = require("react");
|
|
2323
|
-
var
|
|
2324
|
-
var import_react14 = require("react");
|
|
2325
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3019
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2326
3020
|
function _ShowPopover(props) {
|
|
2327
3021
|
const { showIfKey = "", onShowIfKeyValueChange, editor } = props;
|
|
2328
3022
|
const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2329
3023
|
const [isUpdatingKey, setIsUpdatingKey] = (0, import_react12.useState)(false);
|
|
2330
3024
|
const inputRef = (0, import_react12.useRef)(null);
|
|
2331
|
-
const autoCompleteOptions = (0,
|
|
3025
|
+
const autoCompleteOptions = (0, import_react12.useMemo)(() => {
|
|
2332
3026
|
return processVariables(variables, {
|
|
2333
3027
|
query: showIfKey || "",
|
|
2334
3028
|
from: "bubble-variable",
|
|
@@ -2336,7 +3030,7 @@ function _ShowPopover(props) {
|
|
|
2336
3030
|
}).map((variable) => variable.name);
|
|
2337
3031
|
}, [variables, showIfKey, editor]);
|
|
2338
3032
|
const isValidWhenKey = showIfKey || autoCompleteOptions.includes(showIfKey);
|
|
2339
|
-
return /* @__PURE__ */ (0,
|
|
3033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2340
3034
|
Popover,
|
|
2341
3035
|
{
|
|
2342
3036
|
onOpenChange: (open) => {
|
|
@@ -2346,20 +3040,20 @@ function _ShowPopover(props) {
|
|
|
2346
3040
|
setIsUpdatingKey(false);
|
|
2347
3041
|
},
|
|
2348
3042
|
children: [
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2351
3045
|
PopoverTrigger,
|
|
2352
3046
|
{
|
|
2353
3047
|
className: cn(
|
|
2354
|
-
"mly-flex mly-items-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",
|
|
3048
|
+
"mly-flex mly-size-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",
|
|
2355
3049
|
showIfKey && "mly-bg-rose-100 mly-text-rose-800 data-[state=open]:mly-bg-rose-100 hover:mly-bg-rose-100"
|
|
2356
3050
|
),
|
|
2357
|
-
children: /* @__PURE__ */ (0,
|
|
3051
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Eye, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5]" })
|
|
2358
3052
|
}
|
|
2359
3053
|
) }),
|
|
2360
|
-
/* @__PURE__ */ (0,
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { sideOffset: 8, children: "Show block conditionally" })
|
|
2361
3055
|
] }),
|
|
2362
|
-
/* @__PURE__ */ (0,
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2363
3057
|
PopoverContent,
|
|
2364
3058
|
{
|
|
2365
3059
|
className: "mly-flex mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
@@ -2373,8 +3067,27 @@ function _ShowPopover(props) {
|
|
|
2373
3067
|
e.preventDefault();
|
|
2374
3068
|
},
|
|
2375
3069
|
children: [
|
|
2376
|
-
/* @__PURE__ */ (0,
|
|
2377
|
-
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1.5 mly-px-1.5 mly-text-sm mly-leading-none", children: [
|
|
3071
|
+
"Show if",
|
|
3072
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3074
|
+
import_lucide_react15.InfoIcon,
|
|
3075
|
+
{
|
|
3076
|
+
className: cn("mly-size-3 mly-stroke-[2.5] mly-text-gray-500")
|
|
3077
|
+
}
|
|
3078
|
+
) }),
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3080
|
+
TooltipContent,
|
|
3081
|
+
{
|
|
3082
|
+
sideOffset: 14,
|
|
3083
|
+
className: "mly-max-w-[285px]",
|
|
3084
|
+
align: "start",
|
|
3085
|
+
children: "Show the block if the selected variable is true."
|
|
3086
|
+
}
|
|
3087
|
+
)
|
|
3088
|
+
] })
|
|
3089
|
+
] }),
|
|
3090
|
+
!isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2378
3091
|
"button",
|
|
2379
3092
|
{
|
|
2380
3093
|
onClick: () => {
|
|
@@ -2395,7 +3108,7 @@ function _ShowPopover(props) {
|
|
|
2395
3108
|
})
|
|
2396
3109
|
}
|
|
2397
3110
|
),
|
|
2398
|
-
isUpdatingKey && /* @__PURE__ */ (0,
|
|
3111
|
+
isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2399
3112
|
"form",
|
|
2400
3113
|
{
|
|
2401
3114
|
onSubmit: (e) => {
|
|
@@ -2407,7 +3120,7 @@ function _ShowPopover(props) {
|
|
|
2407
3120
|
setIsUpdatingKey(false);
|
|
2408
3121
|
}
|
|
2409
3122
|
},
|
|
2410
|
-
children: /* @__PURE__ */ (0,
|
|
3123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2411
3124
|
InputAutocomplete,
|
|
2412
3125
|
{
|
|
2413
3126
|
value: showIfKey || "",
|
|
@@ -2434,24 +3147,24 @@ function _ShowPopover(props) {
|
|
|
2434
3147
|
}
|
|
2435
3148
|
);
|
|
2436
3149
|
}
|
|
2437
|
-
var ShowPopover = (0,
|
|
3150
|
+
var ShowPopover = (0, import_react12.memo)(_ShowPopover);
|
|
2438
3151
|
|
|
2439
3152
|
// src/editor/nodes/button/button-label-input.tsx
|
|
3153
|
+
var import_react13 = require("react");
|
|
3154
|
+
var import_react14 = require("react");
|
|
2440
3155
|
var import_react15 = require("react");
|
|
2441
|
-
var
|
|
2442
|
-
var import_react17 = require("react");
|
|
2443
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3156
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2444
3157
|
function ButtonLabelInput(props) {
|
|
2445
3158
|
const { value, onValueChange, isVariable, editor } = props;
|
|
2446
|
-
const linkInputRef = (0,
|
|
2447
|
-
const [isEditing, setIsEditing] = (0,
|
|
3159
|
+
const linkInputRef = (0, import_react15.useRef)(null);
|
|
3160
|
+
const [isEditing, setIsEditing] = (0, import_react14.useState)(!isVariable);
|
|
2448
3161
|
const {
|
|
2449
3162
|
variables = [],
|
|
2450
3163
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
2451
3164
|
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
2452
3165
|
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
2453
3166
|
} = useMailyContext();
|
|
2454
|
-
const autoCompleteOptions = (0,
|
|
3167
|
+
const autoCompleteOptions = (0, import_react13.useMemo)(() => {
|
|
2455
3168
|
const withoutTrigger = value.replace(
|
|
2456
3169
|
new RegExp(variableTriggerCharacter, "g"),
|
|
2457
3170
|
""
|
|
@@ -2462,8 +3175,8 @@ function ButtonLabelInput(props) {
|
|
|
2462
3175
|
editor
|
|
2463
3176
|
}).map((variable) => variable.name);
|
|
2464
3177
|
}, [variables, value, editor]);
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2466
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
3178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
3179
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2467
3180
|
"button",
|
|
2468
3181
|
{
|
|
2469
3182
|
onClick: () => {
|
|
@@ -2484,7 +3197,7 @@ function ButtonLabelInput(props) {
|
|
|
2484
3197
|
})
|
|
2485
3198
|
}
|
|
2486
3199
|
),
|
|
2487
|
-
isEditing && /* @__PURE__ */ (0,
|
|
3200
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2488
3201
|
InputAutocomplete,
|
|
2489
3202
|
{
|
|
2490
3203
|
value,
|
|
@@ -2510,8 +3223,8 @@ function ButtonLabelInput(props) {
|
|
|
2510
3223
|
}
|
|
2511
3224
|
|
|
2512
3225
|
// src/editor/nodes/button/button-view.tsx
|
|
2513
|
-
var
|
|
2514
|
-
var
|
|
3226
|
+
var import_react17 = require("react");
|
|
3227
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2515
3228
|
function ButtonView(props) {
|
|
2516
3229
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
2517
3230
|
const {
|
|
@@ -2531,7 +3244,7 @@ function ButtonView(props) {
|
|
|
2531
3244
|
paddingLeft
|
|
2532
3245
|
} = node.attrs;
|
|
2533
3246
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2534
|
-
const sizes = (0,
|
|
3247
|
+
const sizes = (0, import_react17.useMemo)(
|
|
2535
3248
|
() => ({
|
|
2536
3249
|
small: {
|
|
2537
3250
|
paddingX: 24,
|
|
@@ -2548,14 +3261,14 @@ function ButtonView(props) {
|
|
|
2548
3261
|
}),
|
|
2549
3262
|
[]
|
|
2550
3263
|
);
|
|
2551
|
-
const size = (0,
|
|
3264
|
+
const size = (0, import_react17.useMemo)(() => {
|
|
2552
3265
|
var _a;
|
|
2553
3266
|
return (_a = Object.entries(sizes).find(
|
|
2554
3267
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
2555
3268
|
)) == null ? void 0 : _a[0];
|
|
2556
3269
|
}, [paddingRight, paddingTop, sizes]);
|
|
2557
|
-
return /* @__PURE__ */ (0,
|
|
2558
|
-
|
|
3270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3271
|
+
import_react16.NodeViewWrapper,
|
|
2559
3272
|
{
|
|
2560
3273
|
draggable: editor.isEditable,
|
|
2561
3274
|
"data-drag-handle": editor.isEditable,
|
|
@@ -2563,8 +3276,8 @@ function ButtonView(props) {
|
|
|
2563
3276
|
style: {
|
|
2564
3277
|
textAlign: alignment
|
|
2565
3278
|
},
|
|
2566
|
-
children: /* @__PURE__ */ (0,
|
|
2567
|
-
/* @__PURE__ */ (0,
|
|
3279
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
3280
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2568
3281
|
"button",
|
|
2569
3282
|
{
|
|
2570
3283
|
className: cn(
|
|
@@ -2607,7 +3320,7 @@ function ButtonView(props) {
|
|
|
2607
3320
|
}) : text2
|
|
2608
3321
|
}
|
|
2609
3322
|
) }) }),
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
3323
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2611
3324
|
PopoverContent,
|
|
2612
3325
|
{
|
|
2613
3326
|
align: "end",
|
|
@@ -2616,8 +3329,8 @@ function ButtonView(props) {
|
|
|
2616
3329
|
sideOffset: 8,
|
|
2617
3330
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2618
3331
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2619
|
-
children: /* @__PURE__ */ (0,
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
3332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2621
3334
|
ButtonLabelInput,
|
|
2622
3335
|
{
|
|
2623
3336
|
value: text2,
|
|
@@ -2631,9 +3344,9 @@ function ButtonView(props) {
|
|
|
2631
3344
|
editor
|
|
2632
3345
|
}
|
|
2633
3346
|
),
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2635
|
-
/* @__PURE__ */ (0,
|
|
2636
|
-
/* @__PURE__ */ (0,
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2637
3350
|
Select,
|
|
2638
3351
|
{
|
|
2639
3352
|
label: "Border Radius",
|
|
@@ -2651,7 +3364,7 @@ function ButtonView(props) {
|
|
|
2651
3364
|
className: "mly-capitalize"
|
|
2652
3365
|
}
|
|
2653
3366
|
),
|
|
2654
|
-
/* @__PURE__ */ (0,
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2655
3368
|
Select,
|
|
2656
3369
|
{
|
|
2657
3370
|
label: "Style",
|
|
@@ -2669,7 +3382,7 @@ function ButtonView(props) {
|
|
|
2669
3382
|
className: "mly-capitalize"
|
|
2670
3383
|
}
|
|
2671
3384
|
),
|
|
2672
|
-
/* @__PURE__ */ (0,
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2673
3386
|
Select,
|
|
2674
3387
|
{
|
|
2675
3388
|
label: "Size",
|
|
@@ -2692,9 +3405,9 @@ function ButtonView(props) {
|
|
|
2692
3405
|
}
|
|
2693
3406
|
)
|
|
2694
3407
|
] }),
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2696
|
-
/* @__PURE__ */ (0,
|
|
2697
|
-
/* @__PURE__ */ (0,
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3410
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2698
3411
|
AlignmentSwitch,
|
|
2699
3412
|
{
|
|
2700
3413
|
alignment,
|
|
@@ -2705,7 +3418,7 @@ function ButtonView(props) {
|
|
|
2705
3418
|
}
|
|
2706
3419
|
}
|
|
2707
3420
|
),
|
|
2708
|
-
/* @__PURE__ */ (0,
|
|
3421
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2709
3422
|
LinkInputPopover,
|
|
2710
3423
|
{
|
|
2711
3424
|
defaultValue: externalLink || "",
|
|
@@ -2721,9 +3434,9 @@ function ButtonView(props) {
|
|
|
2721
3434
|
}
|
|
2722
3435
|
)
|
|
2723
3436
|
] }),
|
|
2724
|
-
/* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2727
3440
|
BackgroundColorPickerPopup,
|
|
2728
3441
|
{
|
|
2729
3442
|
variant,
|
|
@@ -2735,7 +3448,7 @@ function ButtonView(props) {
|
|
|
2735
3448
|
}
|
|
2736
3449
|
}
|
|
2737
3450
|
),
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
3451
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2739
3452
|
TextColorPickerPopup,
|
|
2740
3453
|
{
|
|
2741
3454
|
color: textColor,
|
|
@@ -2747,8 +3460,8 @@ function ButtonView(props) {
|
|
|
2747
3460
|
}
|
|
2748
3461
|
)
|
|
2749
3462
|
] }),
|
|
2750
|
-
/* @__PURE__ */ (0,
|
|
2751
|
-
/* @__PURE__ */ (0,
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2752
3465
|
ShowPopover,
|
|
2753
3466
|
{
|
|
2754
3467
|
showIfKey,
|
|
@@ -2769,20 +3482,20 @@ function ButtonView(props) {
|
|
|
2769
3482
|
}
|
|
2770
3483
|
function BackgroundColorPickerPopup(props) {
|
|
2771
3484
|
const { color, onChange, variant } = props;
|
|
2772
|
-
return /* @__PURE__ */ (0,
|
|
3485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2773
3486
|
ColorPicker,
|
|
2774
3487
|
{
|
|
2775
3488
|
color,
|
|
2776
3489
|
onColorChange: onChange,
|
|
2777
3490
|
tooltip: "Background Color",
|
|
2778
|
-
children: /* @__PURE__ */ (0,
|
|
3491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2779
3492
|
BaseButton,
|
|
2780
3493
|
{
|
|
2781
3494
|
variant: "ghost",
|
|
2782
3495
|
size: "sm",
|
|
2783
3496
|
type: "button",
|
|
2784
3497
|
className: "mly-size-7",
|
|
2785
|
-
children: /* @__PURE__ */ (0,
|
|
3498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2786
3499
|
"div",
|
|
2787
3500
|
{
|
|
2788
3501
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded-full mly-shadow",
|
|
@@ -2801,16 +3514,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
2801
3514
|
}
|
|
2802
3515
|
function TextColorPickerPopup(props) {
|
|
2803
3516
|
const { color, onChange } = props;
|
|
2804
|
-
return /* @__PURE__ */ (0,
|
|
3517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2805
3518
|
BaseButton,
|
|
2806
3519
|
{
|
|
2807
3520
|
variant: "ghost",
|
|
2808
3521
|
size: "sm",
|
|
2809
3522
|
type: "button",
|
|
2810
3523
|
className: "mly-size-7",
|
|
2811
|
-
children: /* @__PURE__ */ (0,
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
3524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-midnight-gray", children: "A" }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2814
3527
|
"div",
|
|
2815
3528
|
{
|
|
2816
3529
|
className: "mly-h-[2px] mly-w-3 mly-shrink-0 mly-rounded-md mly-shadow",
|
|
@@ -3049,7 +3762,7 @@ var ButtonExtension = import_core10.Node.create({
|
|
|
3049
3762
|
};
|
|
3050
3763
|
},
|
|
3051
3764
|
addNodeView() {
|
|
3052
|
-
return (0,
|
|
3765
|
+
return (0, import_react18.ReactNodeViewRenderer)(ButtonView, {
|
|
3053
3766
|
contentDOMElementTag: "div",
|
|
3054
3767
|
className: "mly-relative"
|
|
3055
3768
|
});
|
|
@@ -3058,21 +3771,21 @@ var ButtonExtension = import_core10.Node.create({
|
|
|
3058
3771
|
|
|
3059
3772
|
// src/editor/nodes/logo/logo.ts
|
|
3060
3773
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
3061
|
-
var
|
|
3774
|
+
var import_react25 = require("@tiptap/react");
|
|
3062
3775
|
|
|
3063
3776
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3064
|
-
var
|
|
3065
|
-
var
|
|
3066
|
-
var
|
|
3777
|
+
var import_react22 = require("@tiptap/react");
|
|
3778
|
+
var import_react23 = require("react");
|
|
3779
|
+
var import_react24 = require("react");
|
|
3067
3780
|
|
|
3068
3781
|
// src/editor/utils/use-event.ts
|
|
3069
|
-
var
|
|
3782
|
+
var import_react19 = require("react");
|
|
3070
3783
|
var useEvent = (handler) => {
|
|
3071
|
-
const handlerRef = (0,
|
|
3072
|
-
(0,
|
|
3784
|
+
const handlerRef = (0, import_react19.useRef)(null);
|
|
3785
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
3073
3786
|
handlerRef.current = handler;
|
|
3074
3787
|
}, [handler]);
|
|
3075
|
-
return (0,
|
|
3788
|
+
return (0, import_react19.useCallback)((...args) => {
|
|
3076
3789
|
if (handlerRef.current === null) {
|
|
3077
3790
|
throw new Error("Handler is not assigned");
|
|
3078
3791
|
}
|
|
@@ -3081,18 +3794,18 @@ var useEvent = (handler) => {
|
|
|
3081
3794
|
};
|
|
3082
3795
|
|
|
3083
3796
|
// src/editor/nodes/image/image-view.tsx
|
|
3084
|
-
var
|
|
3085
|
-
var
|
|
3086
|
-
var
|
|
3087
|
-
var
|
|
3797
|
+
var import_react20 = require("@tiptap/react");
|
|
3798
|
+
var import_lucide_react16 = require("lucide-react");
|
|
3799
|
+
var import_react21 = require("react");
|
|
3800
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3088
3801
|
var MIN_WIDTH = 20;
|
|
3089
3802
|
var MAX_WIDTH = 600;
|
|
3090
3803
|
function ImageView(props) {
|
|
3091
3804
|
const { node, updateAttributes: updateAttributes2, selected, editor } = props;
|
|
3092
|
-
const [status, setStatus] = (0,
|
|
3093
|
-
const wrapperRef = (0,
|
|
3094
|
-
const imgRef = (0,
|
|
3095
|
-
const [resizingStyle, setResizingStyle] = (0,
|
|
3805
|
+
const [status, setStatus] = (0, import_react21.useState)("idle");
|
|
3806
|
+
const wrapperRef = (0, import_react21.useRef)(null);
|
|
3807
|
+
const imgRef = (0, import_react21.useRef)(null);
|
|
3808
|
+
const [resizingStyle, setResizingStyle] = (0, import_react21.useState)();
|
|
3096
3809
|
const handleMouseDown = useEvent(
|
|
3097
3810
|
(event) => {
|
|
3098
3811
|
const imageParent = document.querySelector(
|
|
@@ -3135,7 +3848,7 @@ function ImageView(props) {
|
|
|
3135
3848
|
}
|
|
3136
3849
|
);
|
|
3137
3850
|
function dragCornerButton(direction) {
|
|
3138
|
-
return /* @__PURE__ */ (0,
|
|
3851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3139
3852
|
"div",
|
|
3140
3853
|
{
|
|
3141
3854
|
role: "button",
|
|
@@ -3166,7 +3879,7 @@ function ImageView(props) {
|
|
|
3166
3879
|
"showIfKey"
|
|
3167
3880
|
]);
|
|
3168
3881
|
const hasImageSrc = !!attrs.src;
|
|
3169
|
-
(0,
|
|
3882
|
+
(0, import_react21.useEffect)(() => {
|
|
3170
3883
|
if (!src) {
|
|
3171
3884
|
return;
|
|
3172
3885
|
}
|
|
@@ -3200,8 +3913,8 @@ function ImageView(props) {
|
|
|
3200
3913
|
img.onerror = null;
|
|
3201
3914
|
};
|
|
3202
3915
|
}, [src]);
|
|
3203
|
-
return /* @__PURE__ */ (0,
|
|
3204
|
-
|
|
3916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3917
|
+
import_react20.NodeViewWrapper,
|
|
3205
3918
|
{
|
|
3206
3919
|
as: "div",
|
|
3207
3920
|
draggable: editor.isEditable,
|
|
@@ -3222,12 +3935,12 @@ function ImageView(props) {
|
|
|
3222
3935
|
}[alignment] || {}),
|
|
3223
3936
|
ref: wrapperRef,
|
|
3224
3937
|
children: [
|
|
3225
|
-
!hasImageSrc && /* @__PURE__ */ (0,
|
|
3226
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
3227
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3228
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3229
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3938
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "idle", minHeight: height }),
|
|
3939
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "variable", minHeight: height }),
|
|
3940
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "loading", minHeight: height }),
|
|
3941
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "error", minHeight: height }),
|
|
3942
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3231
3944
|
"img",
|
|
3232
3945
|
__spreadProps(__spreadValues({}, attrs), {
|
|
3233
3946
|
ref: imgRef,
|
|
@@ -3238,13 +3951,13 @@ function ImageView(props) {
|
|
|
3238
3951
|
draggable: editor.isEditable
|
|
3239
3952
|
})
|
|
3240
3953
|
),
|
|
3241
|
-
selected && editor.isEditable && /* @__PURE__ */ (0,
|
|
3954
|
+
selected && editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3242
3955
|
[
|
|
3243
3956
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
3244
3957
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
3245
3958
|
{ top: 0, left: 0, width: "100%", height: "1px" },
|
|
3246
3959
|
{ bottom: 0, left: 0, width: "100%", height: "1px" }
|
|
3247
|
-
].map((style, i) => /* @__PURE__ */ (0,
|
|
3960
|
+
].map((style, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3248
3961
|
"div",
|
|
3249
3962
|
{
|
|
3250
3963
|
className: "mly-bg-rose-500",
|
|
@@ -3265,33 +3978,36 @@ function ImageView(props) {
|
|
|
3265
3978
|
);
|
|
3266
3979
|
}
|
|
3267
3980
|
function ImageStatusLabel(props) {
|
|
3268
|
-
const { status } = props;
|
|
3269
|
-
return /* @__PURE__ */ (0,
|
|
3981
|
+
const { status, minHeight } = props;
|
|
3982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3270
3983
|
"div",
|
|
3271
3984
|
{
|
|
3272
3985
|
className: cn(
|
|
3273
|
-
"mly-flex mly-items-center mly-gap-2 mly-rounded-lg mly-bg-soft-gray mly-
|
|
3986
|
+
"mly-flex mly-items-center mly-justify-center mly-gap-2 mly-rounded-lg mly-bg-soft-gray mly-px-4 mly-py-2 mly-text-sm mly-font-medium",
|
|
3274
3987
|
{
|
|
3275
3988
|
"mly-text-gray-500 hover:mly-bg-soft-gray/60": status === "loading",
|
|
3276
3989
|
"mly-text-red-500 hover:mly-bg-soft-gray/60": status === "error"
|
|
3277
3990
|
}
|
|
3278
3991
|
),
|
|
3992
|
+
style: __spreadValues({}, minHeight ? {
|
|
3993
|
+
minHeight
|
|
3994
|
+
} : {}),
|
|
3279
3995
|
children: [
|
|
3280
|
-
status === "idle" && /* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3996
|
+
status === "idle" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.ImageOffIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "No image selected" })
|
|
3283
3999
|
] }),
|
|
3284
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
3285
|
-
/* @__PURE__ */ (0,
|
|
3286
|
-
/* @__PURE__ */ (0,
|
|
4000
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Loader2, { className: "mly-size-4 mly-animate-spin mly-stroke-[2.5]" }),
|
|
4002
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Loading image..." })
|
|
3287
4003
|
] }),
|
|
3288
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
3289
|
-
/* @__PURE__ */ (0,
|
|
3290
|
-
/* @__PURE__ */ (0,
|
|
4004
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Ban, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
4006
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Error loading image" })
|
|
3291
4007
|
] }),
|
|
3292
|
-
status === "variable" && /* @__PURE__ */ (0,
|
|
3293
|
-
/* @__PURE__ */ (0,
|
|
3294
|
-
/* @__PURE__ */ (0,
|
|
4008
|
+
status === "variable" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.BracesIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
4010
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Variable Image URL" })
|
|
3295
4011
|
] })
|
|
3296
4012
|
]
|
|
3297
4013
|
}
|
|
@@ -3299,10 +4015,10 @@ function ImageStatusLabel(props) {
|
|
|
3299
4015
|
}
|
|
3300
4016
|
|
|
3301
4017
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3302
|
-
var
|
|
4018
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3303
4019
|
function LogoView(props) {
|
|
3304
4020
|
const { node, editor } = props;
|
|
3305
|
-
const [status, setStatus] = (0,
|
|
4021
|
+
const [status, setStatus] = (0, import_react24.useState)("idle");
|
|
3306
4022
|
let {
|
|
3307
4023
|
alignment = "center",
|
|
3308
4024
|
src: logoSrc,
|
|
@@ -3310,7 +4026,7 @@ function LogoView(props) {
|
|
|
3310
4026
|
size = "sm"
|
|
3311
4027
|
} = node.attrs || {};
|
|
3312
4028
|
const hasImageSrc = !!logoSrc;
|
|
3313
|
-
(0,
|
|
4029
|
+
(0, import_react23.useEffect)(() => {
|
|
3314
4030
|
if (!logoSrc) {
|
|
3315
4031
|
return;
|
|
3316
4032
|
}
|
|
@@ -3330,8 +4046,8 @@ function LogoView(props) {
|
|
|
3330
4046
|
};
|
|
3331
4047
|
}, [logoSrc]);
|
|
3332
4048
|
const logoSize = logoSizes[size];
|
|
3333
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
-
|
|
4049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4050
|
+
import_react22.NodeViewWrapper,
|
|
3335
4051
|
{
|
|
3336
4052
|
as: "div",
|
|
3337
4053
|
draggable: editor.isEditable,
|
|
@@ -3344,11 +4060,11 @@ function LogoView(props) {
|
|
|
3344
4060
|
display: "block"
|
|
3345
4061
|
},
|
|
3346
4062
|
children: [
|
|
3347
|
-
!hasImageSrc && /* @__PURE__ */ (0,
|
|
3348
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
3349
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3350
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3351
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
4063
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "idle", minHeight: logoSize }),
|
|
4064
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "variable", minHeight: logoSize }),
|
|
4065
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "loading", minHeight: logoSize }),
|
|
4066
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "error", minHeight: logoSize }),
|
|
4067
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3352
4068
|
"img",
|
|
3353
4069
|
{
|
|
3354
4070
|
src: logoSrc,
|
|
@@ -3468,7 +4184,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3468
4184
|
];
|
|
3469
4185
|
},
|
|
3470
4186
|
addNodeView() {
|
|
3471
|
-
return (0,
|
|
4187
|
+
return (0, import_react25.ReactNodeViewRenderer)(LogoView, {
|
|
3472
4188
|
className: "mly-relative"
|
|
3473
4189
|
});
|
|
3474
4190
|
}
|
|
@@ -3476,7 +4192,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3476
4192
|
|
|
3477
4193
|
// src/editor/nodes/image/image.ts
|
|
3478
4194
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
3479
|
-
var
|
|
4195
|
+
var import_react26 = require("@tiptap/react");
|
|
3480
4196
|
var ImageExtension = import_extension_image2.default.extend({
|
|
3481
4197
|
addAttributes() {
|
|
3482
4198
|
var _a;
|
|
@@ -3568,7 +4284,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
3568
4284
|
});
|
|
3569
4285
|
},
|
|
3570
4286
|
addNodeView() {
|
|
3571
|
-
return (0,
|
|
4287
|
+
return (0, import_react26.ReactNodeViewRenderer)(ImageView, {
|
|
3572
4288
|
className: "mly-relative"
|
|
3573
4289
|
});
|
|
3574
4290
|
}
|
|
@@ -3645,24 +4361,24 @@ var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
|
3645
4361
|
|
|
3646
4362
|
// src/editor/nodes/repeat/repeat.ts
|
|
3647
4363
|
var import_core11 = require("@tiptap/core");
|
|
3648
|
-
var
|
|
4364
|
+
var import_react28 = require("@tiptap/react");
|
|
3649
4365
|
|
|
3650
4366
|
// src/editor/nodes/repeat/repeat-view.tsx
|
|
3651
|
-
var
|
|
3652
|
-
var
|
|
3653
|
-
var
|
|
4367
|
+
var import_react27 = require("@tiptap/react");
|
|
4368
|
+
var import_lucide_react17 = require("lucide-react");
|
|
4369
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3654
4370
|
function RepeatView(props) {
|
|
3655
4371
|
const { editor, getPos } = props;
|
|
3656
|
-
return /* @__PURE__ */ (0,
|
|
3657
|
-
|
|
4372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4373
|
+
import_react27.NodeViewWrapper,
|
|
3658
4374
|
{
|
|
3659
4375
|
"data-type": "repeat",
|
|
3660
4376
|
draggable: editor.isEditable,
|
|
3661
4377
|
"data-drag-handle": editor.isEditable,
|
|
3662
4378
|
className: "mly-relative",
|
|
3663
4379
|
children: [
|
|
3664
|
-
/* @__PURE__ */ (0,
|
|
3665
|
-
/* @__PURE__ */ (0,
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react27.NodeViewContent, { className: "is-editable" }),
|
|
4381
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3666
4382
|
"div",
|
|
3667
4383
|
{
|
|
3668
4384
|
role: "button",
|
|
@@ -3673,8 +4389,8 @@ function RepeatView(props) {
|
|
|
3673
4389
|
editor.commands.setNodeSelection(getPos());
|
|
3674
4390
|
},
|
|
3675
4391
|
children: [
|
|
3676
|
-
/* @__PURE__ */ (0,
|
|
3677
|
-
/* @__PURE__ */ (0,
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
3678
4394
|
]
|
|
3679
4395
|
}
|
|
3680
4396
|
)
|
|
@@ -3758,7 +4474,7 @@ var RepeatExtension = import_core11.Node.create({
|
|
|
3758
4474
|
};
|
|
3759
4475
|
},
|
|
3760
4476
|
addNodeView() {
|
|
3761
|
-
return (0,
|
|
4477
|
+
return (0, import_react28.ReactNodeViewRenderer)(RepeatView, {
|
|
3762
4478
|
contentDOMElementTag: "div",
|
|
3763
4479
|
className: "mly-relative"
|
|
3764
4480
|
});
|
|
@@ -3819,24 +4535,6 @@ var MailyKit = import_core12.Extension.create({
|
|
|
3819
4535
|
types: [import_extension_paragraph2.default.name, import_extension_heading2.default.name, Footer.name]
|
|
3820
4536
|
}),
|
|
3821
4537
|
HorizontalRule,
|
|
3822
|
-
import_extension_placeholder.default.configure({
|
|
3823
|
-
placeholder: ({ node }) => {
|
|
3824
|
-
if (node.type.name === "heading") {
|
|
3825
|
-
return `Heading ${node.attrs.level}`;
|
|
3826
|
-
} else if ([
|
|
3827
|
-
"columns",
|
|
3828
|
-
"column",
|
|
3829
|
-
"section",
|
|
3830
|
-
"repeat",
|
|
3831
|
-
"show",
|
|
3832
|
-
"blockquote"
|
|
3833
|
-
].includes(node.type.name)) {
|
|
3834
|
-
return "";
|
|
3835
|
-
}
|
|
3836
|
-
return "Write something or / to see commands";
|
|
3837
|
-
},
|
|
3838
|
-
includeChildren: true
|
|
3839
|
-
}),
|
|
3840
4538
|
Footer,
|
|
3841
4539
|
import_extension_focus.default,
|
|
3842
4540
|
import_extension_dropcursor.default.configure({
|
|
@@ -3914,140 +4612,271 @@ var SlashCommandExtension = import_core13.Extension.create({
|
|
|
3914
4612
|
}
|
|
3915
4613
|
});
|
|
3916
4614
|
|
|
3917
|
-
// src/editor/utils/update-scroll-view.ts
|
|
3918
|
-
var updateScrollView = (container, item) => {
|
|
3919
|
-
const containerHeight = container.offsetHeight;
|
|
3920
|
-
const itemHeight = item ? item.offsetHeight : 0;
|
|
3921
|
-
const top = item.offsetTop;
|
|
3922
|
-
const bottom = top + itemHeight;
|
|
3923
|
-
if (top < container.scrollTop) {
|
|
3924
|
-
container.scrollTop -= container.scrollTop - top + 5;
|
|
3925
|
-
} else if (bottom > containerHeight + container.scrollTop) {
|
|
3926
|
-
container.scrollTop += bottom - containerHeight - container.scrollTop + 5;
|
|
3927
|
-
}
|
|
3928
|
-
};
|
|
3929
|
-
|
|
3930
4615
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
3931
|
-
var
|
|
3932
|
-
var
|
|
4616
|
+
var import_react29 = require("@tiptap/react");
|
|
4617
|
+
var import_react30 = require("react");
|
|
3933
4618
|
var import_tippy = __toESM(require("tippy.js"));
|
|
3934
|
-
var
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
const
|
|
3938
|
-
const
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
4619
|
+
var import_lucide_react18 = require("lucide-react");
|
|
4620
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4621
|
+
var CommandList = (0, import_react30.forwardRef)(function CommandList2(props, ref) {
|
|
4622
|
+
const { items: groups, command, editor } = props;
|
|
4623
|
+
const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react30.useState)(0);
|
|
4624
|
+
const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react30.useState)(0);
|
|
4625
|
+
const selectItem = (0, import_react30.useCallback)(
|
|
4626
|
+
(groupIndex, commandIndex) => {
|
|
4627
|
+
const item = groups[groupIndex].commands[commandIndex];
|
|
4628
|
+
if (!item) {
|
|
4629
|
+
return;
|
|
3943
4630
|
}
|
|
4631
|
+
command(item);
|
|
3944
4632
|
},
|
|
3945
|
-
|
|
3946
|
-
[command, editor, items]
|
|
4633
|
+
[command]
|
|
3947
4634
|
);
|
|
3948
|
-
(0,
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
if (
|
|
3954
|
-
|
|
4635
|
+
(0, import_react30.useImperativeHandle)(ref, () => ({
|
|
4636
|
+
onKeyDown: ({ event }) => {
|
|
4637
|
+
var _a, _b;
|
|
4638
|
+
const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
|
|
4639
|
+
if (navigationKeys.includes(event.key)) {
|
|
4640
|
+
if (event.key === "ArrowUp") {
|
|
4641
|
+
if (!groups.length) {
|
|
4642
|
+
return false;
|
|
4643
|
+
}
|
|
4644
|
+
let newCommandIndex = selectedCommandIndex - 1;
|
|
4645
|
+
let newGroupIndex = selectedGroupIndex;
|
|
4646
|
+
if (newCommandIndex < 0) {
|
|
4647
|
+
newGroupIndex = selectedGroupIndex - 1;
|
|
4648
|
+
newCommandIndex = ((_a = groups[newGroupIndex]) == null ? void 0 : _a.commands.length) - 1 || 0;
|
|
4649
|
+
}
|
|
4650
|
+
if (newGroupIndex < 0) {
|
|
4651
|
+
newGroupIndex = groups.length - 1;
|
|
4652
|
+
newCommandIndex = ((_b = groups[newGroupIndex]) == null ? void 0 : _b.commands.length) - 1 || 0;
|
|
4653
|
+
}
|
|
4654
|
+
setSelectedGroupIndex(newGroupIndex);
|
|
4655
|
+
setSelectedCommandIndex(newCommandIndex);
|
|
3955
4656
|
return true;
|
|
3956
4657
|
}
|
|
3957
|
-
if (
|
|
3958
|
-
|
|
4658
|
+
if (event.key === "ArrowDown") {
|
|
4659
|
+
if (!groups.length) {
|
|
4660
|
+
return false;
|
|
4661
|
+
}
|
|
4662
|
+
const commands = groups[selectedGroupIndex].commands;
|
|
4663
|
+
let newCommandIndex = selectedCommandIndex + 1;
|
|
4664
|
+
let newGroupIndex = selectedGroupIndex;
|
|
4665
|
+
if (commands.length - 1 < newCommandIndex) {
|
|
4666
|
+
newCommandIndex = 0;
|
|
4667
|
+
newGroupIndex = selectedGroupIndex + 1;
|
|
4668
|
+
}
|
|
4669
|
+
if (groups.length - 1 < newGroupIndex) {
|
|
4670
|
+
newGroupIndex = 0;
|
|
4671
|
+
}
|
|
4672
|
+
setSelectedGroupIndex(newGroupIndex);
|
|
4673
|
+
setSelectedCommandIndex(newCommandIndex);
|
|
3959
4674
|
return true;
|
|
3960
4675
|
}
|
|
3961
|
-
if (
|
|
3962
|
-
|
|
4676
|
+
if (event.key === "Enter") {
|
|
4677
|
+
if (!groups.length) {
|
|
4678
|
+
return false;
|
|
4679
|
+
}
|
|
4680
|
+
selectItem(selectedGroupIndex, selectedCommandIndex);
|
|
3963
4681
|
return true;
|
|
3964
4682
|
}
|
|
3965
4683
|
return false;
|
|
3966
4684
|
}
|
|
3967
|
-
}
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
}, [
|
|
3973
|
-
(0,
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
const commandListContainer = (0, import_react32.useRef)(null);
|
|
3977
|
-
(0, import_react32.useLayoutEffect)(() => {
|
|
4685
|
+
}
|
|
4686
|
+
}));
|
|
4687
|
+
(0, import_react30.useEffect)(() => {
|
|
4688
|
+
setSelectedGroupIndex(0);
|
|
4689
|
+
setSelectedCommandIndex(0);
|
|
4690
|
+
}, [groups]);
|
|
4691
|
+
const commandListContainer = (0, import_react30.useRef)(null);
|
|
4692
|
+
const activeCommandRef = (0, import_react30.useRef)(null);
|
|
4693
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3978
4694
|
const container = commandListContainer == null ? void 0 : commandListContainer.current;
|
|
3979
|
-
const
|
|
3980
|
-
if (
|
|
3981
|
-
|
|
4695
|
+
const activeCommandContainer = activeCommandRef == null ? void 0 : activeCommandRef.current;
|
|
4696
|
+
if (!container || !activeCommandContainer) {
|
|
4697
|
+
return;
|
|
3982
4698
|
}
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
4699
|
+
const { offsetTop, offsetHeight } = activeCommandContainer;
|
|
4700
|
+
container.scrollTop = offsetTop - offsetHeight;
|
|
4701
|
+
}, [
|
|
4702
|
+
selectedGroupIndex,
|
|
4703
|
+
selectedCommandIndex,
|
|
4704
|
+
commandListContainer,
|
|
4705
|
+
activeCommandRef
|
|
4706
|
+
]);
|
|
4707
|
+
return groups.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.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: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3986
4709
|
"div",
|
|
3987
4710
|
{
|
|
3988
4711
|
id: "slash-command",
|
|
3989
4712
|
ref: commandListContainer,
|
|
3990
|
-
className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto mly-scroll-smooth
|
|
3991
|
-
children:
|
|
3992
|
-
|
|
3993
|
-
"
|
|
4713
|
+
className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto mly-scroll-smooth",
|
|
4714
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react30.Fragment, { children: [
|
|
4715
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4716
|
+
"span",
|
|
3994
4717
|
{
|
|
3995
4718
|
className: cn(
|
|
3996
|
-
"mly-
|
|
3997
|
-
|
|
4719
|
+
"mly-block mly-border-b mly-border-gray-200 mly-bg-soft-gray mly-p-2 mly-text-xs mly-uppercase mly-text-gray-400",
|
|
4720
|
+
groupIndex > 0 ? "mly-border-t" : ""
|
|
3998
4721
|
),
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4722
|
+
children: group.title
|
|
4723
|
+
}
|
|
4724
|
+
),
|
|
4725
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-space-y-0.5 mly-p-1", children: group.commands.map((item, commandIndex) => {
|
|
4726
|
+
var _a;
|
|
4727
|
+
const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
|
|
4728
|
+
const isSubCommand = "commands" in item;
|
|
4729
|
+
const hasRenderFunction = typeof item.render === "function";
|
|
4730
|
+
const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
|
|
4731
|
+
let value = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
|
|
4733
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-grow", children: [
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-font-medium", children: item.title }),
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-text-xs mly-text-gray-400", children: item.description })
|
|
4736
|
+
] }),
|
|
4737
|
+
isSubCommand && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "mly-block mly-px-1 mly-text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react18.ChevronRightIcon, { className: "mly-size-3.5 mly-stroke-[2.5]" }) })
|
|
4738
|
+
] });
|
|
4739
|
+
if (renderFunctionValue !== null && renderFunctionValue !== true) {
|
|
4740
|
+
value = renderFunctionValue;
|
|
4741
|
+
}
|
|
4742
|
+
const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && isActive;
|
|
4743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Tooltip, { open: shouldOpenTooltip, children: [
|
|
4744
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4745
|
+
"button",
|
|
4746
|
+
{
|
|
4747
|
+
className: cn(
|
|
4748
|
+
"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",
|
|
4749
|
+
isActive ? "mly-bg-gray-100 mly-text-gray-900" : "mly-bg-transparent"
|
|
4750
|
+
),
|
|
4751
|
+
onClick: () => selectItem(groupIndex, commandIndex),
|
|
4752
|
+
type: "button",
|
|
4753
|
+
ref: isActive ? activeCommandRef : null,
|
|
4754
|
+
children: value
|
|
4755
|
+
}
|
|
4756
|
+
) }),
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4758
|
+
TooltipContent,
|
|
4759
|
+
{
|
|
4760
|
+
side: "right",
|
|
4761
|
+
sideOffset: 10,
|
|
4762
|
+
className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
|
|
4763
|
+
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4764
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.jsx)(
|
|
4765
|
+
"img",
|
|
4766
|
+
{
|
|
4767
|
+
src: item == null ? void 0 : item.preview,
|
|
4768
|
+
alt: item == null ? void 0 : item.title,
|
|
4769
|
+
className: "mly-absolute mly-inset-0 mly-h-full mly-w-full mly-object-cover"
|
|
4770
|
+
}
|
|
4771
|
+
) }),
|
|
4772
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-mt-2 mly-px-0.5 mly-text-gray-500", children: item.description })
|
|
4773
|
+
] })
|
|
4774
|
+
}
|
|
4775
|
+
)
|
|
4776
|
+
] }, commandIndex);
|
|
4777
|
+
}) })
|
|
4778
|
+
] }, groupIndex))
|
|
4012
4779
|
}
|
|
4013
4780
|
),
|
|
4014
|
-
/* @__PURE__ */ (0,
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-border-t mly-border-gray-200 mly-px-1 mly-py-3 mly-pl-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-flex mly-items-center", children: [
|
|
4782
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-p-1 mly-px-2 mly-font-medium", children: "\u2191" }),
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-ml-1 mly-rounded mly-border mly-p-1 mly-px-2 mly-font-medium", children: "\u2193" }),
|
|
4018
4785
|
" ",
|
|
4019
4786
|
"to navigate"
|
|
4020
4787
|
] }),
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4022
|
-
/* @__PURE__ */ (0,
|
|
4023
|
-
/* @__PURE__ */ (0,
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", className: "mly-select-none mly-px-1", children: "\xB7" }),
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-p-1 mly-px-1.5 mly-font-medium", children: "Enter" }),
|
|
4024
4791
|
" ",
|
|
4025
4792
|
"to select"
|
|
4026
4793
|
] })
|
|
4027
4794
|
] }) })
|
|
4028
|
-
] }) : null;
|
|
4029
|
-
}
|
|
4030
|
-
function getSlashCommandSuggestions(
|
|
4795
|
+
] }) }) : null;
|
|
4796
|
+
});
|
|
4797
|
+
function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
4031
4798
|
return {
|
|
4032
4799
|
items: ({ query, editor }) => {
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4800
|
+
var _a;
|
|
4801
|
+
let newGroups = groups;
|
|
4802
|
+
let search = query.toLowerCase();
|
|
4803
|
+
const subCommandIds = newGroups.map((group) => {
|
|
4804
|
+
return group.commands.filter((item) => "commands" in item).map((item) => item == null ? void 0 : item.id.toLowerCase());
|
|
4805
|
+
}).flat().map((id) => `${id}.`);
|
|
4806
|
+
const shouldEnterSubCommand = subCommandIds.some(
|
|
4807
|
+
(id) => search.startsWith(id)
|
|
4808
|
+
);
|
|
4809
|
+
if (shouldEnterSubCommand) {
|
|
4810
|
+
const subCommandId = subCommandIds.find((id) => search.startsWith(id));
|
|
4811
|
+
const sanitizedSubCommandId = subCommandId == null ? void 0 : subCommandId.slice(0, -1);
|
|
4812
|
+
const group = (_a = newGroups.find((group2) => {
|
|
4813
|
+
return group2.commands.some(
|
|
4814
|
+
// @ts-ignore
|
|
4815
|
+
(item) => {
|
|
4816
|
+
var _a2;
|
|
4817
|
+
return ((_a2 = item == null ? void 0 : item.id) == null ? void 0 : _a2.toLowerCase()) === sanitizedSubCommandId;
|
|
4818
|
+
}
|
|
4819
|
+
);
|
|
4820
|
+
})) == null ? void 0 : _a.commands.find(
|
|
4821
|
+
// @ts-ignore
|
|
4822
|
+
(item) => {
|
|
4823
|
+
var _a2;
|
|
4824
|
+
return ((_a2 = item == null ? void 0 : item.id) == null ? void 0 : _a2.toLowerCase()) === sanitizedSubCommandId;
|
|
4039
4825
|
}
|
|
4040
|
-
|
|
4826
|
+
);
|
|
4827
|
+
if (!group) {
|
|
4828
|
+
return groups;
|
|
4041
4829
|
}
|
|
4042
|
-
|
|
4043
|
-
|
|
4830
|
+
search = search.replace(subCommandId || "", "");
|
|
4831
|
+
newGroups = [
|
|
4832
|
+
__spreadProps(__spreadValues({}, group), {
|
|
4833
|
+
commands: (group == null ? void 0 : group.commands) || []
|
|
4834
|
+
})
|
|
4835
|
+
];
|
|
4836
|
+
}
|
|
4837
|
+
const filteredGroups = newGroups.map((group) => {
|
|
4838
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
4839
|
+
commands: group.commands.filter((item) => {
|
|
4840
|
+
var _a2;
|
|
4841
|
+
if (typeof query === "string" && query.length > 0) {
|
|
4842
|
+
const show = (_a2 = item == null ? void 0 : item.render) == null ? void 0 : _a2.call(item, editor);
|
|
4843
|
+
if (show === null) {
|
|
4844
|
+
return false;
|
|
4845
|
+
}
|
|
4846
|
+
return item.title.toLowerCase().includes(search) || (item == null ? void 0 : item.description) && (item == null ? void 0 : item.description.toLowerCase().includes(search)) || item.searchTerms && item.searchTerms.some(
|
|
4847
|
+
(term) => term.includes(search)
|
|
4848
|
+
);
|
|
4849
|
+
}
|
|
4850
|
+
return true;
|
|
4851
|
+
}).map((item) => {
|
|
4852
|
+
const isSubCommandItem = "commands" in item;
|
|
4853
|
+
if (isSubCommandItem) {
|
|
4854
|
+
item = __spreadProps(__spreadValues({}, item), {
|
|
4855
|
+
command: (options) => {
|
|
4856
|
+
const { editor: editor2, range } = options;
|
|
4857
|
+
editor2.chain().focus().insertContentAt(range, `/${item.id}.`).run();
|
|
4858
|
+
}
|
|
4859
|
+
});
|
|
4860
|
+
}
|
|
4861
|
+
return item;
|
|
4862
|
+
})
|
|
4863
|
+
});
|
|
4864
|
+
}).filter((group) => group.commands.length > 0);
|
|
4865
|
+
return filteredGroups;
|
|
4866
|
+
},
|
|
4867
|
+
allow: ({ editor }) => {
|
|
4868
|
+
const isInsideHTMLCodeBlock = editor.isActive("htmlCodeBlock");
|
|
4869
|
+
if (isInsideHTMLCodeBlock) {
|
|
4870
|
+
return false;
|
|
4871
|
+
}
|
|
4872
|
+
return true;
|
|
4044
4873
|
},
|
|
4045
4874
|
render: () => {
|
|
4046
4875
|
let component;
|
|
4047
4876
|
let popup = null;
|
|
4048
4877
|
return {
|
|
4049
4878
|
onStart: (props) => {
|
|
4050
|
-
component = new
|
|
4879
|
+
component = new import_react29.ReactRenderer(CommandList, {
|
|
4051
4880
|
props,
|
|
4052
4881
|
editor: props.editor
|
|
4053
4882
|
});
|
|
@@ -4088,16 +4917,21 @@ function getSlashCommandSuggestions(commands = DEFAULT_SLASH_COMMANDS) {
|
|
|
4088
4917
|
|
|
4089
4918
|
// src/editor/nodes/variable/variable.ts
|
|
4090
4919
|
var import_core14 = require("@tiptap/core");
|
|
4091
|
-
var
|
|
4092
|
-
var
|
|
4920
|
+
var import_state3 = require("@tiptap/pm/state");
|
|
4921
|
+
var import_react31 = require("@tiptap/react");
|
|
4093
4922
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"));
|
|
4094
|
-
var VariablePluginKey = new
|
|
4923
|
+
var VariablePluginKey = new import_state3.PluginKey("variable");
|
|
4095
4924
|
var VariableExtension = import_core14.Node.create({
|
|
4096
4925
|
name: "variable",
|
|
4097
4926
|
group: "inline",
|
|
4098
4927
|
inline: true,
|
|
4099
4928
|
selectable: true,
|
|
4100
4929
|
atom: true,
|
|
4930
|
+
addStorage() {
|
|
4931
|
+
return {
|
|
4932
|
+
popover: false
|
|
4933
|
+
};
|
|
4934
|
+
},
|
|
4101
4935
|
addOptions() {
|
|
4102
4936
|
return {
|
|
4103
4937
|
variables: [],
|
|
@@ -4242,7 +5076,7 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4242
5076
|
];
|
|
4243
5077
|
},
|
|
4244
5078
|
addNodeView() {
|
|
4245
|
-
return (0,
|
|
5079
|
+
return (0, import_react31.ReactNodeViewRenderer)(VariableView, {
|
|
4246
5080
|
className: "mly-relative mly-inline-block",
|
|
4247
5081
|
as: "div"
|
|
4248
5082
|
});
|
|
@@ -4250,14 +5084,14 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4250
5084
|
});
|
|
4251
5085
|
|
|
4252
5086
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
4253
|
-
var
|
|
4254
|
-
var
|
|
5087
|
+
var import_react32 = require("@tiptap/react");
|
|
5088
|
+
var import_react33 = require("react");
|
|
4255
5089
|
var import_tippy2 = __toESM(require("tippy.js"));
|
|
4256
|
-
var
|
|
4257
|
-
var VariableList = (0,
|
|
5090
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5091
|
+
var VariableList = (0, import_react33.forwardRef)((props, ref) => {
|
|
4258
5092
|
const { items = [] } = props;
|
|
4259
|
-
const popoverRef = (0,
|
|
4260
|
-
(0,
|
|
5093
|
+
const popoverRef = (0, import_react33.useRef)(null);
|
|
5094
|
+
(0, import_react33.useImperativeHandle)(ref, () => ({
|
|
4261
5095
|
onKeyDown: ({ event }) => {
|
|
4262
5096
|
if (!popoverRef.current) {
|
|
4263
5097
|
return false;
|
|
@@ -4280,7 +5114,7 @@ var VariableList = (0, import_react35.forwardRef)((props, ref) => {
|
|
|
4280
5114
|
return false;
|
|
4281
5115
|
}
|
|
4282
5116
|
}));
|
|
4283
|
-
return /* @__PURE__ */ (0,
|
|
5117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4284
5118
|
VariablePopover,
|
|
4285
5119
|
{
|
|
4286
5120
|
items,
|
|
@@ -4311,7 +5145,7 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4311
5145
|
let popup = null;
|
|
4312
5146
|
return {
|
|
4313
5147
|
onStart: (props) => {
|
|
4314
|
-
component = new
|
|
5148
|
+
component = new import_react32.ReactRenderer(variableListComponent, {
|
|
4315
5149
|
props,
|
|
4316
5150
|
editor: props.editor
|
|
4317
5151
|
});
|
|
@@ -4357,6 +5191,24 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4357
5191
|
}
|
|
4358
5192
|
};
|
|
4359
5193
|
}
|
|
5194
|
+
|
|
5195
|
+
// src/editor/extensions/placeholder.ts
|
|
5196
|
+
var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"));
|
|
5197
|
+
var PlaceholderExtension = import_extension_placeholder.default.configure({
|
|
5198
|
+
placeholder: ({ node }) => {
|
|
5199
|
+
if (node.type.name === "heading") {
|
|
5200
|
+
return `Heading ${node.attrs.level}`;
|
|
5201
|
+
} else if (node.type.name === "htmlCodeBlock") {
|
|
5202
|
+
return "Type your HTML code...";
|
|
5203
|
+
} else if (["columns", "column", "section", "repeat", "show", "blockquote"].includes(
|
|
5204
|
+
node.type.name
|
|
5205
|
+
)) {
|
|
5206
|
+
return "";
|
|
5207
|
+
}
|
|
5208
|
+
return "Write something or / to see commands";
|
|
5209
|
+
},
|
|
5210
|
+
includeChildren: true
|
|
5211
|
+
});
|
|
4360
5212
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4361
5213
|
0 && (module.exports = {
|
|
4362
5214
|
ButtonExtension,
|
|
@@ -4390,12 +5242,14 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4390
5242
|
DEFAULT_SECTION_PADDING_RIGHT,
|
|
4391
5243
|
DEFAULT_SECTION_PADDING_TOP,
|
|
4392
5244
|
DEFAULT_SECTION_SHOW_IF_KEY,
|
|
5245
|
+
DEFAULT_SPACER_HEIGHT,
|
|
4393
5246
|
Footer,
|
|
4394
5247
|
HorizontalRule,
|
|
4395
5248
|
ImageExtension,
|
|
4396
5249
|
LinkExtension,
|
|
4397
5250
|
LogoExtension,
|
|
4398
5251
|
MailyKit,
|
|
5252
|
+
PlaceholderExtension,
|
|
4399
5253
|
RepeatExtension,
|
|
4400
5254
|
SectionExtension,
|
|
4401
5255
|
SlashCommandExtension,
|
|
@@ -4407,7 +5261,6 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4407
5261
|
allowedButtonVariant,
|
|
4408
5262
|
allowedLogoAlignment,
|
|
4409
5263
|
allowedLogoSize,
|
|
4410
|
-
allowedSpacerSize,
|
|
4411
5264
|
getSlashCommandSuggestions,
|
|
4412
5265
|
getVariableSuggestions,
|
|
4413
5266
|
logoSizes
|