@underverse-ui/underverse 1.0.193 → 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 +830 -564
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +498 -232
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14302,7 +14302,7 @@ function Calendar4({
|
|
|
14302
14302
|
xl: { cell: dense ? "min-h-48" : "min-h-52", day: "text-xl" }
|
|
14303
14303
|
};
|
|
14304
14304
|
const cellSz = CELL_EVENT_STYLES[size];
|
|
14305
|
-
const
|
|
14305
|
+
const VARIANT_STYLES = {
|
|
14306
14306
|
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",
|
|
14307
14307
|
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",
|
|
14308
14308
|
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",
|
|
@@ -27266,17 +27266,35 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
27266
27266
|
var NotificationModal_default = NotificationModal;
|
|
27267
27267
|
|
|
27268
27268
|
// src/components/AccessDenied.tsx
|
|
27269
|
-
import {
|
|
27269
|
+
import { useState as useState42, useEffect as useEffect32, useId as useId15, useRef as useRef26 } from "react";
|
|
27270
27270
|
import { jsx as jsx75, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
27271
|
-
var
|
|
27272
|
-
destructive:
|
|
27273
|
-
warning:
|
|
27274
|
-
info:
|
|
27271
|
+
var VARIANT_COLOR_VARS = {
|
|
27272
|
+
destructive: "var(--destructive)",
|
|
27273
|
+
warning: "var(--warning)",
|
|
27274
|
+
info: "var(--info)"
|
|
27275
27275
|
};
|
|
27276
|
-
var
|
|
27277
|
-
destructive:
|
|
27278
|
-
|
|
27279
|
-
|
|
27276
|
+
var VARIANT_DESIGNS = {
|
|
27277
|
+
destructive: {
|
|
27278
|
+
borderColor: "border-destructive/20 hover:border-destructive/40 focus-within:border-destructive/30",
|
|
27279
|
+
iconBg: "from-destructive/15 to-destructive/5 dark:from-destructive/25 dark:to-destructive/10",
|
|
27280
|
+
iconBorder: "border-destructive/20 group-hover:border-destructive/50",
|
|
27281
|
+
pulseRing: "bg-destructive/10 ring-destructive/5 dark:bg-destructive/20 dark:ring-destructive/10",
|
|
27282
|
+
textColor: "text-destructive"
|
|
27283
|
+
},
|
|
27284
|
+
warning: {
|
|
27285
|
+
borderColor: "border-warning/20 hover:border-warning/40 focus-within:border-warning/30",
|
|
27286
|
+
iconBg: "from-warning/15 to-warning/5 dark:from-warning/25 dark:to-warning/10",
|
|
27287
|
+
iconBorder: "border-warning/20 group-hover:border-warning/50",
|
|
27288
|
+
pulseRing: "bg-warning/10 ring-warning/5 dark:bg-warning/20 dark:ring-warning/10",
|
|
27289
|
+
textColor: "text-warning"
|
|
27290
|
+
},
|
|
27291
|
+
info: {
|
|
27292
|
+
borderColor: "border-info/20 hover:border-info/40 focus-within:border-info/30",
|
|
27293
|
+
iconBg: "from-info/15 to-info/5 dark:from-info/25 dark:to-info/10",
|
|
27294
|
+
iconBorder: "border-info/20 group-hover:border-info/50",
|
|
27295
|
+
pulseRing: "bg-info/10 ring-info/5 dark:bg-info/20 dark:ring-info/10",
|
|
27296
|
+
textColor: "text-info"
|
|
27297
|
+
}
|
|
27280
27298
|
};
|
|
27281
27299
|
function AccessDenied({
|
|
27282
27300
|
title = "Access Restricted",
|
|
@@ -27285,30 +27303,278 @@ function AccessDenied({
|
|
|
27285
27303
|
icon: Icon,
|
|
27286
27304
|
className,
|
|
27287
27305
|
children,
|
|
27288
|
-
overflowHidden = true
|
|
27306
|
+
overflowHidden = true,
|
|
27307
|
+
code = "403"
|
|
27289
27308
|
}) {
|
|
27290
|
-
const
|
|
27291
|
-
const
|
|
27292
|
-
|
|
27309
|
+
const design = VARIANT_DESIGNS[variant];
|
|
27310
|
+
const colorVar = VARIANT_COLOR_VARS[variant];
|
|
27311
|
+
const reactId = useId15();
|
|
27312
|
+
const cleanId = reactId.replace(/:/g, "");
|
|
27313
|
+
const clipId = `white-clip-${cleanId}`;
|
|
27314
|
+
const textId = `text-s-${cleanId}`;
|
|
27315
|
+
const eyeId = `white-eye-${cleanId}`;
|
|
27316
|
+
const tornilloId = `tornillo-${cleanId}`;
|
|
27317
|
+
const svgRef = useRef26(null);
|
|
27318
|
+
const [mousePos, setMousePos] = useState42({ x: 0, y: 0 });
|
|
27319
|
+
const [eyeCoords, setEyeCoords] = useState42({ cx: 130, cy: 65 });
|
|
27320
|
+
const [isHovered, setIsHovered] = useState42(false);
|
|
27321
|
+
const handleMouseMove2 = (e) => {
|
|
27322
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
27323
|
+
setMousePos({
|
|
27324
|
+
x: e.clientX - rect.left,
|
|
27325
|
+
y: e.clientY - rect.top
|
|
27326
|
+
});
|
|
27327
|
+
};
|
|
27328
|
+
useEffect32(() => {
|
|
27329
|
+
const handleGlobalMouseMove = (e) => {
|
|
27330
|
+
if (!svgRef.current) return;
|
|
27331
|
+
const rect = svgRef.current.getBoundingClientRect();
|
|
27332
|
+
const eyeCenterX = rect.left + rect.width * (130 / 260);
|
|
27333
|
+
const eyeCenterY = rect.top + rect.height * (65 / 118.9);
|
|
27334
|
+
const dx = e.clientX - eyeCenterX;
|
|
27335
|
+
const dy = e.clientY - eyeCenterY;
|
|
27336
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
27337
|
+
const maxShift = 11;
|
|
27338
|
+
let shiftX = 0;
|
|
27339
|
+
let shiftY = 0;
|
|
27340
|
+
if (distance > 0) {
|
|
27341
|
+
const currentShift = Math.min(maxShift, distance / 12);
|
|
27342
|
+
shiftX = dx / distance * currentShift;
|
|
27343
|
+
shiftY = dy / distance * currentShift;
|
|
27344
|
+
}
|
|
27345
|
+
setEyeCoords({
|
|
27346
|
+
cx: 130 + shiftX,
|
|
27347
|
+
cy: 65 + shiftY
|
|
27348
|
+
});
|
|
27349
|
+
};
|
|
27350
|
+
const handleGlobalTouchMove = (e) => {
|
|
27351
|
+
if (e.touches.length > 0 && svgRef.current) {
|
|
27352
|
+
const rect = svgRef.current.getBoundingClientRect();
|
|
27353
|
+
const eyeCenterX = rect.left + rect.width * (130 / 260);
|
|
27354
|
+
const eyeCenterY = rect.top + rect.height * (65 / 118.9);
|
|
27355
|
+
const dx = e.touches[0].clientX - eyeCenterX;
|
|
27356
|
+
const dy = e.touches[0].clientY - eyeCenterY;
|
|
27357
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
27358
|
+
const maxShift = 11;
|
|
27359
|
+
let shiftX = 0;
|
|
27360
|
+
let shiftY = 0;
|
|
27361
|
+
if (distance > 0) {
|
|
27362
|
+
const currentShift = Math.min(maxShift, distance / 12);
|
|
27363
|
+
shiftX = dx / distance * currentShift;
|
|
27364
|
+
shiftY = dy / distance * currentShift;
|
|
27365
|
+
}
|
|
27366
|
+
setEyeCoords({
|
|
27367
|
+
cx: 130 + shiftX,
|
|
27368
|
+
cy: 65 + shiftY
|
|
27369
|
+
});
|
|
27370
|
+
}
|
|
27371
|
+
};
|
|
27372
|
+
window.addEventListener("mousemove", handleGlobalMouseMove);
|
|
27373
|
+
window.addEventListener("touchmove", handleGlobalTouchMove);
|
|
27374
|
+
return () => {
|
|
27375
|
+
window.removeEventListener("mousemove", handleGlobalMouseMove);
|
|
27376
|
+
window.removeEventListener("touchmove", handleGlobalTouchMove);
|
|
27377
|
+
};
|
|
27378
|
+
}, []);
|
|
27379
|
+
return /* @__PURE__ */ jsxs61(
|
|
27293
27380
|
Card_default,
|
|
27294
27381
|
{
|
|
27295
|
-
className: cn(
|
|
27296
|
-
|
|
27297
|
-
|
|
27298
|
-
|
|
27299
|
-
|
|
27300
|
-
|
|
27301
|
-
|
|
27382
|
+
className: cn(
|
|
27383
|
+
"relative p-8 md:p-12 text-center shadow-lg transition-all duration-500 ease-out",
|
|
27384
|
+
"bg-linear-to-br from-card/95 via-card/90 to-card/85",
|
|
27385
|
+
"border backdrop-blur-md group/ad",
|
|
27386
|
+
design.borderColor,
|
|
27387
|
+
className
|
|
27388
|
+
),
|
|
27389
|
+
innerClassName: cn(
|
|
27390
|
+
"relative overflow-hidden",
|
|
27391
|
+
!overflowHidden ? "overflow-visible" : void 0
|
|
27392
|
+
),
|
|
27393
|
+
onMouseEnter: () => setIsHovered(true),
|
|
27394
|
+
onMouseLeave: () => setIsHovered(false),
|
|
27395
|
+
onMouseMove: handleMouseMove2,
|
|
27396
|
+
children: [
|
|
27397
|
+
/* @__PURE__ */ jsx75("style", { dangerouslySetInnerHTML: { __html: `
|
|
27398
|
+
@keyframes ad-float {
|
|
27399
|
+
0%, 100% { transform: translateY(0); }
|
|
27400
|
+
50% { transform: translateY(-6px); }
|
|
27401
|
+
}
|
|
27402
|
+
@keyframes ad-drift {
|
|
27403
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
27404
|
+
50% { transform: translate(12%, -8%) scale(1.08); }
|
|
27405
|
+
}
|
|
27406
|
+
@keyframes ad-drift-rev {
|
|
27407
|
+
0%, 100% { transform: translate(0, 0) scale(1); }
|
|
27408
|
+
50% { transform: translate(-10%, 12%) scale(0.92); }
|
|
27409
|
+
}
|
|
27410
|
+
@keyframes ad-alarm {
|
|
27411
|
+
0%, 100% { opacity: 1; }
|
|
27412
|
+
50% { opacity: 0.35; }
|
|
27413
|
+
}
|
|
27414
|
+
.animate-ad-float {
|
|
27415
|
+
animation: ad-float 5s ease-in-out infinite;
|
|
27416
|
+
}
|
|
27417
|
+
.animate-ad-drift-1 {
|
|
27418
|
+
animation: ad-drift 10s ease-in-out infinite;
|
|
27419
|
+
}
|
|
27420
|
+
.animate-ad-drift-2 {
|
|
27421
|
+
animation: ad-drift-rev 12s ease-in-out infinite;
|
|
27422
|
+
}
|
|
27423
|
+
.animate-ad-alarm {
|
|
27424
|
+
animation: ad-alarm 0.5s ease-in-out infinite;
|
|
27425
|
+
}
|
|
27426
|
+
` } }),
|
|
27427
|
+
/* @__PURE__ */ jsxs61("div", { className: "absolute inset-0 pointer-events-none overflow-hidden rounded-2xl md:rounded-3xl", children: [
|
|
27428
|
+
/* @__PURE__ */ jsx75(
|
|
27429
|
+
"div",
|
|
27430
|
+
{
|
|
27431
|
+
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",
|
|
27432
|
+
style: {
|
|
27433
|
+
backgroundImage: `radial-gradient(circle at center, color-mix(in oklch, ${colorVar} 25%, transparent) 0%, transparent 70%)`
|
|
27434
|
+
}
|
|
27435
|
+
}
|
|
27436
|
+
),
|
|
27437
|
+
/* @__PURE__ */ jsx75(
|
|
27438
|
+
"div",
|
|
27439
|
+
{
|
|
27440
|
+
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",
|
|
27441
|
+
style: {
|
|
27442
|
+
backgroundImage: `radial-gradient(circle at center, color-mix(in oklch, ${colorVar} 15%, transparent) 0%, transparent 70%)`
|
|
27443
|
+
}
|
|
27444
|
+
}
|
|
27445
|
+
)
|
|
27302
27446
|
] }),
|
|
27303
|
-
|
|
27304
|
-
|
|
27447
|
+
isHovered && /* @__PURE__ */ jsx75(
|
|
27448
|
+
"div",
|
|
27449
|
+
{
|
|
27450
|
+
className: "absolute inset-0 pointer-events-none transition-opacity duration-500 opacity-100 rounded-2xl md:rounded-3xl",
|
|
27451
|
+
style: {
|
|
27452
|
+
background: `radial-gradient(350px circle at ${mousePos.x}px ${mousePos.y}px, color-mix(in oklch, ${colorVar} 14%, transparent) 0%, transparent 80%)`
|
|
27453
|
+
}
|
|
27454
|
+
}
|
|
27455
|
+
),
|
|
27456
|
+
/* @__PURE__ */ jsx75(
|
|
27457
|
+
"div",
|
|
27458
|
+
{
|
|
27459
|
+
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]",
|
|
27460
|
+
style: {
|
|
27461
|
+
backgroundImage: `radial-gradient(currentColor 1.2px, transparent 1.2px)`,
|
|
27462
|
+
backgroundSize: "20px 20px"
|
|
27463
|
+
}
|
|
27464
|
+
}
|
|
27465
|
+
),
|
|
27466
|
+
/* @__PURE__ */ jsxs61("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: [
|
|
27467
|
+
/* @__PURE__ */ jsx75("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 }),
|
|
27468
|
+
/* @__PURE__ */ jsx75(
|
|
27469
|
+
"div",
|
|
27470
|
+
{
|
|
27471
|
+
className: "absolute text-[120px] md:text-[180px] font-black tracking-tighter select-none font-sans",
|
|
27472
|
+
style: {
|
|
27473
|
+
color: colorVar,
|
|
27474
|
+
opacity: isHovered ? 0.75 : 0,
|
|
27475
|
+
transition: "opacity 300ms ease",
|
|
27476
|
+
maskImage: `radial-gradient(120px circle at ${mousePos.x}px ${mousePos.y}px, black, transparent 120px)`,
|
|
27477
|
+
WebkitMaskImage: `radial-gradient(120px circle at ${mousePos.x}px ${mousePos.y}px, black, transparent 120px)`,
|
|
27478
|
+
filter: `drop-shadow(0 0 25px color-mix(in oklch, ${colorVar} 50%, transparent))`
|
|
27479
|
+
},
|
|
27480
|
+
children: code
|
|
27481
|
+
}
|
|
27482
|
+
)
|
|
27483
|
+
] }),
|
|
27484
|
+
/* @__PURE__ */ jsxs61("div", { className: "relative z-10 flex flex-col items-center gap-6", children: [
|
|
27485
|
+
Icon ? /* @__PURE__ */ jsxs61("div", { className: "relative flex items-center justify-center animate-ad-float", children: [
|
|
27486
|
+
/* @__PURE__ */ jsx75(
|
|
27487
|
+
"div",
|
|
27488
|
+
{
|
|
27489
|
+
className: cn(
|
|
27490
|
+
"absolute w-20 h-20 rounded-full opacity-60 animate-pulse duration-2000 ring-8",
|
|
27491
|
+
design.pulseRing
|
|
27492
|
+
)
|
|
27493
|
+
}
|
|
27494
|
+
),
|
|
27495
|
+
/* @__PURE__ */ jsx75(
|
|
27496
|
+
"div",
|
|
27497
|
+
{
|
|
27498
|
+
className: cn(
|
|
27499
|
+
"relative flex items-center justify-center p-4 rounded-2xl",
|
|
27500
|
+
"bg-linear-to-b border shadow-md transition-all duration-500 ease-out",
|
|
27501
|
+
"group-hover/ad:rotate-6 group-hover/ad:scale-105 group-hover/ad:shadow-lg",
|
|
27502
|
+
design.iconBg,
|
|
27503
|
+
design.iconBorder
|
|
27504
|
+
),
|
|
27505
|
+
children: /* @__PURE__ */ jsx75(Icon, { className: cn("w-10 h-10 transition-transform duration-500 group-hover/ad:scale-110", design.textColor) })
|
|
27506
|
+
}
|
|
27507
|
+
)
|
|
27508
|
+
] }) : (
|
|
27509
|
+
/* Interactive Robot Face Illustration */
|
|
27510
|
+
/* @__PURE__ */ jsx75("div", { className: "relative w-full max-w-65 h-30 select-none animate-ad-float", children: /* @__PURE__ */ jsxs61(
|
|
27511
|
+
"svg",
|
|
27512
|
+
{
|
|
27513
|
+
ref: svgRef,
|
|
27514
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27515
|
+
id: "robot-error",
|
|
27516
|
+
viewBox: "0 0 260 118.9",
|
|
27517
|
+
role: "img",
|
|
27518
|
+
className: "w-full h-full",
|
|
27519
|
+
children: [
|
|
27520
|
+
/* @__PURE__ */ jsx75("title", { children: "403 Error" }),
|
|
27521
|
+
/* @__PURE__ */ jsxs61("defs", { children: [
|
|
27522
|
+
/* @__PURE__ */ jsx75("clipPath", { id: clipId, children: /* @__PURE__ */ jsx75("circle", { id: eyeId, cx: "130", cy: "65", r: "20" }) }),
|
|
27523
|
+
/* @__PURE__ */ jsx75("text", { id: textId, className: "font-sans font-black tracking-tighter", y: "106", style: { fontSize: code.length > 3 ? "80px" : "120px" }, children: code })
|
|
27524
|
+
] }),
|
|
27525
|
+
/* @__PURE__ */ jsx75(
|
|
27526
|
+
"path",
|
|
27527
|
+
{
|
|
27528
|
+
className: "animate-ad-alarm",
|
|
27529
|
+
fill: variant === "destructive" ? "#e62326" : variant === "warning" ? "var(--warning)" : "var(--info)",
|
|
27530
|
+
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"
|
|
27531
|
+
}
|
|
27532
|
+
),
|
|
27533
|
+
/* @__PURE__ */ jsx75("use", { href: `#${textId}`, x: "-0.5px", y: "-1px", fill: "currentColor", className: "opacity-15 dark:opacity-10 text-muted-foreground" }),
|
|
27534
|
+
/* @__PURE__ */ jsx75("use", { href: `#${textId}`, fill: "currentColor", className: "opacity-10 dark:opacity-5 text-muted-foreground" }),
|
|
27535
|
+
/* @__PURE__ */ jsxs61("g", { id: "robot", children: [
|
|
27536
|
+
/* @__PURE__ */ jsxs61("g", { id: "eye-wrap", children: [
|
|
27537
|
+
/* @__PURE__ */ jsx75("use", { href: `#${eyeId}`, fill: "currentColor", className: "opacity-20 dark:opacity-15 text-muted-foreground" }),
|
|
27538
|
+
/* @__PURE__ */ jsx75(
|
|
27539
|
+
"circle",
|
|
27540
|
+
{
|
|
27541
|
+
id: "eyef",
|
|
27542
|
+
clipPath: `url(#${clipId})`,
|
|
27543
|
+
fill: "currentColor",
|
|
27544
|
+
className: "text-foreground",
|
|
27545
|
+
stroke: variant === "destructive" ? "#e62326" : variant === "warning" ? "var(--warning)" : "var(--info)",
|
|
27546
|
+
strokeWidth: "2.5",
|
|
27547
|
+
strokeMiterlimit: "10",
|
|
27548
|
+
cx: eyeCoords.cx,
|
|
27549
|
+
cy: eyeCoords.cy,
|
|
27550
|
+
r: "11"
|
|
27551
|
+
}
|
|
27552
|
+
),
|
|
27553
|
+
/* @__PURE__ */ jsx75("ellipse", { fill: "currentColor", className: "opacity-30 dark:opacity-20 text-muted-foreground", cx: "130", cy: "40", rx: "18", ry: "12" })
|
|
27554
|
+
] }),
|
|
27555
|
+
/* @__PURE__ */ jsx75("circle", { className: "opacity-40 dark:opacity-30 text-muted-foreground", fill: "currentColor", cx: "105", cy: "32", r: "2.5", id: tornilloId }),
|
|
27556
|
+
/* @__PURE__ */ jsx75("use", { href: `#${tornilloId}`, x: "50" }),
|
|
27557
|
+
/* @__PURE__ */ jsx75("use", { href: `#${tornilloId}`, x: "50", y: "60" }),
|
|
27558
|
+
/* @__PURE__ */ jsx75("use", { href: `#${tornilloId}`, y: "60" })
|
|
27559
|
+
] })
|
|
27560
|
+
]
|
|
27561
|
+
}
|
|
27562
|
+
) })
|
|
27563
|
+
),
|
|
27564
|
+
/* @__PURE__ */ jsxs61("div", { className: "space-y-2.5 max-w-sm mx-auto", children: [
|
|
27565
|
+
/* @__PURE__ */ jsx75("h3", { className: "text-xl md:text-2xl font-bold tracking-tight text-foreground transition-colors duration-300", children: title }),
|
|
27566
|
+
/* @__PURE__ */ jsx75("p", { className: "text-sm md:text-base text-muted-foreground/80 leading-relaxed font-normal", children: description })
|
|
27567
|
+
] }),
|
|
27568
|
+
children && /* @__PURE__ */ jsx75("div", { className: "mt-2 flex flex-wrap gap-3 justify-center items-center relative z-20", children })
|
|
27569
|
+
] })
|
|
27570
|
+
]
|
|
27305
27571
|
}
|
|
27306
27572
|
);
|
|
27307
27573
|
}
|
|
27308
27574
|
|
|
27309
27575
|
// src/components/ThemeToggleHeadless.tsx
|
|
27310
27576
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
27311
|
-
import { useRef as
|
|
27577
|
+
import { useRef as useRef27, useState as useState43 } from "react";
|
|
27312
27578
|
import { createPortal as createPortal6 } from "react-dom";
|
|
27313
27579
|
import { Fragment as Fragment27, jsx as jsx76, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
27314
27580
|
function ThemeToggleHeadless({
|
|
@@ -27317,10 +27583,10 @@ function ThemeToggleHeadless({
|
|
|
27317
27583
|
labels,
|
|
27318
27584
|
className
|
|
27319
27585
|
}) {
|
|
27320
|
-
const [isOpen, setIsOpen] =
|
|
27586
|
+
const [isOpen, setIsOpen] = useState43(false);
|
|
27321
27587
|
const isHydrated = useHydrated();
|
|
27322
|
-
const triggerRef =
|
|
27323
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
27588
|
+
const triggerRef = useRef27(null);
|
|
27589
|
+
const [dropdownPosition, setDropdownPosition] = useState43(null);
|
|
27324
27590
|
const themes = [
|
|
27325
27591
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
27326
27592
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: Moon2 },
|
|
@@ -27409,7 +27675,7 @@ function ThemeToggleHeadless({
|
|
|
27409
27675
|
}
|
|
27410
27676
|
|
|
27411
27677
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
27412
|
-
import { useRef as
|
|
27678
|
+
import { useRef as useRef28, useState as useState44 } from "react";
|
|
27413
27679
|
import { createPortal as createPortal7 } from "react-dom";
|
|
27414
27680
|
import { Globe } from "lucide-react";
|
|
27415
27681
|
import { Fragment as Fragment28, jsx as jsx77, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
@@ -27420,9 +27686,9 @@ function LanguageSwitcherHeadless({
|
|
|
27420
27686
|
labels,
|
|
27421
27687
|
className
|
|
27422
27688
|
}) {
|
|
27423
|
-
const [isOpen, setIsOpen] =
|
|
27424
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
27425
|
-
const triggerButtonRef =
|
|
27689
|
+
const [isOpen, setIsOpen] = useState44(false);
|
|
27690
|
+
const [dropdownPosition, setDropdownPosition] = useState44(null);
|
|
27691
|
+
const triggerButtonRef = useRef28(null);
|
|
27426
27692
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
27427
27693
|
const calculatePosition = () => {
|
|
27428
27694
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -27508,7 +27774,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
27508
27774
|
};
|
|
27509
27775
|
|
|
27510
27776
|
// src/contexts/translation-adapter.tsx
|
|
27511
|
-
import * as
|
|
27777
|
+
import * as React73 from "react";
|
|
27512
27778
|
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
27513
27779
|
function isUnresolvedTranslation2(value, namespace, key) {
|
|
27514
27780
|
return value === key || value === `${namespace}.${key}`;
|
|
@@ -27533,7 +27799,7 @@ function useTranslations(namespace) {
|
|
|
27533
27799
|
const nextIntlBridge = useNextIntlBridge();
|
|
27534
27800
|
const internalLocale = useUnderverseLocale();
|
|
27535
27801
|
const internalT = useUnderverseTranslations(namespace);
|
|
27536
|
-
return
|
|
27802
|
+
return React73.useCallback((key, params) => {
|
|
27537
27803
|
if (nextIntlBridge) {
|
|
27538
27804
|
const nextIntlResult = nextIntlBridge.translate(namespace, key, params);
|
|
27539
27805
|
if (nextIntlResult.translated && !isUnresolvedTranslation2(nextIntlResult.translated, namespace, key)) {
|
|
@@ -27558,7 +27824,7 @@ function useLocale2() {
|
|
|
27558
27824
|
}
|
|
27559
27825
|
|
|
27560
27826
|
// src/components/UEditor/UEditor.tsx
|
|
27561
|
-
import
|
|
27827
|
+
import React90, { useEffect as useEffect42, useImperativeHandle as useImperativeHandle4, useMemo as useMemo27, useRef as useRef41 } from "react";
|
|
27562
27828
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
27563
27829
|
|
|
27564
27830
|
// src/components/UEditor/extensions.ts
|
|
@@ -27718,7 +27984,7 @@ import { Node as Node3, mergeAttributes as mergeAttributes2 } from "@tiptap/core
|
|
|
27718
27984
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
27719
27985
|
|
|
27720
27986
|
// src/components/UEditor/BookmarkView.tsx
|
|
27721
|
-
import
|
|
27987
|
+
import React74, { useEffect as useEffect33, useState as useState45 } from "react";
|
|
27722
27988
|
import { NodeViewWrapper as NodeViewWrapper2 } from "@tiptap/react";
|
|
27723
27989
|
import { AlertCircle as AlertCircle4, ExternalLink as ExternalLink2, Globe as Globe2, RefreshCw } from "lucide-react";
|
|
27724
27990
|
|
|
@@ -27799,17 +28065,17 @@ import { jsx as jsx81, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
|
27799
28065
|
var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
27800
28066
|
const t = useSmartTranslations("UEditor");
|
|
27801
28067
|
const { url, title, description, image, publisher } = node.attrs;
|
|
27802
|
-
const [loading2, setLoading] =
|
|
27803
|
-
const [error, setError] =
|
|
27804
|
-
const [retryToken, setRetryToken] =
|
|
27805
|
-
const lastFetchKeyRef =
|
|
27806
|
-
const fetchRequestIdRef =
|
|
28068
|
+
const [loading2, setLoading] = useState45(false);
|
|
28069
|
+
const [error, setError] = useState45(false);
|
|
28070
|
+
const [retryToken, setRetryToken] = useState45(0);
|
|
28071
|
+
const lastFetchKeyRef = React74.useRef("");
|
|
28072
|
+
const fetchRequestIdRef = React74.useRef(0);
|
|
27807
28073
|
const safeUrl = sanitizeUEditorUrl(String(url ?? ""), "link");
|
|
27808
28074
|
const safeImage = sanitizeUEditorUrl(String(image ?? ""), "image");
|
|
27809
28075
|
const clickToOpenNewTabMessage = t("bookmark.clickToOpenNewTab");
|
|
27810
28076
|
const clickToOpenLinkMessage = t("bookmark.clickToOpenLink");
|
|
27811
28077
|
const noDescriptionMessage = t("bookmark.noDescription");
|
|
27812
|
-
|
|
28078
|
+
useEffect33(() => {
|
|
27813
28079
|
if (title && retryToken === 0) return;
|
|
27814
28080
|
if (!safeUrl) return;
|
|
27815
28081
|
const fetchKey = `${safeUrl}\0${retryToken}`;
|
|
@@ -28099,7 +28365,7 @@ import { Node as Node4, mergeAttributes as mergeAttributes3 } from "@tiptap/core
|
|
|
28099
28365
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer3 } from "@tiptap/react";
|
|
28100
28366
|
|
|
28101
28367
|
// src/components/UEditor/FileCardView.tsx
|
|
28102
|
-
import { useEffect as
|
|
28368
|
+
import { useEffect as useEffect34, useState as useState46, useRef as useRef29 } from "react";
|
|
28103
28369
|
import { NodeViewWrapper as NodeViewWrapper3 } from "@tiptap/react";
|
|
28104
28370
|
import { Download as Download2, File as LucideFile, FileText as FileText2, Image as Image3, Music, RefreshCw as RefreshCw2, Video } from "lucide-react";
|
|
28105
28371
|
import { jsx as jsx82, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
@@ -28149,15 +28415,15 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
28149
28415
|
const t = useSmartTranslations("UEditor");
|
|
28150
28416
|
const { src, fileName, fileSize, fileType } = node.attrs;
|
|
28151
28417
|
const FileIcon = getFileIcon2(fileType);
|
|
28152
|
-
const [uploadError, setUploadError] =
|
|
28153
|
-
const [retryToken, setRetryToken] =
|
|
28154
|
-
const uploadAttemptedRef =
|
|
28155
|
-
const lastUploadSrcRef =
|
|
28156
|
-
const uploadRequestIdRef =
|
|
28418
|
+
const [uploadError, setUploadError] = useState46(null);
|
|
28419
|
+
const [retryToken, setRetryToken] = useState46(0);
|
|
28420
|
+
const uploadAttemptedRef = useRef29(false);
|
|
28421
|
+
const lastUploadSrcRef = useRef29("");
|
|
28422
|
+
const uploadRequestIdRef = useRef29(0);
|
|
28157
28423
|
const safeSrc = sanitizeUEditorUrl(String(src ?? ""), "file");
|
|
28158
28424
|
const extension = editor?.extensionManager?.extensions?.find((item) => item.name === "fileCard");
|
|
28159
28425
|
const uploadFn = extension?.options?.upload;
|
|
28160
|
-
|
|
28426
|
+
useEffect34(() => {
|
|
28161
28427
|
if (lastUploadSrcRef.current !== safeSrc) {
|
|
28162
28428
|
lastUploadSrcRef.current = safeSrc;
|
|
28163
28429
|
uploadAttemptedRef.current = false;
|
|
@@ -28748,7 +29014,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
28748
29014
|
import { Extension } from "@tiptap/core";
|
|
28749
29015
|
import Suggestion from "@tiptap/suggestion";
|
|
28750
29016
|
import { ReactRenderer } from "@tiptap/react";
|
|
28751
|
-
import
|
|
29017
|
+
import React76, { forwardRef as forwardRef14, useEffect as useEffect35, useImperativeHandle, useRef as useRef30 } from "react";
|
|
28752
29018
|
import {
|
|
28753
29019
|
FileCode as FileCode2,
|
|
28754
29020
|
Heading1,
|
|
@@ -28833,9 +29099,9 @@ var DEFAULT_MESSAGES = {
|
|
|
28833
29099
|
formRadioDesc: "Insert an interactive radio button field"
|
|
28834
29100
|
};
|
|
28835
29101
|
function useResettingIndex2(resetToken) {
|
|
28836
|
-
const [state, setState] =
|
|
29102
|
+
const [state, setState] = React76.useState({ resetToken, index: 0 });
|
|
28837
29103
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
28838
|
-
const setSelectedIndex =
|
|
29104
|
+
const setSelectedIndex = React76.useCallback((nextIndex) => {
|
|
28839
29105
|
setState((prev) => {
|
|
28840
29106
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
28841
29107
|
return {
|
|
@@ -29062,8 +29328,8 @@ function buildSlashCommandItems({
|
|
|
29062
29328
|
}
|
|
29063
29329
|
var SlashCommandList = forwardRef14((props, ref) => {
|
|
29064
29330
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
29065
|
-
const listRef =
|
|
29066
|
-
|
|
29331
|
+
const listRef = useRef30(null);
|
|
29332
|
+
useEffect35(() => {
|
|
29067
29333
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
29068
29334
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
29069
29335
|
}, [selectedIndex, props.items]);
|
|
@@ -30033,13 +30299,13 @@ import { Extension as Extension3 } from "@tiptap/core";
|
|
|
30033
30299
|
import Suggestion2 from "@tiptap/suggestion";
|
|
30034
30300
|
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
30035
30301
|
import { PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
30036
|
-
import
|
|
30302
|
+
import React77, { forwardRef as forwardRef15, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
30037
30303
|
import { Smile as Smile2 } from "lucide-react";
|
|
30038
30304
|
import { jsx as jsx86, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
30039
30305
|
function useResettingIndex3(resetToken) {
|
|
30040
|
-
const [state, setState] =
|
|
30306
|
+
const [state, setState] = React77.useState({ resetToken, index: 0 });
|
|
30041
30307
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
30042
|
-
const setSelectedIndex =
|
|
30308
|
+
const setSelectedIndex = React77.useCallback((nextIndex) => {
|
|
30043
30309
|
setState((prev) => {
|
|
30044
30310
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
30045
30311
|
return {
|
|
@@ -30186,7 +30452,7 @@ import { Extension as Extension4 } from "@tiptap/core";
|
|
|
30186
30452
|
import Suggestion3 from "@tiptap/suggestion";
|
|
30187
30453
|
import { ReactRenderer as ReactRenderer3 } from "@tiptap/react";
|
|
30188
30454
|
import { PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
30189
|
-
import
|
|
30455
|
+
import React78, { forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
30190
30456
|
import { Sigma } from "lucide-react";
|
|
30191
30457
|
import { jsx as jsx87, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
30192
30458
|
var FORMULA_FUNCTIONS = [
|
|
@@ -30241,8 +30507,8 @@ function isFormulaFunctionSuggestionQuery(query) {
|
|
|
30241
30507
|
}
|
|
30242
30508
|
var FormulaSuggestionList = forwardRef16((props, ref) => {
|
|
30243
30509
|
const t = useSmartTranslations("UEditor");
|
|
30244
|
-
const [selectedIndex, setSelectedIndex] =
|
|
30245
|
-
|
|
30510
|
+
const [selectedIndex, setSelectedIndex] = React78.useState(0);
|
|
30511
|
+
React78.useEffect(() => {
|
|
30246
30512
|
setSelectedIndex(0);
|
|
30247
30513
|
}, [props.items]);
|
|
30248
30514
|
useImperativeHandle3(ref, () => ({
|
|
@@ -30441,7 +30707,7 @@ var UEditorPlaceholder = Extension5.create({
|
|
|
30441
30707
|
});
|
|
30442
30708
|
|
|
30443
30709
|
// src/components/UEditor/resizable-image.tsx
|
|
30444
|
-
import { useEffect as
|
|
30710
|
+
import { useEffect as useEffect36, useRef as useRef31, useState as useState47 } from "react";
|
|
30445
30711
|
import Image4 from "@tiptap/extension-image";
|
|
30446
30712
|
import { mergeAttributes as mergeAttributes6 } from "@tiptap/core";
|
|
30447
30713
|
import { NodeViewWrapper as NodeViewWrapper6, ReactNodeViewRenderer as ReactNodeViewRenderer6 } from "@tiptap/react";
|
|
@@ -30630,16 +30896,16 @@ function sizeFromHeight(height, aspect, maxWidth) {
|
|
|
30630
30896
|
}
|
|
30631
30897
|
function ResizableImageNodeView(props) {
|
|
30632
30898
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
30633
|
-
const wrapperRef =
|
|
30634
|
-
const imgRef =
|
|
30635
|
-
const resizePreviewRef =
|
|
30636
|
-
const [isHovered, setIsHovered] =
|
|
30637
|
-
const [isResizing, setIsResizing] =
|
|
30899
|
+
const wrapperRef = useRef31(null);
|
|
30900
|
+
const imgRef = useRef31(null);
|
|
30901
|
+
const resizePreviewRef = useRef31(null);
|
|
30902
|
+
const [isHovered, setIsHovered] = useState47(false);
|
|
30903
|
+
const [isResizing, setIsResizing] = useState47(false);
|
|
30638
30904
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
30639
30905
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
30640
30906
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
30641
30907
|
const imageLayout = parseImageLayout(node.attrs["imageLayout"]);
|
|
30642
|
-
const dragStateRef =
|
|
30908
|
+
const dragStateRef = useRef31(null);
|
|
30643
30909
|
const dispatchTableLayoutChange2 = () => {
|
|
30644
30910
|
editor.view.dom.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, { bubbles: true }));
|
|
30645
30911
|
};
|
|
@@ -30676,7 +30942,7 @@ function ResizableImageNodeView(props) {
|
|
|
30676
30942
|
if (!drag || drag.frameId !== null) return;
|
|
30677
30943
|
drag.frameId = window.requestAnimationFrame(applyPendingResizeFrame);
|
|
30678
30944
|
};
|
|
30679
|
-
|
|
30945
|
+
useEffect36(() => {
|
|
30680
30946
|
return () => {
|
|
30681
30947
|
const drag = dragStateRef.current;
|
|
30682
30948
|
if (drag && drag.frameId !== null) {
|
|
@@ -30686,7 +30952,7 @@ function ResizableImageNodeView(props) {
|
|
|
30686
30952
|
document.body.style.cursor = "";
|
|
30687
30953
|
};
|
|
30688
30954
|
}, []);
|
|
30689
|
-
|
|
30955
|
+
useEffect36(() => {
|
|
30690
30956
|
const img = imgRef.current;
|
|
30691
30957
|
if (!img) return;
|
|
30692
30958
|
const displayStyle = getImageDisplayStyle(widthAttr, heightAttr);
|
|
@@ -31645,7 +31911,7 @@ var UEditorTable = Table3.extend({
|
|
|
31645
31911
|
var table_align_default = UEditorTable;
|
|
31646
31912
|
|
|
31647
31913
|
// src/components/UEditor/CodeBlockView.tsx
|
|
31648
|
-
import
|
|
31914
|
+
import React80, { useState as useState48 } from "react";
|
|
31649
31915
|
import { NodeViewWrapper as NodeViewWrapper7, NodeViewContent as NodeViewContent2 } from "@tiptap/react";
|
|
31650
31916
|
import { Check as Check11, Copy as Copy2, ChevronDown as ChevronDown7 } from "lucide-react";
|
|
31651
31917
|
import { Fragment as Fragment29, jsx as jsx89, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
@@ -31670,12 +31936,12 @@ var CodeBlockView = ({
|
|
|
31670
31936
|
updateAttributes,
|
|
31671
31937
|
extension
|
|
31672
31938
|
}) => {
|
|
31673
|
-
const [copied, setCopied] =
|
|
31674
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
31675
|
-
const timeoutRef =
|
|
31939
|
+
const [copied, setCopied] = useState48(false);
|
|
31940
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState48(false);
|
|
31941
|
+
const timeoutRef = React80.useRef(null);
|
|
31676
31942
|
const currentLangValue = node.attrs.language || "text";
|
|
31677
31943
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
31678
|
-
|
|
31944
|
+
React80.useEffect(() => {
|
|
31679
31945
|
return () => {
|
|
31680
31946
|
if (timeoutRef.current) {
|
|
31681
31947
|
clearTimeout(timeoutRef.current);
|
|
@@ -32193,7 +32459,7 @@ function buildUEditorExtensions({
|
|
|
32193
32459
|
}
|
|
32194
32460
|
|
|
32195
32461
|
// src/components/UEditor/toolbar.tsx
|
|
32196
|
-
import
|
|
32462
|
+
import React83, { useRef as useRef34, useState as useState50 } from "react";
|
|
32197
32463
|
import { useEditorState } from "@tiptap/react";
|
|
32198
32464
|
import {
|
|
32199
32465
|
AlignCenter,
|
|
@@ -32241,7 +32507,7 @@ import {
|
|
|
32241
32507
|
import { setCellAttr } from "@tiptap/pm/tables";
|
|
32242
32508
|
|
|
32243
32509
|
// src/components/UEditor/colors.tsx
|
|
32244
|
-
import { useMemo as useMemo24, useRef as
|
|
32510
|
+
import { useMemo as useMemo24, useRef as useRef32 } from "react";
|
|
32245
32511
|
import { Check as Check12, Highlighter, Palette as Palette2, Paintbrush, Grid as Grid2 } from "lucide-react";
|
|
32246
32512
|
import { jsx as jsx90, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
32247
32513
|
var TextColorIcon = ({ color }) => {
|
|
@@ -32414,7 +32680,7 @@ var EditorColorPalette = ({
|
|
|
32414
32680
|
label
|
|
32415
32681
|
}) => {
|
|
32416
32682
|
const t = useSmartTranslations("UEditor");
|
|
32417
|
-
const colorInputRef =
|
|
32683
|
+
const colorInputRef = useRef32(null);
|
|
32418
32684
|
const automaticColor = colors[0]?.color ?? "";
|
|
32419
32685
|
const paletteColors = colors.slice(1);
|
|
32420
32686
|
return /* @__PURE__ */ jsxs73("div", { className: "w-56 p-2", children: [
|
|
@@ -32616,7 +32882,7 @@ function deleteSelectedImage(editor) {
|
|
|
32616
32882
|
}
|
|
32617
32883
|
|
|
32618
32884
|
// src/components/UEditor/inputs.tsx
|
|
32619
|
-
import { useEffect as
|
|
32885
|
+
import { useEffect as useEffect37, useId as useId16, useRef as useRef33, useState as useState49 } from "react";
|
|
32620
32886
|
import { Check as Check13, X as X19 } from "lucide-react";
|
|
32621
32887
|
import { jsx as jsx91, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
32622
32888
|
function normalizeUrl(raw) {
|
|
@@ -32628,11 +32894,11 @@ var LinkInput = ({
|
|
|
32628
32894
|
initialUrl = ""
|
|
32629
32895
|
}) => {
|
|
32630
32896
|
const t = useSmartTranslations("UEditor");
|
|
32631
|
-
const [url, setUrl] =
|
|
32632
|
-
const [error, setError] =
|
|
32633
|
-
const inputRef =
|
|
32634
|
-
const errorId =
|
|
32635
|
-
|
|
32897
|
+
const [url, setUrl] = useState49(initialUrl);
|
|
32898
|
+
const [error, setError] = useState49("");
|
|
32899
|
+
const inputRef = useRef33(null);
|
|
32900
|
+
const errorId = useId16();
|
|
32901
|
+
useEffect37(() => {
|
|
32636
32902
|
inputRef.current?.focus();
|
|
32637
32903
|
inputRef.current?.select();
|
|
32638
32904
|
}, []);
|
|
@@ -32672,10 +32938,10 @@ var LinkInput = ({
|
|
|
32672
32938
|
};
|
|
32673
32939
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
32674
32940
|
const t = useSmartTranslations("UEditor");
|
|
32675
|
-
const [url, setUrl] =
|
|
32676
|
-
const [alt, setAlt] =
|
|
32677
|
-
const inputRef =
|
|
32678
|
-
|
|
32941
|
+
const [url, setUrl] = useState49("");
|
|
32942
|
+
const [alt, setAlt] = useState49("");
|
|
32943
|
+
const inputRef = useRef33(null);
|
|
32944
|
+
useEffect37(() => {
|
|
32679
32945
|
inputRef.current?.focus();
|
|
32680
32946
|
}, []);
|
|
32681
32947
|
const handleSubmit = (e) => {
|
|
@@ -33141,7 +33407,7 @@ function fileToDataUrl2(file) {
|
|
|
33141
33407
|
function formatTableInsertLabel(template, rows, cols) {
|
|
33142
33408
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
33143
33409
|
}
|
|
33144
|
-
var ToolbarButton =
|
|
33410
|
+
var ToolbarButton = React83.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
33145
33411
|
const button = /* @__PURE__ */ jsx92(
|
|
33146
33412
|
"button",
|
|
33147
33413
|
{
|
|
@@ -33178,7 +33444,7 @@ var TableInsertGrid = ({
|
|
|
33178
33444
|
previewTemplate,
|
|
33179
33445
|
onInsert
|
|
33180
33446
|
}) => {
|
|
33181
|
-
const [selection, setSelection] =
|
|
33447
|
+
const [selection, setSelection] = React83.useState({ rows: 3, cols: 3 });
|
|
33182
33448
|
const maxRows = 8;
|
|
33183
33449
|
const maxCols = 8;
|
|
33184
33450
|
return /* @__PURE__ */ jsxs75("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
@@ -33236,13 +33502,13 @@ var EditorToolbar = ({
|
|
|
33236
33502
|
selector: ({ transactionNumber }) => transactionNumber
|
|
33237
33503
|
});
|
|
33238
33504
|
const { textColors, highlightColors } = useEditorColors();
|
|
33239
|
-
const [showImageInput, setShowImageInput] =
|
|
33240
|
-
const [showLinkInput, setShowLinkInput] =
|
|
33241
|
-
const [isTableMenuOpen, setIsTableMenuOpen] =
|
|
33242
|
-
const [preservedTableAnchorPos, setPreservedTableAnchorPos] =
|
|
33243
|
-
const fileInputRef =
|
|
33244
|
-
const [isUploadingImage, setIsUploadingImage] =
|
|
33245
|
-
const [imageUploadError, setImageUploadError] =
|
|
33505
|
+
const [showImageInput, setShowImageInput] = useState50(false);
|
|
33506
|
+
const [showLinkInput, setShowLinkInput] = useState50(false);
|
|
33507
|
+
const [isTableMenuOpen, setIsTableMenuOpen] = useState50(false);
|
|
33508
|
+
const [preservedTableAnchorPos, setPreservedTableAnchorPos] = useState50(null);
|
|
33509
|
+
const fileInputRef = useRef34(null);
|
|
33510
|
+
const [isUploadingImage, setIsUploadingImage] = useState50(false);
|
|
33511
|
+
const [imageUploadError, setImageUploadError] = useState50(null);
|
|
33246
33512
|
const isImageSelected = editor.isActive("image");
|
|
33247
33513
|
const imageAttrs = editor.getAttributes("image");
|
|
33248
33514
|
const tableAnchorPos = getTableAnchorPos(editor);
|
|
@@ -33265,10 +33531,10 @@ var EditorToolbar = ({
|
|
|
33265
33531
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
33266
33532
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
33267
33533
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
33268
|
-
const availableFontFamilies =
|
|
33269
|
-
const availableFontSizes =
|
|
33270
|
-
const availableLineHeights =
|
|
33271
|
-
const availableLetterSpacings =
|
|
33534
|
+
const availableFontFamilies = React83.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
33535
|
+
const availableFontSizes = React83.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
33536
|
+
const availableLineHeights = React83.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
33537
|
+
const availableLetterSpacings = React83.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
33272
33538
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
33273
33539
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
33274
33540
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
|
|
@@ -34243,7 +34509,7 @@ var EditorToolbar = ({
|
|
|
34243
34509
|
};
|
|
34244
34510
|
|
|
34245
34511
|
// src/components/UEditor/menus.tsx
|
|
34246
|
-
import { useCallback as useCallback23, useEffect as
|
|
34512
|
+
import { useCallback as useCallback23, useEffect as useEffect38, useMemo as useMemo25, useRef as useRef35, useState as useState51 } from "react";
|
|
34247
34513
|
import { useEditorState as useEditorState2 } from "@tiptap/react";
|
|
34248
34514
|
import { isInTable as isSelectionInTable, setCellAttr as setCellAttr3 } from "@tiptap/pm/tables";
|
|
34249
34515
|
import { createPortal as createPortal8 } from "react-dom";
|
|
@@ -35352,8 +35618,8 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35352
35618
|
const t = useSmartTranslations("UEditor");
|
|
35353
35619
|
const messages = useMemo25(() => buildSlashCommandMessages(t), [t]);
|
|
35354
35620
|
const items = useMemo25(() => buildSlashCommandItems({ query: "", messages }), [messages]);
|
|
35355
|
-
const listRef =
|
|
35356
|
-
|
|
35621
|
+
const listRef = useRef35(null);
|
|
35622
|
+
useEffect38(() => {
|
|
35357
35623
|
const handleKeyDown2 = (event) => {
|
|
35358
35624
|
if (event.key === "Escape") {
|
|
35359
35625
|
event.preventDefault();
|
|
@@ -35383,7 +35649,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35383
35649
|
};
|
|
35384
35650
|
var FloatingMenuContent = ({ editor }) => {
|
|
35385
35651
|
const t = useSmartTranslations("UEditor");
|
|
35386
|
-
const [showCommands, setShowCommands] =
|
|
35652
|
+
const [showCommands, setShowCommands] = useState51(false);
|
|
35387
35653
|
if (showCommands) {
|
|
35388
35654
|
return /* @__PURE__ */ jsx93(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
35389
35655
|
}
|
|
@@ -35482,21 +35748,21 @@ var BubbleMenuContent = ({
|
|
|
35482
35748
|
selector: ({ transactionNumber }) => transactionNumber
|
|
35483
35749
|
});
|
|
35484
35750
|
const { textColors, highlightColors } = useEditorColors();
|
|
35485
|
-
const [showLinkInput, setShowLinkInput] =
|
|
35486
|
-
const [activeColorPalette, setActiveColorPalette] =
|
|
35487
|
-
|
|
35751
|
+
const [showLinkInput, setShowLinkInput] = useState51(initialShowLinkInput);
|
|
35752
|
+
const [activeColorPalette, setActiveColorPalette] = useState51(null);
|
|
35753
|
+
useEffect38(() => {
|
|
35488
35754
|
setShowLinkInput(initialShowLinkInput);
|
|
35489
35755
|
}, [initialShowLinkInput]);
|
|
35490
|
-
|
|
35756
|
+
useEffect38(() => {
|
|
35491
35757
|
if (!cellBorderOpenRequest) return;
|
|
35492
35758
|
setActiveColorPalette("cell-border");
|
|
35493
35759
|
onKeepOpenChange?.(true);
|
|
35494
35760
|
}, [cellBorderOpenRequest, onKeepOpenChange]);
|
|
35495
|
-
const [showTypographyPanel, setShowTypographyPanel] =
|
|
35496
|
-
const [showFormulaPanel, setShowFormulaPanel] =
|
|
35497
|
-
const [formulaDraft, setFormulaDraft] =
|
|
35498
|
-
const [showFontSizeOptions, setShowFontSizeOptions] =
|
|
35499
|
-
const [fontSizeDraft, setFontSizeDraft] =
|
|
35761
|
+
const [showTypographyPanel, setShowTypographyPanel] = useState51(false);
|
|
35762
|
+
const [showFormulaPanel, setShowFormulaPanel] = useState51(false);
|
|
35763
|
+
const [formulaDraft, setFormulaDraft] = useState51("");
|
|
35764
|
+
const [showFontSizeOptions, setShowFontSizeOptions] = useState51(false);
|
|
35765
|
+
const [fontSizeDraft, setFontSizeDraft] = useState51("");
|
|
35500
35766
|
const isImageSelected = editor.isActive("image");
|
|
35501
35767
|
const imageAttrs = editor.getAttributes("image");
|
|
35502
35768
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
@@ -35510,13 +35776,13 @@ var BubbleMenuContent = ({
|
|
|
35510
35776
|
const currentCellBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
35511
35777
|
const currentCellBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
35512
35778
|
const currentCellBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "#000000";
|
|
35513
|
-
const [borderStyleDraft, setBorderStyleDraft] =
|
|
35779
|
+
const [borderStyleDraft, setBorderStyleDraft] = useState51(
|
|
35514
35780
|
["solid", "dashed", "dotted", "double"].includes(currentCellBorderStyle) ? currentCellBorderStyle : "solid"
|
|
35515
35781
|
);
|
|
35516
|
-
const [borderWidthDraft, setBorderWidthDraft] =
|
|
35517
|
-
const [borderColorDraft, setBorderColorDraft] =
|
|
35518
|
-
const [borderEditMode, setBorderEditMode] =
|
|
35519
|
-
const [activeBorderPosition, setActiveBorderPosition] =
|
|
35782
|
+
const [borderWidthDraft, setBorderWidthDraft] = useState51(currentCellBorderWidth);
|
|
35783
|
+
const [borderColorDraft, setBorderColorDraft] = useState51(currentCellBorderColor);
|
|
35784
|
+
const [borderEditMode, setBorderEditMode] = useState51("draw");
|
|
35785
|
+
const [activeBorderPosition, setActiveBorderPosition] = useState51("all");
|
|
35520
35786
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
35521
35787
|
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
35522
35788
|
const isInTable2 = isSelectionInTable(editor.state);
|
|
@@ -35541,10 +35807,10 @@ var BubbleMenuContent = ({
|
|
|
35541
35807
|
],
|
|
35542
35808
|
[highlightColors, t]
|
|
35543
35809
|
);
|
|
35544
|
-
|
|
35810
|
+
useEffect38(() => {
|
|
35545
35811
|
setFontSizeDraft(currentFontSize.replace(/px$/i, ""));
|
|
35546
35812
|
}, [currentFontSize]);
|
|
35547
|
-
|
|
35813
|
+
useEffect38(() => {
|
|
35548
35814
|
setFormulaDraft(currentCellFormula);
|
|
35549
35815
|
}, [currentCellFormula]);
|
|
35550
35816
|
const applyFontSizeDraft = () => {
|
|
@@ -35559,11 +35825,11 @@ var BubbleMenuContent = ({
|
|
|
35559
35825
|
editor.chain().focus().setFontSize(`${clamped}px`).run();
|
|
35560
35826
|
setFontSizeDraft(String(clamped));
|
|
35561
35827
|
};
|
|
35562
|
-
|
|
35828
|
+
useEffect38(() => {
|
|
35563
35829
|
onKeepOpenChange?.(showLinkInput);
|
|
35564
35830
|
onLinkInputOpenChange?.(showLinkInput);
|
|
35565
35831
|
}, [onKeepOpenChange, onLinkInputOpenChange, showLinkInput]);
|
|
35566
|
-
|
|
35832
|
+
useEffect38(() => {
|
|
35567
35833
|
onKeepOpenChange?.(Boolean(activeColorPalette));
|
|
35568
35834
|
}, [activeColorPalette, onKeepOpenChange]);
|
|
35569
35835
|
const closeTransientPanels = useCallback23(() => {
|
|
@@ -35649,7 +35915,7 @@ var BubbleMenuContent = ({
|
|
|
35649
35915
|
}
|
|
35650
35916
|
closeColorPalette();
|
|
35651
35917
|
}, [activeColorPalette, closeColorPalette, editor]);
|
|
35652
|
-
|
|
35918
|
+
useEffect38(() => {
|
|
35653
35919
|
if (!showLinkInput) return;
|
|
35654
35920
|
const close2 = () => setShowLinkInput(false);
|
|
35655
35921
|
editor.on("selectionUpdate", close2);
|
|
@@ -36348,19 +36614,19 @@ var CustomBubbleMenu = ({
|
|
|
36348
36614
|
const SHOW_DELAY_MS = 180;
|
|
36349
36615
|
const BUBBLE_MENU_OFFSET = 16;
|
|
36350
36616
|
const BUBBLE_MENU_ESTIMATED_HEIGHT = 44;
|
|
36351
|
-
const [isVisible, setIsVisible] =
|
|
36352
|
-
const [linkInputOpen, setLinkInputOpen] =
|
|
36353
|
-
const [cellBorderOpenRequest, setCellBorderOpenRequest] =
|
|
36354
|
-
const [position, setPosition2] =
|
|
36617
|
+
const [isVisible, setIsVisible] = useState51(false);
|
|
36618
|
+
const [linkInputOpen, setLinkInputOpen] = useState51(false);
|
|
36619
|
+
const [cellBorderOpenRequest, setCellBorderOpenRequest] = useState51(0);
|
|
36620
|
+
const [position, setPosition2] = useState51({
|
|
36355
36621
|
top: 0,
|
|
36356
36622
|
left: 0,
|
|
36357
36623
|
placement: "top"
|
|
36358
36624
|
});
|
|
36359
|
-
const menuRef =
|
|
36360
|
-
const keepOpenRef =
|
|
36361
|
-
const [keepOpen, setKeepOpenState] =
|
|
36362
|
-
const showTimeoutRef =
|
|
36363
|
-
const suppressShowUntilRef =
|
|
36625
|
+
const menuRef = useRef35(null);
|
|
36626
|
+
const keepOpenRef = useRef35(false);
|
|
36627
|
+
const [keepOpen, setKeepOpenState] = useState51(false);
|
|
36628
|
+
const showTimeoutRef = useRef35(null);
|
|
36629
|
+
const suppressShowUntilRef = useRef35(0);
|
|
36364
36630
|
const setKeepOpen = useCallback23((next) => {
|
|
36365
36631
|
keepOpenRef.current = next;
|
|
36366
36632
|
setKeepOpenState(next);
|
|
@@ -36378,7 +36644,7 @@ var CustomBubbleMenu = ({
|
|
|
36378
36644
|
showTimeoutRef.current = null;
|
|
36379
36645
|
}
|
|
36380
36646
|
}, []);
|
|
36381
|
-
|
|
36647
|
+
useEffect38(() => {
|
|
36382
36648
|
const clearShowTimeout = () => {
|
|
36383
36649
|
if (showTimeoutRef.current) {
|
|
36384
36650
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -36460,7 +36726,7 @@ var CustomBubbleMenu = ({
|
|
|
36460
36726
|
editor.off("update", updatePosition);
|
|
36461
36727
|
};
|
|
36462
36728
|
}, [editor]);
|
|
36463
|
-
|
|
36729
|
+
useEffect38(() => {
|
|
36464
36730
|
if (!isVisible) return;
|
|
36465
36731
|
const handlePointerDown = (event) => {
|
|
36466
36732
|
const target = event.target;
|
|
@@ -36479,7 +36745,7 @@ var CustomBubbleMenu = ({
|
|
|
36479
36745
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
36480
36746
|
};
|
|
36481
36747
|
}, [closeBubbleMenu, editor, isVisible]);
|
|
36482
|
-
|
|
36748
|
+
useEffect38(() => {
|
|
36483
36749
|
const handleTableDoubleClick = (event) => {
|
|
36484
36750
|
const target = event.target;
|
|
36485
36751
|
const cell = target?.closest("td,th");
|
|
@@ -36546,9 +36812,9 @@ var CustomBubbleMenu = ({
|
|
|
36546
36812
|
};
|
|
36547
36813
|
var CustomFloatingMenu = ({ editor }) => {
|
|
36548
36814
|
const FLOATING_MENU_OFFSET = 16;
|
|
36549
|
-
const [isVisible, setIsVisible] =
|
|
36550
|
-
const [position, setPosition2] =
|
|
36551
|
-
|
|
36815
|
+
const [isVisible, setIsVisible] = useState51(false);
|
|
36816
|
+
const [position, setPosition2] = useState51({ top: 0, left: 0 });
|
|
36817
|
+
useEffect38(() => {
|
|
36552
36818
|
const updatePosition = () => {
|
|
36553
36819
|
const { state, view } = editor;
|
|
36554
36820
|
const { $from, empty } = state.selection;
|
|
@@ -37033,7 +37299,7 @@ async function prepareUEditorContentForSave({
|
|
|
37033
37299
|
}
|
|
37034
37300
|
|
|
37035
37301
|
// src/components/UEditor/table-controls.tsx
|
|
37036
|
-
import
|
|
37302
|
+
import React85 from "react";
|
|
37037
37303
|
|
|
37038
37304
|
// node_modules/prosemirror-model/dist/index.js
|
|
37039
37305
|
function findDiffStart(a, b, pos) {
|
|
@@ -41952,17 +42218,17 @@ function getSelectedCell(editor) {
|
|
|
41952
42218
|
}
|
|
41953
42219
|
function TableControls({ editor, containerRef }) {
|
|
41954
42220
|
const t = useSmartTranslations("UEditor");
|
|
41955
|
-
const [layout, setLayout] =
|
|
41956
|
-
const [dragPreview, setDragPreview] =
|
|
41957
|
-
const [hoverState, setHoverState] =
|
|
41958
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
41959
|
-
const layoutRef =
|
|
41960
|
-
const dragStateRef =
|
|
41961
|
-
const syncFrameRef =
|
|
41962
|
-
|
|
42221
|
+
const [layout, setLayout] = React85.useState(null);
|
|
42222
|
+
const [dragPreview, setDragPreview] = React85.useState(null);
|
|
42223
|
+
const [hoverState, setHoverState] = React85.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
42224
|
+
const [openMenuKey, setOpenMenuKey] = React85.useState(null);
|
|
42225
|
+
const layoutRef = React85.useRef(null);
|
|
42226
|
+
const dragStateRef = React85.useRef(null);
|
|
42227
|
+
const syncFrameRef = React85.useRef(null);
|
|
42228
|
+
React85.useEffect(() => {
|
|
41963
42229
|
layoutRef.current = layout;
|
|
41964
42230
|
}, [layout]);
|
|
41965
|
-
const syncFromCell =
|
|
42231
|
+
const syncFromCell = React85.useCallback((cell) => {
|
|
41966
42232
|
const surface = containerRef.current;
|
|
41967
42233
|
if (!surface || !cell) {
|
|
41968
42234
|
setLayout(null);
|
|
@@ -41970,23 +42236,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
41970
42236
|
}
|
|
41971
42237
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
41972
42238
|
}, [containerRef, editor]);
|
|
41973
|
-
const syncFromSelection =
|
|
42239
|
+
const syncFromSelection = React85.useCallback(() => {
|
|
41974
42240
|
syncFromCell(getSelectedCell(editor));
|
|
41975
42241
|
}, [editor, syncFromCell]);
|
|
41976
|
-
const scheduleSyncFromSelection =
|
|
42242
|
+
const scheduleSyncFromSelection = React85.useCallback(() => {
|
|
41977
42243
|
if (syncFrameRef.current !== null) return;
|
|
41978
42244
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
41979
42245
|
syncFrameRef.current = null;
|
|
41980
42246
|
syncFromSelection();
|
|
41981
42247
|
});
|
|
41982
42248
|
}, [syncFromSelection]);
|
|
41983
|
-
|
|
42249
|
+
React85.useEffect(() => () => {
|
|
41984
42250
|
if (syncFrameRef.current !== null) {
|
|
41985
42251
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
41986
42252
|
syncFrameRef.current = null;
|
|
41987
42253
|
}
|
|
41988
42254
|
}, []);
|
|
41989
|
-
const refreshCurrentLayout =
|
|
42255
|
+
const refreshCurrentLayout = React85.useCallback(() => {
|
|
41990
42256
|
setLayout((prev) => {
|
|
41991
42257
|
if (!prev) return prev;
|
|
41992
42258
|
const surface = containerRef.current;
|
|
@@ -41996,12 +42262,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
41996
42262
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
41997
42263
|
});
|
|
41998
42264
|
}, [containerRef, editor]);
|
|
41999
|
-
const clearDrag =
|
|
42265
|
+
const clearDrag = React85.useCallback(() => {
|
|
42000
42266
|
dragStateRef.current = null;
|
|
42001
42267
|
setDragPreview(null);
|
|
42002
42268
|
document.body.style.cursor = "";
|
|
42003
42269
|
}, []);
|
|
42004
|
-
const updateHoverState =
|
|
42270
|
+
const updateHoverState = React85.useCallback((event) => {
|
|
42005
42271
|
const activeLayout = layoutRef.current;
|
|
42006
42272
|
const surface = containerRef.current;
|
|
42007
42273
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -42017,7 +42283,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42017
42283
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
42018
42284
|
});
|
|
42019
42285
|
}, [containerRef]);
|
|
42020
|
-
|
|
42286
|
+
React85.useEffect(() => {
|
|
42021
42287
|
const proseMirror = editor.view.dom;
|
|
42022
42288
|
const surface = containerRef.current;
|
|
42023
42289
|
if (!surface) return void 0;
|
|
@@ -42068,37 +42334,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
42068
42334
|
editor.off("update", refreshCurrentLayout);
|
|
42069
42335
|
};
|
|
42070
42336
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
42071
|
-
const runAtCellPos =
|
|
42337
|
+
const runAtCellPos = React85.useCallback((cellPos, command, options) => {
|
|
42072
42338
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
42073
42339
|
if (options?.sync !== false) {
|
|
42074
42340
|
scheduleSyncFromSelection();
|
|
42075
42341
|
}
|
|
42076
42342
|
return result;
|
|
42077
42343
|
}, [editor, scheduleSyncFromSelection]);
|
|
42078
|
-
const runAtActiveCell =
|
|
42344
|
+
const runAtActiveCell = React85.useCallback((command, options) => {
|
|
42079
42345
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
42080
42346
|
}, [runAtCellPos]);
|
|
42081
|
-
const duplicateRowAt =
|
|
42347
|
+
const duplicateRowAt = React85.useCallback((rowIndex, cellPos) => {
|
|
42082
42348
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
42083
42349
|
scheduleSyncFromSelection();
|
|
42084
42350
|
return result;
|
|
42085
42351
|
}, [editor, scheduleSyncFromSelection]);
|
|
42086
|
-
const clearRowAt =
|
|
42352
|
+
const clearRowAt = React85.useCallback((rowIndex, cellPos) => {
|
|
42087
42353
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
42088
42354
|
scheduleSyncFromSelection();
|
|
42089
42355
|
return result;
|
|
42090
42356
|
}, [editor, scheduleSyncFromSelection]);
|
|
42091
|
-
const duplicateColumnAt =
|
|
42357
|
+
const duplicateColumnAt = React85.useCallback((columnIndex, cellPos) => {
|
|
42092
42358
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
42093
42359
|
scheduleSyncFromSelection();
|
|
42094
42360
|
return result;
|
|
42095
42361
|
}, [editor, scheduleSyncFromSelection]);
|
|
42096
|
-
const clearColumnAt =
|
|
42362
|
+
const clearColumnAt = React85.useCallback((columnIndex, cellPos) => {
|
|
42097
42363
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
42098
42364
|
scheduleSyncFromSelection();
|
|
42099
42365
|
return result;
|
|
42100
42366
|
}, [editor, scheduleSyncFromSelection]);
|
|
42101
|
-
const expandTableBy =
|
|
42367
|
+
const expandTableBy = React85.useCallback((rows, cols) => {
|
|
42102
42368
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
42103
42369
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
42104
42370
|
scheduleSyncFromSelection();
|
|
@@ -42107,19 +42373,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
42107
42373
|
const canExpandTable = Boolean(layout);
|
|
42108
42374
|
const controlsVisible = dragPreview !== null;
|
|
42109
42375
|
const tableMenuOpen = openMenuKey === "table";
|
|
42110
|
-
const startAddColumnDrag =
|
|
42376
|
+
const startAddColumnDrag = React85.useCallback(() => {
|
|
42111
42377
|
setOpenMenuKey(null);
|
|
42112
42378
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
42113
42379
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
42114
42380
|
document.body.style.cursor = "ew-resize";
|
|
42115
42381
|
}, []);
|
|
42116
|
-
const startAddRowDrag =
|
|
42382
|
+
const startAddRowDrag = React85.useCallback(() => {
|
|
42117
42383
|
setOpenMenuKey(null);
|
|
42118
42384
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
42119
42385
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
42120
42386
|
document.body.style.cursor = "ns-resize";
|
|
42121
42387
|
}, []);
|
|
42122
|
-
const startRowDrag =
|
|
42388
|
+
const startRowDrag = React85.useCallback((rowHandle) => {
|
|
42123
42389
|
setOpenMenuKey(null);
|
|
42124
42390
|
dragStateRef.current = {
|
|
42125
42391
|
kind: "row",
|
|
@@ -42136,7 +42402,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42136
42402
|
});
|
|
42137
42403
|
document.body.style.cursor = "grabbing";
|
|
42138
42404
|
}, []);
|
|
42139
|
-
const startColumnDrag =
|
|
42405
|
+
const startColumnDrag = React85.useCallback((columnHandle) => {
|
|
42140
42406
|
setOpenMenuKey(null);
|
|
42141
42407
|
dragStateRef.current = {
|
|
42142
42408
|
kind: "column",
|
|
@@ -42153,7 +42419,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42153
42419
|
});
|
|
42154
42420
|
document.body.style.cursor = "grabbing";
|
|
42155
42421
|
}, []);
|
|
42156
|
-
|
|
42422
|
+
React85.useEffect(() => {
|
|
42157
42423
|
const handleMouseMove2 = (event) => {
|
|
42158
42424
|
const dragState = dragStateRef.current;
|
|
42159
42425
|
const activeLayout = layoutRef.current;
|
|
@@ -42242,7 +42508,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42242
42508
|
window.removeEventListener("blur", clearDrag);
|
|
42243
42509
|
};
|
|
42244
42510
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
42245
|
-
const menuItems =
|
|
42511
|
+
const menuItems = React85.useMemo(() => {
|
|
42246
42512
|
if (!layout) return [];
|
|
42247
42513
|
return [
|
|
42248
42514
|
{
|
|
@@ -42310,7 +42576,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42310
42576
|
}
|
|
42311
42577
|
];
|
|
42312
42578
|
}, [editor, layout, runAtActiveCell, t]);
|
|
42313
|
-
const getRowHandleMenuItems =
|
|
42579
|
+
const getRowHandleMenuItems = React85.useCallback((rowHandle) => [
|
|
42314
42580
|
{
|
|
42315
42581
|
label: t("tableMenu.addRowBefore"),
|
|
42316
42582
|
icon: ArrowUp2,
|
|
@@ -42338,7 +42604,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42338
42604
|
destructive: true
|
|
42339
42605
|
}
|
|
42340
42606
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
42341
|
-
const getColumnHandleMenuItems =
|
|
42607
|
+
const getColumnHandleMenuItems = React85.useCallback((columnHandle) => [
|
|
42342
42608
|
{
|
|
42343
42609
|
label: t("tableMenu.addColumnBefore"),
|
|
42344
42610
|
icon: ArrowLeft2,
|
|
@@ -42655,10 +42921,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
42655
42921
|
);
|
|
42656
42922
|
|
|
42657
42923
|
// src/components/UEditor/use-table-interactions.ts
|
|
42658
|
-
import
|
|
42924
|
+
import React87, { useEffect as useEffect39, useRef as useRef37 } from "react";
|
|
42659
42925
|
|
|
42660
42926
|
// src/components/UEditor/use-table-row-resize.ts
|
|
42661
|
-
import
|
|
42927
|
+
import React86, { useRef as useRef36 } from "react";
|
|
42662
42928
|
function useTableRowResize({
|
|
42663
42929
|
editor,
|
|
42664
42930
|
setHoveredTableCell,
|
|
@@ -42667,16 +42933,16 @@ function useTableRowResize({
|
|
|
42667
42933
|
clearAllTableResizeHover,
|
|
42668
42934
|
scheduleTableLayoutSync
|
|
42669
42935
|
}) {
|
|
42670
|
-
const stateRef =
|
|
42671
|
-
const syncActiveGuide =
|
|
42936
|
+
const stateRef = useRef36(null);
|
|
42937
|
+
const syncActiveGuide = React86.useCallback(() => {
|
|
42672
42938
|
const state = stateRef.current;
|
|
42673
42939
|
if (!state) return false;
|
|
42674
42940
|
setHoveredTableCell(state.cellElement);
|
|
42675
42941
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, state.pendingHeight);
|
|
42676
42942
|
return true;
|
|
42677
42943
|
}, [setHoveredTableCell, showRowGuide]);
|
|
42678
|
-
const isResizing =
|
|
42679
|
-
const beginResize =
|
|
42944
|
+
const isResizing = React86.useCallback(() => stateRef.current !== null, []);
|
|
42945
|
+
const beginResize = React86.useCallback((event, table, row, cell) => {
|
|
42680
42946
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
42681
42947
|
return false;
|
|
42682
42948
|
}
|
|
@@ -42702,7 +42968,7 @@ function useTableRowResize({
|
|
|
42702
42968
|
event.stopPropagation();
|
|
42703
42969
|
return true;
|
|
42704
42970
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
42705
|
-
const handlePointerMove =
|
|
42971
|
+
const handlePointerMove = React86.useCallback((event) => {
|
|
42706
42972
|
const state = stateRef.current;
|
|
42707
42973
|
if (!state) return;
|
|
42708
42974
|
const nextHeight = Math.max(
|
|
@@ -42719,7 +42985,7 @@ function useTableRowResize({
|
|
|
42719
42985
|
document.body.style.cursor = "row-resize";
|
|
42720
42986
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, nextHeight);
|
|
42721
42987
|
}, [showRowGuide]);
|
|
42722
|
-
const handlePointerUp =
|
|
42988
|
+
const handlePointerUp = React86.useCallback((event) => {
|
|
42723
42989
|
if (!editor) return;
|
|
42724
42990
|
const state = stateRef.current;
|
|
42725
42991
|
if (!state) return;
|
|
@@ -42743,7 +43009,7 @@ function useTableRowResize({
|
|
|
42743
43009
|
clearAllTableResizeHover();
|
|
42744
43010
|
scheduleTableLayoutSync();
|
|
42745
43011
|
}, [clearAllTableResizeHover, clearHoveredTableCell, editor, scheduleTableLayoutSync]);
|
|
42746
|
-
const cancelResize =
|
|
43012
|
+
const cancelResize = React86.useCallback(() => {
|
|
42747
43013
|
if (!stateRef.current) return;
|
|
42748
43014
|
stateRef.current = null;
|
|
42749
43015
|
document.body.style.cursor = "";
|
|
@@ -42751,7 +43017,7 @@ function useTableRowResize({
|
|
|
42751
43017
|
clearAllTableResizeHover();
|
|
42752
43018
|
scheduleTableLayoutSync();
|
|
42753
43019
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
42754
|
-
const cleanup =
|
|
43020
|
+
const cleanup = React86.useCallback(() => {
|
|
42755
43021
|
stateRef.current = null;
|
|
42756
43022
|
document.body.style.cursor = "";
|
|
42757
43023
|
}, []);
|
|
@@ -42768,24 +43034,24 @@ function useTableRowResize({
|
|
|
42768
43034
|
|
|
42769
43035
|
// src/components/UEditor/use-table-interactions.ts
|
|
42770
43036
|
function useUEditorTableInteractions(editor, editable = true) {
|
|
42771
|
-
const editorContentRef =
|
|
42772
|
-
const tableColumnGuideRef =
|
|
42773
|
-
const tableRowGuideRef =
|
|
42774
|
-
const activeTableCellHighlightRef =
|
|
42775
|
-
const hoveredTableCellRef =
|
|
42776
|
-
const activeTableCellRef =
|
|
42777
|
-
const suppressActiveCellHighlightRef =
|
|
42778
|
-
const tableLayoutSyncFrameRef =
|
|
42779
|
-
const getProseMirrorElement =
|
|
43037
|
+
const editorContentRef = useRef37(null);
|
|
43038
|
+
const tableColumnGuideRef = useRef37(null);
|
|
43039
|
+
const tableRowGuideRef = useRef37(null);
|
|
43040
|
+
const activeTableCellHighlightRef = useRef37(null);
|
|
43041
|
+
const hoveredTableCellRef = useRef37(null);
|
|
43042
|
+
const activeTableCellRef = useRef37(null);
|
|
43043
|
+
const suppressActiveCellHighlightRef = useRef37(false);
|
|
43044
|
+
const tableLayoutSyncFrameRef = useRef37(null);
|
|
43045
|
+
const getProseMirrorElement = React87.useCallback(() => {
|
|
42780
43046
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
42781
43047
|
}, []);
|
|
42782
|
-
const setEditorResizeCursor =
|
|
43048
|
+
const setEditorResizeCursor = React87.useCallback((cursor) => {
|
|
42783
43049
|
const proseMirror = getProseMirrorElement();
|
|
42784
43050
|
if (proseMirror) {
|
|
42785
43051
|
proseMirror.style.cursor = cursor;
|
|
42786
43052
|
}
|
|
42787
43053
|
}, [getProseMirrorElement]);
|
|
42788
|
-
const hideColumnGuide =
|
|
43054
|
+
const hideColumnGuide = React87.useCallback(() => {
|
|
42789
43055
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
42790
43056
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
42791
43057
|
const guide = tableColumnGuideRef.current;
|
|
@@ -42793,7 +43059,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42793
43059
|
guide.style.opacity = "0";
|
|
42794
43060
|
}
|
|
42795
43061
|
}, [getProseMirrorElement]);
|
|
42796
|
-
const hideRowGuide =
|
|
43062
|
+
const hideRowGuide = React87.useCallback(() => {
|
|
42797
43063
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
42798
43064
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
42799
43065
|
const guide = tableRowGuideRef.current;
|
|
@@ -42801,12 +43067,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42801
43067
|
guide.style.opacity = "0";
|
|
42802
43068
|
}
|
|
42803
43069
|
}, [getProseMirrorElement]);
|
|
42804
|
-
const clearAllTableResizeHover =
|
|
43070
|
+
const clearAllTableResizeHover = React87.useCallback(() => {
|
|
42805
43071
|
setEditorResizeCursor("");
|
|
42806
43072
|
hideColumnGuide();
|
|
42807
43073
|
hideRowGuide();
|
|
42808
43074
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
42809
|
-
const updateActiveCellHighlight =
|
|
43075
|
+
const updateActiveCellHighlight = React87.useCallback((cell) => {
|
|
42810
43076
|
const surface = editorContentRef.current;
|
|
42811
43077
|
const highlight = activeTableCellHighlightRef.current;
|
|
42812
43078
|
if (!highlight) return;
|
|
@@ -42821,7 +43087,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42821
43087
|
highlight.style.width = `${metrics.width}px`;
|
|
42822
43088
|
highlight.style.height = `${metrics.height}px`;
|
|
42823
43089
|
}, []);
|
|
42824
|
-
const scheduleTableLayoutSync =
|
|
43090
|
+
const scheduleTableLayoutSync = React87.useCallback(() => {
|
|
42825
43091
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
42826
43092
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
42827
43093
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -42829,7 +43095,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42829
43095
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
42830
43096
|
});
|
|
42831
43097
|
}, [updateActiveCellHighlight]);
|
|
42832
|
-
const setActiveTableCell =
|
|
43098
|
+
const setActiveTableCell = React87.useCallback((cell) => {
|
|
42833
43099
|
if (activeTableCellRef.current === cell) {
|
|
42834
43100
|
updateActiveCellHighlight(cell);
|
|
42835
43101
|
return;
|
|
@@ -42837,17 +43103,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42837
43103
|
activeTableCellRef.current = cell;
|
|
42838
43104
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
42839
43105
|
}, [updateActiveCellHighlight]);
|
|
42840
|
-
const clearActiveTableCell =
|
|
43106
|
+
const clearActiveTableCell = React87.useCallback(() => {
|
|
42841
43107
|
activeTableCellRef.current = null;
|
|
42842
43108
|
updateActiveCellHighlight(null);
|
|
42843
43109
|
}, [updateActiveCellHighlight]);
|
|
42844
|
-
const setHoveredTableCell =
|
|
43110
|
+
const setHoveredTableCell = React87.useCallback((cell) => {
|
|
42845
43111
|
hoveredTableCellRef.current = cell;
|
|
42846
43112
|
}, []);
|
|
42847
|
-
const clearHoveredTableCell =
|
|
43113
|
+
const clearHoveredTableCell = React87.useCallback(() => {
|
|
42848
43114
|
hoveredTableCellRef.current = null;
|
|
42849
43115
|
}, []);
|
|
42850
|
-
const showColumnGuide =
|
|
43116
|
+
const showColumnGuide = React87.useCallback((table, row, cell) => {
|
|
42851
43117
|
const surface = editorContentRef.current;
|
|
42852
43118
|
const guide = tableColumnGuideRef.current;
|
|
42853
43119
|
if (!surface || !guide) return;
|
|
@@ -42861,7 +43127,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42861
43127
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
42862
43128
|
setEditorResizeCursor("col-resize");
|
|
42863
43129
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
42864
|
-
const showRowGuide =
|
|
43130
|
+
const showRowGuide = React87.useCallback((table, row, cell, previewHeight) => {
|
|
42865
43131
|
const surface = editorContentRef.current;
|
|
42866
43132
|
const guide = tableRowGuideRef.current;
|
|
42867
43133
|
if (!surface || !guide) return;
|
|
@@ -42893,7 +43159,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42893
43159
|
clearAllTableResizeHover,
|
|
42894
43160
|
scheduleTableLayoutSync
|
|
42895
43161
|
});
|
|
42896
|
-
const syncActiveTableCellFromSelection =
|
|
43162
|
+
const syncActiveTableCellFromSelection = React87.useCallback(() => {
|
|
42897
43163
|
if (!editor) return;
|
|
42898
43164
|
if (!editor.isFocused) {
|
|
42899
43165
|
clearActiveTableCell();
|
|
@@ -42901,7 +43167,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42901
43167
|
}
|
|
42902
43168
|
setActiveTableCell(getSelectionTableCell(editor.view));
|
|
42903
43169
|
}, [clearActiveTableCell, editor, setActiveTableCell]);
|
|
42904
|
-
|
|
43170
|
+
useEffect39(() => {
|
|
42905
43171
|
if (!editor || !editable) return void 0;
|
|
42906
43172
|
const proseMirror = editor.view.dom;
|
|
42907
43173
|
const surface = editorContentRef.current;
|
|
@@ -43076,7 +43342,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43076
43342
|
}
|
|
43077
43343
|
|
|
43078
43344
|
// src/components/UEditor/use-formula-coordinate-overlay.ts
|
|
43079
|
-
import { useEffect as
|
|
43345
|
+
import { useEffect as useEffect40, useRef as useRef38 } from "react";
|
|
43080
43346
|
import { TableMap as TableMap6 } from "@tiptap/pm/tables";
|
|
43081
43347
|
|
|
43082
43348
|
// src/components/UEditor/table-formula-range-picker.ts
|
|
@@ -43346,8 +43612,8 @@ function createBlockedReferenceHighlight(label) {
|
|
|
43346
43612
|
return element;
|
|
43347
43613
|
}
|
|
43348
43614
|
function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
43349
|
-
const overlayRef =
|
|
43350
|
-
|
|
43615
|
+
const overlayRef = useRef38(null);
|
|
43616
|
+
useEffect40(() => {
|
|
43351
43617
|
if (!editor) return void 0;
|
|
43352
43618
|
const overlay = overlayRef.current;
|
|
43353
43619
|
const container = containerRef.current;
|
|
@@ -43554,7 +43820,7 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
43554
43820
|
}
|
|
43555
43821
|
|
|
43556
43822
|
// src/components/UEditor/menu-bar.tsx
|
|
43557
|
-
import
|
|
43823
|
+
import React88, { useMemo as useMemo26, useRef as useRef39, useState as useState52 } from "react";
|
|
43558
43824
|
import { useEditorState as useEditorState3 } from "@tiptap/react";
|
|
43559
43825
|
import {
|
|
43560
43826
|
AlignCenter as AlignCenter4,
|
|
@@ -43767,7 +44033,7 @@ function renderMenuItems(items) {
|
|
|
43767
44033
|
case "sub":
|
|
43768
44034
|
return /* @__PURE__ */ jsx99(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
43769
44035
|
case "custom":
|
|
43770
|
-
return /* @__PURE__ */ jsx99(
|
|
44036
|
+
return /* @__PURE__ */ jsx99(React88.Fragment, { children: item.render() }, item.key);
|
|
43771
44037
|
}
|
|
43772
44038
|
});
|
|
43773
44039
|
}
|
|
@@ -44143,7 +44409,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44143
44409
|
}
|
|
44144
44410
|
];
|
|
44145
44411
|
}
|
|
44146
|
-
var MenuBarTrigger =
|
|
44412
|
+
var MenuBarTrigger = React88.forwardRef(
|
|
44147
44413
|
({ children, className, ...props }, ref) => /* @__PURE__ */ jsx99(
|
|
44148
44414
|
"button",
|
|
44149
44415
|
{
|
|
@@ -44179,13 +44445,13 @@ var MenuBar = ({
|
|
|
44179
44445
|
editor,
|
|
44180
44446
|
selector: ({ transactionNumber }) => transactionNumber
|
|
44181
44447
|
});
|
|
44182
|
-
const fileInputRef =
|
|
44183
|
-
const [showImageInput, setShowImageInput] =
|
|
44184
|
-
const [showLinkInput, setShowLinkInput] =
|
|
44185
|
-
const [isInsertMenuOpen, setIsInsertMenuOpen] =
|
|
44186
|
-
const [showSourceDialog, setShowSourceDialog] =
|
|
44187
|
-
const [sourceHtml, setSourceHtml] =
|
|
44188
|
-
const [showPreviewDialog, setShowPreviewDialog] =
|
|
44448
|
+
const fileInputRef = useRef39(null);
|
|
44449
|
+
const [showImageInput, setShowImageInput] = useState52(false);
|
|
44450
|
+
const [showLinkInput, setShowLinkInput] = useState52(false);
|
|
44451
|
+
const [isInsertMenuOpen, setIsInsertMenuOpen] = useState52(false);
|
|
44452
|
+
const [showSourceDialog, setShowSourceDialog] = useState52(false);
|
|
44453
|
+
const [sourceHtml, setSourceHtml] = useState52("");
|
|
44454
|
+
const [showPreviewDialog, setShowPreviewDialog] = useState52(false);
|
|
44189
44455
|
const previewHtml = useMemo26(
|
|
44190
44456
|
() => showPreviewDialog ? prepareUEditorPreviewHtml(editor.getHTML()) : "",
|
|
44191
44457
|
[editor, showPreviewDialog]
|
|
@@ -44475,20 +44741,20 @@ var MenuBar = ({
|
|
|
44475
44741
|
};
|
|
44476
44742
|
|
|
44477
44743
|
// src/components/UEditor/table-formula-bar.tsx
|
|
44478
|
-
import { useEffect as
|
|
44744
|
+
import { useEffect as useEffect41, useRef as useRef40, useState as useState53 } from "react";
|
|
44479
44745
|
import { useEditorState as useEditorState4 } from "@tiptap/react";
|
|
44480
44746
|
import { AlertCircle as AlertCircle5, Check as Check14, Hash as Hash2, Sigma as Sigma3, Trash2 as Trash26 } from "lucide-react";
|
|
44481
44747
|
import { jsx as jsx100, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
44482
44748
|
function TableFormulaBar({ editor }) {
|
|
44483
44749
|
const t = useSmartTranslations("UEditor");
|
|
44484
|
-
const inputRef =
|
|
44485
|
-
const [draftState, setDraftState] =
|
|
44750
|
+
const inputRef = useRef40(null);
|
|
44751
|
+
const [draftState, setDraftState] = useState53(null);
|
|
44486
44752
|
useEditorState4({
|
|
44487
44753
|
editor,
|
|
44488
44754
|
selector: ({ transactionNumber }) => transactionNumber
|
|
44489
44755
|
});
|
|
44490
44756
|
const selectedCell = getSelectedTableFormulaCell(editor);
|
|
44491
|
-
|
|
44757
|
+
useEffect41(() => {
|
|
44492
44758
|
const focusFormulaInput = () => {
|
|
44493
44759
|
inputRef.current?.focus();
|
|
44494
44760
|
};
|
|
@@ -44623,7 +44889,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44623
44889
|
|
|
44624
44890
|
// src/components/UEditor/UEditor.tsx
|
|
44625
44891
|
import { jsx as jsx101, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
44626
|
-
var UEditor =
|
|
44892
|
+
var UEditor = React90.forwardRef(({
|
|
44627
44893
|
content = "",
|
|
44628
44894
|
onChange,
|
|
44629
44895
|
onHtmlChange,
|
|
@@ -44665,14 +44931,14 @@ var UEditor = React89.forwardRef(({
|
|
|
44665
44931
|
}, ref) => {
|
|
44666
44932
|
const t = useSmartTranslations("UEditor");
|
|
44667
44933
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
44668
|
-
const inFlightPrepareRef =
|
|
44669
|
-
const lastAppliedContentRef =
|
|
44670
|
-
const scheduledFormulaRecalculateRef =
|
|
44671
|
-
const editorInstanceRef =
|
|
44672
|
-
const formulaRangePickRef =
|
|
44673
|
-
const formulaRangeSurfaceRef =
|
|
44674
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
44675
|
-
const scheduleFormulaRecalculate =
|
|
44934
|
+
const inFlightPrepareRef = useRef41(null);
|
|
44935
|
+
const lastAppliedContentRef = useRef41(content ?? "");
|
|
44936
|
+
const scheduledFormulaRecalculateRef = useRef41(false);
|
|
44937
|
+
const editorInstanceRef = useRef41(null);
|
|
44938
|
+
const formulaRangePickRef = useRef41(null);
|
|
44939
|
+
const formulaRangeSurfaceRef = useRef41(null);
|
|
44940
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = React90.useState(null);
|
|
44941
|
+
const scheduleFormulaRecalculate = React90.useCallback((editor2, options) => {
|
|
44676
44942
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
44677
44943
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
44678
44944
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -44712,7 +44978,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44712
44978
|
],
|
|
44713
44979
|
[effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable, fetchMetadata, extraExtensions]
|
|
44714
44980
|
);
|
|
44715
|
-
const syncFormulaRangeHighlight =
|
|
44981
|
+
const syncFormulaRangeHighlight = React90.useCallback((pickState) => {
|
|
44716
44982
|
const container = formulaRangeSurfaceRef.current;
|
|
44717
44983
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
44718
44984
|
}, []);
|
|
@@ -44822,7 +45088,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44822
45088
|
scheduleFormulaRecalculate(editor2, { force: true });
|
|
44823
45089
|
}
|
|
44824
45090
|
});
|
|
44825
|
-
|
|
45091
|
+
useEffect42(() => {
|
|
44826
45092
|
editorInstanceRef.current = editor;
|
|
44827
45093
|
return () => {
|
|
44828
45094
|
if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
|
|
@@ -44863,7 +45129,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44863
45129
|
}),
|
|
44864
45130
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
44865
45131
|
);
|
|
44866
|
-
|
|
45132
|
+
useEffect42(() => {
|
|
44867
45133
|
if (!editor) return;
|
|
44868
45134
|
queueMicrotask(() => {
|
|
44869
45135
|
if (!editor.isDestroyed) {
|
|
@@ -44871,7 +45137,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44871
45137
|
}
|
|
44872
45138
|
});
|
|
44873
45139
|
}, [editor]);
|
|
44874
|
-
|
|
45140
|
+
useEffect42(() => {
|
|
44875
45141
|
if (!editor) return;
|
|
44876
45142
|
const nextContent = content ?? "";
|
|
44877
45143
|
if (lastAppliedContentRef.current === nextContent) return;
|