@uva-glass/component-library 2.6.1 → 2.6.2
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-BAr6tzpa.js +4236 -0
- package/dist/Lexical.prod-BAr6tzpa.js.map +1 -0
- package/dist/{LexicalClipboard.prod-Dg23ixPD.js → LexicalClipboard.prod-CLCBYtDj.js} +56 -56
- package/dist/LexicalClipboard.prod-CLCBYtDj.js.map +1 -0
- package/dist/LexicalLink.prod-CBgZ4B3x.js +263 -0
- package/dist/LexicalLink.prod-CBgZ4B3x.js.map +1 -0
- package/dist/LexicalList.prod-haeqjypw.js +576 -0
- package/dist/LexicalList.prod-haeqjypw.js.map +1 -0
- package/dist/{LexicalSelection.prod-CNWFGVlh.js → LexicalSelection.prod-C8x7KK4L.js} +38 -38
- package/dist/LexicalSelection.prod-C8x7KK4L.js.map +1 -0
- package/dist/LexicalTable.prod-8RqiGUG-.js +1447 -0
- package/dist/LexicalTable.prod-8RqiGUG-.js.map +1 -0
- package/dist/LexicalUtils.prod-Dsec_Kl-.js +122 -0
- package/dist/LexicalUtils.prod-Dsec_Kl-.js.map +1 -0
- package/dist/{TablePlugin-E6UFlCgy.js → TablePlugin-sPSGmCno.js} +69 -69
- package/dist/{TablePlugin-E6UFlCgy.js.map → TablePlugin-sPSGmCno.js.map} +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/FormInput/FormInput.js +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/OverlayStepBar/OverlayStepBar.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +37 -37
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +23 -23
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +13 -13
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +26 -26
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +17 -17
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +501 -557
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +11 -11
- package/dist/components/index.js +1 -1
- package/dist/{helpers-BVGma1u6.js → helpers-DHHQR5ys.js} +44 -44
- package/dist/{helpers-BVGma1u6.js.map → helpers-DHHQR5ys.js.map} +1 -1
- package/dist/index.js +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.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.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
|
@@ -0,0 +1,1447 @@
|
|
|
1
|
+
import { j as Q, v as re, r as y, V as Mt, d as Se, N as be, u as we, h as le, c as _e } from "./LexicalUtils.prod-Dsec_Kl-.js";
|
|
2
|
+
import { O as At, P as St, V, L as P, n as ye, v as ut, x as Pt, b as $t, J as Ne, d as G, A as se, f as xe, e as ve, g as bt, F as vt, h as Yt, a as H, H as B, Q as Tt, k as Te, X, B as Fe, l as Oe, m as ke, p as Re, N as Ke, $ as Ee, r as Me, t as rt, M as j, s as yt, u as Ae, o as Pe, y as $e, I as Le, w as He, j as ie, S as Be, z as De, C as We, D as Ie, G as Je, K as ae, R as ze, T as Xe, U as qe, W as _t, i as Ye, Y as je, Z as Ue } from "./Lexical.prod-BAr6tzpa.js";
|
|
3
|
+
import { O as Ve, L as Qe } from "./LexicalClipboard.prod-CLCBYtDj.js";
|
|
4
|
+
const Lt = /^(\d+(?:\.\d+)?)px$/, J = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
|
|
5
|
+
class et extends At {
|
|
6
|
+
static getType() {
|
|
7
|
+
return "tablecell";
|
|
8
|
+
}
|
|
9
|
+
static clone(t) {
|
|
10
|
+
return new et(t.__headerState, t.__colSpan, t.__width, t.__key);
|
|
11
|
+
}
|
|
12
|
+
afterCloneFrom(t) {
|
|
13
|
+
super.afterCloneFrom(t), this.__rowSpan = t.__rowSpan, this.__backgroundColor = t.__backgroundColor;
|
|
14
|
+
}
|
|
15
|
+
static importDOM() {
|
|
16
|
+
return { td: (t) => ({ conversion: jt, priority: 0 }), th: (t) => ({ conversion: jt, priority: 0 }) };
|
|
17
|
+
}
|
|
18
|
+
static importJSON(t) {
|
|
19
|
+
return ht().updateFromJSON(t);
|
|
20
|
+
}
|
|
21
|
+
updateFromJSON(t) {
|
|
22
|
+
return super.updateFromJSON(t).setHeaderStyles(t.headerState).setColSpan(t.colSpan || 1).setRowSpan(t.rowSpan || 1).setWidth(t.width || void 0).setBackgroundColor(t.backgroundColor || null);
|
|
23
|
+
}
|
|
24
|
+
constructor(t = J.NO_STATUS, e = 1, o, l) {
|
|
25
|
+
super(l), this.__colSpan = e, this.__rowSpan = 1, this.__headerState = t, this.__width = o, this.__backgroundColor = null;
|
|
26
|
+
}
|
|
27
|
+
createDOM(t) {
|
|
28
|
+
const e = document.createElement(this.getTag());
|
|
29
|
+
return this.__width && (e.style.width = `${this.__width}px`), this.__colSpan > 1 && (e.colSpan = this.__colSpan), this.__rowSpan > 1 && (e.rowSpan = this.__rowSpan), this.__backgroundColor !== null && (e.style.backgroundColor = this.__backgroundColor), Q(e, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), e;
|
|
30
|
+
}
|
|
31
|
+
exportDOM(t) {
|
|
32
|
+
const e = super.exportDOM(t);
|
|
33
|
+
if (St(e.element)) {
|
|
34
|
+
const o = e.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 e;
|
|
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(t) {
|
|
46
|
+
const e = this.getWritable();
|
|
47
|
+
return e.__colSpan = t, e;
|
|
48
|
+
}
|
|
49
|
+
getRowSpan() {
|
|
50
|
+
return this.getLatest().__rowSpan;
|
|
51
|
+
}
|
|
52
|
+
setRowSpan(t) {
|
|
53
|
+
const e = this.getWritable();
|
|
54
|
+
return e.__rowSpan = t, e;
|
|
55
|
+
}
|
|
56
|
+
getTag() {
|
|
57
|
+
return this.hasHeader() ? "th" : "td";
|
|
58
|
+
}
|
|
59
|
+
setHeaderStyles(t, e = J.BOTH) {
|
|
60
|
+
const o = this.getWritable();
|
|
61
|
+
return o.__headerState = t & e | o.__headerState & ~e, o;
|
|
62
|
+
}
|
|
63
|
+
getHeaderStyles() {
|
|
64
|
+
return this.getLatest().__headerState;
|
|
65
|
+
}
|
|
66
|
+
setWidth(t) {
|
|
67
|
+
const e = this.getWritable();
|
|
68
|
+
return e.__width = t, e;
|
|
69
|
+
}
|
|
70
|
+
getWidth() {
|
|
71
|
+
return this.getLatest().__width;
|
|
72
|
+
}
|
|
73
|
+
getBackgroundColor() {
|
|
74
|
+
return this.getLatest().__backgroundColor;
|
|
75
|
+
}
|
|
76
|
+
setBackgroundColor(t) {
|
|
77
|
+
const e = this.getWritable();
|
|
78
|
+
return e.__backgroundColor = t, e;
|
|
79
|
+
}
|
|
80
|
+
toggleHeaderStyle(t) {
|
|
81
|
+
const e = this.getWritable();
|
|
82
|
+
return (e.__headerState & t) === t ? e.__headerState -= t : e.__headerState += t, e;
|
|
83
|
+
}
|
|
84
|
+
hasHeaderState(t) {
|
|
85
|
+
return (this.getHeaderStyles() & t) === t;
|
|
86
|
+
}
|
|
87
|
+
hasHeader() {
|
|
88
|
+
return this.getLatest().__headerState !== J.NO_STATUS;
|
|
89
|
+
}
|
|
90
|
+
updateDOM(t) {
|
|
91
|
+
return t.__headerState !== this.__headerState || t.__width !== this.__width || t.__colSpan !== this.__colSpan || t.__rowSpan !== this.__rowSpan || t.__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 jt(n) {
|
|
107
|
+
const t = n, e = n.nodeName.toLowerCase();
|
|
108
|
+
let o;
|
|
109
|
+
Lt.test(t.style.width) && (o = parseFloat(t.style.width));
|
|
110
|
+
const l = ht(e === "th" ? J.ROW : J.NO_STATUS, t.colSpan, o);
|
|
111
|
+
l.__rowSpan = t.rowSpan;
|
|
112
|
+
const i = t.style.backgroundColor;
|
|
113
|
+
i !== "" && (l.__backgroundColor = i);
|
|
114
|
+
const r = t.style, c = (r && r.textDecoration || "").split(" "), h = r.fontWeight === "700" || r.fontWeight === "bold", g = 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 f = V();
|
|
118
|
+
return ye(u) && u.getTextContent() === `
|
|
119
|
+
` ? null : (ut(u) && (h && u.toggleFormat("bold"), g && u.toggleFormat("strikethrough"), s && u.toggleFormat("italic"), a && u.toggleFormat("underline")), f.append(u), f);
|
|
120
|
+
}
|
|
121
|
+
return u;
|
|
122
|
+
}, node: l };
|
|
123
|
+
}
|
|
124
|
+
function ht(n = J.NO_STATUS, t = 1, e) {
|
|
125
|
+
return Pt(new et(n, t, e));
|
|
126
|
+
}
|
|
127
|
+
function S(n) {
|
|
128
|
+
return n instanceof et;
|
|
129
|
+
}
|
|
130
|
+
const Ge = ve();
|
|
131
|
+
function Ze(n) {
|
|
132
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
133
|
+
}
|
|
134
|
+
var b = Ze(function(n) {
|
|
135
|
+
const t = new URLSearchParams();
|
|
136
|
+
t.append("code", n);
|
|
137
|
+
for (let e = 1; e < arguments.length; e++) t.append("v", arguments[e]);
|
|
138
|
+
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
139
|
+
});
|
|
140
|
+
class dt extends At {
|
|
141
|
+
static getType() {
|
|
142
|
+
return "tablerow";
|
|
143
|
+
}
|
|
144
|
+
static clone(t) {
|
|
145
|
+
return new dt(t.__height, t.__key);
|
|
146
|
+
}
|
|
147
|
+
static importDOM() {
|
|
148
|
+
return { tr: (t) => ({ conversion: tn, priority: 0 }) };
|
|
149
|
+
}
|
|
150
|
+
static importJSON(t) {
|
|
151
|
+
return Ht().updateFromJSON(t);
|
|
152
|
+
}
|
|
153
|
+
updateFromJSON(t) {
|
|
154
|
+
return super.updateFromJSON(t).setHeight(t.height);
|
|
155
|
+
}
|
|
156
|
+
constructor(t, e) {
|
|
157
|
+
super(e), this.__height = t;
|
|
158
|
+
}
|
|
159
|
+
exportJSON() {
|
|
160
|
+
const t = this.getHeight();
|
|
161
|
+
return { ...super.exportJSON(), ...t === void 0 ? void 0 : { height: t } };
|
|
162
|
+
}
|
|
163
|
+
createDOM(t) {
|
|
164
|
+
const e = document.createElement("tr");
|
|
165
|
+
return this.__height && (e.style.height = `${this.__height}px`), Q(e, t.theme.tableRow), e;
|
|
166
|
+
}
|
|
167
|
+
extractWithChild(t, e, o) {
|
|
168
|
+
return o === "html";
|
|
169
|
+
}
|
|
170
|
+
isShadowRoot() {
|
|
171
|
+
return !0;
|
|
172
|
+
}
|
|
173
|
+
setHeight(t) {
|
|
174
|
+
const e = this.getWritable();
|
|
175
|
+
return e.__height = t, e;
|
|
176
|
+
}
|
|
177
|
+
getHeight() {
|
|
178
|
+
return this.getLatest().__height;
|
|
179
|
+
}
|
|
180
|
+
updateDOM(t) {
|
|
181
|
+
return t.__height !== this.__height;
|
|
182
|
+
}
|
|
183
|
+
canBeEmpty() {
|
|
184
|
+
return !1;
|
|
185
|
+
}
|
|
186
|
+
canIndent() {
|
|
187
|
+
return !1;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function tn(n) {
|
|
191
|
+
const t = n;
|
|
192
|
+
let e;
|
|
193
|
+
return Lt.test(t.style.height) && (e = parseFloat(t.style.height)), { after: (o) => re(o, S), node: Ht(e) };
|
|
194
|
+
}
|
|
195
|
+
function Ht(n) {
|
|
196
|
+
return Pt(new dt(n));
|
|
197
|
+
}
|
|
198
|
+
function M(n) {
|
|
199
|
+
return n instanceof dt;
|
|
200
|
+
}
|
|
201
|
+
const Bt = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, en = Bt && "documentMode" in document ? document.documentMode : null, nn = Bt && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
202
|
+
function on(n, t, e = !0) {
|
|
203
|
+
const o = Jt();
|
|
204
|
+
for (let l = 0; l < n; l++) {
|
|
205
|
+
const i = Ht();
|
|
206
|
+
for (let r = 0; r < t; r++) {
|
|
207
|
+
let c = J.NO_STATUS;
|
|
208
|
+
typeof e == "object" ? (l === 0 && e.rows && (c |= J.ROW), r === 0 && e.columns && (c |= J.COLUMN)) : e && (l === 0 && (c |= J.ROW), r === 0 && (c |= J.COLUMN));
|
|
209
|
+
const h = ht(c), g = V();
|
|
210
|
+
g.append($t()), h.append(g), i.append(h);
|
|
211
|
+
}
|
|
212
|
+
o.append(i);
|
|
213
|
+
}
|
|
214
|
+
return o;
|
|
215
|
+
}
|
|
216
|
+
function Nn(n) {
|
|
217
|
+
const t = y(n, (e) => S(e));
|
|
218
|
+
return S(t) ? t : null;
|
|
219
|
+
}
|
|
220
|
+
function ce(n) {
|
|
221
|
+
const t = y(n, (e) => M(e));
|
|
222
|
+
if (M(t)) return t;
|
|
223
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
224
|
+
}
|
|
225
|
+
function rn(n) {
|
|
226
|
+
const t = y(n, (e) => R(e));
|
|
227
|
+
if (R(t)) return t;
|
|
228
|
+
throw new Error("Expected table cell to be inside of table.");
|
|
229
|
+
}
|
|
230
|
+
function xn(n) {
|
|
231
|
+
const t = ce(n);
|
|
232
|
+
return rn(t).getChildren().findIndex((e) => e.is(t));
|
|
233
|
+
}
|
|
234
|
+
function vn(n) {
|
|
235
|
+
return ce(n).getChildren().findIndex((t) => t.is(n));
|
|
236
|
+
}
|
|
237
|
+
Bt && "InputEvent" in window && !en && new window.InputEvent("input");
|
|
238
|
+
function Tn(n, t) {
|
|
239
|
+
const e = n.getChildren();
|
|
240
|
+
for (let o = 0; o < e.length; o++) {
|
|
241
|
+
const l = e[o];
|
|
242
|
+
if (M(l)) {
|
|
243
|
+
const i = l.getChildren();
|
|
244
|
+
if (t >= i.length || t < 0) throw new Error("Table column target index out of range");
|
|
245
|
+
i[t].remove();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return n;
|
|
249
|
+
}
|
|
250
|
+
function U(n, t, e) {
|
|
251
|
+
const [o, l, i] = Dt(n, t, e);
|
|
252
|
+
return l === null && b(207), i === null && b(208), [o, l, i];
|
|
253
|
+
}
|
|
254
|
+
function Dt(n, t, e) {
|
|
255
|
+
const o = [];
|
|
256
|
+
let l = null, i = null;
|
|
257
|
+
function r(h) {
|
|
258
|
+
let g = o[h];
|
|
259
|
+
return g === void 0 && (o[h] = g = []), g;
|
|
260
|
+
}
|
|
261
|
+
const c = n.getChildren();
|
|
262
|
+
for (let h = 0; h < c.length; h++) {
|
|
263
|
+
const g = c[h];
|
|
264
|
+
M(g) || b(209);
|
|
265
|
+
for (let s = g.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: f, __colSpan: p } = s;
|
|
270
|
+
for (let m = 0; m < f && !(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
|
+
t !== null && l === null && t.is(s) && (l = d), e !== null && i === null && e.is(s) && (i = d);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return [o, l, i];
|
|
278
|
+
}
|
|
279
|
+
function lt(n) {
|
|
280
|
+
let t;
|
|
281
|
+
if (n instanceof et) t = n;
|
|
282
|
+
else if ("__type" in n) {
|
|
283
|
+
const l = y(n, S);
|
|
284
|
+
S(l) || b(148), t = l;
|
|
285
|
+
} else {
|
|
286
|
+
const l = y(n.getNode(), S);
|
|
287
|
+
S(l) || b(148), t = l;
|
|
288
|
+
}
|
|
289
|
+
const e = t.getParent();
|
|
290
|
+
M(e) || b(149);
|
|
291
|
+
const o = e.getParent();
|
|
292
|
+
return R(o) || b(210), [t, e, o];
|
|
293
|
+
}
|
|
294
|
+
function kt(n, t, e) {
|
|
295
|
+
let o = Math.min(t.startColumn, e.startColumn), l = Math.min(t.startRow, e.startRow), i = Math.max(t.startColumn + t.cell.__colSpan - 1, e.startColumn + e.cell.__colSpan - 1), r = Math.max(t.startRow + t.cell.__rowSpan - 1, e.startRow + e.cell.__rowSpan - 1), c = o, h = l, g = o, s = l;
|
|
296
|
+
function a(u) {
|
|
297
|
+
const { cell: d, startColumn: f, startRow: p } = u;
|
|
298
|
+
o = Math.min(o, f), l = Math.min(l, p), i = Math.max(i, f + d.__colSpan - 1), r = Math.max(r, p + d.__rowSpan - 1);
|
|
299
|
+
}
|
|
300
|
+
for (; o < c || l < h || i > g || r > s; ) {
|
|
301
|
+
if (o < c) {
|
|
302
|
+
const u = s - h, d = c - 1;
|
|
303
|
+
for (let f = 0; f <= u; f++) a(n[h + f][d]);
|
|
304
|
+
c = d;
|
|
305
|
+
}
|
|
306
|
+
if (l < h) {
|
|
307
|
+
const u = g - c, d = h - 1;
|
|
308
|
+
for (let f = 0; f <= u; f++) a(n[d][c + f]);
|
|
309
|
+
h = d;
|
|
310
|
+
}
|
|
311
|
+
if (i > g) {
|
|
312
|
+
const u = s - h, d = g + 1;
|
|
313
|
+
for (let f = 0; f <= u; f++) a(n[h + f][d]);
|
|
314
|
+
g = d;
|
|
315
|
+
}
|
|
316
|
+
if (r > s) {
|
|
317
|
+
const u = g - c, d = s + 1;
|
|
318
|
+
for (let f = 0; f <= u; f++) a(n[d][c + f]);
|
|
319
|
+
s = d;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return { maxColumn: i, maxRow: r, minColumn: o, minRow: l };
|
|
323
|
+
}
|
|
324
|
+
function Ut(n) {
|
|
325
|
+
const [t, , e] = lt(n), o = e.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 g = 0;
|
|
330
|
+
for (let s = 0; s < h.length; s++) {
|
|
331
|
+
for (; r[c][g]; ) g++;
|
|
332
|
+
const a = h[s], u = a.__rowSpan || 1, d = a.__colSpan || 1;
|
|
333
|
+
for (let f = 0; f < u; f++) for (let p = 0; p < d; p++) r[c + f][g + p] = a;
|
|
334
|
+
if (t === a) return { colSpan: d, columnIndex: g, rowIndex: c, rowSpan: u };
|
|
335
|
+
g += d;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
function Vt(n) {
|
|
341
|
+
const [[t, e, o, l], [i, r, c, h]] = ["anchor", "focus"].map((g) => {
|
|
342
|
+
const s = n[g].getNode(), a = y(s, S);
|
|
343
|
+
S(a) || b(238, g, s.getKey(), s.getType());
|
|
344
|
+
const u = a.getParent();
|
|
345
|
+
M(u) || b(239, g);
|
|
346
|
+
const d = u.getParent();
|
|
347
|
+
return R(d) || b(240, g), [s, a, u, d];
|
|
348
|
+
});
|
|
349
|
+
return l.is(h) || b(241), { anchorCell: e, anchorNode: t, anchorRow: o, anchorTable: l, focusCell: r, focusNode: i, focusRow: c, focusTable: h };
|
|
350
|
+
}
|
|
351
|
+
class Nt {
|
|
352
|
+
constructor(t, e, o) {
|
|
353
|
+
this.anchor = e, this.focus = o, e._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = t;
|
|
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(t) {
|
|
368
|
+
this._cachedNodes = t;
|
|
369
|
+
}
|
|
370
|
+
is(t) {
|
|
371
|
+
return k(t) && this.tableKey === t.tableKey && this.anchor.is(t.anchor) && this.focus.is(t.focus);
|
|
372
|
+
}
|
|
373
|
+
set(t, e, o) {
|
|
374
|
+
this.dirty = this.dirty || t !== this.tableKey || e !== this.anchor.key || o !== this.focus.key, this.tableKey = t, this.anchor.key = e, this.focus.key = o, this._cachedNodes = null;
|
|
375
|
+
}
|
|
376
|
+
clone() {
|
|
377
|
+
return new Nt(this.tableKey, _t(this.anchor.key, this.anchor.offset, this.anchor.type), _t(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(t) {
|
|
386
|
+
}
|
|
387
|
+
insertText() {
|
|
388
|
+
}
|
|
389
|
+
hasFormat(t) {
|
|
390
|
+
let e = 0;
|
|
391
|
+
this.getNodes().filter(S).forEach((l) => {
|
|
392
|
+
const i = l.getFirstChild();
|
|
393
|
+
ie(i) && (e |= i.getTextFormat());
|
|
394
|
+
});
|
|
395
|
+
const o = Ue[t];
|
|
396
|
+
return !!(e & o);
|
|
397
|
+
}
|
|
398
|
+
insertNodes(t) {
|
|
399
|
+
const e = this.focus.getNode();
|
|
400
|
+
P(e) || b(151), Ye(e.select(0, e.getChildrenSize())).insertNodes(t);
|
|
401
|
+
}
|
|
402
|
+
getShape() {
|
|
403
|
+
const { anchorCell: t, focusCell: e } = Vt(this), o = Ut(t);
|
|
404
|
+
o === null && b(153);
|
|
405
|
+
const l = Ut(e);
|
|
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 t = this._cachedNodes;
|
|
413
|
+
if (t !== null) return t;
|
|
414
|
+
const { anchorTable: e, anchorCell: o, focusCell: l } = Vt(this), i = l.getParents()[1];
|
|
415
|
+
if (i !== e) {
|
|
416
|
+
if (e.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 = e.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(e, o, l), { minColumn: g, maxColumn: s, minRow: a, maxRow: u } = kt(r, c, h), d = /* @__PURE__ */ new Map([[e.getKey(), e]]);
|
|
426
|
+
let f = null;
|
|
427
|
+
for (let m = a; m <= u; m++) for (let C = g; C <= s; C++) {
|
|
428
|
+
const { cell: w } = r[m][C], K = w.getParent();
|
|
429
|
+
M(K) || b(160), K !== f && (d.set(K.getKey(), K), f = 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 je() || (this._cachedNodes = p), p;
|
|
435
|
+
}
|
|
436
|
+
getTextContent() {
|
|
437
|
+
const t = this.getNodes().filter((o) => S(o));
|
|
438
|
+
let e = "";
|
|
439
|
+
for (let o = 0; o < t.length; o++) {
|
|
440
|
+
const l = t[o], i = l.__parent, r = (t[o + 1] || {}).__parent;
|
|
441
|
+
e += l.getTextContent() + (r !== i ? `
|
|
442
|
+
` : " ");
|
|
443
|
+
}
|
|
444
|
+
return e;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function k(n) {
|
|
448
|
+
return n instanceof Nt;
|
|
449
|
+
}
|
|
450
|
+
function Qt() {
|
|
451
|
+
const n = _t("root", 0, "element"), t = _t("root", 0, "element");
|
|
452
|
+
return new Nt("root", n, t);
|
|
453
|
+
}
|
|
454
|
+
function ln(n, t) {
|
|
455
|
+
const e = [[n]];
|
|
456
|
+
for (let o = e.at(-1); o !== void 0 && e.length > 0; o = e.at(-1)) {
|
|
457
|
+
const l = o.pop();
|
|
458
|
+
l === void 0 ? e.pop() : t(l) !== !1 && P(l) && e.push(l.getChildren());
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function ue(n, t = se()) {
|
|
462
|
+
const e = bt(n);
|
|
463
|
+
R(e) || b(231, n);
|
|
464
|
+
const o = Z(e, t.getElementByKey(n));
|
|
465
|
+
return o === null && b(232, n), { tableElement: o, tableNode: e };
|
|
466
|
+
}
|
|
467
|
+
class sn {
|
|
468
|
+
constructor(t, e) {
|
|
469
|
+
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = e, this.editor = t, 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((t) => t()), this.listenersToRemove.clear();
|
|
476
|
+
}
|
|
477
|
+
$lookup() {
|
|
478
|
+
return ue(this.tableNodeKey, this.editor);
|
|
479
|
+
}
|
|
480
|
+
trackTable() {
|
|
481
|
+
const t = new MutationObserver((e) => {
|
|
482
|
+
this.editor.getEditorState().read(() => {
|
|
483
|
+
let o = !1;
|
|
484
|
+
for (let r = 0; r < e.length; r++) {
|
|
485
|
+
const c = e[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 = at(l, i);
|
|
494
|
+
}, { editor: this.editor });
|
|
495
|
+
});
|
|
496
|
+
this.editor.getEditorState().read(() => {
|
|
497
|
+
const { tableNode: e, tableElement: o } = this.$lookup();
|
|
498
|
+
this.table = at(e, o), t.observe(o, { attributes: !0, childList: !0, subtree: !0 });
|
|
499
|
+
}, { editor: this.editor });
|
|
500
|
+
}
|
|
501
|
+
$clearHighlight() {
|
|
502
|
+
const t = 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: e, tableElement: o } = this.$lookup();
|
|
505
|
+
ft(t, at(e, o), null), B() !== null && (j(null), t.dispatchCommand(rt, void 0));
|
|
506
|
+
}
|
|
507
|
+
$enableHighlightStyle() {
|
|
508
|
+
const t = this.editor, { tableElement: e } = this.$lookup();
|
|
509
|
+
Mt(e, t._config.theme.tableSelection), e.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
|
|
510
|
+
}
|
|
511
|
+
$disableHighlightStyle() {
|
|
512
|
+
const { tableElement: t } = this.$lookup();
|
|
513
|
+
Q(t, this.editor._config.theme.tableSelection), this.hasHijackedSelectionStyles = !0;
|
|
514
|
+
}
|
|
515
|
+
$updateTableTableSelection(t) {
|
|
516
|
+
if (t !== null) {
|
|
517
|
+
t.tableKey !== this.tableNodeKey && b(233, t.tableKey, this.tableNodeKey);
|
|
518
|
+
const e = this.editor;
|
|
519
|
+
this.tableSelection = t, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), ft(e, 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(t) {
|
|
529
|
+
this.nextFocus = t;
|
|
530
|
+
}
|
|
531
|
+
getAndClearNextFocus() {
|
|
532
|
+
const { nextFocus: t } = this;
|
|
533
|
+
return t !== null && (this.nextFocus = null), t;
|
|
534
|
+
}
|
|
535
|
+
updateDOMSelection() {
|
|
536
|
+
if (this.anchorCell !== null && this.focusCell !== null) {
|
|
537
|
+
const t = yt(this.editor._window);
|
|
538
|
+
t && t.rangeCount > 0 && t.removeAllRanges();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
$setFocusCellForSelection(t, e = !1) {
|
|
542
|
+
const o = this.editor, { tableNode: l } = this.$lookup(), i = t.x, r = t.y;
|
|
543
|
+
if (this.focusCell = t, this.isHighlightingCells || this.anchorX === i && this.anchorY === r && !e) {
|
|
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 = Kt(l, t.elem);
|
|
548
|
+
if (this.tableSelection != null && this.anchorCellNodeKey != null && c !== null) return this.focusCellNodeKey = c.getKey(), this.tableSelection = function(h, g, s) {
|
|
549
|
+
h.getKey(), g.getKey(), s.getKey();
|
|
550
|
+
const a = B(), u = k(a) ? a.clone() : Qt();
|
|
551
|
+
return u.set(h.getKey(), g.getKey(), s.getKey()), u;
|
|
552
|
+
}(l, this.$getAnchorTableCellOrThrow(), c), j(this.tableSelection), o.dispatchCommand(rt, void 0), ft(o, this.table, this.tableSelection), !0;
|
|
553
|
+
}
|
|
554
|
+
return !1;
|
|
555
|
+
}
|
|
556
|
+
$getAnchorTableCell() {
|
|
557
|
+
return this.anchorCellNodeKey ? bt(this.anchorCellNodeKey) : null;
|
|
558
|
+
}
|
|
559
|
+
$getAnchorTableCellOrThrow() {
|
|
560
|
+
const t = this.$getAnchorTableCell();
|
|
561
|
+
return t === null && b(234), t;
|
|
562
|
+
}
|
|
563
|
+
$getFocusTableCell() {
|
|
564
|
+
return this.focusCellNodeKey ? bt(this.focusCellNodeKey) : null;
|
|
565
|
+
}
|
|
566
|
+
$getFocusTableCellOrThrow() {
|
|
567
|
+
const t = this.$getFocusTableCell();
|
|
568
|
+
return t === null && b(235), t;
|
|
569
|
+
}
|
|
570
|
+
$setAnchorCellForSelection(t) {
|
|
571
|
+
this.isHighlightingCells = !1, this.anchorCell = t, this.anchorX = t.x, this.anchorY = t.y;
|
|
572
|
+
const { tableNode: e } = this.$lookup(), o = Kt(e, t.elem);
|
|
573
|
+
if (o !== null) {
|
|
574
|
+
const l = o.getKey();
|
|
575
|
+
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Qt(), this.anchorCellNodeKey = l;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
$formatCells(t) {
|
|
579
|
+
const e = B();
|
|
580
|
+
k(e) || b(236);
|
|
581
|
+
const o = He(), l = o.anchor, i = o.focus, r = e.getNodes().filter(S);
|
|
582
|
+
r.length > 0 || b(237);
|
|
583
|
+
const c = r[0].getFirstChild(), h = ie(c) ? c.getFormatFlags(t, null) : null;
|
|
584
|
+
r.forEach((g) => {
|
|
585
|
+
l.set(g.getKey(), 0, "element"), i.set(g.getKey(), g.getChildrenSize(), "element"), o.formatText(t, h);
|
|
586
|
+
}), j(e), this.editor.dispatchCommand(rt, void 0);
|
|
587
|
+
}
|
|
588
|
+
$clearText() {
|
|
589
|
+
const { editor: t } = this, e = bt(this.tableNodeKey);
|
|
590
|
+
if (!R(e)) 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 e.selectPrevious(), void e.remove();
|
|
595
|
+
l.forEach((i) => {
|
|
596
|
+
if (P(i)) {
|
|
597
|
+
const r = V(), c = $t();
|
|
598
|
+
r.append(c), i.append(r), i.getChildren().forEach((h) => {
|
|
599
|
+
h !== r && h.remove();
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}), ft(t, this.table, null), j(null), t.dispatchCommand(rt, void 0);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const Rt = "__lexicalTableSelection", an = (n) => !(1 & ~n.buttons);
|
|
606
|
+
function Z(n, t) {
|
|
607
|
+
if (!t) return t;
|
|
608
|
+
const e = t.nodeName === "TABLE" ? t : n.getDOMSlot(t).element;
|
|
609
|
+
return e.nodeName !== "TABLE" && b(245, t.nodeName), e;
|
|
610
|
+
}
|
|
611
|
+
function Wt(n) {
|
|
612
|
+
return n._window;
|
|
613
|
+
}
|
|
614
|
+
function it(n, t) {
|
|
615
|
+
for (let e = t, o = null; e !== null; e = e.getParent()) {
|
|
616
|
+
if (n.is(e)) return o;
|
|
617
|
+
S(e) && (o = e);
|
|
618
|
+
}
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
const cn = [[Be, "down"], [De, "up"], [We, "backward"], [Ie, "forward"]], un = [Je, ae, ze], hn = [Xe, qe];
|
|
622
|
+
function dn(n, t, e, o) {
|
|
623
|
+
const l = e.getRootElement(), i = Wt(e);
|
|
624
|
+
l !== null && i !== null || b(246);
|
|
625
|
+
const r = new sn(e, n.getKey()), c = Z(n, t);
|
|
626
|
+
(function(s, a) {
|
|
627
|
+
Gt(s) !== null && b(205), s[Rt] = a;
|
|
628
|
+
})(c, r), r.listenersToRemove.add(() => function(s, a) {
|
|
629
|
+
Gt(s) === a && delete s[Rt];
|
|
630
|
+
}(c, r)), c.addEventListener("mousedown", (s) => {
|
|
631
|
+
if (s.button !== 0 || !vt(s.target) || !i) return;
|
|
632
|
+
const a = Ft(s.target);
|
|
633
|
+
a !== null && e.update(() => {
|
|
634
|
+
const u = Yt();
|
|
635
|
+
if (nn && s.shiftKey && q(u, n) && (H(u) || k(u))) {
|
|
636
|
+
const d = u.anchor.getNode(), f = it(n, u.anchor.getNode());
|
|
637
|
+
f ? (r.$setAnchorCellForSelection(ct(r, f)), 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 = (f) => {
|
|
644
|
+
if (!vt(f.target)) return;
|
|
645
|
+
if (!an(f) && r.isSelecting) return r.isSelecting = !1, i.removeEventListener("mouseup", u), void i.removeEventListener("mousemove", d);
|
|
646
|
+
const p = !c.contains(f.target);
|
|
647
|
+
let m = null;
|
|
648
|
+
if (p) {
|
|
649
|
+
for (const C of document.elementsFromPoint(f.clientX, f.clientY)) if (m = c.contains(C) ? Ft(C) : null, m) break;
|
|
650
|
+
} else m = Ft(f.target);
|
|
651
|
+
!m || r.focusCell !== null && m.elem === r.focusCell.elem || (r.setNextFocus({ focusCell: m, override: p }), e.dispatchCommand(rt, 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 && vt(a) && e.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(e.registerCommand(s, (u) => ge(e, u, a, n, r), Tt));
|
|
663
|
+
r.listenersToRemove.add(e.registerCommand(Te, (s) => {
|
|
664
|
+
const a = B();
|
|
665
|
+
if (k(a)) {
|
|
666
|
+
const u = it(n, a.focus.getNode());
|
|
667
|
+
if (u !== null) return Y(s), u.selectEnd(), !0;
|
|
668
|
+
}
|
|
669
|
+
return !1;
|
|
670
|
+
}, Tt));
|
|
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(it(n, a.anchor.getNode()))) return !1;
|
|
677
|
+
const u = a.anchor.getNode(), d = a.focus.getNode(), f = n.isParentOf(u), p = n.isParentOf(d);
|
|
678
|
+
if (f && !p || p && !f) 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 === ae && C.getPreviousSibling() === null) return !0;
|
|
682
|
+
}
|
|
683
|
+
return !1;
|
|
684
|
+
};
|
|
685
|
+
for (const s of un) r.listenersToRemove.add(e.registerCommand(s, h(s), X));
|
|
686
|
+
const g = (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", f = u ? "focus" : "anchor", { key: p, offset: m, type: C } = a[f];
|
|
692
|
+
return n[a[d].isBefore(a[f]) ? "selectPrevious" : "selectNext"]()[f].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(e.registerCommand(s, g, X));
|
|
697
|
+
return r.listenersToRemove.add(e.registerCommand(Fe, (s) => {
|
|
698
|
+
const a = B();
|
|
699
|
+
if (a) {
|
|
700
|
+
if (!k(a) && !H(a)) return !1;
|
|
701
|
+
Ve(e, _e(s, ClipboardEvent) ? s : null, Qe(a));
|
|
702
|
+
const u = g(s);
|
|
703
|
+
return H(a) ? (a.removeText(), !0) : u;
|
|
704
|
+
}
|
|
705
|
+
return !1;
|
|
706
|
+
}, X)), r.listenersToRemove.add(e.registerCommand(Oe, (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(e.registerCommand(ke, (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 [f, 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 F = E; F <= w; F++) {
|
|
722
|
+
const v = f[N][F].cell;
|
|
723
|
+
if (A.has(v)) continue;
|
|
724
|
+
A.add(v), v.setFormat(s);
|
|
725
|
+
const _ = v.getChildren();
|
|
726
|
+
for (let T = 0; T < _.length; T++) {
|
|
727
|
+
const O = _[T];
|
|
728
|
+
P(O) && !O.isInline() && O.setFormat(s);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return !0;
|
|
732
|
+
}, X)), r.listenersToRemove.add(e.registerCommand(Re, (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 = ee(e, a, n);
|
|
741
|
+
if (d) return te(d, n, [$t(s)]), !0;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return !1;
|
|
745
|
+
}, X)), o && r.listenersToRemove.add(e.registerCommand(Ke, (s) => {
|
|
746
|
+
const a = B();
|
|
747
|
+
if (!H(a) || !a.isCollapsed() || !q(a, n)) return !1;
|
|
748
|
+
const u = Ct(a.anchor.getNode());
|
|
749
|
+
return !(u === null || !n.is(wt(u))) && (Y(s), function(d, f) {
|
|
750
|
+
const p = f === "next" ? "getNextSibling" : "getPreviousSibling", m = f === "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), f === "next" ? K.selectNext() : K.selectPrevious();
|
|
760
|
+
}(u, s.shiftKey ? "previous" : "next"), !0);
|
|
761
|
+
}, X)), r.listenersToRemove.add(e.registerCommand(Ee, (s) => n.isSelected(), Tt)), r.listenersToRemove.add(e.registerCommand(Me, (s) => {
|
|
762
|
+
const { nodes: a, selection: u } = s, d = u.getStartEndPoints(), f = k(u), p = H(u) && y(u.anchor.getNode(), (x) => S(x)) !== null && y(u.focus.getNode(), (x) => S(x)) !== null || f;
|
|
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)), F = N && y(N, (x) => R(x));
|
|
765
|
+
if (!S(A) || !M(N) || !R(F)) return !1;
|
|
766
|
+
const v = N.getIndexWithinParent(), _ = Math.min(F.getChildrenSize() - 1, v + E - 1), T = A.getIndexWithinParent(), O = Math.min(N.getChildrenSize() - 1, T + K - 1), $ = Math.min(T, O), L = Math.min(v, _), W = Math.max(T, O), D = Math.max(v, _), z = F.getChildren();
|
|
767
|
+
let I = 0;
|
|
768
|
+
for (let x = L; x <= D; x++) {
|
|
769
|
+
const st = z[x];
|
|
770
|
+
if (!M(st)) return !1;
|
|
771
|
+
const zt = w[I];
|
|
772
|
+
if (!M(zt)) return !1;
|
|
773
|
+
const me = st.getChildren(), pe = zt.getChildren();
|
|
774
|
+
let Xt = 0;
|
|
775
|
+
for (let xt = $; xt <= W; xt++) {
|
|
776
|
+
const gt = me[xt];
|
|
777
|
+
if (!S(gt)) return !1;
|
|
778
|
+
const qt = pe[Xt];
|
|
779
|
+
if (!S(qt)) return !1;
|
|
780
|
+
const Ce = gt.getChildren();
|
|
781
|
+
qt.getChildren().forEach((nt) => {
|
|
782
|
+
ut(nt) && V().append(nt), gt.append(nt);
|
|
783
|
+
}), Ce.forEach((nt) => nt.remove()), Xt++;
|
|
784
|
+
}
|
|
785
|
+
I++;
|
|
786
|
+
}
|
|
787
|
+
return !0;
|
|
788
|
+
}, X)), r.listenersToRemove.add(e.registerCommand(rt, () => {
|
|
789
|
+
const s = B(), a = Yt(), 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(), f = n.getFirstChild(), p = Ct(d);
|
|
797
|
+
if (p !== null && M(f)) {
|
|
798
|
+
const m = f.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: f } = s, p = d.getNode(), m = f.getNode(), C = Ct(p), w = Ct(m), K = !(!C || !n.is(wt(C))), E = !(!w || !n.is(wt(w))), A = K !== E, N = K && E, F = s.isBackward();
|
|
804
|
+
if (A) {
|
|
805
|
+
const v = s.clone();
|
|
806
|
+
if (E) {
|
|
807
|
+
const [_] = U(n, w, w), T = _[0][0].cell, O = _[_.length - 1].at(-1).cell;
|
|
808
|
+
v.focus.set(F ? T.getKey() : O.getKey(), F ? T.getChildrenSize() : O.getChildrenSize(), "element");
|
|
809
|
+
} else if (K) {
|
|
810
|
+
const [_] = U(n, C, C), T = _[0][0].cell, O = _[_.length - 1].at(-1).cell;
|
|
811
|
+
v.anchor.set(F ? O.getKey() : T.getKey(), F ? O.getChildrenSize() : 0, "element");
|
|
812
|
+
}
|
|
813
|
+
j(v), Zt(e, r);
|
|
814
|
+
} else N && (C.is(w) || (r.$setAnchorCellForSelection(ct(r, C)), r.$setFocusCellForSelection(ct(r, w), !0)));
|
|
815
|
+
} else if (s && k(s) && s.is(a) && s.tableKey === n.getKey()) {
|
|
816
|
+
const d = yt(i);
|
|
817
|
+
if (d && d.anchorNode && d.focusNode) {
|
|
818
|
+
const f = G(d.focusNode), p = f && !n.isParentOf(f), m = G(d.anchorNode), C = m && n.isParentOf(m);
|
|
819
|
+
if (p && C && d.rangeCount > 0) {
|
|
820
|
+
const w = Ae(d, e);
|
|
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, f) {
|
|
826
|
+
f.$enableHighlightStyle(), It(f.table, (p) => {
|
|
827
|
+
const m = p.elem;
|
|
828
|
+
p.highlighted = !1, de(d, p), m.getAttribute("style") || m.removeAttribute("style");
|
|
829
|
+
});
|
|
830
|
+
}(e, r) : !r.hasHijackedSelectionStyles && n.isSelected() && Zt(e, r), !1);
|
|
831
|
+
}, X)), r.listenersToRemove.add(e.registerCommand(Pe, () => {
|
|
832
|
+
const s = B();
|
|
833
|
+
if (!H(s) || !s.isCollapsed() || !q(s, n)) return !1;
|
|
834
|
+
const a = ee(e, s, n);
|
|
835
|
+
return !!a && (te(a, n), !0);
|
|
836
|
+
}, X)), r;
|
|
837
|
+
}
|
|
838
|
+
function Gt(n) {
|
|
839
|
+
return n[Rt] || null;
|
|
840
|
+
}
|
|
841
|
+
function Ft(n) {
|
|
842
|
+
let t = n;
|
|
843
|
+
for (; t != null; ) {
|
|
844
|
+
const e = t.nodeName;
|
|
845
|
+
if (e === "TD" || e === "TH") {
|
|
846
|
+
const o = t._cell;
|
|
847
|
+
return o === void 0 ? null : o;
|
|
848
|
+
}
|
|
849
|
+
t = t.parentNode;
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
function at(n, t) {
|
|
854
|
+
const e = [], o = { columns: 0, domRows: e, rows: 0 };
|
|
855
|
+
let l = Z(n, t).querySelector("tr"), i = 0, r = 0;
|
|
856
|
+
for (e.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 = e[r];
|
|
862
|
+
a === void 0 && (a = e[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 g = l.parentNode;
|
|
876
|
+
if (g != null) {
|
|
877
|
+
const s = g.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 ft(n, t, e) {
|
|
885
|
+
const o = new Set(e ? e.getNodes() : []);
|
|
886
|
+
It(t, (l, i) => {
|
|
887
|
+
const r = l.elem;
|
|
888
|
+
o.has(i) ? (l.highlighted = !0, he(n, l)) : (l.highlighted = !1, de(n, l), r.getAttribute("style") || r.removeAttribute("style"));
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
function It(n, t) {
|
|
892
|
+
const { domRows: e } = n;
|
|
893
|
+
for (let o = 0; o < e.length; o++) {
|
|
894
|
+
const l = e[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 && t(r, c, { x: i, y: o });
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function Zt(n, t) {
|
|
904
|
+
t.$disableHighlightStyle(), It(t.table, (e) => {
|
|
905
|
+
e.highlighted = !0, he(n, e);
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
const gn = (n, t, e, o, l) => {
|
|
909
|
+
const i = l === "forward";
|
|
910
|
+
switch (l) {
|
|
911
|
+
case "backward":
|
|
912
|
+
case "forward":
|
|
913
|
+
return e !== (i ? n.table.columns - 1 : 0) ? pt(t.getCellNodeFromCordsOrThrow(e + (i ? 1 : -1), o, n.table), i) : o !== (i ? n.table.rows - 1 : 0) ? pt(t.getCellNodeFromCordsOrThrow(i ? 0 : n.table.columns - 1, o + (i ? 1 : -1), n.table), i) : i ? t.selectNext() : t.selectPrevious(), !0;
|
|
914
|
+
case "up":
|
|
915
|
+
return o !== 0 ? pt(t.getCellNodeFromCordsOrThrow(e, o - 1, n.table), !1) : t.selectPrevious(), !0;
|
|
916
|
+
case "down":
|
|
917
|
+
return o !== n.table.rows - 1 ? pt(t.getCellNodeFromCordsOrThrow(e, o + 1, n.table), !0) : t.selectNext(), !0;
|
|
918
|
+
default:
|
|
919
|
+
return !1;
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
function Ot(n, t) {
|
|
923
|
+
let e, o;
|
|
924
|
+
if (t.startColumn === n.minColumn) e = "minColumn";
|
|
925
|
+
else {
|
|
926
|
+
if (t.startColumn + t.cell.__colSpan - 1 !== n.maxColumn) return null;
|
|
927
|
+
e = "maxColumn";
|
|
928
|
+
}
|
|
929
|
+
if (t.startRow === n.minRow) o = "minRow";
|
|
930
|
+
else {
|
|
931
|
+
if (t.startRow + t.cell.__rowSpan - 1 !== n.maxRow) return null;
|
|
932
|
+
o = "maxRow";
|
|
933
|
+
}
|
|
934
|
+
return [e, o];
|
|
935
|
+
}
|
|
936
|
+
function mt([n, t]) {
|
|
937
|
+
return [n === "minColumn" ? "maxColumn" : "minColumn", t === "minRow" ? "maxRow" : "minRow"];
|
|
938
|
+
}
|
|
939
|
+
function ot(n, t, [e, o]) {
|
|
940
|
+
const l = t[o], i = n[l];
|
|
941
|
+
i === void 0 && b(250, o, String(l));
|
|
942
|
+
const r = t[e], c = i[r];
|
|
943
|
+
return c === void 0 && b(250, e, String(r)), c;
|
|
944
|
+
}
|
|
945
|
+
function fn(n, t, e, o, l) {
|
|
946
|
+
const i = kt(t, e, o), r = function(N, F) {
|
|
947
|
+
const { minColumn: v, maxColumn: _, minRow: T, maxRow: O } = F;
|
|
948
|
+
let $ = 1, L = 1, W = 1, D = 1;
|
|
949
|
+
const z = N[T], I = N[O];
|
|
950
|
+
for (let x = v; x <= _; x++) $ = Math.max($, z[x].cell.__rowSpan), D = Math.max(D, I[x].cell.__rowSpan);
|
|
951
|
+
for (let x = T; x <= O; x++) L = Math.max(L, N[x][v].cell.__colSpan), W = Math.max(W, N[x][_].cell.__colSpan);
|
|
952
|
+
return { bottomSpan: D, leftSpan: L, rightSpan: W, topSpan: $ };
|
|
953
|
+
}(t, i), { topSpan: c, leftSpan: h, bottomSpan: g, rightSpan: s } = r, a = function(N, F) {
|
|
954
|
+
const v = Ot(N, F);
|
|
955
|
+
return v === null && b(249, F.cell.getKey()), v;
|
|
956
|
+
}(i, e), [u, d] = mt(a);
|
|
957
|
+
let f = i[u], p = i[d];
|
|
958
|
+
l === "forward" ? f += u === "maxColumn" ? 1 : h : l === "backward" ? f -= u === "minColumn" ? 1 : s : l === "down" ? p += d === "maxRow" ? 1 : c : l === "up" && (p -= d === "minRow" ? 1 : g);
|
|
959
|
+
const m = t[p];
|
|
960
|
+
if (m === void 0) return !1;
|
|
961
|
+
const C = m[f];
|
|
962
|
+
if (C === void 0) return !1;
|
|
963
|
+
const [w, K] = function(N, F, v) {
|
|
964
|
+
const _ = kt(N, F, v), T = Ot(_, F);
|
|
965
|
+
if (T) return [ot(N, _, T), ot(N, _, mt(T))];
|
|
966
|
+
const O = Ot(_, v);
|
|
967
|
+
if (O) return [ot(N, _, mt(O)), ot(N, _, O)];
|
|
968
|
+
const $ = ["minColumn", "minRow"];
|
|
969
|
+
return [ot(N, _, $), ot(N, _, mt($))];
|
|
970
|
+
}(t, e, C), E = ct(n, w.cell), A = ct(n, K.cell);
|
|
971
|
+
return n.$setAnchorCellForSelection(E), n.$setFocusCellForSelection(A, !0), !0;
|
|
972
|
+
}
|
|
973
|
+
function q(n, t) {
|
|
974
|
+
if (H(n) || k(n)) {
|
|
975
|
+
const e = t.isParentOf(n.anchor.getNode()), o = t.isParentOf(n.focus.getNode());
|
|
976
|
+
return e && o;
|
|
977
|
+
}
|
|
978
|
+
return !1;
|
|
979
|
+
}
|
|
980
|
+
function pt(n, t) {
|
|
981
|
+
t ? n.selectStart() : n.selectEnd();
|
|
982
|
+
}
|
|
983
|
+
function he(n, t) {
|
|
984
|
+
const e = t.elem, o = n._config.theme;
|
|
985
|
+
S(G(e)) || b(131), Q(e, o.tableCellSelected);
|
|
986
|
+
}
|
|
987
|
+
function de(n, t) {
|
|
988
|
+
const e = t.elem;
|
|
989
|
+
S(G(e)) || b(131);
|
|
990
|
+
const o = n._config.theme;
|
|
991
|
+
Mt(e, o.tableCellSelected);
|
|
992
|
+
}
|
|
993
|
+
function Ct(n) {
|
|
994
|
+
const t = y(n, S);
|
|
995
|
+
return S(t) ? t : null;
|
|
996
|
+
}
|
|
997
|
+
function wt(n) {
|
|
998
|
+
const t = y(n, R);
|
|
999
|
+
return R(t) ? t : null;
|
|
1000
|
+
}
|
|
1001
|
+
function ge(n, t, e, o, l) {
|
|
1002
|
+
if ((e === "up" || e === "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 (e === "backward") {
|
|
1010
|
+
if (i.focus.offset > 0) return !1;
|
|
1011
|
+
const r = function(h) {
|
|
1012
|
+
for (let g = h, s = h; s !== null; g = s, s = s.getParent()) if (P(s)) {
|
|
1013
|
+
if (s !== g && s.getFirstChild() !== g) 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(t), t.shiftKey ? i.focus.set(c.getParentOrThrow().getKey(), c.getIndexWithinParent(), "element") : c.selectEnd(), !0);
|
|
1021
|
+
}
|
|
1022
|
+
if (t.shiftKey && (e === "up" || e === "down")) {
|
|
1023
|
+
const r = i.focus.getNode();
|
|
1024
|
+
if (!i.isCollapsed() && (e === "up" && !i.isBackward() || e === "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 = e === "down" ? c.getNextSibling() : c.getPreviousSibling();
|
|
1028
|
+
if (!h) return !1;
|
|
1029
|
+
let g = 0;
|
|
1030
|
+
e === "up" && P(h) && (g = h.getChildrenSize());
|
|
1031
|
+
let s = h;
|
|
1032
|
+
e === "up" && P(h) && (s = h.getLastChild() || h, g = ut(s) ? s.getTextContentSize() : 0);
|
|
1033
|
+
const a = i.clone();
|
|
1034
|
+
return a.focus.set(s.getKey(), g, ut(s) ? "text" : "element"), j(a), Y(t), !0;
|
|
1035
|
+
}
|
|
1036
|
+
if ($e(r)) {
|
|
1037
|
+
const c = e === "up" ? i.getNodes()[i.getNodes().length - 1] : i.getNodes()[0];
|
|
1038
|
+
if (c && it(o, c) !== null) {
|
|
1039
|
+
const h = o.getFirstDescendant(), g = o.getLastDescendant();
|
|
1040
|
+
if (!h || !g) return !1;
|
|
1041
|
+
const [s] = lt(h), [a] = lt(g), u = o.getCordsFromCellNode(s, l.table), d = o.getCordsFromCellNode(a, l.table), f = o.getDOMCellFromCordsOrThrow(u.x, u.y, l.table), p = o.getDOMCellFromCordsOrThrow(d.x, d.y, l.table);
|
|
1042
|
+
return l.$setAnchorCellForSelection(f), l.$setFocusCellForSelection(p, !0), !0;
|
|
1043
|
+
}
|
|
1044
|
+
return !1;
|
|
1045
|
+
}
|
|
1046
|
+
{
|
|
1047
|
+
let c = y(r, (g) => P(g) && !g.isInline());
|
|
1048
|
+
if (S(c) && (c = y(c, R)), !c) return !1;
|
|
1049
|
+
const h = e === "down" ? c.getNextSibling() : c.getPreviousSibling();
|
|
1050
|
+
if (R(h) && l.tableNodeKey === h.getKey()) {
|
|
1051
|
+
const g = h.getFirstDescendant(), s = h.getLastDescendant();
|
|
1052
|
+
if (!g || !s) return !1;
|
|
1053
|
+
const [a] = lt(g), [u] = lt(s), d = i.clone();
|
|
1054
|
+
return d.focus.set((e === "up" ? a : u).getKey(), e === "up" ? 0 : u.getChildrenSize(), "element"), Y(t), j(d), !0;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return e === "down" && fe(n) && l.setShouldCheckSelection(), !1;
|
|
1060
|
+
}
|
|
1061
|
+
if (H(i) && i.isCollapsed()) {
|
|
1062
|
+
const { anchor: r, focus: c } = i, h = y(r.getNode(), S), g = y(c.getNode(), S);
|
|
1063
|
+
if (!S(h) || !h.is(g)) return !1;
|
|
1064
|
+
const s = wt(h);
|
|
1065
|
+
if (s !== o && s != null) {
|
|
1066
|
+
const C = Z(s, n.getElementByKey(s.getKey()));
|
|
1067
|
+
if (C != null) return l.table = at(s, C), ge(n, t, e, s, l);
|
|
1068
|
+
}
|
|
1069
|
+
if (e === "backward" || e === "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 || !Le(E[0])) && !!function(A, N, F, v) {
|
|
1074
|
+
return function(_, T, O) {
|
|
1075
|
+
return _ === "element" && (O === "backward" ? T.getPreviousSibling() === null : T.getNextSibling() === null);
|
|
1076
|
+
}(A, F, v) || function(_, T, O, $) {
|
|
1077
|
+
const L = y(O, (D) => P(D) && !D.isInline());
|
|
1078
|
+
if (!L) return !1;
|
|
1079
|
+
const W = $ === "backward" ? T === 0 : T === O.getTextContentSize();
|
|
1080
|
+
return _ === "text" && W && ($ === "backward" ? L.getPreviousSibling() === null : L.getNextSibling() === null);
|
|
1081
|
+
}(A, N, F, v);
|
|
1082
|
+
}(C, w, K, e) && function(A, N, F, v, _) {
|
|
1083
|
+
const [T, O] = U(v, F, F);
|
|
1084
|
+
if (!function(L, W, D) {
|
|
1085
|
+
const z = L[0][0], I = L[L.length - 1][L[0].length - 1], { startColumn: x, startRow: st } = W;
|
|
1086
|
+
return D === "backward" ? x === z.startColumn && st === z.startRow : x === I.startColumn && st === I.startRow;
|
|
1087
|
+
}(T, O, _)) 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, _, v);
|
|
1094
|
+
return !$ || R($) ? !1 : (Y(A), _ === "backward" ? $.selectEnd() : $.selectStart(), !0);
|
|
1095
|
+
}(t, K, h, o, e);
|
|
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 = yt(Wt(n));
|
|
1103
|
+
if (C === null || C.rangeCount === 0) return !1;
|
|
1104
|
+
d = C.getRangeAt(0).getBoundingClientRect();
|
|
1105
|
+
}
|
|
1106
|
+
const f = e === "up" ? h.getFirstChild() : h.getLastChild();
|
|
1107
|
+
if (f == null) return !1;
|
|
1108
|
+
const p = n.getElementByKey(f.__key);
|
|
1109
|
+
if (p == null) return !1;
|
|
1110
|
+
const m = p.getBoundingClientRect();
|
|
1111
|
+
if (e === "up" ? m.top > d.top - d.height : d.bottom + d.height > m.bottom) {
|
|
1112
|
+
Y(t);
|
|
1113
|
+
const C = o.getCordsFromCellNode(h, l.table);
|
|
1114
|
+
if (!t.shiftKey) return gn(l, o, C.x, C.y, e);
|
|
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), g = 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(g) || !R(s) || a == null) return !1;
|
|
1126
|
+
l.$updateTableTableSelection(i);
|
|
1127
|
+
const u = at(s, a), d = o.getCordsFromCellNode(h, u), f = o.getDOMCellFromCordsOrThrow(d.x, d.y, u);
|
|
1128
|
+
if (l.$setAnchorCellForSelection(f), Y(t), t.shiftKey) {
|
|
1129
|
+
const [p, m, C] = U(o, h, g);
|
|
1130
|
+
return fn(l, p, m, C, e);
|
|
1131
|
+
}
|
|
1132
|
+
return g.selectEnd(), !0;
|
|
1133
|
+
}
|
|
1134
|
+
return !1;
|
|
1135
|
+
}
|
|
1136
|
+
function Y(n) {
|
|
1137
|
+
n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
|
|
1138
|
+
}
|
|
1139
|
+
function te(n, t, e) {
|
|
1140
|
+
const o = V();
|
|
1141
|
+
n === "first" ? t.insertBefore(o) : t.insertAfter(o), o.append(...e || []), o.selectEnd();
|
|
1142
|
+
}
|
|
1143
|
+
function ee(n, t, e) {
|
|
1144
|
+
const o = e.getParent();
|
|
1145
|
+
if (!o) return;
|
|
1146
|
+
const l = yt(Wt(n));
|
|
1147
|
+
if (!l) return;
|
|
1148
|
+
const i = l.anchorNode, r = n.getElementByKey(o.getKey()), c = Z(e, n.getElementByKey(e.getKey()));
|
|
1149
|
+
if (!i || !r || !c || !r.contains(i) || c.contains(i)) return;
|
|
1150
|
+
const h = y(t.anchor.getNode(), (w) => S(w));
|
|
1151
|
+
if (!h) return;
|
|
1152
|
+
const g = y(h, (w) => R(w));
|
|
1153
|
+
if (!R(g) || !g.is(e)) return;
|
|
1154
|
+
const [s, a] = U(e, h, h), u = s[0][0], d = s[s.length - 1][s[0].length - 1], { startRow: f, startColumn: p } = a, m = f === u.startRow && p === u.startColumn, C = f === d.startRow && p === d.startColumn;
|
|
1155
|
+
return m ? "first" : C ? "last" : void 0;
|
|
1156
|
+
}
|
|
1157
|
+
function ct(n, t) {
|
|
1158
|
+
const { tableNode: e } = n.$lookup(), o = e.getCordsFromCellNode(t, n.table);
|
|
1159
|
+
return e.getDOMCellFromCordsOrThrow(o.x, o.y, n.table);
|
|
1160
|
+
}
|
|
1161
|
+
function Kt(n, t, e) {
|
|
1162
|
+
return it(n, G(t, e));
|
|
1163
|
+
}
|
|
1164
|
+
function ne(n, t, e, o) {
|
|
1165
|
+
const l = n.querySelector("colgroup");
|
|
1166
|
+
if (!l) return;
|
|
1167
|
+
const i = [];
|
|
1168
|
+
for (let r = 0; r < e; 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 oe(n, t, e) {
|
|
1175
|
+
e ? (Q(n, t.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (Mt(n, t.theme.tableRowStriping), n.removeAttribute("data-lexical-row-striping"));
|
|
1176
|
+
}
|
|
1177
|
+
const Et = /* @__PURE__ */ new WeakSet();
|
|
1178
|
+
function fe(n = se()) {
|
|
1179
|
+
return Et.has(n);
|
|
1180
|
+
}
|
|
1181
|
+
function Fn(n, t) {
|
|
1182
|
+
t ? Et.add(n) : Et.delete(n);
|
|
1183
|
+
}
|
|
1184
|
+
class tt extends At {
|
|
1185
|
+
static getType() {
|
|
1186
|
+
return "table";
|
|
1187
|
+
}
|
|
1188
|
+
getColWidths() {
|
|
1189
|
+
return this.getLatest().__colWidths;
|
|
1190
|
+
}
|
|
1191
|
+
setColWidths(t) {
|
|
1192
|
+
const e = this.getWritable();
|
|
1193
|
+
return e.__colWidths = t, e;
|
|
1194
|
+
}
|
|
1195
|
+
static clone(t) {
|
|
1196
|
+
return new tt(t.__key);
|
|
1197
|
+
}
|
|
1198
|
+
afterCloneFrom(t) {
|
|
1199
|
+
super.afterCloneFrom(t), this.__colWidths = t.__colWidths, this.__rowStriping = t.__rowStriping;
|
|
1200
|
+
}
|
|
1201
|
+
static importDOM() {
|
|
1202
|
+
return { table: (t) => ({ conversion: mn, priority: 1 }) };
|
|
1203
|
+
}
|
|
1204
|
+
static importJSON(t) {
|
|
1205
|
+
return Jt().updateFromJSON(t);
|
|
1206
|
+
}
|
|
1207
|
+
updateFromJSON(t) {
|
|
1208
|
+
return super.updateFromJSON(t).setRowStriping(t.rowStriping || !1).setColWidths(t.colWidths);
|
|
1209
|
+
}
|
|
1210
|
+
constructor(t) {
|
|
1211
|
+
super(t), this.__rowStriping = !1;
|
|
1212
|
+
}
|
|
1213
|
+
exportJSON() {
|
|
1214
|
+
return { ...super.exportJSON(), colWidths: this.getColWidths(), rowStriping: this.__rowStriping ? this.__rowStriping : void 0 };
|
|
1215
|
+
}
|
|
1216
|
+
extractWithChild(t, e, o) {
|
|
1217
|
+
return o === "html";
|
|
1218
|
+
}
|
|
1219
|
+
getDOMSlot(t) {
|
|
1220
|
+
const e = t.nodeName !== "TABLE" && t.querySelector("table") || t;
|
|
1221
|
+
return e.nodeName !== "TABLE" && b(229), super.getDOMSlot(e).withAfter(e.querySelector("colgroup"));
|
|
1222
|
+
}
|
|
1223
|
+
createDOM(t, e) {
|
|
1224
|
+
const o = document.createElement("table"), l = document.createElement("colgroup");
|
|
1225
|
+
if (o.appendChild(l), ne(o, 0, this.getColumnCount(), this.getColWidths()), Ne(l), Q(o, t.theme.table), this.__rowStriping && oe(o, t, !0), fe(e)) {
|
|
1226
|
+
const i = document.createElement("div"), r = t.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(t, e, o) {
|
|
1232
|
+
return t.__rowStriping !== this.__rowStriping && oe(e, o, this.__rowStriping), ne(e, 0, this.getColumnCount(), this.getColWidths()), !1;
|
|
1233
|
+
}
|
|
1234
|
+
exportDOM(t) {
|
|
1235
|
+
const e = super.exportDOM(t), { element: o } = e;
|
|
1236
|
+
return { after: (l) => {
|
|
1237
|
+
if (e.after && (l = e.after(l)), St(l) && l.nodeName !== "TABLE" && (l = l.querySelector("table")), !St(l)) return null;
|
|
1238
|
+
const [i] = Dt(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 g = l.querySelectorAll(":scope > tr");
|
|
1260
|
+
if (g.length > 0) {
|
|
1261
|
+
const s = document.createElement("tbody");
|
|
1262
|
+
for (const a of g) s.appendChild(a);
|
|
1263
|
+
l.append(s);
|
|
1264
|
+
}
|
|
1265
|
+
return l;
|
|
1266
|
+
}, element: St(o) && o.nodeName !== "TABLE" ? o.querySelector("table") : o };
|
|
1267
|
+
}
|
|
1268
|
+
canBeEmpty() {
|
|
1269
|
+
return !1;
|
|
1270
|
+
}
|
|
1271
|
+
isShadowRoot() {
|
|
1272
|
+
return !0;
|
|
1273
|
+
}
|
|
1274
|
+
getCordsFromCellNode(t, e) {
|
|
1275
|
+
const { rows: o, domRows: l } = e;
|
|
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: g } = h, s = Kt(this, g);
|
|
1282
|
+
if (s !== null && t.is(s)) return { x: c, y: i };
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
throw new Error("Cell not found in table.");
|
|
1286
|
+
}
|
|
1287
|
+
getDOMCellFromCords(t, e, o) {
|
|
1288
|
+
const { domRows: l } = o, i = l[e];
|
|
1289
|
+
if (i == null) return null;
|
|
1290
|
+
const r = i[t < i.length ? t : i.length - 1];
|
|
1291
|
+
return r ?? null;
|
|
1292
|
+
}
|
|
1293
|
+
getDOMCellFromCordsOrThrow(t, e, o) {
|
|
1294
|
+
const l = this.getDOMCellFromCords(t, e, o);
|
|
1295
|
+
if (!l) throw new Error("Cell not found at cords.");
|
|
1296
|
+
return l;
|
|
1297
|
+
}
|
|
1298
|
+
getCellNodeFromCords(t, e, o) {
|
|
1299
|
+
const l = this.getDOMCellFromCords(t, e, o);
|
|
1300
|
+
if (l == null) return null;
|
|
1301
|
+
const i = G(l.elem);
|
|
1302
|
+
return S(i) ? i : null;
|
|
1303
|
+
}
|
|
1304
|
+
getCellNodeFromCordsOrThrow(t, e, o) {
|
|
1305
|
+
const l = this.getCellNodeFromCords(t, e, 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(t) {
|
|
1313
|
+
const e = this.getWritable();
|
|
1314
|
+
return e.__rowStriping = t, e;
|
|
1315
|
+
}
|
|
1316
|
+
canSelectBefore() {
|
|
1317
|
+
return !0;
|
|
1318
|
+
}
|
|
1319
|
+
canIndent() {
|
|
1320
|
+
return !1;
|
|
1321
|
+
}
|
|
1322
|
+
getColumnCount() {
|
|
1323
|
+
const t = this.getFirstChild();
|
|
1324
|
+
if (!t) return 0;
|
|
1325
|
+
let e = 0;
|
|
1326
|
+
return t.getChildren().forEach((o) => {
|
|
1327
|
+
S(o) && (e += o.getColSpan());
|
|
1328
|
+
}), e;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
function mn(n) {
|
|
1332
|
+
const t = Jt();
|
|
1333
|
+
n.hasAttribute("data-lexical-row-striping") && t.setRowStriping(!0);
|
|
1334
|
+
const e = n.querySelector(":scope > colgroup");
|
|
1335
|
+
if (e) {
|
|
1336
|
+
let o = [];
|
|
1337
|
+
for (const l of e.querySelectorAll(":scope > col")) {
|
|
1338
|
+
let i = l.style.width || "";
|
|
1339
|
+
if (!Lt.test(i) && (i = l.getAttribute("width") || "", !/^\d+$/.test(i))) {
|
|
1340
|
+
o = void 0;
|
|
1341
|
+
break;
|
|
1342
|
+
}
|
|
1343
|
+
o.push(parseFloat(i));
|
|
1344
|
+
}
|
|
1345
|
+
o && t.setColWidths(o);
|
|
1346
|
+
}
|
|
1347
|
+
return { after: (o) => re(o, M), node: t };
|
|
1348
|
+
}
|
|
1349
|
+
function Jt() {
|
|
1350
|
+
return Pt(new tt());
|
|
1351
|
+
}
|
|
1352
|
+
function R(n) {
|
|
1353
|
+
return n instanceof tt;
|
|
1354
|
+
}
|
|
1355
|
+
function pn({ rows: n, columns: t, includeHeaders: e }) {
|
|
1356
|
+
const o = on(Number(n), Number(t), e);
|
|
1357
|
+
we(o);
|
|
1358
|
+
const l = o.getFirstDescendant();
|
|
1359
|
+
return ut(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()) ? le(n, S) : n.remove();
|
|
1366
|
+
}
|
|
1367
|
+
function bn(n) {
|
|
1368
|
+
le(n, M);
|
|
1369
|
+
const [t] = Dt(n, null, null), e = t.reduce((l, i) => Math.max(l, i.length), 0), o = n.getChildren();
|
|
1370
|
+
for (let l = 0; l < t.length; ++l) {
|
|
1371
|
+
const i = o[l];
|
|
1372
|
+
if (!i) continue;
|
|
1373
|
+
M(i) || b(254, i.constructor.name, i.getType());
|
|
1374
|
+
const r = t[l].reduce((c, h) => h ? 1 + c : c, 0);
|
|
1375
|
+
if (r !== e) for (let c = r; c < e; ++c) {
|
|
1376
|
+
const h = ht();
|
|
1377
|
+
h.append(V()), i.append(h);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function On(n) {
|
|
1382
|
+
return n.registerNodeTransform(et, (t) => {
|
|
1383
|
+
if (t.getColSpan() > 1 || t.getRowSpan() > 1) {
|
|
1384
|
+
const [, , e] = lt(t), [o] = U(e, t, t), l = o.length, i = o[0].length;
|
|
1385
|
+
let r = e.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 g = 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) g = u, c.push(u);
|
|
1394
|
+
else if (u.getColSpan() > 1 || u.getRowSpan() > 1) {
|
|
1395
|
+
S(u) || b(176);
|
|
1396
|
+
const d = ht(u.__headerState);
|
|
1397
|
+
g !== null ? g.insertAfter(d) : Se(r, d);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
for (const h of c) h.setColSpan(1), h.setRowSpan(1);
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
function kn(n, t = !0) {
|
|
1406
|
+
const e = /* @__PURE__ */ new Map(), o = (i, r, c) => {
|
|
1407
|
+
const h = Z(i, c), g = dn(i, h, n, t);
|
|
1408
|
+
e.set(r, [g, h]);
|
|
1409
|
+
}, l = n.registerMutationListener(tt, (i) => {
|
|
1410
|
+
n.getEditorState().read(() => {
|
|
1411
|
+
for (const [r, c] of i) {
|
|
1412
|
+
const h = e.get(r);
|
|
1413
|
+
if (c === "created" || c === "updated") {
|
|
1414
|
+
const { tableNode: g, tableElement: s } = ue(r);
|
|
1415
|
+
h === void 0 ? o(g, r, s) : s !== h[1] && (h[0].removeListeners(), e.delete(r), o(g, r, s));
|
|
1416
|
+
} else c === "destroyed" && h !== void 0 && (h[0].removeListeners(), e.delete(r));
|
|
1417
|
+
}
|
|
1418
|
+
}, { editor: n });
|
|
1419
|
+
}, { skipInitialization: !1 });
|
|
1420
|
+
return () => {
|
|
1421
|
+
l();
|
|
1422
|
+
for (const [, [i]] of e) i.removeListeners();
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
function Rn(n) {
|
|
1426
|
+
return n.hasNodes([tt]) || b(255), be(n.registerCommand(Ge, pn, xe), n.registerNodeTransform(tt, bn), n.registerNodeTransform(dt, Sn), n.registerNodeTransform(et, Cn));
|
|
1427
|
+
}
|
|
1428
|
+
export {
|
|
1429
|
+
vn as F,
|
|
1430
|
+
Tn as L,
|
|
1431
|
+
xn as O,
|
|
1432
|
+
tt as P,
|
|
1433
|
+
rn as R,
|
|
1434
|
+
dt as S,
|
|
1435
|
+
ce as T,
|
|
1436
|
+
kn as X,
|
|
1437
|
+
Ht as _,
|
|
1438
|
+
Fn as a,
|
|
1439
|
+
ht as d,
|
|
1440
|
+
S as g,
|
|
1441
|
+
Rn as j,
|
|
1442
|
+
On as q,
|
|
1443
|
+
et as u,
|
|
1444
|
+
Nn as v,
|
|
1445
|
+
on as x
|
|
1446
|
+
};
|
|
1447
|
+
//# sourceMappingURL=LexicalTable.prod-8RqiGUG-.js.map
|