@uva-glass/component-library 1.59.2 → 1.61.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-CO0gPAfo.js → Lexical.prod-qM_1BY0u.js} +961 -952
- package/dist/Lexical.prod-qM_1BY0u.js.map +1 -0
- package/dist/{LexicalUtils.prod-PbdOb6JG.js → LexicalUtils.prod-BFSPHHi1.js} +20 -20
- package/dist/{LexicalUtils.prod-PbdOb6JG.js.map → LexicalUtils.prod-BFSPHHi1.js.map} +1 -1
- package/dist/ListPlugin-Bhkh3IBK.js +625 -0
- package/dist/ListPlugin-Bhkh3IBK.js.map +1 -0
- package/dist/RteEditor.module-Cku3JY-0.js +29 -0
- package/dist/RteEditor.module-Cku3JY-0.js.map +1 -0
- package/dist/TablePlugin-CLPV2OjO.js +294 -0
- package/dist/TablePlugin-CLPV2OjO.js.map +1 -0
- package/dist/assets/EditorHeader.css +1 -1
- package/dist/assets/Periods.css +1 -1
- package/dist/assets/RteEditor.css +1 -1
- package/dist/assets/TableCellContextMenu.css +1 -1
- package/dist/assets/TablePlugin.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
- package/dist/components/InputField/InputField.stories.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/Periods/Periods.js +19 -19
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +19 -19
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.d.ts +1 -6
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +34 -20
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +36 -31
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.d.ts +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +4 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.d.ts +7 -6
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +157 -54
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.d.ts +1 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +5 -6
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/index.js +3 -2
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.d.ts +1 -6
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +10 -31
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.d.ts +2 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +104 -31
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +6 -5
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.d.ts +6 -7
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +42 -46
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +13 -12
- package/dist/components/RteEditor/RteEditor.d.ts +13 -4
- package/dist/components/RteEditor/RteEditor.js +593 -601
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +1 -1
- package/dist/components/RteEditor/hooks/components/Flyout.js.map +1 -1
- package/dist/components/RteEditor/hooks/useTranslation.d.ts +98 -6
- package/dist/components/RteEditor/translations.d.ts +98 -6
- package/dist/components/RteEditor/translations.js +104 -12
- package/dist/components/RteEditor/translations.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-Ec7CfNnA.js → helpers-BB6Byf50.js} +92 -103
- package/dist/helpers-BB6Byf50.js.map +1 -0
- package/dist/{helpers-BewZrn6E.js → helpers-D9T1Tgkj.js} +581 -515
- package/dist/helpers-D9T1Tgkj.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/dist/Lexical.prod-CO0gPAfo.js.map +0 -1
- package/dist/LexicalList.prod-BceA-cJD.js +0 -562
- package/dist/LexicalList.prod-BceA-cJD.js.map +0 -1
- package/dist/RteEditor.module-Dz9a8vaK.js +0 -29
- package/dist/RteEditor.module-Dz9a8vaK.js.map +0 -1
- package/dist/TablePlugin-Cj6IBz2k.js +0 -249
- package/dist/TablePlugin-Cj6IBz2k.js.map +0 -1
- package/dist/helpers-BewZrn6E.js.map +0 -1
- package/dist/helpers-Ec7CfNnA.js.map +0 -1
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
1
|
+
import { i as et, t as _, $ as ue, U as tt } from "./LexicalUtils.prod-BFSPHHi1.js";
|
|
2
|
+
import { C as Tt, X as Et, k as nt, b as T, n as Ot, N as ot, J as rt, w as Ee, p as st, c as $, v as lt, q as Le, a as it, P as ve, s as He, T as Be, F as V, x as A, A as D, u as Mt, z as at, B as Ft, E as Rt, G as B, H as Kt, I as kt, f as Oe, l as Me, y as Fe, U as Dt, t as Pt, Q as Y, R as At, V as Q, W as Lt, Y as Ht, a0 as Bt, a1 as Wt, a2 as It, a3 as We, a4 as zt, a5 as Ut, a6 as Jt, a7 as Yt, d as Xt, a8 as jt, a9 as qt, aa as $t, ab as Gt, e as se, M as Vt, ac as q, ad as Zt, o as Qt, ae, af as en, D as ct, ag as tn, ah as nn, ai as on, aj as Ie } from "./Lexical.prod-qM_1BY0u.js";
|
|
3
|
+
function rn(n) {
|
|
4
4
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
rn(function(n) {
|
|
7
7
|
const e = new URLSearchParams();
|
|
8
8
|
e.append("code", n);
|
|
9
9
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
10
10
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
11
11
|
});
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const e = {}
|
|
12
|
+
const sn = /* @__PURE__ */ new Map();
|
|
13
|
+
function ln(n) {
|
|
14
|
+
const e = {};
|
|
15
|
+
if (!n) return e;
|
|
16
|
+
const t = n.split(";");
|
|
15
17
|
for (const o of t) if (o !== "") {
|
|
16
18
|
const [s, r] = o.split(/:([^]+)/);
|
|
17
19
|
s && r && (e[s.trim()] = r.trim());
|
|
18
20
|
}
|
|
19
21
|
return e;
|
|
20
22
|
}
|
|
21
|
-
function
|
|
23
|
+
function ut(n, e) {
|
|
22
24
|
const t = n.getStartEndPoints();
|
|
23
25
|
if (e.isSelected(n) && !e.isSegmented() && !e.isToken() && t !== null) {
|
|
24
26
|
const [o, s] = t, r = n.isBackward(), l = o.getNode(), a = s.getNode(), d = e.is(l), h = e.is(a);
|
|
25
27
|
if (d || h) {
|
|
26
|
-
const [i, c] =
|
|
27
|
-
let
|
|
28
|
-
return u ? (w = i > c ? c : i,
|
|
28
|
+
const [i, c] = Tt(n), u = l.is(a), g = e.is(r ? a : l), f = e.is(r ? l : a);
|
|
29
|
+
let p, w = 0;
|
|
30
|
+
return u ? (w = i > c ? c : i, p = i > c ? i : c) : g ? (w = r ? c : i, p = void 0) : f && (w = 0, p = r ? i : c), e.__text = e.__text.slice(w, p), e;
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
return e;
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
const e = n.getStyle(), t =
|
|
35
|
-
|
|
35
|
+
function an(n) {
|
|
36
|
+
const e = n.getStyle(), t = ln(e);
|
|
37
|
+
sn.set(e, t);
|
|
36
38
|
}
|
|
37
|
-
function
|
|
38
|
-
const t =
|
|
39
|
-
return
|
|
39
|
+
function Ln(n, e) {
|
|
40
|
+
const t = Et(n.focus, e);
|
|
41
|
+
return nt(t) && !t.isIsolated() || T(t) && !t.isInline() && !t.canBeEmpty();
|
|
40
42
|
}
|
|
41
|
-
function
|
|
43
|
+
function cn(n, e, t, o) {
|
|
42
44
|
n.modify(e ? "extend" : "move", t, o);
|
|
43
45
|
}
|
|
44
|
-
function
|
|
46
|
+
function un(n) {
|
|
45
47
|
const e = n.anchor.getNode();
|
|
46
|
-
return (
|
|
48
|
+
return (Ot(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
|
|
47
49
|
}
|
|
48
|
-
function
|
|
49
|
-
const o =
|
|
50
|
-
|
|
50
|
+
function Hn(n, e, t) {
|
|
51
|
+
const o = un(n);
|
|
52
|
+
cn(n, e, t ? !o : o, "character");
|
|
51
53
|
}
|
|
52
|
-
function
|
|
54
|
+
function dn(n, e) {
|
|
53
55
|
const t = e.body ? e.body.childNodes : [];
|
|
54
56
|
let o = [];
|
|
55
57
|
const s = [];
|
|
56
58
|
for (let r = 0; r < t.length; r++) {
|
|
57
59
|
const l = t[r];
|
|
58
|
-
if (!
|
|
59
|
-
const a =
|
|
60
|
+
if (!ht.has(l.nodeName)) {
|
|
61
|
+
const a = gt(l, n, s, !1);
|
|
60
62
|
a !== null && (o = o.concat(a));
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
return function(r) {
|
|
64
|
-
for (const l of r) l.getNextSibling() instanceof
|
|
66
|
+
for (const l of r) l.getNextSibling() instanceof ot && l.insertAfter(rt());
|
|
65
67
|
for (const l of r) {
|
|
66
68
|
const a = l.getChildren();
|
|
67
69
|
for (const d of a) l.insertBefore(d);
|
|
@@ -69,158 +71,160 @@ function ln(n, e) {
|
|
|
69
71
|
}
|
|
70
72
|
}(s), o;
|
|
71
73
|
}
|
|
72
|
-
function
|
|
74
|
+
function hn(n, e) {
|
|
73
75
|
if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
|
|
74
|
-
const t = document.createElement("div"), o =
|
|
76
|
+
const t = document.createElement("div"), o = Ee().getChildren();
|
|
75
77
|
for (let s = 0; s < o.length; s++)
|
|
76
|
-
|
|
78
|
+
dt(n, o[s], t, e);
|
|
77
79
|
return t.innerHTML;
|
|
78
80
|
}
|
|
79
|
-
function
|
|
81
|
+
function dt(n, e, t, o = null) {
|
|
80
82
|
let s = o === null || e.isSelected(o);
|
|
81
|
-
const r =
|
|
83
|
+
const r = T(e) && e.excludeFromCopy("html");
|
|
82
84
|
let l = e;
|
|
83
85
|
if (o !== null) {
|
|
84
|
-
let g =
|
|
85
|
-
g =
|
|
86
|
+
let g = st(e);
|
|
87
|
+
g = $(g) && o !== null ? ut(o, g) : g, l = g;
|
|
86
88
|
}
|
|
87
|
-
const a =
|
|
89
|
+
const a = T(l) ? l.getChildren() : [], d = n._nodes.get(l.getType());
|
|
88
90
|
let h;
|
|
89
91
|
h = d && d.exportDOM !== void 0 ? d.exportDOM(n, l) : l.exportDOM(n);
|
|
90
92
|
const { element: i, after: c } = h;
|
|
91
93
|
if (!i) return !1;
|
|
92
94
|
const u = document.createDocumentFragment();
|
|
93
95
|
for (let g = 0; g < a.length; g++) {
|
|
94
|
-
const f = a[g],
|
|
95
|
-
!s &&
|
|
96
|
+
const f = a[g], p = dt(n, f, u, o);
|
|
97
|
+
!s && T(e) && p && e.extractWithChild(f, o, "html") && (s = !0);
|
|
96
98
|
}
|
|
97
99
|
if (s && !r) {
|
|
98
|
-
if ((
|
|
100
|
+
if ((lt(i) || Le(i)) && i.append(u), t.append(i), c) {
|
|
99
101
|
const g = c.call(l, i);
|
|
100
|
-
g && (
|
|
102
|
+
g && (Le(i) ? i.replaceChildren(g) : i.replaceWith(g));
|
|
101
103
|
}
|
|
102
104
|
} else t.append(u);
|
|
103
105
|
return s;
|
|
104
106
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
107
|
+
const ht = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
|
|
108
|
+
function gt(n, e, t, o, s = /* @__PURE__ */ new Map(), r) {
|
|
107
109
|
let l = [];
|
|
108
|
-
if (
|
|
110
|
+
if (ht.has(n.nodeName)) return l;
|
|
109
111
|
let a = null;
|
|
110
|
-
const d = function(f,
|
|
111
|
-
const { nodeName: w } = f, C =
|
|
112
|
-
let
|
|
113
|
-
if (C !== void 0) for (const
|
|
114
|
-
const v =
|
|
115
|
-
v !== null && (
|
|
112
|
+
const d = function(f, p) {
|
|
113
|
+
const { nodeName: w } = f, C = p._htmlConversions.get(w.toLowerCase());
|
|
114
|
+
let x = null;
|
|
115
|
+
if (C !== void 0) for (const E of C) {
|
|
116
|
+
const v = E(f);
|
|
117
|
+
v !== null && (x === null || (x.priority || 0) < (v.priority || 0)) && (x = v);
|
|
116
118
|
}
|
|
117
|
-
return
|
|
119
|
+
return x !== null ? x.conversion : null;
|
|
118
120
|
}(n, e), h = d ? d(n) : null;
|
|
119
121
|
let i = null;
|
|
120
122
|
if (h !== null) {
|
|
121
123
|
i = h.after;
|
|
122
124
|
const f = h.node;
|
|
123
125
|
if (a = Array.isArray(f) ? f[f.length - 1] : f, a !== null) {
|
|
124
|
-
for (const [,
|
|
126
|
+
for (const [, p] of s) if (a = p(a, r), !a) break;
|
|
125
127
|
a && l.push(...Array.isArray(f) ? f : [a]);
|
|
126
128
|
}
|
|
127
129
|
h.forChild != null && s.set(n.nodeName, h.forChild);
|
|
128
130
|
}
|
|
129
131
|
const c = n.childNodes;
|
|
130
132
|
let u = [];
|
|
131
|
-
const g = (a == null || !
|
|
132
|
-
for (let f = 0; f < c.length; f++) u.push(...
|
|
133
|
-
return i != null && (u = i(u)),
|
|
134
|
-
const f = new
|
|
133
|
+
const g = (a == null || !it(a)) && (a != null && ve(a) || o);
|
|
134
|
+
for (let f = 0; f < c.length; f++) u.push(...gt(c[f], e, t, g, new Map(s), a));
|
|
135
|
+
return i != null && (u = i(u)), He(n) && (u = gn(n, u, g ? () => {
|
|
136
|
+
const f = new ot();
|
|
135
137
|
return t.push(f), f;
|
|
136
|
-
} :
|
|
137
|
-
return f.nextSibling == null || f.previousSibling == null ? !1 :
|
|
138
|
-
}(n) && (l = l.concat(
|
|
138
|
+
} : V)), a == null ? u.length > 0 ? l = l.concat(u) : He(n) && function(f) {
|
|
139
|
+
return f.nextSibling == null || f.previousSibling == null ? !1 : Be(f.nextSibling) && Be(f.previousSibling);
|
|
140
|
+
}(n) && (l = l.concat(rt())) : T(a) && a.append(...u), l;
|
|
139
141
|
}
|
|
140
|
-
function
|
|
142
|
+
function gn(n, e, t) {
|
|
141
143
|
const o = n.style.textAlign, s = [];
|
|
142
144
|
let r = [];
|
|
143
145
|
for (let l = 0; l < e.length; l++) {
|
|
144
146
|
const a = e[l];
|
|
145
|
-
if (
|
|
146
|
-
else if (r.push(a), l === e.length - 1 || l < e.length - 1 &&
|
|
147
|
+
if (ve(a)) o && !a.getFormat() && a.setFormat(o), s.push(a);
|
|
148
|
+
else if (r.push(a), l === e.length - 1 || l < e.length - 1 && ve(e[l + 1])) {
|
|
147
149
|
const d = t();
|
|
148
150
|
d.setFormat(o), d.append(...r), s.push(d), r = [];
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
return s;
|
|
152
154
|
}
|
|
153
|
-
function
|
|
155
|
+
function fn(n) {
|
|
154
156
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
155
157
|
}
|
|
156
|
-
var
|
|
158
|
+
var we = fn(function(n) {
|
|
157
159
|
const e = new URLSearchParams();
|
|
158
160
|
e.append("code", n);
|
|
159
161
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
160
162
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
161
163
|
});
|
|
162
|
-
const
|
|
163
|
-
function
|
|
164
|
-
return e == null &&
|
|
164
|
+
const mn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ft = (n) => mn ? (n || window).getSelection() : null;
|
|
165
|
+
function pn(n, e = D()) {
|
|
166
|
+
return e == null && we(166), A(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : hn(n, e);
|
|
165
167
|
}
|
|
166
|
-
function
|
|
167
|
-
return e == null &&
|
|
168
|
+
function wn(n, e = D()) {
|
|
169
|
+
return e == null && we(166), A(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Cn(n, e));
|
|
168
170
|
}
|
|
169
|
-
function
|
|
171
|
+
function Bn(n, e, t) {
|
|
170
172
|
const o = n.getData("application/x-lexical-editor");
|
|
171
173
|
if (o) try {
|
|
172
174
|
const l = JSON.parse(o);
|
|
173
175
|
if (l.namespace === t._config.namespace && Array.isArray(l.nodes))
|
|
174
|
-
return
|
|
176
|
+
return ze(t, Sn(l.nodes), e);
|
|
175
177
|
} catch {
|
|
176
178
|
}
|
|
177
179
|
const s = n.getData("text/html");
|
|
178
180
|
if (s) try {
|
|
179
|
-
const l = new DOMParser().parseFromString(
|
|
180
|
-
|
|
181
|
+
const l = new DOMParser().parseFromString(function(a) {
|
|
182
|
+
return window.trustedTypes && window.trustedTypes.createPolicy ? window.trustedTypes.createPolicy("lexical", { createHTML: (d) => d }).createHTML(a) : a;
|
|
183
|
+
}(s), "text/html");
|
|
184
|
+
return ze(t, dn(t, l), e);
|
|
181
185
|
} catch {
|
|
182
186
|
}
|
|
183
187
|
const r = n.getData("text/plain") || n.getData("text/uri-list");
|
|
184
|
-
if (r != null) if (
|
|
188
|
+
if (r != null) if (A(e)) {
|
|
185
189
|
const l = r.split(/(\r?\n|\t)/);
|
|
186
190
|
l[l.length - 1] === "" && l.pop();
|
|
187
191
|
for (let a = 0; a < l.length; a++) {
|
|
188
|
-
const d =
|
|
189
|
-
if (
|
|
192
|
+
const d = D();
|
|
193
|
+
if (A(d)) {
|
|
190
194
|
const h = l[a];
|
|
191
195
|
h === `
|
|
192
196
|
` || h === `\r
|
|
193
|
-
` ? d.insertParagraph() : h === " " ? d.insertNodes([
|
|
197
|
+
` ? d.insertParagraph() : h === " " ? d.insertNodes([Mt()]) : d.insertText(h);
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
} else e.insertRawText(r);
|
|
197
201
|
}
|
|
198
|
-
function
|
|
199
|
-
n.dispatchCommand(
|
|
202
|
+
function ze(n, e, t) {
|
|
203
|
+
n.dispatchCommand(at, { nodes: e, selection: t }) || t.insertNodes(e);
|
|
200
204
|
}
|
|
201
|
-
function
|
|
205
|
+
function mt(n, e, t, o = []) {
|
|
202
206
|
let s = e === null || t.isSelected(e);
|
|
203
|
-
const r =
|
|
207
|
+
const r = T(t) && t.excludeFromCopy("html");
|
|
204
208
|
let l = t;
|
|
205
209
|
if (e !== null) {
|
|
206
|
-
let h =
|
|
207
|
-
h =
|
|
210
|
+
let h = st(t);
|
|
211
|
+
h = $(h) && e !== null ? ut(e, h) : h, l = h;
|
|
208
212
|
}
|
|
209
|
-
const a =
|
|
213
|
+
const a = T(l) ? l.getChildren() : [], d = function(h) {
|
|
210
214
|
const i = h.exportJSON(), c = h.constructor;
|
|
211
|
-
if (i.type !== c.getType() &&
|
|
215
|
+
if (i.type !== c.getType() && we(58, c.name), T(h)) {
|
|
212
216
|
const u = i.children;
|
|
213
|
-
Array.isArray(u) ||
|
|
217
|
+
Array.isArray(u) || we(59, c.name);
|
|
214
218
|
}
|
|
215
219
|
return i;
|
|
216
220
|
}(l);
|
|
217
|
-
if (
|
|
221
|
+
if ($(l)) {
|
|
218
222
|
const h = l.__text;
|
|
219
223
|
h.length > 0 ? d.text = h : s = !1;
|
|
220
224
|
}
|
|
221
225
|
for (let h = 0; h < a.length; h++) {
|
|
222
|
-
const i = a[h], c =
|
|
223
|
-
!s &&
|
|
226
|
+
const i = a[h], c = mt(n, e, i, d.children);
|
|
227
|
+
!s && T(t) && c && t.extractWithChild(i, e, "clone") && (s = !0);
|
|
224
228
|
}
|
|
225
229
|
if (s && !r) o.push(d);
|
|
226
230
|
else if (Array.isArray(d.children)) for (let h = 0; h < d.children.length; h++) {
|
|
@@ -229,74 +233,74 @@ function dt(n, e, t, o = []) {
|
|
|
229
233
|
}
|
|
230
234
|
return s;
|
|
231
235
|
}
|
|
232
|
-
function
|
|
233
|
-
const t = [], o =
|
|
236
|
+
function Cn(n, e) {
|
|
237
|
+
const t = [], o = Ee().getChildren();
|
|
234
238
|
for (let s = 0; s < o.length; s++)
|
|
235
|
-
|
|
239
|
+
mt(n, e, o[s], t);
|
|
236
240
|
return { namespace: n._config.namespace, nodes: t };
|
|
237
241
|
}
|
|
238
|
-
function
|
|
242
|
+
function Sn(n) {
|
|
239
243
|
const e = [];
|
|
240
244
|
for (let t = 0; t < n.length; t++) {
|
|
241
|
-
const o = n[t], s =
|
|
242
|
-
|
|
245
|
+
const o = n[t], s = Ft(o);
|
|
246
|
+
$(s) && an(s), e.push(s);
|
|
243
247
|
}
|
|
244
248
|
return e;
|
|
245
249
|
}
|
|
246
|
-
let
|
|
247
|
-
async function
|
|
248
|
-
if (
|
|
250
|
+
let ee = null;
|
|
251
|
+
async function bn(n, e, t) {
|
|
252
|
+
if (ee !== null) return !1;
|
|
249
253
|
if (e !== null) return new Promise((d, h) => {
|
|
250
254
|
n.update(() => {
|
|
251
|
-
d(
|
|
255
|
+
d(Ue(n, e, t));
|
|
252
256
|
});
|
|
253
257
|
});
|
|
254
|
-
const o = n.getRootElement(), s = n._window == null ? window.document : n._window.document, r =
|
|
258
|
+
const o = n.getRootElement(), s = n._window == null ? window.document : n._window.document, r = ft(n._window);
|
|
255
259
|
if (o === null || r === null) return !1;
|
|
256
260
|
const l = s.createElement("span");
|
|
257
261
|
l.style.cssText = "position: fixed; top: -1000px;", l.append(s.createTextNode("#")), o.append(l);
|
|
258
262
|
const a = new Range();
|
|
259
263
|
return a.setStart(l, 0), a.setEnd(l, 1), r.removeAllRanges(), r.addRange(a), new Promise((d, h) => {
|
|
260
|
-
const i = n.registerCommand(
|
|
261
|
-
|
|
262
|
-
i(),
|
|
264
|
+
const i = n.registerCommand(Rt, (c) => (et(c, ClipboardEvent) && (i(), ee !== null && (window.clearTimeout(ee), ee = null), d(Ue(n, c, t))), !0), B);
|
|
265
|
+
ee = window.setTimeout(() => {
|
|
266
|
+
i(), ee = null, d(!1);
|
|
263
267
|
}, 50), s.execCommand("copy"), l.remove();
|
|
264
268
|
});
|
|
265
269
|
}
|
|
266
|
-
function
|
|
270
|
+
function Ue(n, e, t) {
|
|
267
271
|
if (t === void 0) {
|
|
268
|
-
const s =
|
|
272
|
+
const s = ft(n._window);
|
|
269
273
|
if (!s) return !1;
|
|
270
274
|
const r = s.anchorNode, l = s.focusNode;
|
|
271
|
-
if (r !== null && l !== null && !
|
|
272
|
-
const a =
|
|
275
|
+
if (r !== null && l !== null && !Kt(n, r, l)) return !1;
|
|
276
|
+
const a = D();
|
|
273
277
|
if (a === null) return !1;
|
|
274
|
-
t =
|
|
278
|
+
t = pt(a);
|
|
275
279
|
}
|
|
276
280
|
e.preventDefault();
|
|
277
281
|
const o = e.clipboardData;
|
|
278
|
-
return o !== null && (
|
|
282
|
+
return o !== null && (_n(o, t), !0);
|
|
279
283
|
}
|
|
280
|
-
const
|
|
281
|
-
function
|
|
284
|
+
const yn = [["text/html", pn], ["application/x-lexical-editor", wn]];
|
|
285
|
+
function pt(n = D()) {
|
|
282
286
|
const e = { "text/plain": n ? n.getTextContent() : "" };
|
|
283
287
|
if (n) {
|
|
284
|
-
const t =
|
|
285
|
-
for (const [o, s] of
|
|
288
|
+
const t = kt();
|
|
289
|
+
for (const [o, s] of yn) {
|
|
286
290
|
const r = s(t, n);
|
|
287
291
|
r !== null && (e[o] = r);
|
|
288
292
|
}
|
|
289
293
|
}
|
|
290
294
|
return e;
|
|
291
295
|
}
|
|
292
|
-
function
|
|
296
|
+
function _n(n, e) {
|
|
293
297
|
for (const t in e) {
|
|
294
298
|
const o = e[t];
|
|
295
299
|
o !== void 0 && n.setData(t, o);
|
|
296
300
|
}
|
|
297
301
|
}
|
|
298
|
-
const
|
|
299
|
-
class de extends
|
|
302
|
+
const Re = /^(\d+(?:\.\d+)?)px$/, I = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
|
|
303
|
+
class de extends Fe {
|
|
300
304
|
static getType() {
|
|
301
305
|
return "tablecell";
|
|
302
306
|
}
|
|
@@ -307,13 +311,13 @@ class de extends Ee {
|
|
|
307
311
|
super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor;
|
|
308
312
|
}
|
|
309
313
|
static importDOM() {
|
|
310
|
-
return { td: (e) => ({ conversion:
|
|
314
|
+
return { td: (e) => ({ conversion: Je, priority: 0 }), th: (e) => ({ conversion: Je, priority: 0 }) };
|
|
311
315
|
}
|
|
312
316
|
static importJSON(e) {
|
|
313
317
|
const t = e.colSpan || 1, o = e.rowSpan || 1;
|
|
314
318
|
return oe(e.headerState, t, e.width || void 0).setRowSpan(o).setBackgroundColor(e.backgroundColor || null);
|
|
315
319
|
}
|
|
316
|
-
constructor(e =
|
|
320
|
+
constructor(e = I.NO_STATUS, t = 1, o, s) {
|
|
317
321
|
super(s), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = o, this.__backgroundColor = null;
|
|
318
322
|
}
|
|
319
323
|
createDOM(e) {
|
|
@@ -350,7 +354,7 @@ class de extends Ee {
|
|
|
350
354
|
getTag() {
|
|
351
355
|
return this.hasHeader() ? "th" : "td";
|
|
352
356
|
}
|
|
353
|
-
setHeaderStyles(e, t =
|
|
357
|
+
setHeaderStyles(e, t = I.BOTH) {
|
|
354
358
|
const o = this.getWritable();
|
|
355
359
|
return o.__headerState = e & t | o.__headerState & ~t, o;
|
|
356
360
|
}
|
|
@@ -379,7 +383,7 @@ class de extends Ee {
|
|
|
379
383
|
return (this.getHeaderStyles() & e) === e;
|
|
380
384
|
}
|
|
381
385
|
hasHeader() {
|
|
382
|
-
return this.getLatest().__headerState !==
|
|
386
|
+
return this.getLatest().__headerState !== I.NO_STATUS;
|
|
383
387
|
}
|
|
384
388
|
updateDOM(e) {
|
|
385
389
|
return e.__headerState !== this.__headerState || e.__width !== this.__width || e.__colSpan !== this.__colSpan || e.__rowSpan !== this.__rowSpan || e.__backgroundColor !== this.__backgroundColor;
|
|
@@ -397,50 +401,50 @@ class de extends Ee {
|
|
|
397
401
|
return !1;
|
|
398
402
|
}
|
|
399
403
|
}
|
|
400
|
-
function
|
|
404
|
+
function Je(n) {
|
|
401
405
|
const e = n, t = n.nodeName.toLowerCase();
|
|
402
406
|
let o;
|
|
403
|
-
|
|
404
|
-
const s = oe(t === "th" ?
|
|
407
|
+
Re.test(e.style.width) && (o = parseFloat(e.style.width));
|
|
408
|
+
const s = oe(t === "th" ? I.ROW : I.NO_STATUS, e.colSpan, o);
|
|
405
409
|
s.__rowSpan = e.rowSpan;
|
|
406
410
|
const r = e.style.backgroundColor;
|
|
407
411
|
r !== "" && (s.__backgroundColor = r);
|
|
408
|
-
const l = e.style, a = l.textDecoration.split(" "), d = l.fontWeight === "700" || l.fontWeight === "bold", h = a.includes("line-through"), i = l.fontStyle === "italic", c = a.includes("underline");
|
|
409
|
-
return { after: (u) => (u.length === 0 && u.push(
|
|
410
|
-
if (
|
|
411
|
-
const f =
|
|
412
|
-
return
|
|
413
|
-
` ? null : (
|
|
412
|
+
const l = e.style, a = (l && l.textDecoration || "").split(" "), d = l.fontWeight === "700" || l.fontWeight === "bold", h = a.includes("line-through"), i = l.fontStyle === "italic", c = a.includes("underline");
|
|
413
|
+
return { after: (u) => (u.length === 0 && u.push(V()), u), forChild: (u, g) => {
|
|
414
|
+
if (m(g) && !T(u)) {
|
|
415
|
+
const f = V();
|
|
416
|
+
return Dt(u) && u.getTextContent() === `
|
|
417
|
+
` ? null : ($(u) && (d && u.toggleFormat("bold"), h && u.toggleFormat("strikethrough"), i && u.toggleFormat("italic"), c && u.toggleFormat("underline")), f.append(u), f);
|
|
414
418
|
}
|
|
415
419
|
return u;
|
|
416
420
|
}, node: s };
|
|
417
421
|
}
|
|
418
422
|
function oe(n, e = 1, t) {
|
|
419
|
-
return
|
|
423
|
+
return Oe(new de(n, e, t));
|
|
420
424
|
}
|
|
421
|
-
function
|
|
425
|
+
function m(n) {
|
|
422
426
|
return n instanceof de;
|
|
423
427
|
}
|
|
424
|
-
const
|
|
425
|
-
function
|
|
428
|
+
const Wn = Pt();
|
|
429
|
+
function xn(n) {
|
|
426
430
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
427
431
|
}
|
|
428
|
-
var
|
|
432
|
+
var N = xn(function(n) {
|
|
429
433
|
const e = new URLSearchParams();
|
|
430
434
|
e.append("code", n);
|
|
431
435
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
432
436
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
433
437
|
});
|
|
434
|
-
const
|
|
435
|
-
class
|
|
438
|
+
const Nn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0;
|
|
439
|
+
class Ce extends Fe {
|
|
436
440
|
static getType() {
|
|
437
441
|
return "tablerow";
|
|
438
442
|
}
|
|
439
443
|
static clone(e) {
|
|
440
|
-
return new
|
|
444
|
+
return new Ce(e.__height, e.__key);
|
|
441
445
|
}
|
|
442
446
|
static importDOM() {
|
|
443
|
-
return { tr: (e) => ({ conversion:
|
|
447
|
+
return { tr: (e) => ({ conversion: vn, priority: 0 }) };
|
|
444
448
|
}
|
|
445
449
|
static importJSON(e) {
|
|
446
450
|
return he(e.height);
|
|
@@ -474,36 +478,57 @@ class we extends Ee {
|
|
|
474
478
|
return !1;
|
|
475
479
|
}
|
|
476
480
|
}
|
|
477
|
-
function
|
|
481
|
+
function vn(n) {
|
|
478
482
|
const e = n;
|
|
479
483
|
let t;
|
|
480
|
-
return
|
|
484
|
+
return Re.test(e.style.height) && (t = parseFloat(e.style.height)), { node: he(t) };
|
|
481
485
|
}
|
|
482
486
|
function he(n) {
|
|
483
|
-
return
|
|
487
|
+
return Oe(new Ce(n));
|
|
484
488
|
}
|
|
485
|
-
function
|
|
486
|
-
return n instanceof
|
|
489
|
+
function W(n) {
|
|
490
|
+
return n instanceof Ce;
|
|
487
491
|
}
|
|
488
|
-
function
|
|
489
|
-
const o =
|
|
492
|
+
function Tn(n, e, t = !0) {
|
|
493
|
+
const o = ke();
|
|
490
494
|
for (let s = 0; s < n; s++) {
|
|
491
495
|
const r = he();
|
|
492
496
|
for (let l = 0; l < e; l++) {
|
|
493
|
-
let a =
|
|
494
|
-
typeof t == "object" ? (s === 0 && t.rows && (a |=
|
|
495
|
-
const d = oe(a), h =
|
|
496
|
-
h.append(
|
|
497
|
+
let a = I.NO_STATUS;
|
|
498
|
+
typeof t == "object" ? (s === 0 && t.rows && (a |= I.ROW), l === 0 && t.columns && (a |= I.COLUMN)) : t && (s === 0 && (a |= I.ROW), l === 0 && (a |= I.COLUMN));
|
|
499
|
+
const d = oe(a), h = V();
|
|
500
|
+
h.append(Me()), d.append(h), r.append(d);
|
|
497
501
|
}
|
|
498
502
|
o.append(r);
|
|
499
503
|
}
|
|
500
504
|
return o;
|
|
501
505
|
}
|
|
502
|
-
function
|
|
506
|
+
function In(n) {
|
|
507
|
+
const e = _(n, (t) => m(t));
|
|
508
|
+
return m(e) ? e : null;
|
|
509
|
+
}
|
|
510
|
+
function ge(n) {
|
|
511
|
+
const e = _(n, (t) => W(t));
|
|
512
|
+
if (W(e)) return e;
|
|
513
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
514
|
+
}
|
|
515
|
+
function Se(n) {
|
|
516
|
+
const e = _(n, (t) => M(t));
|
|
517
|
+
if (M(e)) return e;
|
|
518
|
+
throw new Error("Expected table cell to be inside of table.");
|
|
519
|
+
}
|
|
520
|
+
function En(n) {
|
|
521
|
+
const e = ge(n);
|
|
522
|
+
return Se(e).getChildren().findIndex((t) => t.is(e));
|
|
523
|
+
}
|
|
524
|
+
function wt(n) {
|
|
525
|
+
return ge(n).getChildren().findIndex((e) => e.is(n));
|
|
526
|
+
}
|
|
527
|
+
function On(n, e) {
|
|
503
528
|
const t = n.getChildren();
|
|
504
529
|
for (let o = 0; o < t.length; o++) {
|
|
505
530
|
const s = t[o];
|
|
506
|
-
if (
|
|
531
|
+
if (W(s)) {
|
|
507
532
|
const r = s.getChildren();
|
|
508
533
|
if (e >= r.length || e < 0) throw new Error("Table column target index out of range");
|
|
509
534
|
r[e].remove();
|
|
@@ -511,11 +536,11 @@ function Nn(n, e) {
|
|
|
511
536
|
}
|
|
512
537
|
return n;
|
|
513
538
|
}
|
|
514
|
-
function
|
|
515
|
-
const [o, s, r] =
|
|
516
|
-
return s === null &&
|
|
539
|
+
function ne(n, e, t) {
|
|
540
|
+
const [o, s, r] = Mn(n, e, t);
|
|
541
|
+
return s === null && N(207), r === null && N(208), [o, s, r];
|
|
517
542
|
}
|
|
518
|
-
function
|
|
543
|
+
function Mn(n, e, t) {
|
|
519
544
|
const o = [];
|
|
520
545
|
let s = null, r = null;
|
|
521
546
|
function l(d) {
|
|
@@ -525,15 +550,15 @@ function xn(n, e, t) {
|
|
|
525
550
|
const a = n.getChildren();
|
|
526
551
|
for (let d = 0; d < a.length; d++) {
|
|
527
552
|
const h = a[d];
|
|
528
|
-
|
|
553
|
+
W(h) || N(209);
|
|
529
554
|
for (let i = h.getFirstChild(), c = 0; i != null; i = i.getNextSibling()) {
|
|
530
|
-
|
|
555
|
+
m(i) || N(147);
|
|
531
556
|
const u = l(d);
|
|
532
557
|
for (; u[c] !== void 0; ) c++;
|
|
533
|
-
const g = { cell: i, startColumn: c, startRow: d }, { __rowSpan: f, __colSpan:
|
|
558
|
+
const g = { cell: i, startColumn: c, startRow: d }, { __rowSpan: f, __colSpan: p } = i;
|
|
534
559
|
for (let w = 0; w < f && !(d + w >= a.length); w++) {
|
|
535
560
|
const C = l(d + w);
|
|
536
|
-
for (let
|
|
561
|
+
for (let x = 0; x < p; x++) C[c + x] = g;
|
|
537
562
|
}
|
|
538
563
|
e !== null && s === null && e.is(i) && (s = g), t !== null && r === null && t.is(i) && (r = g);
|
|
539
564
|
}
|
|
@@ -544,18 +569,18 @@ function le(n) {
|
|
|
544
569
|
let e;
|
|
545
570
|
if (n instanceof de) e = n;
|
|
546
571
|
else if ("__type" in n) {
|
|
547
|
-
const s =
|
|
548
|
-
|
|
572
|
+
const s = _(n, m);
|
|
573
|
+
m(s) || N(148), e = s;
|
|
549
574
|
} else {
|
|
550
|
-
const s =
|
|
551
|
-
|
|
575
|
+
const s = _(n.getNode(), m);
|
|
576
|
+
m(s) || N(148), e = s;
|
|
552
577
|
}
|
|
553
578
|
const t = e.getParent();
|
|
554
|
-
|
|
579
|
+
W(t) || N(149);
|
|
555
580
|
const o = t.getParent();
|
|
556
|
-
return
|
|
581
|
+
return M(o) || N(210), [e, t, o];
|
|
557
582
|
}
|
|
558
|
-
function
|
|
583
|
+
function Ye(n) {
|
|
559
584
|
const [e, , t] = le(n), o = t.getChildren(), s = o.length, r = o[0].getChildren().length, l = new Array(s);
|
|
560
585
|
for (let a = 0; a < s; a++) l[a] = new Array(r);
|
|
561
586
|
for (let a = 0; a < s; a++) {
|
|
@@ -564,14 +589,14 @@ function ze(n) {
|
|
|
564
589
|
for (let i = 0; i < d.length; i++) {
|
|
565
590
|
for (; l[a][h]; ) h++;
|
|
566
591
|
const c = d[i], u = c.__rowSpan || 1, g = c.__colSpan || 1;
|
|
567
|
-
for (let f = 0; f < u; f++) for (let
|
|
592
|
+
for (let f = 0; f < u; f++) for (let p = 0; p < g; p++) l[a + f][h + p] = c;
|
|
568
593
|
if (e === c) return { colSpan: g, columnIndex: h, rowIndex: a, rowSpan: u };
|
|
569
594
|
h += g;
|
|
570
595
|
}
|
|
571
596
|
}
|
|
572
597
|
return null;
|
|
573
598
|
}
|
|
574
|
-
class
|
|
599
|
+
class be {
|
|
575
600
|
constructor(e, t, o) {
|
|
576
601
|
this.anchor = t, this.focus = o, t._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = e;
|
|
577
602
|
}
|
|
@@ -588,13 +613,13 @@ class Ce {
|
|
|
588
613
|
this._cachedNodes = e;
|
|
589
614
|
}
|
|
590
615
|
is(e) {
|
|
591
|
-
return !!
|
|
616
|
+
return !!R(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
|
|
592
617
|
}
|
|
593
618
|
set(e, t, o) {
|
|
594
619
|
this.dirty = !0, this.tableKey = e, this.anchor.key = t, this.focus.key = o, this._cachedNodes = null;
|
|
595
620
|
}
|
|
596
621
|
clone() {
|
|
597
|
-
return new
|
|
622
|
+
return new be(this.tableKey, this.anchor, this.focus);
|
|
598
623
|
}
|
|
599
624
|
isCollapsed() {
|
|
600
625
|
return !1;
|
|
@@ -606,83 +631,92 @@ class Ce {
|
|
|
606
631
|
}
|
|
607
632
|
insertText() {
|
|
608
633
|
}
|
|
634
|
+
hasFormat(e) {
|
|
635
|
+
let t = 0;
|
|
636
|
+
this.getNodes().filter(m).forEach((s) => {
|
|
637
|
+
const r = s.getFirstChild();
|
|
638
|
+
ct(r) && (t |= r.getTextFormat());
|
|
639
|
+
});
|
|
640
|
+
const o = tn[e];
|
|
641
|
+
return !!(t & o);
|
|
642
|
+
}
|
|
609
643
|
insertNodes(e) {
|
|
610
644
|
const t = this.focus.getNode();
|
|
611
|
-
|
|
645
|
+
T(t) || N(151), nn(t.select(0, t.getChildrenSize())).insertNodes(e);
|
|
612
646
|
}
|
|
613
647
|
getShape() {
|
|
614
648
|
const e = ae(this.anchor.key);
|
|
615
|
-
|
|
616
|
-
const t =
|
|
617
|
-
t === null &&
|
|
649
|
+
m(e) || N(152);
|
|
650
|
+
const t = Ye(e);
|
|
651
|
+
t === null && N(153);
|
|
618
652
|
const o = ae(this.focus.key);
|
|
619
|
-
|
|
620
|
-
const s =
|
|
621
|
-
s === null &&
|
|
653
|
+
m(o) || N(154);
|
|
654
|
+
const s = Ye(o);
|
|
655
|
+
s === null && N(155);
|
|
622
656
|
const r = Math.min(t.columnIndex, s.columnIndex), l = Math.max(t.columnIndex + t.colSpan - 1, s.columnIndex + s.colSpan - 1), a = Math.min(t.rowIndex, s.rowIndex), d = Math.max(t.rowIndex + t.rowSpan - 1, s.rowIndex + s.rowSpan - 1);
|
|
623
657
|
return { fromX: Math.min(r, l), fromY: Math.min(a, d), toX: Math.max(r, l), toY: Math.max(a, d) };
|
|
624
658
|
}
|
|
625
659
|
getNodes() {
|
|
626
660
|
const e = this._cachedNodes;
|
|
627
661
|
if (e !== null) return e;
|
|
628
|
-
const t = this.anchor.getNode(), o = this.focus.getNode(), s =
|
|
629
|
-
|
|
662
|
+
const t = this.anchor.getNode(), o = this.focus.getNode(), s = _(t, m), r = _(o, m);
|
|
663
|
+
m(s) || N(152), m(r) || N(154);
|
|
630
664
|
const l = s.getParent();
|
|
631
|
-
|
|
665
|
+
W(l) || N(156);
|
|
632
666
|
const a = l.getParent();
|
|
633
|
-
|
|
667
|
+
M(a) || N(157);
|
|
634
668
|
const d = r.getParents()[1];
|
|
635
669
|
if (d !== a) {
|
|
636
670
|
if (a.isParentOf(r)) {
|
|
637
671
|
const b = d.getParent();
|
|
638
|
-
b == null &&
|
|
672
|
+
b == null && N(159), this.set(this.tableKey, r.getKey(), b.getKey());
|
|
639
673
|
} else {
|
|
640
674
|
const b = a.getParent();
|
|
641
|
-
b == null &&
|
|
675
|
+
b == null && N(158), this.set(this.tableKey, b.getKey(), r.getKey());
|
|
642
676
|
}
|
|
643
677
|
return this.getNodes();
|
|
644
678
|
}
|
|
645
|
-
const [h, i, c] =
|
|
646
|
-
let u = Math.min(i.startColumn, c.startColumn), g = Math.min(i.startRow, c.startRow), f = Math.max(i.startColumn + i.cell.__colSpan - 1, c.startColumn + c.cell.__colSpan - 1),
|
|
679
|
+
const [h, i, c] = ne(a, s, r);
|
|
680
|
+
let u = Math.min(i.startColumn, c.startColumn), g = Math.min(i.startRow, c.startRow), f = Math.max(i.startColumn + i.cell.__colSpan - 1, c.startColumn + c.cell.__colSpan - 1), p = Math.max(i.startRow + i.cell.__rowSpan - 1, c.startRow + c.cell.__rowSpan - 1), w = u, C = g, x = u, E = g;
|
|
647
681
|
function v(b) {
|
|
648
682
|
const { cell: y, startColumn: S, startRow: P } = b;
|
|
649
|
-
u = Math.min(u, S), g = Math.min(g, P), f = Math.max(f, S + y.__colSpan - 1),
|
|
683
|
+
u = Math.min(u, S), g = Math.min(g, P), f = Math.max(f, S + y.__colSpan - 1), p = Math.max(p, P + y.__rowSpan - 1);
|
|
650
684
|
}
|
|
651
|
-
for (; u < w || g < C || f >
|
|
685
|
+
for (; u < w || g < C || f > x || p > E; ) {
|
|
652
686
|
if (u < w) {
|
|
653
|
-
const b =
|
|
687
|
+
const b = E - C, y = w - 1;
|
|
654
688
|
for (let S = 0; S <= b; S++) v(h[C + S][y]);
|
|
655
689
|
w = y;
|
|
656
690
|
}
|
|
657
691
|
if (g < C) {
|
|
658
|
-
const b =
|
|
692
|
+
const b = x - w, y = C - 1;
|
|
659
693
|
for (let S = 0; S <= b; S++) v(h[y][w + S]);
|
|
660
694
|
C = y;
|
|
661
695
|
}
|
|
662
|
-
if (f >
|
|
663
|
-
const b =
|
|
696
|
+
if (f > x) {
|
|
697
|
+
const b = E - C, y = x + 1;
|
|
664
698
|
for (let S = 0; S <= b; S++) v(h[C + S][y]);
|
|
665
|
-
|
|
699
|
+
x = y;
|
|
666
700
|
}
|
|
667
|
-
if (
|
|
668
|
-
const b =
|
|
701
|
+
if (p > E) {
|
|
702
|
+
const b = x - w, y = E + 1;
|
|
669
703
|
for (let S = 0; S <= b; S++) v(h[y][w + S]);
|
|
670
|
-
|
|
704
|
+
E = y;
|
|
671
705
|
}
|
|
672
706
|
}
|
|
673
|
-
const
|
|
707
|
+
const K = /* @__PURE__ */ new Map([[a.getKey(), a]]);
|
|
674
708
|
let O = null;
|
|
675
|
-
for (let b = g; b <=
|
|
709
|
+
for (let b = g; b <= p; b++) for (let y = u; y <= f; y++) {
|
|
676
710
|
const { cell: S } = h[b][y], P = S.getParent();
|
|
677
|
-
|
|
678
|
-
for (const
|
|
711
|
+
W(P) || N(160), P !== O && K.set(P.getKey(), P), K.set(S.getKey(), S);
|
|
712
|
+
for (const L of Fn(S)) K.set(L.getKey(), L);
|
|
679
713
|
O = P;
|
|
680
714
|
}
|
|
681
|
-
const
|
|
682
|
-
return
|
|
715
|
+
const F = Array.from(K.values());
|
|
716
|
+
return on() || (this._cachedNodes = F), F;
|
|
683
717
|
}
|
|
684
718
|
getTextContent() {
|
|
685
|
-
const e = this.getNodes().filter((o) =>
|
|
719
|
+
const e = this.getNodes().filter((o) => m(o));
|
|
686
720
|
let t = "";
|
|
687
721
|
for (let o = 0; o < e.length; o++) {
|
|
688
722
|
const s = e[o], r = s.__parent, l = (e[o + 1] || {}).__parent;
|
|
@@ -692,22 +726,22 @@ class Ce {
|
|
|
692
726
|
return t;
|
|
693
727
|
}
|
|
694
728
|
}
|
|
695
|
-
function
|
|
696
|
-
return n instanceof
|
|
729
|
+
function R(n) {
|
|
730
|
+
return n instanceof be;
|
|
697
731
|
}
|
|
698
|
-
function
|
|
699
|
-
const n =
|
|
700
|
-
return new
|
|
732
|
+
function Xe() {
|
|
733
|
+
const n = Ie("root", 0, "element"), e = Ie("root", 0, "element");
|
|
734
|
+
return new be("root", n, e);
|
|
701
735
|
}
|
|
702
|
-
function
|
|
736
|
+
function Fn(n) {
|
|
703
737
|
const e = [], t = [n];
|
|
704
738
|
for (; t.length > 0; ) {
|
|
705
739
|
const o = t.pop();
|
|
706
|
-
o === void 0 &&
|
|
740
|
+
o === void 0 && N(112), T(o) && t.unshift(...o.getChildren()), o !== n && e.push(o);
|
|
707
741
|
}
|
|
708
742
|
return e;
|
|
709
743
|
}
|
|
710
|
-
class
|
|
744
|
+
class Rn {
|
|
711
745
|
constructor(e, t) {
|
|
712
746
|
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = t, this.editor = e, this.table = { columns: 0, domRows: [], rows: 0 }, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.trackTable(), this.isSelecting = !1, this.abortController = new AbortController(), this.listenerOptions = { signal: this.abortController.signal };
|
|
713
747
|
}
|
|
@@ -743,11 +777,11 @@ class Tn {
|
|
|
743
777
|
clearHighlight() {
|
|
744
778
|
const e = this.editor;
|
|
745
779
|
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(), e.update(() => {
|
|
746
|
-
if (!
|
|
780
|
+
if (!M(ae(this.tableNodeKey))) throw new Error("Expected TableNode.");
|
|
747
781
|
const t = e.getElementByKey(this.tableNodeKey);
|
|
748
782
|
if (!t) throw new Error("Expected to find TableElement in DOM");
|
|
749
783
|
const o = ce(t);
|
|
750
|
-
|
|
784
|
+
me(e, o, null), q(null), e.dispatchCommand(se, void 0);
|
|
751
785
|
});
|
|
752
786
|
}
|
|
753
787
|
enableHighlightStyle() {
|
|
@@ -755,7 +789,7 @@ class Tn {
|
|
|
755
789
|
e.update(() => {
|
|
756
790
|
const t = e.getElementByKey(this.tableNodeKey);
|
|
757
791
|
if (!t) throw new Error("Expected to find TableElement in DOM");
|
|
758
|
-
|
|
792
|
+
tt(t, e._config.theme.tableSelection), t.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
|
|
759
793
|
});
|
|
760
794
|
}
|
|
761
795
|
disableHighlightStyle() {
|
|
@@ -769,46 +803,46 @@ class Tn {
|
|
|
769
803
|
updateTableTableSelection(e) {
|
|
770
804
|
if (e !== null && e.tableKey === this.tableNodeKey) {
|
|
771
805
|
const t = this.editor;
|
|
772
|
-
this.tableSelection = e, this.isHighlightingCells = !0, this.disableHighlightStyle(),
|
|
806
|
+
this.tableSelection = e, this.isHighlightingCells = !0, this.disableHighlightStyle(), me(t, this.table, this.tableSelection);
|
|
773
807
|
} else e == null ? this.clearHighlight() : (this.tableNodeKey = e.tableKey, this.updateTableTableSelection(e));
|
|
774
808
|
}
|
|
775
809
|
setFocusCellForSelection(e, t = !1) {
|
|
776
810
|
const o = this.editor;
|
|
777
811
|
o.update(() => {
|
|
778
812
|
const s = ae(this.tableNodeKey);
|
|
779
|
-
if (!
|
|
813
|
+
if (!M(s)) throw new Error("Expected TableNode.");
|
|
780
814
|
if (!o.getElementByKey(this.tableNodeKey)) throw new Error("Expected to find TableElement in DOM");
|
|
781
815
|
const r = e.x, l = e.y;
|
|
782
816
|
if (this.focusCell = e, this.anchorCell !== null) {
|
|
783
|
-
const a =
|
|
817
|
+
const a = Ct(o._window);
|
|
784
818
|
a && a.setBaseAndExtent(this.anchorCell.elem, 0, this.focusCell.elem, 0);
|
|
785
819
|
}
|
|
786
820
|
if (this.isHighlightingCells || this.anchorX === r && this.anchorY === l && !t) {
|
|
787
821
|
if (r === this.focusX && l === this.focusY) return;
|
|
788
822
|
} else this.isHighlightingCells = !0, this.disableHighlightStyle();
|
|
789
823
|
if (this.focusX = r, this.focusY = l, this.isHighlightingCells) {
|
|
790
|
-
const a =
|
|
791
|
-
if (this.tableSelection != null && this.anchorCellNodeKey != null &&
|
|
824
|
+
const a = Y(e.elem);
|
|
825
|
+
if (this.tableSelection != null && this.anchorCellNodeKey != null && m(a) && s.is(te(a))) {
|
|
792
826
|
const d = a.getKey();
|
|
793
|
-
this.tableSelection = this.tableSelection.clone() ||
|
|
827
|
+
this.tableSelection = this.tableSelection.clone() || Xe(), this.focusCellNodeKey = d, this.tableSelection.set(this.tableNodeKey, this.anchorCellNodeKey, this.focusCellNodeKey), q(this.tableSelection), o.dispatchCommand(se, void 0), me(o, this.table, this.tableSelection);
|
|
794
828
|
}
|
|
795
829
|
}
|
|
796
830
|
});
|
|
797
831
|
}
|
|
798
832
|
setAnchorCellForSelection(e) {
|
|
799
833
|
this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y, this.editor.update(() => {
|
|
800
|
-
const t =
|
|
801
|
-
if (
|
|
834
|
+
const t = Y(e.elem);
|
|
835
|
+
if (m(t)) {
|
|
802
836
|
const o = t.getKey();
|
|
803
|
-
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() :
|
|
837
|
+
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Xe(), this.anchorCellNodeKey = o;
|
|
804
838
|
}
|
|
805
839
|
});
|
|
806
840
|
}
|
|
807
841
|
formatCells(e) {
|
|
808
842
|
this.editor.update(() => {
|
|
809
|
-
const t =
|
|
810
|
-
|
|
811
|
-
const o =
|
|
843
|
+
const t = D();
|
|
844
|
+
R(t) || N(11);
|
|
845
|
+
const o = en(), s = o.anchor, r = o.focus, l = t.getNodes().filter(m), a = l[0].getFirstChild(), d = ct(a) ? a.getFormatFlags(e, null) : null;
|
|
812
846
|
l.forEach((h) => {
|
|
813
847
|
s.set(h.getKey(), 0, "element"), r.set(h.getKey(), h.getChildrenSize(), "element"), o.formatText(e, d);
|
|
814
848
|
}), q(t), this.editor.dispatchCommand(se, void 0);
|
|
@@ -818,30 +852,30 @@ class Tn {
|
|
|
818
852
|
const e = this.editor;
|
|
819
853
|
e.update(() => {
|
|
820
854
|
const t = ae(this.tableNodeKey);
|
|
821
|
-
if (!
|
|
822
|
-
const o =
|
|
823
|
-
|
|
824
|
-
const s = o.getNodes().filter(
|
|
855
|
+
if (!M(t)) throw new Error("Expected TableNode.");
|
|
856
|
+
const o = D();
|
|
857
|
+
R(o) || N(11);
|
|
858
|
+
const s = o.getNodes().filter(m);
|
|
825
859
|
s.length !== this.table.columns * this.table.rows ? (s.forEach((r) => {
|
|
826
|
-
if (
|
|
827
|
-
const l =
|
|
860
|
+
if (T(r)) {
|
|
861
|
+
const l = V(), a = Me();
|
|
828
862
|
l.append(a), r.append(l), r.getChildren().forEach((d) => {
|
|
829
863
|
d !== l && d.remove();
|
|
830
864
|
});
|
|
831
865
|
}
|
|
832
|
-
}),
|
|
866
|
+
}), me(e, this.table, null), q(null), e.dispatchCommand(se, void 0)) : (t.selectPrevious(), t.remove(), Ee().selectStart());
|
|
833
867
|
});
|
|
834
868
|
}
|
|
835
869
|
}
|
|
836
|
-
const
|
|
837
|
-
function
|
|
870
|
+
const Te = "__lexicalTableSelection", Ct = (n) => Nn ? (n || window).getSelection() : null;
|
|
871
|
+
function zn(n, e, t, o) {
|
|
838
872
|
const s = t.getRootElement();
|
|
839
873
|
if (s === null) throw new Error("No root element.");
|
|
840
|
-
const r = new
|
|
874
|
+
const r = new Rn(t, n.getKey()), l = t._window || window;
|
|
841
875
|
(function(i, c) {
|
|
842
|
-
|
|
876
|
+
je(i) !== null && N(205), i[Te] = c;
|
|
843
877
|
})(e, r), r.listenersToRemove.add(() => function(i, c) {
|
|
844
|
-
|
|
878
|
+
je(i) === c && delete i[Te];
|
|
845
879
|
}(e, r));
|
|
846
880
|
const a = () => {
|
|
847
881
|
const i = () => {
|
|
@@ -849,7 +883,7 @@ function An(n, e, t, o) {
|
|
|
849
883
|
}, c = (u) => {
|
|
850
884
|
setTimeout(() => {
|
|
851
885
|
if (1 & ~u.buttons && r.isSelecting) return r.isSelecting = !1, l.removeEventListener("mouseup", i), void l.removeEventListener("mousemove", c);
|
|
852
|
-
const g =
|
|
886
|
+
const g = qe(u.target);
|
|
853
887
|
g === null || r.anchorX === g.x && r.anchorY === g.y || (u.preventDefault(), r.setFocusCellForSelection(g));
|
|
854
888
|
}, 0);
|
|
855
889
|
};
|
|
@@ -858,181 +892,181 @@ function An(n, e, t, o) {
|
|
|
858
892
|
e.addEventListener("mousedown", (i) => {
|
|
859
893
|
setTimeout(() => {
|
|
860
894
|
if (i.button !== 0 || !l) return;
|
|
861
|
-
const c =
|
|
862
|
-
c !== null && (
|
|
895
|
+
const c = qe(i.target);
|
|
896
|
+
c !== null && (J(i), r.setAnchorCellForSelection(c));
|
|
863
897
|
const { onMouseUp: u, onMouseMove: g } = a();
|
|
864
898
|
r.isSelecting = !0, l.addEventListener("mouseup", u, r.listenerOptions), l.addEventListener("mousemove", g, r.listenerOptions);
|
|
865
899
|
}, 0);
|
|
866
900
|
}, r.listenerOptions), l.addEventListener("mousedown", (i) => {
|
|
867
901
|
i.button === 0 && t.update(() => {
|
|
868
|
-
const c =
|
|
869
|
-
|
|
902
|
+
const c = D(), u = i.target;
|
|
903
|
+
R(c) && c.tableKey === r.tableNodeKey && s.contains(u) && r.clearHighlight();
|
|
870
904
|
});
|
|
871
|
-
}, r.listenerOptions), r.listenersToRemove.add(t.registerCommand(
|
|
872
|
-
const c =
|
|
873
|
-
if (
|
|
874
|
-
const u =
|
|
875
|
-
if (
|
|
905
|
+
}, r.listenerOptions), r.listenersToRemove.add(t.registerCommand(At, (i) => ie(t, i, "down", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Lt, (i) => ie(t, i, "up", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Ht, (i) => ie(t, i, "backward", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Bt, (i) => ie(t, i, "forward", n, r), Q)), r.listenersToRemove.add(t.registerCommand(Wt, (i) => {
|
|
906
|
+
const c = D();
|
|
907
|
+
if (R(c)) {
|
|
908
|
+
const u = _(c.focus.getNode(), m);
|
|
909
|
+
if (m(u)) return J(i), u.selectEnd(), !0;
|
|
876
910
|
}
|
|
877
911
|
return !1;
|
|
878
|
-
},
|
|
912
|
+
}, Q)), [It, We, zt].forEach((i) => {
|
|
879
913
|
r.listenersToRemove.add(t.registerCommand(i, /* @__PURE__ */ ((c) => () => {
|
|
880
|
-
const u =
|
|
881
|
-
if (!
|
|
882
|
-
if (
|
|
883
|
-
if (
|
|
884
|
-
const g =
|
|
885
|
-
if (!
|
|
886
|
-
const f = u.anchor.getNode(),
|
|
914
|
+
const u = D();
|
|
915
|
+
if (!G(u, n)) return !1;
|
|
916
|
+
if (R(u)) return r.clearText(), !0;
|
|
917
|
+
if (A(u)) {
|
|
918
|
+
const g = _(u.anchor.getNode(), (v) => m(v));
|
|
919
|
+
if (!m(g)) return !1;
|
|
920
|
+
const f = u.anchor.getNode(), p = u.focus.getNode(), w = n.isParentOf(f), C = n.isParentOf(p);
|
|
887
921
|
if (w && !C || C && !w) return r.clearText(), !0;
|
|
888
|
-
const
|
|
889
|
-
if (!E
|
|
890
|
-
if (c ===
|
|
922
|
+
const x = _(u.anchor.getNode(), (v) => T(v)), E = x && _(x, (v) => T(v) && m(v.getParent()));
|
|
923
|
+
if (!T(E) || !T(x)) return !1;
|
|
924
|
+
if (c === We && E.getPreviousSibling() === null) return !0;
|
|
891
925
|
}
|
|
892
926
|
return !1;
|
|
893
|
-
})(i),
|
|
927
|
+
})(i), B));
|
|
894
928
|
});
|
|
895
929
|
const d = (i) => {
|
|
896
|
-
const c =
|
|
897
|
-
if (!
|
|
930
|
+
const c = D();
|
|
931
|
+
if (!R(c) && !A(c)) return !1;
|
|
898
932
|
const u = n.isParentOf(c.anchor.getNode());
|
|
899
933
|
if (u !== n.isParentOf(c.focus.getNode())) {
|
|
900
|
-
const g = u ? "anchor" : "focus", f = u ? "focus" : "anchor", { key:
|
|
901
|
-
return n[c[g].isBefore(c[f]) ? "selectPrevious" : "selectNext"]()[f].set(
|
|
934
|
+
const g = u ? "anchor" : "focus", f = u ? "focus" : "anchor", { key: p, offset: w, type: C } = c[f];
|
|
935
|
+
return n[c[g].isBefore(c[f]) ? "selectPrevious" : "selectNext"]()[f].set(p, w, C), !1;
|
|
902
936
|
}
|
|
903
|
-
return !!
|
|
937
|
+
return !!R(c) && (i && (i.preventDefault(), i.stopPropagation()), r.clearText(), !0);
|
|
904
938
|
};
|
|
905
939
|
function h(i) {
|
|
906
940
|
const c = n.getCordsFromCellNode(i, r.table);
|
|
907
941
|
return n.getDOMCellFromCordsOrThrow(c.x, c.y, r.table);
|
|
908
942
|
}
|
|
909
|
-
return r.listenersToRemove.add(t.registerCommand(
|
|
910
|
-
const c =
|
|
943
|
+
return r.listenersToRemove.add(t.registerCommand(Ut, d, B)), r.listenersToRemove.add(t.registerCommand(Jt, d, B)), r.listenersToRemove.add(t.registerCommand(Yt, (i) => {
|
|
944
|
+
const c = D();
|
|
911
945
|
if (c) {
|
|
912
|
-
if (!
|
|
913
|
-
|
|
946
|
+
if (!R(c) && !A(c)) return !1;
|
|
947
|
+
bn(t, et(i, ClipboardEvent) ? i : null, pt(c));
|
|
914
948
|
const u = d(i);
|
|
915
|
-
return
|
|
949
|
+
return A(c) ? (c.removeText(), !0) : u;
|
|
916
950
|
}
|
|
917
951
|
return !1;
|
|
918
|
-
},
|
|
919
|
-
const c =
|
|
920
|
-
if (!
|
|
921
|
-
if (
|
|
922
|
-
if (
|
|
923
|
-
const u =
|
|
924
|
-
if (!
|
|
952
|
+
}, B)), r.listenersToRemove.add(t.registerCommand(Xt, (i) => {
|
|
953
|
+
const c = D();
|
|
954
|
+
if (!G(c, n)) return !1;
|
|
955
|
+
if (R(c)) return r.formatCells(i), !0;
|
|
956
|
+
if (A(c)) {
|
|
957
|
+
const u = _(c.anchor.getNode(), (g) => m(g));
|
|
958
|
+
if (!m(u)) return !1;
|
|
925
959
|
}
|
|
926
960
|
return !1;
|
|
927
|
-
},
|
|
928
|
-
const c =
|
|
929
|
-
if (!
|
|
961
|
+
}, B)), r.listenersToRemove.add(t.registerCommand(jt, (i) => {
|
|
962
|
+
const c = D();
|
|
963
|
+
if (!R(c) || !G(c, n)) return !1;
|
|
930
964
|
const u = c.anchor.getNode(), g = c.focus.getNode();
|
|
931
|
-
if (!
|
|
932
|
-
const [f,
|
|
933
|
-
for (let
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
const b =
|
|
965
|
+
if (!m(u) || !m(g)) return !1;
|
|
966
|
+
const [f, p, w] = ne(n, u, g), C = Math.max(p.startRow, w.startRow), x = Math.max(p.startColumn, w.startColumn), E = Math.min(p.startRow, w.startRow), v = Math.min(p.startColumn, w.startColumn);
|
|
967
|
+
for (let K = E; K <= C; K++) for (let O = v; O <= x; O++) {
|
|
968
|
+
const F = f[K][O].cell;
|
|
969
|
+
F.setFormat(i);
|
|
970
|
+
const b = F.getChildren();
|
|
937
971
|
for (let y = 0; y < b.length; y++) {
|
|
938
972
|
const S = b[y];
|
|
939
|
-
|
|
973
|
+
T(S) && !S.isInline() && S.setFormat(i);
|
|
940
974
|
}
|
|
941
975
|
}
|
|
942
976
|
return !0;
|
|
943
|
-
},
|
|
944
|
-
const c =
|
|
945
|
-
if (!
|
|
946
|
-
if (
|
|
947
|
-
if (
|
|
948
|
-
const u =
|
|
949
|
-
if (!
|
|
977
|
+
}, B)), r.listenersToRemove.add(t.registerCommand(qt, (i) => {
|
|
978
|
+
const c = D();
|
|
979
|
+
if (!G(c, n)) return !1;
|
|
980
|
+
if (R(c)) return r.clearHighlight(), !1;
|
|
981
|
+
if (A(c)) {
|
|
982
|
+
const u = _(c.anchor.getNode(), (g) => m(g));
|
|
983
|
+
if (!m(u)) return !1;
|
|
950
984
|
if (typeof i == "string") {
|
|
951
|
-
const g =
|
|
952
|
-
if (g) return
|
|
985
|
+
const g = Ve(t, c, n);
|
|
986
|
+
if (g) return Ge(g, n, [Me(i)]), !0;
|
|
953
987
|
}
|
|
954
988
|
}
|
|
955
989
|
return !1;
|
|
956
|
-
},
|
|
957
|
-
const c =
|
|
958
|
-
if (!
|
|
959
|
-
const u =
|
|
990
|
+
}, B)), o && r.listenersToRemove.add(t.registerCommand($t, (i) => {
|
|
991
|
+
const c = D();
|
|
992
|
+
if (!A(c) || !c.isCollapsed() || !G(c, n)) return !1;
|
|
993
|
+
const u = Ne(c.anchor.getNode());
|
|
960
994
|
if (u === null) return !1;
|
|
961
|
-
|
|
995
|
+
J(i);
|
|
962
996
|
const g = n.getCordsFromCellNode(u, r.table);
|
|
963
|
-
return
|
|
964
|
-
},
|
|
965
|
-
const { nodes: c, selection: u } = i, g = u.getStartEndPoints(), f =
|
|
966
|
-
if (c.length !== 1 || !
|
|
967
|
-
const [w] = g, C = c[0],
|
|
968
|
-
if (!
|
|
969
|
-
const b = O.getIndexWithinParent(), y = Math.min(
|
|
970
|
-
let
|
|
971
|
-
for (let
|
|
972
|
-
const re =
|
|
973
|
-
if (!
|
|
974
|
-
const
|
|
975
|
-
if (!
|
|
976
|
-
const
|
|
977
|
-
let
|
|
978
|
-
for (let
|
|
979
|
-
const
|
|
980
|
-
if (!
|
|
981
|
-
const
|
|
982
|
-
if (!
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
}),
|
|
997
|
+
return St(r, n, g.x, g.y, i.shiftKey ? "backward" : "forward"), !0;
|
|
998
|
+
}, B)), r.listenersToRemove.add(t.registerCommand(Gt, (i) => n.isSelected(), Q)), r.listenersToRemove.add(t.registerCommand(at, (i) => {
|
|
999
|
+
const { nodes: c, selection: u } = i, g = u.getStartEndPoints(), f = R(u), p = A(u) && _(u.anchor.getNode(), (k) => m(k)) !== null && _(u.focus.getNode(), (k) => m(k)) !== null || f;
|
|
1000
|
+
if (c.length !== 1 || !M(c[0]) || !p || g === null) return !1;
|
|
1001
|
+
const [w] = g, C = c[0], x = C.getChildren(), E = C.getFirstChildOrThrow().getChildrenSize(), v = C.getChildrenSize(), K = _(w.getNode(), (k) => m(k)), O = K && _(K, (k) => W(k)), F = O && _(O, (k) => M(k));
|
|
1002
|
+
if (!m(K) || !W(O) || !M(F)) return !1;
|
|
1003
|
+
const b = O.getIndexWithinParent(), y = Math.min(F.getChildrenSize() - 1, b + v - 1), S = K.getIndexWithinParent(), P = Math.min(O.getChildrenSize() - 1, S + E - 1), L = Math.min(S, P), H = Math.min(b, y), X = Math.max(S, P), z = Math.max(b, y), j = F.getChildren();
|
|
1004
|
+
let U = 0;
|
|
1005
|
+
for (let k = H; k <= z; k++) {
|
|
1006
|
+
const re = j[k];
|
|
1007
|
+
if (!W(re)) return !1;
|
|
1008
|
+
const De = x[U];
|
|
1009
|
+
if (!W(De)) return !1;
|
|
1010
|
+
const xt = re.getChildren(), Nt = De.getChildren();
|
|
1011
|
+
let Pe = 0;
|
|
1012
|
+
for (let _e = L; _e <= X; _e++) {
|
|
1013
|
+
const fe = xt[_e];
|
|
1014
|
+
if (!m(fe)) return !1;
|
|
1015
|
+
const Ae = Nt[Pe];
|
|
1016
|
+
if (!m(Ae)) return !1;
|
|
1017
|
+
const vt = fe.getChildren();
|
|
1018
|
+
Ae.getChildren().forEach((Z) => {
|
|
1019
|
+
$(Z) && V().append(Z), fe.append(Z);
|
|
1020
|
+
}), vt.forEach((Z) => Z.remove()), Pe++;
|
|
987
1021
|
}
|
|
988
|
-
|
|
1022
|
+
U++;
|
|
989
1023
|
}
|
|
990
1024
|
return !0;
|
|
991
|
-
},
|
|
992
|
-
const i =
|
|
993
|
-
if (
|
|
994
|
-
const { anchor: u, focus: g } = i, f = u.getNode(),
|
|
1025
|
+
}, B)), r.listenersToRemove.add(t.registerCommand(se, () => {
|
|
1026
|
+
const i = D(), c = Vt();
|
|
1027
|
+
if (A(i)) {
|
|
1028
|
+
const { anchor: u, focus: g } = i, f = u.getNode(), p = g.getNode(), w = Ne(f), C = Ne(p), x = !(!w || !n.is(te(w))), E = !(!C || !n.is(te(C))), v = x !== E, K = x && E, O = i.isBackward();
|
|
995
1029
|
if (v) {
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
998
|
-
const [b] =
|
|
999
|
-
|
|
1000
|
-
} else if (
|
|
1001
|
-
const [b] =
|
|
1002
|
-
|
|
1030
|
+
const F = i.clone();
|
|
1031
|
+
if (E) {
|
|
1032
|
+
const [b] = ne(n, C, C), y = b[0][0].cell, S = b[b.length - 1].at(-1).cell;
|
|
1033
|
+
F.focus.set(O ? y.getKey() : S.getKey(), O ? y.getChildrenSize() : S.getChildrenSize(), "element");
|
|
1034
|
+
} else if (x) {
|
|
1035
|
+
const [b] = ne(n, w, w), y = b[0][0].cell, S = b[b.length - 1].at(-1).cell;
|
|
1036
|
+
F.anchor.set(O ? S.getKey() : y.getKey(), O ? S.getChildrenSize() : 0, "element");
|
|
1003
1037
|
}
|
|
1004
|
-
q(
|
|
1005
|
-
} else
|
|
1006
|
-
const { onMouseUp:
|
|
1007
|
-
r.isSelecting = !0, l.addEventListener("mouseup",
|
|
1038
|
+
q(F), $e(t, r);
|
|
1039
|
+
} else K && (w.is(C) || (r.setAnchorCellForSelection(h(w)), r.setFocusCellForSelection(h(C), !0), r.isSelecting || setTimeout(() => {
|
|
1040
|
+
const { onMouseUp: F, onMouseMove: b } = a();
|
|
1041
|
+
r.isSelecting = !0, l.addEventListener("mouseup", F), l.addEventListener("mousemove", b);
|
|
1008
1042
|
}, 0)));
|
|
1009
|
-
} else if (i &&
|
|
1010
|
-
const u =
|
|
1043
|
+
} else if (i && R(i) && i.is(c) && i.tableKey === n.getKey()) {
|
|
1044
|
+
const u = Ct(t._window);
|
|
1011
1045
|
if (u && u.anchorNode && u.focusNode) {
|
|
1012
|
-
const g =
|
|
1046
|
+
const g = Y(u.focusNode), f = g && !n.is(te(g)), p = Y(u.anchorNode), w = p && n.is(te(p));
|
|
1013
1047
|
if (f && w && u.rangeCount > 0) {
|
|
1014
|
-
const C =
|
|
1048
|
+
const C = Zt(u, t);
|
|
1015
1049
|
C && (C.anchor.set(n.getKey(), i.isBackward() ? n.getChildrenSize() : 0, "element"), u.removeAllRanges(), q(C));
|
|
1016
1050
|
}
|
|
1017
1051
|
}
|
|
1018
1052
|
}
|
|
1019
|
-
return i && !i.is(c) && (
|
|
1020
|
-
g.enableHighlightStyle(),
|
|
1021
|
-
const
|
|
1022
|
-
f.highlighted = !1,
|
|
1053
|
+
return i && !i.is(c) && (R(i) || R(c)) && r.tableSelection && !r.tableSelection.is(c) ? (R(i) && i.tableKey === r.tableNodeKey ? r.updateTableTableSelection(i) : !R(i) && R(c) && c.tableKey === r.tableNodeKey && r.updateTableTableSelection(null), !1) : (r.hasHijackedSelectionStyles && !n.isSelected() ? function(u, g) {
|
|
1054
|
+
g.enableHighlightStyle(), Ke(g.table, (f) => {
|
|
1055
|
+
const p = f.elem;
|
|
1056
|
+
f.highlighted = !1, yt(u, f), p.getAttribute("style") || p.removeAttribute("style");
|
|
1023
1057
|
});
|
|
1024
|
-
}(t, r) : !r.hasHijackedSelectionStyles && n.isSelected() &&
|
|
1025
|
-
},
|
|
1026
|
-
const i =
|
|
1027
|
-
if (!
|
|
1028
|
-
const c =
|
|
1029
|
-
return !!c && (
|
|
1030
|
-
},
|
|
1031
|
-
}
|
|
1032
|
-
function
|
|
1033
|
-
return n[
|
|
1034
|
-
}
|
|
1035
|
-
function
|
|
1058
|
+
}(t, r) : !r.hasHijackedSelectionStyles && n.isSelected() && $e(t, r), !1);
|
|
1059
|
+
}, B)), r.listenersToRemove.add(t.registerCommand(Qt, () => {
|
|
1060
|
+
const i = D();
|
|
1061
|
+
if (!A(i) || !i.isCollapsed() || !G(i, n)) return !1;
|
|
1062
|
+
const c = Ve(t, i, n);
|
|
1063
|
+
return !!c && (Ge(c, n), !0);
|
|
1064
|
+
}, B)), r;
|
|
1065
|
+
}
|
|
1066
|
+
function je(n) {
|
|
1067
|
+
return n[Te] || null;
|
|
1068
|
+
}
|
|
1069
|
+
function qe(n) {
|
|
1036
1070
|
let e = n;
|
|
1037
1071
|
for (; e != null; ) {
|
|
1038
1072
|
const t = e.nodeName;
|
|
@@ -1075,44 +1109,44 @@ function ce(n) {
|
|
|
1075
1109
|
}
|
|
1076
1110
|
return t.columns = s + 1, t.rows = r + 1, t;
|
|
1077
1111
|
}
|
|
1078
|
-
function
|
|
1112
|
+
function me(n, e, t) {
|
|
1079
1113
|
const o = new Set(t ? t.getNodes() : []);
|
|
1080
|
-
|
|
1114
|
+
Ke(e, (s, r) => {
|
|
1081
1115
|
const l = s.elem;
|
|
1082
|
-
o.has(r) ? (s.highlighted = !0,
|
|
1116
|
+
o.has(r) ? (s.highlighted = !0, bt(n, s)) : (s.highlighted = !1, yt(n, s), l.getAttribute("style") || l.removeAttribute("style"));
|
|
1083
1117
|
});
|
|
1084
1118
|
}
|
|
1085
|
-
function
|
|
1119
|
+
function Ke(n, e) {
|
|
1086
1120
|
const { domRows: t } = n;
|
|
1087
1121
|
for (let o = 0; o < t.length; o++) {
|
|
1088
1122
|
const s = t[o];
|
|
1089
1123
|
if (s) for (let r = 0; r < s.length; r++) {
|
|
1090
1124
|
const l = s[r];
|
|
1091
1125
|
if (!l) continue;
|
|
1092
|
-
const a =
|
|
1126
|
+
const a = Y(l.elem);
|
|
1093
1127
|
a !== null && e(l, a, { x: r, y: o });
|
|
1094
1128
|
}
|
|
1095
1129
|
}
|
|
1096
1130
|
}
|
|
1097
|
-
function
|
|
1098
|
-
e.disableHighlightStyle(),
|
|
1099
|
-
t.highlighted = !0,
|
|
1131
|
+
function $e(n, e) {
|
|
1132
|
+
e.disableHighlightStyle(), Ke(e.table, (t) => {
|
|
1133
|
+
t.highlighted = !0, bt(n, t);
|
|
1100
1134
|
});
|
|
1101
1135
|
}
|
|
1102
|
-
const
|
|
1136
|
+
const St = (n, e, t, o, s) => {
|
|
1103
1137
|
const r = s === "forward";
|
|
1104
1138
|
switch (s) {
|
|
1105
1139
|
case "backward":
|
|
1106
1140
|
case "forward":
|
|
1107
|
-
return t !== (r ? n.table.columns - 1 : 0) ?
|
|
1141
|
+
return t !== (r ? n.table.columns - 1 : 0) ? pe(e.getCellNodeFromCordsOrThrow(t + (r ? 1 : -1), o, n.table), r) : o !== (r ? n.table.rows - 1 : 0) ? pe(e.getCellNodeFromCordsOrThrow(r ? 0 : n.table.columns - 1, o + (r ? 1 : -1), n.table), r) : r ? e.selectNext() : e.selectPrevious(), !0;
|
|
1108
1142
|
case "up":
|
|
1109
|
-
return o !== 0 ?
|
|
1143
|
+
return o !== 0 ? pe(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
|
|
1110
1144
|
case "down":
|
|
1111
|
-
return o !== n.table.rows - 1 ?
|
|
1145
|
+
return o !== n.table.rows - 1 ? pe(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
|
|
1112
1146
|
default:
|
|
1113
1147
|
return !1;
|
|
1114
1148
|
}
|
|
1115
|
-
},
|
|
1149
|
+
}, Kn = (n, e, t, o, s) => {
|
|
1116
1150
|
const r = s === "forward";
|
|
1117
1151
|
switch (s) {
|
|
1118
1152
|
case "backward":
|
|
@@ -1126,118 +1160,130 @@ const mt = (n, e, t, o, s) => {
|
|
|
1126
1160
|
return !1;
|
|
1127
1161
|
}
|
|
1128
1162
|
};
|
|
1129
|
-
function
|
|
1130
|
-
if (
|
|
1163
|
+
function G(n, e) {
|
|
1164
|
+
if (A(n) || R(n)) {
|
|
1131
1165
|
const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
|
|
1132
1166
|
return t && o;
|
|
1133
1167
|
}
|
|
1134
1168
|
return !1;
|
|
1135
1169
|
}
|
|
1136
|
-
function
|
|
1170
|
+
function pe(n, e) {
|
|
1137
1171
|
e ? n.selectStart() : n.selectEnd();
|
|
1138
1172
|
}
|
|
1139
|
-
const
|
|
1140
|
-
function
|
|
1141
|
-
const t = e.elem, o =
|
|
1142
|
-
|
|
1173
|
+
const xe = "172,206,247";
|
|
1174
|
+
function bt(n, e) {
|
|
1175
|
+
const t = e.elem, o = Y(t);
|
|
1176
|
+
m(o) || N(131), o.getBackgroundColor() === null ? t.style.setProperty("background-color", `rgb(${xe})`) : t.style.setProperty("background-image", `linear-gradient(to right, rgba(${xe},0.85), rgba(${xe},0.85))`), t.style.setProperty("caret-color", "transparent");
|
|
1143
1177
|
}
|
|
1144
|
-
function
|
|
1145
|
-
const t = e.elem, o =
|
|
1146
|
-
|
|
1178
|
+
function yt(n, e) {
|
|
1179
|
+
const t = e.elem, o = Y(t);
|
|
1180
|
+
m(o) || N(131), o.getBackgroundColor() === null && t.style.removeProperty("background-color"), t.style.removeProperty("background-image"), t.style.removeProperty("caret-color");
|
|
1147
1181
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const e =
|
|
1150
|
-
return
|
|
1182
|
+
function Ne(n) {
|
|
1183
|
+
const e = _(n, m);
|
|
1184
|
+
return m(e) ? e : null;
|
|
1151
1185
|
}
|
|
1152
|
-
function
|
|
1153
|
-
const e =
|
|
1154
|
-
return
|
|
1186
|
+
function te(n) {
|
|
1187
|
+
const e = _(n, M);
|
|
1188
|
+
return M(e) ? e : null;
|
|
1155
1189
|
}
|
|
1156
1190
|
function ie(n, e, t, o, s) {
|
|
1157
1191
|
if ((t === "up" || t === "down") && function(l) {
|
|
1158
1192
|
const a = l.getRootElement();
|
|
1159
1193
|
return a ? a.hasAttribute("aria-controls") && a.getAttribute("aria-controls") === "typeahead-menu" : !1;
|
|
1160
1194
|
}(n)) return !1;
|
|
1161
|
-
const r =
|
|
1162
|
-
if (!
|
|
1163
|
-
if (
|
|
1195
|
+
const r = D();
|
|
1196
|
+
if (!G(r, o)) {
|
|
1197
|
+
if (A(r)) {
|
|
1164
1198
|
if (r.isCollapsed() && t === "backward") {
|
|
1165
1199
|
const l = r.anchor.type, a = r.anchor.offset;
|
|
1166
1200
|
if (l !== "element" && (l !== "text" || a !== 0)) return !1;
|
|
1167
1201
|
const d = r.anchor.getNode();
|
|
1168
1202
|
if (!d) return !1;
|
|
1169
|
-
const h =
|
|
1203
|
+
const h = _(d, (c) => T(c) && !c.isInline());
|
|
1170
1204
|
if (!h) return !1;
|
|
1171
1205
|
const i = h.getPreviousSibling();
|
|
1172
|
-
return !(!i || !
|
|
1206
|
+
return !(!i || !M(i)) && (J(e), i.selectEnd(), !0);
|
|
1173
1207
|
}
|
|
1174
1208
|
if (e.shiftKey && (t === "up" || t === "down")) {
|
|
1175
1209
|
const l = r.focus.getNode();
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1210
|
+
if (!r.isCollapsed() && (t === "up" && !r.isBackward() || t === "down" && r.isBackward())) {
|
|
1211
|
+
let a = _(l, (u) => M(u));
|
|
1212
|
+
if (m(a) && (a = _(a, M)), a !== o || !a) return !1;
|
|
1213
|
+
const d = t === "down" ? a.getNextSibling() : a.getPreviousSibling();
|
|
1214
|
+
if (!d) return !1;
|
|
1215
|
+
let h = 0;
|
|
1216
|
+
t === "up" && T(d) && (h = d.getChildrenSize());
|
|
1217
|
+
let i = d;
|
|
1218
|
+
t === "up" && T(d) && (i = d.getLastChild() || d, h = $(i) ? i.getTextContentSize() : 0);
|
|
1219
|
+
const c = r.clone();
|
|
1220
|
+
return c.focus.set(i.getKey(), h, $(i) ? "text" : "element"), q(c), J(e), !0;
|
|
1221
|
+
}
|
|
1222
|
+
if (it(l)) {
|
|
1223
|
+
const a = t === "up" ? r.getNodes()[r.getNodes().length - 1] : r.getNodes()[0];
|
|
1178
1224
|
if (a) {
|
|
1179
|
-
const d =
|
|
1225
|
+
const d = _(a, m);
|
|
1180
1226
|
if (d && o.isParentOf(d)) {
|
|
1181
1227
|
const h = o.getFirstDescendant(), i = o.getLastDescendant();
|
|
1182
1228
|
if (!h || !i) return !1;
|
|
1183
|
-
const [c] = le(h), [u] = le(i), g = o.getCordsFromCellNode(c, s.table), f = o.getCordsFromCellNode(u, s.table),
|
|
1184
|
-
return s.setAnchorCellForSelection(
|
|
1229
|
+
const [c] = le(h), [u] = le(i), g = o.getCordsFromCellNode(c, s.table), f = o.getCordsFromCellNode(u, s.table), p = o.getDOMCellFromCordsOrThrow(g.x, g.y, s.table), w = o.getDOMCellFromCordsOrThrow(f.x, f.y, s.table);
|
|
1230
|
+
return s.setAnchorCellForSelection(p), s.setFocusCellForSelection(w, !0), !0;
|
|
1185
1231
|
}
|
|
1186
1232
|
}
|
|
1187
1233
|
return !1;
|
|
1188
1234
|
}
|
|
1189
1235
|
{
|
|
1190
|
-
|
|
1191
|
-
if (!a) return !1;
|
|
1236
|
+
let a = _(l, (h) => T(h) && !h.isInline());
|
|
1237
|
+
if (m(a) && (a = _(a, M)), !a) return !1;
|
|
1192
1238
|
const d = t === "down" ? a.getNextSibling() : a.getPreviousSibling();
|
|
1193
|
-
if (
|
|
1239
|
+
if (M(d) && s.tableNodeKey === d.getKey()) {
|
|
1194
1240
|
const h = d.getFirstDescendant(), i = d.getLastDescendant();
|
|
1195
1241
|
if (!h || !i) return !1;
|
|
1196
1242
|
const [c] = le(h), [u] = le(i), g = r.clone();
|
|
1197
|
-
return g.focus.set((t === "up" ? c : u).getKey(), t === "up" ? 0 : u.getChildrenSize(), "element"), q(g), !0;
|
|
1243
|
+
return g.focus.set((t === "up" ? c : u).getKey(), t === "up" ? 0 : u.getChildrenSize(), "element"), J(e), q(g), !0;
|
|
1198
1244
|
}
|
|
1199
1245
|
}
|
|
1200
1246
|
}
|
|
1201
1247
|
}
|
|
1202
1248
|
return !1;
|
|
1203
1249
|
}
|
|
1204
|
-
if (
|
|
1205
|
-
const { anchor: l, focus: a } = r, d =
|
|
1206
|
-
if (!
|
|
1207
|
-
const i =
|
|
1250
|
+
if (A(r) && r.isCollapsed()) {
|
|
1251
|
+
const { anchor: l, focus: a } = r, d = _(l.getNode(), m), h = _(a.getNode(), m);
|
|
1252
|
+
if (!m(d) || !d.is(h)) return !1;
|
|
1253
|
+
const i = te(d);
|
|
1208
1254
|
if (i !== o && i != null) {
|
|
1209
1255
|
const C = n.getElementByKey(i.getKey());
|
|
1210
1256
|
if (C != null) return s.table = ce(C), ie(n, e, t, i, s);
|
|
1211
1257
|
}
|
|
1212
1258
|
if (t === "backward" || t === "forward") {
|
|
1213
|
-
const C = l.type,
|
|
1214
|
-
if (!
|
|
1259
|
+
const C = l.type, x = l.offset, E = l.getNode();
|
|
1260
|
+
if (!E) return !1;
|
|
1215
1261
|
const v = r.getNodes();
|
|
1216
|
-
return (v.length !== 1 || !
|
|
1262
|
+
return (v.length !== 1 || !nt(v[0])) && !!function(K, O, F, b) {
|
|
1217
1263
|
return function(y, S, P) {
|
|
1218
1264
|
return y === "element" && (P === "backward" ? S.getPreviousSibling() === null : S.getNextSibling() === null);
|
|
1219
|
-
}(
|
|
1220
|
-
const
|
|
1221
|
-
if (!
|
|
1222
|
-
const
|
|
1223
|
-
return y === "text" &&
|
|
1224
|
-
}(
|
|
1225
|
-
}(C,
|
|
1226
|
-
const y =
|
|
1227
|
-
if (!
|
|
1228
|
-
const [S, P] =
|
|
1229
|
-
if (!function(
|
|
1230
|
-
const
|
|
1231
|
-
return
|
|
1265
|
+
}(K, F, b) || function(y, S, P, L) {
|
|
1266
|
+
const H = _(P, (z) => T(z) && !z.isInline());
|
|
1267
|
+
if (!H) return !1;
|
|
1268
|
+
const X = L === "backward" ? S === 0 : S === P.getTextContentSize();
|
|
1269
|
+
return y === "text" && X && (L === "backward" ? H.getPreviousSibling() === null : H.getNextSibling() === null);
|
|
1270
|
+
}(K, O, F, b);
|
|
1271
|
+
}(C, x, E, t) && function(K, O, F, b) {
|
|
1272
|
+
const y = _(O, m);
|
|
1273
|
+
if (!m(y)) return !1;
|
|
1274
|
+
const [S, P] = ne(F, y, y);
|
|
1275
|
+
if (!function(H, X, z) {
|
|
1276
|
+
const j = H[0][0], U = H[H.length - 1][H[0].length - 1], { startColumn: k, startRow: re } = X;
|
|
1277
|
+
return z === "backward" ? k === j.startColumn && re === j.startRow : k === U.startColumn && re === U.startRow;
|
|
1232
1278
|
}(S, P, b)) return !1;
|
|
1233
|
-
const
|
|
1234
|
-
const
|
|
1235
|
-
if (!
|
|
1236
|
-
const
|
|
1237
|
-
return
|
|
1238
|
-
}(O, b,
|
|
1239
|
-
return !
|
|
1240
|
-
}(e,
|
|
1279
|
+
const L = function(H, X, z) {
|
|
1280
|
+
const j = _(H, (k) => T(k) && !k.isInline());
|
|
1281
|
+
if (!j) return;
|
|
1282
|
+
const U = X === "backward" ? j.getPreviousSibling() : j.getNextSibling();
|
|
1283
|
+
return U && M(U) ? U : X === "backward" ? z.getPreviousSibling() : z.getNextSibling();
|
|
1284
|
+
}(O, b, F);
|
|
1285
|
+
return !L || M(L) ? !1 : (J(K), b === "backward" ? L.selectEnd() : L.selectStart(), !0);
|
|
1286
|
+
}(e, E, o, t);
|
|
1241
1287
|
}
|
|
1242
1288
|
const c = n.getElementByKey(d.__key), u = n.getElementByKey(l.key);
|
|
1243
1289
|
if (u == null || c == null) return !1;
|
|
@@ -1250,54 +1296,54 @@ function ie(n, e, t, o, s) {
|
|
|
1250
1296
|
}
|
|
1251
1297
|
const f = t === "up" ? d.getFirstChild() : d.getLastChild();
|
|
1252
1298
|
if (f == null) return !1;
|
|
1253
|
-
const
|
|
1254
|
-
if (
|
|
1255
|
-
const w =
|
|
1299
|
+
const p = n.getElementByKey(f.__key);
|
|
1300
|
+
if (p == null) return !1;
|
|
1301
|
+
const w = p.getBoundingClientRect();
|
|
1256
1302
|
if (t === "up" ? w.top > g.top - g.height : g.bottom + g.height > w.bottom) {
|
|
1257
|
-
|
|
1303
|
+
J(e);
|
|
1258
1304
|
const C = o.getCordsFromCellNode(d, s.table);
|
|
1259
|
-
if (!e.shiftKey) return
|
|
1305
|
+
if (!e.shiftKey) return St(s, o, C.x, C.y, t);
|
|
1260
1306
|
{
|
|
1261
|
-
const
|
|
1262
|
-
s.setAnchorCellForSelection(
|
|
1307
|
+
const x = o.getDOMCellFromCordsOrThrow(C.x, C.y, s.table);
|
|
1308
|
+
s.setAnchorCellForSelection(x), s.setFocusCellForSelection(x, !0);
|
|
1263
1309
|
}
|
|
1264
1310
|
return !0;
|
|
1265
1311
|
}
|
|
1266
|
-
} else if (
|
|
1267
|
-
const { anchor: l, focus: a } = r, d =
|
|
1268
|
-
if (!
|
|
1312
|
+
} else if (R(r)) {
|
|
1313
|
+
const { anchor: l, focus: a } = r, d = _(l.getNode(), m), h = _(a.getNode(), m), [i] = r.getNodes(), c = n.getElementByKey(i.getKey());
|
|
1314
|
+
if (!m(d) || !m(h) || !M(i) || c == null) return !1;
|
|
1269
1315
|
s.updateTableTableSelection(r);
|
|
1270
1316
|
const u = ce(c), g = o.getCordsFromCellNode(d, u), f = o.getDOMCellFromCordsOrThrow(g.x, g.y, u);
|
|
1271
|
-
if (s.setAnchorCellForSelection(f),
|
|
1272
|
-
const
|
|
1273
|
-
return
|
|
1317
|
+
if (s.setAnchorCellForSelection(f), J(e), e.shiftKey) {
|
|
1318
|
+
const p = o.getCordsFromCellNode(h, u);
|
|
1319
|
+
return Kn(s, i, p.x, p.y, t);
|
|
1274
1320
|
}
|
|
1275
1321
|
return h.selectEnd(), !0;
|
|
1276
1322
|
}
|
|
1277
1323
|
return !1;
|
|
1278
1324
|
}
|
|
1279
|
-
function
|
|
1325
|
+
function J(n) {
|
|
1280
1326
|
n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
|
|
1281
1327
|
}
|
|
1282
|
-
function
|
|
1283
|
-
const o =
|
|
1328
|
+
function Ge(n, e, t) {
|
|
1329
|
+
const o = V();
|
|
1284
1330
|
n === "first" ? e.insertBefore(o) : e.insertAfter(o), o.append(...t || []), o.selectEnd();
|
|
1285
1331
|
}
|
|
1286
|
-
function
|
|
1332
|
+
function Ve(n, e, t) {
|
|
1287
1333
|
const o = t.getParent();
|
|
1288
1334
|
if (!o) return;
|
|
1289
1335
|
const s = n.getElementByKey(o.getKey());
|
|
1290
1336
|
if (!s) return;
|
|
1291
1337
|
const r = window.getSelection();
|
|
1292
1338
|
if (!r || r.anchorNode !== s) return;
|
|
1293
|
-
const l =
|
|
1339
|
+
const l = _(e.anchor.getNode(), (w) => m(w));
|
|
1294
1340
|
if (!l) return;
|
|
1295
|
-
const a =
|
|
1296
|
-
if (!
|
|
1297
|
-
const [d, h] =
|
|
1298
|
-
return f ? "first" :
|
|
1341
|
+
const a = _(l, (w) => M(w));
|
|
1342
|
+
if (!M(a) || !a.is(t)) return;
|
|
1343
|
+
const [d, h] = ne(t, l, l), i = d[0][0], c = d[d.length - 1][d[0].length - 1], { startRow: u, startColumn: g } = h, f = u === i.startRow && g === i.startColumn, p = u === c.startRow && g === c.startColumn;
|
|
1344
|
+
return f ? "first" : p ? "last" : void 0;
|
|
1299
1345
|
}
|
|
1300
|
-
function
|
|
1346
|
+
function Ze(n, e, t, o) {
|
|
1301
1347
|
const s = n.querySelector("colgroup");
|
|
1302
1348
|
if (!s) return;
|
|
1303
1349
|
const r = [];
|
|
@@ -1307,10 +1353,10 @@ function $e(n, e, t, o) {
|
|
|
1307
1353
|
}
|
|
1308
1354
|
s.replaceChildren(...r);
|
|
1309
1355
|
}
|
|
1310
|
-
function
|
|
1311
|
-
t ? (ue(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (
|
|
1356
|
+
function Qe(n, e, t) {
|
|
1357
|
+
t ? (ue(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (tt(n, e.theme.tableRowStriping), n.removeAttribute("data-lexical-row-striping"));
|
|
1312
1358
|
}
|
|
1313
|
-
class
|
|
1359
|
+
class ye extends Fe {
|
|
1314
1360
|
static getType() {
|
|
1315
1361
|
return "table";
|
|
1316
1362
|
}
|
|
@@ -1322,16 +1368,16 @@ class Se extends Ee {
|
|
|
1322
1368
|
return t.__colWidths = e, t;
|
|
1323
1369
|
}
|
|
1324
1370
|
static clone(e) {
|
|
1325
|
-
return new
|
|
1371
|
+
return new ye(e.__key);
|
|
1326
1372
|
}
|
|
1327
1373
|
afterCloneFrom(e) {
|
|
1328
1374
|
super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping;
|
|
1329
1375
|
}
|
|
1330
1376
|
static importDOM() {
|
|
1331
|
-
return { table: (e) => ({ conversion:
|
|
1377
|
+
return { table: (e) => ({ conversion: kn, priority: 1 }) };
|
|
1332
1378
|
}
|
|
1333
1379
|
static importJSON(e) {
|
|
1334
|
-
const t =
|
|
1380
|
+
const t = ke();
|
|
1335
1381
|
return t.__rowStriping = e.rowStriping || !1, t.__colWidths = e.colWidths, t;
|
|
1336
1382
|
}
|
|
1337
1383
|
constructor(e) {
|
|
@@ -1342,16 +1388,16 @@ class Se extends Ee {
|
|
|
1342
1388
|
}
|
|
1343
1389
|
createDOM(e, t) {
|
|
1344
1390
|
const o = document.createElement("table"), s = document.createElement("colgroup");
|
|
1345
|
-
return o.appendChild(s),
|
|
1391
|
+
return o.appendChild(s), Ze(o, 0, this.getColumnCount(), this.getColWidths()), ue(o, e.theme.table), this.__rowStriping && Qe(o, e, !0), o;
|
|
1346
1392
|
}
|
|
1347
1393
|
updateDOM(e, t, o) {
|
|
1348
|
-
return e.__rowStriping !== this.__rowStriping &&
|
|
1394
|
+
return e.__rowStriping !== this.__rowStriping && Qe(t, o, this.__rowStriping), Ze(t, 0, this.getColumnCount(), this.getColWidths()), !1;
|
|
1349
1395
|
}
|
|
1350
1396
|
exportDOM(e) {
|
|
1351
1397
|
return { ...super.exportDOM(e), after: (t) => {
|
|
1352
1398
|
if (t) {
|
|
1353
1399
|
const o = t.cloneNode(), s = document.createElement("colgroup"), r = document.createElement("tbody");
|
|
1354
|
-
if (
|
|
1400
|
+
if (lt(t)) {
|
|
1355
1401
|
const l = t.querySelectorAll("col");
|
|
1356
1402
|
s.append(...l);
|
|
1357
1403
|
const a = t.querySelectorAll("tr");
|
|
@@ -1375,7 +1421,7 @@ class Se extends Ee {
|
|
|
1375
1421
|
const a = l.findIndex((d) => {
|
|
1376
1422
|
if (!d) return;
|
|
1377
1423
|
const { elem: h } = d;
|
|
1378
|
-
return
|
|
1424
|
+
return Y(h) === e;
|
|
1379
1425
|
});
|
|
1380
1426
|
if (a !== -1) return { x: a, y: r };
|
|
1381
1427
|
}
|
|
@@ -1395,8 +1441,8 @@ class Se extends Ee {
|
|
|
1395
1441
|
getCellNodeFromCords(e, t, o) {
|
|
1396
1442
|
const s = this.getDOMCellFromCords(e, t, o);
|
|
1397
1443
|
if (s == null) return null;
|
|
1398
|
-
const r =
|
|
1399
|
-
return
|
|
1444
|
+
const r = Y(s.elem);
|
|
1445
|
+
return m(r) ? r : null;
|
|
1400
1446
|
}
|
|
1401
1447
|
getCellNodeFromCordsOrThrow(e, t, o) {
|
|
1402
1448
|
const s = this.getCellNodeFromCords(e, t, o);
|
|
@@ -1420,41 +1466,55 @@ class Se extends Ee {
|
|
|
1420
1466
|
if (!e) return 0;
|
|
1421
1467
|
let t = 0;
|
|
1422
1468
|
return e.getChildren().forEach((o) => {
|
|
1423
|
-
|
|
1469
|
+
m(o) && (t += o.getColSpan());
|
|
1424
1470
|
}), t;
|
|
1425
1471
|
}
|
|
1426
1472
|
}
|
|
1427
|
-
function
|
|
1428
|
-
const e =
|
|
1429
|
-
|
|
1473
|
+
function kn(n) {
|
|
1474
|
+
const e = ke();
|
|
1475
|
+
n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0);
|
|
1476
|
+
const t = n.querySelector(":scope > colgroup");
|
|
1477
|
+
if (t) {
|
|
1478
|
+
let o = [];
|
|
1479
|
+
for (const s of t.querySelectorAll(":scope > col")) {
|
|
1480
|
+
const r = s.style.width;
|
|
1481
|
+
if (!r || !Re.test(r)) {
|
|
1482
|
+
o = void 0;
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
o.push(parseFloat(r));
|
|
1486
|
+
}
|
|
1487
|
+
o && e.setColWidths(o);
|
|
1488
|
+
}
|
|
1489
|
+
return { node: e };
|
|
1430
1490
|
}
|
|
1431
|
-
function
|
|
1432
|
-
return
|
|
1491
|
+
function ke() {
|
|
1492
|
+
return Oe(new ye());
|
|
1433
1493
|
}
|
|
1434
|
-
function
|
|
1435
|
-
return n instanceof
|
|
1494
|
+
function M(n) {
|
|
1495
|
+
return n instanceof ye;
|
|
1436
1496
|
}
|
|
1437
|
-
const
|
|
1438
|
-
const t =
|
|
1497
|
+
const _t = 100, Un = (n, e) => {
|
|
1498
|
+
const t = Tn(0, 0, !1);
|
|
1439
1499
|
for (let o = 0; o < n; o++) {
|
|
1440
1500
|
const s = he();
|
|
1441
1501
|
for (let r = 0; r < e; r++) {
|
|
1442
|
-
const l = oe(0, void 0,
|
|
1502
|
+
const l = oe(0, void 0, _t / e);
|
|
1443
1503
|
s.append(l);
|
|
1444
1504
|
}
|
|
1445
1505
|
t.append(s);
|
|
1446
1506
|
}
|
|
1447
1507
|
return t;
|
|
1448
|
-
},
|
|
1449
|
-
const e = n
|
|
1508
|
+
}, Jn = (n) => {
|
|
1509
|
+
const e = ge(n), t = e.getNextSibling() || e.getPreviousSibling(), o = e.getParentOrThrow();
|
|
1450
1510
|
if (o.getChildrenSize() > 1 ? e.remove() : o.remove(), t !== null) {
|
|
1451
1511
|
const s = t.getFirstDescendant();
|
|
1452
1512
|
s && s.select();
|
|
1453
1513
|
}
|
|
1454
|
-
},
|
|
1455
|
-
n
|
|
1456
|
-
},
|
|
1457
|
-
const t = he(), o = n
|
|
1514
|
+
}, Dn = (n) => {
|
|
1515
|
+
Se(n).remove();
|
|
1516
|
+
}, Yn = (n, e) => {
|
|
1517
|
+
const t = he(), o = ge(n), s = o.getChildrenSize();
|
|
1458
1518
|
for (let l = 0; l < s; l++) {
|
|
1459
1519
|
const a = oe(0);
|
|
1460
1520
|
t.append(a);
|
|
@@ -1462,51 +1522,57 @@ const Ct = 100, Hn = (n, e) => {
|
|
|
1462
1522
|
e === "insertRowAbove" ? o.insertBefore(t) : o.insertAfter(t);
|
|
1463
1523
|
const r = t.getFirstDescendant();
|
|
1464
1524
|
r && r.select();
|
|
1465
|
-
},
|
|
1466
|
-
const t = n
|
|
1467
|
-
|
|
1525
|
+
}, Xn = (n, e) => {
|
|
1526
|
+
const t = ge(n);
|
|
1527
|
+
if (!m(n))
|
|
1528
|
+
throw new Error("Selected node is not a TableCellNode");
|
|
1529
|
+
const o = En(n), s = t.getChildren().length, r = Se(n);
|
|
1530
|
+
let l = wt(n);
|
|
1468
1531
|
const a = r.getChildren(), d = a.length;
|
|
1469
1532
|
for (let i = 0; i < d; i++) {
|
|
1470
1533
|
const c = oe(0), u = a[i].getChildren()[l];
|
|
1471
1534
|
u && (e === "insertColumnLeft" ? u.insertBefore(c) : u.insertAfter(c)), a.forEach((g) => {
|
|
1472
1535
|
g.getChildren().forEach((f) => {
|
|
1473
|
-
f.setWidth(
|
|
1536
|
+
f.setWidth(_t / s);
|
|
1474
1537
|
});
|
|
1475
1538
|
});
|
|
1476
1539
|
}
|
|
1477
1540
|
l = e === "insertColumnLeft" ? l : l + 1;
|
|
1478
1541
|
const h = a[o].getChildren()[l];
|
|
1479
1542
|
h && h.select();
|
|
1480
|
-
},
|
|
1481
|
-
var
|
|
1482
|
-
|
|
1483
|
-
|
|
1543
|
+
}, jn = (n) => {
|
|
1544
|
+
var s;
|
|
1545
|
+
if (!m(n))
|
|
1546
|
+
throw new Error("Selected node is not a TableCellNode");
|
|
1547
|
+
const e = Se(n), t = ((s = e.getFirstChild()) == null ? void 0 : s.getChildrenSize()) || 0, o = wt(n);
|
|
1548
|
+
t === 1 ? Dn(n) : On(e, o);
|
|
1484
1549
|
};
|
|
1485
1550
|
export {
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1551
|
+
Hn as $,
|
|
1552
|
+
ne as F,
|
|
1553
|
+
Mn as K,
|
|
1554
|
+
Ln as L,
|
|
1555
|
+
bn as O,
|
|
1556
|
+
zn as U,
|
|
1557
|
+
Bn as _,
|
|
1558
|
+
jn as a,
|
|
1559
|
+
Jn as b,
|
|
1560
|
+
Yn as c,
|
|
1561
|
+
Dn as d,
|
|
1562
|
+
Un as e,
|
|
1563
|
+
de as f,
|
|
1564
|
+
In as g,
|
|
1565
|
+
Ce as h,
|
|
1566
|
+
Xn as i,
|
|
1567
|
+
Tn as j,
|
|
1568
|
+
M as k,
|
|
1569
|
+
le as l,
|
|
1570
|
+
W as m,
|
|
1571
|
+
oe as n,
|
|
1572
|
+
m as o,
|
|
1573
|
+
dn as p,
|
|
1574
|
+
hn as q,
|
|
1575
|
+
Wn as r,
|
|
1576
|
+
ye as u
|
|
1511
1577
|
};
|
|
1512
|
-
//# sourceMappingURL=helpers-
|
|
1578
|
+
//# sourceMappingURL=helpers-D9T1Tgkj.js.map
|