@maily-to/core 0.0.25 → 0.0.26
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 +8 -8
- package/dist/extensions/index.d.ts +8 -8
- package/dist/extensions/index.js +429 -429
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/index.mjs +353 -353
- 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 +83 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +3 -3
package/dist/extensions/index.js
CHANGED
|
@@ -91,12 +91,12 @@ __export(extensions_exports, {
|
|
|
91
91
|
DEFAULT_SECTION_PADDING_TOP: () => DEFAULT_SECTION_PADDING_TOP,
|
|
92
92
|
DEFAULT_SECTION_SHOW_IF_KEY: () => DEFAULT_SECTION_SHOW_IF_KEY,
|
|
93
93
|
Footer: () => Footer,
|
|
94
|
-
ForExtension: () => ForExtension,
|
|
95
94
|
HorizontalRule: () => HorizontalRule,
|
|
96
95
|
ImageExtension: () => ImageExtension,
|
|
97
96
|
LinkExtension: () => LinkExtension,
|
|
98
97
|
LogoExtension: () => LogoExtension,
|
|
99
98
|
MailyKit: () => MailyKit,
|
|
99
|
+
RepeatExtension: () => RepeatExtension,
|
|
100
100
|
SectionExtension: () => SectionExtension,
|
|
101
101
|
SlashCommandExtension: () => SlashCommandExtension,
|
|
102
102
|
Spacer: () => Spacer,
|
|
@@ -1203,139 +1203,17 @@ var ColumnsExtension = import_core9.Node.create({
|
|
|
1203
1203
|
}
|
|
1204
1204
|
});
|
|
1205
1205
|
|
|
1206
|
-
// src/editor/nodes/for/for.ts
|
|
1207
|
-
var import_core10 = require("@tiptap/core");
|
|
1208
|
-
var import_react4 = require("@tiptap/react");
|
|
1209
|
-
|
|
1210
|
-
// src/editor/nodes/for/for-view.tsx
|
|
1211
|
-
var import_react3 = require("@tiptap/react");
|
|
1212
|
-
var import_lucide_react = require("lucide-react");
|
|
1213
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1214
|
-
function ForView(props) {
|
|
1215
|
-
const { editor, getPos } = props;
|
|
1216
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1217
|
-
import_react3.NodeViewWrapper,
|
|
1218
|
-
{
|
|
1219
|
-
draggable: editor.isEditable,
|
|
1220
|
-
"data-drag-handle": editor.isEditable,
|
|
1221
|
-
"data-type": "for",
|
|
1222
|
-
className: "mly-relative",
|
|
1223
|
-
children: [
|
|
1224
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react3.NodeViewContent, { className: "is-editable" }),
|
|
1225
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1226
|
-
"div",
|
|
1227
|
-
{
|
|
1228
|
-
role: "button",
|
|
1229
|
-
"data-repeat-indicator": "",
|
|
1230
|
-
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",
|
|
1231
|
-
contentEditable: false,
|
|
1232
|
-
onClick: () => {
|
|
1233
|
-
editor.commands.setNodeSelection(getPos());
|
|
1234
|
-
},
|
|
1235
|
-
children: [
|
|
1236
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
1237
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
1238
|
-
]
|
|
1239
|
-
}
|
|
1240
|
-
)
|
|
1241
|
-
]
|
|
1242
|
-
}
|
|
1243
|
-
);
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
// src/editor/nodes/for/for.ts
|
|
1247
|
-
var ForExtension = import_core10.Node.create({
|
|
1248
|
-
name: "for",
|
|
1249
|
-
group: "block",
|
|
1250
|
-
content: "(block|columns)+",
|
|
1251
|
-
draggable: true,
|
|
1252
|
-
isolating: true,
|
|
1253
|
-
addAttributes() {
|
|
1254
|
-
return {
|
|
1255
|
-
each: {
|
|
1256
|
-
default: "items",
|
|
1257
|
-
parseHTML: (element) => {
|
|
1258
|
-
return element.getAttribute("each") || "";
|
|
1259
|
-
},
|
|
1260
|
-
renderHTML: (attributes) => {
|
|
1261
|
-
if (!attributes.each) {
|
|
1262
|
-
return {};
|
|
1263
|
-
}
|
|
1264
|
-
return {
|
|
1265
|
-
each: attributes.each
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
},
|
|
1269
|
-
isUpdatingKey: {
|
|
1270
|
-
default: false
|
|
1271
|
-
},
|
|
1272
|
-
showIfKey: {
|
|
1273
|
-
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
1274
|
-
parseHTML: (element) => {
|
|
1275
|
-
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
1276
|
-
},
|
|
1277
|
-
renderHTML(attributes) {
|
|
1278
|
-
if (!attributes.showIfKey) {
|
|
1279
|
-
return {};
|
|
1280
|
-
}
|
|
1281
|
-
return {
|
|
1282
|
-
"data-show-if-key": attributes.showIfKey
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
};
|
|
1287
|
-
},
|
|
1288
|
-
parseHTML() {
|
|
1289
|
-
return [
|
|
1290
|
-
{
|
|
1291
|
-
tag: `div[data-type="${this.name}"]`
|
|
1292
|
-
}
|
|
1293
|
-
];
|
|
1294
|
-
},
|
|
1295
|
-
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
1296
|
-
return [
|
|
1297
|
-
"div",
|
|
1298
|
-
(0, import_core10.mergeAttributes)(HTMLAttributes2, {
|
|
1299
|
-
"data-type": this.name
|
|
1300
|
-
}),
|
|
1301
|
-
0
|
|
1302
|
-
];
|
|
1303
|
-
},
|
|
1304
|
-
addCommands() {
|
|
1305
|
-
return {
|
|
1306
|
-
setFor: () => ({ commands }) => {
|
|
1307
|
-
return commands.insertContent({
|
|
1308
|
-
type: this.name,
|
|
1309
|
-
attrs: {},
|
|
1310
|
-
content: [
|
|
1311
|
-
{
|
|
1312
|
-
type: "paragraph"
|
|
1313
|
-
}
|
|
1314
|
-
]
|
|
1315
|
-
});
|
|
1316
|
-
},
|
|
1317
|
-
updateFor: (attrs) => updateAttributes(this.name, attrs)
|
|
1318
|
-
};
|
|
1319
|
-
},
|
|
1320
|
-
addNodeView() {
|
|
1321
|
-
return (0, import_react4.ReactNodeViewRenderer)(ForView, {
|
|
1322
|
-
contentDOMElementTag: "div",
|
|
1323
|
-
className: "mly-relative"
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
});
|
|
1327
|
-
|
|
1328
1206
|
// src/editor/nodes/button/button.tsx
|
|
1329
|
-
var
|
|
1330
|
-
var
|
|
1207
|
+
var import_core10 = require("@tiptap/core");
|
|
1208
|
+
var import_react20 = require("@tiptap/react");
|
|
1331
1209
|
|
|
1332
1210
|
// src/editor/components/alignment-switch.tsx
|
|
1333
|
-
var
|
|
1211
|
+
var import_lucide_react = require("lucide-react");
|
|
1334
1212
|
|
|
1335
1213
|
// src/editor/components/base-button.tsx
|
|
1336
1214
|
var React4 = __toESM(require("react"));
|
|
1337
1215
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
1338
|
-
var
|
|
1216
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1339
1217
|
var BaseButton = React4.forwardRef(
|
|
1340
1218
|
(_a, ref) => {
|
|
1341
1219
|
var _b = _a, {
|
|
@@ -1372,7 +1250,7 @@ var BaseButton = React4.forwardRef(
|
|
|
1372
1250
|
sizeClasses[size],
|
|
1373
1251
|
className
|
|
1374
1252
|
);
|
|
1375
|
-
return /* @__PURE__ */ (0,
|
|
1253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Comp, __spreadValues({ className: classes, ref }, props));
|
|
1376
1254
|
}
|
|
1377
1255
|
);
|
|
1378
1256
|
BaseButton.displayName = "BaseButton";
|
|
@@ -1380,13 +1258,13 @@ BaseButton.displayName = "BaseButton";
|
|
|
1380
1258
|
// src/editor/components/ui/tooltip.tsx
|
|
1381
1259
|
var React5 = __toESM(require("react"));
|
|
1382
1260
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
1383
|
-
var
|
|
1261
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1384
1262
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1385
1263
|
var Tooltip = TooltipPrimitive.Root;
|
|
1386
1264
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1387
1265
|
var TooltipContent = React5.forwardRef((_a, ref) => {
|
|
1388
1266
|
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
|
1389
|
-
return /* @__PURE__ */ (0,
|
|
1267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1390
1268
|
TooltipPrimitive.Content,
|
|
1391
1269
|
__spreadValues({
|
|
1392
1270
|
ref,
|
|
@@ -1401,11 +1279,11 @@ var TooltipContent = React5.forwardRef((_a, ref) => {
|
|
|
1401
1279
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1402
1280
|
|
|
1403
1281
|
// src/editor/components/bubble-menu-button.tsx
|
|
1404
|
-
var
|
|
1282
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1405
1283
|
function BubbleMenuButton(item) {
|
|
1406
1284
|
var _a;
|
|
1407
1285
|
const { tooltip } = item;
|
|
1408
|
-
const content = /* @__PURE__ */ (0,
|
|
1286
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1409
1287
|
BaseButton,
|
|
1410
1288
|
__spreadProps(__spreadValues({
|
|
1411
1289
|
variant: "ghost",
|
|
@@ -1418,7 +1296,7 @@ function BubbleMenuButton(item) {
|
|
|
1418
1296
|
),
|
|
1419
1297
|
type: "button",
|
|
1420
1298
|
disabled: item.disbabled,
|
|
1421
|
-
children: item.icon ? /* @__PURE__ */ (0,
|
|
1299
|
+
children: item.icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1422
1300
|
item.icon,
|
|
1423
1301
|
{
|
|
1424
1302
|
className: cn(
|
|
@@ -1426,7 +1304,7 @@ function BubbleMenuButton(item) {
|
|
|
1426
1304
|
item == null ? void 0 : item.iconClassName
|
|
1427
1305
|
)
|
|
1428
1306
|
}
|
|
1429
|
-
) : /* @__PURE__ */ (0,
|
|
1307
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1430
1308
|
"span",
|
|
1431
1309
|
{
|
|
1432
1310
|
className: cn(
|
|
@@ -1439,42 +1317,42 @@ function BubbleMenuButton(item) {
|
|
|
1439
1317
|
})
|
|
1440
1318
|
);
|
|
1441
1319
|
if (tooltip) {
|
|
1442
|
-
return /* @__PURE__ */ (0,
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Tooltip, { children: [
|
|
1321
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTrigger, { asChild: true, children: content }),
|
|
1322
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
1445
1323
|
] });
|
|
1446
1324
|
}
|
|
1447
1325
|
return content;
|
|
1448
1326
|
}
|
|
1449
1327
|
|
|
1450
1328
|
// src/editor/components/alignment-switch.tsx
|
|
1451
|
-
var
|
|
1329
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1452
1330
|
function AlignmentSwitch(props) {
|
|
1453
1331
|
const { alignment = "left", onAlignmentChange } = props;
|
|
1454
1332
|
const activeAlignment = {
|
|
1455
1333
|
left: {
|
|
1456
|
-
icon:
|
|
1334
|
+
icon: import_lucide_react.AlignLeft,
|
|
1457
1335
|
tooltip: "Align Left",
|
|
1458
1336
|
onClick: () => {
|
|
1459
1337
|
onAlignmentChange("center");
|
|
1460
1338
|
}
|
|
1461
1339
|
},
|
|
1462
1340
|
center: {
|
|
1463
|
-
icon:
|
|
1341
|
+
icon: import_lucide_react.AlignCenter,
|
|
1464
1342
|
tooltip: "Align Center",
|
|
1465
1343
|
onClick: () => {
|
|
1466
1344
|
onAlignmentChange("right");
|
|
1467
1345
|
}
|
|
1468
1346
|
},
|
|
1469
1347
|
right: {
|
|
1470
|
-
icon:
|
|
1348
|
+
icon: import_lucide_react.AlignRight,
|
|
1471
1349
|
tooltip: "Align Right",
|
|
1472
1350
|
onClick: () => {
|
|
1473
1351
|
onAlignmentChange("left");
|
|
1474
1352
|
}
|
|
1475
1353
|
}
|
|
1476
1354
|
}[alignment];
|
|
1477
|
-
return /* @__PURE__ */ (0,
|
|
1355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1478
1356
|
BubbleMenuButton,
|
|
1479
1357
|
{
|
|
1480
1358
|
icon: activeAlignment.icon,
|
|
@@ -1486,7 +1364,7 @@ function AlignmentSwitch(props) {
|
|
|
1486
1364
|
|
|
1487
1365
|
// src/editor/components/ui/color-picker.tsx
|
|
1488
1366
|
var import_react_colorful = require("react-colorful");
|
|
1489
|
-
var
|
|
1367
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1490
1368
|
function ColorPicker(props) {
|
|
1491
1369
|
const {
|
|
1492
1370
|
color,
|
|
@@ -1504,14 +1382,14 @@ function ColorPicker(props) {
|
|
|
1504
1382
|
onColorChange(color2);
|
|
1505
1383
|
});
|
|
1506
1384
|
};
|
|
1507
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
1385
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverTrigger, { asChild: true, children: children || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1508
1386
|
BaseButton,
|
|
1509
1387
|
{
|
|
1510
1388
|
variant: "ghost",
|
|
1511
1389
|
className: "!mly-size-7 mly-shrink-0",
|
|
1512
1390
|
size: "sm",
|
|
1513
1391
|
type: "button",
|
|
1514
|
-
children: /* @__PURE__ */ (0,
|
|
1392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1515
1393
|
"div",
|
|
1516
1394
|
{
|
|
1517
1395
|
className: cn(
|
|
@@ -1525,7 +1403,7 @@ function ColorPicker(props) {
|
|
|
1525
1403
|
)
|
|
1526
1404
|
}
|
|
1527
1405
|
) });
|
|
1528
|
-
return /* @__PURE__ */ (0,
|
|
1406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1529
1407
|
Popover,
|
|
1530
1408
|
{
|
|
1531
1409
|
onOpenChange: (open) => {
|
|
@@ -1534,17 +1412,17 @@ function ColorPicker(props) {
|
|
|
1534
1412
|
}
|
|
1535
1413
|
},
|
|
1536
1414
|
children: [
|
|
1537
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
1538
|
-
/* @__PURE__ */ (0,
|
|
1539
|
-
/* @__PURE__ */ (0,
|
|
1415
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Tooltip, { children: [
|
|
1416
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
1540
1418
|
] }) : popoverButton,
|
|
1541
|
-
/* @__PURE__ */ (0,
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1542
1420
|
PopoverContent,
|
|
1543
1421
|
{
|
|
1544
1422
|
className: "mly-w-full mly-rounded-none mly-border-0 !mly-bg-transparent !mly-p-0 mly-shadow-none mly-drop-shadow-md",
|
|
1545
1423
|
sideOffset: 8,
|
|
1546
|
-
children: /* @__PURE__ */ (0,
|
|
1547
|
-
/* @__PURE__ */ (0,
|
|
1424
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mly-min-w-[260px] mly-rounded-xl mly-border mly-bg-white mly-p-4", children: [
|
|
1425
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1548
1426
|
import_react_colorful.HexColorPicker,
|
|
1549
1427
|
{
|
|
1550
1428
|
color,
|
|
@@ -1552,7 +1430,7 @@ function ColorPicker(props) {
|
|
|
1552
1430
|
className: "mly-flex !mly-w-full mly-flex-col mly-gap-4"
|
|
1553
1431
|
}
|
|
1554
1432
|
),
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1556
1434
|
import_react_colorful.HexColorInput,
|
|
1557
1435
|
{
|
|
1558
1436
|
alpha: true,
|
|
@@ -1562,10 +1440,10 @@ function ColorPicker(props) {
|
|
|
1562
1440
|
prefixed: true
|
|
1563
1441
|
}
|
|
1564
1442
|
),
|
|
1565
|
-
suggestedColors.length > 0 && /* @__PURE__ */ (0,
|
|
1566
|
-
/* @__PURE__ */ (0,
|
|
1567
|
-
/* @__PURE__ */ (0,
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1443
|
+
suggestedColors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "-mly-mx-4 mly-my-4 mly-h-px mly-bg-gray-200" }),
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "mly-text-xs mly-text-gray-500", children: "Recently used" }),
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mly-mt-2 mly-flex mly-flex-wrap mly-gap-0.5", children: suggestedColors.map((suggestedColor) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1569
1447
|
BaseButton,
|
|
1570
1448
|
{
|
|
1571
1449
|
variant: "ghost",
|
|
@@ -1573,7 +1451,7 @@ function ColorPicker(props) {
|
|
|
1573
1451
|
className: "!mly-size-7 mly-shrink-0",
|
|
1574
1452
|
type: "button",
|
|
1575
1453
|
onClick: () => handleColorChange(suggestedColor),
|
|
1576
|
-
children: /* @__PURE__ */ (0,
|
|
1454
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1577
1455
|
"div",
|
|
1578
1456
|
{
|
|
1579
1457
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded",
|
|
@@ -1595,10 +1473,10 @@ function ColorPicker(props) {
|
|
|
1595
1473
|
}
|
|
1596
1474
|
|
|
1597
1475
|
// src/editor/components/ui/divider.tsx
|
|
1598
|
-
var
|
|
1476
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1599
1477
|
function Divider(props) {
|
|
1600
1478
|
const { type = "vertical", className } = props;
|
|
1601
|
-
return /* @__PURE__ */ (0,
|
|
1479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1602
1480
|
"div",
|
|
1603
1481
|
{
|
|
1604
1482
|
className: cn(
|
|
@@ -1611,20 +1489,20 @@ function Divider(props) {
|
|
|
1611
1489
|
}
|
|
1612
1490
|
|
|
1613
1491
|
// src/editor/components/ui/link-input-popover.tsx
|
|
1614
|
-
var
|
|
1615
|
-
var
|
|
1492
|
+
var import_lucide_react10 = require("lucide-react");
|
|
1493
|
+
var import_react9 = require("react");
|
|
1616
1494
|
|
|
1617
1495
|
// src/editor/provider.tsx
|
|
1618
|
-
var
|
|
1496
|
+
var import_react4 = require("react");
|
|
1619
1497
|
|
|
1620
1498
|
// src/blocks/button.tsx
|
|
1621
|
-
var
|
|
1622
|
-
var
|
|
1499
|
+
var import_lucide_react2 = require("lucide-react");
|
|
1500
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1623
1501
|
var button = {
|
|
1624
1502
|
title: "Button",
|
|
1625
1503
|
description: "Add a call to action button to email.",
|
|
1626
1504
|
searchTerms: ["link", "button", "cta"],
|
|
1627
|
-
icon: /* @__PURE__ */ (0,
|
|
1505
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.MousePointer, { className: "mly-h-4 mly-w-4" }),
|
|
1628
1506
|
command: ({ editor, range }) => {
|
|
1629
1507
|
editor.chain().focus().deleteRange(range).setButton().run();
|
|
1630
1508
|
}
|
|
@@ -1633,7 +1511,7 @@ var linkCard = {
|
|
|
1633
1511
|
title: "Link Card",
|
|
1634
1512
|
description: "Add a link card to email.",
|
|
1635
1513
|
searchTerms: ["link", "button", "image"],
|
|
1636
|
-
icon: /* @__PURE__ */ (0,
|
|
1514
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react2.ArrowUpRightSquare, { className: "mly-h-4 mly-w-4" }),
|
|
1637
1515
|
command: ({ editor, range }) => {
|
|
1638
1516
|
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
1639
1517
|
},
|
|
@@ -1645,13 +1523,13 @@ var linkCard = {
|
|
|
1645
1523
|
};
|
|
1646
1524
|
|
|
1647
1525
|
// src/blocks/image.tsx
|
|
1648
|
-
var
|
|
1649
|
-
var
|
|
1526
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1527
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1650
1528
|
var image = {
|
|
1651
1529
|
title: "Image",
|
|
1652
1530
|
description: "Full width image",
|
|
1653
1531
|
searchTerms: ["image"],
|
|
1654
|
-
icon: /* @__PURE__ */ (0,
|
|
1532
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1655
1533
|
command: ({ editor, range }) => {
|
|
1656
1534
|
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
1657
1535
|
}
|
|
@@ -1660,20 +1538,20 @@ var logo = {
|
|
|
1660
1538
|
title: "Logo",
|
|
1661
1539
|
description: "Add your brand logo",
|
|
1662
1540
|
searchTerms: ["image", "logo"],
|
|
1663
|
-
icon: /* @__PURE__ */ (0,
|
|
1541
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1664
1542
|
command: ({ editor, range }) => {
|
|
1665
1543
|
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
1666
1544
|
}
|
|
1667
1545
|
};
|
|
1668
1546
|
|
|
1669
1547
|
// src/blocks/layout.tsx
|
|
1670
|
-
var
|
|
1671
|
-
var
|
|
1548
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1549
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1672
1550
|
var columns = {
|
|
1673
1551
|
title: "Columns",
|
|
1674
1552
|
description: "Add columns to email.",
|
|
1675
1553
|
searchTerms: ["layout", "columns"],
|
|
1676
|
-
icon: /* @__PURE__ */ (0,
|
|
1554
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.ColumnsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1677
1555
|
shouldBeHidden: (editor) => {
|
|
1678
1556
|
return editor.isActive("columns");
|
|
1679
1557
|
},
|
|
@@ -1685,28 +1563,28 @@ var section = {
|
|
|
1685
1563
|
title: "Section",
|
|
1686
1564
|
description: "Add a section to email.",
|
|
1687
1565
|
searchTerms: ["layout", "section"],
|
|
1688
|
-
icon: /* @__PURE__ */ (0,
|
|
1566
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.RectangleHorizontal, { className: "mly-h-4 mly-w-4" }),
|
|
1689
1567
|
command: ({ editor, range }) => {
|
|
1690
1568
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
1691
1569
|
}
|
|
1692
1570
|
};
|
|
1693
|
-
var
|
|
1694
|
-
title: "
|
|
1571
|
+
var repeat = {
|
|
1572
|
+
title: "Repeat",
|
|
1695
1573
|
description: "Loop over an array of items.",
|
|
1696
|
-
searchTerms: ["for", "loop"],
|
|
1697
|
-
icon: /* @__PURE__ */ (0,
|
|
1574
|
+
searchTerms: ["repeat", "for", "loop"],
|
|
1575
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
1698
1576
|
shouldBeHidden: (editor) => {
|
|
1699
|
-
return editor.isActive("
|
|
1577
|
+
return editor.isActive("repeat");
|
|
1700
1578
|
},
|
|
1701
1579
|
command: ({ editor, range }) => {
|
|
1702
|
-
editor.chain().focus().deleteRange(range).
|
|
1580
|
+
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
1703
1581
|
}
|
|
1704
1582
|
};
|
|
1705
1583
|
var spacer = {
|
|
1706
1584
|
title: "Spacer",
|
|
1707
1585
|
description: "Add space between blocks.",
|
|
1708
1586
|
searchTerms: ["space", "gap", "divider"],
|
|
1709
|
-
icon: /* @__PURE__ */ (0,
|
|
1587
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.MoveVertical, { className: "mly-h-4 mly-w-4" }),
|
|
1710
1588
|
command: ({ editor, range }) => {
|
|
1711
1589
|
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
1712
1590
|
}
|
|
@@ -1715,20 +1593,20 @@ var divider = {
|
|
|
1715
1593
|
title: "Divider",
|
|
1716
1594
|
description: "Add a horizontal divider.",
|
|
1717
1595
|
searchTerms: ["divider", "line"],
|
|
1718
|
-
icon: /* @__PURE__ */ (0,
|
|
1596
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Minus, { className: "mly-h-4 mly-w-4" }),
|
|
1719
1597
|
command: ({ editor, range }) => {
|
|
1720
1598
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
1721
1599
|
}
|
|
1722
1600
|
};
|
|
1723
1601
|
|
|
1724
1602
|
// src/blocks/list.tsx
|
|
1725
|
-
var
|
|
1726
|
-
var
|
|
1603
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1604
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1727
1605
|
var bulletList = {
|
|
1728
1606
|
title: "Bullet List",
|
|
1729
1607
|
description: "Create a simple bullet list.",
|
|
1730
1608
|
searchTerms: ["unordered", "point"],
|
|
1731
|
-
icon: /* @__PURE__ */ (0,
|
|
1609
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.List, { className: "mly-h-4 mly-w-4" }),
|
|
1732
1610
|
command: ({ editor, range }) => {
|
|
1733
1611
|
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
1734
1612
|
}
|
|
@@ -1737,20 +1615,20 @@ var orderedList = {
|
|
|
1737
1615
|
title: "Numbered List",
|
|
1738
1616
|
description: "Create a list with numbering.",
|
|
1739
1617
|
searchTerms: ["ordered"],
|
|
1740
|
-
icon: /* @__PURE__ */ (0,
|
|
1618
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.ListOrdered, { className: "mly-h-4 mly-w-4" }),
|
|
1741
1619
|
command: ({ editor, range }) => {
|
|
1742
1620
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
1743
1621
|
}
|
|
1744
1622
|
};
|
|
1745
1623
|
|
|
1746
1624
|
// src/blocks/typography.tsx
|
|
1747
|
-
var
|
|
1748
|
-
var
|
|
1625
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1626
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1749
1627
|
var text = {
|
|
1750
1628
|
title: "Text",
|
|
1751
1629
|
description: "Just start typing with plain text.",
|
|
1752
1630
|
searchTerms: ["p", "paragraph"],
|
|
1753
|
-
icon: /* @__PURE__ */ (0,
|
|
1631
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.Text, { className: "mly-h-4 mly-w-4" }),
|
|
1754
1632
|
command: ({ editor, range }) => {
|
|
1755
1633
|
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
1756
1634
|
}
|
|
@@ -1759,7 +1637,7 @@ var heading1 = {
|
|
|
1759
1637
|
title: "Heading 1",
|
|
1760
1638
|
description: "Big heading.",
|
|
1761
1639
|
searchTerms: ["title", "big", "large"],
|
|
1762
|
-
icon: /* @__PURE__ */ (0,
|
|
1640
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
1763
1641
|
command: ({ editor, range }) => {
|
|
1764
1642
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
1765
1643
|
}
|
|
@@ -1768,7 +1646,7 @@ var heading2 = {
|
|
|
1768
1646
|
title: "Heading 2",
|
|
1769
1647
|
description: "Medium heading.",
|
|
1770
1648
|
searchTerms: ["subtitle", "medium"],
|
|
1771
|
-
icon: /* @__PURE__ */ (0,
|
|
1649
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.Heading2, { className: "mly-h-4 mly-w-4" }),
|
|
1772
1650
|
command: ({ editor, range }) => {
|
|
1773
1651
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
1774
1652
|
}
|
|
@@ -1777,7 +1655,7 @@ var heading3 = {
|
|
|
1777
1655
|
title: "Heading 3",
|
|
1778
1656
|
description: "Small heading.",
|
|
1779
1657
|
searchTerms: ["subtitle", "small"],
|
|
1780
|
-
icon: /* @__PURE__ */ (0,
|
|
1658
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.Heading3, { className: "mly-h-4 mly-w-4" }),
|
|
1781
1659
|
command: ({ editor, range }) => {
|
|
1782
1660
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
1783
1661
|
}
|
|
@@ -1786,7 +1664,7 @@ var hardBreak = {
|
|
|
1786
1664
|
title: "Hard Break",
|
|
1787
1665
|
description: "Add a break between lines.",
|
|
1788
1666
|
searchTerms: ["break", "line"],
|
|
1789
|
-
icon: /* @__PURE__ */ (0,
|
|
1667
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.DivideIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1790
1668
|
command: ({ editor, range }) => {
|
|
1791
1669
|
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
1792
1670
|
}
|
|
@@ -1795,7 +1673,7 @@ var blockquote = {
|
|
|
1795
1673
|
title: "Blockquote",
|
|
1796
1674
|
description: "Add blockquote.",
|
|
1797
1675
|
searchTerms: ["quote", "blockquote"],
|
|
1798
|
-
icon: /* @__PURE__ */ (0,
|
|
1676
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.TextQuote, { className: "mly-h-4 mly-w-4" }),
|
|
1799
1677
|
command: ({ editor, range }) => {
|
|
1800
1678
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
1801
1679
|
}
|
|
@@ -1804,7 +1682,7 @@ var footer = {
|
|
|
1804
1682
|
title: "Footer",
|
|
1805
1683
|
description: "Add a footer text to email.",
|
|
1806
1684
|
searchTerms: ["footer", "text"],
|
|
1807
|
-
icon: /* @__PURE__ */ (0,
|
|
1685
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1808
1686
|
command: ({ editor, range }) => {
|
|
1809
1687
|
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
1810
1688
|
}
|
|
@@ -1813,7 +1691,7 @@ var clearLine = {
|
|
|
1813
1691
|
title: "Clear Line",
|
|
1814
1692
|
description: "Clear the current line.",
|
|
1815
1693
|
searchTerms: ["clear", "line"],
|
|
1816
|
-
icon: /* @__PURE__ */ (0,
|
|
1694
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.EraserIcon, { className: "mly-h-4 mly-w-4" }),
|
|
1817
1695
|
command: ({ editor, range }) => {
|
|
1818
1696
|
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
1819
1697
|
}
|
|
@@ -1831,7 +1709,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
1831
1709
|
logo,
|
|
1832
1710
|
columns,
|
|
1833
1711
|
section,
|
|
1834
|
-
|
|
1712
|
+
repeat,
|
|
1835
1713
|
divider,
|
|
1836
1714
|
spacer,
|
|
1837
1715
|
button,
|
|
@@ -1843,20 +1721,20 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
1843
1721
|
];
|
|
1844
1722
|
|
|
1845
1723
|
// src/editor/nodes/variable/variable-view.tsx
|
|
1846
|
-
var
|
|
1847
|
-
var
|
|
1848
|
-
var
|
|
1724
|
+
var import_react3 = require("@tiptap/react");
|
|
1725
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1726
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1849
1727
|
function VariableView(props) {
|
|
1850
1728
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
1851
1729
|
const { id, fallback, required } = node.attrs;
|
|
1852
1730
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
1853
|
-
return /* @__PURE__ */ (0,
|
|
1854
|
-
|
|
1731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1732
|
+
import_react3.NodeViewWrapper,
|
|
1855
1733
|
{
|
|
1856
1734
|
className: "react-component mly-inline-block mly-leading-none",
|
|
1857
1735
|
draggable: "false",
|
|
1858
|
-
children: /* @__PURE__ */ (0,
|
|
1859
|
-
/* @__PURE__ */ (0,
|
|
1736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Popover, { children: [
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1860
1738
|
PopoverTrigger,
|
|
1861
1739
|
{
|
|
1862
1740
|
onClick: (e) => {
|
|
@@ -1873,7 +1751,7 @@ function VariableView(props) {
|
|
|
1873
1751
|
})
|
|
1874
1752
|
}
|
|
1875
1753
|
),
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1754
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1877
1755
|
PopoverContent,
|
|
1878
1756
|
{
|
|
1879
1757
|
align: "start",
|
|
@@ -1882,10 +1760,10 @@ function VariableView(props) {
|
|
|
1882
1760
|
sideOffset: 8,
|
|
1883
1761
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
1884
1762
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1885
|
-
children: /* @__PURE__ */ (0,
|
|
1886
|
-
/* @__PURE__ */ (0,
|
|
1887
|
-
/* @__PURE__ */ (0,
|
|
1888
|
-
/* @__PURE__ */ (0,
|
|
1763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
1764
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "mly-relative", children: [
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mly-inline-block mly-px-2 mly-text-xs mly-text-midnight-gray", children: "Variable" }),
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1889
1767
|
"input",
|
|
1890
1768
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
1891
1769
|
value: id != null ? id : "",
|
|
@@ -1899,10 +1777,10 @@ function VariableView(props) {
|
|
|
1899
1777
|
})
|
|
1900
1778
|
)
|
|
1901
1779
|
] }),
|
|
1902
|
-
/* @__PURE__ */ (0,
|
|
1903
|
-
/* @__PURE__ */ (0,
|
|
1904
|
-
/* @__PURE__ */ (0,
|
|
1905
|
-
/* @__PURE__ */ (0,
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Divider, { className: "mly-mx-1.5" }),
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "mly-relative", children: [
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1906
1784
|
"input",
|
|
1907
1785
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
1908
1786
|
value: fallback != null ? fallback : "",
|
|
@@ -1915,7 +1793,7 @@ function VariableView(props) {
|
|
|
1915
1793
|
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"
|
|
1916
1794
|
})
|
|
1917
1795
|
),
|
|
1918
|
-
/* @__PURE__ */ (0,
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
1919
1797
|
] })
|
|
1920
1798
|
] }) })
|
|
1921
1799
|
}
|
|
@@ -1928,13 +1806,13 @@ var DefaultRenderVariable = (props) => {
|
|
|
1928
1806
|
const { variable, fallback, from } = props;
|
|
1929
1807
|
const { name, required, valid } = variable;
|
|
1930
1808
|
if (from === "button-variable") {
|
|
1931
|
-
return /* @__PURE__ */ (0,
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
1933
|
-
/* @__PURE__ */ (0,
|
|
1809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.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: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1934
1812
|
] });
|
|
1935
1813
|
}
|
|
1936
1814
|
if (from === "bubble-variable") {
|
|
1937
|
-
return /* @__PURE__ */ (0,
|
|
1815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1938
1816
|
"div",
|
|
1939
1817
|
{
|
|
1940
1818
|
className: cn(
|
|
@@ -1942,33 +1820,33 @@ var DefaultRenderVariable = (props) => {
|
|
|
1942
1820
|
!valid && "mly-border-rose-400 mly-bg-rose-50 mly-text-rose-600 hover:mly-bg-rose-100"
|
|
1943
1821
|
),
|
|
1944
1822
|
children: [
|
|
1945
|
-
/* @__PURE__ */ (0,
|
|
1946
|
-
/* @__PURE__ */ (0,
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
1947
1825
|
]
|
|
1948
1826
|
}
|
|
1949
1827
|
);
|
|
1950
1828
|
}
|
|
1951
|
-
return /* @__PURE__ */ (0,
|
|
1829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1952
1830
|
"span",
|
|
1953
1831
|
{
|
|
1954
1832
|
tabIndex: -1,
|
|
1955
1833
|
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",
|
|
1956
1834
|
children: [
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.Braces, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
1958
1836
|
name,
|
|
1959
|
-
required && !fallback && /* @__PURE__ */ (0,
|
|
1837
|
+
required && !fallback && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.AlertTriangle, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5]" })
|
|
1960
1838
|
]
|
|
1961
1839
|
}
|
|
1962
1840
|
);
|
|
1963
1841
|
};
|
|
1964
1842
|
|
|
1965
1843
|
// src/editor/provider.tsx
|
|
1966
|
-
var
|
|
1844
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1967
1845
|
var DEFAULT_PLACEHOLDER_URL = "maily.to/";
|
|
1968
1846
|
var DEFAULT_VARIABLE_TRIGGER_CHAR = "@";
|
|
1969
1847
|
var DEFAULT_VARIABLES = [];
|
|
1970
1848
|
var DEFAULT_RENDER_VARIABLE_FUNCTION = DefaultRenderVariable;
|
|
1971
|
-
var MailyContext = (0,
|
|
1849
|
+
var MailyContext = (0, import_react4.createContext)({
|
|
1972
1850
|
placeholderUrl: DEFAULT_PLACEHOLDER_URL,
|
|
1973
1851
|
variableTriggerCharacter: DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
1974
1852
|
variables: DEFAULT_VARIABLES,
|
|
@@ -1976,7 +1854,7 @@ var MailyContext = (0, import_react6.createContext)({
|
|
|
1976
1854
|
renderVariable: DEFAULT_RENDER_VARIABLE_FUNCTION
|
|
1977
1855
|
});
|
|
1978
1856
|
function useMailyContext() {
|
|
1979
|
-
const values = (0,
|
|
1857
|
+
const values = (0, import_react4.useContext)(MailyContext);
|
|
1980
1858
|
if (!values) {
|
|
1981
1859
|
throw new Error("Missing MailyContext.Provider in the component tree");
|
|
1982
1860
|
}
|
|
@@ -1984,14 +1862,14 @@ function useMailyContext() {
|
|
|
1984
1862
|
}
|
|
1985
1863
|
|
|
1986
1864
|
// src/editor/nodes/variable/variable-popover.tsx
|
|
1987
|
-
var
|
|
1988
|
-
var
|
|
1989
|
-
var
|
|
1990
|
-
var VariablePopover = (0,
|
|
1865
|
+
var import_lucide_react8 = require("lucide-react");
|
|
1866
|
+
var import_react5 = require("react");
|
|
1867
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1868
|
+
var VariablePopover = (0, import_react5.forwardRef)((props, ref) => {
|
|
1991
1869
|
const { items, onSelectItem } = props;
|
|
1992
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
1993
|
-
const scrollContainerRef = (0,
|
|
1994
|
-
const itemRefs = (0,
|
|
1870
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react5.useState)(0);
|
|
1871
|
+
const scrollContainerRef = (0, import_react5.useRef)(null);
|
|
1872
|
+
const itemRefs = (0, import_react5.useRef)([]);
|
|
1995
1873
|
const scrollSelectedIntoView = (index) => {
|
|
1996
1874
|
const container = scrollContainerRef.current;
|
|
1997
1875
|
const selectedItem = itemRefs.current[index];
|
|
@@ -2007,17 +1885,17 @@ var VariablePopover = (0, import_react7.forwardRef)((props, ref) => {
|
|
|
2007
1885
|
container.scrollTop += itemRect.top - containerRect.top - padding;
|
|
2008
1886
|
}
|
|
2009
1887
|
};
|
|
2010
|
-
(0,
|
|
1888
|
+
(0, import_react5.useEffect)(() => {
|
|
2011
1889
|
setSelectedIndex(0);
|
|
2012
1890
|
if (scrollContainerRef.current) {
|
|
2013
1891
|
scrollContainerRef.current.scrollTop = 0;
|
|
2014
1892
|
}
|
|
2015
1893
|
itemRefs.current = items.map(() => null);
|
|
2016
1894
|
}, [items]);
|
|
2017
|
-
(0,
|
|
1895
|
+
(0, import_react5.useEffect)(() => {
|
|
2018
1896
|
scrollSelectedIntoView(selectedIndex);
|
|
2019
1897
|
}, [selectedIndex]);
|
|
2020
|
-
(0,
|
|
1898
|
+
(0, import_react5.useImperativeHandle)(ref, () => ({
|
|
2021
1899
|
moveUp: () => {
|
|
2022
1900
|
setSelectedIndex((selectedIndex + items.length - 1) % items.length);
|
|
2023
1901
|
},
|
|
@@ -2032,17 +1910,17 @@ var VariablePopover = (0, import_react7.forwardRef)((props, ref) => {
|
|
|
2032
1910
|
onSelectItem(item);
|
|
2033
1911
|
}
|
|
2034
1912
|
}));
|
|
2035
|
-
return /* @__PURE__ */ (0,
|
|
2036
|
-
/* @__PURE__ */ (0,
|
|
2037
|
-
/* @__PURE__ */ (0,
|
|
2038
|
-
/* @__PURE__ */ (0,
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.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: [
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.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: [
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "mly-text-xs mly-uppercase", children: "Variables" }),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Braces, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
2039
1917
|
] }),
|
|
2040
|
-
/* @__PURE__ */ (0,
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2041
1919
|
"div",
|
|
2042
1920
|
{
|
|
2043
1921
|
ref: scrollContainerRef,
|
|
2044
1922
|
className: "mly-max-h-52 mly-overflow-y-auto mly-scrollbar-thin mly-scrollbar-track-transparent mly-scrollbar-thumb-gray-200",
|
|
2045
|
-
children: /* @__PURE__ */ (0,
|
|
1923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.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_runtime18.jsxs)(
|
|
2046
1924
|
"button",
|
|
2047
1925
|
{
|
|
2048
1926
|
ref: (el) => itemRefs.current[index] = el,
|
|
@@ -2052,27 +1930,27 @@ var VariablePopover = (0, import_react7.forwardRef)((props, ref) => {
|
|
|
2052
1930
|
index === selectedIndex ? "mly-bg-soft-gray" : "mly-bg-white"
|
|
2053
1931
|
),
|
|
2054
1932
|
children: [
|
|
2055
|
-
/* @__PURE__ */ (0,
|
|
1933
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Braces, { className: "mly-size-3 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
2056
1934
|
item.name
|
|
2057
1935
|
]
|
|
2058
1936
|
},
|
|
2059
1937
|
index
|
|
2060
|
-
)) : /* @__PURE__ */ (0,
|
|
1938
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime18.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" }) })
|
|
2061
1939
|
}
|
|
2062
1940
|
),
|
|
2063
|
-
/* @__PURE__ */ (0,
|
|
2064
|
-
/* @__PURE__ */ (0,
|
|
2065
|
-
/* @__PURE__ */ (0,
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.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: [
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1", children: [
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ArrowDownIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ArrowUpIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "mly-text-xs mly-text-gray-500", children: "Navigate" })
|
|
2068
1946
|
] }),
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
1947
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.CornerDownLeftIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
2070
1948
|
] })
|
|
2071
1949
|
] });
|
|
2072
1950
|
});
|
|
2073
1951
|
function VariableIcon(props) {
|
|
2074
1952
|
const { className, children } = props;
|
|
2075
|
-
return /* @__PURE__ */ (0,
|
|
1953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2076
1954
|
"div",
|
|
2077
1955
|
{
|
|
2078
1956
|
className: cn(
|
|
@@ -2085,10 +1963,10 @@ function VariableIcon(props) {
|
|
|
2085
1963
|
}
|
|
2086
1964
|
|
|
2087
1965
|
// src/editor/utils/use-outside-click.ts
|
|
2088
|
-
var
|
|
2089
|
-
var
|
|
1966
|
+
var import_react6 = require("react");
|
|
1967
|
+
var import_react7 = require("react");
|
|
2090
1968
|
function useOutsideClick(ref, callback) {
|
|
2091
|
-
const handleClick = (0,
|
|
1969
|
+
const handleClick = (0, import_react6.useCallback)(
|
|
2092
1970
|
(e) => {
|
|
2093
1971
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
2094
1972
|
callback();
|
|
@@ -2096,7 +1974,7 @@ function useOutsideClick(ref, callback) {
|
|
|
2096
1974
|
},
|
|
2097
1975
|
[ref, callback]
|
|
2098
1976
|
);
|
|
2099
|
-
(0,
|
|
1977
|
+
(0, import_react7.useEffect)(() => {
|
|
2100
1978
|
document.addEventListener("mousedown", handleClick);
|
|
2101
1979
|
document.addEventListener("touchstart", handleClick);
|
|
2102
1980
|
return () => {
|
|
@@ -2107,10 +1985,10 @@ function useOutsideClick(ref, callback) {
|
|
|
2107
1985
|
}
|
|
2108
1986
|
|
|
2109
1987
|
// src/editor/components/ui/input-autocomplete.tsx
|
|
2110
|
-
var
|
|
2111
|
-
var
|
|
2112
|
-
var
|
|
2113
|
-
var InputAutocomplete = (0,
|
|
1988
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1989
|
+
var import_react8 = require("react");
|
|
1990
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1991
|
+
var InputAutocomplete = (0, import_react8.forwardRef)((props, ref) => {
|
|
2114
1992
|
const _a = props, {
|
|
2115
1993
|
value = "",
|
|
2116
1994
|
onValueChange,
|
|
@@ -2128,15 +2006,15 @@ var InputAutocomplete = (0, import_react10.forwardRef)((props, ref) => {
|
|
|
2128
2006
|
"autoCompleteOptions",
|
|
2129
2007
|
"triggerChar"
|
|
2130
2008
|
]);
|
|
2131
|
-
const containerRef = (0,
|
|
2132
|
-
const popoverRef = (0,
|
|
2009
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
2010
|
+
const popoverRef = (0, import_react8.useRef)(null);
|
|
2133
2011
|
useOutsideClick(containerRef, () => {
|
|
2134
2012
|
onOutsideClick == null ? void 0 : onOutsideClick();
|
|
2135
2013
|
});
|
|
2136
2014
|
const isTriggeringVariable = value.startsWith(triggerChar);
|
|
2137
|
-
return /* @__PURE__ */ (0,
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
2015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cn("mly-relative"), ref: containerRef, children: [
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "mly-relative", children: [
|
|
2017
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2140
2018
|
"input",
|
|
2141
2019
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2142
2020
|
placeholder: "e.g. items",
|
|
@@ -2170,9 +2048,9 @@ var InputAutocomplete = (0, import_react10.forwardRef)((props, ref) => {
|
|
|
2170
2048
|
spellCheck: false
|
|
2171
2049
|
})
|
|
2172
2050
|
),
|
|
2173
|
-
/* @__PURE__ */ (0,
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.CornerDownLeft, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
2174
2052
|
] }),
|
|
2175
|
-
isTriggeringVariable && /* @__PURE__ */ (0,
|
|
2053
|
+
isTriggeringVariable && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mly-absolute mly-left-0 mly-top-8", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2176
2054
|
VariablePopover,
|
|
2177
2055
|
{
|
|
2178
2056
|
items: autoCompleteOptions.map((option) => {
|
|
@@ -2213,8 +2091,8 @@ You can check out the documentation for more information: https://github.com/ari
|
|
|
2213
2091
|
}
|
|
2214
2092
|
|
|
2215
2093
|
// src/editor/components/ui/link-input-popover.tsx
|
|
2216
|
-
var
|
|
2217
|
-
var
|
|
2094
|
+
var import_react10 = require("react");
|
|
2095
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2218
2096
|
var LINK_PROTOCOL_REGEX = /https?:\/\//;
|
|
2219
2097
|
function LinkInputPopover(props) {
|
|
2220
2098
|
var _a;
|
|
@@ -2222,7 +2100,7 @@ function LinkInputPopover(props) {
|
|
|
2222
2100
|
defaultValue = "",
|
|
2223
2101
|
onValueChange,
|
|
2224
2102
|
tooltip,
|
|
2225
|
-
icon: Icon =
|
|
2103
|
+
icon: Icon = import_lucide_react10.Link,
|
|
2226
2104
|
editor,
|
|
2227
2105
|
isVariable
|
|
2228
2106
|
} = props;
|
|
@@ -2231,17 +2109,17 @@ function LinkInputPopover(props) {
|
|
|
2231
2109
|
LINK_PROTOCOL_REGEX,
|
|
2232
2110
|
""
|
|
2233
2111
|
);
|
|
2234
|
-
const [isOpen, setIsOpen] = (0,
|
|
2235
|
-
const [protocol, setProtocol] = (0,
|
|
2236
|
-
const [isEditing, setIsEditing] = (0,
|
|
2237
|
-
const linkInputRef = (0,
|
|
2112
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
2113
|
+
const [protocol, setProtocol] = (0, import_react9.useState)(defaultProtocol || "https://");
|
|
2114
|
+
const [isEditing, setIsEditing] = (0, import_react9.useState)(!isVariable);
|
|
2115
|
+
const linkInputRef = (0, import_react9.useRef)(null);
|
|
2238
2116
|
const {
|
|
2239
2117
|
variables = [],
|
|
2240
2118
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
2241
2119
|
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
2242
2120
|
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
2243
2121
|
} = useMailyContext();
|
|
2244
|
-
const autoCompleteOptions = (0,
|
|
2122
|
+
const autoCompleteOptions = (0, import_react10.useMemo)(() => {
|
|
2245
2123
|
const withoutTrigger = defaultUrlWithoutProtocol.replace(
|
|
2246
2124
|
new RegExp(variableTriggerCharacter, "g"),
|
|
2247
2125
|
""
|
|
@@ -2252,7 +2130,7 @@ function LinkInputPopover(props) {
|
|
|
2252
2130
|
editor
|
|
2253
2131
|
}).map((variable) => variable.name);
|
|
2254
2132
|
}, [variables, defaultUrlWithoutProtocol, editor]);
|
|
2255
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
2133
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2256
2134
|
BaseButton,
|
|
2257
2135
|
{
|
|
2258
2136
|
variant: "ghost",
|
|
@@ -2260,19 +2138,19 @@ function LinkInputPopover(props) {
|
|
|
2260
2138
|
type: "button",
|
|
2261
2139
|
className: "mly-size-7",
|
|
2262
2140
|
"data-state": !!defaultUrlWithoutProtocol,
|
|
2263
|
-
children: /* @__PURE__ */ (0,
|
|
2141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-midnight-gray" })
|
|
2264
2142
|
}
|
|
2265
2143
|
) });
|
|
2266
2144
|
const normalizeProtocol = (value, p = protocol) => {
|
|
2267
2145
|
value = value == null ? void 0 : value.replace(LINK_PROTOCOL_REGEX, "");
|
|
2268
2146
|
return p + value;
|
|
2269
2147
|
};
|
|
2270
|
-
return /* @__PURE__ */ (0,
|
|
2271
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
2272
|
-
/* @__PURE__ */ (0,
|
|
2273
|
-
/* @__PURE__ */ (0,
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2149
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Tooltip, { children: [
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2274
2152
|
] }) : popoverButton,
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2276
2154
|
PopoverContent,
|
|
2277
2155
|
{
|
|
2278
2156
|
align: "end",
|
|
@@ -2280,7 +2158,7 @@ function LinkInputPopover(props) {
|
|
|
2280
2158
|
className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
|
|
2281
2159
|
sideOffset: 8,
|
|
2282
2160
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2283
|
-
children: /* @__PURE__ */ (0,
|
|
2161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2284
2162
|
"form",
|
|
2285
2163
|
{
|
|
2286
2164
|
onSubmit: (e) => {
|
|
@@ -2293,8 +2171,8 @@ function LinkInputPopover(props) {
|
|
|
2293
2171
|
onValueChange == null ? void 0 : onValueChange(value);
|
|
2294
2172
|
setIsOpen(false);
|
|
2295
2173
|
},
|
|
2296
|
-
children: /* @__PURE__ */ (0,
|
|
2297
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
2174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
2175
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(
|
|
2298
2176
|
"button",
|
|
2299
2177
|
{
|
|
2300
2178
|
onClick: () => {
|
|
@@ -2315,9 +2193,9 @@ function LinkInputPopover(props) {
|
|
|
2315
2193
|
})
|
|
2316
2194
|
}
|
|
2317
2195
|
) }),
|
|
2318
|
-
isEditing && /* @__PURE__ */ (0,
|
|
2319
|
-
/* @__PURE__ */ (0,
|
|
2320
|
-
/* @__PURE__ */ (0,
|
|
2196
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2197
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mly-relative", children: [
|
|
2198
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2321
2199
|
"select",
|
|
2322
2200
|
{
|
|
2323
2201
|
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",
|
|
@@ -2334,13 +2212,13 @@ function LinkInputPopover(props) {
|
|
|
2334
2212
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
2335
2213
|
},
|
|
2336
2214
|
children: [
|
|
2337
|
-
/* @__PURE__ */ (0,
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "https://", children: "https://" }),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "http://", children: "http://" })
|
|
2339
2217
|
]
|
|
2340
2218
|
}
|
|
2341
2219
|
),
|
|
2342
|
-
/* @__PURE__ */ (0,
|
|
2343
|
-
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(
|
|
2221
|
+
import_lucide_react10.ChevronDownIcon,
|
|
2344
2222
|
{
|
|
2345
2223
|
size: 16,
|
|
2346
2224
|
strokeWidth: 2,
|
|
@@ -2349,7 +2227,7 @@ function LinkInputPopover(props) {
|
|
|
2349
2227
|
}
|
|
2350
2228
|
) })
|
|
2351
2229
|
] }),
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2353
2231
|
InputAutocomplete,
|
|
2354
2232
|
{
|
|
2355
2233
|
value: defaultUrlWithoutProtocol,
|
|
@@ -2385,9 +2263,9 @@ function LinkInputPopover(props) {
|
|
|
2385
2263
|
}
|
|
2386
2264
|
|
|
2387
2265
|
// src/editor/components/ui/select.tsx
|
|
2388
|
-
var
|
|
2389
|
-
var
|
|
2390
|
-
var
|
|
2266
|
+
var import_react11 = require("react");
|
|
2267
|
+
var import_lucide_react11 = require("lucide-react");
|
|
2268
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2391
2269
|
function Select(props) {
|
|
2392
2270
|
const {
|
|
2393
2271
|
label,
|
|
@@ -2399,11 +2277,11 @@ function Select(props) {
|
|
|
2399
2277
|
icon: Icon,
|
|
2400
2278
|
iconClassName
|
|
2401
2279
|
} = props;
|
|
2402
|
-
const selectId = `mly${(0,
|
|
2403
|
-
const content = /* @__PURE__ */ (0,
|
|
2404
|
-
/* @__PURE__ */ (0,
|
|
2405
|
-
Icon && /* @__PURE__ */ (0,
|
|
2406
|
-
/* @__PURE__ */ (0,
|
|
2280
|
+
const selectId = `mly${(0, import_react11.useId)()}`;
|
|
2281
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
|
|
2282
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
2283
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(Icon, { className: cn("mly-size-3", iconClassName) }) }),
|
|
2284
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2407
2285
|
"select",
|
|
2408
2286
|
{
|
|
2409
2287
|
id: selectId,
|
|
@@ -2414,11 +2292,11 @@ function Select(props) {
|
|
|
2414
2292
|
),
|
|
2415
2293
|
value,
|
|
2416
2294
|
onChange: (event) => onValueChange(event.target.value),
|
|
2417
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
2295
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
2418
2296
|
}
|
|
2419
2297
|
),
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
2421
|
-
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(
|
|
2299
|
+
import_lucide_react11.ChevronDownIcon,
|
|
2422
2300
|
{
|
|
2423
2301
|
size: 16,
|
|
2424
2302
|
strokeWidth: 2,
|
|
@@ -2430,27 +2308,27 @@ function Select(props) {
|
|
|
2430
2308
|
if (!tooltip) {
|
|
2431
2309
|
return content;
|
|
2432
2310
|
}
|
|
2433
|
-
return /* @__PURE__ */ (0,
|
|
2434
|
-
/* @__PURE__ */ (0,
|
|
2435
|
-
/* @__PURE__ */ (0,
|
|
2311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
2312
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: content }),
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2436
2314
|
] });
|
|
2437
2315
|
}
|
|
2438
2316
|
|
|
2439
2317
|
// src/editor/nodes/button/button-view.tsx
|
|
2440
|
-
var
|
|
2318
|
+
var import_react18 = require("@tiptap/react");
|
|
2441
2319
|
|
|
2442
2320
|
// src/editor/components/show-popover.tsx
|
|
2443
|
-
var
|
|
2321
|
+
var import_lucide_react12 = require("lucide-react");
|
|
2322
|
+
var import_react12 = require("react");
|
|
2323
|
+
var import_react13 = require("react");
|
|
2444
2324
|
var import_react14 = require("react");
|
|
2445
|
-
var
|
|
2446
|
-
var import_react16 = require("react");
|
|
2447
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2325
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2448
2326
|
function _ShowPopover(props) {
|
|
2449
2327
|
const { showIfKey = "", onShowIfKeyValueChange, editor } = props;
|
|
2450
2328
|
const { variables = [], renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2451
|
-
const [isUpdatingKey, setIsUpdatingKey] = (0,
|
|
2452
|
-
const inputRef = (0,
|
|
2453
|
-
const autoCompleteOptions = (0,
|
|
2329
|
+
const [isUpdatingKey, setIsUpdatingKey] = (0, import_react12.useState)(false);
|
|
2330
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
2331
|
+
const autoCompleteOptions = (0, import_react13.useMemo)(() => {
|
|
2454
2332
|
return processVariables(variables, {
|
|
2455
2333
|
query: showIfKey || "",
|
|
2456
2334
|
from: "bubble-variable",
|
|
@@ -2458,7 +2336,7 @@ function _ShowPopover(props) {
|
|
|
2458
2336
|
}).map((variable) => variable.name);
|
|
2459
2337
|
}, [variables, showIfKey, editor]);
|
|
2460
2338
|
const isValidWhenKey = showIfKey || autoCompleteOptions.includes(showIfKey);
|
|
2461
|
-
return /* @__PURE__ */ (0,
|
|
2339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2462
2340
|
Popover,
|
|
2463
2341
|
{
|
|
2464
2342
|
onOpenChange: (open) => {
|
|
@@ -2468,20 +2346,20 @@ function _ShowPopover(props) {
|
|
|
2468
2346
|
setIsUpdatingKey(false);
|
|
2469
2347
|
},
|
|
2470
2348
|
children: [
|
|
2471
|
-
/* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2473
2351
|
PopoverTrigger,
|
|
2474
2352
|
{
|
|
2475
2353
|
className: cn(
|
|
2476
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",
|
|
2477
2355
|
showIfKey && "mly-bg-rose-100 mly-text-rose-800 data-[state=open]:mly-bg-rose-100 hover:mly-bg-rose-100"
|
|
2478
2356
|
),
|
|
2479
|
-
children: /* @__PURE__ */ (0,
|
|
2357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Eye, { className: "mly-h-4 mly-w-4 mly-stroke-[2.5]" })
|
|
2480
2358
|
}
|
|
2481
2359
|
) }),
|
|
2482
|
-
/* @__PURE__ */ (0,
|
|
2360
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { sideOffset: 8, children: "Show block conditionally" })
|
|
2483
2361
|
] }),
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2485
2363
|
PopoverContent,
|
|
2486
2364
|
{
|
|
2487
2365
|
className: "mly-flex mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
@@ -2495,8 +2373,8 @@ function _ShowPopover(props) {
|
|
|
2495
2373
|
e.preventDefault();
|
|
2496
2374
|
},
|
|
2497
2375
|
children: [
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2499
|
-
!isUpdatingKey && /* @__PURE__ */ (0,
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "mly-flex mly-items-center mly-px-1.5 mly-text-sm mly-leading-none", children: "Show if" }),
|
|
2377
|
+
!isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2500
2378
|
"button",
|
|
2501
2379
|
{
|
|
2502
2380
|
onClick: () => {
|
|
@@ -2517,7 +2395,7 @@ function _ShowPopover(props) {
|
|
|
2517
2395
|
})
|
|
2518
2396
|
}
|
|
2519
2397
|
),
|
|
2520
|
-
isUpdatingKey && /* @__PURE__ */ (0,
|
|
2398
|
+
isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2521
2399
|
"form",
|
|
2522
2400
|
{
|
|
2523
2401
|
onSubmit: (e) => {
|
|
@@ -2529,7 +2407,7 @@ function _ShowPopover(props) {
|
|
|
2529
2407
|
setIsUpdatingKey(false);
|
|
2530
2408
|
}
|
|
2531
2409
|
},
|
|
2532
|
-
children: /* @__PURE__ */ (0,
|
|
2410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2533
2411
|
InputAutocomplete,
|
|
2534
2412
|
{
|
|
2535
2413
|
value: showIfKey || "",
|
|
@@ -2556,24 +2434,24 @@ function _ShowPopover(props) {
|
|
|
2556
2434
|
}
|
|
2557
2435
|
);
|
|
2558
2436
|
}
|
|
2559
|
-
var ShowPopover = (0,
|
|
2437
|
+
var ShowPopover = (0, import_react14.memo)(_ShowPopover);
|
|
2560
2438
|
|
|
2561
2439
|
// src/editor/nodes/button/button-label-input.tsx
|
|
2440
|
+
var import_react15 = require("react");
|
|
2441
|
+
var import_react16 = require("react");
|
|
2562
2442
|
var import_react17 = require("react");
|
|
2563
|
-
var
|
|
2564
|
-
var import_react19 = require("react");
|
|
2565
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2443
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2566
2444
|
function ButtonLabelInput(props) {
|
|
2567
2445
|
const { value, onValueChange, isVariable, editor } = props;
|
|
2568
|
-
const linkInputRef = (0,
|
|
2569
|
-
const [isEditing, setIsEditing] = (0,
|
|
2446
|
+
const linkInputRef = (0, import_react17.useRef)(null);
|
|
2447
|
+
const [isEditing, setIsEditing] = (0, import_react16.useState)(!isVariable);
|
|
2570
2448
|
const {
|
|
2571
2449
|
variables = [],
|
|
2572
2450
|
variableTriggerCharacter = DEFAULT_VARIABLE_TRIGGER_CHAR,
|
|
2573
2451
|
renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION,
|
|
2574
2452
|
placeholderUrl = DEFAULT_PLACEHOLDER_URL
|
|
2575
2453
|
} = useMailyContext();
|
|
2576
|
-
const autoCompleteOptions = (0,
|
|
2454
|
+
const autoCompleteOptions = (0, import_react15.useMemo)(() => {
|
|
2577
2455
|
const withoutTrigger = value.replace(
|
|
2578
2456
|
new RegExp(variableTriggerCharacter, "g"),
|
|
2579
2457
|
""
|
|
@@ -2584,8 +2462,8 @@ function ButtonLabelInput(props) {
|
|
|
2584
2462
|
editor
|
|
2585
2463
|
}).map((variable) => variable.name);
|
|
2586
2464
|
}, [variables, value, editor]);
|
|
2587
|
-
return /* @__PURE__ */ (0,
|
|
2588
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
2465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
2466
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2589
2467
|
"button",
|
|
2590
2468
|
{
|
|
2591
2469
|
onClick: () => {
|
|
@@ -2606,7 +2484,7 @@ function ButtonLabelInput(props) {
|
|
|
2606
2484
|
})
|
|
2607
2485
|
}
|
|
2608
2486
|
),
|
|
2609
|
-
isEditing && /* @__PURE__ */ (0,
|
|
2487
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2610
2488
|
InputAutocomplete,
|
|
2611
2489
|
{
|
|
2612
2490
|
value,
|
|
@@ -2632,8 +2510,8 @@ function ButtonLabelInput(props) {
|
|
|
2632
2510
|
}
|
|
2633
2511
|
|
|
2634
2512
|
// src/editor/nodes/button/button-view.tsx
|
|
2635
|
-
var
|
|
2636
|
-
var
|
|
2513
|
+
var import_react19 = require("react");
|
|
2514
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2637
2515
|
function ButtonView(props) {
|
|
2638
2516
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
2639
2517
|
const {
|
|
@@ -2653,7 +2531,7 @@ function ButtonView(props) {
|
|
|
2653
2531
|
paddingLeft
|
|
2654
2532
|
} = node.attrs;
|
|
2655
2533
|
const { renderVariable = DEFAULT_RENDER_VARIABLE_FUNCTION } = useMailyContext();
|
|
2656
|
-
const sizes = (0,
|
|
2534
|
+
const sizes = (0, import_react19.useMemo)(
|
|
2657
2535
|
() => ({
|
|
2658
2536
|
small: {
|
|
2659
2537
|
paddingX: 24,
|
|
@@ -2670,14 +2548,14 @@ function ButtonView(props) {
|
|
|
2670
2548
|
}),
|
|
2671
2549
|
[]
|
|
2672
2550
|
);
|
|
2673
|
-
const size = (0,
|
|
2551
|
+
const size = (0, import_react19.useMemo)(() => {
|
|
2674
2552
|
var _a;
|
|
2675
2553
|
return (_a = Object.entries(sizes).find(
|
|
2676
2554
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
2677
2555
|
)) == null ? void 0 : _a[0];
|
|
2678
2556
|
}, [paddingRight, paddingTop, sizes]);
|
|
2679
|
-
return /* @__PURE__ */ (0,
|
|
2680
|
-
|
|
2557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2558
|
+
import_react18.NodeViewWrapper,
|
|
2681
2559
|
{
|
|
2682
2560
|
draggable: editor.isEditable,
|
|
2683
2561
|
"data-drag-handle": editor.isEditable,
|
|
@@ -2685,8 +2563,8 @@ function ButtonView(props) {
|
|
|
2685
2563
|
style: {
|
|
2686
2564
|
textAlign: alignment
|
|
2687
2565
|
},
|
|
2688
|
-
children: /* @__PURE__ */ (0,
|
|
2689
|
-
/* @__PURE__ */ (0,
|
|
2566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2690
2568
|
"button",
|
|
2691
2569
|
{
|
|
2692
2570
|
className: cn(
|
|
@@ -2729,7 +2607,7 @@ function ButtonView(props) {
|
|
|
2729
2607
|
}) : text2
|
|
2730
2608
|
}
|
|
2731
2609
|
) }) }),
|
|
2732
|
-
/* @__PURE__ */ (0,
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2733
2611
|
PopoverContent,
|
|
2734
2612
|
{
|
|
2735
2613
|
align: "end",
|
|
@@ -2738,8 +2616,8 @@ function ButtonView(props) {
|
|
|
2738
2616
|
sideOffset: 8,
|
|
2739
2617
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2740
2618
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2741
|
-
children: /* @__PURE__ */ (0,
|
|
2742
|
-
/* @__PURE__ */ (0,
|
|
2619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2743
2621
|
ButtonLabelInput,
|
|
2744
2622
|
{
|
|
2745
2623
|
value: text2,
|
|
@@ -2753,9 +2631,9 @@ function ButtonView(props) {
|
|
|
2753
2631
|
editor
|
|
2754
2632
|
}
|
|
2755
2633
|
),
|
|
2756
|
-
/* @__PURE__ */ (0,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2634
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Divider, {}),
|
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
2636
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2759
2637
|
Select,
|
|
2760
2638
|
{
|
|
2761
2639
|
label: "Border Radius",
|
|
@@ -2773,7 +2651,7 @@ function ButtonView(props) {
|
|
|
2773
2651
|
className: "mly-capitalize"
|
|
2774
2652
|
}
|
|
2775
2653
|
),
|
|
2776
|
-
/* @__PURE__ */ (0,
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2777
2655
|
Select,
|
|
2778
2656
|
{
|
|
2779
2657
|
label: "Style",
|
|
@@ -2791,7 +2669,7 @@ function ButtonView(props) {
|
|
|
2791
2669
|
className: "mly-capitalize"
|
|
2792
2670
|
}
|
|
2793
2671
|
),
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2672
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2795
2673
|
Select,
|
|
2796
2674
|
{
|
|
2797
2675
|
label: "Size",
|
|
@@ -2814,9 +2692,9 @@ function ButtonView(props) {
|
|
|
2814
2692
|
}
|
|
2815
2693
|
)
|
|
2816
2694
|
] }),
|
|
2817
|
-
/* @__PURE__ */ (0,
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
2819
|
-
/* @__PURE__ */ (0,
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Divider, {}),
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2820
2698
|
AlignmentSwitch,
|
|
2821
2699
|
{
|
|
2822
2700
|
alignment,
|
|
@@ -2827,7 +2705,7 @@ function ButtonView(props) {
|
|
|
2827
2705
|
}
|
|
2828
2706
|
}
|
|
2829
2707
|
),
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2708
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2831
2709
|
LinkInputPopover,
|
|
2832
2710
|
{
|
|
2833
2711
|
defaultValue: externalLink || "",
|
|
@@ -2843,9 +2721,9 @@ function ButtonView(props) {
|
|
|
2843
2721
|
}
|
|
2844
2722
|
)
|
|
2845
2723
|
] }),
|
|
2846
|
-
/* @__PURE__ */ (0,
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Divider, {}),
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2849
2727
|
BackgroundColorPickerPopup,
|
|
2850
2728
|
{
|
|
2851
2729
|
variant,
|
|
@@ -2857,7 +2735,7 @@ function ButtonView(props) {
|
|
|
2857
2735
|
}
|
|
2858
2736
|
}
|
|
2859
2737
|
),
|
|
2860
|
-
/* @__PURE__ */ (0,
|
|
2738
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2861
2739
|
TextColorPickerPopup,
|
|
2862
2740
|
{
|
|
2863
2741
|
color: textColor,
|
|
@@ -2869,8 +2747,8 @@ function ButtonView(props) {
|
|
|
2869
2747
|
}
|
|
2870
2748
|
)
|
|
2871
2749
|
] }),
|
|
2872
|
-
/* @__PURE__ */ (0,
|
|
2873
|
-
/* @__PURE__ */ (0,
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Divider, {}),
|
|
2751
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2874
2752
|
ShowPopover,
|
|
2875
2753
|
{
|
|
2876
2754
|
showIfKey,
|
|
@@ -2891,20 +2769,20 @@ function ButtonView(props) {
|
|
|
2891
2769
|
}
|
|
2892
2770
|
function BackgroundColorPickerPopup(props) {
|
|
2893
2771
|
const { color, onChange, variant } = props;
|
|
2894
|
-
return /* @__PURE__ */ (0,
|
|
2772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2895
2773
|
ColorPicker,
|
|
2896
2774
|
{
|
|
2897
2775
|
color,
|
|
2898
2776
|
onColorChange: onChange,
|
|
2899
2777
|
tooltip: "Background Color",
|
|
2900
|
-
children: /* @__PURE__ */ (0,
|
|
2778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2901
2779
|
BaseButton,
|
|
2902
2780
|
{
|
|
2903
2781
|
variant: "ghost",
|
|
2904
2782
|
size: "sm",
|
|
2905
2783
|
type: "button",
|
|
2906
2784
|
className: "mly-size-7",
|
|
2907
|
-
children: /* @__PURE__ */ (0,
|
|
2785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2908
2786
|
"div",
|
|
2909
2787
|
{
|
|
2910
2788
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded-full mly-shadow",
|
|
@@ -2923,16 +2801,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
2923
2801
|
}
|
|
2924
2802
|
function TextColorPickerPopup(props) {
|
|
2925
2803
|
const { color, onChange } = props;
|
|
2926
|
-
return /* @__PURE__ */ (0,
|
|
2804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2927
2805
|
BaseButton,
|
|
2928
2806
|
{
|
|
2929
2807
|
variant: "ghost",
|
|
2930
2808
|
size: "sm",
|
|
2931
2809
|
type: "button",
|
|
2932
2810
|
className: "mly-size-7",
|
|
2933
|
-
children: /* @__PURE__ */ (0,
|
|
2934
|
-
/* @__PURE__ */ (0,
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
2811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-midnight-gray", children: "A" }),
|
|
2813
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2936
2814
|
"div",
|
|
2937
2815
|
{
|
|
2938
2816
|
className: "mly-h-[2px] mly-w-3 mly-shrink-0 mly-rounded-md mly-shadow",
|
|
@@ -2956,7 +2834,7 @@ var DEFAULT_BUTTON_PADDING_BOTTOM = 10;
|
|
|
2956
2834
|
var DEFAULT_BUTTON_PADDING_LEFT = 32;
|
|
2957
2835
|
var allowedButtonVariant = ["filled", "outline"];
|
|
2958
2836
|
var allowedButtonBorderRadius = ["sharp", "smooth", "round"];
|
|
2959
|
-
var ButtonExtension =
|
|
2837
|
+
var ButtonExtension = import_core10.Node.create({
|
|
2960
2838
|
name: "button",
|
|
2961
2839
|
group: "block",
|
|
2962
2840
|
atom: true,
|
|
@@ -3153,7 +3031,7 @@ var ButtonExtension = import_core11.Node.create({
|
|
|
3153
3031
|
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
3154
3032
|
return [
|
|
3155
3033
|
"div",
|
|
3156
|
-
(0,
|
|
3034
|
+
(0, import_core10.mergeAttributes)(HTMLAttributes2, {
|
|
3157
3035
|
"data-type": this.name
|
|
3158
3036
|
})
|
|
3159
3037
|
];
|
|
@@ -3171,7 +3049,7 @@ var ButtonExtension = import_core11.Node.create({
|
|
|
3171
3049
|
};
|
|
3172
3050
|
},
|
|
3173
3051
|
addNodeView() {
|
|
3174
|
-
return (0,
|
|
3052
|
+
return (0, import_react20.ReactNodeViewRenderer)(ButtonView, {
|
|
3175
3053
|
contentDOMElementTag: "div",
|
|
3176
3054
|
className: "mly-relative"
|
|
3177
3055
|
});
|
|
@@ -3180,21 +3058,21 @@ var ButtonExtension = import_core11.Node.create({
|
|
|
3180
3058
|
|
|
3181
3059
|
// src/editor/nodes/logo/logo.ts
|
|
3182
3060
|
var import_extension_image = __toESM(require("@tiptap/extension-image"));
|
|
3183
|
-
var
|
|
3061
|
+
var import_react27 = require("@tiptap/react");
|
|
3184
3062
|
|
|
3185
3063
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3186
|
-
var
|
|
3187
|
-
var
|
|
3188
|
-
var
|
|
3064
|
+
var import_react24 = require("@tiptap/react");
|
|
3065
|
+
var import_react25 = require("react");
|
|
3066
|
+
var import_react26 = require("react");
|
|
3189
3067
|
|
|
3190
3068
|
// src/editor/utils/use-event.ts
|
|
3191
|
-
var
|
|
3069
|
+
var import_react21 = require("react");
|
|
3192
3070
|
var useEvent = (handler) => {
|
|
3193
|
-
const handlerRef = (0,
|
|
3194
|
-
(0,
|
|
3071
|
+
const handlerRef = (0, import_react21.useRef)(null);
|
|
3072
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
3195
3073
|
handlerRef.current = handler;
|
|
3196
3074
|
}, [handler]);
|
|
3197
|
-
return (0,
|
|
3075
|
+
return (0, import_react21.useCallback)((...args) => {
|
|
3198
3076
|
if (handlerRef.current === null) {
|
|
3199
3077
|
throw new Error("Handler is not assigned");
|
|
3200
3078
|
}
|
|
@@ -3203,18 +3081,18 @@ var useEvent = (handler) => {
|
|
|
3203
3081
|
};
|
|
3204
3082
|
|
|
3205
3083
|
// src/editor/nodes/image/image-view.tsx
|
|
3206
|
-
var
|
|
3207
|
-
var
|
|
3208
|
-
var
|
|
3209
|
-
var
|
|
3084
|
+
var import_react22 = require("@tiptap/react");
|
|
3085
|
+
var import_lucide_react13 = require("lucide-react");
|
|
3086
|
+
var import_react23 = require("react");
|
|
3087
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3210
3088
|
var MIN_WIDTH = 20;
|
|
3211
3089
|
var MAX_WIDTH = 600;
|
|
3212
3090
|
function ImageView(props) {
|
|
3213
3091
|
const { node, updateAttributes: updateAttributes2, selected, editor } = props;
|
|
3214
|
-
const [status, setStatus] = (0,
|
|
3215
|
-
const wrapperRef = (0,
|
|
3216
|
-
const imgRef = (0,
|
|
3217
|
-
const [resizingStyle, setResizingStyle] = (0,
|
|
3092
|
+
const [status, setStatus] = (0, import_react23.useState)("idle");
|
|
3093
|
+
const wrapperRef = (0, import_react23.useRef)(null);
|
|
3094
|
+
const imgRef = (0, import_react23.useRef)(null);
|
|
3095
|
+
const [resizingStyle, setResizingStyle] = (0, import_react23.useState)();
|
|
3218
3096
|
const handleMouseDown = useEvent(
|
|
3219
3097
|
(event) => {
|
|
3220
3098
|
const imageParent = document.querySelector(
|
|
@@ -3257,7 +3135,7 @@ function ImageView(props) {
|
|
|
3257
3135
|
}
|
|
3258
3136
|
);
|
|
3259
3137
|
function dragCornerButton(direction) {
|
|
3260
|
-
return /* @__PURE__ */ (0,
|
|
3138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3261
3139
|
"div",
|
|
3262
3140
|
{
|
|
3263
3141
|
role: "button",
|
|
@@ -3288,7 +3166,7 @@ function ImageView(props) {
|
|
|
3288
3166
|
"showIfKey"
|
|
3289
3167
|
]);
|
|
3290
3168
|
const hasImageSrc = !!attrs.src;
|
|
3291
|
-
(0,
|
|
3169
|
+
(0, import_react23.useEffect)(() => {
|
|
3292
3170
|
if (!src) {
|
|
3293
3171
|
return;
|
|
3294
3172
|
}
|
|
@@ -3322,8 +3200,8 @@ function ImageView(props) {
|
|
|
3322
3200
|
img.onerror = null;
|
|
3323
3201
|
};
|
|
3324
3202
|
}, [src]);
|
|
3325
|
-
return /* @__PURE__ */ (0,
|
|
3326
|
-
|
|
3203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3204
|
+
import_react22.NodeViewWrapper,
|
|
3327
3205
|
{
|
|
3328
3206
|
as: "div",
|
|
3329
3207
|
draggable: editor.isEditable,
|
|
@@ -3344,12 +3222,12 @@ function ImageView(props) {
|
|
|
3344
3222
|
}[alignment] || {}),
|
|
3345
3223
|
ref: wrapperRef,
|
|
3346
3224
|
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,
|
|
3352
|
-
/* @__PURE__ */ (0,
|
|
3225
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageStatusLabel, { status: "idle" }),
|
|
3226
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageStatusLabel, { status: "variable" }),
|
|
3227
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageStatusLabel, { status: "loading" }),
|
|
3228
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageStatusLabel, { status: "error" }),
|
|
3229
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3353
3231
|
"img",
|
|
3354
3232
|
__spreadProps(__spreadValues({}, attrs), {
|
|
3355
3233
|
ref: imgRef,
|
|
@@ -3360,13 +3238,13 @@ function ImageView(props) {
|
|
|
3360
3238
|
draggable: editor.isEditable
|
|
3361
3239
|
})
|
|
3362
3240
|
),
|
|
3363
|
-
selected && editor.isEditable && /* @__PURE__ */ (0,
|
|
3241
|
+
selected && editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3364
3242
|
[
|
|
3365
3243
|
{ left: 0, top: 0, height: "100%", width: "1px" },
|
|
3366
3244
|
{ right: 0, top: 0, height: "100%", width: "1px" },
|
|
3367
3245
|
{ top: 0, left: 0, width: "100%", height: "1px" },
|
|
3368
3246
|
{ bottom: 0, left: 0, width: "100%", height: "1px" }
|
|
3369
|
-
].map((style, i) => /* @__PURE__ */ (0,
|
|
3247
|
+
].map((style, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3370
3248
|
"div",
|
|
3371
3249
|
{
|
|
3372
3250
|
className: "mly-bg-rose-500",
|
|
@@ -3388,7 +3266,7 @@ function ImageView(props) {
|
|
|
3388
3266
|
}
|
|
3389
3267
|
function ImageStatusLabel(props) {
|
|
3390
3268
|
const { status } = props;
|
|
3391
|
-
return /* @__PURE__ */ (0,
|
|
3269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3392
3270
|
"div",
|
|
3393
3271
|
{
|
|
3394
3272
|
className: cn(
|
|
@@ -3399,21 +3277,21 @@ function ImageStatusLabel(props) {
|
|
|
3399
3277
|
}
|
|
3400
3278
|
),
|
|
3401
3279
|
children: [
|
|
3402
|
-
status === "idle" && /* @__PURE__ */ (0,
|
|
3403
|
-
/* @__PURE__ */ (0,
|
|
3404
|
-
/* @__PURE__ */ (0,
|
|
3280
|
+
status === "idle" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.ImageOffIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "No image selected" })
|
|
3405
3283
|
] }),
|
|
3406
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3408
|
-
/* @__PURE__ */ (0,
|
|
3284
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3285
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.Loader2, { className: "mly-size-4 mly-animate-spin mly-stroke-[2.5]" }),
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Loading image..." })
|
|
3409
3287
|
] }),
|
|
3410
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
3411
|
-
/* @__PURE__ */ (0,
|
|
3412
|
-
/* @__PURE__ */ (0,
|
|
3288
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.Ban, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Error loading image" })
|
|
3413
3291
|
] }),
|
|
3414
|
-
status === "variable" && /* @__PURE__ */ (0,
|
|
3415
|
-
/* @__PURE__ */ (0,
|
|
3416
|
-
/* @__PURE__ */ (0,
|
|
3292
|
+
status === "variable" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.BracesIcon, { className: "mly-size-4 mly-stroke-[2.5]" }),
|
|
3294
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Variable Image URL" })
|
|
3417
3295
|
] })
|
|
3418
3296
|
]
|
|
3419
3297
|
}
|
|
@@ -3421,10 +3299,10 @@ function ImageStatusLabel(props) {
|
|
|
3421
3299
|
}
|
|
3422
3300
|
|
|
3423
3301
|
// src/editor/nodes/logo/logo-view.tsx
|
|
3424
|
-
var
|
|
3302
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3425
3303
|
function LogoView(props) {
|
|
3426
3304
|
const { node, editor } = props;
|
|
3427
|
-
const [status, setStatus] = (0,
|
|
3305
|
+
const [status, setStatus] = (0, import_react26.useState)("idle");
|
|
3428
3306
|
let {
|
|
3429
3307
|
alignment = "center",
|
|
3430
3308
|
src: logoSrc,
|
|
@@ -3432,7 +3310,7 @@ function LogoView(props) {
|
|
|
3432
3310
|
size = "sm"
|
|
3433
3311
|
} = node.attrs || {};
|
|
3434
3312
|
const hasImageSrc = !!logoSrc;
|
|
3435
|
-
(0,
|
|
3313
|
+
(0, import_react25.useEffect)(() => {
|
|
3436
3314
|
if (!logoSrc) {
|
|
3437
3315
|
return;
|
|
3438
3316
|
}
|
|
@@ -3452,8 +3330,8 @@ function LogoView(props) {
|
|
|
3452
3330
|
};
|
|
3453
3331
|
}, [logoSrc]);
|
|
3454
3332
|
const logoSize = logoSizes[size];
|
|
3455
|
-
return /* @__PURE__ */ (0,
|
|
3456
|
-
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3334
|
+
import_react24.NodeViewWrapper,
|
|
3457
3335
|
{
|
|
3458
3336
|
as: "div",
|
|
3459
3337
|
draggable: editor.isEditable,
|
|
@@ -3466,11 +3344,11 @@ function LogoView(props) {
|
|
|
3466
3344
|
display: "block"
|
|
3467
3345
|
},
|
|
3468
3346
|
children: [
|
|
3469
|
-
!hasImageSrc && /* @__PURE__ */ (0,
|
|
3470
|
-
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0,
|
|
3471
|
-
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3472
|
-
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3473
|
-
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0,
|
|
3347
|
+
!hasImageSrc && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageStatusLabel, { status: "idle" }),
|
|
3348
|
+
hasImageSrc && isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageStatusLabel, { status: "variable" }),
|
|
3349
|
+
hasImageSrc && status === "loading" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageStatusLabel, { status: "loading" }),
|
|
3350
|
+
hasImageSrc && status === "error" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ImageStatusLabel, { status: "error" }),
|
|
3351
|
+
hasImageSrc && status === "loaded" && !isSrcVariable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3474
3352
|
"img",
|
|
3475
3353
|
{
|
|
3476
3354
|
src: logoSrc,
|
|
@@ -3590,7 +3468,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3590
3468
|
];
|
|
3591
3469
|
},
|
|
3592
3470
|
addNodeView() {
|
|
3593
|
-
return (0,
|
|
3471
|
+
return (0, import_react27.ReactNodeViewRenderer)(LogoView, {
|
|
3594
3472
|
className: "mly-relative"
|
|
3595
3473
|
});
|
|
3596
3474
|
}
|
|
@@ -3598,7 +3476,7 @@ var LogoExtension = import_extension_image.default.extend({
|
|
|
3598
3476
|
|
|
3599
3477
|
// src/editor/nodes/image/image.ts
|
|
3600
3478
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"));
|
|
3601
|
-
var
|
|
3479
|
+
var import_react28 = require("@tiptap/react");
|
|
3602
3480
|
var ImageExtension = import_extension_image2.default.extend({
|
|
3603
3481
|
addAttributes() {
|
|
3604
3482
|
var _a;
|
|
@@ -3690,7 +3568,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
3690
3568
|
});
|
|
3691
3569
|
},
|
|
3692
3570
|
addNodeView() {
|
|
3693
|
-
return (0,
|
|
3571
|
+
return (0, import_react28.ReactNodeViewRenderer)(ImageView, {
|
|
3694
3572
|
className: "mly-relative"
|
|
3695
3573
|
});
|
|
3696
3574
|
}
|
|
@@ -3765,6 +3643,128 @@ var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
|
3765
3643
|
}
|
|
3766
3644
|
});
|
|
3767
3645
|
|
|
3646
|
+
// src/editor/nodes/repeat/repeat.ts
|
|
3647
|
+
var import_core11 = require("@tiptap/core");
|
|
3648
|
+
var import_react30 = require("@tiptap/react");
|
|
3649
|
+
|
|
3650
|
+
// src/editor/nodes/repeat/repeat-view.tsx
|
|
3651
|
+
var import_react29 = require("@tiptap/react");
|
|
3652
|
+
var import_lucide_react14 = require("lucide-react");
|
|
3653
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3654
|
+
function RepeatView(props) {
|
|
3655
|
+
const { editor, getPos } = props;
|
|
3656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3657
|
+
import_react29.NodeViewWrapper,
|
|
3658
|
+
{
|
|
3659
|
+
"data-type": "repeat",
|
|
3660
|
+
draggable: editor.isEditable,
|
|
3661
|
+
"data-drag-handle": editor.isEditable,
|
|
3662
|
+
className: "mly-relative",
|
|
3663
|
+
children: [
|
|
3664
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react29.NodeViewContent, { className: "is-editable" }),
|
|
3665
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3666
|
+
"div",
|
|
3667
|
+
{
|
|
3668
|
+
role: "button",
|
|
3669
|
+
"data-repeat-indicator": "",
|
|
3670
|
+
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",
|
|
3671
|
+
contentEditable: false,
|
|
3672
|
+
onClick: () => {
|
|
3673
|
+
editor.commands.setNodeSelection(getPos());
|
|
3674
|
+
},
|
|
3675
|
+
children: [
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
3678
|
+
]
|
|
3679
|
+
}
|
|
3680
|
+
)
|
|
3681
|
+
]
|
|
3682
|
+
}
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
// src/editor/nodes/repeat/repeat.ts
|
|
3687
|
+
var RepeatExtension = import_core11.Node.create({
|
|
3688
|
+
name: "repeat",
|
|
3689
|
+
group: "block",
|
|
3690
|
+
content: "(block|columns)+",
|
|
3691
|
+
draggable: true,
|
|
3692
|
+
isolating: true,
|
|
3693
|
+
addAttributes() {
|
|
3694
|
+
return {
|
|
3695
|
+
each: {
|
|
3696
|
+
default: "items",
|
|
3697
|
+
parseHTML: (element) => {
|
|
3698
|
+
return element.getAttribute("each") || "";
|
|
3699
|
+
},
|
|
3700
|
+
renderHTML: (attributes) => {
|
|
3701
|
+
if (!attributes.each) {
|
|
3702
|
+
return {};
|
|
3703
|
+
}
|
|
3704
|
+
return {
|
|
3705
|
+
each: attributes.each
|
|
3706
|
+
};
|
|
3707
|
+
}
|
|
3708
|
+
},
|
|
3709
|
+
isUpdatingKey: {
|
|
3710
|
+
default: false
|
|
3711
|
+
},
|
|
3712
|
+
showIfKey: {
|
|
3713
|
+
default: DEFAULT_SECTION_SHOW_IF_KEY,
|
|
3714
|
+
parseHTML: (element) => {
|
|
3715
|
+
return element.getAttribute("data-show-if-key") || DEFAULT_SECTION_SHOW_IF_KEY;
|
|
3716
|
+
},
|
|
3717
|
+
renderHTML(attributes) {
|
|
3718
|
+
if (!attributes.showIfKey) {
|
|
3719
|
+
return {};
|
|
3720
|
+
}
|
|
3721
|
+
return {
|
|
3722
|
+
"data-show-if-key": attributes.showIfKey
|
|
3723
|
+
};
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
};
|
|
3727
|
+
},
|
|
3728
|
+
parseHTML() {
|
|
3729
|
+
return [
|
|
3730
|
+
{
|
|
3731
|
+
tag: `div[data-type="${this.name}"]`
|
|
3732
|
+
}
|
|
3733
|
+
];
|
|
3734
|
+
},
|
|
3735
|
+
renderHTML({ HTMLAttributes: HTMLAttributes2 }) {
|
|
3736
|
+
return [
|
|
3737
|
+
"div",
|
|
3738
|
+
(0, import_core11.mergeAttributes)(HTMLAttributes2, {
|
|
3739
|
+
"data-type": this.name
|
|
3740
|
+
}),
|
|
3741
|
+
0
|
|
3742
|
+
];
|
|
3743
|
+
},
|
|
3744
|
+
addCommands() {
|
|
3745
|
+
return {
|
|
3746
|
+
setRepeat: () => ({ commands }) => {
|
|
3747
|
+
return commands.insertContent({
|
|
3748
|
+
type: this.name,
|
|
3749
|
+
attrs: {},
|
|
3750
|
+
content: [
|
|
3751
|
+
{
|
|
3752
|
+
type: "paragraph"
|
|
3753
|
+
}
|
|
3754
|
+
]
|
|
3755
|
+
});
|
|
3756
|
+
},
|
|
3757
|
+
updateRepeat: (attrs) => updateAttributes(this.name, attrs)
|
|
3758
|
+
};
|
|
3759
|
+
},
|
|
3760
|
+
addNodeView() {
|
|
3761
|
+
return (0, import_react30.ReactNodeViewRenderer)(RepeatView, {
|
|
3762
|
+
contentDOMElementTag: "div",
|
|
3763
|
+
className: "mly-relative"
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
});
|
|
3767
|
+
|
|
3768
3768
|
// src/editor/extensions/maily-kit.tsx
|
|
3769
3769
|
var MailyKit = import_core12.Extension.create({
|
|
3770
3770
|
name: "maily-kit",
|
|
@@ -3827,7 +3827,7 @@ var MailyKit = import_core12.Extension.create({
|
|
|
3827
3827
|
"columns",
|
|
3828
3828
|
"column",
|
|
3829
3829
|
"section",
|
|
3830
|
-
"
|
|
3830
|
+
"repeat",
|
|
3831
3831
|
"show",
|
|
3832
3832
|
"blockquote"
|
|
3833
3833
|
].includes(node.type.name)) {
|
|
@@ -3859,8 +3859,8 @@ var MailyKit = import_core12.Extension.create({
|
|
|
3859
3859
|
if (this.options.linkCard !== false) {
|
|
3860
3860
|
extensions.push(LinkCardExtension.configure(this.options.linkCard));
|
|
3861
3861
|
}
|
|
3862
|
-
if (this.options.
|
|
3863
|
-
extensions.push(
|
|
3862
|
+
if (this.options.repeat !== false) {
|
|
3863
|
+
extensions.push(RepeatExtension);
|
|
3864
3864
|
}
|
|
3865
3865
|
if (this.options.section !== false) {
|
|
3866
3866
|
extensions.push(SectionExtension);
|
|
@@ -4392,12 +4392,12 @@ function getVariableSuggestions(variables = DEFAULT_VARIABLES, char = DEFAULT_VA
|
|
|
4392
4392
|
DEFAULT_SECTION_PADDING_TOP,
|
|
4393
4393
|
DEFAULT_SECTION_SHOW_IF_KEY,
|
|
4394
4394
|
Footer,
|
|
4395
|
-
ForExtension,
|
|
4396
4395
|
HorizontalRule,
|
|
4397
4396
|
ImageExtension,
|
|
4398
4397
|
LinkExtension,
|
|
4399
4398
|
LogoExtension,
|
|
4400
4399
|
MailyKit,
|
|
4400
|
+
RepeatExtension,
|
|
4401
4401
|
SectionExtension,
|
|
4402
4402
|
SlashCommandExtension,
|
|
4403
4403
|
Spacer,
|