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