@uva-glass/component-library 3.14.1 → 3.15.0
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-D8x7Ii0F.js → Lexical.prod-qoFV025v.js} +1831 -1858
- package/dist/Lexical.prod-qoFV025v.js.map +1 -0
- package/dist/LexicalClipboard.prod-BFJoO5qv.js +255 -0
- package/dist/LexicalClipboard.prod-BFJoO5qv.js.map +1 -0
- package/dist/{LexicalLink.prod-CkldFE8u.js → LexicalLink.prod-BIN12UMz.js} +47 -47
- package/dist/{LexicalLink.prod-CkldFE8u.js.map → LexicalLink.prod-BIN12UMz.js.map} +1 -1
- package/dist/{LexicalList.prod-CsVDXdmw.js → LexicalList.prod-WlGaeo0L.js} +71 -71
- package/dist/LexicalList.prod-WlGaeo0L.js.map +1 -0
- package/dist/LexicalSelection.prod-B5grbYgk.js +97 -0
- package/dist/LexicalSelection.prod-B5grbYgk.js.map +1 -0
- package/dist/{LexicalTable.prod-rZbTmo9K.js → LexicalTable.prod-osQj1CQX.js} +551 -550
- package/dist/LexicalTable.prod-osQj1CQX.js.map +1 -0
- package/dist/{LexicalUtils.prod-CpMJ4I9h.js → LexicalUtils.prod-BpZsS7jD.js} +29 -29
- package/dist/{LexicalUtils.prod-CpMJ4I9h.js.map → LexicalUtils.prod-BpZsS7jD.js.map} +1 -1
- package/dist/{TablePlugin-WOgWan8s.js → TablePlugin-6tDdOCQy.js} +10 -10
- package/dist/{TablePlugin-WOgWan8s.js.map → TablePlugin-6tDdOCQy.js.map} +1 -1
- package/dist/assets/PageOverlay.css +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/PageOverlay/PageOverlay.js +31 -31
- 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 +4 -4
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +4 -4
- 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 +33 -33
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +24 -24
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
- 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 +14 -14
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +20 -20
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +451 -450
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +4 -4
- package/dist/components/Timeline/Timeline.test.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-E_SsILnP.js → helpers-5RvdadYU.js} +25 -25
- package/dist/{helpers-E_SsILnP.js.map → helpers-5RvdadYU.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +7 -7
- package/dist/Lexical.prod-D8x7Ii0F.js.map +0 -1
- package/dist/LexicalClipboard.prod-D5GjiArS.js +0 -255
- package/dist/LexicalClipboard.prod-D5GjiArS.js.map +0 -1
- package/dist/LexicalList.prod-CsVDXdmw.js.map +0 -1
- package/dist/LexicalSelection.prod-JQDTaUpX.js +0 -90
- package/dist/LexicalSelection.prod-JQDTaUpX.js.map +0 -1
- package/dist/LexicalTable.prod-rZbTmo9K.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { w as x, r as Q, i as ge, _ as
|
|
2
|
-
import { f as
|
|
3
|
-
import { _ as Rn, M as Fn } from "./LexicalClipboard.prod-
|
|
4
|
-
const
|
|
5
|
-
class ce extends
|
|
1
|
+
import { w as x, r as Q, i as ge, _ as Nt, j as Ut, N as Xt, T as vt, S as Yt, L as qt } from "./LexicalUtils.prod-BpZsS7jD.js";
|
|
2
|
+
import { f as Ze, u as be, e as Qe, h as jt, Q as Ce, i as at, P as I, X as Ge, T as Vt, m as xt, k as re, n as Zt, L as Be, p as Tt, c as z, o as Qt, q as ye, d as D, N as B, w as Je, s as Oe, t as Gt, x as en, z as tn, A as nn, K as De, O as on, B as rn, C as Rt, D as ln, E as V, G as sn, H as an, U as cn, M as un, R as hn, S as dn, V as fn, W as gn, Y as fe, y as ne, $ as $e, a0 as mn, a as Ft, a1 as pn, F as et, a2 as Cn, Z as _n, a3 as Ae, a4 as Sn, a5 as wn, a6 as ct, a7 as yn, a8 as ut, j as bn, a9 as ht, _ as dt, l as Te, aa as Nn, v as vn, ab as xn, ac as Tn } from "./Lexical.prod-qoFV025v.js";
|
|
3
|
+
import { _ as Rn, M as Fn } from "./LexicalClipboard.prod-BFJoO5qv.js";
|
|
4
|
+
const tt = /^(\d+(?:\.\d+)?)px$/, W = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
|
|
5
|
+
class ce extends Ze {
|
|
6
6
|
static getType() {
|
|
7
7
|
return "tablecell";
|
|
8
8
|
}
|
|
@@ -13,31 +13,31 @@ class ce extends Ve {
|
|
|
13
13
|
super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor, this.__verticalAlign = e.__verticalAlign;
|
|
14
14
|
}
|
|
15
15
|
static importDOM() {
|
|
16
|
-
return { td: (e) => ({ conversion:
|
|
16
|
+
return { td: (e) => ({ conversion: ft, priority: 0 }), th: (e) => ({ conversion: ft, priority: 0 }) };
|
|
17
17
|
}
|
|
18
18
|
static importJSON(e) {
|
|
19
|
-
return
|
|
19
|
+
return X().updateFromJSON(e);
|
|
20
20
|
}
|
|
21
21
|
updateFromJSON(e) {
|
|
22
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).setVerticalAlign(e.verticalAlign || void 0);
|
|
23
23
|
}
|
|
24
|
-
constructor(e = W.NO_STATUS, t = 1, o,
|
|
25
|
-
super(
|
|
24
|
+
constructor(e = W.NO_STATUS, t = 1, o, r) {
|
|
25
|
+
super(r), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = o, this.__backgroundColor = null, this.__verticalAlign = void 0;
|
|
26
26
|
}
|
|
27
27
|
createDOM(e) {
|
|
28
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),
|
|
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), Ue(this.__verticalAlign) && (t.style.verticalAlign = this.__verticalAlign), Q(t, e.theme.tableCell, this.hasHeader() && e.theme.tableCellHeader), t;
|
|
30
30
|
}
|
|
31
31
|
exportDOM(e) {
|
|
32
32
|
const t = super.exportDOM(e);
|
|
33
|
-
if (
|
|
33
|
+
if (be(t.element)) {
|
|
34
34
|
const o = t.element;
|
|
35
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 = this.getVerticalAlign() || "top", o.style.textAlign = "start", this.__backgroundColor === null && this.hasHeader() && (o.style.backgroundColor = "#f2f3f5");
|
|
36
36
|
}
|
|
37
37
|
return t;
|
|
38
38
|
}
|
|
39
39
|
exportJSON() {
|
|
40
|
-
return { ...super.exportJSON(), ...
|
|
40
|
+
return { ...super.exportJSON(), ...Ue(this.__verticalAlign) && { verticalAlign: this.__verticalAlign }, backgroundColor: this.getBackgroundColor(), colSpan: this.__colSpan, headerState: this.__headerState, rowSpan: this.__rowSpan, width: this.getWidth() };
|
|
41
41
|
}
|
|
42
42
|
getColSpan() {
|
|
43
43
|
return this.getLatest().__colSpan;
|
|
@@ -110,19 +110,19 @@ class ce extends Ve {
|
|
|
110
110
|
return !1;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Ue(n) {
|
|
114
114
|
return n === "middle" || n === "bottom";
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function ft(n) {
|
|
117
117
|
const e = n, t = n.nodeName.toLowerCase();
|
|
118
118
|
let o;
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
119
|
+
tt.test(e.style.width) && (o = parseFloat(e.style.width));
|
|
120
|
+
const r = X(t === "th" ? W.ROW : W.NO_STATUS, e.colSpan, o);
|
|
121
|
+
r.__rowSpan = e.rowSpan;
|
|
122
122
|
const s = e.style.backgroundColor;
|
|
123
|
-
s !== "" && (
|
|
124
|
-
const
|
|
125
|
-
|
|
123
|
+
s !== "" && (r.__backgroundColor = s);
|
|
124
|
+
const l = e.style.verticalAlign;
|
|
125
|
+
Ue(l) && (r.__verticalAlign = l);
|
|
126
126
|
const i = e.style, u = (i && i.textDecoration || "").split(" "), m = i.fontWeight === "700" || i.fontWeight === "bold", h = u.includes("line-through"), p = i.fontStyle === "italic", C = u.includes("underline");
|
|
127
127
|
return { after: (a) => {
|
|
128
128
|
const c = [];
|
|
@@ -130,27 +130,27 @@ function dt(n) {
|
|
|
130
130
|
const d = () => {
|
|
131
131
|
if (f) {
|
|
132
132
|
const g = f.getFirstChild();
|
|
133
|
-
|
|
133
|
+
at(g) && f.getChildrenSize() === 1 && g.remove();
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
for (const g of a) jt(g) || Ce(g) ||
|
|
136
|
+
for (const g of a) jt(g) || Ce(g) || at(g) ? (Ce(g) && (m && g.toggleFormat("bold"), h && g.toggleFormat("strikethrough"), p && g.toggleFormat("italic"), C && g.toggleFormat("underline")), f ? f.append(g) : (f = I().append(g), c.push(f))) : (c.push(g), d(), f = null);
|
|
137
137
|
return d(), c.length === 0 && c.push(I()), c;
|
|
138
|
-
}, node:
|
|
138
|
+
}, node: r };
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
140
|
+
function X(n = W.NO_STATUS, e = 1, t) {
|
|
141
|
+
return Qe(new ce(n, e, t));
|
|
142
142
|
}
|
|
143
143
|
function w(n) {
|
|
144
144
|
return n instanceof ce;
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
function
|
|
146
|
+
const Kn = Qt("INSERT_TABLE_COMMAND");
|
|
147
|
+
function y(n, ...e) {
|
|
148
148
|
const t = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
149
149
|
o.append("code", n);
|
|
150
|
-
for (const
|
|
150
|
+
for (const r of e) o.append("v", r);
|
|
151
151
|
throw t.search = o.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
152
152
|
}
|
|
153
|
-
class xe extends
|
|
153
|
+
class xe extends Ze {
|
|
154
154
|
static getType() {
|
|
155
155
|
return "tablerow";
|
|
156
156
|
}
|
|
@@ -158,7 +158,7 @@ class xe extends Ve {
|
|
|
158
158
|
return new xe(e.__height, e.__key);
|
|
159
159
|
}
|
|
160
160
|
static importDOM() {
|
|
161
|
-
return { tr: (e) => ({ conversion:
|
|
161
|
+
return { tr: (e) => ({ conversion: On, priority: 0 }) };
|
|
162
162
|
}
|
|
163
163
|
static importJSON(e) {
|
|
164
164
|
return ve().updateFromJSON(e);
|
|
@@ -200,27 +200,27 @@ class xe extends Ve {
|
|
|
200
200
|
return !1;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function On(n) {
|
|
204
204
|
const e = n;
|
|
205
205
|
let t;
|
|
206
|
-
return
|
|
206
|
+
return tt.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) => Nt(o, w), node: ve(t) };
|
|
207
207
|
}
|
|
208
208
|
function ve(n) {
|
|
209
|
-
return
|
|
209
|
+
return Qe(new xe(n));
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function A(n) {
|
|
212
212
|
return n instanceof xe;
|
|
213
213
|
}
|
|
214
|
-
const
|
|
214
|
+
const nt = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, An = nt && "documentMode" in document ? document.documentMode : null, gt = nt && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
215
215
|
function En(n, e, t = !0) {
|
|
216
|
-
const o =
|
|
217
|
-
for (let
|
|
216
|
+
const o = lt();
|
|
217
|
+
for (let r = 0; r < n; r++) {
|
|
218
218
|
const s = ve();
|
|
219
|
-
for (let
|
|
219
|
+
for (let l = 0; l < e; l++) {
|
|
220
220
|
let i = W.NO_STATUS;
|
|
221
|
-
typeof t == "object" ? (
|
|
222
|
-
const u =
|
|
223
|
-
m.append(
|
|
221
|
+
typeof t == "object" ? (r === 0 && t.rows && (i |= W.ROW), l === 0 && t.columns && (i |= W.COLUMN)) : t && (r === 0 && (i |= W.ROW), l === 0 && (i |= W.COLUMN));
|
|
222
|
+
const u = X(i), m = I();
|
|
223
|
+
m.append(Ge()), u.append(m), s.append(u);
|
|
224
224
|
}
|
|
225
225
|
o.append(s);
|
|
226
226
|
}
|
|
@@ -230,86 +230,86 @@ function so(n) {
|
|
|
230
230
|
const e = x(n, (t) => w(t));
|
|
231
231
|
return w(e) ? e : null;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
const e = x(n, (t) =>
|
|
235
|
-
if (
|
|
233
|
+
function Kt(n) {
|
|
234
|
+
const e = x(n, (t) => A(t));
|
|
235
|
+
if (A(e)) return e;
|
|
236
236
|
throw new Error("Expected table cell to be inside of table row.");
|
|
237
237
|
}
|
|
238
238
|
function Ot(n) {
|
|
239
|
-
const e = x(n, (t) =>
|
|
240
|
-
if (
|
|
239
|
+
const e = x(n, (t) => $(t));
|
|
240
|
+
if ($(e)) return e;
|
|
241
241
|
throw new Error("Expected table cell to be inside of table.");
|
|
242
242
|
}
|
|
243
243
|
function io(n) {
|
|
244
|
-
const e =
|
|
244
|
+
const e = Kt(n);
|
|
245
245
|
return Ot(e).getChildren().findIndex((t) => t.is(e));
|
|
246
246
|
}
|
|
247
247
|
function ao(n) {
|
|
248
|
-
return
|
|
248
|
+
return Kt(n).getChildren().findIndex((e) => e.is(n));
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
const
|
|
250
|
+
nt && "InputEvent" in window && !An && new window.InputEvent("input");
|
|
251
|
+
const Xe = (n, e) => n === W.BOTH || n === e ? e : W.NO_STATUS;
|
|
252
252
|
function kn(n, e = !0) {
|
|
253
|
-
const [, , t] = G(n), [o,
|
|
253
|
+
const [, , t] = G(n), [o, r] = U(t, n, n), s = o[0].length, { startRow: l } = r;
|
|
254
254
|
let i = null;
|
|
255
255
|
if (e) {
|
|
256
|
-
const u =
|
|
256
|
+
const u = l + n.__rowSpan - 1, m = o[u], h = ve();
|
|
257
257
|
for (let C = 0; C < s; C++) {
|
|
258
258
|
const { cell: a, startRow: c } = m[C];
|
|
259
259
|
if (c + a.__rowSpan - 1 <= u) {
|
|
260
|
-
const f = m[C].cell.__headerState, d =
|
|
261
|
-
h.append(
|
|
260
|
+
const f = m[C].cell.__headerState, d = Xe(f, W.COLUMN);
|
|
261
|
+
h.append(X(d).append(I()));
|
|
262
262
|
} else a.setRowSpan(a.__rowSpan + 1);
|
|
263
263
|
}
|
|
264
264
|
const p = t.getChildAtIndex(u);
|
|
265
|
-
|
|
265
|
+
A(p) || y(256), p.insertAfter(h), i = h;
|
|
266
266
|
} else {
|
|
267
|
-
const u =
|
|
267
|
+
const u = l, m = o[u], h = ve();
|
|
268
268
|
for (let C = 0; C < s; C++) {
|
|
269
269
|
const { cell: a, startRow: c } = m[C];
|
|
270
270
|
if (c === u) {
|
|
271
|
-
const f = m[C].cell.__headerState, d =
|
|
272
|
-
h.append(
|
|
271
|
+
const f = m[C].cell.__headerState, d = Xe(f, W.COLUMN);
|
|
272
|
+
h.append(X(d).append(I()));
|
|
273
273
|
} else a.setRowSpan(a.__rowSpan + 1);
|
|
274
274
|
}
|
|
275
275
|
const p = t.getChildAtIndex(u);
|
|
276
|
-
|
|
276
|
+
A(p) || y(257), p.insertBefore(h), i = h;
|
|
277
277
|
}
|
|
278
278
|
return i;
|
|
279
279
|
}
|
|
280
280
|
function $n(n, e = !0, t = !0) {
|
|
281
|
-
const [, , o] = G(n), [
|
|
282
|
-
|
|
281
|
+
const [, , o] = G(n), [r, s] = U(o, n, n), l = r.length, { startColumn: i } = s, u = e ? i + n.__colSpan - 1 : i - 1, m = o.getFirstChild();
|
|
282
|
+
A(m) || y(120);
|
|
283
283
|
let h = null;
|
|
284
284
|
function p(c = W.NO_STATUS) {
|
|
285
|
-
const f =
|
|
285
|
+
const f = X(c).append(I());
|
|
286
286
|
return h === null && (h = f), f;
|
|
287
287
|
}
|
|
288
288
|
let C = m;
|
|
289
|
-
e: for (let c = 0; c <
|
|
289
|
+
e: for (let c = 0; c < l; c++) {
|
|
290
290
|
if (c !== 0) {
|
|
291
|
-
const
|
|
292
|
-
|
|
291
|
+
const b = C.getNextSibling();
|
|
292
|
+
A(b) || y(121), C = b;
|
|
293
293
|
}
|
|
294
|
-
const f =
|
|
294
|
+
const f = r[c], d = f[u < 0 ? 0 : u].cell.__headerState, g = Xe(d, W.ROW);
|
|
295
295
|
if (u < 0) {
|
|
296
|
-
|
|
296
|
+
At(C, p(g));
|
|
297
297
|
continue;
|
|
298
298
|
}
|
|
299
299
|
const { cell: _, startColumn: S, startRow: N } = f[u];
|
|
300
300
|
if (S + _.__colSpan - 1 <= u) {
|
|
301
|
-
let
|
|
302
|
-
for (; T !== c &&
|
|
301
|
+
let b = _, T = N, F = u;
|
|
302
|
+
for (; T !== c && b.__rowSpan > 1; ) {
|
|
303
303
|
if (F -= _.__colSpan, !(F >= 0)) {
|
|
304
304
|
C.append(p(g));
|
|
305
305
|
continue e;
|
|
306
306
|
}
|
|
307
307
|
{
|
|
308
|
-
const { cell: M, startRow:
|
|
309
|
-
|
|
308
|
+
const { cell: M, startRow: K } = f[F];
|
|
309
|
+
b = M, T = K;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
b.insertAfter(p(g));
|
|
313
313
|
} else _.setColSpan(_.__colSpan + 1);
|
|
314
314
|
}
|
|
315
315
|
h !== null && t && Mn(h);
|
|
@@ -323,9 +323,9 @@ function $n(n, e = !0, t = !0) {
|
|
|
323
323
|
function co(n, e) {
|
|
324
324
|
const t = n.getChildren();
|
|
325
325
|
for (let o = 0; o < t.length; o++) {
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
328
|
-
const s =
|
|
326
|
+
const r = t[o];
|
|
327
|
+
if (A(r)) {
|
|
328
|
+
const s = r.getChildren();
|
|
329
329
|
if (e >= s.length || e < 0) throw new Error("Table column target index out of range");
|
|
330
330
|
s[e].remove();
|
|
331
331
|
}
|
|
@@ -336,14 +336,14 @@ function Mn(n) {
|
|
|
336
336
|
const e = n.getFirstDescendant();
|
|
337
337
|
e == null ? n.selectStart() : e.getParentOrThrow().selectStart();
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function At(n, e) {
|
|
340
340
|
const t = n.getFirstChild();
|
|
341
341
|
t !== null ? t.insertBefore(e) : n.append(e);
|
|
342
342
|
}
|
|
343
343
|
function Ln(n) {
|
|
344
344
|
if (n.length === 0) return null;
|
|
345
345
|
const e = Ot(n[0]), [t] = oe(e, null, null);
|
|
346
|
-
let o = 1 / 0,
|
|
346
|
+
let o = 1 / 0, r = -1 / 0, s = 1 / 0, l = -1 / 0;
|
|
347
347
|
const i = /* @__PURE__ */ new Set();
|
|
348
348
|
for (const a of t) for (const c of a) {
|
|
349
349
|
if (!c || !c.cell) continue;
|
|
@@ -351,16 +351,16 @@ function Ln(n) {
|
|
|
351
351
|
if (!i.has(f) && n.some((d) => d.is(c.cell))) {
|
|
352
352
|
i.add(f);
|
|
353
353
|
const d = c.startRow, g = c.startColumn, _ = c.cell.__rowSpan || 1, S = c.cell.__colSpan || 1;
|
|
354
|
-
o = Math.min(o, d),
|
|
354
|
+
o = Math.min(o, d), r = Math.max(r, d + _ - 1), s = Math.min(s, g), l = Math.max(l, g + S - 1);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
if (o === 1 / 0 || s === 1 / 0) return null;
|
|
358
|
-
const u =
|
|
358
|
+
const u = r - o + 1, m = l - s + 1, h = t[o][s];
|
|
359
359
|
if (!h.cell) return null;
|
|
360
360
|
const p = h.cell;
|
|
361
361
|
p.setColSpan(m), p.setRowSpan(u);
|
|
362
362
|
const C = /* @__PURE__ */ new Set([p.getKey()]);
|
|
363
|
-
for (let a = o; a <=
|
|
363
|
+
for (let a = o; a <= r; a++) for (let c = s; c <= l; c++) {
|
|
364
364
|
const f = t[a][c];
|
|
365
365
|
if (!f.cell) continue;
|
|
366
366
|
const d = f.cell, g = d.getKey();
|
|
@@ -371,125 +371,125 @@ function Ln(n) {
|
|
|
371
371
|
function zn(n) {
|
|
372
372
|
if (n.getChildrenSize() !== 1) return !1;
|
|
373
373
|
const e = n.getFirstChildOrThrow();
|
|
374
|
-
return !(!
|
|
374
|
+
return !(!et(e) || !e.isEmpty());
|
|
375
375
|
}
|
|
376
376
|
function Wn(n) {
|
|
377
|
-
const [e, t, o] = G(n),
|
|
378
|
-
if (
|
|
379
|
-
const [
|
|
377
|
+
const [e, t, o] = G(n), r = e.__colSpan, s = e.__rowSpan;
|
|
378
|
+
if (r === 1 && s === 1) return;
|
|
379
|
+
const [l, i] = U(o, e, e), { startColumn: u, startRow: m } = i, h = e.__headerState & W.COLUMN, p = Array.from({ length: r }, (c, f) => {
|
|
380
380
|
let d = h;
|
|
381
|
-
for (let g = 0; d !== 0 && g <
|
|
381
|
+
for (let g = 0; d !== 0 && g < l.length; g++) d &= l[g][f + u].cell.__headerState;
|
|
382
382
|
return d;
|
|
383
383
|
}), C = e.__headerState & W.ROW, a = Array.from({ length: s }, (c, f) => {
|
|
384
384
|
let d = C;
|
|
385
|
-
for (let g = 0; d !== 0 && g <
|
|
385
|
+
for (let g = 0; d !== 0 && g < l[0].length; g++) d &= l[f + m][g].cell.__headerState;
|
|
386
386
|
return d;
|
|
387
387
|
});
|
|
388
|
-
if (
|
|
389
|
-
for (let c = 1; c <
|
|
388
|
+
if (r > 1) {
|
|
389
|
+
for (let c = 1; c < r; c++) e.insertAfter(X(p[c] | a[0]).append(I()));
|
|
390
390
|
e.setColSpan(1);
|
|
391
391
|
}
|
|
392
392
|
if (s > 1) {
|
|
393
393
|
let c;
|
|
394
394
|
for (let f = 1; f < s; f++) {
|
|
395
|
-
const d = m + f, g =
|
|
396
|
-
c = (c || t).getNextSibling(),
|
|
395
|
+
const d = m + f, g = l[d];
|
|
396
|
+
c = (c || t).getNextSibling(), A(c) || y(125);
|
|
397
397
|
let _ = null;
|
|
398
398
|
for (let S = 0; S < u; S++) {
|
|
399
|
-
const N = g[S],
|
|
400
|
-
N.startRow === d && (_ =
|
|
399
|
+
const N = g[S], b = N.cell;
|
|
400
|
+
N.startRow === d && (_ = b), b.__colSpan > 1 && (S += b.__colSpan - 1);
|
|
401
401
|
}
|
|
402
|
-
if (_ === null) for (let S =
|
|
403
|
-
else for (let S =
|
|
402
|
+
if (_ === null) for (let S = r - 1; S >= 0; S--) At(c, X(p[S] | a[f]).append(I()));
|
|
403
|
+
else for (let S = r - 1; S >= 0; S--) _.insertAfter(X(p[S] | a[f]).append(I()));
|
|
404
404
|
}
|
|
405
405
|
e.setRowSpan(1);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
const [o,
|
|
410
|
-
return
|
|
408
|
+
function U(n, e, t) {
|
|
409
|
+
const [o, r, s] = oe(n, e, t);
|
|
410
|
+
return r === null && y(207), s === null && y(208), [o, r, s];
|
|
411
411
|
}
|
|
412
412
|
function oe(n, e, t) {
|
|
413
413
|
const o = [];
|
|
414
|
-
let
|
|
415
|
-
function
|
|
414
|
+
let r = null, s = null;
|
|
415
|
+
function l(u) {
|
|
416
416
|
let m = o[u];
|
|
417
417
|
return m === void 0 && (o[u] = m = []), m;
|
|
418
418
|
}
|
|
419
419
|
const i = n.getChildren();
|
|
420
420
|
for (let u = 0; u < i.length; u++) {
|
|
421
421
|
const m = i[u];
|
|
422
|
-
|
|
423
|
-
const h =
|
|
422
|
+
A(m) || y(209);
|
|
423
|
+
const h = l(u);
|
|
424
424
|
for (let p = m.getFirstChild(), C = 0; p != null; p = p.getNextSibling()) {
|
|
425
|
-
for (w(p) ||
|
|
425
|
+
for (w(p) || y(147); h[C] !== void 0; ) C++;
|
|
426
426
|
const a = { cell: p, startColumn: C, startRow: u }, { __rowSpan: c, __colSpan: f } = p;
|
|
427
427
|
for (let d = 0; d < c && !(u + d >= i.length); d++) {
|
|
428
|
-
const g =
|
|
428
|
+
const g = l(u + d);
|
|
429
429
|
for (let _ = 0; _ < f; _++) g[C + _] = a;
|
|
430
430
|
}
|
|
431
|
-
e !== null &&
|
|
431
|
+
e !== null && r === null && e.is(p) && (r = a), t !== null && s === null && t.is(p) && (s = a);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
return [o,
|
|
434
|
+
return [o, r, s];
|
|
435
435
|
}
|
|
436
436
|
function G(n) {
|
|
437
437
|
let e;
|
|
438
438
|
if (n instanceof ce) e = n;
|
|
439
439
|
else if ("__type" in n) {
|
|
440
|
-
const
|
|
441
|
-
w(
|
|
440
|
+
const r = x(n, w);
|
|
441
|
+
w(r) || y(148), e = r;
|
|
442
442
|
} else {
|
|
443
|
-
const
|
|
444
|
-
w(
|
|
443
|
+
const r = x(n.getNode(), w);
|
|
444
|
+
w(r) || y(148), e = r;
|
|
445
445
|
}
|
|
446
446
|
const t = e.getParent();
|
|
447
|
-
|
|
447
|
+
A(t) || y(149);
|
|
448
448
|
const o = t.getParent();
|
|
449
|
-
return
|
|
449
|
+
return $(o) || y(210), [e, t, o];
|
|
450
450
|
}
|
|
451
451
|
function Ee(n, e, t) {
|
|
452
|
-
let o,
|
|
452
|
+
let o, r = Math.min(e.startColumn, t.startColumn), s = Math.min(e.startRow, t.startRow), l = Math.max(e.startColumn + e.cell.__colSpan - 1, t.startColumn + t.cell.__colSpan - 1), i = Math.max(e.startRow + e.cell.__rowSpan - 1, t.startRow + t.cell.__rowSpan - 1);
|
|
453
453
|
do {
|
|
454
454
|
o = !1;
|
|
455
455
|
for (let u = 0; u < n.length; u++) for (let m = 0; m < n[0].length; m++) {
|
|
456
456
|
const h = n[u][m];
|
|
457
457
|
if (!h) continue;
|
|
458
|
-
const p = h.startColumn + h.cell.__colSpan - 1, C = h.startRow + h.cell.__rowSpan - 1, a = h.startColumn <=
|
|
458
|
+
const p = h.startColumn + h.cell.__colSpan - 1, C = h.startRow + h.cell.__rowSpan - 1, a = h.startColumn <= l && p >= r, c = h.startRow <= i && C >= s;
|
|
459
459
|
if (a && c) {
|
|
460
|
-
const f = Math.min(
|
|
461
|
-
f ===
|
|
460
|
+
const f = Math.min(r, h.startColumn), d = Math.max(l, p), g = Math.min(s, h.startRow), _ = Math.max(i, C);
|
|
461
|
+
f === r && d === l && g === s && _ === i || (r = f, l = d, s = g, i = _, o = !0);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
} while (o);
|
|
465
|
-
return { maxColumn:
|
|
465
|
+
return { maxColumn: l, maxRow: i, minColumn: r, minRow: s };
|
|
466
466
|
}
|
|
467
|
-
function
|
|
468
|
-
const [e, , t] = G(n), o = t.getChildren(),
|
|
469
|
-
for (let i = 0; i <
|
|
470
|
-
for (let i = 0; i <
|
|
467
|
+
function mt(n) {
|
|
468
|
+
const [e, , t] = G(n), o = t.getChildren(), r = o.length, s = o[0].getChildren().length, l = new Array(r);
|
|
469
|
+
for (let i = 0; i < r; i++) l[i] = new Array(s);
|
|
470
|
+
for (let i = 0; i < r; i++) {
|
|
471
471
|
const u = o[i].getChildren();
|
|
472
472
|
let m = 0;
|
|
473
473
|
for (let h = 0; h < u.length; h++) {
|
|
474
|
-
for (;
|
|
474
|
+
for (; l[i][m]; ) m++;
|
|
475
475
|
const p = u[h], C = p.__rowSpan || 1, a = p.__colSpan || 1;
|
|
476
|
-
for (let c = 0; c < C; c++) for (let f = 0; f < a; f++)
|
|
476
|
+
for (let c = 0; c < C; c++) for (let f = 0; f < a; f++) l[i + c][m + f] = p;
|
|
477
477
|
if (e === p) return { colSpan: a, columnIndex: m, rowIndex: i, rowSpan: C };
|
|
478
478
|
m += a;
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
return null;
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
const [[e, t, o,
|
|
483
|
+
function pt(n) {
|
|
484
|
+
const [[e, t, o, r], [s, l, i, u]] = ["anchor", "focus"].map((m) => {
|
|
485
485
|
const h = n[m].getNode(), p = x(h, w);
|
|
486
|
-
w(p) ||
|
|
486
|
+
w(p) || y(238, m, h.getKey(), h.getType());
|
|
487
487
|
const C = p.getParent();
|
|
488
|
-
|
|
488
|
+
A(C) || y(239, m);
|
|
489
489
|
const a = C.getParent();
|
|
490
|
-
return
|
|
490
|
+
return $(a) || y(240, m), [h, p, C, a];
|
|
491
491
|
});
|
|
492
|
-
return
|
|
492
|
+
return r.is(u) || y(241), { anchorCell: t, anchorNode: e, anchorRow: o, anchorTable: r, focusCell: l, focusNode: s, focusRow: i, focusTable: u };
|
|
493
493
|
}
|
|
494
494
|
class Me {
|
|
495
495
|
constructor(e, t, o) {
|
|
@@ -511,7 +511,7 @@ class Me {
|
|
|
511
511
|
this._cachedNodes = e;
|
|
512
512
|
}
|
|
513
513
|
is(e) {
|
|
514
|
-
return
|
|
514
|
+
return O(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
|
|
515
515
|
}
|
|
516
516
|
set(e, t, o) {
|
|
517
517
|
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;
|
|
@@ -531,45 +531,45 @@ class Me {
|
|
|
531
531
|
}
|
|
532
532
|
hasFormat(e) {
|
|
533
533
|
let t = 0;
|
|
534
|
-
this.getNodes().filter(w).forEach((
|
|
535
|
-
const s =
|
|
536
|
-
|
|
534
|
+
this.getNodes().filter(w).forEach((r) => {
|
|
535
|
+
const s = r.getFirstChild();
|
|
536
|
+
et(s) && (t |= s.getTextFormat());
|
|
537
537
|
});
|
|
538
538
|
const o = Tn[e];
|
|
539
539
|
return !!(t & o);
|
|
540
540
|
}
|
|
541
541
|
insertNodes(e) {
|
|
542
542
|
const t = this.focus.getNode();
|
|
543
|
-
D(t) ||
|
|
543
|
+
D(t) || y(151), vn(t.select(0, t.getChildrenSize())).insertNodes(e);
|
|
544
544
|
}
|
|
545
545
|
getShape() {
|
|
546
|
-
const { anchorCell: e, focusCell: t } =
|
|
547
|
-
o === null &&
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
const s = Math.min(o.columnIndex,
|
|
551
|
-
return { fromX: Math.min(s,
|
|
546
|
+
const { anchorCell: e, focusCell: t } = pt(this), o = mt(e);
|
|
547
|
+
o === null && y(153);
|
|
548
|
+
const r = mt(t);
|
|
549
|
+
r === null && y(155);
|
|
550
|
+
const s = Math.min(o.columnIndex, r.columnIndex), l = Math.max(o.columnIndex + o.colSpan - 1, r.columnIndex + r.colSpan - 1), i = Math.min(o.rowIndex, r.rowIndex), u = Math.max(o.rowIndex + o.rowSpan - 1, r.rowIndex + r.rowSpan - 1);
|
|
551
|
+
return { fromX: Math.min(s, l), fromY: Math.min(i, u), toX: Math.max(s, l), toY: Math.max(i, u) };
|
|
552
552
|
}
|
|
553
553
|
getNodes() {
|
|
554
554
|
if (!this.isValid()) return [];
|
|
555
555
|
const e = this._cachedNodes;
|
|
556
556
|
if (e !== null) return e;
|
|
557
|
-
const { anchorTable: t, anchorCell: o, focusCell:
|
|
557
|
+
const { anchorTable: t, anchorCell: o, focusCell: r } = pt(this), s = r.getParents()[1];
|
|
558
558
|
if (s !== t) {
|
|
559
|
-
if (t.isParentOf(
|
|
559
|
+
if (t.isParentOf(r)) {
|
|
560
560
|
const d = s.getParent();
|
|
561
|
-
d == null &&
|
|
561
|
+
d == null && y(159), this.set(this.tableKey, r.getKey(), d.getKey());
|
|
562
562
|
} else {
|
|
563
563
|
const d = t.getParent();
|
|
564
|
-
d == null &&
|
|
564
|
+
d == null && y(158), this.set(this.tableKey, d.getKey(), r.getKey());
|
|
565
565
|
}
|
|
566
566
|
return this.getNodes();
|
|
567
567
|
}
|
|
568
|
-
const [
|
|
568
|
+
const [l, i, u] = U(t, o, r), { minColumn: m, maxColumn: h, minRow: p, maxRow: C } = Ee(l, i, u), a = /* @__PURE__ */ new Map([[t.getKey(), t]]);
|
|
569
569
|
let c = null;
|
|
570
570
|
for (let d = p; d <= C; d++) for (let g = m; g <= h; g++) {
|
|
571
|
-
const { cell: _ } =
|
|
572
|
-
|
|
571
|
+
const { cell: _ } = l[d][g], S = _.getParent();
|
|
572
|
+
A(S) || y(160), S !== c && (a.set(S.getKey(), S), c = S), a.has(_.getKey()) || Hn(_, (N) => {
|
|
573
573
|
a.set(N.getKey(), N);
|
|
574
574
|
});
|
|
575
575
|
}
|
|
@@ -580,37 +580,37 @@ class Me {
|
|
|
580
580
|
const e = this.getNodes().filter((o) => w(o));
|
|
581
581
|
let t = "";
|
|
582
582
|
for (let o = 0; o < e.length; o++) {
|
|
583
|
-
const
|
|
584
|
-
t +=
|
|
583
|
+
const r = e[o], s = r.__parent, l = (e[o + 1] || {}).__parent;
|
|
584
|
+
t += r.getTextContent() + (l !== s ? `
|
|
585
585
|
` : " ");
|
|
586
586
|
}
|
|
587
587
|
return t;
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function O(n) {
|
|
591
591
|
return n instanceof Me;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function Et() {
|
|
594
594
|
const n = Ae("root", 0, "element"), e = Ae("root", 0, "element");
|
|
595
595
|
return new Me("root", n, e);
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Pn(n, e, t) {
|
|
598
598
|
n.getKey(), e.getKey(), t.getKey();
|
|
599
|
-
const o = B(),
|
|
600
|
-
return
|
|
599
|
+
const o = B(), r = O(o) ? o.clone() : Et();
|
|
600
|
+
return r.set(n.getKey(), e.getKey(), t.getKey()), r;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Hn(n, e) {
|
|
603
603
|
const t = [[n]];
|
|
604
604
|
for (let o = t.at(-1); o !== void 0 && t.length > 0; o = t.at(-1)) {
|
|
605
|
-
const
|
|
606
|
-
|
|
605
|
+
const r = o.pop();
|
|
606
|
+
r === void 0 ? t.pop() : e(r) !== !1 && D(r) && t.push(r.getChildren());
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
const t =
|
|
611
|
-
|
|
609
|
+
function kt(n, e = xt()) {
|
|
610
|
+
const t = Oe(n);
|
|
611
|
+
$(t) || y(231, n);
|
|
612
612
|
const o = ie(t, e.getElementByKey(n));
|
|
613
|
-
return o === null &&
|
|
613
|
+
return o === null && y(232, n), { tableElement: o, tableNode: t };
|
|
614
614
|
}
|
|
615
615
|
class Bn {
|
|
616
616
|
constructor(e, t) {
|
|
@@ -623,22 +623,22 @@ class Bn {
|
|
|
623
623
|
this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach((e) => e()), this.listenersToRemove.clear();
|
|
624
624
|
}
|
|
625
625
|
$lookup() {
|
|
626
|
-
return
|
|
626
|
+
return kt(this.tableNodeKey, this.editor);
|
|
627
627
|
}
|
|
628
628
|
trackTable() {
|
|
629
629
|
const e = new MutationObserver((t) => {
|
|
630
630
|
this.editor.getEditorState().read(() => {
|
|
631
631
|
let o = !1;
|
|
632
|
-
for (let
|
|
633
|
-
const i = t[
|
|
632
|
+
for (let l = 0; l < t.length; l++) {
|
|
633
|
+
const i = t[l].target.nodeName;
|
|
634
634
|
if (i === "TABLE" || i === "TBODY" || i === "THEAD" || i === "TR") {
|
|
635
635
|
o = !0;
|
|
636
636
|
break;
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
if (!o) return;
|
|
640
|
-
const { tableNode:
|
|
641
|
-
this.table = me(
|
|
640
|
+
const { tableNode: r, tableElement: s } = this.$lookup();
|
|
641
|
+
this.table = me(r, s);
|
|
642
642
|
}, { editor: this.editor });
|
|
643
643
|
});
|
|
644
644
|
this.editor.getEditorState().read(() => {
|
|
@@ -662,7 +662,7 @@ class Bn {
|
|
|
662
662
|
}
|
|
663
663
|
$updateTableTableSelection(e) {
|
|
664
664
|
if (e !== null) {
|
|
665
|
-
e.tableKey !== this.tableNodeKey &&
|
|
665
|
+
e.tableKey !== this.tableNodeKey && y(233, e.tableKey, this.tableNodeKey);
|
|
666
666
|
const t = this.editor;
|
|
667
667
|
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), Re(t, this.table, this.tableSelection);
|
|
668
668
|
} else this.$clearHighlight();
|
|
@@ -687,79 +687,79 @@ class Bn {
|
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
$setFocusCellForSelection(e, t = !1) {
|
|
690
|
-
const o = this.editor, { tableNode:
|
|
691
|
-
if (this.focusCell = e, this.isHighlightingCells || this.anchorX === s && this.anchorY ===
|
|
692
|
-
if (s === this.focusX &&
|
|
690
|
+
const o = this.editor, { tableNode: r } = this.$lookup(), s = e.x, l = e.y;
|
|
691
|
+
if (this.focusCell = e, this.isHighlightingCells || this.anchorX === s && this.anchorY === l && !t) {
|
|
692
|
+
if (s === this.focusX && l === this.focusY) return !1;
|
|
693
693
|
} else this.isHighlightingCells = !0, this.$disableHighlightStyle();
|
|
694
|
-
if (this.focusX = s, this.focusY =
|
|
695
|
-
const i = qe(
|
|
696
|
-
if (this.tableSelection != null && this.anchorCellNodeKey != null && i !== null) return this.focusCellNodeKey = i.getKey(), this.tableSelection =
|
|
694
|
+
if (this.focusX = s, this.focusY = l, this.isHighlightingCells) {
|
|
695
|
+
const i = qe(r, e.elem);
|
|
696
|
+
if (this.tableSelection != null && this.anchorCellNodeKey != null && i !== null) return this.focusCellNodeKey = i.getKey(), this.tableSelection = Pn(r, this.$getAnchorTableCellOrThrow(), i), ne(this.tableSelection), o.dispatchCommand(fe, void 0), Re(o, this.table, this.tableSelection), !0;
|
|
697
697
|
}
|
|
698
698
|
return !1;
|
|
699
699
|
}
|
|
700
700
|
$getAnchorTableCell() {
|
|
701
|
-
return this.anchorCellNodeKey ?
|
|
701
|
+
return this.anchorCellNodeKey ? Oe(this.anchorCellNodeKey) : null;
|
|
702
702
|
}
|
|
703
703
|
$getAnchorTableCellOrThrow() {
|
|
704
704
|
const e = this.$getAnchorTableCell();
|
|
705
|
-
return e === null &&
|
|
705
|
+
return e === null && y(234), e;
|
|
706
706
|
}
|
|
707
707
|
$getFocusTableCell() {
|
|
708
|
-
return this.focusCellNodeKey ?
|
|
708
|
+
return this.focusCellNodeKey ? Oe(this.focusCellNodeKey) : null;
|
|
709
709
|
}
|
|
710
710
|
$getFocusTableCellOrThrow() {
|
|
711
711
|
const e = this.$getFocusTableCell();
|
|
712
|
-
return e === null &&
|
|
712
|
+
return e === null && y(235), e;
|
|
713
713
|
}
|
|
714
714
|
$setAnchorCellForSelection(e) {
|
|
715
715
|
this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y;
|
|
716
716
|
const { tableNode: t } = this.$lookup(), o = qe(t, e.elem);
|
|
717
717
|
if (o !== null) {
|
|
718
|
-
const
|
|
719
|
-
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() :
|
|
718
|
+
const r = o.getKey();
|
|
719
|
+
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Et(), this.anchorCellNodeKey = r;
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
$formatCells(e) {
|
|
723
723
|
const t = B();
|
|
724
|
-
|
|
725
|
-
const o = pn(),
|
|
726
|
-
|
|
727
|
-
const i =
|
|
728
|
-
|
|
729
|
-
|
|
724
|
+
O(t) || y(236);
|
|
725
|
+
const o = pn(), r = o.anchor, s = o.focus, l = t.getNodes().filter(w);
|
|
726
|
+
l.length > 0 || y(237);
|
|
727
|
+
const i = l[0].getFirstChild(), u = et(i) ? i.getFormatFlags(e, null) : null;
|
|
728
|
+
l.forEach((m) => {
|
|
729
|
+
r.set(m.getKey(), 0, "element"), s.set(m.getKey(), m.getChildrenSize(), "element"), o.formatText(e, u);
|
|
730
730
|
}), ne(t), this.editor.dispatchCommand(fe, void 0);
|
|
731
731
|
}
|
|
732
732
|
$clearText() {
|
|
733
|
-
const { editor: e } = this, t =
|
|
734
|
-
if (
|
|
733
|
+
const { editor: e } = this, t = Oe(this.tableNodeKey);
|
|
734
|
+
if (!$(t)) throw new Error("Expected TableNode.");
|
|
735
735
|
const o = B();
|
|
736
|
-
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
736
|
+
O(o) || y(253);
|
|
737
|
+
const r = o.getNodes().filter(w), s = t.getFirstChild(), l = t.getLastChild();
|
|
738
|
+
if (r.length > 0 && s !== null && l !== null && A(s) && A(l) && r[0] === s.getFirstChild() && r[r.length - 1] === l.getLastChild()) {
|
|
739
739
|
t.selectPrevious();
|
|
740
|
-
const
|
|
741
|
-
return t.remove(), void (Cn(
|
|
740
|
+
const i = t.getParent();
|
|
741
|
+
return t.remove(), void (Cn(i) && i.isEmpty() && e.dispatchCommand(Ft, void 0));
|
|
742
742
|
}
|
|
743
|
-
|
|
744
|
-
if (D(
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
743
|
+
r.forEach((i) => {
|
|
744
|
+
if (D(i)) {
|
|
745
|
+
const u = I(), m = Ge();
|
|
746
|
+
u.append(m), i.append(u), i.getChildren().forEach((h) => {
|
|
747
|
+
h !== u && h.remove();
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
}), Re(e, this.table, null), ne(null), e.dispatchCommand(fe, void 0);
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
const
|
|
753
|
+
const Ye = "__lexicalTableSelection", Dn = (n) => !(1 & ~n.buttons);
|
|
754
754
|
function de(n) {
|
|
755
|
-
return
|
|
755
|
+
return be(n) && n.nodeName === "TABLE";
|
|
756
756
|
}
|
|
757
757
|
function ie(n, e) {
|
|
758
758
|
if (!e) return e;
|
|
759
759
|
const t = de(e) ? e : n.getDOMSlot(e).element;
|
|
760
|
-
return t.nodeName !== "TABLE" &&
|
|
760
|
+
return t.nodeName !== "TABLE" && y(245, e.nodeName), t;
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function ot(n) {
|
|
763
763
|
return n._window;
|
|
764
764
|
}
|
|
765
765
|
function Ne(n, e) {
|
|
@@ -769,64 +769,64 @@ function Ne(n, e) {
|
|
|
769
769
|
}
|
|
770
770
|
return null;
|
|
771
771
|
}
|
|
772
|
-
const In = [[Gt, "down"], [en, "up"], [tn, "backward"], [nn, "forward"]],
|
|
773
|
-
function
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
const
|
|
772
|
+
const In = [[Gt, "down"], [en, "up"], [tn, "backward"], [nn, "forward"]], Jn = [rn, Rt, ln], Un = [sn, an];
|
|
773
|
+
function Xn(n, e, t, o) {
|
|
774
|
+
const r = t.getRootElement(), s = ot(t);
|
|
775
|
+
r !== null && s !== null || y(246);
|
|
776
|
+
const l = new Bn(t, n.getKey()), i = ie(n, e);
|
|
777
777
|
(function(a, c) {
|
|
778
|
-
|
|
779
|
-
})(i,
|
|
780
|
-
|
|
781
|
-
}(i,
|
|
778
|
+
Ct(a) !== null && y(205), a[Ye] = c;
|
|
779
|
+
})(i, l), l.listenersToRemove.add(() => function(a, c) {
|
|
780
|
+
Ct(a) === c && delete a[Ye];
|
|
781
|
+
}(i, l));
|
|
782
782
|
const u = (a) => {
|
|
783
|
-
if (
|
|
783
|
+
if (l.pointerType = a.pointerType, a.button !== 0 || !ye(a.target) || !s) return;
|
|
784
784
|
const c = ke(a.target);
|
|
785
785
|
c !== null && t.update(() => {
|
|
786
|
-
const f =
|
|
787
|
-
if (
|
|
786
|
+
const f = Je();
|
|
787
|
+
if (gt && a.shiftKey && Z(f, n) && (z(f) || O(f))) {
|
|
788
788
|
const d = f.anchor.getNode(), g = Ne(n, f.anchor.getNode());
|
|
789
|
-
g ? (
|
|
790
|
-
} else
|
|
789
|
+
g ? (l.$setAnchorCellForSelection(se(l, g)), l.$setFocusCellForSelection(c), te(a)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(f.anchor.key, f.anchor.offset, f.anchor.type);
|
|
790
|
+
} else l.$setAnchorCellForSelection(c);
|
|
791
791
|
}), (() => {
|
|
792
|
-
if (
|
|
792
|
+
if (l.isSelecting) return;
|
|
793
793
|
const f = () => {
|
|
794
|
-
|
|
794
|
+
l.isSelecting = !1, s.removeEventListener("pointerup", f), s.removeEventListener("pointermove", d);
|
|
795
795
|
}, d = (g) => {
|
|
796
|
-
if (!Dn(g) &&
|
|
797
|
-
if (!
|
|
796
|
+
if (!Dn(g) && l.isSelecting) return l.isSelecting = !1, s.removeEventListener("pointerup", f), void s.removeEventListener("pointermove", d);
|
|
797
|
+
if (!ye(g.target)) return;
|
|
798
798
|
let _ = null;
|
|
799
|
-
const S = !(
|
|
800
|
-
if (S) _ =
|
|
801
|
-
else for (const N of document.elementsFromPoint(g.clientX, g.clientY)) if (_ =
|
|
802
|
-
!_ ||
|
|
799
|
+
const S = !(gt || i.contains(g.target));
|
|
800
|
+
if (S) _ = _t(i, g.target);
|
|
801
|
+
else for (const N of document.elementsFromPoint(g.clientX, g.clientY)) if (_ = _t(i, N), _) break;
|
|
802
|
+
!_ || l.focusCell !== null && _.elem === l.focusCell.elem || (l.setNextFocus({ focusCell: _, override: S }), t.dispatchCommand(fe, void 0));
|
|
803
803
|
};
|
|
804
|
-
|
|
804
|
+
l.isSelecting = !0, s.addEventListener("pointerup", f, l.listenerOptions), s.addEventListener("pointermove", d, l.listenerOptions);
|
|
805
805
|
})();
|
|
806
806
|
};
|
|
807
|
-
i.addEventListener("pointerdown", u,
|
|
807
|
+
i.addEventListener("pointerdown", u, l.listenerOptions), l.listenersToRemove.add(() => {
|
|
808
808
|
i.removeEventListener("pointerdown", u);
|
|
809
809
|
});
|
|
810
810
|
const m = (a) => {
|
|
811
|
-
a.detail >= 3 &&
|
|
811
|
+
a.detail >= 3 && ye(a.target) && ke(a.target) !== null && a.preventDefault();
|
|
812
812
|
};
|
|
813
|
-
i.addEventListener("mousedown", m,
|
|
813
|
+
i.addEventListener("mousedown", m, l.listenerOptions), l.listenersToRemove.add(() => {
|
|
814
814
|
i.removeEventListener("mousedown", m);
|
|
815
815
|
});
|
|
816
816
|
const h = (a) => {
|
|
817
817
|
const c = a.target;
|
|
818
|
-
a.button === 0 &&
|
|
818
|
+
a.button === 0 && ye(c) && t.update(() => {
|
|
819
819
|
const f = B();
|
|
820
|
-
|
|
820
|
+
O(f) && f.tableKey === l.tableNodeKey && r.contains(c) && l.$clearHighlight();
|
|
821
821
|
});
|
|
822
822
|
};
|
|
823
|
-
s.addEventListener("pointerdown", h,
|
|
823
|
+
s.addEventListener("pointerdown", h, l.listenerOptions), l.listenersToRemove.add(() => {
|
|
824
824
|
s.removeEventListener("pointerdown", h);
|
|
825
825
|
});
|
|
826
|
-
for (const [a, c] of In)
|
|
827
|
-
|
|
826
|
+
for (const [a, c] of In) l.listenersToRemove.add(t.registerCommand(a, (f) => Lt(t, f, c, n, l), De));
|
|
827
|
+
l.listenersToRemove.add(t.registerCommand(on, (a) => {
|
|
828
828
|
const c = B();
|
|
829
|
-
if (
|
|
829
|
+
if (O(c)) {
|
|
830
830
|
const f = Ne(n, c.focus.getNode());
|
|
831
831
|
if (f !== null) return te(a), f.selectEnd(), !0;
|
|
832
832
|
}
|
|
@@ -835,141 +835,141 @@ function Yn(n, e, t, o) {
|
|
|
835
835
|
const p = (a) => () => {
|
|
836
836
|
const c = B();
|
|
837
837
|
if (!Z(c, n)) return !1;
|
|
838
|
-
if (
|
|
838
|
+
if (O(c)) return l.$clearText(), !0;
|
|
839
839
|
if (z(c)) {
|
|
840
840
|
if (!w(Ne(n, c.anchor.getNode()))) return !1;
|
|
841
841
|
const f = c.anchor.getNode(), d = c.focus.getNode(), g = n.isParentOf(f), _ = n.isParentOf(d);
|
|
842
|
-
if (g && !_ || _ && !g) return
|
|
843
|
-
const S = x(c.anchor.getNode(), (
|
|
842
|
+
if (g && !_ || _ && !g) return l.$clearText(), !0;
|
|
843
|
+
const S = x(c.anchor.getNode(), (b) => D(b)), N = S && x(S, (b) => D(b) && w(b.getParent()));
|
|
844
844
|
if (!D(N) || !D(S)) return !1;
|
|
845
|
-
if (a ===
|
|
845
|
+
if (a === Rt && N.getPreviousSibling() === null) return !0;
|
|
846
846
|
}
|
|
847
847
|
return !1;
|
|
848
848
|
};
|
|
849
|
-
for (const a of
|
|
849
|
+
for (const a of Jn) l.listenersToRemove.add(t.registerCommand(a, p(a), V));
|
|
850
850
|
const C = (a) => {
|
|
851
851
|
const c = B();
|
|
852
|
-
if (!
|
|
852
|
+
if (!O(c) && !z(c)) return !1;
|
|
853
853
|
const f = n.isParentOf(c.anchor.getNode());
|
|
854
854
|
if (f !== n.isParentOf(c.focus.getNode())) {
|
|
855
855
|
const d = f ? "anchor" : "focus", g = f ? "focus" : "anchor", { key: _, offset: S, type: N } = c[g];
|
|
856
856
|
return n[c[d].isBefore(c[g]) ? "selectPrevious" : "selectNext"]()[g].set(_, S, N), !1;
|
|
857
857
|
}
|
|
858
|
-
return !!Z(c, n) && !!
|
|
858
|
+
return !!Z(c, n) && !!O(c) && (a && (a.preventDefault(), a.stopPropagation()), l.$clearText(), !0);
|
|
859
859
|
};
|
|
860
|
-
for (const a of
|
|
861
|
-
return
|
|
860
|
+
for (const a of Un) l.listenersToRemove.add(t.registerCommand(a, C, V));
|
|
861
|
+
return l.listenersToRemove.add(t.registerCommand(cn, (a) => {
|
|
862
862
|
const c = B();
|
|
863
863
|
if (c) {
|
|
864
|
-
if (!
|
|
864
|
+
if (!O(c) && !z(c)) return !1;
|
|
865
865
|
Rn(t, qt(a, ClipboardEvent) ? a : null, Fn(c));
|
|
866
866
|
const f = C(a);
|
|
867
867
|
return z(c) ? (c.removeText(), !0) : f;
|
|
868
868
|
}
|
|
869
869
|
return !1;
|
|
870
|
-
}, V)),
|
|
870
|
+
}, V)), l.listenersToRemove.add(t.registerCommand(un, (a) => {
|
|
871
871
|
const c = B();
|
|
872
872
|
if (!Z(c, n)) return !1;
|
|
873
|
-
if (
|
|
873
|
+
if (O(c)) return l.$formatCells(a), !0;
|
|
874
874
|
if (z(c)) {
|
|
875
875
|
const f = x(c.anchor.getNode(), (d) => w(d));
|
|
876
876
|
if (!w(f)) return !1;
|
|
877
877
|
}
|
|
878
878
|
return !1;
|
|
879
|
-
}, V)),
|
|
879
|
+
}, V)), l.listenersToRemove.add(t.registerCommand(hn, (a) => {
|
|
880
880
|
const c = B();
|
|
881
|
-
if (!
|
|
881
|
+
if (!O(c) || !Z(c, n)) return !1;
|
|
882
882
|
const f = c.anchor.getNode(), d = c.focus.getNode();
|
|
883
883
|
if (!w(f) || !w(d)) return !1;
|
|
884
|
-
if (function(
|
|
885
|
-
if (K
|
|
886
|
-
const R =
|
|
887
|
-
if (
|
|
888
|
-
const [L] =
|
|
889
|
-
return R.getKey() === L[0][0].cell.getKey() &&
|
|
884
|
+
if (function(K, E) {
|
|
885
|
+
if (O(K)) {
|
|
886
|
+
const R = K.anchor.getNode(), k = K.focus.getNode();
|
|
887
|
+
if (E && R && k) {
|
|
888
|
+
const [L] = U(E, R, k);
|
|
889
|
+
return R.getKey() === L[0][0].cell.getKey() && k.getKey() === L[L.length - 1].at(-1).cell.getKey();
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
return !1;
|
|
893
893
|
}(c, n)) return n.setFormat(a), !0;
|
|
894
|
-
const [g, _, S] =
|
|
895
|
-
for (let
|
|
896
|
-
const R = g[
|
|
894
|
+
const [g, _, S] = U(n, f, d), N = Math.max(_.startRow + _.cell.__rowSpan - 1, S.startRow + S.cell.__rowSpan - 1), b = Math.max(_.startColumn + _.cell.__colSpan - 1, S.startColumn + S.cell.__colSpan - 1), T = Math.min(_.startRow, S.startRow), F = Math.min(_.startColumn, S.startColumn), M = /* @__PURE__ */ new Set();
|
|
895
|
+
for (let K = T; K <= N; K++) for (let E = F; E <= b; E++) {
|
|
896
|
+
const R = g[K][E].cell;
|
|
897
897
|
if (M.has(R)) continue;
|
|
898
898
|
M.add(R), R.setFormat(a);
|
|
899
|
-
const
|
|
900
|
-
for (let L = 0; L <
|
|
901
|
-
const
|
|
902
|
-
D(
|
|
899
|
+
const k = R.getChildren();
|
|
900
|
+
for (let L = 0; L < k.length; L++) {
|
|
901
|
+
const P = k[L];
|
|
902
|
+
D(P) && !P.isInline() && P.setFormat(a);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
return !0;
|
|
906
|
-
}, V)),
|
|
906
|
+
}, V)), l.listenersToRemove.add(t.registerCommand(dn, (a) => {
|
|
907
907
|
const c = B();
|
|
908
908
|
if (!Z(c, n)) return !1;
|
|
909
|
-
if (
|
|
909
|
+
if (O(c)) return l.$clearHighlight(), !1;
|
|
910
910
|
if (z(c)) {
|
|
911
911
|
const f = x(c.anchor.getNode(), (d) => w(d));
|
|
912
912
|
if (!w(f)) return !1;
|
|
913
913
|
if (typeof a == "string") {
|
|
914
|
-
const d =
|
|
915
|
-
if (d) return
|
|
914
|
+
const d = yt(t, c, n);
|
|
915
|
+
if (d) return wt(d, n, [Ge(a)]), !0;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
return !1;
|
|
919
|
-
}, V)), o &&
|
|
919
|
+
}, V)), o && l.listenersToRemove.add(t.registerCommand(fn, (a) => {
|
|
920
920
|
const c = B();
|
|
921
921
|
if (!z(c) || !c.isCollapsed() || !Z(c, n)) return !1;
|
|
922
922
|
const f = we(c.anchor.getNode());
|
|
923
923
|
return !(f === null || !n.is(pe(f))) && (te(a), function(d, g) {
|
|
924
924
|
const _ = g === "next" ? "getNextSibling" : "getPreviousSibling", S = g === "next" ? "getFirstChild" : "getLastChild", N = d[_]();
|
|
925
925
|
if (D(N)) return N.selectEnd();
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
for (let F =
|
|
926
|
+
const b = x(d, A);
|
|
927
|
+
b === null && y(247);
|
|
928
|
+
for (let F = b[_](); A(F); F = F[_]()) {
|
|
929
929
|
const M = F[S]();
|
|
930
930
|
if (D(M)) return M.selectEnd();
|
|
931
931
|
}
|
|
932
|
-
const T = x(
|
|
933
|
-
T === null &&
|
|
932
|
+
const T = x(b, $);
|
|
933
|
+
T === null && y(248), g === "next" ? T.selectNext() : T.selectPrevious();
|
|
934
934
|
}(f, a.shiftKey ? "previous" : "next"), !0);
|
|
935
|
-
}, V)),
|
|
936
|
-
const { nodes: c, selection: f } = a, d = f.getStartEndPoints(), g =
|
|
937
|
-
if (c.length !== 1 ||
|
|
938
|
-
const [S, N] = d, [
|
|
939
|
-
if (!(w(
|
|
940
|
-
const
|
|
941
|
-
let
|
|
935
|
+
}, V)), l.listenersToRemove.add(t.registerCommand(gn, (a) => n.isSelected(), De)), l.listenersToRemove.add(t.registerCommand(Tt, (a) => {
|
|
936
|
+
const { nodes: c, selection: f } = a, d = f.getStartEndPoints(), g = O(f), _ = z(f) && x(f.anchor.getNode(), (v) => w(v)) !== null && x(f.focus.getNode(), (v) => w(v)) !== null || g;
|
|
937
|
+
if (c.length !== 1 || !$(c[0]) || !_ || d === null) return !1;
|
|
938
|
+
const [S, N] = d, [b, T, F] = G(S), M = x(N.getNode(), (v) => w(v));
|
|
939
|
+
if (!(w(b) && w(M) && A(T) && $(F))) return !1;
|
|
940
|
+
const K = c[0], [E, R, k] = U(F, b, M), [L] = oe(K, null, null), P = E.length, le = P > 0 ? E[0].length : 0;
|
|
941
|
+
let Y = R.startRow, q = R.startColumn, H = L.length, ue = H > 0 ? L[0].length : 0;
|
|
942
942
|
if (g) {
|
|
943
|
-
const v = Ee(
|
|
944
|
-
|
|
943
|
+
const v = Ee(E, R, k), J = v.maxRow - v.minRow + 1, j = v.maxColumn - v.minColumn + 1;
|
|
944
|
+
Y = v.minRow, q = v.minColumn, H = Math.min(H, J), ue = Math.min(ue, j);
|
|
945
945
|
}
|
|
946
946
|
let Le = !1;
|
|
947
|
-
const zt = Math.min(
|
|
948
|
-
for (let v =
|
|
949
|
-
const j =
|
|
950
|
-
|
|
947
|
+
const zt = Math.min(P, Y + H) - 1, Wt = Math.min(le, q + ue) - 1, st = /* @__PURE__ */ new Set();
|
|
948
|
+
for (let v = Y; v <= zt; v++) for (let J = q; J <= Wt; J++) {
|
|
949
|
+
const j = E[v][J];
|
|
950
|
+
st.has(j.cell.getKey()) || j.cell.__rowSpan === 1 && j.cell.__colSpan === 1 || (Wn(j.cell), st.add(j.cell.getKey()), Le = !0);
|
|
951
951
|
}
|
|
952
952
|
let [_e] = oe(F.getWritable(), null, null);
|
|
953
|
-
const
|
|
954
|
-
for (let v = 0; v < Ht; v++)
|
|
955
|
-
kn(_e[H - 1][0].cell);
|
|
956
|
-
const Pt = ue - le + q;
|
|
953
|
+
const Pt = H - P + Y;
|
|
957
954
|
for (let v = 0; v < Pt; v++)
|
|
955
|
+
kn(_e[P - 1][0].cell);
|
|
956
|
+
const Ht = ue - le + q;
|
|
957
|
+
for (let v = 0; v < Ht; v++)
|
|
958
958
|
$n(_e[0][le - 1].cell, !0, !1);
|
|
959
959
|
[_e] = oe(F.getWritable(), null, null);
|
|
960
|
-
for (let v =
|
|
961
|
-
const j = v -
|
|
962
|
-
if (ze.startRow !== j || ze.startColumn !==
|
|
960
|
+
for (let v = Y; v < Y + H; v++) for (let J = q; J < q + ue; J++) {
|
|
961
|
+
const j = v - Y, it = J - q, ze = L[j][it];
|
|
962
|
+
if (ze.startRow !== j || ze.startColumn !== it) continue;
|
|
963
963
|
const Se = ze.cell;
|
|
964
964
|
if (Se.__rowSpan !== 1 || Se.__colSpan !== 1) {
|
|
965
|
-
const ee = [], Dt = Math.min(v + Se.__rowSpan,
|
|
966
|
-
for (let
|
|
967
|
-
const
|
|
968
|
-
ee.push(
|
|
965
|
+
const ee = [], Dt = Math.min(v + Se.__rowSpan, Y + H) - 1, It = Math.min(J + Se.__colSpan, q + ue) - 1;
|
|
966
|
+
for (let Pe = v; Pe <= Dt; Pe++) for (let He = J; He <= It; He++) {
|
|
967
|
+
const Jt = _e[Pe][He];
|
|
968
|
+
ee.push(Jt.cell);
|
|
969
969
|
}
|
|
970
970
|
Ln(ee), Le = !0;
|
|
971
971
|
}
|
|
972
|
-
const { cell: We } = _e[v][
|
|
972
|
+
const { cell: We } = _e[v][J], Bt = We.getChildren();
|
|
973
973
|
Se.getChildren().forEach((ee) => {
|
|
974
974
|
Ce(ee) && I().append(ee), We.append(ee);
|
|
975
975
|
}), Bt.forEach((ee) => ee.remove());
|
|
@@ -979,61 +979,61 @@ function Yn(n, e, t, o) {
|
|
|
979
979
|
v[R.startRow][R.startColumn].cell.selectEnd();
|
|
980
980
|
}
|
|
981
981
|
return !0;
|
|
982
|
-
}, V)),
|
|
983
|
-
const a = B(), c =
|
|
982
|
+
}, V)), l.listenersToRemove.add(t.registerCommand(fe, () => {
|
|
983
|
+
const a = B(), c = Je(), f = l.getAndClearNextFocus();
|
|
984
984
|
if (f !== null) {
|
|
985
985
|
const { focusCell: d } = f;
|
|
986
|
-
if (
|
|
987
|
-
if (d !==
|
|
986
|
+
if (O(a) && a.tableKey === l.tableNodeKey) return (d.x !== l.focusX || d.y !== l.focusY) && (l.$setFocusCellForSelection(d), !0);
|
|
987
|
+
if (d !== l.anchorCell && Z(a, n)) return l.$setFocusCellForSelection(d), !0;
|
|
988
988
|
}
|
|
989
|
-
if (
|
|
989
|
+
if (l.getAndClearShouldCheckSelection() && z(c) && z(a) && a.isCollapsed()) {
|
|
990
990
|
const d = a.anchor.getNode(), g = n.getFirstChild(), _ = we(d);
|
|
991
|
-
if (_ !== null &&
|
|
991
|
+
if (_ !== null && A(g)) {
|
|
992
992
|
const S = g.getFirstChild();
|
|
993
993
|
if (w(S) && n.is(x(_, (N) => N.is(n) || N.is(S)))) return S.selectStart(), !0;
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
if (z(a)) {
|
|
997
|
-
const { anchor: d, focus: g } = a, _ = d.getNode(), S = g.getNode(), N = we(_),
|
|
997
|
+
const { anchor: d, focus: g } = a, _ = d.getNode(), S = g.getNode(), N = we(_), b = we(S), T = !(!N || !n.is(pe(N))), F = !(!b || !n.is(pe(b))), M = T !== F, K = T && F, E = a.isBackward();
|
|
998
998
|
if (M) {
|
|
999
999
|
const R = a.clone();
|
|
1000
1000
|
if (F) {
|
|
1001
|
-
const [
|
|
1002
|
-
R.focus.set(
|
|
1001
|
+
const [k] = U(n, b, b), L = k[0][0].cell, P = k[k.length - 1].at(-1).cell;
|
|
1002
|
+
R.focus.set(E ? L.getKey() : P.getKey(), E ? L.getChildrenSize() : P.getChildrenSize(), "element");
|
|
1003
1003
|
} else if (T) {
|
|
1004
|
-
const [
|
|
1005
|
-
R.anchor.set(
|
|
1004
|
+
const [k] = U(n, N, N), L = k[0][0].cell, P = k[k.length - 1].at(-1).cell;
|
|
1005
|
+
R.anchor.set(E ? P.getKey() : L.getKey(), E ? P.getChildrenSize() : 0, "element");
|
|
1006
1006
|
}
|
|
1007
|
-
ne(R),
|
|
1008
|
-
} else if (
|
|
1007
|
+
ne(R), St(t, l);
|
|
1008
|
+
} else if (K && (N.is(b) || (l.$setAnchorCellForSelection(se(l, N)), l.$setFocusCellForSelection(se(l, b), !0)), l.pointerType === "touch" && a.isCollapsed() && z(c) && c.isCollapsed())) {
|
|
1009
1009
|
const R = we(c.anchor.getNode());
|
|
1010
|
-
R && !R.is(
|
|
1010
|
+
R && !R.is(b) && (l.$setAnchorCellForSelection(se(l, R)), l.$setFocusCellForSelection(se(l, b), !0), l.pointerType = null);
|
|
1011
1011
|
}
|
|
1012
|
-
} else if (a &&
|
|
1012
|
+
} else if (a && O(a) && a.is(c) && a.tableKey === n.getKey()) {
|
|
1013
1013
|
const d = $e(s);
|
|
1014
1014
|
if (d && d.anchorNode && d.focusNode) {
|
|
1015
1015
|
const g = re(d.focusNode), _ = g && !n.isParentOf(g), S = re(d.anchorNode), N = S && n.isParentOf(S);
|
|
1016
1016
|
if (_ && N && d.rangeCount > 0) {
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1017
|
+
const b = mn(d, t);
|
|
1018
|
+
b && (b.anchor.set(n.getKey(), a.isBackward() ? n.getChildrenSize() : 0, "element"), d.removeAllRanges(), ne(b));
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
|
-
return a && !a.is(c) && (
|
|
1023
|
-
g.$enableHighlightStyle(),
|
|
1022
|
+
return a && !a.is(c) && (O(a) || O(c)) && l.tableSelection && !l.tableSelection.is(c) ? (O(a) && a.tableKey === l.tableNodeKey ? l.$updateTableTableSelection(a) : !O(a) && O(c) && c.tableKey === l.tableNodeKey && l.$updateTableTableSelection(null), !1) : (l.hasHijackedSelectionStyles && !n.isSelected() ? function(d, g) {
|
|
1023
|
+
g.$enableHighlightStyle(), rt(g.table, (_) => {
|
|
1024
1024
|
const S = _.elem;
|
|
1025
|
-
_.highlighted = !1,
|
|
1025
|
+
_.highlighted = !1, Mt(d, _), S.getAttribute("style") || S.removeAttribute("style");
|
|
1026
1026
|
});
|
|
1027
|
-
}(t,
|
|
1028
|
-
}, V)),
|
|
1027
|
+
}(t, l) : !l.hasHijackedSelectionStyles && n.isSelected() && St(t, l), !1);
|
|
1028
|
+
}, V)), l.listenersToRemove.add(t.registerCommand(Ft, () => {
|
|
1029
1029
|
const a = B();
|
|
1030
1030
|
if (!z(a) || !a.isCollapsed() || !Z(a, n)) return !1;
|
|
1031
|
-
const c =
|
|
1032
|
-
return !!c && (
|
|
1033
|
-
}, V)),
|
|
1031
|
+
const c = yt(t, a, n);
|
|
1032
|
+
return !!c && (wt(c, n), !0);
|
|
1033
|
+
}, V)), l;
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1036
|
-
return n[
|
|
1035
|
+
function Ct(n) {
|
|
1036
|
+
return n[Ye] || null;
|
|
1037
1037
|
}
|
|
1038
1038
|
function ke(n) {
|
|
1039
1039
|
let e = n;
|
|
@@ -1047,81 +1047,81 @@ function ke(n) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
return null;
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1050
|
+
function _t(n, e) {
|
|
1051
1051
|
if (!n.contains(e)) return null;
|
|
1052
1052
|
let t = null;
|
|
1053
1053
|
for (let o = e; o != null; o = o.parentNode) {
|
|
1054
1054
|
if (o === n) return t;
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1055
|
+
const r = o.nodeName;
|
|
1056
|
+
r !== "TD" && r !== "TH" || (t = o._cell || null);
|
|
1057
1057
|
}
|
|
1058
1058
|
return null;
|
|
1059
1059
|
}
|
|
1060
1060
|
function me(n, e) {
|
|
1061
1061
|
const t = [], o = { columns: 0, domRows: t, rows: 0 };
|
|
1062
|
-
let
|
|
1063
|
-
for (t.length = 0;
|
|
1064
|
-
const i =
|
|
1062
|
+
let r = ie(n, e).querySelector("tr"), s = 0, l = 0;
|
|
1063
|
+
for (t.length = 0; r != null; ) {
|
|
1064
|
+
const i = r.nodeName;
|
|
1065
1065
|
if (i === "TD" || i === "TH") {
|
|
1066
|
-
const h = { elem:
|
|
1067
|
-
|
|
1068
|
-
let p = t[
|
|
1069
|
-
p === void 0 && (p = t[
|
|
1066
|
+
const h = { elem: r, hasBackgroundColor: r.style.backgroundColor !== "", highlighted: !1, x: s, y: l };
|
|
1067
|
+
r._cell = h;
|
|
1068
|
+
let p = t[l];
|
|
1069
|
+
p === void 0 && (p = t[l] = []), p[s] = h;
|
|
1070
1070
|
} else {
|
|
1071
|
-
const h =
|
|
1071
|
+
const h = r.firstChild;
|
|
1072
1072
|
if (h != null) {
|
|
1073
|
-
|
|
1073
|
+
r = h;
|
|
1074
1074
|
continue;
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
const u =
|
|
1077
|
+
const u = r.nextSibling;
|
|
1078
1078
|
if (u != null) {
|
|
1079
|
-
s++,
|
|
1079
|
+
s++, r = u;
|
|
1080
1080
|
continue;
|
|
1081
1081
|
}
|
|
1082
|
-
const m =
|
|
1082
|
+
const m = r.parentNode;
|
|
1083
1083
|
if (m != null) {
|
|
1084
1084
|
const h = m.nextSibling;
|
|
1085
1085
|
if (h == null) break;
|
|
1086
|
-
|
|
1086
|
+
l++, s = 0, r = h;
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
|
-
return o.columns = s + 1, o.rows =
|
|
1089
|
+
return o.columns = s + 1, o.rows = l + 1, o;
|
|
1090
1090
|
}
|
|
1091
1091
|
function Re(n, e, t) {
|
|
1092
1092
|
const o = new Set(t ? t.getNodes() : []);
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1095
|
-
o.has(s) ? (
|
|
1093
|
+
rt(e, (r, s) => {
|
|
1094
|
+
const l = r.elem;
|
|
1095
|
+
o.has(s) ? (r.highlighted = !0, $t(n, r)) : (r.highlighted = !1, Mt(n, r), l.getAttribute("style") || l.removeAttribute("style"));
|
|
1096
1096
|
});
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1098
|
+
function rt(n, e) {
|
|
1099
1099
|
const { domRows: t } = n;
|
|
1100
1100
|
for (let o = 0; o < t.length; o++) {
|
|
1101
|
-
const
|
|
1102
|
-
if (
|
|
1103
|
-
const
|
|
1104
|
-
if (!
|
|
1105
|
-
const i = re(
|
|
1106
|
-
i !== null && e(
|
|
1101
|
+
const r = t[o];
|
|
1102
|
+
if (r) for (let s = 0; s < r.length; s++) {
|
|
1103
|
+
const l = r[s];
|
|
1104
|
+
if (!l) continue;
|
|
1105
|
+
const i = re(l.elem);
|
|
1106
|
+
i !== null && e(l, i, { x: s, y: o });
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1111
|
-
e.$disableHighlightStyle(),
|
|
1112
|
-
t.highlighted = !0,
|
|
1110
|
+
function St(n, e) {
|
|
1111
|
+
e.$disableHighlightStyle(), rt(e.table, (t) => {
|
|
1112
|
+
t.highlighted = !0, $t(n, t);
|
|
1113
1113
|
});
|
|
1114
1114
|
}
|
|
1115
|
-
const
|
|
1116
|
-
const s =
|
|
1117
|
-
switch (
|
|
1115
|
+
const Yn = (n, e, t, o, r) => {
|
|
1116
|
+
const s = r === "forward";
|
|
1117
|
+
switch (r) {
|
|
1118
1118
|
case "backward":
|
|
1119
1119
|
case "forward":
|
|
1120
|
-
return t !== (s ? n.table.columns - 1 : 0) ?
|
|
1120
|
+
return t !== (s ? n.table.columns - 1 : 0) ? Ke(e.getCellNodeFromCordsOrThrow(t + (s ? 1 : -1), o, n.table), s) : o !== (s ? n.table.rows - 1 : 0) ? Ke(e.getCellNodeFromCordsOrThrow(s ? 0 : n.table.columns - 1, o + (s ? 1 : -1), n.table), s) : s ? e.selectNext() : e.selectPrevious(), !0;
|
|
1121
1121
|
case "up":
|
|
1122
|
-
return o !== 0 ?
|
|
1122
|
+
return o !== 0 ? Ke(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
|
|
1123
1123
|
case "down":
|
|
1124
|
-
return o !== n.table.rows - 1 ?
|
|
1124
|
+
return o !== n.table.rows - 1 ? Ke(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
|
|
1125
1125
|
default:
|
|
1126
1126
|
return !1;
|
|
1127
1127
|
}
|
|
@@ -1144,56 +1144,56 @@ function Fe([n, e]) {
|
|
|
1144
1144
|
return [n === "minColumn" ? "maxColumn" : "minColumn", e === "minRow" ? "maxRow" : "minRow"];
|
|
1145
1145
|
}
|
|
1146
1146
|
function he(n, e, [t, o]) {
|
|
1147
|
-
const
|
|
1148
|
-
s === void 0 &&
|
|
1149
|
-
const
|
|
1150
|
-
return i === void 0 &&
|
|
1151
|
-
}
|
|
1152
|
-
function qn(n, e, t, o,
|
|
1153
|
-
const s = Ee(e, t, o),
|
|
1154
|
-
const { minColumn: M, maxColumn:
|
|
1155
|
-
let
|
|
1156
|
-
const
|
|
1157
|
-
for (let
|
|
1158
|
-
for (let
|
|
1159
|
-
return { bottomSpan: le, leftSpan: L, rightSpan:
|
|
1160
|
-
}(e, s), { topSpan: i, leftSpan: u, bottomSpan: m, rightSpan: h } =
|
|
1147
|
+
const r = e[o], s = n[r];
|
|
1148
|
+
s === void 0 && y(250, o, String(r));
|
|
1149
|
+
const l = e[t], i = s[l];
|
|
1150
|
+
return i === void 0 && y(250, t, String(l)), i;
|
|
1151
|
+
}
|
|
1152
|
+
function qn(n, e, t, o, r) {
|
|
1153
|
+
const s = Ee(e, t, o), l = function(T, F) {
|
|
1154
|
+
const { minColumn: M, maxColumn: K, minRow: E, maxRow: R } = F;
|
|
1155
|
+
let k = 1, L = 1, P = 1, le = 1;
|
|
1156
|
+
const Y = T[E], q = T[R];
|
|
1157
|
+
for (let H = M; H <= K; H++) k = Math.max(k, Y[H].cell.__rowSpan), le = Math.max(le, q[H].cell.__rowSpan);
|
|
1158
|
+
for (let H = E; H <= R; H++) L = Math.max(L, T[H][M].cell.__colSpan), P = Math.max(P, T[H][K].cell.__colSpan);
|
|
1159
|
+
return { bottomSpan: le, leftSpan: L, rightSpan: P, topSpan: k };
|
|
1160
|
+
}(e, s), { topSpan: i, leftSpan: u, bottomSpan: m, rightSpan: h } = l, p = function(T, F) {
|
|
1161
1161
|
const M = Ie(T, F);
|
|
1162
|
-
return M === null &&
|
|
1162
|
+
return M === null && y(249, F.cell.getKey()), M;
|
|
1163
1163
|
}(s, t), [C, a] = Fe(p);
|
|
1164
1164
|
let c = s[C], f = s[a];
|
|
1165
|
-
|
|
1165
|
+
r === "forward" ? c += C === "maxColumn" ? 1 : u : r === "backward" ? c -= C === "minColumn" ? 1 : h : r === "down" ? f += a === "maxRow" ? 1 : i : r === "up" && (f -= a === "minRow" ? 1 : m);
|
|
1166
1166
|
const d = e[f];
|
|
1167
1167
|
if (d === void 0) return !1;
|
|
1168
1168
|
const g = d[c];
|
|
1169
1169
|
if (g === void 0) return !1;
|
|
1170
1170
|
const [_, S] = function(T, F, M) {
|
|
1171
|
-
const
|
|
1172
|
-
if (
|
|
1173
|
-
const R = Ie(
|
|
1174
|
-
if (R) return [he(T,
|
|
1175
|
-
const
|
|
1176
|
-
return [he(T,
|
|
1177
|
-
}(e, t, g), N = se(n, _.cell),
|
|
1178
|
-
return n.$setAnchorCellForSelection(N), n.$setFocusCellForSelection(
|
|
1171
|
+
const K = Ee(T, F, M), E = Ie(K, F);
|
|
1172
|
+
if (E) return [he(T, K, E), he(T, K, Fe(E))];
|
|
1173
|
+
const R = Ie(K, M);
|
|
1174
|
+
if (R) return [he(T, K, Fe(R)), he(T, K, R)];
|
|
1175
|
+
const k = ["minColumn", "minRow"];
|
|
1176
|
+
return [he(T, K, k), he(T, K, Fe(k))];
|
|
1177
|
+
}(e, t, g), N = se(n, _.cell), b = se(n, S.cell);
|
|
1178
|
+
return n.$setAnchorCellForSelection(N), n.$setFocusCellForSelection(b, !0), !0;
|
|
1179
1179
|
}
|
|
1180
1180
|
function Z(n, e) {
|
|
1181
|
-
if (z(n) ||
|
|
1181
|
+
if (z(n) || O(n)) {
|
|
1182
1182
|
const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
|
|
1183
1183
|
return t && o;
|
|
1184
1184
|
}
|
|
1185
1185
|
return !1;
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1187
|
+
function Ke(n, e) {
|
|
1188
1188
|
e ? n.selectStart() : n.selectEnd();
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1190
|
+
function $t(n, e) {
|
|
1191
1191
|
const t = e.elem, o = n._config.theme;
|
|
1192
|
-
w(re(t)) ||
|
|
1192
|
+
w(re(t)) || y(131), Q(t, o.tableCellSelected);
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function Mt(n, e) {
|
|
1195
1195
|
const t = e.elem;
|
|
1196
|
-
w(re(t)) ||
|
|
1196
|
+
w(re(t)) || y(131);
|
|
1197
1197
|
const o = n._config.theme;
|
|
1198
1198
|
ge(t, o.tableCellSelected);
|
|
1199
1199
|
}
|
|
@@ -1202,53 +1202,53 @@ function we(n) {
|
|
|
1202
1202
|
return w(e) ? e : null;
|
|
1203
1203
|
}
|
|
1204
1204
|
function pe(n) {
|
|
1205
|
-
const e = x(n,
|
|
1206
|
-
return
|
|
1205
|
+
const e = x(n, $);
|
|
1206
|
+
return $(e) ? e : null;
|
|
1207
1207
|
}
|
|
1208
|
-
function jn(n, e, t, o,
|
|
1209
|
-
const i = Sn(t.focus,
|
|
1208
|
+
function jn(n, e, t, o, r, s, l) {
|
|
1209
|
+
const i = Sn(t.focus, r ? "previous" : "next");
|
|
1210
1210
|
if (wn(i)) return !1;
|
|
1211
1211
|
let u = i;
|
|
1212
|
-
for (const d of
|
|
1213
|
-
if (!
|
|
1212
|
+
for (const d of ct(i).iterNodeCarets("shadowRoot")) {
|
|
1213
|
+
if (!yn(d) || !D(d.origin)) return !1;
|
|
1214
1214
|
u = d;
|
|
1215
1215
|
}
|
|
1216
1216
|
const m = u.getParentAtCaret();
|
|
1217
1217
|
if (!w(m)) return !1;
|
|
1218
1218
|
const h = m, p = function(d) {
|
|
1219
|
-
for (const g of
|
|
1219
|
+
for (const g of ct(d).iterNodeCarets("root")) {
|
|
1220
1220
|
const { origin: _ } = g;
|
|
1221
1221
|
if (w(_)) {
|
|
1222
|
-
if (
|
|
1223
|
-
} else if (
|
|
1222
|
+
if (ut(g)) return bn(_, d.direction);
|
|
1223
|
+
} else if (!A(_)) break;
|
|
1224
1224
|
}
|
|
1225
1225
|
return null;
|
|
1226
|
-
}(
|
|
1226
|
+
}(ht(h, u.direction)), C = x(h, $);
|
|
1227
1227
|
if (!C || !C.is(s)) return !1;
|
|
1228
1228
|
const a = n.getElementByKey(h.getKey()), c = ke(a);
|
|
1229
1229
|
if (!a || !c) return !1;
|
|
1230
1230
|
const f = Vn(n, C);
|
|
1231
|
-
if (
|
|
1231
|
+
if (l.table = f, p) if (o === "extend") {
|
|
1232
1232
|
const d = ke(n.getElementByKey(p.origin.getKey()));
|
|
1233
1233
|
if (!d) return !1;
|
|
1234
|
-
|
|
1234
|
+
l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(d, !0);
|
|
1235
1235
|
} else {
|
|
1236
|
-
const d =
|
|
1236
|
+
const d = dt(p);
|
|
1237
1237
|
Te(t.anchor, d), Te(t.focus, d);
|
|
1238
1238
|
}
|
|
1239
|
-
else if (o === "extend")
|
|
1239
|
+
else if (o === "extend") l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(c, !0);
|
|
1240
1240
|
else {
|
|
1241
1241
|
const d = function(g) {
|
|
1242
1242
|
const _ = Nn(g);
|
|
1243
|
-
return
|
|
1244
|
-
}(
|
|
1243
|
+
return ut(_) ? dt(_) : g;
|
|
1244
|
+
}(ht(C, i.direction));
|
|
1245
1245
|
Te(t.anchor, d), Te(t.focus, d);
|
|
1246
1246
|
}
|
|
1247
1247
|
return te(e), !0;
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1250
|
-
if ((t === "up" || t === "down") && function(
|
|
1251
|
-
const i =
|
|
1249
|
+
function Lt(n, e, t, o, r) {
|
|
1250
|
+
if ((t === "up" || t === "down") && function(l) {
|
|
1251
|
+
const i = l.getRootElement();
|
|
1252
1252
|
return i ? i.hasAttribute("aria-controls") && i.getAttribute("aria-controls") === "typeahead-menu" : !1;
|
|
1253
1253
|
}(n)) return !1;
|
|
1254
1254
|
const s = B();
|
|
@@ -1256,22 +1256,22 @@ function Mt(n, e, t, o, l) {
|
|
|
1256
1256
|
if (z(s)) {
|
|
1257
1257
|
if (t === "backward") {
|
|
1258
1258
|
if (s.focus.offset > 0) return !1;
|
|
1259
|
-
const
|
|
1259
|
+
const l = function(u) {
|
|
1260
1260
|
for (let m = u, h = u; h !== null; m = h, h = h.getParent()) if (D(h)) {
|
|
1261
1261
|
if (h !== m && h.getFirstChild() !== m) return null;
|
|
1262
1262
|
if (!h.isInline()) return h;
|
|
1263
1263
|
}
|
|
1264
1264
|
return null;
|
|
1265
1265
|
}(s.focus.getNode());
|
|
1266
|
-
if (!
|
|
1267
|
-
const i =
|
|
1268
|
-
return
|
|
1266
|
+
if (!l) return !1;
|
|
1267
|
+
const i = l.getPreviousSibling();
|
|
1268
|
+
return !!$(i) && (te(e), e.shiftKey ? s.focus.set(i.getParentOrThrow().getKey(), i.getIndexWithinParent(), "element") : i.selectEnd(), !0);
|
|
1269
1269
|
}
|
|
1270
1270
|
if (e.shiftKey && (t === "up" || t === "down")) {
|
|
1271
|
-
const
|
|
1271
|
+
const l = s.focus.getNode();
|
|
1272
1272
|
if (!s.isCollapsed() && (t === "up" && !s.isBackward() || t === "down" && s.isBackward())) {
|
|
1273
|
-
let i = x(
|
|
1274
|
-
if (w(i) && (i = x(i,
|
|
1273
|
+
let i = x(l, (C) => $(C));
|
|
1274
|
+
if (w(i) && (i = x(i, $)), i !== o || !i) return !1;
|
|
1275
1275
|
const u = t === "down" ? i.getNextSibling() : i.getPreviousSibling();
|
|
1276
1276
|
if (!u) return !1;
|
|
1277
1277
|
let m = 0;
|
|
@@ -1281,21 +1281,21 @@ function Mt(n, e, t, o, l) {
|
|
|
1281
1281
|
const p = s.clone();
|
|
1282
1282
|
return p.focus.set(h.getKey(), m, Ce(h) ? "text" : "element"), ne(p), te(e), !0;
|
|
1283
1283
|
}
|
|
1284
|
-
if (_n(
|
|
1284
|
+
if (_n(l)) {
|
|
1285
1285
|
const i = t === "up" ? s.getNodes()[s.getNodes().length - 1] : s.getNodes()[0];
|
|
1286
1286
|
if (i && Ne(o, i) !== null) {
|
|
1287
1287
|
const u = o.getFirstDescendant(), m = o.getLastDescendant();
|
|
1288
1288
|
if (!u || !m) return !1;
|
|
1289
|
-
const [h] = G(u), [p] = G(m), C = o.getCordsFromCellNode(h,
|
|
1290
|
-
return
|
|
1289
|
+
const [h] = G(u), [p] = G(m), C = o.getCordsFromCellNode(h, r.table), a = o.getCordsFromCellNode(p, r.table), c = o.getDOMCellFromCordsOrThrow(C.x, C.y, r.table), f = o.getDOMCellFromCordsOrThrow(a.x, a.y, r.table);
|
|
1290
|
+
return r.$setAnchorCellForSelection(c), r.$setFocusCellForSelection(f, !0), !0;
|
|
1291
1291
|
}
|
|
1292
1292
|
return !1;
|
|
1293
1293
|
}
|
|
1294
1294
|
{
|
|
1295
|
-
let i = x(
|
|
1296
|
-
if (w(i) && (i = x(i,
|
|
1295
|
+
let i = x(l, (m) => D(m) && !m.isInline());
|
|
1296
|
+
if (w(i) && (i = x(i, $)), !i) return !1;
|
|
1297
1297
|
const u = t === "down" ? i.getNextSibling() : i.getPreviousSibling();
|
|
1298
|
-
if (
|
|
1298
|
+
if ($(u) && r.tableNodeKey === u.getKey()) {
|
|
1299
1299
|
const m = u.getFirstDescendant(), h = u.getLastDescendant();
|
|
1300
1300
|
if (!m || !h) return !1;
|
|
1301
1301
|
const [p] = G(m), [C] = G(h), a = s.clone();
|
|
@@ -1304,25 +1304,25 @@ function Mt(n, e, t, o, l) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
|
-
return t === "down" &&
|
|
1307
|
+
return t === "down" && Ve(n) && r.setShouldCheckSelection(), !1;
|
|
1308
1308
|
}
|
|
1309
1309
|
if (z(s)) {
|
|
1310
1310
|
if (t === "backward" || t === "forward")
|
|
1311
|
-
return jn(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o,
|
|
1311
|
+
return jn(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o, r);
|
|
1312
1312
|
if (s.isCollapsed()) {
|
|
1313
|
-
const { anchor:
|
|
1313
|
+
const { anchor: l, focus: i } = s, u = x(l.getNode(), w), m = x(i.getNode(), w);
|
|
1314
1314
|
if (!w(u) || !u.is(m)) return !1;
|
|
1315
1315
|
const h = pe(u);
|
|
1316
1316
|
if (h !== o && h != null) {
|
|
1317
1317
|
const g = ie(h, n.getElementByKey(h.getKey()));
|
|
1318
|
-
if (g != null) return
|
|
1318
|
+
if (g != null) return r.table = me(h, g), Lt(n, e, t, h, r);
|
|
1319
1319
|
}
|
|
1320
|
-
const p = n.getElementByKey(u.__key), C = n.getElementByKey(
|
|
1320
|
+
const p = n.getElementByKey(u.__key), C = n.getElementByKey(l.key);
|
|
1321
1321
|
if (C == null || p == null) return !1;
|
|
1322
1322
|
let a;
|
|
1323
|
-
if (
|
|
1323
|
+
if (l.type === "element") a = C.getBoundingClientRect();
|
|
1324
1324
|
else {
|
|
1325
|
-
const g = $e(
|
|
1325
|
+
const g = $e(ot(n));
|
|
1326
1326
|
if (g === null || g.rangeCount === 0) return !1;
|
|
1327
1327
|
a = g.getRangeAt(0).getBoundingClientRect();
|
|
1328
1328
|
}
|
|
@@ -1333,25 +1333,25 @@ function Mt(n, e, t, o, l) {
|
|
|
1333
1333
|
const d = f.getBoundingClientRect();
|
|
1334
1334
|
if (t === "up" ? d.top > a.top - a.height : a.bottom + a.height > d.bottom) {
|
|
1335
1335
|
te(e);
|
|
1336
|
-
const g = o.getCordsFromCellNode(u,
|
|
1337
|
-
if (!e.shiftKey) return
|
|
1336
|
+
const g = o.getCordsFromCellNode(u, r.table);
|
|
1337
|
+
if (!e.shiftKey) return Yn(r, o, g.x, g.y, t);
|
|
1338
1338
|
{
|
|
1339
|
-
const _ = o.getDOMCellFromCordsOrThrow(g.x, g.y,
|
|
1340
|
-
|
|
1339
|
+
const _ = o.getDOMCellFromCordsOrThrow(g.x, g.y, r.table);
|
|
1340
|
+
r.$setAnchorCellForSelection(_), r.$setFocusCellForSelection(_, !0);
|
|
1341
1341
|
}
|
|
1342
1342
|
return !0;
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
|
-
} else if (
|
|
1346
|
-
const { anchor:
|
|
1347
|
-
|
|
1345
|
+
} else if (O(s)) {
|
|
1346
|
+
const { anchor: l, focus: i } = s, u = x(l.getNode(), w), m = x(i.getNode(), w), [h] = s.getNodes();
|
|
1347
|
+
$(h) || y(251);
|
|
1348
1348
|
const p = ie(h, n.getElementByKey(h.getKey()));
|
|
1349
|
-
if (!w(u) || !w(m) ||
|
|
1350
|
-
|
|
1349
|
+
if (!w(u) || !w(m) || !$(h) || p == null) return !1;
|
|
1350
|
+
r.$updateTableTableSelection(s);
|
|
1351
1351
|
const C = me(h, p), a = o.getCordsFromCellNode(u, C), c = o.getDOMCellFromCordsOrThrow(a.x, a.y, C);
|
|
1352
|
-
if (
|
|
1353
|
-
const [f, d, g] =
|
|
1354
|
-
return qn(
|
|
1352
|
+
if (r.$setAnchorCellForSelection(c), te(e), e.shiftKey) {
|
|
1353
|
+
const [f, d, g] = U(o, u, m);
|
|
1354
|
+
return qn(r, f, d, g, t);
|
|
1355
1355
|
}
|
|
1356
1356
|
return m.selectEnd(), !0;
|
|
1357
1357
|
}
|
|
@@ -1360,22 +1360,22 @@ function Mt(n, e, t, o, l) {
|
|
|
1360
1360
|
function te(n) {
|
|
1361
1361
|
n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
|
|
1362
1362
|
}
|
|
1363
|
-
function
|
|
1363
|
+
function wt(n, e, t) {
|
|
1364
1364
|
const o = I();
|
|
1365
1365
|
n === "first" ? e.insertBefore(o) : e.insertAfter(o), o.append(...t || []), o.selectEnd();
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1367
|
+
function yt(n, e, t) {
|
|
1368
1368
|
const o = t.getParent();
|
|
1369
1369
|
if (!o) return;
|
|
1370
|
-
const
|
|
1371
|
-
if (!
|
|
1372
|
-
const s =
|
|
1373
|
-
if (!s || !
|
|
1370
|
+
const r = $e(ot(n));
|
|
1371
|
+
if (!r) return;
|
|
1372
|
+
const s = r.anchorNode, l = n.getElementByKey(o.getKey()), i = ie(t, n.getElementByKey(t.getKey()));
|
|
1373
|
+
if (!s || !l || !i || !l.contains(s) || i.contains(s)) return;
|
|
1374
1374
|
const u = x(e.anchor.getNode(), (_) => w(_));
|
|
1375
1375
|
if (!u) return;
|
|
1376
|
-
const m = x(u, (_) =>
|
|
1377
|
-
if (
|
|
1378
|
-
const [h, p] =
|
|
1376
|
+
const m = x(u, (_) => $(_));
|
|
1377
|
+
if (!$(m) || !m.is(t)) return;
|
|
1378
|
+
const [h, p] = U(t, u, u), C = h[0][0], a = h[h.length - 1][h[0].length - 1], { startRow: c, startColumn: f } = p, d = c === C.startRow && f === C.startColumn, g = c === a.startRow && f === a.startColumn;
|
|
1379
1379
|
return d ? "first" : g ? "last" : void 0;
|
|
1380
1380
|
}
|
|
1381
1381
|
function se(n, e) {
|
|
@@ -1387,21 +1387,21 @@ function qe(n, e, t) {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
function bt(n, e, t) {
|
|
1389
1389
|
if (!e.theme.tableAlignment) return;
|
|
1390
|
-
const o = [],
|
|
1390
|
+
const o = [], r = [];
|
|
1391
1391
|
for (const s of ["center", "right"]) {
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1392
|
+
const l = e.theme.tableAlignment[s];
|
|
1393
|
+
l && (s === t ? r : o).push(l);
|
|
1394
1394
|
}
|
|
1395
|
-
ge(n, ...o), Q(n, ...
|
|
1395
|
+
ge(n, ...o), Q(n, ...r);
|
|
1396
1396
|
}
|
|
1397
1397
|
const je = /* @__PURE__ */ new WeakSet();
|
|
1398
|
-
function
|
|
1398
|
+
function Ve(n = xt()) {
|
|
1399
1399
|
return je.has(n);
|
|
1400
1400
|
}
|
|
1401
1401
|
function uo(n, e) {
|
|
1402
1402
|
e ? je.add(n) : je.delete(n);
|
|
1403
1403
|
}
|
|
1404
|
-
class ae extends
|
|
1404
|
+
class ae extends Ze {
|
|
1405
1405
|
static getType() {
|
|
1406
1406
|
return "table";
|
|
1407
1407
|
}
|
|
@@ -1422,7 +1422,7 @@ class ae extends Ve {
|
|
|
1422
1422
|
return { table: (e) => ({ conversion: Zn, priority: 1 }) };
|
|
1423
1423
|
}
|
|
1424
1424
|
static importJSON(e) {
|
|
1425
|
-
return
|
|
1425
|
+
return lt().updateFromJSON(e);
|
|
1426
1426
|
}
|
|
1427
1427
|
updateFromJSON(e) {
|
|
1428
1428
|
return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setFrozenColumns(e.frozenColumnCount || 0).setFrozenRows(e.frozenRowCount || 0).setColWidths(e.colWidths);
|
|
@@ -1438,33 +1438,33 @@ class ae extends Ve {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
getDOMSlot(e) {
|
|
1440
1440
|
const t = de(e) ? e : e.querySelector("table");
|
|
1441
|
-
return de(t) ||
|
|
1441
|
+
return de(t) || y(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
|
|
1442
1442
|
}
|
|
1443
1443
|
createDOM(e, t) {
|
|
1444
1444
|
const o = document.createElement("table");
|
|
1445
1445
|
this.__style && (o.style.cssText = this.__style);
|
|
1446
|
-
const
|
|
1447
|
-
if (o.appendChild(
|
|
1448
|
-
const s = document.createElement("div"),
|
|
1449
|
-
return
|
|
1446
|
+
const r = document.createElement("colgroup");
|
|
1447
|
+
if (o.appendChild(r), Vt(r), Q(o, e.theme.table), this.updateTableElement(null, o, e), Ve(t)) {
|
|
1448
|
+
const s = document.createElement("div"), l = e.theme.tableScrollableWrapper;
|
|
1449
|
+
return l ? Q(s, l) : s.style.cssText = "overflow-x: auto;", s.appendChild(o), this.updateTableWrapper(null, s, o, e), s;
|
|
1450
1450
|
}
|
|
1451
1451
|
return o;
|
|
1452
1452
|
}
|
|
1453
|
-
updateTableWrapper(e, t, o,
|
|
1454
|
-
this.__frozenColumnCount !== (e ? e.__frozenColumnCount : 0) && function(s,
|
|
1455
|
-
u > 0 ? (Q(s, i.theme.tableFrozenColumn),
|
|
1456
|
-
}(t, o,
|
|
1457
|
-
u > 0 ? (Q(s, i.theme.tableFrozenRow),
|
|
1458
|
-
}(t, o,
|
|
1453
|
+
updateTableWrapper(e, t, o, r) {
|
|
1454
|
+
this.__frozenColumnCount !== (e ? e.__frozenColumnCount : 0) && function(s, l, i, u) {
|
|
1455
|
+
u > 0 ? (Q(s, i.theme.tableFrozenColumn), l.setAttribute("data-lexical-frozen-column", "true")) : (ge(s, i.theme.tableFrozenColumn), l.removeAttribute("data-lexical-frozen-column"));
|
|
1456
|
+
}(t, o, r, this.__frozenColumnCount), this.__frozenRowCount !== (e ? e.__frozenRowCount : 0) && function(s, l, i, u) {
|
|
1457
|
+
u > 0 ? (Q(s, i.theme.tableFrozenRow), l.setAttribute("data-lexical-frozen-row", "true")) : (ge(s, i.theme.tableFrozenRow), l.removeAttribute("data-lexical-frozen-row"));
|
|
1458
|
+
}(t, o, r, this.__frozenRowCount);
|
|
1459
1459
|
}
|
|
1460
1460
|
updateTableElement(e, t, o) {
|
|
1461
|
-
this.__style !== (e ? e.__style : "") && (t.style.cssText = this.__style), this.__rowStriping !== (!!e && e.__rowStriping) && function(
|
|
1462
|
-
|
|
1463
|
-
}(t, o, this.__rowStriping), function(
|
|
1464
|
-
const u =
|
|
1461
|
+
this.__style !== (e ? e.__style : "") && (t.style.cssText = this.__style), this.__rowStriping !== (!!e && e.__rowStriping) && function(r, s, l) {
|
|
1462
|
+
l ? (Q(r, s.theme.tableRowStriping), r.setAttribute("data-lexical-row-striping", "true")) : (ge(r, s.theme.tableRowStriping), r.removeAttribute("data-lexical-row-striping"));
|
|
1463
|
+
}(t, o, this.__rowStriping), function(r, s, l, i) {
|
|
1464
|
+
const u = r.querySelector("colgroup");
|
|
1465
1465
|
if (!u) return;
|
|
1466
1466
|
const m = [];
|
|
1467
|
-
for (let h = 0; h <
|
|
1467
|
+
for (let h = 0; h < l; h++) {
|
|
1468
1468
|
const p = document.createElement("col"), C = i && i[h];
|
|
1469
1469
|
C && (p.style.width = `${C}px`), m.push(p);
|
|
1470
1470
|
}
|
|
@@ -1472,44 +1472,44 @@ class ae extends Ve {
|
|
|
1472
1472
|
}(t, 0, this.getColumnCount(), this.getColWidths()), bt(t, o, this.getFormatType());
|
|
1473
1473
|
}
|
|
1474
1474
|
updateDOM(e, t, o) {
|
|
1475
|
-
const
|
|
1475
|
+
const r = this.getDOMSlot(t).element;
|
|
1476
|
+
return t === r === Ve() || (be(s = t) && s.nodeName === "DIV" && this.updateTableWrapper(e, t, r, o), this.updateTableElement(e, r, o), !1);
|
|
1476
1477
|
var s;
|
|
1477
|
-
return ye(s = t) && s.nodeName === "DIV" && this.updateTableWrapper(e, t, l, o), this.updateTableElement(e, this.getDOMSlot(t).element, o), !1;
|
|
1478
1478
|
}
|
|
1479
1479
|
exportDOM(e) {
|
|
1480
1480
|
const t = super.exportDOM(e), { element: o } = t;
|
|
1481
|
-
return { after: (
|
|
1482
|
-
if (t.after && (
|
|
1483
|
-
bt(
|
|
1484
|
-
const [s] = oe(this, null, null),
|
|
1481
|
+
return { after: (r) => {
|
|
1482
|
+
if (t.after && (r = t.after(r)), !de(r) && be(r) && (r = r.querySelector("table")), !de(r)) return null;
|
|
1483
|
+
bt(r, e._config, this.getFormatType());
|
|
1484
|
+
const [s] = oe(this, null, null), l = /* @__PURE__ */ new Map();
|
|
1485
1485
|
for (const h of s) for (const p of h) {
|
|
1486
1486
|
const C = p.cell.getKey();
|
|
1487
|
-
|
|
1487
|
+
l.has(C) || l.set(C, { colSpan: p.cell.getColSpan(), startColumn: p.startColumn });
|
|
1488
1488
|
}
|
|
1489
1489
|
const i = /* @__PURE__ */ new Set();
|
|
1490
|
-
for (const h of
|
|
1490
|
+
for (const h of r.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
|
|
1491
1491
|
const p = h.getAttribute("data-temporary-table-cell-lexical-key");
|
|
1492
1492
|
if (p) {
|
|
1493
|
-
const C =
|
|
1493
|
+
const C = l.get(p);
|
|
1494
1494
|
if (h.removeAttribute("data-temporary-table-cell-lexical-key"), C) {
|
|
1495
|
-
|
|
1495
|
+
l.delete(p);
|
|
1496
1496
|
for (let a = 0; a < C.colSpan; a++) i.add(a + C.startColumn);
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
const u =
|
|
1500
|
+
const u = r.querySelector(":scope > colgroup");
|
|
1501
1501
|
if (u) {
|
|
1502
|
-
const h = Array.from(
|
|
1502
|
+
const h = Array.from(r.querySelectorAll(":scope > colgroup > col")).filter((p, C) => i.has(C));
|
|
1503
1503
|
u.replaceChildren(...h);
|
|
1504
1504
|
}
|
|
1505
|
-
const m =
|
|
1505
|
+
const m = r.querySelectorAll(":scope > tr");
|
|
1506
1506
|
if (m.length > 0) {
|
|
1507
1507
|
const h = document.createElement("tbody");
|
|
1508
1508
|
for (const p of m) h.appendChild(p);
|
|
1509
|
-
|
|
1509
|
+
r.append(h);
|
|
1510
1510
|
}
|
|
1511
|
-
return
|
|
1512
|
-
}, element: !de(o) &&
|
|
1511
|
+
return r;
|
|
1512
|
+
}, element: !de(o) && be(o) ? o.querySelector("table") : o };
|
|
1513
1513
|
}
|
|
1514
1514
|
canBeEmpty() {
|
|
1515
1515
|
return !1;
|
|
@@ -1518,11 +1518,11 @@ class ae extends Ve {
|
|
|
1518
1518
|
return !0;
|
|
1519
1519
|
}
|
|
1520
1520
|
getCordsFromCellNode(e, t) {
|
|
1521
|
-
const { rows: o, domRows:
|
|
1521
|
+
const { rows: o, domRows: r } = t;
|
|
1522
1522
|
for (let s = 0; s < o; s++) {
|
|
1523
|
-
const
|
|
1524
|
-
if (
|
|
1525
|
-
const u =
|
|
1523
|
+
const l = r[s];
|
|
1524
|
+
if (l != null) for (let i = 0; i < l.length; i++) {
|
|
1525
|
+
const u = l[i];
|
|
1526
1526
|
if (u == null) continue;
|
|
1527
1527
|
const { elem: m } = u, h = qe(this, m);
|
|
1528
1528
|
if (h !== null && e.is(h)) return { x: i, y: s };
|
|
@@ -1531,26 +1531,26 @@ class ae extends Ve {
|
|
|
1531
1531
|
throw new Error("Cell not found in table.");
|
|
1532
1532
|
}
|
|
1533
1533
|
getDOMCellFromCords(e, t, o) {
|
|
1534
|
-
const { domRows:
|
|
1534
|
+
const { domRows: r } = o, s = r[t];
|
|
1535
1535
|
if (s == null) return null;
|
|
1536
|
-
const
|
|
1537
|
-
return
|
|
1536
|
+
const l = s[e < s.length ? e : s.length - 1];
|
|
1537
|
+
return l ?? null;
|
|
1538
1538
|
}
|
|
1539
1539
|
getDOMCellFromCordsOrThrow(e, t, o) {
|
|
1540
|
-
const
|
|
1541
|
-
if (!
|
|
1542
|
-
return
|
|
1540
|
+
const r = this.getDOMCellFromCords(e, t, o);
|
|
1541
|
+
if (!r) throw new Error("Cell not found at cords.");
|
|
1542
|
+
return r;
|
|
1543
1543
|
}
|
|
1544
1544
|
getCellNodeFromCords(e, t, o) {
|
|
1545
|
-
const
|
|
1546
|
-
if (
|
|
1547
|
-
const s = re(
|
|
1545
|
+
const r = this.getDOMCellFromCords(e, t, o);
|
|
1546
|
+
if (r == null) return null;
|
|
1547
|
+
const s = re(r.elem);
|
|
1548
1548
|
return w(s) ? s : null;
|
|
1549
1549
|
}
|
|
1550
1550
|
getCellNodeFromCordsOrThrow(e, t, o) {
|
|
1551
|
-
const
|
|
1552
|
-
if (!
|
|
1553
|
-
return
|
|
1551
|
+
const r = this.getCellNodeFromCords(e, t, o);
|
|
1552
|
+
if (!r) throw new Error("Node at cords not TableCellNode.");
|
|
1553
|
+
return r;
|
|
1554
1554
|
}
|
|
1555
1555
|
getRowStriping() {
|
|
1556
1556
|
return !!this.getLatest().__rowStriping;
|
|
@@ -1590,17 +1590,17 @@ class ae extends Ve {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
function Vn(n, e) {
|
|
1592
1592
|
const t = n.getElementByKey(e.getKey());
|
|
1593
|
-
return t === null &&
|
|
1593
|
+
return t === null && y(230), me(e, t);
|
|
1594
1594
|
}
|
|
1595
1595
|
function Zn(n) {
|
|
1596
|
-
const e =
|
|
1596
|
+
const e = lt();
|
|
1597
1597
|
n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0);
|
|
1598
1598
|
const t = n.querySelector(":scope > colgroup");
|
|
1599
1599
|
if (t) {
|
|
1600
1600
|
let o = [];
|
|
1601
|
-
for (const
|
|
1602
|
-
let s =
|
|
1603
|
-
if (!
|
|
1601
|
+
for (const r of t.querySelectorAll(":scope > col")) {
|
|
1602
|
+
let s = r.style.width || "";
|
|
1603
|
+
if (!tt.test(s) && (s = r.getAttribute("width") || "", !/^\d+$/.test(s))) {
|
|
1604
1604
|
o = void 0;
|
|
1605
1605
|
break;
|
|
1606
1606
|
}
|
|
@@ -1608,44 +1608,44 @@ function Zn(n) {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
o && e.setColWidths(o);
|
|
1610
1610
|
}
|
|
1611
|
-
return { after: (o) =>
|
|
1611
|
+
return { after: (o) => Nt(o, A), node: e };
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return
|
|
1613
|
+
function lt() {
|
|
1614
|
+
return Qe(new ae());
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function $(n) {
|
|
1617
1617
|
return n instanceof ae;
|
|
1618
1618
|
}
|
|
1619
1619
|
function Qn({ rows: n, columns: e, includeHeaders: t }) {
|
|
1620
|
-
const o = B() ||
|
|
1620
|
+
const o = B() || Je();
|
|
1621
1621
|
if (!o || !z(o) || pe(o.anchor.getNode())) return !1;
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1624
|
-
const s =
|
|
1622
|
+
const r = En(Number(n), Number(e), t);
|
|
1623
|
+
Yt(r);
|
|
1624
|
+
const s = r.getFirstDescendant();
|
|
1625
1625
|
return Ce(s) && s.select(), !0;
|
|
1626
1626
|
}
|
|
1627
1627
|
function Gn(n) {
|
|
1628
|
-
|
|
1628
|
+
A(n.getParent()) ? n.isEmpty() && n.append(I()) : n.remove();
|
|
1629
1629
|
}
|
|
1630
1630
|
function eo(n) {
|
|
1631
|
-
|
|
1631
|
+
$(n.getParent()) ? vt(n, w) : n.remove();
|
|
1632
1632
|
}
|
|
1633
1633
|
function to(n) {
|
|
1634
|
-
|
|
1635
|
-
const [e] = oe(n, null, null), t = e.reduce((
|
|
1636
|
-
for (let
|
|
1637
|
-
const s = o[
|
|
1634
|
+
vt(n, A);
|
|
1635
|
+
const [e] = oe(n, null, null), t = e.reduce((r, s) => Math.max(r, s.length), 0), o = n.getChildren();
|
|
1636
|
+
for (let r = 0; r < e.length; ++r) {
|
|
1637
|
+
const s = o[r];
|
|
1638
1638
|
if (!s) continue;
|
|
1639
|
-
|
|
1640
|
-
const
|
|
1641
|
-
if (
|
|
1642
|
-
const u =
|
|
1639
|
+
A(s) || y(254, s.constructor.name, s.getType());
|
|
1640
|
+
const l = e[r].reduce((i, u) => u ? 1 + i : i, 0);
|
|
1641
|
+
if (l !== t) for (let i = l; i < t; ++i) {
|
|
1642
|
+
const u = X();
|
|
1643
1643
|
u.append(I()), s.append(u);
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
1647
|
function no(n) {
|
|
1648
|
-
if (n.detail < 3 || !
|
|
1648
|
+
if (n.detail < 3 || !ye(n.target)) return !1;
|
|
1649
1649
|
const e = re(n.target);
|
|
1650
1650
|
if (e === null) return !1;
|
|
1651
1651
|
const t = x(e, (o) => D(o) && !o.isInline());
|
|
@@ -1654,20 +1654,20 @@ function no(n) {
|
|
|
1654
1654
|
function ho(n) {
|
|
1655
1655
|
return n.registerNodeTransform(ce, (e) => {
|
|
1656
1656
|
if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
|
|
1657
|
-
const [, , t] = G(e), [o] =
|
|
1658
|
-
let
|
|
1659
|
-
|
|
1657
|
+
const [, , t] = G(e), [o] = U(t, e, e), r = o.length, s = o[0].length;
|
|
1658
|
+
let l = t.getFirstChild();
|
|
1659
|
+
A(l) || y(175);
|
|
1660
1660
|
const i = [];
|
|
1661
|
-
for (let u = 0; u <
|
|
1662
|
-
u !== 0 && (
|
|
1661
|
+
for (let u = 0; u < r; u++) {
|
|
1662
|
+
u !== 0 && (l = l.getNextSibling(), A(l) || y(175));
|
|
1663
1663
|
let m = null;
|
|
1664
1664
|
for (let h = 0; h < s; h++) {
|
|
1665
1665
|
const p = o[u][h], C = p.cell;
|
|
1666
1666
|
if (p.startRow === u && p.startColumn === h) m = C, i.push(C);
|
|
1667
1667
|
else if (C.getColSpan() > 1 || C.getRowSpan() > 1) {
|
|
1668
|
-
w(C) ||
|
|
1669
|
-
const a =
|
|
1670
|
-
m !== null ? m.insertAfter(a) :
|
|
1668
|
+
w(C) || y(176);
|
|
1669
|
+
const a = X(C.__headerState);
|
|
1670
|
+
m !== null ? m.insertAfter(a) : Xt(l, a);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
@@ -1676,45 +1676,46 @@ function ho(n) {
|
|
|
1676
1676
|
});
|
|
1677
1677
|
}
|
|
1678
1678
|
function fo(n, e = !0) {
|
|
1679
|
-
const t = /* @__PURE__ */ new Map(), o = (s,
|
|
1680
|
-
const u = ie(s, i), m =
|
|
1681
|
-
t.set(
|
|
1682
|
-
},
|
|
1679
|
+
const t = /* @__PURE__ */ new Map(), o = (s, l, i) => {
|
|
1680
|
+
const u = ie(s, i), m = Xn(s, u, n, e);
|
|
1681
|
+
t.set(l, [m, u]);
|
|
1682
|
+
}, r = n.registerMutationListener(ae, (s) => {
|
|
1683
1683
|
n.getEditorState().read(() => {
|
|
1684
|
-
for (const [
|
|
1685
|
-
const u = t.get(
|
|
1684
|
+
for (const [l, i] of s) {
|
|
1685
|
+
const u = t.get(l);
|
|
1686
1686
|
if (i === "created" || i === "updated") {
|
|
1687
|
-
const { tableNode: m, tableElement: h } =
|
|
1688
|
-
u === void 0 ? o(m,
|
|
1689
|
-
} else i === "destroyed" && u !== void 0 && (u[0].removeListeners(), t.delete(
|
|
1687
|
+
const { tableNode: m, tableElement: h } = kt(l);
|
|
1688
|
+
u === void 0 ? o(m, l, h) : h !== u[1] && (u[0].removeListeners(), t.delete(l), o(m, l, h));
|
|
1689
|
+
} else i === "destroyed" && u !== void 0 && (u[0].removeListeners(), t.delete(l));
|
|
1690
1690
|
}
|
|
1691
1691
|
}, { editor: n });
|
|
1692
1692
|
}, { skipInitialization: !1 });
|
|
1693
1693
|
return () => {
|
|
1694
|
-
|
|
1694
|
+
r();
|
|
1695
1695
|
for (const [, [s]] of t) s.removeListeners();
|
|
1696
1696
|
};
|
|
1697
1697
|
}
|
|
1698
1698
|
function go(n) {
|
|
1699
|
-
return n.hasNodes([ae]) ||
|
|
1699
|
+
return n.hasNodes([ae]) || y(255), Ut(n.registerCommand(Kn, Qn, Be), n.registerCommand(Tt, ({ nodes: e, selection: t }) => z(t) ? pe(t.anchor.getNode()) !== null && e.some($) : !1, Be), n.registerCommand(Zt, no, Be), n.registerNodeTransform(ae, to), n.registerNodeTransform(xe, eo), n.registerNodeTransform(ce, Gn));
|
|
1700
1700
|
}
|
|
1701
1701
|
export {
|
|
1702
1702
|
ao as B,
|
|
1703
|
-
|
|
1703
|
+
Kt as H,
|
|
1704
1704
|
ve as K,
|
|
1705
|
-
|
|
1705
|
+
En as L,
|
|
1706
1706
|
xe as O,
|
|
1707
1707
|
io as P,
|
|
1708
1708
|
w as R,
|
|
1709
1709
|
ho as S,
|
|
1710
|
-
|
|
1710
|
+
so as W,
|
|
1711
1711
|
co as Z,
|
|
1712
1712
|
ae as a,
|
|
1713
1713
|
go as b,
|
|
1714
1714
|
uo as c,
|
|
1715
|
+
Ve as s,
|
|
1715
1716
|
fo as w,
|
|
1716
|
-
|
|
1717
|
+
X as x,
|
|
1717
1718
|
ce as y,
|
|
1718
1719
|
Ot as z
|
|
1719
1720
|
};
|
|
1720
|
-
//# sourceMappingURL=LexicalTable.prod-
|
|
1721
|
+
//# sourceMappingURL=LexicalTable.prod-osQj1CQX.js.map
|