@underverse-ui/underverse 1.0.192 → 1.0.194
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/README.md +27 -0
- package/api-reference.json +1 -1
- package/dist/index.cjs +1247 -620
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -1
- package/dist/index.d.ts +106 -1
- package/dist/index.js +906 -278
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1107,6 +1107,19 @@ var en_default = {
|
|
|
1107
1107
|
borderStyle: "Border Style",
|
|
1108
1108
|
borderWidth: "Border Width",
|
|
1109
1109
|
borderColor: "Border Color",
|
|
1110
|
+
borderPosition: "Border placement",
|
|
1111
|
+
borderMode: "Border mode",
|
|
1112
|
+
borderDraw: "Draw borders",
|
|
1113
|
+
borderErase: "Hide borders",
|
|
1114
|
+
borderAll: "All borders",
|
|
1115
|
+
borderOuter: "Outer borders",
|
|
1116
|
+
borderInner: "Inner borders",
|
|
1117
|
+
borderHorizontal: "Inner horizontal borders",
|
|
1118
|
+
borderVertical: "Inner vertical borders",
|
|
1119
|
+
borderTop: "Top border",
|
|
1120
|
+
borderRight: "Right border",
|
|
1121
|
+
borderBottom: "Bottom border",
|
|
1122
|
+
borderLeft: "Left border",
|
|
1110
1123
|
clearBorder: "Clear Border",
|
|
1111
1124
|
formula: "Formula",
|
|
1112
1125
|
formulaBar: "Formula bar",
|
|
@@ -1540,6 +1553,19 @@ var vi_default = {
|
|
|
1540
1553
|
borderStyle: "Ki\u1EC3u vi\u1EC1n",
|
|
1541
1554
|
borderWidth: "\u0110\u1ED9 d\xE0y vi\u1EC1n",
|
|
1542
1555
|
borderColor: "M\xE0u vi\u1EC1n",
|
|
1556
|
+
borderPosition: "V\u1ECB tr\xED vi\u1EC1n",
|
|
1557
|
+
borderMode: "Ch\u1EBF \u0111\u1ED9 vi\u1EC1n",
|
|
1558
|
+
borderDraw: "V\u1EBD vi\u1EC1n",
|
|
1559
|
+
borderErase: "\u1EA8n c\u1EA1nh",
|
|
1560
|
+
borderAll: "T\u1EA5t c\u1EA3 vi\u1EC1n",
|
|
1561
|
+
borderOuter: "Vi\u1EC1n ngo\xE0i",
|
|
1562
|
+
borderInner: "Vi\u1EC1n trong",
|
|
1563
|
+
borderHorizontal: "Vi\u1EC1n ngang b\xEAn trong",
|
|
1564
|
+
borderVertical: "Vi\u1EC1n d\u1ECDc b\xEAn trong",
|
|
1565
|
+
borderTop: "Vi\u1EC1n tr\xEAn",
|
|
1566
|
+
borderRight: "Vi\u1EC1n ph\u1EA3i",
|
|
1567
|
+
borderBottom: "Vi\u1EC1n d\u01B0\u1EDBi",
|
|
1568
|
+
borderLeft: "Vi\u1EC1n tr\xE1i",
|
|
1543
1569
|
clearBorder: "X\xF3a vi\u1EC1n",
|
|
1544
1570
|
formula: "C\xF4ng th\u1EE9c",
|
|
1545
1571
|
formulaBar: "Thanh c\xF4ng th\u1EE9c",
|
|
@@ -1973,6 +1999,19 @@ var ko_default = {
|
|
|
1973
1999
|
borderStyle: "\uD14C\uB450\uB9AC \uC2A4\uD0C0\uC77C",
|
|
1974
2000
|
borderWidth: "\uD14C\uB450\uB9AC \uB450\uAED8",
|
|
1975
2001
|
borderColor: "\uD14C\uB450\uB9AC \uC0C9\uC0C1",
|
|
2002
|
+
borderPosition: "\uD14C\uB450\uB9AC \uC704\uCE58",
|
|
2003
|
+
borderMode: "\uD14C\uB450\uB9AC \uBAA8\uB4DC",
|
|
2004
|
+
borderDraw: "\uD14C\uB450\uB9AC \uADF8\uB9AC\uAE30",
|
|
2005
|
+
borderErase: "\uD14C\uB450\uB9AC \uC228\uAE30\uAE30",
|
|
2006
|
+
borderAll: "\uBAA8\uB4E0 \uD14C\uB450\uB9AC",
|
|
2007
|
+
borderOuter: "\uBC14\uAE65\uCABD \uD14C\uB450\uB9AC",
|
|
2008
|
+
borderInner: "\uC548\uCABD \uD14C\uB450\uB9AC",
|
|
2009
|
+
borderHorizontal: "\uC548\uCABD \uAC00\uB85C \uD14C\uB450\uB9AC",
|
|
2010
|
+
borderVertical: "\uC548\uCABD \uC138\uB85C \uD14C\uB450\uB9AC",
|
|
2011
|
+
borderTop: "\uC704\uCABD \uD14C\uB450\uB9AC",
|
|
2012
|
+
borderRight: "\uC624\uB978\uCABD \uD14C\uB450\uB9AC",
|
|
2013
|
+
borderBottom: "\uC544\uB798\uCABD \uD14C\uB450\uB9AC",
|
|
2014
|
+
borderLeft: "\uC67C\uCABD \uD14C\uB450\uB9AC",
|
|
1976
2015
|
clearBorder: "\uD14C\uB450\uB9AC \uC9C0\uC6B0\uAE30",
|
|
1977
2016
|
formula: "\uC218\uC2DD",
|
|
1978
2017
|
formulaBar: "\uC218\uC2DD \uC785\uB825\uC904",
|
|
@@ -2406,6 +2445,19 @@ var ja_default = {
|
|
|
2406
2445
|
borderStyle: "\u67A0\u7DDA\u30B9\u30BF\u30A4\u30EB",
|
|
2407
2446
|
borderWidth: "\u67A0\u7DDA\u306E\u592A\u3055",
|
|
2408
2447
|
borderColor: "\u67A0\u7DDA\u306E\u8272",
|
|
2448
|
+
borderPosition: "\u67A0\u7DDA\u306E\u4F4D\u7F6E",
|
|
2449
|
+
borderMode: "\u67A0\u7DDA\u30E2\u30FC\u30C9",
|
|
2450
|
+
borderDraw: "\u67A0\u7DDA\u3092\u5F15\u304F",
|
|
2451
|
+
borderErase: "\u67A0\u7DDA\u3092\u975E\u8868\u793A",
|
|
2452
|
+
borderAll: "\u3059\u3079\u3066\u306E\u67A0\u7DDA",
|
|
2453
|
+
borderOuter: "\u5916\u67A0",
|
|
2454
|
+
borderInner: "\u5185\u5074\u306E\u67A0\u7DDA",
|
|
2455
|
+
borderHorizontal: "\u5185\u5074\u306E\u6A2A\u7F6B\u7DDA",
|
|
2456
|
+
borderVertical: "\u5185\u5074\u306E\u7E26\u7F6B\u7DDA",
|
|
2457
|
+
borderTop: "\u4E0A\u7F6B\u7DDA",
|
|
2458
|
+
borderRight: "\u53F3\u7F6B\u7DDA",
|
|
2459
|
+
borderBottom: "\u4E0B\u7F6B\u7DDA",
|
|
2460
|
+
borderLeft: "\u5DE6\u7F6B\u7DDA",
|
|
2409
2461
|
clearBorder: "\u67A0\u7DDA\u3092\u30AF\u30EA\u30A2",
|
|
2410
2462
|
formula: "\u6570\u5F0F",
|
|
2411
2463
|
formulaBar: "\u6570\u5F0F\u30D0\u30FC",
|
|
@@ -14447,7 +14499,7 @@ function Calendar4({
|
|
|
14447
14499
|
xl: { cell: dense ? "min-h-48" : "min-h-52", day: "text-xl" }
|
|
14448
14500
|
};
|
|
14449
14501
|
const cellSz = CELL_EVENT_STYLES[size];
|
|
14450
|
-
const
|
|
14502
|
+
const VARIANT_STYLES = {
|
|
14451
14503
|
default: "border border-border/60 rounded-2xl md:rounded-3xl bg-linear-to-br from-card via-card to-card/95 shadow-sm backdrop-blur-sm",
|
|
14452
14504
|
bordered: "border-2 border-border/70 rounded-2xl md:rounded-3xl bg-linear-to-br from-card via-card to-card/95 shadow-md hover:shadow-lg transition-shadow duration-300",
|
|
14453
14505
|
card: "border border-border/50 rounded-3xl bg-linear-to-br from-card via-background/95 to-card shadow-lg hover:shadow-xl transition-shadow duration-300 backdrop-blur-md",
|
|
@@ -27395,17 +27447,35 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
27395
27447
|
var NotificationModal_default = NotificationModal;
|
|
27396
27448
|
|
|
27397
27449
|
// src/components/AccessDenied.tsx
|
|
27398
|
-
var
|
|
27450
|
+
var import_react43 = require("react");
|
|
27399
27451
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
27400
|
-
var
|
|
27401
|
-
destructive:
|
|
27402
|
-
warning:
|
|
27403
|
-
info:
|
|
27452
|
+
var VARIANT_COLOR_VARS = {
|
|
27453
|
+
destructive: "var(--destructive)",
|
|
27454
|
+
warning: "var(--warning)",
|
|
27455
|
+
info: "var(--info)"
|
|
27404
27456
|
};
|
|
27405
|
-
var
|
|
27406
|
-
destructive:
|
|
27407
|
-
|
|
27408
|
-
|
|
27457
|
+
var VARIANT_DESIGNS = {
|
|
27458
|
+
destructive: {
|
|
27459
|
+
borderColor: "border-destructive/20 hover:border-destructive/40 focus-within:border-destructive/30",
|
|
27460
|
+
iconBg: "from-destructive/15 to-destructive/5 dark:from-destructive/25 dark:to-destructive/10",
|
|
27461
|
+
iconBorder: "border-destructive/20 group-hover:border-destructive/50",
|
|
27462
|
+
pulseRing: "bg-destructive/10 ring-destructive/5 dark:bg-destructive/20 dark:ring-destructive/10",
|
|
27463
|
+
textColor: "text-destructive"
|
|
27464
|
+
},
|
|
27465
|
+
warning: {
|
|
27466
|
+
borderColor: "border-warning/20 hover:border-warning/40 focus-within:border-warning/30",
|
|
27467
|
+
iconBg: "from-warning/15 to-warning/5 dark:from-warning/25 dark:to-warning/10",
|
|
27468
|
+
iconBorder: "border-warning/20 group-hover:border-warning/50",
|
|
27469
|
+
pulseRing: "bg-warning/10 ring-warning/5 dark:bg-warning/20 dark:ring-warning/10",
|
|
27470
|
+
textColor: "text-warning"
|
|
27471
|
+
},
|
|
27472
|
+
info: {
|
|
27473
|
+
borderColor: "border-info/20 hover:border-info/40 focus-within:border-info/30",
|
|
27474
|
+
iconBg: "from-info/15 to-info/5 dark:from-info/25 dark:to-info/10",
|
|
27475
|
+
iconBorder: "border-info/20 group-hover:border-info/50",
|
|
27476
|
+
pulseRing: "bg-info/10 ring-info/5 dark:bg-info/20 dark:ring-info/10",
|
|
27477
|
+
textColor: "text-info"
|
|
27478
|
+
}
|
|
27409
27479
|
};
|
|
27410
27480
|
function AccessDenied({
|
|
27411
27481
|
title = "Access Restricted",
|
|
@@ -27414,30 +27484,278 @@ function AccessDenied({
|
|
|
27414
27484
|
icon: Icon,
|
|
27415
27485
|
className,
|
|
27416
27486
|
children,
|
|
27417
|
-
overflowHidden = true
|
|
27487
|
+
overflowHidden = true,
|
|
27488
|
+
code = "403"
|
|
27418
27489
|
}) {
|
|
27419
|
-
const
|
|
27420
|
-
const
|
|
27421
|
-
|
|
27490
|
+
const design = VARIANT_DESIGNS[variant];
|
|
27491
|
+
const colorVar = VARIANT_COLOR_VARS[variant];
|
|
27492
|
+
const reactId = (0, import_react43.useId)();
|
|
27493
|
+
const cleanId = reactId.replace(/:/g, "");
|
|
27494
|
+
const clipId = `white-clip-${cleanId}`;
|
|
27495
|
+
const textId = `text-s-${cleanId}`;
|
|
27496
|
+
const eyeId = `white-eye-${cleanId}`;
|
|
27497
|
+
const tornilloId = `tornillo-${cleanId}`;
|
|
27498
|
+
const svgRef = (0, import_react43.useRef)(null);
|
|
27499
|
+
const [mousePos, setMousePos] = (0, import_react43.useState)({ x: 0, y: 0 });
|
|
27500
|
+
const [eyeCoords, setEyeCoords] = (0, import_react43.useState)({ cx: 130, cy: 65 });
|
|
27501
|
+
const [isHovered, setIsHovered] = (0, import_react43.useState)(false);
|
|
27502
|
+
const handleMouseMove2 = (e) => {
|
|
27503
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
27504
|
+
setMousePos({
|
|
27505
|
+
x: e.clientX - rect.left,
|
|
27506
|
+
y: e.clientY - rect.top
|
|
27507
|
+
});
|
|
27508
|
+
};
|
|
27509
|
+
(0, import_react43.useEffect)(() => {
|
|
27510
|
+
const handleGlobalMouseMove = (e) => {
|
|
27511
|
+
if (!svgRef.current) return;
|
|
27512
|
+
const rect = svgRef.current.getBoundingClientRect();
|
|
27513
|
+
const eyeCenterX = rect.left + rect.width * (130 / 260);
|
|
27514
|
+
const eyeCenterY = rect.top + rect.height * (65 / 118.9);
|
|
27515
|
+
const dx = e.clientX - eyeCenterX;
|
|
27516
|
+
const dy = e.clientY - eyeCenterY;
|
|
27517
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
27518
|
+
const maxShift = 11;
|
|
27519
|
+
let shiftX = 0;
|
|
27520
|
+
let shiftY = 0;
|
|
27521
|
+
if (distance > 0) {
|
|
27522
|
+
const currentShift = Math.min(maxShift, distance / 12);
|
|
27523
|
+
shiftX = dx / distance * currentShift;
|
|
27524
|
+
shiftY = dy / distance * currentShift;
|
|
27525
|
+
}
|
|
27526
|
+
setEyeCoords({
|
|
27527
|
+
cx: 130 + shiftX,
|
|
27528
|
+
cy: 65 + shiftY
|
|
27529
|
+
});
|
|
27530
|
+
};
|
|
27531
|
+
const handleGlobalTouchMove = (e) => {
|
|
27532
|
+
if (e.touches.length > 0 && svgRef.current) {
|
|
27533
|
+
const rect = svgRef.current.getBoundingClientRect();
|
|
27534
|
+
const eyeCenterX = rect.left + rect.width * (130 / 260);
|
|
27535
|
+
const eyeCenterY = rect.top + rect.height * (65 / 118.9);
|
|
27536
|
+
const dx = e.touches[0].clientX - eyeCenterX;
|
|
27537
|
+
const dy = e.touches[0].clientY - eyeCenterY;
|
|
27538
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
27539
|
+
const maxShift = 11;
|
|
27540
|
+
let shiftX = 0;
|
|
27541
|
+
let shiftY = 0;
|
|
27542
|
+
if (distance > 0) {
|
|
27543
|
+
const currentShift = Math.min(maxShift, distance / 12);
|
|
27544
|
+
shiftX = dx / distance * currentShift;
|
|
27545
|
+
shiftY = dy / distance * currentShift;
|
|
27546
|
+
}
|
|
27547
|
+
setEyeCoords({
|
|
27548
|
+
cx: 130 + shiftX,
|
|
27549
|
+
cy: 65 + shiftY
|
|
27550
|
+
});
|
|
27551
|
+
}
|
|
27552
|
+
};
|
|
27553
|
+
window.addEventListener("mousemove", handleGlobalMouseMove);
|
|
27554
|
+
window.addEventListener("touchmove", handleGlobalTouchMove);
|
|
27555
|
+
return () => {
|
|
27556
|
+
window.removeEventListener("mousemove", handleGlobalMouseMove);
|
|
27557
|
+
window.removeEventListener("touchmove", handleGlobalTouchMove);
|
|
27558
|
+
};
|
|
27559
|
+
}, []);
|
|
27560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
27422
27561
|
Card_default,
|
|
27423
27562
|
{
|
|
27424
|
-
className: cn(
|
|
27425
|
-
|
|
27426
|
-
|
|
27427
|
-
|
|
27428
|
-
|
|
27429
|
-
|
|
27430
|
-
|
|
27563
|
+
className: cn(
|
|
27564
|
+
"relative p-8 md:p-12 text-center shadow-lg transition-all duration-500 ease-out",
|
|
27565
|
+
"bg-linear-to-br from-card/95 via-card/90 to-card/85",
|
|
27566
|
+
"border backdrop-blur-md group/ad",
|
|
27567
|
+
design.borderColor,
|
|
27568
|
+
className
|
|
27569
|
+
),
|
|
27570
|
+
innerClassName: cn(
|
|
27571
|
+
"relative overflow-hidden",
|
|
27572
|
+
!overflowHidden ? "overflow-visible" : void 0
|
|
27573
|
+
),
|
|
27574
|
+
onMouseEnter: () => setIsHovered(true),
|
|
27575
|
+
onMouseLeave: () => setIsHovered(false),
|
|
27576
|
+
onMouseMove: handleMouseMove2,
|
|
27577
|
+
children: [
|
|
27578
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("style", { dangerouslySetInnerHTML: { __html: `
|
|
27579
|
+
@keyframes ad-float {
|
|
27580
|
+
0%, 100% { transform: translateY(0); }
|
|
27581
|
+
50% { transform: translateY(-6px); }
|
|
27582
|
+
}
|
|
27583
|
+
@keyframes ad-drift {
|
|
27584
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
27585
|
+
50% { transform: translate(12%, -8%) scale(1.08); }
|
|
27586
|
+
}
|
|
27587
|
+
@keyframes ad-drift-rev {
|
|
27588
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
27589
|
+
50% { transform: translate(-10%, 12%) scale(0.92); }
|
|
27590
|
+
}
|
|
27591
|
+
@keyframes ad-alarm {
|
|
27592
|
+
0%, 100% { opacity: 1; }
|
|
27593
|
+
50% { opacity: 0.35; }
|
|
27594
|
+
}
|
|
27595
|
+
.animate-ad-float {
|
|
27596
|
+
animation: ad-float 5s ease-in-out infinite;
|
|
27597
|
+
}
|
|
27598
|
+
.animate-ad-drift-1 {
|
|
27599
|
+
animation: ad-drift 10s ease-in-out infinite;
|
|
27600
|
+
}
|
|
27601
|
+
.animate-ad-drift-2 {
|
|
27602
|
+
animation: ad-drift-rev 12s ease-in-out infinite;
|
|
27603
|
+
}
|
|
27604
|
+
.animate-ad-alarm {
|
|
27605
|
+
animation: ad-alarm 0.5s ease-in-out infinite;
|
|
27606
|
+
}
|
|
27607
|
+
` } }),
|
|
27608
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "absolute inset-0 pointer-events-none overflow-hidden rounded-2xl md:rounded-3xl", children: [
|
|
27609
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27610
|
+
"div",
|
|
27611
|
+
{
|
|
27612
|
+
className: "absolute -top-24 -left-24 w-64 h-64 rounded-full transition-transform duration-700 ease-out group-hover/ad:scale-110 animate-ad-drift-1",
|
|
27613
|
+
style: {
|
|
27614
|
+
backgroundImage: `radial-gradient(circle at center, color-mix(in oklch, ${colorVar} 25%, transparent) 0%, transparent 70%)`
|
|
27615
|
+
}
|
|
27616
|
+
}
|
|
27617
|
+
),
|
|
27618
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27619
|
+
"div",
|
|
27620
|
+
{
|
|
27621
|
+
className: "absolute -bottom-20 -right-20 w-48 h-48 rounded-full transition-transform duration-700 ease-out group-hover/ad:scale-105 animate-ad-drift-2",
|
|
27622
|
+
style: {
|
|
27623
|
+
backgroundImage: `radial-gradient(circle at center, color-mix(in oklch, ${colorVar} 15%, transparent) 0%, transparent 70%)`
|
|
27624
|
+
}
|
|
27625
|
+
}
|
|
27626
|
+
)
|
|
27431
27627
|
] }),
|
|
27432
|
-
|
|
27433
|
-
|
|
27628
|
+
isHovered && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27629
|
+
"div",
|
|
27630
|
+
{
|
|
27631
|
+
className: "absolute inset-0 pointer-events-none transition-opacity duration-500 opacity-100 rounded-2xl md:rounded-3xl",
|
|
27632
|
+
style: {
|
|
27633
|
+
background: `radial-gradient(350px circle at ${mousePos.x}px ${mousePos.y}px, color-mix(in oklch, ${colorVar} 14%, transparent) 0%, transparent 80%)`
|
|
27634
|
+
}
|
|
27635
|
+
}
|
|
27636
|
+
),
|
|
27637
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27638
|
+
"div",
|
|
27639
|
+
{
|
|
27640
|
+
className: "absolute inset-0 opacity-[0.03] dark:opacity-[0.06] pointer-events-none transition-opacity duration-300 group-hover/ad:opacity-[0.05] dark:group-hover/ad:opacity-[0.08]",
|
|
27641
|
+
style: {
|
|
27642
|
+
backgroundImage: `radial-gradient(currentColor 1.2px, transparent 1.2px)`,
|
|
27643
|
+
backgroundSize: "20px 20px"
|
|
27644
|
+
}
|
|
27645
|
+
}
|
|
27646
|
+
),
|
|
27647
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "absolute inset-0 select-none flex items-center justify-center pointer-events-none overflow-hidden rounded-2xl md:rounded-3xl z-0", children: [
|
|
27648
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "text-[120px] md:text-[180px] font-black tracking-tighter opacity-10 dark:opacity-15 select-none text-muted-foreground/40 dark:text-muted-foreground/30 font-sans", children: code }),
|
|
27649
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27650
|
+
"div",
|
|
27651
|
+
{
|
|
27652
|
+
className: "absolute text-[120px] md:text-[180px] font-black tracking-tighter select-none font-sans",
|
|
27653
|
+
style: {
|
|
27654
|
+
color: colorVar,
|
|
27655
|
+
opacity: isHovered ? 0.75 : 0,
|
|
27656
|
+
transition: "opacity 300ms ease",
|
|
27657
|
+
maskImage: `radial-gradient(120px circle at ${mousePos.x}px ${mousePos.y}px, black, transparent 120px)`,
|
|
27658
|
+
WebkitMaskImage: `radial-gradient(120px circle at ${mousePos.x}px ${mousePos.y}px, black, transparent 120px)`,
|
|
27659
|
+
filter: `drop-shadow(0 0 25px color-mix(in oklch, ${colorVar} 50%, transparent))`
|
|
27660
|
+
},
|
|
27661
|
+
children: code
|
|
27662
|
+
}
|
|
27663
|
+
)
|
|
27664
|
+
] }),
|
|
27665
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "relative z-10 flex flex-col items-center gap-6", children: [
|
|
27666
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "relative flex items-center justify-center animate-ad-float", children: [
|
|
27667
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27668
|
+
"div",
|
|
27669
|
+
{
|
|
27670
|
+
className: cn(
|
|
27671
|
+
"absolute w-20 h-20 rounded-full opacity-60 animate-pulse duration-2000 ring-8",
|
|
27672
|
+
design.pulseRing
|
|
27673
|
+
)
|
|
27674
|
+
}
|
|
27675
|
+
),
|
|
27676
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27677
|
+
"div",
|
|
27678
|
+
{
|
|
27679
|
+
className: cn(
|
|
27680
|
+
"relative flex items-center justify-center p-4 rounded-2xl",
|
|
27681
|
+
"bg-linear-to-b border shadow-md transition-all duration-500 ease-out",
|
|
27682
|
+
"group-hover/ad:rotate-6 group-hover/ad:scale-105 group-hover/ad:shadow-lg",
|
|
27683
|
+
design.iconBg,
|
|
27684
|
+
design.iconBorder
|
|
27685
|
+
),
|
|
27686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon, { className: cn("w-10 h-10 transition-transform duration-500 group-hover/ad:scale-110", design.textColor) })
|
|
27687
|
+
}
|
|
27688
|
+
)
|
|
27689
|
+
] }) : (
|
|
27690
|
+
/* Interactive Robot Face Illustration */
|
|
27691
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "relative w-full max-w-65 h-30 select-none animate-ad-float", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
27692
|
+
"svg",
|
|
27693
|
+
{
|
|
27694
|
+
ref: svgRef,
|
|
27695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27696
|
+
id: "robot-error",
|
|
27697
|
+
viewBox: "0 0 260 118.9",
|
|
27698
|
+
role: "img",
|
|
27699
|
+
className: "w-full h-full",
|
|
27700
|
+
children: [
|
|
27701
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("title", { children: "403 Error" }),
|
|
27702
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("defs", { children: [
|
|
27703
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("circle", { id: eyeId, cx: "130", cy: "65", r: "20" }) }),
|
|
27704
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("text", { id: textId, className: "font-sans font-black tracking-tighter", y: "106", style: { fontSize: code.length > 3 ? "80px" : "120px" }, children: code })
|
|
27705
|
+
] }),
|
|
27706
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27707
|
+
"path",
|
|
27708
|
+
{
|
|
27709
|
+
className: "animate-ad-alarm",
|
|
27710
|
+
fill: variant === "destructive" ? "#e62326" : variant === "warning" ? "var(--warning)" : "var(--info)",
|
|
27711
|
+
d: "M120.9 19.6V9.1c0-5 4.1-9.1 9.1-9.1h0c5 0 9.1 4.1 9.1 9.1v10.6"
|
|
27712
|
+
}
|
|
27713
|
+
),
|
|
27714
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("use", { href: `#${textId}`, x: "-0.5px", y: "-1px", fill: "currentColor", className: "opacity-15 dark:opacity-10 text-muted-foreground" }),
|
|
27715
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("use", { href: `#${textId}`, fill: "currentColor", className: "opacity-10 dark:opacity-5 text-muted-foreground" }),
|
|
27716
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("g", { id: "robot", children: [
|
|
27717
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("g", { id: "eye-wrap", children: [
|
|
27718
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("use", { href: `#${eyeId}`, fill: "currentColor", className: "opacity-20 dark:opacity-15 text-muted-foreground" }),
|
|
27719
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
27720
|
+
"circle",
|
|
27721
|
+
{
|
|
27722
|
+
id: "eyef",
|
|
27723
|
+
clipPath: `url(#${clipId})`,
|
|
27724
|
+
fill: "currentColor",
|
|
27725
|
+
className: "text-foreground",
|
|
27726
|
+
stroke: variant === "destructive" ? "#e62326" : variant === "warning" ? "var(--warning)" : "var(--info)",
|
|
27727
|
+
strokeWidth: "2.5",
|
|
27728
|
+
strokeMiterlimit: "10",
|
|
27729
|
+
cx: eyeCoords.cx,
|
|
27730
|
+
cy: eyeCoords.cy,
|
|
27731
|
+
r: "11"
|
|
27732
|
+
}
|
|
27733
|
+
),
|
|
27734
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("ellipse", { fill: "currentColor", className: "opacity-30 dark:opacity-20 text-muted-foreground", cx: "130", cy: "40", rx: "18", ry: "12" })
|
|
27735
|
+
] }),
|
|
27736
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("circle", { className: "opacity-40 dark:opacity-30 text-muted-foreground", fill: "currentColor", cx: "105", cy: "32", r: "2.5", id: tornilloId }),
|
|
27737
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("use", { href: `#${tornilloId}`, x: "50" }),
|
|
27738
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("use", { href: `#${tornilloId}`, x: "50", y: "60" }),
|
|
27739
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("use", { href: `#${tornilloId}`, y: "60" })
|
|
27740
|
+
] })
|
|
27741
|
+
]
|
|
27742
|
+
}
|
|
27743
|
+
) })
|
|
27744
|
+
),
|
|
27745
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "space-y-2.5 max-w-sm mx-auto", children: [
|
|
27746
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("h3", { className: "text-xl md:text-2xl font-bold tracking-tight text-foreground transition-colors duration-300", children: title }),
|
|
27747
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "text-sm md:text-base text-muted-foreground/80 leading-relaxed font-normal", children: description })
|
|
27748
|
+
] }),
|
|
27749
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "mt-2 flex flex-wrap gap-3 justify-center items-center relative z-20", children })
|
|
27750
|
+
] })
|
|
27751
|
+
]
|
|
27434
27752
|
}
|
|
27435
27753
|
);
|
|
27436
27754
|
}
|
|
27437
27755
|
|
|
27438
27756
|
// src/components/ThemeToggleHeadless.tsx
|
|
27439
|
-
var
|
|
27440
|
-
var
|
|
27757
|
+
var import_lucide_react40 = require("lucide-react");
|
|
27758
|
+
var import_react44 = require("react");
|
|
27441
27759
|
var import_react_dom6 = require("react-dom");
|
|
27442
27760
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
27443
27761
|
function ThemeToggleHeadless({
|
|
@@ -27446,14 +27764,14 @@ function ThemeToggleHeadless({
|
|
|
27446
27764
|
labels,
|
|
27447
27765
|
className
|
|
27448
27766
|
}) {
|
|
27449
|
-
const [isOpen, setIsOpen] = (0,
|
|
27767
|
+
const [isOpen, setIsOpen] = (0, import_react44.useState)(false);
|
|
27450
27768
|
const isHydrated = useHydrated();
|
|
27451
|
-
const triggerRef = (0,
|
|
27452
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
27769
|
+
const triggerRef = (0, import_react44.useRef)(null);
|
|
27770
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react44.useState)(null);
|
|
27453
27771
|
const themes = [
|
|
27454
|
-
{ value: "light", label: labels?.light ?? "Light", icon:
|
|
27455
|
-
{ value: "dark", label: labels?.dark ?? "Dark", icon:
|
|
27456
|
-
{ value: "system", label: labels?.system ?? "System", icon:
|
|
27772
|
+
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react40.Sun },
|
|
27773
|
+
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react40.Moon },
|
|
27774
|
+
{ value: "system", label: labels?.system ?? "System", icon: import_lucide_react40.Monitor }
|
|
27457
27775
|
];
|
|
27458
27776
|
const current = isHydrated ? themes.find((t) => t.value === theme) || themes[2] : themes[2];
|
|
27459
27777
|
const CurrentIcon = current.icon;
|
|
@@ -27538,9 +27856,9 @@ function ThemeToggleHeadless({
|
|
|
27538
27856
|
}
|
|
27539
27857
|
|
|
27540
27858
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
27541
|
-
var
|
|
27859
|
+
var import_react45 = require("react");
|
|
27542
27860
|
var import_react_dom7 = require("react-dom");
|
|
27543
|
-
var
|
|
27861
|
+
var import_lucide_react41 = require("lucide-react");
|
|
27544
27862
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
27545
27863
|
function LanguageSwitcherHeadless({
|
|
27546
27864
|
locales,
|
|
@@ -27549,9 +27867,9 @@ function LanguageSwitcherHeadless({
|
|
|
27549
27867
|
labels,
|
|
27550
27868
|
className
|
|
27551
27869
|
}) {
|
|
27552
|
-
const [isOpen, setIsOpen] = (0,
|
|
27553
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
27554
|
-
const triggerButtonRef = (0,
|
|
27870
|
+
const [isOpen, setIsOpen] = (0, import_react45.useState)(false);
|
|
27871
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react45.useState)(null);
|
|
27872
|
+
const triggerButtonRef = (0, import_react45.useRef)(null);
|
|
27555
27873
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
27556
27874
|
const calculatePosition = () => {
|
|
27557
27875
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -27583,7 +27901,7 @@ function LanguageSwitcherHeadless({
|
|
|
27583
27901
|
"aria-expanded": isOpen,
|
|
27584
27902
|
"aria-label": labels?.heading ?? "Language",
|
|
27585
27903
|
title: labels?.heading ?? "Language",
|
|
27586
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
27904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react41.Globe, { className: "h-5 w-5" })
|
|
27587
27905
|
}
|
|
27588
27906
|
),
|
|
27589
27907
|
isOpen && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
@@ -27637,7 +27955,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
27637
27955
|
};
|
|
27638
27956
|
|
|
27639
27957
|
// src/contexts/translation-adapter.tsx
|
|
27640
|
-
var
|
|
27958
|
+
var React73 = __toESM(require("react"), 1);
|
|
27641
27959
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
27642
27960
|
function isUnresolvedTranslation2(value, namespace, key) {
|
|
27643
27961
|
return value === key || value === `${namespace}.${key}`;
|
|
@@ -27662,7 +27980,7 @@ function useTranslations(namespace) {
|
|
|
27662
27980
|
const nextIntlBridge = useNextIntlBridge();
|
|
27663
27981
|
const internalLocale = useUnderverseLocale();
|
|
27664
27982
|
const internalT = useUnderverseTranslations(namespace);
|
|
27665
|
-
return
|
|
27983
|
+
return React73.useCallback((key, params) => {
|
|
27666
27984
|
if (nextIntlBridge) {
|
|
27667
27985
|
const nextIntlResult = nextIntlBridge.translate(namespace, key, params);
|
|
27668
27986
|
if (nextIntlResult.translated && !isUnresolvedTranslation2(nextIntlResult.translated, namespace, key)) {
|
|
@@ -27687,8 +28005,8 @@ function useLocale2() {
|
|
|
27687
28005
|
}
|
|
27688
28006
|
|
|
27689
28007
|
// src/components/UEditor/UEditor.tsx
|
|
27690
|
-
var
|
|
27691
|
-
var
|
|
28008
|
+
var import_react83 = __toESM(require("react"), 1);
|
|
28009
|
+
var import_react84 = require("@tiptap/react");
|
|
27692
28010
|
|
|
27693
28011
|
// src/components/UEditor/extensions.ts
|
|
27694
28012
|
var import_core16 = require("@tiptap/core");
|
|
@@ -27708,14 +28026,14 @@ var import_extension_task_item = __toESM(require("@tiptap/extension-task-item"),
|
|
|
27708
28026
|
var import_extension_blockquote = __toESM(require("@tiptap/extension-blockquote"), 1);
|
|
27709
28027
|
var import_extension_code = __toESM(require("@tiptap/extension-code"), 1);
|
|
27710
28028
|
var import_core17 = require("@tiptap/core");
|
|
27711
|
-
var
|
|
28029
|
+
var import_react68 = require("@tiptap/react");
|
|
27712
28030
|
|
|
27713
28031
|
// src/components/UEditor/callout.ts
|
|
27714
28032
|
var import_core = require("@tiptap/core");
|
|
27715
|
-
var
|
|
28033
|
+
var import_react47 = require("@tiptap/react");
|
|
27716
28034
|
|
|
27717
28035
|
// src/components/UEditor/CalloutView.tsx
|
|
27718
|
-
var
|
|
28036
|
+
var import_react46 = require("@tiptap/react");
|
|
27719
28037
|
|
|
27720
28038
|
// src/components/UEditor/emoji-picker.tsx
|
|
27721
28039
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
@@ -27737,7 +28055,7 @@ var CalloutView = ({ node, updateAttributes, selected }) => {
|
|
|
27737
28055
|
const currentEmoji = node.attrs.emoji ?? "\u{1F4A1}";
|
|
27738
28056
|
const currentBgColor = node.attrs.backgroundColor ?? "var(--muted)";
|
|
27739
28057
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
27740
|
-
|
|
28058
|
+
import_react46.NodeViewWrapper,
|
|
27741
28059
|
{
|
|
27742
28060
|
className: cn(
|
|
27743
28061
|
"flex items-start gap-4 rounded-xl border p-4 my-4 transition-all duration-200 border-border/50",
|
|
@@ -27780,7 +28098,7 @@ var CalloutView = ({ node, updateAttributes, selected }) => {
|
|
|
27780
28098
|
] })
|
|
27781
28099
|
}
|
|
27782
28100
|
) }),
|
|
27783
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
28101
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react46.NodeViewContent, { className: "min-w-0 flex-1 outline-none" })
|
|
27784
28102
|
]
|
|
27785
28103
|
}
|
|
27786
28104
|
);
|
|
@@ -27831,7 +28149,7 @@ var Callout = import_core.Node.create({
|
|
|
27831
28149
|
];
|
|
27832
28150
|
},
|
|
27833
28151
|
addNodeView() {
|
|
27834
|
-
return (0,
|
|
28152
|
+
return (0, import_react47.ReactNodeViewRenderer)(CalloutView);
|
|
27835
28153
|
},
|
|
27836
28154
|
addCommands() {
|
|
27837
28155
|
return {
|
|
@@ -27844,12 +28162,12 @@ var Callout = import_core.Node.create({
|
|
|
27844
28162
|
|
|
27845
28163
|
// src/components/UEditor/bookmark.ts
|
|
27846
28164
|
var import_core2 = require("@tiptap/core");
|
|
27847
|
-
var
|
|
28165
|
+
var import_react50 = require("@tiptap/react");
|
|
27848
28166
|
|
|
27849
28167
|
// src/components/UEditor/BookmarkView.tsx
|
|
27850
|
-
var
|
|
27851
|
-
var
|
|
27852
|
-
var
|
|
28168
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
28169
|
+
var import_react49 = require("@tiptap/react");
|
|
28170
|
+
var import_lucide_react42 = require("lucide-react");
|
|
27853
28171
|
|
|
27854
28172
|
// src/components/UEditor/url-safety.ts
|
|
27855
28173
|
var LINK_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
@@ -27928,17 +28246,17 @@ var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
|
27928
28246
|
var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
27929
28247
|
const t = useSmartTranslations("UEditor");
|
|
27930
28248
|
const { url, title, description, image, publisher } = node.attrs;
|
|
27931
|
-
const [loading2, setLoading] = (0,
|
|
27932
|
-
const [error, setError] = (0,
|
|
27933
|
-
const [retryToken, setRetryToken] = (0,
|
|
27934
|
-
const lastFetchKeyRef =
|
|
27935
|
-
const fetchRequestIdRef =
|
|
28249
|
+
const [loading2, setLoading] = (0, import_react48.useState)(false);
|
|
28250
|
+
const [error, setError] = (0, import_react48.useState)(false);
|
|
28251
|
+
const [retryToken, setRetryToken] = (0, import_react48.useState)(0);
|
|
28252
|
+
const lastFetchKeyRef = import_react48.default.useRef("");
|
|
28253
|
+
const fetchRequestIdRef = import_react48.default.useRef(0);
|
|
27936
28254
|
const safeUrl = sanitizeUEditorUrl(String(url ?? ""), "link");
|
|
27937
28255
|
const safeImage = sanitizeUEditorUrl(String(image ?? ""), "image");
|
|
27938
28256
|
const clickToOpenNewTabMessage = t("bookmark.clickToOpenNewTab");
|
|
27939
28257
|
const clickToOpenLinkMessage = t("bookmark.clickToOpenLink");
|
|
27940
28258
|
const noDescriptionMessage = t("bookmark.noDescription");
|
|
27941
|
-
(0,
|
|
28259
|
+
(0, import_react48.useEffect)(() => {
|
|
27942
28260
|
if (title && retryToken === 0) return;
|
|
27943
28261
|
if (!safeUrl) return;
|
|
27944
28262
|
const fetchKey = `${safeUrl}\0${retryToken}`;
|
|
@@ -28041,7 +28359,7 @@ var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
|
28041
28359
|
}
|
|
28042
28360
|
})();
|
|
28043
28361
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
28044
|
-
|
|
28362
|
+
import_react49.NodeViewWrapper,
|
|
28045
28363
|
{
|
|
28046
28364
|
className: cn(
|
|
28047
28365
|
"my-4 block overflow-hidden rounded-xl border border-border/60 bg-muted/20 hover:bg-muted/30 transition-all duration-200 cursor-pointer select-none",
|
|
@@ -28063,7 +28381,7 @@ var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
|
28063
28381
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex-1 p-4 flex flex-col justify-between gap-1 min-w-0", children: [
|
|
28064
28382
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
28065
28383
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "text-xs text-muted-foreground font-medium flex items-center gap-1.5 truncate", children: [
|
|
28066
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
28384
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react42.Globe, { className: "h-3 w-3 flex-shrink-0" }),
|
|
28067
28385
|
displayPublisher
|
|
28068
28386
|
] }),
|
|
28069
28387
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("h4", { className: "text-sm font-semibold text-foreground line-clamp-1 break-all", children: title || safeUrl || String(url ?? "") }),
|
|
@@ -28071,11 +28389,11 @@ var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
|
28071
28389
|
] }),
|
|
28072
28390
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "text-[11px] text-primary/80 font-mono mt-2 truncate flex items-center gap-1", children: [
|
|
28073
28391
|
safeUrl || String(url ?? ""),
|
|
28074
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
28392
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react42.ExternalLink, { className: "h-3 w-3 flex-shrink-0" })
|
|
28075
28393
|
] }),
|
|
28076
28394
|
error && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "mt-2 flex flex-wrap items-center gap-2 text-xs text-destructive", children: [
|
|
28077
28395
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
|
|
28078
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
28396
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react42.AlertCircle, { className: "h-3.5 w-3.5" }),
|
|
28079
28397
|
t("bookmark.previewFailed")
|
|
28080
28398
|
] }),
|
|
28081
28399
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
@@ -28085,7 +28403,7 @@ var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
|
28085
28403
|
onClick: handleRetryPreview,
|
|
28086
28404
|
className: "inline-flex items-center gap-1 rounded-md border border-destructive/30 px-2 py-0.5 font-medium hover:bg-destructive/10",
|
|
28087
28405
|
children: [
|
|
28088
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
28406
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react42.RefreshCw, { className: "h-3 w-3" }),
|
|
28089
28407
|
t("bookmark.retryPreview")
|
|
28090
28408
|
]
|
|
28091
28409
|
}
|
|
@@ -28179,7 +28497,7 @@ var Bookmark = import_core2.Node.create({
|
|
|
28179
28497
|
];
|
|
28180
28498
|
},
|
|
28181
28499
|
addNodeView() {
|
|
28182
|
-
return (0,
|
|
28500
|
+
return (0, import_react50.ReactNodeViewRenderer)(BookmarkView);
|
|
28183
28501
|
},
|
|
28184
28502
|
addCommands() {
|
|
28185
28503
|
return {
|
|
@@ -28225,12 +28543,12 @@ var Bookmark = import_core2.Node.create({
|
|
|
28225
28543
|
|
|
28226
28544
|
// src/components/UEditor/file-card.ts
|
|
28227
28545
|
var import_core3 = require("@tiptap/core");
|
|
28228
|
-
var
|
|
28546
|
+
var import_react53 = require("@tiptap/react");
|
|
28229
28547
|
|
|
28230
28548
|
// src/components/UEditor/FileCardView.tsx
|
|
28231
|
-
var
|
|
28232
|
-
var
|
|
28233
|
-
var
|
|
28549
|
+
var import_react51 = require("react");
|
|
28550
|
+
var import_react52 = require("@tiptap/react");
|
|
28551
|
+
var import_lucide_react43 = require("lucide-react");
|
|
28234
28552
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
28235
28553
|
function formatBytes(bytes, decimals = 1) {
|
|
28236
28554
|
if (!Number.isFinite(bytes) || bytes <= 0) return "0 Bytes";
|
|
@@ -28242,11 +28560,11 @@ function formatBytes(bytes, decimals = 1) {
|
|
|
28242
28560
|
}
|
|
28243
28561
|
function getFileIcon2(type) {
|
|
28244
28562
|
const mime = String(type || "").toLowerCase();
|
|
28245
|
-
if (mime.includes("pdf")) return
|
|
28246
|
-
if (mime.startsWith("image/")) return
|
|
28247
|
-
if (mime.startsWith("audio/")) return
|
|
28248
|
-
if (mime.startsWith("video/")) return
|
|
28249
|
-
return
|
|
28563
|
+
if (mime.includes("pdf")) return import_lucide_react43.FileText;
|
|
28564
|
+
if (mime.startsWith("image/")) return import_lucide_react43.Image;
|
|
28565
|
+
if (mime.startsWith("audio/")) return import_lucide_react43.Music;
|
|
28566
|
+
if (mime.startsWith("video/")) return import_lucide_react43.Video;
|
|
28567
|
+
return import_lucide_react43.File;
|
|
28250
28568
|
}
|
|
28251
28569
|
function dataURLtoFile(dataurl, filename, mimeType) {
|
|
28252
28570
|
try {
|
|
@@ -28278,15 +28596,15 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
28278
28596
|
const t = useSmartTranslations("UEditor");
|
|
28279
28597
|
const { src, fileName, fileSize, fileType } = node.attrs;
|
|
28280
28598
|
const FileIcon = getFileIcon2(fileType);
|
|
28281
|
-
const [uploadError, setUploadError] = (0,
|
|
28282
|
-
const [retryToken, setRetryToken] = (0,
|
|
28283
|
-
const uploadAttemptedRef = (0,
|
|
28284
|
-
const lastUploadSrcRef = (0,
|
|
28285
|
-
const uploadRequestIdRef = (0,
|
|
28599
|
+
const [uploadError, setUploadError] = (0, import_react51.useState)(null);
|
|
28600
|
+
const [retryToken, setRetryToken] = (0, import_react51.useState)(0);
|
|
28601
|
+
const uploadAttemptedRef = (0, import_react51.useRef)(false);
|
|
28602
|
+
const lastUploadSrcRef = (0, import_react51.useRef)("");
|
|
28603
|
+
const uploadRequestIdRef = (0, import_react51.useRef)(0);
|
|
28286
28604
|
const safeSrc = sanitizeUEditorUrl(String(src ?? ""), "file");
|
|
28287
28605
|
const extension = editor?.extensionManager?.extensions?.find((item) => item.name === "fileCard");
|
|
28288
28606
|
const uploadFn = extension?.options?.upload;
|
|
28289
|
-
(0,
|
|
28607
|
+
(0, import_react51.useEffect)(() => {
|
|
28290
28608
|
if (lastUploadSrcRef.current !== safeSrc) {
|
|
28291
28609
|
lastUploadSrcRef.current = safeSrc;
|
|
28292
28610
|
uploadAttemptedRef.current = false;
|
|
@@ -28347,7 +28665,7 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
28347
28665
|
setRetryToken((value) => value + 1);
|
|
28348
28666
|
};
|
|
28349
28667
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
28350
|
-
|
|
28668
|
+
import_react52.NodeViewWrapper,
|
|
28351
28669
|
{
|
|
28352
28670
|
className: cn(
|
|
28353
28671
|
"my-4 flex items-center justify-between rounded-xl border border-border/60 bg-card p-4 hover:bg-muted/15 transition-all duration-200 cursor-pointer select-none",
|
|
@@ -28372,7 +28690,7 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
28372
28690
|
onClick: handleRetryUpload,
|
|
28373
28691
|
className: "inline-flex items-center gap-1 rounded-md border border-destructive/30 px-1.5 py-0.5 text-[11px] font-medium text-destructive hover:bg-destructive/10",
|
|
28374
28692
|
children: [
|
|
28375
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
28693
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react43.RefreshCw, { className: "h-3 w-3" }),
|
|
28376
28694
|
t("fileCard.retryUpload")
|
|
28377
28695
|
]
|
|
28378
28696
|
}
|
|
@@ -28386,7 +28704,7 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
28386
28704
|
type: "button",
|
|
28387
28705
|
onClick: handleDownload,
|
|
28388
28706
|
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
28389
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
28707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_lucide_react43.Download, { className: "h-4 w-4" })
|
|
28390
28708
|
}
|
|
28391
28709
|
)
|
|
28392
28710
|
]
|
|
@@ -28463,7 +28781,7 @@ var FileCard = import_core3.Node.create({
|
|
|
28463
28781
|
];
|
|
28464
28782
|
},
|
|
28465
28783
|
addNodeView() {
|
|
28466
|
-
return (0,
|
|
28784
|
+
return (0, import_react53.ReactNodeViewRenderer)(FileCardView);
|
|
28467
28785
|
},
|
|
28468
28786
|
addCommands() {
|
|
28469
28787
|
return {
|
|
@@ -28486,11 +28804,11 @@ var FileCard = import_core3.Node.create({
|
|
|
28486
28804
|
|
|
28487
28805
|
// src/components/UEditor/form-checkbox.ts
|
|
28488
28806
|
var import_core4 = require("@tiptap/core");
|
|
28489
|
-
var
|
|
28807
|
+
var import_react55 = require("@tiptap/react");
|
|
28490
28808
|
|
|
28491
28809
|
// src/components/UEditor/FormCheckboxView.tsx
|
|
28492
|
-
var
|
|
28493
|
-
var
|
|
28810
|
+
var import_react54 = require("@tiptap/react");
|
|
28811
|
+
var import_lucide_react44 = require("lucide-react");
|
|
28494
28812
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
28495
28813
|
var FormCheckboxView = ({ node, updateAttributes, editor, selected }) => {
|
|
28496
28814
|
const isChecked = !!node.attrs.checked;
|
|
@@ -28508,7 +28826,7 @@ var FormCheckboxView = ({ node, updateAttributes, editor, selected }) => {
|
|
|
28508
28826
|
}
|
|
28509
28827
|
};
|
|
28510
28828
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
28511
|
-
|
|
28829
|
+
import_react54.NodeViewWrapper,
|
|
28512
28830
|
{
|
|
28513
28831
|
as: "span",
|
|
28514
28832
|
className: cn(
|
|
@@ -28537,7 +28855,7 @@ var FormCheckboxView = ({ node, updateAttributes, editor, selected }) => {
|
|
|
28537
28855
|
"transition-transform duration-200 ease-out-back",
|
|
28538
28856
|
isChecked ? "scale-100 opacity-100" : "scale-50 opacity-0"
|
|
28539
28857
|
),
|
|
28540
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
28858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react44.Check, { className: "w-3.5 h-3.5 stroke-[3px]" })
|
|
28541
28859
|
}
|
|
28542
28860
|
)
|
|
28543
28861
|
}
|
|
@@ -28625,7 +28943,7 @@ var FormCheckbox2 = import_core4.Node.create({
|
|
|
28625
28943
|
];
|
|
28626
28944
|
},
|
|
28627
28945
|
addNodeView() {
|
|
28628
|
-
return (0,
|
|
28946
|
+
return (0, import_react55.ReactNodeViewRenderer)(FormCheckboxView);
|
|
28629
28947
|
},
|
|
28630
28948
|
addCommands() {
|
|
28631
28949
|
return {
|
|
@@ -28641,11 +28959,11 @@ var FormCheckbox2 = import_core4.Node.create({
|
|
|
28641
28959
|
|
|
28642
28960
|
// src/components/UEditor/form-radio.ts
|
|
28643
28961
|
var import_core5 = require("@tiptap/core");
|
|
28644
|
-
var
|
|
28962
|
+
var import_react57 = require("@tiptap/react");
|
|
28645
28963
|
|
|
28646
28964
|
// src/components/UEditor/FormRadioView.tsx
|
|
28647
|
-
var
|
|
28648
|
-
var
|
|
28965
|
+
var import_react56 = require("@tiptap/react");
|
|
28966
|
+
var import_lucide_react45 = require("lucide-react");
|
|
28649
28967
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
28650
28968
|
var FormRadioView = ({ node, updateAttributes, editor, selected }) => {
|
|
28651
28969
|
const t = useSmartTranslations("UEditor");
|
|
@@ -28664,7 +28982,7 @@ var FormRadioView = ({ node, updateAttributes, editor, selected }) => {
|
|
|
28664
28982
|
}
|
|
28665
28983
|
};
|
|
28666
28984
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
28667
|
-
|
|
28985
|
+
import_react56.NodeViewWrapper,
|
|
28668
28986
|
{
|
|
28669
28987
|
as: "span",
|
|
28670
28988
|
className: cn(
|
|
@@ -28707,7 +29025,7 @@ var FormRadioView = ({ node, updateAttributes, editor, selected }) => {
|
|
|
28707
29025
|
type: "button",
|
|
28708
29026
|
className: "p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors outline-none cursor-pointer",
|
|
28709
29027
|
title: t("radio.editGroup") || "Edit Group",
|
|
28710
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
29028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react45.Settings, { className: "w-3.5 h-3.5" })
|
|
28711
29029
|
}
|
|
28712
29030
|
),
|
|
28713
29031
|
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "p-3 w-52 flex flex-col gap-2 bg-card border rounded-xl shadow-lg text-card-foreground", children: [
|
|
@@ -28814,7 +29132,7 @@ var FormRadio = import_core5.Node.create({
|
|
|
28814
29132
|
];
|
|
28815
29133
|
},
|
|
28816
29134
|
addNodeView() {
|
|
28817
|
-
return (0,
|
|
29135
|
+
return (0, import_react57.ReactNodeViewRenderer)(FormRadioView);
|
|
28818
29136
|
},
|
|
28819
29137
|
addCommands() {
|
|
28820
29138
|
return {
|
|
@@ -28876,9 +29194,9 @@ var import_lowlight = require("lowlight");
|
|
|
28876
29194
|
// src/components/UEditor/slash-command.tsx
|
|
28877
29195
|
var import_core6 = require("@tiptap/core");
|
|
28878
29196
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
28879
|
-
var
|
|
28880
|
-
var
|
|
28881
|
-
var
|
|
29197
|
+
var import_react58 = require("@tiptap/react");
|
|
29198
|
+
var import_react59 = __toESM(require("react"), 1);
|
|
29199
|
+
var import_lucide_react46 = require("lucide-react");
|
|
28882
29200
|
|
|
28883
29201
|
// src/components/UEditor/tippy-interop.ts
|
|
28884
29202
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
@@ -28944,9 +29262,9 @@ var DEFAULT_MESSAGES = {
|
|
|
28944
29262
|
formRadioDesc: "Insert an interactive radio button field"
|
|
28945
29263
|
};
|
|
28946
29264
|
function useResettingIndex2(resetToken) {
|
|
28947
|
-
const [state, setState] =
|
|
29265
|
+
const [state, setState] = import_react59.default.useState({ resetToken, index: 0 });
|
|
28948
29266
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
28949
|
-
const setSelectedIndex =
|
|
29267
|
+
const setSelectedIndex = import_react59.default.useCallback((nextIndex) => {
|
|
28950
29268
|
setState((prev) => {
|
|
28951
29269
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
28952
29270
|
return {
|
|
@@ -29008,7 +29326,7 @@ function buildSlashCommandItems({
|
|
|
29008
29326
|
const run = (handler) => handler;
|
|
29009
29327
|
return [
|
|
29010
29328
|
{
|
|
29011
|
-
icon:
|
|
29329
|
+
icon: import_lucide_react46.Type,
|
|
29012
29330
|
title: messages.text,
|
|
29013
29331
|
description: messages.textDesc,
|
|
29014
29332
|
command: run(({ editor, range }) => {
|
|
@@ -29016,7 +29334,7 @@ function buildSlashCommandItems({
|
|
|
29016
29334
|
})
|
|
29017
29335
|
},
|
|
29018
29336
|
{
|
|
29019
|
-
icon:
|
|
29337
|
+
icon: import_lucide_react46.Heading1,
|
|
29020
29338
|
title: messages.heading1,
|
|
29021
29339
|
description: messages.heading1Desc,
|
|
29022
29340
|
command: run(({ editor, range }) => {
|
|
@@ -29024,7 +29342,7 @@ function buildSlashCommandItems({
|
|
|
29024
29342
|
})
|
|
29025
29343
|
},
|
|
29026
29344
|
{
|
|
29027
|
-
icon:
|
|
29345
|
+
icon: import_lucide_react46.Heading2,
|
|
29028
29346
|
title: messages.heading2,
|
|
29029
29347
|
description: messages.heading2Desc,
|
|
29030
29348
|
command: run(({ editor, range }) => {
|
|
@@ -29032,7 +29350,7 @@ function buildSlashCommandItems({
|
|
|
29032
29350
|
})
|
|
29033
29351
|
},
|
|
29034
29352
|
{
|
|
29035
|
-
icon:
|
|
29353
|
+
icon: import_lucide_react46.Heading3,
|
|
29036
29354
|
title: messages.heading3,
|
|
29037
29355
|
description: messages.heading3Desc,
|
|
29038
29356
|
command: run(({ editor, range }) => {
|
|
@@ -29040,7 +29358,7 @@ function buildSlashCommandItems({
|
|
|
29040
29358
|
})
|
|
29041
29359
|
},
|
|
29042
29360
|
{
|
|
29043
|
-
icon:
|
|
29361
|
+
icon: import_lucide_react46.List,
|
|
29044
29362
|
title: messages.bulletList,
|
|
29045
29363
|
description: messages.bulletListDesc,
|
|
29046
29364
|
command: run(({ editor, range }) => {
|
|
@@ -29048,7 +29366,7 @@ function buildSlashCommandItems({
|
|
|
29048
29366
|
})
|
|
29049
29367
|
},
|
|
29050
29368
|
{
|
|
29051
|
-
icon:
|
|
29369
|
+
icon: import_lucide_react46.ListOrdered,
|
|
29052
29370
|
title: messages.orderedList,
|
|
29053
29371
|
description: messages.orderedListDesc,
|
|
29054
29372
|
command: run(({ editor, range }) => {
|
|
@@ -29056,7 +29374,7 @@ function buildSlashCommandItems({
|
|
|
29056
29374
|
})
|
|
29057
29375
|
},
|
|
29058
29376
|
{
|
|
29059
|
-
icon:
|
|
29377
|
+
icon: import_lucide_react46.ListTodo,
|
|
29060
29378
|
title: messages.todoList,
|
|
29061
29379
|
description: messages.todoListDesc,
|
|
29062
29380
|
command: run(({ editor, range }) => {
|
|
@@ -29064,7 +29382,7 @@ function buildSlashCommandItems({
|
|
|
29064
29382
|
})
|
|
29065
29383
|
},
|
|
29066
29384
|
{
|
|
29067
|
-
icon:
|
|
29385
|
+
icon: import_lucide_react46.Quote,
|
|
29068
29386
|
title: messages.quote,
|
|
29069
29387
|
description: messages.quoteDesc,
|
|
29070
29388
|
command: run(({ editor, range }) => {
|
|
@@ -29072,7 +29390,7 @@ function buildSlashCommandItems({
|
|
|
29072
29390
|
})
|
|
29073
29391
|
},
|
|
29074
29392
|
{
|
|
29075
|
-
icon:
|
|
29393
|
+
icon: import_lucide_react46.FileCode,
|
|
29076
29394
|
title: messages.codeBlock,
|
|
29077
29395
|
description: messages.codeBlockDesc,
|
|
29078
29396
|
command: run(({ editor, range }) => {
|
|
@@ -29080,7 +29398,7 @@ function buildSlashCommandItems({
|
|
|
29080
29398
|
})
|
|
29081
29399
|
},
|
|
29082
29400
|
{
|
|
29083
|
-
icon:
|
|
29401
|
+
icon: import_lucide_react46.Minus,
|
|
29084
29402
|
title: messages.divider,
|
|
29085
29403
|
description: messages.dividerDesc,
|
|
29086
29404
|
command: run(({ editor, range }) => {
|
|
@@ -29088,7 +29406,7 @@ function buildSlashCommandItems({
|
|
|
29088
29406
|
})
|
|
29089
29407
|
},
|
|
29090
29408
|
{
|
|
29091
|
-
icon:
|
|
29409
|
+
icon: import_lucide_react46.Table,
|
|
29092
29410
|
title: messages.table,
|
|
29093
29411
|
description: messages.tableDesc,
|
|
29094
29412
|
command: run(({ editor, range }) => {
|
|
@@ -29096,7 +29414,7 @@ function buildSlashCommandItems({
|
|
|
29096
29414
|
})
|
|
29097
29415
|
},
|
|
29098
29416
|
{
|
|
29099
|
-
icon:
|
|
29417
|
+
icon: import_lucide_react46.Info,
|
|
29100
29418
|
title: messages.callout || "Callout",
|
|
29101
29419
|
description: messages.calloutDesc || "Highlight key info with a callout block",
|
|
29102
29420
|
command: run(({ editor, range }) => {
|
|
@@ -29104,7 +29422,7 @@ function buildSlashCommandItems({
|
|
|
29104
29422
|
})
|
|
29105
29423
|
},
|
|
29106
29424
|
{
|
|
29107
|
-
icon:
|
|
29425
|
+
icon: import_lucide_react46.Bookmark,
|
|
29108
29426
|
title: messages.bookmark || "Bookmark Card",
|
|
29109
29427
|
description: messages.bookmarkDesc || "Embed a link as a bookmark card",
|
|
29110
29428
|
command: run(({ editor, range }) => {
|
|
@@ -29115,7 +29433,7 @@ function buildSlashCommandItems({
|
|
|
29115
29433
|
})
|
|
29116
29434
|
},
|
|
29117
29435
|
{
|
|
29118
|
-
icon:
|
|
29436
|
+
icon: import_lucide_react46.Paperclip,
|
|
29119
29437
|
title: messages.fileCard || "File Attachment",
|
|
29120
29438
|
description: messages.fileCardDesc || "Upload a file card attachment",
|
|
29121
29439
|
command: run(({ editor, range }) => {
|
|
@@ -29140,7 +29458,7 @@ function buildSlashCommandItems({
|
|
|
29140
29458
|
})
|
|
29141
29459
|
},
|
|
29142
29460
|
{
|
|
29143
|
-
icon:
|
|
29461
|
+
icon: import_lucide_react46.CheckSquare,
|
|
29144
29462
|
title: messages.formCheckbox,
|
|
29145
29463
|
description: messages.formCheckboxDesc,
|
|
29146
29464
|
searchTerms: ["checkbox", "square checkbox"],
|
|
@@ -29149,7 +29467,7 @@ function buildSlashCommandItems({
|
|
|
29149
29467
|
})
|
|
29150
29468
|
},
|
|
29151
29469
|
{
|
|
29152
|
-
icon:
|
|
29470
|
+
icon: import_lucide_react46.CircleCheckBig,
|
|
29153
29471
|
title: messages.roundCheckbox,
|
|
29154
29472
|
description: messages.roundCheckboxDesc,
|
|
29155
29473
|
searchTerms: ["roundcheckbox", "round checkbox", "circle checkbox"],
|
|
@@ -29158,7 +29476,7 @@ function buildSlashCommandItems({
|
|
|
29158
29476
|
})
|
|
29159
29477
|
},
|
|
29160
29478
|
{
|
|
29161
|
-
icon:
|
|
29479
|
+
icon: import_lucide_react46.CircleDot,
|
|
29162
29480
|
title: messages.formRadio,
|
|
29163
29481
|
description: messages.formRadioDesc,
|
|
29164
29482
|
command: run(({ editor, range }) => {
|
|
@@ -29171,14 +29489,14 @@ function buildSlashCommandItems({
|
|
|
29171
29489
|
return [item.title, item.description, ...item.searchTerms ?? []].some((value) => value.toLowerCase().includes(normalizedQuery));
|
|
29172
29490
|
});
|
|
29173
29491
|
}
|
|
29174
|
-
var SlashCommandList = (0,
|
|
29492
|
+
var SlashCommandList = (0, import_react59.forwardRef)((props, ref) => {
|
|
29175
29493
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
29176
|
-
const listRef = (0,
|
|
29177
|
-
(0,
|
|
29494
|
+
const listRef = (0, import_react59.useRef)(null);
|
|
29495
|
+
(0, import_react59.useEffect)(() => {
|
|
29178
29496
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
29179
29497
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
29180
29498
|
}, [selectedIndex, props.items]);
|
|
29181
|
-
(0,
|
|
29499
|
+
(0, import_react59.useImperativeHandle)(ref, () => ({
|
|
29182
29500
|
onKeyDown: (keyProps) => {
|
|
29183
29501
|
if (!keyProps || !keyProps.event) return false;
|
|
29184
29502
|
const { event } = keyProps;
|
|
@@ -29263,7 +29581,7 @@ var SlashCommand = import_core6.Extension.create({
|
|
|
29263
29581
|
let popup;
|
|
29264
29582
|
return {
|
|
29265
29583
|
onStart: (props) => {
|
|
29266
|
-
component = new
|
|
29584
|
+
component = new import_react58.ReactRenderer(SlashCommandList, {
|
|
29267
29585
|
props: {
|
|
29268
29586
|
...props,
|
|
29269
29587
|
messages
|
|
@@ -30142,15 +30460,15 @@ var ClipboardImages = import_core7.Extension.create({
|
|
|
30142
30460
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
30143
30461
|
var import_core8 = require("@tiptap/core");
|
|
30144
30462
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
30145
|
-
var
|
|
30463
|
+
var import_react60 = require("@tiptap/react");
|
|
30146
30464
|
var import_state3 = require("@tiptap/pm/state");
|
|
30147
|
-
var
|
|
30148
|
-
var
|
|
30465
|
+
var import_react61 = __toESM(require("react"), 1);
|
|
30466
|
+
var import_lucide_react47 = require("lucide-react");
|
|
30149
30467
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
30150
30468
|
function useResettingIndex3(resetToken) {
|
|
30151
|
-
const [state, setState] =
|
|
30469
|
+
const [state, setState] = import_react61.default.useState({ resetToken, index: 0 });
|
|
30152
30470
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
30153
|
-
const setSelectedIndex =
|
|
30471
|
+
const setSelectedIndex = import_react61.default.useCallback((nextIndex) => {
|
|
30154
30472
|
setState((prev) => {
|
|
30155
30473
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
30156
30474
|
return {
|
|
@@ -30161,11 +30479,11 @@ function useResettingIndex3(resetToken) {
|
|
|
30161
30479
|
}, [resetToken]);
|
|
30162
30480
|
return [selectedIndex, setSelectedIndex];
|
|
30163
30481
|
}
|
|
30164
|
-
var EmojiList = (0,
|
|
30482
|
+
var EmojiList = (0, import_react61.forwardRef)((props, ref) => {
|
|
30165
30483
|
const t = useSmartTranslations("UEditor");
|
|
30166
30484
|
const [selectedIndex, setSelectedIndex] = useResettingIndex3(props.items);
|
|
30167
30485
|
const showingCountLabel = formatEmojiCountLabel(t("emojiSuggestion.showingCount"), 64, props.items.length);
|
|
30168
|
-
(0,
|
|
30486
|
+
(0, import_react61.useImperativeHandle)(ref, () => ({
|
|
30169
30487
|
onKeyDown: (keyProps) => {
|
|
30170
30488
|
if (!keyProps || !keyProps.event) return false;
|
|
30171
30489
|
const { event } = keyProps;
|
|
@@ -30200,7 +30518,7 @@ var EmojiList = (0, import_react60.forwardRef)((props, ref) => {
|
|
|
30200
30518
|
}
|
|
30201
30519
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "w-80 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-2xl shadow-lg", children: [
|
|
30202
30520
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
30203
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
30521
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react47.Smile, { className: "w-4 h-4 text-primary" }),
|
|
30204
30522
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("emojiSuggestion.title") })
|
|
30205
30523
|
] }) }),
|
|
30206
30524
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "p-3", children: [
|
|
@@ -30247,7 +30565,7 @@ var EmojiSuggestion = import_core8.Extension.create({
|
|
|
30247
30565
|
let popup;
|
|
30248
30566
|
return {
|
|
30249
30567
|
onStart: (props) => {
|
|
30250
|
-
component = new
|
|
30568
|
+
component = new import_react60.ReactRenderer(EmojiList, {
|
|
30251
30569
|
props,
|
|
30252
30570
|
editor: props.editor
|
|
30253
30571
|
});
|
|
@@ -30295,10 +30613,10 @@ var EmojiSuggestion = import_core8.Extension.create({
|
|
|
30295
30613
|
// src/components/UEditor/formula-suggestion.tsx
|
|
30296
30614
|
var import_core9 = require("@tiptap/core");
|
|
30297
30615
|
var import_suggestion3 = __toESM(require("@tiptap/suggestion"), 1);
|
|
30298
|
-
var
|
|
30616
|
+
var import_react62 = require("@tiptap/react");
|
|
30299
30617
|
var import_state4 = require("@tiptap/pm/state");
|
|
30300
|
-
var
|
|
30301
|
-
var
|
|
30618
|
+
var import_react63 = __toESM(require("react"), 1);
|
|
30619
|
+
var import_lucide_react48 = require("lucide-react");
|
|
30302
30620
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
30303
30621
|
var FORMULA_FUNCTIONS = [
|
|
30304
30622
|
{
|
|
@@ -30350,13 +30668,13 @@ function buildFormulaSuggestionItems({ query }) {
|
|
|
30350
30668
|
function isFormulaFunctionSuggestionQuery(query) {
|
|
30351
30669
|
return /^[A-Z]*$/i.test(query.trim());
|
|
30352
30670
|
}
|
|
30353
|
-
var FormulaSuggestionList = (0,
|
|
30671
|
+
var FormulaSuggestionList = (0, import_react63.forwardRef)((props, ref) => {
|
|
30354
30672
|
const t = useSmartTranslations("UEditor");
|
|
30355
|
-
const [selectedIndex, setSelectedIndex] =
|
|
30356
|
-
|
|
30673
|
+
const [selectedIndex, setSelectedIndex] = import_react63.default.useState(0);
|
|
30674
|
+
import_react63.default.useEffect(() => {
|
|
30357
30675
|
setSelectedIndex(0);
|
|
30358
30676
|
}, [props.items]);
|
|
30359
|
-
(0,
|
|
30677
|
+
(0, import_react63.useImperativeHandle)(ref, () => ({
|
|
30360
30678
|
onKeyDown: ({ event }) => {
|
|
30361
30679
|
if (props.items.length === 0) return false;
|
|
30362
30680
|
if (event.key === "ArrowUp") {
|
|
@@ -30382,7 +30700,7 @@ var FormulaSuggestionList = (0, import_react62.forwardRef)((props, ref) => {
|
|
|
30382
30700
|
}
|
|
30383
30701
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-lg shadow-lg", children: [
|
|
30384
30702
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
30385
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30703
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react48.Sigma, { className: "w-4 h-4 text-primary" }),
|
|
30386
30704
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("formulaSuggestion.title") })
|
|
30387
30705
|
] }) }),
|
|
30388
30706
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "p-1.5", children: props.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
@@ -30434,7 +30752,7 @@ var FormulaSuggestion = import_core9.Extension.create({
|
|
|
30434
30752
|
let popup;
|
|
30435
30753
|
return {
|
|
30436
30754
|
onStart: (props) => {
|
|
30437
|
-
component = new
|
|
30755
|
+
component = new import_react62.ReactRenderer(FormulaSuggestionList, {
|
|
30438
30756
|
props,
|
|
30439
30757
|
editor: props.editor
|
|
30440
30758
|
});
|
|
@@ -30552,10 +30870,10 @@ var UEditorPlaceholder = import_core10.Extension.create({
|
|
|
30552
30870
|
});
|
|
30553
30871
|
|
|
30554
30872
|
// src/components/UEditor/resizable-image.tsx
|
|
30555
|
-
var
|
|
30873
|
+
var import_react64 = require("react");
|
|
30556
30874
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
30557
30875
|
var import_core11 = require("@tiptap/core");
|
|
30558
|
-
var
|
|
30876
|
+
var import_react65 = require("@tiptap/react");
|
|
30559
30877
|
|
|
30560
30878
|
// src/components/UEditor/table-dom-utils.ts
|
|
30561
30879
|
var DEFAULT_TABLE_ROW_HEIGHT = 25;
|
|
@@ -30741,16 +31059,16 @@ function sizeFromHeight(height, aspect, maxWidth) {
|
|
|
30741
31059
|
}
|
|
30742
31060
|
function ResizableImageNodeView(props) {
|
|
30743
31061
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
30744
|
-
const wrapperRef = (0,
|
|
30745
|
-
const imgRef = (0,
|
|
30746
|
-
const resizePreviewRef = (0,
|
|
30747
|
-
const [isHovered, setIsHovered] = (0,
|
|
30748
|
-
const [isResizing, setIsResizing] = (0,
|
|
31062
|
+
const wrapperRef = (0, import_react64.useRef)(null);
|
|
31063
|
+
const imgRef = (0, import_react64.useRef)(null);
|
|
31064
|
+
const resizePreviewRef = (0, import_react64.useRef)(null);
|
|
31065
|
+
const [isHovered, setIsHovered] = (0, import_react64.useState)(false);
|
|
31066
|
+
const [isResizing, setIsResizing] = (0, import_react64.useState)(false);
|
|
30749
31067
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
30750
31068
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
30751
31069
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
30752
31070
|
const imageLayout = parseImageLayout(node.attrs["imageLayout"]);
|
|
30753
|
-
const dragStateRef = (0,
|
|
31071
|
+
const dragStateRef = (0, import_react64.useRef)(null);
|
|
30754
31072
|
const dispatchTableLayoutChange2 = () => {
|
|
30755
31073
|
editor.view.dom.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, { bubbles: true }));
|
|
30756
31074
|
};
|
|
@@ -30787,7 +31105,7 @@ function ResizableImageNodeView(props) {
|
|
|
30787
31105
|
if (!drag || drag.frameId !== null) return;
|
|
30788
31106
|
drag.frameId = window.requestAnimationFrame(applyPendingResizeFrame);
|
|
30789
31107
|
};
|
|
30790
|
-
(0,
|
|
31108
|
+
(0, import_react64.useEffect)(() => {
|
|
30791
31109
|
return () => {
|
|
30792
31110
|
const drag = dragStateRef.current;
|
|
30793
31111
|
if (drag && drag.frameId !== null) {
|
|
@@ -30797,7 +31115,7 @@ function ResizableImageNodeView(props) {
|
|
|
30797
31115
|
document.body.style.cursor = "";
|
|
30798
31116
|
};
|
|
30799
31117
|
}, []);
|
|
30800
|
-
(0,
|
|
31118
|
+
(0, import_react64.useEffect)(() => {
|
|
30801
31119
|
const img = imgRef.current;
|
|
30802
31120
|
if (!img) return;
|
|
30803
31121
|
const displayStyle = getImageDisplayStyle(widthAttr, heightAttr);
|
|
@@ -30905,7 +31223,7 @@ function ResizableImageNodeView(props) {
|
|
|
30905
31223
|
const wrapperAlignClass = imageLayout === "block" ? textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "" : "";
|
|
30906
31224
|
const wrapperLayoutClass = imageLayout === "left" ? "float-left mr-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : imageLayout === "right" ? "float-right ml-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : "w-fit";
|
|
30907
31225
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
30908
|
-
|
|
31226
|
+
import_react65.NodeViewWrapper,
|
|
30909
31227
|
{
|
|
30910
31228
|
as: "div",
|
|
30911
31229
|
ref: wrapperRef,
|
|
@@ -31028,7 +31346,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
31028
31346
|
return ["img", (0, import_core11.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
31029
31347
|
},
|
|
31030
31348
|
addNodeView() {
|
|
31031
|
-
return (0,
|
|
31349
|
+
return (0, import_react65.ReactNodeViewRenderer)(ResizableImageNodeView);
|
|
31032
31350
|
}
|
|
31033
31351
|
}).configure({
|
|
31034
31352
|
allowBase64: true,
|
|
@@ -31747,9 +32065,9 @@ var UEditorTable = import_extension_table.Table.extend({
|
|
|
31747
32065
|
var table_align_default = UEditorTable;
|
|
31748
32066
|
|
|
31749
32067
|
// src/components/UEditor/CodeBlockView.tsx
|
|
31750
|
-
var
|
|
31751
|
-
var
|
|
31752
|
-
var
|
|
32068
|
+
var import_react66 = __toESM(require("react"), 1);
|
|
32069
|
+
var import_react67 = require("@tiptap/react");
|
|
32070
|
+
var import_lucide_react49 = require("lucide-react");
|
|
31753
32071
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
31754
32072
|
var LANGUAGES = [
|
|
31755
32073
|
{ label: "Plain Text", value: "text" },
|
|
@@ -31772,12 +32090,12 @@ var CodeBlockView = ({
|
|
|
31772
32090
|
updateAttributes,
|
|
31773
32091
|
extension
|
|
31774
32092
|
}) => {
|
|
31775
|
-
const [copied, setCopied] = (0,
|
|
31776
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0,
|
|
31777
|
-
const timeoutRef =
|
|
32093
|
+
const [copied, setCopied] = (0, import_react66.useState)(false);
|
|
32094
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, import_react66.useState)(false);
|
|
32095
|
+
const timeoutRef = import_react66.default.useRef(null);
|
|
31778
32096
|
const currentLangValue = node.attrs.language || "text";
|
|
31779
32097
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
31780
|
-
|
|
32098
|
+
import_react66.default.useEffect(() => {
|
|
31781
32099
|
return () => {
|
|
31782
32100
|
if (timeoutRef.current) {
|
|
31783
32101
|
clearTimeout(timeoutRef.current);
|
|
@@ -31798,7 +32116,7 @@ var CodeBlockView = ({
|
|
|
31798
32116
|
console.error("Failed to copy code text: ", err);
|
|
31799
32117
|
}
|
|
31800
32118
|
};
|
|
31801
|
-
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
32119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_react67.NodeViewWrapper, { className: "group/code relative my-4 rounded-xl border border-border/60 bg-muted/40 p-4 font-mono text-sm shadow-sm overflow-visible", children: [
|
|
31802
32120
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
31803
32121
|
"div",
|
|
31804
32122
|
{
|
|
@@ -31814,7 +32132,7 @@ var CodeBlockView = ({
|
|
|
31814
32132
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
31815
32133
|
children: [
|
|
31816
32134
|
currentLangLabel,
|
|
31817
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
32135
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react49.ChevronDown, { className: "h-3 w-3" })
|
|
31818
32136
|
]
|
|
31819
32137
|
}
|
|
31820
32138
|
),
|
|
@@ -31851,13 +32169,13 @@ var CodeBlockView = ({
|
|
|
31851
32169
|
onClick: handleCopy,
|
|
31852
32170
|
className: "flex h-7 w-7 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
31853
32171
|
title: "Copy code",
|
|
31854
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
32172
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react49.Check, { className: "h-3.5 w-3.5 text-success animate-in fade-in-0 zoom-in-75" }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react49.Copy, { className: "h-3.5 w-3.5" })
|
|
31855
32173
|
}
|
|
31856
32174
|
)
|
|
31857
32175
|
]
|
|
31858
32176
|
}
|
|
31859
32177
|
),
|
|
31860
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("pre", { className: "m-0 overflow-x-auto [scrollbar-width:thin] pt-4 sm:pt-0", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("code", { className: "bg-transparent! text-foreground!", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
32178
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("pre", { className: "m-0 overflow-x-auto [scrollbar-width:thin] pt-4 sm:pt-0", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("code", { className: "bg-transparent! text-foreground!", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react67.NodeViewContent, {}) }) })
|
|
31861
32179
|
] });
|
|
31862
32180
|
};
|
|
31863
32181
|
|
|
@@ -31970,7 +32288,7 @@ var CustomTableCell = import_extension_table_cell.default.extend({
|
|
|
31970
32288
|
},
|
|
31971
32289
|
textDirection: {
|
|
31972
32290
|
default: null,
|
|
31973
|
-
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" ||
|
|
32291
|
+
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
|
|
31974
32292
|
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
31975
32293
|
}
|
|
31976
32294
|
};
|
|
@@ -31989,7 +32307,7 @@ var CustomTableCell = import_extension_table_cell.default.extend({
|
|
|
31989
32307
|
if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
|
|
31990
32308
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
31991
32309
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
31992
|
-
if (textDirection === "vertical") mergedStyle += "; writing-mode:
|
|
32310
|
+
if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
|
|
31993
32311
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
31994
32312
|
return [
|
|
31995
32313
|
"td",
|
|
@@ -32096,7 +32414,7 @@ var CustomTableHeader = import_extension_table_header.default.extend({
|
|
|
32096
32414
|
},
|
|
32097
32415
|
textDirection: {
|
|
32098
32416
|
default: null,
|
|
32099
|
-
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" ||
|
|
32417
|
+
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
|
|
32100
32418
|
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
32101
32419
|
}
|
|
32102
32420
|
};
|
|
@@ -32115,7 +32433,7 @@ var CustomTableHeader = import_extension_table_header.default.extend({
|
|
|
32115
32433
|
if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
|
|
32116
32434
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
32117
32435
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
32118
|
-
if (textDirection === "vertical") mergedStyle += "; writing-mode:
|
|
32436
|
+
if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
|
|
32119
32437
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
32120
32438
|
return [
|
|
32121
32439
|
"th",
|
|
@@ -32145,7 +32463,7 @@ var CustomTaskList = import_extension_task_list.default.extend({
|
|
|
32145
32463
|
var lowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
|
|
32146
32464
|
var CustomCodeBlockLowlight = import_extension_code_block_lowlight.default.extend({
|
|
32147
32465
|
addNodeView() {
|
|
32148
|
-
return (0,
|
|
32466
|
+
return (0, import_react68.ReactNodeViewRenderer)(CodeBlockView);
|
|
32149
32467
|
}
|
|
32150
32468
|
});
|
|
32151
32469
|
function buildUEditorExtensions({
|
|
@@ -32295,14 +32613,14 @@ function buildUEditorExtensions({
|
|
|
32295
32613
|
}
|
|
32296
32614
|
|
|
32297
32615
|
// src/components/UEditor/toolbar.tsx
|
|
32298
|
-
var
|
|
32299
|
-
var
|
|
32300
|
-
var
|
|
32616
|
+
var import_react71 = __toESM(require("react"), 1);
|
|
32617
|
+
var import_react72 = require("@tiptap/react");
|
|
32618
|
+
var import_lucide_react52 = require("lucide-react");
|
|
32301
32619
|
var import_tables4 = require("@tiptap/pm/tables");
|
|
32302
32620
|
|
|
32303
32621
|
// src/components/UEditor/colors.tsx
|
|
32304
|
-
var
|
|
32305
|
-
var
|
|
32622
|
+
var import_react69 = require("react");
|
|
32623
|
+
var import_lucide_react50 = require("lucide-react");
|
|
32306
32624
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
32307
32625
|
var TextColorIcon = ({ color }) => {
|
|
32308
32626
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
@@ -32321,7 +32639,7 @@ var TextColorIcon = ({ color }) => {
|
|
|
32321
32639
|
var HighlightColorIcon = ({ color }) => {
|
|
32322
32640
|
const underlineColor = color || "currentColor";
|
|
32323
32641
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32324
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32642
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react50.Highlighter, { className: "h-4 w-4" }),
|
|
32325
32643
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32326
32644
|
"span",
|
|
32327
32645
|
{
|
|
@@ -32335,7 +32653,7 @@ var HighlightColorIcon = ({ color }) => {
|
|
|
32335
32653
|
var CellBgColorIcon = ({ color }) => {
|
|
32336
32654
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32337
32655
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32338
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32656
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react50.Paintbrush, { className: "h-4 w-4" }),
|
|
32339
32657
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32340
32658
|
"span",
|
|
32341
32659
|
{
|
|
@@ -32349,7 +32667,7 @@ var CellBgColorIcon = ({ color }) => {
|
|
|
32349
32667
|
var CellBorderIcon = ({ color }) => {
|
|
32350
32668
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32351
32669
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32352
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32670
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react50.Grid, { className: "h-4 w-4" }),
|
|
32353
32671
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32354
32672
|
"span",
|
|
32355
32673
|
{
|
|
@@ -32436,7 +32754,7 @@ function getSwatchCheckClass(color) {
|
|
|
32436
32754
|
}
|
|
32437
32755
|
var useEditorColors = () => {
|
|
32438
32756
|
const t = useSmartTranslations("UEditor");
|
|
32439
|
-
const textColors = (0,
|
|
32757
|
+
const textColors = (0, import_react69.useMemo)(
|
|
32440
32758
|
() => [
|
|
32441
32759
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
32442
32760
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -32450,7 +32768,7 @@ var useEditorColors = () => {
|
|
|
32450
32768
|
],
|
|
32451
32769
|
[t]
|
|
32452
32770
|
);
|
|
32453
|
-
const highlightColors = (0,
|
|
32771
|
+
const highlightColors = (0, import_react69.useMemo)(
|
|
32454
32772
|
() => [
|
|
32455
32773
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
32456
32774
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -32474,7 +32792,7 @@ var EditorColorPalette = ({
|
|
|
32474
32792
|
label
|
|
32475
32793
|
}) => {
|
|
32476
32794
|
const t = useSmartTranslations("UEditor");
|
|
32477
|
-
const colorInputRef = (0,
|
|
32795
|
+
const colorInputRef = (0, import_react69.useRef)(null);
|
|
32478
32796
|
const automaticColor = colors[0]?.color ?? "";
|
|
32479
32797
|
const paletteColors = colors.slice(1);
|
|
32480
32798
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "w-56 p-2", children: [
|
|
@@ -32491,7 +32809,7 @@ var EditorColorPalette = ({
|
|
|
32491
32809
|
currentColor === automaticColor ? "border-primary text-primary" : "border-transparent text-foreground"
|
|
32492
32810
|
),
|
|
32493
32811
|
children: [
|
|
32494
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "flex h-5 w-5 items-center justify-center rounded border border-border bg-background", children: currentColor === automaticColor && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32812
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "flex h-5 w-5 items-center justify-center rounded border border-border bg-background", children: currentColor === automaticColor && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react50.Check, { className: "h-3.5 w-3.5" }) }),
|
|
32495
32813
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "flex-1 text-center", children: t("colors.automatic") })
|
|
32496
32814
|
]
|
|
32497
32815
|
}
|
|
@@ -32508,7 +32826,7 @@ var EditorColorPalette = ({
|
|
|
32508
32826
|
currentColor === c.color ? "border-primary ring-2 ring-primary/25" : "border-border/70"
|
|
32509
32827
|
),
|
|
32510
32828
|
style: { backgroundColor: c.color || "transparent" },
|
|
32511
|
-
children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32829
|
+
children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react50.Check, { className: cn("h-3.5 w-3.5", getSwatchCheckClass(c.color)) }) })
|
|
32512
32830
|
}
|
|
32513
32831
|
) }, `${c.name}-${c.color}`)) }),
|
|
32514
32832
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
@@ -32530,7 +32848,7 @@ var EditorColorPalette = ({
|
|
|
32530
32848
|
}
|
|
32531
32849
|
),
|
|
32532
32850
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
32533
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32851
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react50.Palette, { className: "h-4 w-4 text-muted-foreground" }),
|
|
32534
32852
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32535
32853
|
"input",
|
|
32536
32854
|
{
|
|
@@ -32676,8 +32994,8 @@ function deleteSelectedImage(editor) {
|
|
|
32676
32994
|
}
|
|
32677
32995
|
|
|
32678
32996
|
// src/components/UEditor/inputs.tsx
|
|
32679
|
-
var
|
|
32680
|
-
var
|
|
32997
|
+
var import_react70 = require("react");
|
|
32998
|
+
var import_lucide_react51 = require("lucide-react");
|
|
32681
32999
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
32682
33000
|
function normalizeUrl(raw) {
|
|
32683
33001
|
return sanitizeUEditorUrl(raw, "link");
|
|
@@ -32688,11 +33006,11 @@ var LinkInput = ({
|
|
|
32688
33006
|
initialUrl = ""
|
|
32689
33007
|
}) => {
|
|
32690
33008
|
const t = useSmartTranslations("UEditor");
|
|
32691
|
-
const [url, setUrl] = (0,
|
|
32692
|
-
const [error, setError] = (0,
|
|
32693
|
-
const inputRef = (0,
|
|
32694
|
-
const errorId = (0,
|
|
32695
|
-
(0,
|
|
33009
|
+
const [url, setUrl] = (0, import_react70.useState)(initialUrl);
|
|
33010
|
+
const [error, setError] = (0, import_react70.useState)("");
|
|
33011
|
+
const inputRef = (0, import_react70.useRef)(null);
|
|
33012
|
+
const errorId = (0, import_react70.useId)();
|
|
33013
|
+
(0, import_react70.useEffect)(() => {
|
|
32696
33014
|
inputRef.current?.focus();
|
|
32697
33015
|
inputRef.current?.select();
|
|
32698
33016
|
}, []);
|
|
@@ -32724,18 +33042,18 @@ var LinkInput = ({
|
|
|
32724
33042
|
className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20 aria-invalid:ring-2 aria-invalid:ring-destructive/40"
|
|
32725
33043
|
}
|
|
32726
33044
|
),
|
|
32727
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32728
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33045
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react51.Check, { className: "w-4 h-4" }) }),
|
|
33046
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react51.X, { className: "w-4 h-4" }) })
|
|
32729
33047
|
] }),
|
|
32730
33048
|
error ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { id: errorId, role: "alert", className: "mt-1.5 px-1 text-xs text-destructive", children: error }) : null
|
|
32731
33049
|
] });
|
|
32732
33050
|
};
|
|
32733
33051
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
32734
33052
|
const t = useSmartTranslations("UEditor");
|
|
32735
|
-
const [url, setUrl] = (0,
|
|
32736
|
-
const [alt, setAlt] = (0,
|
|
32737
|
-
const inputRef = (0,
|
|
32738
|
-
(0,
|
|
33053
|
+
const [url, setUrl] = (0, import_react70.useState)("");
|
|
33054
|
+
const [alt, setAlt] = (0, import_react70.useState)("");
|
|
33055
|
+
const inputRef = (0, import_react70.useRef)(null);
|
|
33056
|
+
(0, import_react70.useEffect)(() => {
|
|
32739
33057
|
inputRef.current?.focus();
|
|
32740
33058
|
}, []);
|
|
32741
33059
|
const handleSubmit = (e) => {
|
|
@@ -33201,7 +33519,7 @@ function fileToDataUrl2(file) {
|
|
|
33201
33519
|
function formatTableInsertLabel(template, rows, cols) {
|
|
33202
33520
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
33203
33521
|
}
|
|
33204
|
-
var ToolbarButton =
|
|
33522
|
+
var ToolbarButton = import_react71.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
33205
33523
|
const button = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33206
33524
|
"button",
|
|
33207
33525
|
{
|
|
@@ -33238,7 +33556,7 @@ var TableInsertGrid = ({
|
|
|
33238
33556
|
previewTemplate,
|
|
33239
33557
|
onInsert
|
|
33240
33558
|
}) => {
|
|
33241
|
-
const [selection, setSelection] =
|
|
33559
|
+
const [selection, setSelection] = import_react71.default.useState({ rows: 3, cols: 3 });
|
|
33242
33560
|
const maxRows = 8;
|
|
33243
33561
|
const maxCols = 8;
|
|
33244
33562
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
@@ -33291,18 +33609,18 @@ var EditorToolbar = ({
|
|
|
33291
33609
|
letterSpacings
|
|
33292
33610
|
}) => {
|
|
33293
33611
|
const t = useSmartTranslations("UEditor");
|
|
33294
|
-
(0,
|
|
33612
|
+
(0, import_react72.useEditorState)({
|
|
33295
33613
|
editor,
|
|
33296
33614
|
selector: ({ transactionNumber }) => transactionNumber
|
|
33297
33615
|
});
|
|
33298
33616
|
const { textColors, highlightColors } = useEditorColors();
|
|
33299
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
33300
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
33301
|
-
const [isTableMenuOpen, setIsTableMenuOpen] = (0,
|
|
33302
|
-
const [preservedTableAnchorPos, setPreservedTableAnchorPos] = (0,
|
|
33303
|
-
const fileInputRef = (0,
|
|
33304
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
33305
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
33617
|
+
const [showImageInput, setShowImageInput] = (0, import_react71.useState)(false);
|
|
33618
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react71.useState)(false);
|
|
33619
|
+
const [isTableMenuOpen, setIsTableMenuOpen] = (0, import_react71.useState)(false);
|
|
33620
|
+
const [preservedTableAnchorPos, setPreservedTableAnchorPos] = (0, import_react71.useState)(null);
|
|
33621
|
+
const fileInputRef = (0, import_react71.useRef)(null);
|
|
33622
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react71.useState)(false);
|
|
33623
|
+
const [imageUploadError, setImageUploadError] = (0, import_react71.useState)(null);
|
|
33306
33624
|
const isImageSelected = editor.isActive("image");
|
|
33307
33625
|
const imageAttrs = editor.getAttributes("image");
|
|
33308
33626
|
const tableAnchorPos = getTableAnchorPos(editor);
|
|
@@ -33325,10 +33643,10 @@ var EditorToolbar = ({
|
|
|
33325
33643
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
33326
33644
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
33327
33645
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
33328
|
-
const availableFontFamilies =
|
|
33329
|
-
const availableFontSizes =
|
|
33330
|
-
const availableLineHeights =
|
|
33331
|
-
const availableLetterSpacings =
|
|
33646
|
+
const availableFontFamilies = import_react71.default.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
33647
|
+
const availableFontSizes = import_react71.default.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
33648
|
+
const availableLineHeights = import_react71.default.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
33649
|
+
const availableLetterSpacings = import_react71.default.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
33332
33650
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
33333
33651
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
33334
33652
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
|
|
@@ -33366,18 +33684,18 @@ var EditorToolbar = ({
|
|
|
33366
33684
|
};
|
|
33367
33685
|
if (variant === "minimal") {
|
|
33368
33686
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/35 bg-muted/30 p-1.5", children: [
|
|
33369
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33370
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33687
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Undo, { className: "w-4 h-4" }) }),
|
|
33688
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Redo, { className: "w-4 h-4" }) }),
|
|
33371
33689
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
33372
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33373
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33690
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Bold, { className: "w-4 h-4" }) }),
|
|
33691
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Italic, { className: "w-4 h-4" }) }),
|
|
33374
33692
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33375
33693
|
ToolbarButton,
|
|
33376
33694
|
{
|
|
33377
33695
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
33378
33696
|
active: editor.isActive("bulletList"),
|
|
33379
33697
|
title: t("toolbar.bulletList"),
|
|
33380
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.List, { className: "w-4 h-4" })
|
|
33381
33699
|
}
|
|
33382
33700
|
),
|
|
33383
33701
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
@@ -33385,14 +33703,14 @@ var EditorToolbar = ({
|
|
|
33385
33703
|
{
|
|
33386
33704
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33387
33705
|
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
33388
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33389
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33706
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
33707
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33390
33708
|
] }),
|
|
33391
33709
|
children: [
|
|
33392
33710
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33393
33711
|
DropdownMenuItem,
|
|
33394
33712
|
{
|
|
33395
|
-
icon:
|
|
33713
|
+
icon: import_lucide_react52.SquareCheckBig,
|
|
33396
33714
|
label: t("slashCommand.formCheckbox"),
|
|
33397
33715
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
33398
33716
|
}
|
|
@@ -33400,7 +33718,7 @@ var EditorToolbar = ({
|
|
|
33400
33718
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33401
33719
|
DropdownMenuItem,
|
|
33402
33720
|
{
|
|
33403
|
-
icon:
|
|
33721
|
+
icon: import_lucide_react52.CircleCheckBig,
|
|
33404
33722
|
label: t("slashCommand.roundCheckbox"),
|
|
33405
33723
|
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
33406
33724
|
}
|
|
@@ -33412,7 +33730,7 @@ var EditorToolbar = ({
|
|
|
33412
33730
|
DropdownMenu,
|
|
33413
33731
|
{
|
|
33414
33732
|
contentClassName: "min-w-72",
|
|
33415
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33733
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Link, { className: "w-4 h-4" }) }),
|
|
33416
33734
|
children: showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33417
33735
|
LinkInput,
|
|
33418
33736
|
{
|
|
@@ -33427,7 +33745,7 @@ var EditorToolbar = ({
|
|
|
33427
33745
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33428
33746
|
DropdownMenuItem,
|
|
33429
33747
|
{
|
|
33430
|
-
icon:
|
|
33748
|
+
icon: import_lucide_react52.Link,
|
|
33431
33749
|
label: t("toolbar.link"),
|
|
33432
33750
|
onClick: () => setShowLinkInput(true),
|
|
33433
33751
|
active: editor.isActive("link"),
|
|
@@ -33437,7 +33755,7 @@ var EditorToolbar = ({
|
|
|
33437
33755
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33438
33756
|
DropdownMenuItem,
|
|
33439
33757
|
{
|
|
33440
|
-
icon:
|
|
33758
|
+
icon: import_lucide_react52.Trash2,
|
|
33441
33759
|
label: t("toolbar.removeLink"),
|
|
33442
33760
|
onClick: () => editor.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
33443
33761
|
disabled: !editor.isActive("link"),
|
|
@@ -33449,7 +33767,7 @@ var EditorToolbar = ({
|
|
|
33449
33767
|
)
|
|
33450
33768
|
] });
|
|
33451
33769
|
}
|
|
33452
|
-
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ?
|
|
33770
|
+
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? import_lucide_react52.AlignCenterVertical : currentCellVerticalAlign === "bottom" ? import_lucide_react52.AlignEndVertical : import_lucide_react52.AlignStartVertical;
|
|
33453
33771
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/35 bg-linear-to-r from-muted/25 to-transparent p-1.5", children: [
|
|
33454
33772
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33455
33773
|
DropdownMenu,
|
|
@@ -33457,7 +33775,7 @@ var EditorToolbar = ({
|
|
|
33457
33775
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33458
33776
|
}, title: t("toolbar.fontFamily"), className: "min-w-0 max-w-40 px-1.5 w-auto gap-1", children: [
|
|
33459
33777
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "max-w-28 truncate text-xs font-medium", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
|
|
33460
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33778
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
33461
33779
|
] }),
|
|
33462
33780
|
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
33463
33781
|
children: availableFontFamilies.map((option) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -33478,10 +33796,10 @@ var EditorToolbar = ({
|
|
|
33478
33796
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33479
33797
|
}, title: t("toolbar.fontSize"), className: "px-1.5 w-auto gap-1", children: [
|
|
33480
33798
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-0.5", children: [
|
|
33481
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33799
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground", strokeWidth: 2.5 }),
|
|
33482
33800
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "min-w-4 text-center text-xs font-semibold leading-none", children: displayedFontSizeLabel })
|
|
33483
33801
|
] }),
|
|
33484
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33802
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
33485
33803
|
] }),
|
|
33486
33804
|
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
33487
33805
|
children: availableFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -33501,14 +33819,14 @@ var EditorToolbar = ({
|
|
|
33501
33819
|
contentClassName: "p-1",
|
|
33502
33820
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33503
33821
|
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
33504
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33505
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33822
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Type, { className: "w-4 h-4" }),
|
|
33823
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
33506
33824
|
] }),
|
|
33507
33825
|
children: [
|
|
33508
33826
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33509
33827
|
DropdownMenuItem,
|
|
33510
33828
|
{
|
|
33511
|
-
icon:
|
|
33829
|
+
icon: import_lucide_react52.Type,
|
|
33512
33830
|
label: t("toolbar.normal"),
|
|
33513
33831
|
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
33514
33832
|
active: editor.isActive("paragraph")
|
|
@@ -33517,7 +33835,7 @@ var EditorToolbar = ({
|
|
|
33517
33835
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33518
33836
|
DropdownMenuItem,
|
|
33519
33837
|
{
|
|
33520
|
-
icon:
|
|
33838
|
+
icon: import_lucide_react52.Heading1,
|
|
33521
33839
|
label: t("toolbar.heading1"),
|
|
33522
33840
|
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
33523
33841
|
active: editor.isActive("heading", { level: 1 }),
|
|
@@ -33527,7 +33845,7 @@ var EditorToolbar = ({
|
|
|
33527
33845
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33528
33846
|
DropdownMenuItem,
|
|
33529
33847
|
{
|
|
33530
|
-
icon:
|
|
33848
|
+
icon: import_lucide_react52.Heading2,
|
|
33531
33849
|
label: t("toolbar.heading2"),
|
|
33532
33850
|
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
33533
33851
|
active: editor.isActive("heading", { level: 2 }),
|
|
@@ -33537,7 +33855,7 @@ var EditorToolbar = ({
|
|
|
33537
33855
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33538
33856
|
DropdownMenuItem,
|
|
33539
33857
|
{
|
|
33540
|
-
icon:
|
|
33858
|
+
icon: import_lucide_react52.Heading3,
|
|
33541
33859
|
label: t("toolbar.heading3"),
|
|
33542
33860
|
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
33543
33861
|
active: editor.isActive("heading", { level: 3 }),
|
|
@@ -33553,15 +33871,15 @@ var EditorToolbar = ({
|
|
|
33553
33871
|
{
|
|
33554
33872
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33555
33873
|
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: [
|
|
33556
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33557
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33874
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowUp, { className: "w-3 h-3" }),
|
|
33875
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowDown, { className: "w-3 h-3" })
|
|
33558
33876
|
] }),
|
|
33559
33877
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33560
33878
|
children: [
|
|
33561
33879
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33562
33880
|
DropdownMenuItem,
|
|
33563
33881
|
{
|
|
33564
|
-
icon:
|
|
33882
|
+
icon: import_lucide_react52.Type,
|
|
33565
33883
|
label: t("toolbar.lineHeightDefault"),
|
|
33566
33884
|
onClick: () => editor.chain().focus().unsetLineHeight().run(),
|
|
33567
33885
|
active: !currentLineHeight
|
|
@@ -33584,15 +33902,15 @@ var EditorToolbar = ({
|
|
|
33584
33902
|
{
|
|
33585
33903
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33586
33904
|
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: [
|
|
33587
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33588
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33905
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowLeft, { className: "w-3 h-3" }),
|
|
33906
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowRight, { className: "w-3 h-3" })
|
|
33589
33907
|
] }),
|
|
33590
33908
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33591
33909
|
children: [
|
|
33592
33910
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33593
33911
|
DropdownMenuItem,
|
|
33594
33912
|
{
|
|
33595
|
-
icon:
|
|
33913
|
+
icon: import_lucide_react52.Type,
|
|
33596
33914
|
label: t("toolbar.letterSpacingDefault"),
|
|
33597
33915
|
onClick: () => editor.chain().focus().unsetLetterSpacing().run(),
|
|
33598
33916
|
active: !currentLetterSpacing
|
|
@@ -33612,19 +33930,19 @@ var EditorToolbar = ({
|
|
|
33612
33930
|
)
|
|
33613
33931
|
] }),
|
|
33614
33932
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
33615
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33616
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33933
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Bold, { className: "w-4 h-4" }) }),
|
|
33934
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Italic, { className: "w-4 h-4" }) }),
|
|
33617
33935
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33618
33936
|
ToolbarButton,
|
|
33619
33937
|
{
|
|
33620
33938
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
33621
33939
|
active: editor.isActive("underline"),
|
|
33622
33940
|
title: t("toolbar.underline"),
|
|
33623
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Underline, { className: "w-4 h-4" })
|
|
33624
33942
|
}
|
|
33625
33943
|
),
|
|
33626
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33627
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33944
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Strikethrough, { className: "w-4 h-4" }) }),
|
|
33945
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Code, { className: "w-4 h-4" }) }),
|
|
33628
33946
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
33629
33947
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33630
33948
|
ToolbarButton,
|
|
@@ -33632,7 +33950,7 @@ var EditorToolbar = ({
|
|
|
33632
33950
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
33633
33951
|
active: editor.isActive("subscript"),
|
|
33634
33952
|
title: t("toolbar.subscript"),
|
|
33635
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Subscript, { className: "w-4 h-4" })
|
|
33636
33954
|
}
|
|
33637
33955
|
),
|
|
33638
33956
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -33641,7 +33959,7 @@ var EditorToolbar = ({
|
|
|
33641
33959
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
33642
33960
|
active: editor.isActive("superscript"),
|
|
33643
33961
|
title: t("toolbar.superscript"),
|
|
33644
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33962
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Superscript, { className: "w-4 h-4" })
|
|
33645
33963
|
}
|
|
33646
33964
|
)
|
|
33647
33965
|
] }),
|
|
@@ -33649,7 +33967,7 @@ var EditorToolbar = ({
|
|
|
33649
33967
|
DropdownMenu,
|
|
33650
33968
|
{
|
|
33651
33969
|
contentClassName: "min-w-72",
|
|
33652
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33970
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Link, { className: "w-4 h-4" }) }),
|
|
33653
33971
|
children: showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33654
33972
|
LinkInput,
|
|
33655
33973
|
{
|
|
@@ -33664,7 +33982,7 @@ var EditorToolbar = ({
|
|
|
33664
33982
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33665
33983
|
DropdownMenuItem,
|
|
33666
33984
|
{
|
|
33667
|
-
icon:
|
|
33985
|
+
icon: import_lucide_react52.Link,
|
|
33668
33986
|
label: t("toolbar.link"),
|
|
33669
33987
|
onClick: () => setShowLinkInput(true),
|
|
33670
33988
|
active: editor.isActive("link"),
|
|
@@ -33674,7 +33992,7 @@ var EditorToolbar = ({
|
|
|
33674
33992
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33675
33993
|
DropdownMenuItem,
|
|
33676
33994
|
{
|
|
33677
|
-
icon:
|
|
33995
|
+
icon: import_lucide_react52.Trash2,
|
|
33678
33996
|
label: t("toolbar.removeLink"),
|
|
33679
33997
|
onClick: () => editor.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
33680
33998
|
disabled: !editor.isActive("link"),
|
|
@@ -33691,7 +34009,7 @@ var EditorToolbar = ({
|
|
|
33691
34009
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33692
34010
|
}, title: t("colors.textColor"), children: [
|
|
33693
34011
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TextColorIcon, { color: currentTextColor }),
|
|
33694
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34012
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33695
34013
|
] }),
|
|
33696
34014
|
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33697
34015
|
EditorColorPalette,
|
|
@@ -33716,7 +34034,7 @@ var EditorToolbar = ({
|
|
|
33716
34034
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33717
34035
|
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
33718
34036
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(HighlightColorIcon, { color: currentHighlightColor }),
|
|
33719
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34037
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33720
34038
|
] }),
|
|
33721
34039
|
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33722
34040
|
EditorColorPalette,
|
|
@@ -33742,7 +34060,7 @@ var EditorToolbar = ({
|
|
|
33742
34060
|
{
|
|
33743
34061
|
contentClassName: "p-0 overflow-hidden",
|
|
33744
34062
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => {
|
|
33745
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34063
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Smile, { className: "w-4 h-4" }) }),
|
|
33746
34064
|
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33747
34065
|
EmojiPicker2,
|
|
33748
34066
|
{
|
|
@@ -33761,14 +34079,14 @@ var EditorToolbar = ({
|
|
|
33761
34079
|
{
|
|
33762
34080
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33763
34081
|
}, title: t("toolbar.alignment"), children: [
|
|
33764
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33765
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34082
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.AlignLeft, { className: "w-4 h-4" }),
|
|
34083
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33766
34084
|
] }),
|
|
33767
34085
|
children: [
|
|
33768
34086
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33769
34087
|
DropdownMenuItem,
|
|
33770
34088
|
{
|
|
33771
|
-
icon:
|
|
34089
|
+
icon: import_lucide_react52.AlignLeft,
|
|
33772
34090
|
label: t("toolbar.alignLeft"),
|
|
33773
34091
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
33774
34092
|
active: editor.isActive({ textAlign: "left" })
|
|
@@ -33777,7 +34095,7 @@ var EditorToolbar = ({
|
|
|
33777
34095
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33778
34096
|
DropdownMenuItem,
|
|
33779
34097
|
{
|
|
33780
|
-
icon:
|
|
34098
|
+
icon: import_lucide_react52.AlignCenter,
|
|
33781
34099
|
label: t("toolbar.alignCenter"),
|
|
33782
34100
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
33783
34101
|
active: editor.isActive({ textAlign: "center" })
|
|
@@ -33786,7 +34104,7 @@ var EditorToolbar = ({
|
|
|
33786
34104
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33787
34105
|
DropdownMenuItem,
|
|
33788
34106
|
{
|
|
33789
|
-
icon:
|
|
34107
|
+
icon: import_lucide_react52.AlignRight,
|
|
33790
34108
|
label: t("toolbar.alignRight"),
|
|
33791
34109
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
33792
34110
|
active: editor.isActive({ textAlign: "right" })
|
|
@@ -33795,7 +34113,7 @@ var EditorToolbar = ({
|
|
|
33795
34113
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33796
34114
|
DropdownMenuItem,
|
|
33797
34115
|
{
|
|
33798
|
-
icon:
|
|
34116
|
+
icon: import_lucide_react52.AlignJustify,
|
|
33799
34117
|
label: t("toolbar.justify"),
|
|
33800
34118
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
33801
34119
|
active: editor.isActive({ textAlign: "justify" })
|
|
@@ -33806,7 +34124,7 @@ var EditorToolbar = ({
|
|
|
33806
34124
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33807
34125
|
DropdownMenuItem,
|
|
33808
34126
|
{
|
|
33809
|
-
icon:
|
|
34127
|
+
icon: import_lucide_react52.AlignStartVertical,
|
|
33810
34128
|
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
33811
34129
|
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "top"),
|
|
33812
34130
|
active: currentCellVerticalAlign === "top"
|
|
@@ -33815,7 +34133,7 @@ var EditorToolbar = ({
|
|
|
33815
34133
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33816
34134
|
DropdownMenuItem,
|
|
33817
34135
|
{
|
|
33818
|
-
icon:
|
|
34136
|
+
icon: import_lucide_react52.AlignCenterVertical,
|
|
33819
34137
|
label: t("tableMenu.alignVerticalMiddle") || "Align middle",
|
|
33820
34138
|
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "middle"),
|
|
33821
34139
|
active: currentCellVerticalAlign === "middle"
|
|
@@ -33824,7 +34142,7 @@ var EditorToolbar = ({
|
|
|
33824
34142
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33825
34143
|
DropdownMenuItem,
|
|
33826
34144
|
{
|
|
33827
|
-
icon:
|
|
34145
|
+
icon: import_lucide_react52.AlignEndVertical,
|
|
33828
34146
|
label: t("tableMenu.alignVerticalBottom") || "Align bottom",
|
|
33829
34147
|
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "bottom"),
|
|
33830
34148
|
active: currentCellVerticalAlign === "bottom"
|
|
@@ -33839,14 +34157,14 @@ var EditorToolbar = ({
|
|
|
33839
34157
|
{
|
|
33840
34158
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33841
34159
|
}, title: t("tableMenu.textDirection"), children: [
|
|
33842
|
-
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33843
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34160
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" }),
|
|
34161
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33844
34162
|
] }),
|
|
33845
34163
|
children: [
|
|
33846
34164
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33847
34165
|
DropdownMenuItem,
|
|
33848
34166
|
{
|
|
33849
|
-
icon:
|
|
34167
|
+
icon: import_lucide_react52.ArrowRight,
|
|
33850
34168
|
label: t("tableMenu.horizontalText"),
|
|
33851
34169
|
onClick: () => applyTableCellAttribute(editor, "textDirection", null),
|
|
33852
34170
|
active: currentCellTextDirection === "horizontal"
|
|
@@ -33855,7 +34173,7 @@ var EditorToolbar = ({
|
|
|
33855
34173
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33856
34174
|
DropdownMenuItem,
|
|
33857
34175
|
{
|
|
33858
|
-
icon:
|
|
34176
|
+
icon: import_lucide_react52.ArrowDown,
|
|
33859
34177
|
label: t("tableMenu.verticalText"),
|
|
33860
34178
|
onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
|
|
33861
34179
|
active: currentCellTextDirection === "vertical"
|
|
@@ -33871,14 +34189,14 @@ var EditorToolbar = ({
|
|
|
33871
34189
|
{
|
|
33872
34190
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33873
34191
|
}, title: t("toolbar.bulletList"), children: [
|
|
33874
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33875
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34192
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.List, { className: "w-4 h-4" }),
|
|
34193
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33876
34194
|
] }),
|
|
33877
34195
|
children: [
|
|
33878
34196
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33879
34197
|
DropdownMenuItem,
|
|
33880
34198
|
{
|
|
33881
|
-
icon:
|
|
34199
|
+
icon: import_lucide_react52.List,
|
|
33882
34200
|
label: t("toolbar.bulletList"),
|
|
33883
34201
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
33884
34202
|
active: editor.isActive("bulletList"),
|
|
@@ -33888,7 +34206,7 @@ var EditorToolbar = ({
|
|
|
33888
34206
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33889
34207
|
DropdownMenuItem,
|
|
33890
34208
|
{
|
|
33891
|
-
icon:
|
|
34209
|
+
icon: import_lucide_react52.ListOrdered,
|
|
33892
34210
|
label: t("toolbar.orderedList"),
|
|
33893
34211
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
33894
34212
|
active: editor.isActive("orderedList"),
|
|
@@ -33898,7 +34216,7 @@ var EditorToolbar = ({
|
|
|
33898
34216
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33899
34217
|
DropdownMenuItem,
|
|
33900
34218
|
{
|
|
33901
|
-
icon:
|
|
34219
|
+
icon: import_lucide_react52.ListTodo,
|
|
33902
34220
|
label: t("toolbar.taskList"),
|
|
33903
34221
|
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
33904
34222
|
active: editor.isActive("taskList"),
|
|
@@ -33913,14 +34231,14 @@ var EditorToolbar = ({
|
|
|
33913
34231
|
{
|
|
33914
34232
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33915
34233
|
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
33916
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33917
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34234
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
34235
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33918
34236
|
] }),
|
|
33919
34237
|
children: [
|
|
33920
34238
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33921
34239
|
DropdownMenuItem,
|
|
33922
34240
|
{
|
|
33923
|
-
icon:
|
|
34241
|
+
icon: import_lucide_react52.SquareCheckBig,
|
|
33924
34242
|
label: t("slashCommand.formCheckbox"),
|
|
33925
34243
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
33926
34244
|
}
|
|
@@ -33928,7 +34246,7 @@ var EditorToolbar = ({
|
|
|
33928
34246
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33929
34247
|
DropdownMenuItem,
|
|
33930
34248
|
{
|
|
33931
|
-
icon:
|
|
34249
|
+
icon: import_lucide_react52.CircleCheckBig,
|
|
33932
34250
|
label: t("slashCommand.roundCheckbox"),
|
|
33933
34251
|
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
33934
34252
|
}
|
|
@@ -33936,20 +34254,20 @@ var EditorToolbar = ({
|
|
|
33936
34254
|
]
|
|
33937
34255
|
}
|
|
33938
34256
|
),
|
|
33939
|
-
isMediumFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34257
|
+
isMediumFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Quote, { className: "w-4 h-4" }) }),
|
|
33940
34258
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
33941
34259
|
DropdownMenu,
|
|
33942
34260
|
{
|
|
33943
34261
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33944
34262
|
}, title: t("toolbar.quote"), children: [
|
|
33945
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33946
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34263
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Quote, { className: "w-4 h-4" }),
|
|
34264
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33947
34265
|
] }),
|
|
33948
34266
|
children: [
|
|
33949
34267
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33950
34268
|
DropdownMenuItem,
|
|
33951
34269
|
{
|
|
33952
|
-
icon:
|
|
34270
|
+
icon: import_lucide_react52.Quote,
|
|
33953
34271
|
label: t("toolbar.quote"),
|
|
33954
34272
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
33955
34273
|
active: editor.isActive("blockquote"),
|
|
@@ -33959,7 +34277,7 @@ var EditorToolbar = ({
|
|
|
33959
34277
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33960
34278
|
DropdownMenuItem,
|
|
33961
34279
|
{
|
|
33962
|
-
icon:
|
|
34280
|
+
icon: import_lucide_react52.FileCode,
|
|
33963
34281
|
label: t("toolbar.codeBlock"),
|
|
33964
34282
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
33965
34283
|
active: editor.isActive("codeBlock"),
|
|
@@ -33974,8 +34292,8 @@ var EditorToolbar = ({
|
|
|
33974
34292
|
{
|
|
33975
34293
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33976
34294
|
}, title: t("toolbar.image"), children: [
|
|
33977
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33978
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34295
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Image, { className: "w-4 h-4" }),
|
|
34296
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33979
34297
|
] }),
|
|
33980
34298
|
children: showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33981
34299
|
ImageInput,
|
|
@@ -33987,11 +34305,11 @@ var EditorToolbar = ({
|
|
|
33987
34305
|
onCancel: () => setShowImageInput(false)
|
|
33988
34306
|
}
|
|
33989
34307
|
) : /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
33990
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenuItem, { icon:
|
|
34308
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenuItem, { icon: import_lucide_react52.Link, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
33991
34309
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33992
34310
|
DropdownMenuItem,
|
|
33993
34311
|
{
|
|
33994
|
-
icon:
|
|
34312
|
+
icon: import_lucide_react52.Upload,
|
|
33995
34313
|
label: isUploadingImage ? t("imageInput.uploading") : t("imageInput.uploadTab"),
|
|
33996
34314
|
disabled: isUploadingImage,
|
|
33997
34315
|
onClick: () => fileInputRef.current?.click(),
|
|
@@ -34018,7 +34336,7 @@ var EditorToolbar = ({
|
|
|
34018
34336
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34019
34337
|
DropdownMenuItem,
|
|
34020
34338
|
{
|
|
34021
|
-
icon:
|
|
34339
|
+
icon: import_lucide_react52.AlignCenter,
|
|
34022
34340
|
label: t("toolbar.imageLayoutBlock"),
|
|
34023
34341
|
onClick: () => applyImageLayout(editor, "block"),
|
|
34024
34342
|
active: isImageSelected && imageLayout === "block",
|
|
@@ -34028,7 +34346,7 @@ var EditorToolbar = ({
|
|
|
34028
34346
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34029
34347
|
DropdownMenuItem,
|
|
34030
34348
|
{
|
|
34031
|
-
icon:
|
|
34349
|
+
icon: import_lucide_react52.AlignLeft,
|
|
34032
34350
|
label: t("toolbar.imageLayoutLeft"),
|
|
34033
34351
|
onClick: () => applyImageLayout(editor, "left"),
|
|
34034
34352
|
active: isImageSelected && imageLayout === "left",
|
|
@@ -34038,7 +34356,7 @@ var EditorToolbar = ({
|
|
|
34038
34356
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34039
34357
|
DropdownMenuItem,
|
|
34040
34358
|
{
|
|
34041
|
-
icon:
|
|
34359
|
+
icon: import_lucide_react52.AlignRight,
|
|
34042
34360
|
label: t("toolbar.imageLayoutRight"),
|
|
34043
34361
|
onClick: () => applyImageLayout(editor, "right"),
|
|
34044
34362
|
active: isImageSelected && imageLayout === "right",
|
|
@@ -34077,7 +34395,7 @@ var EditorToolbar = ({
|
|
|
34077
34395
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34078
34396
|
DropdownMenuItem,
|
|
34079
34397
|
{
|
|
34080
|
-
icon:
|
|
34398
|
+
icon: import_lucide_react52.RotateCcw,
|
|
34081
34399
|
label: t("toolbar.imageResetSize"),
|
|
34082
34400
|
onClick: () => resetImageSize(editor),
|
|
34083
34401
|
disabled: !isImageSelected
|
|
@@ -34086,7 +34404,7 @@ var EditorToolbar = ({
|
|
|
34086
34404
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34087
34405
|
DropdownMenuItem,
|
|
34088
34406
|
{
|
|
34089
|
-
icon:
|
|
34407
|
+
icon: import_lucide_react52.Trash2,
|
|
34090
34408
|
label: t("toolbar.imageDelete"),
|
|
34091
34409
|
onClick: () => deleteSelectedImage(editor),
|
|
34092
34410
|
disabled: !isImageSelected,
|
|
@@ -34106,8 +34424,8 @@ var EditorToolbar = ({
|
|
|
34106
34424
|
},
|
|
34107
34425
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34108
34426
|
}, title: t("toolbar.table"), children: [
|
|
34109
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34110
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34427
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Table, { className: "w-4 h-4" }),
|
|
34428
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34111
34429
|
] }),
|
|
34112
34430
|
contentClassName: "p-2 min-w-56",
|
|
34113
34431
|
children: [
|
|
@@ -34127,7 +34445,7 @@ var EditorToolbar = ({
|
|
|
34127
34445
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34128
34446
|
DropdownMenuItem,
|
|
34129
34447
|
{
|
|
34130
|
-
icon:
|
|
34448
|
+
icon: import_lucide_react52.AlignLeft,
|
|
34131
34449
|
label: t("tableMenu.alignLeft"),
|
|
34132
34450
|
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
34133
34451
|
active: hasTableContext && currentTableAlign === "left",
|
|
@@ -34137,7 +34455,7 @@ var EditorToolbar = ({
|
|
|
34137
34455
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34138
34456
|
DropdownMenuItem,
|
|
34139
34457
|
{
|
|
34140
|
-
icon:
|
|
34458
|
+
icon: import_lucide_react52.AlignCenter,
|
|
34141
34459
|
label: t("tableMenu.alignCenter"),
|
|
34142
34460
|
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
34143
34461
|
active: hasTableContext && currentTableAlign === "center",
|
|
@@ -34147,7 +34465,7 @@ var EditorToolbar = ({
|
|
|
34147
34465
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34148
34466
|
DropdownMenuItem,
|
|
34149
34467
|
{
|
|
34150
|
-
icon:
|
|
34468
|
+
icon: import_lucide_react52.AlignRight,
|
|
34151
34469
|
label: t("tableMenu.alignRight"),
|
|
34152
34470
|
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
34153
34471
|
active: hasTableContext && currentTableAlign === "right",
|
|
@@ -34158,7 +34476,7 @@ var EditorToolbar = ({
|
|
|
34158
34476
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34159
34477
|
DropdownMenuItem,
|
|
34160
34478
|
{
|
|
34161
|
-
icon:
|
|
34479
|
+
icon: import_lucide_react52.ArrowLeft,
|
|
34162
34480
|
label: t("tableMenu.addColumnBefore"),
|
|
34163
34481
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34164
34482
|
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
@@ -34167,7 +34485,7 @@ var EditorToolbar = ({
|
|
|
34167
34485
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34168
34486
|
DropdownMenuItem,
|
|
34169
34487
|
{
|
|
34170
|
-
icon:
|
|
34488
|
+
icon: import_lucide_react52.ArrowDown,
|
|
34171
34489
|
label: t("tableMenu.addColumnAfter"),
|
|
34172
34490
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34173
34491
|
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
@@ -34176,7 +34494,7 @@ var EditorToolbar = ({
|
|
|
34176
34494
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34177
34495
|
DropdownMenuItem,
|
|
34178
34496
|
{
|
|
34179
|
-
icon:
|
|
34497
|
+
icon: import_lucide_react52.ArrowUp,
|
|
34180
34498
|
label: t("tableMenu.addRowBefore"),
|
|
34181
34499
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34182
34500
|
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
@@ -34185,7 +34503,7 @@ var EditorToolbar = ({
|
|
|
34185
34503
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34186
34504
|
DropdownMenuItem,
|
|
34187
34505
|
{
|
|
34188
|
-
icon:
|
|
34506
|
+
icon: import_lucide_react52.ArrowRight,
|
|
34189
34507
|
label: t("tableMenu.addRowAfter"),
|
|
34190
34508
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34191
34509
|
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
@@ -34195,7 +34513,7 @@ var EditorToolbar = ({
|
|
|
34195
34513
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34196
34514
|
DropdownMenuItem,
|
|
34197
34515
|
{
|
|
34198
|
-
icon:
|
|
34516
|
+
icon: import_lucide_react52.Table,
|
|
34199
34517
|
label: t("tableMenu.toggleHeaderRow"),
|
|
34200
34518
|
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
34201
34519
|
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
@@ -34204,7 +34522,7 @@ var EditorToolbar = ({
|
|
|
34204
34522
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34205
34523
|
DropdownMenuItem,
|
|
34206
34524
|
{
|
|
34207
|
-
icon:
|
|
34525
|
+
icon: import_lucide_react52.Table,
|
|
34208
34526
|
label: t("tableMenu.toggleHeaderColumn"),
|
|
34209
34527
|
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
34210
34528
|
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
@@ -34214,7 +34532,7 @@ var EditorToolbar = ({
|
|
|
34214
34532
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34215
34533
|
DropdownMenuItem,
|
|
34216
34534
|
{
|
|
34217
|
-
icon:
|
|
34535
|
+
icon: import_lucide_react52.Trash2,
|
|
34218
34536
|
label: t("tableMenu.deleteColumn"),
|
|
34219
34537
|
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34220
34538
|
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
@@ -34223,7 +34541,7 @@ var EditorToolbar = ({
|
|
|
34223
34541
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34224
34542
|
DropdownMenuItem,
|
|
34225
34543
|
{
|
|
34226
|
-
icon:
|
|
34544
|
+
icon: import_lucide_react52.Trash2,
|
|
34227
34545
|
label: t("tableMenu.deleteRow"),
|
|
34228
34546
|
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34229
34547
|
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
@@ -34232,7 +34550,7 @@ var EditorToolbar = ({
|
|
|
34232
34550
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34233
34551
|
DropdownMenuItem,
|
|
34234
34552
|
{
|
|
34235
|
-
icon:
|
|
34553
|
+
icon: import_lucide_react52.Trash2,
|
|
34236
34554
|
label: t("tableMenu.deleteTable"),
|
|
34237
34555
|
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
34238
34556
|
disabled: !hasTableContext || !editor.can().deleteTable()
|
|
@@ -34242,8 +34560,8 @@ var EditorToolbar = ({
|
|
|
34242
34560
|
}
|
|
34243
34561
|
),
|
|
34244
34562
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
34245
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34246
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34563
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Undo, { className: "w-4 h-4" }) }),
|
|
34564
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Redo, { className: "w-4 h-4" }) }),
|
|
34247
34565
|
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
34248
34566
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
34249
34567
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -34252,7 +34570,7 @@ var EditorToolbar = ({
|
|
|
34252
34570
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34253
34571
|
disabled: !editor.can().addColumnBefore(),
|
|
34254
34572
|
title: t("tableMenu.addColumnBefore"),
|
|
34255
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowLeft, { className: "w-4 h-4" })
|
|
34256
34574
|
}
|
|
34257
34575
|
),
|
|
34258
34576
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -34261,7 +34579,7 @@ var EditorToolbar = ({
|
|
|
34261
34579
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34262
34580
|
disabled: !editor.can().addColumnAfter(),
|
|
34263
34581
|
title: t("tableMenu.addColumnAfter"),
|
|
34264
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34582
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" })
|
|
34265
34583
|
}
|
|
34266
34584
|
),
|
|
34267
34585
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -34270,7 +34588,7 @@ var EditorToolbar = ({
|
|
|
34270
34588
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34271
34589
|
disabled: !editor.can().addRowBefore(),
|
|
34272
34590
|
title: t("tableMenu.addRowBefore"),
|
|
34273
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowUp, { className: "w-4 h-4" })
|
|
34274
34592
|
}
|
|
34275
34593
|
),
|
|
34276
34594
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -34279,7 +34597,7 @@ var EditorToolbar = ({
|
|
|
34279
34597
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34280
34598
|
disabled: !editor.can().addRowAfter(),
|
|
34281
34599
|
title: t("tableMenu.addRowAfter"),
|
|
34282
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" })
|
|
34283
34601
|
}
|
|
34284
34602
|
),
|
|
34285
34603
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -34295,7 +34613,7 @@ var EditorToolbar = ({
|
|
|
34295
34613
|
active: canSplitCell,
|
|
34296
34614
|
disabled: !canMergeCells && !canSplitCell,
|
|
34297
34615
|
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
34298
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34616
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.TableCellsMerge, { className: "w-4 h-4" })
|
|
34299
34617
|
}
|
|
34300
34618
|
)
|
|
34301
34619
|
] })
|
|
@@ -34303,15 +34621,143 @@ var EditorToolbar = ({
|
|
|
34303
34621
|
};
|
|
34304
34622
|
|
|
34305
34623
|
// src/components/UEditor/menus.tsx
|
|
34306
|
-
var
|
|
34307
|
-
var
|
|
34308
|
-
var
|
|
34624
|
+
var import_react73 = require("react");
|
|
34625
|
+
var import_react74 = require("@tiptap/react");
|
|
34626
|
+
var import_tables7 = require("@tiptap/pm/tables");
|
|
34309
34627
|
var import_react_dom8 = require("react-dom");
|
|
34310
|
-
var
|
|
34628
|
+
var import_lucide_react53 = require("lucide-react");
|
|
34629
|
+
|
|
34630
|
+
// src/components/UEditor/table-border-commands.ts
|
|
34631
|
+
var import_tables5 = require("@tiptap/pm/tables");
|
|
34632
|
+
var SIDES = ["top", "right", "bottom", "left"];
|
|
34633
|
+
var OPPOSITE_SIDE = {
|
|
34634
|
+
top: "bottom",
|
|
34635
|
+
right: "left",
|
|
34636
|
+
bottom: "top",
|
|
34637
|
+
left: "right"
|
|
34638
|
+
};
|
|
34639
|
+
function splitCssValues(value) {
|
|
34640
|
+
const values = [];
|
|
34641
|
+
let token = "";
|
|
34642
|
+
let parentheses = 0;
|
|
34643
|
+
for (const character of value.trim()) {
|
|
34644
|
+
if (/\s/.test(character) && parentheses === 0) {
|
|
34645
|
+
if (token) values.push(token);
|
|
34646
|
+
token = "";
|
|
34647
|
+
continue;
|
|
34648
|
+
}
|
|
34649
|
+
if (character === "(") parentheses += 1;
|
|
34650
|
+
if (character === ")") parentheses = Math.max(0, parentheses - 1);
|
|
34651
|
+
token += character;
|
|
34652
|
+
}
|
|
34653
|
+
if (token) values.push(token);
|
|
34654
|
+
return values;
|
|
34655
|
+
}
|
|
34656
|
+
function expandCssQuad(value, fallback) {
|
|
34657
|
+
const values = typeof value === "string" ? splitCssValues(value) : [];
|
|
34658
|
+
const [top = fallback, right = top, bottom = top, left = right] = values;
|
|
34659
|
+
return { top, right, bottom, left };
|
|
34660
|
+
}
|
|
34661
|
+
function serializeCssQuad({ top, right, bottom, left }) {
|
|
34662
|
+
if (top === right && top === bottom && top === left) return top;
|
|
34663
|
+
if (top === bottom && right === left) return `${top} ${right}`;
|
|
34664
|
+
if (right === left) return `${top} ${right} ${bottom}`;
|
|
34665
|
+
return `${top} ${right} ${bottom} ${left}`;
|
|
34666
|
+
}
|
|
34667
|
+
function getAppliedSides(position, cell, selection) {
|
|
34668
|
+
const outer = {
|
|
34669
|
+
top: cell.top === selection.top,
|
|
34670
|
+
right: cell.right === selection.right,
|
|
34671
|
+
bottom: cell.bottom === selection.bottom,
|
|
34672
|
+
left: cell.left === selection.left
|
|
34673
|
+
};
|
|
34674
|
+
const inner = {
|
|
34675
|
+
top: cell.top > selection.top,
|
|
34676
|
+
right: cell.right < selection.right,
|
|
34677
|
+
bottom: cell.bottom < selection.bottom,
|
|
34678
|
+
left: cell.left > selection.left
|
|
34679
|
+
};
|
|
34680
|
+
switch (position) {
|
|
34681
|
+
case "all":
|
|
34682
|
+
return { top: true, right: true, bottom: true, left: true };
|
|
34683
|
+
case "outer":
|
|
34684
|
+
return outer;
|
|
34685
|
+
case "inner":
|
|
34686
|
+
return inner;
|
|
34687
|
+
case "horizontal":
|
|
34688
|
+
return { top: inner.top, right: false, bottom: inner.bottom, left: false };
|
|
34689
|
+
case "vertical":
|
|
34690
|
+
return { top: false, right: inner.right, bottom: false, left: inner.left };
|
|
34691
|
+
default:
|
|
34692
|
+
return {
|
|
34693
|
+
top: position === "top" && outer.top,
|
|
34694
|
+
right: position === "right" && outer.right,
|
|
34695
|
+
bottom: position === "bottom" && outer.bottom,
|
|
34696
|
+
left: position === "left" && outer.left
|
|
34697
|
+
};
|
|
34698
|
+
}
|
|
34699
|
+
}
|
|
34700
|
+
function applyTableCellBorders(editor, position, format, options = {}) {
|
|
34701
|
+
const { state, view } = editor;
|
|
34702
|
+
const selection = (0, import_tables5.selectedRect)(state);
|
|
34703
|
+
const transaction = state.tr;
|
|
34704
|
+
const cellPositions = new Set(selection.map.cellsInRect(selection));
|
|
34705
|
+
const sidesByCell = /* @__PURE__ */ new Map();
|
|
34706
|
+
const addSide = (cellPos, side) => {
|
|
34707
|
+
const sides = sidesByCell.get(cellPos) ?? /* @__PURE__ */ new Set();
|
|
34708
|
+
sides.add(side);
|
|
34709
|
+
sidesByCell.set(cellPos, sides);
|
|
34710
|
+
};
|
|
34711
|
+
const addAdjacentSides = (cell, side) => {
|
|
34712
|
+
const adjacentPositions = /* @__PURE__ */ new Set();
|
|
34713
|
+
if (side === "top" && cell.top > 0) {
|
|
34714
|
+
for (let col = cell.left; col < cell.right; col += 1) adjacentPositions.add(selection.map.map[(cell.top - 1) * selection.map.width + col]);
|
|
34715
|
+
} else if (side === "bottom" && cell.bottom < selection.map.height) {
|
|
34716
|
+
for (let col = cell.left; col < cell.right; col += 1) adjacentPositions.add(selection.map.map[cell.bottom * selection.map.width + col]);
|
|
34717
|
+
} else if (side === "left" && cell.left > 0) {
|
|
34718
|
+
for (let row = cell.top; row < cell.bottom; row += 1) adjacentPositions.add(selection.map.map[row * selection.map.width + cell.left - 1]);
|
|
34719
|
+
} else if (side === "right" && cell.right < selection.map.width) {
|
|
34720
|
+
for (let row = cell.top; row < cell.bottom; row += 1) adjacentPositions.add(selection.map.map[row * selection.map.width + cell.right]);
|
|
34721
|
+
}
|
|
34722
|
+
for (const adjacentPos of adjacentPositions) addSide(adjacentPos, OPPOSITE_SIDE[side]);
|
|
34723
|
+
};
|
|
34724
|
+
for (const relativePos of cellPositions) {
|
|
34725
|
+
const cell = selection.map.findCell(relativePos);
|
|
34726
|
+
const appliedSides = getAppliedSides(position, cell, selection);
|
|
34727
|
+
for (const side of SIDES) {
|
|
34728
|
+
if (!appliedSides[side]) continue;
|
|
34729
|
+
addSide(relativePos, side);
|
|
34730
|
+
addAdjacentSides(cell, side);
|
|
34731
|
+
}
|
|
34732
|
+
}
|
|
34733
|
+
for (const [relativePos, appliedSides] of sidesByCell) {
|
|
34734
|
+
const absolutePos = selection.tableStart + relativePos;
|
|
34735
|
+
const node = state.doc.nodeAt(absolutePos);
|
|
34736
|
+
if (!node) continue;
|
|
34737
|
+
const styles = expandCssQuad(node.attrs.borderStyle, "solid");
|
|
34738
|
+
const widths = expandCssQuad(node.attrs.borderWidth, "1px");
|
|
34739
|
+
const colors = expandCssQuad(node.attrs.borderColor, "#000000");
|
|
34740
|
+
for (const side of SIDES) {
|
|
34741
|
+
if (!appliedSides.has(side)) continue;
|
|
34742
|
+
styles[side] = format.style;
|
|
34743
|
+
widths[side] = format.width;
|
|
34744
|
+
colors[side] = format.color || "currentColor";
|
|
34745
|
+
}
|
|
34746
|
+
transaction.setNodeMarkup(absolutePos, void 0, {
|
|
34747
|
+
...node.attrs,
|
|
34748
|
+
borderStyle: serializeCssQuad(styles),
|
|
34749
|
+
borderWidth: serializeCssQuad(widths),
|
|
34750
|
+
borderColor: serializeCssQuad(colors)
|
|
34751
|
+
});
|
|
34752
|
+
}
|
|
34753
|
+
if (transaction.docChanged) view.dispatch(transaction);
|
|
34754
|
+
if (options.focus ?? true) view.focus();
|
|
34755
|
+
return transaction.docChanged;
|
|
34756
|
+
}
|
|
34311
34757
|
|
|
34312
34758
|
// src/components/UEditor/table-formula-commands.ts
|
|
34313
34759
|
var import_state11 = require("@tiptap/pm/state");
|
|
34314
|
-
var
|
|
34760
|
+
var import_tables6 = require("@tiptap/pm/tables");
|
|
34315
34761
|
|
|
34316
34762
|
// src/components/UEditor/table-formula.ts
|
|
34317
34763
|
var CELL_ADDRESS_RE = /^([A-Z]+)([1-9]\d*)$/i;
|
|
@@ -34902,7 +35348,7 @@ function getSelectionTableCellAnchor(editor) {
|
|
|
34902
35348
|
const tableNode = $cell.node(depth);
|
|
34903
35349
|
if (tableNode.type.name !== "table") continue;
|
|
34904
35350
|
const tableStart = $cell.start(depth);
|
|
34905
|
-
const rect = safeFindCell2(
|
|
35351
|
+
const rect = safeFindCell2(import_tables6.TableMap.get(tableNode), cellPos - tableStart);
|
|
34906
35352
|
if (!rect) return null;
|
|
34907
35353
|
return {
|
|
34908
35354
|
cellPos,
|
|
@@ -34918,7 +35364,7 @@ function getSelectionTableCellAnchor(editor) {
|
|
|
34918
35364
|
function restoreSelectionAtTableCell(editor, anchor) {
|
|
34919
35365
|
const tableNode = editor.state.doc.nodeAt(anchor.tablePos);
|
|
34920
35366
|
if (!tableNode || tableNode.type.name !== "table") return false;
|
|
34921
|
-
const map =
|
|
35367
|
+
const map = import_tables6.TableMap.get(tableNode);
|
|
34922
35368
|
if (anchor.row >= map.height || anchor.column >= map.width) return false;
|
|
34923
35369
|
const relativeCellPos = map.positionAt(anchor.row, anchor.column, tableNode);
|
|
34924
35370
|
const cellPos = anchor.tablePos + 1 + relativeCellPos;
|
|
@@ -34974,7 +35420,7 @@ function getSelectionTableCellLabel(editor) {
|
|
|
34974
35420
|
const tableNode = $from.node(tableDepth);
|
|
34975
35421
|
const tableStart = $from.start(tableDepth);
|
|
34976
35422
|
const relativeCellPos = $from.before(cellDepth) - tableStart;
|
|
34977
|
-
const rect = safeFindCell2(
|
|
35423
|
+
const rect = safeFindCell2(import_tables6.TableMap.get(tableNode), relativeCellPos);
|
|
34978
35424
|
if (!rect) return null;
|
|
34979
35425
|
return `${indexToColumnName(rect.left)}${rect.top + 1}`;
|
|
34980
35426
|
}
|
|
@@ -35012,7 +35458,7 @@ function removeSelectedTableCellFormula(editor, clearContent) {
|
|
|
35012
35458
|
return true;
|
|
35013
35459
|
}
|
|
35014
35460
|
function buildTableValueMap(tableNode) {
|
|
35015
|
-
const map =
|
|
35461
|
+
const map = import_tables6.TableMap.get(tableNode);
|
|
35016
35462
|
const values = /* @__PURE__ */ new Map();
|
|
35017
35463
|
for (const rowInfo of getTableRows2(tableNode)) {
|
|
35018
35464
|
for (const entry of rowInfo.cells) {
|
|
@@ -35037,8 +35483,8 @@ function setSelectedTableCellFormula(editor, formula) {
|
|
|
35037
35483
|
if (!normalized) {
|
|
35038
35484
|
return clearSelectedTableCellFormula(editor);
|
|
35039
35485
|
}
|
|
35040
|
-
const appliedFormula = (0,
|
|
35041
|
-
const clearedValue = (0,
|
|
35486
|
+
const appliedFormula = (0, import_tables6.setCellAttr)("formula", normalized)(state, view.dispatch.bind(view));
|
|
35487
|
+
const clearedValue = (0, import_tables6.setCellAttr)("computedValue", null)(editor.state, view.dispatch.bind(view));
|
|
35042
35488
|
if (appliedFormula || clearedValue) {
|
|
35043
35489
|
recalculateActiveTableFormulas(editor);
|
|
35044
35490
|
if (selectionAnchor) restoreSelectionAtTableCell(editor, selectionAnchor);
|
|
@@ -35057,7 +35503,7 @@ function convertSelectedTableCellFormulaToValue(editor) {
|
|
|
35057
35503
|
function setSelectedTableCellNumberFormat(editor, numberFormat) {
|
|
35058
35504
|
const value = numberFormat && numberFormat !== "text" ? numberFormat : null;
|
|
35059
35505
|
const { state, view } = editor;
|
|
35060
|
-
const applied = (0,
|
|
35506
|
+
const applied = (0, import_tables6.setCellAttr)("numberFormat", value)(state, view.dispatch.bind(view));
|
|
35061
35507
|
if (!applied) return false;
|
|
35062
35508
|
recalculateSelectedTable(editor);
|
|
35063
35509
|
view.focus();
|
|
@@ -35129,7 +35575,7 @@ function promoteFormulaTextInTableNode(tableNode) {
|
|
|
35129
35575
|
function recalculateTableNode(tableNode, options) {
|
|
35130
35576
|
const promoted = promoteFormulaTextInTableNode(tableNode);
|
|
35131
35577
|
tableNode = promoted.tableNode;
|
|
35132
|
-
const map =
|
|
35578
|
+
const map = import_tables6.TableMap.get(tableNode);
|
|
35133
35579
|
const values = buildTableValueMap(tableNode);
|
|
35134
35580
|
const formulaEntries = /* @__PURE__ */ new Map();
|
|
35135
35581
|
let changed = false;
|
|
@@ -35200,7 +35646,7 @@ function recalculateTableNode(tableNode, options) {
|
|
|
35200
35646
|
return tableNode.type.create(tableNode.attrs, rows);
|
|
35201
35647
|
}
|
|
35202
35648
|
function recalculateSelectedTable(editor) {
|
|
35203
|
-
const rect = (0,
|
|
35649
|
+
const rect = (0, import_tables6.selectedRect)(editor.state);
|
|
35204
35650
|
const tableNode = rect.table;
|
|
35205
35651
|
const nextTable = recalculateTableNode(tableNode);
|
|
35206
35652
|
if (!nextTable) return false;
|
|
@@ -35254,10 +35700,10 @@ function recalculateAllTableFormulas(editor) {
|
|
|
35254
35700
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
35255
35701
|
var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
35256
35702
|
const t = useSmartTranslations("UEditor");
|
|
35257
|
-
const messages = (0,
|
|
35258
|
-
const items = (0,
|
|
35259
|
-
const listRef = (0,
|
|
35260
|
-
(0,
|
|
35703
|
+
const messages = (0, import_react73.useMemo)(() => buildSlashCommandMessages(t), [t]);
|
|
35704
|
+
const items = (0, import_react73.useMemo)(() => buildSlashCommandItems({ query: "", messages }), [messages]);
|
|
35705
|
+
const listRef = (0, import_react73.useRef)(null);
|
|
35706
|
+
(0, import_react73.useEffect)(() => {
|
|
35261
35707
|
const handleKeyDown2 = (event) => {
|
|
35262
35708
|
if (event.key === "Escape") {
|
|
35263
35709
|
event.preventDefault();
|
|
@@ -35287,7 +35733,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35287
35733
|
};
|
|
35288
35734
|
var FloatingMenuContent = ({ editor }) => {
|
|
35289
35735
|
const t = useSmartTranslations("UEditor");
|
|
35290
|
-
const [showCommands, setShowCommands] = (0,
|
|
35736
|
+
const [showCommands, setShowCommands] = (0, import_react73.useState)(false);
|
|
35291
35737
|
if (showCommands) {
|
|
35292
35738
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
35293
35739
|
}
|
|
@@ -35298,7 +35744,7 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
35298
35744
|
onClick: () => setShowCommands(true),
|
|
35299
35745
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
|
|
35300
35746
|
children: [
|
|
35301
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35747
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
35302
35748
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
35303
35749
|
]
|
|
35304
35750
|
}
|
|
@@ -35307,7 +35753,7 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
35307
35753
|
function applyTableCellBackground(editor, color) {
|
|
35308
35754
|
const value = color || null;
|
|
35309
35755
|
const { state, view } = editor;
|
|
35310
|
-
const applied = (0,
|
|
35756
|
+
const applied = (0, import_tables7.setCellAttr)("backgroundColor", value)(state, view.dispatch.bind(view));
|
|
35311
35757
|
if (applied) {
|
|
35312
35758
|
view.focus();
|
|
35313
35759
|
return;
|
|
@@ -35317,7 +35763,7 @@ function applyTableCellBackground(editor, color) {
|
|
|
35317
35763
|
function applyTableCellAttribute2(editor, name, value, options = {}) {
|
|
35318
35764
|
const shouldFocus = options.focus ?? true;
|
|
35319
35765
|
const { state, view } = editor;
|
|
35320
|
-
const applied = (0,
|
|
35766
|
+
const applied = (0, import_tables7.setCellAttr)(name, value)(state, view.dispatch.bind(view));
|
|
35321
35767
|
if (applied) {
|
|
35322
35768
|
if (shouldFocus) view.focus();
|
|
35323
35769
|
return;
|
|
@@ -35344,6 +35790,32 @@ function BorderStylePreviewIcon({ style }) {
|
|
|
35344
35790
|
}
|
|
35345
35791
|
);
|
|
35346
35792
|
}
|
|
35793
|
+
function BorderPositionPreviewIcon({ position }) {
|
|
35794
|
+
const showTop = position === "all" || position === "outer" || position === "top";
|
|
35795
|
+
const showRight = position === "all" || position === "outer" || position === "right";
|
|
35796
|
+
const showBottom = position === "all" || position === "outer" || position === "bottom";
|
|
35797
|
+
const showLeft = position === "all" || position === "outer" || position === "left";
|
|
35798
|
+
const showHorizontal = position === "all" || position === "inner" || position === "horizontal";
|
|
35799
|
+
const showVertical = position === "all" || position === "inner" || position === "vertical";
|
|
35800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-5 w-5 fill-none stroke-current", children: [
|
|
35801
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35802
|
+
"path",
|
|
35803
|
+
{
|
|
35804
|
+
d: "M2 2H18V18H2Z M2 10H18 M10 2V18",
|
|
35805
|
+
className: "text-foreground opacity-70",
|
|
35806
|
+
stroke: "currentColor",
|
|
35807
|
+
strokeDasharray: "2 1.5",
|
|
35808
|
+
strokeWidth: "1.25"
|
|
35809
|
+
}
|
|
35810
|
+
),
|
|
35811
|
+
showTop && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 2H18", strokeWidth: "2" }),
|
|
35812
|
+
showRight && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M18 2V18", strokeWidth: "2" }),
|
|
35813
|
+
showBottom && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 18H18", strokeWidth: "2" }),
|
|
35814
|
+
showLeft && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 2V18", strokeWidth: "2" }),
|
|
35815
|
+
showHorizontal && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 10H18", strokeWidth: "2" }),
|
|
35816
|
+
showVertical && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M10 2V18", strokeWidth: "2" })
|
|
35817
|
+
] });
|
|
35818
|
+
}
|
|
35347
35819
|
var BubbleMenuContent = ({
|
|
35348
35820
|
editor,
|
|
35349
35821
|
onKeepOpenChange,
|
|
@@ -35351,24 +35823,30 @@ var BubbleMenuContent = ({
|
|
|
35351
35823
|
onRequestClose,
|
|
35352
35824
|
fontSizes,
|
|
35353
35825
|
lineHeights,
|
|
35354
|
-
initialShowLinkInput = false
|
|
35826
|
+
initialShowLinkInput = false,
|
|
35827
|
+
cellBorderOpenRequest = 0
|
|
35355
35828
|
}) => {
|
|
35356
35829
|
const t = useSmartTranslations("UEditor");
|
|
35357
|
-
(0,
|
|
35830
|
+
(0, import_react74.useEditorState)({
|
|
35358
35831
|
editor,
|
|
35359
35832
|
selector: ({ transactionNumber }) => transactionNumber
|
|
35360
35833
|
});
|
|
35361
35834
|
const { textColors, highlightColors } = useEditorColors();
|
|
35362
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
35363
|
-
const [activeColorPalette, setActiveColorPalette] = (0,
|
|
35364
|
-
(0,
|
|
35835
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react73.useState)(initialShowLinkInput);
|
|
35836
|
+
const [activeColorPalette, setActiveColorPalette] = (0, import_react73.useState)(null);
|
|
35837
|
+
(0, import_react73.useEffect)(() => {
|
|
35365
35838
|
setShowLinkInput(initialShowLinkInput);
|
|
35366
35839
|
}, [initialShowLinkInput]);
|
|
35367
|
-
|
|
35368
|
-
|
|
35369
|
-
|
|
35370
|
-
|
|
35371
|
-
|
|
35840
|
+
(0, import_react73.useEffect)(() => {
|
|
35841
|
+
if (!cellBorderOpenRequest) return;
|
|
35842
|
+
setActiveColorPalette("cell-border");
|
|
35843
|
+
onKeepOpenChange?.(true);
|
|
35844
|
+
}, [cellBorderOpenRequest, onKeepOpenChange]);
|
|
35845
|
+
const [showTypographyPanel, setShowTypographyPanel] = (0, import_react73.useState)(false);
|
|
35846
|
+
const [showFormulaPanel, setShowFormulaPanel] = (0, import_react73.useState)(false);
|
|
35847
|
+
const [formulaDraft, setFormulaDraft] = (0, import_react73.useState)("");
|
|
35848
|
+
const [showFontSizeOptions, setShowFontSizeOptions] = (0, import_react73.useState)(false);
|
|
35849
|
+
const [fontSizeDraft, setFontSizeDraft] = (0, import_react73.useState)("");
|
|
35372
35850
|
const isImageSelected = editor.isActive("image");
|
|
35373
35851
|
const imageAttrs = editor.getAttributes("image");
|
|
35374
35852
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
@@ -35381,22 +35859,30 @@ var BubbleMenuContent = ({
|
|
|
35381
35859
|
const currentCellNumberFormat = normalizeStyleValue(editor.getAttributes("tableCell").numberFormat || editor.getAttributes("tableHeader").numberFormat) || "text";
|
|
35382
35860
|
const currentCellBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
35383
35861
|
const currentCellBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
35862
|
+
const currentCellBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "#000000";
|
|
35863
|
+
const [borderStyleDraft, setBorderStyleDraft] = (0, import_react73.useState)(
|
|
35864
|
+
["solid", "dashed", "dotted", "double"].includes(currentCellBorderStyle) ? currentCellBorderStyle : "solid"
|
|
35865
|
+
);
|
|
35866
|
+
const [borderWidthDraft, setBorderWidthDraft] = (0, import_react73.useState)(currentCellBorderWidth);
|
|
35867
|
+
const [borderColorDraft, setBorderColorDraft] = (0, import_react73.useState)(currentCellBorderColor);
|
|
35868
|
+
const [borderEditMode, setBorderEditMode] = (0, import_react73.useState)("draw");
|
|
35869
|
+
const [activeBorderPosition, setActiveBorderPosition] = (0, import_react73.useState)("all");
|
|
35384
35870
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
35385
35871
|
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
35386
|
-
const isInTable2 = (0,
|
|
35872
|
+
const isInTable2 = (0, import_tables7.isInTable)(editor.state);
|
|
35387
35873
|
const canMergeCells = isInTable2 && editor.can().mergeCells();
|
|
35388
35874
|
const canSplitCell = isInTable2 && editor.can().splitCell();
|
|
35389
35875
|
const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
|
|
35390
35876
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
35391
|
-
const quickFontSizes = (0,
|
|
35877
|
+
const quickFontSizes = (0, import_react73.useMemo)(
|
|
35392
35878
|
() => (fontSizes ?? getDefaultFontSizes()).filter((option) => ["14px", "16px", "24px"].includes(option.value)),
|
|
35393
35879
|
[fontSizes]
|
|
35394
35880
|
);
|
|
35395
|
-
const quickLineHeights = (0,
|
|
35881
|
+
const quickLineHeights = (0, import_react73.useMemo)(
|
|
35396
35882
|
() => (lineHeights ?? getDefaultLineHeights()).filter((option) => ["1.2", "1.5", "1.75"].includes(option.value)),
|
|
35397
35883
|
[lineHeights]
|
|
35398
35884
|
);
|
|
35399
|
-
const borderColors = (0,
|
|
35885
|
+
const borderColors = (0, import_react73.useMemo)(
|
|
35400
35886
|
() => [
|
|
35401
35887
|
highlightColors[0] ?? { name: t("colors.default"), color: "" },
|
|
35402
35888
|
{ name: "Black", color: "#000000" },
|
|
@@ -35405,10 +35891,10 @@ var BubbleMenuContent = ({
|
|
|
35405
35891
|
],
|
|
35406
35892
|
[highlightColors, t]
|
|
35407
35893
|
);
|
|
35408
|
-
(0,
|
|
35894
|
+
(0, import_react73.useEffect)(() => {
|
|
35409
35895
|
setFontSizeDraft(currentFontSize.replace(/px$/i, ""));
|
|
35410
35896
|
}, [currentFontSize]);
|
|
35411
|
-
(0,
|
|
35897
|
+
(0, import_react73.useEffect)(() => {
|
|
35412
35898
|
setFormulaDraft(currentCellFormula);
|
|
35413
35899
|
}, [currentCellFormula]);
|
|
35414
35900
|
const applyFontSizeDraft = () => {
|
|
@@ -35423,40 +35909,79 @@ var BubbleMenuContent = ({
|
|
|
35423
35909
|
editor.chain().focus().setFontSize(`${clamped}px`).run();
|
|
35424
35910
|
setFontSizeDraft(String(clamped));
|
|
35425
35911
|
};
|
|
35426
|
-
(0,
|
|
35912
|
+
(0, import_react73.useEffect)(() => {
|
|
35427
35913
|
onKeepOpenChange?.(showLinkInput);
|
|
35428
35914
|
onLinkInputOpenChange?.(showLinkInput);
|
|
35429
35915
|
}, [onKeepOpenChange, onLinkInputOpenChange, showLinkInput]);
|
|
35430
|
-
(0,
|
|
35916
|
+
(0, import_react73.useEffect)(() => {
|
|
35431
35917
|
onKeepOpenChange?.(Boolean(activeColorPalette));
|
|
35432
35918
|
}, [activeColorPalette, onKeepOpenChange]);
|
|
35433
|
-
const closeTransientPanels = (0,
|
|
35919
|
+
const closeTransientPanels = (0, import_react73.useCallback)(() => {
|
|
35434
35920
|
setActiveColorPalette(null);
|
|
35435
35921
|
setShowLinkInput(false);
|
|
35436
35922
|
onKeepOpenChange?.(false);
|
|
35437
35923
|
onLinkInputOpenChange?.(false);
|
|
35438
35924
|
onRequestClose?.();
|
|
35439
35925
|
}, [onKeepOpenChange, onLinkInputOpenChange, onRequestClose]);
|
|
35440
|
-
const
|
|
35441
|
-
|
|
35442
|
-
|
|
35443
|
-
|
|
35444
|
-
|
|
35445
|
-
|
|
35446
|
-
|
|
35447
|
-
|
|
35448
|
-
|
|
35449
|
-
|
|
35450
|
-
|
|
35451
|
-
|
|
35452
|
-
|
|
35453
|
-
|
|
35454
|
-
|
|
35455
|
-
|
|
35926
|
+
const selectTableCellBorderColor = (0, import_react73.useCallback)((color) => {
|
|
35927
|
+
const value = color || "currentColor";
|
|
35928
|
+
setBorderColorDraft(value);
|
|
35929
|
+
setBorderEditMode("draw");
|
|
35930
|
+
setActiveBorderPosition("all");
|
|
35931
|
+
applyTableCellBorders(editor, "all", {
|
|
35932
|
+
color: value,
|
|
35933
|
+
style: borderStyleDraft,
|
|
35934
|
+
width: borderWidthDraft
|
|
35935
|
+
}, { focus: false });
|
|
35936
|
+
setActiveColorPalette("cell-border");
|
|
35937
|
+
onKeepOpenChange?.(true);
|
|
35938
|
+
}, [borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35939
|
+
const applyTableCellBorderPosition = (0, import_react73.useCallback)((position) => {
|
|
35940
|
+
setActiveBorderPosition(position);
|
|
35941
|
+
applyTableCellBorders(editor, position, {
|
|
35942
|
+
color: borderColorDraft,
|
|
35943
|
+
style: borderEditMode === "erase" ? "none" : borderStyleDraft,
|
|
35944
|
+
width: borderWidthDraft
|
|
35945
|
+
}, { focus: false });
|
|
35946
|
+
onKeepOpenChange?.(true);
|
|
35947
|
+
}, [borderColorDraft, borderEditMode, borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35948
|
+
const applyTableCellBorderStyle = (0, import_react73.useCallback)((style) => {
|
|
35949
|
+
setBorderStyleDraft(style);
|
|
35950
|
+
setBorderEditMode("draw");
|
|
35951
|
+
setActiveBorderPosition("all");
|
|
35952
|
+
applyTableCellBorders(editor, "all", {
|
|
35953
|
+
color: borderColorDraft,
|
|
35954
|
+
style,
|
|
35955
|
+
width: borderWidthDraft
|
|
35956
|
+
}, { focus: false });
|
|
35957
|
+
onKeepOpenChange?.(true);
|
|
35958
|
+
}, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35959
|
+
const applyTableCellBorderWidth = (0, import_react73.useCallback)((width) => {
|
|
35960
|
+
setBorderWidthDraft(width);
|
|
35961
|
+
setBorderEditMode("draw");
|
|
35962
|
+
setActiveBorderPosition("all");
|
|
35963
|
+
applyTableCellBorders(editor, "all", {
|
|
35964
|
+
color: borderColorDraft,
|
|
35965
|
+
style: borderStyleDraft,
|
|
35966
|
+
width
|
|
35967
|
+
}, { focus: false });
|
|
35968
|
+
onKeepOpenChange?.(true);
|
|
35969
|
+
}, [borderColorDraft, borderStyleDraft, editor, onKeepOpenChange]);
|
|
35970
|
+
const clearTableCellBorders = (0, import_react73.useCallback)(() => {
|
|
35971
|
+
setActiveBorderPosition("all");
|
|
35972
|
+
setBorderEditMode("erase");
|
|
35973
|
+
applyTableCellBorders(editor, "all", {
|
|
35974
|
+
color: borderColorDraft,
|
|
35975
|
+
style: "none",
|
|
35976
|
+
width: borderWidthDraft
|
|
35977
|
+
}, { focus: false });
|
|
35978
|
+
onKeepOpenChange?.(true);
|
|
35979
|
+
}, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35980
|
+
const closeColorPalette = (0, import_react73.useCallback)(() => {
|
|
35456
35981
|
setActiveColorPalette(null);
|
|
35457
35982
|
onKeepOpenChange?.(false);
|
|
35458
35983
|
}, [onKeepOpenChange]);
|
|
35459
|
-
const applyInlineColorAndClose = (0,
|
|
35984
|
+
const applyInlineColorAndClose = (0, import_react73.useCallback)((color) => {
|
|
35460
35985
|
if (activeColorPalette === "text") {
|
|
35461
35986
|
if (color === "inherit") {
|
|
35462
35987
|
editor.chain().focus().unsetColor().run();
|
|
@@ -35474,7 +35999,7 @@ var BubbleMenuContent = ({
|
|
|
35474
35999
|
}
|
|
35475
36000
|
closeColorPalette();
|
|
35476
36001
|
}, [activeColorPalette, closeColorPalette, editor]);
|
|
35477
|
-
(0,
|
|
36002
|
+
(0, import_react73.useEffect)(() => {
|
|
35478
36003
|
if (!showLinkInput) return;
|
|
35479
36004
|
const close2 = () => setShowLinkInput(false);
|
|
35480
36005
|
editor.on("selectionUpdate", close2);
|
|
@@ -35505,27 +36030,104 @@ var BubbleMenuContent = ({
|
|
|
35505
36030
|
const isTextPalette = activeColorPalette === "text";
|
|
35506
36031
|
const isHighlightPalette = activeColorPalette === "highlight";
|
|
35507
36032
|
if (activeColorPalette === "cell-border") {
|
|
35508
|
-
|
|
35509
|
-
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-2 p-2 w-56 text-sm", "data-ueditor-keep-open": true, children: [
|
|
36033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex w-72 flex-col gap-2 p-2 text-sm", "data-ueditor-keep-open": true, children: [
|
|
35510
36034
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
36035
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex gap-2", children: [
|
|
36036
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
36037
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("label", { className: "mb-1 block text-xs text-muted-foreground", children: t("tableMenu.borderPosition") || "Border placement" }),
|
|
36038
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "grid grid-cols-5 gap-1", role: "group", "aria-label": t("tableMenu.borderPosition") || "Border placement", children: [
|
|
36039
|
+
[
|
|
36040
|
+
["all", "borderAll"],
|
|
36041
|
+
["outer", "borderOuter"],
|
|
36042
|
+
["inner", "borderInner"],
|
|
36043
|
+
["horizontal", "borderHorizontal"],
|
|
36044
|
+
["vertical", "borderVertical"],
|
|
36045
|
+
["top", "borderTop"],
|
|
36046
|
+
["right", "borderRight"],
|
|
36047
|
+
["bottom", "borderBottom"],
|
|
36048
|
+
["left", "borderLeft"]
|
|
36049
|
+
].map(([position, labelKey]) => {
|
|
36050
|
+
const label = t(`tableMenu.${labelKey}`) || position;
|
|
36051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36052
|
+
"button",
|
|
36053
|
+
{
|
|
36054
|
+
type: "button",
|
|
36055
|
+
"aria-label": label,
|
|
36056
|
+
title: label,
|
|
36057
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
36058
|
+
onClick: () => applyTableCellBorderPosition(position),
|
|
36059
|
+
className: cn(
|
|
36060
|
+
"inline-flex h-8 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted hover:text-primary",
|
|
36061
|
+
activeBorderPosition === position ? "bg-primary/10 text-primary" : "bg-muted/40"
|
|
36062
|
+
),
|
|
36063
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(BorderPositionPreviewIcon, { position })
|
|
36064
|
+
},
|
|
36065
|
+
position
|
|
36066
|
+
);
|
|
36067
|
+
}),
|
|
36068
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36069
|
+
"button",
|
|
36070
|
+
{
|
|
36071
|
+
type: "button",
|
|
36072
|
+
"aria-label": t("tableMenu.clearBorder") || "Clear borders",
|
|
36073
|
+
title: t("tableMenu.clearBorder") || "Clear borders",
|
|
36074
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
36075
|
+
onClick: clearTableCellBorders,
|
|
36076
|
+
className: "inline-flex h-8 items-center justify-center rounded-md bg-muted/40 text-destructive transition-colors hover:bg-destructive/10",
|
|
36077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(BorderStylePreviewIcon, { style: "none" })
|
|
36078
|
+
}
|
|
36079
|
+
)
|
|
36080
|
+
] })
|
|
36081
|
+
] }),
|
|
36082
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-1 border-l border-border pl-2 pt-5", role: "group", "aria-label": t("tableMenu.borderMode") || "Border mode", children: [
|
|
36083
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36084
|
+
"button",
|
|
36085
|
+
{
|
|
36086
|
+
type: "button",
|
|
36087
|
+
"aria-label": t("tableMenu.borderDraw") || "Draw borders",
|
|
36088
|
+
title: t("tableMenu.borderDraw") || "Draw borders",
|
|
36089
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
36090
|
+
onClick: () => setBorderEditMode("draw"),
|
|
36091
|
+
className: cn(
|
|
36092
|
+
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36093
|
+
borderEditMode === "draw" ? "bg-primary/10 text-primary" : "text-muted-foreground"
|
|
36094
|
+
),
|
|
36095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Edit2, { className: "h-4 w-4" })
|
|
36096
|
+
}
|
|
36097
|
+
),
|
|
36098
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36099
|
+
"button",
|
|
36100
|
+
{
|
|
36101
|
+
type: "button",
|
|
36102
|
+
"aria-label": t("tableMenu.borderErase") || "Hide borders",
|
|
36103
|
+
title: t("tableMenu.borderErase") || "Hide borders",
|
|
36104
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
36105
|
+
onClick: () => setBorderEditMode("erase"),
|
|
36106
|
+
className: cn(
|
|
36107
|
+
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36108
|
+
borderEditMode === "erase" ? "bg-destructive/10 text-destructive" : "text-muted-foreground"
|
|
36109
|
+
),
|
|
36110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Eraser, { className: "h-4 w-4" })
|
|
36111
|
+
}
|
|
36112
|
+
)
|
|
36113
|
+
] })
|
|
36114
|
+
] }),
|
|
35511
36115
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
35512
36116
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
35513
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid grid-cols-
|
|
36117
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid grid-cols-4 gap-1.5", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
|
|
35514
36118
|
["solid", "Solid"],
|
|
35515
36119
|
["dashed", "Dashed"],
|
|
35516
36120
|
["dotted", "Dotted"],
|
|
35517
|
-
["double", "Double"]
|
|
35518
|
-
["none", "None"]
|
|
36121
|
+
["double", "Double"]
|
|
35519
36122
|
].map(([style, label]) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
35520
36123
|
"button",
|
|
35521
36124
|
{
|
|
35522
36125
|
type: "button",
|
|
35523
|
-
"data-ueditor-close-on-select": true,
|
|
35524
36126
|
onMouseDown: (event) => event.preventDefault(),
|
|
35525
|
-
onClick: () =>
|
|
36127
|
+
onClick: () => applyTableCellBorderStyle(style),
|
|
35526
36128
|
className: cn(
|
|
35527
|
-
"inline-flex h-8 items-center justify-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors hover:bg-muted",
|
|
35528
|
-
|
|
36129
|
+
"inline-flex h-8 min-w-0 items-center justify-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors hover:bg-muted",
|
|
36130
|
+
borderStyleDraft === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
35529
36131
|
),
|
|
35530
36132
|
children: [
|
|
35531
36133
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(BorderStylePreviewIcon, { style }),
|
|
@@ -35541,12 +36143,11 @@ var BubbleMenuContent = ({
|
|
|
35541
36143
|
"button",
|
|
35542
36144
|
{
|
|
35543
36145
|
type: "button",
|
|
35544
|
-
"data-ueditor-close-on-select": true,
|
|
35545
36146
|
onMouseDown: (event) => event.preventDefault(),
|
|
35546
|
-
onClick: () =>
|
|
36147
|
+
onClick: () => applyTableCellBorderWidth(width),
|
|
35547
36148
|
className: cn(
|
|
35548
36149
|
"h-8 rounded-md px-2 text-xs font-medium transition-colors hover:bg-muted",
|
|
35549
|
-
|
|
36150
|
+
borderWidthDraft === width ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
35550
36151
|
),
|
|
35551
36152
|
children: width
|
|
35552
36153
|
},
|
|
@@ -35566,33 +36167,22 @@ var BubbleMenuContent = ({
|
|
|
35566
36167
|
{
|
|
35567
36168
|
className: "w-4 h-4 rounded-full border border-border",
|
|
35568
36169
|
style: {
|
|
35569
|
-
backgroundColor:
|
|
36170
|
+
backgroundColor: borderColorDraft
|
|
35570
36171
|
}
|
|
35571
36172
|
}
|
|
35572
36173
|
)
|
|
35573
36174
|
]
|
|
35574
36175
|
}
|
|
35575
|
-
)
|
|
35576
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "flex items-center justify-between gap-2 mt-2 pt-2 border-t border-border", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35577
|
-
"button",
|
|
35578
|
-
{
|
|
35579
|
-
type: "button",
|
|
35580
|
-
"data-ueditor-close-on-select": true,
|
|
35581
|
-
onClick: clearTableCellBorderAndClose,
|
|
35582
|
-
className: "text-xs text-destructive hover:underline",
|
|
35583
|
-
children: t("tableMenu.clearBorder") || "Clear Border"
|
|
35584
|
-
}
|
|
35585
|
-
) })
|
|
36176
|
+
)
|
|
35586
36177
|
] });
|
|
35587
36178
|
}
|
|
35588
36179
|
if (activeColorPalette === "cell-border-color") {
|
|
35589
|
-
const currentBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "";
|
|
35590
36180
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35591
36181
|
EditorColorPalette,
|
|
35592
36182
|
{
|
|
35593
36183
|
colors: borderColors,
|
|
35594
|
-
currentColor:
|
|
35595
|
-
onSelect:
|
|
36184
|
+
currentColor: borderColorDraft,
|
|
36185
|
+
onSelect: selectTableCellBorderColor,
|
|
35596
36186
|
label: t("tableMenu.borderColor") || "Border Color"
|
|
35597
36187
|
}
|
|
35598
36188
|
) });
|
|
@@ -35609,22 +36199,22 @@ var BubbleMenuContent = ({
|
|
|
35609
36199
|
}
|
|
35610
36200
|
if (isImageSelected) {
|
|
35611
36201
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
35612
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35613
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35614
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36202
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.AlignCenter, { className: "w-4 h-4" }) }),
|
|
36203
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.AlignLeft, { className: "w-4 h-4" }) }),
|
|
36204
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.AlignRight, { className: "w-4 h-4" }) }),
|
|
35615
36205
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
35616
36206
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
35617
36207
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
35618
36208
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
35619
36209
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
35620
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36210
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.RotateCcw, { className: "w-4 h-4" }) }),
|
|
35621
36211
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35622
36212
|
ToolbarButton,
|
|
35623
36213
|
{
|
|
35624
36214
|
onClick: () => deleteSelectedImage(editor),
|
|
35625
36215
|
title: t("toolbar.imageDelete"),
|
|
35626
36216
|
className: "text-destructive hover:text-destructive",
|
|
35627
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36217
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Trash2, { className: "w-4 h-4" })
|
|
35628
36218
|
}
|
|
35629
36219
|
)
|
|
35630
36220
|
] });
|
|
@@ -35780,7 +36370,7 @@ var BubbleMenuContent = ({
|
|
|
35780
36370
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
35781
36371
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
35782
36372
|
),
|
|
35783
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.ChevronDown, { className: "h-4 w-4" })
|
|
35784
36374
|
}
|
|
35785
36375
|
)
|
|
35786
36376
|
] }),
|
|
@@ -35859,7 +36449,7 @@ var BubbleMenuContent = ({
|
|
|
35859
36449
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
35860
36450
|
),
|
|
35861
36451
|
children: [
|
|
35862
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36452
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Subscript, { className: "h-4 w-4" }),
|
|
35863
36453
|
t("toolbar.subscript")
|
|
35864
36454
|
]
|
|
35865
36455
|
}
|
|
@@ -35874,7 +36464,7 @@ var BubbleMenuContent = ({
|
|
|
35874
36464
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
35875
36465
|
),
|
|
35876
36466
|
children: [
|
|
35877
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36467
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Superscript, { className: "h-4 w-4" }),
|
|
35878
36468
|
t("toolbar.superscript")
|
|
35879
36469
|
]
|
|
35880
36470
|
}
|
|
@@ -35883,21 +36473,21 @@ var BubbleMenuContent = ({
|
|
|
35883
36473
|
] })
|
|
35884
36474
|
] });
|
|
35885
36475
|
}
|
|
35886
|
-
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ?
|
|
36476
|
+
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? import_lucide_react53.AlignCenterVertical : currentCellVerticalAlign === "bottom" ? import_lucide_react53.AlignEndVertical : import_lucide_react53.AlignStartVertical;
|
|
35887
36477
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
35888
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35889
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36478
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Bold, { className: "w-4 h-4" }) }),
|
|
36479
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Italic, { className: "w-4 h-4" }) }),
|
|
35890
36480
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35891
36481
|
ToolbarButton,
|
|
35892
36482
|
{
|
|
35893
36483
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
35894
36484
|
active: editor.isActive("underline"),
|
|
35895
36485
|
title: t("toolbar.underline"),
|
|
35896
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Underline, { className: "w-4 h-4" })
|
|
35897
36487
|
}
|
|
35898
36488
|
),
|
|
35899
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35900
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36489
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Strikethrough, { className: "w-4 h-4" }) }),
|
|
36490
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Code, { className: "w-4 h-4" }) }),
|
|
35901
36491
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
35902
36492
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
35903
36493
|
ToolbarButton,
|
|
@@ -35910,7 +36500,7 @@ var BubbleMenuContent = ({
|
|
|
35910
36500
|
},
|
|
35911
36501
|
active: editor.isActive("link"),
|
|
35912
36502
|
title: t("toolbar.link"),
|
|
35913
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36503
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Link, { className: "w-4 h-4" })
|
|
35914
36504
|
}
|
|
35915
36505
|
),
|
|
35916
36506
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextColorIcon, { color: currentTextColor }) }),
|
|
@@ -35956,7 +36546,7 @@ var BubbleMenuContent = ({
|
|
|
35956
36546
|
},
|
|
35957
36547
|
active: Boolean(currentCellFormula),
|
|
35958
36548
|
title: t("tableMenu.formula") || "Formula",
|
|
35959
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Sigma, { className: "w-4 h-4" })
|
|
35960
36550
|
}
|
|
35961
36551
|
),
|
|
35962
36552
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -35972,7 +36562,7 @@ var BubbleMenuContent = ({
|
|
|
35972
36562
|
active: canSplitCell,
|
|
35973
36563
|
disabled: !canMergeCells && !canSplitCell,
|
|
35974
36564
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
35975
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.TableCellsMerge, { className: "w-4 h-4" })
|
|
35976
36566
|
}
|
|
35977
36567
|
),
|
|
35978
36568
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
@@ -35992,7 +36582,7 @@ var BubbleMenuContent = ({
|
|
|
35992
36582
|
title: t("tableMenu.alignVertical") || "Vertical alignment",
|
|
35993
36583
|
children: [
|
|
35994
36584
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(VerticalAlignActiveIcon, { className: "w-4 h-4" }),
|
|
35995
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36585
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
35996
36586
|
]
|
|
35997
36587
|
}
|
|
35998
36588
|
),
|
|
@@ -36000,7 +36590,7 @@ var BubbleMenuContent = ({
|
|
|
36000
36590
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36001
36591
|
DropdownMenuItem,
|
|
36002
36592
|
{
|
|
36003
|
-
icon:
|
|
36593
|
+
icon: import_lucide_react53.AlignStartVertical,
|
|
36004
36594
|
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
36005
36595
|
onClick: () => applyTableCellAttribute2(editor, "verticalAlign", "top", { focus: false }),
|
|
36006
36596
|
active: currentCellVerticalAlign === "top"
|
|
@@ -36009,7 +36599,7 @@ var BubbleMenuContent = ({
|
|
|
36009
36599
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36010
36600
|
DropdownMenuItem,
|
|
36011
36601
|
{
|
|
36012
|
-
icon:
|
|
36602
|
+
icon: import_lucide_react53.AlignCenterVertical,
|
|
36013
36603
|
label: t("tableMenu.alignVerticalMiddle") || "Align middle",
|
|
36014
36604
|
onClick: () => applyTableCellAttribute2(editor, "verticalAlign", "middle", { focus: false }),
|
|
36015
36605
|
active: currentCellVerticalAlign === "middle"
|
|
@@ -36018,7 +36608,7 @@ var BubbleMenuContent = ({
|
|
|
36018
36608
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36019
36609
|
DropdownMenuItem,
|
|
36020
36610
|
{
|
|
36021
|
-
icon:
|
|
36611
|
+
icon: import_lucide_react53.AlignEndVertical,
|
|
36022
36612
|
label: t("tableMenu.alignVerticalBottom") || "Align bottom",
|
|
36023
36613
|
onClick: () => applyTableCellAttribute2(editor, "verticalAlign", "bottom", { focus: false }),
|
|
36024
36614
|
active: currentCellVerticalAlign === "bottom"
|
|
@@ -36043,8 +36633,8 @@ var BubbleMenuContent = ({
|
|
|
36043
36633
|
},
|
|
36044
36634
|
title: t("tableMenu.textDirection"),
|
|
36045
36635
|
children: [
|
|
36046
|
-
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36047
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36636
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.ArrowRight, { className: "w-4 h-4" }),
|
|
36637
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
36048
36638
|
]
|
|
36049
36639
|
}
|
|
36050
36640
|
),
|
|
@@ -36052,7 +36642,7 @@ var BubbleMenuContent = ({
|
|
|
36052
36642
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36053
36643
|
DropdownMenuItem,
|
|
36054
36644
|
{
|
|
36055
|
-
icon:
|
|
36645
|
+
icon: import_lucide_react53.ArrowRight,
|
|
36056
36646
|
label: t("tableMenu.horizontalText"),
|
|
36057
36647
|
onClick: () => applyTableCellAttribute2(editor, "textDirection", null, { focus: false }),
|
|
36058
36648
|
active: currentCellTextDirection === "horizontal"
|
|
@@ -36061,7 +36651,7 @@ var BubbleMenuContent = ({
|
|
|
36061
36651
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36062
36652
|
DropdownMenuItem,
|
|
36063
36653
|
{
|
|
36064
|
-
icon:
|
|
36654
|
+
icon: import_lucide_react53.ArrowDown,
|
|
36065
36655
|
label: t("tableMenu.verticalText"),
|
|
36066
36656
|
onClick: () => applyTableCellAttribute2(editor, "textDirection", "vertical", { focus: false }),
|
|
36067
36657
|
active: currentCellTextDirection === "vertical"
|
|
@@ -36077,7 +36667,7 @@ var BubbleMenuContent = ({
|
|
|
36077
36667
|
onClick: () => setShowTypographyPanel(true),
|
|
36078
36668
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
36079
36669
|
title: t("toolbar.textStyle"),
|
|
36080
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Type, { className: "w-4 h-4" })
|
|
36081
36671
|
}
|
|
36082
36672
|
)
|
|
36083
36673
|
] });
|
|
@@ -36095,9 +36685,9 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
36095
36685
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
36096
36686
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-45", children: url }),
|
|
36097
36687
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36098
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36099
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36100
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
36688
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.ExternalLink, { className: "w-4 h-4" }) }),
|
|
36689
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Edit2, { className: "w-4 h-4" }) }),
|
|
36690
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Unlink, { className: "w-4 h-4" }) })
|
|
36101
36691
|
] });
|
|
36102
36692
|
};
|
|
36103
36693
|
var CustomBubbleMenu = ({
|
|
@@ -36108,26 +36698,27 @@ var CustomBubbleMenu = ({
|
|
|
36108
36698
|
const SHOW_DELAY_MS = 180;
|
|
36109
36699
|
const BUBBLE_MENU_OFFSET = 16;
|
|
36110
36700
|
const BUBBLE_MENU_ESTIMATED_HEIGHT = 44;
|
|
36111
|
-
const [isVisible, setIsVisible] = (0,
|
|
36112
|
-
const [linkInputOpen, setLinkInputOpen] = (0,
|
|
36113
|
-
const [
|
|
36701
|
+
const [isVisible, setIsVisible] = (0, import_react73.useState)(false);
|
|
36702
|
+
const [linkInputOpen, setLinkInputOpen] = (0, import_react73.useState)(false);
|
|
36703
|
+
const [cellBorderOpenRequest, setCellBorderOpenRequest] = (0, import_react73.useState)(0);
|
|
36704
|
+
const [position, setPosition2] = (0, import_react73.useState)({
|
|
36114
36705
|
top: 0,
|
|
36115
36706
|
left: 0,
|
|
36116
36707
|
placement: "top"
|
|
36117
36708
|
});
|
|
36118
|
-
const menuRef = (0,
|
|
36119
|
-
const keepOpenRef = (0,
|
|
36120
|
-
const [keepOpen, setKeepOpenState] = (0,
|
|
36121
|
-
const showTimeoutRef = (0,
|
|
36122
|
-
const suppressShowUntilRef = (0,
|
|
36123
|
-
const setKeepOpen = (0,
|
|
36709
|
+
const menuRef = (0, import_react73.useRef)(null);
|
|
36710
|
+
const keepOpenRef = (0, import_react73.useRef)(false);
|
|
36711
|
+
const [keepOpen, setKeepOpenState] = (0, import_react73.useState)(false);
|
|
36712
|
+
const showTimeoutRef = (0, import_react73.useRef)(null);
|
|
36713
|
+
const suppressShowUntilRef = (0, import_react73.useRef)(0);
|
|
36714
|
+
const setKeepOpen = (0, import_react73.useCallback)((next) => {
|
|
36124
36715
|
keepOpenRef.current = next;
|
|
36125
36716
|
setKeepOpenState(next);
|
|
36126
36717
|
if (!next) setLinkInputOpen(false);
|
|
36127
36718
|
if (next) setIsVisible(true);
|
|
36128
36719
|
}, []);
|
|
36129
|
-
const closeBubbleMenu = (0,
|
|
36130
|
-
suppressShowUntilRef.current = Date.now() + 1e3;
|
|
36720
|
+
const closeBubbleMenu = (0, import_react73.useCallback)((suppressShow = true) => {
|
|
36721
|
+
suppressShowUntilRef.current = suppressShow ? Date.now() + 1e3 : 0;
|
|
36131
36722
|
keepOpenRef.current = false;
|
|
36132
36723
|
setKeepOpenState(false);
|
|
36133
36724
|
setLinkInputOpen(false);
|
|
@@ -36137,7 +36728,7 @@ var CustomBubbleMenu = ({
|
|
|
36137
36728
|
showTimeoutRef.current = null;
|
|
36138
36729
|
}
|
|
36139
36730
|
}, []);
|
|
36140
|
-
(0,
|
|
36731
|
+
(0, import_react73.useEffect)(() => {
|
|
36141
36732
|
const clearShowTimeout = () => {
|
|
36142
36733
|
if (showTimeoutRef.current) {
|
|
36143
36734
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -36219,6 +36810,41 @@ var CustomBubbleMenu = ({
|
|
|
36219
36810
|
editor.off("update", updatePosition);
|
|
36220
36811
|
};
|
|
36221
36812
|
}, [editor]);
|
|
36813
|
+
(0, import_react73.useEffect)(() => {
|
|
36814
|
+
if (!isVisible) return;
|
|
36815
|
+
const handlePointerDown = (event) => {
|
|
36816
|
+
const target = event.target;
|
|
36817
|
+
if (target && (menuRef.current?.contains(target) || target.closest("[data-ueditor-keep-open]"))) return;
|
|
36818
|
+
const table = target?.closest("table");
|
|
36819
|
+
if (table && editor.view.dom.contains(table)) return;
|
|
36820
|
+
closeBubbleMenu(false);
|
|
36821
|
+
};
|
|
36822
|
+
const handleKeyDown2 = (event) => {
|
|
36823
|
+
if (event.key === "Escape") closeBubbleMenu();
|
|
36824
|
+
};
|
|
36825
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
36826
|
+
document.addEventListener("keydown", handleKeyDown2);
|
|
36827
|
+
return () => {
|
|
36828
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
36829
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
|
36830
|
+
};
|
|
36831
|
+
}, [closeBubbleMenu, editor, isVisible]);
|
|
36832
|
+
(0, import_react73.useEffect)(() => {
|
|
36833
|
+
const handleTableDoubleClick = (event) => {
|
|
36834
|
+
const target = event.target;
|
|
36835
|
+
const cell = target?.closest("td,th");
|
|
36836
|
+
if (!cell || !editor.view.dom.contains(cell)) return;
|
|
36837
|
+
suppressShowUntilRef.current = 0;
|
|
36838
|
+
keepOpenRef.current = true;
|
|
36839
|
+
setKeepOpenState(true);
|
|
36840
|
+
setLinkInputOpen(false);
|
|
36841
|
+
setCellBorderOpenRequest((request) => request + 1);
|
|
36842
|
+
setIsVisible(true);
|
|
36843
|
+
requestAnimationFrame(() => editor.view.focus());
|
|
36844
|
+
};
|
|
36845
|
+
editor.view.dom.addEventListener("dblclick", handleTableDoubleClick);
|
|
36846
|
+
return () => editor.view.dom.removeEventListener("dblclick", handleTableDoubleClick);
|
|
36847
|
+
}, [editor]);
|
|
36222
36848
|
if (!isVisible) return null;
|
|
36223
36849
|
return (0, import_react_dom8.createPortal)(
|
|
36224
36850
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -36259,7 +36885,8 @@ var CustomBubbleMenu = ({
|
|
|
36259
36885
|
onRequestClose: closeBubbleMenu,
|
|
36260
36886
|
fontSizes,
|
|
36261
36887
|
lineHeights,
|
|
36262
|
-
initialShowLinkInput: linkInputOpen
|
|
36888
|
+
initialShowLinkInput: linkInputOpen,
|
|
36889
|
+
cellBorderOpenRequest
|
|
36263
36890
|
}
|
|
36264
36891
|
)
|
|
36265
36892
|
}
|
|
@@ -36269,9 +36896,9 @@ var CustomBubbleMenu = ({
|
|
|
36269
36896
|
};
|
|
36270
36897
|
var CustomFloatingMenu = ({ editor }) => {
|
|
36271
36898
|
const FLOATING_MENU_OFFSET = 16;
|
|
36272
|
-
const [isVisible, setIsVisible] = (0,
|
|
36273
|
-
const [position, setPosition2] = (0,
|
|
36274
|
-
(0,
|
|
36899
|
+
const [isVisible, setIsVisible] = (0, import_react73.useState)(false);
|
|
36900
|
+
const [position, setPosition2] = (0, import_react73.useState)({ top: 0, left: 0 });
|
|
36901
|
+
(0, import_react73.useEffect)(() => {
|
|
36275
36902
|
const updatePosition = () => {
|
|
36276
36903
|
const { state, view } = editor;
|
|
36277
36904
|
const { $from, empty } = state.selection;
|
|
@@ -36756,7 +37383,7 @@ async function prepareUEditorContentForSave({
|
|
|
36756
37383
|
}
|
|
36757
37384
|
|
|
36758
37385
|
// src/components/UEditor/table-controls.tsx
|
|
36759
|
-
var
|
|
37386
|
+
var import_react75 = __toESM(require("react"), 1);
|
|
36760
37387
|
|
|
36761
37388
|
// node_modules/prosemirror-model/dist/index.js
|
|
36762
37389
|
function findDiffStart(a, b, pos) {
|
|
@@ -40711,7 +41338,7 @@ function moveTableRow$1(table, indexesOrigin, indexesTarget, direction) {
|
|
|
40711
41338
|
rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);
|
|
40712
41339
|
return convertArrayOfRowsToTableNode(table, rows);
|
|
40713
41340
|
}
|
|
40714
|
-
function
|
|
41341
|
+
function selectedRect4(state) {
|
|
40715
41342
|
const sel = state.selection;
|
|
40716
41343
|
const $pos = selectionCell(state);
|
|
40717
41344
|
const table = $pos.node(-1);
|
|
@@ -40729,7 +41356,7 @@ function deprecated_toggleHeader(type) {
|
|
|
40729
41356
|
if (!isInTable(state)) return false;
|
|
40730
41357
|
if (dispatch) {
|
|
40731
41358
|
const types = tableNodeTypes2(state.schema);
|
|
40732
|
-
const rect =
|
|
41359
|
+
const rect = selectedRect4(state), tr = state.tr;
|
|
40733
41360
|
const cells = rect.map.cellsInRect(type == "column" ? {
|
|
40734
41361
|
left: rect.left,
|
|
40735
41362
|
top: 0,
|
|
@@ -40769,7 +41396,7 @@ function toggleHeader(type, options) {
|
|
|
40769
41396
|
if (!isInTable(state)) return false;
|
|
40770
41397
|
if (dispatch) {
|
|
40771
41398
|
const types = tableNodeTypes2(state.schema);
|
|
40772
|
-
const rect =
|
|
41399
|
+
const rect = selectedRect4(state), tr = state.tr;
|
|
40773
41400
|
const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types);
|
|
40774
41401
|
const isHeaderColumnEnabled = isHeaderEnabledByType("column", rect, types);
|
|
40775
41402
|
const selectionStartsAt = (type === "column" ? isHeaderRowEnabled : type === "row" ? isHeaderColumnEnabled : false) ? 1 : 0;
|
|
@@ -40917,7 +41544,7 @@ function atEndOfCell(view, axis, dir) {
|
|
|
40917
41544
|
var columnResizingPluginKey2 = new PluginKey5("tableColumnResizing");
|
|
40918
41545
|
|
|
40919
41546
|
// src/components/UEditor/table-controls.tsx
|
|
40920
|
-
var
|
|
41547
|
+
var import_lucide_react56 = require("lucide-react");
|
|
40921
41548
|
|
|
40922
41549
|
// src/components/UEditor/table-layout-model.ts
|
|
40923
41550
|
var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
|
|
@@ -41427,7 +42054,7 @@ function TableAddRails({
|
|
|
41427
42054
|
}
|
|
41428
42055
|
|
|
41429
42056
|
// src/components/UEditor/table-control-menu.tsx
|
|
41430
|
-
var
|
|
42057
|
+
var import_lucide_react54 = require("lucide-react");
|
|
41431
42058
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
41432
42059
|
function TableControlMenu({
|
|
41433
42060
|
controlsVisible,
|
|
@@ -41479,7 +42106,7 @@ function TableControlMenu({
|
|
|
41479
42106
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
41480
42107
|
pointerEvents: shown ? "auto" : "none"
|
|
41481
42108
|
},
|
|
41482
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
42109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_lucide_react54.MoreHorizontal, { className: "h-4 w-4" })
|
|
41483
42110
|
}
|
|
41484
42111
|
)
|
|
41485
42112
|
}
|
|
@@ -41491,7 +42118,7 @@ function TableControlMenu({
|
|
|
41491
42118
|
}
|
|
41492
42119
|
|
|
41493
42120
|
// src/components/UEditor/table-axis-handles.tsx
|
|
41494
|
-
var
|
|
42121
|
+
var import_lucide_react55 = require("lucide-react");
|
|
41495
42122
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
41496
42123
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
41497
42124
|
function TableRowHandles({
|
|
@@ -41553,7 +42180,7 @@ function TableRowHandles({
|
|
|
41553
42180
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
41554
42181
|
pointerEvents: isShown ? "auto" : "none"
|
|
41555
42182
|
},
|
|
41556
|
-
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
42183
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react55.GripVertical, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
41557
42184
|
}
|
|
41558
42185
|
)
|
|
41559
42186
|
}
|
|
@@ -41624,7 +42251,7 @@ function TableColumnHandles({
|
|
|
41624
42251
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
41625
42252
|
pointerEvents: isShown ? "auto" : "none"
|
|
41626
42253
|
},
|
|
41627
|
-
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
42254
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react55.GripHorizontal, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
41628
42255
|
}
|
|
41629
42256
|
)
|
|
41630
42257
|
}
|
|
@@ -41664,17 +42291,17 @@ function getSelectedCell(editor) {
|
|
|
41664
42291
|
}
|
|
41665
42292
|
function TableControls({ editor, containerRef }) {
|
|
41666
42293
|
const t = useSmartTranslations("UEditor");
|
|
41667
|
-
const [layout, setLayout] =
|
|
41668
|
-
const [dragPreview, setDragPreview] =
|
|
41669
|
-
const [hoverState, setHoverState] =
|
|
41670
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
41671
|
-
const layoutRef =
|
|
41672
|
-
const dragStateRef =
|
|
41673
|
-
const syncFrameRef =
|
|
41674
|
-
|
|
42294
|
+
const [layout, setLayout] = import_react75.default.useState(null);
|
|
42295
|
+
const [dragPreview, setDragPreview] = import_react75.default.useState(null);
|
|
42296
|
+
const [hoverState, setHoverState] = import_react75.default.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
42297
|
+
const [openMenuKey, setOpenMenuKey] = import_react75.default.useState(null);
|
|
42298
|
+
const layoutRef = import_react75.default.useRef(null);
|
|
42299
|
+
const dragStateRef = import_react75.default.useRef(null);
|
|
42300
|
+
const syncFrameRef = import_react75.default.useRef(null);
|
|
42301
|
+
import_react75.default.useEffect(() => {
|
|
41675
42302
|
layoutRef.current = layout;
|
|
41676
42303
|
}, [layout]);
|
|
41677
|
-
const syncFromCell =
|
|
42304
|
+
const syncFromCell = import_react75.default.useCallback((cell) => {
|
|
41678
42305
|
const surface = containerRef.current;
|
|
41679
42306
|
if (!surface || !cell) {
|
|
41680
42307
|
setLayout(null);
|
|
@@ -41682,23 +42309,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
41682
42309
|
}
|
|
41683
42310
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
41684
42311
|
}, [containerRef, editor]);
|
|
41685
|
-
const syncFromSelection =
|
|
42312
|
+
const syncFromSelection = import_react75.default.useCallback(() => {
|
|
41686
42313
|
syncFromCell(getSelectedCell(editor));
|
|
41687
42314
|
}, [editor, syncFromCell]);
|
|
41688
|
-
const scheduleSyncFromSelection =
|
|
42315
|
+
const scheduleSyncFromSelection = import_react75.default.useCallback(() => {
|
|
41689
42316
|
if (syncFrameRef.current !== null) return;
|
|
41690
42317
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
41691
42318
|
syncFrameRef.current = null;
|
|
41692
42319
|
syncFromSelection();
|
|
41693
42320
|
});
|
|
41694
42321
|
}, [syncFromSelection]);
|
|
41695
|
-
|
|
42322
|
+
import_react75.default.useEffect(() => () => {
|
|
41696
42323
|
if (syncFrameRef.current !== null) {
|
|
41697
42324
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
41698
42325
|
syncFrameRef.current = null;
|
|
41699
42326
|
}
|
|
41700
42327
|
}, []);
|
|
41701
|
-
const refreshCurrentLayout =
|
|
42328
|
+
const refreshCurrentLayout = import_react75.default.useCallback(() => {
|
|
41702
42329
|
setLayout((prev) => {
|
|
41703
42330
|
if (!prev) return prev;
|
|
41704
42331
|
const surface = containerRef.current;
|
|
@@ -41708,12 +42335,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
41708
42335
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
41709
42336
|
});
|
|
41710
42337
|
}, [containerRef, editor]);
|
|
41711
|
-
const clearDrag =
|
|
42338
|
+
const clearDrag = import_react75.default.useCallback(() => {
|
|
41712
42339
|
dragStateRef.current = null;
|
|
41713
42340
|
setDragPreview(null);
|
|
41714
42341
|
document.body.style.cursor = "";
|
|
41715
42342
|
}, []);
|
|
41716
|
-
const updateHoverState =
|
|
42343
|
+
const updateHoverState = import_react75.default.useCallback((event) => {
|
|
41717
42344
|
const activeLayout = layoutRef.current;
|
|
41718
42345
|
const surface = containerRef.current;
|
|
41719
42346
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -41729,7 +42356,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41729
42356
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
41730
42357
|
});
|
|
41731
42358
|
}, [containerRef]);
|
|
41732
|
-
|
|
42359
|
+
import_react75.default.useEffect(() => {
|
|
41733
42360
|
const proseMirror = editor.view.dom;
|
|
41734
42361
|
const surface = containerRef.current;
|
|
41735
42362
|
if (!surface) return void 0;
|
|
@@ -41780,37 +42407,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
41780
42407
|
editor.off("update", refreshCurrentLayout);
|
|
41781
42408
|
};
|
|
41782
42409
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
41783
|
-
const runAtCellPos =
|
|
42410
|
+
const runAtCellPos = import_react75.default.useCallback((cellPos, command, options) => {
|
|
41784
42411
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
41785
42412
|
if (options?.sync !== false) {
|
|
41786
42413
|
scheduleSyncFromSelection();
|
|
41787
42414
|
}
|
|
41788
42415
|
return result;
|
|
41789
42416
|
}, [editor, scheduleSyncFromSelection]);
|
|
41790
|
-
const runAtActiveCell =
|
|
42417
|
+
const runAtActiveCell = import_react75.default.useCallback((command, options) => {
|
|
41791
42418
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
41792
42419
|
}, [runAtCellPos]);
|
|
41793
|
-
const duplicateRowAt =
|
|
42420
|
+
const duplicateRowAt = import_react75.default.useCallback((rowIndex, cellPos) => {
|
|
41794
42421
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
41795
42422
|
scheduleSyncFromSelection();
|
|
41796
42423
|
return result;
|
|
41797
42424
|
}, [editor, scheduleSyncFromSelection]);
|
|
41798
|
-
const clearRowAt =
|
|
42425
|
+
const clearRowAt = import_react75.default.useCallback((rowIndex, cellPos) => {
|
|
41799
42426
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
41800
42427
|
scheduleSyncFromSelection();
|
|
41801
42428
|
return result;
|
|
41802
42429
|
}, [editor, scheduleSyncFromSelection]);
|
|
41803
|
-
const duplicateColumnAt =
|
|
42430
|
+
const duplicateColumnAt = import_react75.default.useCallback((columnIndex, cellPos) => {
|
|
41804
42431
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
41805
42432
|
scheduleSyncFromSelection();
|
|
41806
42433
|
return result;
|
|
41807
42434
|
}, [editor, scheduleSyncFromSelection]);
|
|
41808
|
-
const clearColumnAt =
|
|
42435
|
+
const clearColumnAt = import_react75.default.useCallback((columnIndex, cellPos) => {
|
|
41809
42436
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
41810
42437
|
scheduleSyncFromSelection();
|
|
41811
42438
|
return result;
|
|
41812
42439
|
}, [editor, scheduleSyncFromSelection]);
|
|
41813
|
-
const expandTableBy =
|
|
42440
|
+
const expandTableBy = import_react75.default.useCallback((rows, cols) => {
|
|
41814
42441
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
41815
42442
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
41816
42443
|
scheduleSyncFromSelection();
|
|
@@ -41819,19 +42446,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
41819
42446
|
const canExpandTable = Boolean(layout);
|
|
41820
42447
|
const controlsVisible = dragPreview !== null;
|
|
41821
42448
|
const tableMenuOpen = openMenuKey === "table";
|
|
41822
|
-
const startAddColumnDrag =
|
|
42449
|
+
const startAddColumnDrag = import_react75.default.useCallback(() => {
|
|
41823
42450
|
setOpenMenuKey(null);
|
|
41824
42451
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
41825
42452
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
41826
42453
|
document.body.style.cursor = "ew-resize";
|
|
41827
42454
|
}, []);
|
|
41828
|
-
const startAddRowDrag =
|
|
42455
|
+
const startAddRowDrag = import_react75.default.useCallback(() => {
|
|
41829
42456
|
setOpenMenuKey(null);
|
|
41830
42457
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
41831
42458
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
41832
42459
|
document.body.style.cursor = "ns-resize";
|
|
41833
42460
|
}, []);
|
|
41834
|
-
const startRowDrag =
|
|
42461
|
+
const startRowDrag = import_react75.default.useCallback((rowHandle) => {
|
|
41835
42462
|
setOpenMenuKey(null);
|
|
41836
42463
|
dragStateRef.current = {
|
|
41837
42464
|
kind: "row",
|
|
@@ -41848,7 +42475,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41848
42475
|
});
|
|
41849
42476
|
document.body.style.cursor = "grabbing";
|
|
41850
42477
|
}, []);
|
|
41851
|
-
const startColumnDrag =
|
|
42478
|
+
const startColumnDrag = import_react75.default.useCallback((columnHandle) => {
|
|
41852
42479
|
setOpenMenuKey(null);
|
|
41853
42480
|
dragStateRef.current = {
|
|
41854
42481
|
kind: "column",
|
|
@@ -41865,7 +42492,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41865
42492
|
});
|
|
41866
42493
|
document.body.style.cursor = "grabbing";
|
|
41867
42494
|
}, []);
|
|
41868
|
-
|
|
42495
|
+
import_react75.default.useEffect(() => {
|
|
41869
42496
|
const handleMouseMove2 = (event) => {
|
|
41870
42497
|
const dragState = dragStateRef.current;
|
|
41871
42498
|
const activeLayout = layoutRef.current;
|
|
@@ -41954,126 +42581,126 @@ function TableControls({ editor, containerRef }) {
|
|
|
41954
42581
|
window.removeEventListener("blur", clearDrag);
|
|
41955
42582
|
};
|
|
41956
42583
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
41957
|
-
const menuItems =
|
|
42584
|
+
const menuItems = import_react75.default.useMemo(() => {
|
|
41958
42585
|
if (!layout) return [];
|
|
41959
42586
|
return [
|
|
41960
42587
|
{
|
|
41961
42588
|
label: t("tableMenu.alignLeft"),
|
|
41962
|
-
icon:
|
|
42589
|
+
icon: import_lucide_react56.AlignLeft,
|
|
41963
42590
|
onClick: () => applyTableAlignment(editor, "left", layout.cellPos)
|
|
41964
42591
|
},
|
|
41965
42592
|
{
|
|
41966
42593
|
label: t("tableMenu.alignCenter"),
|
|
41967
|
-
icon:
|
|
42594
|
+
icon: import_lucide_react56.AlignCenter,
|
|
41968
42595
|
onClick: () => applyTableAlignment(editor, "center", layout.cellPos)
|
|
41969
42596
|
},
|
|
41970
42597
|
{
|
|
41971
42598
|
label: t("tableMenu.alignRight"),
|
|
41972
|
-
icon:
|
|
42599
|
+
icon: import_lucide_react56.AlignRight,
|
|
41973
42600
|
onClick: () => applyTableAlignment(editor, "right", layout.cellPos)
|
|
41974
42601
|
},
|
|
41975
42602
|
{
|
|
41976
42603
|
label: t("tableMenu.addColumnBefore"),
|
|
41977
|
-
icon:
|
|
42604
|
+
icon: import_lucide_react56.ArrowLeft,
|
|
41978
42605
|
onClick: () => runAtActiveCell((chain) => chain.addColumnBefore())
|
|
41979
42606
|
},
|
|
41980
42607
|
{
|
|
41981
42608
|
label: t("tableMenu.addColumnAfter"),
|
|
41982
|
-
icon:
|
|
42609
|
+
icon: import_lucide_react56.ArrowRight,
|
|
41983
42610
|
onClick: () => runAtActiveCell((chain) => chain.addColumnAfter())
|
|
41984
42611
|
},
|
|
41985
42612
|
{
|
|
41986
42613
|
label: t("tableMenu.addRowBefore"),
|
|
41987
|
-
icon:
|
|
42614
|
+
icon: import_lucide_react56.ArrowUp,
|
|
41988
42615
|
onClick: () => runAtActiveCell((chain) => chain.addRowBefore())
|
|
41989
42616
|
},
|
|
41990
42617
|
{
|
|
41991
42618
|
label: t("tableMenu.addRowAfter"),
|
|
41992
|
-
icon:
|
|
42619
|
+
icon: import_lucide_react56.ArrowDown,
|
|
41993
42620
|
onClick: () => runAtActiveCell((chain) => chain.addRowAfter())
|
|
41994
42621
|
},
|
|
41995
42622
|
{
|
|
41996
42623
|
label: t("tableMenu.toggleHeaderRow"),
|
|
41997
|
-
icon:
|
|
42624
|
+
icon: import_lucide_react56.Table,
|
|
41998
42625
|
onClick: () => runAtActiveCell((chain) => chain.toggleHeaderRow())
|
|
41999
42626
|
},
|
|
42000
42627
|
{
|
|
42001
42628
|
label: t("tableMenu.toggleHeaderColumn"),
|
|
42002
|
-
icon:
|
|
42629
|
+
icon: import_lucide_react56.Table,
|
|
42003
42630
|
onClick: () => runAtActiveCell((chain) => chain.toggleHeaderColumn())
|
|
42004
42631
|
},
|
|
42005
42632
|
{
|
|
42006
42633
|
label: t("tableMenu.deleteColumn"),
|
|
42007
|
-
icon:
|
|
42634
|
+
icon: import_lucide_react56.Trash2,
|
|
42008
42635
|
onClick: () => runAtActiveCell((chain) => chain.deleteColumn()),
|
|
42009
42636
|
destructive: true
|
|
42010
42637
|
},
|
|
42011
42638
|
{
|
|
42012
42639
|
label: t("tableMenu.deleteRow"),
|
|
42013
|
-
icon:
|
|
42640
|
+
icon: import_lucide_react56.Trash2,
|
|
42014
42641
|
onClick: () => runAtActiveCell((chain) => chain.deleteRow()),
|
|
42015
42642
|
destructive: true
|
|
42016
42643
|
},
|
|
42017
42644
|
{
|
|
42018
42645
|
label: t("tableMenu.deleteTable"),
|
|
42019
|
-
icon:
|
|
42646
|
+
icon: import_lucide_react56.Trash2,
|
|
42020
42647
|
onClick: () => runAtActiveCell((chain) => chain.deleteTable()),
|
|
42021
42648
|
destructive: true
|
|
42022
42649
|
}
|
|
42023
42650
|
];
|
|
42024
42651
|
}, [editor, layout, runAtActiveCell, t]);
|
|
42025
|
-
const getRowHandleMenuItems =
|
|
42652
|
+
const getRowHandleMenuItems = import_react75.default.useCallback((rowHandle) => [
|
|
42026
42653
|
{
|
|
42027
42654
|
label: t("tableMenu.addRowBefore"),
|
|
42028
|
-
icon:
|
|
42655
|
+
icon: import_lucide_react56.ArrowUp,
|
|
42029
42656
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.addRowBefore())
|
|
42030
42657
|
},
|
|
42031
42658
|
{
|
|
42032
42659
|
label: t("tableMenu.addRowAfter"),
|
|
42033
|
-
icon:
|
|
42660
|
+
icon: import_lucide_react56.ArrowDown,
|
|
42034
42661
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.addRowAfter())
|
|
42035
42662
|
},
|
|
42036
42663
|
{
|
|
42037
42664
|
label: t("tableMenu.duplicateRow"),
|
|
42038
|
-
icon:
|
|
42665
|
+
icon: import_lucide_react56.Copy,
|
|
42039
42666
|
onClick: () => duplicateRowAt(rowHandle.index, rowHandle.cellPos)
|
|
42040
42667
|
},
|
|
42041
42668
|
{
|
|
42042
42669
|
label: t("tableMenu.clearRowContents"),
|
|
42043
|
-
icon:
|
|
42670
|
+
icon: import_lucide_react56.Table,
|
|
42044
42671
|
onClick: () => clearRowAt(rowHandle.index, rowHandle.cellPos)
|
|
42045
42672
|
},
|
|
42046
42673
|
{
|
|
42047
42674
|
label: t("tableMenu.deleteRow"),
|
|
42048
|
-
icon:
|
|
42675
|
+
icon: import_lucide_react56.Trash2,
|
|
42049
42676
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.deleteRow()),
|
|
42050
42677
|
destructive: true
|
|
42051
42678
|
}
|
|
42052
42679
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
42053
|
-
const getColumnHandleMenuItems =
|
|
42680
|
+
const getColumnHandleMenuItems = import_react75.default.useCallback((columnHandle) => [
|
|
42054
42681
|
{
|
|
42055
42682
|
label: t("tableMenu.addColumnBefore"),
|
|
42056
|
-
icon:
|
|
42683
|
+
icon: import_lucide_react56.ArrowLeft,
|
|
42057
42684
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.addColumnBefore())
|
|
42058
42685
|
},
|
|
42059
42686
|
{
|
|
42060
42687
|
label: t("tableMenu.addColumnAfter"),
|
|
42061
|
-
icon:
|
|
42688
|
+
icon: import_lucide_react56.ArrowRight,
|
|
42062
42689
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.addColumnAfter())
|
|
42063
42690
|
},
|
|
42064
42691
|
{
|
|
42065
42692
|
label: t("tableMenu.duplicateColumn"),
|
|
42066
|
-
icon:
|
|
42693
|
+
icon: import_lucide_react56.Copy,
|
|
42067
42694
|
onClick: () => duplicateColumnAt(columnHandle.index, columnHandle.cellPos)
|
|
42068
42695
|
},
|
|
42069
42696
|
{
|
|
42070
42697
|
label: t("tableMenu.clearColumnContents"),
|
|
42071
|
-
icon:
|
|
42698
|
+
icon: import_lucide_react56.Table,
|
|
42072
42699
|
onClick: () => clearColumnAt(columnHandle.index, columnHandle.cellPos)
|
|
42073
42700
|
},
|
|
42074
42701
|
{
|
|
42075
42702
|
label: t("tableMenu.deleteColumn"),
|
|
42076
|
-
icon:
|
|
42703
|
+
icon: import_lucide_react56.Trash2,
|
|
42077
42704
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.deleteColumn()),
|
|
42078
42705
|
destructive: true
|
|
42079
42706
|
}
|
|
@@ -42367,10 +42994,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
42367
42994
|
);
|
|
42368
42995
|
|
|
42369
42996
|
// src/components/UEditor/use-table-interactions.ts
|
|
42370
|
-
var
|
|
42997
|
+
var import_react77 = __toESM(require("react"), 1);
|
|
42371
42998
|
|
|
42372
42999
|
// src/components/UEditor/use-table-row-resize.ts
|
|
42373
|
-
var
|
|
43000
|
+
var import_react76 = __toESM(require("react"), 1);
|
|
42374
43001
|
function useTableRowResize({
|
|
42375
43002
|
editor,
|
|
42376
43003
|
setHoveredTableCell,
|
|
@@ -42379,16 +43006,16 @@ function useTableRowResize({
|
|
|
42379
43006
|
clearAllTableResizeHover,
|
|
42380
43007
|
scheduleTableLayoutSync
|
|
42381
43008
|
}) {
|
|
42382
|
-
const stateRef = (0,
|
|
42383
|
-
const syncActiveGuide =
|
|
43009
|
+
const stateRef = (0, import_react76.useRef)(null);
|
|
43010
|
+
const syncActiveGuide = import_react76.default.useCallback(() => {
|
|
42384
43011
|
const state = stateRef.current;
|
|
42385
43012
|
if (!state) return false;
|
|
42386
43013
|
setHoveredTableCell(state.cellElement);
|
|
42387
43014
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, state.pendingHeight);
|
|
42388
43015
|
return true;
|
|
42389
43016
|
}, [setHoveredTableCell, showRowGuide]);
|
|
42390
|
-
const isResizing =
|
|
42391
|
-
const beginResize =
|
|
43017
|
+
const isResizing = import_react76.default.useCallback(() => stateRef.current !== null, []);
|
|
43018
|
+
const beginResize = import_react76.default.useCallback((event, table, row, cell) => {
|
|
42392
43019
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
42393
43020
|
return false;
|
|
42394
43021
|
}
|
|
@@ -42414,7 +43041,7 @@ function useTableRowResize({
|
|
|
42414
43041
|
event.stopPropagation();
|
|
42415
43042
|
return true;
|
|
42416
43043
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
42417
|
-
const handlePointerMove =
|
|
43044
|
+
const handlePointerMove = import_react76.default.useCallback((event) => {
|
|
42418
43045
|
const state = stateRef.current;
|
|
42419
43046
|
if (!state) return;
|
|
42420
43047
|
const nextHeight = Math.max(
|
|
@@ -42431,7 +43058,7 @@ function useTableRowResize({
|
|
|
42431
43058
|
document.body.style.cursor = "row-resize";
|
|
42432
43059
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, nextHeight);
|
|
42433
43060
|
}, [showRowGuide]);
|
|
42434
|
-
const handlePointerUp =
|
|
43061
|
+
const handlePointerUp = import_react76.default.useCallback((event) => {
|
|
42435
43062
|
if (!editor) return;
|
|
42436
43063
|
const state = stateRef.current;
|
|
42437
43064
|
if (!state) return;
|
|
@@ -42455,7 +43082,7 @@ function useTableRowResize({
|
|
|
42455
43082
|
clearAllTableResizeHover();
|
|
42456
43083
|
scheduleTableLayoutSync();
|
|
42457
43084
|
}, [clearAllTableResizeHover, clearHoveredTableCell, editor, scheduleTableLayoutSync]);
|
|
42458
|
-
const cancelResize =
|
|
43085
|
+
const cancelResize = import_react76.default.useCallback(() => {
|
|
42459
43086
|
if (!stateRef.current) return;
|
|
42460
43087
|
stateRef.current = null;
|
|
42461
43088
|
document.body.style.cursor = "";
|
|
@@ -42463,7 +43090,7 @@ function useTableRowResize({
|
|
|
42463
43090
|
clearAllTableResizeHover();
|
|
42464
43091
|
scheduleTableLayoutSync();
|
|
42465
43092
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
42466
|
-
const cleanup =
|
|
43093
|
+
const cleanup = import_react76.default.useCallback(() => {
|
|
42467
43094
|
stateRef.current = null;
|
|
42468
43095
|
document.body.style.cursor = "";
|
|
42469
43096
|
}, []);
|
|
@@ -42480,24 +43107,24 @@ function useTableRowResize({
|
|
|
42480
43107
|
|
|
42481
43108
|
// src/components/UEditor/use-table-interactions.ts
|
|
42482
43109
|
function useUEditorTableInteractions(editor, editable = true) {
|
|
42483
|
-
const editorContentRef = (0,
|
|
42484
|
-
const tableColumnGuideRef = (0,
|
|
42485
|
-
const tableRowGuideRef = (0,
|
|
42486
|
-
const activeTableCellHighlightRef = (0,
|
|
42487
|
-
const hoveredTableCellRef = (0,
|
|
42488
|
-
const activeTableCellRef = (0,
|
|
42489
|
-
const suppressActiveCellHighlightRef = (0,
|
|
42490
|
-
const tableLayoutSyncFrameRef = (0,
|
|
42491
|
-
const getProseMirrorElement =
|
|
43110
|
+
const editorContentRef = (0, import_react77.useRef)(null);
|
|
43111
|
+
const tableColumnGuideRef = (0, import_react77.useRef)(null);
|
|
43112
|
+
const tableRowGuideRef = (0, import_react77.useRef)(null);
|
|
43113
|
+
const activeTableCellHighlightRef = (0, import_react77.useRef)(null);
|
|
43114
|
+
const hoveredTableCellRef = (0, import_react77.useRef)(null);
|
|
43115
|
+
const activeTableCellRef = (0, import_react77.useRef)(null);
|
|
43116
|
+
const suppressActiveCellHighlightRef = (0, import_react77.useRef)(false);
|
|
43117
|
+
const tableLayoutSyncFrameRef = (0, import_react77.useRef)(null);
|
|
43118
|
+
const getProseMirrorElement = import_react77.default.useCallback(() => {
|
|
42492
43119
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
42493
43120
|
}, []);
|
|
42494
|
-
const setEditorResizeCursor =
|
|
43121
|
+
const setEditorResizeCursor = import_react77.default.useCallback((cursor) => {
|
|
42495
43122
|
const proseMirror = getProseMirrorElement();
|
|
42496
43123
|
if (proseMirror) {
|
|
42497
43124
|
proseMirror.style.cursor = cursor;
|
|
42498
43125
|
}
|
|
42499
43126
|
}, [getProseMirrorElement]);
|
|
42500
|
-
const hideColumnGuide =
|
|
43127
|
+
const hideColumnGuide = import_react77.default.useCallback(() => {
|
|
42501
43128
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
42502
43129
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
42503
43130
|
const guide = tableColumnGuideRef.current;
|
|
@@ -42505,7 +43132,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42505
43132
|
guide.style.opacity = "0";
|
|
42506
43133
|
}
|
|
42507
43134
|
}, [getProseMirrorElement]);
|
|
42508
|
-
const hideRowGuide =
|
|
43135
|
+
const hideRowGuide = import_react77.default.useCallback(() => {
|
|
42509
43136
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
42510
43137
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
42511
43138
|
const guide = tableRowGuideRef.current;
|
|
@@ -42513,12 +43140,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42513
43140
|
guide.style.opacity = "0";
|
|
42514
43141
|
}
|
|
42515
43142
|
}, [getProseMirrorElement]);
|
|
42516
|
-
const clearAllTableResizeHover =
|
|
43143
|
+
const clearAllTableResizeHover = import_react77.default.useCallback(() => {
|
|
42517
43144
|
setEditorResizeCursor("");
|
|
42518
43145
|
hideColumnGuide();
|
|
42519
43146
|
hideRowGuide();
|
|
42520
43147
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
42521
|
-
const updateActiveCellHighlight =
|
|
43148
|
+
const updateActiveCellHighlight = import_react77.default.useCallback((cell) => {
|
|
42522
43149
|
const surface = editorContentRef.current;
|
|
42523
43150
|
const highlight = activeTableCellHighlightRef.current;
|
|
42524
43151
|
if (!highlight) return;
|
|
@@ -42533,7 +43160,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42533
43160
|
highlight.style.width = `${metrics.width}px`;
|
|
42534
43161
|
highlight.style.height = `${metrics.height}px`;
|
|
42535
43162
|
}, []);
|
|
42536
|
-
const scheduleTableLayoutSync =
|
|
43163
|
+
const scheduleTableLayoutSync = import_react77.default.useCallback(() => {
|
|
42537
43164
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
42538
43165
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
42539
43166
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -42541,7 +43168,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42541
43168
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
42542
43169
|
});
|
|
42543
43170
|
}, [updateActiveCellHighlight]);
|
|
42544
|
-
const setActiveTableCell =
|
|
43171
|
+
const setActiveTableCell = import_react77.default.useCallback((cell) => {
|
|
42545
43172
|
if (activeTableCellRef.current === cell) {
|
|
42546
43173
|
updateActiveCellHighlight(cell);
|
|
42547
43174
|
return;
|
|
@@ -42549,17 +43176,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42549
43176
|
activeTableCellRef.current = cell;
|
|
42550
43177
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
42551
43178
|
}, [updateActiveCellHighlight]);
|
|
42552
|
-
const clearActiveTableCell =
|
|
43179
|
+
const clearActiveTableCell = import_react77.default.useCallback(() => {
|
|
42553
43180
|
activeTableCellRef.current = null;
|
|
42554
43181
|
updateActiveCellHighlight(null);
|
|
42555
43182
|
}, [updateActiveCellHighlight]);
|
|
42556
|
-
const setHoveredTableCell =
|
|
43183
|
+
const setHoveredTableCell = import_react77.default.useCallback((cell) => {
|
|
42557
43184
|
hoveredTableCellRef.current = cell;
|
|
42558
43185
|
}, []);
|
|
42559
|
-
const clearHoveredTableCell =
|
|
43186
|
+
const clearHoveredTableCell = import_react77.default.useCallback(() => {
|
|
42560
43187
|
hoveredTableCellRef.current = null;
|
|
42561
43188
|
}, []);
|
|
42562
|
-
const showColumnGuide =
|
|
43189
|
+
const showColumnGuide = import_react77.default.useCallback((table, row, cell) => {
|
|
42563
43190
|
const surface = editorContentRef.current;
|
|
42564
43191
|
const guide = tableColumnGuideRef.current;
|
|
42565
43192
|
if (!surface || !guide) return;
|
|
@@ -42573,7 +43200,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42573
43200
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
42574
43201
|
setEditorResizeCursor("col-resize");
|
|
42575
43202
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
42576
|
-
const showRowGuide =
|
|
43203
|
+
const showRowGuide = import_react77.default.useCallback((table, row, cell, previewHeight) => {
|
|
42577
43204
|
const surface = editorContentRef.current;
|
|
42578
43205
|
const guide = tableRowGuideRef.current;
|
|
42579
43206
|
if (!surface || !guide) return;
|
|
@@ -42605,7 +43232,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42605
43232
|
clearAllTableResizeHover,
|
|
42606
43233
|
scheduleTableLayoutSync
|
|
42607
43234
|
});
|
|
42608
|
-
const syncActiveTableCellFromSelection =
|
|
43235
|
+
const syncActiveTableCellFromSelection = import_react77.default.useCallback(() => {
|
|
42609
43236
|
if (!editor) return;
|
|
42610
43237
|
if (!editor.isFocused) {
|
|
42611
43238
|
clearActiveTableCell();
|
|
@@ -42613,7 +43240,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42613
43240
|
}
|
|
42614
43241
|
setActiveTableCell(getSelectionTableCell(editor.view));
|
|
42615
43242
|
}, [clearActiveTableCell, editor, setActiveTableCell]);
|
|
42616
|
-
(0,
|
|
43243
|
+
(0, import_react77.useEffect)(() => {
|
|
42617
43244
|
if (!editor || !editable) return void 0;
|
|
42618
43245
|
const proseMirror = editor.view.dom;
|
|
42619
43246
|
const surface = editorContentRef.current;
|
|
@@ -42788,12 +43415,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42788
43415
|
}
|
|
42789
43416
|
|
|
42790
43417
|
// src/components/UEditor/use-formula-coordinate-overlay.ts
|
|
42791
|
-
var
|
|
42792
|
-
var
|
|
43418
|
+
var import_react78 = require("react");
|
|
43419
|
+
var import_tables9 = require("@tiptap/pm/tables");
|
|
42793
43420
|
|
|
42794
43421
|
// src/components/UEditor/table-formula-range-picker.ts
|
|
42795
43422
|
var import_state12 = require("@tiptap/pm/state");
|
|
42796
|
-
var
|
|
43423
|
+
var import_tables8 = require("@tiptap/pm/tables");
|
|
42797
43424
|
function getCellText2(cellNode) {
|
|
42798
43425
|
return cellNode.textBetween(0, cellNode.content.size, "\n").trim();
|
|
42799
43426
|
}
|
|
@@ -42811,7 +43438,7 @@ function getFormulaEditingTableContext(view) {
|
|
|
42811
43438
|
if (!tableNode || tableNode.type.name !== "table") return null;
|
|
42812
43439
|
const tableDom = cellDom.closest("table");
|
|
42813
43440
|
if (!(tableDom instanceof HTMLTableElement)) return null;
|
|
42814
|
-
const tableMap =
|
|
43441
|
+
const tableMap = import_tables8.TableMap.get(tableNode);
|
|
42815
43442
|
const tableStart = $from.start(tableDepth);
|
|
42816
43443
|
const formulaCellRect = tableMap.findCell(cellPos - tableStart);
|
|
42817
43444
|
return {
|
|
@@ -42828,7 +43455,7 @@ function getFormulaEditingTableContext(view) {
|
|
|
42828
43455
|
return null;
|
|
42829
43456
|
}
|
|
42830
43457
|
function collectTableFormulaCells(tableNode) {
|
|
42831
|
-
const tableMap =
|
|
43458
|
+
const tableMap = import_tables8.TableMap.get(tableNode);
|
|
42832
43459
|
const formulas = [];
|
|
42833
43460
|
tableNode.forEach((rowNode, rowOffset) => {
|
|
42834
43461
|
rowNode.forEach((cellNode, cellOffset) => {
|
|
@@ -42914,7 +43541,7 @@ function getFormulaTableCellInfo(view, target, tablePos) {
|
|
|
42914
43541
|
const domPos = view.posAtDOM(cell, 0);
|
|
42915
43542
|
const tableInfo = findTableForPos(view, domPos);
|
|
42916
43543
|
if (!tableInfo || tableInfo.pos !== tablePos) return null;
|
|
42917
|
-
const map =
|
|
43544
|
+
const map = import_tables8.TableMap.get(tableInfo.node);
|
|
42918
43545
|
const relativeCellPos = getCellRelativePosFromDomPos2(map, tableInfo.start, domPos);
|
|
42919
43546
|
if (relativeCellPos == null) return null;
|
|
42920
43547
|
const rect = map.findCell(relativeCellPos);
|
|
@@ -43058,8 +43685,8 @@ function createBlockedReferenceHighlight(label) {
|
|
|
43058
43685
|
return element;
|
|
43059
43686
|
}
|
|
43060
43687
|
function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
43061
|
-
const overlayRef = (0,
|
|
43062
|
-
(0,
|
|
43688
|
+
const overlayRef = (0, import_react78.useRef)(null);
|
|
43689
|
+
(0, import_react78.useEffect)(() => {
|
|
43063
43690
|
if (!editor) return void 0;
|
|
43064
43691
|
const overlay = overlayRef.current;
|
|
43065
43692
|
const container = containerRef.current;
|
|
@@ -43088,7 +43715,7 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
43088
43715
|
const tableRect = context.tableDom.getBoundingClientRect();
|
|
43089
43716
|
const tableLeft = tableRect.left - containerRect.left + container.scrollLeft;
|
|
43090
43717
|
const tableTop = tableRect.top - containerRect.top + container.scrollTop;
|
|
43091
|
-
const map =
|
|
43718
|
+
const map = import_tables9.TableMap.get(context.tableNode);
|
|
43092
43719
|
const columnSegments = Array(map.width);
|
|
43093
43720
|
const rowSegments = Array(map.height);
|
|
43094
43721
|
const cellInfos = [];
|
|
@@ -43266,9 +43893,9 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
43266
43893
|
}
|
|
43267
43894
|
|
|
43268
43895
|
// src/components/UEditor/menu-bar.tsx
|
|
43269
|
-
var
|
|
43270
|
-
var
|
|
43271
|
-
var
|
|
43896
|
+
var import_react79 = __toESM(require("react"), 1);
|
|
43897
|
+
var import_react80 = require("@tiptap/react");
|
|
43898
|
+
var import_lucide_react57 = require("lucide-react");
|
|
43272
43899
|
|
|
43273
43900
|
// src/components/UEditor/preview-html.ts
|
|
43274
43901
|
var DEFAULT_TABLE_COLUMN_WIDTH2 = 100;
|
|
@@ -43448,7 +44075,7 @@ function renderMenuItems(items) {
|
|
|
43448
44075
|
case "sub":
|
|
43449
44076
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
43450
44077
|
case "custom":
|
|
43451
|
-
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
44078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react79.default.Fragment, { children: item.render() }, item.key);
|
|
43452
44079
|
}
|
|
43453
44080
|
});
|
|
43454
44081
|
}
|
|
@@ -43486,7 +44113,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
43486
44113
|
{
|
|
43487
44114
|
type: "action",
|
|
43488
44115
|
label: t("menubar.undo"),
|
|
43489
|
-
icon:
|
|
44116
|
+
icon: import_lucide_react57.Undo,
|
|
43490
44117
|
shortcut: t("menubar.undoShortcut"),
|
|
43491
44118
|
onClick: () => editor.chain().focus().undo().run(),
|
|
43492
44119
|
disabled: !editor.can().undo()
|
|
@@ -43494,7 +44121,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
43494
44121
|
{
|
|
43495
44122
|
type: "action",
|
|
43496
44123
|
label: t("menubar.redo"),
|
|
43497
|
-
icon:
|
|
44124
|
+
icon: import_lucide_react57.Redo,
|
|
43498
44125
|
shortcut: t("menubar.redoShortcut"),
|
|
43499
44126
|
onClick: () => editor.chain().focus().redo().run(),
|
|
43500
44127
|
disabled: !editor.can().redo()
|
|
@@ -43503,7 +44130,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
43503
44130
|
{
|
|
43504
44131
|
type: "action",
|
|
43505
44132
|
label: t("menubar.cut"),
|
|
43506
|
-
icon:
|
|
44133
|
+
icon: import_lucide_react57.Scissors,
|
|
43507
44134
|
shortcut: t("menubar.cutShortcut"),
|
|
43508
44135
|
onClick: () => document.execCommand("cut")
|
|
43509
44136
|
},
|
|
@@ -43551,7 +44178,7 @@ function buildViewMenuItems(t, {
|
|
|
43551
44178
|
{
|
|
43552
44179
|
type: "action",
|
|
43553
44180
|
label: t("menubar.sourceCode"),
|
|
43554
|
-
icon:
|
|
44181
|
+
icon: import_lucide_react57.FileCode,
|
|
43555
44182
|
onClick: () => onSourceCode ? onSourceCode() : openSourceDialog()
|
|
43556
44183
|
},
|
|
43557
44184
|
{
|
|
@@ -43563,7 +44190,7 @@ function buildViewMenuItems(t, {
|
|
|
43563
44190
|
{
|
|
43564
44191
|
type: "action",
|
|
43565
44192
|
label: t("menubar.fullscreen"),
|
|
43566
|
-
icon:
|
|
44193
|
+
icon: import_lucide_react57.Maximize2,
|
|
43567
44194
|
shortcut: t("menubar.fullscreenShortcut"),
|
|
43568
44195
|
onClick: () => {
|
|
43569
44196
|
const el = containerRef.current;
|
|
@@ -43582,7 +44209,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43582
44209
|
{
|
|
43583
44210
|
type: "action",
|
|
43584
44211
|
label: t("menubar.bold"),
|
|
43585
|
-
icon:
|
|
44212
|
+
icon: import_lucide_react57.Bold,
|
|
43586
44213
|
shortcut: t("menubar.boldShortcut"),
|
|
43587
44214
|
active: editor.isActive("bold"),
|
|
43588
44215
|
onClick: () => editor.chain().focus().toggleBold().run()
|
|
@@ -43590,7 +44217,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43590
44217
|
{
|
|
43591
44218
|
type: "action",
|
|
43592
44219
|
label: t("menubar.italic"),
|
|
43593
|
-
icon:
|
|
44220
|
+
icon: import_lucide_react57.Italic,
|
|
43594
44221
|
shortcut: t("menubar.italicShortcut"),
|
|
43595
44222
|
active: editor.isActive("italic"),
|
|
43596
44223
|
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
@@ -43598,7 +44225,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43598
44225
|
{
|
|
43599
44226
|
type: "action",
|
|
43600
44227
|
label: t("menubar.underline"),
|
|
43601
|
-
icon:
|
|
44228
|
+
icon: import_lucide_react57.Underline,
|
|
43602
44229
|
shortcut: t("menubar.underlineShortcut"),
|
|
43603
44230
|
active: editor.isActive("underline"),
|
|
43604
44231
|
onClick: () => editor.chain().focus().toggleUnderline().run()
|
|
@@ -43606,28 +44233,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43606
44233
|
{
|
|
43607
44234
|
type: "action",
|
|
43608
44235
|
label: t("menubar.strike"),
|
|
43609
|
-
icon:
|
|
44236
|
+
icon: import_lucide_react57.Strikethrough,
|
|
43610
44237
|
active: editor.isActive("strike"),
|
|
43611
44238
|
onClick: () => editor.chain().focus().toggleStrike().run()
|
|
43612
44239
|
},
|
|
43613
44240
|
{
|
|
43614
44241
|
type: "action",
|
|
43615
44242
|
label: t("menubar.superscript"),
|
|
43616
|
-
icon:
|
|
44243
|
+
icon: import_lucide_react57.Superscript,
|
|
43617
44244
|
active: editor.isActive("superscript"),
|
|
43618
44245
|
onClick: () => editor.chain().focus().toggleSuperscript().run()
|
|
43619
44246
|
},
|
|
43620
44247
|
{
|
|
43621
44248
|
type: "action",
|
|
43622
44249
|
label: t("menubar.subscript"),
|
|
43623
|
-
icon:
|
|
44250
|
+
icon: import_lucide_react57.Subscript,
|
|
43624
44251
|
active: editor.isActive("subscript"),
|
|
43625
44252
|
onClick: () => editor.chain().focus().toggleSubscript().run()
|
|
43626
44253
|
},
|
|
43627
44254
|
{
|
|
43628
44255
|
type: "action",
|
|
43629
44256
|
label: t("menubar.code"),
|
|
43630
|
-
icon:
|
|
44257
|
+
icon: import_lucide_react57.Code,
|
|
43631
44258
|
active: editor.isActive("code"),
|
|
43632
44259
|
onClick: () => editor.chain().focus().toggleCode().run()
|
|
43633
44260
|
},
|
|
@@ -43645,21 +44272,21 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43645
44272
|
{
|
|
43646
44273
|
type: "action",
|
|
43647
44274
|
label: t("menubar.heading1"),
|
|
43648
|
-
icon:
|
|
44275
|
+
icon: import_lucide_react57.Heading1,
|
|
43649
44276
|
active: editor.isActive("heading", { level: 1 }),
|
|
43650
44277
|
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run()
|
|
43651
44278
|
},
|
|
43652
44279
|
{
|
|
43653
44280
|
type: "action",
|
|
43654
44281
|
label: t("menubar.heading2"),
|
|
43655
|
-
icon:
|
|
44282
|
+
icon: import_lucide_react57.Heading2,
|
|
43656
44283
|
active: editor.isActive("heading", { level: 2 }),
|
|
43657
44284
|
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run()
|
|
43658
44285
|
},
|
|
43659
44286
|
{
|
|
43660
44287
|
type: "action",
|
|
43661
44288
|
label: t("menubar.heading3"),
|
|
43662
|
-
icon:
|
|
44289
|
+
icon: import_lucide_react57.Heading3,
|
|
43663
44290
|
active: editor.isActive("heading", { level: 3 }),
|
|
43664
44291
|
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run()
|
|
43665
44292
|
},
|
|
@@ -43667,21 +44294,21 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43667
44294
|
{
|
|
43668
44295
|
type: "action",
|
|
43669
44296
|
label: t("menubar.blockquote"),
|
|
43670
|
-
icon:
|
|
44297
|
+
icon: import_lucide_react57.Quote,
|
|
43671
44298
|
active: editor.isActive("blockquote"),
|
|
43672
44299
|
onClick: () => editor.chain().focus().toggleBlockquote().run()
|
|
43673
44300
|
},
|
|
43674
44301
|
{
|
|
43675
44302
|
type: "action",
|
|
43676
44303
|
label: t("menubar.codeBlock"),
|
|
43677
|
-
icon:
|
|
44304
|
+
icon: import_lucide_react57.FileCode,
|
|
43678
44305
|
active: editor.isActive("codeBlock"),
|
|
43679
44306
|
onClick: () => editor.chain().focus().toggleCodeBlock().run()
|
|
43680
44307
|
},
|
|
43681
44308
|
{
|
|
43682
44309
|
type: "action",
|
|
43683
44310
|
label: t("menubar.taskList"),
|
|
43684
|
-
icon:
|
|
44311
|
+
icon: import_lucide_react57.ListTodo,
|
|
43685
44312
|
active: editor.isActive("taskList"),
|
|
43686
44313
|
onClick: () => editor.chain().focus().toggleTaskList().run()
|
|
43687
44314
|
}
|
|
@@ -43694,28 +44321,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
43694
44321
|
{
|
|
43695
44322
|
type: "action",
|
|
43696
44323
|
label: t("menubar.alignLeft"),
|
|
43697
|
-
icon:
|
|
44324
|
+
icon: import_lucide_react57.AlignLeft,
|
|
43698
44325
|
active: editor.isActive({ textAlign: "left" }),
|
|
43699
44326
|
onClick: () => editor.chain().focus().setTextAlign("left").run()
|
|
43700
44327
|
},
|
|
43701
44328
|
{
|
|
43702
44329
|
type: "action",
|
|
43703
44330
|
label: t("menubar.alignCenter"),
|
|
43704
|
-
icon:
|
|
44331
|
+
icon: import_lucide_react57.AlignCenter,
|
|
43705
44332
|
active: editor.isActive({ textAlign: "center" }),
|
|
43706
44333
|
onClick: () => editor.chain().focus().setTextAlign("center").run()
|
|
43707
44334
|
},
|
|
43708
44335
|
{
|
|
43709
44336
|
type: "action",
|
|
43710
44337
|
label: t("menubar.alignRight"),
|
|
43711
|
-
icon:
|
|
44338
|
+
icon: import_lucide_react57.AlignRight,
|
|
43712
44339
|
active: editor.isActive({ textAlign: "right" }),
|
|
43713
44340
|
onClick: () => editor.chain().focus().setTextAlign("right").run()
|
|
43714
44341
|
},
|
|
43715
44342
|
{
|
|
43716
44343
|
type: "action",
|
|
43717
44344
|
label: t("menubar.alignJustify"),
|
|
43718
|
-
icon:
|
|
44345
|
+
icon: import_lucide_react57.AlignJustify,
|
|
43719
44346
|
active: editor.isActive({ textAlign: "justify" }),
|
|
43720
44347
|
onClick: () => editor.chain().focus().setTextAlign("justify").run()
|
|
43721
44348
|
}
|
|
@@ -43734,7 +44361,7 @@ function buildToolsMenuItems(t, { onSourceCode, openSourceDialog }) {
|
|
|
43734
44361
|
{
|
|
43735
44362
|
type: "action",
|
|
43736
44363
|
label: t("menubar.sourceCode"),
|
|
43737
|
-
icon:
|
|
44364
|
+
icon: import_lucide_react57.FileCode,
|
|
43738
44365
|
onClick: () => onSourceCode ? onSourceCode() : openSourceDialog()
|
|
43739
44366
|
}
|
|
43740
44367
|
];
|
|
@@ -43745,7 +44372,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
43745
44372
|
{
|
|
43746
44373
|
type: "sub",
|
|
43747
44374
|
label: t("menubar.insertTable"),
|
|
43748
|
-
icon:
|
|
44375
|
+
icon: import_lucide_react57.Table,
|
|
43749
44376
|
items: [
|
|
43750
44377
|
{
|
|
43751
44378
|
type: "custom",
|
|
@@ -43771,7 +44398,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
43771
44398
|
{
|
|
43772
44399
|
type: "action",
|
|
43773
44400
|
label: t("menubar.deleteTable"),
|
|
43774
|
-
icon:
|
|
44401
|
+
icon: import_lucide_react57.Trash2,
|
|
43775
44402
|
destructive: true,
|
|
43776
44403
|
disabled: !inTable,
|
|
43777
44404
|
onClick: () => editor.chain().focus().deleteTable().run()
|
|
@@ -43824,7 +44451,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
43824
44451
|
}
|
|
43825
44452
|
];
|
|
43826
44453
|
}
|
|
43827
|
-
var MenuBarTrigger =
|
|
44454
|
+
var MenuBarTrigger = import_react79.default.forwardRef(
|
|
43828
44455
|
({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
43829
44456
|
"button",
|
|
43830
44457
|
{
|
|
@@ -43856,18 +44483,18 @@ var MenuBar = ({
|
|
|
43856
44483
|
onPreview
|
|
43857
44484
|
}) => {
|
|
43858
44485
|
const t = useSmartTranslations("UEditor");
|
|
43859
|
-
(0,
|
|
44486
|
+
(0, import_react80.useEditorState)({
|
|
43860
44487
|
editor,
|
|
43861
44488
|
selector: ({ transactionNumber }) => transactionNumber
|
|
43862
44489
|
});
|
|
43863
|
-
const fileInputRef = (0,
|
|
43864
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
43865
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
43866
|
-
const [isInsertMenuOpen, setIsInsertMenuOpen] = (0,
|
|
43867
|
-
const [showSourceDialog, setShowSourceDialog] = (0,
|
|
43868
|
-
const [sourceHtml, setSourceHtml] = (0,
|
|
43869
|
-
const [showPreviewDialog, setShowPreviewDialog] = (0,
|
|
43870
|
-
const previewHtml = (0,
|
|
44490
|
+
const fileInputRef = (0, import_react79.useRef)(null);
|
|
44491
|
+
const [showImageInput, setShowImageInput] = (0, import_react79.useState)(false);
|
|
44492
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react79.useState)(false);
|
|
44493
|
+
const [isInsertMenuOpen, setIsInsertMenuOpen] = (0, import_react79.useState)(false);
|
|
44494
|
+
const [showSourceDialog, setShowSourceDialog] = (0, import_react79.useState)(false);
|
|
44495
|
+
const [sourceHtml, setSourceHtml] = (0, import_react79.useState)("");
|
|
44496
|
+
const [showPreviewDialog, setShowPreviewDialog] = (0, import_react79.useState)(false);
|
|
44497
|
+
const previewHtml = (0, import_react79.useMemo)(
|
|
43871
44498
|
() => showPreviewDialog ? prepareUEditorPreviewHtml(editor.getHTML()) : "",
|
|
43872
44499
|
[editor, showPreviewDialog]
|
|
43873
44500
|
);
|
|
@@ -43929,12 +44556,12 @@ var MenuBar = ({
|
|
|
43929
44556
|
type: "custom",
|
|
43930
44557
|
key: "image",
|
|
43931
44558
|
render: () => showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
|
|
43932
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(DropdownMenuItem, { label: t("menubar.image"), icon:
|
|
44559
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(DropdownMenuItem, { label: t("menubar.image"), icon: import_lucide_react57.Image, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
43933
44560
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
43934
44561
|
DropdownMenuItem,
|
|
43935
44562
|
{
|
|
43936
44563
|
label: t("menubar.imageUpload"),
|
|
43937
|
-
icon:
|
|
44564
|
+
icon: import_lucide_react57.Upload,
|
|
43938
44565
|
onClick: () => fileInputRef.current?.click(),
|
|
43939
44566
|
closeOnSelect: false
|
|
43940
44567
|
}
|
|
@@ -43949,7 +44576,7 @@ var MenuBar = ({
|
|
|
43949
44576
|
DropdownMenuItem,
|
|
43950
44577
|
{
|
|
43951
44578
|
label: t("menubar.link"),
|
|
43952
|
-
icon:
|
|
44579
|
+
icon: import_lucide_react57.Link,
|
|
43953
44580
|
shortcut: t("menubar.linkShortcut"),
|
|
43954
44581
|
onClick: () => setShowLinkInput(true),
|
|
43955
44582
|
closeOnSelect: false
|
|
@@ -43960,7 +44587,7 @@ var MenuBar = ({
|
|
|
43960
44587
|
{
|
|
43961
44588
|
type: "sub",
|
|
43962
44589
|
label: t("menubar.insertTable"),
|
|
43963
|
-
icon:
|
|
44590
|
+
icon: import_lucide_react57.Table,
|
|
43964
44591
|
items: [
|
|
43965
44592
|
{
|
|
43966
44593
|
type: "custom",
|
|
@@ -43980,24 +44607,24 @@ var MenuBar = ({
|
|
|
43980
44607
|
{
|
|
43981
44608
|
type: "sub",
|
|
43982
44609
|
label: t("menubar.formFields") || "Form Fields",
|
|
43983
|
-
icon:
|
|
44610
|
+
icon: import_lucide_react57.ListTodo,
|
|
43984
44611
|
items: [
|
|
43985
44612
|
{
|
|
43986
44613
|
type: "action",
|
|
43987
44614
|
label: t("menubar.formCheckbox") || "Form Checkbox",
|
|
43988
|
-
icon:
|
|
44615
|
+
icon: import_lucide_react57.Square,
|
|
43989
44616
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
43990
44617
|
},
|
|
43991
44618
|
{
|
|
43992
44619
|
type: "action",
|
|
43993
44620
|
label: t("slashCommand.roundCheckbox") || "Round Checkbox",
|
|
43994
|
-
icon:
|
|
44621
|
+
icon: import_lucide_react57.CircleCheckBig,
|
|
43995
44622
|
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
43996
44623
|
},
|
|
43997
44624
|
{
|
|
43998
44625
|
type: "action",
|
|
43999
44626
|
label: t("menubar.formRadio") || "Form Radio Button",
|
|
44000
|
-
icon:
|
|
44627
|
+
icon: import_lucide_react57.CircleDot,
|
|
44001
44628
|
onClick: () => editor.chain().focus().setFormRadio().run()
|
|
44002
44629
|
}
|
|
44003
44630
|
]
|
|
@@ -44079,7 +44706,7 @@ var MenuBar = ({
|
|
|
44079
44706
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
44080
44707
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
44081
44708
|
),
|
|
44082
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
44709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react57.Eye, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
44083
44710
|
}
|
|
44084
44711
|
)
|
|
44085
44712
|
] }),
|
|
@@ -44156,20 +44783,20 @@ var MenuBar = ({
|
|
|
44156
44783
|
};
|
|
44157
44784
|
|
|
44158
44785
|
// src/components/UEditor/table-formula-bar.tsx
|
|
44159
|
-
var
|
|
44160
|
-
var
|
|
44161
|
-
var
|
|
44786
|
+
var import_react81 = require("react");
|
|
44787
|
+
var import_react82 = require("@tiptap/react");
|
|
44788
|
+
var import_lucide_react58 = require("lucide-react");
|
|
44162
44789
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
44163
44790
|
function TableFormulaBar({ editor }) {
|
|
44164
44791
|
const t = useSmartTranslations("UEditor");
|
|
44165
|
-
const inputRef = (0,
|
|
44166
|
-
const [draftState, setDraftState] = (0,
|
|
44167
|
-
(0,
|
|
44792
|
+
const inputRef = (0, import_react81.useRef)(null);
|
|
44793
|
+
const [draftState, setDraftState] = (0, import_react81.useState)(null);
|
|
44794
|
+
(0, import_react82.useEditorState)({
|
|
44168
44795
|
editor,
|
|
44169
44796
|
selector: ({ transactionNumber }) => transactionNumber
|
|
44170
44797
|
});
|
|
44171
44798
|
const selectedCell = getSelectedTableFormulaCell(editor);
|
|
44172
|
-
(0,
|
|
44799
|
+
(0, import_react81.useEffect)(() => {
|
|
44173
44800
|
const focusFormulaInput = () => {
|
|
44174
44801
|
inputRef.current?.focus();
|
|
44175
44802
|
};
|
|
@@ -44225,7 +44852,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44225
44852
|
children: selectedCell.label
|
|
44226
44853
|
}
|
|
44227
44854
|
),
|
|
44228
|
-
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44855
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react58.Sigma, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 text-primary" }),
|
|
44229
44856
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44230
44857
|
"input",
|
|
44231
44858
|
{
|
|
@@ -44253,7 +44880,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44253
44880
|
role: "status",
|
|
44254
44881
|
className: "hidden shrink-0 items-center gap-1 text-xs font-medium text-destructive sm:inline-flex",
|
|
44255
44882
|
children: [
|
|
44256
|
-
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44883
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react58.AlertCircle, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
44257
44884
|
t("tableMenu.formulaError")
|
|
44258
44885
|
]
|
|
44259
44886
|
}
|
|
@@ -44266,7 +44893,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44266
44893
|
"aria-label": t("tableMenu.apply"),
|
|
44267
44894
|
title: t("tableMenu.apply"),
|
|
44268
44895
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
|
|
44269
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react58.Check, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44270
44897
|
}
|
|
44271
44898
|
),
|
|
44272
44899
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
@@ -44280,7 +44907,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44280
44907
|
"aria-label": t("tableMenu.convertToValue"),
|
|
44281
44908
|
title: t("tableMenu.convertToValue"),
|
|
44282
44909
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border/60 bg-background text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
44283
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react58.Hash, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44284
44911
|
}
|
|
44285
44912
|
),
|
|
44286
44913
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
@@ -44294,7 +44921,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44294
44921
|
"aria-label": t("tableMenu.clearCell"),
|
|
44295
44922
|
title: t("tableMenu.clearCell"),
|
|
44296
44923
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-destructive/30 bg-background text-destructive transition-colors hover:bg-destructive/10",
|
|
44297
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react58.Trash2, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44298
44925
|
}
|
|
44299
44926
|
)
|
|
44300
44927
|
]
|
|
@@ -44304,7 +44931,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44304
44931
|
|
|
44305
44932
|
// src/components/UEditor/UEditor.tsx
|
|
44306
44933
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
44307
|
-
var UEditor =
|
|
44934
|
+
var UEditor = import_react83.default.forwardRef(({
|
|
44308
44935
|
content = "",
|
|
44309
44936
|
onChange,
|
|
44310
44937
|
onHtmlChange,
|
|
@@ -44346,14 +44973,14 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44346
44973
|
}, ref) => {
|
|
44347
44974
|
const t = useSmartTranslations("UEditor");
|
|
44348
44975
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
44349
|
-
const inFlightPrepareRef = (0,
|
|
44350
|
-
const lastAppliedContentRef = (0,
|
|
44351
|
-
const scheduledFormulaRecalculateRef = (0,
|
|
44352
|
-
const editorInstanceRef = (0,
|
|
44353
|
-
const formulaRangePickRef = (0,
|
|
44354
|
-
const formulaRangeSurfaceRef = (0,
|
|
44355
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
44356
|
-
const scheduleFormulaRecalculate =
|
|
44976
|
+
const inFlightPrepareRef = (0, import_react83.useRef)(null);
|
|
44977
|
+
const lastAppliedContentRef = (0, import_react83.useRef)(content ?? "");
|
|
44978
|
+
const scheduledFormulaRecalculateRef = (0, import_react83.useRef)(false);
|
|
44979
|
+
const editorInstanceRef = (0, import_react83.useRef)(null);
|
|
44980
|
+
const formulaRangePickRef = (0, import_react83.useRef)(null);
|
|
44981
|
+
const formulaRangeSurfaceRef = (0, import_react83.useRef)(null);
|
|
44982
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react83.default.useState(null);
|
|
44983
|
+
const scheduleFormulaRecalculate = import_react83.default.useCallback((editor2, options) => {
|
|
44357
44984
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
44358
44985
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
44359
44986
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -44364,7 +44991,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44364
44991
|
}
|
|
44365
44992
|
});
|
|
44366
44993
|
}, []);
|
|
44367
|
-
const resolvedUploadFile = (0,
|
|
44994
|
+
const resolvedUploadFile = (0, import_react83.useMemo)(() => {
|
|
44368
44995
|
if (uploadFile) return uploadFile;
|
|
44369
44996
|
if (uploadFileForSave) {
|
|
44370
44997
|
return async (file) => {
|
|
@@ -44374,7 +45001,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44374
45001
|
}
|
|
44375
45002
|
return uploadImage;
|
|
44376
45003
|
}, [uploadFile, uploadFileForSave, uploadImage]);
|
|
44377
|
-
const extensions = (0,
|
|
45004
|
+
const extensions = (0, import_react83.useMemo)(
|
|
44378
45005
|
() => [
|
|
44379
45006
|
...buildUEditorExtensions({
|
|
44380
45007
|
placeholder: effectivePlaceholder,
|
|
@@ -44393,11 +45020,11 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44393
45020
|
],
|
|
44394
45021
|
[effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable, fetchMetadata, extraExtensions]
|
|
44395
45022
|
);
|
|
44396
|
-
const syncFormulaRangeHighlight =
|
|
45023
|
+
const syncFormulaRangeHighlight = import_react83.default.useCallback((pickState) => {
|
|
44397
45024
|
const container = formulaRangeSurfaceRef.current;
|
|
44398
45025
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
44399
45026
|
}, []);
|
|
44400
|
-
const editor = (0,
|
|
45027
|
+
const editor = (0, import_react84.useEditor)({
|
|
44401
45028
|
immediatelyRender: false,
|
|
44402
45029
|
extensions,
|
|
44403
45030
|
content,
|
|
@@ -44503,7 +45130,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44503
45130
|
scheduleFormulaRecalculate(editor2, { force: true });
|
|
44504
45131
|
}
|
|
44505
45132
|
});
|
|
44506
|
-
(0,
|
|
45133
|
+
(0, import_react83.useEffect)(() => {
|
|
44507
45134
|
editorInstanceRef.current = editor;
|
|
44508
45135
|
return () => {
|
|
44509
45136
|
if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
|
|
@@ -44519,7 +45146,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44519
45146
|
apply: t("tableMenu.apply"),
|
|
44520
45147
|
cancel: t("imageInput.cancelBtn")
|
|
44521
45148
|
});
|
|
44522
|
-
(0,
|
|
45149
|
+
(0, import_react83.useImperativeHandle)(
|
|
44523
45150
|
ref,
|
|
44524
45151
|
() => ({
|
|
44525
45152
|
editor,
|
|
@@ -44544,7 +45171,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44544
45171
|
}),
|
|
44545
45172
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
44546
45173
|
);
|
|
44547
|
-
(0,
|
|
45174
|
+
(0, import_react83.useEffect)(() => {
|
|
44548
45175
|
if (!editor) return;
|
|
44549
45176
|
queueMicrotask(() => {
|
|
44550
45177
|
if (!editor.isDestroyed) {
|
|
@@ -44552,7 +45179,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44552
45179
|
}
|
|
44553
45180
|
});
|
|
44554
45181
|
}, [editor]);
|
|
44555
|
-
(0,
|
|
45182
|
+
(0, import_react83.useEffect)(() => {
|
|
44556
45183
|
if (!editor) return;
|
|
44557
45184
|
const nextContent = content ?? "";
|
|
44558
45185
|
if (lastAppliedContentRef.current === nextContent) return;
|
|
@@ -44702,7 +45329,7 @@ var UEditor = import_react82.default.forwardRef(({
|
|
|
44702
45329
|
),
|
|
44703
45330
|
editable && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(TableControls, { editor, containerRef: editorContentRef }),
|
|
44704
45331
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44705
|
-
|
|
45332
|
+
import_react84.EditorContent,
|
|
44706
45333
|
{
|
|
44707
45334
|
editor,
|
|
44708
45335
|
className: "min-h-full"
|