@maily-to/core 0.0.25 → 0.0.27
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 +2 -2
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.js +7 -7
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/index.mjs +6 -6
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.d.mts +10 -9
- package/dist/extensions/index.d.ts +10 -9
- package/dist/extensions/index.js +432 -433
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +356 -357
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +100 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +5 -4
|
@@ -1119,139 +1119,17 @@ var ColumnsExtension = Node7.create({
|
|
|
1119
1119
|
}
|
|
1120
1120
|
});
|
|
1121
1121
|
|
|
1122
|
-
// src/editor/nodes/
|
|
1122
|
+
// src/editor/nodes/button/button.tsx
|
|
1123
1123
|
import { mergeAttributes as mergeAttributes7, Node as Node8 } from "@tiptap/core";
|
|
1124
1124
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
1125
1125
|
|
|
1126
|
-
// src/editor/nodes/for/for-view.tsx
|
|
1127
|
-
import { NodeViewWrapper as NodeViewWrapper2, NodeViewContent } from "@tiptap/react";
|
|
1128
|
-
import { Repeat2 } from "lucide-react";
|
|
1129
|
-
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1130
|
-
function ForView(props) {
|
|
1131
|
-
const { editor, getPos } = props;
|
|
1132
|
-
return /* @__PURE__ */ jsxs2(
|
|
1133
|
-
NodeViewWrapper2,
|
|
1134
|
-
{
|
|
1135
|
-
draggable: editor.isEditable,
|
|
1136
|
-
"data-drag-handle": editor.isEditable,
|
|
1137
|
-
"data-type": "for",
|
|
1138
|
-
className: "mly-relative",
|
|
1139
|
-
children: [
|
|
1140
|
-
/* @__PURE__ */ jsx5(NodeViewContent, { className: "is-editable" }),
|
|
1141
|
-
/* @__PURE__ */ jsxs2(
|
|
1142
|
-
"div",
|
|
1143
|
-
{
|
|
1144
|
-
role: "button",
|
|
1145
|
-
"data-repeat-indicator": "",
|
|
1146
|
-
className: "mly-absolute mly-inset-y-0 mly-right-0 mly-flex mly-translate-x-full mly-cursor-pointer mly-flex-col mly-items-center mly-gap-1 mly-opacity-60",
|
|
1147
|
-
contentEditable: false,
|
|
1148
|
-
onClick: () => {
|
|
1149
|
-
editor.commands.setNodeSelection(getPos());
|
|
1150
|
-
},
|
|
1151
|
-
children: [
|
|
1152
|
-
/* @__PURE__ */ jsx5(Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
1153
|
-
/* @__PURE__ */ jsx5("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
1154
|
-
]
|
|
1155
|
-
}
|
|
1156
|
-
)
|
|
1157
|
-
]
|
|
1158
|
-
}
|
|
1159
|
-
);
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
// src/editor/nodes/for/for.ts
|
|
1163
|
-
var ForExtension = Node8.create({
|
|
1164
|
-
name: "for",
|
|
1165
|
-
group: "block",
|
|
1166
|
-
content: "(block|columns)+",
|
|
1167
|
-
draggable: true,
|
|
1168
|
-
isolating: true,
|
|
1169
|
-
addAttributes() {
|
|
1170
|
-
return {
|
|
1171
|
-
each: {
|
|
1172
|
-
default: "items",
|
|
1173
|
-
parseHTML: (element) => {
|
|
1174
|
-
return element.getAttribute("each") || "";
|
|
1175
|
-
},
|
|
1176
|
-
renderHTML: (attributes) => {
|
|
1177
|
-
if (!attributes.each) {
|
|
1178
|
-
return {};
|
|
1179
|
-
}
|
|
1180
|
-
return {
|
|
1181
|
-
each: attributes.each
|
|
1182
|
-
};
|
|
1183
|
-
}
|
|
1184
|
-
},
|
|
1185
|
-
isUpdatingKey: {
|
|
1186
|
-
default: false
|
|
1187
|
-
},
|
|
1188
|
-
showIfKey: {
|
|
1189
|
-
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
1190
|
-
parseHTML: (element) => {
|
|
1191
|
-
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
1192
|
-
},
|
|
1193
|
-
renderHTML(attributes) {
|
|
1194
|
-
if (!attributes.showIfKey) {
|
|
1195
|
-
return {};
|
|
1196
|
-
}
|
|
1197
|
-
return {
|
|
1198
|
-
"data-show-if-key": attributes.showIfKey
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
},
|
|
1204
|
-
parseHTML() {
|
|
1205
|
-
return [
|
|
1206
|
-
{
|
|
1207
|
-
tag: `div[data-type="${this.name}"]`
|
|
1208
|
-
}
|
|
1209
|
-
];
|
|
1210
|
-
},
|
|
1211
|
-
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
1212
|
-
return [
|
|
1213
|
-
"div",
|
|
1214
|
-
mergeAttributes7(HTMLAttributes2, {
|
|
1215
|
-
"data-type": this.name
|
|
1216
|
-
}),
|
|
1217
|
-
0
|
|
1218
|
-
];
|
|
1219
|
-
},
|
|
1220
|
-
addCommands() {
|
|
1221
|
-
return {
|
|
1222
|
-
setFor: () => ({ commands }) => {
|
|
1223
|
-
return commands.insertContent({
|
|
1224
|
-
type: this.name,
|
|
1225
|
-
attrs: {},
|
|
1226
|
-
content: [
|
|
1227
|
-
{
|
|
1228
|
-
type: "paragraph"
|
|
1229
|
-
}
|
|
1230
|
-
]
|
|
1231
|
-
});
|
|
1232
|
-
},
|
|
1233
|
-
updateFor: (attrs) => updateAttributes(this.name, attrs)
|
|
1234
|
-
};
|
|
1235
|
-
},
|
|
1236
|
-
addNodeView() {
|
|
1237
|
-
return ReactNodeViewRenderer2(ForView, {
|
|
1238
|
-
contentDOMElementTag: "div",
|
|
1239
|
-
className: "mly-relative"
|
|
1240
|
-
});
|
|
1241
|
-
}
|
|
1242
|
-
});
|
|
1243
|
-
|
|
1244
|
-
// src/editor/nodes/button/button.tsx
|
|
1245
|
-
import { mergeAttributes as mergeAttributes8, Node as Node9 } from "@tiptap/core";
|
|
1246
|
-
import { ReactNodeViewRenderer as ReactNodeViewRenderer3 } from "@tiptap/react";
|
|
1247
|
-
|
|
1248
1126
|
// src/editor/components/alignment-switch.tsx
|
|
1249
1127
|
import { AlignCenter, AlignLeft, AlignRight } from "lucide-react";
|
|
1250
1128
|
|
|
1251
1129
|
// src/editor/components/base-button.tsx
|
|
1252
1130
|
import * as React4 from "react";
|
|
1253
1131
|
import { Slot } from "@radix-ui/react-slot";
|
|
1254
|
-
import { jsx as
|
|
1132
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1255
1133
|
var BaseButton = React4.forwardRef(
|
|
1256
1134
|
(_a, ref) => {
|
|
1257
1135
|
var _b = _a, {
|
|
@@ -1288,7 +1166,7 @@ var BaseButton = React4.forwardRef(
|
|
|
1288
1166
|
sizeClasses[size],
|
|
1289
1167
|
className
|
|
1290
1168
|
);
|
|
1291
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ jsx5(Comp, __spreadValues({ className: classes, ref }, props));
|
|
1292
1170
|
}
|
|
1293
1171
|
);
|
|
1294
1172
|
BaseButton.displayName = "BaseButton";
|
|
@@ -1296,13 +1174,13 @@ BaseButton.displayName = "BaseButton";
|
|
|
1296
1174
|
// src/editor/components/ui/tooltip.tsx
|
|
1297
1175
|
import * as React5 from "react";
|
|
1298
1176
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1299
|
-
import { jsx as
|
|
1177
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1300
1178
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1301
1179
|
var Tooltip = TooltipPrimitive.Root;
|
|
1302
1180
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1303
1181
|
var TooltipContent = React5.forwardRef((_a, ref) => {
|
|
1304
1182
|
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
|
1305
|
-
return /* @__PURE__ */
|
|
1183
|
+
return /* @__PURE__ */ jsx6(
|
|
1306
1184
|
TooltipPrimitive.Content,
|
|
1307
1185
|
__spreadValues({
|
|
1308
1186
|
ref,
|
|
@@ -1317,11 +1195,11 @@ var TooltipContent = React5.forwardRef((_a, ref) => {
|
|
|
1317
1195
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1318
1196
|
|
|
1319
1197
|
// src/editor/components/bubble-menu-button.tsx
|
|
1320
|
-
import { jsx as
|
|
1198
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1321
1199
|
function BubbleMenuButton(item) {
|
|
1322
1200
|
var _a;
|
|
1323
1201
|
const { tooltip } = item;
|
|
1324
|
-
const content = /* @__PURE__ */
|
|
1202
|
+
const content = /* @__PURE__ */ jsx7(
|
|
1325
1203
|
BaseButton,
|
|
1326
1204
|
__spreadProps(__spreadValues({
|
|
1327
1205
|
variant: "ghost",
|
|
@@ -1334,7 +1212,7 @@ function BubbleMenuButton(item) {
|
|
|
1334
1212
|
),
|
|
1335
1213
|
type: "button",
|
|
1336
1214
|
disabled: item.disbabled,
|
|
1337
|
-
children: item.icon ? /* @__PURE__ */
|
|
1215
|
+
children: item.icon ? /* @__PURE__ */ jsx7(
|
|
1338
1216
|
item.icon,
|
|
1339
1217
|
{
|
|
1340
1218
|
className: cn(
|
|
@@ -1342,7 +1220,7 @@ function BubbleMenuButton(item) {
|
|
|
1342
1220
|
item == null ? void 0 : item.iconClassName
|
|
1343
1221
|
)
|
|
1344
1222
|
}
|
|
1345
|
-
) : /* @__PURE__ */
|
|
1223
|
+
) : /* @__PURE__ */ jsx7(
|
|
1346
1224
|
"span",
|
|
1347
1225
|
{
|
|
1348
1226
|
className: cn(
|
|
@@ -1355,16 +1233,16 @@ function BubbleMenuButton(item) {
|
|
|
1355
1233
|
})
|
|
1356
1234
|
);
|
|
1357
1235
|
if (tooltip) {
|
|
1358
|
-
return /* @__PURE__ */
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
/* @__PURE__ */
|
|
1236
|
+
return /* @__PURE__ */ jsxs2(Tooltip, { children: [
|
|
1237
|
+
/* @__PURE__ */ jsx7(TooltipTrigger, { asChild: true, children: content }),
|
|
1238
|
+
/* @__PURE__ */ jsx7(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
1361
1239
|
] });
|
|
1362
1240
|
}
|
|
1363
1241
|
return content;
|
|
1364
1242
|
}
|
|
1365
1243
|
|
|
1366
1244
|
// src/editor/components/alignment-switch.tsx
|
|
1367
|
-
import { jsx as
|
|
1245
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1368
1246
|
function AlignmentSwitch(props) {
|
|
1369
1247
|
const { alignment = "left", onAlignmentChange } = props;
|
|
1370
1248
|
const activeAlignment = {
|
|
@@ -1390,7 +1268,7 @@ function AlignmentSwitch(props) {
|
|
|
1390
1268
|
}
|
|
1391
1269
|
}
|
|
1392
1270
|
}[alignment];
|
|
1393
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ jsx8(
|
|
1394
1272
|
BubbleMenuButton,
|
|
1395
1273
|
{
|
|
1396
1274
|
icon: activeAlignment.icon,
|
|
@@ -1402,7 +1280,7 @@ function AlignmentSwitch(props) {
|
|
|
1402
1280
|
|
|
1403
1281
|
// src/editor/components/ui/color-picker.tsx
|
|
1404
1282
|
import { HexColorPicker, HexColorInput } from "react-colorful";
|
|
1405
|
-
import { jsx as
|
|
1283
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1406
1284
|
function ColorPicker(props) {
|
|
1407
1285
|
const {
|
|
1408
1286
|
color,
|
|
@@ -1420,14 +1298,14 @@ function ColorPicker(props) {
|
|
|
1420
1298
|
onColorChange(color2);
|
|
1421
1299
|
});
|
|
1422
1300
|
};
|
|
1423
|
-
const popoverButton = /* @__PURE__ */
|
|
1301
|
+
const popoverButton = /* @__PURE__ */ jsx9(PopoverTrigger, { asChild: true, children: children || /* @__PURE__ */ jsx9(
|
|
1424
1302
|
BaseButton,
|
|
1425
1303
|
{
|
|
1426
1304
|
variant: "ghost",
|
|
1427
1305
|
className: "!mly-size-7 mly-shrink-0",
|
|
1428
1306
|
size: "sm",
|
|
1429
1307
|
type: "button",
|
|
1430
|
-
children: /* @__PURE__ */
|
|
1308
|
+
children: /* @__PURE__ */ jsx9(
|
|
1431
1309
|
"div",
|
|
1432
1310
|
{
|
|
1433
1311
|
className: cn(
|
|
@@ -1441,7 +1319,7 @@ function ColorPicker(props) {
|
|
|
1441
1319
|
)
|
|
1442
1320
|
}
|
|
1443
1321
|
) });
|
|
1444
|
-
return /* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ jsxs3(
|
|
1445
1323
|
Popover,
|
|
1446
1324
|
{
|
|
1447
1325
|
onOpenChange: (open) => {
|
|
@@ -1450,17 +1328,17 @@ function ColorPicker(props) {
|
|
|
1450
1328
|
}
|
|
1451
1329
|
},
|
|
1452
1330
|
children: [
|
|
1453
|
-
tooltip ? /* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1331
|
+
tooltip ? /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
1332
|
+
/* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
1333
|
+
/* @__PURE__ */ jsx9(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
1456
1334
|
] }) : popoverButton,
|
|
1457
|
-
/* @__PURE__ */
|
|
1335
|
+
/* @__PURE__ */ jsx9(
|
|
1458
1336
|
PopoverContent,
|
|
1459
1337
|
{
|
|
1460
1338
|
className: "mly-w-full mly-rounded-none mly-border-0 !mly-bg-transparent !mly-p-0 mly-shadow-none mly-drop-shadow-md",
|
|
1461
1339
|
sideOffset: 8,
|
|
1462
|
-
children: /* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */
|
|
1340
|
+
children: /* @__PURE__ */ jsxs3("div", { className: "mly-min-w-[260px] mly-rounded-xl mly-border mly-bg-white mly-p-4", children: [
|
|
1341
|
+
/* @__PURE__ */ jsx9(
|
|
1464
1342
|
HexColorPicker,
|
|
1465
1343
|
{
|
|
1466
1344
|
color,
|
|
@@ -1468,7 +1346,7 @@ function ColorPicker(props) {
|
|
|
1468
1346
|
className: "mly-flex !mly-w-full mly-flex-col mly-gap-4"
|
|
1469
1347
|
}
|
|
1470
1348
|
),
|
|
1471
|
-
/* @__PURE__ */
|
|
1349
|
+
/* @__PURE__ */ jsx9(
|
|
1472
1350
|
HexColorInput,
|
|
1473
1351
|
{
|
|
1474
1352
|
alpha: true,
|
|
@@ -1478,10 +1356,10 @@ function ColorPicker(props) {
|
|
|
1478
1356
|
prefixed: true
|
|
1479
1357
|
}
|
|
1480
1358
|
),
|
|
1481
|
-
suggestedColors.length > 0 && /* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1359
|
+
suggestedColors.length > 0 && /* @__PURE__ */ jsxs3("div", { children: [
|
|
1360
|
+
/* @__PURE__ */ jsx9("div", { className: "-mly-mx-4 mly-my-4 mly-h-px mly-bg-gray-200" }),
|
|
1361
|
+
/* @__PURE__ */ jsx9("h2", { className: "mly-text-xs mly-text-gray-500", children: "Recently used" }),
|
|
1362
|
+
/* @__PURE__ */ jsx9("div", { className: "mly-mt-2 mly-flex mly-flex-wrap mly-gap-0.5", children: suggestedColors.map((suggestedColor) => /* @__PURE__ */ jsx9(
|
|
1485
1363
|
BaseButton,
|
|
1486
1364
|
{
|
|
1487
1365
|
variant: "ghost",
|
|
@@ -1489,7 +1367,7 @@ function ColorPicker(props) {
|
|
|
1489
1367
|
className: "!mly-size-7 mly-shrink-0",
|
|
1490
1368
|
type: "button",
|
|
1491
1369
|
onClick: () => handleColorChange(suggestedColor),
|
|
1492
|
-
children: /* @__PURE__ */
|
|
1370
|
+
children: /* @__PURE__ */ jsx9(
|
|
1493
1371
|
"div",
|
|
1494
1372
|
{
|
|
1495
1373
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded",
|
|
@@ -1511,10 +1389,10 @@ function ColorPicker(props) {
|
|
|
1511
1389
|
}
|
|
1512
1390
|
|
|
1513
1391
|
// src/editor/components/ui/divider.tsx
|
|
1514
|
-
import { jsx as
|
|
1392
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1515
1393
|
function Divider(props) {
|
|
1516
1394
|
const { type = "vertical", className } = props;
|
|
1517
|
-
return /* @__PURE__ */
|
|
1395
|
+
return /* @__PURE__ */ jsx10(
|
|
1518
1396
|
"div",
|
|
1519
1397
|
{
|
|
1520
1398
|
className: cn(
|
|
@@ -1538,12 +1416,12 @@ import { createContext, useContext } from "react";
|
|
|
1538
1416
|
|
|
1539
1417
|
// src/blocks/button.tsx
|
|
1540
1418
|
import { MousePointer, ArrowUpRightSquare } from "lucide-react";
|
|
1541
|
-
import { jsx as
|
|
1419
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1542
1420
|
var button = {
|
|
1543
1421
|
title: "Button",
|
|
1544
1422
|
description: "Add a call to action button to email.",
|
|
1545
1423
|
searchTerms: ["link", "button", "cta"],
|
|
1546
|
-
icon: /* @__PURE__ */
|
|
1424
|
+
icon: /* @__PURE__ */ jsx11(MousePointer, { className: "mly-h-4 mly-w-4" }),
|
|
1547
1425
|
command: ({ editor, range }) => {
|
|
1548
1426
|
editor.chain().focus().deleteRange(range).setButton().run();
|
|
1549
1427
|
}
|
|
@@ -1552,7 +1430,7 @@ var linkCard = {
|
|
|
1552
1430
|
title: "Link Card",
|
|
1553
1431
|
description: "Add a link card to email.",
|
|
1554
1432
|
searchTerms: ["link", "button", "image"],
|
|
1555
|
-
icon: /* @__PURE__ */
|
|
1433
|
+
icon: /* @__PURE__ */ jsx11(ArrowUpRightSquare, { className: "mly-h-4 mly-w-4" }),
|
|
1556
1434
|
command: ({ editor, range }) => {
|
|
1557
1435
|
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
1558
1436
|
},
|
|
@@ -1565,12 +1443,12 @@ var linkCard = {
|
|
|
1565
1443
|
|
|
1566
1444
|
// src/blocks/image.tsx
|
|
1567
1445
|
import { ImageIcon } from "lucide-react";
|
|
1568
|
-
import { jsx as
|
|
1446
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1569
1447
|
var image = {
|
|
1570
1448
|
title: "Image",
|
|
1571
1449
|
description: "Full width image",
|
|
1572
1450
|
searchTerms: ["image"],
|
|
1573
|
-
icon: /* @__PURE__ */
|
|
1451
|
+
icon: /* @__PURE__ */ jsx12(ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1574
1452
|
command: ({ editor, range }) => {
|
|
1575
1453
|
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
1576
1454
|
}
|
|
@@ -1579,7 +1457,7 @@ var logo = {
|
|
|
1579
1457
|
title: "Logo",
|
|
1580
1458
|
description: "Add your brand logo",
|
|
1581
1459
|
searchTerms: ["image", "logo"],
|
|
1582
|
-
icon: /* @__PURE__ */
|
|
1460
|
+
icon: /* @__PURE__ */ jsx12(ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1583
1461
|
command: ({ editor, range }) => {
|
|
1584
1462
|
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
1585
1463
|
}
|
|
@@ -1588,17 +1466,17 @@ var logo = {
|
|
|
1588
1466
|
// src/blocks/layout.tsx
|
|
1589
1467
|
import {
|
|
1590
1468
|
ColumnsIcon,
|
|
1591
|
-
Repeat2
|
|
1469
|
+
Repeat2,
|
|
1592
1470
|
MoveVertical,
|
|
1593
1471
|
RectangleHorizontal,
|
|
1594
1472
|
Minus
|
|
1595
1473
|
} from "lucide-react";
|
|
1596
|
-
import { jsx as
|
|
1474
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1597
1475
|
var columns = {
|
|
1598
1476
|
title: "Columns",
|
|
1599
1477
|
description: "Add columns to email.",
|
|
1600
1478
|
searchTerms: ["layout", "columns"],
|
|
1601
|
-
icon: /* @__PURE__ */
|
|
1479
|
+
icon: /* @__PURE__ */ jsx13(ColumnsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1602
1480
|
shouldBeHidden: (editor) => {
|
|
1603
1481
|
return editor.isActive("columns");
|
|
1604
1482
|
},
|
|
@@ -1610,28 +1488,28 @@ var section = {
|
|
|
1610
1488
|
title: "Section",
|
|
1611
1489
|
description: "Add a section to email.",
|
|
1612
1490
|
searchTerms: ["layout", "section"],
|
|
1613
|
-
icon: /* @__PURE__ */
|
|
1491
|
+
icon: /* @__PURE__ */ jsx13(RectangleHorizontal, { className: "mly-h-4 mly-w-4" }),
|
|
1614
1492
|
command: ({ editor, range }) => {
|
|
1615
1493
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
1616
1494
|
}
|
|
1617
1495
|
};
|
|
1618
|
-
var
|
|
1619
|
-
title: "
|
|
1496
|
+
var repeat = {
|
|
1497
|
+
title: "Repeat",
|
|
1620
1498
|
description: "Loop over an array of items.",
|
|
1621
|
-
searchTerms: ["for", "loop"],
|
|
1622
|
-
icon: /* @__PURE__ */
|
|
1499
|
+
searchTerms: ["repeat", "for", "loop"],
|
|
1500
|
+
icon: /* @__PURE__ */ jsx13(Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
1623
1501
|
shouldBeHidden: (editor) => {
|
|
1624
|
-
return editor.isActive("
|
|
1502
|
+
return editor.isActive("repeat");
|
|
1625
1503
|
},
|
|
1626
1504
|
command: ({ editor, range }) => {
|
|
1627
|
-
editor.chain().focus().deleteRange(range).
|
|
1505
|
+
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
1628
1506
|
}
|
|
1629
1507
|
};
|
|
1630
1508
|
var spacer = {
|
|
1631
1509
|
title: "Spacer",
|
|
1632
1510
|
description: "Add space between blocks.",
|
|
1633
1511
|
searchTerms: ["space", "gap", "divider"],
|
|
1634
|
-
icon: /* @__PURE__ */
|
|
1512
|
+
icon: /* @__PURE__ */ jsx13(MoveVertical, { className: "mly-h-4 mly-w-4" }),
|
|
1635
1513
|
command: ({ editor, range }) => {
|
|
1636
1514
|
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
1637
1515
|
}
|
|
@@ -1640,7 +1518,7 @@ var divider = {
|
|
|
1640
1518
|
title: "Divider",
|
|
1641
1519
|
description: "Add a horizontal divider.",
|
|
1642
1520
|
searchTerms: ["divider", "line"],
|
|
1643
|
-
icon: /* @__PURE__ */
|
|
1521
|
+
icon: /* @__PURE__ */ jsx13(Minus, { className: "mly-h-4 mly-w-4" }),
|
|
1644
1522
|
command: ({ editor, range }) => {
|
|
1645
1523
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
1646
1524
|
}
|
|
@@ -1648,12 +1526,12 @@ var divider = {
|
|
|
1648
1526
|
|
|
1649
1527
|
// src/blocks/list.tsx
|
|
1650
1528
|
import { List, ListOrdered } from "lucide-react";
|
|
1651
|
-
import { jsx as
|
|
1529
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1652
1530
|
var bulletList = {
|
|
1653
1531
|
title: "Bullet List",
|
|
1654
1532
|
description: "Create a simple bullet list.",
|
|
1655
1533
|
searchTerms: ["unordered", "point"],
|
|
1656
|
-
icon: /* @__PURE__ */
|
|
1534
|
+
icon: /* @__PURE__ */ jsx14(List, { className: "mly-h-4 mly-w-4" }),
|
|
1657
1535
|
command: ({ editor, range }) => {
|
|
1658
1536
|
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
1659
1537
|
}
|
|
@@ -1662,7 +1540,7 @@ var orderedList = {
|
|
|
1662
1540
|
title: "Numbered List",
|
|
1663
1541
|
description: "Create a list with numbering.",
|
|
1664
1542
|
searchTerms: ["ordered"],
|
|
1665
|
-
icon: /* @__PURE__ */
|
|
1543
|
+
icon: /* @__PURE__ */ jsx14(ListOrdered, { className: "mly-h-4 mly-w-4" }),
|
|
1666
1544
|
command: ({ editor, range }) => {
|
|
1667
1545
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
1668
1546
|
}
|
|
@@ -1679,12 +1557,12 @@ import {
|
|
|
1679
1557
|
FootprintsIcon,
|
|
1680
1558
|
EraserIcon
|
|
1681
1559
|
} from "lucide-react";
|
|
1682
|
-
import { jsx as
|
|
1560
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1683
1561
|
var text = {
|
|
1684
1562
|
title: "Text",
|
|
1685
1563
|
description: "Just start typing with plain text.",
|
|
1686
1564
|
searchTerms: ["p", "paragraph"],
|
|
1687
|
-
icon: /* @__PURE__ */
|
|
1565
|
+
icon: /* @__PURE__ */ jsx15(Text, { className: "mly-h-4 mly-w-4" }),
|
|
1688
1566
|
command: ({ editor, range }) => {
|
|
1689
1567
|
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
1690
1568
|
}
|
|
@@ -1693,7 +1571,7 @@ var heading1 = {
|
|
|
1693
1571
|
title: "Heading 1",
|
|
1694
1572
|
description: "Big heading.",
|
|
1695
1573
|
searchTerms: ["title", "big", "large"],
|
|
1696
|
-
icon: /* @__PURE__ */
|
|
1574
|
+
icon: /* @__PURE__ */ jsx15(Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
1697
1575
|
command: ({ editor, range }) => {
|
|
1698
1576
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
1699
1577
|
}
|
|
@@ -1702,7 +1580,7 @@ var heading2 = {
|
|
|
1702
1580
|
title: "Heading 2",
|
|
1703
1581
|
description: "Medium heading.",
|
|
1704
1582
|
searchTerms: ["subtitle", "medium"],
|
|
1705
|
-
icon: /* @__PURE__ */
|
|
1583
|
+
icon: /* @__PURE__ */ jsx15(Heading2, { className: "mly-h-4 mly-w-4" }),
|
|
1706
1584
|
command: ({ editor, range }) => {
|
|
1707
1585
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
1708
1586
|
}
|
|
@@ -1711,7 +1589,7 @@ var heading3 = {
|
|
|
1711
1589
|
title: "Heading 3",
|
|
1712
1590
|
description: "Small heading.",
|
|
1713
1591
|
searchTerms: ["subtitle", "small"],
|
|
1714
|
-
icon: /* @__PURE__ */
|
|
1592
|
+
icon: /* @__PURE__ */ jsx15(Heading3, { className: "mly-h-4 mly-w-4" }),
|
|
1715
1593
|
command: ({ editor, range }) => {
|
|
1716
1594
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
1717
1595
|
}
|
|
@@ -1720,7 +1598,7 @@ var hardBreak = {
|
|
|
1720
1598
|
title: "Hard Break",
|
|
1721
1599
|
description: "Add a break between lines.",
|
|
1722
1600
|
searchTerms: ["break", "line"],
|
|
1723
|
-
icon: /* @__PURE__ */
|
|
1601
|
+
icon: /* @__PURE__ */ jsx15(DivideIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1724
1602
|
command: ({ editor, range }) => {
|
|
1725
1603
|
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
1726
1604
|
}
|
|
@@ -1729,7 +1607,7 @@ var blockquote = {
|
|
|
1729
1607
|
title: "Blockquote",
|
|
1730
1608
|
description: "Add blockquote.",
|
|
1731
1609
|
searchTerms: ["quote", "blockquote"],
|
|
1732
|
-
icon: /* @__PURE__ */
|
|
1610
|
+
icon: /* @__PURE__ */ jsx15(TextQuote, { className: "mly-h-4 mly-w-4" }),
|
|
1733
1611
|
command: ({ editor, range }) => {
|
|
1734
1612
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
1735
1613
|
}
|
|
@@ -1738,7 +1616,7 @@ var footer = {
|
|
|
1738
1616
|
title: "Footer",
|
|
1739
1617
|
description: "Add a footer text to email.",
|
|
1740
1618
|
searchTerms: ["footer", "text"],
|
|
1741
|
-
icon: /* @__PURE__ */
|
|
1619
|
+
icon: /* @__PURE__ */ jsx15(FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1742
1620
|
command: ({ editor, range }) => {
|
|
1743
1621
|
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
1744
1622
|
}
|
|
@@ -1747,7 +1625,7 @@ var clearLine = {
|
|
|
1747
1625
|
title: "Clear Line",
|
|
1748
1626
|
description: "Clear the current line.",
|
|
1749
1627
|
searchTerms: ["clear", "line"],
|
|
1750
|
-
icon: /* @__PURE__ */
|
|
1628
|
+
icon: /* @__PURE__ */ jsx15(EraserIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1751
1629
|
command: ({ editor, range }) => {
|
|
1752
1630
|
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
1753
1631
|
}
|
|
@@ -1765,7 +1643,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
1765
1643
|
logo,
|
|
1766
1644
|
columns,
|
|
1767
1645
|
section,
|
|
1768
|
-
|
|
1646
|
+
repeat,
|
|
1769
1647
|
divider,
|
|
1770
1648
|
spacer,
|
|
1771
1649
|
button,
|
|
@@ -1777,20 +1655,20 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
1777
1655
|
];
|
|
1778
1656
|
|
|
1779
1657
|
// src/editor/nodes/variable/variable-view.tsx
|
|
1780
|
-
import { NodeViewWrapper as
|
|
1658
|
+
import { NodeViewWrapper as NodeViewWrapper2 } from "@tiptap/react";
|
|
1781
1659
|
import { AlertTriangle, Braces, Pencil } from "lucide-react";
|
|
1782
|
-
import { jsx as
|
|
1660
|
+
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1783
1661
|
function VariableView(props) {
|
|
1784
1662
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
1785
1663
|
const { id, fallback, required } = node.attrs;
|
|
1786
1664
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
1787
|
-
return /* @__PURE__ */
|
|
1788
|
-
|
|
1665
|
+
return /* @__PURE__ */ jsx16(
|
|
1666
|
+
NodeViewWrapper2,
|
|
1789
1667
|
{
|
|
1790
1668
|
className: "react-component mly-inline-block mly-leading-none",
|
|
1791
1669
|
draggable: "false",
|
|
1792
|
-
children: /* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1670
|
+
children: /* @__PURE__ */ jsxs4(Popover, { children: [
|
|
1671
|
+
/* @__PURE__ */ jsx16(
|
|
1794
1672
|
PopoverTrigger,
|
|
1795
1673
|
{
|
|
1796
1674
|
onClick: (e) => {
|
|
@@ -1807,7 +1685,7 @@ function VariableView(props) {
|
|
|
1807
1685
|
})
|
|
1808
1686
|
}
|
|
1809
1687
|
),
|
|
1810
|
-
/* @__PURE__ */
|
|
1688
|
+
/* @__PURE__ */ jsx16(
|
|
1811
1689
|
PopoverContent,
|
|
1812
1690
|
{
|
|
1813
1691
|
align: "start",
|
|
@@ -1816,10 +1694,10 @@ function VariableView(props) {
|
|
|
1816
1694
|
sideOffset: 8,
|
|
1817
1695
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
1818
1696
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1819
|
-
children: /* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1697
|
+
children: /* @__PURE__ */ jsx16(TooltipProvider, { children: /* @__PURE__ */ jsxs4("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
1698
|
+
/* @__PURE__ */ jsxs4("label", { className: "mly-relative", children: [
|
|
1699
|
+
/* @__PURE__ */ jsx16("span", { className: "mly-inline-block mly-px-2 mly-text-xs mly-text-midnight-gray", children: "Variable" }),
|
|
1700
|
+
/* @__PURE__ */ jsx16(
|
|
1823
1701
|
"input",
|
|
1824
1702
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
1825
1703
|
value: id != null ? id : "",
|
|
@@ -1833,10 +1711,10 @@ function VariableView(props) {
|
|
|
1833
1711
|
})
|
|
1834
1712
|
)
|
|
1835
1713
|
] }),
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx16(Divider, { className: "mly-mx-1.5" }),
|
|
1715
|
+
/* @__PURE__ */ jsxs4("label", { className: "mly-relative", children: [
|
|
1716
|
+
/* @__PURE__ */ jsx16("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
|
|
1717
|
+
/* @__PURE__ */ jsx16(
|
|
1840
1718
|
"input",
|
|
1841
1719
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
1842
1720
|
value: fallback != null ? fallback : "",
|
|
@@ -1849,7 +1727,7 @@ function VariableView(props) {
|
|
|
1849
1727
|
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"
|
|
1850
1728
|
})
|
|
1851
1729
|
),
|
|
1852
|
-
/* @__PURE__ */
|
|
1730
|
+
/* @__PURE__ */ jsx16("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ jsx16(Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
1853
1731
|
] })
|
|
1854
1732
|
] }) })
|
|
1855
1733
|
}
|
|
@@ -1862,13 +1740,13 @@ var DefaultRenderVariable = (props) => {
|
|
|
1862
1740
|
const { variable, fallback, from } = props;
|
|
1863
1741
|
const { name, required, valid } = variable;
|
|
1864
1742
|
if (from === "button-variable") {
|
|
1865
|
-
return /* @__PURE__ */
|
|
1866
|
-
/* @__PURE__ */
|
|
1867
|
-
/* @__PURE__ */
|
|
1743
|
+
return /* @__PURE__ */ jsxs4("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: [
|
|
1744
|
+
/* @__PURE__ */ jsx16(Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
|
|
1745
|
+
/* @__PURE__ */ jsx16("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1868
1746
|
] });
|
|
1869
1747
|
}
|
|
1870
1748
|
if (from === "bubble-variable") {
|
|
1871
|
-
return /* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ jsxs4(
|
|
1872
1750
|
"div",
|
|
1873
1751
|
{
|
|
1874
1752
|
className: cn(
|
|
@@ -1876,28 +1754,28 @@ var DefaultRenderVariable = (props) => {
|
|
|
1876
1754
|
!valid && "mly-border-rose-400 mly-bg-rose-50 mly-text-rose-600 hover:mly-bg-rose-100"
|
|
1877
1755
|
),
|
|
1878
1756
|
children: [
|
|
1879
|
-
/* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1757
|
+
/* @__PURE__ */ jsx16(Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1758
|
+
/* @__PURE__ */ jsx16("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1881
1759
|
]
|
|
1882
1760
|
}
|
|
1883
1761
|
);
|
|
1884
1762
|
}
|
|
1885
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsxs4(
|
|
1886
1764
|
"span",
|
|
1887
1765
|
{
|
|
1888
1766
|
tabIndex: -1,
|
|
1889
1767
|
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",
|
|
1890
1768
|
children: [
|
|
1891
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx16(Braces, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1892
1770
|
name,
|
|
1893
|
-
required && !fallback && /* @__PURE__ */
|
|
1771
|
+
required && !fallback && /* @__PURE__ */ jsx16(AlertTriangle, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5]" })
|
|
1894
1772
|
]
|
|
1895
1773
|
}
|
|
1896
1774
|
);
|
|
1897
1775
|
};
|
|
1898
1776
|
|
|
1899
1777
|
// src/editor/provider.tsx
|
|
1900
|
-
import { jsx as
|
|
1778
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1901
1779
|
var DEFAULT_PLACEHOLDER_URL = "maily.to/";
|
|
1902
1780
|
var DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
|
|
1903
1781
|
var DEFAULT_VARIABLES = [];
|
|
@@ -1931,7 +1809,7 @@ import {
|
|
|
1931
1809
|
useEffect,
|
|
1932
1810
|
useRef
|
|
1933
1811
|
} from "react";
|
|
1934
|
-
import { jsx as
|
|
1812
|
+
import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1935
1813
|
var VariablePopover = forwardRef6((props, ref) => {
|
|
1936
1814
|
const { items, onSelectItem } = props;
|
|
1937
1815
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
@@ -1977,17 +1855,17 @@ var VariablePopover = forwardRef6((props, ref) => {
|
|
|
1977
1855
|
onSelectItem(item);
|
|
1978
1856
|
}
|
|
1979
1857
|
}));
|
|
1980
|
-
return /* @__PURE__ */
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
1858
|
+
return /* @__PURE__ */ jsxs5("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: [
|
|
1859
|
+
/* @__PURE__ */ jsxs5("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: [
|
|
1860
|
+
/* @__PURE__ */ jsx18("span", { className: "mly-text-xs mly-uppercase", children: "Variables" }),
|
|
1861
|
+
/* @__PURE__ */ jsx18(VariableIcon, { children: /* @__PURE__ */ jsx18(Braces2, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
1984
1862
|
] }),
|
|
1985
|
-
/* @__PURE__ */
|
|
1863
|
+
/* @__PURE__ */ jsx18(
|
|
1986
1864
|
"div",
|
|
1987
1865
|
{
|
|
1988
1866
|
ref: scrollContainerRef,
|
|
1989
1867
|
className: "mly-max-h-52 mly-overflow-y-auto mly-scrollbar-thin mly-scrollbar-track-transparent mly-scrollbar-thumb-gray-200",
|
|
1990
|
-
children: /* @__PURE__ */
|
|
1868
|
+
children: /* @__PURE__ */ jsx18("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__ */ jsxs5(
|
|
1991
1869
|
"button",
|
|
1992
1870
|
{
|
|
1993
1871
|
ref: (el) => itemRefs.current[index] = el,
|
|
@@ -1997,27 +1875,27 @@ var VariablePopover = forwardRef6((props, ref) => {
|
|
|
1997
1875
|
index === selectedIndex ? "mly-bg-soft-gray" : "mly-bg-white"
|
|
1998
1876
|
),
|
|
1999
1877
|
children: [
|
|
2000
|
-
/* @__PURE__ */
|
|
1878
|
+
/* @__PURE__ */ jsx18(Braces2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
2001
1879
|
item.name
|
|
2002
1880
|
]
|
|
2003
1881
|
},
|
|
2004
1882
|
index
|
|
2005
|
-
)) : /* @__PURE__ */
|
|
1883
|
+
)) : /* @__PURE__ */ jsx18("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" }) })
|
|
2006
1884
|
}
|
|
2007
1885
|
),
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
1886
|
+
/* @__PURE__ */ jsxs5("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: [
|
|
1887
|
+
/* @__PURE__ */ jsxs5("div", { className: "mly-flex mly-items-center mly-gap-1", children: [
|
|
1888
|
+
/* @__PURE__ */ jsx18(VariableIcon, { children: /* @__PURE__ */ jsx18(ArrowDownIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
1889
|
+
/* @__PURE__ */ jsx18(VariableIcon, { children: /* @__PURE__ */ jsx18(ArrowUpIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
1890
|
+
/* @__PURE__ */ jsx18("span", { className: "mly-text-xs mly-text-gray-500", children: "Navigate" })
|
|
2013
1891
|
] }),
|
|
2014
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ jsx18(VariableIcon, { children: /* @__PURE__ */ jsx18(CornerDownLeftIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
2015
1893
|
] })
|
|
2016
1894
|
] });
|
|
2017
1895
|
});
|
|
2018
1896
|
function VariableIcon(props) {
|
|
2019
1897
|
const { className, children } = props;
|
|
2020
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ jsx18(
|
|
2021
1899
|
"div",
|
|
2022
1900
|
{
|
|
2023
1901
|
className: cn(
|
|
@@ -2054,7 +1932,7 @@ function useOutsideClick(ref, callback) {
|
|
|
2054
1932
|
// src/editor/components/ui/input-autocomplete.tsx
|
|
2055
1933
|
import { CornerDownLeft } from "lucide-react";
|
|
2056
1934
|
import { forwardRef as forwardRef7, useRef as useRef2 } from "react";
|
|
2057
|
-
import { jsx as
|
|
1935
|
+
import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2058
1936
|
var InputAutocomplete = forwardRef7((props, ref) => {
|
|
2059
1937
|
const _a = props, {
|
|
2060
1938
|
value = "",
|
|
@@ -2079,9 +1957,9 @@ var InputAutocomplete = forwardRef7((props, ref) => {
|
|
|
2079
1957
|
onOutsideClick == null ? void 0 : onOutsideClick();
|
|
2080
1958
|
});
|
|
2081
1959
|
const isTriggeringVariable = value.startsWith(triggerChar);
|
|
2082
|
-
return /* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2084
|
-
/* @__PURE__ */
|
|
1960
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("mly-relative"), ref: containerRef, children: [
|
|
1961
|
+
/* @__PURE__ */ jsxs6("label", { className: "mly-relative", children: [
|
|
1962
|
+
/* @__PURE__ */ jsx19(
|
|
2085
1963
|
"input",
|
|
2086
1964
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2087
1965
|
placeholder: "e.g. items",
|
|
@@ -2115,9 +1993,9 @@ var InputAutocomplete = forwardRef7((props, ref) => {
|
|
|
2115
1993
|
spellCheck: false
|
|
2116
1994
|
})
|
|
2117
1995
|
),
|
|
2118
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsx19("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ jsx19(CornerDownLeft, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
2119
1997
|
] }),
|
|
2120
|
-
isTriggeringVariable && /* @__PURE__ */
|
|
1998
|
+
isTriggeringVariable && /* @__PURE__ */ jsx19("div", { className: "mly-absolute mly-left-0 mly-top-8", children: /* @__PURE__ */ jsx19(
|
|
2121
1999
|
VariablePopover,
|
|
2122
2000
|
{
|
|
2123
2001
|
items: autoCompleteOptions.map((option) => {
|
|
@@ -2159,7 +2037,7 @@ You can check out the documentation for more information: https://github.com/ari
|
|
|
2159
2037
|
|
|
2160
2038
|
// src/editor/components/ui/link-input-popover.tsx
|
|
2161
2039
|
import { useMemo as useMemo2 } from "react";
|
|
2162
|
-
import { Fragment as Fragment2, jsx as
|
|
2040
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2163
2041
|
var LINK_PROTOCOL_REGEX = /https?:\/\//;
|
|
2164
2042
|
function LinkInputPopover(props) {
|
|
2165
2043
|
var _a;
|
|
@@ -2197,7 +2075,7 @@ function LinkInputPopover(props) {
|
|
|
2197
2075
|
editor
|
|
2198
2076
|
}).map((variable) => variable.name);
|
|
2199
2077
|
}, [variables, defaultUrlWithoutProtocol, editor]);
|
|
2200
|
-
const popoverButton = /* @__PURE__ */
|
|
2078
|
+
const popoverButton = /* @__PURE__ */ jsx20(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx20(
|
|
2201
2079
|
BaseButton,
|
|
2202
2080
|
{
|
|
2203
2081
|
variant: "ghost",
|
|
@@ -2205,19 +2083,19 @@ function LinkInputPopover(props) {
|
|
|
2205
2083
|
type: "button",
|
|
2206
2084
|
className: "mly-size-7",
|
|
2207
2085
|
"data-state": !!defaultUrlWithoutProtocol,
|
|
2208
|
-
children: /* @__PURE__ */
|
|
2086
|
+
children: /* @__PURE__ */ jsx20(Icon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-midnight-gray" })
|
|
2209
2087
|
}
|
|
2210
2088
|
) });
|
|
2211
2089
|
const normalizeProtocol = (value, p = protocol) => {
|
|
2212
2090
|
value = value == null ? void 0 : value.replace(LINK_PROTOCOL_REGEX, "");
|
|
2213
2091
|
return p + value;
|
|
2214
2092
|
};
|
|
2215
|
-
return /* @__PURE__ */
|
|
2216
|
-
tooltip ? /* @__PURE__ */
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */
|
|
2093
|
+
return /* @__PURE__ */ jsxs7(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2094
|
+
tooltip ? /* @__PURE__ */ jsxs7(Tooltip, { children: [
|
|
2095
|
+
/* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
2096
|
+
/* @__PURE__ */ jsx20(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2219
2097
|
] }) : popoverButton,
|
|
2220
|
-
/* @__PURE__ */
|
|
2098
|
+
/* @__PURE__ */ jsx20(
|
|
2221
2099
|
PopoverContent,
|
|
2222
2100
|
{
|
|
2223
2101
|
align: "end",
|
|
@@ -2225,7 +2103,7 @@ function LinkInputPopover(props) {
|
|
|
2225
2103
|
className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
|
|
2226
2104
|
sideOffset: 8,
|
|
2227
2105
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2228
|
-
children: /* @__PURE__ */
|
|
2106
|
+
children: /* @__PURE__ */ jsx20(
|
|
2229
2107
|
"form",
|
|
2230
2108
|
{
|
|
2231
2109
|
onSubmit: (e) => {
|
|
@@ -2238,8 +2116,8 @@ function LinkInputPopover(props) {
|
|
|
2238
2116
|
onValueChange == null ? void 0 : onValueChange(value);
|
|
2239
2117
|
setIsOpen(false);
|
|
2240
2118
|
},
|
|
2241
|
-
children: /* @__PURE__ */
|
|
2242
|
-
!isEditing && /* @__PURE__ */
|
|
2119
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
2120
|
+
!isEditing && /* @__PURE__ */ jsx20("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__ */ jsx20(
|
|
2243
2121
|
"button",
|
|
2244
2122
|
{
|
|
2245
2123
|
onClick: () => {
|
|
@@ -2260,9 +2138,9 @@ function LinkInputPopover(props) {
|
|
|
2260
2138
|
})
|
|
2261
2139
|
}
|
|
2262
2140
|
) }),
|
|
2263
|
-
isEditing && /* @__PURE__ */
|
|
2264
|
-
/* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
2141
|
+
isEditing && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
2142
|
+
/* @__PURE__ */ jsxs7("div", { className: "mly-relative", children: [
|
|
2143
|
+
/* @__PURE__ */ jsxs7(
|
|
2266
2144
|
"select",
|
|
2267
2145
|
{
|
|
2268
2146
|
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",
|
|
@@ -2279,12 +2157,12 @@ function LinkInputPopover(props) {
|
|
|
2279
2157
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
2280
2158
|
},
|
|
2281
2159
|
children: [
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2160
|
+
/* @__PURE__ */ jsx20("option", { value: "https://", children: "https://" }),
|
|
2161
|
+
/* @__PURE__ */ jsx20("option", { value: "http://", children: "http://" })
|
|
2284
2162
|
]
|
|
2285
2163
|
}
|
|
2286
2164
|
),
|
|
2287
|
-
/* @__PURE__ */
|
|
2165
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20(
|
|
2288
2166
|
ChevronDownIcon,
|
|
2289
2167
|
{
|
|
2290
2168
|
size: 16,
|
|
@@ -2294,7 +2172,7 @@ function LinkInputPopover(props) {
|
|
|
2294
2172
|
}
|
|
2295
2173
|
) })
|
|
2296
2174
|
] }),
|
|
2297
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsx20(
|
|
2298
2176
|
InputAutocomplete,
|
|
2299
2177
|
{
|
|
2300
2178
|
value: defaultUrlWithoutProtocol,
|
|
@@ -2332,7 +2210,7 @@ function LinkInputPopover(props) {
|
|
|
2332
2210
|
// src/editor/components/ui/select.tsx
|
|
2333
2211
|
import { useId } from "react";
|
|
2334
2212
|
import { ChevronDownIcon as ChevronDownIcon2 } from "lucide-react";
|
|
2335
|
-
import { jsx as
|
|
2213
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2336
2214
|
function Select(props) {
|
|
2337
2215
|
const {
|
|
2338
2216
|
label,
|
|
@@ -2345,10 +2223,10 @@ function Select(props) {
|
|
|
2345
2223
|
iconClassName
|
|
2346
2224
|
} = props;
|
|
2347
2225
|
const selectId = `mly${useId()}`;
|
|
2348
|
-
const content = /* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
Icon && /* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2226
|
+
const content = /* @__PURE__ */ jsxs8("div", { className: "relative", children: [
|
|
2227
|
+
/* @__PURE__ */ jsx21("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
2228
|
+
Icon && /* @__PURE__ */ jsx21("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__ */ jsx21(Icon, { className: cn("mly-size-3", iconClassName) }) }),
|
|
2229
|
+
/* @__PURE__ */ jsx21(
|
|
2352
2230
|
"select",
|
|
2353
2231
|
{
|
|
2354
2232
|
id: selectId,
|
|
@@ -2359,10 +2237,10 @@ function Select(props) {
|
|
|
2359
2237
|
),
|
|
2360
2238
|
value,
|
|
2361
2239
|
onChange: (event) => onValueChange(event.target.value),
|
|
2362
|
-
children: options.map((option) => /* @__PURE__ */
|
|
2240
|
+
children: options.map((option) => /* @__PURE__ */ jsx21("option", { value: option.value, children: option.label }, option.value))
|
|
2363
2241
|
}
|
|
2364
2242
|
),
|
|
2365
|
-
/* @__PURE__ */
|
|
2243
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21(
|
|
2366
2244
|
ChevronDownIcon2,
|
|
2367
2245
|
{
|
|
2368
2246
|
size: 16,
|
|
@@ -2375,21 +2253,21 @@ function Select(props) {
|
|
|
2375
2253
|
if (!tooltip) {
|
|
2376
2254
|
return content;
|
|
2377
2255
|
}
|
|
2378
|
-
return /* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2380
|
-
/* @__PURE__ */
|
|
2256
|
+
return /* @__PURE__ */ jsxs8(Tooltip, { children: [
|
|
2257
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: content }),
|
|
2258
|
+
/* @__PURE__ */ jsx21(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2381
2259
|
] });
|
|
2382
2260
|
}
|
|
2383
2261
|
|
|
2384
2262
|
// src/editor/nodes/button/button-view.tsx
|
|
2385
|
-
import { NodeViewWrapper as
|
|
2263
|
+
import { NodeViewWrapper as NodeViewWrapper3 } from "@tiptap/react";
|
|
2386
2264
|
|
|
2387
2265
|
// src/editor/components/show-popover.tsx
|
|
2388
2266
|
import { Eye } from "lucide-react";
|
|
2389
2267
|
import { useRef as useRef4, useState as useState4 } from "react";
|
|
2390
2268
|
import { useMemo as useMemo3 } from "react";
|
|
2391
2269
|
import { memo } from "react";
|
|
2392
|
-
import { jsx as
|
|
2270
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2393
2271
|
function _ShowPopover(props) {
|
|
2394
2272
|
const { showIfKey = "", onShowIfKeyValueChange, editor } = props;
|
|
2395
2273
|
const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
@@ -2403,7 +2281,7 @@ function _ShowPopover(props) {
|
|
|
2403
2281
|
}).map((variable) => variable.name);
|
|
2404
2282
|
}, [variables, showIfKey, editor]);
|
|
2405
2283
|
const isValidWhenKey = showIfKey || autoCompleteOptions.includes(showIfKey);
|
|
2406
|
-
return /* @__PURE__ */
|
|
2284
|
+
return /* @__PURE__ */ jsxs9(
|
|
2407
2285
|
Popover,
|
|
2408
2286
|
{
|
|
2409
2287
|
onOpenChange: (open) => {
|
|
@@ -2413,20 +2291,20 @@ function _ShowPopover(props) {
|
|
|
2413
2291
|
setIsUpdatingKey(false);
|
|
2414
2292
|
},
|
|
2415
2293
|
children: [
|
|
2416
|
-
/* @__PURE__ */
|
|
2417
|
-
/* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ jsxs9(Tooltip, { children: [
|
|
2295
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
2418
2296
|
PopoverTrigger,
|
|
2419
2297
|
{
|
|
2420
2298
|
className: cn(
|
|
2421
2299
|
"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",
|
|
2422
2300
|
showIfKey && "mly-bg-rose-100 mly-text-rose-800 data-[state=open]:mly-bg-rose-100 hover:mly-bg-rose-100"
|
|
2423
2301
|
),
|
|
2424
|
-
children: /* @__PURE__ */
|
|
2302
|
+
children: /* @__PURE__ */ jsx22(Eye, { className: "mly-h-4 mly-w-4 mly-stroke-[2.5]" })
|
|
2425
2303
|
}
|
|
2426
2304
|
) }),
|
|
2427
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ jsx22(TooltipContent, { sideOffset: 8, children: "Show block conditionally" })
|
|
2428
2306
|
] }),
|
|
2429
|
-
/* @__PURE__ */
|
|
2307
|
+
/* @__PURE__ */ jsxs9(
|
|
2430
2308
|
PopoverContent,
|
|
2431
2309
|
{
|
|
2432
2310
|
className: "mly-flex mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
@@ -2440,8 +2318,8 @@ function _ShowPopover(props) {
|
|
|
2440
2318
|
e.preventDefault();
|
|
2441
2319
|
},
|
|
2442
2320
|
children: [
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
!isUpdatingKey && /* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ jsx22("span", { className: "mly-flex mly-items-center mly-px-1.5 mly-text-sm mly-leading-none", children: "Show if" }),
|
|
2322
|
+
!isUpdatingKey && /* @__PURE__ */ jsx22(
|
|
2445
2323
|
"button",
|
|
2446
2324
|
{
|
|
2447
2325
|
onClick: () => {
|
|
@@ -2462,7 +2340,7 @@ function _ShowPopover(props) {
|
|
|
2462
2340
|
})
|
|
2463
2341
|
}
|
|
2464
2342
|
),
|
|
2465
|
-
isUpdatingKey && /* @__PURE__ */
|
|
2343
|
+
isUpdatingKey && /* @__PURE__ */ jsx22(
|
|
2466
2344
|
"form",
|
|
2467
2345
|
{
|
|
2468
2346
|
onSubmit: (e) => {
|
|
@@ -2474,7 +2352,7 @@ function _ShowPopover(props) {
|
|
|
2474
2352
|
setIsUpdatingKey(false);
|
|
2475
2353
|
}
|
|
2476
2354
|
},
|
|
2477
|
-
children: /* @__PURE__ */
|
|
2355
|
+
children: /* @__PURE__ */ jsx22(
|
|
2478
2356
|
InputAutocomplete,
|
|
2479
2357
|
{
|
|
2480
2358
|
value: showIfKey || "",
|
|
@@ -2507,7 +2385,7 @@ var ShowPopover = memo(_ShowPopover);
|
|
|
2507
2385
|
import { useMemo as useMemo4 } from "react";
|
|
2508
2386
|
import { useState as useState5 } from "react";
|
|
2509
2387
|
import { useRef as useRef5 } from "react";
|
|
2510
|
-
import { jsx as
|
|
2388
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2511
2389
|
function ButtonLabelInput(props) {
|
|
2512
2390
|
const { value, onValueChange, isVariable, editor } = props;
|
|
2513
2391
|
const linkInputRef = useRef5(null);
|
|
@@ -2529,8 +2407,8 @@ function ButtonLabelInput(props) {
|
|
|
2529
2407
|
editor
|
|
2530
2408
|
}).map((variable) => variable.name);
|
|
2531
2409
|
}, [variables, value, editor]);
|
|
2532
|
-
return /* @__PURE__ */
|
|
2533
|
-
!isEditing && /* @__PURE__ */
|
|
2410
|
+
return /* @__PURE__ */ jsxs10("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
2411
|
+
!isEditing && /* @__PURE__ */ jsx23(
|
|
2534
2412
|
"button",
|
|
2535
2413
|
{
|
|
2536
2414
|
onClick: () => {
|
|
@@ -2551,7 +2429,7 @@ function ButtonLabelInput(props) {
|
|
|
2551
2429
|
})
|
|
2552
2430
|
}
|
|
2553
2431
|
),
|
|
2554
|
-
isEditing && /* @__PURE__ */
|
|
2432
|
+
isEditing && /* @__PURE__ */ jsx23(
|
|
2555
2433
|
InputAutocomplete,
|
|
2556
2434
|
{
|
|
2557
2435
|
value,
|
|
@@ -2578,7 +2456,7 @@ function ButtonLabelInput(props) {
|
|
|
2578
2456
|
|
|
2579
2457
|
// src/editor/nodes/button/button-view.tsx
|
|
2580
2458
|
import { useMemo as useMemo5 } from "react";
|
|
2581
|
-
import { jsx as
|
|
2459
|
+
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2582
2460
|
function ButtonView(props) {
|
|
2583
2461
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
2584
2462
|
const {
|
|
@@ -2621,8 +2499,8 @@ function ButtonView(props) {
|
|
|
2621
2499
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
2622
2500
|
)) == null ? void 0 : _a[0];
|
|
2623
2501
|
}, [paddingRight, paddingTop, sizes]);
|
|
2624
|
-
return /* @__PURE__ */
|
|
2625
|
-
|
|
2502
|
+
return /* @__PURE__ */ jsx24(
|
|
2503
|
+
NodeViewWrapper3,
|
|
2626
2504
|
{
|
|
2627
2505
|
draggable: editor.isEditable,
|
|
2628
2506
|
"data-drag-handle": editor.isEditable,
|
|
@@ -2630,8 +2508,8 @@ function ButtonView(props) {
|
|
|
2630
2508
|
style: {
|
|
2631
2509
|
textAlign: alignment
|
|
2632
2510
|
},
|
|
2633
|
-
children: /* @__PURE__ */
|
|
2634
|
-
/* @__PURE__ */
|
|
2511
|
+
children: /* @__PURE__ */ jsxs11(Popover, { open: props.selected && editor.isEditable, children: [
|
|
2512
|
+
/* @__PURE__ */ jsx24(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24(
|
|
2635
2513
|
"button",
|
|
2636
2514
|
{
|
|
2637
2515
|
className: cn(
|
|
@@ -2674,7 +2552,7 @@ function ButtonView(props) {
|
|
|
2674
2552
|
}) : text2
|
|
2675
2553
|
}
|
|
2676
2554
|
) }) }),
|
|
2677
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ jsx24(
|
|
2678
2556
|
PopoverContent,
|
|
2679
2557
|
{
|
|
2680
2558
|
align: "end",
|
|
@@ -2683,8 +2561,8 @@ function ButtonView(props) {
|
|
|
2683
2561
|
sideOffset: 8,
|
|
2684
2562
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2685
2563
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2686
|
-
children: /* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
2564
|
+
children: /* @__PURE__ */ jsx24(TooltipProvider, { children: /* @__PURE__ */ jsxs11("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
2565
|
+
/* @__PURE__ */ jsx24(
|
|
2688
2566
|
ButtonLabelInput,
|
|
2689
2567
|
{
|
|
2690
2568
|
value: text2,
|
|
@@ -2698,9 +2576,9 @@ function ButtonView(props) {
|
|
|
2698
2576
|
editor
|
|
2699
2577
|
}
|
|
2700
2578
|
),
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2579
|
+
/* @__PURE__ */ jsx24(Divider, {}),
|
|
2580
|
+
/* @__PURE__ */ jsxs11("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
2581
|
+
/* @__PURE__ */ jsx24(
|
|
2704
2582
|
Select,
|
|
2705
2583
|
{
|
|
2706
2584
|
label: "Border Radius",
|
|
@@ -2718,7 +2596,7 @@ function ButtonView(props) {
|
|
|
2718
2596
|
className: "mly-capitalize"
|
|
2719
2597
|
}
|
|
2720
2598
|
),
|
|
2721
|
-
/* @__PURE__ */
|
|
2599
|
+
/* @__PURE__ */ jsx24(
|
|
2722
2600
|
Select,
|
|
2723
2601
|
{
|
|
2724
2602
|
label: "Style",
|
|
@@ -2736,7 +2614,7 @@ function ButtonView(props) {
|
|
|
2736
2614
|
className: "mly-capitalize"
|
|
2737
2615
|
}
|
|
2738
2616
|
),
|
|
2739
|
-
/* @__PURE__ */
|
|
2617
|
+
/* @__PURE__ */ jsx24(
|
|
2740
2618
|
Select,
|
|
2741
2619
|
{
|
|
2742
2620
|
label: "Size",
|
|
@@ -2759,9 +2637,9 @@ function ButtonView(props) {
|
|
|
2759
2637
|
}
|
|
2760
2638
|
)
|
|
2761
2639
|
] }),
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
/* @__PURE__ */
|
|
2764
|
-
/* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ jsx24(Divider, {}),
|
|
2641
|
+
/* @__PURE__ */ jsxs11("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx24(
|
|
2765
2643
|
AlignmentSwitch,
|
|
2766
2644
|
{
|
|
2767
2645
|
alignment,
|
|
@@ -2772,7 +2650,7 @@ function ButtonView(props) {
|
|
|
2772
2650
|
}
|
|
2773
2651
|
}
|
|
2774
2652
|
),
|
|
2775
|
-
/* @__PURE__ */
|
|
2653
|
+
/* @__PURE__ */ jsx24(
|
|
2776
2654
|
LinkInputPopover,
|
|
2777
2655
|
{
|
|
2778
2656
|
defaultValue: externalLink || "",
|
|
@@ -2788,9 +2666,9 @@ function ButtonView(props) {
|
|
|
2788
2666
|
}
|
|
2789
2667
|
)
|
|
2790
2668
|
] }),
|
|
2791
|
-
/* @__PURE__ */
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ jsx24(Divider, {}),
|
|
2670
|
+
/* @__PURE__ */ jsxs11("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
2671
|
+
/* @__PURE__ */ jsx24(
|
|
2794
2672
|
BackgroundColorPickerPopup,
|
|
2795
2673
|
{
|
|
2796
2674
|
variant,
|
|
@@ -2802,7 +2680,7 @@ function ButtonView(props) {
|
|
|
2802
2680
|
}
|
|
2803
2681
|
}
|
|
2804
2682
|
),
|
|
2805
|
-
/* @__PURE__ */
|
|
2683
|
+
/* @__PURE__ */ jsx24(
|
|
2806
2684
|
TextColorPickerPopup,
|
|
2807
2685
|
{
|
|
2808
2686
|
color: textColor,
|
|
@@ -2814,8 +2692,8 @@ function ButtonView(props) {
|
|
|
2814
2692
|
}
|
|
2815
2693
|
)
|
|
2816
2694
|
] }),
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ jsx24(Divider, {}),
|
|
2696
|
+
/* @__PURE__ */ jsx24(
|
|
2819
2697
|
ShowPopover,
|
|
2820
2698
|
{
|
|
2821
2699
|
showIfKey,
|
|
@@ -2836,20 +2714,20 @@ function ButtonView(props) {
|
|
|
2836
2714
|
}
|
|
2837
2715
|
function BackgroundColorPickerPopup(props) {
|
|
2838
2716
|
const { color, onChange, variant } = props;
|
|
2839
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx24(
|
|
2840
2718
|
ColorPicker,
|
|
2841
2719
|
{
|
|
2842
2720
|
color,
|
|
2843
2721
|
onColorChange: onChange,
|
|
2844
2722
|
tooltip: "Background Color",
|
|
2845
|
-
children: /* @__PURE__ */
|
|
2723
|
+
children: /* @__PURE__ */ jsx24(
|
|
2846
2724
|
BaseButton,
|
|
2847
2725
|
{
|
|
2848
2726
|
variant: "ghost",
|
|
2849
2727
|
size: "sm",
|
|
2850
2728
|
type: "button",
|
|
2851
2729
|
className: "mly-size-7",
|
|
2852
|
-
children: /* @__PURE__ */
|
|
2730
|
+
children: /* @__PURE__ */ jsx24(
|
|
2853
2731
|
"div",
|
|
2854
2732
|
{
|
|
2855
2733
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded-full mly-shadow",
|
|
@@ -2868,16 +2746,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
2868
2746
|
}
|
|
2869
2747
|
function TextColorPickerPopup(props) {
|
|
2870
2748
|
const { color, onChange } = props;
|
|
2871
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ jsx24(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ jsx24(
|
|
2872
2750
|
BaseButton,
|
|
2873
2751
|
{
|
|
2874
2752
|
variant: "ghost",
|
|
2875
2753
|
size: "sm",
|
|
2876
2754
|
type: "button",
|
|
2877
2755
|
className: "mly-size-7",
|
|
2878
|
-
children: /* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
2880
|
-
/* @__PURE__ */
|
|
2756
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
|
|
2757
|
+
/* @__PURE__ */ jsx24("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-midnight-gray", children: "A" }),
|
|
2758
|
+
/* @__PURE__ */ jsx24(
|
|
2881
2759
|
"div",
|
|
2882
2760
|
{
|
|
2883
2761
|
className: "mly-h-[2px] mly-w-3 mly-shrink-0 mly-rounded-md mly-shadow",
|
|
@@ -2901,7 +2779,7 @@ var DEFAULT_BUTTON_PADDING_BOTTOM = 10;
|
|
|
2901
2779
|
var DEFAULT_BUTTON_PADDING_LEFT = 32;
|
|
2902
2780
|
var allowedButtonVariant = ["filled", "outline"];
|
|
2903
2781
|
var allowedButtonBorderRadius = ["sharp", "smooth", "round"];
|
|
2904
|
-
var ButtonExtension =
|
|
2782
|
+
var ButtonExtension = Node8.create({
|
|
2905
2783
|
name: "button",
|
|
2906
2784
|
group: "block",
|
|
2907
2785
|
atom: true,
|
|
@@ -3098,7 +2976,7 @@ var ButtonExtension = Node9.create({
|
|
|
3098
2976
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
3099
2977
|
return [
|
|
3100
2978
|
"div",
|
|
3101
|
-
|
|
2979
|
+
mergeAttributes7(HTMLAttributes2, {
|
|
3102
2980
|
"data-type": this.name
|
|
3103
2981
|
})
|
|
3104
2982
|
];
|
|
@@ -3116,7 +2994,7 @@ var ButtonExtension = Node9.create({
|
|
|
3116
2994
|
};
|
|
3117
2995
|
},
|
|
3118
2996
|
addNodeView() {
|
|
3119
|
-
return
|
|
2997
|
+
return ReactNodeViewRenderer2(ButtonView, {
|
|
3120
2998
|
contentDOMElementTag: "div",
|
|
3121
2999
|
className: "mly-relative"
|
|
3122
3000
|
});
|
|
@@ -3125,10 +3003,10 @@ var ButtonExtension = Node9.create({
|
|
|
3125
3003
|
|
|
3126
3004
|
// src/editor/nodes/logo/logo.ts
|
|
3127
3005
|
import TiptapImage from "@tiptap/extension-image";
|
|
3128
|
-
import { ReactNodeViewRenderer as
|
|
3006
|
+
import { ReactNodeViewRenderer as ReactNodeViewRenderer3 } from "@tiptap/react";
|
|
3129
3007
|
|
|
3130
3008
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3131
|
-
import { NodeViewWrapper as
|
|
3009
|
+
import { NodeViewWrapper as NodeViewWrapper5 } from "@tiptap/react";
|
|
3132
3010
|
import { useEffect as useEffect4 } from "react";
|
|
3133
3011
|
import { useState as useState7 } from "react";
|
|
3134
3012
|
|
|
@@ -3148,10 +3026,10 @@ var useEvent = (handler) => {
|
|
|
3148
3026
|
};
|
|
3149
3027
|
|
|
3150
3028
|
// src/editor/nodes/image/image-view.tsx
|
|
3151
|
-
import { NodeViewWrapper as
|
|
3029
|
+
import { NodeViewWrapper as NodeViewWrapper4 } from "@tiptap/react";
|
|
3152
3030
|
import { Ban, BracesIcon as BracesIcon2, ImageOffIcon, Loader2 } from "lucide-react";
|
|
3153
3031
|
import { useEffect as useEffect3, useRef as useRef7, useState as useState6 } from "react";
|
|
3154
|
-
import { Fragment as Fragment3, jsx as
|
|
3032
|
+
import { Fragment as Fragment3, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3155
3033
|
var MIN_WIDTH = 20;
|
|
3156
3034
|
var MAX_WIDTH = 600;
|
|
3157
3035
|
function ImageView(props) {
|
|
@@ -3202,7 +3080,7 @@ function ImageView(props) {
|
|
|
3202
3080
|
}
|
|
3203
3081
|
);
|
|
3204
3082
|
function dragCornerButton(direction) {
|
|
3205
|
-
return /* @__PURE__ */
|
|
3083
|
+
return /* @__PURE__ */ jsx25(
|
|
3206
3084
|
"div",
|
|
3207
3085
|
{
|
|
3208
3086
|
role: "button",
|
|
@@ -3267,8 +3145,8 @@ function ImageView(props) {
|
|
|
3267
3145
|
img.onerror = null;
|
|
3268
3146
|
};
|
|
3269
3147
|
}, [src]);
|
|
3270
|
-
return /* @__PURE__ */
|
|
3271
|
-
|
|
3148
|
+
return /* @__PURE__ */ jsxs12(
|
|
3149
|
+
NodeViewWrapper4,
|
|
3272
3150
|
{
|
|
3273
3151
|
as: "div",
|
|
3274
3152
|
draggable: editor.isEditable,
|
|
@@ -3289,12 +3167,12 @@ function ImageView(props) {
|
|
|
3289
3167
|
}[alignment] || {}),
|
|
3290
3168
|
ref: wrapperRef,
|
|
3291
3169
|
children: [
|
|
3292
|
-
!hasImageSrc && /* @__PURE__ */
|
|
3293
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */
|
|
3294
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */
|
|
3295
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */
|
|
3296
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3170
|
+
!hasImageSrc && /* @__PURE__ */ jsx25(ImageStatusLabel, { status: "idle" }),
|
|
3171
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ jsx25(ImageStatusLabel, { status: "variable" }),
|
|
3172
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ jsx25(ImageStatusLabel, { status: "loading" }),
|
|
3173
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ jsx25(ImageStatusLabel, { status: "error" }),
|
|
3174
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3175
|
+
/* @__PURE__ */ jsx25(
|
|
3298
3176
|
"img",
|
|
3299
3177
|
__spreadProps(__spreadValues({}, attrs), {
|
|
3300
3178
|
ref: imgRef,
|
|
@@ -3305,13 +3183,13 @@ function ImageView(props) {
|
|
|
3305
3183
|
draggable: editor.isEditable
|
|
3306
3184
|
})
|
|
3307
3185
|
),
|
|
3308
|
-
selected && editor.isEditable && /* @__PURE__ */
|
|
3186
|
+
selected && editor.isEditable && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3309
3187
|
[
|
|
3310
3188
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
3311
3189
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
3312
3190
|
{ top: 0, left: 0, width: "100%", height: "1px" },
|
|
3313
3191
|
{ bottom: 0, left: 0, width: "100%", height: "1px" }
|
|
3314
|
-
].map((style, i) => /* @__PURE__ */
|
|
3192
|
+
].map((style, i) => /* @__PURE__ */ jsx25(
|
|
3315
3193
|
"div",
|
|
3316
3194
|
{
|
|
3317
3195
|
className: "mly-bg-rose-500",
|
|
@@ -3333,7 +3211,7 @@ function ImageView(props) {
|
|
|
3333
3211
|
}
|
|
3334
3212
|
function ImageStatusLabel(props) {
|
|
3335
3213
|
const { status } = props;
|
|
3336
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ jsxs12(
|
|
3337
3215
|
"div",
|
|
3338
3216
|
{
|
|
3339
3217
|
className: cn(
|
|
@@ -3344,21 +3222,21 @@ function ImageStatusLabel(props) {
|
|
|
3344
3222
|
}
|
|
3345
3223
|
),
|
|
3346
3224
|
children: [
|
|
3347
|
-
status === "idle" && /* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3349
|
-
/* @__PURE__ */
|
|
3225
|
+
status === "idle" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3226
|
+
/* @__PURE__ */ jsx25(ImageOffIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3227
|
+
/* @__PURE__ */ jsx25("span", { children: "No image selected" })
|
|
3350
3228
|
] }),
|
|
3351
|
-
status === "loading" && /* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3229
|
+
status === "loading" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3230
|
+
/* @__PURE__ */ jsx25(Loader2, { className: "mly-size-4 mly-animate-spin mly-stroke-[2.5]" }),
|
|
3231
|
+
/* @__PURE__ */ jsx25("span", { children: "Loading image..." })
|
|
3354
3232
|
] }),
|
|
3355
|
-
status === "error" && /* @__PURE__ */
|
|
3356
|
-
/* @__PURE__ */
|
|
3357
|
-
/* @__PURE__ */
|
|
3233
|
+
status === "error" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3234
|
+
/* @__PURE__ */ jsx25(Ban, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3235
|
+
/* @__PURE__ */ jsx25("span", { children: "Error loading image" })
|
|
3358
3236
|
] }),
|
|
3359
|
-
status === "variable" && /* @__PURE__ */
|
|
3360
|
-
/* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3237
|
+
status === "variable" && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3238
|
+
/* @__PURE__ */ jsx25(BracesIcon2, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3239
|
+
/* @__PURE__ */ jsx25("span", { children: "Variable Image URL" })
|
|
3362
3240
|
] })
|
|
3363
3241
|
]
|
|
3364
3242
|
}
|
|
@@ -3366,7 +3244,7 @@ function ImageStatusLabel(props) {
|
|
|
3366
3244
|
}
|
|
3367
3245
|
|
|
3368
3246
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3369
|
-
import { jsx as
|
|
3247
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3370
3248
|
function LogoView(props) {
|
|
3371
3249
|
const { node, editor } = props;
|
|
3372
3250
|
const [status, setStatus] = useState7("idle");
|
|
@@ -3397,8 +3275,8 @@ function LogoView(props) {
|
|
|
3397
3275
|
};
|
|
3398
3276
|
}, [logoSrc]);
|
|
3399
3277
|
const logoSize = logoSizes[size];
|
|
3400
|
-
return /* @__PURE__ */
|
|
3401
|
-
|
|
3278
|
+
return /* @__PURE__ */ jsxs13(
|
|
3279
|
+
NodeViewWrapper5,
|
|
3402
3280
|
{
|
|
3403
3281
|
as: "div",
|
|
3404
3282
|
draggable: editor.isEditable,
|
|
@@ -3411,11 +3289,11 @@ function LogoView(props) {
|
|
|
3411
3289
|
display: "block"
|
|
3412
3290
|
},
|
|
3413
3291
|
children: [
|
|
3414
|
-
!hasImageSrc && /* @__PURE__ */
|
|
3415
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */
|
|
3416
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */
|
|
3417
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */
|
|
3418
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */
|
|
3292
|
+
!hasImageSrc && /* @__PURE__ */ jsx26(ImageStatusLabel, { status: "idle" }),
|
|
3293
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ jsx26(ImageStatusLabel, { status: "variable" }),
|
|
3294
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ jsx26(ImageStatusLabel, { status: "loading" }),
|
|
3295
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ jsx26(ImageStatusLabel, { status: "error" }),
|
|
3296
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ jsx26(
|
|
3419
3297
|
"img",
|
|
3420
3298
|
{
|
|
3421
3299
|
src: logoSrc,
|
|
@@ -3535,7 +3413,7 @@ var LogoExtension = TiptapImage.extend({
|
|
|
3535
3413
|
];
|
|
3536
3414
|
},
|
|
3537
3415
|
addNodeView() {
|
|
3538
|
-
return
|
|
3416
|
+
return ReactNodeViewRenderer3(LogoView, {
|
|
3539
3417
|
className: "mly-relative"
|
|
3540
3418
|
});
|
|
3541
3419
|
}
|
|
@@ -3543,7 +3421,7 @@ var LogoExtension = TiptapImage.extend({
|
|
|
3543
3421
|
|
|
3544
3422
|
// src/editor/nodes/image/image.ts
|
|
3545
3423
|
import TiptapImage2 from "@tiptap/extension-image";
|
|
3546
|
-
import { ReactNodeViewRenderer as
|
|
3424
|
+
import { ReactNodeViewRenderer as ReactNodeViewRenderer4 } from "@tiptap/react";
|
|
3547
3425
|
var ImageExtension = TiptapImage2.extend({
|
|
3548
3426
|
addAttributes() {
|
|
3549
3427
|
var _a;
|
|
@@ -3635,7 +3513,7 @@ var ImageExtension = TiptapImage2.extend({
|
|
|
3635
3513
|
});
|
|
3636
3514
|
},
|
|
3637
3515
|
addNodeView() {
|
|
3638
|
-
return
|
|
3516
|
+
return ReactNodeViewRenderer4(ImageView, {
|
|
3639
3517
|
className: "mly-relative"
|
|
3640
3518
|
});
|
|
3641
3519
|
}
|
|
@@ -3710,6 +3588,128 @@ var ParagraphExtension = TiptapParagraph.extend({
|
|
|
3710
3588
|
}
|
|
3711
3589
|
});
|
|
3712
3590
|
|
|
3591
|
+
// src/editor/nodes/repeat/repeat.ts
|
|
3592
|
+
import { mergeAttributes as mergeAttributes8, Node as Node9 } from "@tiptap/core";
|
|
3593
|
+
import { ReactNodeViewRenderer as ReactNodeViewRenderer5 } from "@tiptap/react";
|
|
3594
|
+
|
|
3595
|
+
// src/editor/nodes/repeat/repeat-view.tsx
|
|
3596
|
+
import { NodeViewWrapper as NodeViewWrapper6, NodeViewContent } from "@tiptap/react";
|
|
3597
|
+
import { Repeat2 as Repeat22 } from "lucide-react";
|
|
3598
|
+
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3599
|
+
function RepeatView(props) {
|
|
3600
|
+
const { editor, getPos } = props;
|
|
3601
|
+
return /* @__PURE__ */ jsxs14(
|
|
3602
|
+
NodeViewWrapper6,
|
|
3603
|
+
{
|
|
3604
|
+
"data-type": "repeat",
|
|
3605
|
+
draggable: editor.isEditable,
|
|
3606
|
+
"data-drag-handle": editor.isEditable,
|
|
3607
|
+
className: "mly-relative",
|
|
3608
|
+
children: [
|
|
3609
|
+
/* @__PURE__ */ jsx27(NodeViewContent, { className: "is-editable" }),
|
|
3610
|
+
/* @__PURE__ */ jsxs14(
|
|
3611
|
+
"div",
|
|
3612
|
+
{
|
|
3613
|
+
role: "button",
|
|
3614
|
+
"data-repeat-indicator": "",
|
|
3615
|
+
className: "mly-absolute mly-inset-y-0 mly-right-0 mly-flex mly-translate-x-full mly-cursor-pointer mly-flex-col mly-items-center mly-gap-1 mly-opacity-60",
|
|
3616
|
+
contentEditable: false,
|
|
3617
|
+
onClick: () => {
|
|
3618
|
+
editor.commands.setNodeSelection(getPos());
|
|
3619
|
+
},
|
|
3620
|
+
children: [
|
|
3621
|
+
/* @__PURE__ */ jsx27(Repeat22, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
3622
|
+
/* @__PURE__ */ jsx27("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
3623
|
+
]
|
|
3624
|
+
}
|
|
3625
|
+
)
|
|
3626
|
+
]
|
|
3627
|
+
}
|
|
3628
|
+
);
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
// src/editor/nodes/repeat/repeat.ts
|
|
3632
|
+
var RepeatExtension = Node9.create({
|
|
3633
|
+
name: "repeat",
|
|
3634
|
+
group: "block",
|
|
3635
|
+
content: "(block|columns)+",
|
|
3636
|
+
draggable: true,
|
|
3637
|
+
isolating: true,
|
|
3638
|
+
addAttributes() {
|
|
3639
|
+
return {
|
|
3640
|
+
each: {
|
|
3641
|
+
default: "items",
|
|
3642
|
+
parseHTML: (element) => {
|
|
3643
|
+
return element.getAttribute("each") || "";
|
|
3644
|
+
},
|
|
3645
|
+
renderHTML: (attributes) => {
|
|
3646
|
+
if (!attributes.each) {
|
|
3647
|
+
return {};
|
|
3648
|
+
}
|
|
3649
|
+
return {
|
|
3650
|
+
each: attributes.each
|
|
3651
|
+
};
|
|
3652
|
+
}
|
|
3653
|
+
},
|
|
3654
|
+
isUpdatingKey: {
|
|
3655
|
+
default: false
|
|
3656
|
+
},
|
|
3657
|
+
showIfKey: {
|
|
3658
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
3659
|
+
parseHTML: (element) => {
|
|
3660
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
3661
|
+
},
|
|
3662
|
+
renderHTML(attributes) {
|
|
3663
|
+
if (!attributes.showIfKey) {
|
|
3664
|
+
return {};
|
|
3665
|
+
}
|
|
3666
|
+
return {
|
|
3667
|
+
"data-show-if-key": attributes.showIfKey
|
|
3668
|
+
};
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
};
|
|
3672
|
+
},
|
|
3673
|
+
parseHTML() {
|
|
3674
|
+
return [
|
|
3675
|
+
{
|
|
3676
|
+
tag: `div[data-type="${this.name}"]`
|
|
3677
|
+
}
|
|
3678
|
+
];
|
|
3679
|
+
},
|
|
3680
|
+
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
3681
|
+
return [
|
|
3682
|
+
"div",
|
|
3683
|
+
mergeAttributes8(HTMLAttributes2, {
|
|
3684
|
+
"data-type": this.name
|
|
3685
|
+
}),
|
|
3686
|
+
0
|
|
3687
|
+
];
|
|
3688
|
+
},
|
|
3689
|
+
addCommands() {
|
|
3690
|
+
return {
|
|
3691
|
+
setRepeat: () => ({ commands }) => {
|
|
3692
|
+
return commands.insertContent({
|
|
3693
|
+
type: this.name,
|
|
3694
|
+
attrs: {},
|
|
3695
|
+
content: [
|
|
3696
|
+
{
|
|
3697
|
+
type: "paragraph"
|
|
3698
|
+
}
|
|
3699
|
+
]
|
|
3700
|
+
});
|
|
3701
|
+
},
|
|
3702
|
+
updateRepeat: (attrs) => updateAttributes(this.name, attrs)
|
|
3703
|
+
};
|
|
3704
|
+
},
|
|
3705
|
+
addNodeView() {
|
|
3706
|
+
return ReactNodeViewRenderer5(RepeatView, {
|
|
3707
|
+
contentDOMElementTag: "div",
|
|
3708
|
+
className: "mly-relative"
|
|
3709
|
+
});
|
|
3710
|
+
}
|
|
3711
|
+
});
|
|
3712
|
+
|
|
3713
3713
|
// src/editor/extensions/maily-kit.tsx
|
|
3714
3714
|
var MailyKit = Extension.create({
|
|
3715
3715
|
name: "maily-kit",
|
|
@@ -3772,7 +3772,7 @@ var MailyKit = Extension.create({
|
|
|
3772
3772
|
"columns",
|
|
3773
3773
|
"column",
|
|
3774
3774
|
"section",
|
|
3775
|
-
"
|
|
3775
|
+
"repeat",
|
|
3776
3776
|
"show",
|
|
3777
3777
|
"blockquote"
|
|
3778
3778
|
].includes(node.type.name)) {
|
|
@@ -3804,8 +3804,8 @@ var MailyKit = Extension.create({
|
|
|
3804
3804
|
if (this.options.linkCard !== false) {
|
|
3805
3805
|
extensions.push(LinkCardExtension.configure(this.options.linkCard));
|
|
3806
3806
|
}
|
|
3807
|
-
if (this.options.
|
|
3808
|
-
extensions.push(
|
|
3807
|
+
if (this.options.repeat !== false) {
|
|
3808
|
+
extensions.push(RepeatExtension);
|
|
3809
3809
|
}
|
|
3810
3810
|
if (this.options.section !== false) {
|
|
3811
3811
|
extensions.push(SectionExtension);
|
|
@@ -4202,9 +4202,8 @@ var VariableExtension = Node10.create({
|
|
|
4202
4202
|
|
|
4203
4203
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
4204
4204
|
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
4205
|
-
import { forwardRef as forwardRef8, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
4205
|
+
import { useRef as useRef9, forwardRef as forwardRef8, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
4206
4206
|
import tippy2 from "tippy.js";
|
|
4207
|
-
import { useRef as useRef9 } from "react";
|
|
4208
4207
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4209
4208
|
var VariableList = forwardRef8((props, ref) => {
|
|
4210
4209
|
const { items = [] } = props;
|
|
@@ -4248,7 +4247,7 @@ var VariableList = forwardRef8((props, ref) => {
|
|
|
4248
4247
|
);
|
|
4249
4248
|
});
|
|
4250
4249
|
VariableList.displayName = "VariableList";
|
|
4251
|
-
function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
|
|
4250
|
+
function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VARIABLE_TRIGGER_CHAR, variableListComponent = VariableList) {
|
|
4252
4251
|
return {
|
|
4253
4252
|
char,
|
|
4254
4253
|
items: ({ query, editor }) => {
|
|
@@ -4263,7 +4262,7 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4263
4262
|
let popup = null;
|
|
4264
4263
|
return {
|
|
4265
4264
|
onStart: (props) => {
|
|
4266
|
-
component = new ReactRenderer2(
|
|
4265
|
+
component = new ReactRenderer2(variableListComponent, {
|
|
4267
4266
|
props,
|
|
4268
4267
|
editor: props.editor
|
|
4269
4268
|
});
|
|
@@ -4342,12 +4341,12 @@ export {
|
|
|
4342
4341
|
DEFAULT_SECTION_PADDING_TOP,
|
|
4343
4342
|
DEFAULT_SECTION_SHOW_IF_KEY,
|
|
4344
4343
|
Footer,
|
|
4345
|
-
ForExtension,
|
|
4346
4344
|
HorizontalRule,
|
|
4347
4345
|
ImageExtension,
|
|
4348
4346
|
LinkExtension,
|
|
4349
4347
|
LogoExtension,
|
|
4350
4348
|
MailyKit,
|
|
4349
|
+
RepeatExtension,
|
|
4351
4350
|
SectionExtension,
|
|
4352
4351
|
SlashCommandExtension,
|
|
4353
4352
|
Spacer,
|