@underverse-ui/underverse 1.0.186 → 1.0.188
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/index.cjs +308 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +322 -55
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1003,6 +1003,8 @@ var en_default = {
|
|
|
1003
1003
|
fileCardDesc: "Upload a file card attachment",
|
|
1004
1004
|
formCheckbox: "Form Checkbox",
|
|
1005
1005
|
formCheckboxDesc: "Insert an interactive checkbox field",
|
|
1006
|
+
roundCheckbox: "Round Checkbox",
|
|
1007
|
+
roundCheckboxDesc: "Insert a circular interactive checkbox",
|
|
1006
1008
|
formRadio: "Form Radio Button",
|
|
1007
1009
|
formRadioDesc: "Insert an interactive radio button field"
|
|
1008
1010
|
},
|
|
@@ -1010,7 +1012,8 @@ var en_default = {
|
|
|
1010
1012
|
addBlock: "Add block"
|
|
1011
1013
|
},
|
|
1012
1014
|
linkInput: {
|
|
1013
|
-
placeholder: "Paste or type a link..."
|
|
1015
|
+
placeholder: "Paste or type a link...",
|
|
1016
|
+
invalid: "Enter a valid link, such as https://example.com."
|
|
1014
1017
|
},
|
|
1015
1018
|
imageInput: {
|
|
1016
1019
|
urlTab: "URL",
|
|
@@ -1101,7 +1104,10 @@ var en_default = {
|
|
|
1101
1104
|
alignVertical: "Vertical Alignment",
|
|
1102
1105
|
alignVerticalTop: "Top Align",
|
|
1103
1106
|
alignVerticalMiddle: "Middle Align",
|
|
1104
|
-
alignVerticalBottom: "Bottom Align"
|
|
1107
|
+
alignVerticalBottom: "Bottom Align",
|
|
1108
|
+
textDirection: "Text Direction",
|
|
1109
|
+
horizontalText: "Horizontal Text",
|
|
1110
|
+
verticalText: "Vertical Text"
|
|
1105
1111
|
},
|
|
1106
1112
|
callout: {
|
|
1107
1113
|
selectEmoji: "Select Emoji",
|
|
@@ -1430,6 +1436,8 @@ var vi_default = {
|
|
|
1430
1436
|
fileCardDesc: "T\u1EA3i l\xEAn t\u1EC7p tin \u0111\xEDnh k\xE8m",
|
|
1431
1437
|
formCheckbox: "Checkbox bi\u1EC3u m\u1EABu",
|
|
1432
1438
|
formCheckboxDesc: "Th\xEAm \xF4 checkbox bi\u1EC3u m\u1EABu",
|
|
1439
|
+
roundCheckbox: "Checkbox tr\xF2n",
|
|
1440
|
+
roundCheckboxDesc: "Th\xEAm checkbox t\u01B0\u01A1ng t\xE1c h\xECnh tr\xF2n",
|
|
1433
1441
|
formRadio: "Radio bi\u1EC3u m\u1EABu",
|
|
1434
1442
|
formRadioDesc: "Th\xEAm n\xFAt ch\u1ECDn m\u1ED9t (Radio) bi\u1EC3u m\u1EABu"
|
|
1435
1443
|
},
|
|
@@ -1437,7 +1445,8 @@ var vi_default = {
|
|
|
1437
1445
|
addBlock: "Th\xEAm kh\u1ED1i"
|
|
1438
1446
|
},
|
|
1439
1447
|
linkInput: {
|
|
1440
|
-
placeholder: "D\xE1n ho\u1EB7c nh\u1EADp li\xEAn k\u1EBFt..."
|
|
1448
|
+
placeholder: "D\xE1n ho\u1EB7c nh\u1EADp li\xEAn k\u1EBFt...",
|
|
1449
|
+
invalid: "Vui l\xF2ng nh\u1EADp li\xEAn k\u1EBFt h\u1EE3p l\u1EC7, v\xED d\u1EE5: https://example.com."
|
|
1441
1450
|
},
|
|
1442
1451
|
imageInput: {
|
|
1443
1452
|
urlTab: "URL",
|
|
@@ -1528,7 +1537,10 @@ var vi_default = {
|
|
|
1528
1537
|
alignVertical: "C\u0103n l\u1EC1 d\u1ECDc",
|
|
1529
1538
|
alignVerticalTop: "C\u0103n tr\xEAn",
|
|
1530
1539
|
alignVerticalMiddle: "C\u0103n gi\u1EEFa",
|
|
1531
|
-
alignVerticalBottom: "C\u0103n d\u01B0\u1EDBi"
|
|
1540
|
+
alignVerticalBottom: "C\u0103n d\u01B0\u1EDBi",
|
|
1541
|
+
textDirection: "H\u01B0\u1EDBng ch\u1EEF",
|
|
1542
|
+
horizontalText: "Ch\u1EEF ngang",
|
|
1543
|
+
verticalText: "Ch\u1EEF d\u1ECDc"
|
|
1532
1544
|
},
|
|
1533
1545
|
callout: {
|
|
1534
1546
|
selectEmoji: "Ch\u1ECDn Bi\u1EC3u t\u01B0\u1EE3ng",
|
|
@@ -1857,6 +1869,8 @@ var ko_default = {
|
|
|
1857
1869
|
fileCardDesc: "\uD30C\uC77C \uCE74\uB4DC \uCCA8\uBD80 \uD30C\uC77C\uC744 \uC5C5\uB85C\uB4DC\uD569\uB2C8\uB2E4",
|
|
1858
1870
|
formCheckbox: "\uC591\uC2DD \uCCB4\uD06C\uBC15\uC2A4",
|
|
1859
1871
|
formCheckboxDesc: "\uB300\uD654\uD615 \uCCB4\uD06C\uBC15\uC2A4 \uD544\uB4DC \uC0BD\uC785",
|
|
1872
|
+
roundCheckbox: "\uC6D0\uD615 \uCCB4\uD06C\uBC15\uC2A4",
|
|
1873
|
+
roundCheckboxDesc: "\uC6D0\uD615 \uB300\uD654\uD615 \uCCB4\uD06C\uBC15\uC2A4 \uC0BD\uC785",
|
|
1860
1874
|
formRadio: "\uC591\uC2DD \uB77C\uB514\uC624 \uBC84\uD2BC",
|
|
1861
1875
|
formRadioDesc: "\uB300\uD654\uD615 \uB77C\uB514\uC624 \uBC84\uD2BC \uD544\uB4DC \uC0BD\uC785"
|
|
1862
1876
|
},
|
|
@@ -1864,7 +1878,8 @@ var ko_default = {
|
|
|
1864
1878
|
addBlock: "\uBE14\uB85D \uCD94\uAC00"
|
|
1865
1879
|
},
|
|
1866
1880
|
linkInput: {
|
|
1867
|
-
placeholder: "\uB9C1\uD06C \uBD99\uC5EC\uB123\uAE30 \uB610\uB294 \uC785\uB825..."
|
|
1881
|
+
placeholder: "\uB9C1\uD06C \uBD99\uC5EC\uB123\uAE30 \uB610\uB294 \uC785\uB825...",
|
|
1882
|
+
invalid: "https://example.com\uACFC \uAC19\uC740 \uC62C\uBC14\uB978 \uB9C1\uD06C\uB97C \uC785\uB825\uD574 \uC8FC\uC138\uC694."
|
|
1868
1883
|
},
|
|
1869
1884
|
imageInput: {
|
|
1870
1885
|
urlTab: "URL",
|
|
@@ -1955,7 +1970,10 @@ var ko_default = {
|
|
|
1955
1970
|
alignVertical: "\uC138\uB85C \uB9DE\uCDA4",
|
|
1956
1971
|
alignVerticalTop: "\uC704\uCABD \uB9DE\uCDA4",
|
|
1957
1972
|
alignVerticalMiddle: "\uAC00\uC6B4\uB370 \uB9DE\uCDA4",
|
|
1958
|
-
alignVerticalBottom: "\uC544\uB798\uCABD \uB9DE\uCDA4"
|
|
1973
|
+
alignVerticalBottom: "\uC544\uB798\uCABD \uB9DE\uCDA4",
|
|
1974
|
+
textDirection: "\uD14D\uC2A4\uD2B8 \uBC29\uD5A5",
|
|
1975
|
+
horizontalText: "\uAC00\uB85C\uC4F0\uAE30",
|
|
1976
|
+
verticalText: "\uC138\uB85C\uC4F0\uAE30"
|
|
1959
1977
|
},
|
|
1960
1978
|
callout: {
|
|
1961
1979
|
selectEmoji: "\uC774\uBAA8\uC9C0 \uC120\uD0DD",
|
|
@@ -2284,6 +2302,8 @@ var ja_default = {
|
|
|
2284
2302
|
fileCardDesc: "\u30D5\u30A1\u30A4\u30EB\u30AB\u30FC\u30C9\u306E\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u307E\u3059",
|
|
2285
2303
|
formCheckbox: "\u30D5\u30A9\u30FC\u30E0\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9",
|
|
2286
2304
|
formCheckboxDesc: "\u30A4\u30F3\u30BF\u30E9\u30AF\u30C6\u30A3\u30D6\u306A\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u3092\u633F\u5165\u3057\u307E\u3059",
|
|
2305
|
+
roundCheckbox: "\u4E38\u578B\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9",
|
|
2306
|
+
roundCheckboxDesc: "\u4E38\u578B\u306E\u30A4\u30F3\u30BF\u30E9\u30AF\u30C6\u30A3\u30D6\u306A\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u3092\u633F\u5165\u3057\u307E\u3059",
|
|
2287
2307
|
formRadio: "\u30D5\u30A9\u30FC\u30E0\u30E9\u30B8\u30AA\u30DC\u30BF\u30F3",
|
|
2288
2308
|
formRadioDesc: "\u30A4\u30F3\u30BF\u30E9\u30AF\u30C6\u30A3\u30D6\u306A\u30E9\u30B8\u30AA\u30DC\u30BF\u30F3\u3092\u633F\u5165\u3057\u307E\u3059"
|
|
2289
2309
|
},
|
|
@@ -2291,7 +2311,8 @@ var ja_default = {
|
|
|
2291
2311
|
addBlock: "\u30D6\u30ED\u30C3\u30AF\u3092\u8FFD\u52A0"
|
|
2292
2312
|
},
|
|
2293
2313
|
linkInput: {
|
|
2294
|
-
placeholder: "\u30EA\u30F3\u30AF\u3092\u8CBC\u308A\u4ED8\u3051\u307E\u305F\u306F\u5165\u529B..."
|
|
2314
|
+
placeholder: "\u30EA\u30F3\u30AF\u3092\u8CBC\u308A\u4ED8\u3051\u307E\u305F\u306F\u5165\u529B...",
|
|
2315
|
+
invalid: "https://example.com \u306E\u3088\u3046\u306A\u6709\u52B9\u306A\u30EA\u30F3\u30AF\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
2295
2316
|
},
|
|
2296
2317
|
imageInput: {
|
|
2297
2318
|
urlTab: "URL",
|
|
@@ -2382,7 +2403,10 @@ var ja_default = {
|
|
|
2382
2403
|
alignVertical: "\u5782\u76F4\u63C3\u3048",
|
|
2383
2404
|
alignVerticalTop: "\u4E0A\u63C3\u3048",
|
|
2384
2405
|
alignVerticalMiddle: "\u4E0A\u4E0B\u4E2D\u592E\u63C3\u3048",
|
|
2385
|
-
alignVerticalBottom: "\u4E0B\u63C3\u3048"
|
|
2406
|
+
alignVerticalBottom: "\u4E0B\u63C3\u3048",
|
|
2407
|
+
textDirection: "\u6587\u5B57\u65B9\u5411",
|
|
2408
|
+
horizontalText: "\u6A2A\u66F8\u304D",
|
|
2409
|
+
verticalText: "\u7E26\u66F8\u304D"
|
|
2386
2410
|
},
|
|
2387
2411
|
callout: {
|
|
2388
2412
|
selectEmoji: "\u7D75\u6587\u5B57\u3092\u9078\u629E",
|
|
@@ -27745,6 +27769,32 @@ function isProtocolRelativeUrl(value) {
|
|
|
27745
27769
|
function isRelativeUrl(value) {
|
|
27746
27770
|
return value.startsWith("/") || value.startsWith("./") || value.startsWith("../") || value.startsWith("#");
|
|
27747
27771
|
}
|
|
27772
|
+
function isValidIpv4Hostname(hostname) {
|
|
27773
|
+
const parts = hostname.split(".");
|
|
27774
|
+
return parts.length === 4 && parts.every((part) => /^\d{1,3}$/.test(part) && Number(part) <= 255);
|
|
27775
|
+
}
|
|
27776
|
+
function isValidWebHostname(hostname) {
|
|
27777
|
+
const normalized = hostname.toLowerCase();
|
|
27778
|
+
if (normalized === "localhost" || isValidIpv4Hostname(normalized)) return true;
|
|
27779
|
+
if (normalized.startsWith("[") && normalized.endsWith("]") && normalized.includes(":")) return true;
|
|
27780
|
+
const labels = normalized.split(".");
|
|
27781
|
+
if (labels.length < 2) return false;
|
|
27782
|
+
const validLabel = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)$/;
|
|
27783
|
+
return labels.every((label) => validLabel.test(label)) && /[a-z]/.test(labels.at(-1) ?? "");
|
|
27784
|
+
}
|
|
27785
|
+
function isValidLinkUrl(parsed) {
|
|
27786
|
+
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
|
27787
|
+
return isValidWebHostname(parsed.hostname);
|
|
27788
|
+
}
|
|
27789
|
+
if (parsed.protocol === "mailto:") {
|
|
27790
|
+
return /^[^@]+@[^@]+\.[^@]+$/.test(decodeURIComponent(parsed.pathname));
|
|
27791
|
+
}
|
|
27792
|
+
if (parsed.protocol === "tel:") {
|
|
27793
|
+
const number = decodeURIComponent(parsed.pathname);
|
|
27794
|
+
return /^\+?[\d().-]+$/.test(number) && (number.match(/\d/g)?.length ?? 0) >= 3;
|
|
27795
|
+
}
|
|
27796
|
+
return false;
|
|
27797
|
+
}
|
|
27748
27798
|
function isDataImageUrl(value) {
|
|
27749
27799
|
return /^data:image\/(?:png|jpe?g|gif|webp|svg\+xml|bmp|x-icon|avif);base64,/i.test(value);
|
|
27750
27800
|
}
|
|
@@ -27762,7 +27812,7 @@ function isSafeUEditorUrl(raw, kind) {
|
|
|
27762
27812
|
const parsed = new URL(value);
|
|
27763
27813
|
if (kind === "image") return IMAGE_PROTOCOLS.has(parsed.protocol);
|
|
27764
27814
|
if (kind === "file") return FILE_PROTOCOLS.has(parsed.protocol);
|
|
27765
|
-
return LINK_PROTOCOLS.has(parsed.protocol);
|
|
27815
|
+
return LINK_PROTOCOLS.has(parsed.protocol) && isValidLinkUrl(parsed);
|
|
27766
27816
|
} catch {
|
|
27767
27817
|
return false;
|
|
27768
27818
|
}
|
|
@@ -28349,6 +28399,7 @@ var import_lucide_react45 = require("lucide-react");
|
|
|
28349
28399
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
28350
28400
|
var FormCheckboxView = ({ node, updateAttributes, editor, selected }) => {
|
|
28351
28401
|
const isChecked = !!node.attrs.checked;
|
|
28402
|
+
const isCircle = node.attrs.variant === "circle";
|
|
28352
28403
|
const isEditable = editor.isEditable;
|
|
28353
28404
|
const handleToggle = (e) => {
|
|
28354
28405
|
if (!isEditable) return;
|
|
@@ -28378,7 +28429,8 @@ var FormCheckboxView = ({ node, updateAttributes, editor, selected }) => {
|
|
|
28378
28429
|
onClick: handleToggle,
|
|
28379
28430
|
onKeyDown: handleKeyDown2,
|
|
28380
28431
|
className: cn(
|
|
28381
|
-
"flex items-center justify-center w-5 h-5
|
|
28432
|
+
"flex items-center justify-center w-5 h-5 border text-primary-foreground transition-all duration-200 outline-none",
|
|
28433
|
+
isCircle ? "rounded-full" : "rounded-md",
|
|
28382
28434
|
isChecked ? "bg-primary border-primary scale-100" : "bg-background border-border/70 hover:border-primary/50",
|
|
28383
28435
|
selected && "ring-2 ring-primary/30 ring-offset-1",
|
|
28384
28436
|
isEditable && "focus-visible:ring-2 focus-visible:ring-primary/45 focus-visible:ring-offset-1 focus-visible:border-primary"
|
|
@@ -28450,6 +28502,11 @@ var FormCheckbox2 = import_core4.Node.create({
|
|
|
28450
28502
|
name: attributes.name
|
|
28451
28503
|
};
|
|
28452
28504
|
}
|
|
28505
|
+
},
|
|
28506
|
+
variant: {
|
|
28507
|
+
default: "square",
|
|
28508
|
+
parseHTML: (element) => element.getAttribute("data-variant") === "circle" ? "circle" : "square",
|
|
28509
|
+
renderHTML: (attributes) => attributes.variant === "circle" ? { "data-variant": "circle" } : {}
|
|
28453
28510
|
}
|
|
28454
28511
|
};
|
|
28455
28512
|
},
|
|
@@ -28786,6 +28843,8 @@ var DEFAULT_MESSAGES = {
|
|
|
28786
28843
|
fileCardDesc: "Upload a file card attachment",
|
|
28787
28844
|
formCheckbox: "Form Checkbox",
|
|
28788
28845
|
formCheckboxDesc: "Insert an interactive checkbox field",
|
|
28846
|
+
roundCheckbox: "Round Checkbox",
|
|
28847
|
+
roundCheckboxDesc: "Insert a circular interactive checkbox",
|
|
28789
28848
|
formRadio: "Form Radio Button",
|
|
28790
28849
|
formRadioDesc: "Insert an interactive radio button field"
|
|
28791
28850
|
};
|
|
@@ -28841,6 +28900,8 @@ function buildSlashCommandMessages(translate) {
|
|
|
28841
28900
|
fileCardDesc: translate("slashCommand.fileCardDesc") || "Upload a file card attachment",
|
|
28842
28901
|
formCheckbox: translate("slashCommand.formCheckbox") || "Form Checkbox",
|
|
28843
28902
|
formCheckboxDesc: translate("slashCommand.formCheckboxDesc") || "Insert an interactive checkbox field",
|
|
28903
|
+
roundCheckbox: translate("slashCommand.roundCheckbox") || "Round Checkbox",
|
|
28904
|
+
roundCheckboxDesc: translate("slashCommand.roundCheckboxDesc") || "Insert a circular interactive checkbox",
|
|
28844
28905
|
formRadio: translate("slashCommand.formRadio") || "Form Radio Button",
|
|
28845
28906
|
formRadioDesc: translate("slashCommand.formRadioDesc") || "Insert an interactive radio button field"
|
|
28846
28907
|
};
|
|
@@ -28987,10 +29048,20 @@ function buildSlashCommandItems({
|
|
|
28987
29048
|
icon: import_lucide_react47.CheckSquare,
|
|
28988
29049
|
title: messages.formCheckbox,
|
|
28989
29050
|
description: messages.formCheckboxDesc,
|
|
29051
|
+
searchTerms: ["checkbox", "square checkbox"],
|
|
28990
29052
|
command: run(({ editor, range }) => {
|
|
28991
29053
|
getCommandChain(editor, range).setFormCheckbox().run();
|
|
28992
29054
|
})
|
|
28993
29055
|
},
|
|
29056
|
+
{
|
|
29057
|
+
icon: import_lucide_react47.CircleCheckBig,
|
|
29058
|
+
title: messages.roundCheckbox,
|
|
29059
|
+
description: messages.roundCheckboxDesc,
|
|
29060
|
+
searchTerms: ["roundcheckbox", "round checkbox", "circle checkbox"],
|
|
29061
|
+
command: run(({ editor, range }) => {
|
|
29062
|
+
getCommandChain(editor, range).setFormCheckbox({ variant: "circle" }).run();
|
|
29063
|
+
})
|
|
29064
|
+
},
|
|
28994
29065
|
{
|
|
28995
29066
|
icon: import_lucide_react47.CircleDot,
|
|
28996
29067
|
title: messages.formRadio,
|
|
@@ -28999,7 +29070,11 @@ function buildSlashCommandItems({
|
|
|
28999
29070
|
getCommandChain(editor, range).setFormRadio({ name: `radio-group-${Math.random().toString(36).substring(2, 6)}` }).run();
|
|
29000
29071
|
})
|
|
29001
29072
|
}
|
|
29002
|
-
].filter((item) =>
|
|
29073
|
+
].filter((item) => {
|
|
29074
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
29075
|
+
if (!normalizedQuery) return true;
|
|
29076
|
+
return [item.title, item.description, ...item.searchTerms ?? []].some((value) => value.toLowerCase().includes(normalizedQuery));
|
|
29077
|
+
});
|
|
29003
29078
|
}
|
|
29004
29079
|
var SlashCommandList = (0, import_react58.forwardRef)((props, ref) => {
|
|
29005
29080
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
@@ -31797,6 +31872,11 @@ var CustomTableCell = import_extension_table_cell.default.extend({
|
|
|
31797
31872
|
"data-vertical-align": attributes.verticalAlign
|
|
31798
31873
|
};
|
|
31799
31874
|
}
|
|
31875
|
+
},
|
|
31876
|
+
textDirection: {
|
|
31877
|
+
default: null,
|
|
31878
|
+
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || element.style.writingMode === "vertical-rl" ? "vertical" : null,
|
|
31879
|
+
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
31800
31880
|
}
|
|
31801
31881
|
};
|
|
31802
31882
|
},
|
|
@@ -31807,12 +31887,14 @@ var CustomTableCell = import_extension_table_cell.default.extend({
|
|
|
31807
31887
|
const borderStyle = HTMLAttributes["data-border-style"];
|
|
31808
31888
|
const borderWidth = HTMLAttributes["data-border-width"];
|
|
31809
31889
|
const verticalAlign = HTMLAttributes["data-vertical-align"];
|
|
31890
|
+
const textDirection = HTMLAttributes["data-text-direction"];
|
|
31810
31891
|
let mergedStyle = style;
|
|
31811
31892
|
if (bg) mergedStyle += `; background-color: ${bg}`;
|
|
31812
31893
|
if (borderColor) mergedStyle += `; border-color: ${borderColor}`;
|
|
31813
31894
|
if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
|
|
31814
31895
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
31815
31896
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
31897
|
+
if (textDirection === "vertical") mergedStyle += "; writing-mode: vertical-rl; text-orientation: mixed";
|
|
31816
31898
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
31817
31899
|
return [
|
|
31818
31900
|
"td",
|
|
@@ -31916,6 +31998,11 @@ var CustomTableHeader = import_extension_table_header.default.extend({
|
|
|
31916
31998
|
"data-vertical-align": attributes.verticalAlign
|
|
31917
31999
|
};
|
|
31918
32000
|
}
|
|
32001
|
+
},
|
|
32002
|
+
textDirection: {
|
|
32003
|
+
default: null,
|
|
32004
|
+
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || element.style.writingMode === "vertical-rl" ? "vertical" : null,
|
|
32005
|
+
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
31919
32006
|
}
|
|
31920
32007
|
};
|
|
31921
32008
|
},
|
|
@@ -31926,12 +32013,14 @@ var CustomTableHeader = import_extension_table_header.default.extend({
|
|
|
31926
32013
|
const borderStyle = HTMLAttributes["data-border-style"];
|
|
31927
32014
|
const borderWidth = HTMLAttributes["data-border-width"];
|
|
31928
32015
|
const verticalAlign = HTMLAttributes["data-vertical-align"];
|
|
32016
|
+
const textDirection = HTMLAttributes["data-text-direction"];
|
|
31929
32017
|
let mergedStyle = style;
|
|
31930
32018
|
if (bg) mergedStyle += `; background-color: ${bg}`;
|
|
31931
32019
|
if (borderColor) mergedStyle += `; border-color: ${borderColor}`;
|
|
31932
32020
|
if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
|
|
31933
32021
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
31934
32022
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
32023
|
+
if (textDirection === "vertical") mergedStyle += "; writing-mode: vertical-rl; text-orientation: mixed";
|
|
31935
32024
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
31936
32025
|
return [
|
|
31937
32026
|
"th",
|
|
@@ -32505,7 +32594,9 @@ var LinkInput = ({
|
|
|
32505
32594
|
}) => {
|
|
32506
32595
|
const t = useSmartTranslations("UEditor");
|
|
32507
32596
|
const [url, setUrl] = (0, import_react69.useState)(initialUrl);
|
|
32597
|
+
const [error, setError] = (0, import_react69.useState)("");
|
|
32508
32598
|
const inputRef = (0, import_react69.useRef)(null);
|
|
32599
|
+
const errorId = (0, import_react69.useId)();
|
|
32509
32600
|
(0, import_react69.useEffect)(() => {
|
|
32510
32601
|
inputRef.current?.focus();
|
|
32511
32602
|
inputRef.current?.select();
|
|
@@ -32513,22 +32604,35 @@ var LinkInput = ({
|
|
|
32513
32604
|
const handleSubmit = (e) => {
|
|
32514
32605
|
e.preventDefault();
|
|
32515
32606
|
const normalized = normalizeUrl(url);
|
|
32516
|
-
if (normalized)
|
|
32607
|
+
if (!normalized) {
|
|
32608
|
+
setError(t("linkInput.invalid"));
|
|
32609
|
+
return;
|
|
32610
|
+
}
|
|
32611
|
+
setError("");
|
|
32612
|
+
onSubmit(normalized);
|
|
32517
32613
|
};
|
|
32518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("form", { onSubmit: handleSubmit, className: "
|
|
32519
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.
|
|
32520
|
-
|
|
32521
|
-
|
|
32522
|
-
|
|
32523
|
-
|
|
32524
|
-
|
|
32525
|
-
|
|
32526
|
-
|
|
32527
|
-
|
|
32528
|
-
|
|
32529
|
-
|
|
32530
|
-
|
|
32531
|
-
|
|
32614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("form", { onSubmit: handleSubmit, className: "p-2", children: [
|
|
32615
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
32616
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32617
|
+
"input",
|
|
32618
|
+
{
|
|
32619
|
+
ref: inputRef,
|
|
32620
|
+
type: "text",
|
|
32621
|
+
value: url,
|
|
32622
|
+
onChange: (e) => {
|
|
32623
|
+
setUrl(e.target.value);
|
|
32624
|
+
if (error) setError("");
|
|
32625
|
+
},
|
|
32626
|
+
placeholder: t("linkInput.placeholder"),
|
|
32627
|
+
"aria-invalid": Boolean(error),
|
|
32628
|
+
"aria-describedby": error ? errorId : void 0,
|
|
32629
|
+
className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20 aria-invalid:ring-2 aria-invalid:ring-destructive/40"
|
|
32630
|
+
}
|
|
32631
|
+
),
|
|
32632
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react52.Check, { className: "w-4 h-4" }) }),
|
|
32633
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_lucide_react52.X, { className: "w-4 h-4" }) })
|
|
32634
|
+
] }),
|
|
32635
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { id: errorId, role: "alert", className: "mt-1.5 px-1 text-xs text-destructive", children: error }) : null
|
|
32532
32636
|
] });
|
|
32533
32637
|
};
|
|
32534
32638
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
@@ -32589,8 +32693,28 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
32589
32693
|
] });
|
|
32590
32694
|
};
|
|
32591
32695
|
|
|
32592
|
-
// src/components/UEditor/
|
|
32696
|
+
// src/components/UEditor/link-commands.ts
|
|
32593
32697
|
var import_state9 = require("@tiptap/pm/state");
|
|
32698
|
+
function applyEditorLink(editor, href) {
|
|
32699
|
+
const isEditingLink = editor.isActive("link");
|
|
32700
|
+
const hasSelectedText = !editor.state.selection.empty;
|
|
32701
|
+
const chain = editor.chain().focus();
|
|
32702
|
+
if (isEditingLink) {
|
|
32703
|
+
chain.extendMarkRange("link");
|
|
32704
|
+
}
|
|
32705
|
+
chain.setLink({ href });
|
|
32706
|
+
if (!hasSelectedText && !isEditingLink) {
|
|
32707
|
+
chain.insertContent(href);
|
|
32708
|
+
}
|
|
32709
|
+
return chain.command(({ tr }) => {
|
|
32710
|
+
tr.setSelection(import_state9.TextSelection.create(tr.doc, tr.selection.to));
|
|
32711
|
+
tr.removeStoredMark(editor.schema.marks.link);
|
|
32712
|
+
return true;
|
|
32713
|
+
}).run();
|
|
32714
|
+
}
|
|
32715
|
+
|
|
32716
|
+
// src/components/UEditor/table-cell-commands.ts
|
|
32717
|
+
var import_state10 = require("@tiptap/pm/state");
|
|
32594
32718
|
var import_tables3 = require("@tiptap/pm/tables");
|
|
32595
32719
|
function getCellSelectionPositions(selection) {
|
|
32596
32720
|
const value = selection;
|
|
@@ -32624,7 +32748,7 @@ function getFocusableCellPos(editor, cellPos) {
|
|
|
32624
32748
|
return node?.isTextblock ? offset + 1 : cellPos + 1;
|
|
32625
32749
|
}
|
|
32626
32750
|
function focusCell(editor, cellPos) {
|
|
32627
|
-
const selection =
|
|
32751
|
+
const selection = import_state10.TextSelection.near(editor.state.doc.resolve(getFocusableCellPos(editor, cellPos)));
|
|
32628
32752
|
editor.view.dispatch(editor.state.tr.setSelection(selection));
|
|
32629
32753
|
editor.view.focus();
|
|
32630
32754
|
}
|
|
@@ -33099,6 +33223,7 @@ var EditorToolbar = ({
|
|
|
33099
33223
|
const canMergeCells = hasTableContext && editor.can().mergeCells();
|
|
33100
33224
|
const canSplitCell = hasTableContext && editor.can().splitCell();
|
|
33101
33225
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
33226
|
+
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
33102
33227
|
const currentFontFamily = normalizeStyleValue(textStyleAttrs.fontFamily);
|
|
33103
33228
|
const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
|
|
33104
33229
|
const currentTextColor = normalizeStyleValue(textStyleAttrs.color) || "inherit";
|
|
@@ -33160,6 +33285,34 @@ var EditorToolbar = ({
|
|
|
33160
33285
|
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.List, { className: "w-4 h-4" })
|
|
33161
33286
|
}
|
|
33162
33287
|
),
|
|
33288
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
33289
|
+
DropdownMenu,
|
|
33290
|
+
{
|
|
33291
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(ToolbarButton, { onClick: () => {
|
|
33292
|
+
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
33293
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.SquareCheckBig, { className: "w-4 h-4" }),
|
|
33294
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
33295
|
+
] }),
|
|
33296
|
+
children: [
|
|
33297
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33298
|
+
DropdownMenuItem,
|
|
33299
|
+
{
|
|
33300
|
+
icon: import_lucide_react53.SquareCheckBig,
|
|
33301
|
+
label: t("slashCommand.formCheckbox"),
|
|
33302
|
+
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
33303
|
+
}
|
|
33304
|
+
),
|
|
33305
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33306
|
+
DropdownMenuItem,
|
|
33307
|
+
{
|
|
33308
|
+
icon: import_lucide_react53.CircleCheckBig,
|
|
33309
|
+
label: t("slashCommand.roundCheckbox"),
|
|
33310
|
+
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
33311
|
+
}
|
|
33312
|
+
)
|
|
33313
|
+
]
|
|
33314
|
+
}
|
|
33315
|
+
),
|
|
33163
33316
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33164
33317
|
DropdownMenu,
|
|
33165
33318
|
{
|
|
@@ -33170,7 +33323,7 @@ var EditorToolbar = ({
|
|
|
33170
33323
|
{
|
|
33171
33324
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
33172
33325
|
onSubmit: (url) => {
|
|
33173
|
-
editor
|
|
33326
|
+
applyEditorLink(editor, url);
|
|
33174
33327
|
setShowLinkInput(false);
|
|
33175
33328
|
},
|
|
33176
33329
|
onCancel: () => setShowLinkInput(false)
|
|
@@ -33407,7 +33560,7 @@ var EditorToolbar = ({
|
|
|
33407
33560
|
{
|
|
33408
33561
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
33409
33562
|
onSubmit: (url) => {
|
|
33410
|
-
editor
|
|
33563
|
+
applyEditorLink(editor, url);
|
|
33411
33564
|
setShowLinkInput(false);
|
|
33412
33565
|
},
|
|
33413
33566
|
onCancel: () => setShowLinkInput(false)
|
|
@@ -33585,6 +33738,36 @@ var EditorToolbar = ({
|
|
|
33585
33738
|
] })
|
|
33586
33739
|
]
|
|
33587
33740
|
}
|
|
33741
|
+
),
|
|
33742
|
+
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
33743
|
+
DropdownMenu,
|
|
33744
|
+
{
|
|
33745
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(ToolbarButton, { onClick: () => {
|
|
33746
|
+
}, title: t("tableMenu.textDirection"), children: [
|
|
33747
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.ArrowRight, { className: "w-4 h-4" }),
|
|
33748
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
33749
|
+
] }),
|
|
33750
|
+
children: [
|
|
33751
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33752
|
+
DropdownMenuItem,
|
|
33753
|
+
{
|
|
33754
|
+
icon: import_lucide_react53.ArrowRight,
|
|
33755
|
+
label: t("tableMenu.horizontalText"),
|
|
33756
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", null),
|
|
33757
|
+
active: currentCellTextDirection === "horizontal"
|
|
33758
|
+
}
|
|
33759
|
+
),
|
|
33760
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33761
|
+
DropdownMenuItem,
|
|
33762
|
+
{
|
|
33763
|
+
icon: import_lucide_react53.ArrowDown,
|
|
33764
|
+
label: t("tableMenu.verticalText"),
|
|
33765
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
|
|
33766
|
+
active: currentCellTextDirection === "vertical"
|
|
33767
|
+
}
|
|
33768
|
+
)
|
|
33769
|
+
]
|
|
33770
|
+
}
|
|
33588
33771
|
)
|
|
33589
33772
|
] }),
|
|
33590
33773
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ToolbarDivider, {}),
|
|
@@ -33630,6 +33813,34 @@ var EditorToolbar = ({
|
|
|
33630
33813
|
]
|
|
33631
33814
|
}
|
|
33632
33815
|
),
|
|
33816
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
33817
|
+
DropdownMenu,
|
|
33818
|
+
{
|
|
33819
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(ToolbarButton, { onClick: () => {
|
|
33820
|
+
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
33821
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.SquareCheckBig, { className: "w-4 h-4" }),
|
|
33822
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
33823
|
+
] }),
|
|
33824
|
+
children: [
|
|
33825
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33826
|
+
DropdownMenuItem,
|
|
33827
|
+
{
|
|
33828
|
+
icon: import_lucide_react53.SquareCheckBig,
|
|
33829
|
+
label: t("slashCommand.formCheckbox"),
|
|
33830
|
+
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
33831
|
+
}
|
|
33832
|
+
),
|
|
33833
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
33834
|
+
DropdownMenuItem,
|
|
33835
|
+
{
|
|
33836
|
+
icon: import_lucide_react53.CircleCheckBig,
|
|
33837
|
+
label: t("slashCommand.roundCheckbox"),
|
|
33838
|
+
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
33839
|
+
}
|
|
33840
|
+
)
|
|
33841
|
+
]
|
|
33842
|
+
}
|
|
33843
|
+
),
|
|
33633
33844
|
isMediumFull && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react53.Quote, { className: "w-4 h-4" }) }),
|
|
33634
33845
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
33635
33846
|
DropdownMenu,
|
|
@@ -34004,7 +34215,7 @@ var import_react_dom8 = require("react-dom");
|
|
|
34004
34215
|
var import_lucide_react54 = require("lucide-react");
|
|
34005
34216
|
|
|
34006
34217
|
// src/components/UEditor/table-formula-commands.ts
|
|
34007
|
-
var
|
|
34218
|
+
var import_state11 = require("@tiptap/pm/state");
|
|
34008
34219
|
var import_tables5 = require("@tiptap/pm/tables");
|
|
34009
34220
|
|
|
34010
34221
|
// src/components/UEditor/table-formula.ts
|
|
@@ -34620,7 +34831,7 @@ function restoreSelectionAtTableCell(editor, anchor) {
|
|
|
34620
34831
|
if (!cellNode || cellNode.type.name !== "tableCell" && cellNode.type.name !== "tableHeader") return false;
|
|
34621
34832
|
const selectionPos = Math.min(cellPos + 2, editor.state.doc.content.size);
|
|
34622
34833
|
editor.view.dispatch(
|
|
34623
|
-
editor.state.tr.setSelection(
|
|
34834
|
+
editor.state.tr.setSelection(import_state11.TextSelection.near(editor.state.doc.resolve(selectionPos))).setMeta("addToHistory", false)
|
|
34624
34835
|
);
|
|
34625
34836
|
return true;
|
|
34626
34837
|
}
|
|
@@ -34697,7 +34908,7 @@ function removeSelectedTableCellFormula(editor, clearContent) {
|
|
|
34697
34908
|
);
|
|
34698
34909
|
let transaction = editor.state.tr.replaceWith(selectedCell.cellPos, selectedCell.cellPos + selectedCell.node.nodeSize, nextCell2).setMeta(UEDITOR_TABLE_FORMULA_RECALCULATE_META, true);
|
|
34699
34910
|
const selectionPos = Math.min(selectedCell.cellPos + 2, transaction.doc.content.size);
|
|
34700
|
-
transaction = transaction.setSelection(
|
|
34911
|
+
transaction = transaction.setSelection(import_state11.TextSelection.near(transaction.doc.resolve(selectionPos)));
|
|
34701
34912
|
editor.view.dispatch(transaction);
|
|
34702
34913
|
recalculateActiveTableFormulas(editor);
|
|
34703
34914
|
restoreSelectionAtTableCell(editor, selectedCell);
|
|
@@ -35076,6 +35287,7 @@ var BubbleMenuContent = ({
|
|
|
35076
35287
|
const currentCellBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
35077
35288
|
const currentCellBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
35078
35289
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
35290
|
+
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
35079
35291
|
const isInTable2 = (0, import_tables6.isInTable)(editor.state);
|
|
35080
35292
|
const canMergeCells = isInTable2 && editor.can().mergeCells();
|
|
35081
35293
|
const canSplitCell = isInTable2 && editor.can().splitCell();
|
|
@@ -35183,7 +35395,7 @@ var BubbleMenuContent = ({
|
|
|
35183
35395
|
{
|
|
35184
35396
|
initialUrl: editor.getAttributes("link").href || "",
|
|
35185
35397
|
onSubmit: (url) => {
|
|
35186
|
-
editor
|
|
35398
|
+
applyEditorLink(editor, url);
|
|
35187
35399
|
setShowLinkInput(false);
|
|
35188
35400
|
requestAnimationFrame(() => editor.commands.focus());
|
|
35189
35401
|
},
|
|
@@ -35719,6 +35931,49 @@ var BubbleMenuContent = ({
|
|
|
35719
35931
|
)
|
|
35720
35932
|
]
|
|
35721
35933
|
}
|
|
35934
|
+
),
|
|
35935
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
35936
|
+
DropdownMenu,
|
|
35937
|
+
{
|
|
35938
|
+
onOpenChange: (open) => {
|
|
35939
|
+
onKeepOpenChange?.(open);
|
|
35940
|
+
},
|
|
35941
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
35942
|
+
ToolbarButton,
|
|
35943
|
+
{
|
|
35944
|
+
onMouseDown: () => {
|
|
35945
|
+
onKeepOpenChange?.(true);
|
|
35946
|
+
},
|
|
35947
|
+
onClick: () => {
|
|
35948
|
+
},
|
|
35949
|
+
title: t("tableMenu.textDirection"),
|
|
35950
|
+
children: [
|
|
35951
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react54.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react54.ArrowRight, { className: "w-4 h-4" }),
|
|
35952
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react54.ChevronDown, { className: "w-3 h-3" })
|
|
35953
|
+
]
|
|
35954
|
+
}
|
|
35955
|
+
),
|
|
35956
|
+
children: [
|
|
35957
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
35958
|
+
DropdownMenuItem,
|
|
35959
|
+
{
|
|
35960
|
+
icon: import_lucide_react54.ArrowRight,
|
|
35961
|
+
label: t("tableMenu.horizontalText"),
|
|
35962
|
+
onClick: () => applyTableCellAttribute2(editor, "textDirection", null, { focus: false }),
|
|
35963
|
+
active: currentCellTextDirection === "horizontal"
|
|
35964
|
+
}
|
|
35965
|
+
),
|
|
35966
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
35967
|
+
DropdownMenuItem,
|
|
35968
|
+
{
|
|
35969
|
+
icon: import_lucide_react54.ArrowDown,
|
|
35970
|
+
label: t("tableMenu.verticalText"),
|
|
35971
|
+
onClick: () => applyTableCellAttribute2(editor, "textDirection", "vertical", { focus: false }),
|
|
35972
|
+
active: currentCellTextDirection === "vertical"
|
|
35973
|
+
}
|
|
35974
|
+
)
|
|
35975
|
+
]
|
|
35976
|
+
}
|
|
35722
35977
|
)
|
|
35723
35978
|
] }),
|
|
35724
35979
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
@@ -39040,7 +39295,7 @@ var Selection = class {
|
|
|
39040
39295
|
found.
|
|
39041
39296
|
*/
|
|
39042
39297
|
static findFrom($pos, dir, textOnly = false) {
|
|
39043
|
-
let inner = $pos.parent.inlineContent ? new
|
|
39298
|
+
let inner = $pos.parent.inlineContent ? new TextSelection5($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
|
|
39044
39299
|
if (inner)
|
|
39045
39300
|
return inner;
|
|
39046
39301
|
for (let depth = $pos.depth - 1; depth >= 0; depth--) {
|
|
@@ -39109,7 +39364,7 @@ var Selection = class {
|
|
|
39109
39364
|
returns the bookmark for that.
|
|
39110
39365
|
*/
|
|
39111
39366
|
getBookmark() {
|
|
39112
|
-
return
|
|
39367
|
+
return TextSelection5.between(this.$anchor, this.$head).getBookmark();
|
|
39113
39368
|
}
|
|
39114
39369
|
};
|
|
39115
39370
|
Selection.prototype.visible = true;
|
|
@@ -39129,7 +39384,7 @@ function checkTextSelection($pos) {
|
|
|
39129
39384
|
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
39130
39385
|
}
|
|
39131
39386
|
}
|
|
39132
|
-
var
|
|
39387
|
+
var TextSelection5 = class _TextSelection extends Selection {
|
|
39133
39388
|
/**
|
|
39134
39389
|
Construct a text selection between the given points.
|
|
39135
39390
|
*/
|
|
@@ -39215,7 +39470,7 @@ var TextSelection4 = class _TextSelection extends Selection {
|
|
|
39215
39470
|
return new _TextSelection($anchor, $head);
|
|
39216
39471
|
}
|
|
39217
39472
|
};
|
|
39218
|
-
Selection.jsonID("text",
|
|
39473
|
+
Selection.jsonID("text", TextSelection5);
|
|
39219
39474
|
var TextBookmark = class _TextBookmark {
|
|
39220
39475
|
constructor(anchor, head) {
|
|
39221
39476
|
this.anchor = anchor;
|
|
@@ -39225,7 +39480,7 @@ var TextBookmark = class _TextBookmark {
|
|
|
39225
39480
|
return new _TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
|
|
39226
39481
|
}
|
|
39227
39482
|
resolve(doc) {
|
|
39228
|
-
return
|
|
39483
|
+
return TextSelection5.between(doc.resolve(this.anchor), doc.resolve(this.head));
|
|
39229
39484
|
}
|
|
39230
39485
|
};
|
|
39231
39486
|
var NodeSelection2 = class _NodeSelection extends Selection {
|
|
@@ -39344,7 +39599,7 @@ var AllBookmark = {
|
|
|
39344
39599
|
};
|
|
39345
39600
|
function findSelectionIn(doc, node, pos, index, dir, text = false) {
|
|
39346
39601
|
if (node.inlineContent)
|
|
39347
|
-
return
|
|
39602
|
+
return TextSelection5.create(doc, pos);
|
|
39348
39603
|
for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
|
|
39349
39604
|
let child = node.child(i);
|
|
39350
39605
|
if (!child.isAtom) {
|
|
@@ -39936,7 +40191,7 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
39936
40191
|
else if (tableChanged && this.isColSelection()) return CellSelection2.colSelection($anchorCell, $headCell);
|
|
39937
40192
|
else return new CellSelection2($anchorCell, $headCell);
|
|
39938
40193
|
}
|
|
39939
|
-
return
|
|
40194
|
+
return TextSelection5.between($anchorCell, $headCell);
|
|
39940
40195
|
}
|
|
39941
40196
|
content() {
|
|
39942
40197
|
const table = this.$anchorCell.node(-1);
|
|
@@ -40551,7 +40806,7 @@ function shiftArrow(axis, dir) {
|
|
|
40551
40806
|
};
|
|
40552
40807
|
}
|
|
40553
40808
|
function atEndOfCell(view, axis, dir) {
|
|
40554
|
-
if (!(view.state.selection instanceof
|
|
40809
|
+
if (!(view.state.selection instanceof TextSelection5)) return null;
|
|
40555
40810
|
const { $head } = view.state.selection;
|
|
40556
40811
|
for (let d = $head.depth - 1; d >= 0; d--) {
|
|
40557
40812
|
const parent = $head.node(d);
|
|
@@ -42442,7 +42697,7 @@ var import_react77 = require("react");
|
|
|
42442
42697
|
var import_tables8 = require("@tiptap/pm/tables");
|
|
42443
42698
|
|
|
42444
42699
|
// src/components/UEditor/table-formula-range-picker.ts
|
|
42445
|
-
var
|
|
42700
|
+
var import_state12 = require("@tiptap/pm/state");
|
|
42446
42701
|
var import_tables7 = require("@tiptap/pm/tables");
|
|
42447
42702
|
function getCellText2(cellNode) {
|
|
42448
42703
|
return cellNode.textBetween(0, cellNode.content.size, "\n").trim();
|
|
@@ -42520,7 +42775,7 @@ function cancelFormulaEditing(view) {
|
|
|
42520
42775
|
if (!context) return false;
|
|
42521
42776
|
let tr = view.state.tr.delete(context.cellContentStart, context.cellContentEnd);
|
|
42522
42777
|
const selectionPos = Math.min(context.cellContentStart, tr.doc.content.size);
|
|
42523
|
-
tr = tr.setSelection(
|
|
42778
|
+
tr = tr.setSelection(import_state12.TextSelection.near(tr.doc.resolve(selectionPos)));
|
|
42524
42779
|
view.dispatch(tr);
|
|
42525
42780
|
view.focus();
|
|
42526
42781
|
return true;
|
|
@@ -42597,7 +42852,7 @@ function replacePickedLabel(view, pickState, nextLabel, currentCell) {
|
|
|
42597
42852
|
}
|
|
42598
42853
|
let tr = view.state.tr.insertText(nextLabel, pickState.insertedFrom, pickState.insertedTo);
|
|
42599
42854
|
const nextTo = pickState.insertedFrom + nextLabel.length;
|
|
42600
|
-
tr = tr.setSelection(
|
|
42855
|
+
tr = tr.setSelection(import_state12.TextSelection.create(tr.doc, nextTo));
|
|
42601
42856
|
view.dispatch(tr);
|
|
42602
42857
|
return {
|
|
42603
42858
|
...pickState,
|
|
@@ -42634,7 +42889,7 @@ function beginFormulaRangePick(view, event) {
|
|
|
42634
42889
|
const insertedText = `${prefix}${picked.label}`;
|
|
42635
42890
|
const insertedFrom = from + prefix.length;
|
|
42636
42891
|
let tr = view.state.tr.insertText(insertedText, from, to);
|
|
42637
|
-
tr = tr.setSelection(
|
|
42892
|
+
tr = tr.setSelection(import_state12.TextSelection.create(tr.doc, from + insertedText.length));
|
|
42638
42893
|
view.dispatch(tr);
|
|
42639
42894
|
view.focus();
|
|
42640
42895
|
event.preventDefault();
|
|
@@ -43571,7 +43826,7 @@ var MenuBar = ({
|
|
|
43571
43826
|
closeInsertMenu();
|
|
43572
43827
|
};
|
|
43573
43828
|
const handleLinkSubmit = (url) => {
|
|
43574
|
-
editor
|
|
43829
|
+
applyEditorLink(editor, url);
|
|
43575
43830
|
closeInsertMenu();
|
|
43576
43831
|
};
|
|
43577
43832
|
const insertMenuItems = [
|
|
@@ -43638,6 +43893,12 @@ var MenuBar = ({
|
|
|
43638
43893
|
icon: import_lucide_react58.Square,
|
|
43639
43894
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
43640
43895
|
},
|
|
43896
|
+
{
|
|
43897
|
+
type: "action",
|
|
43898
|
+
label: t("slashCommand.roundCheckbox") || "Round Checkbox",
|
|
43899
|
+
icon: import_lucide_react58.CircleCheckBig,
|
|
43900
|
+
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
43901
|
+
},
|
|
43641
43902
|
{
|
|
43642
43903
|
type: "action",
|
|
43643
43904
|
label: t("menubar.formRadio") || "Form Radio Button",
|