@underverse-ui/underverse 2.0.11 → 2.0.13
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/api-reference.json +1 -1
- package/dist/{EmojiPicker-RPB24XXJ.js → EmojiPicker-FFNIUMI3.js} +4 -4
- package/dist/{chunk-K5PVUTXH.js → chunk-HEYNAGQD.js} +3 -3
- package/dist/{chunk-VDIAFUIE.js → chunk-MMMCBJ2L.js} +149 -78
- package/dist/{chunk-VDIAFUIE.js.map → chunk-MMMCBJ2L.js.map} +1 -1
- package/dist/{chunk-CKG2QLQL.js → chunk-PYC5EY5W.js} +2 -2
- package/dist/chunk-PYC5EY5W.js.map +1 -0
- package/dist/{chunk-7V65PWQN.js → chunk-R7ZKNCWR.js} +3 -3
- package/dist/{chunk-KKASHK7A.js → chunk-VNSCI3OK.js} +2 -2
- package/dist/{chunk-WNVGXH5Y.js → chunk-WDY3QWOW.js} +202 -57
- package/dist/chunk-WDY3QWOW.js.map +1 -0
- package/dist/index.cjs +340 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/{menu-bar-R5ZFI2ST.js → menu-bar-SVX36W4S.js} +7 -6
- package/dist/menu-bar-SVX36W4S.js.map +1 -0
- package/dist/ueditor.cjs +339 -125
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +5 -0
- package/dist/ueditor.d.ts +5 -0
- package/dist/ueditor.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-CKG2QLQL.js.map +0 -1
- package/dist/chunk-WNVGXH5Y.js.map +0 -1
- package/dist/menu-bar-R5ZFI2ST.js.map +0 -1
- /package/dist/{EmojiPicker-RPB24XXJ.js.map → EmojiPicker-FFNIUMI3.js.map} +0 -0
- /package/dist/{chunk-K5PVUTXH.js.map → chunk-HEYNAGQD.js.map} +0 -0
- /package/dist/{chunk-7V65PWQN.js.map → chunk-R7ZKNCWR.js.map} +0 -0
- /package/dist/{chunk-KKASHK7A.js.map → chunk-VNSCI3OK.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -84,7 +84,7 @@ var init_form_control_size = __esm({
|
|
|
84
84
|
};
|
|
85
85
|
formControlLabelClass = "font-medium";
|
|
86
86
|
formControlFixedClass = "min-h-0 overflow-hidden";
|
|
87
|
-
formControlValueClass = "
|
|
87
|
+
formControlValueClass = "flex h-full items-center min-w-0 flex-1 truncate whitespace-nowrap";
|
|
88
88
|
formControlOutlineClass = "border border-input hover:border-primary/40 focus-visible:outline-none focus-visible:border-ring";
|
|
89
89
|
formControlGroupOutlineClass = "border border-input hover:border-primary/40 focus-within:border-ring";
|
|
90
90
|
}
|
|
@@ -5848,17 +5848,60 @@ function getSelectionTableCell(view) {
|
|
|
5848
5848
|
const cell = element?.closest?.("th,td");
|
|
5849
5849
|
return cell instanceof HTMLElement ? cell : null;
|
|
5850
5850
|
}
|
|
5851
|
-
function
|
|
5851
|
+
function resolveRowResizeTarget(cell, clientX, clientY) {
|
|
5852
5852
|
const rect = cell.getBoundingClientRect();
|
|
5853
|
-
const
|
|
5854
|
-
|
|
5855
|
-
|
|
5853
|
+
const row = cell.closest("tr");
|
|
5854
|
+
if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
|
|
5855
|
+
return null;
|
|
5856
|
+
}
|
|
5857
|
+
const distToBottom = Math.abs(clientY - rect.bottom);
|
|
5858
|
+
const distToTop = Math.abs(clientY - rect.top);
|
|
5859
|
+
const distToRight = Math.abs(clientX - rect.right);
|
|
5860
|
+
const distToLeft = Math.abs(clientX - rect.left);
|
|
5861
|
+
if (distToRight <= 3 || distToLeft <= 3) {
|
|
5862
|
+
return null;
|
|
5863
|
+
}
|
|
5864
|
+
if (distToBottom <= TABLE_RESIZE_HIT_ZONE) {
|
|
5865
|
+
return { row, cell };
|
|
5866
|
+
}
|
|
5867
|
+
if (distToTop <= TABLE_RESIZE_HIT_ZONE) {
|
|
5868
|
+
const prevRow = row.previousElementSibling;
|
|
5869
|
+
if (prevRow instanceof HTMLTableRowElement) {
|
|
5870
|
+
const cellIndex = cell.cellIndex;
|
|
5871
|
+
const prevCell = prevRow.children[cellIndex] ?? prevRow.firstElementChild;
|
|
5872
|
+
if (prevCell instanceof HTMLTableCellElement) {
|
|
5873
|
+
return { row: prevRow, cell: prevCell };
|
|
5874
|
+
}
|
|
5875
|
+
}
|
|
5876
|
+
}
|
|
5877
|
+
return null;
|
|
5856
5878
|
}
|
|
5857
|
-
function
|
|
5879
|
+
function resolveColumnResizeTarget(cell, clientX, clientY) {
|
|
5858
5880
|
const rect = cell.getBoundingClientRect();
|
|
5859
|
-
const
|
|
5860
|
-
|
|
5861
|
-
|
|
5881
|
+
const row = cell.closest("tr");
|
|
5882
|
+
if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
|
|
5883
|
+
return null;
|
|
5884
|
+
}
|
|
5885
|
+
const distToRight = Math.abs(clientX - rect.right);
|
|
5886
|
+
const distToLeft = Math.abs(clientX - rect.left);
|
|
5887
|
+
const distToBottom = Math.abs(clientY - rect.bottom);
|
|
5888
|
+
const distToTop = Math.abs(clientY - rect.top);
|
|
5889
|
+
if (distToBottom <= 3 || distToTop <= 3) {
|
|
5890
|
+
return null;
|
|
5891
|
+
}
|
|
5892
|
+
if (distToRight <= TABLE_RESIZE_HIT_ZONE) {
|
|
5893
|
+
return { row, cell };
|
|
5894
|
+
}
|
|
5895
|
+
if (distToLeft <= TABLE_RESIZE_HIT_ZONE) {
|
|
5896
|
+
const prevCell = cell.previousElementSibling;
|
|
5897
|
+
if (prevCell instanceof HTMLTableCellElement) {
|
|
5898
|
+
return { row, cell: prevCell };
|
|
5899
|
+
}
|
|
5900
|
+
}
|
|
5901
|
+
return null;
|
|
5902
|
+
}
|
|
5903
|
+
function isRowResizeHotspot(cell, clientX, clientY) {
|
|
5904
|
+
return resolveRowResizeTarget(cell, clientX, clientY) !== null;
|
|
5862
5905
|
}
|
|
5863
5906
|
function getRelativeBoundaryMetrics(surface, table, row, cell) {
|
|
5864
5907
|
const surfaceRect = surface.getBoundingClientRect();
|
|
@@ -5910,7 +5953,7 @@ function getRelativeSelectedCellsMetrics(surface) {
|
|
|
5910
5953
|
height: bottom - top
|
|
5911
5954
|
};
|
|
5912
5955
|
}
|
|
5913
|
-
var DEFAULT_TABLE_ROW_HEIGHT, MIN_TABLE_ROW_HEIGHT, COLUMN_RESIZE_LINE_THICKNESS, ROW_RESIZE_LINE_THICKNESS, UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, TABLE_RESIZE_HIT_ZONE;
|
|
5956
|
+
var DEFAULT_TABLE_ROW_HEIGHT, MIN_TABLE_ROW_HEIGHT, COLUMN_RESIZE_LINE_THICKNESS, ROW_RESIZE_LINE_THICKNESS, UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, isRowResizingGlobal, TABLE_RESIZE_HIT_ZONE;
|
|
5914
5957
|
var init_table_dom_utils = __esm({
|
|
5915
5958
|
"src/components/UEditor/table-dom-utils.ts"() {
|
|
5916
5959
|
"use strict";
|
|
@@ -5918,8 +5961,9 @@ var init_table_dom_utils = __esm({
|
|
|
5918
5961
|
MIN_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
|
|
5919
5962
|
COLUMN_RESIZE_LINE_THICKNESS = 2;
|
|
5920
5963
|
ROW_RESIZE_LINE_THICKNESS = 2;
|
|
5921
|
-
UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor
|
|
5922
|
-
|
|
5964
|
+
UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor:table-layout-change";
|
|
5965
|
+
isRowResizingGlobal = { active: false };
|
|
5966
|
+
TABLE_RESIZE_HIT_ZONE = 5;
|
|
5923
5967
|
}
|
|
5924
5968
|
});
|
|
5925
5969
|
|
|
@@ -6629,6 +6673,18 @@ var init_colors = __esm({
|
|
|
6629
6673
|
const automaticColor = colors[0]?.color ?? "";
|
|
6630
6674
|
const paletteColors = colors.slice(1);
|
|
6631
6675
|
const customColorSelect = onCustomColorSelect ?? onSelect;
|
|
6676
|
+
const [hexInput, setHexInput] = import_react71.default.useState(currentColor.startsWith("#") ? currentColor : "");
|
|
6677
|
+
import_react71.default.useEffect(() => {
|
|
6678
|
+
setHexInput(currentColor.startsWith("#") ? currentColor : "");
|
|
6679
|
+
}, [currentColor]);
|
|
6680
|
+
const commitHex = (val) => {
|
|
6681
|
+
let formatted = val.trim();
|
|
6682
|
+
if (!formatted) return;
|
|
6683
|
+
if (!formatted.startsWith("#")) formatted = `#${formatted}`;
|
|
6684
|
+
if (/^#([0-9A-F]{3}){1,2}$/i.test(formatted)) {
|
|
6685
|
+
customColorSelect(formatted);
|
|
6686
|
+
}
|
|
6687
|
+
};
|
|
6632
6688
|
import_react71.default.useEffect(() => {
|
|
6633
6689
|
const input = colorInputRef.current;
|
|
6634
6690
|
if (!input) return;
|
|
@@ -6640,7 +6696,7 @@ var init_colors = __esm({
|
|
|
6640
6696
|
const input = colorInputRef.current;
|
|
6641
6697
|
if (input) input.value = currentColor.startsWith("#") ? currentColor : "#000000";
|
|
6642
6698
|
}, [currentColor]);
|
|
6643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "w-56 p-2", children: [
|
|
6699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "w-56 p-2", "data-ueditor-keep-open": true, children: [
|
|
6644
6700
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
6645
6701
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
6646
6702
|
"button",
|
|
@@ -6674,29 +6730,48 @@ var init_colors = __esm({
|
|
|
6674
6730
|
children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Check, { className: cn("h-3.5 w-3.5", getSwatchCheckClass(c.color)) }) })
|
|
6675
6731
|
}
|
|
6676
6732
|
) }, `${c.name}-${c.color}`)) }),
|
|
6677
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
6678
|
-
"
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6733
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
6734
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex h-8 flex-1 items-center gap-1.5 rounded-md border border-input bg-muted/30 px-2", children: [
|
|
6735
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6736
|
+
"span",
|
|
6737
|
+
{
|
|
6738
|
+
className: "h-4 w-4 shrink-0 rounded-[2px] border border-border",
|
|
6739
|
+
style: { backgroundColor: hexInput.startsWith("#") ? hexInput : currentColor.startsWith("#") ? currentColor : "transparent" }
|
|
6740
|
+
}
|
|
6741
|
+
),
|
|
6742
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6743
|
+
"input",
|
|
6744
|
+
{
|
|
6745
|
+
type: "text",
|
|
6746
|
+
value: hexInput,
|
|
6747
|
+
onChange: (e) => setHexInput(e.target.value),
|
|
6748
|
+
onBlur: () => commitHex(hexInput),
|
|
6749
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
6750
|
+
onClick: (e) => e.stopPropagation(),
|
|
6751
|
+
onKeyDown: (e) => {
|
|
6752
|
+
e.stopPropagation();
|
|
6753
|
+
if (e.key === "Enter") {
|
|
6754
|
+
e.preventDefault();
|
|
6755
|
+
commitHex(hexInput);
|
|
6692
6756
|
}
|
|
6693
|
-
}
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
}
|
|
6699
|
-
|
|
6757
|
+
},
|
|
6758
|
+
placeholder: "#HEX",
|
|
6759
|
+
className: "h-full w-full bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground"
|
|
6760
|
+
}
|
|
6761
|
+
)
|
|
6762
|
+
] }),
|
|
6763
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6764
|
+
"button",
|
|
6765
|
+
{
|
|
6766
|
+
type: "button",
|
|
6767
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
6768
|
+
onClick: () => colorInputRef.current?.click(),
|
|
6769
|
+
title: t("colors.moreColors"),
|
|
6770
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-input bg-muted/30 text-foreground transition-colors hover:bg-muted",
|
|
6771
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Palette, { className: "h-4 w-4 text-muted-foreground" })
|
|
6772
|
+
}
|
|
6773
|
+
)
|
|
6774
|
+
] }),
|
|
6700
6775
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
6701
6776
|
"input",
|
|
6702
6777
|
{
|
|
@@ -7270,7 +7345,7 @@ var init_toolbar = __esm({
|
|
|
7270
7345
|
return button;
|
|
7271
7346
|
});
|
|
7272
7347
|
ToolbarButton.displayName = "ToolbarButton";
|
|
7273
|
-
ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-1
|
|
7348
|
+
ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-1 h-5 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
|
|
7274
7349
|
TableInsertGrid = ({
|
|
7275
7350
|
insertLabel,
|
|
7276
7351
|
previewTemplate,
|
|
@@ -7315,6 +7390,7 @@ var init_toolbar = __esm({
|
|
|
7315
7390
|
maxImageFileSize = DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
|
|
7316
7391
|
allowedImageMimeTypes = DEFAULT_UEDITOR_IMAGE_MIME_TYPES,
|
|
7317
7392
|
fontFamilies,
|
|
7393
|
+
defaultFontFamily = "Inter",
|
|
7318
7394
|
fontSizes,
|
|
7319
7395
|
lineHeights,
|
|
7320
7396
|
letterSpacings
|
|
@@ -7357,9 +7433,9 @@ var init_toolbar = __esm({
|
|
|
7357
7433
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
|
|
7358
7434
|
const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
|
|
7359
7435
|
const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
|
|
7360
|
-
const
|
|
7361
|
-
const defaultFontFamilyValue =
|
|
7362
|
-
const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel :
|
|
7436
|
+
const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
|
|
7437
|
+
const defaultFontFamilyValue = defaultFontFamilyOption?.value ?? defaultFontFamily ?? "Inter";
|
|
7438
|
+
const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel : defaultFontFamilyOption?.label ?? defaultFontFamily ?? t("toolbar.fontDefault");
|
|
7363
7439
|
const displayedFontFamilyValue = currentFontFamily || defaultFontFamilyValue;
|
|
7364
7440
|
const displayedFontSizeLabel = currentFontSize ? currentFontSizeLabel : "13";
|
|
7365
7441
|
const activeFontSize = currentFontSize || "13px";
|
|
@@ -7491,7 +7567,7 @@ var init_toolbar = __esm({
|
|
|
7491
7567
|
"div",
|
|
7492
7568
|
{
|
|
7493
7569
|
role: "toolbar",
|
|
7494
|
-
className: "flex min-h-
|
|
7570
|
+
className: "flex min-h-9 flex-nowrap items-center gap-0.5 overflow-x-auto border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-1.5 py-1 dark:bg-muted/60",
|
|
7495
7571
|
children: [
|
|
7496
7572
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7497
7573
|
DropdownMenu,
|
|
@@ -7502,9 +7578,9 @@ var init_toolbar = __esm({
|
|
|
7502
7578
|
onClick: () => {
|
|
7503
7579
|
},
|
|
7504
7580
|
title: t("toolbar.fontFamily"),
|
|
7505
|
-
className: "h-
|
|
7581
|
+
className: "h-7 w-40 max-w-40 justify-between gap-1.5 border border-[rgba(196,197,213,0.6)] bg-white px-2 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
|
|
7506
7582
|
children: [
|
|
7507
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-
|
|
7583
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-xs font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
|
|
7508
7584
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
7509
7585
|
]
|
|
7510
7586
|
}
|
|
@@ -7531,9 +7607,9 @@ var init_toolbar = __esm({
|
|
|
7531
7607
|
onClick: () => {
|
|
7532
7608
|
},
|
|
7533
7609
|
title: t("toolbar.fontSize"),
|
|
7534
|
-
className: "h-
|
|
7610
|
+
className: "h-7 w-14 justify-between gap-1 border border-[rgba(196,197,213,0.6)] bg-white px-2 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
|
|
7535
7611
|
children: [
|
|
7536
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-
|
|
7612
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
|
|
7537
7613
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
7538
7614
|
]
|
|
7539
7615
|
}
|
|
@@ -7658,6 +7734,27 @@ var init_toolbar = __esm({
|
|
|
7658
7734
|
)
|
|
7659
7735
|
] }),
|
|
7660
7736
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
7737
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7738
|
+
DropdownMenu,
|
|
7739
|
+
{
|
|
7740
|
+
isOpen: isTableMenuOpen,
|
|
7741
|
+
onOpenChange: setIsTableMenuOpen,
|
|
7742
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
7743
|
+
}, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
|
|
7744
|
+
contentClassName: "p-2 min-w-56",
|
|
7745
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
7746
|
+
TableInsertGrid,
|
|
7747
|
+
{
|
|
7748
|
+
insertLabel: t("tableMenu.insertTable"),
|
|
7749
|
+
previewTemplate: t("tableMenu.gridPreview"),
|
|
7750
|
+
onInsert: (rows, cols) => {
|
|
7751
|
+
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
7752
|
+
setIsTableMenuOpen(false);
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7755
|
+
)
|
|
7756
|
+
}
|
|
7757
|
+
),
|
|
7661
7758
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaBoldIcon, { className: "h-4 w-4" }) }),
|
|
7662
7759
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaItalicIcon, { className: "h-4 w-4" }) }),
|
|
7663
7760
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -8128,27 +8225,6 @@ var init_toolbar = __esm({
|
|
|
8128
8225
|
] })
|
|
8129
8226
|
}
|
|
8130
8227
|
),
|
|
8131
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
8132
|
-
DropdownMenu,
|
|
8133
|
-
{
|
|
8134
|
-
isOpen: isTableMenuOpen,
|
|
8135
|
-
onOpenChange: setIsTableMenuOpen,
|
|
8136
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
8137
|
-
}, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
|
|
8138
|
-
contentClassName: "p-2 min-w-56",
|
|
8139
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
8140
|
-
TableInsertGrid,
|
|
8141
|
-
{
|
|
8142
|
-
insertLabel: t("tableMenu.insertTable"),
|
|
8143
|
-
previewTemplate: t("tableMenu.gridPreview"),
|
|
8144
|
-
onInsert: (rows, cols) => {
|
|
8145
|
-
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
8146
|
-
setIsTableMenuOpen(false);
|
|
8147
|
-
}
|
|
8148
|
-
}
|
|
8149
|
-
)
|
|
8150
|
-
}
|
|
8151
|
-
),
|
|
8152
8228
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
8153
8229
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaUndoIcon, { className: "h-4 w-4" }) }),
|
|
8154
8230
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaRedoIcon, { className: "h-4 w-4" }) }),
|
|
@@ -8347,7 +8423,7 @@ var init_editor_styles = __esm({
|
|
|
8347
8423
|
"[&_.selectedCell]:after:absolute",
|
|
8348
8424
|
"[&_.selectedCell]:after:inset-0",
|
|
8349
8425
|
"[&_.selectedCell]:after:z-[2]",
|
|
8350
|
-
"[&_.selectedCell]:after:bg-primary/
|
|
8426
|
+
"[&_.selectedCell]:after:bg-primary/8",
|
|
8351
8427
|
"[&_.selectedCell]:after:pointer-events-none",
|
|
8352
8428
|
"[&_.column-resize-handle]:pointer-events-auto",
|
|
8353
8429
|
"[&_.column-resize-handle]:cursor-col-resize",
|
|
@@ -8361,17 +8437,10 @@ var init_editor_styles = __esm({
|
|
|
8361
8437
|
"[&_.column-resize-handle]:rounded-none",
|
|
8362
8438
|
"[&_.column-resize-handle]:opacity-0",
|
|
8363
8439
|
"[&_.column-resize-handle]:transition-opacity",
|
|
8364
|
-
"[&_.column-resize-handle]:
|
|
8365
|
-
"[&_.column-resize-handle]:
|
|
8366
|
-
"[&_.column-resize-handle]:
|
|
8367
|
-
"[&_.column-resize-handle]:after:
|
|
8368
|
-
"[&_.column-resize-handle]:after:w-0.5",
|
|
8369
|
-
"[&_.column-resize-handle]:after:-translate-x-1/2",
|
|
8370
|
-
"[&_.column-resize-handle]:after:rounded-full",
|
|
8371
|
-
"[&_.column-resize-handle]:after:bg-primary/75",
|
|
8372
|
-
"[&_.column-resize-handle]:after:content-['']",
|
|
8373
|
-
"[&.resize-cursor_.column-resize-handle]:opacity-100",
|
|
8374
|
-
"[&.resize-cursor_.column-resize-handle]:after:bg-primary",
|
|
8440
|
+
"[&_.column-resize-handle]:duration-200",
|
|
8441
|
+
"[&_.column-resize-handle]:delay-100",
|
|
8442
|
+
"[&_.column-resize-handle]:ease-out",
|
|
8443
|
+
"[&_.column-resize-handle]:after:hidden",
|
|
8375
8444
|
"[&_.column-resize-dragging]:min-w-0",
|
|
8376
8445
|
"[&.resize-cursor]:cursor-col-resize",
|
|
8377
8446
|
"[&.resize-row-cursor]:cursor-row-resize",
|
|
@@ -9046,7 +9115,8 @@ var init_menu_bar = __esm({
|
|
|
9046
9115
|
onSave,
|
|
9047
9116
|
onExport,
|
|
9048
9117
|
onSourceCode,
|
|
9049
|
-
onPreview
|
|
9118
|
+
onPreview,
|
|
9119
|
+
showPreviewButton = true
|
|
9050
9120
|
}) => {
|
|
9051
9121
|
const t = useSmartTranslations("UEditor");
|
|
9052
9122
|
useSharedEditorUiRenderState(editor);
|
|
@@ -9255,7 +9325,7 @@ var init_menu_bar = __esm({
|
|
|
9255
9325
|
},
|
|
9256
9326
|
key
|
|
9257
9327
|
)),
|
|
9258
|
-
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
9328
|
+
showPreviewButton && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
9259
9329
|
"button",
|
|
9260
9330
|
{
|
|
9261
9331
|
type: "button",
|
|
@@ -36473,6 +36543,15 @@ function edgeCell(view, event, side, handleWidth) {
|
|
|
36473
36543
|
const index = map.map.indexOf($cell.pos - start);
|
|
36474
36544
|
return index % map.width === 0 ? -1 : start + map.map[index - 1];
|
|
36475
36545
|
}
|
|
36546
|
+
var handleHoverTimer = null;
|
|
36547
|
+
var pendingHandleCell = -1;
|
|
36548
|
+
function clearHandleHoverTimer() {
|
|
36549
|
+
if (handleHoverTimer !== null) {
|
|
36550
|
+
window.clearTimeout(handleHoverTimer);
|
|
36551
|
+
handleHoverTimer = null;
|
|
36552
|
+
}
|
|
36553
|
+
pendingHandleCell = -1;
|
|
36554
|
+
}
|
|
36476
36555
|
function updateHandle(view, value) {
|
|
36477
36556
|
view.dispatch(view.state.tr.setMeta(import_tables2.columnResizingPluginKey, { setHandle: value }));
|
|
36478
36557
|
}
|
|
@@ -36487,19 +36566,43 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
36487
36566
|
if (event.clientX - left <= handleWidth) cell = edgeCell(view, event, "left", handleWidth);
|
|
36488
36567
|
else if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, "right", handleWidth);
|
|
36489
36568
|
}
|
|
36490
|
-
if (cell === pluginState.activeHandle)
|
|
36491
|
-
|
|
36569
|
+
if (cell === pluginState.activeHandle) {
|
|
36570
|
+
clearHandleHoverTimer();
|
|
36571
|
+
return;
|
|
36572
|
+
}
|
|
36573
|
+
if (cell === -1) {
|
|
36574
|
+
clearHandleHoverTimer();
|
|
36575
|
+
if (pluginState.activeHandle !== -1) {
|
|
36576
|
+
updateHandle(view, -1);
|
|
36577
|
+
}
|
|
36578
|
+
return;
|
|
36579
|
+
}
|
|
36580
|
+
if (!lastColumnResizable) {
|
|
36492
36581
|
const $cell = view.state.doc.resolve(cell);
|
|
36493
36582
|
const table = $cell.node(-1);
|
|
36494
36583
|
const map = import_tables2.TableMap.get(table);
|
|
36495
36584
|
const tableStart = $cell.start(-1);
|
|
36496
36585
|
const nodeAfter = $cell.nodeAfter;
|
|
36497
36586
|
if (!nodeAfter) return;
|
|
36498
|
-
if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1)
|
|
36587
|
+
if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) {
|
|
36588
|
+
clearHandleHoverTimer();
|
|
36589
|
+
if (pluginState.activeHandle !== -1) {
|
|
36590
|
+
updateHandle(view, -1);
|
|
36591
|
+
}
|
|
36592
|
+
return;
|
|
36593
|
+
}
|
|
36499
36594
|
}
|
|
36500
|
-
|
|
36595
|
+
if (pendingHandleCell === cell) return;
|
|
36596
|
+
clearHandleHoverTimer();
|
|
36597
|
+
pendingHandleCell = cell;
|
|
36598
|
+
handleHoverTimer = window.setTimeout(() => {
|
|
36599
|
+
handleHoverTimer = null;
|
|
36600
|
+
pendingHandleCell = -1;
|
|
36601
|
+
updateHandle(view, cell);
|
|
36602
|
+
}, 100);
|
|
36501
36603
|
}
|
|
36502
36604
|
function handleMouseLeave(view) {
|
|
36605
|
+
clearHandleHoverTimer();
|
|
36503
36606
|
if (!view.editable) return;
|
|
36504
36607
|
const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
|
|
36505
36608
|
if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) {
|
|
@@ -36548,7 +36651,7 @@ function getColumnResizeGhost(view) {
|
|
|
36548
36651
|
ghost.style.pointerEvents = "none";
|
|
36549
36652
|
ghost.style.width = "2px";
|
|
36550
36653
|
ghost.style.backgroundColor = "var(--primary, #2563eb)";
|
|
36551
|
-
ghost.style.opacity = "
|
|
36654
|
+
ghost.style.opacity = "0.5";
|
|
36552
36655
|
ghost.style.borderRadius = "9999px";
|
|
36553
36656
|
ghost.style.boxShadow = "0 0 0 1px color-mix(in oklch, var(--background, #fff) 80%, transparent)";
|
|
36554
36657
|
ghost.style.transform = "translateX(-1px)";
|
|
@@ -36577,6 +36680,7 @@ function showColumnResizeGhost(view, cell, dragging, width) {
|
|
|
36577
36680
|
ghost.style.height = `${rect.height}px`;
|
|
36578
36681
|
}
|
|
36579
36682
|
function handleMouseDown(view, event, cellMinWidth) {
|
|
36683
|
+
clearHandleHoverTimer();
|
|
36580
36684
|
if (!view.editable) return false;
|
|
36581
36685
|
const win = view.dom.ownerDocument.defaultView ?? window;
|
|
36582
36686
|
const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
|
|
@@ -36698,6 +36802,7 @@ function dynamicColumnResizing({
|
|
|
36698
36802
|
|
|
36699
36803
|
// src/components/UEditor/table-align.ts
|
|
36700
36804
|
init_table_align_utils();
|
|
36805
|
+
init_table_dom_utils();
|
|
36701
36806
|
function normalizeTableAlign(value) {
|
|
36702
36807
|
if (value === "left" || value === "center" || value === "right") {
|
|
36703
36808
|
return value;
|
|
@@ -36824,6 +36929,38 @@ var UEditorTable = import_extension_table.Table.extend({
|
|
|
36824
36929
|
lastColumnResizable: this.options.lastColumnResizable
|
|
36825
36930
|
})
|
|
36826
36931
|
] : [],
|
|
36932
|
+
new import_state7.Plugin({
|
|
36933
|
+
key: new import_state7.PluginKey("tableRowResizeInterceptor"),
|
|
36934
|
+
props: {
|
|
36935
|
+
handleDOMEvents: {
|
|
36936
|
+
mousedown(view, event) {
|
|
36937
|
+
if (event.button !== 0) return false;
|
|
36938
|
+
const target = resolveEventElement(event.target);
|
|
36939
|
+
const cell = target?.closest("th,td");
|
|
36940
|
+
if (cell instanceof HTMLElement && isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
36941
|
+
isRowResizingGlobal.active = true;
|
|
36942
|
+
return true;
|
|
36943
|
+
}
|
|
36944
|
+
return false;
|
|
36945
|
+
},
|
|
36946
|
+
mousemove(_view, event) {
|
|
36947
|
+
if (isRowResizingGlobal.active) {
|
|
36948
|
+
if (event.buttons === 0) {
|
|
36949
|
+
isRowResizingGlobal.active = false;
|
|
36950
|
+
return false;
|
|
36951
|
+
}
|
|
36952
|
+
event.preventDefault();
|
|
36953
|
+
return true;
|
|
36954
|
+
}
|
|
36955
|
+
return false;
|
|
36956
|
+
},
|
|
36957
|
+
mouseup() {
|
|
36958
|
+
isRowResizingGlobal.active = false;
|
|
36959
|
+
return false;
|
|
36960
|
+
}
|
|
36961
|
+
}
|
|
36962
|
+
}
|
|
36963
|
+
}),
|
|
36827
36964
|
(0, import_tables3.tableEditing)({
|
|
36828
36965
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
36829
36966
|
}),
|
|
@@ -38672,8 +38809,11 @@ function buildUEditorExtensions({
|
|
|
38672
38809
|
placeholder,
|
|
38673
38810
|
emptyEditorClass: "is-editor-empty",
|
|
38674
38811
|
emptyNodeClass: "is-empty",
|
|
38675
|
-
shouldShow: ({ node, hasTable }) => {
|
|
38812
|
+
shouldShow: ({ editor, node, hasTable, isEmptyDoc }) => {
|
|
38676
38813
|
const nodeName = node.type.name;
|
|
38814
|
+
if (!isEmptyDoc || editor.state.doc.childCount !== 1) {
|
|
38815
|
+
return false;
|
|
38816
|
+
}
|
|
38677
38817
|
if (nodeName === "table" || nodeName === "tableCell" || nodeName === "tableHeader") {
|
|
38678
38818
|
return false;
|
|
38679
38819
|
}
|
|
@@ -39980,7 +40120,11 @@ var CustomBubbleMenu = ({
|
|
|
39980
40120
|
setIsVisible(false);
|
|
39981
40121
|
return;
|
|
39982
40122
|
}
|
|
39983
|
-
|
|
40123
|
+
const isInputFocused = () => {
|
|
40124
|
+
const active = document.activeElement;
|
|
40125
|
+
return Boolean(active && (menuRef.current?.contains(active) || active.closest?.("[data-ueditor-keep-open]")));
|
|
40126
|
+
};
|
|
40127
|
+
if (!keepOpenRef.current && !isInputFocused() && (context2 === "none" || !view.hasFocus())) {
|
|
39984
40128
|
clearShowTimeout();
|
|
39985
40129
|
setIsVisible(false);
|
|
39986
40130
|
return;
|
|
@@ -40021,7 +40165,8 @@ var CustomBubbleMenu = ({
|
|
|
40021
40165
|
}, SHOW_DELAY_MS);
|
|
40022
40166
|
};
|
|
40023
40167
|
const handleBlur = () => {
|
|
40024
|
-
|
|
40168
|
+
const isInputFocused = Boolean(document.activeElement && (menuRef.current?.contains(document.activeElement) || document.activeElement.closest?.("[data-ueditor-keep-open]")));
|
|
40169
|
+
if (!keepOpenRef.current && !isInputFocused) {
|
|
40025
40170
|
clearShowTimeout();
|
|
40026
40171
|
setIsVisible(false);
|
|
40027
40172
|
}
|
|
@@ -40115,6 +40260,9 @@ var CustomBubbleMenu = ({
|
|
|
40115
40260
|
} else if (target?.closest?.("[data-ueditor-keep-open]")) {
|
|
40116
40261
|
setKeepOpen(true);
|
|
40117
40262
|
}
|
|
40263
|
+
if (target && target.closest("input, textarea, select")) {
|
|
40264
|
+
return;
|
|
40265
|
+
}
|
|
40118
40266
|
e.preventDefault();
|
|
40119
40267
|
},
|
|
40120
40268
|
children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
@@ -43688,7 +43836,7 @@ function createKey(name) {
|
|
|
43688
43836
|
keys[name] = 0;
|
|
43689
43837
|
return name + "$";
|
|
43690
43838
|
}
|
|
43691
|
-
var
|
|
43839
|
+
var PluginKey7 = class {
|
|
43692
43840
|
/**
|
|
43693
43841
|
Create a plugin key.
|
|
43694
43842
|
*/
|
|
@@ -44120,7 +44268,7 @@ function tableNodeTypes2(schema) {
|
|
|
44120
44268
|
}
|
|
44121
44269
|
return result;
|
|
44122
44270
|
}
|
|
44123
|
-
var tableEditingKey = new
|
|
44271
|
+
var tableEditingKey = new PluginKey7("selectingCells");
|
|
44124
44272
|
function cellAround2($pos) {
|
|
44125
44273
|
for (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == "row") return $pos.node(0).resolve($pos.before(d + 1));
|
|
44126
44274
|
return null;
|
|
@@ -44351,7 +44499,7 @@ var CellBookmark = class CellBookmark2 {
|
|
|
44351
44499
|
else return Selection.near($headCell, 1);
|
|
44352
44500
|
}
|
|
44353
44501
|
};
|
|
44354
|
-
var fixTablesKey = new
|
|
44502
|
+
var fixTablesKey = new PluginKey7("fix-tables");
|
|
44355
44503
|
function convertTableNodeToArrayOfRows(tableNode) {
|
|
44356
44504
|
const map = TableMap4.get(tableNode);
|
|
44357
44505
|
const rows = [];
|
|
@@ -44829,7 +44977,7 @@ function atEndOfCell(view, axis, dir) {
|
|
|
44829
44977
|
}
|
|
44830
44978
|
return null;
|
|
44831
44979
|
}
|
|
44832
|
-
var columnResizingPluginKey2 = new
|
|
44980
|
+
var columnResizingPluginKey2 = new PluginKey7("tableColumnResizing");
|
|
44833
44981
|
|
|
44834
44982
|
// src/components/UEditor/table-controls.tsx
|
|
44835
44983
|
var import_lucide_react57 = require("lucide-react");
|
|
@@ -45278,6 +45426,8 @@ init_Tooltip();
|
|
|
45278
45426
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
45279
45427
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
45280
45428
|
var ADD_ROW_RAIL_GAP = 4;
|
|
45429
|
+
var BUTTON_LONG_SIZE = 36;
|
|
45430
|
+
var BUTTON_SHORT_SIZE = 14;
|
|
45281
45431
|
function TableAddRails({
|
|
45282
45432
|
addColumnVisible,
|
|
45283
45433
|
addRowVisible,
|
|
@@ -45290,10 +45440,10 @@ function TableAddRails({
|
|
|
45290
45440
|
quickAddRowLabel
|
|
45291
45441
|
}) {
|
|
45292
45442
|
const visibleBounds = getVisibleTableBounds(layout);
|
|
45293
|
-
const columnRailTop = visibleBounds.top;
|
|
45443
|
+
const columnRailTop = visibleBounds.top + Math.max(0, (visibleBounds.height - BUTTON_LONG_SIZE) / 2);
|
|
45294
45444
|
const columnRailLeft = visibleBounds.right + ADD_COLUMN_RAIL_GAP;
|
|
45295
45445
|
const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
|
|
45296
|
-
const rowRailLeft = visibleBounds.left;
|
|
45446
|
+
const rowRailLeft = visibleBounds.left + Math.max(0, (visibleBounds.width - BUTTON_LONG_SIZE) / 2);
|
|
45297
45447
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
45298
45448
|
const showRowRail = controlsVisible || addRowVisible;
|
|
45299
45449
|
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
@@ -45318,15 +45468,15 @@ function TableAddRails({
|
|
|
45318
45468
|
className: cn(
|
|
45319
45469
|
"absolute z-30 inline-flex items-center justify-center rounded-md",
|
|
45320
45470
|
"border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
|
|
45321
|
-
"transition-[opacity,transform,colors] duration-
|
|
45471
|
+
"transition-[opacity,transform,colors] duration-200 delay-100 ease-out cursor-pointer hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
|
|
45322
45472
|
),
|
|
45323
45473
|
style: {
|
|
45324
|
-
top:
|
|
45474
|
+
top: columnRailTop,
|
|
45325
45475
|
left: columnRailLeft,
|
|
45326
|
-
width:
|
|
45327
|
-
height:
|
|
45476
|
+
width: BUTTON_SHORT_SIZE,
|
|
45477
|
+
height: BUTTON_LONG_SIZE,
|
|
45328
45478
|
opacity: showColumnRail ? 1 : 0,
|
|
45329
|
-
transform: showColumnRail ? "scale(1)" : "scale(0.
|
|
45479
|
+
transform: showColumnRail ? "scale(1)" : "scale(0.85)",
|
|
45330
45480
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
45331
45481
|
},
|
|
45332
45482
|
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
@@ -45355,15 +45505,15 @@ function TableAddRails({
|
|
|
45355
45505
|
className: cn(
|
|
45356
45506
|
"absolute z-30 inline-flex items-center justify-center rounded-md",
|
|
45357
45507
|
"border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
|
|
45358
|
-
"transition-[opacity,transform,colors] duration-
|
|
45508
|
+
"transition-[opacity,transform,colors] duration-200 delay-100 ease-out cursor-pointer hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
|
|
45359
45509
|
),
|
|
45360
45510
|
style: {
|
|
45361
45511
|
top: rowRailTop,
|
|
45362
|
-
left:
|
|
45363
|
-
width:
|
|
45364
|
-
height:
|
|
45512
|
+
left: rowRailLeft,
|
|
45513
|
+
width: BUTTON_LONG_SIZE,
|
|
45514
|
+
height: BUTTON_SHORT_SIZE,
|
|
45365
45515
|
opacity: showRowRail ? 1 : 0,
|
|
45366
|
-
transform: showRowRail ? "scale(1)" : "scale(0.
|
|
45516
|
+
transform: showRowRail ? "scale(1)" : "scale(0.85)",
|
|
45367
45517
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
45368
45518
|
},
|
|
45369
45519
|
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
@@ -45500,7 +45650,7 @@ function TableRowHandles({
|
|
|
45500
45650
|
onStartDrag(rowHandle);
|
|
45501
45651
|
},
|
|
45502
45652
|
className: cn(
|
|
45503
|
-
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-
|
|
45653
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-200 delay-100 ease-out",
|
|
45504
45654
|
visible ? "border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-foreground cursor-grab active:cursor-grabbing" : "border-transparent bg-transparent cursor-pointer"
|
|
45505
45655
|
),
|
|
45506
45656
|
style: {
|
|
@@ -45575,7 +45725,7 @@ function TableColumnHandles({
|
|
|
45575
45725
|
onStartDrag(columnHandle);
|
|
45576
45726
|
},
|
|
45577
45727
|
className: cn(
|
|
45578
|
-
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-
|
|
45728
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-200 delay-100 ease-out",
|
|
45579
45729
|
visible ? "border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-foreground cursor-grab active:cursor-grabbing" : "border-transparent bg-transparent cursor-pointer"
|
|
45580
45730
|
),
|
|
45581
45731
|
style: {
|
|
@@ -45964,7 +46114,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
45964
46114
|
const updateHoverState = import_react77.default.useCallback((event) => {
|
|
45965
46115
|
const activeLayout = layoutRef.current;
|
|
45966
46116
|
const surface = containerRef.current;
|
|
45967
|
-
if (!activeLayout || !surface || dragStateRef.current) {
|
|
46117
|
+
if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
|
|
45968
46118
|
setHoverState(DEFAULT_TABLE_HOVER_STATE);
|
|
45969
46119
|
return;
|
|
45970
46120
|
}
|
|
@@ -46098,7 +46248,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
46098
46248
|
return result;
|
|
46099
46249
|
}, [editor, scheduleSyncFromSelection]);
|
|
46100
46250
|
const canExpandTable = Boolean(layout);
|
|
46101
|
-
const controlsVisible =
|
|
46251
|
+
const controlsVisible = false;
|
|
46102
46252
|
const tableMenuOpen = openMenuKey === "table";
|
|
46103
46253
|
const startTableResize = import_react77.default.useCallback((event) => {
|
|
46104
46254
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
@@ -46625,6 +46775,9 @@ function useTableRowResize({
|
|
|
46625
46775
|
pendingHeight: startHeight
|
|
46626
46776
|
};
|
|
46627
46777
|
showRowGuide(table, row, cell, startHeight);
|
|
46778
|
+
isRowResizingGlobal.active = true;
|
|
46779
|
+
window.getSelection()?.removeAllRanges();
|
|
46780
|
+
document.body.style.userSelect = "none";
|
|
46628
46781
|
document.body.style.cursor = "row-resize";
|
|
46629
46782
|
event.preventDefault();
|
|
46630
46783
|
event.stopPropagation();
|
|
@@ -46666,6 +46819,8 @@ function useTableRowResize({
|
|
|
46666
46819
|
editor.view.dispatch(tr);
|
|
46667
46820
|
}
|
|
46668
46821
|
stateRef.current = null;
|
|
46822
|
+
isRowResizingGlobal.active = false;
|
|
46823
|
+
document.body.style.userSelect = "";
|
|
46669
46824
|
document.body.style.cursor = "";
|
|
46670
46825
|
clearHoveredTableCell();
|
|
46671
46826
|
clearAllTableResizeHover();
|
|
@@ -46674,6 +46829,8 @@ function useTableRowResize({
|
|
|
46674
46829
|
const cancelResize = import_react78.default.useCallback(() => {
|
|
46675
46830
|
if (!stateRef.current) return;
|
|
46676
46831
|
stateRef.current = null;
|
|
46832
|
+
isRowResizingGlobal.active = false;
|
|
46833
|
+
document.body.style.userSelect = "";
|
|
46677
46834
|
document.body.style.cursor = "";
|
|
46678
46835
|
clearHoveredTableCell();
|
|
46679
46836
|
clearAllTableResizeHover();
|
|
@@ -46681,6 +46838,8 @@ function useTableRowResize({
|
|
|
46681
46838
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
46682
46839
|
const cleanup = import_react78.default.useCallback(() => {
|
|
46683
46840
|
stateRef.current = null;
|
|
46841
|
+
isRowResizingGlobal.active = false;
|
|
46842
|
+
document.body.style.userSelect = "";
|
|
46684
46843
|
document.body.style.cursor = "";
|
|
46685
46844
|
}, []);
|
|
46686
46845
|
return {
|
|
@@ -46729,11 +46888,21 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
46729
46888
|
guide.style.opacity = "0";
|
|
46730
46889
|
}
|
|
46731
46890
|
}, [getProseMirrorElement]);
|
|
46891
|
+
const hotspotTimerRef = (0, import_react79.useRef)(null);
|
|
46892
|
+
const activeHotspotKeyRef = (0, import_react79.useRef)(null);
|
|
46893
|
+
const clearHotspotTimer = import_react79.default.useCallback(() => {
|
|
46894
|
+
if (hotspotTimerRef.current !== null) {
|
|
46895
|
+
window.clearTimeout(hotspotTimerRef.current);
|
|
46896
|
+
hotspotTimerRef.current = null;
|
|
46897
|
+
}
|
|
46898
|
+
}, []);
|
|
46732
46899
|
const clearAllTableResizeHover = import_react79.default.useCallback(() => {
|
|
46900
|
+
clearHotspotTimer();
|
|
46901
|
+
activeHotspotKeyRef.current = null;
|
|
46733
46902
|
setEditorResizeCursor("");
|
|
46734
46903
|
hideColumnGuide();
|
|
46735
46904
|
hideRowGuide();
|
|
46736
|
-
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
46905
|
+
}, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
46737
46906
|
const updateActiveCellHighlight = import_react79.default.useCallback((cell) => {
|
|
46738
46907
|
const surface = editorContentRef.current;
|
|
46739
46908
|
const highlight = activeTableCellHighlightRef.current;
|
|
@@ -46872,6 +47041,10 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
46872
47041
|
if (syncActiveRowResizeGuide()) {
|
|
46873
47042
|
return;
|
|
46874
47043
|
}
|
|
47044
|
+
if (event.buttons !== 0) {
|
|
47045
|
+
clearAllTableResizeHover();
|
|
47046
|
+
return;
|
|
47047
|
+
}
|
|
46875
47048
|
const target = resolveEventElement(event.target);
|
|
46876
47049
|
if (!(target instanceof Element)) {
|
|
46877
47050
|
clearAllTableResizeHover();
|
|
@@ -46891,18 +47064,46 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
46891
47064
|
clearAllTableResizeHover();
|
|
46892
47065
|
return;
|
|
46893
47066
|
}
|
|
46894
|
-
const
|
|
46895
|
-
const
|
|
46896
|
-
if (
|
|
46897
|
-
|
|
46898
|
-
|
|
47067
|
+
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
47068
|
+
const colTarget = resolveColumnResizeTarget(cell, event.clientX, event.clientY);
|
|
47069
|
+
if (rowTarget) {
|
|
47070
|
+
const hotspotKey = `row:${rowTarget.row.rowIndex}-${rowTarget.cell.cellIndex}`;
|
|
47071
|
+
if (activeHotspotKeyRef.current === hotspotKey) {
|
|
47072
|
+
hideColumnGuide();
|
|
47073
|
+
showRowGuide(table, rowTarget.row, rowTarget.cell);
|
|
47074
|
+
return;
|
|
47075
|
+
}
|
|
47076
|
+
if (activeHotspotKeyRef.current !== hotspotKey) {
|
|
47077
|
+
clearHotspotTimer();
|
|
47078
|
+
activeHotspotKeyRef.current = hotspotKey;
|
|
47079
|
+
hotspotTimerRef.current = window.setTimeout(() => {
|
|
47080
|
+
hotspotTimerRef.current = null;
|
|
47081
|
+
hideColumnGuide();
|
|
47082
|
+
showRowGuide(table, rowTarget.row, rowTarget.cell);
|
|
47083
|
+
}, 100);
|
|
47084
|
+
}
|
|
46899
47085
|
return;
|
|
46900
47086
|
}
|
|
46901
|
-
if (
|
|
46902
|
-
|
|
46903
|
-
|
|
47087
|
+
if (colTarget) {
|
|
47088
|
+
const hotspotKey = `col:${colTarget.row.rowIndex}-${colTarget.cell.cellIndex}`;
|
|
47089
|
+
if (activeHotspotKeyRef.current === hotspotKey) {
|
|
47090
|
+
hideRowGuide();
|
|
47091
|
+
showColumnGuide(table, colTarget.row, colTarget.cell);
|
|
47092
|
+
return;
|
|
47093
|
+
}
|
|
47094
|
+
if (activeHotspotKeyRef.current !== hotspotKey) {
|
|
47095
|
+
clearHotspotTimer();
|
|
47096
|
+
activeHotspotKeyRef.current = hotspotKey;
|
|
47097
|
+
hotspotTimerRef.current = window.setTimeout(() => {
|
|
47098
|
+
hotspotTimerRef.current = null;
|
|
47099
|
+
hideRowGuide();
|
|
47100
|
+
showColumnGuide(table, colTarget.row, colTarget.cell);
|
|
47101
|
+
}, 100);
|
|
47102
|
+
}
|
|
46904
47103
|
return;
|
|
46905
47104
|
}
|
|
47105
|
+
clearHotspotTimer();
|
|
47106
|
+
activeHotspotKeyRef.current = null;
|
|
46906
47107
|
clearAllTableResizeHover();
|
|
46907
47108
|
};
|
|
46908
47109
|
const handleEditorMouseLeave = () => {
|
|
@@ -46923,15 +47124,22 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
46923
47124
|
clearActiveTableCell();
|
|
46924
47125
|
return;
|
|
46925
47126
|
}
|
|
46926
|
-
setActiveTableCell(cell);
|
|
46927
|
-
scheduleActiveCellSync(cell);
|
|
46928
47127
|
const row = cell.closest("tr");
|
|
46929
47128
|
const table = cell.closest("table");
|
|
46930
47129
|
if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
|
|
46931
|
-
|
|
46932
|
-
|
|
46933
|
-
|
|
47130
|
+
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
47131
|
+
if (rowTarget) {
|
|
47132
|
+
event.preventDefault();
|
|
47133
|
+
event.stopPropagation();
|
|
47134
|
+
window.getSelection()?.removeAllRanges();
|
|
47135
|
+
if (beginResize(event, table, rowTarget.row, rowTarget.cell)) {
|
|
47136
|
+
suppressActiveCellHighlightRef.current = true;
|
|
47137
|
+
updateActiveCellHighlight(null);
|
|
47138
|
+
return;
|
|
47139
|
+
}
|
|
46934
47140
|
}
|
|
47141
|
+
setActiveTableCell(cell);
|
|
47142
|
+
scheduleActiveCellSync(cell);
|
|
46935
47143
|
};
|
|
46936
47144
|
const handlePointerMove = (event) => {
|
|
46937
47145
|
handleRowResizePointerMove(event);
|
|
@@ -47020,8 +47228,9 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
47020
47228
|
clearActiveTableCell();
|
|
47021
47229
|
clearHoveredTableCell();
|
|
47022
47230
|
clearAllTableResizeHover();
|
|
47231
|
+
clearHotspotTimer();
|
|
47023
47232
|
};
|
|
47024
|
-
}, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
|
|
47233
|
+
}, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHotspotTimer, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
|
|
47025
47234
|
return {
|
|
47026
47235
|
editorContentRef,
|
|
47027
47236
|
tableColumnGuideRef,
|
|
@@ -47783,6 +47992,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
47783
47992
|
variant = "default",
|
|
47784
47993
|
rounded = true,
|
|
47785
47994
|
fontFamilies,
|
|
47995
|
+
defaultFontFamily = "Inter",
|
|
47786
47996
|
fontSizes,
|
|
47787
47997
|
lineHeights,
|
|
47788
47998
|
letterSpacings,
|
|
@@ -47791,6 +48001,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
47791
48001
|
uploadFileForSave,
|
|
47792
48002
|
extraExtensions,
|
|
47793
48003
|
showMenuBar = false,
|
|
48004
|
+
showPreviewButton = true,
|
|
47794
48005
|
onSave,
|
|
47795
48006
|
onExport,
|
|
47796
48007
|
onSourceCode,
|
|
@@ -48076,7 +48287,8 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
48076
48287
|
onSave,
|
|
48077
48288
|
onExport,
|
|
48078
48289
|
onSourceCode,
|
|
48079
|
-
onPreview
|
|
48290
|
+
onPreview,
|
|
48291
|
+
showPreviewButton
|
|
48080
48292
|
}
|
|
48081
48293
|
) }),
|
|
48082
48294
|
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -48089,6 +48301,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
48089
48301
|
maxImageFileSize,
|
|
48090
48302
|
allowedImageMimeTypes,
|
|
48091
48303
|
fontFamilies,
|
|
48304
|
+
defaultFontFamily,
|
|
48092
48305
|
fontSizes,
|
|
48093
48306
|
lineHeights,
|
|
48094
48307
|
letterSpacings
|
|
@@ -48114,6 +48327,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
48114
48327
|
},
|
|
48115
48328
|
className: "relative flex-1 overflow-y-auto",
|
|
48116
48329
|
style: {
|
|
48330
|
+
fontFamily: defaultFontFamily,
|
|
48117
48331
|
minHeight: editable ? minHeight : void 0,
|
|
48118
48332
|
maxHeight
|
|
48119
48333
|
},
|
|
@@ -48123,7 +48337,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
48123
48337
|
{
|
|
48124
48338
|
ref: tableColumnGuideRef,
|
|
48125
48339
|
"aria-hidden": "true",
|
|
48126
|
-
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
48340
|
+
className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
|
|
48127
48341
|
}
|
|
48128
48342
|
),
|
|
48129
48343
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -48131,7 +48345,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
48131
48345
|
{
|
|
48132
48346
|
ref: tableRowGuideRef,
|
|
48133
48347
|
"aria-hidden": "true",
|
|
48134
|
-
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
48348
|
+
className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
|
|
48135
48349
|
}
|
|
48136
48350
|
),
|
|
48137
48351
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -48140,7 +48354,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
48140
48354
|
ref: activeTableCellHighlightRef,
|
|
48141
48355
|
"aria-hidden": "true",
|
|
48142
48356
|
"data-ueditor-active-cell-highlight": "",
|
|
48143
|
-
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border
|
|
48357
|
+
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
|
|
48144
48358
|
}
|
|
48145
48359
|
),
|
|
48146
48360
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|