@maily-to/core 0.0.26 → 0.1.0
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 +20 -4
- package/dist/blocks/index.d.ts +20 -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 +33 -12
- package/dist/extensions/index.d.ts +33 -12
- package/dist/extensions/index.js +1299 -469
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +1245 -409
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.d.mts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +3387 -1994
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3622 -2222
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
- package/readme.md +85 -7
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,747 @@ 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
|
+
commands: [
|
|
2399
|
+
headerLogoWithTextVertical,
|
|
2400
|
+
headerLogoWithTextHorizontal,
|
|
2401
|
+
headerLogoWithCoverImage
|
|
2402
|
+
]
|
|
2403
|
+
},
|
|
2404
|
+
{
|
|
2405
|
+
id: "footers",
|
|
2406
|
+
title: "Footers",
|
|
2407
|
+
description: "Add pre-designed footers block",
|
|
2408
|
+
searchTerms: ["footers"],
|
|
2409
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2410
|
+
commands: [
|
|
2411
|
+
footerCopyrightText,
|
|
2412
|
+
footerCommunityFeedbackCta,
|
|
2413
|
+
footerCompanySignature
|
|
2414
|
+
]
|
|
2415
|
+
},
|
|
2416
|
+
htmlCodeBlock
|
|
2417
|
+
]
|
|
2418
|
+
}
|
|
1721
2419
|
];
|
|
1722
2420
|
|
|
1723
2421
|
// src/editor/nodes/variable/variable-view.tsx
|
|
1724
2422
|
var import_react3 = require("@tiptap/react");
|
|
1725
|
-
var
|
|
1726
|
-
var
|
|
2423
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2424
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1727
2425
|
function VariableView(props) {
|
|
1728
2426
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
1729
2427
|
const { id, fallback, required } = node.attrs;
|
|
1730
2428
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
1731
|
-
return /* @__PURE__ */ (0,
|
|
2429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1732
2430
|
import_react3.NodeViewWrapper,
|
|
1733
2431
|
{
|
|
1734
2432
|
className: "react-component mly-inline-block mly-leading-none",
|
|
1735
2433
|
draggable: "false",
|
|
1736
|
-
children: /* @__PURE__ */ (0,
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
{
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
},
|
|
1746
|
-
children: renderVariable({
|
|
2434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2435
|
+
Popover,
|
|
2436
|
+
{
|
|
2437
|
+
onOpenChange: (open) => {
|
|
2438
|
+
editor.storage.variable.popover = open;
|
|
2439
|
+
},
|
|
2440
|
+
children: [
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PopoverTrigger, { children: renderVariable({
|
|
1747
2442
|
variable: { name: id, required, valid: true },
|
|
1748
2443
|
fallback,
|
|
1749
2444
|
editor,
|
|
1750
2445
|
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
|
-
|
|
2446
|
+
}) }),
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2448
|
+
PopoverContent,
|
|
2449
|
+
{
|
|
2450
|
+
align: "start",
|
|
2451
|
+
side: "bottom",
|
|
2452
|
+
className: "mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
2453
|
+
sideOffset: 8,
|
|
2454
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2455
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2456
|
+
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: [
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "mly-relative", children: [
|
|
2458
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-inline-block mly-px-2 mly-text-xs mly-text-midnight-gray", children: "Variable" }),
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2460
|
+
"input",
|
|
2461
|
+
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2462
|
+
value: id != null ? id : "",
|
|
2463
|
+
onChange: (e) => {
|
|
2464
|
+
updateAttributes2({
|
|
2465
|
+
id: e.target.value
|
|
2466
|
+
});
|
|
2467
|
+
},
|
|
2468
|
+
placeholder: "ie. name...",
|
|
2469
|
+
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"
|
|
2470
|
+
})
|
|
2471
|
+
)
|
|
2472
|
+
] }),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Divider, { className: "mly-mx-1.5" }),
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "mly-relative", children: [
|
|
2475
|
+
/* @__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" }),
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2477
|
+
"input",
|
|
2478
|
+
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2479
|
+
value: fallback != null ? fallback : "",
|
|
2480
|
+
onChange: (e) => {
|
|
2481
|
+
updateAttributes2({
|
|
2482
|
+
fallback: e.target.value
|
|
2483
|
+
});
|
|
2484
|
+
},
|
|
2485
|
+
placeholder: "ie. John Doe...",
|
|
2486
|
+
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"
|
|
2487
|
+
})
|
|
2488
|
+
),
|
|
2489
|
+
/* @__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" }) })
|
|
2490
|
+
] })
|
|
2491
|
+
] }) })
|
|
2492
|
+
}
|
|
2493
|
+
)
|
|
2494
|
+
]
|
|
2495
|
+
}
|
|
2496
|
+
)
|
|
1802
2497
|
}
|
|
1803
2498
|
);
|
|
1804
2499
|
}
|
|
@@ -1806,13 +2501,13 @@ var DefaultRenderVariable = (props) => {
|
|
|
1806
2501
|
const { variable, fallback, from } = props;
|
|
1807
2502
|
const { name, required, valid } = variable;
|
|
1808
2503
|
if (from === "button-variable") {
|
|
1809
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
2504
|
+
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: [
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1812
2507
|
] });
|
|
1813
2508
|
}
|
|
1814
2509
|
if (from === "bubble-variable") {
|
|
1815
|
-
return /* @__PURE__ */ (0,
|
|
2510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1816
2511
|
"div",
|
|
1817
2512
|
{
|
|
1818
2513
|
className: cn(
|
|
@@ -1820,28 +2515,28 @@ var DefaultRenderVariable = (props) => {
|
|
|
1820
2515
|
!valid && "mly-border-rose-400 mly-bg-rose-50 mly-text-rose-600 hover:mly-bg-rose-100"
|
|
1821
2516
|
),
|
|
1822
2517
|
children: [
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
2518
|
+
/* @__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" }),
|
|
2519
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1825
2520
|
]
|
|
1826
2521
|
}
|
|
1827
2522
|
);
|
|
1828
2523
|
}
|
|
1829
|
-
return /* @__PURE__ */ (0,
|
|
2524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1830
2525
|
"span",
|
|
1831
2526
|
{
|
|
1832
2527
|
tabIndex: -1,
|
|
1833
2528
|
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
2529
|
children: [
|
|
1835
|
-
/* @__PURE__ */ (0,
|
|
2530
|
+
/* @__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
2531
|
name,
|
|
1837
|
-
required && !fallback && /* @__PURE__ */ (0,
|
|
2532
|
+
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
2533
|
]
|
|
1839
2534
|
}
|
|
1840
2535
|
);
|
|
1841
2536
|
};
|
|
1842
2537
|
|
|
1843
2538
|
// src/editor/provider.tsx
|
|
1844
|
-
var
|
|
2539
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1845
2540
|
var DEFAULT_PLACEHOLDER_URL = "maily.to/";
|
|
1846
2541
|
var DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
|
|
1847
2542
|
var DEFAULT_VARIABLES = [];
|
|
@@ -1862,9 +2557,9 @@ function useMailyContext() {
|
|
|
1862
2557
|
}
|
|
1863
2558
|
|
|
1864
2559
|
// src/editor/nodes/variable/variable-popover.tsx
|
|
1865
|
-
var
|
|
2560
|
+
var import_lucide_react11 = require("lucide-react");
|
|
1866
2561
|
var import_react5 = require("react");
|
|
1867
|
-
var
|
|
2562
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1868
2563
|
var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
1869
2564
|
const { items, onSelectItem } = props;
|
|
1870
2565
|
const [selectedIndex, setSelectedIndex] = (0, import_react5.useState)(0);
|
|
@@ -1910,17 +2605,17 @@ var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
1910
2605
|
onSelectItem(item);
|
|
1911
2606
|
}
|
|
1912
2607
|
}));
|
|
1913
|
-
return /* @__PURE__ */ (0,
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
1915
|
-
/* @__PURE__ */ (0,
|
|
1916
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
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: [
|
|
2609
|
+
/* @__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: [
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mly-text-xs mly-uppercase", children: "Variables" }),
|
|
2611
|
+
/* @__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
2612
|
] }),
|
|
1918
|
-
/* @__PURE__ */ (0,
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1919
2614
|
"div",
|
|
1920
2615
|
{
|
|
1921
2616
|
ref: scrollContainerRef,
|
|
1922
2617
|
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,
|
|
2618
|
+
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
2619
|
"button",
|
|
1925
2620
|
{
|
|
1926
2621
|
ref: (el) => itemRefs.current[index] = el,
|
|
@@ -1930,27 +2625,27 @@ var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
|
1930
2625
|
index === selectedIndex ? "mly-bg-soft-gray" : "mly-bg-white"
|
|
1931
2626
|
),
|
|
1932
2627
|
children: [
|
|
1933
|
-
/* @__PURE__ */ (0,
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.Braces, { className: "mly-size-3 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1934
2629
|
item.name
|
|
1935
2630
|
]
|
|
1936
2631
|
},
|
|
1937
2632
|
index
|
|
1938
|
-
)) : /* @__PURE__ */ (0,
|
|
2633
|
+
)) : /* @__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
2634
|
}
|
|
1940
2635
|
),
|
|
1941
|
-
/* @__PURE__ */ (0,
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
1943
|
-
/* @__PURE__ */ (0,
|
|
1944
|
-
/* @__PURE__ */ (0,
|
|
1945
|
-
/* @__PURE__ */ (0,
|
|
2636
|
+
/* @__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: [
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1", children: [
|
|
2638
|
+
/* @__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]" }) }),
|
|
2639
|
+
/* @__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]" }) }),
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "mly-text-xs mly-text-gray-500", children: "Navigate" })
|
|
1946
2641
|
] }),
|
|
1947
|
-
/* @__PURE__ */ (0,
|
|
2642
|
+
/* @__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
2643
|
] })
|
|
1949
2644
|
] });
|
|
1950
2645
|
});
|
|
1951
2646
|
function VariableIcon(props) {
|
|
1952
2647
|
const { className, children } = props;
|
|
1953
|
-
return /* @__PURE__ */ (0,
|
|
2648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1954
2649
|
"div",
|
|
1955
2650
|
{
|
|
1956
2651
|
className: cn(
|
|
@@ -1985,9 +2680,9 @@ function useOutsideClick(ref, callback) {
|
|
|
1985
2680
|
}
|
|
1986
2681
|
|
|
1987
2682
|
// src/editor/components/ui/input-autocomplete.tsx
|
|
1988
|
-
var
|
|
2683
|
+
var import_lucide_react12 = require("lucide-react");
|
|
1989
2684
|
var import_react8 = require("react");
|
|
1990
|
-
var
|
|
2685
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1991
2686
|
var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
1992
2687
|
const _a = props, {
|
|
1993
2688
|
value = "",
|
|
@@ -2012,9 +2707,9 @@ var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
2012
2707
|
onOutsideClick == null ? void 0 : onOutsideClick();
|
|
2013
2708
|
});
|
|
2014
2709
|
const isTriggeringVariable = value.startsWith(triggerChar);
|
|
2015
|
-
return /* @__PURE__ */ (0,
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
2710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("mly-relative"), ref: containerRef, children: [
|
|
2711
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "mly-relative", children: [
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2018
2713
|
"input",
|
|
2019
2714
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2020
2715
|
placeholder: "e.g. items",
|
|
@@ -2026,7 +2721,7 @@ var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
2026
2721
|
onValueChange(e.target.value);
|
|
2027
2722
|
},
|
|
2028
2723
|
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",
|
|
2724
|
+
"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
2725
|
className
|
|
2031
2726
|
),
|
|
2032
2727
|
onKeyDown: (e) => {
|
|
@@ -2048,9 +2743,9 @@ var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
|
2048
2743
|
spellCheck: false
|
|
2049
2744
|
})
|
|
2050
2745
|
),
|
|
2051
|
-
/* @__PURE__ */ (0,
|
|
2746
|
+
/* @__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
2747
|
] }),
|
|
2053
|
-
isTriggeringVariable && /* @__PURE__ */ (0,
|
|
2748
|
+
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
2749
|
VariablePopover,
|
|
2055
2750
|
{
|
|
2056
2751
|
items: autoCompleteOptions.map((option) => {
|
|
@@ -2092,7 +2787,7 @@ You can check out the documentation for more information: https://github.com/ari
|
|
|
2092
2787
|
|
|
2093
2788
|
// src/editor/components/ui/link-input-popover.tsx
|
|
2094
2789
|
var import_react10 = require("react");
|
|
2095
|
-
var
|
|
2790
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2096
2791
|
var LINK_PROTOCOL_REGEX = /https?:\/\//;
|
|
2097
2792
|
function LinkInputPopover(props) {
|
|
2098
2793
|
var _a;
|
|
@@ -2100,7 +2795,7 @@ function LinkInputPopover(props) {
|
|
|
2100
2795
|
defaultValue = "",
|
|
2101
2796
|
onValueChange,
|
|
2102
2797
|
tooltip,
|
|
2103
|
-
icon: Icon =
|
|
2798
|
+
icon: Icon = import_lucide_react13.Link,
|
|
2104
2799
|
editor,
|
|
2105
2800
|
isVariable
|
|
2106
2801
|
} = props;
|
|
@@ -2130,7 +2825,7 @@ function LinkInputPopover(props) {
|
|
|
2130
2825
|
editor
|
|
2131
2826
|
}).map((variable) => variable.name);
|
|
2132
2827
|
}, [variables, defaultUrlWithoutProtocol, editor]);
|
|
2133
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
2828
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2134
2829
|
BaseButton,
|
|
2135
2830
|
{
|
|
2136
2831
|
variant: "ghost",
|
|
@@ -2138,19 +2833,19 @@ function LinkInputPopover(props) {
|
|
|
2138
2833
|
type: "button",
|
|
2139
2834
|
className: "mly-size-7",
|
|
2140
2835
|
"data-state": !!defaultUrlWithoutProtocol,
|
|
2141
|
-
children: /* @__PURE__ */ (0,
|
|
2836
|
+
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
2837
|
}
|
|
2143
2838
|
) });
|
|
2144
2839
|
const normalizeProtocol = (value, p = protocol) => {
|
|
2145
2840
|
value = value == null ? void 0 : value.replace(LINK_PROTOCOL_REGEX, "");
|
|
2146
2841
|
return p + value;
|
|
2147
2842
|
};
|
|
2148
|
-
return /* @__PURE__ */ (0,
|
|
2149
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2844
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Tooltip, { children: [
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2152
2847
|
] }) : popoverButton,
|
|
2153
|
-
/* @__PURE__ */ (0,
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2154
2849
|
PopoverContent,
|
|
2155
2850
|
{
|
|
2156
2851
|
align: "end",
|
|
@@ -2158,7 +2853,7 @@ function LinkInputPopover(props) {
|
|
|
2158
2853
|
className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
|
|
2159
2854
|
sideOffset: 8,
|
|
2160
2855
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2161
|
-
children: /* @__PURE__ */ (0,
|
|
2856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2162
2857
|
"form",
|
|
2163
2858
|
{
|
|
2164
2859
|
onSubmit: (e) => {
|
|
@@ -2171,8 +2866,8 @@ function LinkInputPopover(props) {
|
|
|
2171
2866
|
onValueChange == null ? void 0 : onValueChange(value);
|
|
2172
2867
|
setIsOpen(false);
|
|
2173
2868
|
},
|
|
2174
|
-
children: /* @__PURE__ */ (0,
|
|
2175
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
2869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
2870
|
+
!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
2871
|
"button",
|
|
2177
2872
|
{
|
|
2178
2873
|
onClick: () => {
|
|
@@ -2193,9 +2888,9 @@ function LinkInputPopover(props) {
|
|
|
2193
2888
|
})
|
|
2194
2889
|
}
|
|
2195
2890
|
) }),
|
|
2196
|
-
isEditing && /* @__PURE__ */ (0,
|
|
2197
|
-
/* @__PURE__ */ (0,
|
|
2198
|
-
/* @__PURE__ */ (0,
|
|
2891
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mly-relative", children: [
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2199
2894
|
"select",
|
|
2200
2895
|
{
|
|
2201
2896
|
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 +2907,13 @@ function LinkInputPopover(props) {
|
|
|
2212
2907
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
2213
2908
|
},
|
|
2214
2909
|
children: [
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2910
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "https://", children: "https://" }),
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: "http://", children: "http://" })
|
|
2217
2912
|
]
|
|
2218
2913
|
}
|
|
2219
2914
|
),
|
|
2220
|
-
/* @__PURE__ */ (0,
|
|
2221
|
-
|
|
2915
|
+
/* @__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)(
|
|
2916
|
+
import_lucide_react13.ChevronDownIcon,
|
|
2222
2917
|
{
|
|
2223
2918
|
size: 16,
|
|
2224
2919
|
strokeWidth: 2,
|
|
@@ -2227,7 +2922,7 @@ function LinkInputPopover(props) {
|
|
|
2227
2922
|
}
|
|
2228
2923
|
) })
|
|
2229
2924
|
] }),
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2925
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2231
2926
|
InputAutocomplete,
|
|
2232
2927
|
{
|
|
2233
2928
|
value: defaultUrlWithoutProtocol,
|
|
@@ -2264,8 +2959,8 @@ function LinkInputPopover(props) {
|
|
|
2264
2959
|
|
|
2265
2960
|
// src/editor/components/ui/select.tsx
|
|
2266
2961
|
var import_react11 = require("react");
|
|
2267
|
-
var
|
|
2268
|
-
var
|
|
2962
|
+
var import_lucide_react14 = require("lucide-react");
|
|
2963
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2269
2964
|
function Select(props) {
|
|
2270
2965
|
const {
|
|
2271
2966
|
label,
|
|
@@ -2278,10 +2973,10 @@ function Select(props) {
|
|
|
2278
2973
|
iconClassName
|
|
2279
2974
|
} = props;
|
|
2280
2975
|
const selectId = `mly${(0, import_react11.useId)()}`;
|
|
2281
|
-
const content = /* @__PURE__ */ (0,
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2283
|
-
Icon && /* @__PURE__ */ (0,
|
|
2284
|
-
/* @__PURE__ */ (0,
|
|
2976
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
2978
|
+
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) }) }),
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2285
2980
|
"select",
|
|
2286
2981
|
{
|
|
2287
2982
|
id: selectId,
|
|
@@ -2292,11 +2987,11 @@ function Select(props) {
|
|
|
2292
2987
|
),
|
|
2293
2988
|
value,
|
|
2294
2989
|
onChange: (event) => onValueChange(event.target.value),
|
|
2295
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
2990
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
2296
2991
|
}
|
|
2297
2992
|
),
|
|
2298
|
-
/* @__PURE__ */ (0,
|
|
2299
|
-
|
|
2993
|
+
/* @__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)(
|
|
2994
|
+
import_lucide_react14.ChevronDownIcon,
|
|
2300
2995
|
{
|
|
2301
2996
|
size: 16,
|
|
2302
2997
|
strokeWidth: 2,
|
|
@@ -2308,27 +3003,25 @@ function Select(props) {
|
|
|
2308
3003
|
if (!tooltip) {
|
|
2309
3004
|
return content;
|
|
2310
3005
|
}
|
|
2311
|
-
return /* @__PURE__ */ (0,
|
|
2312
|
-
/* @__PURE__ */ (0,
|
|
2313
|
-
/* @__PURE__ */ (0,
|
|
3006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
3007
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: content }),
|
|
3008
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2314
3009
|
] });
|
|
2315
3010
|
}
|
|
2316
3011
|
|
|
2317
3012
|
// src/editor/nodes/button/button-view.tsx
|
|
2318
|
-
var
|
|
3013
|
+
var import_react16 = require("@tiptap/react");
|
|
2319
3014
|
|
|
2320
3015
|
// src/editor/components/show-popover.tsx
|
|
2321
|
-
var
|
|
3016
|
+
var import_lucide_react15 = require("lucide-react");
|
|
2322
3017
|
var import_react12 = require("react");
|
|
2323
|
-
var
|
|
2324
|
-
var import_react14 = require("react");
|
|
2325
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3018
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2326
3019
|
function _ShowPopover(props) {
|
|
2327
3020
|
const { showIfKey = "", onShowIfKeyValueChange, editor } = props;
|
|
2328
3021
|
const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2329
3022
|
const [isUpdatingKey, setIsUpdatingKey] = (0, import_react12.useState)(false);
|
|
2330
3023
|
const inputRef = (0, import_react12.useRef)(null);
|
|
2331
|
-
const autoCompleteOptions = (0,
|
|
3024
|
+
const autoCompleteOptions = (0, import_react12.useMemo)(() => {
|
|
2332
3025
|
return processVariables(variables, {
|
|
2333
3026
|
query: showIfKey || "",
|
|
2334
3027
|
from: "bubble-variable",
|
|
@@ -2336,7 +3029,7 @@ function _ShowPopover(props) {
|
|
|
2336
3029
|
}).map((variable) => variable.name);
|
|
2337
3030
|
}, [variables, showIfKey, editor]);
|
|
2338
3031
|
const isValidWhenKey = showIfKey || autoCompleteOptions.includes(showIfKey);
|
|
2339
|
-
return /* @__PURE__ */ (0,
|
|
3032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2340
3033
|
Popover,
|
|
2341
3034
|
{
|
|
2342
3035
|
onOpenChange: (open) => {
|
|
@@ -2346,20 +3039,20 @@ function _ShowPopover(props) {
|
|
|
2346
3039
|
setIsUpdatingKey(false);
|
|
2347
3040
|
},
|
|
2348
3041
|
children: [
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
3042
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2351
3044
|
PopoverTrigger,
|
|
2352
3045
|
{
|
|
2353
3046
|
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",
|
|
3047
|
+
"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
3048
|
showIfKey && "mly-bg-rose-100 mly-text-rose-800 data-[state=open]:mly-bg-rose-100 hover:mly-bg-rose-100"
|
|
2356
3049
|
),
|
|
2357
|
-
children: /* @__PURE__ */ (0,
|
|
3050
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Eye, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5]" })
|
|
2358
3051
|
}
|
|
2359
3052
|
) }),
|
|
2360
|
-
/* @__PURE__ */ (0,
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { sideOffset: 8, children: "Show block conditionally" })
|
|
2361
3054
|
] }),
|
|
2362
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2363
3056
|
PopoverContent,
|
|
2364
3057
|
{
|
|
2365
3058
|
className: "mly-flex mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
@@ -2373,8 +3066,27 @@ function _ShowPopover(props) {
|
|
|
2373
3066
|
e.preventDefault();
|
|
2374
3067
|
},
|
|
2375
3068
|
children: [
|
|
2376
|
-
/* @__PURE__ */ (0,
|
|
2377
|
-
|
|
3069
|
+
/* @__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: [
|
|
3070
|
+
"Show if",
|
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3072
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3073
|
+
import_lucide_react15.InfoIcon,
|
|
3074
|
+
{
|
|
3075
|
+
className: cn("mly-size-3 mly-stroke-[2.5] mly-text-gray-500")
|
|
3076
|
+
}
|
|
3077
|
+
) }),
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3079
|
+
TooltipContent,
|
|
3080
|
+
{
|
|
3081
|
+
sideOffset: 14,
|
|
3082
|
+
className: "mly-max-w-[285px]",
|
|
3083
|
+
align: "start",
|
|
3084
|
+
children: "Show the block if the selected variable is true."
|
|
3085
|
+
}
|
|
3086
|
+
)
|
|
3087
|
+
] })
|
|
3088
|
+
] }),
|
|
3089
|
+
!isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2378
3090
|
"button",
|
|
2379
3091
|
{
|
|
2380
3092
|
onClick: () => {
|
|
@@ -2395,7 +3107,7 @@ function _ShowPopover(props) {
|
|
|
2395
3107
|
})
|
|
2396
3108
|
}
|
|
2397
3109
|
),
|
|
2398
|
-
isUpdatingKey && /* @__PURE__ */ (0,
|
|
3110
|
+
isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2399
3111
|
"form",
|
|
2400
3112
|
{
|
|
2401
3113
|
onSubmit: (e) => {
|
|
@@ -2407,7 +3119,7 @@ function _ShowPopover(props) {
|
|
|
2407
3119
|
setIsUpdatingKey(false);
|
|
2408
3120
|
}
|
|
2409
3121
|
},
|
|
2410
|
-
children: /* @__PURE__ */ (0,
|
|
3122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2411
3123
|
InputAutocomplete,
|
|
2412
3124
|
{
|
|
2413
3125
|
value: showIfKey || "",
|
|
@@ -2434,24 +3146,24 @@ function _ShowPopover(props) {
|
|
|
2434
3146
|
}
|
|
2435
3147
|
);
|
|
2436
3148
|
}
|
|
2437
|
-
var ShowPopover = (0,
|
|
3149
|
+
var ShowPopover = (0, import_react12.memo)(_ShowPopover);
|
|
2438
3150
|
|
|
2439
3151
|
// src/editor/nodes/button/button-label-input.tsx
|
|
3152
|
+
var import_react13 = require("react");
|
|
3153
|
+
var import_react14 = require("react");
|
|
2440
3154
|
var import_react15 = require("react");
|
|
2441
|
-
var
|
|
2442
|
-
var import_react17 = require("react");
|
|
2443
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3155
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2444
3156
|
function ButtonLabelInput(props) {
|
|
2445
3157
|
const { value, onValueChange, isVariable, editor } = props;
|
|
2446
|
-
const linkInputRef = (0,
|
|
2447
|
-
const [isEditing, setIsEditing] = (0,
|
|
3158
|
+
const linkInputRef = (0, import_react15.useRef)(null);
|
|
3159
|
+
const [isEditing, setIsEditing] = (0, import_react14.useState)(!isVariable);
|
|
2448
3160
|
const {
|
|
2449
3161
|
variables = [],
|
|
2450
3162
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
2451
3163
|
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
2452
3164
|
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
2453
3165
|
} = useMailyContext();
|
|
2454
|
-
const autoCompleteOptions = (0,
|
|
3166
|
+
const autoCompleteOptions = (0, import_react13.useMemo)(() => {
|
|
2455
3167
|
const withoutTrigger = value.replace(
|
|
2456
3168
|
new RegExp(variableTriggerCharacter, "g"),
|
|
2457
3169
|
""
|
|
@@ -2462,8 +3174,8 @@ function ButtonLabelInput(props) {
|
|
|
2462
3174
|
editor
|
|
2463
3175
|
}).map((variable) => variable.name);
|
|
2464
3176
|
}, [variables, value, editor]);
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2466
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
3177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
3178
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2467
3179
|
"button",
|
|
2468
3180
|
{
|
|
2469
3181
|
onClick: () => {
|
|
@@ -2484,7 +3196,7 @@ function ButtonLabelInput(props) {
|
|
|
2484
3196
|
})
|
|
2485
3197
|
}
|
|
2486
3198
|
),
|
|
2487
|
-
isEditing && /* @__PURE__ */ (0,
|
|
3199
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2488
3200
|
InputAutocomplete,
|
|
2489
3201
|
{
|
|
2490
3202
|
value,
|
|
@@ -2510,8 +3222,8 @@ function ButtonLabelInput(props) {
|
|
|
2510
3222
|
}
|
|
2511
3223
|
|
|
2512
3224
|
// src/editor/nodes/button/button-view.tsx
|
|
2513
|
-
var
|
|
2514
|
-
var
|
|
3225
|
+
var import_react17 = require("react");
|
|
3226
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2515
3227
|
function ButtonView(props) {
|
|
2516
3228
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
2517
3229
|
const {
|
|
@@ -2531,7 +3243,7 @@ function ButtonView(props) {
|
|
|
2531
3243
|
paddingLeft
|
|
2532
3244
|
} = node.attrs;
|
|
2533
3245
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2534
|
-
const sizes = (0,
|
|
3246
|
+
const sizes = (0, import_react17.useMemo)(
|
|
2535
3247
|
() => ({
|
|
2536
3248
|
small: {
|
|
2537
3249
|
paddingX: 24,
|
|
@@ -2548,14 +3260,14 @@ function ButtonView(props) {
|
|
|
2548
3260
|
}),
|
|
2549
3261
|
[]
|
|
2550
3262
|
);
|
|
2551
|
-
const size = (0,
|
|
3263
|
+
const size = (0, import_react17.useMemo)(() => {
|
|
2552
3264
|
var _a;
|
|
2553
3265
|
return (_a = Object.entries(sizes).find(
|
|
2554
3266
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
2555
3267
|
)) == null ? void 0 : _a[0];
|
|
2556
3268
|
}, [paddingRight, paddingTop, sizes]);
|
|
2557
|
-
return /* @__PURE__ */ (0,
|
|
2558
|
-
|
|
3269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3270
|
+
import_react16.NodeViewWrapper,
|
|
2559
3271
|
{
|
|
2560
3272
|
draggable: editor.isEditable,
|
|
2561
3273
|
"data-drag-handle": editor.isEditable,
|
|
@@ -2563,8 +3275,8 @@ function ButtonView(props) {
|
|
|
2563
3275
|
style: {
|
|
2564
3276
|
textAlign: alignment
|
|
2565
3277
|
},
|
|
2566
|
-
children: /* @__PURE__ */ (0,
|
|
2567
|
-
/* @__PURE__ */ (0,
|
|
3278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
3279
|
+
/* @__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
3280
|
"button",
|
|
2569
3281
|
{
|
|
2570
3282
|
className: cn(
|
|
@@ -2607,7 +3319,7 @@ function ButtonView(props) {
|
|
|
2607
3319
|
}) : text2
|
|
2608
3320
|
}
|
|
2609
3321
|
) }) }),
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2611
3323
|
PopoverContent,
|
|
2612
3324
|
{
|
|
2613
3325
|
align: "end",
|
|
@@ -2616,8 +3328,8 @@ function ButtonView(props) {
|
|
|
2616
3328
|
sideOffset: 8,
|
|
2617
3329
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2618
3330
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2619
|
-
children: /* @__PURE__ */ (0,
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
3331
|
+
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: [
|
|
3332
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2621
3333
|
ButtonLabelInput,
|
|
2622
3334
|
{
|
|
2623
3335
|
value: text2,
|
|
@@ -2631,9 +3343,9 @@ function ButtonView(props) {
|
|
|
2631
3343
|
editor
|
|
2632
3344
|
}
|
|
2633
3345
|
),
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2635
|
-
/* @__PURE__ */ (0,
|
|
2636
|
-
/* @__PURE__ */ (0,
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2637
3349
|
Select,
|
|
2638
3350
|
{
|
|
2639
3351
|
label: "Border Radius",
|
|
@@ -2651,7 +3363,7 @@ function ButtonView(props) {
|
|
|
2651
3363
|
className: "mly-capitalize"
|
|
2652
3364
|
}
|
|
2653
3365
|
),
|
|
2654
|
-
/* @__PURE__ */ (0,
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2655
3367
|
Select,
|
|
2656
3368
|
{
|
|
2657
3369
|
label: "Style",
|
|
@@ -2669,7 +3381,7 @@ function ButtonView(props) {
|
|
|
2669
3381
|
className: "mly-capitalize"
|
|
2670
3382
|
}
|
|
2671
3383
|
),
|
|
2672
|
-
/* @__PURE__ */ (0,
|
|
3384
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2673
3385
|
Select,
|
|
2674
3386
|
{
|
|
2675
3387
|
label: "Size",
|
|
@@ -2692,9 +3404,9 @@ function ButtonView(props) {
|
|
|
2692
3404
|
}
|
|
2693
3405
|
)
|
|
2694
3406
|
] }),
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2696
|
-
/* @__PURE__ */ (0,
|
|
2697
|
-
/* @__PURE__ */ (0,
|
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2698
3410
|
AlignmentSwitch,
|
|
2699
3411
|
{
|
|
2700
3412
|
alignment,
|
|
@@ -2705,7 +3417,7 @@ function ButtonView(props) {
|
|
|
2705
3417
|
}
|
|
2706
3418
|
}
|
|
2707
3419
|
),
|
|
2708
|
-
/* @__PURE__ */ (0,
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2709
3421
|
LinkInputPopover,
|
|
2710
3422
|
{
|
|
2711
3423
|
defaultValue: externalLink || "",
|
|
@@ -2721,9 +3433,9 @@ function ButtonView(props) {
|
|
|
2721
3433
|
}
|
|
2722
3434
|
)
|
|
2723
3435
|
] }),
|
|
2724
|
-
/* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
3436
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3437
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2727
3439
|
BackgroundColorPickerPopup,
|
|
2728
3440
|
{
|
|
2729
3441
|
variant,
|
|
@@ -2735,7 +3447,7 @@ function ButtonView(props) {
|
|
|
2735
3447
|
}
|
|
2736
3448
|
}
|
|
2737
3449
|
),
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
3450
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2739
3451
|
TextColorPickerPopup,
|
|
2740
3452
|
{
|
|
2741
3453
|
color: textColor,
|
|
@@ -2747,8 +3459,8 @@ function ButtonView(props) {
|
|
|
2747
3459
|
}
|
|
2748
3460
|
)
|
|
2749
3461
|
] }),
|
|
2750
|
-
/* @__PURE__ */ (0,
|
|
2751
|
-
/* @__PURE__ */ (0,
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Divider, {}),
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2752
3464
|
ShowPopover,
|
|
2753
3465
|
{
|
|
2754
3466
|
showIfKey,
|
|
@@ -2769,20 +3481,20 @@ function ButtonView(props) {
|
|
|
2769
3481
|
}
|
|
2770
3482
|
function BackgroundColorPickerPopup(props) {
|
|
2771
3483
|
const { color, onChange, variant } = props;
|
|
2772
|
-
return /* @__PURE__ */ (0,
|
|
3484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2773
3485
|
ColorPicker,
|
|
2774
3486
|
{
|
|
2775
3487
|
color,
|
|
2776
3488
|
onColorChange: onChange,
|
|
2777
3489
|
tooltip: "Background Color",
|
|
2778
|
-
children: /* @__PURE__ */ (0,
|
|
3490
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2779
3491
|
BaseButton,
|
|
2780
3492
|
{
|
|
2781
3493
|
variant: "ghost",
|
|
2782
3494
|
size: "sm",
|
|
2783
3495
|
type: "button",
|
|
2784
3496
|
className: "mly-size-7",
|
|
2785
|
-
children: /* @__PURE__ */ (0,
|
|
3497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2786
3498
|
"div",
|
|
2787
3499
|
{
|
|
2788
3500
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded-full mly-shadow",
|
|
@@ -2801,16 +3513,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
2801
3513
|
}
|
|
2802
3514
|
function TextColorPickerPopup(props) {
|
|
2803
3515
|
const { color, onChange } = props;
|
|
2804
|
-
return /* @__PURE__ */ (0,
|
|
3516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2805
3517
|
BaseButton,
|
|
2806
3518
|
{
|
|
2807
3519
|
variant: "ghost",
|
|
2808
3520
|
size: "sm",
|
|
2809
3521
|
type: "button",
|
|
2810
3522
|
className: "mly-size-7",
|
|
2811
|
-
children: /* @__PURE__ */ (0,
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
3523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-midnight-gray", children: "A" }),
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2814
3526
|
"div",
|
|
2815
3527
|
{
|
|
2816
3528
|
className: "mly-h-[2px] mly-w-3 mly-shrink-0 mly-rounded-md mly-shadow",
|
|
@@ -3049,7 +3761,7 @@ var ButtonExtension = import_core10.Node.create({
|
|
|
3049
3761
|
};
|
|
3050
3762
|
},
|
|
3051
3763
|
addNodeView() {
|
|
3052
|
-
return (0,
|
|
3764
|
+
return (0, import_react18.ReactNodeViewRenderer)(ButtonView, {
|
|
3053
3765
|
contentDOMElementTag: "div",
|
|
3054
3766
|
className: "mly-relative"
|
|
3055
3767
|
});
|
|
@@ -3058,21 +3770,21 @@ var ButtonExtension = import_core10.Node.create({
|
|
|
3058
3770
|
|
|
3059
3771
|
// src/editor/nodes/logo/logo.ts
|
|
3060
3772
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
3061
|
-
var
|
|
3773
|
+
var import_react25 = require("@tiptap/react");
|
|
3062
3774
|
|
|
3063
3775
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3064
|
-
var
|
|
3065
|
-
var
|
|
3066
|
-
var
|
|
3776
|
+
var import_react22 = require("@tiptap/react");
|
|
3777
|
+
var import_react23 = require("react");
|
|
3778
|
+
var import_react24 = require("react");
|
|
3067
3779
|
|
|
3068
3780
|
// src/editor/utils/use-event.ts
|
|
3069
|
-
var
|
|
3781
|
+
var import_react19 = require("react");
|
|
3070
3782
|
var useEvent = (handler) => {
|
|
3071
|
-
const handlerRef = (0,
|
|
3072
|
-
(0,
|
|
3783
|
+
const handlerRef = (0, import_react19.useRef)(null);
|
|
3784
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
3073
3785
|
handlerRef.current = handler;
|
|
3074
3786
|
}, [handler]);
|
|
3075
|
-
return (0,
|
|
3787
|
+
return (0, import_react19.useCallback)((...args) => {
|
|
3076
3788
|
if (handlerRef.current === null) {
|
|
3077
3789
|
throw new Error("Handler is not assigned");
|
|
3078
3790
|
}
|
|
@@ -3081,18 +3793,18 @@ var useEvent = (handler) => {
|
|
|
3081
3793
|
};
|
|
3082
3794
|
|
|
3083
3795
|
// src/editor/nodes/image/image-view.tsx
|
|
3084
|
-
var
|
|
3085
|
-
var
|
|
3086
|
-
var
|
|
3087
|
-
var
|
|
3796
|
+
var import_react20 = require("@tiptap/react");
|
|
3797
|
+
var import_lucide_react16 = require("lucide-react");
|
|
3798
|
+
var import_react21 = require("react");
|
|
3799
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3088
3800
|
var MIN_WIDTH = 20;
|
|
3089
3801
|
var MAX_WIDTH = 600;
|
|
3090
3802
|
function ImageView(props) {
|
|
3091
3803
|
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,
|
|
3804
|
+
const [status, setStatus] = (0, import_react21.useState)("idle");
|
|
3805
|
+
const wrapperRef = (0, import_react21.useRef)(null);
|
|
3806
|
+
const imgRef = (0, import_react21.useRef)(null);
|
|
3807
|
+
const [resizingStyle, setResizingStyle] = (0, import_react21.useState)();
|
|
3096
3808
|
const handleMouseDown = useEvent(
|
|
3097
3809
|
(event) => {
|
|
3098
3810
|
const imageParent = document.querySelector(
|
|
@@ -3135,7 +3847,7 @@ function ImageView(props) {
|
|
|
3135
3847
|
}
|
|
3136
3848
|
);
|
|
3137
3849
|
function dragCornerButton(direction) {
|
|
3138
|
-
return /* @__PURE__ */ (0,
|
|
3850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3139
3851
|
"div",
|
|
3140
3852
|
{
|
|
3141
3853
|
role: "button",
|
|
@@ -3166,7 +3878,7 @@ function ImageView(props) {
|
|
|
3166
3878
|
"showIfKey"
|
|
3167
3879
|
]);
|
|
3168
3880
|
const hasImageSrc = !!attrs.src;
|
|
3169
|
-
(0,
|
|
3881
|
+
(0, import_react21.useEffect)(() => {
|
|
3170
3882
|
if (!src) {
|
|
3171
3883
|
return;
|
|
3172
3884
|
}
|
|
@@ -3200,8 +3912,8 @@ function ImageView(props) {
|
|
|
3200
3912
|
img.onerror = null;
|
|
3201
3913
|
};
|
|
3202
3914
|
}, [src]);
|
|
3203
|
-
return /* @__PURE__ */ (0,
|
|
3204
|
-
|
|
3915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3916
|
+
import_react20.NodeViewWrapper,
|
|
3205
3917
|
{
|
|
3206
3918
|
as: "div",
|
|
3207
3919
|
draggable: editor.isEditable,
|
|
@@ -3222,12 +3934,12 @@ function ImageView(props) {
|
|
|
3222
3934
|
}[alignment] || {}),
|
|
3223
3935
|
ref: wrapperRef,
|
|
3224
3936
|
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,
|
|
3937
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "idle", minHeight: height }),
|
|
3938
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "variable", minHeight: height }),
|
|
3939
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "loading", minHeight: height }),
|
|
3940
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageStatusLabel, { status: "error", minHeight: height }),
|
|
3941
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3942
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3231
3943
|
"img",
|
|
3232
3944
|
__spreadProps(__spreadValues({}, attrs), {
|
|
3233
3945
|
ref: imgRef,
|
|
@@ -3238,13 +3950,13 @@ function ImageView(props) {
|
|
|
3238
3950
|
draggable: editor.isEditable
|
|
3239
3951
|
})
|
|
3240
3952
|
),
|
|
3241
|
-
selected && editor.isEditable && /* @__PURE__ */ (0,
|
|
3953
|
+
selected && editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3242
3954
|
[
|
|
3243
3955
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
3244
3956
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
3245
3957
|
{ top: 0, left: 0, width: "100%", height: "1px" },
|
|
3246
3958
|
{ bottom: 0, left: 0, width: "100%", height: "1px" }
|
|
3247
|
-
].map((style, i) => /* @__PURE__ */ (0,
|
|
3959
|
+
].map((style, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3248
3960
|
"div",
|
|
3249
3961
|
{
|
|
3250
3962
|
className: "mly-bg-rose-500",
|
|
@@ -3265,33 +3977,36 @@ function ImageView(props) {
|
|
|
3265
3977
|
);
|
|
3266
3978
|
}
|
|
3267
3979
|
function ImageStatusLabel(props) {
|
|
3268
|
-
const { status } = props;
|
|
3269
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
+
const { status, minHeight } = props;
|
|
3981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3270
3982
|
"div",
|
|
3271
3983
|
{
|
|
3272
3984
|
className: cn(
|
|
3273
|
-
"mly-flex mly-items-center mly-gap-2 mly-rounded-lg mly-bg-soft-gray mly-
|
|
3985
|
+
"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
3986
|
{
|
|
3275
3987
|
"mly-text-gray-500 hover:mly-bg-soft-gray/60": status === "loading",
|
|
3276
3988
|
"mly-text-red-500 hover:mly-bg-soft-gray/60": status === "error"
|
|
3277
3989
|
}
|
|
3278
3990
|
),
|
|
3991
|
+
style: __spreadValues({}, minHeight ? {
|
|
3992
|
+
minHeight
|
|
3993
|
+
} : {}),
|
|
3279
3994
|
children: [
|
|
3280
|
-
status === "idle" && /* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3995
|
+
status === "idle" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3996
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.ImageOffIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3997
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "No image selected" })
|
|
3283
3998
|
] }),
|
|
3284
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
3285
|
-
/* @__PURE__ */ (0,
|
|
3286
|
-
/* @__PURE__ */ (0,
|
|
3999
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Loader2, { className: "mly-size-4 mly-animate-spin mly-stroke-[2.5]" }),
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Loading image..." })
|
|
3287
4002
|
] }),
|
|
3288
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
3289
|
-
/* @__PURE__ */ (0,
|
|
3290
|
-
/* @__PURE__ */ (0,
|
|
4003
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4004
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Ban, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Error loading image" })
|
|
3291
4006
|
] }),
|
|
3292
|
-
status === "variable" && /* @__PURE__ */ (0,
|
|
3293
|
-
/* @__PURE__ */ (0,
|
|
3294
|
-
/* @__PURE__ */ (0,
|
|
4007
|
+
status === "variable" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
4008
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.BracesIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Variable Image URL" })
|
|
3295
4010
|
] })
|
|
3296
4011
|
]
|
|
3297
4012
|
}
|
|
@@ -3299,10 +4014,10 @@ function ImageStatusLabel(props) {
|
|
|
3299
4014
|
}
|
|
3300
4015
|
|
|
3301
4016
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3302
|
-
var
|
|
4017
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3303
4018
|
function LogoView(props) {
|
|
3304
4019
|
const { node, editor } = props;
|
|
3305
|
-
const [status, setStatus] = (0,
|
|
4020
|
+
const [status, setStatus] = (0, import_react24.useState)("idle");
|
|
3306
4021
|
let {
|
|
3307
4022
|
alignment = "center",
|
|
3308
4023
|
src: logoSrc,
|
|
@@ -3310,7 +4025,7 @@ function LogoView(props) {
|
|
|
3310
4025
|
size = "sm"
|
|
3311
4026
|
} = node.attrs || {};
|
|
3312
4027
|
const hasImageSrc = !!logoSrc;
|
|
3313
|
-
(0,
|
|
4028
|
+
(0, import_react23.useEffect)(() => {
|
|
3314
4029
|
if (!logoSrc) {
|
|
3315
4030
|
return;
|
|
3316
4031
|
}
|
|
@@ -3330,8 +4045,8 @@ function LogoView(props) {
|
|
|
3330
4045
|
};
|
|
3331
4046
|
}, [logoSrc]);
|
|
3332
4047
|
const logoSize = logoSizes[size];
|
|
3333
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
-
|
|
4048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4049
|
+
import_react22.NodeViewWrapper,
|
|
3335
4050
|
{
|
|
3336
4051
|
as: "div",
|
|
3337
4052
|
draggable: editor.isEditable,
|
|
@@ -3344,11 +4059,11 @@ function LogoView(props) {
|
|
|
3344
4059
|
display: "block"
|
|
3345
4060
|
},
|
|
3346
4061
|
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,
|
|
4062
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "idle", minHeight: logoSize }),
|
|
4063
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "variable", minHeight: logoSize }),
|
|
4064
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "loading", minHeight: logoSize }),
|
|
4065
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ImageStatusLabel, { status: "error", minHeight: logoSize }),
|
|
4066
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3352
4067
|
"img",
|
|
3353
4068
|
{
|
|
3354
4069
|
src: logoSrc,
|
|
@@ -3468,7 +4183,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3468
4183
|
];
|
|
3469
4184
|
},
|
|
3470
4185
|
addNodeView() {
|
|
3471
|
-
return (0,
|
|
4186
|
+
return (0, import_react25.ReactNodeViewRenderer)(LogoView, {
|
|
3472
4187
|
className: "mly-relative"
|
|
3473
4188
|
});
|
|
3474
4189
|
}
|
|
@@ -3476,7 +4191,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3476
4191
|
|
|
3477
4192
|
// src/editor/nodes/image/image.ts
|
|
3478
4193
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
3479
|
-
var
|
|
4194
|
+
var import_react26 = require("@tiptap/react");
|
|
3480
4195
|
var ImageExtension = import_extension_image2.default.extend({
|
|
3481
4196
|
addAttributes() {
|
|
3482
4197
|
var _a;
|
|
@@ -3568,7 +4283,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
3568
4283
|
});
|
|
3569
4284
|
},
|
|
3570
4285
|
addNodeView() {
|
|
3571
|
-
return (0,
|
|
4286
|
+
return (0, import_react26.ReactNodeViewRenderer)(ImageView, {
|
|
3572
4287
|
className: "mly-relative"
|
|
3573
4288
|
});
|
|
3574
4289
|
}
|
|
@@ -3645,24 +4360,24 @@ var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
|
3645
4360
|
|
|
3646
4361
|
// src/editor/nodes/repeat/repeat.ts
|
|
3647
4362
|
var import_core11 = require("@tiptap/core");
|
|
3648
|
-
var
|
|
4363
|
+
var import_react28 = require("@tiptap/react");
|
|
3649
4364
|
|
|
3650
4365
|
// src/editor/nodes/repeat/repeat-view.tsx
|
|
3651
|
-
var
|
|
3652
|
-
var
|
|
3653
|
-
var
|
|
4366
|
+
var import_react27 = require("@tiptap/react");
|
|
4367
|
+
var import_lucide_react17 = require("lucide-react");
|
|
4368
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3654
4369
|
function RepeatView(props) {
|
|
3655
4370
|
const { editor, getPos } = props;
|
|
3656
|
-
return /* @__PURE__ */ (0,
|
|
3657
|
-
|
|
4371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4372
|
+
import_react27.NodeViewWrapper,
|
|
3658
4373
|
{
|
|
3659
4374
|
"data-type": "repeat",
|
|
3660
4375
|
draggable: editor.isEditable,
|
|
3661
4376
|
"data-drag-handle": editor.isEditable,
|
|
3662
4377
|
className: "mly-relative",
|
|
3663
4378
|
children: [
|
|
3664
|
-
/* @__PURE__ */ (0,
|
|
3665
|
-
/* @__PURE__ */ (0,
|
|
4379
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react27.NodeViewContent, { className: "is-editable" }),
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3666
4381
|
"div",
|
|
3667
4382
|
{
|
|
3668
4383
|
role: "button",
|
|
@@ -3673,8 +4388,8 @@ function RepeatView(props) {
|
|
|
3673
4388
|
editor.commands.setNodeSelection(getPos());
|
|
3674
4389
|
},
|
|
3675
4390
|
children: [
|
|
3676
|
-
/* @__PURE__ */ (0,
|
|
3677
|
-
/* @__PURE__ */ (0,
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
3678
4393
|
]
|
|
3679
4394
|
}
|
|
3680
4395
|
)
|
|
@@ -3758,7 +4473,7 @@ var RepeatExtension = import_core11.Node.create({
|
|
|
3758
4473
|
};
|
|
3759
4474
|
},
|
|
3760
4475
|
addNodeView() {
|
|
3761
|
-
return (0,
|
|
4476
|
+
return (0, import_react28.ReactNodeViewRenderer)(RepeatView, {
|
|
3762
4477
|
contentDOMElementTag: "div",
|
|
3763
4478
|
className: "mly-relative"
|
|
3764
4479
|
});
|
|
@@ -3819,24 +4534,6 @@ var MailyKit = import_core12.Extension.create({
|
|
|
3819
4534
|
types: [import_extension_paragraph2.default.name, import_extension_heading2.default.name, Footer.name]
|
|
3820
4535
|
}),
|
|
3821
4536
|
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
4537
|
Footer,
|
|
3841
4538
|
import_extension_focus.default,
|
|
3842
4539
|
import_extension_dropcursor.default.configure({
|
|
@@ -3914,140 +4611,250 @@ var SlashCommandExtension = import_core13.Extension.create({
|
|
|
3914
4611
|
}
|
|
3915
4612
|
});
|
|
3916
4613
|
|
|
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
4614
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
3931
|
-
var
|
|
3932
|
-
var
|
|
4615
|
+
var import_react29 = require("@tiptap/react");
|
|
4616
|
+
var import_react30 = require("react");
|
|
3933
4617
|
var import_tippy = __toESM(require("tippy.js"));
|
|
3934
|
-
var
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
const
|
|
3938
|
-
const
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
4618
|
+
var import_lucide_react18 = require("lucide-react");
|
|
4619
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4620
|
+
var CommandList = (0, import_react30.forwardRef)(function CommandList2(props, ref) {
|
|
4621
|
+
const { items: groups, command, editor } = props;
|
|
4622
|
+
const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react30.useState)(0);
|
|
4623
|
+
const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react30.useState)(0);
|
|
4624
|
+
const selectItem = (0, import_react30.useCallback)(
|
|
4625
|
+
(groupIndex, commandIndex) => {
|
|
4626
|
+
const item = groups[groupIndex].commands[commandIndex];
|
|
4627
|
+
if (!item) {
|
|
4628
|
+
return;
|
|
3943
4629
|
}
|
|
4630
|
+
command(item);
|
|
3944
4631
|
},
|
|
3945
|
-
|
|
3946
|
-
[command, editor, items]
|
|
4632
|
+
[command]
|
|
3947
4633
|
);
|
|
3948
|
-
(0,
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
if (
|
|
3954
|
-
|
|
4634
|
+
(0, import_react30.useImperativeHandle)(ref, () => ({
|
|
4635
|
+
onKeyDown: ({ event }) => {
|
|
4636
|
+
var _a, _b;
|
|
4637
|
+
const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
|
|
4638
|
+
if (navigationKeys.includes(event.key)) {
|
|
4639
|
+
if (event.key === "ArrowUp") {
|
|
4640
|
+
if (!groups.length) {
|
|
4641
|
+
return false;
|
|
4642
|
+
}
|
|
4643
|
+
let newCommandIndex = selectedCommandIndex - 1;
|
|
4644
|
+
let newGroupIndex = selectedGroupIndex;
|
|
4645
|
+
if (newCommandIndex < 0) {
|
|
4646
|
+
newGroupIndex = selectedGroupIndex - 1;
|
|
4647
|
+
newCommandIndex = ((_a = groups[newGroupIndex]) == null ? void 0 : _a.commands.length) - 1 || 0;
|
|
4648
|
+
}
|
|
4649
|
+
if (newGroupIndex < 0) {
|
|
4650
|
+
newGroupIndex = groups.length - 1;
|
|
4651
|
+
newCommandIndex = ((_b = groups[newGroupIndex]) == null ? void 0 : _b.commands.length) - 1 || 0;
|
|
4652
|
+
}
|
|
4653
|
+
setSelectedGroupIndex(newGroupIndex);
|
|
4654
|
+
setSelectedCommandIndex(newCommandIndex);
|
|
3955
4655
|
return true;
|
|
3956
4656
|
}
|
|
3957
|
-
if (
|
|
3958
|
-
|
|
4657
|
+
if (event.key === "ArrowDown") {
|
|
4658
|
+
if (!groups.length) {
|
|
4659
|
+
return false;
|
|
4660
|
+
}
|
|
4661
|
+
const commands = groups[selectedGroupIndex].commands;
|
|
4662
|
+
let newCommandIndex = selectedCommandIndex + 1;
|
|
4663
|
+
let newGroupIndex = selectedGroupIndex;
|
|
4664
|
+
if (commands.length - 1 < newCommandIndex) {
|
|
4665
|
+
newCommandIndex = 0;
|
|
4666
|
+
newGroupIndex = selectedGroupIndex + 1;
|
|
4667
|
+
}
|
|
4668
|
+
if (groups.length - 1 < newGroupIndex) {
|
|
4669
|
+
newGroupIndex = 0;
|
|
4670
|
+
}
|
|
4671
|
+
setSelectedGroupIndex(newGroupIndex);
|
|
4672
|
+
setSelectedCommandIndex(newCommandIndex);
|
|
3959
4673
|
return true;
|
|
3960
4674
|
}
|
|
3961
|
-
if (
|
|
3962
|
-
|
|
4675
|
+
if (event.key === "Enter") {
|
|
4676
|
+
if (!groups.length) {
|
|
4677
|
+
return false;
|
|
4678
|
+
}
|
|
4679
|
+
selectItem(selectedGroupIndex, selectedCommandIndex);
|
|
3963
4680
|
return true;
|
|
3964
4681
|
}
|
|
3965
4682
|
return false;
|
|
3966
4683
|
}
|
|
3967
|
-
}
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
}, [
|
|
3973
|
-
(0,
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
const commandListContainer = (0, import_react32.useRef)(null);
|
|
3977
|
-
(0, import_react32.useLayoutEffect)(() => {
|
|
4684
|
+
}
|
|
4685
|
+
}));
|
|
4686
|
+
(0, import_react30.useEffect)(() => {
|
|
4687
|
+
setSelectedGroupIndex(0);
|
|
4688
|
+
setSelectedCommandIndex(0);
|
|
4689
|
+
}, [groups]);
|
|
4690
|
+
const commandListContainer = (0, import_react30.useRef)(null);
|
|
4691
|
+
const activeCommandRef = (0, import_react30.useRef)(null);
|
|
4692
|
+
(0, import_react30.useLayoutEffect)(() => {
|
|
3978
4693
|
const container = commandListContainer == null ? void 0 : commandListContainer.current;
|
|
3979
|
-
const
|
|
3980
|
-
if (
|
|
3981
|
-
|
|
4694
|
+
const activeCommandContainer = activeCommandRef == null ? void 0 : activeCommandRef.current;
|
|
4695
|
+
if (!container || !activeCommandContainer) {
|
|
4696
|
+
return;
|
|
3982
4697
|
}
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
4698
|
+
const { offsetTop, offsetHeight } = activeCommandContainer;
|
|
4699
|
+
container.scrollTop = offsetTop - offsetHeight;
|
|
4700
|
+
}, [
|
|
4701
|
+
selectedGroupIndex,
|
|
4702
|
+
selectedCommandIndex,
|
|
4703
|
+
commandListContainer,
|
|
4704
|
+
activeCommandRef
|
|
4705
|
+
]);
|
|
4706
|
+
return groups.length > 0 ? /* @__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: [
|
|
4707
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3986
4708
|
"div",
|
|
3987
4709
|
{
|
|
3988
4710
|
id: "slash-command",
|
|
3989
4711
|
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
|
-
"
|
|
4712
|
+
className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto mly-scroll-smooth",
|
|
4713
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react30.Fragment, { children: [
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4715
|
+
"span",
|
|
3994
4716
|
{
|
|
3995
4717
|
className: cn(
|
|
3996
|
-
"mly-
|
|
3997
|
-
|
|
4718
|
+
"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",
|
|
4719
|
+
groupIndex > 0 ? "mly-border-t" : ""
|
|
3998
4720
|
),
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4721
|
+
children: group.title
|
|
4722
|
+
}
|
|
4723
|
+
),
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-p-1", children: group.commands.map((item, commandIndex) => {
|
|
4725
|
+
var _a;
|
|
4726
|
+
const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
|
|
4727
|
+
const isSubCommand = "commands" in item;
|
|
4728
|
+
const hasRenderFunction = typeof item.render === "function";
|
|
4729
|
+
const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
|
|
4730
|
+
let value = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
4731
|
+
/* @__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 }),
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-grow", children: [
|
|
4733
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-font-medium", children: item.title }),
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mly-text-xs mly-text-gray-400", children: item.description })
|
|
4735
|
+
] }),
|
|
4736
|
+
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]" }) })
|
|
4737
|
+
] });
|
|
4738
|
+
if (renderFunctionValue !== null && renderFunctionValue !== true) {
|
|
4739
|
+
value = renderFunctionValue;
|
|
4740
|
+
}
|
|
4741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4742
|
+
"button",
|
|
4743
|
+
{
|
|
4744
|
+
className: cn(
|
|
4745
|
+
"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",
|
|
4746
|
+
isActive ? "mly-bg-gray-100 mly-text-gray-900" : "mly-bg-transparent"
|
|
4747
|
+
),
|
|
4748
|
+
onClick: () => selectItem(groupIndex, commandIndex),
|
|
4749
|
+
type: "button",
|
|
4750
|
+
ref: isActive ? activeCommandRef : null,
|
|
4751
|
+
children: value
|
|
4752
|
+
},
|
|
4753
|
+
commandIndex
|
|
4754
|
+
);
|
|
4755
|
+
}) })
|
|
4756
|
+
] }, groupIndex))
|
|
4012
4757
|
}
|
|
4013
4758
|
),
|
|
4014
|
-
/* @__PURE__ */ (0,
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4759
|
+
/* @__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: [
|
|
4760
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
4761
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-p-1 mly-px-2 mly-font-medium", children: "\u2191" }),
|
|
4762
|
+
/* @__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
4763
|
" ",
|
|
4019
4764
|
"to navigate"
|
|
4020
4765
|
] }),
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4022
|
-
/* @__PURE__ */ (0,
|
|
4023
|
-
/* @__PURE__ */ (0,
|
|
4766
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", className: "mly-select-none mly-px-1", children: "\xB7" }),
|
|
4767
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
4768
|
+
/* @__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
4769
|
" ",
|
|
4025
4770
|
"to select"
|
|
4026
4771
|
] })
|
|
4027
4772
|
] }) })
|
|
4028
4773
|
] }) : null;
|
|
4029
|
-
}
|
|
4030
|
-
function getSlashCommandSuggestions(
|
|
4774
|
+
});
|
|
4775
|
+
function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
4031
4776
|
return {
|
|
4032
4777
|
items: ({ query, editor }) => {
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4778
|
+
var _a;
|
|
4779
|
+
let newGroups = groups;
|
|
4780
|
+
let search = query.toLowerCase();
|
|
4781
|
+
const subCommandIds = newGroups.map((group) => {
|
|
4782
|
+
return group.commands.filter((item) => "commands" in item).map((item) => item == null ? void 0 : item.id.toLowerCase());
|
|
4783
|
+
}).flat().map((id) => `${id}.`);
|
|
4784
|
+
const shouldEnterSubCommand = subCommandIds.some(
|
|
4785
|
+
(id) => search.startsWith(id)
|
|
4786
|
+
);
|
|
4787
|
+
if (shouldEnterSubCommand) {
|
|
4788
|
+
const subCommandId = subCommandIds.find((id) => search.startsWith(id));
|
|
4789
|
+
const sanitizedSubCommandId = subCommandId == null ? void 0 : subCommandId.slice(0, -1);
|
|
4790
|
+
const group = (_a = newGroups.find((group2) => {
|
|
4791
|
+
return group2.commands.some(
|
|
4792
|
+
// @ts-ignore
|
|
4793
|
+
(item) => {
|
|
4794
|
+
var _a2;
|
|
4795
|
+
return ((_a2 = item == null ? void 0 : item.id) == null ? void 0 : _a2.toLowerCase()) === sanitizedSubCommandId;
|
|
4796
|
+
}
|
|
4797
|
+
);
|
|
4798
|
+
})) == null ? void 0 : _a.commands.find(
|
|
4799
|
+
// @ts-ignore
|
|
4800
|
+
(item) => {
|
|
4801
|
+
var _a2;
|
|
4802
|
+
return ((_a2 = item == null ? void 0 : item.id) == null ? void 0 : _a2.toLowerCase()) === sanitizedSubCommandId;
|
|
4039
4803
|
}
|
|
4040
|
-
|
|
4804
|
+
);
|
|
4805
|
+
if (!group) {
|
|
4806
|
+
return groups;
|
|
4041
4807
|
}
|
|
4042
|
-
|
|
4043
|
-
|
|
4808
|
+
search = search.replace(subCommandId || "", "");
|
|
4809
|
+
newGroups = [
|
|
4810
|
+
__spreadProps(__spreadValues({}, group), {
|
|
4811
|
+
commands: (group == null ? void 0 : group.commands) || []
|
|
4812
|
+
})
|
|
4813
|
+
];
|
|
4814
|
+
}
|
|
4815
|
+
const filteredGroups = newGroups.map((group) => {
|
|
4816
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
4817
|
+
commands: group.commands.filter((item) => {
|
|
4818
|
+
var _a2;
|
|
4819
|
+
if (typeof query === "string" && query.length > 0) {
|
|
4820
|
+
const show = (_a2 = item == null ? void 0 : item.render) == null ? void 0 : _a2.call(item, editor);
|
|
4821
|
+
if (show === null) {
|
|
4822
|
+
return false;
|
|
4823
|
+
}
|
|
4824
|
+
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(
|
|
4825
|
+
(term) => term.includes(search)
|
|
4826
|
+
);
|
|
4827
|
+
}
|
|
4828
|
+
return true;
|
|
4829
|
+
}).map((item) => {
|
|
4830
|
+
const isSubCommandItem = "commands" in item;
|
|
4831
|
+
if (isSubCommandItem) {
|
|
4832
|
+
item = __spreadProps(__spreadValues({}, item), {
|
|
4833
|
+
command: (options) => {
|
|
4834
|
+
const { editor: editor2, range } = options;
|
|
4835
|
+
editor2.chain().focus().insertContentAt(range, `/${item.id}.`).run();
|
|
4836
|
+
}
|
|
4837
|
+
});
|
|
4838
|
+
}
|
|
4839
|
+
return item;
|
|
4840
|
+
})
|
|
4841
|
+
});
|
|
4842
|
+
}).filter((group) => group.commands.length > 0);
|
|
4843
|
+
return filteredGroups;
|
|
4844
|
+
},
|
|
4845
|
+
allow: ({ editor }) => {
|
|
4846
|
+
const isInsideHTMLCodeBlock = editor.isActive("htmlCodeBlock");
|
|
4847
|
+
if (isInsideHTMLCodeBlock) {
|
|
4848
|
+
return false;
|
|
4849
|
+
}
|
|
4850
|
+
return true;
|
|
4044
4851
|
},
|
|
4045
4852
|
render: () => {
|
|
4046
4853
|
let component;
|
|
4047
4854
|
let popup = null;
|
|
4048
4855
|
return {
|
|
4049
4856
|
onStart: (props) => {
|
|
4050
|
-
component = new
|
|
4857
|
+
component = new import_react29.ReactRenderer(CommandList, {
|
|
4051
4858
|
props,
|
|
4052
4859
|
editor: props.editor
|
|
4053
4860
|
});
|
|
@@ -4088,16 +4895,21 @@ function getSlashCommandSuggestions(commands = DEFAULT_SLASH_COMMANDS) {
|
|
|
4088
4895
|
|
|
4089
4896
|
// src/editor/nodes/variable/variable.ts
|
|
4090
4897
|
var import_core14 = require("@tiptap/core");
|
|
4091
|
-
var
|
|
4092
|
-
var
|
|
4898
|
+
var import_state3 = require("@tiptap/pm/state");
|
|
4899
|
+
var import_react31 = require("@tiptap/react");
|
|
4093
4900
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"));
|
|
4094
|
-
var VariablePluginKey = new
|
|
4901
|
+
var VariablePluginKey = new import_state3.PluginKey("variable");
|
|
4095
4902
|
var VariableExtension = import_core14.Node.create({
|
|
4096
4903
|
name: "variable",
|
|
4097
4904
|
group: "inline",
|
|
4098
4905
|
inline: true,
|
|
4099
4906
|
selectable: true,
|
|
4100
4907
|
atom: true,
|
|
4908
|
+
addStorage() {
|
|
4909
|
+
return {
|
|
4910
|
+
popover: false
|
|
4911
|
+
};
|
|
4912
|
+
},
|
|
4101
4913
|
addOptions() {
|
|
4102
4914
|
return {
|
|
4103
4915
|
variables: [],
|
|
@@ -4242,7 +5054,7 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4242
5054
|
];
|
|
4243
5055
|
},
|
|
4244
5056
|
addNodeView() {
|
|
4245
|
-
return (0,
|
|
5057
|
+
return (0, import_react31.ReactNodeViewRenderer)(VariableView, {
|
|
4246
5058
|
className: "mly-relative mly-inline-block",
|
|
4247
5059
|
as: "div"
|
|
4248
5060
|
});
|
|
@@ -4250,15 +5062,14 @@ var VariableExtension = import_core14.Node.create({
|
|
|
4250
5062
|
});
|
|
4251
5063
|
|
|
4252
5064
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
4253
|
-
var
|
|
4254
|
-
var
|
|
5065
|
+
var import_react32 = require("@tiptap/react");
|
|
5066
|
+
var import_react33 = require("react");
|
|
4255
5067
|
var import_tippy2 = __toESM(require("tippy.js"));
|
|
4256
|
-
var
|
|
4257
|
-
var
|
|
4258
|
-
var VariableList = (0, import_react35.forwardRef)((props, ref) => {
|
|
5068
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5069
|
+
var VariableList = (0, import_react33.forwardRef)((props, ref) => {
|
|
4259
5070
|
const { items = [] } = props;
|
|
4260
|
-
const popoverRef = (0,
|
|
4261
|
-
(0,
|
|
5071
|
+
const popoverRef = (0, import_react33.useRef)(null);
|
|
5072
|
+
(0, import_react33.useImperativeHandle)(ref, () => ({
|
|
4262
5073
|
onKeyDown: ({ event }) => {
|
|
4263
5074
|
if (!popoverRef.current) {
|
|
4264
5075
|
return false;
|
|
@@ -4281,7 +5092,7 @@ var VariableList = (0, import_react35.forwardRef)((props, ref) => {
|
|
|
4281
5092
|
return false;
|
|
4282
5093
|
}
|
|
4283
5094
|
}));
|
|
4284
|
-
return /* @__PURE__ */ (0,
|
|
5095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4285
5096
|
VariablePopover,
|
|
4286
5097
|
{
|
|
4287
5098
|
items,
|
|
@@ -4297,7 +5108,7 @@ var VariableList = (0, import_react35.forwardRef)((props, ref) => {
|
|
|
4297
5108
|
);
|
|
4298
5109
|
});
|
|
4299
5110
|
VariableList.displayName = "VariableList";
|
|
4300
|
-
function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
|
|
5111
|
+
function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VARIABLE_TRIGGER_CHAR, variableListComponent = VariableList) {
|
|
4301
5112
|
return {
|
|
4302
5113
|
char,
|
|
4303
5114
|
items: ({ query, editor }) => {
|
|
@@ -4312,7 +5123,7 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4312
5123
|
let popup = null;
|
|
4313
5124
|
return {
|
|
4314
5125
|
onStart: (props) => {
|
|
4315
|
-
component = new
|
|
5126
|
+
component = new import_react32.ReactRenderer(variableListComponent, {
|
|
4316
5127
|
props,
|
|
4317
5128
|
editor: props.editor
|
|
4318
5129
|
});
|
|
@@ -4358,6 +5169,24 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4358
5169
|
}
|
|
4359
5170
|
};
|
|
4360
5171
|
}
|
|
5172
|
+
|
|
5173
|
+
// src/editor/extensions/placeholder.ts
|
|
5174
|
+
var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"));
|
|
5175
|
+
var PlaceholderExtension = import_extension_placeholder.default.configure({
|
|
5176
|
+
placeholder: ({ node }) => {
|
|
5177
|
+
if (node.type.name === "heading") {
|
|
5178
|
+
return `Heading ${node.attrs.level}`;
|
|
5179
|
+
} else if (node.type.name === "htmlCodeBlock") {
|
|
5180
|
+
return "Type your HTML code...";
|
|
5181
|
+
} else if (["columns", "column", "section", "repeat", "show", "blockquote"].includes(
|
|
5182
|
+
node.type.name
|
|
5183
|
+
)) {
|
|
5184
|
+
return "";
|
|
5185
|
+
}
|
|
5186
|
+
return "Write something or / to see commands";
|
|
5187
|
+
},
|
|
5188
|
+
includeChildren: true
|
|
5189
|
+
});
|
|
4361
5190
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4362
5191
|
0 && (module.exports = {
|
|
4363
5192
|
ButtonExtension,
|
|
@@ -4391,12 +5220,14 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4391
5220
|
DEFAULT_SECTION_PADDING_RIGHT,
|
|
4392
5221
|
DEFAULT_SECTION_PADDING_TOP,
|
|
4393
5222
|
DEFAULT_SECTION_SHOW_IF_KEY,
|
|
5223
|
+
DEFAULT_SPACER_HEIGHT,
|
|
4394
5224
|
Footer,
|
|
4395
5225
|
HorizontalRule,
|
|
4396
5226
|
ImageExtension,
|
|
4397
5227
|
LinkExtension,
|
|
4398
5228
|
LogoExtension,
|
|
4399
5229
|
MailyKit,
|
|
5230
|
+
PlaceholderExtension,
|
|
4400
5231
|
RepeatExtension,
|
|
4401
5232
|
SectionExtension,
|
|
4402
5233
|
SlashCommandExtension,
|
|
@@ -4408,7 +5239,6 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4408
5239
|
allowedButtonVariant,
|
|
4409
5240
|
allowedLogoAlignment,
|
|
4410
5241
|
allowedLogoSize,
|
|
4411
|
-
allowedSpacerSize,
|
|
4412
5242
|
getSlashCommandSuggestions,
|
|
4413
5243
|
getVariableSuggestions,
|
|
4414
5244
|
logoSizes
|