@underverse-ui/underverse 1.0.211 → 2.0.1
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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +243 -706
- package/api-reference.json +1 -1
- package/dist/{EmojiPicker-FEJJDAWZ.js → EmojiPicker-34YATB7Z.js} +4 -4
- package/dist/{chunk-F6A7HJE4.js → chunk-A7XL4RDV.js} +3 -3
- package/dist/{chunk-CYCBSKWI.js → chunk-KGNYK5YF.js} +2 -2
- package/dist/{chunk-BRDGIALS.js → chunk-PLHJWXCW.js} +24 -30
- package/dist/{chunk-BRDGIALS.js.map → chunk-PLHJWXCW.js.map} +1 -1
- package/dist/{chunk-GKY5DHGR.js → chunk-UNDGI6ZI.js} +3 -3
- package/dist/{chunk-4E43DRP2.js → chunk-Y7SQKJ7X.js} +95 -31
- package/dist/chunk-Y7SQKJ7X.js.map +1 -0
- package/dist/{chunk-AMAILXHP.js → chunk-Z6WE65J2.js} +44 -18
- package/dist/chunk-Z6WE65J2.js.map +1 -0
- package/dist/index.cjs +280 -159
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +140 -103
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-6GS5LLTD.js → menu-bar-AAD3LQTN.js} +4 -4
- package/dist/ueditor.cjs +132 -42
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +4 -4
- package/package.json +3 -1
- package/dist/chunk-4E43DRP2.js.map +0 -1
- package/dist/chunk-AMAILXHP.js.map +0 -1
- /package/dist/{EmojiPicker-FEJJDAWZ.js.map → EmojiPicker-34YATB7Z.js.map} +0 -0
- /package/dist/{chunk-F6A7HJE4.js.map → chunk-A7XL4RDV.js.map} +0 -0
- /package/dist/{chunk-CYCBSKWI.js.map → chunk-KGNYK5YF.js.map} +0 -0
- /package/dist/{chunk-GKY5DHGR.js.map → chunk-UNDGI6ZI.js.map} +0 -0
- /package/dist/{menu-bar-6GS5LLTD.js.map → menu-bar-AAD3LQTN.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
mergeRefs,
|
|
6
6
|
setRefValue,
|
|
7
7
|
useSmartTranslations
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PLHJWXCW.js";
|
|
9
9
|
|
|
10
10
|
// src/contexts/UnderverseConfigContext.tsx
|
|
11
11
|
import * as React from "react";
|
|
@@ -1083,6 +1083,9 @@ function getClipboardData(dataTransfer, type) {
|
|
|
1083
1083
|
return "";
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
|
+
function hasClipboardHtmlTable(dataTransfer) {
|
|
1087
|
+
return /<table(?:\s|>)/i.test(getClipboardData(dataTransfer, "text/html"));
|
|
1088
|
+
}
|
|
1086
1089
|
function extractClipboardHtmlFragment(html) {
|
|
1087
1090
|
const startMarker = "<!--StartFragment-->";
|
|
1088
1091
|
const endMarker = "<!--EndFragment-->";
|
|
@@ -1093,6 +1096,13 @@ function extractClipboardHtmlFragment(html) {
|
|
|
1093
1096
|
}
|
|
1094
1097
|
return html;
|
|
1095
1098
|
}
|
|
1099
|
+
function hasMeaningfulContentOutsideTable(container) {
|
|
1100
|
+
const clone = container.cloneNode(true);
|
|
1101
|
+
clone.querySelectorAll("table, style, script, meta, link").forEach((element) => element.remove());
|
|
1102
|
+
const remainingText = (clone.textContent ?? "").replace(/\u00a0/g, " ").replace(/\u200b/g, "").trim();
|
|
1103
|
+
if (remainingText) return true;
|
|
1104
|
+
return !!clone.querySelector("img, video, audio, iframe, object, embed, svg, canvas, hr, input, textarea, select, button");
|
|
1105
|
+
}
|
|
1096
1106
|
function normalizeClipboardCellText(value) {
|
|
1097
1107
|
return value.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\u00a0/g, " ").replace(/[ \t]+\n/g, "\n").replace(/\n[ \t]+/g, "\n").replace(/\n+$/g, "").replace(/^\n+/g, "").trim();
|
|
1098
1108
|
}
|
|
@@ -1716,7 +1726,10 @@ function getClipboardTableContent(dataTransfer) {
|
|
|
1716
1726
|
const fragment = extractClipboardHtmlFragment(html);
|
|
1717
1727
|
const fragmentDoc = new DOMParser().parseFromString(fragment, "text/html");
|
|
1718
1728
|
const styleMap = parseClipboardCssClassStyles(doc);
|
|
1719
|
-
const
|
|
1729
|
+
const sourceBody = fragmentDoc.querySelector("table") ? fragmentDoc.body : doc.body;
|
|
1730
|
+
const tables = sourceBody.querySelectorAll("table");
|
|
1731
|
+
if (tables.length !== 1 || hasMeaningfulContentOutsideTable(sourceBody)) return null;
|
|
1732
|
+
const table = tables[0];
|
|
1720
1733
|
if (!(table instanceof HTMLTableElement)) return null;
|
|
1721
1734
|
return createTableContent(getHtmlTableRows(table, styleMap), 1, {
|
|
1722
1735
|
backgroundColor: DEFAULT_HTML_TABLE_CELL_BACKGROUND_COLOR
|
|
@@ -1866,6 +1879,7 @@ var ClipboardImages = Extension.create({
|
|
|
1866
1879
|
editor.chain().focus().insertContent(tableContent).run();
|
|
1867
1880
|
return true;
|
|
1868
1881
|
}
|
|
1882
|
+
if (hasClipboardHtmlTable(event.clipboardData)) return false;
|
|
1869
1883
|
const tsvTableContent = getClipboardTsvTableContent(event.clipboardData);
|
|
1870
1884
|
if (tsvTableContent) {
|
|
1871
1885
|
event.preventDefault();
|
|
@@ -2065,7 +2079,7 @@ import {
|
|
|
2065
2079
|
import { setCellAttr } from "@tiptap/pm/tables";
|
|
2066
2080
|
|
|
2067
2081
|
// src/components/UEditor/colors.tsx
|
|
2068
|
-
import { useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
2082
|
+
import React6, { useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
2069
2083
|
import { Check as Check2, Palette, Paintbrush, Grid } from "lucide-react";
|
|
2070
2084
|
|
|
2071
2085
|
// src/components/UEditor/figma-toolbar-icons.tsx
|
|
@@ -2380,12 +2394,25 @@ var EditorColorPalette = ({
|
|
|
2380
2394
|
colors,
|
|
2381
2395
|
currentColor,
|
|
2382
2396
|
onSelect,
|
|
2397
|
+
onCustomColorSelect,
|
|
2383
2398
|
label
|
|
2384
2399
|
}) => {
|
|
2385
2400
|
const t = useSmartTranslations("UEditor");
|
|
2386
2401
|
const colorInputRef = useRef3(null);
|
|
2387
2402
|
const automaticColor = colors[0]?.color ?? "";
|
|
2388
2403
|
const paletteColors = colors.slice(1);
|
|
2404
|
+
const customColorSelect = onCustomColorSelect ?? onSelect;
|
|
2405
|
+
React6.useEffect(() => {
|
|
2406
|
+
const input = colorInputRef.current;
|
|
2407
|
+
if (!input) return;
|
|
2408
|
+
const commitColor = () => customColorSelect(input.value);
|
|
2409
|
+
input.addEventListener("change", commitColor);
|
|
2410
|
+
return () => input.removeEventListener("change", commitColor);
|
|
2411
|
+
}, [customColorSelect]);
|
|
2412
|
+
React6.useEffect(() => {
|
|
2413
|
+
const input = colorInputRef.current;
|
|
2414
|
+
if (input) input.value = currentColor.startsWith("#") ? currentColor : "#000000";
|
|
2415
|
+
}, [currentColor]);
|
|
2389
2416
|
return /* @__PURE__ */ jsxs4("div", { className: "w-56 p-2", children: [
|
|
2390
2417
|
/* @__PURE__ */ jsx6("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
2391
2418
|
/* @__PURE__ */ jsxs4(
|
|
@@ -2439,20 +2466,19 @@ var EditorColorPalette = ({
|
|
|
2439
2466
|
}
|
|
2440
2467
|
),
|
|
2441
2468
|
/* @__PURE__ */ jsx6("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
2442
|
-
/* @__PURE__ */ jsx6(Palette, { className: "h-4 w-4 text-muted-foreground" })
|
|
2443
|
-
/* @__PURE__ */ jsx6(
|
|
2444
|
-
"input",
|
|
2445
|
-
{
|
|
2446
|
-
ref: colorInputRef,
|
|
2447
|
-
type: "color",
|
|
2448
|
-
value: currentColor.startsWith("#") ? currentColor : "#000000",
|
|
2449
|
-
onChange: (event) => onSelect(event.target.value),
|
|
2450
|
-
className: "sr-only",
|
|
2451
|
-
tabIndex: -1
|
|
2452
|
-
}
|
|
2453
|
-
)
|
|
2469
|
+
/* @__PURE__ */ jsx6(Palette, { className: "h-4 w-4 text-muted-foreground" })
|
|
2454
2470
|
]
|
|
2455
2471
|
}
|
|
2472
|
+
),
|
|
2473
|
+
/* @__PURE__ */ jsx6(
|
|
2474
|
+
"input",
|
|
2475
|
+
{
|
|
2476
|
+
ref: colorInputRef,
|
|
2477
|
+
type: "color",
|
|
2478
|
+
defaultValue: currentColor.startsWith("#") ? currentColor : "#000000",
|
|
2479
|
+
className: "sr-only",
|
|
2480
|
+
tabIndex: -1
|
|
2481
|
+
}
|
|
2456
2482
|
)
|
|
2457
2483
|
] });
|
|
2458
2484
|
};
|
|
@@ -4303,7 +4329,7 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
4303
4329
|
"[&_td]:px-2",
|
|
4304
4330
|
"[&_td]:py-0",
|
|
4305
4331
|
"[&_td]:whitespace-normal",
|
|
4306
|
-
"[&_td]:
|
|
4332
|
+
"[&_td]:wrap-anywhere",
|
|
4307
4333
|
"[&_td]:[word-break:normal]",
|
|
4308
4334
|
"[&_td[data-text-wrap='nowrap']]:whitespace-nowrap",
|
|
4309
4335
|
"[&_td[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
|
|
@@ -4315,7 +4341,7 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
4315
4341
|
"[&_th]:px-2",
|
|
4316
4342
|
"[&_th]:py-0",
|
|
4317
4343
|
"[&_th]:whitespace-normal",
|
|
4318
|
-
"[&_th]:
|
|
4344
|
+
"[&_th]:wrap-anywhere",
|
|
4319
4345
|
"[&_th]:[word-break:normal]",
|
|
4320
4346
|
"[&_th[data-text-wrap='nowrap']]:whitespace-nowrap",
|
|
4321
4347
|
"[&_th[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
|
|
@@ -4523,4 +4549,4 @@ export {
|
|
|
4523
4549
|
EditorToolbar,
|
|
4524
4550
|
UEDITOR_PROSEMIRROR_CLASS_NAME
|
|
4525
4551
|
};
|
|
4526
|
-
//# sourceMappingURL=chunk-
|
|
4552
|
+
//# sourceMappingURL=chunk-Z6WE65J2.js.map
|