@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.js
CHANGED
|
@@ -910,6 +910,19 @@ var en_default = {
|
|
|
910
910
|
borderStyle: "Border Style",
|
|
911
911
|
borderWidth: "Border Width",
|
|
912
912
|
borderColor: "Border Color",
|
|
913
|
+
borderPosition: "Border placement",
|
|
914
|
+
borderMode: "Border mode",
|
|
915
|
+
borderDraw: "Draw borders",
|
|
916
|
+
borderErase: "Hide borders",
|
|
917
|
+
borderAll: "All borders",
|
|
918
|
+
borderOuter: "Outer borders",
|
|
919
|
+
borderInner: "Inner borders",
|
|
920
|
+
borderHorizontal: "Inner horizontal borders",
|
|
921
|
+
borderVertical: "Inner vertical borders",
|
|
922
|
+
borderTop: "Top border",
|
|
923
|
+
borderRight: "Right border",
|
|
924
|
+
borderBottom: "Bottom border",
|
|
925
|
+
borderLeft: "Left border",
|
|
913
926
|
clearBorder: "Clear Border",
|
|
914
927
|
formula: "Formula",
|
|
915
928
|
formulaBar: "Formula bar",
|
|
@@ -1343,6 +1356,19 @@ var vi_default = {
|
|
|
1343
1356
|
borderStyle: "Ki\u1EC3u vi\u1EC1n",
|
|
1344
1357
|
borderWidth: "\u0110\u1ED9 d\xE0y vi\u1EC1n",
|
|
1345
1358
|
borderColor: "M\xE0u vi\u1EC1n",
|
|
1359
|
+
borderPosition: "V\u1ECB tr\xED vi\u1EC1n",
|
|
1360
|
+
borderMode: "Ch\u1EBF \u0111\u1ED9 vi\u1EC1n",
|
|
1361
|
+
borderDraw: "V\u1EBD vi\u1EC1n",
|
|
1362
|
+
borderErase: "\u1EA8n c\u1EA1nh",
|
|
1363
|
+
borderAll: "T\u1EA5t c\u1EA3 vi\u1EC1n",
|
|
1364
|
+
borderOuter: "Vi\u1EC1n ngo\xE0i",
|
|
1365
|
+
borderInner: "Vi\u1EC1n trong",
|
|
1366
|
+
borderHorizontal: "Vi\u1EC1n ngang b\xEAn trong",
|
|
1367
|
+
borderVertical: "Vi\u1EC1n d\u1ECDc b\xEAn trong",
|
|
1368
|
+
borderTop: "Vi\u1EC1n tr\xEAn",
|
|
1369
|
+
borderRight: "Vi\u1EC1n ph\u1EA3i",
|
|
1370
|
+
borderBottom: "Vi\u1EC1n d\u01B0\u1EDBi",
|
|
1371
|
+
borderLeft: "Vi\u1EC1n tr\xE1i",
|
|
1346
1372
|
clearBorder: "X\xF3a vi\u1EC1n",
|
|
1347
1373
|
formula: "C\xF4ng th\u1EE9c",
|
|
1348
1374
|
formulaBar: "Thanh c\xF4ng th\u1EE9c",
|
|
@@ -1776,6 +1802,19 @@ var ko_default = {
|
|
|
1776
1802
|
borderStyle: "\uD14C\uB450\uB9AC \uC2A4\uD0C0\uC77C",
|
|
1777
1803
|
borderWidth: "\uD14C\uB450\uB9AC \uB450\uAED8",
|
|
1778
1804
|
borderColor: "\uD14C\uB450\uB9AC \uC0C9\uC0C1",
|
|
1805
|
+
borderPosition: "\uD14C\uB450\uB9AC \uC704\uCE58",
|
|
1806
|
+
borderMode: "\uD14C\uB450\uB9AC \uBAA8\uB4DC",
|
|
1807
|
+
borderDraw: "\uD14C\uB450\uB9AC \uADF8\uB9AC\uAE30",
|
|
1808
|
+
borderErase: "\uD14C\uB450\uB9AC \uC228\uAE30\uAE30",
|
|
1809
|
+
borderAll: "\uBAA8\uB4E0 \uD14C\uB450\uB9AC",
|
|
1810
|
+
borderOuter: "\uBC14\uAE65\uCABD \uD14C\uB450\uB9AC",
|
|
1811
|
+
borderInner: "\uC548\uCABD \uD14C\uB450\uB9AC",
|
|
1812
|
+
borderHorizontal: "\uC548\uCABD \uAC00\uB85C \uD14C\uB450\uB9AC",
|
|
1813
|
+
borderVertical: "\uC548\uCABD \uC138\uB85C \uD14C\uB450\uB9AC",
|
|
1814
|
+
borderTop: "\uC704\uCABD \uD14C\uB450\uB9AC",
|
|
1815
|
+
borderRight: "\uC624\uB978\uCABD \uD14C\uB450\uB9AC",
|
|
1816
|
+
borderBottom: "\uC544\uB798\uCABD \uD14C\uB450\uB9AC",
|
|
1817
|
+
borderLeft: "\uC67C\uCABD \uD14C\uB450\uB9AC",
|
|
1779
1818
|
clearBorder: "\uD14C\uB450\uB9AC \uC9C0\uC6B0\uAE30",
|
|
1780
1819
|
formula: "\uC218\uC2DD",
|
|
1781
1820
|
formulaBar: "\uC218\uC2DD \uC785\uB825\uC904",
|
|
@@ -2209,6 +2248,19 @@ var ja_default = {
|
|
|
2209
2248
|
borderStyle: "\u67A0\u7DDA\u30B9\u30BF\u30A4\u30EB",
|
|
2210
2249
|
borderWidth: "\u67A0\u7DDA\u306E\u592A\u3055",
|
|
2211
2250
|
borderColor: "\u67A0\u7DDA\u306E\u8272",
|
|
2251
|
+
borderPosition: "\u67A0\u7DDA\u306E\u4F4D\u7F6E",
|
|
2252
|
+
borderMode: "\u67A0\u7DDA\u30E2\u30FC\u30C9",
|
|
2253
|
+
borderDraw: "\u67A0\u7DDA\u3092\u5F15\u304F",
|
|
2254
|
+
borderErase: "\u67A0\u7DDA\u3092\u975E\u8868\u793A",
|
|
2255
|
+
borderAll: "\u3059\u3079\u3066\u306E\u67A0\u7DDA",
|
|
2256
|
+
borderOuter: "\u5916\u67A0",
|
|
2257
|
+
borderInner: "\u5185\u5074\u306E\u67A0\u7DDA",
|
|
2258
|
+
borderHorizontal: "\u5185\u5074\u306E\u6A2A\u7F6B\u7DDA",
|
|
2259
|
+
borderVertical: "\u5185\u5074\u306E\u7E26\u7F6B\u7DDA",
|
|
2260
|
+
borderTop: "\u4E0A\u7F6B\u7DDA",
|
|
2261
|
+
borderRight: "\u53F3\u7F6B\u7DDA",
|
|
2262
|
+
borderBottom: "\u4E0B\u7F6B\u7DDA",
|
|
2263
|
+
borderLeft: "\u5DE6\u7F6B\u7DDA",
|
|
2212
2264
|
clearBorder: "\u67A0\u7DDA\u3092\u30AF\u30EA\u30A2",
|
|
2213
2265
|
formula: "\u6570\u5F0F",
|
|
2214
2266
|
formulaBar: "\u6570\u5F0F\u30D0\u30FC",
|
|
@@ -14250,7 +14302,7 @@ function Calendar4({
|
|
|
14250
14302
|
xl: { cell: dense ? "min-h-48" : "min-h-52", day: "text-xl" }
|
|
14251
14303
|
};
|
|
14252
14304
|
const cellSz = CELL_EVENT_STYLES[size];
|
|
14253
|
-
const
|
|
14305
|
+
const VARIANT_STYLES = {
|
|
14254
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",
|
|
14255
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",
|
|
14256
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",
|
|
@@ -27214,17 +27266,35 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
27214
27266
|
var NotificationModal_default = NotificationModal;
|
|
27215
27267
|
|
|
27216
27268
|
// src/components/AccessDenied.tsx
|
|
27217
|
-
import {
|
|
27269
|
+
import { useState as useState42, useEffect as useEffect32, useId as useId15, useRef as useRef26 } from "react";
|
|
27218
27270
|
import { jsx as jsx75, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
27219
|
-
var
|
|
27220
|
-
destructive:
|
|
27221
|
-
warning:
|
|
27222
|
-
info:
|
|
27271
|
+
var VARIANT_COLOR_VARS = {
|
|
27272
|
+
destructive: "var(--destructive)",
|
|
27273
|
+
warning: "var(--warning)",
|
|
27274
|
+
info: "var(--info)"
|
|
27223
27275
|
};
|
|
27224
|
-
var
|
|
27225
|
-
destructive:
|
|
27226
|
-
|
|
27227
|
-
|
|
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
|
+
}
|
|
27228
27298
|
};
|
|
27229
27299
|
function AccessDenied({
|
|
27230
27300
|
title = "Access Restricted",
|
|
@@ -27233,30 +27303,278 @@ function AccessDenied({
|
|
|
27233
27303
|
icon: Icon,
|
|
27234
27304
|
className,
|
|
27235
27305
|
children,
|
|
27236
|
-
overflowHidden = true
|
|
27306
|
+
overflowHidden = true,
|
|
27307
|
+
code = "403"
|
|
27237
27308
|
}) {
|
|
27238
|
-
const
|
|
27239
|
-
const
|
|
27240
|
-
|
|
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(
|
|
27241
27380
|
Card_default,
|
|
27242
27381
|
{
|
|
27243
|
-
className: cn(
|
|
27244
|
-
|
|
27245
|
-
|
|
27246
|
-
|
|
27247
|
-
|
|
27248
|
-
|
|
27249
|
-
|
|
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
|
+
)
|
|
27250
27446
|
] }),
|
|
27251
|
-
|
|
27252
|
-
|
|
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
|
+
]
|
|
27253
27571
|
}
|
|
27254
27572
|
);
|
|
27255
27573
|
}
|
|
27256
27574
|
|
|
27257
27575
|
// src/components/ThemeToggleHeadless.tsx
|
|
27258
27576
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
27259
|
-
import { useRef as
|
|
27577
|
+
import { useRef as useRef27, useState as useState43 } from "react";
|
|
27260
27578
|
import { createPortal as createPortal6 } from "react-dom";
|
|
27261
27579
|
import { Fragment as Fragment27, jsx as jsx76, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
27262
27580
|
function ThemeToggleHeadless({
|
|
@@ -27265,10 +27583,10 @@ function ThemeToggleHeadless({
|
|
|
27265
27583
|
labels,
|
|
27266
27584
|
className
|
|
27267
27585
|
}) {
|
|
27268
|
-
const [isOpen, setIsOpen] =
|
|
27586
|
+
const [isOpen, setIsOpen] = useState43(false);
|
|
27269
27587
|
const isHydrated = useHydrated();
|
|
27270
|
-
const triggerRef =
|
|
27271
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
27588
|
+
const triggerRef = useRef27(null);
|
|
27589
|
+
const [dropdownPosition, setDropdownPosition] = useState43(null);
|
|
27272
27590
|
const themes = [
|
|
27273
27591
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
27274
27592
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: Moon2 },
|
|
@@ -27357,7 +27675,7 @@ function ThemeToggleHeadless({
|
|
|
27357
27675
|
}
|
|
27358
27676
|
|
|
27359
27677
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
27360
|
-
import { useRef as
|
|
27678
|
+
import { useRef as useRef28, useState as useState44 } from "react";
|
|
27361
27679
|
import { createPortal as createPortal7 } from "react-dom";
|
|
27362
27680
|
import { Globe } from "lucide-react";
|
|
27363
27681
|
import { Fragment as Fragment28, jsx as jsx77, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
@@ -27368,9 +27686,9 @@ function LanguageSwitcherHeadless({
|
|
|
27368
27686
|
labels,
|
|
27369
27687
|
className
|
|
27370
27688
|
}) {
|
|
27371
|
-
const [isOpen, setIsOpen] =
|
|
27372
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
27373
|
-
const triggerButtonRef =
|
|
27689
|
+
const [isOpen, setIsOpen] = useState44(false);
|
|
27690
|
+
const [dropdownPosition, setDropdownPosition] = useState44(null);
|
|
27691
|
+
const triggerButtonRef = useRef28(null);
|
|
27374
27692
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
27375
27693
|
const calculatePosition = () => {
|
|
27376
27694
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -27456,7 +27774,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
27456
27774
|
};
|
|
27457
27775
|
|
|
27458
27776
|
// src/contexts/translation-adapter.tsx
|
|
27459
|
-
import * as
|
|
27777
|
+
import * as React73 from "react";
|
|
27460
27778
|
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
27461
27779
|
function isUnresolvedTranslation2(value, namespace, key) {
|
|
27462
27780
|
return value === key || value === `${namespace}.${key}`;
|
|
@@ -27481,7 +27799,7 @@ function useTranslations(namespace) {
|
|
|
27481
27799
|
const nextIntlBridge = useNextIntlBridge();
|
|
27482
27800
|
const internalLocale = useUnderverseLocale();
|
|
27483
27801
|
const internalT = useUnderverseTranslations(namespace);
|
|
27484
|
-
return
|
|
27802
|
+
return React73.useCallback((key, params) => {
|
|
27485
27803
|
if (nextIntlBridge) {
|
|
27486
27804
|
const nextIntlResult = nextIntlBridge.translate(namespace, key, params);
|
|
27487
27805
|
if (nextIntlResult.translated && !isUnresolvedTranslation2(nextIntlResult.translated, namespace, key)) {
|
|
@@ -27506,7 +27824,7 @@ function useLocale2() {
|
|
|
27506
27824
|
}
|
|
27507
27825
|
|
|
27508
27826
|
// src/components/UEditor/UEditor.tsx
|
|
27509
|
-
import
|
|
27827
|
+
import React90, { useEffect as useEffect42, useImperativeHandle as useImperativeHandle4, useMemo as useMemo27, useRef as useRef41 } from "react";
|
|
27510
27828
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
27511
27829
|
|
|
27512
27830
|
// src/components/UEditor/extensions.ts
|
|
@@ -27666,7 +27984,7 @@ import { Node as Node3, mergeAttributes as mergeAttributes2 } from "@tiptap/core
|
|
|
27666
27984
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
|
|
27667
27985
|
|
|
27668
27986
|
// src/components/UEditor/BookmarkView.tsx
|
|
27669
|
-
import
|
|
27987
|
+
import React74, { useEffect as useEffect33, useState as useState45 } from "react";
|
|
27670
27988
|
import { NodeViewWrapper as NodeViewWrapper2 } from "@tiptap/react";
|
|
27671
27989
|
import { AlertCircle as AlertCircle4, ExternalLink as ExternalLink2, Globe as Globe2, RefreshCw } from "lucide-react";
|
|
27672
27990
|
|
|
@@ -27747,17 +28065,17 @@ import { jsx as jsx81, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
|
27747
28065
|
var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
27748
28066
|
const t = useSmartTranslations("UEditor");
|
|
27749
28067
|
const { url, title, description, image, publisher } = node.attrs;
|
|
27750
|
-
const [loading2, setLoading] =
|
|
27751
|
-
const [error, setError] =
|
|
27752
|
-
const [retryToken, setRetryToken] =
|
|
27753
|
-
const lastFetchKeyRef =
|
|
27754
|
-
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);
|
|
27755
28073
|
const safeUrl = sanitizeUEditorUrl(String(url ?? ""), "link");
|
|
27756
28074
|
const safeImage = sanitizeUEditorUrl(String(image ?? ""), "image");
|
|
27757
28075
|
const clickToOpenNewTabMessage = t("bookmark.clickToOpenNewTab");
|
|
27758
28076
|
const clickToOpenLinkMessage = t("bookmark.clickToOpenLink");
|
|
27759
28077
|
const noDescriptionMessage = t("bookmark.noDescription");
|
|
27760
|
-
|
|
28078
|
+
useEffect33(() => {
|
|
27761
28079
|
if (title && retryToken === 0) return;
|
|
27762
28080
|
if (!safeUrl) return;
|
|
27763
28081
|
const fetchKey = `${safeUrl}\0${retryToken}`;
|
|
@@ -28047,7 +28365,7 @@ import { Node as Node4, mergeAttributes as mergeAttributes3 } from "@tiptap/core
|
|
|
28047
28365
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer3 } from "@tiptap/react";
|
|
28048
28366
|
|
|
28049
28367
|
// src/components/UEditor/FileCardView.tsx
|
|
28050
|
-
import { useEffect as
|
|
28368
|
+
import { useEffect as useEffect34, useState as useState46, useRef as useRef29 } from "react";
|
|
28051
28369
|
import { NodeViewWrapper as NodeViewWrapper3 } from "@tiptap/react";
|
|
28052
28370
|
import { Download as Download2, File as LucideFile, FileText as FileText2, Image as Image3, Music, RefreshCw as RefreshCw2, Video } from "lucide-react";
|
|
28053
28371
|
import { jsx as jsx82, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
@@ -28097,15 +28415,15 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
28097
28415
|
const t = useSmartTranslations("UEditor");
|
|
28098
28416
|
const { src, fileName, fileSize, fileType } = node.attrs;
|
|
28099
28417
|
const FileIcon = getFileIcon2(fileType);
|
|
28100
|
-
const [uploadError, setUploadError] =
|
|
28101
|
-
const [retryToken, setRetryToken] =
|
|
28102
|
-
const uploadAttemptedRef =
|
|
28103
|
-
const lastUploadSrcRef =
|
|
28104
|
-
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);
|
|
28105
28423
|
const safeSrc = sanitizeUEditorUrl(String(src ?? ""), "file");
|
|
28106
28424
|
const extension = editor?.extensionManager?.extensions?.find((item) => item.name === "fileCard");
|
|
28107
28425
|
const uploadFn = extension?.options?.upload;
|
|
28108
|
-
|
|
28426
|
+
useEffect34(() => {
|
|
28109
28427
|
if (lastUploadSrcRef.current !== safeSrc) {
|
|
28110
28428
|
lastUploadSrcRef.current = safeSrc;
|
|
28111
28429
|
uploadAttemptedRef.current = false;
|
|
@@ -28696,7 +29014,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
28696
29014
|
import { Extension } from "@tiptap/core";
|
|
28697
29015
|
import Suggestion from "@tiptap/suggestion";
|
|
28698
29016
|
import { ReactRenderer } from "@tiptap/react";
|
|
28699
|
-
import
|
|
29017
|
+
import React76, { forwardRef as forwardRef14, useEffect as useEffect35, useImperativeHandle, useRef as useRef30 } from "react";
|
|
28700
29018
|
import {
|
|
28701
29019
|
FileCode as FileCode2,
|
|
28702
29020
|
Heading1,
|
|
@@ -28781,9 +29099,9 @@ var DEFAULT_MESSAGES = {
|
|
|
28781
29099
|
formRadioDesc: "Insert an interactive radio button field"
|
|
28782
29100
|
};
|
|
28783
29101
|
function useResettingIndex2(resetToken) {
|
|
28784
|
-
const [state, setState] =
|
|
29102
|
+
const [state, setState] = React76.useState({ resetToken, index: 0 });
|
|
28785
29103
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
28786
|
-
const setSelectedIndex =
|
|
29104
|
+
const setSelectedIndex = React76.useCallback((nextIndex) => {
|
|
28787
29105
|
setState((prev) => {
|
|
28788
29106
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
28789
29107
|
return {
|
|
@@ -29010,8 +29328,8 @@ function buildSlashCommandItems({
|
|
|
29010
29328
|
}
|
|
29011
29329
|
var SlashCommandList = forwardRef14((props, ref) => {
|
|
29012
29330
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
29013
|
-
const listRef =
|
|
29014
|
-
|
|
29331
|
+
const listRef = useRef30(null);
|
|
29332
|
+
useEffect35(() => {
|
|
29015
29333
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
29016
29334
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
29017
29335
|
}, [selectedIndex, props.items]);
|
|
@@ -29981,13 +30299,13 @@ import { Extension as Extension3 } from "@tiptap/core";
|
|
|
29981
30299
|
import Suggestion2 from "@tiptap/suggestion";
|
|
29982
30300
|
import { ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
29983
30301
|
import { PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
29984
|
-
import
|
|
30302
|
+
import React77, { forwardRef as forwardRef15, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
29985
30303
|
import { Smile as Smile2 } from "lucide-react";
|
|
29986
30304
|
import { jsx as jsx86, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
29987
30305
|
function useResettingIndex3(resetToken) {
|
|
29988
|
-
const [state, setState] =
|
|
30306
|
+
const [state, setState] = React77.useState({ resetToken, index: 0 });
|
|
29989
30307
|
const selectedIndex = Object.is(state.resetToken, resetToken) ? state.index : 0;
|
|
29990
|
-
const setSelectedIndex =
|
|
30308
|
+
const setSelectedIndex = React77.useCallback((nextIndex) => {
|
|
29991
30309
|
setState((prev) => {
|
|
29992
30310
|
const prevIndex = Object.is(prev.resetToken, resetToken) ? prev.index : 0;
|
|
29993
30311
|
return {
|
|
@@ -30134,7 +30452,7 @@ import { Extension as Extension4 } from "@tiptap/core";
|
|
|
30134
30452
|
import Suggestion3 from "@tiptap/suggestion";
|
|
30135
30453
|
import { ReactRenderer as ReactRenderer3 } from "@tiptap/react";
|
|
30136
30454
|
import { PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
30137
|
-
import
|
|
30455
|
+
import React78, { forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
30138
30456
|
import { Sigma } from "lucide-react";
|
|
30139
30457
|
import { jsx as jsx87, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
30140
30458
|
var FORMULA_FUNCTIONS = [
|
|
@@ -30189,8 +30507,8 @@ function isFormulaFunctionSuggestionQuery(query) {
|
|
|
30189
30507
|
}
|
|
30190
30508
|
var FormulaSuggestionList = forwardRef16((props, ref) => {
|
|
30191
30509
|
const t = useSmartTranslations("UEditor");
|
|
30192
|
-
const [selectedIndex, setSelectedIndex] =
|
|
30193
|
-
|
|
30510
|
+
const [selectedIndex, setSelectedIndex] = React78.useState(0);
|
|
30511
|
+
React78.useEffect(() => {
|
|
30194
30512
|
setSelectedIndex(0);
|
|
30195
30513
|
}, [props.items]);
|
|
30196
30514
|
useImperativeHandle3(ref, () => ({
|
|
@@ -30389,7 +30707,7 @@ var UEditorPlaceholder = Extension5.create({
|
|
|
30389
30707
|
});
|
|
30390
30708
|
|
|
30391
30709
|
// src/components/UEditor/resizable-image.tsx
|
|
30392
|
-
import { useEffect as
|
|
30710
|
+
import { useEffect as useEffect36, useRef as useRef31, useState as useState47 } from "react";
|
|
30393
30711
|
import Image4 from "@tiptap/extension-image";
|
|
30394
30712
|
import { mergeAttributes as mergeAttributes6 } from "@tiptap/core";
|
|
30395
30713
|
import { NodeViewWrapper as NodeViewWrapper6, ReactNodeViewRenderer as ReactNodeViewRenderer6 } from "@tiptap/react";
|
|
@@ -30578,16 +30896,16 @@ function sizeFromHeight(height, aspect, maxWidth) {
|
|
|
30578
30896
|
}
|
|
30579
30897
|
function ResizableImageNodeView(props) {
|
|
30580
30898
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
30581
|
-
const wrapperRef =
|
|
30582
|
-
const imgRef =
|
|
30583
|
-
const resizePreviewRef =
|
|
30584
|
-
const [isHovered, setIsHovered] =
|
|
30585
|
-
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);
|
|
30586
30904
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
30587
30905
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
30588
30906
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
30589
30907
|
const imageLayout = parseImageLayout(node.attrs["imageLayout"]);
|
|
30590
|
-
const dragStateRef =
|
|
30908
|
+
const dragStateRef = useRef31(null);
|
|
30591
30909
|
const dispatchTableLayoutChange2 = () => {
|
|
30592
30910
|
editor.view.dom.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, { bubbles: true }));
|
|
30593
30911
|
};
|
|
@@ -30624,7 +30942,7 @@ function ResizableImageNodeView(props) {
|
|
|
30624
30942
|
if (!drag || drag.frameId !== null) return;
|
|
30625
30943
|
drag.frameId = window.requestAnimationFrame(applyPendingResizeFrame);
|
|
30626
30944
|
};
|
|
30627
|
-
|
|
30945
|
+
useEffect36(() => {
|
|
30628
30946
|
return () => {
|
|
30629
30947
|
const drag = dragStateRef.current;
|
|
30630
30948
|
if (drag && drag.frameId !== null) {
|
|
@@ -30634,7 +30952,7 @@ function ResizableImageNodeView(props) {
|
|
|
30634
30952
|
document.body.style.cursor = "";
|
|
30635
30953
|
};
|
|
30636
30954
|
}, []);
|
|
30637
|
-
|
|
30955
|
+
useEffect36(() => {
|
|
30638
30956
|
const img = imgRef.current;
|
|
30639
30957
|
if (!img) return;
|
|
30640
30958
|
const displayStyle = getImageDisplayStyle(widthAttr, heightAttr);
|
|
@@ -31593,7 +31911,7 @@ var UEditorTable = Table3.extend({
|
|
|
31593
31911
|
var table_align_default = UEditorTable;
|
|
31594
31912
|
|
|
31595
31913
|
// src/components/UEditor/CodeBlockView.tsx
|
|
31596
|
-
import
|
|
31914
|
+
import React80, { useState as useState48 } from "react";
|
|
31597
31915
|
import { NodeViewWrapper as NodeViewWrapper7, NodeViewContent as NodeViewContent2 } from "@tiptap/react";
|
|
31598
31916
|
import { Check as Check11, Copy as Copy2, ChevronDown as ChevronDown7 } from "lucide-react";
|
|
31599
31917
|
import { Fragment as Fragment29, jsx as jsx89, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
@@ -31618,12 +31936,12 @@ var CodeBlockView = ({
|
|
|
31618
31936
|
updateAttributes,
|
|
31619
31937
|
extension
|
|
31620
31938
|
}) => {
|
|
31621
|
-
const [copied, setCopied] =
|
|
31622
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
31623
|
-
const timeoutRef =
|
|
31939
|
+
const [copied, setCopied] = useState48(false);
|
|
31940
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState48(false);
|
|
31941
|
+
const timeoutRef = React80.useRef(null);
|
|
31624
31942
|
const currentLangValue = node.attrs.language || "text";
|
|
31625
31943
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
31626
|
-
|
|
31944
|
+
React80.useEffect(() => {
|
|
31627
31945
|
return () => {
|
|
31628
31946
|
if (timeoutRef.current) {
|
|
31629
31947
|
clearTimeout(timeoutRef.current);
|
|
@@ -31816,7 +32134,7 @@ var CustomTableCell = TableCell2.extend({
|
|
|
31816
32134
|
},
|
|
31817
32135
|
textDirection: {
|
|
31818
32136
|
default: null,
|
|
31819
|
-
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" ||
|
|
32137
|
+
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
|
|
31820
32138
|
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
31821
32139
|
}
|
|
31822
32140
|
};
|
|
@@ -31835,7 +32153,7 @@ var CustomTableCell = TableCell2.extend({
|
|
|
31835
32153
|
if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
|
|
31836
32154
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
31837
32155
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
31838
|
-
if (textDirection === "vertical") mergedStyle += "; writing-mode:
|
|
32156
|
+
if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
|
|
31839
32157
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
31840
32158
|
return [
|
|
31841
32159
|
"td",
|
|
@@ -31942,7 +32260,7 @@ var CustomTableHeader = TableHeader2.extend({
|
|
|
31942
32260
|
},
|
|
31943
32261
|
textDirection: {
|
|
31944
32262
|
default: null,
|
|
31945
|
-
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" ||
|
|
32263
|
+
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
|
|
31946
32264
|
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
31947
32265
|
}
|
|
31948
32266
|
};
|
|
@@ -31961,7 +32279,7 @@ var CustomTableHeader = TableHeader2.extend({
|
|
|
31961
32279
|
if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
|
|
31962
32280
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
31963
32281
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
31964
|
-
if (textDirection === "vertical") mergedStyle += "; writing-mode:
|
|
32282
|
+
if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
|
|
31965
32283
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
31966
32284
|
return [
|
|
31967
32285
|
"th",
|
|
@@ -32141,7 +32459,7 @@ function buildUEditorExtensions({
|
|
|
32141
32459
|
}
|
|
32142
32460
|
|
|
32143
32461
|
// src/components/UEditor/toolbar.tsx
|
|
32144
|
-
import
|
|
32462
|
+
import React83, { useRef as useRef34, useState as useState50 } from "react";
|
|
32145
32463
|
import { useEditorState } from "@tiptap/react";
|
|
32146
32464
|
import {
|
|
32147
32465
|
AlignCenter,
|
|
@@ -32189,7 +32507,7 @@ import {
|
|
|
32189
32507
|
import { setCellAttr } from "@tiptap/pm/tables";
|
|
32190
32508
|
|
|
32191
32509
|
// src/components/UEditor/colors.tsx
|
|
32192
|
-
import { useMemo as useMemo24, useRef as
|
|
32510
|
+
import { useMemo as useMemo24, useRef as useRef32 } from "react";
|
|
32193
32511
|
import { Check as Check12, Highlighter, Palette as Palette2, Paintbrush, Grid as Grid2 } from "lucide-react";
|
|
32194
32512
|
import { jsx as jsx90, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
32195
32513
|
var TextColorIcon = ({ color }) => {
|
|
@@ -32362,7 +32680,7 @@ var EditorColorPalette = ({
|
|
|
32362
32680
|
label
|
|
32363
32681
|
}) => {
|
|
32364
32682
|
const t = useSmartTranslations("UEditor");
|
|
32365
|
-
const colorInputRef =
|
|
32683
|
+
const colorInputRef = useRef32(null);
|
|
32366
32684
|
const automaticColor = colors[0]?.color ?? "";
|
|
32367
32685
|
const paletteColors = colors.slice(1);
|
|
32368
32686
|
return /* @__PURE__ */ jsxs73("div", { className: "w-56 p-2", children: [
|
|
@@ -32564,7 +32882,7 @@ function deleteSelectedImage(editor) {
|
|
|
32564
32882
|
}
|
|
32565
32883
|
|
|
32566
32884
|
// src/components/UEditor/inputs.tsx
|
|
32567
|
-
import { useEffect as
|
|
32885
|
+
import { useEffect as useEffect37, useId as useId16, useRef as useRef33, useState as useState49 } from "react";
|
|
32568
32886
|
import { Check as Check13, X as X19 } from "lucide-react";
|
|
32569
32887
|
import { jsx as jsx91, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
32570
32888
|
function normalizeUrl(raw) {
|
|
@@ -32576,11 +32894,11 @@ var LinkInput = ({
|
|
|
32576
32894
|
initialUrl = ""
|
|
32577
32895
|
}) => {
|
|
32578
32896
|
const t = useSmartTranslations("UEditor");
|
|
32579
|
-
const [url, setUrl] =
|
|
32580
|
-
const [error, setError] =
|
|
32581
|
-
const inputRef =
|
|
32582
|
-
const errorId =
|
|
32583
|
-
|
|
32897
|
+
const [url, setUrl] = useState49(initialUrl);
|
|
32898
|
+
const [error, setError] = useState49("");
|
|
32899
|
+
const inputRef = useRef33(null);
|
|
32900
|
+
const errorId = useId16();
|
|
32901
|
+
useEffect37(() => {
|
|
32584
32902
|
inputRef.current?.focus();
|
|
32585
32903
|
inputRef.current?.select();
|
|
32586
32904
|
}, []);
|
|
@@ -32620,10 +32938,10 @@ var LinkInput = ({
|
|
|
32620
32938
|
};
|
|
32621
32939
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
32622
32940
|
const t = useSmartTranslations("UEditor");
|
|
32623
|
-
const [url, setUrl] =
|
|
32624
|
-
const [alt, setAlt] =
|
|
32625
|
-
const inputRef =
|
|
32626
|
-
|
|
32941
|
+
const [url, setUrl] = useState49("");
|
|
32942
|
+
const [alt, setAlt] = useState49("");
|
|
32943
|
+
const inputRef = useRef33(null);
|
|
32944
|
+
useEffect37(() => {
|
|
32627
32945
|
inputRef.current?.focus();
|
|
32628
32946
|
}, []);
|
|
32629
32947
|
const handleSubmit = (e) => {
|
|
@@ -33089,7 +33407,7 @@ function fileToDataUrl2(file) {
|
|
|
33089
33407
|
function formatTableInsertLabel(template, rows, cols) {
|
|
33090
33408
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
33091
33409
|
}
|
|
33092
|
-
var ToolbarButton =
|
|
33410
|
+
var ToolbarButton = React83.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
33093
33411
|
const button = /* @__PURE__ */ jsx92(
|
|
33094
33412
|
"button",
|
|
33095
33413
|
{
|
|
@@ -33126,7 +33444,7 @@ var TableInsertGrid = ({
|
|
|
33126
33444
|
previewTemplate,
|
|
33127
33445
|
onInsert
|
|
33128
33446
|
}) => {
|
|
33129
|
-
const [selection, setSelection] =
|
|
33447
|
+
const [selection, setSelection] = React83.useState({ rows: 3, cols: 3 });
|
|
33130
33448
|
const maxRows = 8;
|
|
33131
33449
|
const maxCols = 8;
|
|
33132
33450
|
return /* @__PURE__ */ jsxs75("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
@@ -33184,13 +33502,13 @@ var EditorToolbar = ({
|
|
|
33184
33502
|
selector: ({ transactionNumber }) => transactionNumber
|
|
33185
33503
|
});
|
|
33186
33504
|
const { textColors, highlightColors } = useEditorColors();
|
|
33187
|
-
const [showImageInput, setShowImageInput] =
|
|
33188
|
-
const [showLinkInput, setShowLinkInput] =
|
|
33189
|
-
const [isTableMenuOpen, setIsTableMenuOpen] =
|
|
33190
|
-
const [preservedTableAnchorPos, setPreservedTableAnchorPos] =
|
|
33191
|
-
const fileInputRef =
|
|
33192
|
-
const [isUploadingImage, setIsUploadingImage] =
|
|
33193
|
-
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);
|
|
33194
33512
|
const isImageSelected = editor.isActive("image");
|
|
33195
33513
|
const imageAttrs = editor.getAttributes("image");
|
|
33196
33514
|
const tableAnchorPos = getTableAnchorPos(editor);
|
|
@@ -33213,10 +33531,10 @@ var EditorToolbar = ({
|
|
|
33213
33531
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
33214
33532
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
33215
33533
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
33216
|
-
const availableFontFamilies =
|
|
33217
|
-
const availableFontSizes =
|
|
33218
|
-
const availableLineHeights =
|
|
33219
|
-
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]);
|
|
33220
33538
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
33221
33539
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
33222
33540
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
|
|
@@ -34191,7 +34509,7 @@ var EditorToolbar = ({
|
|
|
34191
34509
|
};
|
|
34192
34510
|
|
|
34193
34511
|
// src/components/UEditor/menus.tsx
|
|
34194
|
-
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";
|
|
34195
34513
|
import { useEditorState as useEditorState2 } from "@tiptap/react";
|
|
34196
34514
|
import { isInTable as isSelectionInTable, setCellAttr as setCellAttr3 } from "@tiptap/pm/tables";
|
|
34197
34515
|
import { createPortal as createPortal8 } from "react-dom";
|
|
@@ -34214,6 +34532,7 @@ import {
|
|
|
34214
34532
|
Underline as UnderlineIcon2,
|
|
34215
34533
|
Strikethrough as StrikethroughIcon2,
|
|
34216
34534
|
Edit2,
|
|
34535
|
+
Eraser,
|
|
34217
34536
|
Unlink,
|
|
34218
34537
|
ExternalLink as ExternalLink3,
|
|
34219
34538
|
Sigma as Sigma2,
|
|
@@ -34224,9 +34543,137 @@ import {
|
|
|
34224
34543
|
ArrowRight as ArrowRight2
|
|
34225
34544
|
} from "lucide-react";
|
|
34226
34545
|
|
|
34546
|
+
// src/components/UEditor/table-border-commands.ts
|
|
34547
|
+
import { selectedRect as selectedRect2 } from "@tiptap/pm/tables";
|
|
34548
|
+
var SIDES = ["top", "right", "bottom", "left"];
|
|
34549
|
+
var OPPOSITE_SIDE = {
|
|
34550
|
+
top: "bottom",
|
|
34551
|
+
right: "left",
|
|
34552
|
+
bottom: "top",
|
|
34553
|
+
left: "right"
|
|
34554
|
+
};
|
|
34555
|
+
function splitCssValues(value) {
|
|
34556
|
+
const values = [];
|
|
34557
|
+
let token = "";
|
|
34558
|
+
let parentheses = 0;
|
|
34559
|
+
for (const character of value.trim()) {
|
|
34560
|
+
if (/\s/.test(character) && parentheses === 0) {
|
|
34561
|
+
if (token) values.push(token);
|
|
34562
|
+
token = "";
|
|
34563
|
+
continue;
|
|
34564
|
+
}
|
|
34565
|
+
if (character === "(") parentheses += 1;
|
|
34566
|
+
if (character === ")") parentheses = Math.max(0, parentheses - 1);
|
|
34567
|
+
token += character;
|
|
34568
|
+
}
|
|
34569
|
+
if (token) values.push(token);
|
|
34570
|
+
return values;
|
|
34571
|
+
}
|
|
34572
|
+
function expandCssQuad(value, fallback) {
|
|
34573
|
+
const values = typeof value === "string" ? splitCssValues(value) : [];
|
|
34574
|
+
const [top = fallback, right = top, bottom = top, left = right] = values;
|
|
34575
|
+
return { top, right, bottom, left };
|
|
34576
|
+
}
|
|
34577
|
+
function serializeCssQuad({ top, right, bottom, left }) {
|
|
34578
|
+
if (top === right && top === bottom && top === left) return top;
|
|
34579
|
+
if (top === bottom && right === left) return `${top} ${right}`;
|
|
34580
|
+
if (right === left) return `${top} ${right} ${bottom}`;
|
|
34581
|
+
return `${top} ${right} ${bottom} ${left}`;
|
|
34582
|
+
}
|
|
34583
|
+
function getAppliedSides(position, cell, selection) {
|
|
34584
|
+
const outer = {
|
|
34585
|
+
top: cell.top === selection.top,
|
|
34586
|
+
right: cell.right === selection.right,
|
|
34587
|
+
bottom: cell.bottom === selection.bottom,
|
|
34588
|
+
left: cell.left === selection.left
|
|
34589
|
+
};
|
|
34590
|
+
const inner = {
|
|
34591
|
+
top: cell.top > selection.top,
|
|
34592
|
+
right: cell.right < selection.right,
|
|
34593
|
+
bottom: cell.bottom < selection.bottom,
|
|
34594
|
+
left: cell.left > selection.left
|
|
34595
|
+
};
|
|
34596
|
+
switch (position) {
|
|
34597
|
+
case "all":
|
|
34598
|
+
return { top: true, right: true, bottom: true, left: true };
|
|
34599
|
+
case "outer":
|
|
34600
|
+
return outer;
|
|
34601
|
+
case "inner":
|
|
34602
|
+
return inner;
|
|
34603
|
+
case "horizontal":
|
|
34604
|
+
return { top: inner.top, right: false, bottom: inner.bottom, left: false };
|
|
34605
|
+
case "vertical":
|
|
34606
|
+
return { top: false, right: inner.right, bottom: false, left: inner.left };
|
|
34607
|
+
default:
|
|
34608
|
+
return {
|
|
34609
|
+
top: position === "top" && outer.top,
|
|
34610
|
+
right: position === "right" && outer.right,
|
|
34611
|
+
bottom: position === "bottom" && outer.bottom,
|
|
34612
|
+
left: position === "left" && outer.left
|
|
34613
|
+
};
|
|
34614
|
+
}
|
|
34615
|
+
}
|
|
34616
|
+
function applyTableCellBorders(editor, position, format, options = {}) {
|
|
34617
|
+
const { state, view } = editor;
|
|
34618
|
+
const selection = selectedRect2(state);
|
|
34619
|
+
const transaction = state.tr;
|
|
34620
|
+
const cellPositions = new Set(selection.map.cellsInRect(selection));
|
|
34621
|
+
const sidesByCell = /* @__PURE__ */ new Map();
|
|
34622
|
+
const addSide = (cellPos, side) => {
|
|
34623
|
+
const sides = sidesByCell.get(cellPos) ?? /* @__PURE__ */ new Set();
|
|
34624
|
+
sides.add(side);
|
|
34625
|
+
sidesByCell.set(cellPos, sides);
|
|
34626
|
+
};
|
|
34627
|
+
const addAdjacentSides = (cell, side) => {
|
|
34628
|
+
const adjacentPositions = /* @__PURE__ */ new Set();
|
|
34629
|
+
if (side === "top" && cell.top > 0) {
|
|
34630
|
+
for (let col = cell.left; col < cell.right; col += 1) adjacentPositions.add(selection.map.map[(cell.top - 1) * selection.map.width + col]);
|
|
34631
|
+
} else if (side === "bottom" && cell.bottom < selection.map.height) {
|
|
34632
|
+
for (let col = cell.left; col < cell.right; col += 1) adjacentPositions.add(selection.map.map[cell.bottom * selection.map.width + col]);
|
|
34633
|
+
} else if (side === "left" && cell.left > 0) {
|
|
34634
|
+
for (let row = cell.top; row < cell.bottom; row += 1) adjacentPositions.add(selection.map.map[row * selection.map.width + cell.left - 1]);
|
|
34635
|
+
} else if (side === "right" && cell.right < selection.map.width) {
|
|
34636
|
+
for (let row = cell.top; row < cell.bottom; row += 1) adjacentPositions.add(selection.map.map[row * selection.map.width + cell.right]);
|
|
34637
|
+
}
|
|
34638
|
+
for (const adjacentPos of adjacentPositions) addSide(adjacentPos, OPPOSITE_SIDE[side]);
|
|
34639
|
+
};
|
|
34640
|
+
for (const relativePos of cellPositions) {
|
|
34641
|
+
const cell = selection.map.findCell(relativePos);
|
|
34642
|
+
const appliedSides = getAppliedSides(position, cell, selection);
|
|
34643
|
+
for (const side of SIDES) {
|
|
34644
|
+
if (!appliedSides[side]) continue;
|
|
34645
|
+
addSide(relativePos, side);
|
|
34646
|
+
addAdjacentSides(cell, side);
|
|
34647
|
+
}
|
|
34648
|
+
}
|
|
34649
|
+
for (const [relativePos, appliedSides] of sidesByCell) {
|
|
34650
|
+
const absolutePos = selection.tableStart + relativePos;
|
|
34651
|
+
const node = state.doc.nodeAt(absolutePos);
|
|
34652
|
+
if (!node) continue;
|
|
34653
|
+
const styles = expandCssQuad(node.attrs.borderStyle, "solid");
|
|
34654
|
+
const widths = expandCssQuad(node.attrs.borderWidth, "1px");
|
|
34655
|
+
const colors = expandCssQuad(node.attrs.borderColor, "#000000");
|
|
34656
|
+
for (const side of SIDES) {
|
|
34657
|
+
if (!appliedSides.has(side)) continue;
|
|
34658
|
+
styles[side] = format.style;
|
|
34659
|
+
widths[side] = format.width;
|
|
34660
|
+
colors[side] = format.color || "currentColor";
|
|
34661
|
+
}
|
|
34662
|
+
transaction.setNodeMarkup(absolutePos, void 0, {
|
|
34663
|
+
...node.attrs,
|
|
34664
|
+
borderStyle: serializeCssQuad(styles),
|
|
34665
|
+
borderWidth: serializeCssQuad(widths),
|
|
34666
|
+
borderColor: serializeCssQuad(colors)
|
|
34667
|
+
});
|
|
34668
|
+
}
|
|
34669
|
+
if (transaction.docChanged) view.dispatch(transaction);
|
|
34670
|
+
if (options.focus ?? true) view.focus();
|
|
34671
|
+
return transaction.docChanged;
|
|
34672
|
+
}
|
|
34673
|
+
|
|
34227
34674
|
// src/components/UEditor/table-formula-commands.ts
|
|
34228
34675
|
import { TextSelection as TextSelection4 } from "@tiptap/pm/state";
|
|
34229
|
-
import { selectedRect as
|
|
34676
|
+
import { selectedRect as selectedRect3, setCellAttr as setCellAttr2, TableMap as TableMap3 } from "@tiptap/pm/tables";
|
|
34230
34677
|
|
|
34231
34678
|
// src/components/UEditor/table-formula.ts
|
|
34232
34679
|
var CELL_ADDRESS_RE = /^([A-Z]+)([1-9]\d*)$/i;
|
|
@@ -35115,7 +35562,7 @@ function recalculateTableNode(tableNode, options) {
|
|
|
35115
35562
|
return tableNode.type.create(tableNode.attrs, rows);
|
|
35116
35563
|
}
|
|
35117
35564
|
function recalculateSelectedTable(editor) {
|
|
35118
|
-
const rect =
|
|
35565
|
+
const rect = selectedRect3(editor.state);
|
|
35119
35566
|
const tableNode = rect.table;
|
|
35120
35567
|
const nextTable = recalculateTableNode(tableNode);
|
|
35121
35568
|
if (!nextTable) return false;
|
|
@@ -35171,8 +35618,8 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35171
35618
|
const t = useSmartTranslations("UEditor");
|
|
35172
35619
|
const messages = useMemo25(() => buildSlashCommandMessages(t), [t]);
|
|
35173
35620
|
const items = useMemo25(() => buildSlashCommandItems({ query: "", messages }), [messages]);
|
|
35174
|
-
const listRef =
|
|
35175
|
-
|
|
35621
|
+
const listRef = useRef35(null);
|
|
35622
|
+
useEffect38(() => {
|
|
35176
35623
|
const handleKeyDown2 = (event) => {
|
|
35177
35624
|
if (event.key === "Escape") {
|
|
35178
35625
|
event.preventDefault();
|
|
@@ -35202,7 +35649,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35202
35649
|
};
|
|
35203
35650
|
var FloatingMenuContent = ({ editor }) => {
|
|
35204
35651
|
const t = useSmartTranslations("UEditor");
|
|
35205
|
-
const [showCommands, setShowCommands] =
|
|
35652
|
+
const [showCommands, setShowCommands] = useState51(false);
|
|
35206
35653
|
if (showCommands) {
|
|
35207
35654
|
return /* @__PURE__ */ jsx93(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
35208
35655
|
}
|
|
@@ -35259,6 +35706,32 @@ function BorderStylePreviewIcon({ style }) {
|
|
|
35259
35706
|
}
|
|
35260
35707
|
);
|
|
35261
35708
|
}
|
|
35709
|
+
function BorderPositionPreviewIcon({ position }) {
|
|
35710
|
+
const showTop = position === "all" || position === "outer" || position === "top";
|
|
35711
|
+
const showRight = position === "all" || position === "outer" || position === "right";
|
|
35712
|
+
const showBottom = position === "all" || position === "outer" || position === "bottom";
|
|
35713
|
+
const showLeft = position === "all" || position === "outer" || position === "left";
|
|
35714
|
+
const showHorizontal = position === "all" || position === "inner" || position === "horizontal";
|
|
35715
|
+
const showVertical = position === "all" || position === "inner" || position === "vertical";
|
|
35716
|
+
return /* @__PURE__ */ jsxs76("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-5 w-5 fill-none stroke-current", children: [
|
|
35717
|
+
/* @__PURE__ */ jsx93(
|
|
35718
|
+
"path",
|
|
35719
|
+
{
|
|
35720
|
+
d: "M2 2H18V18H2Z M2 10H18 M10 2V18",
|
|
35721
|
+
className: "text-foreground opacity-70",
|
|
35722
|
+
stroke: "currentColor",
|
|
35723
|
+
strokeDasharray: "2 1.5",
|
|
35724
|
+
strokeWidth: "1.25"
|
|
35725
|
+
}
|
|
35726
|
+
),
|
|
35727
|
+
showTop && /* @__PURE__ */ jsx93("path", { d: "M2 2H18", strokeWidth: "2" }),
|
|
35728
|
+
showRight && /* @__PURE__ */ jsx93("path", { d: "M18 2V18", strokeWidth: "2" }),
|
|
35729
|
+
showBottom && /* @__PURE__ */ jsx93("path", { d: "M2 18H18", strokeWidth: "2" }),
|
|
35730
|
+
showLeft && /* @__PURE__ */ jsx93("path", { d: "M2 2V18", strokeWidth: "2" }),
|
|
35731
|
+
showHorizontal && /* @__PURE__ */ jsx93("path", { d: "M2 10H18", strokeWidth: "2" }),
|
|
35732
|
+
showVertical && /* @__PURE__ */ jsx93("path", { d: "M10 2V18", strokeWidth: "2" })
|
|
35733
|
+
] });
|
|
35734
|
+
}
|
|
35262
35735
|
var BubbleMenuContent = ({
|
|
35263
35736
|
editor,
|
|
35264
35737
|
onKeepOpenChange,
|
|
@@ -35266,7 +35739,8 @@ var BubbleMenuContent = ({
|
|
|
35266
35739
|
onRequestClose,
|
|
35267
35740
|
fontSizes,
|
|
35268
35741
|
lineHeights,
|
|
35269
|
-
initialShowLinkInput = false
|
|
35742
|
+
initialShowLinkInput = false,
|
|
35743
|
+
cellBorderOpenRequest = 0
|
|
35270
35744
|
}) => {
|
|
35271
35745
|
const t = useSmartTranslations("UEditor");
|
|
35272
35746
|
useEditorState2({
|
|
@@ -35274,16 +35748,21 @@ var BubbleMenuContent = ({
|
|
|
35274
35748
|
selector: ({ transactionNumber }) => transactionNumber
|
|
35275
35749
|
});
|
|
35276
35750
|
const { textColors, highlightColors } = useEditorColors();
|
|
35277
|
-
const [showLinkInput, setShowLinkInput] =
|
|
35278
|
-
const [activeColorPalette, setActiveColorPalette] =
|
|
35279
|
-
|
|
35751
|
+
const [showLinkInput, setShowLinkInput] = useState51(initialShowLinkInput);
|
|
35752
|
+
const [activeColorPalette, setActiveColorPalette] = useState51(null);
|
|
35753
|
+
useEffect38(() => {
|
|
35280
35754
|
setShowLinkInput(initialShowLinkInput);
|
|
35281
35755
|
}, [initialShowLinkInput]);
|
|
35282
|
-
|
|
35283
|
-
|
|
35284
|
-
|
|
35285
|
-
|
|
35286
|
-
|
|
35756
|
+
useEffect38(() => {
|
|
35757
|
+
if (!cellBorderOpenRequest) return;
|
|
35758
|
+
setActiveColorPalette("cell-border");
|
|
35759
|
+
onKeepOpenChange?.(true);
|
|
35760
|
+
}, [cellBorderOpenRequest, onKeepOpenChange]);
|
|
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("");
|
|
35287
35766
|
const isImageSelected = editor.isActive("image");
|
|
35288
35767
|
const imageAttrs = editor.getAttributes("image");
|
|
35289
35768
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
@@ -35296,6 +35775,14 @@ var BubbleMenuContent = ({
|
|
|
35296
35775
|
const currentCellNumberFormat = normalizeStyleValue(editor.getAttributes("tableCell").numberFormat || editor.getAttributes("tableHeader").numberFormat) || "text";
|
|
35297
35776
|
const currentCellBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
35298
35777
|
const currentCellBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
35778
|
+
const currentCellBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "#000000";
|
|
35779
|
+
const [borderStyleDraft, setBorderStyleDraft] = useState51(
|
|
35780
|
+
["solid", "dashed", "dotted", "double"].includes(currentCellBorderStyle) ? currentCellBorderStyle : "solid"
|
|
35781
|
+
);
|
|
35782
|
+
const [borderWidthDraft, setBorderWidthDraft] = useState51(currentCellBorderWidth);
|
|
35783
|
+
const [borderColorDraft, setBorderColorDraft] = useState51(currentCellBorderColor);
|
|
35784
|
+
const [borderEditMode, setBorderEditMode] = useState51("draw");
|
|
35785
|
+
const [activeBorderPosition, setActiveBorderPosition] = useState51("all");
|
|
35299
35786
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
35300
35787
|
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
35301
35788
|
const isInTable2 = isSelectionInTable(editor.state);
|
|
@@ -35320,10 +35807,10 @@ var BubbleMenuContent = ({
|
|
|
35320
35807
|
],
|
|
35321
35808
|
[highlightColors, t]
|
|
35322
35809
|
);
|
|
35323
|
-
|
|
35810
|
+
useEffect38(() => {
|
|
35324
35811
|
setFontSizeDraft(currentFontSize.replace(/px$/i, ""));
|
|
35325
35812
|
}, [currentFontSize]);
|
|
35326
|
-
|
|
35813
|
+
useEffect38(() => {
|
|
35327
35814
|
setFormulaDraft(currentCellFormula);
|
|
35328
35815
|
}, [currentCellFormula]);
|
|
35329
35816
|
const applyFontSizeDraft = () => {
|
|
@@ -35338,11 +35825,11 @@ var BubbleMenuContent = ({
|
|
|
35338
35825
|
editor.chain().focus().setFontSize(`${clamped}px`).run();
|
|
35339
35826
|
setFontSizeDraft(String(clamped));
|
|
35340
35827
|
};
|
|
35341
|
-
|
|
35828
|
+
useEffect38(() => {
|
|
35342
35829
|
onKeepOpenChange?.(showLinkInput);
|
|
35343
35830
|
onLinkInputOpenChange?.(showLinkInput);
|
|
35344
35831
|
}, [onKeepOpenChange, onLinkInputOpenChange, showLinkInput]);
|
|
35345
|
-
|
|
35832
|
+
useEffect38(() => {
|
|
35346
35833
|
onKeepOpenChange?.(Boolean(activeColorPalette));
|
|
35347
35834
|
}, [activeColorPalette, onKeepOpenChange]);
|
|
35348
35835
|
const closeTransientPanels = useCallback23(() => {
|
|
@@ -35352,21 +35839,60 @@ var BubbleMenuContent = ({
|
|
|
35352
35839
|
onLinkInputOpenChange?.(false);
|
|
35353
35840
|
onRequestClose?.();
|
|
35354
35841
|
}, [onKeepOpenChange, onLinkInputOpenChange, onRequestClose]);
|
|
35355
|
-
const
|
|
35356
|
-
|
|
35357
|
-
|
|
35358
|
-
|
|
35359
|
-
|
|
35360
|
-
|
|
35361
|
-
|
|
35362
|
-
|
|
35363
|
-
|
|
35364
|
-
|
|
35365
|
-
|
|
35366
|
-
|
|
35367
|
-
|
|
35368
|
-
|
|
35369
|
-
|
|
35842
|
+
const selectTableCellBorderColor = useCallback23((color) => {
|
|
35843
|
+
const value = color || "currentColor";
|
|
35844
|
+
setBorderColorDraft(value);
|
|
35845
|
+
setBorderEditMode("draw");
|
|
35846
|
+
setActiveBorderPosition("all");
|
|
35847
|
+
applyTableCellBorders(editor, "all", {
|
|
35848
|
+
color: value,
|
|
35849
|
+
style: borderStyleDraft,
|
|
35850
|
+
width: borderWidthDraft
|
|
35851
|
+
}, { focus: false });
|
|
35852
|
+
setActiveColorPalette("cell-border");
|
|
35853
|
+
onKeepOpenChange?.(true);
|
|
35854
|
+
}, [borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35855
|
+
const applyTableCellBorderPosition = useCallback23((position) => {
|
|
35856
|
+
setActiveBorderPosition(position);
|
|
35857
|
+
applyTableCellBorders(editor, position, {
|
|
35858
|
+
color: borderColorDraft,
|
|
35859
|
+
style: borderEditMode === "erase" ? "none" : borderStyleDraft,
|
|
35860
|
+
width: borderWidthDraft
|
|
35861
|
+
}, { focus: false });
|
|
35862
|
+
onKeepOpenChange?.(true);
|
|
35863
|
+
}, [borderColorDraft, borderEditMode, borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35864
|
+
const applyTableCellBorderStyle = useCallback23((style) => {
|
|
35865
|
+
setBorderStyleDraft(style);
|
|
35866
|
+
setBorderEditMode("draw");
|
|
35867
|
+
setActiveBorderPosition("all");
|
|
35868
|
+
applyTableCellBorders(editor, "all", {
|
|
35869
|
+
color: borderColorDraft,
|
|
35870
|
+
style,
|
|
35871
|
+
width: borderWidthDraft
|
|
35872
|
+
}, { focus: false });
|
|
35873
|
+
onKeepOpenChange?.(true);
|
|
35874
|
+
}, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35875
|
+
const applyTableCellBorderWidth = useCallback23((width) => {
|
|
35876
|
+
setBorderWidthDraft(width);
|
|
35877
|
+
setBorderEditMode("draw");
|
|
35878
|
+
setActiveBorderPosition("all");
|
|
35879
|
+
applyTableCellBorders(editor, "all", {
|
|
35880
|
+
color: borderColorDraft,
|
|
35881
|
+
style: borderStyleDraft,
|
|
35882
|
+
width
|
|
35883
|
+
}, { focus: false });
|
|
35884
|
+
onKeepOpenChange?.(true);
|
|
35885
|
+
}, [borderColorDraft, borderStyleDraft, editor, onKeepOpenChange]);
|
|
35886
|
+
const clearTableCellBorders = useCallback23(() => {
|
|
35887
|
+
setActiveBorderPosition("all");
|
|
35888
|
+
setBorderEditMode("erase");
|
|
35889
|
+
applyTableCellBorders(editor, "all", {
|
|
35890
|
+
color: borderColorDraft,
|
|
35891
|
+
style: "none",
|
|
35892
|
+
width: borderWidthDraft
|
|
35893
|
+
}, { focus: false });
|
|
35894
|
+
onKeepOpenChange?.(true);
|
|
35895
|
+
}, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35370
35896
|
const closeColorPalette = useCallback23(() => {
|
|
35371
35897
|
setActiveColorPalette(null);
|
|
35372
35898
|
onKeepOpenChange?.(false);
|
|
@@ -35389,7 +35915,7 @@ var BubbleMenuContent = ({
|
|
|
35389
35915
|
}
|
|
35390
35916
|
closeColorPalette();
|
|
35391
35917
|
}, [activeColorPalette, closeColorPalette, editor]);
|
|
35392
|
-
|
|
35918
|
+
useEffect38(() => {
|
|
35393
35919
|
if (!showLinkInput) return;
|
|
35394
35920
|
const close2 = () => setShowLinkInput(false);
|
|
35395
35921
|
editor.on("selectionUpdate", close2);
|
|
@@ -35420,27 +35946,104 @@ var BubbleMenuContent = ({
|
|
|
35420
35946
|
const isTextPalette = activeColorPalette === "text";
|
|
35421
35947
|
const isHighlightPalette = activeColorPalette === "highlight";
|
|
35422
35948
|
if (activeColorPalette === "cell-border") {
|
|
35423
|
-
|
|
35424
|
-
return /* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-2 p-2 w-56 text-sm", "data-ueditor-keep-open": true, children: [
|
|
35949
|
+
return /* @__PURE__ */ jsxs76("div", { className: "flex w-72 flex-col gap-2 p-2 text-sm", "data-ueditor-keep-open": true, children: [
|
|
35425
35950
|
/* @__PURE__ */ jsx93("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
35951
|
+
/* @__PURE__ */ jsxs76("div", { className: "flex gap-2", children: [
|
|
35952
|
+
/* @__PURE__ */ jsxs76("div", { className: "min-w-0 flex-1", children: [
|
|
35953
|
+
/* @__PURE__ */ jsx93("label", { className: "mb-1 block text-xs text-muted-foreground", children: t("tableMenu.borderPosition") || "Border placement" }),
|
|
35954
|
+
/* @__PURE__ */ jsxs76("div", { className: "grid grid-cols-5 gap-1", role: "group", "aria-label": t("tableMenu.borderPosition") || "Border placement", children: [
|
|
35955
|
+
[
|
|
35956
|
+
["all", "borderAll"],
|
|
35957
|
+
["outer", "borderOuter"],
|
|
35958
|
+
["inner", "borderInner"],
|
|
35959
|
+
["horizontal", "borderHorizontal"],
|
|
35960
|
+
["vertical", "borderVertical"],
|
|
35961
|
+
["top", "borderTop"],
|
|
35962
|
+
["right", "borderRight"],
|
|
35963
|
+
["bottom", "borderBottom"],
|
|
35964
|
+
["left", "borderLeft"]
|
|
35965
|
+
].map(([position, labelKey]) => {
|
|
35966
|
+
const label = t(`tableMenu.${labelKey}`) || position;
|
|
35967
|
+
return /* @__PURE__ */ jsx93(
|
|
35968
|
+
"button",
|
|
35969
|
+
{
|
|
35970
|
+
type: "button",
|
|
35971
|
+
"aria-label": label,
|
|
35972
|
+
title: label,
|
|
35973
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
35974
|
+
onClick: () => applyTableCellBorderPosition(position),
|
|
35975
|
+
className: cn(
|
|
35976
|
+
"inline-flex h-8 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted hover:text-primary",
|
|
35977
|
+
activeBorderPosition === position ? "bg-primary/10 text-primary" : "bg-muted/40"
|
|
35978
|
+
),
|
|
35979
|
+
children: /* @__PURE__ */ jsx93(BorderPositionPreviewIcon, { position })
|
|
35980
|
+
},
|
|
35981
|
+
position
|
|
35982
|
+
);
|
|
35983
|
+
}),
|
|
35984
|
+
/* @__PURE__ */ jsx93(
|
|
35985
|
+
"button",
|
|
35986
|
+
{
|
|
35987
|
+
type: "button",
|
|
35988
|
+
"aria-label": t("tableMenu.clearBorder") || "Clear borders",
|
|
35989
|
+
title: t("tableMenu.clearBorder") || "Clear borders",
|
|
35990
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
35991
|
+
onClick: clearTableCellBorders,
|
|
35992
|
+
className: "inline-flex h-8 items-center justify-center rounded-md bg-muted/40 text-destructive transition-colors hover:bg-destructive/10",
|
|
35993
|
+
children: /* @__PURE__ */ jsx93(BorderStylePreviewIcon, { style: "none" })
|
|
35994
|
+
}
|
|
35995
|
+
)
|
|
35996
|
+
] })
|
|
35997
|
+
] }),
|
|
35998
|
+
/* @__PURE__ */ jsxs76("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: [
|
|
35999
|
+
/* @__PURE__ */ jsx93(
|
|
36000
|
+
"button",
|
|
36001
|
+
{
|
|
36002
|
+
type: "button",
|
|
36003
|
+
"aria-label": t("tableMenu.borderDraw") || "Draw borders",
|
|
36004
|
+
title: t("tableMenu.borderDraw") || "Draw borders",
|
|
36005
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
36006
|
+
onClick: () => setBorderEditMode("draw"),
|
|
36007
|
+
className: cn(
|
|
36008
|
+
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36009
|
+
borderEditMode === "draw" ? "bg-primary/10 text-primary" : "text-muted-foreground"
|
|
36010
|
+
),
|
|
36011
|
+
children: /* @__PURE__ */ jsx93(Edit2, { className: "h-4 w-4" })
|
|
36012
|
+
}
|
|
36013
|
+
),
|
|
36014
|
+
/* @__PURE__ */ jsx93(
|
|
36015
|
+
"button",
|
|
36016
|
+
{
|
|
36017
|
+
type: "button",
|
|
36018
|
+
"aria-label": t("tableMenu.borderErase") || "Hide borders",
|
|
36019
|
+
title: t("tableMenu.borderErase") || "Hide borders",
|
|
36020
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
36021
|
+
onClick: () => setBorderEditMode("erase"),
|
|
36022
|
+
className: cn(
|
|
36023
|
+
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36024
|
+
borderEditMode === "erase" ? "bg-destructive/10 text-destructive" : "text-muted-foreground"
|
|
36025
|
+
),
|
|
36026
|
+
children: /* @__PURE__ */ jsx93(Eraser, { className: "h-4 w-4" })
|
|
36027
|
+
}
|
|
36028
|
+
)
|
|
36029
|
+
] })
|
|
36030
|
+
] }),
|
|
35426
36031
|
/* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-1", children: [
|
|
35427
36032
|
/* @__PURE__ */ jsx93("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
35428
|
-
/* @__PURE__ */ jsx93("div", { className: "grid grid-cols-
|
|
36033
|
+
/* @__PURE__ */ jsx93("div", { className: "grid grid-cols-4 gap-1.5", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
|
|
35429
36034
|
["solid", "Solid"],
|
|
35430
36035
|
["dashed", "Dashed"],
|
|
35431
36036
|
["dotted", "Dotted"],
|
|
35432
|
-
["double", "Double"]
|
|
35433
|
-
["none", "None"]
|
|
36037
|
+
["double", "Double"]
|
|
35434
36038
|
].map(([style, label]) => /* @__PURE__ */ jsxs76(
|
|
35435
36039
|
"button",
|
|
35436
36040
|
{
|
|
35437
36041
|
type: "button",
|
|
35438
|
-
"data-ueditor-close-on-select": true,
|
|
35439
36042
|
onMouseDown: (event) => event.preventDefault(),
|
|
35440
|
-
onClick: () =>
|
|
36043
|
+
onClick: () => applyTableCellBorderStyle(style),
|
|
35441
36044
|
className: cn(
|
|
35442
|
-
"inline-flex h-8 items-center justify-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors hover:bg-muted",
|
|
35443
|
-
|
|
36045
|
+
"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",
|
|
36046
|
+
borderStyleDraft === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
35444
36047
|
),
|
|
35445
36048
|
children: [
|
|
35446
36049
|
/* @__PURE__ */ jsx93(BorderStylePreviewIcon, { style }),
|
|
@@ -35456,12 +36059,11 @@ var BubbleMenuContent = ({
|
|
|
35456
36059
|
"button",
|
|
35457
36060
|
{
|
|
35458
36061
|
type: "button",
|
|
35459
|
-
"data-ueditor-close-on-select": true,
|
|
35460
36062
|
onMouseDown: (event) => event.preventDefault(),
|
|
35461
|
-
onClick: () =>
|
|
36063
|
+
onClick: () => applyTableCellBorderWidth(width),
|
|
35462
36064
|
className: cn(
|
|
35463
36065
|
"h-8 rounded-md px-2 text-xs font-medium transition-colors hover:bg-muted",
|
|
35464
|
-
|
|
36066
|
+
borderWidthDraft === width ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
35465
36067
|
),
|
|
35466
36068
|
children: width
|
|
35467
36069
|
},
|
|
@@ -35481,33 +36083,22 @@ var BubbleMenuContent = ({
|
|
|
35481
36083
|
{
|
|
35482
36084
|
className: "w-4 h-4 rounded-full border border-border",
|
|
35483
36085
|
style: {
|
|
35484
|
-
backgroundColor:
|
|
36086
|
+
backgroundColor: borderColorDraft
|
|
35485
36087
|
}
|
|
35486
36088
|
}
|
|
35487
36089
|
)
|
|
35488
36090
|
]
|
|
35489
36091
|
}
|
|
35490
|
-
)
|
|
35491
|
-
/* @__PURE__ */ jsx93("div", { className: "flex items-center justify-between gap-2 mt-2 pt-2 border-t border-border", children: /* @__PURE__ */ jsx93(
|
|
35492
|
-
"button",
|
|
35493
|
-
{
|
|
35494
|
-
type: "button",
|
|
35495
|
-
"data-ueditor-close-on-select": true,
|
|
35496
|
-
onClick: clearTableCellBorderAndClose,
|
|
35497
|
-
className: "text-xs text-destructive hover:underline",
|
|
35498
|
-
children: t("tableMenu.clearBorder") || "Clear Border"
|
|
35499
|
-
}
|
|
35500
|
-
) })
|
|
36092
|
+
)
|
|
35501
36093
|
] });
|
|
35502
36094
|
}
|
|
35503
36095
|
if (activeColorPalette === "cell-border-color") {
|
|
35504
|
-
const currentBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "";
|
|
35505
36096
|
return /* @__PURE__ */ jsx93("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ jsx93(
|
|
35506
36097
|
EditorColorPalette,
|
|
35507
36098
|
{
|
|
35508
36099
|
colors: borderColors,
|
|
35509
|
-
currentColor:
|
|
35510
|
-
onSelect:
|
|
36100
|
+
currentColor: borderColorDraft,
|
|
36101
|
+
onSelect: selectTableCellBorderColor,
|
|
35511
36102
|
label: t("tableMenu.borderColor") || "Border Color"
|
|
35512
36103
|
}
|
|
35513
36104
|
) });
|
|
@@ -36023,26 +36614,27 @@ var CustomBubbleMenu = ({
|
|
|
36023
36614
|
const SHOW_DELAY_MS = 180;
|
|
36024
36615
|
const BUBBLE_MENU_OFFSET = 16;
|
|
36025
36616
|
const BUBBLE_MENU_ESTIMATED_HEIGHT = 44;
|
|
36026
|
-
const [isVisible, setIsVisible] =
|
|
36027
|
-
const [linkInputOpen, setLinkInputOpen] =
|
|
36028
|
-
const [
|
|
36617
|
+
const [isVisible, setIsVisible] = useState51(false);
|
|
36618
|
+
const [linkInputOpen, setLinkInputOpen] = useState51(false);
|
|
36619
|
+
const [cellBorderOpenRequest, setCellBorderOpenRequest] = useState51(0);
|
|
36620
|
+
const [position, setPosition2] = useState51({
|
|
36029
36621
|
top: 0,
|
|
36030
36622
|
left: 0,
|
|
36031
36623
|
placement: "top"
|
|
36032
36624
|
});
|
|
36033
|
-
const menuRef =
|
|
36034
|
-
const keepOpenRef =
|
|
36035
|
-
const [keepOpen, setKeepOpenState] =
|
|
36036
|
-
const showTimeoutRef =
|
|
36037
|
-
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);
|
|
36038
36630
|
const setKeepOpen = useCallback23((next) => {
|
|
36039
36631
|
keepOpenRef.current = next;
|
|
36040
36632
|
setKeepOpenState(next);
|
|
36041
36633
|
if (!next) setLinkInputOpen(false);
|
|
36042
36634
|
if (next) setIsVisible(true);
|
|
36043
36635
|
}, []);
|
|
36044
|
-
const closeBubbleMenu = useCallback23(() => {
|
|
36045
|
-
suppressShowUntilRef.current = Date.now() + 1e3;
|
|
36636
|
+
const closeBubbleMenu = useCallback23((suppressShow = true) => {
|
|
36637
|
+
suppressShowUntilRef.current = suppressShow ? Date.now() + 1e3 : 0;
|
|
36046
36638
|
keepOpenRef.current = false;
|
|
36047
36639
|
setKeepOpenState(false);
|
|
36048
36640
|
setLinkInputOpen(false);
|
|
@@ -36052,7 +36644,7 @@ var CustomBubbleMenu = ({
|
|
|
36052
36644
|
showTimeoutRef.current = null;
|
|
36053
36645
|
}
|
|
36054
36646
|
}, []);
|
|
36055
|
-
|
|
36647
|
+
useEffect38(() => {
|
|
36056
36648
|
const clearShowTimeout = () => {
|
|
36057
36649
|
if (showTimeoutRef.current) {
|
|
36058
36650
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -36134,6 +36726,41 @@ var CustomBubbleMenu = ({
|
|
|
36134
36726
|
editor.off("update", updatePosition);
|
|
36135
36727
|
};
|
|
36136
36728
|
}, [editor]);
|
|
36729
|
+
useEffect38(() => {
|
|
36730
|
+
if (!isVisible) return;
|
|
36731
|
+
const handlePointerDown = (event) => {
|
|
36732
|
+
const target = event.target;
|
|
36733
|
+
if (target && (menuRef.current?.contains(target) || target.closest("[data-ueditor-keep-open]"))) return;
|
|
36734
|
+
const table = target?.closest("table");
|
|
36735
|
+
if (table && editor.view.dom.contains(table)) return;
|
|
36736
|
+
closeBubbleMenu(false);
|
|
36737
|
+
};
|
|
36738
|
+
const handleKeyDown2 = (event) => {
|
|
36739
|
+
if (event.key === "Escape") closeBubbleMenu();
|
|
36740
|
+
};
|
|
36741
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
36742
|
+
document.addEventListener("keydown", handleKeyDown2);
|
|
36743
|
+
return () => {
|
|
36744
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
36745
|
+
document.removeEventListener("keydown", handleKeyDown2);
|
|
36746
|
+
};
|
|
36747
|
+
}, [closeBubbleMenu, editor, isVisible]);
|
|
36748
|
+
useEffect38(() => {
|
|
36749
|
+
const handleTableDoubleClick = (event) => {
|
|
36750
|
+
const target = event.target;
|
|
36751
|
+
const cell = target?.closest("td,th");
|
|
36752
|
+
if (!cell || !editor.view.dom.contains(cell)) return;
|
|
36753
|
+
suppressShowUntilRef.current = 0;
|
|
36754
|
+
keepOpenRef.current = true;
|
|
36755
|
+
setKeepOpenState(true);
|
|
36756
|
+
setLinkInputOpen(false);
|
|
36757
|
+
setCellBorderOpenRequest((request) => request + 1);
|
|
36758
|
+
setIsVisible(true);
|
|
36759
|
+
requestAnimationFrame(() => editor.view.focus());
|
|
36760
|
+
};
|
|
36761
|
+
editor.view.dom.addEventListener("dblclick", handleTableDoubleClick);
|
|
36762
|
+
return () => editor.view.dom.removeEventListener("dblclick", handleTableDoubleClick);
|
|
36763
|
+
}, [editor]);
|
|
36137
36764
|
if (!isVisible) return null;
|
|
36138
36765
|
return createPortal8(
|
|
36139
36766
|
/* @__PURE__ */ jsx93(
|
|
@@ -36174,7 +36801,8 @@ var CustomBubbleMenu = ({
|
|
|
36174
36801
|
onRequestClose: closeBubbleMenu,
|
|
36175
36802
|
fontSizes,
|
|
36176
36803
|
lineHeights,
|
|
36177
|
-
initialShowLinkInput: linkInputOpen
|
|
36804
|
+
initialShowLinkInput: linkInputOpen,
|
|
36805
|
+
cellBorderOpenRequest
|
|
36178
36806
|
}
|
|
36179
36807
|
)
|
|
36180
36808
|
}
|
|
@@ -36184,9 +36812,9 @@ var CustomBubbleMenu = ({
|
|
|
36184
36812
|
};
|
|
36185
36813
|
var CustomFloatingMenu = ({ editor }) => {
|
|
36186
36814
|
const FLOATING_MENU_OFFSET = 16;
|
|
36187
|
-
const [isVisible, setIsVisible] =
|
|
36188
|
-
const [position, setPosition2] =
|
|
36189
|
-
|
|
36815
|
+
const [isVisible, setIsVisible] = useState51(false);
|
|
36816
|
+
const [position, setPosition2] = useState51({ top: 0, left: 0 });
|
|
36817
|
+
useEffect38(() => {
|
|
36190
36818
|
const updatePosition = () => {
|
|
36191
36819
|
const { state, view } = editor;
|
|
36192
36820
|
const { $from, empty } = state.selection;
|
|
@@ -36671,7 +37299,7 @@ async function prepareUEditorContentForSave({
|
|
|
36671
37299
|
}
|
|
36672
37300
|
|
|
36673
37301
|
// src/components/UEditor/table-controls.tsx
|
|
36674
|
-
import
|
|
37302
|
+
import React85 from "react";
|
|
36675
37303
|
|
|
36676
37304
|
// node_modules/prosemirror-model/dist/index.js
|
|
36677
37305
|
function findDiffStart(a, b, pos) {
|
|
@@ -40626,7 +41254,7 @@ function moveTableRow$1(table, indexesOrigin, indexesTarget, direction) {
|
|
|
40626
41254
|
rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);
|
|
40627
41255
|
return convertArrayOfRowsToTableNode(table, rows);
|
|
40628
41256
|
}
|
|
40629
|
-
function
|
|
41257
|
+
function selectedRect4(state) {
|
|
40630
41258
|
const sel = state.selection;
|
|
40631
41259
|
const $pos = selectionCell(state);
|
|
40632
41260
|
const table = $pos.node(-1);
|
|
@@ -40644,7 +41272,7 @@ function deprecated_toggleHeader(type) {
|
|
|
40644
41272
|
if (!isInTable(state)) return false;
|
|
40645
41273
|
if (dispatch) {
|
|
40646
41274
|
const types = tableNodeTypes2(state.schema);
|
|
40647
|
-
const rect =
|
|
41275
|
+
const rect = selectedRect4(state), tr = state.tr;
|
|
40648
41276
|
const cells = rect.map.cellsInRect(type == "column" ? {
|
|
40649
41277
|
left: rect.left,
|
|
40650
41278
|
top: 0,
|
|
@@ -40684,7 +41312,7 @@ function toggleHeader(type, options) {
|
|
|
40684
41312
|
if (!isInTable(state)) return false;
|
|
40685
41313
|
if (dispatch) {
|
|
40686
41314
|
const types = tableNodeTypes2(state.schema);
|
|
40687
|
-
const rect =
|
|
41315
|
+
const rect = selectedRect4(state), tr = state.tr;
|
|
40688
41316
|
const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types);
|
|
40689
41317
|
const isHeaderColumnEnabled = isHeaderEnabledByType("column", rect, types);
|
|
40690
41318
|
const selectionStartsAt = (type === "column" ? isHeaderRowEnabled : type === "row" ? isHeaderColumnEnabled : false) ? 1 : 0;
|
|
@@ -41590,17 +42218,17 @@ function getSelectedCell(editor) {
|
|
|
41590
42218
|
}
|
|
41591
42219
|
function TableControls({ editor, containerRef }) {
|
|
41592
42220
|
const t = useSmartTranslations("UEditor");
|
|
41593
|
-
const [layout, setLayout] =
|
|
41594
|
-
const [dragPreview, setDragPreview] =
|
|
41595
|
-
const [hoverState, setHoverState] =
|
|
41596
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
41597
|
-
const layoutRef =
|
|
41598
|
-
const dragStateRef =
|
|
41599
|
-
const syncFrameRef =
|
|
41600
|
-
|
|
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(() => {
|
|
41601
42229
|
layoutRef.current = layout;
|
|
41602
42230
|
}, [layout]);
|
|
41603
|
-
const syncFromCell =
|
|
42231
|
+
const syncFromCell = React85.useCallback((cell) => {
|
|
41604
42232
|
const surface = containerRef.current;
|
|
41605
42233
|
if (!surface || !cell) {
|
|
41606
42234
|
setLayout(null);
|
|
@@ -41608,23 +42236,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
41608
42236
|
}
|
|
41609
42237
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
41610
42238
|
}, [containerRef, editor]);
|
|
41611
|
-
const syncFromSelection =
|
|
42239
|
+
const syncFromSelection = React85.useCallback(() => {
|
|
41612
42240
|
syncFromCell(getSelectedCell(editor));
|
|
41613
42241
|
}, [editor, syncFromCell]);
|
|
41614
|
-
const scheduleSyncFromSelection =
|
|
42242
|
+
const scheduleSyncFromSelection = React85.useCallback(() => {
|
|
41615
42243
|
if (syncFrameRef.current !== null) return;
|
|
41616
42244
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
41617
42245
|
syncFrameRef.current = null;
|
|
41618
42246
|
syncFromSelection();
|
|
41619
42247
|
});
|
|
41620
42248
|
}, [syncFromSelection]);
|
|
41621
|
-
|
|
42249
|
+
React85.useEffect(() => () => {
|
|
41622
42250
|
if (syncFrameRef.current !== null) {
|
|
41623
42251
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
41624
42252
|
syncFrameRef.current = null;
|
|
41625
42253
|
}
|
|
41626
42254
|
}, []);
|
|
41627
|
-
const refreshCurrentLayout =
|
|
42255
|
+
const refreshCurrentLayout = React85.useCallback(() => {
|
|
41628
42256
|
setLayout((prev) => {
|
|
41629
42257
|
if (!prev) return prev;
|
|
41630
42258
|
const surface = containerRef.current;
|
|
@@ -41634,12 +42262,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
41634
42262
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
41635
42263
|
});
|
|
41636
42264
|
}, [containerRef, editor]);
|
|
41637
|
-
const clearDrag =
|
|
42265
|
+
const clearDrag = React85.useCallback(() => {
|
|
41638
42266
|
dragStateRef.current = null;
|
|
41639
42267
|
setDragPreview(null);
|
|
41640
42268
|
document.body.style.cursor = "";
|
|
41641
42269
|
}, []);
|
|
41642
|
-
const updateHoverState =
|
|
42270
|
+
const updateHoverState = React85.useCallback((event) => {
|
|
41643
42271
|
const activeLayout = layoutRef.current;
|
|
41644
42272
|
const surface = containerRef.current;
|
|
41645
42273
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -41655,7 +42283,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41655
42283
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
41656
42284
|
});
|
|
41657
42285
|
}, [containerRef]);
|
|
41658
|
-
|
|
42286
|
+
React85.useEffect(() => {
|
|
41659
42287
|
const proseMirror = editor.view.dom;
|
|
41660
42288
|
const surface = containerRef.current;
|
|
41661
42289
|
if (!surface) return void 0;
|
|
@@ -41706,37 +42334,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
41706
42334
|
editor.off("update", refreshCurrentLayout);
|
|
41707
42335
|
};
|
|
41708
42336
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
41709
|
-
const runAtCellPos =
|
|
42337
|
+
const runAtCellPos = React85.useCallback((cellPos, command, options) => {
|
|
41710
42338
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
41711
42339
|
if (options?.sync !== false) {
|
|
41712
42340
|
scheduleSyncFromSelection();
|
|
41713
42341
|
}
|
|
41714
42342
|
return result;
|
|
41715
42343
|
}, [editor, scheduleSyncFromSelection]);
|
|
41716
|
-
const runAtActiveCell =
|
|
42344
|
+
const runAtActiveCell = React85.useCallback((command, options) => {
|
|
41717
42345
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
41718
42346
|
}, [runAtCellPos]);
|
|
41719
|
-
const duplicateRowAt =
|
|
42347
|
+
const duplicateRowAt = React85.useCallback((rowIndex, cellPos) => {
|
|
41720
42348
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
41721
42349
|
scheduleSyncFromSelection();
|
|
41722
42350
|
return result;
|
|
41723
42351
|
}, [editor, scheduleSyncFromSelection]);
|
|
41724
|
-
const clearRowAt =
|
|
42352
|
+
const clearRowAt = React85.useCallback((rowIndex, cellPos) => {
|
|
41725
42353
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
41726
42354
|
scheduleSyncFromSelection();
|
|
41727
42355
|
return result;
|
|
41728
42356
|
}, [editor, scheduleSyncFromSelection]);
|
|
41729
|
-
const duplicateColumnAt =
|
|
42357
|
+
const duplicateColumnAt = React85.useCallback((columnIndex, cellPos) => {
|
|
41730
42358
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
41731
42359
|
scheduleSyncFromSelection();
|
|
41732
42360
|
return result;
|
|
41733
42361
|
}, [editor, scheduleSyncFromSelection]);
|
|
41734
|
-
const clearColumnAt =
|
|
42362
|
+
const clearColumnAt = React85.useCallback((columnIndex, cellPos) => {
|
|
41735
42363
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
41736
42364
|
scheduleSyncFromSelection();
|
|
41737
42365
|
return result;
|
|
41738
42366
|
}, [editor, scheduleSyncFromSelection]);
|
|
41739
|
-
const expandTableBy =
|
|
42367
|
+
const expandTableBy = React85.useCallback((rows, cols) => {
|
|
41740
42368
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
41741
42369
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
41742
42370
|
scheduleSyncFromSelection();
|
|
@@ -41745,19 +42373,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
41745
42373
|
const canExpandTable = Boolean(layout);
|
|
41746
42374
|
const controlsVisible = dragPreview !== null;
|
|
41747
42375
|
const tableMenuOpen = openMenuKey === "table";
|
|
41748
|
-
const startAddColumnDrag =
|
|
42376
|
+
const startAddColumnDrag = React85.useCallback(() => {
|
|
41749
42377
|
setOpenMenuKey(null);
|
|
41750
42378
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
41751
42379
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
41752
42380
|
document.body.style.cursor = "ew-resize";
|
|
41753
42381
|
}, []);
|
|
41754
|
-
const startAddRowDrag =
|
|
42382
|
+
const startAddRowDrag = React85.useCallback(() => {
|
|
41755
42383
|
setOpenMenuKey(null);
|
|
41756
42384
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
41757
42385
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
41758
42386
|
document.body.style.cursor = "ns-resize";
|
|
41759
42387
|
}, []);
|
|
41760
|
-
const startRowDrag =
|
|
42388
|
+
const startRowDrag = React85.useCallback((rowHandle) => {
|
|
41761
42389
|
setOpenMenuKey(null);
|
|
41762
42390
|
dragStateRef.current = {
|
|
41763
42391
|
kind: "row",
|
|
@@ -41774,7 +42402,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41774
42402
|
});
|
|
41775
42403
|
document.body.style.cursor = "grabbing";
|
|
41776
42404
|
}, []);
|
|
41777
|
-
const startColumnDrag =
|
|
42405
|
+
const startColumnDrag = React85.useCallback((columnHandle) => {
|
|
41778
42406
|
setOpenMenuKey(null);
|
|
41779
42407
|
dragStateRef.current = {
|
|
41780
42408
|
kind: "column",
|
|
@@ -41791,7 +42419,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41791
42419
|
});
|
|
41792
42420
|
document.body.style.cursor = "grabbing";
|
|
41793
42421
|
}, []);
|
|
41794
|
-
|
|
42422
|
+
React85.useEffect(() => {
|
|
41795
42423
|
const handleMouseMove2 = (event) => {
|
|
41796
42424
|
const dragState = dragStateRef.current;
|
|
41797
42425
|
const activeLayout = layoutRef.current;
|
|
@@ -41880,7 +42508,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41880
42508
|
window.removeEventListener("blur", clearDrag);
|
|
41881
42509
|
};
|
|
41882
42510
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
41883
|
-
const menuItems =
|
|
42511
|
+
const menuItems = React85.useMemo(() => {
|
|
41884
42512
|
if (!layout) return [];
|
|
41885
42513
|
return [
|
|
41886
42514
|
{
|
|
@@ -41948,7 +42576,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41948
42576
|
}
|
|
41949
42577
|
];
|
|
41950
42578
|
}, [editor, layout, runAtActiveCell, t]);
|
|
41951
|
-
const getRowHandleMenuItems =
|
|
42579
|
+
const getRowHandleMenuItems = React85.useCallback((rowHandle) => [
|
|
41952
42580
|
{
|
|
41953
42581
|
label: t("tableMenu.addRowBefore"),
|
|
41954
42582
|
icon: ArrowUp2,
|
|
@@ -41976,7 +42604,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
41976
42604
|
destructive: true
|
|
41977
42605
|
}
|
|
41978
42606
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
41979
|
-
const getColumnHandleMenuItems =
|
|
42607
|
+
const getColumnHandleMenuItems = React85.useCallback((columnHandle) => [
|
|
41980
42608
|
{
|
|
41981
42609
|
label: t("tableMenu.addColumnBefore"),
|
|
41982
42610
|
icon: ArrowLeft2,
|
|
@@ -42293,10 +42921,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
42293
42921
|
);
|
|
42294
42922
|
|
|
42295
42923
|
// src/components/UEditor/use-table-interactions.ts
|
|
42296
|
-
import
|
|
42924
|
+
import React87, { useEffect as useEffect39, useRef as useRef37 } from "react";
|
|
42297
42925
|
|
|
42298
42926
|
// src/components/UEditor/use-table-row-resize.ts
|
|
42299
|
-
import
|
|
42927
|
+
import React86, { useRef as useRef36 } from "react";
|
|
42300
42928
|
function useTableRowResize({
|
|
42301
42929
|
editor,
|
|
42302
42930
|
setHoveredTableCell,
|
|
@@ -42305,16 +42933,16 @@ function useTableRowResize({
|
|
|
42305
42933
|
clearAllTableResizeHover,
|
|
42306
42934
|
scheduleTableLayoutSync
|
|
42307
42935
|
}) {
|
|
42308
|
-
const stateRef =
|
|
42309
|
-
const syncActiveGuide =
|
|
42936
|
+
const stateRef = useRef36(null);
|
|
42937
|
+
const syncActiveGuide = React86.useCallback(() => {
|
|
42310
42938
|
const state = stateRef.current;
|
|
42311
42939
|
if (!state) return false;
|
|
42312
42940
|
setHoveredTableCell(state.cellElement);
|
|
42313
42941
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, state.pendingHeight);
|
|
42314
42942
|
return true;
|
|
42315
42943
|
}, [setHoveredTableCell, showRowGuide]);
|
|
42316
|
-
const isResizing =
|
|
42317
|
-
const beginResize =
|
|
42944
|
+
const isResizing = React86.useCallback(() => stateRef.current !== null, []);
|
|
42945
|
+
const beginResize = React86.useCallback((event, table, row, cell) => {
|
|
42318
42946
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
42319
42947
|
return false;
|
|
42320
42948
|
}
|
|
@@ -42340,7 +42968,7 @@ function useTableRowResize({
|
|
|
42340
42968
|
event.stopPropagation();
|
|
42341
42969
|
return true;
|
|
42342
42970
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
42343
|
-
const handlePointerMove =
|
|
42971
|
+
const handlePointerMove = React86.useCallback((event) => {
|
|
42344
42972
|
const state = stateRef.current;
|
|
42345
42973
|
if (!state) return;
|
|
42346
42974
|
const nextHeight = Math.max(
|
|
@@ -42357,7 +42985,7 @@ function useTableRowResize({
|
|
|
42357
42985
|
document.body.style.cursor = "row-resize";
|
|
42358
42986
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, nextHeight);
|
|
42359
42987
|
}, [showRowGuide]);
|
|
42360
|
-
const handlePointerUp =
|
|
42988
|
+
const handlePointerUp = React86.useCallback((event) => {
|
|
42361
42989
|
if (!editor) return;
|
|
42362
42990
|
const state = stateRef.current;
|
|
42363
42991
|
if (!state) return;
|
|
@@ -42381,7 +43009,7 @@ function useTableRowResize({
|
|
|
42381
43009
|
clearAllTableResizeHover();
|
|
42382
43010
|
scheduleTableLayoutSync();
|
|
42383
43011
|
}, [clearAllTableResizeHover, clearHoveredTableCell, editor, scheduleTableLayoutSync]);
|
|
42384
|
-
const cancelResize =
|
|
43012
|
+
const cancelResize = React86.useCallback(() => {
|
|
42385
43013
|
if (!stateRef.current) return;
|
|
42386
43014
|
stateRef.current = null;
|
|
42387
43015
|
document.body.style.cursor = "";
|
|
@@ -42389,7 +43017,7 @@ function useTableRowResize({
|
|
|
42389
43017
|
clearAllTableResizeHover();
|
|
42390
43018
|
scheduleTableLayoutSync();
|
|
42391
43019
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
42392
|
-
const cleanup =
|
|
43020
|
+
const cleanup = React86.useCallback(() => {
|
|
42393
43021
|
stateRef.current = null;
|
|
42394
43022
|
document.body.style.cursor = "";
|
|
42395
43023
|
}, []);
|
|
@@ -42406,24 +43034,24 @@ function useTableRowResize({
|
|
|
42406
43034
|
|
|
42407
43035
|
// src/components/UEditor/use-table-interactions.ts
|
|
42408
43036
|
function useUEditorTableInteractions(editor, editable = true) {
|
|
42409
|
-
const editorContentRef =
|
|
42410
|
-
const tableColumnGuideRef =
|
|
42411
|
-
const tableRowGuideRef =
|
|
42412
|
-
const activeTableCellHighlightRef =
|
|
42413
|
-
const hoveredTableCellRef =
|
|
42414
|
-
const activeTableCellRef =
|
|
42415
|
-
const suppressActiveCellHighlightRef =
|
|
42416
|
-
const tableLayoutSyncFrameRef =
|
|
42417
|
-
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(() => {
|
|
42418
43046
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
42419
43047
|
}, []);
|
|
42420
|
-
const setEditorResizeCursor =
|
|
43048
|
+
const setEditorResizeCursor = React87.useCallback((cursor) => {
|
|
42421
43049
|
const proseMirror = getProseMirrorElement();
|
|
42422
43050
|
if (proseMirror) {
|
|
42423
43051
|
proseMirror.style.cursor = cursor;
|
|
42424
43052
|
}
|
|
42425
43053
|
}, [getProseMirrorElement]);
|
|
42426
|
-
const hideColumnGuide =
|
|
43054
|
+
const hideColumnGuide = React87.useCallback(() => {
|
|
42427
43055
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
42428
43056
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
42429
43057
|
const guide = tableColumnGuideRef.current;
|
|
@@ -42431,7 +43059,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42431
43059
|
guide.style.opacity = "0";
|
|
42432
43060
|
}
|
|
42433
43061
|
}, [getProseMirrorElement]);
|
|
42434
|
-
const hideRowGuide =
|
|
43062
|
+
const hideRowGuide = React87.useCallback(() => {
|
|
42435
43063
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
42436
43064
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
42437
43065
|
const guide = tableRowGuideRef.current;
|
|
@@ -42439,12 +43067,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42439
43067
|
guide.style.opacity = "0";
|
|
42440
43068
|
}
|
|
42441
43069
|
}, [getProseMirrorElement]);
|
|
42442
|
-
const clearAllTableResizeHover =
|
|
43070
|
+
const clearAllTableResizeHover = React87.useCallback(() => {
|
|
42443
43071
|
setEditorResizeCursor("");
|
|
42444
43072
|
hideColumnGuide();
|
|
42445
43073
|
hideRowGuide();
|
|
42446
43074
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
42447
|
-
const updateActiveCellHighlight =
|
|
43075
|
+
const updateActiveCellHighlight = React87.useCallback((cell) => {
|
|
42448
43076
|
const surface = editorContentRef.current;
|
|
42449
43077
|
const highlight = activeTableCellHighlightRef.current;
|
|
42450
43078
|
if (!highlight) return;
|
|
@@ -42459,7 +43087,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42459
43087
|
highlight.style.width = `${metrics.width}px`;
|
|
42460
43088
|
highlight.style.height = `${metrics.height}px`;
|
|
42461
43089
|
}, []);
|
|
42462
|
-
const scheduleTableLayoutSync =
|
|
43090
|
+
const scheduleTableLayoutSync = React87.useCallback(() => {
|
|
42463
43091
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
42464
43092
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
42465
43093
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -42467,7 +43095,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42467
43095
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
42468
43096
|
});
|
|
42469
43097
|
}, [updateActiveCellHighlight]);
|
|
42470
|
-
const setActiveTableCell =
|
|
43098
|
+
const setActiveTableCell = React87.useCallback((cell) => {
|
|
42471
43099
|
if (activeTableCellRef.current === cell) {
|
|
42472
43100
|
updateActiveCellHighlight(cell);
|
|
42473
43101
|
return;
|
|
@@ -42475,17 +43103,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42475
43103
|
activeTableCellRef.current = cell;
|
|
42476
43104
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
42477
43105
|
}, [updateActiveCellHighlight]);
|
|
42478
|
-
const clearActiveTableCell =
|
|
43106
|
+
const clearActiveTableCell = React87.useCallback(() => {
|
|
42479
43107
|
activeTableCellRef.current = null;
|
|
42480
43108
|
updateActiveCellHighlight(null);
|
|
42481
43109
|
}, [updateActiveCellHighlight]);
|
|
42482
|
-
const setHoveredTableCell =
|
|
43110
|
+
const setHoveredTableCell = React87.useCallback((cell) => {
|
|
42483
43111
|
hoveredTableCellRef.current = cell;
|
|
42484
43112
|
}, []);
|
|
42485
|
-
const clearHoveredTableCell =
|
|
43113
|
+
const clearHoveredTableCell = React87.useCallback(() => {
|
|
42486
43114
|
hoveredTableCellRef.current = null;
|
|
42487
43115
|
}, []);
|
|
42488
|
-
const showColumnGuide =
|
|
43116
|
+
const showColumnGuide = React87.useCallback((table, row, cell) => {
|
|
42489
43117
|
const surface = editorContentRef.current;
|
|
42490
43118
|
const guide = tableColumnGuideRef.current;
|
|
42491
43119
|
if (!surface || !guide) return;
|
|
@@ -42499,7 +43127,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42499
43127
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
42500
43128
|
setEditorResizeCursor("col-resize");
|
|
42501
43129
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
42502
|
-
const showRowGuide =
|
|
43130
|
+
const showRowGuide = React87.useCallback((table, row, cell, previewHeight) => {
|
|
42503
43131
|
const surface = editorContentRef.current;
|
|
42504
43132
|
const guide = tableRowGuideRef.current;
|
|
42505
43133
|
if (!surface || !guide) return;
|
|
@@ -42531,7 +43159,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42531
43159
|
clearAllTableResizeHover,
|
|
42532
43160
|
scheduleTableLayoutSync
|
|
42533
43161
|
});
|
|
42534
|
-
const syncActiveTableCellFromSelection =
|
|
43162
|
+
const syncActiveTableCellFromSelection = React87.useCallback(() => {
|
|
42535
43163
|
if (!editor) return;
|
|
42536
43164
|
if (!editor.isFocused) {
|
|
42537
43165
|
clearActiveTableCell();
|
|
@@ -42539,7 +43167,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42539
43167
|
}
|
|
42540
43168
|
setActiveTableCell(getSelectionTableCell(editor.view));
|
|
42541
43169
|
}, [clearActiveTableCell, editor, setActiveTableCell]);
|
|
42542
|
-
|
|
43170
|
+
useEffect39(() => {
|
|
42543
43171
|
if (!editor || !editable) return void 0;
|
|
42544
43172
|
const proseMirror = editor.view.dom;
|
|
42545
43173
|
const surface = editorContentRef.current;
|
|
@@ -42714,7 +43342,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
42714
43342
|
}
|
|
42715
43343
|
|
|
42716
43344
|
// src/components/UEditor/use-formula-coordinate-overlay.ts
|
|
42717
|
-
import { useEffect as
|
|
43345
|
+
import { useEffect as useEffect40, useRef as useRef38 } from "react";
|
|
42718
43346
|
import { TableMap as TableMap6 } from "@tiptap/pm/tables";
|
|
42719
43347
|
|
|
42720
43348
|
// src/components/UEditor/table-formula-range-picker.ts
|
|
@@ -42984,8 +43612,8 @@ function createBlockedReferenceHighlight(label) {
|
|
|
42984
43612
|
return element;
|
|
42985
43613
|
}
|
|
42986
43614
|
function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
42987
|
-
const overlayRef =
|
|
42988
|
-
|
|
43615
|
+
const overlayRef = useRef38(null);
|
|
43616
|
+
useEffect40(() => {
|
|
42989
43617
|
if (!editor) return void 0;
|
|
42990
43618
|
const overlay = overlayRef.current;
|
|
42991
43619
|
const container = containerRef.current;
|
|
@@ -43192,7 +43820,7 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
43192
43820
|
}
|
|
43193
43821
|
|
|
43194
43822
|
// src/components/UEditor/menu-bar.tsx
|
|
43195
|
-
import
|
|
43823
|
+
import React88, { useMemo as useMemo26, useRef as useRef39, useState as useState52 } from "react";
|
|
43196
43824
|
import { useEditorState as useEditorState3 } from "@tiptap/react";
|
|
43197
43825
|
import {
|
|
43198
43826
|
AlignCenter as AlignCenter4,
|
|
@@ -43405,7 +44033,7 @@ function renderMenuItems(items) {
|
|
|
43405
44033
|
case "sub":
|
|
43406
44034
|
return /* @__PURE__ */ jsx99(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
43407
44035
|
case "custom":
|
|
43408
|
-
return /* @__PURE__ */ jsx99(
|
|
44036
|
+
return /* @__PURE__ */ jsx99(React88.Fragment, { children: item.render() }, item.key);
|
|
43409
44037
|
}
|
|
43410
44038
|
});
|
|
43411
44039
|
}
|
|
@@ -43781,7 +44409,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
43781
44409
|
}
|
|
43782
44410
|
];
|
|
43783
44411
|
}
|
|
43784
|
-
var MenuBarTrigger =
|
|
44412
|
+
var MenuBarTrigger = React88.forwardRef(
|
|
43785
44413
|
({ children, className, ...props }, ref) => /* @__PURE__ */ jsx99(
|
|
43786
44414
|
"button",
|
|
43787
44415
|
{
|
|
@@ -43817,13 +44445,13 @@ var MenuBar = ({
|
|
|
43817
44445
|
editor,
|
|
43818
44446
|
selector: ({ transactionNumber }) => transactionNumber
|
|
43819
44447
|
});
|
|
43820
|
-
const fileInputRef =
|
|
43821
|
-
const [showImageInput, setShowImageInput] =
|
|
43822
|
-
const [showLinkInput, setShowLinkInput] =
|
|
43823
|
-
const [isInsertMenuOpen, setIsInsertMenuOpen] =
|
|
43824
|
-
const [showSourceDialog, setShowSourceDialog] =
|
|
43825
|
-
const [sourceHtml, setSourceHtml] =
|
|
43826
|
-
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);
|
|
43827
44455
|
const previewHtml = useMemo26(
|
|
43828
44456
|
() => showPreviewDialog ? prepareUEditorPreviewHtml(editor.getHTML()) : "",
|
|
43829
44457
|
[editor, showPreviewDialog]
|
|
@@ -44113,20 +44741,20 @@ var MenuBar = ({
|
|
|
44113
44741
|
};
|
|
44114
44742
|
|
|
44115
44743
|
// src/components/UEditor/table-formula-bar.tsx
|
|
44116
|
-
import { useEffect as
|
|
44744
|
+
import { useEffect as useEffect41, useRef as useRef40, useState as useState53 } from "react";
|
|
44117
44745
|
import { useEditorState as useEditorState4 } from "@tiptap/react";
|
|
44118
44746
|
import { AlertCircle as AlertCircle5, Check as Check14, Hash as Hash2, Sigma as Sigma3, Trash2 as Trash26 } from "lucide-react";
|
|
44119
44747
|
import { jsx as jsx100, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
44120
44748
|
function TableFormulaBar({ editor }) {
|
|
44121
44749
|
const t = useSmartTranslations("UEditor");
|
|
44122
|
-
const inputRef =
|
|
44123
|
-
const [draftState, setDraftState] =
|
|
44750
|
+
const inputRef = useRef40(null);
|
|
44751
|
+
const [draftState, setDraftState] = useState53(null);
|
|
44124
44752
|
useEditorState4({
|
|
44125
44753
|
editor,
|
|
44126
44754
|
selector: ({ transactionNumber }) => transactionNumber
|
|
44127
44755
|
});
|
|
44128
44756
|
const selectedCell = getSelectedTableFormulaCell(editor);
|
|
44129
|
-
|
|
44757
|
+
useEffect41(() => {
|
|
44130
44758
|
const focusFormulaInput = () => {
|
|
44131
44759
|
inputRef.current?.focus();
|
|
44132
44760
|
};
|
|
@@ -44261,7 +44889,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44261
44889
|
|
|
44262
44890
|
// src/components/UEditor/UEditor.tsx
|
|
44263
44891
|
import { jsx as jsx101, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
44264
|
-
var UEditor =
|
|
44892
|
+
var UEditor = React90.forwardRef(({
|
|
44265
44893
|
content = "",
|
|
44266
44894
|
onChange,
|
|
44267
44895
|
onHtmlChange,
|
|
@@ -44303,14 +44931,14 @@ var UEditor = React89.forwardRef(({
|
|
|
44303
44931
|
}, ref) => {
|
|
44304
44932
|
const t = useSmartTranslations("UEditor");
|
|
44305
44933
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
44306
|
-
const inFlightPrepareRef =
|
|
44307
|
-
const lastAppliedContentRef =
|
|
44308
|
-
const scheduledFormulaRecalculateRef =
|
|
44309
|
-
const editorInstanceRef =
|
|
44310
|
-
const formulaRangePickRef =
|
|
44311
|
-
const formulaRangeSurfaceRef =
|
|
44312
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
44313
|
-
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) => {
|
|
44314
44942
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
44315
44943
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
44316
44944
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -44350,7 +44978,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44350
44978
|
],
|
|
44351
44979
|
[effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable, fetchMetadata, extraExtensions]
|
|
44352
44980
|
);
|
|
44353
|
-
const syncFormulaRangeHighlight =
|
|
44981
|
+
const syncFormulaRangeHighlight = React90.useCallback((pickState) => {
|
|
44354
44982
|
const container = formulaRangeSurfaceRef.current;
|
|
44355
44983
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
44356
44984
|
}, []);
|
|
@@ -44460,7 +45088,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44460
45088
|
scheduleFormulaRecalculate(editor2, { force: true });
|
|
44461
45089
|
}
|
|
44462
45090
|
});
|
|
44463
|
-
|
|
45091
|
+
useEffect42(() => {
|
|
44464
45092
|
editorInstanceRef.current = editor;
|
|
44465
45093
|
return () => {
|
|
44466
45094
|
if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
|
|
@@ -44501,7 +45129,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44501
45129
|
}),
|
|
44502
45130
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
44503
45131
|
);
|
|
44504
|
-
|
|
45132
|
+
useEffect42(() => {
|
|
44505
45133
|
if (!editor) return;
|
|
44506
45134
|
queueMicrotask(() => {
|
|
44507
45135
|
if (!editor.isDestroyed) {
|
|
@@ -44509,7 +45137,7 @@ var UEditor = React89.forwardRef(({
|
|
|
44509
45137
|
}
|
|
44510
45138
|
});
|
|
44511
45139
|
}, [editor]);
|
|
44512
|
-
|
|
45140
|
+
useEffect42(() => {
|
|
44513
45141
|
if (!editor) return;
|
|
44514
45142
|
const nextContent = content ?? "";
|
|
44515
45143
|
if (lastAppliedContentRef.current === nextContent) return;
|