@underverse-ui/underverse 1.0.205 → 1.0.206
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-BAWP2RAS.js → EmojiPicker-FEJJDAWZ.js} +4 -4
- package/dist/{chunk-2V6A6PGI.js → chunk-4E43DRP2.js} +102 -24
- package/dist/chunk-4E43DRP2.js.map +1 -0
- package/dist/{chunk-MJV7ETJM.js → chunk-AMAILXHP.js} +61 -36
- package/dist/chunk-AMAILXHP.js.map +1 -0
- package/dist/{chunk-XJR7E6QB.js → chunk-BRDGIALS.js} +13 -5
- package/dist/chunk-BRDGIALS.js.map +1 -0
- package/dist/{chunk-IXEFOLUD.js → chunk-CYCBSKWI.js} +2 -2
- package/dist/{chunk-Z63YNF3N.js → chunk-F6A7HJE4.js} +3 -3
- package/dist/{chunk-7U3Y7R7U.js → chunk-GKY5DHGR.js} +3 -3
- package/dist/index.cjs +171 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +6 -6
- package/dist/{menu-bar-NDAP3SOR.js → menu-bar-6GS5LLTD.js} +4 -4
- package/dist/ueditor.cjs +171 -62
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-2V6A6PGI.js.map +0 -1
- package/dist/chunk-MJV7ETJM.js.map +0 -1
- package/dist/chunk-XJR7E6QB.js.map +0 -1
- /package/dist/{EmojiPicker-BAWP2RAS.js.map → EmojiPicker-FEJJDAWZ.js.map} +0 -0
- /package/dist/{chunk-IXEFOLUD.js.map → chunk-CYCBSKWI.js.map} +0 -0
- /package/dist/{chunk-Z63YNF3N.js.map → chunk-F6A7HJE4.js.map} +0 -0
- /package/dist/{chunk-7U3Y7R7U.js.map → chunk-GKY5DHGR.js.map} +0 -0
- /package/dist/{menu-bar-NDAP3SOR.js.map → menu-bar-6GS5LLTD.js.map} +0 -0
package/dist/ueditor.cjs
CHANGED
|
@@ -378,7 +378,9 @@ var init_en = __esm({
|
|
|
378
378
|
alignVerticalBottom: "Bottom Align",
|
|
379
379
|
textDirection: "Text Direction",
|
|
380
380
|
horizontalText: "Horizontal Text",
|
|
381
|
-
verticalText: "Vertical Text"
|
|
381
|
+
verticalText: "Vertical Text",
|
|
382
|
+
wrapText: "Wrap Text",
|
|
383
|
+
noWrapText: "Don't Wrap Text"
|
|
382
384
|
},
|
|
383
385
|
callout: {
|
|
384
386
|
selectEmoji: "Select Emoji",
|
|
@@ -834,7 +836,9 @@ var init_vi = __esm({
|
|
|
834
836
|
alignVerticalBottom: "C\u0103n d\u01B0\u1EDBi",
|
|
835
837
|
textDirection: "H\u01B0\u1EDBng ch\u1EEF",
|
|
836
838
|
horizontalText: "Ch\u1EEF ngang",
|
|
837
|
-
verticalText: "Ch\u1EEF d\u1ECDc"
|
|
839
|
+
verticalText: "Ch\u1EEF d\u1ECDc",
|
|
840
|
+
wrapText: "T\u1EF1 xu\u1ED1ng d\xF2ng",
|
|
841
|
+
noWrapText: "Kh\xF4ng xu\u1ED1ng d\xF2ng"
|
|
838
842
|
},
|
|
839
843
|
callout: {
|
|
840
844
|
selectEmoji: "Ch\u1ECDn Bi\u1EC3u t\u01B0\u1EE3ng",
|
|
@@ -1290,7 +1294,9 @@ var init_ko = __esm({
|
|
|
1290
1294
|
alignVerticalBottom: "\uC544\uB798\uCABD \uB9DE\uCDA4",
|
|
1291
1295
|
textDirection: "\uD14D\uC2A4\uD2B8 \uBC29\uD5A5",
|
|
1292
1296
|
horizontalText: "\uAC00\uB85C\uC4F0\uAE30",
|
|
1293
|
-
verticalText: "\uC138\uB85C\uC4F0\uAE30"
|
|
1297
|
+
verticalText: "\uC138\uB85C\uC4F0\uAE30",
|
|
1298
|
+
wrapText: "\uD14D\uC2A4\uD2B8 \uC904 \uBC14\uAFC8",
|
|
1299
|
+
noWrapText: "\uC904 \uBC14\uAFC8 \uC548 \uD568"
|
|
1294
1300
|
},
|
|
1295
1301
|
callout: {
|
|
1296
1302
|
selectEmoji: "\uC774\uBAA8\uC9C0 \uC120\uD0DD",
|
|
@@ -1746,7 +1752,9 @@ var init_ja = __esm({
|
|
|
1746
1752
|
alignVerticalBottom: "\u4E0B\u63C3\u3048",
|
|
1747
1753
|
textDirection: "\u6587\u5B57\u65B9\u5411",
|
|
1748
1754
|
horizontalText: "\u6A2A\u66F8\u304D",
|
|
1749
|
-
verticalText: "\u7E26\u66F8\u304D"
|
|
1755
|
+
verticalText: "\u7E26\u66F8\u304D",
|
|
1756
|
+
wrapText: "\u30C6\u30AD\u30B9\u30C8\u3092\u6298\u308A\u8FD4\u3059",
|
|
1757
|
+
noWrapText: "\u6298\u308A\u8FD4\u3055\u306A\u3044"
|
|
1750
1758
|
},
|
|
1751
1759
|
callout: {
|
|
1752
1760
|
selectEmoji: "\u7D75\u6587\u5B57\u3092\u9078\u629E",
|
|
@@ -5137,16 +5145,19 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
|
|
|
5137
5145
|
const tableDom = editor.view.nodeDOM(tableInfo.pos);
|
|
5138
5146
|
const tableElement = domAtTableElement?.closest?.("table") ?? (tableDom instanceof HTMLTableElement ? tableDom : tableDom instanceof HTMLElement ? tableDom.querySelector("table") : null) ?? (editor.view.dom.querySelectorAll("table").length === 1 ? editor.view.dom.querySelector("table") : null);
|
|
5139
5147
|
if (tableElement instanceof HTMLTableElement) {
|
|
5148
|
+
tableElement.style.tableLayout = "fixed";
|
|
5149
|
+
if (tableElement.style.width === "max-content") {
|
|
5150
|
+
tableElement.style.removeProperty("width");
|
|
5151
|
+
}
|
|
5152
|
+
if (tableElement.style.maxWidth === "100%") {
|
|
5153
|
+
tableElement.style.removeProperty("max-width");
|
|
5154
|
+
}
|
|
5140
5155
|
if (tableAlign) {
|
|
5141
5156
|
tableElement.setAttribute("data-table-align", tableAlign);
|
|
5142
|
-
tableElement.style.width = "max-content";
|
|
5143
|
-
tableElement.style.maxWidth = "100%";
|
|
5144
5157
|
tableElement.style.marginLeft = tableAlign === "center" || tableAlign === "right" ? "auto" : "0";
|
|
5145
5158
|
tableElement.style.marginRight = tableAlign === "center" ? "auto" : tableAlign === "right" ? "0" : "auto";
|
|
5146
5159
|
} else {
|
|
5147
5160
|
tableElement.removeAttribute("data-table-align");
|
|
5148
|
-
tableElement.style.removeProperty("width");
|
|
5149
|
-
tableElement.style.removeProperty("max-width");
|
|
5150
5161
|
tableElement.style.removeProperty("margin-left");
|
|
5151
5162
|
tableElement.style.removeProperty("margin-right");
|
|
5152
5163
|
}
|
|
@@ -6661,6 +6672,7 @@ function computeEditorUiRenderState(editor) {
|
|
|
6661
6672
|
formula: tableCell.formula ?? tableHeader.formula ?? null,
|
|
6662
6673
|
numberFormat: tableCell.numberFormat ?? tableHeader.numberFormat ?? null,
|
|
6663
6674
|
textDirection: tableCell.textDirection ?? tableHeader.textDirection ?? null,
|
|
6675
|
+
textWrap: tableCell.textWrap ?? tableHeader.textWrap ?? "wrap",
|
|
6664
6676
|
verticalAlign: tableCell.verticalAlign ?? tableHeader.verticalAlign ?? null
|
|
6665
6677
|
},
|
|
6666
6678
|
can: {
|
|
@@ -6872,6 +6884,7 @@ var init_toolbar = __esm({
|
|
|
6872
6884
|
const canSplitCell = hasTableContext && editor.can().splitCell();
|
|
6873
6885
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
6874
6886
|
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
6887
|
+
const currentCellTextWrap = normalizeStyleValue(editor.getAttributes("tableCell").textWrap || editor.getAttributes("tableHeader").textWrap) || "wrap";
|
|
6875
6888
|
const currentFontFamily = normalizeStyleValue(textStyleAttrs.fontFamily);
|
|
6876
6889
|
const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
|
|
6877
6890
|
const currentTextColor = normalizeStyleValue(textStyleAttrs.color) || "inherit";
|
|
@@ -7382,33 +7395,44 @@ var init_toolbar = __esm({
|
|
|
7382
7395
|
]
|
|
7383
7396
|
}
|
|
7384
7397
|
),
|
|
7385
|
-
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7398
|
+
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
7399
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
7400
|
+
DropdownMenu,
|
|
7401
|
+
{
|
|
7402
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => {
|
|
7403
|
+
}, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.ArrowRight, { className: "w-4 h-4" }) }),
|
|
7404
|
+
children: [
|
|
7405
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7406
|
+
DropdownMenuItem,
|
|
7407
|
+
{
|
|
7408
|
+
icon: import_lucide_react13.ArrowRight,
|
|
7409
|
+
label: t("tableMenu.horizontalText"),
|
|
7410
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", null),
|
|
7411
|
+
active: currentCellTextDirection === "horizontal"
|
|
7412
|
+
}
|
|
7413
|
+
),
|
|
7414
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7415
|
+
DropdownMenuItem,
|
|
7416
|
+
{
|
|
7417
|
+
icon: import_lucide_react13.ArrowDown,
|
|
7418
|
+
label: t("tableMenu.verticalText"),
|
|
7419
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
|
|
7420
|
+
active: currentCellTextDirection === "vertical"
|
|
7421
|
+
}
|
|
7422
|
+
)
|
|
7423
|
+
]
|
|
7424
|
+
}
|
|
7425
|
+
),
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
7427
|
+
ToolbarButton,
|
|
7428
|
+
{
|
|
7429
|
+
onClick: () => applyTableCellAttribute(editor, "textWrap", currentCellTextWrap === "nowrap" ? "wrap" : "nowrap"),
|
|
7430
|
+
active: currentCellTextWrap !== "nowrap",
|
|
7431
|
+
title: currentCellTextWrap === "nowrap" ? t("tableMenu.wrapText") : t("tableMenu.noWrapText"),
|
|
7432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.WrapText, { className: "h-4 w-4" })
|
|
7433
|
+
}
|
|
7434
|
+
)
|
|
7435
|
+
] })
|
|
7412
7436
|
] }),
|
|
7413
7437
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarDivider, {}),
|
|
7414
7438
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
@@ -7795,8 +7819,6 @@ var init_editor_styles = __esm({
|
|
|
7795
7819
|
"[&_table]:table-fixed",
|
|
7796
7820
|
"[&_table]:overflow-hidden",
|
|
7797
7821
|
"[&_table]:select-text",
|
|
7798
|
-
"[&_table[data-table-align]]:w-max",
|
|
7799
|
-
"[&_table[data-table-align]]:max-w-full",
|
|
7800
7822
|
"[&_table[data-table-align='center']]:mx-auto",
|
|
7801
7823
|
"[&_table[data-table-align='right']]:ml-auto",
|
|
7802
7824
|
"[&_table[data-table-align='right']]:mr-0",
|
|
@@ -7806,6 +7828,11 @@ var init_editor_styles = __esm({
|
|
|
7806
7828
|
"[&_td]:select-text",
|
|
7807
7829
|
"[&_td]:px-2",
|
|
7808
7830
|
"[&_td]:py-0",
|
|
7831
|
+
"[&_td]:whitespace-normal",
|
|
7832
|
+
"[&_td]:[overflow-wrap:anywhere]",
|
|
7833
|
+
"[&_td]:[word-break:normal]",
|
|
7834
|
+
"[&_td[data-text-wrap='nowrap']]:whitespace-nowrap",
|
|
7835
|
+
"[&_td[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
|
|
7809
7836
|
"[&_td_p]:my-0",
|
|
7810
7837
|
"[&_th]:relative",
|
|
7811
7838
|
"[&_th]:align-top",
|
|
@@ -7813,6 +7840,11 @@ var init_editor_styles = __esm({
|
|
|
7813
7840
|
"[&_th]:select-text",
|
|
7814
7841
|
"[&_th]:px-2",
|
|
7815
7842
|
"[&_th]:py-0",
|
|
7843
|
+
"[&_th]:whitespace-normal",
|
|
7844
|
+
"[&_th]:[overflow-wrap:anywhere]",
|
|
7845
|
+
"[&_th]:[word-break:normal]",
|
|
7846
|
+
"[&_th[data-text-wrap='nowrap']]:whitespace-nowrap",
|
|
7847
|
+
"[&_th[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
|
|
7816
7848
|
"[&_th_p]:my-0",
|
|
7817
7849
|
"[&_td[data-formula]]:pr-7",
|
|
7818
7850
|
"[&_th[data-formula]]:pr-7",
|
|
@@ -9070,7 +9102,7 @@ var import_react45 = require("@tiptap/react");
|
|
|
9070
9102
|
init_cn();
|
|
9071
9103
|
|
|
9072
9104
|
// src/components/UEditor/extensions.ts
|
|
9073
|
-
var
|
|
9105
|
+
var import_core20 = require("@tiptap/core");
|
|
9074
9106
|
var import_extension_document = require("@tiptap/extension-document");
|
|
9075
9107
|
var import_extension_paragraph = require("@tiptap/extension-paragraph");
|
|
9076
9108
|
var import_extension_text = require("@tiptap/extension-text");
|
|
@@ -9087,7 +9119,7 @@ var import_extension_task_list = require("@tiptap/extension-task-list");
|
|
|
9087
9119
|
var import_extension_task_item = require("@tiptap/extension-task-item");
|
|
9088
9120
|
var import_extension_blockquote = require("@tiptap/extension-blockquote");
|
|
9089
9121
|
var import_extension_code = require("@tiptap/extension-code");
|
|
9090
|
-
var
|
|
9122
|
+
var import_core21 = require("@tiptap/core");
|
|
9091
9123
|
var import_react28 = require("@tiptap/react");
|
|
9092
9124
|
|
|
9093
9125
|
// src/components/UEditor/callout.ts
|
|
@@ -11910,6 +11942,7 @@ var Indent = import_core16.Extension.create({
|
|
|
11910
11942
|
var indent_default = Indent;
|
|
11911
11943
|
|
|
11912
11944
|
// src/components/UEditor/table-align.ts
|
|
11945
|
+
var import_core17 = require("@tiptap/core");
|
|
11913
11946
|
var import_extension_table = require("@tiptap/extension-table");
|
|
11914
11947
|
var import_state7 = require("@tiptap/pm/state");
|
|
11915
11948
|
var import_tables3 = require("@tiptap/pm/tables");
|
|
@@ -11920,12 +11953,13 @@ var import_view2 = require("@tiptap/pm/view");
|
|
|
11920
11953
|
var import_tables2 = require("@tiptap/pm/tables");
|
|
11921
11954
|
var DEFAULT_TABLE_COLUMN_WIDTH = 100;
|
|
11922
11955
|
var MIN_RESIZED_TABLE_COLUMN_WIDTH = 25;
|
|
11923
|
-
function
|
|
11924
|
-
|
|
11956
|
+
function getColumnResizeMinWidth(configuredMinWidth) {
|
|
11957
|
+
const normalizedMinWidth = Number.isFinite(configuredMinWidth) && configuredMinWidth > 0 ? Math.round(configuredMinWidth) : MIN_RESIZED_TABLE_COLUMN_WIDTH;
|
|
11958
|
+
return Math.max(MIN_RESIZED_TABLE_COLUMN_WIDTH, normalizedMinWidth);
|
|
11925
11959
|
}
|
|
11926
11960
|
function setColumnStyle(column, width) {
|
|
11927
11961
|
if (width == null) {
|
|
11928
|
-
column.style.width =
|
|
11962
|
+
column.style.width = `${DEFAULT_TABLE_COLUMN_WIDTH}px`;
|
|
11929
11963
|
column.style.minWidth = `${DEFAULT_TABLE_COLUMN_WIDTH}px`;
|
|
11930
11964
|
return;
|
|
11931
11965
|
}
|
|
@@ -11937,7 +11971,6 @@ function isTableColumnElement(node) {
|
|
|
11937
11971
|
}
|
|
11938
11972
|
function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue) {
|
|
11939
11973
|
let totalWidth = 0;
|
|
11940
|
-
let fixedWidth = true;
|
|
11941
11974
|
let nextDOM = colgroup.firstChild;
|
|
11942
11975
|
const row = node.firstChild;
|
|
11943
11976
|
if (row) {
|
|
@@ -11947,9 +11980,6 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
11947
11980
|
const rawWidth = overrideCol === col ? overrideValue : colwidth?.[spanIndex];
|
|
11948
11981
|
const width = rawWidth ? Math.max(rawWidth, MIN_RESIZED_TABLE_COLUMN_WIDTH) : null;
|
|
11949
11982
|
totalWidth += width ?? DEFAULT_TABLE_COLUMN_WIDTH;
|
|
11950
|
-
if (!width) {
|
|
11951
|
-
fixedWidth = false;
|
|
11952
|
-
}
|
|
11953
11983
|
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(document.createElement("col"));
|
|
11954
11984
|
setColumnStyle(colElement, width);
|
|
11955
11985
|
nextDOM = colElement.nextSibling;
|
|
@@ -11962,11 +11992,10 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
11962
11992
|
nextDOM = after;
|
|
11963
11993
|
}
|
|
11964
11994
|
const hasUserWidth = typeof node.attrs.style === "string" && /\bwidth\s*:/i.test(node.attrs.style);
|
|
11965
|
-
if (
|
|
11995
|
+
if (!hasUserWidth) {
|
|
11966
11996
|
table.style.width = `${totalWidth}px`;
|
|
11967
11997
|
table.style.minWidth = "";
|
|
11968
11998
|
} else {
|
|
11969
|
-
table.style.width = "";
|
|
11970
11999
|
table.style.minWidth = `${totalWidth}px`;
|
|
11971
12000
|
}
|
|
11972
12001
|
}
|
|
@@ -11979,6 +12008,7 @@ var UEditorTableView = class {
|
|
|
11979
12008
|
if (node.attrs.style) {
|
|
11980
12009
|
this.table.style.cssText = node.attrs.style;
|
|
11981
12010
|
}
|
|
12011
|
+
this.table.style.tableLayout = "fixed";
|
|
11982
12012
|
this.colgroup = this.table.appendChild(document.createElement("colgroup"));
|
|
11983
12013
|
updateDynamicColumns(node, this.colgroup, this.table);
|
|
11984
12014
|
this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
@@ -12160,7 +12190,7 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
12160
12190
|
colspan: attrs.colspan ?? 1,
|
|
12161
12191
|
colwidth: attrs.colwidth
|
|
12162
12192
|
});
|
|
12163
|
-
const minWidth =
|
|
12193
|
+
const minWidth = getColumnResizeMinWidth(cellMinWidth);
|
|
12164
12194
|
const dragging = {
|
|
12165
12195
|
startX: event.clientX,
|
|
12166
12196
|
startWidth: width,
|
|
@@ -12289,15 +12319,37 @@ function parseTableAlign(element) {
|
|
|
12289
12319
|
function renderTableAlignStyle(tableAlign) {
|
|
12290
12320
|
switch (tableAlign) {
|
|
12291
12321
|
case "center":
|
|
12292
|
-
return "
|
|
12322
|
+
return "table-layout: fixed; margin-left: auto; margin-right: auto;";
|
|
12293
12323
|
case "right":
|
|
12294
|
-
return "
|
|
12324
|
+
return "table-layout: fixed; margin-left: auto; margin-right: 0;";
|
|
12295
12325
|
case "left":
|
|
12296
|
-
return "
|
|
12326
|
+
return "table-layout: fixed; margin-left: 0; margin-right: auto;";
|
|
12297
12327
|
default:
|
|
12298
12328
|
return "";
|
|
12299
12329
|
}
|
|
12300
12330
|
}
|
|
12331
|
+
function createUEditorColGroup(node) {
|
|
12332
|
+
const columns = [];
|
|
12333
|
+
let totalWidth = 0;
|
|
12334
|
+
const firstRow = node.firstChild;
|
|
12335
|
+
if (firstRow) {
|
|
12336
|
+
for (let cellIndex = 0; cellIndex < firstRow.childCount; cellIndex += 1) {
|
|
12337
|
+
const cell = firstRow.child(cellIndex);
|
|
12338
|
+
const colspan = Math.max(1, Number(cell.attrs.colspan) || 1);
|
|
12339
|
+
const colwidth = Array.isArray(cell.attrs.colwidth) ? cell.attrs.colwidth : [];
|
|
12340
|
+
for (let spanIndex = 0; spanIndex < colspan; spanIndex += 1) {
|
|
12341
|
+
const storedWidth = Number(colwidth[spanIndex]);
|
|
12342
|
+
const width = Number.isFinite(storedWidth) && storedWidth > 0 ? Math.max(MIN_RESIZED_TABLE_COLUMN_WIDTH, Math.round(storedWidth)) : DEFAULT_TABLE_COLUMN_WIDTH;
|
|
12343
|
+
totalWidth += width;
|
|
12344
|
+
columns.push(["col", { style: `width: ${width}px; min-width: ${width}px;`, width: String(width) }]);
|
|
12345
|
+
}
|
|
12346
|
+
}
|
|
12347
|
+
}
|
|
12348
|
+
return {
|
|
12349
|
+
colgroup: ["colgroup", {}, ...columns],
|
|
12350
|
+
tableWidth: totalWidth > 0 ? `${totalWidth}px` : ""
|
|
12351
|
+
};
|
|
12352
|
+
}
|
|
12301
12353
|
var UEditorTable = import_extension_table.Table.extend({
|
|
12302
12354
|
addGlobalAttributes() {
|
|
12303
12355
|
return [
|
|
@@ -12351,6 +12403,18 @@ var UEditorTable = import_extension_table.Table.extend({
|
|
|
12351
12403
|
}
|
|
12352
12404
|
};
|
|
12353
12405
|
},
|
|
12406
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
12407
|
+
const { colgroup, tableWidth } = createUEditorColGroup(node);
|
|
12408
|
+
const table = [
|
|
12409
|
+
"table",
|
|
12410
|
+
(0, import_core17.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
|
|
12411
|
+
style: tableWidth ? `width: ${tableWidth};` : "table-layout: fixed;"
|
|
12412
|
+
}),
|
|
12413
|
+
colgroup,
|
|
12414
|
+
["tbody", 0]
|
|
12415
|
+
];
|
|
12416
|
+
return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, table] : table;
|
|
12417
|
+
},
|
|
12354
12418
|
addProseMirrorPlugins() {
|
|
12355
12419
|
const isResizable = this.options.resizable && this.editor.isEditable;
|
|
12356
12420
|
return [
|
|
@@ -12504,7 +12568,7 @@ var CodeBlockView = ({
|
|
|
12504
12568
|
};
|
|
12505
12569
|
|
|
12506
12570
|
// src/components/UEditor/optimized-lowlight.ts
|
|
12507
|
-
var
|
|
12571
|
+
var import_core18 = require("@tiptap/core");
|
|
12508
12572
|
var import_state8 = require("@tiptap/pm/state");
|
|
12509
12573
|
var import_view3 = require("@tiptap/pm/view");
|
|
12510
12574
|
function parseHighlightNodes(nodes, inheritedClasses = []) {
|
|
@@ -12551,7 +12615,7 @@ function buildLowlightDecorations({
|
|
|
12551
12615
|
nodeName
|
|
12552
12616
|
}) {
|
|
12553
12617
|
const decorations = [];
|
|
12554
|
-
for (const block of (0,
|
|
12618
|
+
for (const block of (0, import_core18.findChildren)(doc, (node) => node.type.name === nodeName)) {
|
|
12555
12619
|
let from = block.pos + 1;
|
|
12556
12620
|
const language = block.node.attrs.language || defaultLanguage;
|
|
12557
12621
|
const result = highlightCode(lowlight, language, block.node.textContent);
|
|
@@ -12692,7 +12756,7 @@ function createOptimizedLowlightPlugin({
|
|
|
12692
12756
|
}
|
|
12693
12757
|
|
|
12694
12758
|
// src/components/UEditor/table-formula-recalculation.ts
|
|
12695
|
-
var
|
|
12759
|
+
var import_core19 = require("@tiptap/core");
|
|
12696
12760
|
var import_state11 = require("@tiptap/pm/state");
|
|
12697
12761
|
|
|
12698
12762
|
// src/components/UEditor/table-formula-commands.ts
|
|
@@ -13716,7 +13780,7 @@ function recalculateAllTableFormulas(editor) {
|
|
|
13716
13780
|
}
|
|
13717
13781
|
|
|
13718
13782
|
// src/components/UEditor/table-formula-recalculation.ts
|
|
13719
|
-
var TableFormulaRecalculation =
|
|
13783
|
+
var TableFormulaRecalculation = import_core19.Extension.create({
|
|
13720
13784
|
name: "tableFormulaRecalculation",
|
|
13721
13785
|
addProseMirrorPlugins() {
|
|
13722
13786
|
return [
|
|
@@ -13747,6 +13811,21 @@ function getFormulaStateAttributes(attributes) {
|
|
|
13747
13811
|
"data-formula-state": computedValue.startsWith("#") ? "error" : "computed"
|
|
13748
13812
|
};
|
|
13749
13813
|
}
|
|
13814
|
+
function normalizeTableCellTextWrap(value) {
|
|
13815
|
+
return value === "nowrap" ? "nowrap" : "wrap";
|
|
13816
|
+
}
|
|
13817
|
+
function parseTableCellTextWrap(element) {
|
|
13818
|
+
if (element.getAttribute("data-text-wrap") === "nowrap" || element.style.whiteSpace === "nowrap") {
|
|
13819
|
+
return "nowrap";
|
|
13820
|
+
}
|
|
13821
|
+
return "wrap";
|
|
13822
|
+
}
|
|
13823
|
+
function renderTableCellTextWrap(attributes) {
|
|
13824
|
+
return normalizeTableCellTextWrap(attributes.textWrap) === "nowrap" ? { "data-text-wrap": "nowrap" } : {};
|
|
13825
|
+
}
|
|
13826
|
+
function getTableCellTextWrapStyle(value) {
|
|
13827
|
+
return normalizeTableCellTextWrap(value) === "nowrap" ? "white-space: nowrap; overflow-wrap: normal; word-break: normal" : "white-space: normal; overflow-wrap: anywhere; word-break: normal";
|
|
13828
|
+
}
|
|
13750
13829
|
var CustomTableCell = import_extension_table_cell.TableCell.extend({
|
|
13751
13830
|
addAttributes() {
|
|
13752
13831
|
return {
|
|
@@ -13847,6 +13926,11 @@ var CustomTableCell = import_extension_table_cell.TableCell.extend({
|
|
|
13847
13926
|
default: null,
|
|
13848
13927
|
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
|
|
13849
13928
|
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
13929
|
+
},
|
|
13930
|
+
textWrap: {
|
|
13931
|
+
default: "wrap",
|
|
13932
|
+
parseHTML: parseTableCellTextWrap,
|
|
13933
|
+
renderHTML: renderTableCellTextWrap
|
|
13850
13934
|
}
|
|
13851
13935
|
};
|
|
13852
13936
|
},
|
|
@@ -13858,6 +13942,7 @@ var CustomTableCell = import_extension_table_cell.TableCell.extend({
|
|
|
13858
13942
|
const borderWidth = HTMLAttributes["data-border-width"];
|
|
13859
13943
|
const verticalAlign = HTMLAttributes["data-vertical-align"];
|
|
13860
13944
|
const textDirection = HTMLAttributes["data-text-direction"];
|
|
13945
|
+
const textWrap = HTMLAttributes["data-text-wrap"];
|
|
13861
13946
|
let mergedStyle = style;
|
|
13862
13947
|
if (bg) mergedStyle += `; background-color: ${bg}`;
|
|
13863
13948
|
if (borderColor) mergedStyle += `; border-color: ${borderColor}`;
|
|
@@ -13865,10 +13950,11 @@ var CustomTableCell = import_extension_table_cell.TableCell.extend({
|
|
|
13865
13950
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
13866
13951
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
13867
13952
|
if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
|
|
13953
|
+
mergedStyle += `; ${getTableCellTextWrapStyle(textWrap)}`;
|
|
13868
13954
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
13869
13955
|
return [
|
|
13870
13956
|
"td",
|
|
13871
|
-
(0,
|
|
13957
|
+
(0, import_core20.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
|
|
13872
13958
|
0
|
|
13873
13959
|
];
|
|
13874
13960
|
}
|
|
@@ -13973,6 +14059,11 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
|
|
|
13973
14059
|
default: null,
|
|
13974
14060
|
parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
|
|
13975
14061
|
renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
|
|
14062
|
+
},
|
|
14063
|
+
textWrap: {
|
|
14064
|
+
default: "wrap",
|
|
14065
|
+
parseHTML: parseTableCellTextWrap,
|
|
14066
|
+
renderHTML: renderTableCellTextWrap
|
|
13976
14067
|
}
|
|
13977
14068
|
};
|
|
13978
14069
|
},
|
|
@@ -13984,6 +14075,7 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
|
|
|
13984
14075
|
const borderWidth = HTMLAttributes["data-border-width"];
|
|
13985
14076
|
const verticalAlign = HTMLAttributes["data-vertical-align"];
|
|
13986
14077
|
const textDirection = HTMLAttributes["data-text-direction"];
|
|
14078
|
+
const textWrap = HTMLAttributes["data-text-wrap"];
|
|
13987
14079
|
let mergedStyle = style;
|
|
13988
14080
|
if (bg) mergedStyle += `; background-color: ${bg}`;
|
|
13989
14081
|
if (borderColor) mergedStyle += `; border-color: ${borderColor}`;
|
|
@@ -13991,10 +14083,11 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
|
|
|
13991
14083
|
if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
|
|
13992
14084
|
if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
|
|
13993
14085
|
if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
|
|
14086
|
+
mergedStyle += `; ${getTableCellTextWrapStyle(textWrap)}`;
|
|
13994
14087
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
13995
14088
|
return [
|
|
13996
14089
|
"th",
|
|
13997
|
-
(0,
|
|
14090
|
+
(0, import_core20.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
|
|
13998
14091
|
0
|
|
13999
14092
|
];
|
|
14000
14093
|
}
|
|
@@ -14002,15 +14095,15 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
|
|
|
14002
14095
|
var CustomTaskList = import_extension_task_list.TaskList.extend({
|
|
14003
14096
|
addInputRules() {
|
|
14004
14097
|
return [
|
|
14005
|
-
(0,
|
|
14098
|
+
(0, import_core21.wrappingInputRule)({
|
|
14006
14099
|
find: /^\s*(\[ \]|\[\])\s$/,
|
|
14007
14100
|
type: this.type
|
|
14008
14101
|
}),
|
|
14009
|
-
(0,
|
|
14102
|
+
(0, import_core21.wrappingInputRule)({
|
|
14010
14103
|
find: /^\s*(-\s*\[ \]|-\s*\[\])\s$/,
|
|
14011
14104
|
type: this.type
|
|
14012
14105
|
}),
|
|
14013
|
-
(0,
|
|
14106
|
+
(0, import_core21.wrappingInputRule)({
|
|
14014
14107
|
find: /^\s*(\*\s*\[ \]|-\s*\[\])\s$/,
|
|
14015
14108
|
type: this.type
|
|
14016
14109
|
})
|
|
@@ -14156,7 +14249,8 @@ function buildUEditorExtensions({
|
|
|
14156
14249
|
handleWidth: 10,
|
|
14157
14250
|
allowTableNodeSelection: true,
|
|
14158
14251
|
HTMLAttributes: {
|
|
14159
|
-
class: "border-collapse my-4"
|
|
14252
|
+
class: "border-collapse my-4",
|
|
14253
|
+
style: "table-layout: fixed;"
|
|
14160
14254
|
}
|
|
14161
14255
|
}),
|
|
14162
14256
|
table_row_default,
|
|
@@ -14569,6 +14663,7 @@ var BubbleMenuContent = ({
|
|
|
14569
14663
|
const [activeBorderPosition, setActiveBorderPosition] = (0, import_react35.useState)("all");
|
|
14570
14664
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
14571
14665
|
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
14666
|
+
const currentCellTextWrap = normalizeStyleValue(editor.getAttributes("tableCell").textWrap || editor.getAttributes("tableHeader").textWrap) || "wrap";
|
|
14572
14667
|
const isInTable3 = (0, import_tables8.isInTable)(editor.state);
|
|
14573
14668
|
const canMergeCells = isInTable3 && editor.can().mergeCells();
|
|
14574
14669
|
const canSplitCell = isInTable3 && editor.can().splitCell();
|
|
@@ -15229,6 +15324,20 @@ var BubbleMenuContent = ({
|
|
|
15229
15324
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.TableCellsMerge, { className: "w-4 h-4" })
|
|
15230
15325
|
}
|
|
15231
15326
|
),
|
|
15327
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
15328
|
+
ToolbarButton,
|
|
15329
|
+
{
|
|
15330
|
+
onClick: () => applyTableCellAttribute2(
|
|
15331
|
+
editor,
|
|
15332
|
+
"textWrap",
|
|
15333
|
+
currentCellTextWrap === "nowrap" ? "wrap" : "nowrap",
|
|
15334
|
+
{ focus: false }
|
|
15335
|
+
),
|
|
15336
|
+
active: currentCellTextWrap !== "nowrap",
|
|
15337
|
+
title: currentCellTextWrap === "nowrap" ? t("tableMenu.wrapText") : t("tableMenu.noWrapText"),
|
|
15338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.WrapText, { className: "h-4 w-4" })
|
|
15339
|
+
}
|
|
15340
|
+
),
|
|
15232
15341
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
15233
15342
|
DropdownMenu,
|
|
15234
15343
|
{
|