@daisychainapp/maily-to-core 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/index.cjs +460 -614
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.mjs +403 -557
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +92 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +121 -211
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1360,7 +1360,7 @@ var ColumnsExtension = import_core10.Node.create({
|
|
|
1360
1360
|
|
|
1361
1361
|
// src/editor/nodes/button/button.tsx
|
|
1362
1362
|
var import_core12 = require("@tiptap/core");
|
|
1363
|
-
var
|
|
1363
|
+
var import_react26 = require("@tiptap/react");
|
|
1364
1364
|
|
|
1365
1365
|
// src/editor/components/alignment-switch.tsx
|
|
1366
1366
|
var import_lucide_react2 = require("lucide-react");
|
|
@@ -2234,302 +2234,9 @@ function AlignmentSwitch(props) {
|
|
|
2234
2234
|
] });
|
|
2235
2235
|
}
|
|
2236
2236
|
|
|
2237
|
-
// src/editor/components/show-popover.tsx
|
|
2238
|
-
var import_lucide_react4 = require("lucide-react");
|
|
2239
|
-
var import_react15 = require("react");
|
|
2240
|
-
|
|
2241
|
-
// src/editor/utils/node-options.ts
|
|
2242
|
-
var import_react11 = require("react");
|
|
2243
|
-
function getNodeOptions(editor, name) {
|
|
2244
|
-
const node = editor.extensionManager.extensions.find(
|
|
2245
|
-
(extension) => extension.name === name
|
|
2246
|
-
);
|
|
2247
|
-
if (!node) {
|
|
2248
|
-
throw new Error(`Node ${name} not found`);
|
|
2249
|
-
}
|
|
2250
|
-
return node.options;
|
|
2251
|
-
}
|
|
2252
|
-
function getVariableOptions(editor) {
|
|
2253
|
-
return getNodeOptions(editor, "variable");
|
|
2254
|
-
}
|
|
2255
|
-
function useVariableOptions(editor) {
|
|
2256
|
-
return (0, import_react11.useMemo)(() => {
|
|
2257
|
-
return getVariableOptions(editor);
|
|
2258
|
-
}, [editor]);
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
// src/editor/utils/variable.ts
|
|
2262
|
-
function processVariables(variables, options) {
|
|
2263
|
-
const { query } = options;
|
|
2264
|
-
const queryLower = query.toLowerCase();
|
|
2265
|
-
let filteredVariables = [];
|
|
2266
|
-
if (Array.isArray(variables)) {
|
|
2267
|
-
filteredVariables = variables.filter(
|
|
2268
|
-
(variable) => variable.name.toLowerCase().startsWith(queryLower)
|
|
2269
|
-
);
|
|
2270
|
-
if (query.length > 0 && !filteredVariables.some((variable) => variable.name === query)) {
|
|
2271
|
-
filteredVariables.push({ name: query, required: true });
|
|
2272
|
-
}
|
|
2273
|
-
return filteredVariables;
|
|
2274
|
-
} else if (typeof variables === "function") {
|
|
2275
|
-
return variables(options);
|
|
2276
|
-
} else {
|
|
2277
|
-
throw new Error(`Invalid variables type. Expected 'Array' or 'Function', but received '${typeof variables}'.
|
|
2278
|
-
|
|
2279
|
-
You can check out the documentation for more information: https://github.com/arikchakma/maily.to/blob/main/packages/core/readme.md`);
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
// src/editor/utils/use-outside-click.ts
|
|
2284
|
-
var import_react12 = require("react");
|
|
2285
|
-
var import_react13 = require("react");
|
|
2286
|
-
function useOutsideClick(ref, callback) {
|
|
2287
|
-
const handleClick = (0, import_react12.useCallback)(
|
|
2288
|
-
(e) => {
|
|
2289
|
-
if (ref.current && !ref.current.contains(e.target)) {
|
|
2290
|
-
callback();
|
|
2291
|
-
}
|
|
2292
|
-
},
|
|
2293
|
-
[ref, callback]
|
|
2294
|
-
);
|
|
2295
|
-
(0, import_react13.useEffect)(() => {
|
|
2296
|
-
document.addEventListener("mousedown", handleClick);
|
|
2297
|
-
document.addEventListener("touchstart", handleClick);
|
|
2298
|
-
return () => {
|
|
2299
|
-
document.removeEventListener("mousedown", handleClick);
|
|
2300
|
-
document.removeEventListener("touchstart", handleClick);
|
|
2301
|
-
};
|
|
2302
|
-
}, [handleClick]);
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
// src/editor/components/ui/input-autocomplete.tsx
|
|
2306
|
-
var import_lucide_react3 = require("lucide-react");
|
|
2307
|
-
var import_react14 = require("react");
|
|
2308
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2309
|
-
var InputAutocomplete = (0, import_react14.forwardRef)((props, ref) => {
|
|
2310
|
-
var _b;
|
|
2311
|
-
const _a = props, {
|
|
2312
|
-
value = "",
|
|
2313
|
-
onValueChange,
|
|
2314
|
-
className,
|
|
2315
|
-
onOutsideClick,
|
|
2316
|
-
onSelectOption,
|
|
2317
|
-
autoCompleteOptions = [],
|
|
2318
|
-
triggerChar = "",
|
|
2319
|
-
editor
|
|
2320
|
-
} = _a, inputProps = __objRest(_a, [
|
|
2321
|
-
"value",
|
|
2322
|
-
"onValueChange",
|
|
2323
|
-
"className",
|
|
2324
|
-
"onOutsideClick",
|
|
2325
|
-
"onSelectOption",
|
|
2326
|
-
"autoCompleteOptions",
|
|
2327
|
-
"triggerChar",
|
|
2328
|
-
"editor"
|
|
2329
|
-
]);
|
|
2330
|
-
const containerRef = (0, import_react14.useRef)(null);
|
|
2331
|
-
const popoverRef = (0, import_react14.useRef)(null);
|
|
2332
|
-
const VariableSuggestionPopoverComponent = (_b = useVariableOptions(editor)) == null ? void 0 : _b.variableSuggestionsPopover;
|
|
2333
|
-
useOutsideClick(containerRef, () => {
|
|
2334
|
-
onOutsideClick == null ? void 0 : onOutsideClick();
|
|
2335
|
-
});
|
|
2336
|
-
const isTriggeringVariable = value.startsWith(triggerChar);
|
|
2337
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("mly-relative"), ref: containerRef, children: [
|
|
2338
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "mly-relative", children: [
|
|
2339
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2340
|
-
"input",
|
|
2341
|
-
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
2342
|
-
placeholder: "e.g. items",
|
|
2343
|
-
type: "text"
|
|
2344
|
-
}), inputProps), {
|
|
2345
|
-
ref,
|
|
2346
|
-
value,
|
|
2347
|
-
onChange: (e) => {
|
|
2348
|
-
onValueChange(e.target.value);
|
|
2349
|
-
},
|
|
2350
|
-
className: cn(
|
|
2351
|
-
"mly-h-7 mly-w-40 mly-rounded-md mly-bg-white mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray hover:mly-bg-soft-gray focus:mly-bg-soft-gray focus:mly-outline-none",
|
|
2352
|
-
className
|
|
2353
|
-
),
|
|
2354
|
-
onKeyDown: (e) => {
|
|
2355
|
-
if (!popoverRef.current || !isTriggeringVariable) {
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
const { moveUp, moveDown, select } = popoverRef.current;
|
|
2359
|
-
if (e.key === "ArrowDown") {
|
|
2360
|
-
e.preventDefault();
|
|
2361
|
-
moveDown();
|
|
2362
|
-
} else if (e.key === "ArrowUp") {
|
|
2363
|
-
e.preventDefault();
|
|
2364
|
-
moveUp();
|
|
2365
|
-
} else if (e.key === "Enter") {
|
|
2366
|
-
e.preventDefault();
|
|
2367
|
-
select();
|
|
2368
|
-
}
|
|
2369
|
-
},
|
|
2370
|
-
spellCheck: false
|
|
2371
|
-
})
|
|
2372
|
-
),
|
|
2373
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.CornerDownLeft, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
2374
|
-
] }),
|
|
2375
|
-
isTriggeringVariable && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mly-absolute mly-left-0 mly-top-8", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2376
|
-
VariableSuggestionPopoverComponent,
|
|
2377
|
-
{
|
|
2378
|
-
items: autoCompleteOptions.map((option) => {
|
|
2379
|
-
return {
|
|
2380
|
-
name: option
|
|
2381
|
-
};
|
|
2382
|
-
}),
|
|
2383
|
-
onSelectItem: (item) => {
|
|
2384
|
-
onSelectOption == null ? void 0 : onSelectOption(item.name);
|
|
2385
|
-
},
|
|
2386
|
-
ref: popoverRef
|
|
2387
|
-
}
|
|
2388
|
-
) })
|
|
2389
|
-
] });
|
|
2390
|
-
});
|
|
2391
|
-
InputAutocomplete.displayName = "InputAutocomplete";
|
|
2392
|
-
|
|
2393
|
-
// src/editor/components/show-popover.tsx
|
|
2394
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2395
|
-
function _ShowPopover(props) {
|
|
2396
|
-
const { showIfKey = "", onShowIfKeyValueChange, editor } = props;
|
|
2397
|
-
const opts = useVariableOptions(editor);
|
|
2398
|
-
const variables = opts == null ? void 0 : opts.variables;
|
|
2399
|
-
const renderVariable = opts == null ? void 0 : opts.renderVariable;
|
|
2400
|
-
const [isUpdatingKey, setIsUpdatingKey] = (0, import_react15.useState)(false);
|
|
2401
|
-
const inputRef = (0, import_react15.useRef)(null);
|
|
2402
|
-
const autoCompleteOptions = (0, import_react15.useMemo)(() => {
|
|
2403
|
-
return processVariables(variables, {
|
|
2404
|
-
query: showIfKey || "",
|
|
2405
|
-
from: "bubble-variable",
|
|
2406
|
-
editor
|
|
2407
|
-
}).map((variable) => variable.name);
|
|
2408
|
-
}, [variables, showIfKey, editor]);
|
|
2409
|
-
const isValidWhenKey = showIfKey || autoCompleteOptions.includes(showIfKey);
|
|
2410
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2411
|
-
Popover,
|
|
2412
|
-
{
|
|
2413
|
-
onOpenChange: (open) => {
|
|
2414
|
-
if (open) {
|
|
2415
|
-
return;
|
|
2416
|
-
}
|
|
2417
|
-
setIsUpdatingKey(false);
|
|
2418
|
-
},
|
|
2419
|
-
children: [
|
|
2420
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Tooltip, { children: [
|
|
2421
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2422
|
-
PopoverTrigger,
|
|
2423
|
-
{
|
|
2424
|
-
className: cn(
|
|
2425
|
-
"mly-flex mly-size-7 mly-items-center mly-justify-center mly-gap-1 mly-rounded-md mly-px-1.5 mly-text-sm data-[state=open]:mly-bg-soft-gray hover:mly-bg-soft-gray focus-visible:mly-relative focus-visible:mly-z-10 focus-visible:mly-outline-none focus-visible:mly-ring-2 focus-visible:mly-ring-gray-400 focus-visible:mly-ring-offset-2",
|
|
2426
|
-
showIfKey && "mly-bg-rose-100 mly-text-rose-800 data-[state=open]:mly-bg-rose-100 hover:mly-bg-rose-100"
|
|
2427
|
-
),
|
|
2428
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Eye, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5]" })
|
|
2429
|
-
}
|
|
2430
|
-
) }),
|
|
2431
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipContent, { sideOffset: 8, children: "Show block conditionally" })
|
|
2432
|
-
] }),
|
|
2433
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2434
|
-
PopoverContent,
|
|
2435
|
-
{
|
|
2436
|
-
className: "mly-flex mly-w-max mly-rounded-lg !mly-p-0.5",
|
|
2437
|
-
side: "top",
|
|
2438
|
-
sideOffset: 8,
|
|
2439
|
-
align: "end",
|
|
2440
|
-
onOpenAutoFocus: (e) => {
|
|
2441
|
-
e.preventDefault();
|
|
2442
|
-
},
|
|
2443
|
-
onCloseAutoFocus: (e) => {
|
|
2444
|
-
e.preventDefault();
|
|
2445
|
-
},
|
|
2446
|
-
children: [
|
|
2447
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1.5 mly-px-1.5 mly-text-sm mly-leading-none", children: [
|
|
2448
|
-
"Show if",
|
|
2449
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Tooltip, { children: [
|
|
2450
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2451
|
-
import_lucide_react4.InfoIcon,
|
|
2452
|
-
{
|
|
2453
|
-
className: cn("mly-size-3 mly-stroke-[2.5] mly-text-gray-500")
|
|
2454
|
-
}
|
|
2455
|
-
) }),
|
|
2456
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2457
|
-
TooltipContent,
|
|
2458
|
-
{
|
|
2459
|
-
sideOffset: 14,
|
|
2460
|
-
className: "mly-max-w-[285px]",
|
|
2461
|
-
align: "start",
|
|
2462
|
-
children: "Show the block if the selected variable is true."
|
|
2463
|
-
}
|
|
2464
|
-
)
|
|
2465
|
-
] })
|
|
2466
|
-
] }),
|
|
2467
|
-
!isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2468
|
-
"button",
|
|
2469
|
-
{
|
|
2470
|
-
onClick: () => {
|
|
2471
|
-
setIsUpdatingKey(true);
|
|
2472
|
-
setTimeout(() => {
|
|
2473
|
-
var _a;
|
|
2474
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
2475
|
-
}, 0);
|
|
2476
|
-
},
|
|
2477
|
-
children: renderVariable({
|
|
2478
|
-
variable: {
|
|
2479
|
-
name: showIfKey,
|
|
2480
|
-
valid: !!isValidWhenKey
|
|
2481
|
-
},
|
|
2482
|
-
fallback: "",
|
|
2483
|
-
from: "bubble-variable",
|
|
2484
|
-
editor
|
|
2485
|
-
})
|
|
2486
|
-
}
|
|
2487
|
-
),
|
|
2488
|
-
isUpdatingKey && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2489
|
-
"form",
|
|
2490
|
-
{
|
|
2491
|
-
onSubmit: (e) => {
|
|
2492
|
-
e.preventDefault();
|
|
2493
|
-
setIsUpdatingKey(false);
|
|
2494
|
-
},
|
|
2495
|
-
onKeyDown: (e) => {
|
|
2496
|
-
if (e.key === "Escape") {
|
|
2497
|
-
setIsUpdatingKey(false);
|
|
2498
|
-
}
|
|
2499
|
-
},
|
|
2500
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2501
|
-
InputAutocomplete,
|
|
2502
|
-
{
|
|
2503
|
-
editor,
|
|
2504
|
-
value: showIfKey || "",
|
|
2505
|
-
onValueChange: (value) => {
|
|
2506
|
-
onShowIfKeyValueChange == null ? void 0 : onShowIfKeyValueChange(value);
|
|
2507
|
-
},
|
|
2508
|
-
onOutsideClick: () => {
|
|
2509
|
-
setIsUpdatingKey(false);
|
|
2510
|
-
},
|
|
2511
|
-
onSelectOption: (value) => {
|
|
2512
|
-
onShowIfKeyValueChange == null ? void 0 : onShowIfKeyValueChange(value);
|
|
2513
|
-
setIsUpdatingKey(false);
|
|
2514
|
-
},
|
|
2515
|
-
autoCompleteOptions,
|
|
2516
|
-
ref: inputRef
|
|
2517
|
-
}
|
|
2518
|
-
)
|
|
2519
|
-
}
|
|
2520
|
-
)
|
|
2521
|
-
]
|
|
2522
|
-
}
|
|
2523
|
-
)
|
|
2524
|
-
]
|
|
2525
|
-
}
|
|
2526
|
-
);
|
|
2527
|
-
}
|
|
2528
|
-
var ShowPopover = (0, import_react15.memo)(_ShowPopover);
|
|
2529
|
-
|
|
2530
2237
|
// src/editor/components/ui/color-picker.tsx
|
|
2531
2238
|
var import_react_colorful = require("react-colorful");
|
|
2532
|
-
var
|
|
2239
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2533
2240
|
function ColorPicker(props) {
|
|
2534
2241
|
const {
|
|
2535
2242
|
color,
|
|
@@ -2547,14 +2254,14 @@ function ColorPicker(props) {
|
|
|
2547
2254
|
onColorChange(color2);
|
|
2548
2255
|
});
|
|
2549
2256
|
};
|
|
2550
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
2257
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopoverTrigger, { asChild: true, children: children || /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2551
2258
|
BaseButton,
|
|
2552
2259
|
{
|
|
2553
2260
|
variant: "ghost",
|
|
2554
2261
|
className: "!mly-size-7 mly-shrink-0",
|
|
2555
2262
|
size: "sm",
|
|
2556
2263
|
type: "button",
|
|
2557
|
-
children: /* @__PURE__ */ (0,
|
|
2264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2558
2265
|
"div",
|
|
2559
2266
|
{
|
|
2560
2267
|
className: cn(
|
|
@@ -2568,7 +2275,7 @@ function ColorPicker(props) {
|
|
|
2568
2275
|
)
|
|
2569
2276
|
}
|
|
2570
2277
|
) });
|
|
2571
|
-
return /* @__PURE__ */ (0,
|
|
2278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2572
2279
|
Popover,
|
|
2573
2280
|
{
|
|
2574
2281
|
onOpenChange: (open) => {
|
|
@@ -2577,17 +2284,17 @@ function ColorPicker(props) {
|
|
|
2577
2284
|
}
|
|
2578
2285
|
},
|
|
2579
2286
|
children: [
|
|
2580
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
2581
|
-
/* @__PURE__ */ (0,
|
|
2582
|
-
/* @__PURE__ */ (0,
|
|
2287
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Tooltip, { children: [
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
2583
2290
|
] }) : popoverButton,
|
|
2584
|
-
/* @__PURE__ */ (0,
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2585
2292
|
PopoverContent,
|
|
2586
2293
|
{
|
|
2587
2294
|
className: "mly-w-full mly-rounded-none mly-border-0 !mly-bg-transparent !mly-p-0 mly-shadow-none mly-drop-shadow-md",
|
|
2588
2295
|
sideOffset: 8,
|
|
2589
|
-
children: /* @__PURE__ */ (0,
|
|
2590
|
-
/* @__PURE__ */ (0,
|
|
2296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mly-min-w-[260px] mly-rounded-xl mly-border mly-border-gray-200 mly-bg-white mly-p-4", children: [
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2591
2298
|
import_react_colorful.HexColorPicker,
|
|
2592
2299
|
{
|
|
2593
2300
|
color,
|
|
@@ -2595,7 +2302,7 @@ function ColorPicker(props) {
|
|
|
2595
2302
|
className: "mly-flex !mly-w-full mly-flex-col mly-gap-4"
|
|
2596
2303
|
}
|
|
2597
2304
|
),
|
|
2598
|
-
/* @__PURE__ */ (0,
|
|
2305
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2599
2306
|
import_react_colorful.HexColorInput,
|
|
2600
2307
|
{
|
|
2601
2308
|
alpha: true,
|
|
@@ -2605,10 +2312,10 @@ function ColorPicker(props) {
|
|
|
2605
2312
|
prefixed: true
|
|
2606
2313
|
}
|
|
2607
2314
|
),
|
|
2608
|
-
suggestedColors.length > 0 && /* @__PURE__ */ (0,
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
2611
|
-
/* @__PURE__ */ (0,
|
|
2315
|
+
suggestedColors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "-mly-mx-4 mly-my-4 mly-h-px mly-bg-gray-200" }),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { className: "mly-text-xs mly-text-gray-500", children: "Recently used" }),
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mly-mt-2 mly-flex mly-flex-wrap mly-gap-0.5", children: suggestedColors.map((suggestedColor) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2612
2319
|
BaseButton,
|
|
2613
2320
|
{
|
|
2614
2321
|
variant: "ghost",
|
|
@@ -2616,7 +2323,7 @@ function ColorPicker(props) {
|
|
|
2616
2323
|
className: "!mly-size-7 mly-shrink-0",
|
|
2617
2324
|
type: "button",
|
|
2618
2325
|
onClick: () => handleColorChange(suggestedColor),
|
|
2619
|
-
children: /* @__PURE__ */ (0,
|
|
2326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2620
2327
|
"div",
|
|
2621
2328
|
{
|
|
2622
2329
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded",
|
|
@@ -2638,10 +2345,10 @@ function ColorPicker(props) {
|
|
|
2638
2345
|
}
|
|
2639
2346
|
|
|
2640
2347
|
// src/editor/components/ui/divider.tsx
|
|
2641
|
-
var
|
|
2348
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2642
2349
|
function Divider(props) {
|
|
2643
2350
|
const { type = "vertical", className } = props;
|
|
2644
|
-
return /* @__PURE__ */ (0,
|
|
2351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2645
2352
|
"div",
|
|
2646
2353
|
{
|
|
2647
2354
|
className: cn(
|
|
@@ -2654,23 +2361,23 @@ function Divider(props) {
|
|
|
2654
2361
|
}
|
|
2655
2362
|
|
|
2656
2363
|
// src/editor/components/ui/link-input-popover.tsx
|
|
2657
|
-
var
|
|
2658
|
-
var
|
|
2364
|
+
var import_lucide_react14 = require("lucide-react");
|
|
2365
|
+
var import_react20 = require("react");
|
|
2659
2366
|
|
|
2660
2367
|
// src/editor/provider.tsx
|
|
2661
|
-
var
|
|
2368
|
+
var import_react11 = require("react");
|
|
2662
2369
|
|
|
2663
2370
|
// src/editor/extensions/slash-command/default-slash-commands.tsx
|
|
2664
|
-
var
|
|
2371
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2665
2372
|
|
|
2666
2373
|
// src/blocks/button.tsx
|
|
2667
|
-
var
|
|
2668
|
-
var
|
|
2374
|
+
var import_lucide_react3 = require("lucide-react");
|
|
2375
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2669
2376
|
var button = {
|
|
2670
2377
|
title: "Button",
|
|
2671
2378
|
description: "Add a call to action button to email.",
|
|
2672
2379
|
searchTerms: ["link", "button", "cta"],
|
|
2673
|
-
icon: /* @__PURE__ */ (0,
|
|
2380
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react3.MousePointer, { className: "mly-h-4 mly-w-4" }),
|
|
2674
2381
|
command: ({ editor, range }) => {
|
|
2675
2382
|
editor.chain().focus().deleteRange(range).setButton().run();
|
|
2676
2383
|
}
|
|
@@ -2679,7 +2386,7 @@ var linkCard = {
|
|
|
2679
2386
|
title: "Link Card",
|
|
2680
2387
|
description: "Add a link card to email.",
|
|
2681
2388
|
searchTerms: ["link", "button", "image"],
|
|
2682
|
-
icon: /* @__PURE__ */ (0,
|
|
2389
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react3.ArrowUpRightSquare, { className: "mly-h-4 mly-w-4" }),
|
|
2683
2390
|
command: ({ editor, range }) => {
|
|
2684
2391
|
editor.chain().focus().deleteRange(range).setLinkCard().run();
|
|
2685
2392
|
},
|
|
@@ -2691,13 +2398,13 @@ var linkCard = {
|
|
|
2691
2398
|
};
|
|
2692
2399
|
|
|
2693
2400
|
// src/blocks/code.tsx
|
|
2694
|
-
var
|
|
2695
|
-
var
|
|
2401
|
+
var import_lucide_react4 = require("lucide-react");
|
|
2402
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2696
2403
|
var htmlCodeBlock = {
|
|
2697
2404
|
title: "Custom HTML",
|
|
2698
2405
|
description: "Insert a custom HTML block",
|
|
2699
2406
|
searchTerms: ["html", "code", "custom"],
|
|
2700
|
-
icon: /* @__PURE__ */ (0,
|
|
2407
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react4.CodeXmlIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2701
2408
|
command: ({ editor, range }) => {
|
|
2702
2409
|
editor.chain().focus().deleteRange(range).setHtmlCodeBlock({ language: "html" }).run();
|
|
2703
2410
|
}
|
|
@@ -2705,13 +2412,13 @@ var htmlCodeBlock = {
|
|
|
2705
2412
|
|
|
2706
2413
|
// src/blocks/image.tsx
|
|
2707
2414
|
var import_state3 = require("@tiptap/pm/state");
|
|
2708
|
-
var
|
|
2709
|
-
var
|
|
2415
|
+
var import_lucide_react5 = require("lucide-react");
|
|
2416
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2710
2417
|
var image = {
|
|
2711
2418
|
title: "Image",
|
|
2712
2419
|
description: "Full width image",
|
|
2713
2420
|
searchTerms: ["image"],
|
|
2714
|
-
icon: /* @__PURE__ */ (0,
|
|
2421
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2715
2422
|
command: ({ editor, range }) => {
|
|
2716
2423
|
editor.chain().focus().deleteRange(range).setImage({ src: "" }).run();
|
|
2717
2424
|
}
|
|
@@ -2720,7 +2427,7 @@ var logo = {
|
|
|
2720
2427
|
title: "Logo",
|
|
2721
2428
|
description: "Add your brand logo",
|
|
2722
2429
|
searchTerms: ["image", "logo"],
|
|
2723
|
-
icon: /* @__PURE__ */ (0,
|
|
2430
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2724
2431
|
command: ({ editor, range }) => {
|
|
2725
2432
|
editor.chain().focus().deleteRange(range).setLogoImage({ src: "" }).run();
|
|
2726
2433
|
}
|
|
@@ -2729,7 +2436,7 @@ var inlineImage = {
|
|
|
2729
2436
|
title: "Inline Image",
|
|
2730
2437
|
description: "Inline image",
|
|
2731
2438
|
searchTerms: ["image", "inline"],
|
|
2732
|
-
icon: /* @__PURE__ */ (0,
|
|
2439
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2733
2440
|
command: ({ editor, range }) => {
|
|
2734
2441
|
editor.chain().focus().deleteRange(range).setInlineImage({
|
|
2735
2442
|
src: "https://maily.to/brand/logo.png"
|
|
@@ -2752,13 +2459,13 @@ var inlineImage = {
|
|
|
2752
2459
|
};
|
|
2753
2460
|
|
|
2754
2461
|
// src/blocks/layout.tsx
|
|
2755
|
-
var
|
|
2756
|
-
var
|
|
2462
|
+
var import_lucide_react6 = require("lucide-react");
|
|
2463
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2757
2464
|
var columns = {
|
|
2758
2465
|
title: "Columns",
|
|
2759
2466
|
description: "Add columns to email.",
|
|
2760
2467
|
searchTerms: ["layout", "columns"],
|
|
2761
|
-
icon: /* @__PURE__ */ (0,
|
|
2468
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.ColumnsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2762
2469
|
command: ({ editor, range }) => {
|
|
2763
2470
|
editor.chain().focus().deleteRange(range).setColumns().focus(editor.state.selection.head - 2).run();
|
|
2764
2471
|
}
|
|
@@ -2767,7 +2474,7 @@ var section = {
|
|
|
2767
2474
|
title: "Section",
|
|
2768
2475
|
description: "Add a section to email.",
|
|
2769
2476
|
searchTerms: ["layout", "section"],
|
|
2770
|
-
icon: /* @__PURE__ */ (0,
|
|
2477
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.RectangleHorizontal, { className: "mly-h-4 mly-w-4" }),
|
|
2771
2478
|
command: ({ editor, range }) => {
|
|
2772
2479
|
editor.chain().focus().deleteRange(range).setSection().run();
|
|
2773
2480
|
}
|
|
@@ -2776,7 +2483,7 @@ var repeat = {
|
|
|
2776
2483
|
title: "Repeat",
|
|
2777
2484
|
description: "Loop over an array of items.",
|
|
2778
2485
|
searchTerms: ["repeat", "for", "loop"],
|
|
2779
|
-
icon: /* @__PURE__ */ (0,
|
|
2486
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.Repeat2, { className: "mly-h-4 mly-w-4" }),
|
|
2780
2487
|
command: ({ editor, range }) => {
|
|
2781
2488
|
editor.chain().focus().deleteRange(range).setRepeat().run();
|
|
2782
2489
|
}
|
|
@@ -2785,7 +2492,7 @@ var spacer = {
|
|
|
2785
2492
|
title: "Spacer",
|
|
2786
2493
|
description: "Add space between blocks.",
|
|
2787
2494
|
searchTerms: ["space", "gap", "divider"],
|
|
2788
|
-
icon: /* @__PURE__ */ (0,
|
|
2495
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.MoveVertical, { className: "mly-h-4 mly-w-4" }),
|
|
2789
2496
|
command: ({ editor, range }) => {
|
|
2790
2497
|
editor.chain().focus().deleteRange(range).setSpacer({ height: "sm" }).run();
|
|
2791
2498
|
}
|
|
@@ -2794,20 +2501,20 @@ var divider = {
|
|
|
2794
2501
|
title: "Divider",
|
|
2795
2502
|
description: "Add a horizontal divider.",
|
|
2796
2503
|
searchTerms: ["divider", "line"],
|
|
2797
|
-
icon: /* @__PURE__ */ (0,
|
|
2504
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.Minus, { className: "mly-h-4 mly-w-4" }),
|
|
2798
2505
|
command: ({ editor, range }) => {
|
|
2799
2506
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
2800
2507
|
}
|
|
2801
2508
|
};
|
|
2802
2509
|
|
|
2803
2510
|
// src/blocks/list.tsx
|
|
2804
|
-
var
|
|
2805
|
-
var
|
|
2511
|
+
var import_lucide_react7 = require("lucide-react");
|
|
2512
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2806
2513
|
var bulletList = {
|
|
2807
2514
|
title: "Bullet List",
|
|
2808
2515
|
description: "Create a simple bullet list.",
|
|
2809
2516
|
searchTerms: ["unordered", "point"],
|
|
2810
|
-
icon: /* @__PURE__ */ (0,
|
|
2517
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.List, { className: "mly-h-4 mly-w-4" }),
|
|
2811
2518
|
command: ({ editor, range }) => {
|
|
2812
2519
|
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
2813
2520
|
}
|
|
@@ -2816,20 +2523,20 @@ var orderedList = {
|
|
|
2816
2523
|
title: "Numbered List",
|
|
2817
2524
|
description: "Create a list with numbering.",
|
|
2818
2525
|
searchTerms: ["ordered"],
|
|
2819
|
-
icon: /* @__PURE__ */ (0,
|
|
2526
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.ListOrdered, { className: "mly-h-4 mly-w-4" }),
|
|
2820
2527
|
command: ({ editor, range }) => {
|
|
2821
2528
|
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
2822
2529
|
}
|
|
2823
2530
|
};
|
|
2824
2531
|
|
|
2825
2532
|
// src/blocks/typography.tsx
|
|
2826
|
-
var
|
|
2827
|
-
var
|
|
2533
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2534
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2828
2535
|
var text = {
|
|
2829
2536
|
title: "Text",
|
|
2830
2537
|
description: "Just start typing with plain text.",
|
|
2831
2538
|
searchTerms: ["p", "paragraph"],
|
|
2832
|
-
icon: /* @__PURE__ */ (0,
|
|
2539
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Text, { className: "mly-h-4 mly-w-4" }),
|
|
2833
2540
|
command: ({ editor, range }) => {
|
|
2834
2541
|
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
2835
2542
|
}
|
|
@@ -2838,7 +2545,7 @@ var heading1 = {
|
|
|
2838
2545
|
title: "Heading 1",
|
|
2839
2546
|
description: "Big heading.",
|
|
2840
2547
|
searchTerms: ["h1", "title", "big", "large"],
|
|
2841
|
-
icon: /* @__PURE__ */ (0,
|
|
2548
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
2842
2549
|
command: ({ editor, range }) => {
|
|
2843
2550
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
2844
2551
|
}
|
|
@@ -2847,7 +2554,7 @@ var heading2 = {
|
|
|
2847
2554
|
title: "Heading 2",
|
|
2848
2555
|
description: "Medium heading.",
|
|
2849
2556
|
searchTerms: ["h2", "subtitle", "medium"],
|
|
2850
|
-
icon: /* @__PURE__ */ (0,
|
|
2557
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Heading2, { className: "mly-h-4 mly-w-4" }),
|
|
2851
2558
|
command: ({ editor, range }) => {
|
|
2852
2559
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
2853
2560
|
}
|
|
@@ -2856,7 +2563,7 @@ var heading3 = {
|
|
|
2856
2563
|
title: "Heading 3",
|
|
2857
2564
|
description: "Small heading.",
|
|
2858
2565
|
searchTerms: ["h3", "subtitle", "small"],
|
|
2859
|
-
icon: /* @__PURE__ */ (0,
|
|
2566
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Heading3, { className: "mly-h-4 mly-w-4" }),
|
|
2860
2567
|
command: ({ editor, range }) => {
|
|
2861
2568
|
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
2862
2569
|
}
|
|
@@ -2865,7 +2572,7 @@ var hardBreak = {
|
|
|
2865
2572
|
title: "Hard Break",
|
|
2866
2573
|
description: "Add a break between lines.",
|
|
2867
2574
|
searchTerms: ["break", "line"],
|
|
2868
|
-
icon: /* @__PURE__ */ (0,
|
|
2575
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.DivideIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2869
2576
|
command: ({ editor, range }) => {
|
|
2870
2577
|
editor.chain().focus().deleteRange(range).setHardBreak().run();
|
|
2871
2578
|
}
|
|
@@ -2874,7 +2581,7 @@ var blockquote = {
|
|
|
2874
2581
|
title: "Blockquote",
|
|
2875
2582
|
description: "Add blockquote.",
|
|
2876
2583
|
searchTerms: ["quote", "blockquote"],
|
|
2877
|
-
icon: /* @__PURE__ */ (0,
|
|
2584
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.TextQuote, { className: "mly-h-4 mly-w-4" }),
|
|
2878
2585
|
command: ({ editor, range }) => {
|
|
2879
2586
|
editor.chain().focus().deleteRange(range).toggleBlockquote().run();
|
|
2880
2587
|
}
|
|
@@ -2883,7 +2590,7 @@ var footer = {
|
|
|
2883
2590
|
title: "Footer",
|
|
2884
2591
|
description: "Add a footer text to email.",
|
|
2885
2592
|
searchTerms: ["footer", "text"],
|
|
2886
|
-
icon: /* @__PURE__ */ (0,
|
|
2593
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2887
2594
|
command: ({ editor, range }) => {
|
|
2888
2595
|
editor.chain().focus().deleteRange(range).setFooter().run();
|
|
2889
2596
|
}
|
|
@@ -2892,16 +2599,16 @@ var clearLine = {
|
|
|
2892
2599
|
title: "Clear Line",
|
|
2893
2600
|
description: "Clear the current line.",
|
|
2894
2601
|
searchTerms: ["clear", "line"],
|
|
2895
|
-
icon: /* @__PURE__ */ (0,
|
|
2602
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.EraserIcon, { className: "mly-h-4 mly-w-4" }),
|
|
2896
2603
|
command: ({ editor, range }) => {
|
|
2897
2604
|
editor.chain().focus().selectParentNode().deleteSelection().run();
|
|
2898
2605
|
}
|
|
2899
2606
|
};
|
|
2900
2607
|
|
|
2901
2608
|
// src/editor/components/icons/logo-with-cover-image.tsx
|
|
2902
|
-
var
|
|
2609
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2903
2610
|
function LogoWithCoverImageIcon(props) {
|
|
2904
|
-
return /* @__PURE__ */ (0,
|
|
2611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2905
2612
|
"svg",
|
|
2906
2613
|
__spreadProps(__spreadValues({
|
|
2907
2614
|
width: "14",
|
|
@@ -2911,7 +2618,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
2911
2618
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2912
2619
|
}, props), {
|
|
2913
2620
|
children: [
|
|
2914
|
-
/* @__PURE__ */ (0,
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2915
2622
|
"path",
|
|
2916
2623
|
{
|
|
2917
2624
|
fillRule: "evenodd",
|
|
@@ -2920,7 +2627,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
2920
2627
|
fill: "currentColor"
|
|
2921
2628
|
}
|
|
2922
2629
|
),
|
|
2923
|
-
/* @__PURE__ */ (0,
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2924
2631
|
"path",
|
|
2925
2632
|
{
|
|
2926
2633
|
fillRule: "evenodd",
|
|
@@ -2929,7 +2636,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
2929
2636
|
fill: "currentColor"
|
|
2930
2637
|
}
|
|
2931
2638
|
),
|
|
2932
|
-
/* @__PURE__ */ (0,
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2933
2640
|
"path",
|
|
2934
2641
|
{
|
|
2935
2642
|
fillRule: "evenodd",
|
|
@@ -2938,8 +2645,8 @@ function LogoWithCoverImageIcon(props) {
|
|
|
2938
2645
|
fill: "currentColor"
|
|
2939
2646
|
}
|
|
2940
2647
|
),
|
|
2941
|
-
/* @__PURE__ */ (0,
|
|
2942
|
-
/* @__PURE__ */ (0,
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("mask", { id: "path-4-inside-1_1046_19527", fill: "white", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "3", y: "4", width: "8", height: "3", rx: "0.5" }) }),
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2943
2650
|
"rect",
|
|
2944
2651
|
{
|
|
2945
2652
|
x: "3",
|
|
@@ -2952,7 +2659,7 @@ function LogoWithCoverImageIcon(props) {
|
|
|
2952
2659
|
mask: "url(#path-4-inside-1_1046_19527)"
|
|
2953
2660
|
}
|
|
2954
2661
|
),
|
|
2955
|
-
/* @__PURE__ */ (0,
|
|
2662
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2956
2663
|
"rect",
|
|
2957
2664
|
{
|
|
2958
2665
|
x: "6.25",
|
|
@@ -2964,16 +2671,16 @@ function LogoWithCoverImageIcon(props) {
|
|
|
2964
2671
|
strokeWidth: "0.5"
|
|
2965
2672
|
}
|
|
2966
2673
|
),
|
|
2967
|
-
/* @__PURE__ */ (0,
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "3", y: "8", width: "2", height: "1", rx: "0.5", fill: "currentColor" })
|
|
2968
2675
|
]
|
|
2969
2676
|
})
|
|
2970
2677
|
);
|
|
2971
2678
|
}
|
|
2972
2679
|
|
|
2973
2680
|
// src/editor/components/icons/logo-with-text-horizon.tsx
|
|
2974
|
-
var
|
|
2681
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2975
2682
|
function LogoWithTextHorizonIcon(props) {
|
|
2976
|
-
return /* @__PURE__ */ (0,
|
|
2683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2977
2684
|
"svg",
|
|
2978
2685
|
__spreadProps(__spreadValues({
|
|
2979
2686
|
width: "14",
|
|
@@ -2983,7 +2690,7 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
2983
2690
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2984
2691
|
}, props), {
|
|
2985
2692
|
children: [
|
|
2986
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2987
2694
|
"path",
|
|
2988
2695
|
{
|
|
2989
2696
|
fillRule: "evenodd",
|
|
@@ -2992,7 +2699,7 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
2992
2699
|
fill: "currentColor"
|
|
2993
2700
|
}
|
|
2994
2701
|
),
|
|
2995
|
-
/* @__PURE__ */ (0,
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2996
2703
|
"rect",
|
|
2997
2704
|
{
|
|
2998
2705
|
x: "6.25",
|
|
@@ -3004,8 +2711,8 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
3004
2711
|
strokeWidth: "0.5"
|
|
3005
2712
|
}
|
|
3006
2713
|
),
|
|
3007
|
-
/* @__PURE__ */ (0,
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "3", y: "6.5", width: "2", height: "1", rx: "0.5", fill: "currentColor" }),
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3009
2716
|
"path",
|
|
3010
2717
|
{
|
|
3011
2718
|
fillRule: "evenodd",
|
|
@@ -3014,7 +2721,7 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
3014
2721
|
fill: "currentColor"
|
|
3015
2722
|
}
|
|
3016
2723
|
),
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3018
2725
|
"path",
|
|
3019
2726
|
{
|
|
3020
2727
|
fillRule: "evenodd",
|
|
@@ -3029,9 +2736,9 @@ function LogoWithTextHorizonIcon(props) {
|
|
|
3029
2736
|
}
|
|
3030
2737
|
|
|
3031
2738
|
// src/editor/components/icons/logo-with-text-vertical.tsx
|
|
3032
|
-
var
|
|
2739
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3033
2740
|
function LogoWithTextVerticalIcon(props) {
|
|
3034
|
-
return /* @__PURE__ */ (0,
|
|
2741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3035
2742
|
"svg",
|
|
3036
2743
|
__spreadProps(__spreadValues({
|
|
3037
2744
|
width: "14",
|
|
@@ -3041,7 +2748,7 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
3041
2748
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3042
2749
|
}, props), {
|
|
3043
2750
|
children: [
|
|
3044
|
-
/* @__PURE__ */ (0,
|
|
2751
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3045
2752
|
"path",
|
|
3046
2753
|
{
|
|
3047
2754
|
fillRule: "evenodd",
|
|
@@ -3050,7 +2757,7 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
3050
2757
|
fill: "currentColor"
|
|
3051
2758
|
}
|
|
3052
2759
|
),
|
|
3053
|
-
/* @__PURE__ */ (0,
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3054
2761
|
"rect",
|
|
3055
2762
|
{
|
|
3056
2763
|
x: "4.25",
|
|
@@ -3062,8 +2769,8 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
3062
2769
|
strokeWidth: "0.5"
|
|
3063
2770
|
}
|
|
3064
2771
|
),
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3066
|
-
/* @__PURE__ */ (0,
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "6", y: "6", width: "2", height: "1", rx: "0.5", fill: "currentColor" }),
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3067
2774
|
"path",
|
|
3068
2775
|
{
|
|
3069
2776
|
fillRule: "evenodd",
|
|
@@ -3072,7 +2779,7 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
3072
2779
|
fill: "currentColor"
|
|
3073
2780
|
}
|
|
3074
2781
|
),
|
|
3075
|
-
/* @__PURE__ */ (0,
|
|
2782
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3076
2783
|
"path",
|
|
3077
2784
|
{
|
|
3078
2785
|
fillRule: "evenodd",
|
|
@@ -3087,12 +2794,12 @@ function LogoWithTextVerticalIcon(props) {
|
|
|
3087
2794
|
}
|
|
3088
2795
|
|
|
3089
2796
|
// src/blocks/headers.tsx
|
|
3090
|
-
var
|
|
2797
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3091
2798
|
var headerLogoWithTextHorizontal = {
|
|
3092
2799
|
title: "Logo with Text (Horizontal)",
|
|
3093
2800
|
description: "Logo and a text horizontally",
|
|
3094
2801
|
searchTerms: ["logo", "text"],
|
|
3095
|
-
icon: /* @__PURE__ */ (0,
|
|
2802
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LogoWithTextHorizonIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3096
2803
|
command: ({ editor, range }) => {
|
|
3097
2804
|
editor.chain().deleteRange(range).insertContent({
|
|
3098
2805
|
type: "columns",
|
|
@@ -3156,7 +2863,7 @@ var headerLogoWithTextVertical = {
|
|
|
3156
2863
|
title: "Logo with Text (Vertical)",
|
|
3157
2864
|
description: "Logo and a text vertically",
|
|
3158
2865
|
searchTerms: ["logo", "text"],
|
|
3159
|
-
icon: /* @__PURE__ */ (0,
|
|
2866
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LogoWithTextVerticalIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3160
2867
|
command: ({ editor, range }) => {
|
|
3161
2868
|
editor.chain().deleteRange(range).insertContent([
|
|
3162
2869
|
{
|
|
@@ -3187,7 +2894,7 @@ var headerLogoWithCoverImage = {
|
|
|
3187
2894
|
title: "Logo with Cover Image",
|
|
3188
2895
|
description: "Logo and a cover image",
|
|
3189
2896
|
searchTerms: ["logo", "cover", "image"],
|
|
3190
|
-
icon: /* @__PURE__ */ (0,
|
|
2897
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LogoWithCoverImageIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3191
2898
|
command: ({ editor, range }) => {
|
|
3192
2899
|
const todayFormatted = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
3193
2900
|
year: "numeric",
|
|
@@ -3275,13 +2982,13 @@ var headerLogoWithCoverImage = {
|
|
|
3275
2982
|
};
|
|
3276
2983
|
|
|
3277
2984
|
// src/blocks/footers.tsx
|
|
3278
|
-
var
|
|
3279
|
-
var
|
|
2985
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2986
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3280
2987
|
var footerCopyrightText = {
|
|
3281
2988
|
title: "Footer Copyright",
|
|
3282
2989
|
description: "Copyright text for the footer.",
|
|
3283
2990
|
searchTerms: ["footer", "copyright"],
|
|
3284
|
-
icon: /* @__PURE__ */ (0,
|
|
2991
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react9.CopyrightIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3285
2992
|
command: ({ editor, range }) => {
|
|
3286
2993
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
3287
2994
|
editor.chain().focus().deleteRange(range).insertContent({
|
|
@@ -3301,7 +3008,7 @@ var footerCommunityFeedbackCta = {
|
|
|
3301
3008
|
title: "Footer Community Feedback CTA",
|
|
3302
3009
|
description: "Community feedback CTA for the footer.",
|
|
3303
3010
|
searchTerms: ["footer", "community", "feedback", "cta"],
|
|
3304
|
-
icon: /* @__PURE__ */ (0,
|
|
3011
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react9.RectangleHorizontalIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3305
3012
|
command: ({ editor, range }) => {
|
|
3306
3013
|
editor.chain().focus().deleteRange(range).insertContent([
|
|
3307
3014
|
{
|
|
@@ -3344,7 +3051,7 @@ var footerCompanySignature = {
|
|
|
3344
3051
|
title: "Footer Company Signature",
|
|
3345
3052
|
description: "Company signature for the footer.",
|
|
3346
3053
|
searchTerms: ["footer", "company", "signature"],
|
|
3347
|
-
icon: /* @__PURE__ */ (0,
|
|
3054
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react9.LayoutTemplateIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3348
3055
|
command: ({ editor, range }) => {
|
|
3349
3056
|
editor.chain().focus().deleteRange(range).insertContent([
|
|
3350
3057
|
{ type: "horizontalRule" },
|
|
@@ -3498,7 +3205,7 @@ var footerCompanySignature = {
|
|
|
3498
3205
|
};
|
|
3499
3206
|
|
|
3500
3207
|
// src/editor/extensions/slash-command/default-slash-commands.tsx
|
|
3501
|
-
var
|
|
3208
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3502
3209
|
var DEFAULT_SLASH_COMMANDS = [
|
|
3503
3210
|
{
|
|
3504
3211
|
title: "Blocks",
|
|
@@ -3533,7 +3240,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
3533
3240
|
title: "Headers",
|
|
3534
3241
|
description: "Add pre-designed headers block",
|
|
3535
3242
|
searchTerms: ["header", "headers"],
|
|
3536
|
-
icon: /* @__PURE__ */ (0,
|
|
3243
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react10.Heading1, { className: "mly-h-4 mly-w-4" }),
|
|
3537
3244
|
preview: "https://cdn.usemaily.com/previews/header-preview-xyz.png",
|
|
3538
3245
|
commands: [
|
|
3539
3246
|
headerLogoWithTextVertical,
|
|
@@ -3546,7 +3253,7 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
3546
3253
|
title: "Footers",
|
|
3547
3254
|
description: "Add pre-designed footers block",
|
|
3548
3255
|
searchTerms: ["footers"],
|
|
3549
|
-
icon: /* @__PURE__ */ (0,
|
|
3256
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react10.FootprintsIcon, { className: "mly-h-4 mly-w-4" }),
|
|
3550
3257
|
commands: [
|
|
3551
3258
|
footerCopyrightText,
|
|
3552
3259
|
footerCommunityFeedbackCta,
|
|
@@ -3559,38 +3266,190 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
3559
3266
|
];
|
|
3560
3267
|
|
|
3561
3268
|
// src/editor/provider.tsx
|
|
3562
|
-
var
|
|
3269
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3563
3270
|
var DEFAULT_PLACEHOLDER_URL = "https://maily.to/";
|
|
3564
|
-
var MailyContext = (0,
|
|
3271
|
+
var MailyContext = (0, import_react11.createContext)({
|
|
3565
3272
|
placeholderUrl: DEFAULT_PLACEHOLDER_URL,
|
|
3566
3273
|
blocks: DEFAULT_SLASH_COMMANDS
|
|
3567
3274
|
});
|
|
3568
3275
|
function useMailyContext() {
|
|
3569
|
-
const values = (0,
|
|
3276
|
+
const values = (0, import_react11.useContext)(MailyContext);
|
|
3570
3277
|
if (!values) {
|
|
3571
3278
|
throw new Error("Missing MailyContext.Provider in the component tree");
|
|
3572
3279
|
}
|
|
3573
3280
|
return values;
|
|
3574
3281
|
}
|
|
3575
3282
|
|
|
3283
|
+
// src/editor/utils/node-options.ts
|
|
3284
|
+
var import_react12 = require("react");
|
|
3285
|
+
function getNodeOptions(editor, name) {
|
|
3286
|
+
const node = editor.extensionManager.extensions.find(
|
|
3287
|
+
(extension) => extension.name === name
|
|
3288
|
+
);
|
|
3289
|
+
if (!node) {
|
|
3290
|
+
throw new Error(`Node ${name} not found`);
|
|
3291
|
+
}
|
|
3292
|
+
return node.options;
|
|
3293
|
+
}
|
|
3294
|
+
function getVariableOptions(editor) {
|
|
3295
|
+
return getNodeOptions(editor, "variable");
|
|
3296
|
+
}
|
|
3297
|
+
function useVariableOptions(editor) {
|
|
3298
|
+
return (0, import_react12.useMemo)(() => {
|
|
3299
|
+
return getVariableOptions(editor);
|
|
3300
|
+
}, [editor]);
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
// src/editor/utils/use-outside-click.ts
|
|
3304
|
+
var import_react13 = require("react");
|
|
3305
|
+
var import_react14 = require("react");
|
|
3306
|
+
function useOutsideClick(ref, callback) {
|
|
3307
|
+
const handleClick = (0, import_react13.useCallback)(
|
|
3308
|
+
(e) => {
|
|
3309
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
3310
|
+
callback();
|
|
3311
|
+
}
|
|
3312
|
+
},
|
|
3313
|
+
[ref, callback]
|
|
3314
|
+
);
|
|
3315
|
+
(0, import_react14.useEffect)(() => {
|
|
3316
|
+
document.addEventListener("mousedown", handleClick);
|
|
3317
|
+
document.addEventListener("touchstart", handleClick);
|
|
3318
|
+
return () => {
|
|
3319
|
+
document.removeEventListener("mousedown", handleClick);
|
|
3320
|
+
document.removeEventListener("touchstart", handleClick);
|
|
3321
|
+
};
|
|
3322
|
+
}, [handleClick]);
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
// src/editor/components/ui/input-autocomplete.tsx
|
|
3326
|
+
var import_lucide_react11 = require("lucide-react");
|
|
3327
|
+
var import_react15 = require("react");
|
|
3328
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3329
|
+
var InputAutocomplete = (0, import_react15.forwardRef)((props, ref) => {
|
|
3330
|
+
var _b;
|
|
3331
|
+
const _a = props, {
|
|
3332
|
+
value = "",
|
|
3333
|
+
onValueChange,
|
|
3334
|
+
className,
|
|
3335
|
+
onOutsideClick,
|
|
3336
|
+
onSelectOption,
|
|
3337
|
+
autoCompleteOptions = [],
|
|
3338
|
+
triggerChar = "",
|
|
3339
|
+
editor
|
|
3340
|
+
} = _a, inputProps = __objRest(_a, [
|
|
3341
|
+
"value",
|
|
3342
|
+
"onValueChange",
|
|
3343
|
+
"className",
|
|
3344
|
+
"onOutsideClick",
|
|
3345
|
+
"onSelectOption",
|
|
3346
|
+
"autoCompleteOptions",
|
|
3347
|
+
"triggerChar",
|
|
3348
|
+
"editor"
|
|
3349
|
+
]);
|
|
3350
|
+
const containerRef = (0, import_react15.useRef)(null);
|
|
3351
|
+
const popoverRef = (0, import_react15.useRef)(null);
|
|
3352
|
+
const VariableSuggestionPopoverComponent = (_b = useVariableOptions(editor)) == null ? void 0 : _b.variableSuggestionsPopover;
|
|
3353
|
+
useOutsideClick(containerRef, () => {
|
|
3354
|
+
onOutsideClick == null ? void 0 : onOutsideClick();
|
|
3355
|
+
});
|
|
3356
|
+
const isTriggeringVariable = value.startsWith(triggerChar);
|
|
3357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("mly-relative"), ref: containerRef, children: [
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "mly-relative", children: [
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3360
|
+
"input",
|
|
3361
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
3362
|
+
placeholder: "e.g. items",
|
|
3363
|
+
type: "text"
|
|
3364
|
+
}), inputProps), {
|
|
3365
|
+
ref,
|
|
3366
|
+
value,
|
|
3367
|
+
onChange: (e) => {
|
|
3368
|
+
onValueChange(e.target.value);
|
|
3369
|
+
},
|
|
3370
|
+
className: cn(
|
|
3371
|
+
"mly-h-7 mly-w-40 mly-rounded-md mly-bg-white mly-px-2 mly-pr-6 mly-text-sm mly-text-midnight-gray hover:mly-bg-soft-gray focus:mly-bg-soft-gray focus:mly-outline-none",
|
|
3372
|
+
className
|
|
3373
|
+
),
|
|
3374
|
+
onKeyDown: (e) => {
|
|
3375
|
+
if (!popoverRef.current || !isTriggeringVariable) {
|
|
3376
|
+
return;
|
|
3377
|
+
}
|
|
3378
|
+
const { moveUp, moveDown, select } = popoverRef.current;
|
|
3379
|
+
if (e.key === "ArrowDown") {
|
|
3380
|
+
e.preventDefault();
|
|
3381
|
+
moveDown();
|
|
3382
|
+
} else if (e.key === "ArrowUp") {
|
|
3383
|
+
e.preventDefault();
|
|
3384
|
+
moveUp();
|
|
3385
|
+
} else if (e.key === "Enter") {
|
|
3386
|
+
e.preventDefault();
|
|
3387
|
+
select();
|
|
3388
|
+
}
|
|
3389
|
+
},
|
|
3390
|
+
spellCheck: false
|
|
3391
|
+
})
|
|
3392
|
+
),
|
|
3393
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react11.CornerDownLeft, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
3394
|
+
] }),
|
|
3395
|
+
isTriggeringVariable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mly-absolute mly-left-0 mly-top-8", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3396
|
+
VariableSuggestionPopoverComponent,
|
|
3397
|
+
{
|
|
3398
|
+
items: autoCompleteOptions.map((option) => {
|
|
3399
|
+
return {
|
|
3400
|
+
name: option
|
|
3401
|
+
};
|
|
3402
|
+
}),
|
|
3403
|
+
onSelectItem: (item) => {
|
|
3404
|
+
onSelectOption == null ? void 0 : onSelectOption(item.name);
|
|
3405
|
+
},
|
|
3406
|
+
ref: popoverRef
|
|
3407
|
+
}
|
|
3408
|
+
) })
|
|
3409
|
+
] });
|
|
3410
|
+
});
|
|
3411
|
+
InputAutocomplete.displayName = "InputAutocomplete";
|
|
3412
|
+
|
|
3413
|
+
// src/editor/utils/variable.ts
|
|
3414
|
+
function processVariables(variables, options) {
|
|
3415
|
+
const { query } = options;
|
|
3416
|
+
const queryLower = query.toLowerCase();
|
|
3417
|
+
let filteredVariables = [];
|
|
3418
|
+
if (Array.isArray(variables)) {
|
|
3419
|
+
filteredVariables = variables.filter(
|
|
3420
|
+
(variable) => variable.name.toLowerCase().startsWith(queryLower)
|
|
3421
|
+
);
|
|
3422
|
+
if (query.length > 0 && !filteredVariables.some((variable) => variable.name === query)) {
|
|
3423
|
+
filteredVariables.push({ name: query, required: true });
|
|
3424
|
+
}
|
|
3425
|
+
return filteredVariables;
|
|
3426
|
+
} else if (typeof variables === "function") {
|
|
3427
|
+
return variables(options);
|
|
3428
|
+
} else {
|
|
3429
|
+
throw new Error(`Invalid variables type. Expected 'Array' or 'Function', but received '${typeof variables}'.
|
|
3430
|
+
|
|
3431
|
+
You can check out the documentation for more information: https://github.com/arikchakma/maily.to/blob/main/packages/core/readme.md`);
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
|
|
3576
3435
|
// src/editor/components/ui/link-input-popover.tsx
|
|
3577
|
-
var
|
|
3436
|
+
var import_react21 = require("react");
|
|
3578
3437
|
|
|
3579
3438
|
// src/editor/nodes/variable/variable.ts
|
|
3580
3439
|
var import_core11 = require("@tiptap/core");
|
|
3581
3440
|
var import_state4 = require("@tiptap/pm/state");
|
|
3582
|
-
var
|
|
3441
|
+
var import_react19 = require("@tiptap/react");
|
|
3583
3442
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
3584
3443
|
|
|
3585
3444
|
// src/editor/nodes/variable/variable-suggestions-popover.tsx
|
|
3586
|
-
var
|
|
3587
|
-
var
|
|
3588
|
-
var
|
|
3589
|
-
var VariableSuggestionsPopover = (0,
|
|
3445
|
+
var import_lucide_react12 = require("lucide-react");
|
|
3446
|
+
var import_react16 = require("react");
|
|
3447
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3448
|
+
var VariableSuggestionsPopover = (0, import_react16.forwardRef)((props, ref) => {
|
|
3590
3449
|
const { items, onSelectItem } = props;
|
|
3591
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3592
|
-
const scrollContainerRef = (0,
|
|
3593
|
-
const itemRefs = (0,
|
|
3450
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react16.useState)(0);
|
|
3451
|
+
const scrollContainerRef = (0, import_react16.useRef)(null);
|
|
3452
|
+
const itemRefs = (0, import_react16.useRef)([]);
|
|
3594
3453
|
const scrollSelectedIntoView = (index) => {
|
|
3595
3454
|
const container = scrollContainerRef.current;
|
|
3596
3455
|
const selectedItem = itemRefs.current[index];
|
|
@@ -3606,17 +3465,17 @@ var VariableSuggestionsPopover = (0, import_react17.forwardRef)((props, ref) =>
|
|
|
3606
3465
|
container.scrollTop += itemRect.top - containerRect.top - padding;
|
|
3607
3466
|
}
|
|
3608
3467
|
};
|
|
3609
|
-
(0,
|
|
3468
|
+
(0, import_react16.useEffect)(() => {
|
|
3610
3469
|
setSelectedIndex(0);
|
|
3611
3470
|
if (scrollContainerRef.current) {
|
|
3612
3471
|
scrollContainerRef.current.scrollTop = 0;
|
|
3613
3472
|
}
|
|
3614
3473
|
itemRefs.current = items.map(() => null);
|
|
3615
3474
|
}, [items]);
|
|
3616
|
-
(0,
|
|
3475
|
+
(0, import_react16.useEffect)(() => {
|
|
3617
3476
|
scrollSelectedIntoView(selectedIndex);
|
|
3618
3477
|
}, [selectedIndex]);
|
|
3619
|
-
(0,
|
|
3478
|
+
(0, import_react16.useImperativeHandle)(ref, () => ({
|
|
3620
3479
|
moveUp: () => {
|
|
3621
3480
|
setSelectedIndex((selectedIndex + items.length - 1) % items.length);
|
|
3622
3481
|
},
|
|
@@ -3631,17 +3490,17 @@ var VariableSuggestionsPopover = (0, import_react17.forwardRef)((props, ref) =>
|
|
|
3631
3490
|
onSelectItem(item);
|
|
3632
3491
|
}
|
|
3633
3492
|
}));
|
|
3634
|
-
return /* @__PURE__ */ (0,
|
|
3635
|
-
/* @__PURE__ */ (0,
|
|
3636
|
-
/* @__PURE__ */ (0,
|
|
3637
|
-
/* @__PURE__ */ (0,
|
|
3493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.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: [
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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: [
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "mly-text-xs mly-uppercase", children: "Variables" }),
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react12.Braces, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
3638
3497
|
] }),
|
|
3639
|
-
/* @__PURE__ */ (0,
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3640
3499
|
"div",
|
|
3641
3500
|
{
|
|
3642
3501
|
ref: scrollContainerRef,
|
|
3643
3502
|
className: "mly-max-h-52 mly-overflow-y-auto mly-scrollbar-thin mly-scrollbar-track-transparent mly-scrollbar-thumb-gray-200",
|
|
3644
|
-
children: /* @__PURE__ */ (0,
|
|
3503
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsxs)(
|
|
3645
3504
|
"button",
|
|
3646
3505
|
{
|
|
3647
3506
|
ref: (el) => itemRefs.current[index] = el,
|
|
@@ -3651,27 +3510,27 @@ var VariableSuggestionsPopover = (0, import_react17.forwardRef)((props, ref) =>
|
|
|
3651
3510
|
index === selectedIndex ? "mly-bg-soft-gray" : "mly-bg-white"
|
|
3652
3511
|
),
|
|
3653
3512
|
children: [
|
|
3654
|
-
/* @__PURE__ */ (0,
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react12.Braces, { className: "mly-size-3 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
3655
3514
|
item.name
|
|
3656
3515
|
]
|
|
3657
3516
|
},
|
|
3658
3517
|
index
|
|
3659
|
-
)) : /* @__PURE__ */ (0,
|
|
3518
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime27.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" }) })
|
|
3660
3519
|
}
|
|
3661
3520
|
),
|
|
3662
|
-
/* @__PURE__ */ (0,
|
|
3663
|
-
/* @__PURE__ */ (0,
|
|
3664
|
-
/* @__PURE__ */ (0,
|
|
3665
|
-
/* @__PURE__ */ (0,
|
|
3666
|
-
/* @__PURE__ */ (0,
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.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: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mly-flex mly-items-center mly-gap-1", children: [
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react12.ArrowDownIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react12.ArrowUpIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) }),
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "mly-text-xs mly-text-gray-500", children: "Navigate" })
|
|
3667
3526
|
] }),
|
|
3668
|
-
/* @__PURE__ */ (0,
|
|
3527
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VariableIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react12.CornerDownLeftIcon, { className: "mly-size-3 mly-stroke-[2.5]" }) })
|
|
3669
3528
|
] })
|
|
3670
3529
|
] });
|
|
3671
3530
|
});
|
|
3672
3531
|
function VariableIcon(props) {
|
|
3673
3532
|
const { className, children } = props;
|
|
3674
|
-
return /* @__PURE__ */ (0,
|
|
3533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3675
3534
|
"div",
|
|
3676
3535
|
{
|
|
3677
3536
|
className: cn(
|
|
@@ -3684,37 +3543,37 @@ function VariableIcon(props) {
|
|
|
3684
3543
|
}
|
|
3685
3544
|
|
|
3686
3545
|
// src/editor/nodes/variable/variable-view.tsx
|
|
3687
|
-
var
|
|
3688
|
-
var
|
|
3689
|
-
var
|
|
3690
|
-
var
|
|
3546
|
+
var import_react17 = require("@tiptap/react");
|
|
3547
|
+
var import_lucide_react13 = require("lucide-react");
|
|
3548
|
+
var import_react18 = require("react");
|
|
3549
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3691
3550
|
function VariableView(props) {
|
|
3692
3551
|
const { node, updateAttributes: updateAttributes2, editor } = props;
|
|
3693
3552
|
const { id, fallback, required } = node.attrs;
|
|
3694
|
-
const renderVariable = (0,
|
|
3553
|
+
const renderVariable = (0, import_react18.useMemo)(() => {
|
|
3695
3554
|
var _a, _b;
|
|
3696
3555
|
const variableRender = (_b = (_a = getNodeOptions(editor, "variable")) == null ? void 0 : _a.renderVariable) != null ? _b : DEFAULT_RENDER_VARIABLE_FUNCTION;
|
|
3697
3556
|
return variableRender;
|
|
3698
3557
|
}, [editor]);
|
|
3699
|
-
return /* @__PURE__ */ (0,
|
|
3700
|
-
|
|
3558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3559
|
+
import_react17.NodeViewWrapper,
|
|
3701
3560
|
{
|
|
3702
3561
|
className: "react-component mly-inline-block mly-leading-none",
|
|
3703
3562
|
draggable: "false",
|
|
3704
|
-
children: /* @__PURE__ */ (0,
|
|
3563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3705
3564
|
Popover,
|
|
3706
3565
|
{
|
|
3707
3566
|
onOpenChange: (open) => {
|
|
3708
3567
|
editor.storage.variable.popover = open;
|
|
3709
3568
|
},
|
|
3710
3569
|
children: [
|
|
3711
|
-
/* @__PURE__ */ (0,
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PopoverTrigger, { children: renderVariable({
|
|
3712
3571
|
variable: { name: id, required, valid: true },
|
|
3713
3572
|
fallback,
|
|
3714
3573
|
editor,
|
|
3715
3574
|
from: "content-variable"
|
|
3716
3575
|
}) }),
|
|
3717
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3718
3577
|
PopoverContent,
|
|
3719
3578
|
{
|
|
3720
3579
|
align: "start",
|
|
@@ -3723,10 +3582,10 @@ function VariableView(props) {
|
|
|
3723
3582
|
sideOffset: 8,
|
|
3724
3583
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3725
3584
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
3726
|
-
children: /* @__PURE__ */ (0,
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
3728
|
-
/* @__PURE__ */ (0,
|
|
3729
|
-
/* @__PURE__ */ (0,
|
|
3585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "mly-relative", children: [
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "mly-inline-block mly-px-2 mly-text-xs mly-text-midnight-gray", children: "Variable" }),
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3730
3589
|
"input",
|
|
3731
3590
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
3732
3591
|
value: id != null ? id : "",
|
|
@@ -3740,10 +3599,10 @@ function VariableView(props) {
|
|
|
3740
3599
|
})
|
|
3741
3600
|
)
|
|
3742
3601
|
] }),
|
|
3743
|
-
/* @__PURE__ */ (0,
|
|
3744
|
-
/* @__PURE__ */ (0,
|
|
3745
|
-
/* @__PURE__ */ (0,
|
|
3746
|
-
/* @__PURE__ */ (0,
|
|
3602
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Divider, { className: "mly-mx-1.5" }),
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "mly-relative", children: [
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "mly-inline-block mly-px-2 mly-pl-1 mly-text-xs mly-text-midnight-gray", children: "Default" }),
|
|
3605
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3747
3606
|
"input",
|
|
3748
3607
|
__spreadProps(__spreadValues({}, AUTOCOMPLETE_PASSWORD_MANAGERS_OFF), {
|
|
3749
3608
|
value: fallback != null ? fallback : "",
|
|
@@ -3756,7 +3615,7 @@ function VariableView(props) {
|
|
|
3756
3615
|
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"
|
|
3757
3616
|
})
|
|
3758
3617
|
),
|
|
3759
|
-
/* @__PURE__ */ (0,
|
|
3618
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-right-1 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react13.Pencil, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) })
|
|
3760
3619
|
] })
|
|
3761
3620
|
] }) })
|
|
3762
3621
|
}
|
|
@@ -3771,13 +3630,13 @@ var DefaultRenderVariable = (props) => {
|
|
|
3771
3630
|
const { variable, fallback, from } = props;
|
|
3772
3631
|
const { name, required, valid } = variable;
|
|
3773
3632
|
if (from === "button-variable") {
|
|
3774
|
-
return /* @__PURE__ */ (0,
|
|
3775
|
-
/* @__PURE__ */ (0,
|
|
3776
|
-
/* @__PURE__ */ (0,
|
|
3633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.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: [
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react13.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5]" }),
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
3777
3636
|
] });
|
|
3778
3637
|
}
|
|
3779
3638
|
if (from === "bubble-variable") {
|
|
3780
|
-
return /* @__PURE__ */ (0,
|
|
3639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3781
3640
|
"div",
|
|
3782
3641
|
{
|
|
3783
3642
|
className: cn(
|
|
@@ -3785,21 +3644,21 @@ var DefaultRenderVariable = (props) => {
|
|
|
3785
3644
|
!valid && "mly-border-rose-400 mly-bg-rose-50 mly-text-rose-600 hover:mly-bg-rose-100"
|
|
3786
3645
|
),
|
|
3787
3646
|
children: [
|
|
3788
|
-
/* @__PURE__ */ (0,
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3647
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react13.Braces, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
3648
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "mly-min-w-0 mly-truncate mly-text-left", children: name })
|
|
3790
3649
|
]
|
|
3791
3650
|
}
|
|
3792
3651
|
);
|
|
3793
3652
|
}
|
|
3794
|
-
return /* @__PURE__ */ (0,
|
|
3653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3795
3654
|
"span",
|
|
3796
3655
|
{
|
|
3797
3656
|
tabIndex: -1,
|
|
3798
3657
|
className: "mly-inline-flex mly-items-center mly-gap-[var(--variable-icon-gap)] mly-rounded-full mly-border mly-border-gray-200 mly-px-1.5 mly-py-0.5 mly-leading-none",
|
|
3799
3658
|
children: [
|
|
3800
|
-
/* @__PURE__ */ (0,
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react13.Braces, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5] mly-text-rose-600" }),
|
|
3801
3660
|
name,
|
|
3802
|
-
required && !fallback && /* @__PURE__ */ (0,
|
|
3661
|
+
required && !fallback && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react13.AlertTriangle, { className: "mly-size-[var(--variable-icon-size)] mly-shrink-0 mly-stroke-[2.5]" })
|
|
3803
3662
|
]
|
|
3804
3663
|
}
|
|
3805
3664
|
);
|
|
@@ -3968,7 +3827,7 @@ var VariableExtension = import_core11.Node.create({
|
|
|
3968
3827
|
];
|
|
3969
3828
|
},
|
|
3970
3829
|
addNodeView() {
|
|
3971
|
-
return (0,
|
|
3830
|
+
return (0, import_react19.ReactNodeViewRenderer)(VariableView, {
|
|
3972
3831
|
className: "mly-relative mly-inline-block",
|
|
3973
3832
|
as: "div"
|
|
3974
3833
|
});
|
|
@@ -3976,26 +3835,26 @@ var VariableExtension = import_core11.Node.create({
|
|
|
3976
3835
|
});
|
|
3977
3836
|
|
|
3978
3837
|
// src/editor/components/ui/link-input-popover.tsx
|
|
3979
|
-
var
|
|
3838
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3980
3839
|
function LinkInputPopover(props) {
|
|
3981
3840
|
var _a, _b;
|
|
3982
3841
|
const {
|
|
3983
3842
|
defaultValue = "",
|
|
3984
3843
|
onValueChange,
|
|
3985
3844
|
tooltip,
|
|
3986
|
-
icon: Icon =
|
|
3845
|
+
icon: Icon = import_lucide_react14.Link,
|
|
3987
3846
|
editor,
|
|
3988
3847
|
isVariable
|
|
3989
3848
|
} = props;
|
|
3990
|
-
const [isOpen, setIsOpen] = (0,
|
|
3991
|
-
const [isEditing, setIsEditing] = (0,
|
|
3992
|
-
const linkInputRef = (0,
|
|
3849
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
3850
|
+
const [isEditing, setIsEditing] = (0, import_react20.useState)(!isVariable);
|
|
3851
|
+
const linkInputRef = (0, import_react20.useRef)(null);
|
|
3993
3852
|
const { placeholderUrl = DEFAULT_PLACEHOLDER_URL } = useMailyContext();
|
|
3994
3853
|
const options = useVariableOptions(editor);
|
|
3995
3854
|
const renderVariable = options == null ? void 0 : options.renderVariable;
|
|
3996
3855
|
const variables = options == null ? void 0 : options.variables;
|
|
3997
3856
|
const variableTriggerCharacter = (_b = (_a = options == null ? void 0 : options.suggestion) == null ? void 0 : _a.char) != null ? _b : DEFAULT_VARIABLE_TRIGGER_CHAR;
|
|
3998
|
-
const autoCompleteOptions = (0,
|
|
3857
|
+
const autoCompleteOptions = (0, import_react21.useMemo)(() => {
|
|
3999
3858
|
const withoutTrigger = defaultValue.replace(
|
|
4000
3859
|
new RegExp(variableTriggerCharacter, "g"),
|
|
4001
3860
|
""
|
|
@@ -4006,7 +3865,7 @@ function LinkInputPopover(props) {
|
|
|
4006
3865
|
editor
|
|
4007
3866
|
}).map((variable) => variable.name);
|
|
4008
3867
|
}, [variables, variableTriggerCharacter, defaultValue, editor]);
|
|
4009
|
-
const popoverButton = /* @__PURE__ */ (0,
|
|
3868
|
+
const popoverButton = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4010
3869
|
BaseButton,
|
|
4011
3870
|
{
|
|
4012
3871
|
variant: "ghost",
|
|
@@ -4014,10 +3873,10 @@ function LinkInputPopover(props) {
|
|
|
4014
3873
|
type: "button",
|
|
4015
3874
|
className: "!mly-size-7",
|
|
4016
3875
|
"data-state": !!defaultValue,
|
|
4017
|
-
children: /* @__PURE__ */ (0,
|
|
3876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { className: "mly-h-3 mly-w-3 mly-shrink-0 mly-stroke-[2.5] mly-text-midnight-gray" })
|
|
4018
3877
|
}
|
|
4019
3878
|
) });
|
|
4020
|
-
return /* @__PURE__ */ (0,
|
|
3879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4021
3880
|
Popover,
|
|
4022
3881
|
{
|
|
4023
3882
|
open: isOpen,
|
|
@@ -4031,11 +3890,11 @@ function LinkInputPopover(props) {
|
|
|
4031
3890
|
}
|
|
4032
3891
|
},
|
|
4033
3892
|
children: [
|
|
4034
|
-
tooltip ? /* @__PURE__ */ (0,
|
|
4035
|
-
/* @__PURE__ */ (0,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
3893
|
+
tooltip ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3894
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { asChild: true, children: popoverButton }),
|
|
3895
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
4037
3896
|
] }) : popoverButton,
|
|
4038
|
-
/* @__PURE__ */ (0,
|
|
3897
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4039
3898
|
PopoverContent,
|
|
4040
3899
|
{
|
|
4041
3900
|
align: "end",
|
|
@@ -4043,7 +3902,7 @@ function LinkInputPopover(props) {
|
|
|
4043
3902
|
className: "mly-w-max mly-rounded-none mly-border-none mly-bg-transparent !mly-p-0 mly-shadow-none",
|
|
4044
3903
|
sideOffset: 8,
|
|
4045
3904
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
4046
|
-
children: /* @__PURE__ */ (0,
|
|
3905
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4047
3906
|
"form",
|
|
4048
3907
|
{
|
|
4049
3908
|
onSubmit: (e) => {
|
|
@@ -4055,8 +3914,8 @@ function LinkInputPopover(props) {
|
|
|
4055
3914
|
onValueChange == null ? void 0 : onValueChange(input.value);
|
|
4056
3915
|
setIsOpen(false);
|
|
4057
3916
|
},
|
|
4058
|
-
children: /* @__PURE__ */ (0,
|
|
4059
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
3917
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
3918
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsx)(
|
|
4060
3919
|
"button",
|
|
4061
3920
|
{
|
|
4062
3921
|
onClick: () => {
|
|
@@ -4077,9 +3936,9 @@ function LinkInputPopover(props) {
|
|
|
4077
3936
|
})
|
|
4078
3937
|
}
|
|
4079
3938
|
) }),
|
|
4080
|
-
isEditing && /* @__PURE__ */ (0,
|
|
4081
|
-
/* @__PURE__ */ (0,
|
|
4082
|
-
/* @__PURE__ */ (0,
|
|
3939
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mly-relative", children: [
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "mly-absolute mly-inset-y-0 mly-left-1.5 mly-z-10 mly-flex mly-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.LinkIcon, { className: "mly-h-3 mly-w-3 mly-stroke-[2.5] mly-text-midnight-gray" }) }),
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4083
3942
|
InputAutocomplete,
|
|
4084
3943
|
{
|
|
4085
3944
|
editor,
|
|
@@ -4115,9 +3974,9 @@ function LinkInputPopover(props) {
|
|
|
4115
3974
|
}
|
|
4116
3975
|
|
|
4117
3976
|
// src/editor/components/ui/select.tsx
|
|
4118
|
-
var
|
|
4119
|
-
var
|
|
4120
|
-
var
|
|
3977
|
+
var import_react22 = require("react");
|
|
3978
|
+
var import_lucide_react15 = require("lucide-react");
|
|
3979
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4121
3980
|
function Select(props) {
|
|
4122
3981
|
const {
|
|
4123
3982
|
label,
|
|
@@ -4129,11 +3988,11 @@ function Select(props) {
|
|
|
4129
3988
|
icon: Icon,
|
|
4130
3989
|
iconClassName
|
|
4131
3990
|
} = props;
|
|
4132
|
-
const selectId = `mly${(0,
|
|
4133
|
-
const content = /* @__PURE__ */ (0,
|
|
4134
|
-
/* @__PURE__ */ (0,
|
|
4135
|
-
Icon && /* @__PURE__ */ (0,
|
|
4136
|
-
/* @__PURE__ */ (0,
|
|
3991
|
+
const selectId = `mly${(0, import_react22.useId)()}`;
|
|
3992
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mly-relative", children: [
|
|
3993
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { htmlFor: selectId, className: "mly-sr-only", children: label }),
|
|
3994
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)(Icon, { className: cn("mly-size-3", iconClassName) }) }),
|
|
3995
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4137
3996
|
"select",
|
|
4138
3997
|
{
|
|
4139
3998
|
id: selectId,
|
|
@@ -4144,11 +4003,11 @@ function Select(props) {
|
|
|
4144
4003
|
),
|
|
4145
4004
|
value,
|
|
4146
4005
|
onChange: (event) => onValueChange(event.target.value),
|
|
4147
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
4006
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
4148
4007
|
}
|
|
4149
4008
|
),
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4151
|
-
|
|
4009
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)(
|
|
4010
|
+
import_lucide_react15.ChevronDownIcon,
|
|
4152
4011
|
{
|
|
4153
4012
|
size: 16,
|
|
4154
4013
|
strokeWidth: 2,
|
|
@@ -4160,30 +4019,30 @@ function Select(props) {
|
|
|
4160
4019
|
if (!tooltip) {
|
|
4161
4020
|
return content;
|
|
4162
4021
|
}
|
|
4163
|
-
return /* @__PURE__ */ (0,
|
|
4164
|
-
/* @__PURE__ */ (0,
|
|
4165
|
-
/* @__PURE__ */ (0,
|
|
4022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Tooltip, { children: [
|
|
4023
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TooltipTrigger, { asChild: true, children: content }),
|
|
4024
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TooltipContent, { sideOffset: 8, children: tooltip })
|
|
4166
4025
|
] });
|
|
4167
4026
|
}
|
|
4168
4027
|
|
|
4169
4028
|
// src/editor/nodes/button/button-view.tsx
|
|
4170
|
-
var
|
|
4171
|
-
var
|
|
4029
|
+
var import_react24 = require("@tiptap/react");
|
|
4030
|
+
var import_react25 = require("react");
|
|
4172
4031
|
|
|
4173
4032
|
// src/editor/nodes/button/button-label-input.tsx
|
|
4174
|
-
var
|
|
4175
|
-
var
|
|
4033
|
+
var import_react23 = require("react");
|
|
4034
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4176
4035
|
function ButtonLabelInput(props) {
|
|
4177
4036
|
var _a, _b;
|
|
4178
4037
|
const { value, onValueChange, isVariable, editor } = props;
|
|
4179
|
-
const linkInputRef = (0,
|
|
4180
|
-
const [isEditing, setIsEditing] = (0,
|
|
4038
|
+
const linkInputRef = (0, import_react23.useRef)(null);
|
|
4039
|
+
const [isEditing, setIsEditing] = (0, import_react23.useState)(!isVariable);
|
|
4181
4040
|
const { placeholderUrl = DEFAULT_PLACEHOLDER_URL } = useMailyContext();
|
|
4182
4041
|
const otps = useVariableOptions(editor);
|
|
4183
4042
|
const variables = otps == null ? void 0 : otps.variables;
|
|
4184
4043
|
const variableTriggerCharacter = (_b = (_a = otps == null ? void 0 : otps.suggestion) == null ? void 0 : _a.char) != null ? _b : DEFAULT_VARIABLE_TRIGGER_CHAR;
|
|
4185
4044
|
const renderVariable = otps == null ? void 0 : otps.renderVariable;
|
|
4186
|
-
const autoCompleteOptions = (0,
|
|
4045
|
+
const autoCompleteOptions = (0, import_react23.useMemo)(() => {
|
|
4187
4046
|
const withoutTrigger = value.replace(
|
|
4188
4047
|
new RegExp(variableTriggerCharacter, "g"),
|
|
4189
4048
|
""
|
|
@@ -4194,8 +4053,8 @@ function ButtonLabelInput(props) {
|
|
|
4194
4053
|
editor
|
|
4195
4054
|
}).map((variable) => variable.name);
|
|
4196
4055
|
}, [variables, value, editor]);
|
|
4197
|
-
return /* @__PURE__ */ (0,
|
|
4198
|
-
!isEditing && /* @__PURE__ */ (0,
|
|
4056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mly-isolate mly-flex mly-rounded-lg", children: [
|
|
4057
|
+
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4199
4058
|
"button",
|
|
4200
4059
|
{
|
|
4201
4060
|
onClick: () => {
|
|
@@ -4216,7 +4075,7 @@ function ButtonLabelInput(props) {
|
|
|
4216
4075
|
})
|
|
4217
4076
|
}
|
|
4218
4077
|
),
|
|
4219
|
-
isEditing && /* @__PURE__ */ (0,
|
|
4078
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4220
4079
|
InputAutocomplete,
|
|
4221
4080
|
{
|
|
4222
4081
|
editor,
|
|
@@ -4243,7 +4102,7 @@ function ButtonLabelInput(props) {
|
|
|
4243
4102
|
}
|
|
4244
4103
|
|
|
4245
4104
|
// src/editor/nodes/button/button-view.tsx
|
|
4246
|
-
var
|
|
4105
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4247
4106
|
function ButtonView(props) {
|
|
4248
4107
|
const { node, editor, getPos, updateAttributes: updateAttributes2 } = props;
|
|
4249
4108
|
const {
|
|
@@ -4264,7 +4123,7 @@ function ButtonView(props) {
|
|
|
4264
4123
|
} = node.attrs;
|
|
4265
4124
|
const opts = useVariableOptions(editor);
|
|
4266
4125
|
const renderVariable = opts == null ? void 0 : opts.renderVariable;
|
|
4267
|
-
const sizes = (0,
|
|
4126
|
+
const sizes = (0, import_react25.useMemo)(
|
|
4268
4127
|
() => ({
|
|
4269
4128
|
small: {
|
|
4270
4129
|
paddingX: 24,
|
|
@@ -4281,14 +4140,14 @@ function ButtonView(props) {
|
|
|
4281
4140
|
}),
|
|
4282
4141
|
[]
|
|
4283
4142
|
);
|
|
4284
|
-
const size = (0,
|
|
4143
|
+
const size = (0, import_react25.useMemo)(() => {
|
|
4285
4144
|
var _a;
|
|
4286
4145
|
return (_a = Object.entries(sizes).find(
|
|
4287
4146
|
([, { paddingX, paddingY }]) => paddingRight === paddingX && paddingTop === paddingY
|
|
4288
4147
|
)) == null ? void 0 : _a[0];
|
|
4289
4148
|
}, [paddingRight, paddingTop, sizes]);
|
|
4290
|
-
return /* @__PURE__ */ (0,
|
|
4291
|
-
|
|
4149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4150
|
+
import_react24.NodeViewWrapper,
|
|
4292
4151
|
{
|
|
4293
4152
|
draggable: editor.isEditable,
|
|
4294
4153
|
"data-drag-handle": editor.isEditable,
|
|
@@ -4296,8 +4155,8 @@ function ButtonView(props) {
|
|
|
4296
4155
|
style: {
|
|
4297
4156
|
textAlign: alignment
|
|
4298
4157
|
},
|
|
4299
|
-
children: /* @__PURE__ */ (0,
|
|
4300
|
-
/* @__PURE__ */ (0,
|
|
4158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Popover, { open: props.selected && editor.isEditable, children: [
|
|
4159
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4301
4160
|
"button",
|
|
4302
4161
|
{
|
|
4303
4162
|
className: cn(
|
|
@@ -4340,7 +4199,7 @@ function ButtonView(props) {
|
|
|
4340
4199
|
}) : text2
|
|
4341
4200
|
}
|
|
4342
4201
|
) }) }),
|
|
4343
|
-
/* @__PURE__ */ (0,
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4344
4203
|
PopoverContent,
|
|
4345
4204
|
{
|
|
4346
4205
|
align: "end",
|
|
@@ -4349,8 +4208,8 @@ function ButtonView(props) {
|
|
|
4349
4208
|
sideOffset: 8,
|
|
4350
4209
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
4351
4210
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
4352
|
-
children: /* @__PURE__ */ (0,
|
|
4353
|
-
/* @__PURE__ */ (0,
|
|
4211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mly-flex mly-items-stretch mly-text-midnight-gray", children: [
|
|
4212
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4354
4213
|
ButtonLabelInput,
|
|
4355
4214
|
{
|
|
4356
4215
|
value: text2,
|
|
@@ -4364,9 +4223,9 @@ function ButtonView(props) {
|
|
|
4364
4223
|
editor
|
|
4365
4224
|
}
|
|
4366
4225
|
),
|
|
4367
|
-
/* @__PURE__ */ (0,
|
|
4368
|
-
/* @__PURE__ */ (0,
|
|
4369
|
-
/* @__PURE__ */ (0,
|
|
4226
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, {}),
|
|
4227
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
4228
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4370
4229
|
Select,
|
|
4371
4230
|
{
|
|
4372
4231
|
label: "Border Radius",
|
|
@@ -4384,7 +4243,7 @@ function ButtonView(props) {
|
|
|
4384
4243
|
className: "mly-capitalize"
|
|
4385
4244
|
}
|
|
4386
4245
|
),
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4388
4247
|
Select,
|
|
4389
4248
|
{
|
|
4390
4249
|
label: "Style",
|
|
@@ -4402,7 +4261,7 @@ function ButtonView(props) {
|
|
|
4402
4261
|
className: "mly-capitalize"
|
|
4403
4262
|
}
|
|
4404
4263
|
),
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4406
4265
|
Select,
|
|
4407
4266
|
{
|
|
4408
4267
|
label: "Size",
|
|
@@ -4425,9 +4284,9 @@ function ButtonView(props) {
|
|
|
4425
4284
|
}
|
|
4426
4285
|
)
|
|
4427
4286
|
] }),
|
|
4428
|
-
/* @__PURE__ */ (0,
|
|
4429
|
-
/* @__PURE__ */ (0,
|
|
4430
|
-
/* @__PURE__ */ (0,
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, {}),
|
|
4288
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
4289
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4431
4290
|
AlignmentSwitch,
|
|
4432
4291
|
{
|
|
4433
4292
|
alignment,
|
|
@@ -4438,7 +4297,7 @@ function ButtonView(props) {
|
|
|
4438
4297
|
}
|
|
4439
4298
|
}
|
|
4440
4299
|
),
|
|
4441
|
-
/* @__PURE__ */ (0,
|
|
4300
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4442
4301
|
LinkInputPopover,
|
|
4443
4302
|
{
|
|
4444
4303
|
defaultValue: externalLink || "",
|
|
@@ -4454,9 +4313,9 @@ function ButtonView(props) {
|
|
|
4454
4313
|
}
|
|
4455
4314
|
)
|
|
4456
4315
|
] }),
|
|
4457
|
-
/* @__PURE__ */ (0,
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
4459
|
-
/* @__PURE__ */ (0,
|
|
4316
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, {}),
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mly-flex mly-space-x-0.5", children: [
|
|
4318
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4460
4319
|
BackgroundColorPickerPopup,
|
|
4461
4320
|
{
|
|
4462
4321
|
variant,
|
|
@@ -4468,7 +4327,7 @@ function ButtonView(props) {
|
|
|
4468
4327
|
}
|
|
4469
4328
|
}
|
|
4470
4329
|
),
|
|
4471
|
-
/* @__PURE__ */ (0,
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4472
4331
|
TextColorPickerPopup,
|
|
4473
4332
|
{
|
|
4474
4333
|
color: textColor,
|
|
@@ -4479,20 +4338,7 @@ function ButtonView(props) {
|
|
|
4479
4338
|
}
|
|
4480
4339
|
}
|
|
4481
4340
|
)
|
|
4482
|
-
] })
|
|
4483
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Divider, {}),
|
|
4484
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4485
|
-
ShowPopover,
|
|
4486
|
-
{
|
|
4487
|
-
showIfKey,
|
|
4488
|
-
onShowIfKeyValueChange: (value) => {
|
|
4489
|
-
updateAttributes2({
|
|
4490
|
-
showIfKey: value
|
|
4491
|
-
});
|
|
4492
|
-
},
|
|
4493
|
-
editor
|
|
4494
|
-
}
|
|
4495
|
-
)
|
|
4341
|
+
] })
|
|
4496
4342
|
] }) })
|
|
4497
4343
|
}
|
|
4498
4344
|
)
|
|
@@ -4502,20 +4348,20 @@ function ButtonView(props) {
|
|
|
4502
4348
|
}
|
|
4503
4349
|
function BackgroundColorPickerPopup(props) {
|
|
4504
4350
|
const { color, onChange, variant } = props;
|
|
4505
|
-
return /* @__PURE__ */ (0,
|
|
4351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4506
4352
|
ColorPicker,
|
|
4507
4353
|
{
|
|
4508
4354
|
color,
|
|
4509
4355
|
onColorChange: onChange,
|
|
4510
4356
|
tooltip: "Background Color",
|
|
4511
|
-
children: /* @__PURE__ */ (0,
|
|
4357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4512
4358
|
BaseButton,
|
|
4513
4359
|
{
|
|
4514
4360
|
variant: "ghost",
|
|
4515
4361
|
size: "sm",
|
|
4516
4362
|
type: "button",
|
|
4517
4363
|
className: "mly-size-7",
|
|
4518
|
-
children: /* @__PURE__ */ (0,
|
|
4364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4519
4365
|
"div",
|
|
4520
4366
|
{
|
|
4521
4367
|
className: "mly-h-4 mly-w-4 mly-shrink-0 mly-rounded-full mly-shadow",
|
|
@@ -4534,16 +4380,16 @@ function BackgroundColorPickerPopup(props) {
|
|
|
4534
4380
|
}
|
|
4535
4381
|
function TextColorPickerPopup(props) {
|
|
4536
4382
|
const { color, onChange } = props;
|
|
4537
|
-
return /* @__PURE__ */ (0,
|
|
4383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ColorPicker, { color, onColorChange: onChange, tooltip: "Text Color", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4538
4384
|
BaseButton,
|
|
4539
4385
|
{
|
|
4540
4386
|
variant: "ghost",
|
|
4541
4387
|
size: "sm",
|
|
4542
4388
|
type: "button",
|
|
4543
4389
|
className: "mly-size-7",
|
|
4544
|
-
children: /* @__PURE__ */ (0,
|
|
4545
|
-
/* @__PURE__ */ (0,
|
|
4546
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mly-flex mly-flex-col mly-items-center mly-justify-center mly-gap-[1px]", children: [
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "mly-font-bolder mly-font-mono mly-text-xs mly-text-midnight-gray", children: "A" }),
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4547
4393
|
"div",
|
|
4548
4394
|
{
|
|
4549
4395
|
className: "mly-h-[2px] mly-w-3 mly-shrink-0 mly-rounded-md mly-shadow",
|
|
@@ -4782,7 +4628,7 @@ var ButtonExtension = import_core12.Node.create({
|
|
|
4782
4628
|
};
|
|
4783
4629
|
},
|
|
4784
4630
|
addNodeView() {
|
|
4785
|
-
return (0,
|
|
4631
|
+
return (0, import_react26.ReactNodeViewRenderer)(ButtonView, {
|
|
4786
4632
|
contentDOMElementTag: "div",
|
|
4787
4633
|
className: "mly-relative"
|
|
4788
4634
|
});
|
|
@@ -4791,7 +4637,7 @@ var ButtonExtension = import_core12.Node.create({
|
|
|
4791
4637
|
|
|
4792
4638
|
// src/editor/nodes/image/image.ts
|
|
4793
4639
|
var import_extension_image2 = __toESM(require("@tiptap/extension-image"), 1);
|
|
4794
|
-
var
|
|
4640
|
+
var import_react27 = require("@tiptap/react");
|
|
4795
4641
|
var DEFAULT_IMAGE_BORDER_RADIUS = 0;
|
|
4796
4642
|
var ImageExtension = import_extension_image2.default.extend({
|
|
4797
4643
|
addAttributes() {
|
|
@@ -4929,7 +4775,7 @@ var ImageExtension = import_extension_image2.default.extend({
|
|
|
4929
4775
|
});
|
|
4930
4776
|
},
|
|
4931
4777
|
addNodeView() {
|
|
4932
|
-
return (0,
|
|
4778
|
+
return (0, import_react27.ReactNodeViewRenderer)(ImageView, {
|
|
4933
4779
|
className: "mly-relative"
|
|
4934
4780
|
});
|
|
4935
4781
|
}
|
|
@@ -5006,24 +4852,24 @@ var ParagraphExtension = import_extension_paragraph.default.extend({
|
|
|
5006
4852
|
|
|
5007
4853
|
// src/editor/nodes/repeat/repeat.ts
|
|
5008
4854
|
var import_core13 = require("@tiptap/core");
|
|
5009
|
-
var
|
|
4855
|
+
var import_react29 = require("@tiptap/react");
|
|
5010
4856
|
|
|
5011
4857
|
// src/editor/nodes/repeat/repeat-view.tsx
|
|
5012
|
-
var
|
|
5013
|
-
var
|
|
5014
|
-
var
|
|
4858
|
+
var import_react28 = require("@tiptap/react");
|
|
4859
|
+
var import_lucide_react16 = require("lucide-react");
|
|
4860
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5015
4861
|
function RepeatView(props) {
|
|
5016
4862
|
const { editor, getPos } = props;
|
|
5017
|
-
return /* @__PURE__ */ (0,
|
|
5018
|
-
|
|
4863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
4864
|
+
import_react28.NodeViewWrapper,
|
|
5019
4865
|
{
|
|
5020
4866
|
"data-type": "repeat",
|
|
5021
4867
|
draggable: editor.isEditable,
|
|
5022
4868
|
"data-drag-handle": editor.isEditable,
|
|
5023
4869
|
className: "mly-relative",
|
|
5024
4870
|
children: [
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5026
|
-
/* @__PURE__ */ (0,
|
|
4871
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.NodeViewContent, { className: "is-editable" }),
|
|
4872
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5027
4873
|
"div",
|
|
5028
4874
|
{
|
|
5029
4875
|
role: "button",
|
|
@@ -5034,8 +4880,8 @@ function RepeatView(props) {
|
|
|
5034
4880
|
editor.commands.setNodeSelection(getPos());
|
|
5035
4881
|
},
|
|
5036
4882
|
children: [
|
|
5037
|
-
/* @__PURE__ */ (0,
|
|
5038
|
-
/* @__PURE__ */ (0,
|
|
4883
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react16.Repeat2, { className: "mly-size-3 mly-stroke-[2.5] mly-text-midnight-gray" }),
|
|
4884
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "mly-w-[1.5px] mly-grow mly-rounded-full mly-bg-rose-300" })
|
|
5039
4885
|
]
|
|
5040
4886
|
}
|
|
5041
4887
|
)
|
|
@@ -5119,7 +4965,7 @@ var RepeatExtension = import_core13.Node.create({
|
|
|
5119
4965
|
};
|
|
5120
4966
|
},
|
|
5121
4967
|
addNodeView() {
|
|
5122
|
-
return (0,
|
|
4968
|
+
return (0, import_react29.ReactNodeViewRenderer)(RepeatView, {
|
|
5123
4969
|
contentDOMElementTag: "div",
|
|
5124
4970
|
className: "mly-relative"
|
|
5125
4971
|
});
|
|
@@ -5276,14 +5122,14 @@ var SlashCommandExtension = import_core15.Extension.create({
|
|
|
5276
5122
|
});
|
|
5277
5123
|
|
|
5278
5124
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
5279
|
-
var
|
|
5280
|
-
var
|
|
5125
|
+
var import_react31 = require("@tiptap/react");
|
|
5126
|
+
var import_react32 = require("react");
|
|
5281
5127
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
5282
5128
|
|
|
5283
5129
|
// src/editor/extensions/slash-command/slash-command-item.tsx
|
|
5284
|
-
var
|
|
5285
|
-
var
|
|
5286
|
-
var
|
|
5130
|
+
var import_lucide_react17 = require("lucide-react");
|
|
5131
|
+
var import_react30 = require("react");
|
|
5132
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5287
5133
|
function SlashCommandItem(props) {
|
|
5288
5134
|
var _a;
|
|
5289
5135
|
const {
|
|
@@ -5298,7 +5144,7 @@ function SlashCommandItem(props) {
|
|
|
5298
5144
|
hoveredItemKey,
|
|
5299
5145
|
onHover
|
|
5300
5146
|
} = props;
|
|
5301
|
-
const [open, setOpen] = (0,
|
|
5147
|
+
const [open, setOpen] = (0, import_react30.useState)(false);
|
|
5302
5148
|
const isActive = groupIndex === selectedGroupIndex && commandIndex === selectedCommandIndex;
|
|
5303
5149
|
const itemKey = `${groupIndex}-${commandIndex}`;
|
|
5304
5150
|
const isHovered = hoveredItemKey === itemKey;
|
|
@@ -5306,19 +5152,19 @@ function SlashCommandItem(props) {
|
|
|
5306
5152
|
const shouldOpenTooltip = !!(item == null ? void 0 : item.preview) && (isHovered || isActive && !hoveredItemKey);
|
|
5307
5153
|
const hasRenderFunction = typeof item.render === "function";
|
|
5308
5154
|
const renderFunctionValue = hasRenderFunction ? (_a = item.render) == null ? void 0 : _a.call(item, editor) : null;
|
|
5309
|
-
let value = /* @__PURE__ */ (0,
|
|
5310
|
-
/* @__PURE__ */ (0,
|
|
5311
|
-
/* @__PURE__ */ (0,
|
|
5312
|
-
/* @__PURE__ */ (0,
|
|
5313
|
-
/* @__PURE__ */ (0,
|
|
5155
|
+
let value = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
5156
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mly-flex mly-h-6 mly-w-6 mly-shrink-0 mly-items-center mly-justify-center", children: item.icon }),
|
|
5157
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "mly-grow", children: [
|
|
5158
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "mly-font-medium", children: item.title }),
|
|
5159
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "mly-text-xs mly-text-gray-400", children: item.description })
|
|
5314
5160
|
] }),
|
|
5315
|
-
isSubCommand2 && /* @__PURE__ */ (0,
|
|
5161
|
+
isSubCommand2 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "mly-block mly-px-1 mly-text-gray-400", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react17.ChevronRightIcon, { className: "mly-size-3.5 mly-stroke-[2.5]" }) })
|
|
5316
5162
|
] });
|
|
5317
5163
|
if (renderFunctionValue !== null && renderFunctionValue !== true) {
|
|
5318
5164
|
value = renderFunctionValue;
|
|
5319
5165
|
}
|
|
5320
|
-
const openTimerRef = (0,
|
|
5321
|
-
const handleDelayedOpen = (0,
|
|
5166
|
+
const openTimerRef = (0, import_react30.useRef)(0);
|
|
5167
|
+
const handleDelayedOpen = (0, import_react30.useCallback)(() => {
|
|
5322
5168
|
window.clearTimeout(openTimerRef.current);
|
|
5323
5169
|
const delay = 200;
|
|
5324
5170
|
openTimerRef.current = window.setTimeout(() => {
|
|
@@ -5326,7 +5172,7 @@ function SlashCommandItem(props) {
|
|
|
5326
5172
|
openTimerRef.current = 0;
|
|
5327
5173
|
}, delay);
|
|
5328
5174
|
}, [setOpen]);
|
|
5329
|
-
(0,
|
|
5175
|
+
(0, import_react30.useEffect)(() => {
|
|
5330
5176
|
if (shouldOpenTooltip) {
|
|
5331
5177
|
handleDelayedOpen();
|
|
5332
5178
|
} else {
|
|
@@ -5335,7 +5181,7 @@ function SlashCommandItem(props) {
|
|
|
5335
5181
|
setOpen(false);
|
|
5336
5182
|
}
|
|
5337
5183
|
}, [shouldOpenTooltip]);
|
|
5338
|
-
(0,
|
|
5184
|
+
(0, import_react30.useEffect)(() => {
|
|
5339
5185
|
return () => {
|
|
5340
5186
|
if (openTimerRef.current) {
|
|
5341
5187
|
window.clearTimeout(openTimerRef.current);
|
|
@@ -5343,8 +5189,8 @@ function SlashCommandItem(props) {
|
|
|
5343
5189
|
}
|
|
5344
5190
|
};
|
|
5345
5191
|
}, []);
|
|
5346
|
-
return /* @__PURE__ */ (0,
|
|
5347
|
-
/* @__PURE__ */ (0,
|
|
5192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Tooltip, { open, children: [
|
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5348
5194
|
"button",
|
|
5349
5195
|
{
|
|
5350
5196
|
className: cn(
|
|
@@ -5359,14 +5205,14 @@ function SlashCommandItem(props) {
|
|
|
5359
5205
|
children: value
|
|
5360
5206
|
}
|
|
5361
5207
|
) }),
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5363
5209
|
TooltipContent,
|
|
5364
5210
|
{
|
|
5365
5211
|
side: "right",
|
|
5366
5212
|
sideOffset: 10,
|
|
5367
5213
|
className: "mly-w-52 mly-rounded-lg mly-border-none mly-p-1 mly-shadow",
|
|
5368
|
-
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0,
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
5214
|
+
children: typeof item.preview === "function" ? item == null ? void 0 : item.preview(editor) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
5215
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("figure", { className: "mly-relative mly-aspect-[2.5] mly-w-full mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5370
5216
|
"img",
|
|
5371
5217
|
{
|
|
5372
5218
|
src: item == null ? void 0 : item.preview,
|
|
@@ -5374,7 +5220,7 @@ function SlashCommandItem(props) {
|
|
|
5374
5220
|
className: "mly-absolute mly-inset-0 mly-h-full mly-w-full mly-object-cover"
|
|
5375
5221
|
}
|
|
5376
5222
|
) }),
|
|
5377
|
-
/* @__PURE__ */ (0,
|
|
5223
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "mly-mt-2 mly-px-0.5 mly-text-gray-500", children: item.description })
|
|
5378
5224
|
] })
|
|
5379
5225
|
}
|
|
5380
5226
|
)
|
|
@@ -5463,16 +5309,16 @@ function processCommand(options) {
|
|
|
5463
5309
|
}
|
|
5464
5310
|
|
|
5465
5311
|
// src/editor/extensions/slash-command/slash-command-view.tsx
|
|
5466
|
-
var
|
|
5467
|
-
var CommandList = (0,
|
|
5312
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5313
|
+
var CommandList = (0, import_react32.forwardRef)((props, ref) => {
|
|
5468
5314
|
const { items: groups, command, editor, range, query } = props;
|
|
5469
|
-
const [selectedGroupIndex, setSelectedGroupIndex] = (0,
|
|
5470
|
-
const [selectedCommandIndex, setSelectedCommandIndex] = (0,
|
|
5471
|
-
const [hoveredItemKey, setHoveredItemKey] = (0,
|
|
5472
|
-
const prevQuery = (0,
|
|
5473
|
-
const prevSelectedGroupIndex = (0,
|
|
5474
|
-
const prevSelectedCommandIndex = (0,
|
|
5475
|
-
const selectItem = (0,
|
|
5315
|
+
const [selectedGroupIndex, setSelectedGroupIndex] = (0, import_react32.useState)(0);
|
|
5316
|
+
const [selectedCommandIndex, setSelectedCommandIndex] = (0, import_react32.useState)(0);
|
|
5317
|
+
const [hoveredItemKey, setHoveredItemKey] = (0, import_react32.useState)(null);
|
|
5318
|
+
const prevQuery = (0, import_react32.useRef)("");
|
|
5319
|
+
const prevSelectedGroupIndex = (0, import_react32.useRef)(0);
|
|
5320
|
+
const prevSelectedCommandIndex = (0, import_react32.useRef)(0);
|
|
5321
|
+
const selectItem = (0, import_react32.useCallback)(
|
|
5476
5322
|
(groupIndex, commandIndex) => {
|
|
5477
5323
|
const item = groups[groupIndex].commands[commandIndex];
|
|
5478
5324
|
if (!item) {
|
|
@@ -5482,7 +5328,7 @@ var CommandList = (0, import_react33.forwardRef)((props, ref) => {
|
|
|
5482
5328
|
},
|
|
5483
5329
|
[command]
|
|
5484
5330
|
);
|
|
5485
|
-
(0,
|
|
5331
|
+
(0, import_react32.useImperativeHandle)(ref, () => ({
|
|
5486
5332
|
onKeyDown: ({ event }) => {
|
|
5487
5333
|
var _a, _b, _c, _d;
|
|
5488
5334
|
const navigationKeys = [
|
|
@@ -5570,9 +5416,9 @@ var CommandList = (0, import_react33.forwardRef)((props, ref) => {
|
|
|
5570
5416
|
}
|
|
5571
5417
|
}
|
|
5572
5418
|
}));
|
|
5573
|
-
const commandListContainer = (0,
|
|
5574
|
-
const activeCommandRef = (0,
|
|
5575
|
-
(0,
|
|
5419
|
+
const commandListContainer = (0, import_react32.useRef)(null);
|
|
5420
|
+
const activeCommandRef = (0, import_react32.useRef)(null);
|
|
5421
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
5576
5422
|
const container = commandListContainer == null ? void 0 : commandListContainer.current;
|
|
5577
5423
|
const activeCommandContainer = activeCommandRef == null ? void 0 : activeCommandRef.current;
|
|
5578
5424
|
if (!container || !activeCommandContainer) {
|
|
@@ -5587,11 +5433,11 @@ var CommandList = (0, import_react33.forwardRef)((props, ref) => {
|
|
|
5587
5433
|
commandListContainer,
|
|
5588
5434
|
activeCommandRef
|
|
5589
5435
|
]);
|
|
5590
|
-
(0,
|
|
5436
|
+
(0, import_react32.useEffect)(() => {
|
|
5591
5437
|
setSelectedGroupIndex(0);
|
|
5592
5438
|
setSelectedCommandIndex(0);
|
|
5593
5439
|
}, [groups]);
|
|
5594
|
-
(0,
|
|
5440
|
+
(0, import_react32.useEffect)(() => {
|
|
5595
5441
|
return () => {
|
|
5596
5442
|
prevQuery.current = "";
|
|
5597
5443
|
prevSelectedGroupIndex.current = 0;
|
|
@@ -5601,15 +5447,15 @@ var CommandList = (0, import_react33.forwardRef)((props, ref) => {
|
|
|
5601
5447
|
if (!groups || groups.length === 0) {
|
|
5602
5448
|
return null;
|
|
5603
5449
|
}
|
|
5604
|
-
return /* @__PURE__ */ (0,
|
|
5605
|
-
/* @__PURE__ */ (0,
|
|
5450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-z-50 mly-w-72 mly-overflow-hidden mly-rounded-md mly-border mly-border-gray-200 mly-bg-white mly-shadow-md mly-transition-all", children: [
|
|
5451
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5606
5452
|
"div",
|
|
5607
5453
|
{
|
|
5608
5454
|
id: "slash-command",
|
|
5609
5455
|
ref: commandListContainer,
|
|
5610
5456
|
className: "mly-no-scrollbar mly-h-auto mly-max-h-[330px] mly-overflow-y-auto",
|
|
5611
|
-
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0,
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5457
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react32.Fragment, { children: [
|
|
5458
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5613
5459
|
"span",
|
|
5614
5460
|
{
|
|
5615
5461
|
className: cn(
|
|
@@ -5619,9 +5465,9 @@ var CommandList = (0, import_react33.forwardRef)((props, ref) => {
|
|
|
5619
5465
|
children: group.title
|
|
5620
5466
|
}
|
|
5621
5467
|
),
|
|
5622
|
-
/* @__PURE__ */ (0,
|
|
5468
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-space-y-0.5 mly-p-1", children: group.commands.map((item, commandIndex) => {
|
|
5623
5469
|
const itemKey = `${groupIndex}-${commandIndex}`;
|
|
5624
|
-
return /* @__PURE__ */ (0,
|
|
5470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5625
5471
|
SlashCommandItem,
|
|
5626
5472
|
{
|
|
5627
5473
|
item,
|
|
@@ -5641,16 +5487,16 @@ var CommandList = (0, import_react33.forwardRef)((props, ref) => {
|
|
|
5641
5487
|
] }, groupIndex))
|
|
5642
5488
|
}
|
|
5643
5489
|
),
|
|
5644
|
-
/* @__PURE__ */ (0,
|
|
5645
|
-
/* @__PURE__ */ (0,
|
|
5646
|
-
/* @__PURE__ */ (0,
|
|
5647
|
-
/* @__PURE__ */ (0,
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mly-border-t mly-border-gray-200 mly-px-1 mly-py-3 mly-pl-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mly-flex mly-items-center", children: [
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
5492
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2191" }),
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-ml-1 mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-2 mly-font-medium", children: "\u2193" }),
|
|
5648
5494
|
" ",
|
|
5649
5495
|
"to navigate"
|
|
5650
5496
|
] }),
|
|
5651
|
-
/* @__PURE__ */ (0,
|
|
5652
|
-
/* @__PURE__ */ (0,
|
|
5653
|
-
/* @__PURE__ */ (0,
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", className: "mly-select-none mly-px-1", children: "\xB7" }),
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "mly-text-center mly-text-xs mly-text-gray-400", children: [
|
|
5499
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("kbd", { className: "mly-rounded mly-border mly-border-gray-200 mly-p-1 mly-px-1.5 mly-font-medium", children: "Enter" }),
|
|
5654
5500
|
" ",
|
|
5655
5501
|
"to select"
|
|
5656
5502
|
] })
|
|
@@ -5674,7 +5520,7 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
|
5674
5520
|
let popup = null;
|
|
5675
5521
|
return {
|
|
5676
5522
|
onStart: (props) => {
|
|
5677
|
-
component = new
|
|
5523
|
+
component = new import_react31.ReactRenderer(CommandList, {
|
|
5678
5524
|
props,
|
|
5679
5525
|
editor: props.editor
|
|
5680
5526
|
});
|
|
@@ -5727,16 +5573,16 @@ function getSlashCommandSuggestions(groups = DEFAULT_SLASH_COMMANDS) {
|
|
|
5727
5573
|
}
|
|
5728
5574
|
|
|
5729
5575
|
// src/editor/nodes/variable/variable-suggestions.tsx
|
|
5730
|
-
var
|
|
5731
|
-
var
|
|
5576
|
+
var import_react33 = require("@tiptap/react");
|
|
5577
|
+
var import_react34 = require("react");
|
|
5732
5578
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
5733
|
-
var
|
|
5734
|
-
var VariableList = (0,
|
|
5579
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5580
|
+
var VariableList = (0, import_react34.forwardRef)((props, ref) => {
|
|
5735
5581
|
var _a;
|
|
5736
5582
|
const { items = [], editor } = props;
|
|
5737
|
-
const popoverRef = (0,
|
|
5583
|
+
const popoverRef = (0, import_react34.useRef)(null);
|
|
5738
5584
|
const VariableSuggestionPopoverComponent = (_a = useVariableOptions(editor)) == null ? void 0 : _a.variableSuggestionsPopover;
|
|
5739
|
-
(0,
|
|
5585
|
+
(0, import_react34.useImperativeHandle)(ref, () => ({
|
|
5740
5586
|
onKeyDown: ({ event }) => {
|
|
5741
5587
|
if (!popoverRef.current) {
|
|
5742
5588
|
return false;
|
|
@@ -5759,7 +5605,7 @@ var VariableList = (0, import_react35.forwardRef)((props, ref) => {
|
|
|
5759
5605
|
return false;
|
|
5760
5606
|
}
|
|
5761
5607
|
}));
|
|
5762
|
-
return /* @__PURE__ */ (0,
|
|
5608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5763
5609
|
VariableSuggestionPopoverComponent,
|
|
5764
5610
|
{
|
|
5765
5611
|
items,
|
|
@@ -5792,7 +5638,7 @@ function getVariableSuggestions(char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
|
|
|
5792
5638
|
let popup = null;
|
|
5793
5639
|
return {
|
|
5794
5640
|
onStart: (props) => {
|
|
5795
|
-
component = new
|
|
5641
|
+
component = new import_react33.ReactRenderer(VariableList, {
|
|
5796
5642
|
props,
|
|
5797
5643
|
editor: props.editor
|
|
5798
5644
|
});
|
|
@@ -5842,20 +5688,20 @@ function getVariableSuggestions(char = DEFAULT_VARIABLE_TRIGGER_CHAR) {
|
|
|
5842
5688
|
// src/editor/nodes/html/html.tsx
|
|
5843
5689
|
var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
|
|
5844
5690
|
var import_state5 = require("@tiptap/pm/state");
|
|
5845
|
-
var
|
|
5691
|
+
var import_react37 = require("@tiptap/react");
|
|
5846
5692
|
var import_xml = __toESM(require("highlight.js/lib/languages/xml"), 1);
|
|
5847
5693
|
var import_lowlight = require("lowlight");
|
|
5848
5694
|
|
|
5849
5695
|
// src/editor/nodes/html/html-view.tsx
|
|
5850
|
-
var
|
|
5851
|
-
var
|
|
5852
|
-
var
|
|
5696
|
+
var import_react35 = require("@tiptap/react");
|
|
5697
|
+
var import_react36 = require("react");
|
|
5698
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5853
5699
|
function HTMLCodeBlockView(props) {
|
|
5854
5700
|
const { node, updateAttributes: updateAttributes2 } = props;
|
|
5855
5701
|
let { language, activeTab = "code" } = node.attrs;
|
|
5856
5702
|
activeTab || (activeTab = "code");
|
|
5857
5703
|
const languageClass = language ? `language-${language}` : "";
|
|
5858
|
-
const html2 = (0,
|
|
5704
|
+
const html2 = (0, import_react36.useMemo)(() => {
|
|
5859
5705
|
const text2 = node.content.content.reduce((acc, cur) => {
|
|
5860
5706
|
if (cur.type.name === "text") {
|
|
5861
5707
|
return acc + cur.text;
|
|
@@ -5874,21 +5720,21 @@ function HTMLCodeBlockView(props) {
|
|
|
5874
5720
|
return `<style>${combinedStyle}</style>${body.innerHTML}`;
|
|
5875
5721
|
}, [activeTab]);
|
|
5876
5722
|
const isEmpty = html2 === "";
|
|
5877
|
-
return /* @__PURE__ */ (0,
|
|
5878
|
-
|
|
5723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5724
|
+
import_react35.NodeViewWrapper,
|
|
5879
5725
|
{
|
|
5880
5726
|
draggable: false,
|
|
5881
5727
|
"data-drag-handle": false,
|
|
5882
5728
|
"data-type": "htmlCodeBlock",
|
|
5883
5729
|
children: [
|
|
5884
|
-
activeTab === "code" && /* @__PURE__ */ (0,
|
|
5885
|
-
|
|
5730
|
+
activeTab === "code" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "mly-my-0 mly-rounded-lg mly-border mly-border-gray-200 mly-bg-white mly-p-2 mly-text-black", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5731
|
+
import_react35.NodeViewContent,
|
|
5886
5732
|
{
|
|
5887
5733
|
as: "code",
|
|
5888
5734
|
className: cn("is-editable", languageClass)
|
|
5889
5735
|
}
|
|
5890
5736
|
) }),
|
|
5891
|
-
activeTab === "preview" && /* @__PURE__ */ (0,
|
|
5737
|
+
activeTab === "preview" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5892
5738
|
"div",
|
|
5893
5739
|
{
|
|
5894
5740
|
className: cn(
|
|
@@ -5956,7 +5802,7 @@ var HTMLCodeBlockExtension = import_extension_code_block_lowlight.default.extend
|
|
|
5956
5802
|
});
|
|
5957
5803
|
},
|
|
5958
5804
|
addNodeView() {
|
|
5959
|
-
return (0,
|
|
5805
|
+
return (0, import_react37.ReactNodeViewRenderer)(HTMLCodeBlockView, {
|
|
5960
5806
|
className: "mly-relative",
|
|
5961
5807
|
attrs: ({ node }) => {
|
|
5962
5808
|
var _a;
|