@uva-glass/component-library 2.6.1 → 2.6.3
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/dist/Lexical.prod-sR6tW7N6.js +4236 -0
- package/dist/Lexical.prod-sR6tW7N6.js.map +1 -0
- package/dist/LexicalClipboard.prod-BbRoaXo6.js +258 -0
- package/dist/LexicalClipboard.prod-BbRoaXo6.js.map +1 -0
- package/dist/{LexicalComposerContext.prod-Dyvim1tK.js → LexicalComposerContext.prod-DxxjdrXB.js} +2 -2
- package/dist/{LexicalComposerContext.prod-Dyvim1tK.js.map → LexicalComposerContext.prod-DxxjdrXB.js.map} +1 -1
- package/dist/LexicalLink.prod-iDKxtfCF.js +263 -0
- package/dist/LexicalLink.prod-iDKxtfCF.js.map +1 -0
- package/dist/LexicalList.prod-ywkx7SnO.js +576 -0
- package/dist/LexicalList.prod-ywkx7SnO.js.map +1 -0
- package/dist/LexicalSelection.prod-mYXylG1z.js +86 -0
- package/dist/LexicalSelection.prod-mYXylG1z.js.map +1 -0
- package/dist/LexicalTable.prod-XN7avk7R.js +1447 -0
- package/dist/LexicalTable.prod-XN7avk7R.js.map +1 -0
- package/dist/LexicalUtils.prod-DnFLi0Ww.js +122 -0
- package/dist/LexicalUtils.prod-DnFLi0Ww.js.map +1 -0
- package/dist/{SortableProvider-BUsvniX7.js → SortableProvider-RaH_ZXB3.js} +20 -20
- package/dist/{SortableProvider-BUsvniX7.js.map → SortableProvider-RaH_ZXB3.js.map} +1 -1
- package/dist/{TablePlugin-E6UFlCgy.js → TablePlugin-5Cs2F_co.js} +75 -74
- package/dist/{TablePlugin-E6UFlCgy.js.map → TablePlugin-5Cs2F_co.js.map} +1 -1
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/MenuButton.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +6 -5
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/CheckboxButton/CheckboxButton.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.d.ts +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.js +110 -74
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.d.ts +2 -1
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +121 -31
- package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/FormInput/FormInput.js +14 -13
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/FormInput/FormInput.stories.js +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.js +17 -17
- package/dist/components/InputField/InputField.stories.js +17 -16
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +2 -2
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +5 -4
- package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +4 -4
- package/dist/components/OverlayStepBar/OverlayStepBar.js +13 -12
- package/dist/components/OverlayStepBar/OverlayStepBar.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +15 -14
- package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +11 -10
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
- package/dist/components/RadioButton/RadioButton.js +3 -3
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +6 -5
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +15 -14
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +6 -5
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +43 -42
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +42 -42
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +15 -15
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +5 -4
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +8 -7
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +29 -29
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +18 -18
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/Providers/LanguageProvider.js +7 -7
- package/dist/components/RteEditor/RteEditor.js +608 -663
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +11 -11
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/SelectListbox/SelectProvider.js +10 -10
- package/dist/components/Sortable/Sortable.js +1 -1
- package/dist/components/Sortable/Sortable.stories.js +7 -7
- package/dist/components/Sortable/SortableProvider.js +1 -1
- package/dist/components/Sortable/components/SortableContainer.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js +15 -15
- package/dist/components/Sortable/sortableReducer.js +21 -21
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +5 -5
- package/dist/components/Tooltip/Tooltip.js +22 -22
- package/dist/components/index.js +1 -1
- package/dist/{helpers-BVGma1u6.js → helpers-BpqX-Lj3.js} +32 -32
- package/dist/helpers-BpqX-Lj3.js.map +1 -0
- package/dist/{index-0wq-B7do.js → index-B3c5pcHk.js} +22 -22
- package/dist/{index-0wq-B7do.js.map → index-B3c5pcHk.js.map} +1 -1
- package/dist/{index-B9BWML6P.js → index-BpZ8v2ye.js} +7088 -7092
- package/dist/{index-B9BWML6P.js.map → index-BpZ8v2ye.js.map} +1 -1
- package/dist/index-CHX1d9_A.js +21922 -0
- package/dist/{index-DWzkl4aY.js.map → index-CHX1d9_A.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/{react-18-BIqxBxbW.js → react-18-CT6mjea2.js} +2 -2
- package/dist/{react-18-BIqxBxbW.js.map → react-18-CT6mjea2.js.map} +1 -1
- package/dist/storybook__react.d.js +510 -510
- package/dist/storybook__react.d.js.map +1 -1
- package/package.json +14 -14
- package/dist/Lexical.prod-Bzma_w4s.js +0 -4216
- package/dist/Lexical.prod-Bzma_w4s.js.map +0 -1
- package/dist/LexicalClipboard.prod-Dg23ixPD.js +0 -258
- package/dist/LexicalClipboard.prod-Dg23ixPD.js.map +0 -1
- package/dist/LexicalLink.prod-C1RDJLfo.js +0 -208
- package/dist/LexicalLink.prod-C1RDJLfo.js.map +0 -1
- package/dist/LexicalList.prod-BGzfDPU0.js +0 -568
- package/dist/LexicalList.prod-BGzfDPU0.js.map +0 -1
- package/dist/LexicalSelection.prod-CNWFGVlh.js +0 -86
- package/dist/LexicalSelection.prod-CNWFGVlh.js.map +0 -1
- package/dist/LexicalTable.prod-D-4NN9o5.js +0 -1366
- package/dist/LexicalTable.prod-D-4NN9o5.js.map +0 -1
- package/dist/LexicalUtils.prod-Cg2siy-c.js +0 -94
- package/dist/LexicalUtils.prod-Cg2siy-c.js.map +0 -1
- package/dist/helpers-BVGma1u6.js.map +0 -1
- package/dist/index-DWzkl4aY.js +0 -21915
|
@@ -0,0 +1,1447 @@
|
|
|
1
|
+
import { j as Q, v as rt, r as y, V as Me, d as St, N as bt, u as wt, h as lt, c as _t } from "./LexicalUtils.prod-DnFLi0Ww.js";
|
|
2
|
+
import { O as Ae, P as Se, V, L as P, n as yt, v as ue, x as Pe, b as $e, J as Nt, d as G, A as st, f as xt, e as Tt, g as be, F as Te, h as Ye, a as H, H as B, Q as Fe, k as Ft, X, B as Ot, l as vt, m as kt, p as Rt, N as Kt, $ as Et, r as Mt, t as re, M as j, s as ye, u as At, o as Pt, y as $t, I as Lt, w as Ht, j as it, S as Bt, z as Dt, C as Wt, D as It, G as Jt, K as at, R as zt, T as Xt, U as qt, W as _e, i as Yt, Y as jt, Z as Ut } from "./Lexical.prod-sR6tW7N6.js";
|
|
3
|
+
import { O as Vt, L as Qt } from "./LexicalClipboard.prod-BbRoaXo6.js";
|
|
4
|
+
const Le = /^(\d+(?:\.\d+)?)px$/, J = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
|
|
5
|
+
class te extends Ae {
|
|
6
|
+
static getType() {
|
|
7
|
+
return "tablecell";
|
|
8
|
+
}
|
|
9
|
+
static clone(e) {
|
|
10
|
+
return new te(e.__headerState, e.__colSpan, e.__width, e.__key);
|
|
11
|
+
}
|
|
12
|
+
afterCloneFrom(e) {
|
|
13
|
+
super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor;
|
|
14
|
+
}
|
|
15
|
+
static importDOM() {
|
|
16
|
+
return { td: (e) => ({ conversion: je, priority: 0 }), th: (e) => ({ conversion: je, priority: 0 }) };
|
|
17
|
+
}
|
|
18
|
+
static importJSON(e) {
|
|
19
|
+
return he().updateFromJSON(e);
|
|
20
|
+
}
|
|
21
|
+
updateFromJSON(e) {
|
|
22
|
+
return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan || 1).setRowSpan(e.rowSpan || 1).setWidth(e.width || void 0).setBackgroundColor(e.backgroundColor || null);
|
|
23
|
+
}
|
|
24
|
+
constructor(e = J.NO_STATUS, t = 1, o, l) {
|
|
25
|
+
super(l), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = o, this.__backgroundColor = null;
|
|
26
|
+
}
|
|
27
|
+
createDOM(e) {
|
|
28
|
+
const t = document.createElement(this.getTag());
|
|
29
|
+
return this.__width && (t.style.width = `${this.__width}px`), this.__colSpan > 1 && (t.colSpan = this.__colSpan), this.__rowSpan > 1 && (t.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (t.style.backgroundColor = this.__backgroundColor), Q(t, e.theme.tableCell, this.hasHeader() && e.theme.tableCellHeader), t;
|
|
30
|
+
}
|
|
31
|
+
exportDOM(e) {
|
|
32
|
+
const t = super.exportDOM(e);
|
|
33
|
+
if (Se(t.element)) {
|
|
34
|
+
const o = t.element;
|
|
35
|
+
o.setAttribute("data-temporary-table-cell-lexical-key", this.getKey()), o.style.border = "1px solid black", this.__colSpan > 1 && (o.colSpan = this.__colSpan), this.__rowSpan > 1 && (o.rowSpan = this.__rowSpan), o.style.width = `${this.getWidth() || 75}px`, o.style.verticalAlign = "top", o.style.textAlign = "start", this.__backgroundColor === null && this.hasHeader() && (o.style.backgroundColor = "#f2f3f5");
|
|
36
|
+
}
|
|
37
|
+
return t;
|
|
38
|
+
}
|
|
39
|
+
exportJSON() {
|
|
40
|
+
return { ...super.exportJSON(), backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
|
|
41
|
+
}
|
|
42
|
+
getColSpan() {
|
|
43
|
+
return this.getLatest().__colSpan;
|
|
44
|
+
}
|
|
45
|
+
setColSpan(e) {
|
|
46
|
+
const t = this.getWritable();
|
|
47
|
+
return t.__colSpan = e, t;
|
|
48
|
+
}
|
|
49
|
+
getRowSpan() {
|
|
50
|
+
return this.getLatest().__rowSpan;
|
|
51
|
+
}
|
|
52
|
+
setRowSpan(e) {
|
|
53
|
+
const t = this.getWritable();
|
|
54
|
+
return t.__rowSpan = e, t;
|
|
55
|
+
}
|
|
56
|
+
getTag() {
|
|
57
|
+
return this.hasHeader() ? "th" : "td";
|
|
58
|
+
}
|
|
59
|
+
setHeaderStyles(e, t = J.BOTH) {
|
|
60
|
+
const o = this.getWritable();
|
|
61
|
+
return o.__headerState = e & t | o.__headerState & ~t, o;
|
|
62
|
+
}
|
|
63
|
+
getHeaderStyles() {
|
|
64
|
+
return this.getLatest().__headerState;
|
|
65
|
+
}
|
|
66
|
+
setWidth(e) {
|
|
67
|
+
const t = this.getWritable();
|
|
68
|
+
return t.__width = e, t;
|
|
69
|
+
}
|
|
70
|
+
getWidth() {
|
|
71
|
+
return this.getLatest().__width;
|
|
72
|
+
}
|
|
73
|
+
getBackgroundColor() {
|
|
74
|
+
return this.getLatest().__backgroundColor;
|
|
75
|
+
}
|
|
76
|
+
setBackgroundColor(e) {
|
|
77
|
+
const t = this.getWritable();
|
|
78
|
+
return t.__backgroundColor = e, t;
|
|
79
|
+
}
|
|
80
|
+
toggleHeaderStyle(e) {
|
|
81
|
+
const t = this.getWritable();
|
|
82
|
+
return (t.__headerState & e) === e ? t.__headerState -= e : t.__headerState += e, t;
|
|
83
|
+
}
|
|
84
|
+
hasHeaderState(e) {
|
|
85
|
+
return (this.getHeaderStyles() & e) === e;
|
|
86
|
+
}
|
|
87
|
+
hasHeader() {
|
|
88
|
+
return this.getLatest().__headerState !== J.NO_STATUS;
|
|
89
|
+
}
|
|
90
|
+
updateDOM(e) {
|
|
91
|
+
return e.__headerState !== this.__headerState || e.__width !== this.__width || e.__colSpan !== this.__colSpan || e.__rowSpan !== this.__rowSpan || e.__backgroundColor !== this.__backgroundColor;
|
|
92
|
+
}
|
|
93
|
+
isShadowRoot() {
|
|
94
|
+
return !0;
|
|
95
|
+
}
|
|
96
|
+
collapseAtStart() {
|
|
97
|
+
return !0;
|
|
98
|
+
}
|
|
99
|
+
canBeEmpty() {
|
|
100
|
+
return !1;
|
|
101
|
+
}
|
|
102
|
+
canIndent() {
|
|
103
|
+
return !1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function je(n) {
|
|
107
|
+
const e = n, t = n.nodeName.toLowerCase();
|
|
108
|
+
let o;
|
|
109
|
+
Le.test(e.style.width) && (o = parseFloat(e.style.width));
|
|
110
|
+
const l = he(t === "th" ? J.ROW : J.NO_STATUS, e.colSpan, o);
|
|
111
|
+
l.__rowSpan = e.rowSpan;
|
|
112
|
+
const i = e.style.backgroundColor;
|
|
113
|
+
i !== "" && (l.__backgroundColor = i);
|
|
114
|
+
const r = e.style, c = (r && r.textDecoration || "").split(" "), h = r.fontWeight === "700" || r.fontWeight === "bold", f = c.includes("line-through"), s = r.fontStyle === "italic", a = c.includes("underline");
|
|
115
|
+
return { after: (u) => (u.length === 0 && u.push(V()), u), forChild: (u, d) => {
|
|
116
|
+
if (S(d) && !P(u)) {
|
|
117
|
+
const g = V();
|
|
118
|
+
return yt(u) && u.getTextContent() === `
|
|
119
|
+
` ? null : (ue(u) && (h && u.toggleFormat("bold"), f && u.toggleFormat("strikethrough"), s && u.toggleFormat("italic"), a && u.toggleFormat("underline")), g.append(u), g);
|
|
120
|
+
}
|
|
121
|
+
return u;
|
|
122
|
+
}, node: l };
|
|
123
|
+
}
|
|
124
|
+
function he(n = J.NO_STATUS, e = 1, t) {
|
|
125
|
+
return Pe(new te(n, e, t));
|
|
126
|
+
}
|
|
127
|
+
function S(n) {
|
|
128
|
+
return n instanceof te;
|
|
129
|
+
}
|
|
130
|
+
const Gt = Tt();
|
|
131
|
+
function Zt(n) {
|
|
132
|
+
return n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
133
|
+
}
|
|
134
|
+
var b = Zt(function(n) {
|
|
135
|
+
const e = new URLSearchParams();
|
|
136
|
+
e.append("code", n);
|
|
137
|
+
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
138
|
+
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
139
|
+
});
|
|
140
|
+
class de extends Ae {
|
|
141
|
+
static getType() {
|
|
142
|
+
return "tablerow";
|
|
143
|
+
}
|
|
144
|
+
static clone(e) {
|
|
145
|
+
return new de(e.__height, e.__key);
|
|
146
|
+
}
|
|
147
|
+
static importDOM() {
|
|
148
|
+
return { tr: (e) => ({ conversion: en, priority: 0 }) };
|
|
149
|
+
}
|
|
150
|
+
static importJSON(e) {
|
|
151
|
+
return He().updateFromJSON(e);
|
|
152
|
+
}
|
|
153
|
+
updateFromJSON(e) {
|
|
154
|
+
return super.updateFromJSON(e).setHeight(e.height);
|
|
155
|
+
}
|
|
156
|
+
constructor(e, t) {
|
|
157
|
+
super(t), this.__height = e;
|
|
158
|
+
}
|
|
159
|
+
exportJSON() {
|
|
160
|
+
const e = this.getHeight();
|
|
161
|
+
return { ...super.exportJSON(), ...e === void 0 ? void 0 : { height: e } };
|
|
162
|
+
}
|
|
163
|
+
createDOM(e) {
|
|
164
|
+
const t = document.createElement("tr");
|
|
165
|
+
return this.__height && (t.style.height = `${this.__height}px`), Q(t, e.theme.tableRow), t;
|
|
166
|
+
}
|
|
167
|
+
extractWithChild(e, t, o) {
|
|
168
|
+
return o === "html";
|
|
169
|
+
}
|
|
170
|
+
isShadowRoot() {
|
|
171
|
+
return !0;
|
|
172
|
+
}
|
|
173
|
+
setHeight(e) {
|
|
174
|
+
const t = this.getWritable();
|
|
175
|
+
return t.__height = e, t;
|
|
176
|
+
}
|
|
177
|
+
getHeight() {
|
|
178
|
+
return this.getLatest().__height;
|
|
179
|
+
}
|
|
180
|
+
updateDOM(e) {
|
|
181
|
+
return e.__height !== this.__height;
|
|
182
|
+
}
|
|
183
|
+
canBeEmpty() {
|
|
184
|
+
return !1;
|
|
185
|
+
}
|
|
186
|
+
canIndent() {
|
|
187
|
+
return !1;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function en(n) {
|
|
191
|
+
const e = n;
|
|
192
|
+
let t;
|
|
193
|
+
return Le.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) => rt(o, S), node: He(t) };
|
|
194
|
+
}
|
|
195
|
+
function He(n) {
|
|
196
|
+
return Pe(new de(n));
|
|
197
|
+
}
|
|
198
|
+
function M(n) {
|
|
199
|
+
return n instanceof de;
|
|
200
|
+
}
|
|
201
|
+
const Be = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, tn = Be && "documentMode" in document ? document.documentMode : null, nn = Be && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
202
|
+
function on(n, e, t = !0) {
|
|
203
|
+
const o = Je();
|
|
204
|
+
for (let l = 0; l < n; l++) {
|
|
205
|
+
const i = He();
|
|
206
|
+
for (let r = 0; r < e; r++) {
|
|
207
|
+
let c = J.NO_STATUS;
|
|
208
|
+
typeof t == "object" ? (l === 0 && t.rows && (c |= J.ROW), r === 0 && t.columns && (c |= J.COLUMN)) : t && (l === 0 && (c |= J.ROW), r === 0 && (c |= J.COLUMN));
|
|
209
|
+
const h = he(c), f = V();
|
|
210
|
+
f.append($e()), h.append(f), i.append(h);
|
|
211
|
+
}
|
|
212
|
+
o.append(i);
|
|
213
|
+
}
|
|
214
|
+
return o;
|
|
215
|
+
}
|
|
216
|
+
function Nn(n) {
|
|
217
|
+
const e = y(n, (t) => S(t));
|
|
218
|
+
return S(e) ? e : null;
|
|
219
|
+
}
|
|
220
|
+
function ct(n) {
|
|
221
|
+
const e = y(n, (t) => M(t));
|
|
222
|
+
if (M(e)) return e;
|
|
223
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
224
|
+
}
|
|
225
|
+
function rn(n) {
|
|
226
|
+
const e = y(n, (t) => R(t));
|
|
227
|
+
if (R(e)) return e;
|
|
228
|
+
throw new Error("Expected table cell to be inside of table.");
|
|
229
|
+
}
|
|
230
|
+
function xn(n) {
|
|
231
|
+
const e = ct(n);
|
|
232
|
+
return rn(e).getChildren().findIndex((t) => t.is(e));
|
|
233
|
+
}
|
|
234
|
+
function Tn(n) {
|
|
235
|
+
return ct(n).getChildren().findIndex((e) => e.is(n));
|
|
236
|
+
}
|
|
237
|
+
Be && "InputEvent" in window && !tn && new window.InputEvent("input");
|
|
238
|
+
function Fn(n, e) {
|
|
239
|
+
const t = n.getChildren();
|
|
240
|
+
for (let o = 0; o < t.length; o++) {
|
|
241
|
+
const l = t[o];
|
|
242
|
+
if (M(l)) {
|
|
243
|
+
const i = l.getChildren();
|
|
244
|
+
if (e >= i.length || e < 0) throw new Error("Table column target index out of range");
|
|
245
|
+
i[e].remove();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return n;
|
|
249
|
+
}
|
|
250
|
+
function U(n, e, t) {
|
|
251
|
+
const [o, l, i] = De(n, e, t);
|
|
252
|
+
return l === null && b(207), i === null && b(208), [o, l, i];
|
|
253
|
+
}
|
|
254
|
+
function De(n, e, t) {
|
|
255
|
+
const o = [];
|
|
256
|
+
let l = null, i = null;
|
|
257
|
+
function r(h) {
|
|
258
|
+
let f = o[h];
|
|
259
|
+
return f === void 0 && (o[h] = f = []), f;
|
|
260
|
+
}
|
|
261
|
+
const c = n.getChildren();
|
|
262
|
+
for (let h = 0; h < c.length; h++) {
|
|
263
|
+
const f = c[h];
|
|
264
|
+
M(f) || b(209);
|
|
265
|
+
for (let s = f.getFirstChild(), a = 0; s != null; s = s.getNextSibling()) {
|
|
266
|
+
S(s) || b(147);
|
|
267
|
+
const u = r(h);
|
|
268
|
+
for (; u[a] !== void 0; ) a++;
|
|
269
|
+
const d = { cell: s, startColumn: a, startRow: h }, { __rowSpan: g, __colSpan: p } = s;
|
|
270
|
+
for (let m = 0; m < g && !(h + m >= c.length); m++) {
|
|
271
|
+
const C = r(h + m);
|
|
272
|
+
for (let w = 0; w < p; w++) C[a + w] = d;
|
|
273
|
+
}
|
|
274
|
+
e !== null && l === null && e.is(s) && (l = d), t !== null && i === null && t.is(s) && (i = d);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return [o, l, i];
|
|
278
|
+
}
|
|
279
|
+
function le(n) {
|
|
280
|
+
let e;
|
|
281
|
+
if (n instanceof te) e = n;
|
|
282
|
+
else if ("__type" in n) {
|
|
283
|
+
const l = y(n, S);
|
|
284
|
+
S(l) || b(148), e = l;
|
|
285
|
+
} else {
|
|
286
|
+
const l = y(n.getNode(), S);
|
|
287
|
+
S(l) || b(148), e = l;
|
|
288
|
+
}
|
|
289
|
+
const t = e.getParent();
|
|
290
|
+
M(t) || b(149);
|
|
291
|
+
const o = t.getParent();
|
|
292
|
+
return R(o) || b(210), [e, t, o];
|
|
293
|
+
}
|
|
294
|
+
function ke(n, e, t) {
|
|
295
|
+
let o = Math.min(e.startColumn, t.startColumn), l = Math.min(e.startRow, t.startRow), i = Math.max(e.startColumn + e.cell.__colSpan - 1, t.startColumn + t.cell.__colSpan - 1), r = Math.max(e.startRow + e.cell.__rowSpan - 1, t.startRow + t.cell.__rowSpan - 1), c = o, h = l, f = o, s = l;
|
|
296
|
+
function a(u) {
|
|
297
|
+
const { cell: d, startColumn: g, startRow: p } = u;
|
|
298
|
+
o = Math.min(o, g), l = Math.min(l, p), i = Math.max(i, g + d.__colSpan - 1), r = Math.max(r, p + d.__rowSpan - 1);
|
|
299
|
+
}
|
|
300
|
+
for (; o < c || l < h || i > f || r > s; ) {
|
|
301
|
+
if (o < c) {
|
|
302
|
+
const u = s - h, d = c - 1;
|
|
303
|
+
for (let g = 0; g <= u; g++) a(n[h + g][d]);
|
|
304
|
+
c = d;
|
|
305
|
+
}
|
|
306
|
+
if (l < h) {
|
|
307
|
+
const u = f - c, d = h - 1;
|
|
308
|
+
for (let g = 0; g <= u; g++) a(n[d][c + g]);
|
|
309
|
+
h = d;
|
|
310
|
+
}
|
|
311
|
+
if (i > f) {
|
|
312
|
+
const u = s - h, d = f + 1;
|
|
313
|
+
for (let g = 0; g <= u; g++) a(n[h + g][d]);
|
|
314
|
+
f = d;
|
|
315
|
+
}
|
|
316
|
+
if (r > s) {
|
|
317
|
+
const u = f - c, d = s + 1;
|
|
318
|
+
for (let g = 0; g <= u; g++) a(n[d][c + g]);
|
|
319
|
+
s = d;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return { maxColumn: i, maxRow: r, minColumn: o, minRow: l };
|
|
323
|
+
}
|
|
324
|
+
function Ue(n) {
|
|
325
|
+
const [e, , t] = le(n), o = t.getChildren(), l = o.length, i = o[0].getChildren().length, r = new Array(l);
|
|
326
|
+
for (let c = 0; c < l; c++) r[c] = new Array(i);
|
|
327
|
+
for (let c = 0; c < l; c++) {
|
|
328
|
+
const h = o[c].getChildren();
|
|
329
|
+
let f = 0;
|
|
330
|
+
for (let s = 0; s < h.length; s++) {
|
|
331
|
+
for (; r[c][f]; ) f++;
|
|
332
|
+
const a = h[s], u = a.__rowSpan || 1, d = a.__colSpan || 1;
|
|
333
|
+
for (let g = 0; g < u; g++) for (let p = 0; p < d; p++) r[c + g][f + p] = a;
|
|
334
|
+
if (e === a) return { colSpan: d, columnIndex: f, rowIndex: c, rowSpan: u };
|
|
335
|
+
f += d;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
function Ve(n) {
|
|
341
|
+
const [[e, t, o, l], [i, r, c, h]] = ["anchor", "focus"].map((f) => {
|
|
342
|
+
const s = n[f].getNode(), a = y(s, S);
|
|
343
|
+
S(a) || b(238, f, s.getKey(), s.getType());
|
|
344
|
+
const u = a.getParent();
|
|
345
|
+
M(u) || b(239, f);
|
|
346
|
+
const d = u.getParent();
|
|
347
|
+
return R(d) || b(240, f), [s, a, u, d];
|
|
348
|
+
});
|
|
349
|
+
return l.is(h) || b(241), { anchorCell: t, anchorNode: e, anchorRow: o, anchorTable: l, focusCell: r, focusNode: i, focusRow: c, focusTable: h };
|
|
350
|
+
}
|
|
351
|
+
class Ne {
|
|
352
|
+
constructor(e, t, o) {
|
|
353
|
+
this.anchor = t, this.focus = o, t._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = e;
|
|
354
|
+
}
|
|
355
|
+
getStartEndPoints() {
|
|
356
|
+
return [this.anchor, this.focus];
|
|
357
|
+
}
|
|
358
|
+
isValid() {
|
|
359
|
+
return this.tableKey !== "root" && this.anchor.key !== "root" && this.anchor.type === "element" && this.focus.key !== "root" && this.focus.type === "element";
|
|
360
|
+
}
|
|
361
|
+
isBackward() {
|
|
362
|
+
return this.focus.isBefore(this.anchor);
|
|
363
|
+
}
|
|
364
|
+
getCachedNodes() {
|
|
365
|
+
return this._cachedNodes;
|
|
366
|
+
}
|
|
367
|
+
setCachedNodes(e) {
|
|
368
|
+
this._cachedNodes = e;
|
|
369
|
+
}
|
|
370
|
+
is(e) {
|
|
371
|
+
return k(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
|
|
372
|
+
}
|
|
373
|
+
set(e, t, o) {
|
|
374
|
+
this.dirty = this.dirty || e !== this.tableKey || t !== this.anchor.key || o !== this.focus.key, this.tableKey = e, this.anchor.key = t, this.focus.key = o, this._cachedNodes = null;
|
|
375
|
+
}
|
|
376
|
+
clone() {
|
|
377
|
+
return new Ne(this.tableKey, _e(this.anchor.key, this.anchor.offset, this.anchor.type), _e(this.focus.key, this.focus.offset, this.focus.type));
|
|
378
|
+
}
|
|
379
|
+
isCollapsed() {
|
|
380
|
+
return !1;
|
|
381
|
+
}
|
|
382
|
+
extract() {
|
|
383
|
+
return this.getNodes();
|
|
384
|
+
}
|
|
385
|
+
insertRawText(e) {
|
|
386
|
+
}
|
|
387
|
+
insertText() {
|
|
388
|
+
}
|
|
389
|
+
hasFormat(e) {
|
|
390
|
+
let t = 0;
|
|
391
|
+
this.getNodes().filter(S).forEach((l) => {
|
|
392
|
+
const i = l.getFirstChild();
|
|
393
|
+
it(i) && (t |= i.getTextFormat());
|
|
394
|
+
});
|
|
395
|
+
const o = Ut[e];
|
|
396
|
+
return !!(t & o);
|
|
397
|
+
}
|
|
398
|
+
insertNodes(e) {
|
|
399
|
+
const t = this.focus.getNode();
|
|
400
|
+
P(t) || b(151), Yt(t.select(0, t.getChildrenSize())).insertNodes(e);
|
|
401
|
+
}
|
|
402
|
+
getShape() {
|
|
403
|
+
const { anchorCell: e, focusCell: t } = Ve(this), o = Ue(e);
|
|
404
|
+
o === null && b(153);
|
|
405
|
+
const l = Ue(t);
|
|
406
|
+
l === null && b(155);
|
|
407
|
+
const i = Math.min(o.columnIndex, l.columnIndex), r = Math.max(o.columnIndex + o.colSpan - 1, l.columnIndex + l.colSpan - 1), c = Math.min(o.rowIndex, l.rowIndex), h = Math.max(o.rowIndex + o.rowSpan - 1, l.rowIndex + l.rowSpan - 1);
|
|
408
|
+
return { fromX: Math.min(i, r), fromY: Math.min(c, h), toX: Math.max(i, r), toY: Math.max(c, h) };
|
|
409
|
+
}
|
|
410
|
+
getNodes() {
|
|
411
|
+
if (!this.isValid()) return [];
|
|
412
|
+
const e = this._cachedNodes;
|
|
413
|
+
if (e !== null) return e;
|
|
414
|
+
const { anchorTable: t, anchorCell: o, focusCell: l } = Ve(this), i = l.getParents()[1];
|
|
415
|
+
if (i !== t) {
|
|
416
|
+
if (t.isParentOf(l)) {
|
|
417
|
+
const m = i.getParent();
|
|
418
|
+
m == null && b(159), this.set(this.tableKey, l.getKey(), m.getKey());
|
|
419
|
+
} else {
|
|
420
|
+
const m = t.getParent();
|
|
421
|
+
m == null && b(158), this.set(this.tableKey, m.getKey(), l.getKey());
|
|
422
|
+
}
|
|
423
|
+
return this.getNodes();
|
|
424
|
+
}
|
|
425
|
+
const [r, c, h] = U(t, o, l), { minColumn: f, maxColumn: s, minRow: a, maxRow: u } = ke(r, c, h), d = /* @__PURE__ */ new Map([[t.getKey(), t]]);
|
|
426
|
+
let g = null;
|
|
427
|
+
for (let m = a; m <= u; m++) for (let C = f; C <= s; C++) {
|
|
428
|
+
const { cell: w } = r[m][C], K = w.getParent();
|
|
429
|
+
M(K) || b(160), K !== g && (d.set(K.getKey(), K), g = K), d.has(w.getKey()) || ln(w, (E) => {
|
|
430
|
+
d.set(E.getKey(), E);
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
const p = Array.from(d.values());
|
|
434
|
+
return jt() || (this._cachedNodes = p), p;
|
|
435
|
+
}
|
|
436
|
+
getTextContent() {
|
|
437
|
+
const e = this.getNodes().filter((o) => S(o));
|
|
438
|
+
let t = "";
|
|
439
|
+
for (let o = 0; o < e.length; o++) {
|
|
440
|
+
const l = e[o], i = l.__parent, r = (e[o + 1] || {}).__parent;
|
|
441
|
+
t += l.getTextContent() + (r !== i ? `
|
|
442
|
+
` : " ");
|
|
443
|
+
}
|
|
444
|
+
return t;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function k(n) {
|
|
448
|
+
return n instanceof Ne;
|
|
449
|
+
}
|
|
450
|
+
function Qe() {
|
|
451
|
+
const n = _e("root", 0, "element"), e = _e("root", 0, "element");
|
|
452
|
+
return new Ne("root", n, e);
|
|
453
|
+
}
|
|
454
|
+
function ln(n, e) {
|
|
455
|
+
const t = [[n]];
|
|
456
|
+
for (let o = t.at(-1); o !== void 0 && t.length > 0; o = t.at(-1)) {
|
|
457
|
+
const l = o.pop();
|
|
458
|
+
l === void 0 ? t.pop() : e(l) !== !1 && P(l) && t.push(l.getChildren());
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function ut(n, e = st()) {
|
|
462
|
+
const t = be(n);
|
|
463
|
+
R(t) || b(231, n);
|
|
464
|
+
const o = Z(t, e.getElementByKey(n));
|
|
465
|
+
return o === null && b(232, n), { tableElement: o, tableNode: t };
|
|
466
|
+
}
|
|
467
|
+
class sn {
|
|
468
|
+
constructor(e, t) {
|
|
469
|
+
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = t, this.editor = e, this.table = { columns: 0, domRows: [], rows: 0 }, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.isSelecting = !1, this.shouldCheckSelection = !1, this.abortController = new AbortController(), this.listenerOptions = { signal: this.abortController.signal }, this.nextFocus = null, this.trackTable();
|
|
470
|
+
}
|
|
471
|
+
getTable() {
|
|
472
|
+
return this.table;
|
|
473
|
+
}
|
|
474
|
+
removeListeners() {
|
|
475
|
+
this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach((e) => e()), this.listenersToRemove.clear();
|
|
476
|
+
}
|
|
477
|
+
$lookup() {
|
|
478
|
+
return ut(this.tableNodeKey, this.editor);
|
|
479
|
+
}
|
|
480
|
+
trackTable() {
|
|
481
|
+
const e = new MutationObserver((t) => {
|
|
482
|
+
this.editor.getEditorState().read(() => {
|
|
483
|
+
let o = !1;
|
|
484
|
+
for (let r = 0; r < t.length; r++) {
|
|
485
|
+
const c = t[r].target.nodeName;
|
|
486
|
+
if (c === "TABLE" || c === "TBODY" || c === "THEAD" || c === "TR") {
|
|
487
|
+
o = !0;
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (!o) return;
|
|
492
|
+
const { tableNode: l, tableElement: i } = this.$lookup();
|
|
493
|
+
this.table = ae(l, i);
|
|
494
|
+
}, { editor: this.editor });
|
|
495
|
+
});
|
|
496
|
+
this.editor.getEditorState().read(() => {
|
|
497
|
+
const { tableNode: t, tableElement: o } = this.$lookup();
|
|
498
|
+
this.table = ae(t, o), e.observe(o, { attributes: !0, childList: !0, subtree: !0 });
|
|
499
|
+
}, { editor: this.editor });
|
|
500
|
+
}
|
|
501
|
+
$clearHighlight() {
|
|
502
|
+
const e = this.editor;
|
|
503
|
+
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.$enableHighlightStyle();
|
|
504
|
+
const { tableNode: t, tableElement: o } = this.$lookup();
|
|
505
|
+
ge(e, ae(t, o), null), B() !== null && (j(null), e.dispatchCommand(re, void 0));
|
|
506
|
+
}
|
|
507
|
+
$enableHighlightStyle() {
|
|
508
|
+
const e = this.editor, { tableElement: t } = this.$lookup();
|
|
509
|
+
Me(t, e._config.theme.tableSelection), t.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
|
|
510
|
+
}
|
|
511
|
+
$disableHighlightStyle() {
|
|
512
|
+
const { tableElement: e } = this.$lookup();
|
|
513
|
+
Q(e, this.editor._config.theme.tableSelection), this.hasHijackedSelectionStyles = !0;
|
|
514
|
+
}
|
|
515
|
+
$updateTableTableSelection(e) {
|
|
516
|
+
if (e !== null) {
|
|
517
|
+
e.tableKey !== this.tableNodeKey && b(233, e.tableKey, this.tableNodeKey);
|
|
518
|
+
const t = this.editor;
|
|
519
|
+
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), ge(t, this.table, this.tableSelection);
|
|
520
|
+
} else this.$clearHighlight();
|
|
521
|
+
}
|
|
522
|
+
setShouldCheckSelection() {
|
|
523
|
+
this.shouldCheckSelection = !0;
|
|
524
|
+
}
|
|
525
|
+
getAndClearShouldCheckSelection() {
|
|
526
|
+
return !!this.shouldCheckSelection && (this.shouldCheckSelection = !1, !0);
|
|
527
|
+
}
|
|
528
|
+
setNextFocus(e) {
|
|
529
|
+
this.nextFocus = e;
|
|
530
|
+
}
|
|
531
|
+
getAndClearNextFocus() {
|
|
532
|
+
const { nextFocus: e } = this;
|
|
533
|
+
return e !== null && (this.nextFocus = null), e;
|
|
534
|
+
}
|
|
535
|
+
updateDOMSelection() {
|
|
536
|
+
if (this.anchorCell !== null && this.focusCell !== null) {
|
|
537
|
+
const e = ye(this.editor._window);
|
|
538
|
+
e && e.rangeCount > 0 && e.removeAllRanges();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
$setFocusCellForSelection(e, t = !1) {
|
|
542
|
+
const o = this.editor, { tableNode: l } = this.$lookup(), i = e.x, r = e.y;
|
|
543
|
+
if (this.focusCell = e, this.isHighlightingCells || this.anchorX === i && this.anchorY === r && !t) {
|
|
544
|
+
if (i === this.focusX && r === this.focusY) return !1;
|
|
545
|
+
} else this.isHighlightingCells = !0, this.$disableHighlightStyle();
|
|
546
|
+
if (this.focusX = i, this.focusY = r, this.isHighlightingCells) {
|
|
547
|
+
const c = Ke(l, e.elem);
|
|
548
|
+
if (this.tableSelection != null && this.anchorCellNodeKey != null && c !== null) return this.focusCellNodeKey = c.getKey(), this.tableSelection = function(h, f, s) {
|
|
549
|
+
h.getKey(), f.getKey(), s.getKey();
|
|
550
|
+
const a = B(), u = k(a) ? a.clone() : Qe();
|
|
551
|
+
return u.set(h.getKey(), f.getKey(), s.getKey()), u;
|
|
552
|
+
}(l, this.$getAnchorTableCellOrThrow(), c), j(this.tableSelection), o.dispatchCommand(re, void 0), ge(o, this.table, this.tableSelection), !0;
|
|
553
|
+
}
|
|
554
|
+
return !1;
|
|
555
|
+
}
|
|
556
|
+
$getAnchorTableCell() {
|
|
557
|
+
return this.anchorCellNodeKey ? be(this.anchorCellNodeKey) : null;
|
|
558
|
+
}
|
|
559
|
+
$getAnchorTableCellOrThrow() {
|
|
560
|
+
const e = this.$getAnchorTableCell();
|
|
561
|
+
return e === null && b(234), e;
|
|
562
|
+
}
|
|
563
|
+
$getFocusTableCell() {
|
|
564
|
+
return this.focusCellNodeKey ? be(this.focusCellNodeKey) : null;
|
|
565
|
+
}
|
|
566
|
+
$getFocusTableCellOrThrow() {
|
|
567
|
+
const e = this.$getFocusTableCell();
|
|
568
|
+
return e === null && b(235), e;
|
|
569
|
+
}
|
|
570
|
+
$setAnchorCellForSelection(e) {
|
|
571
|
+
this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y;
|
|
572
|
+
const { tableNode: t } = this.$lookup(), o = Ke(t, e.elem);
|
|
573
|
+
if (o !== null) {
|
|
574
|
+
const l = o.getKey();
|
|
575
|
+
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Qe(), this.anchorCellNodeKey = l;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
$formatCells(e) {
|
|
579
|
+
const t = B();
|
|
580
|
+
k(t) || b(236);
|
|
581
|
+
const o = Ht(), l = o.anchor, i = o.focus, r = t.getNodes().filter(S);
|
|
582
|
+
r.length > 0 || b(237);
|
|
583
|
+
const c = r[0].getFirstChild(), h = it(c) ? c.getFormatFlags(e, null) : null;
|
|
584
|
+
r.forEach((f) => {
|
|
585
|
+
l.set(f.getKey(), 0, "element"), i.set(f.getKey(), f.getChildrenSize(), "element"), o.formatText(e, h);
|
|
586
|
+
}), j(t), this.editor.dispatchCommand(re, void 0);
|
|
587
|
+
}
|
|
588
|
+
$clearText() {
|
|
589
|
+
const { editor: e } = this, t = be(this.tableNodeKey);
|
|
590
|
+
if (!R(t)) throw new Error("Expected TableNode.");
|
|
591
|
+
const o = B();
|
|
592
|
+
k(o) || b(253);
|
|
593
|
+
const l = o.getNodes().filter(S);
|
|
594
|
+
if (l.length === this.table.columns * this.table.rows) return t.selectPrevious(), void t.remove();
|
|
595
|
+
l.forEach((i) => {
|
|
596
|
+
if (P(i)) {
|
|
597
|
+
const r = V(), c = $e();
|
|
598
|
+
r.append(c), i.append(r), i.getChildren().forEach((h) => {
|
|
599
|
+
h !== r && h.remove();
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}), ge(e, this.table, null), j(null), e.dispatchCommand(re, void 0);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const Re = "__lexicalTableSelection", an = (n) => !(1 & ~n.buttons);
|
|
606
|
+
function Z(n, e) {
|
|
607
|
+
if (!e) return e;
|
|
608
|
+
const t = e.nodeName === "TABLE" ? e : n.getDOMSlot(e).element;
|
|
609
|
+
return t.nodeName !== "TABLE" && b(245, e.nodeName), t;
|
|
610
|
+
}
|
|
611
|
+
function We(n) {
|
|
612
|
+
return n._window;
|
|
613
|
+
}
|
|
614
|
+
function ie(n, e) {
|
|
615
|
+
for (let t = e, o = null; t !== null; t = t.getParent()) {
|
|
616
|
+
if (n.is(t)) return o;
|
|
617
|
+
S(t) && (o = t);
|
|
618
|
+
}
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
const cn = [[Bt, "down"], [Dt, "up"], [Wt, "backward"], [It, "forward"]], un = [Jt, at, zt], hn = [Xt, qt];
|
|
622
|
+
function dn(n, e, t, o) {
|
|
623
|
+
const l = t.getRootElement(), i = We(t);
|
|
624
|
+
l !== null && i !== null || b(246);
|
|
625
|
+
const r = new sn(t, n.getKey()), c = Z(n, e);
|
|
626
|
+
(function(s, a) {
|
|
627
|
+
Ge(s) !== null && b(205), s[Re] = a;
|
|
628
|
+
})(c, r), r.listenersToRemove.add(() => function(s, a) {
|
|
629
|
+
Ge(s) === a && delete s[Re];
|
|
630
|
+
}(c, r)), c.addEventListener("mousedown", (s) => {
|
|
631
|
+
if (s.button !== 0 || !Te(s.target) || !i) return;
|
|
632
|
+
const a = Oe(s.target);
|
|
633
|
+
a !== null && t.update(() => {
|
|
634
|
+
const u = Ye();
|
|
635
|
+
if (nn && s.shiftKey && q(u, n) && (H(u) || k(u))) {
|
|
636
|
+
const d = u.anchor.getNode(), g = ie(n, u.anchor.getNode());
|
|
637
|
+
g ? (r.$setAnchorCellForSelection(ce(r, g)), r.$setFocusCellForSelection(a), Y(s)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(u.anchor.key, u.anchor.offset, u.anchor.type);
|
|
638
|
+
} else r.$setAnchorCellForSelection(a);
|
|
639
|
+
}), (() => {
|
|
640
|
+
if (r.isSelecting) return;
|
|
641
|
+
const u = () => {
|
|
642
|
+
r.isSelecting = !1, i.removeEventListener("mouseup", u), i.removeEventListener("mousemove", d);
|
|
643
|
+
}, d = (g) => {
|
|
644
|
+
if (!Te(g.target)) return;
|
|
645
|
+
if (!an(g) && r.isSelecting) return r.isSelecting = !1, i.removeEventListener("mouseup", u), void i.removeEventListener("mousemove", d);
|
|
646
|
+
const p = !c.contains(g.target);
|
|
647
|
+
let m = null;
|
|
648
|
+
if (p) {
|
|
649
|
+
for (const C of document.elementsFromPoint(g.clientX, g.clientY)) if (m = c.contains(C) ? Oe(C) : null, m) break;
|
|
650
|
+
} else m = Oe(g.target);
|
|
651
|
+
!m || r.focusCell !== null && m.elem === r.focusCell.elem || (r.setNextFocus({ focusCell: m, override: p }), t.dispatchCommand(re, void 0));
|
|
652
|
+
};
|
|
653
|
+
r.isSelecting = !0, i.addEventListener("mouseup", u, r.listenerOptions), i.addEventListener("mousemove", d, r.listenerOptions);
|
|
654
|
+
})();
|
|
655
|
+
}, r.listenerOptions), i.addEventListener("mousedown", (s) => {
|
|
656
|
+
const a = s.target;
|
|
657
|
+
s.button === 0 && Te(a) && t.update(() => {
|
|
658
|
+
const u = B();
|
|
659
|
+
k(u) && u.tableKey === r.tableNodeKey && l.contains(a) && r.$clearHighlight();
|
|
660
|
+
});
|
|
661
|
+
}, r.listenerOptions);
|
|
662
|
+
for (const [s, a] of cn) r.listenersToRemove.add(t.registerCommand(s, (u) => ft(t, u, a, n, r), Fe));
|
|
663
|
+
r.listenersToRemove.add(t.registerCommand(Ft, (s) => {
|
|
664
|
+
const a = B();
|
|
665
|
+
if (k(a)) {
|
|
666
|
+
const u = ie(n, a.focus.getNode());
|
|
667
|
+
if (u !== null) return Y(s), u.selectEnd(), !0;
|
|
668
|
+
}
|
|
669
|
+
return !1;
|
|
670
|
+
}, Fe));
|
|
671
|
+
const h = (s) => () => {
|
|
672
|
+
const a = B();
|
|
673
|
+
if (!q(a, n)) return !1;
|
|
674
|
+
if (k(a)) return r.$clearText(), !0;
|
|
675
|
+
if (H(a)) {
|
|
676
|
+
if (!S(ie(n, a.anchor.getNode()))) return !1;
|
|
677
|
+
const u = a.anchor.getNode(), d = a.focus.getNode(), g = n.isParentOf(u), p = n.isParentOf(d);
|
|
678
|
+
if (g && !p || p && !g) return r.$clearText(), !0;
|
|
679
|
+
const m = y(a.anchor.getNode(), (w) => P(w)), C = m && y(m, (w) => P(w) && S(w.getParent()));
|
|
680
|
+
if (!P(C) || !P(m)) return !1;
|
|
681
|
+
if (s === at && C.getPreviousSibling() === null) return !0;
|
|
682
|
+
}
|
|
683
|
+
return !1;
|
|
684
|
+
};
|
|
685
|
+
for (const s of un) r.listenersToRemove.add(t.registerCommand(s, h(s), X));
|
|
686
|
+
const f = (s) => {
|
|
687
|
+
const a = B();
|
|
688
|
+
if (!k(a) && !H(a)) return !1;
|
|
689
|
+
const u = n.isParentOf(a.anchor.getNode());
|
|
690
|
+
if (u !== n.isParentOf(a.focus.getNode())) {
|
|
691
|
+
const d = u ? "anchor" : "focus", g = u ? "focus" : "anchor", { key: p, offset: m, type: C } = a[g];
|
|
692
|
+
return n[a[d].isBefore(a[g]) ? "selectPrevious" : "selectNext"]()[g].set(p, m, C), !1;
|
|
693
|
+
}
|
|
694
|
+
return !!q(a, n) && !!k(a) && (s && (s.preventDefault(), s.stopPropagation()), r.$clearText(), !0);
|
|
695
|
+
};
|
|
696
|
+
for (const s of hn) r.listenersToRemove.add(t.registerCommand(s, f, X));
|
|
697
|
+
return r.listenersToRemove.add(t.registerCommand(Ot, (s) => {
|
|
698
|
+
const a = B();
|
|
699
|
+
if (a) {
|
|
700
|
+
if (!k(a) && !H(a)) return !1;
|
|
701
|
+
Vt(t, _t(s, ClipboardEvent) ? s : null, Qt(a));
|
|
702
|
+
const u = f(s);
|
|
703
|
+
return H(a) ? (a.removeText(), !0) : u;
|
|
704
|
+
}
|
|
705
|
+
return !1;
|
|
706
|
+
}, X)), r.listenersToRemove.add(t.registerCommand(vt, (s) => {
|
|
707
|
+
const a = B();
|
|
708
|
+
if (!q(a, n)) return !1;
|
|
709
|
+
if (k(a)) return r.$formatCells(s), !0;
|
|
710
|
+
if (H(a)) {
|
|
711
|
+
const u = y(a.anchor.getNode(), (d) => S(d));
|
|
712
|
+
if (!S(u)) return !1;
|
|
713
|
+
}
|
|
714
|
+
return !1;
|
|
715
|
+
}, X)), r.listenersToRemove.add(t.registerCommand(kt, (s) => {
|
|
716
|
+
const a = B();
|
|
717
|
+
if (!k(a) || !q(a, n)) return !1;
|
|
718
|
+
const u = a.anchor.getNode(), d = a.focus.getNode();
|
|
719
|
+
if (!S(u) || !S(d)) return !1;
|
|
720
|
+
const [g, p, m] = U(n, u, d), C = Math.max(p.startRow + p.cell.__rowSpan - 1, m.startRow + m.cell.__rowSpan - 1), w = Math.max(p.startColumn + p.cell.__colSpan - 1, m.startColumn + m.cell.__colSpan - 1), K = Math.min(p.startRow, m.startRow), E = Math.min(p.startColumn, m.startColumn), A = /* @__PURE__ */ new Set();
|
|
721
|
+
for (let N = K; N <= C; N++) for (let O = E; O <= w; O++) {
|
|
722
|
+
const T = g[N][O].cell;
|
|
723
|
+
if (A.has(T)) continue;
|
|
724
|
+
A.add(T), T.setFormat(s);
|
|
725
|
+
const _ = T.getChildren();
|
|
726
|
+
for (let F = 0; F < _.length; F++) {
|
|
727
|
+
const v = _[F];
|
|
728
|
+
P(v) && !v.isInline() && v.setFormat(s);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return !0;
|
|
732
|
+
}, X)), r.listenersToRemove.add(t.registerCommand(Rt, (s) => {
|
|
733
|
+
const a = B();
|
|
734
|
+
if (!q(a, n)) return !1;
|
|
735
|
+
if (k(a)) return r.$clearHighlight(), !1;
|
|
736
|
+
if (H(a)) {
|
|
737
|
+
const u = y(a.anchor.getNode(), (d) => S(d));
|
|
738
|
+
if (!S(u)) return !1;
|
|
739
|
+
if (typeof s == "string") {
|
|
740
|
+
const d = tt(t, a, n);
|
|
741
|
+
if (d) return et(d, n, [$e(s)]), !0;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return !1;
|
|
745
|
+
}, X)), o && r.listenersToRemove.add(t.registerCommand(Kt, (s) => {
|
|
746
|
+
const a = B();
|
|
747
|
+
if (!H(a) || !a.isCollapsed() || !q(a, n)) return !1;
|
|
748
|
+
const u = Ce(a.anchor.getNode());
|
|
749
|
+
return !(u === null || !n.is(we(u))) && (Y(s), function(d, g) {
|
|
750
|
+
const p = g === "next" ? "getNextSibling" : "getPreviousSibling", m = g === "next" ? "getFirstChild" : "getLastChild", C = d[p]();
|
|
751
|
+
if (P(C)) return C.selectEnd();
|
|
752
|
+
const w = y(d, M);
|
|
753
|
+
w === null && b(247);
|
|
754
|
+
for (let E = w[p](); M(E); E = E[p]()) {
|
|
755
|
+
const A = E[m]();
|
|
756
|
+
if (P(A)) return A.selectEnd();
|
|
757
|
+
}
|
|
758
|
+
const K = y(w, R);
|
|
759
|
+
K === null && b(248), g === "next" ? K.selectNext() : K.selectPrevious();
|
|
760
|
+
}(u, s.shiftKey ? "previous" : "next"), !0);
|
|
761
|
+
}, X)), r.listenersToRemove.add(t.registerCommand(Et, (s) => n.isSelected(), Fe)), r.listenersToRemove.add(t.registerCommand(Mt, (s) => {
|
|
762
|
+
const { nodes: a, selection: u } = s, d = u.getStartEndPoints(), g = k(u), p = H(u) && y(u.anchor.getNode(), (x) => S(x)) !== null && y(u.focus.getNode(), (x) => S(x)) !== null || g;
|
|
763
|
+
if (a.length !== 1 || !R(a[0]) || !p || d === null) return !1;
|
|
764
|
+
const [m] = d, C = a[0], w = C.getChildren(), K = C.getFirstChildOrThrow().getChildrenSize(), E = C.getChildrenSize(), A = y(m.getNode(), (x) => S(x)), N = A && y(A, (x) => M(x)), O = N && y(N, (x) => R(x));
|
|
765
|
+
if (!S(A) || !M(N) || !R(O)) return !1;
|
|
766
|
+
const T = N.getIndexWithinParent(), _ = Math.min(O.getChildrenSize() - 1, T + E - 1), F = A.getIndexWithinParent(), v = Math.min(N.getChildrenSize() - 1, F + K - 1), $ = Math.min(F, v), L = Math.min(T, _), W = Math.max(F, v), D = Math.max(T, _), z = O.getChildren();
|
|
767
|
+
let I = 0;
|
|
768
|
+
for (let x = L; x <= D; x++) {
|
|
769
|
+
const se = z[x];
|
|
770
|
+
if (!M(se)) return !1;
|
|
771
|
+
const ze = w[I];
|
|
772
|
+
if (!M(ze)) return !1;
|
|
773
|
+
const mt = se.getChildren(), pt = ze.getChildren();
|
|
774
|
+
let Xe = 0;
|
|
775
|
+
for (let xe = $; xe <= W; xe++) {
|
|
776
|
+
const fe = mt[xe];
|
|
777
|
+
if (!S(fe)) return !1;
|
|
778
|
+
const qe = pt[Xe];
|
|
779
|
+
if (!S(qe)) return !1;
|
|
780
|
+
const Ct = fe.getChildren();
|
|
781
|
+
qe.getChildren().forEach((ne) => {
|
|
782
|
+
ue(ne) && V().append(ne), fe.append(ne);
|
|
783
|
+
}), Ct.forEach((ne) => ne.remove()), Xe++;
|
|
784
|
+
}
|
|
785
|
+
I++;
|
|
786
|
+
}
|
|
787
|
+
return !0;
|
|
788
|
+
}, X)), r.listenersToRemove.add(t.registerCommand(re, () => {
|
|
789
|
+
const s = B(), a = Ye(), u = r.getAndClearNextFocus();
|
|
790
|
+
if (u !== null) {
|
|
791
|
+
const { focusCell: d } = u;
|
|
792
|
+
if (k(s) && s.tableKey === r.tableNodeKey) return (d.x !== r.focusX || d.y !== r.focusY) && (r.$setFocusCellForSelection(d), !0);
|
|
793
|
+
if (d !== r.anchorCell && q(s, n)) return r.$setFocusCellForSelection(d), !0;
|
|
794
|
+
}
|
|
795
|
+
if (r.getAndClearShouldCheckSelection() && H(a) && H(s) && s.isCollapsed()) {
|
|
796
|
+
const d = s.anchor.getNode(), g = n.getFirstChild(), p = Ce(d);
|
|
797
|
+
if (p !== null && M(g)) {
|
|
798
|
+
const m = g.getFirstChild();
|
|
799
|
+
if (S(m) && n.is(y(p, (C) => C.is(n) || C.is(m)))) return m.selectStart(), !0;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
if (H(s)) {
|
|
803
|
+
const { anchor: d, focus: g } = s, p = d.getNode(), m = g.getNode(), C = Ce(p), w = Ce(m), K = !(!C || !n.is(we(C))), E = !(!w || !n.is(we(w))), A = K !== E, N = K && E, O = s.isBackward();
|
|
804
|
+
if (A) {
|
|
805
|
+
const T = s.clone();
|
|
806
|
+
if (E) {
|
|
807
|
+
const [_] = U(n, w, w), F = _[0][0].cell, v = _[_.length - 1].at(-1).cell;
|
|
808
|
+
T.focus.set(O ? F.getKey() : v.getKey(), O ? F.getChildrenSize() : v.getChildrenSize(), "element");
|
|
809
|
+
} else if (K) {
|
|
810
|
+
const [_] = U(n, C, C), F = _[0][0].cell, v = _[_.length - 1].at(-1).cell;
|
|
811
|
+
T.anchor.set(O ? v.getKey() : F.getKey(), O ? v.getChildrenSize() : 0, "element");
|
|
812
|
+
}
|
|
813
|
+
j(T), Ze(t, r);
|
|
814
|
+
} else N && (C.is(w) || (r.$setAnchorCellForSelection(ce(r, C)), r.$setFocusCellForSelection(ce(r, w), !0)));
|
|
815
|
+
} else if (s && k(s) && s.is(a) && s.tableKey === n.getKey()) {
|
|
816
|
+
const d = ye(i);
|
|
817
|
+
if (d && d.anchorNode && d.focusNode) {
|
|
818
|
+
const g = G(d.focusNode), p = g && !n.isParentOf(g), m = G(d.anchorNode), C = m && n.isParentOf(m);
|
|
819
|
+
if (p && C && d.rangeCount > 0) {
|
|
820
|
+
const w = At(d, t);
|
|
821
|
+
w && (w.anchor.set(n.getKey(), s.isBackward() ? n.getChildrenSize() : 0, "element"), d.removeAllRanges(), j(w));
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return s && !s.is(a) && (k(s) || k(a)) && r.tableSelection && !r.tableSelection.is(a) ? (k(s) && s.tableKey === r.tableNodeKey ? r.$updateTableTableSelection(s) : !k(s) && k(a) && a.tableKey === r.tableNodeKey && r.$updateTableTableSelection(null), !1) : (r.hasHijackedSelectionStyles && !n.isSelected() ? function(d, g) {
|
|
826
|
+
g.$enableHighlightStyle(), Ie(g.table, (p) => {
|
|
827
|
+
const m = p.elem;
|
|
828
|
+
p.highlighted = !1, dt(d, p), m.getAttribute("style") || m.removeAttribute("style");
|
|
829
|
+
});
|
|
830
|
+
}(t, r) : !r.hasHijackedSelectionStyles && n.isSelected() && Ze(t, r), !1);
|
|
831
|
+
}, X)), r.listenersToRemove.add(t.registerCommand(Pt, () => {
|
|
832
|
+
const s = B();
|
|
833
|
+
if (!H(s) || !s.isCollapsed() || !q(s, n)) return !1;
|
|
834
|
+
const a = tt(t, s, n);
|
|
835
|
+
return !!a && (et(a, n), !0);
|
|
836
|
+
}, X)), r;
|
|
837
|
+
}
|
|
838
|
+
function Ge(n) {
|
|
839
|
+
return n[Re] || null;
|
|
840
|
+
}
|
|
841
|
+
function Oe(n) {
|
|
842
|
+
let e = n;
|
|
843
|
+
for (; e != null; ) {
|
|
844
|
+
const t = e.nodeName;
|
|
845
|
+
if (t === "TD" || t === "TH") {
|
|
846
|
+
const o = e._cell;
|
|
847
|
+
return o === void 0 ? null : o;
|
|
848
|
+
}
|
|
849
|
+
e = e.parentNode;
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
function ae(n, e) {
|
|
854
|
+
const t = [], o = { columns: 0, domRows: t, rows: 0 };
|
|
855
|
+
let l = Z(n, e).querySelector("tr"), i = 0, r = 0;
|
|
856
|
+
for (t.length = 0; l != null; ) {
|
|
857
|
+
const c = l.nodeName;
|
|
858
|
+
if (c === "TD" || c === "TH") {
|
|
859
|
+
const s = { elem: l, hasBackgroundColor: l.style.backgroundColor !== "", highlighted: !1, x: i, y: r };
|
|
860
|
+
l._cell = s;
|
|
861
|
+
let a = t[r];
|
|
862
|
+
a === void 0 && (a = t[r] = []), a[i] = s;
|
|
863
|
+
} else {
|
|
864
|
+
const s = l.firstChild;
|
|
865
|
+
if (s != null) {
|
|
866
|
+
l = s;
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
const h = l.nextSibling;
|
|
871
|
+
if (h != null) {
|
|
872
|
+
i++, l = h;
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
const f = l.parentNode;
|
|
876
|
+
if (f != null) {
|
|
877
|
+
const s = f.nextSibling;
|
|
878
|
+
if (s == null) break;
|
|
879
|
+
r++, i = 0, l = s;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return o.columns = i + 1, o.rows = r + 1, o;
|
|
883
|
+
}
|
|
884
|
+
function ge(n, e, t) {
|
|
885
|
+
const o = new Set(t ? t.getNodes() : []);
|
|
886
|
+
Ie(e, (l, i) => {
|
|
887
|
+
const r = l.elem;
|
|
888
|
+
o.has(i) ? (l.highlighted = !0, ht(n, l)) : (l.highlighted = !1, dt(n, l), r.getAttribute("style") || r.removeAttribute("style"));
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
function Ie(n, e) {
|
|
892
|
+
const { domRows: t } = n;
|
|
893
|
+
for (let o = 0; o < t.length; o++) {
|
|
894
|
+
const l = t[o];
|
|
895
|
+
if (l) for (let i = 0; i < l.length; i++) {
|
|
896
|
+
const r = l[i];
|
|
897
|
+
if (!r) continue;
|
|
898
|
+
const c = G(r.elem);
|
|
899
|
+
c !== null && e(r, c, { x: i, y: o });
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function Ze(n, e) {
|
|
904
|
+
e.$disableHighlightStyle(), Ie(e.table, (t) => {
|
|
905
|
+
t.highlighted = !0, ht(n, t);
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
const fn = (n, e, t, o, l) => {
|
|
909
|
+
const i = l === "forward";
|
|
910
|
+
switch (l) {
|
|
911
|
+
case "backward":
|
|
912
|
+
case "forward":
|
|
913
|
+
return t !== (i ? n.table.columns - 1 : 0) ? pe(e.getCellNodeFromCordsOrThrow(t + (i ? 1 : -1), o, n.table), i) : o !== (i ? n.table.rows - 1 : 0) ? pe(e.getCellNodeFromCordsOrThrow(i ? 0 : n.table.columns - 1, o + (i ? 1 : -1), n.table), i) : i ? e.selectNext() : e.selectPrevious(), !0;
|
|
914
|
+
case "up":
|
|
915
|
+
return o !== 0 ? pe(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
|
|
916
|
+
case "down":
|
|
917
|
+
return o !== n.table.rows - 1 ? pe(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
|
|
918
|
+
default:
|
|
919
|
+
return !1;
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
function ve(n, e) {
|
|
923
|
+
let t, o;
|
|
924
|
+
if (e.startColumn === n.minColumn) t = "minColumn";
|
|
925
|
+
else {
|
|
926
|
+
if (e.startColumn + e.cell.__colSpan - 1 !== n.maxColumn) return null;
|
|
927
|
+
t = "maxColumn";
|
|
928
|
+
}
|
|
929
|
+
if (e.startRow === n.minRow) o = "minRow";
|
|
930
|
+
else {
|
|
931
|
+
if (e.startRow + e.cell.__rowSpan - 1 !== n.maxRow) return null;
|
|
932
|
+
o = "maxRow";
|
|
933
|
+
}
|
|
934
|
+
return [t, o];
|
|
935
|
+
}
|
|
936
|
+
function me([n, e]) {
|
|
937
|
+
return [n === "minColumn" ? "maxColumn" : "minColumn", e === "minRow" ? "maxRow" : "minRow"];
|
|
938
|
+
}
|
|
939
|
+
function oe(n, e, [t, o]) {
|
|
940
|
+
const l = e[o], i = n[l];
|
|
941
|
+
i === void 0 && b(250, o, String(l));
|
|
942
|
+
const r = e[t], c = i[r];
|
|
943
|
+
return c === void 0 && b(250, t, String(r)), c;
|
|
944
|
+
}
|
|
945
|
+
function gn(n, e, t, o, l) {
|
|
946
|
+
const i = ke(e, t, o), r = function(N, O) {
|
|
947
|
+
const { minColumn: T, maxColumn: _, minRow: F, maxRow: v } = O;
|
|
948
|
+
let $ = 1, L = 1, W = 1, D = 1;
|
|
949
|
+
const z = N[F], I = N[v];
|
|
950
|
+
for (let x = T; x <= _; x++) $ = Math.max($, z[x].cell.__rowSpan), D = Math.max(D, I[x].cell.__rowSpan);
|
|
951
|
+
for (let x = F; x <= v; x++) L = Math.max(L, N[x][T].cell.__colSpan), W = Math.max(W, N[x][_].cell.__colSpan);
|
|
952
|
+
return { bottomSpan: D, leftSpan: L, rightSpan: W, topSpan: $ };
|
|
953
|
+
}(e, i), { topSpan: c, leftSpan: h, bottomSpan: f, rightSpan: s } = r, a = function(N, O) {
|
|
954
|
+
const T = ve(N, O);
|
|
955
|
+
return T === null && b(249, O.cell.getKey()), T;
|
|
956
|
+
}(i, t), [u, d] = me(a);
|
|
957
|
+
let g = i[u], p = i[d];
|
|
958
|
+
l === "forward" ? g += u === "maxColumn" ? 1 : h : l === "backward" ? g -= u === "minColumn" ? 1 : s : l === "down" ? p += d === "maxRow" ? 1 : c : l === "up" && (p -= d === "minRow" ? 1 : f);
|
|
959
|
+
const m = e[p];
|
|
960
|
+
if (m === void 0) return !1;
|
|
961
|
+
const C = m[g];
|
|
962
|
+
if (C === void 0) return !1;
|
|
963
|
+
const [w, K] = function(N, O, T) {
|
|
964
|
+
const _ = ke(N, O, T), F = ve(_, O);
|
|
965
|
+
if (F) return [oe(N, _, F), oe(N, _, me(F))];
|
|
966
|
+
const v = ve(_, T);
|
|
967
|
+
if (v) return [oe(N, _, me(v)), oe(N, _, v)];
|
|
968
|
+
const $ = ["minColumn", "minRow"];
|
|
969
|
+
return [oe(N, _, $), oe(N, _, me($))];
|
|
970
|
+
}(e, t, C), E = ce(n, w.cell), A = ce(n, K.cell);
|
|
971
|
+
return n.$setAnchorCellForSelection(E), n.$setFocusCellForSelection(A, !0), !0;
|
|
972
|
+
}
|
|
973
|
+
function q(n, e) {
|
|
974
|
+
if (H(n) || k(n)) {
|
|
975
|
+
const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
|
|
976
|
+
return t && o;
|
|
977
|
+
}
|
|
978
|
+
return !1;
|
|
979
|
+
}
|
|
980
|
+
function pe(n, e) {
|
|
981
|
+
e ? n.selectStart() : n.selectEnd();
|
|
982
|
+
}
|
|
983
|
+
function ht(n, e) {
|
|
984
|
+
const t = e.elem, o = n._config.theme;
|
|
985
|
+
S(G(t)) || b(131), Q(t, o.tableCellSelected);
|
|
986
|
+
}
|
|
987
|
+
function dt(n, e) {
|
|
988
|
+
const t = e.elem;
|
|
989
|
+
S(G(t)) || b(131);
|
|
990
|
+
const o = n._config.theme;
|
|
991
|
+
Me(t, o.tableCellSelected);
|
|
992
|
+
}
|
|
993
|
+
function Ce(n) {
|
|
994
|
+
const e = y(n, S);
|
|
995
|
+
return S(e) ? e : null;
|
|
996
|
+
}
|
|
997
|
+
function we(n) {
|
|
998
|
+
const e = y(n, R);
|
|
999
|
+
return R(e) ? e : null;
|
|
1000
|
+
}
|
|
1001
|
+
function ft(n, e, t, o, l) {
|
|
1002
|
+
if ((t === "up" || t === "down") && function(r) {
|
|
1003
|
+
const c = r.getRootElement();
|
|
1004
|
+
return c ? c.hasAttribute("aria-controls") && c.getAttribute("aria-controls") === "typeahead-menu" : !1;
|
|
1005
|
+
}(n)) return !1;
|
|
1006
|
+
const i = B();
|
|
1007
|
+
if (!q(i, o)) {
|
|
1008
|
+
if (H(i)) {
|
|
1009
|
+
if (t === "backward") {
|
|
1010
|
+
if (i.focus.offset > 0) return !1;
|
|
1011
|
+
const r = function(h) {
|
|
1012
|
+
for (let f = h, s = h; s !== null; f = s, s = s.getParent()) if (P(s)) {
|
|
1013
|
+
if (s !== f && s.getFirstChild() !== f) return null;
|
|
1014
|
+
if (!s.isInline()) return s;
|
|
1015
|
+
}
|
|
1016
|
+
return null;
|
|
1017
|
+
}(i.focus.getNode());
|
|
1018
|
+
if (!r) return !1;
|
|
1019
|
+
const c = r.getPreviousSibling();
|
|
1020
|
+
return !!R(c) && (Y(e), e.shiftKey ? i.focus.set(c.getParentOrThrow().getKey(), c.getIndexWithinParent(), "element") : c.selectEnd(), !0);
|
|
1021
|
+
}
|
|
1022
|
+
if (e.shiftKey && (t === "up" || t === "down")) {
|
|
1023
|
+
const r = i.focus.getNode();
|
|
1024
|
+
if (!i.isCollapsed() && (t === "up" && !i.isBackward() || t === "down" && i.isBackward())) {
|
|
1025
|
+
let c = y(r, (u) => R(u));
|
|
1026
|
+
if (S(c) && (c = y(c, R)), c !== o || !c) return !1;
|
|
1027
|
+
const h = t === "down" ? c.getNextSibling() : c.getPreviousSibling();
|
|
1028
|
+
if (!h) return !1;
|
|
1029
|
+
let f = 0;
|
|
1030
|
+
t === "up" && P(h) && (f = h.getChildrenSize());
|
|
1031
|
+
let s = h;
|
|
1032
|
+
t === "up" && P(h) && (s = h.getLastChild() || h, f = ue(s) ? s.getTextContentSize() : 0);
|
|
1033
|
+
const a = i.clone();
|
|
1034
|
+
return a.focus.set(s.getKey(), f, ue(s) ? "text" : "element"), j(a), Y(e), !0;
|
|
1035
|
+
}
|
|
1036
|
+
if ($t(r)) {
|
|
1037
|
+
const c = t === "up" ? i.getNodes()[i.getNodes().length - 1] : i.getNodes()[0];
|
|
1038
|
+
if (c && ie(o, c) !== null) {
|
|
1039
|
+
const h = o.getFirstDescendant(), f = o.getLastDescendant();
|
|
1040
|
+
if (!h || !f) return !1;
|
|
1041
|
+
const [s] = le(h), [a] = le(f), u = o.getCordsFromCellNode(s, l.table), d = o.getCordsFromCellNode(a, l.table), g = o.getDOMCellFromCordsOrThrow(u.x, u.y, l.table), p = o.getDOMCellFromCordsOrThrow(d.x, d.y, l.table);
|
|
1042
|
+
return l.$setAnchorCellForSelection(g), l.$setFocusCellForSelection(p, !0), !0;
|
|
1043
|
+
}
|
|
1044
|
+
return !1;
|
|
1045
|
+
}
|
|
1046
|
+
{
|
|
1047
|
+
let c = y(r, (f) => P(f) && !f.isInline());
|
|
1048
|
+
if (S(c) && (c = y(c, R)), !c) return !1;
|
|
1049
|
+
const h = t === "down" ? c.getNextSibling() : c.getPreviousSibling();
|
|
1050
|
+
if (R(h) && l.tableNodeKey === h.getKey()) {
|
|
1051
|
+
const f = h.getFirstDescendant(), s = h.getLastDescendant();
|
|
1052
|
+
if (!f || !s) return !1;
|
|
1053
|
+
const [a] = le(f), [u] = le(s), d = i.clone();
|
|
1054
|
+
return d.focus.set((t === "up" ? a : u).getKey(), t === "up" ? 0 : u.getChildrenSize(), "element"), Y(e), j(d), !0;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return t === "down" && gt(n) && l.setShouldCheckSelection(), !1;
|
|
1060
|
+
}
|
|
1061
|
+
if (H(i) && i.isCollapsed()) {
|
|
1062
|
+
const { anchor: r, focus: c } = i, h = y(r.getNode(), S), f = y(c.getNode(), S);
|
|
1063
|
+
if (!S(h) || !h.is(f)) return !1;
|
|
1064
|
+
const s = we(h);
|
|
1065
|
+
if (s !== o && s != null) {
|
|
1066
|
+
const C = Z(s, n.getElementByKey(s.getKey()));
|
|
1067
|
+
if (C != null) return l.table = ae(s, C), ft(n, e, t, s, l);
|
|
1068
|
+
}
|
|
1069
|
+
if (t === "backward" || t === "forward") {
|
|
1070
|
+
const C = r.type, w = r.offset, K = r.getNode();
|
|
1071
|
+
if (!K) return !1;
|
|
1072
|
+
const E = i.getNodes();
|
|
1073
|
+
return (E.length !== 1 || !Lt(E[0])) && !!function(A, N, O, T) {
|
|
1074
|
+
return function(_, F, v) {
|
|
1075
|
+
return _ === "element" && (v === "backward" ? F.getPreviousSibling() === null : F.getNextSibling() === null);
|
|
1076
|
+
}(A, O, T) || function(_, F, v, $) {
|
|
1077
|
+
const L = y(v, (D) => P(D) && !D.isInline());
|
|
1078
|
+
if (!L) return !1;
|
|
1079
|
+
const W = $ === "backward" ? F === 0 : F === v.getTextContentSize();
|
|
1080
|
+
return _ === "text" && W && ($ === "backward" ? L.getPreviousSibling() === null : L.getNextSibling() === null);
|
|
1081
|
+
}(A, N, O, T);
|
|
1082
|
+
}(C, w, K, t) && function(A, N, O, T, _) {
|
|
1083
|
+
const [F, v] = U(T, O, O);
|
|
1084
|
+
if (!function(L, W, D) {
|
|
1085
|
+
const z = L[0][0], I = L[L.length - 1][L[0].length - 1], { startColumn: x, startRow: se } = W;
|
|
1086
|
+
return D === "backward" ? x === z.startColumn && se === z.startRow : x === I.startColumn && se === I.startRow;
|
|
1087
|
+
}(F, v, _)) return !1;
|
|
1088
|
+
const $ = function(L, W, D) {
|
|
1089
|
+
const z = y(L, (x) => P(x) && !x.isInline());
|
|
1090
|
+
if (!z) return;
|
|
1091
|
+
const I = W === "backward" ? z.getPreviousSibling() : z.getNextSibling();
|
|
1092
|
+
return I && R(I) ? I : W === "backward" ? D.getPreviousSibling() : D.getNextSibling();
|
|
1093
|
+
}(N, _, T);
|
|
1094
|
+
return !$ || R($) ? !1 : (Y(A), _ === "backward" ? $.selectEnd() : $.selectStart(), !0);
|
|
1095
|
+
}(e, K, h, o, t);
|
|
1096
|
+
}
|
|
1097
|
+
const a = n.getElementByKey(h.__key), u = n.getElementByKey(r.key);
|
|
1098
|
+
if (u == null || a == null) return !1;
|
|
1099
|
+
let d;
|
|
1100
|
+
if (r.type === "element") d = u.getBoundingClientRect();
|
|
1101
|
+
else {
|
|
1102
|
+
const C = ye(We(n));
|
|
1103
|
+
if (C === null || C.rangeCount === 0) return !1;
|
|
1104
|
+
d = C.getRangeAt(0).getBoundingClientRect();
|
|
1105
|
+
}
|
|
1106
|
+
const g = t === "up" ? h.getFirstChild() : h.getLastChild();
|
|
1107
|
+
if (g == null) return !1;
|
|
1108
|
+
const p = n.getElementByKey(g.__key);
|
|
1109
|
+
if (p == null) return !1;
|
|
1110
|
+
const m = p.getBoundingClientRect();
|
|
1111
|
+
if (t === "up" ? m.top > d.top - d.height : d.bottom + d.height > m.bottom) {
|
|
1112
|
+
Y(e);
|
|
1113
|
+
const C = o.getCordsFromCellNode(h, l.table);
|
|
1114
|
+
if (!e.shiftKey) return fn(l, o, C.x, C.y, t);
|
|
1115
|
+
{
|
|
1116
|
+
const w = o.getDOMCellFromCordsOrThrow(C.x, C.y, l.table);
|
|
1117
|
+
l.$setAnchorCellForSelection(w), l.$setFocusCellForSelection(w, !0);
|
|
1118
|
+
}
|
|
1119
|
+
return !0;
|
|
1120
|
+
}
|
|
1121
|
+
} else if (k(i)) {
|
|
1122
|
+
const { anchor: r, focus: c } = i, h = y(r.getNode(), S), f = y(c.getNode(), S), [s] = i.getNodes();
|
|
1123
|
+
R(s) || b(251);
|
|
1124
|
+
const a = Z(s, n.getElementByKey(s.getKey()));
|
|
1125
|
+
if (!S(h) || !S(f) || !R(s) || a == null) return !1;
|
|
1126
|
+
l.$updateTableTableSelection(i);
|
|
1127
|
+
const u = ae(s, a), d = o.getCordsFromCellNode(h, u), g = o.getDOMCellFromCordsOrThrow(d.x, d.y, u);
|
|
1128
|
+
if (l.$setAnchorCellForSelection(g), Y(e), e.shiftKey) {
|
|
1129
|
+
const [p, m, C] = U(o, h, f);
|
|
1130
|
+
return gn(l, p, m, C, t);
|
|
1131
|
+
}
|
|
1132
|
+
return f.selectEnd(), !0;
|
|
1133
|
+
}
|
|
1134
|
+
return !1;
|
|
1135
|
+
}
|
|
1136
|
+
function Y(n) {
|
|
1137
|
+
n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
|
|
1138
|
+
}
|
|
1139
|
+
function et(n, e, t) {
|
|
1140
|
+
const o = V();
|
|
1141
|
+
n === "first" ? e.insertBefore(o) : e.insertAfter(o), o.append(...t || []), o.selectEnd();
|
|
1142
|
+
}
|
|
1143
|
+
function tt(n, e, t) {
|
|
1144
|
+
const o = t.getParent();
|
|
1145
|
+
if (!o) return;
|
|
1146
|
+
const l = ye(We(n));
|
|
1147
|
+
if (!l) return;
|
|
1148
|
+
const i = l.anchorNode, r = n.getElementByKey(o.getKey()), c = Z(t, n.getElementByKey(t.getKey()));
|
|
1149
|
+
if (!i || !r || !c || !r.contains(i) || c.contains(i)) return;
|
|
1150
|
+
const h = y(e.anchor.getNode(), (w) => S(w));
|
|
1151
|
+
if (!h) return;
|
|
1152
|
+
const f = y(h, (w) => R(w));
|
|
1153
|
+
if (!R(f) || !f.is(t)) return;
|
|
1154
|
+
const [s, a] = U(t, h, h), u = s[0][0], d = s[s.length - 1][s[0].length - 1], { startRow: g, startColumn: p } = a, m = g === u.startRow && p === u.startColumn, C = g === d.startRow && p === d.startColumn;
|
|
1155
|
+
return m ? "first" : C ? "last" : void 0;
|
|
1156
|
+
}
|
|
1157
|
+
function ce(n, e) {
|
|
1158
|
+
const { tableNode: t } = n.$lookup(), o = t.getCordsFromCellNode(e, n.table);
|
|
1159
|
+
return t.getDOMCellFromCordsOrThrow(o.x, o.y, n.table);
|
|
1160
|
+
}
|
|
1161
|
+
function Ke(n, e, t) {
|
|
1162
|
+
return ie(n, G(e, t));
|
|
1163
|
+
}
|
|
1164
|
+
function nt(n, e, t, o) {
|
|
1165
|
+
const l = n.querySelector("colgroup");
|
|
1166
|
+
if (!l) return;
|
|
1167
|
+
const i = [];
|
|
1168
|
+
for (let r = 0; r < t; r++) {
|
|
1169
|
+
const c = document.createElement("col"), h = o && o[r];
|
|
1170
|
+
h && (c.style.width = `${h}px`), i.push(c);
|
|
1171
|
+
}
|
|
1172
|
+
l.replaceChildren(...i);
|
|
1173
|
+
}
|
|
1174
|
+
function ot(n, e, t) {
|
|
1175
|
+
t ? (Q(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (Me(n, e.theme.tableRowStriping), n.removeAttribute("data-lexical-row-striping"));
|
|
1176
|
+
}
|
|
1177
|
+
const Ee = /* @__PURE__ */ new WeakSet();
|
|
1178
|
+
function gt(n = st()) {
|
|
1179
|
+
return Ee.has(n);
|
|
1180
|
+
}
|
|
1181
|
+
function On(n, e) {
|
|
1182
|
+
e ? Ee.add(n) : Ee.delete(n);
|
|
1183
|
+
}
|
|
1184
|
+
class ee extends Ae {
|
|
1185
|
+
static getType() {
|
|
1186
|
+
return "table";
|
|
1187
|
+
}
|
|
1188
|
+
getColWidths() {
|
|
1189
|
+
return this.getLatest().__colWidths;
|
|
1190
|
+
}
|
|
1191
|
+
setColWidths(e) {
|
|
1192
|
+
const t = this.getWritable();
|
|
1193
|
+
return t.__colWidths = e, t;
|
|
1194
|
+
}
|
|
1195
|
+
static clone(e) {
|
|
1196
|
+
return new ee(e.__key);
|
|
1197
|
+
}
|
|
1198
|
+
afterCloneFrom(e) {
|
|
1199
|
+
super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping;
|
|
1200
|
+
}
|
|
1201
|
+
static importDOM() {
|
|
1202
|
+
return { table: (e) => ({ conversion: mn, priority: 1 }) };
|
|
1203
|
+
}
|
|
1204
|
+
static importJSON(e) {
|
|
1205
|
+
return Je().updateFromJSON(e);
|
|
1206
|
+
}
|
|
1207
|
+
updateFromJSON(e) {
|
|
1208
|
+
return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setColWidths(e.colWidths);
|
|
1209
|
+
}
|
|
1210
|
+
constructor(e) {
|
|
1211
|
+
super(e), this.__rowStriping = !1;
|
|
1212
|
+
}
|
|
1213
|
+
exportJSON() {
|
|
1214
|
+
return { ...super.exportJSON(), colWidths: this.getColWidths(), rowStriping: this.__rowStriping ? this.__rowStriping : void 0 };
|
|
1215
|
+
}
|
|
1216
|
+
extractWithChild(e, t, o) {
|
|
1217
|
+
return o === "html";
|
|
1218
|
+
}
|
|
1219
|
+
getDOMSlot(e) {
|
|
1220
|
+
const t = e.nodeName !== "TABLE" && e.querySelector("table") || e;
|
|
1221
|
+
return t.nodeName !== "TABLE" && b(229), super.getDOMSlot(t).withAfter(t.querySelector("colgroup"));
|
|
1222
|
+
}
|
|
1223
|
+
createDOM(e, t) {
|
|
1224
|
+
const o = document.createElement("table"), l = document.createElement("colgroup");
|
|
1225
|
+
if (o.appendChild(l), nt(o, 0, this.getColumnCount(), this.getColWidths()), Nt(l), Q(o, e.theme.table), this.__rowStriping && ot(o, e, !0), gt(t)) {
|
|
1226
|
+
const i = document.createElement("div"), r = e.theme.tableScrollableWrapper;
|
|
1227
|
+
return r ? Q(i, r) : i.style.cssText = "overflow-x: auto;", i.appendChild(o), i;
|
|
1228
|
+
}
|
|
1229
|
+
return o;
|
|
1230
|
+
}
|
|
1231
|
+
updateDOM(e, t, o) {
|
|
1232
|
+
return e.__rowStriping !== this.__rowStriping && ot(t, o, this.__rowStriping), nt(t, 0, this.getColumnCount(), this.getColWidths()), !1;
|
|
1233
|
+
}
|
|
1234
|
+
exportDOM(e) {
|
|
1235
|
+
const t = super.exportDOM(e), { element: o } = t;
|
|
1236
|
+
return { after: (l) => {
|
|
1237
|
+
if (t.after && (l = t.after(l)), Se(l) && l.nodeName !== "TABLE" && (l = l.querySelector("table")), !Se(l)) return null;
|
|
1238
|
+
const [i] = De(this, null, null), r = /* @__PURE__ */ new Map();
|
|
1239
|
+
for (const s of i) for (const a of s) {
|
|
1240
|
+
const u = a.cell.getKey();
|
|
1241
|
+
r.has(u) || r.set(u, { colSpan: a.cell.getColSpan(), startColumn: a.startColumn });
|
|
1242
|
+
}
|
|
1243
|
+
const c = /* @__PURE__ */ new Set();
|
|
1244
|
+
for (const s of l.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
|
|
1245
|
+
const a = s.getAttribute("data-temporary-table-cell-lexical-key");
|
|
1246
|
+
if (a) {
|
|
1247
|
+
const u = r.get(a);
|
|
1248
|
+
if (s.removeAttribute("data-temporary-table-cell-lexical-key"), u) {
|
|
1249
|
+
r.delete(a);
|
|
1250
|
+
for (let d = 0; d < u.colSpan; d++) c.add(d + u.startColumn);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
const h = l.querySelector(":scope > colgroup");
|
|
1255
|
+
if (h) {
|
|
1256
|
+
const s = Array.from(l.querySelectorAll(":scope > colgroup > col")).filter((a, u) => c.has(u));
|
|
1257
|
+
h.replaceChildren(...s);
|
|
1258
|
+
}
|
|
1259
|
+
const f = l.querySelectorAll(":scope > tr");
|
|
1260
|
+
if (f.length > 0) {
|
|
1261
|
+
const s = document.createElement("tbody");
|
|
1262
|
+
for (const a of f) s.appendChild(a);
|
|
1263
|
+
l.append(s);
|
|
1264
|
+
}
|
|
1265
|
+
return l;
|
|
1266
|
+
}, element: Se(o) && o.nodeName !== "TABLE" ? o.querySelector("table") : o };
|
|
1267
|
+
}
|
|
1268
|
+
canBeEmpty() {
|
|
1269
|
+
return !1;
|
|
1270
|
+
}
|
|
1271
|
+
isShadowRoot() {
|
|
1272
|
+
return !0;
|
|
1273
|
+
}
|
|
1274
|
+
getCordsFromCellNode(e, t) {
|
|
1275
|
+
const { rows: o, domRows: l } = t;
|
|
1276
|
+
for (let i = 0; i < o; i++) {
|
|
1277
|
+
const r = l[i];
|
|
1278
|
+
if (r != null) for (let c = 0; c < r.length; c++) {
|
|
1279
|
+
const h = r[c];
|
|
1280
|
+
if (h == null) continue;
|
|
1281
|
+
const { elem: f } = h, s = Ke(this, f);
|
|
1282
|
+
if (s !== null && e.is(s)) return { x: c, y: i };
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
throw new Error("Cell not found in table.");
|
|
1286
|
+
}
|
|
1287
|
+
getDOMCellFromCords(e, t, o) {
|
|
1288
|
+
const { domRows: l } = o, i = l[t];
|
|
1289
|
+
if (i == null) return null;
|
|
1290
|
+
const r = i[e < i.length ? e : i.length - 1];
|
|
1291
|
+
return r ?? null;
|
|
1292
|
+
}
|
|
1293
|
+
getDOMCellFromCordsOrThrow(e, t, o) {
|
|
1294
|
+
const l = this.getDOMCellFromCords(e, t, o);
|
|
1295
|
+
if (!l) throw new Error("Cell not found at cords.");
|
|
1296
|
+
return l;
|
|
1297
|
+
}
|
|
1298
|
+
getCellNodeFromCords(e, t, o) {
|
|
1299
|
+
const l = this.getDOMCellFromCords(e, t, o);
|
|
1300
|
+
if (l == null) return null;
|
|
1301
|
+
const i = G(l.elem);
|
|
1302
|
+
return S(i) ? i : null;
|
|
1303
|
+
}
|
|
1304
|
+
getCellNodeFromCordsOrThrow(e, t, o) {
|
|
1305
|
+
const l = this.getCellNodeFromCords(e, t, o);
|
|
1306
|
+
if (!l) throw new Error("Node at cords not TableCellNode.");
|
|
1307
|
+
return l;
|
|
1308
|
+
}
|
|
1309
|
+
getRowStriping() {
|
|
1310
|
+
return !!this.getLatest().__rowStriping;
|
|
1311
|
+
}
|
|
1312
|
+
setRowStriping(e) {
|
|
1313
|
+
const t = this.getWritable();
|
|
1314
|
+
return t.__rowStriping = e, t;
|
|
1315
|
+
}
|
|
1316
|
+
canSelectBefore() {
|
|
1317
|
+
return !0;
|
|
1318
|
+
}
|
|
1319
|
+
canIndent() {
|
|
1320
|
+
return !1;
|
|
1321
|
+
}
|
|
1322
|
+
getColumnCount() {
|
|
1323
|
+
const e = this.getFirstChild();
|
|
1324
|
+
if (!e) return 0;
|
|
1325
|
+
let t = 0;
|
|
1326
|
+
return e.getChildren().forEach((o) => {
|
|
1327
|
+
S(o) && (t += o.getColSpan());
|
|
1328
|
+
}), t;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
function mn(n) {
|
|
1332
|
+
const e = Je();
|
|
1333
|
+
n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0);
|
|
1334
|
+
const t = n.querySelector(":scope > colgroup");
|
|
1335
|
+
if (t) {
|
|
1336
|
+
let o = [];
|
|
1337
|
+
for (const l of t.querySelectorAll(":scope > col")) {
|
|
1338
|
+
let i = l.style.width || "";
|
|
1339
|
+
if (!Le.test(i) && (i = l.getAttribute("width") || "", !/^\d+$/.test(i))) {
|
|
1340
|
+
o = void 0;
|
|
1341
|
+
break;
|
|
1342
|
+
}
|
|
1343
|
+
o.push(parseFloat(i));
|
|
1344
|
+
}
|
|
1345
|
+
o && e.setColWidths(o);
|
|
1346
|
+
}
|
|
1347
|
+
return { after: (o) => rt(o, M), node: e };
|
|
1348
|
+
}
|
|
1349
|
+
function Je() {
|
|
1350
|
+
return Pe(new ee());
|
|
1351
|
+
}
|
|
1352
|
+
function R(n) {
|
|
1353
|
+
return n instanceof ee;
|
|
1354
|
+
}
|
|
1355
|
+
function pn({ rows: n, columns: e, includeHeaders: t }) {
|
|
1356
|
+
const o = on(Number(n), Number(e), t);
|
|
1357
|
+
wt(o);
|
|
1358
|
+
const l = o.getFirstDescendant();
|
|
1359
|
+
return ue(l) && l.select(), !0;
|
|
1360
|
+
}
|
|
1361
|
+
function Cn(n) {
|
|
1362
|
+
M(n.getParent()) ? n.isEmpty() && n.append(V()) : n.remove();
|
|
1363
|
+
}
|
|
1364
|
+
function Sn(n) {
|
|
1365
|
+
R(n.getParent()) ? lt(n, S) : n.remove();
|
|
1366
|
+
}
|
|
1367
|
+
function bn(n) {
|
|
1368
|
+
lt(n, M);
|
|
1369
|
+
const [e] = De(n, null, null), t = e.reduce((l, i) => Math.max(l, i.length), 0), o = n.getChildren();
|
|
1370
|
+
for (let l = 0; l < e.length; ++l) {
|
|
1371
|
+
const i = o[l];
|
|
1372
|
+
if (!i) continue;
|
|
1373
|
+
M(i) || b(254, i.constructor.name, i.getType());
|
|
1374
|
+
const r = e[l].reduce((c, h) => h ? 1 + c : c, 0);
|
|
1375
|
+
if (r !== t) for (let c = r; c < t; ++c) {
|
|
1376
|
+
const h = he();
|
|
1377
|
+
h.append(V()), i.append(h);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function vn(n) {
|
|
1382
|
+
return n.registerNodeTransform(te, (e) => {
|
|
1383
|
+
if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
|
|
1384
|
+
const [, , t] = le(e), [o] = U(t, e, e), l = o.length, i = o[0].length;
|
|
1385
|
+
let r = t.getFirstChild();
|
|
1386
|
+
M(r) || b(175);
|
|
1387
|
+
const c = [];
|
|
1388
|
+
for (let h = 0; h < l; h++) {
|
|
1389
|
+
h !== 0 && (r = r.getNextSibling(), M(r) || b(175));
|
|
1390
|
+
let f = null;
|
|
1391
|
+
for (let s = 0; s < i; s++) {
|
|
1392
|
+
const a = o[h][s], u = a.cell;
|
|
1393
|
+
if (a.startRow === h && a.startColumn === s) f = u, c.push(u);
|
|
1394
|
+
else if (u.getColSpan() > 1 || u.getRowSpan() > 1) {
|
|
1395
|
+
S(u) || b(176);
|
|
1396
|
+
const d = he(u.__headerState);
|
|
1397
|
+
f !== null ? f.insertAfter(d) : St(r, d);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
for (const h of c) h.setColSpan(1), h.setRowSpan(1);
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
function kn(n, e = !0) {
|
|
1406
|
+
const t = /* @__PURE__ */ new Map(), o = (i, r, c) => {
|
|
1407
|
+
const h = Z(i, c), f = dn(i, h, n, e);
|
|
1408
|
+
t.set(r, [f, h]);
|
|
1409
|
+
}, l = n.registerMutationListener(ee, (i) => {
|
|
1410
|
+
n.getEditorState().read(() => {
|
|
1411
|
+
for (const [r, c] of i) {
|
|
1412
|
+
const h = t.get(r);
|
|
1413
|
+
if (c === "created" || c === "updated") {
|
|
1414
|
+
const { tableNode: f, tableElement: s } = ut(r);
|
|
1415
|
+
h === void 0 ? o(f, r, s) : s !== h[1] && (h[0].removeListeners(), t.delete(r), o(f, r, s));
|
|
1416
|
+
} else c === "destroyed" && h !== void 0 && (h[0].removeListeners(), t.delete(r));
|
|
1417
|
+
}
|
|
1418
|
+
}, { editor: n });
|
|
1419
|
+
}, { skipInitialization: !1 });
|
|
1420
|
+
return () => {
|
|
1421
|
+
l();
|
|
1422
|
+
for (const [, [i]] of t) i.removeListeners();
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
function Rn(n) {
|
|
1426
|
+
return n.hasNodes([ee]) || b(255), bt(n.registerCommand(Gt, pn, xt), n.registerNodeTransform(ee, bn), n.registerNodeTransform(de, Sn), n.registerNodeTransform(te, Cn));
|
|
1427
|
+
}
|
|
1428
|
+
export {
|
|
1429
|
+
Tn as F,
|
|
1430
|
+
Fn as L,
|
|
1431
|
+
xn as O,
|
|
1432
|
+
ee as P,
|
|
1433
|
+
rn as R,
|
|
1434
|
+
de as S,
|
|
1435
|
+
ct as T,
|
|
1436
|
+
kn as X,
|
|
1437
|
+
He as _,
|
|
1438
|
+
On as a,
|
|
1439
|
+
he as d,
|
|
1440
|
+
S as g,
|
|
1441
|
+
Rn as j,
|
|
1442
|
+
vn as q,
|
|
1443
|
+
te as u,
|
|
1444
|
+
Nn as v,
|
|
1445
|
+
on as x
|
|
1446
|
+
};
|
|
1447
|
+
//# sourceMappingURL=LexicalTable.prod-XN7avk7R.js.map
|