@mx-space/cli 0.7.8 → 0.8.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.dev-rcxzwpir.mjs → Lexical.dev-By5dOKBN.mjs} +1486 -356
- package/dist/{Lexical.node-BUsI9gWr.mjs → Lexical.node-fXM8Jp7p.mjs} +39 -17
- package/dist/{Lexical.prod-C8HtkSD6.mjs → Lexical.prod-BlCvXPGa.mjs} +2279 -1768
- package/dist/LexicalClipboard.dev--HxGoSkO.mjs +915 -0
- package/dist/{LexicalClipboard.node-CO-MCKx5.mjs → LexicalClipboard.node-C3mRbrmW.mjs} +10 -3
- package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +371 -0
- package/dist/LexicalCodeCore.dev-DjSrd4A4.mjs +1109 -0
- package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +642 -0
- package/dist/{LexicalDragon.dev-gBP8WSRS.mjs → LexicalDragon.dev-DwprRH0z.mjs} +3 -3
- package/dist/{LexicalDragon.node-OG6G55nl.mjs → LexicalDragon.node-BVhw4C7s.mjs} +2 -2
- package/dist/{LexicalDragon.prod-DP-_Q8cv.mjs → LexicalDragon.prod-nh4J-8vn.mjs} +3 -3
- package/dist/{LexicalExtension.dev-DVbjljrm.mjs → LexicalExtension.dev-BPNyvGqe.mjs} +335 -6
- package/dist/{LexicalExtension.node-CF3EAPN7.mjs → LexicalExtension.node-BVlcrgOx.mjs} +15 -8
- package/dist/{LexicalExtension.prod-DklHHErZ.mjs → LexicalExtension.prod-DFKbiNt-.mjs} +375 -265
- package/dist/{LexicalHeadless.dev-DdWLM7Nl.mjs → LexicalHeadless.dev-B-cj7Pr5.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-CoiiTDzR.mjs → LexicalHeadless.prod-Byp1vNzT.mjs} +2 -2
- package/dist/LexicalHtml.dev-prBAwszN.mjs +2424 -0
- package/dist/LexicalHtml.node-BvNF96jZ.mjs +56 -0
- package/dist/LexicalHtml.prod-Sz3CW1ht.mjs +1207 -0
- package/dist/{LexicalLink.dev-BS1Bf-yD.mjs → LexicalLink.dev-NySTYhVR.mjs} +42 -8
- package/dist/{LexicalLink.prod-B_crkoHP.mjs → LexicalLink.prod-BuCM8gts.mjs} +209 -191
- package/dist/{LexicalList.dev-OMqmcnQ-.mjs → LexicalList.dev-DIMOvSFD.mjs} +252 -80
- package/dist/{LexicalList.prod-CpL1s8vS.mjs → LexicalList.prod-MVqfA6Vo.mjs} +364 -278
- package/dist/{LexicalMarkdown.dev-BHSdx_Gr.mjs → LexicalMarkdown.dev-C7aylvCG.mjs} +729 -552
- package/dist/LexicalMarkdown.prod-CfQSM406.mjs +868 -0
- package/dist/{LexicalRichText.dev-Bz9A_WbM.mjs → LexicalRichText.dev-DfICq6lU.mjs} +272 -77
- package/dist/{LexicalRichText.node-DDpwfE-P.mjs → LexicalRichText.node-Bg9jND3Q.mjs} +21 -8
- package/dist/LexicalRichText.prod-GsFzCK-o.mjs +550 -0
- package/dist/{LexicalSelection.dev-CQ380fnD.mjs → LexicalSelection.dev-DGjj12wW.mjs} +50 -38
- package/dist/{LexicalSelection.node-DesBMjIE.mjs → LexicalSelection.node-BU5L4193.mjs} +4 -4
- package/dist/{LexicalSelection.prod-D2jivCDB.mjs → LexicalSelection.prod-D-PwRbyK.mjs} +158 -140
- package/dist/{LexicalTable.dev-Ca7mQ7Jk.mjs → LexicalTable.dev-ChP7cugd.mjs} +215 -53
- package/dist/{LexicalTable.prod-DyPAcC7y.mjs → LexicalTable.prod-Bpr9YRXp.mjs} +668 -573
- package/dist/{LexicalUtils.dev-HxM8F0g6.mjs → LexicalUtils.dev-BiFU3789.mjs} +10 -47
- package/dist/{LexicalUtils.node-lCWjRjoG.mjs → LexicalUtils.node-j3Llm7Y3.mjs} +2 -2
- package/dist/{LexicalUtils.prod-Bti5w4ki.mjs → LexicalUtils.prod-DCvrA78p.mjs} +103 -105
- package/dist/bin/mxs.d.mts +1 -1
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-By7trG9K.mjs +2 -0
- package/dist/{esm-CK9m5JKX.mjs → esm-Dg-WhPCe.mjs} +989 -989
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{mxs-BZt1cLW9.mjs → mxs-DT0oYk6U.mjs} +11935 -11866
- package/package.json +15 -14
- package/dist/LexicalClipboard.dev-BpqRwTLP.mjs +0 -494
- package/dist/LexicalClipboard.prod-B_xdeiAC.mjs +0 -291
- package/dist/LexicalCodeCore.dev-7_cexm39.mjs +0 -537
- package/dist/LexicalCodeCore.prod-Bd6WFHcO.mjs +0 -381
- package/dist/LexicalHtml.dev-C3ZSWBFZ.mjs +0 -684
- package/dist/LexicalHtml.node-D0TD152E.mjs +0 -24
- package/dist/LexicalHtml.prod-CX47X0zl.mjs +0 -430
- package/dist/LexicalMarkdown.prod-C-S7Ii6-.mjs +0 -754
- package/dist/LexicalRichText.prod-C8qXACDL.mjs +0 -427
- package/dist/esm-DRbkkY3r.mjs +0 -2
- /package/dist/{mxs-CM8-6uAr.d.mts → mxs-iqJBopvE.d.mts} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { f as namedSignals, l as effect, p as signal } from "./LexicalExtension.node-BVlcrgOx.mjs";
|
|
2
|
+
import { $ as $isElementNode, $t as ElementNode, An as KEY_ARROW_UP_COMMAND, Bt as COMMAND_PRIORITY_LOW, Cn as IS_STRIKETHROUGH, Cr as isHTMLTableRowElement, Ct as $setPointFromCaret, Dn as KEY_ARROW_DOWN_COMMAND, En as IS_UNDERLINE, F as $getEditor, H as $getRoot, Ht as CONTROLLED_TEXT_INSERTION_COMMAND, In as KEY_TAB_COMMAND, Jn as SELECT_ALL_COMMAND, Jt as DELETE_WORD_COMMAND, Kn as SELECTION_CHANGE_COMMAND, Kt as DELETE_CHARACTER_COMMAND, L as $getNearestNodeFromDOMNode, Mn as KEY_DELETE_COMMAND, Mr as setDOMStyleFromCSS, Nr as setDOMUnmanaged, On as KEY_ARROW_LEFT_COMMAND, Pn as KEY_ESCAPE_COMMAND, Pt as CLICK_COMMAND, Qn as TEXT_TYPE_TO_FORMAT, R as $getNodeByKey, Rt as COMMAND_PRIORITY_EDITOR, S as $getAdjacentChildCaret, Sr as isHTMLElement, U as $getSelection, V as $getPreviousSelection, W as $getSiblingCaret, Wt as CUT_COMMAND, X as $isChildCaret, _ as $createTextNode, b as $fullReconcile, cn as INSERT_PARAGRAPH_COMMAND, cr as defineExtension, ct as $isRootNode, en as FOCUS_COMMAND, et as $isExtendableTextPointCaret, f as $createParagraphNode, ft as $isTextNode, gr as isCurrentlyReadOnlyMode, gt as $normalizeSelection__EXPERIMENTAL, h as $createRangeSelectionFromDom, hn as IS_BOLD, ht as $normalizeCaret, ir as createCommand, it as $isLineBreakNode, jn as KEY_BACKSPACE_COMMAND, jr as safeCast, k as $getChildCaret, kn as KEY_ARROW_RIGHT_COMMAND, lr as getDOMSelection, lt as $isRootOrShadowRoot, m as $createRangeSelection, n as $applyNodeReplacement, nn as FORMAT_TEXT_COMMAND, ot as $isParagraphNode, p as $createPoint, qn as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, qt as DELETE_LINE_COMMAND, r as $caretFromPoint, rr as configExtension, st as $isRangeSelection, tn as FORMAT_ELEMENT_COMMAND, tt as $isInlineElementOrDecoratorNode, ut as $isSiblingCaret, v as $extendCaretToRange, vn as IS_FIREFOX, vr as isDOMNode, wt as $setSelection, xn as IS_ITALIC, z as $getNodeByKeyOrThrow, zt as COMMAND_PRIORITY_HIGH } from "./Lexical.node-fXM8Jp7p.mjs";
|
|
3
|
+
import { a as CoreImportExtension, d as ImportTextStyle, f as contextValue, g as sel, o as DOMImportExtension, p as defineImportRule, u as ImportTextFormat } from "./LexicalHtml.node-BvNF96jZ.mjs";
|
|
4
|
+
import { _ as removeClassNamesFromElement, c as $insertNodeToNearestRoot, d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, m as isHTMLElement$1, n as $dfs, r as $findMatchingParent, s as $insertFirst, t as $descendantsMatching, u as $unwrapAndFilterDescendants } from "./LexicalUtils.node-j3Llm7Y3.mjs";
|
|
5
|
+
import { o as copyToClipboard, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-C3mRbrmW.mjs";
|
|
6
|
+
//#region ../../node_modules/.pnpm/@lexical+table@0.45.0/node_modules/@lexical/table/dist/LexicalTable.prod.mjs
|
|
6
7
|
/**
|
|
7
8
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
9
|
*
|
|
@@ -10,13 +11,13 @@ import { a as copyToClipboard, t as $getClipboardDataFromSelection } from "./Lex
|
|
|
10
11
|
* LICENSE file in the root directory of this source tree.
|
|
11
12
|
*
|
|
12
13
|
*/
|
|
13
|
-
const
|
|
14
|
+
const Je = /^(\d+(?:\.\d+)?)px$/, Xe = {
|
|
14
15
|
BOTH: 3,
|
|
15
16
|
COLUMN: 2,
|
|
16
17
|
NO_STATUS: 0,
|
|
17
18
|
ROW: 1
|
|
18
19
|
};
|
|
19
|
-
var
|
|
20
|
+
var Ye = class Ye extends ElementNode {
|
|
20
21
|
__colSpan;
|
|
21
22
|
__rowSpan;
|
|
22
23
|
__headerState;
|
|
@@ -27,7 +28,7 @@ var Ee = class Ee extends ElementNode {
|
|
|
27
28
|
return "tablecell";
|
|
28
29
|
}
|
|
29
30
|
static clone(e) {
|
|
30
|
-
return new
|
|
31
|
+
return new Ye(e.__headerState, e.__colSpan, e.__width, e.__key);
|
|
31
32
|
}
|
|
32
33
|
afterCloneFrom(e) {
|
|
33
34
|
super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor, this.__verticalAlign = e.__verticalAlign, this.__colSpan = e.__colSpan, this.__headerState = e.__headerState, this.__width = e.__width;
|
|
@@ -35,27 +36,27 @@ var Ee = class Ee extends ElementNode {
|
|
|
35
36
|
static importDOM() {
|
|
36
37
|
return {
|
|
37
38
|
td: (e) => ({
|
|
38
|
-
conversion:
|
|
39
|
+
conversion: je,
|
|
39
40
|
priority: 0
|
|
40
41
|
}),
|
|
41
42
|
th: (e) => ({
|
|
42
|
-
conversion:
|
|
43
|
+
conversion: je,
|
|
43
44
|
priority: 0
|
|
44
45
|
})
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
static importJSON(e) {
|
|
48
|
-
return
|
|
49
|
+
return Ve().updateFromJSON(e);
|
|
49
50
|
}
|
|
50
51
|
updateFromJSON(e) {
|
|
51
52
|
return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan || 1).setRowSpan(e.rowSpan || 1).setWidth(e.width || void 0).setBackgroundColor(e.backgroundColor || null).setVerticalAlign(e.verticalAlign || void 0);
|
|
52
53
|
}
|
|
53
|
-
constructor(e =
|
|
54
|
+
constructor(e = Xe.NO_STATUS, t = 1, n, o) {
|
|
54
55
|
super(o), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = n, this.__backgroundColor = null, this.__verticalAlign = void 0;
|
|
55
56
|
}
|
|
56
57
|
createDOM(t) {
|
|
57
58
|
const n = document.createElement(this.getTag());
|
|
58
|
-
return this.__width && (n.style.width = `${this.__width}px`), this.__colSpan > 1 && (n.colSpan = this.__colSpan), this.__rowSpan > 1 && (n.rowSpan = this.__rowSpan), null !== this.__backgroundColor && (n.style.backgroundColor = this.__backgroundColor),
|
|
59
|
+
return this.__width && (n.style.width = `${this.__width}px`), this.__colSpan > 1 && (n.colSpan = this.__colSpan), this.__rowSpan > 1 && (n.rowSpan = this.__rowSpan), null !== this.__backgroundColor && (n.style.backgroundColor = this.__backgroundColor), qe(this.__verticalAlign) && (n.style.verticalAlign = this.__verticalAlign), addClassNamesToElement(n, t.theme.tableCell, this.hasHeader() && t.theme.tableCellHeader), n;
|
|
59
60
|
}
|
|
60
61
|
exportDOM(e) {
|
|
61
62
|
const t = super.exportDOM(e);
|
|
@@ -68,7 +69,7 @@ var Ee = class Ee extends ElementNode {
|
|
|
68
69
|
exportJSON() {
|
|
69
70
|
return {
|
|
70
71
|
...super.exportJSON(),
|
|
71
|
-
...
|
|
72
|
+
...qe(this.__verticalAlign) && { verticalAlign: this.__verticalAlign },
|
|
72
73
|
backgroundColor: this.getBackgroundColor(),
|
|
73
74
|
colSpan: this.__colSpan,
|
|
74
75
|
headerState: this.__headerState,
|
|
@@ -93,7 +94,7 @@ var Ee = class Ee extends ElementNode {
|
|
|
93
94
|
getTag() {
|
|
94
95
|
return this.hasHeader() ? "th" : "td";
|
|
95
96
|
}
|
|
96
|
-
setHeaderStyles(e, t =
|
|
97
|
+
setHeaderStyles(e, t = Xe.BOTH) {
|
|
97
98
|
const n = this.getWritable();
|
|
98
99
|
return n.__headerState = e & t | n.__headerState & ~t, n;
|
|
99
100
|
}
|
|
@@ -129,7 +130,7 @@ var Ee = class Ee extends ElementNode {
|
|
|
129
130
|
return (this.getHeaderStyles() & e) === e;
|
|
130
131
|
}
|
|
131
132
|
hasHeader() {
|
|
132
|
-
return this.getLatest().__headerState !==
|
|
133
|
+
return this.getLatest().__headerState !== Xe.NO_STATUS;
|
|
133
134
|
}
|
|
134
135
|
updateDOM(e) {
|
|
135
136
|
return e.__headerState !== this.__headerState || e.__width !== this.__width || e.__colSpan !== this.__colSpan || e.__rowSpan !== this.__rowSpan || e.__backgroundColor !== this.__backgroundColor || e.__verticalAlign !== this.__verticalAlign;
|
|
@@ -147,29 +148,29 @@ var Ee = class Ee extends ElementNode {
|
|
|
147
148
|
return !1;
|
|
148
149
|
}
|
|
149
150
|
};
|
|
150
|
-
function
|
|
151
|
+
function qe(e) {
|
|
151
152
|
return "middle" === e || "bottom" === e;
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function je(e) {
|
|
154
155
|
const t = e, n = e.nodeName.toLowerCase();
|
|
155
156
|
let o;
|
|
156
|
-
|
|
157
|
-
let r =
|
|
157
|
+
Je.test(t.style.width) && (o = parseFloat(t.style.width));
|
|
158
|
+
let r = Xe.NO_STATUS;
|
|
158
159
|
if ("th" === n) {
|
|
159
160
|
const e = t.getAttribute("scope");
|
|
160
|
-
if ("col" === e) r =
|
|
161
|
-
else if ("row" === e) r =
|
|
161
|
+
if ("col" === e) r = Xe.COLUMN;
|
|
162
|
+
else if ("row" === e) r = Xe.ROW;
|
|
162
163
|
else {
|
|
163
164
|
const e = t.parentElement, n = isHTMLElement(e) && "tr" === e.nodeName.toLowerCase() && isHTMLElement(e.parentElement) && ("thead" === e.parentElement.nodeName.toLowerCase() || 0 === e.rowIndex), o = 0 === t.cellIndex;
|
|
164
|
-
n && (r |=
|
|
165
|
+
n && (r |= Xe.ROW), o && (r |= Xe.COLUMN), r === Xe.NO_STATUS && (r = Xe.ROW);
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
|
-
const l =
|
|
168
|
+
const l = Ve(r, t.colSpan, o);
|
|
168
169
|
l.__rowSpan = t.rowSpan;
|
|
169
170
|
const s = t.style.backgroundColor;
|
|
170
171
|
"" !== s && (l.__backgroundColor = s);
|
|
171
172
|
const i = t.style.verticalAlign;
|
|
172
|
-
|
|
173
|
+
qe(i) && (l.__verticalAlign = i);
|
|
173
174
|
const c = t.style, a = (c && c.textDecoration || "").split(" "), u = "700" === c.fontWeight || "bold" === c.fontWeight, h = a.includes("line-through"), C = "italic" === c.fontStyle, _ = a.includes("underline"), S = c.color;
|
|
174
175
|
return {
|
|
175
176
|
after: (e) => {
|
|
@@ -193,38 +194,38 @@ function Me(e) {
|
|
|
193
194
|
node: l
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
-
return $applyNodeReplacement(new
|
|
197
|
+
function Ve(e = Xe.NO_STATUS, t = 1, n) {
|
|
198
|
+
return $applyNodeReplacement(new Ye(e, t, n));
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
-
return e instanceof
|
|
200
|
+
function Ge(e) {
|
|
201
|
+
return e instanceof Ye;
|
|
201
202
|
}
|
|
202
|
-
const
|
|
203
|
-
function
|
|
203
|
+
const Qe = createCommand("INSERT_TABLE_COMMAND");
|
|
204
|
+
function Ze(e, ...t) {
|
|
204
205
|
const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
205
206
|
o.append("code", e);
|
|
206
207
|
for (const e of t) o.append("v", e);
|
|
207
208
|
throw n.search = o.toString(), Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
208
209
|
}
|
|
209
|
-
var
|
|
210
|
+
var et = class et extends ElementNode {
|
|
210
211
|
__height;
|
|
211
212
|
static getType() {
|
|
212
213
|
return "tablerow";
|
|
213
214
|
}
|
|
214
215
|
static clone(e) {
|
|
215
|
-
return new
|
|
216
|
+
return new et(e.__height, e.__key);
|
|
216
217
|
}
|
|
217
218
|
afterCloneFrom(e) {
|
|
218
219
|
super.afterCloneFrom(e), this.__height = e.__height;
|
|
219
220
|
}
|
|
220
221
|
static importDOM() {
|
|
221
222
|
return { tr: (e) => ({
|
|
222
|
-
conversion:
|
|
223
|
+
conversion: tt,
|
|
223
224
|
priority: 0
|
|
224
225
|
}) };
|
|
225
226
|
}
|
|
226
227
|
static importJSON(e) {
|
|
227
|
-
return
|
|
228
|
+
return nt().updateFromJSON(e);
|
|
228
229
|
}
|
|
229
230
|
updateFromJSON(e) {
|
|
230
231
|
return super.updateFromJSON(e).setHeight(e.height);
|
|
@@ -266,58 +267,57 @@ var He = class He extends ElementNode {
|
|
|
266
267
|
return !1;
|
|
267
268
|
}
|
|
268
269
|
};
|
|
269
|
-
function
|
|
270
|
+
function tt(e) {
|
|
270
271
|
const n = e;
|
|
271
272
|
let o;
|
|
272
|
-
return
|
|
273
|
-
after: (e) => $descendantsMatching(e,
|
|
274
|
-
node:
|
|
273
|
+
return Je.test(n.style.height) && (o = parseFloat(n.style.height)), {
|
|
274
|
+
after: (e) => $descendantsMatching(e, Ge),
|
|
275
|
+
node: nt(o)
|
|
275
276
|
};
|
|
276
277
|
}
|
|
277
|
-
function
|
|
278
|
-
return $applyNodeReplacement(new
|
|
278
|
+
function nt(e) {
|
|
279
|
+
return $applyNodeReplacement(new et(e));
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
-
return e instanceof
|
|
281
|
+
function ot(e) {
|
|
282
|
+
return e instanceof et;
|
|
282
283
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const o = Fn();
|
|
284
|
+
function rt(e, t, n = !0) {
|
|
285
|
+
const o = Hn();
|
|
286
286
|
for (let r = 0; r < e; r++) {
|
|
287
|
-
const e =
|
|
287
|
+
const e = nt();
|
|
288
288
|
for (let o = 0; o < t; o++) {
|
|
289
|
-
let t =
|
|
290
|
-
"object" == typeof n ? (0 === r && n.rows && (t |=
|
|
291
|
-
const l =
|
|
289
|
+
let t = Xe.NO_STATUS;
|
|
290
|
+
"object" == typeof n ? (0 === r && n.rows && (t |= Xe.ROW), 0 === o && n.columns && (t |= Xe.COLUMN)) : n && (0 === r && (t |= Xe.ROW), 0 === o && (t |= Xe.COLUMN));
|
|
291
|
+
const l = Ve(t), s = $createParagraphNode();
|
|
292
292
|
s.append($createTextNode()), l.append(s), e.append(l);
|
|
293
293
|
}
|
|
294
294
|
o.append(e);
|
|
295
295
|
}
|
|
296
296
|
return o;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
299
|
-
const t = $findMatchingParent(e, (e) =>
|
|
300
|
-
return
|
|
298
|
+
function lt(e) {
|
|
299
|
+
const t = $findMatchingParent(e, (e) => Ge(e));
|
|
300
|
+
return Ge(t) ? t : null;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
const t = $findMatchingParent(e, (e) =>
|
|
304
|
-
if (
|
|
302
|
+
function st(e) {
|
|
303
|
+
const t = $findMatchingParent(e, (e) => ot(e));
|
|
304
|
+
if (ot(t)) return t;
|
|
305
305
|
throw new Error("Expected table cell to be inside of table row.");
|
|
306
306
|
}
|
|
307
|
-
function
|
|
308
|
-
const t = $findMatchingParent(e, (e) =>
|
|
309
|
-
if (
|
|
307
|
+
function it(e) {
|
|
308
|
+
const t = $findMatchingParent(e, (e) => Bn(e));
|
|
309
|
+
if (Bn(t)) return t;
|
|
310
310
|
throw new Error("Expected table cell to be inside of table.");
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
const t =
|
|
314
|
-
return
|
|
312
|
+
function ct(e) {
|
|
313
|
+
const t = st(e);
|
|
314
|
+
return it(t).getChildren().findIndex((e) => e.is(t));
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
return
|
|
316
|
+
function at(e) {
|
|
317
|
+
return st(e).getChildren().findIndex((t) => t.is(e));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
const n =
|
|
319
|
+
function ut(e, t) {
|
|
320
|
+
const n = it(e), { x: o, y: r } = n.getCordsFromCellNode(e, t);
|
|
321
321
|
return {
|
|
322
322
|
above: n.getCellNodeFromCords(o, r - 1, t),
|
|
323
323
|
below: n.getCellNodeFromCords(o, r + 1, t),
|
|
@@ -325,82 +325,81 @@ function Qe(e, t) {
|
|
|
325
325
|
right: n.getCellNodeFromCords(o + 1, r, t)
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function ht(e, t) {
|
|
329
329
|
const n = e.getChildren();
|
|
330
330
|
if (t >= n.length || t < 0) throw new Error("Expected table cell to be inside of table row.");
|
|
331
331
|
return n[t].remove(), e;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function dt(e, t, n = !0, o, r) {
|
|
334
334
|
const l = e.getChildren();
|
|
335
335
|
if (t >= l.length || t < 0) throw new Error("Table row target index out of range");
|
|
336
336
|
const s = l[t];
|
|
337
|
-
if (!
|
|
337
|
+
if (!ot(s)) throw new Error("Row before insertion index does not exist.");
|
|
338
338
|
for (let e = 0; e < o; e++) {
|
|
339
|
-
const e = s.getChildren(), t = e.length, o =
|
|
339
|
+
const e = s.getChildren(), t = e.length, o = nt();
|
|
340
340
|
for (let n = 0; n < t; n++) {
|
|
341
341
|
const t = e[n];
|
|
342
|
-
|
|
343
|
-
const { above: l, below: s } =
|
|
344
|
-
let i =
|
|
342
|
+
Ge(t) || Ze(12);
|
|
343
|
+
const { above: l, below: s } = ut(t, r);
|
|
344
|
+
let i = Xe.NO_STATUS;
|
|
345
345
|
const c = l && l.getWidth() || s && s.getWidth() || void 0;
|
|
346
|
-
(l && l.hasHeaderState(
|
|
347
|
-
const a =
|
|
346
|
+
(l && l.hasHeaderState(Xe.COLUMN) || s && s.hasHeaderState(Xe.COLUMN)) && (i |= Xe.COLUMN);
|
|
347
|
+
const a = Ve(i, 1, c);
|
|
348
348
|
a.append($createParagraphNode()), o.append(a);
|
|
349
349
|
}
|
|
350
350
|
n ? s.insertAfter(o) : s.insertBefore(o);
|
|
351
351
|
}
|
|
352
352
|
return e;
|
|
353
353
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
function nt(e = !0) {
|
|
354
|
+
const ft = (e, t) => e === Xe.BOTH || e === t ? t : Xe.NO_STATUS;
|
|
355
|
+
function gt(e = !0) {
|
|
357
356
|
const t = $getSelection();
|
|
358
|
-
$isRangeSelection(t) ||
|
|
359
|
-
const n = t.anchor.getNode(), o = t.focus.getNode(), [r] =
|
|
360
|
-
return e ?
|
|
357
|
+
$isRangeSelection(t) || Pt(t) || Ze(188);
|
|
358
|
+
const n = t.anchor.getNode(), o = t.focus.getNode(), [r] = Mt(n), [l, , s] = Mt(o), [, i, c] = Et(s, l, r), { startRow: a } = c, { startRow: u } = i;
|
|
359
|
+
return e ? pt(a + r.__rowSpan > u + l.__rowSpan ? r : l, !0) : pt(u < a ? l : r, !1);
|
|
361
360
|
}
|
|
362
|
-
const
|
|
363
|
-
function
|
|
364
|
-
const [, , n] =
|
|
361
|
+
const mt = gt;
|
|
362
|
+
function pt(e, t = !0) {
|
|
363
|
+
const [, , n] = Mt(e), [o, r] = Et(n, e, e), l = o[0].length, { startRow: s } = r;
|
|
365
364
|
let i = null;
|
|
366
365
|
if (t) {
|
|
367
|
-
const t = s + e.__rowSpan - 1, r = o[t], c =
|
|
366
|
+
const t = s + e.__rowSpan - 1, r = o[t], c = nt();
|
|
368
367
|
for (let e = 0; e < l; e++) {
|
|
369
368
|
const { cell: n, startRow: o } = r[e];
|
|
370
369
|
if (o + n.__rowSpan - 1 <= t) {
|
|
371
|
-
const t = r[e].cell.__headerState, n =
|
|
372
|
-
c.append(
|
|
370
|
+
const t = r[e].cell.__headerState, n = ft(t, Xe.COLUMN);
|
|
371
|
+
c.append(Ve(n).append($createParagraphNode()));
|
|
373
372
|
} else n.setRowSpan(n.__rowSpan + 1);
|
|
374
373
|
}
|
|
375
374
|
const a = n.getChildAtIndex(t);
|
|
376
|
-
|
|
375
|
+
ot(a) || Ze(256), a.insertAfter(c), i = c;
|
|
377
376
|
} else {
|
|
378
|
-
const e = s, t = o[e], r =
|
|
377
|
+
const e = s, t = o[e], r = nt();
|
|
379
378
|
for (let n = 0; n < l; n++) {
|
|
380
379
|
const { cell: o, startRow: l } = t[n];
|
|
381
380
|
if (l === e) {
|
|
382
|
-
const e = t[n].cell.__headerState, o =
|
|
383
|
-
r.append(
|
|
381
|
+
const e = t[n].cell.__headerState, o = ft(e, Xe.COLUMN);
|
|
382
|
+
r.append(Ve(o).append($createParagraphNode()));
|
|
384
383
|
} else o.setRowSpan(o.__rowSpan + 1);
|
|
385
384
|
}
|
|
386
385
|
const c = n.getChildAtIndex(e);
|
|
387
|
-
|
|
386
|
+
ot(c) || Ze(257), c.insertBefore(r), i = r;
|
|
388
387
|
}
|
|
389
388
|
return i;
|
|
390
389
|
}
|
|
391
|
-
function
|
|
390
|
+
function Ct(e, t, n = !0, o, r) {
|
|
392
391
|
const l = e.getChildren(), s = [];
|
|
393
392
|
for (let e = 0; e < l.length; e++) {
|
|
394
393
|
const n = l[e];
|
|
395
|
-
if (
|
|
394
|
+
if (ot(n)) for (let e = 0; e < o; e++) {
|
|
396
395
|
const e = n.getChildren();
|
|
397
396
|
if (t >= e.length || t < 0) throw new Error("Table column target index out of range");
|
|
398
397
|
const o = e[t];
|
|
399
|
-
|
|
400
|
-
const { left: l, right: i } =
|
|
401
|
-
let c =
|
|
402
|
-
(l && l.hasHeaderState(
|
|
403
|
-
const a =
|
|
398
|
+
Ge(o) || Ze(12);
|
|
399
|
+
const { left: l, right: i } = ut(o, r);
|
|
400
|
+
let c = Xe.NO_STATUS;
|
|
401
|
+
(l && l.hasHeaderState(Xe.ROW) || i && i.hasHeaderState(Xe.ROW)) && (c |= Xe.ROW);
|
|
402
|
+
const a = Ve(c);
|
|
404
403
|
a.append($createParagraphNode()), s.push({
|
|
405
404
|
newTableCell: a,
|
|
406
405
|
targetCell: o
|
|
@@ -411,30 +410,30 @@ function lt(e, t, n = !0, o, r) {
|
|
|
411
410
|
n ? t.insertAfter(e) : t.insertBefore(e);
|
|
412
411
|
}), e;
|
|
413
412
|
}
|
|
414
|
-
function
|
|
413
|
+
function _t(e = !0) {
|
|
415
414
|
const t = $getSelection();
|
|
416
|
-
$isRangeSelection(t) ||
|
|
417
|
-
const n = t.anchor.getNode(), o = t.focus.getNode(), [r] =
|
|
418
|
-
return e ?
|
|
419
|
-
}
|
|
420
|
-
const
|
|
421
|
-
function
|
|
422
|
-
const [, , o] =
|
|
423
|
-
|
|
415
|
+
$isRangeSelection(t) || Pt(t) || Ze(188);
|
|
416
|
+
const n = t.anchor.getNode(), o = t.focus.getNode(), [r] = Mt(n), [l, , s] = Mt(o), [, i, c] = Et(s, l, r), { startColumn: a } = c, { startColumn: u } = i;
|
|
417
|
+
return e ? bt(a + r.__colSpan > u + l.__colSpan ? r : l, !0) : bt(u < a ? l : r, !1);
|
|
418
|
+
}
|
|
419
|
+
const St = _t;
|
|
420
|
+
function bt(e, t = !0, n = !0) {
|
|
421
|
+
const [, , o] = Mt(e), [r, l] = Et(o, e, e), s = r.length, { startColumn: i } = l, c = t ? i + e.__colSpan - 1 : i - 1, a = o.getFirstChild();
|
|
422
|
+
ot(a) || Ze(120);
|
|
424
423
|
let u = null;
|
|
425
|
-
function h(e =
|
|
426
|
-
const t =
|
|
424
|
+
function h(e = Xe.NO_STATUS) {
|
|
425
|
+
const t = Ve(e).append($createParagraphNode());
|
|
427
426
|
return null === u && (u = t), t;
|
|
428
427
|
}
|
|
429
428
|
let d = a;
|
|
430
429
|
e: for (let e = 0; e < s; e++) {
|
|
431
430
|
if (0 !== e) {
|
|
432
431
|
const e = d.getNextSibling();
|
|
433
|
-
|
|
432
|
+
ot(e) || Ze(121), d = e;
|
|
434
433
|
}
|
|
435
|
-
const t = r[e], n = t[c < 0 ? 0 : c].cell.__headerState, o =
|
|
434
|
+
const t = r[e], n = t[c < 0 ? 0 : c].cell.__headerState, o = ft(n, Xe.ROW);
|
|
436
435
|
if (c < 0) {
|
|
437
|
-
|
|
436
|
+
Ft(d, h(o));
|
|
438
437
|
continue;
|
|
439
438
|
}
|
|
440
439
|
const { cell: l, startColumn: s, startRow: i } = t[c];
|
|
@@ -453,7 +452,7 @@ function ct(e, t = !0, n = !0) {
|
|
|
453
452
|
n.insertAfter(h(o));
|
|
454
453
|
} else l.setColSpan(l.__colSpan + 1);
|
|
455
454
|
}
|
|
456
|
-
null !== u && n &&
|
|
455
|
+
null !== u && n && Tt(u);
|
|
457
456
|
const f = o.getColWidths();
|
|
458
457
|
if (f) {
|
|
459
458
|
const e = [...f], t = c < 0 ? 0 : c, n = e[t];
|
|
@@ -461,11 +460,11 @@ function ct(e, t = !0, n = !0) {
|
|
|
461
460
|
}
|
|
462
461
|
return u;
|
|
463
462
|
}
|
|
464
|
-
function
|
|
463
|
+
function wt(e, t) {
|
|
465
464
|
const n = e.getChildren();
|
|
466
465
|
for (let e = 0; e < n.length; e++) {
|
|
467
466
|
const o = n[e];
|
|
468
|
-
if (
|
|
467
|
+
if (ot(o)) {
|
|
469
468
|
const e = o.getChildren();
|
|
470
469
|
if (t >= e.length || t < 0) throw new Error("Table column target index out of range");
|
|
471
470
|
e[t].remove();
|
|
@@ -473,10 +472,10 @@ function at(e, t) {
|
|
|
473
472
|
}
|
|
474
473
|
return e;
|
|
475
474
|
}
|
|
476
|
-
function
|
|
475
|
+
function yt() {
|
|
477
476
|
const e = $getSelection();
|
|
478
|
-
$isRangeSelection(e) ||
|
|
479
|
-
const [t, n] = e.isBackward() ? [e.focus.getNode(), e.anchor.getNode()] : [e.anchor.getNode(), e.focus.getNode()], [o, , r] =
|
|
477
|
+
$isRangeSelection(e) || Pt(e) || Ze(188);
|
|
478
|
+
const [t, n] = e.isBackward() ? [e.focus.getNode(), e.anchor.getNode()] : [e.anchor.getNode(), e.focus.getNode()], [o, , r] = Mt(t), [l] = Mt(n), [s, i, c] = Et(r, o, l), { startRow: a } = i, { startRow: u } = c, h = u + l.__rowSpan - 1;
|
|
480
479
|
if (s.length === h - a + 1) return void r.remove();
|
|
481
480
|
const d = s[0].length, f = s[h + 1], g = r.getChildAtIndex(h + 1);
|
|
482
481
|
for (let e = h; e >= a; e--) {
|
|
@@ -488,32 +487,32 @@ function ut() {
|
|
|
488
487
|
n.setRowSpan(n.__rowSpan - r);
|
|
489
488
|
}
|
|
490
489
|
if (o >= a && o + n.__rowSpan - 1 > h && e === h) {
|
|
491
|
-
null === g &&
|
|
490
|
+
null === g && Ze(122);
|
|
492
491
|
let o = null;
|
|
493
492
|
for (let n = 0; n < t; n++) {
|
|
494
493
|
const t = f[n], r = t.cell;
|
|
495
494
|
t.startRow === e + 1 && (o = r), r.__colSpan > 1 && (n += r.__colSpan - 1);
|
|
496
495
|
}
|
|
497
|
-
null === o ?
|
|
496
|
+
null === o ? Ft(g, n) : o.insertAfter(n);
|
|
498
497
|
}
|
|
499
498
|
}
|
|
500
499
|
}
|
|
501
500
|
const t = r.getChildAtIndex(e);
|
|
502
|
-
|
|
501
|
+
ot(t) || Ze(206, String(e)), t.remove();
|
|
503
502
|
}
|
|
504
503
|
if (void 0 !== f) {
|
|
505
504
|
const { cell: e } = f[0];
|
|
506
|
-
|
|
505
|
+
Tt(e);
|
|
507
506
|
} else {
|
|
508
507
|
const { cell: t } = s[a - 1][0];
|
|
509
|
-
|
|
508
|
+
Tt(t);
|
|
510
509
|
}
|
|
511
510
|
}
|
|
512
|
-
const
|
|
513
|
-
function
|
|
511
|
+
const Nt = yt;
|
|
512
|
+
function vt() {
|
|
514
513
|
const e = $getSelection();
|
|
515
|
-
$isRangeSelection(e) ||
|
|
516
|
-
const t = e.anchor.getNode(), n = e.focus.getNode(), [o, , r] =
|
|
514
|
+
$isRangeSelection(e) || Pt(e) || Ze(188);
|
|
515
|
+
const t = e.anchor.getNode(), n = e.focus.getNode(), [o, , r] = Mt(t), [l] = Mt(n), [s, i, c] = Et(r, o, l), { startColumn: a } = i, { startRow: u, startColumn: h } = c, d = Math.min(a, h), f = Math.max(a + o.__colSpan - 1, h + l.__colSpan - 1), g = f - d + 1;
|
|
517
516
|
if (s[0].length === f - d + 1) return r.selectPrevious(), void r.remove();
|
|
518
517
|
const m = s.length;
|
|
519
518
|
for (let e = 0; e < m; e++) for (let t = d; t <= f; t++) {
|
|
@@ -533,10 +532,10 @@ function dt() {
|
|
|
533
532
|
const p = s[u], C = a > h ? p[a + o.__colSpan] : p[h + l.__colSpan];
|
|
534
533
|
if (void 0 !== C) {
|
|
535
534
|
const { cell: e } = C;
|
|
536
|
-
|
|
535
|
+
Tt(e);
|
|
537
536
|
} else {
|
|
538
537
|
const { cell: t } = h < a ? p[h - 1] : p[a - 1];
|
|
539
|
-
|
|
538
|
+
Tt(t);
|
|
540
539
|
}
|
|
541
540
|
const _ = r.getColWidths();
|
|
542
541
|
if (_) {
|
|
@@ -544,18 +543,18 @@ function dt() {
|
|
|
544
543
|
e.splice(d, g), r.setColWidths(e);
|
|
545
544
|
}
|
|
546
545
|
}
|
|
547
|
-
const
|
|
548
|
-
function
|
|
546
|
+
const xt = vt;
|
|
547
|
+
function Tt(e) {
|
|
549
548
|
const t = e.getFirstDescendant();
|
|
550
549
|
null == t ? e.selectStart() : t.getParentOrThrow().selectStart();
|
|
551
550
|
}
|
|
552
|
-
function
|
|
551
|
+
function Ft(e, t) {
|
|
553
552
|
const n = e.getFirstChild();
|
|
554
553
|
null !== n ? n.insertBefore(t) : e.append(t);
|
|
555
554
|
}
|
|
556
|
-
function
|
|
555
|
+
function Rt(e) {
|
|
557
556
|
if (0 === e.length) return null;
|
|
558
|
-
const [n] =
|
|
557
|
+
const [n] = kt(it(e[0]), null, null);
|
|
559
558
|
let o = Infinity, r = -Infinity, l = Infinity, s = -Infinity;
|
|
560
559
|
const i = /* @__PURE__ */ new Set();
|
|
561
560
|
for (const t of n) for (const n of t) {
|
|
@@ -579,63 +578,63 @@ function pt(e) {
|
|
|
579
578
|
const r = o.cell, l = r.getKey();
|
|
580
579
|
if (!d.has(l)) {
|
|
581
580
|
d.add(l);
|
|
582
|
-
|
|
581
|
+
Ot(r) || h.append(...r.getChildren()), r.remove();
|
|
583
582
|
}
|
|
584
583
|
}
|
|
585
584
|
return 0 === h.getChildrenSize() && h.append($createParagraphNode()), h;
|
|
586
585
|
}
|
|
587
|
-
function
|
|
586
|
+
function Ot(e) {
|
|
588
587
|
if (1 !== e.getChildrenSize()) return !1;
|
|
589
588
|
const t = e.getFirstChildOrThrow();
|
|
590
589
|
return !(!$isParagraphNode(t) || !t.isEmpty());
|
|
591
590
|
}
|
|
592
|
-
function
|
|
591
|
+
function At() {
|
|
593
592
|
const e = $getSelection();
|
|
594
|
-
$isRangeSelection(e) ||
|
|
595
|
-
const o = $findMatchingParent(e.anchor.getNode(),
|
|
596
|
-
return
|
|
593
|
+
$isRangeSelection(e) || Pt(e) || Ze(188);
|
|
594
|
+
const o = $findMatchingParent(e.anchor.getNode(), Ge);
|
|
595
|
+
return Ge(o) || Ze(148), Kt(o);
|
|
597
596
|
}
|
|
598
|
-
function
|
|
599
|
-
const [t, n, o] =
|
|
597
|
+
function Kt(e) {
|
|
598
|
+
const [t, n, o] = Mt(e), r = t.__colSpan, l = t.__rowSpan;
|
|
600
599
|
if (1 === r && 1 === l) return;
|
|
601
|
-
const [s, i] =
|
|
600
|
+
const [s, i] = Et(o, t, t), { startColumn: c, startRow: a } = i, u = t.__headerState & Xe.COLUMN, h = Array.from({ length: r }, (e, t) => {
|
|
602
601
|
let n = u;
|
|
603
602
|
for (let e = 0; 0 !== n && e < s.length; e++) n &= s[e][t + c].cell.__headerState;
|
|
604
603
|
return n;
|
|
605
|
-
}), d = t.__headerState &
|
|
604
|
+
}), d = t.__headerState & Xe.ROW, f = Array.from({ length: l }, (e, t) => {
|
|
606
605
|
let n = d;
|
|
607
606
|
for (let e = 0; 0 !== n && e < s[0].length; e++) n &= s[t + a][e].cell.__headerState;
|
|
608
607
|
return n;
|
|
609
608
|
});
|
|
610
609
|
if (r > 1) {
|
|
611
|
-
for (let e = 1; e < r; e++) t.insertAfter(
|
|
610
|
+
for (let e = 1; e < r; e++) t.insertAfter(Ve(h[e] | f[0]).append($createParagraphNode()));
|
|
612
611
|
t.setColSpan(1);
|
|
613
612
|
}
|
|
614
613
|
if (l > 1) {
|
|
615
614
|
let e;
|
|
616
615
|
for (let t = 1; t < l; t++) {
|
|
617
616
|
const o = a + t, l = s[o];
|
|
618
|
-
e = (e || n).getNextSibling(),
|
|
617
|
+
e = (e || n).getNextSibling(), ot(e) || Ze(125);
|
|
619
618
|
let i = null;
|
|
620
619
|
for (let e = 0; e < c; e++) {
|
|
621
620
|
const t = l[e], n = t.cell;
|
|
622
621
|
t.startRow === o && (i = n), n.__colSpan > 1 && (e += n.__colSpan - 1);
|
|
623
622
|
}
|
|
624
|
-
if (null === i) for (let n = r - 1; n >= 0; n--)
|
|
625
|
-
else for (let e = r - 1; e >= 0; e--) i.insertAfter(
|
|
623
|
+
if (null === i) for (let n = r - 1; n >= 0; n--) Ft(e, Ve(h[n] | f[t]).append($createParagraphNode()));
|
|
624
|
+
else for (let e = r - 1; e >= 0; e--) i.insertAfter(Ve(h[e] | f[t]).append($createParagraphNode()));
|
|
626
625
|
}
|
|
627
626
|
t.setRowSpan(1);
|
|
628
627
|
}
|
|
629
628
|
}
|
|
630
|
-
function
|
|
631
|
-
const [o, r, l] =
|
|
632
|
-
return null === r &&
|
|
629
|
+
function Et(e, t, n) {
|
|
630
|
+
const [o, r, l] = kt(e, t, n);
|
|
631
|
+
return null === r && Ze(207), null === l && Ze(208), [
|
|
633
632
|
o,
|
|
634
633
|
r,
|
|
635
634
|
l
|
|
636
635
|
];
|
|
637
636
|
}
|
|
638
|
-
function
|
|
637
|
+
function kt(e, t, n) {
|
|
639
638
|
const o = [];
|
|
640
639
|
let r = null, l = null;
|
|
641
640
|
function s(e) {
|
|
@@ -645,10 +644,10 @@ function bt(e, t, n) {
|
|
|
645
644
|
const i = e.getChildren();
|
|
646
645
|
for (let e = 0; e < i.length; e++) {
|
|
647
646
|
const o = i[e];
|
|
648
|
-
|
|
647
|
+
ot(o) || Ze(209);
|
|
649
648
|
const c = s(e);
|
|
650
649
|
for (let a = o.getFirstChild(), u = 0; null != a; a = a.getNextSibling()) {
|
|
651
|
-
for (
|
|
650
|
+
for (Ge(a) || Ze(147); void 0 !== c[u];) u++;
|
|
652
651
|
const o = {
|
|
653
652
|
cell: a,
|
|
654
653
|
startColumn: u,
|
|
@@ -667,26 +666,26 @@ function bt(e, t, n) {
|
|
|
667
666
|
l
|
|
668
667
|
];
|
|
669
668
|
}
|
|
670
|
-
function
|
|
669
|
+
function Mt(e) {
|
|
671
670
|
let t;
|
|
672
|
-
if (e instanceof
|
|
671
|
+
if (e instanceof Ye) t = e;
|
|
673
672
|
else if ("__type" in e) {
|
|
674
|
-
const o = $findMatchingParent(e,
|
|
675
|
-
|
|
673
|
+
const o = $findMatchingParent(e, Ge);
|
|
674
|
+
Ge(o) || Ze(148), t = o;
|
|
676
675
|
} else {
|
|
677
|
-
const o = $findMatchingParent(e.getNode(),
|
|
678
|
-
|
|
676
|
+
const o = $findMatchingParent(e.getNode(), Ge);
|
|
677
|
+
Ge(o) || Ze(148), t = o;
|
|
679
678
|
}
|
|
680
679
|
const o = t.getParent();
|
|
681
|
-
|
|
680
|
+
ot(o) || Ze(149);
|
|
682
681
|
const r = o.getParent();
|
|
683
|
-
return
|
|
682
|
+
return Bn(r) || Ze(210), [
|
|
684
683
|
t,
|
|
685
684
|
o,
|
|
686
685
|
r
|
|
687
686
|
];
|
|
688
687
|
}
|
|
689
|
-
function
|
|
688
|
+
function $t(e, t, n) {
|
|
690
689
|
let o, r = Math.min(t.startColumn, n.startColumn), l = Math.min(t.startRow, n.startRow), s = Math.max(t.startColumn + t.cell.__colSpan - 1, n.startColumn + n.cell.__colSpan - 1), i = Math.max(t.startRow + t.cell.__rowSpan - 1, n.startRow + n.cell.__rowSpan - 1);
|
|
691
690
|
do {
|
|
692
691
|
o = !1;
|
|
@@ -707,23 +706,23 @@ function Nt(e, t, n) {
|
|
|
707
706
|
minRow: l
|
|
708
707
|
};
|
|
709
708
|
}
|
|
710
|
-
function
|
|
709
|
+
function Wt(e) {
|
|
711
710
|
const t = e.getChildren();
|
|
712
711
|
let n = null;
|
|
713
712
|
for (const e of t) {
|
|
714
|
-
if (!
|
|
713
|
+
if (!ot(e)) return !1;
|
|
715
714
|
if (null === n && (n = e.getChildrenSize()), e.getChildrenSize() !== n) return !1;
|
|
716
715
|
const t = e.getChildren();
|
|
717
|
-
for (const e of t) if (!
|
|
716
|
+
for (const e of t) if (!Ge(e) || 1 !== e.getRowSpan() || 1 !== e.getColSpan()) return !1;
|
|
718
717
|
}
|
|
719
718
|
return (n || 0) > 0;
|
|
720
719
|
}
|
|
721
|
-
function
|
|
720
|
+
function zt(e, t, n) {
|
|
722
721
|
if (t === n) return;
|
|
723
722
|
const o = e.getColumnCount();
|
|
724
723
|
if (t < 0 || t >= o || n < 0 || n >= o) return;
|
|
725
|
-
if (!
|
|
726
|
-
e.getChildren().filter(
|
|
724
|
+
if (!Wt(e)) return;
|
|
725
|
+
e.getChildren().filter(ot).forEach((e) => {
|
|
727
726
|
const o = e.getChildren(), [r] = o.splice(t, 1);
|
|
728
727
|
o.splice(n, 0, r), e.splice(0, o.length, o);
|
|
729
728
|
});
|
|
@@ -733,8 +732,8 @@ function xt(e, t, n) {
|
|
|
733
732
|
o.splice(n, 0, l), e.setColWidths(o);
|
|
734
733
|
}
|
|
735
734
|
}
|
|
736
|
-
function
|
|
737
|
-
const [t, , n] =
|
|
735
|
+
function Lt(e) {
|
|
736
|
+
const [t, , n] = Mt(e), o = n.getChildren(), r = o.length, l = o[0].getChildren().length, s = new Array(r);
|
|
738
737
|
for (let e = 0; e < r; e++) s[e] = new Array(l);
|
|
739
738
|
for (let e = 0; e < r; e++) {
|
|
740
739
|
const n = o[e].getChildren();
|
|
@@ -754,21 +753,21 @@ function Tt(e) {
|
|
|
754
753
|
}
|
|
755
754
|
return null;
|
|
756
755
|
}
|
|
757
|
-
function
|
|
756
|
+
function Ht(e) {
|
|
758
757
|
const [[t, o, r, l], [s, i, c, a]] = ["anchor", "focus"].map((t) => {
|
|
759
|
-
const o = e[t].getNode(), r = $findMatchingParent(o,
|
|
760
|
-
|
|
758
|
+
const o = e[t].getNode(), r = $findMatchingParent(o, Ge);
|
|
759
|
+
Ge(r) || Ze(238, t, o.getKey(), o.getType());
|
|
761
760
|
const l = r.getParent();
|
|
762
|
-
|
|
761
|
+
ot(l) || Ze(239, t);
|
|
763
762
|
const s = l.getParent();
|
|
764
|
-
return
|
|
763
|
+
return Bn(s) || Ze(240, t), [
|
|
765
764
|
o,
|
|
766
765
|
r,
|
|
767
766
|
l,
|
|
768
767
|
s
|
|
769
768
|
];
|
|
770
769
|
});
|
|
771
|
-
return l.is(a) ||
|
|
770
|
+
return l.is(a) || Ze(241), {
|
|
772
771
|
anchorCell: o,
|
|
773
772
|
anchorNode: t,
|
|
774
773
|
anchorRow: r,
|
|
@@ -779,7 +778,7 @@ function Ft(e) {
|
|
|
779
778
|
focusTable: a
|
|
780
779
|
};
|
|
781
780
|
}
|
|
782
|
-
var
|
|
781
|
+
var Bt = class Bt {
|
|
783
782
|
tableKey;
|
|
784
783
|
anchor;
|
|
785
784
|
focus;
|
|
@@ -806,13 +805,13 @@ var Rt = class Rt {
|
|
|
806
805
|
this._cachedNodes = e;
|
|
807
806
|
}
|
|
808
807
|
is(e) {
|
|
809
|
-
return
|
|
808
|
+
return Pt(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
|
|
810
809
|
}
|
|
811
810
|
set(e, t, n) {
|
|
812
811
|
this.dirty = this.dirty || e !== this.tableKey || t !== this.anchor.key || n !== this.focus.key, this.tableKey = e, this.anchor.key = t, this.focus.key = n, this._cachedNodes = null;
|
|
813
812
|
}
|
|
814
813
|
clone() {
|
|
815
|
-
return new
|
|
814
|
+
return new Bt(this.tableKey, $createPoint(this.anchor.key, this.anchor.offset, this.anchor.type), $createPoint(this.focus.key, this.focus.offset, this.focus.type));
|
|
816
815
|
}
|
|
817
816
|
isCollapsed() {
|
|
818
817
|
return !1;
|
|
@@ -824,7 +823,7 @@ var Rt = class Rt {
|
|
|
824
823
|
insertText() {}
|
|
825
824
|
hasFormat(e) {
|
|
826
825
|
let t = 0;
|
|
827
|
-
this.getNodes().filter(
|
|
826
|
+
this.getNodes().filter(Ge).forEach((e) => {
|
|
828
827
|
const n = e.getFirstChild();
|
|
829
828
|
$isParagraphNode(n) && (t |= n.getTextFormat());
|
|
830
829
|
});
|
|
@@ -833,14 +832,14 @@ var Rt = class Rt {
|
|
|
833
832
|
}
|
|
834
833
|
insertNodes(e) {
|
|
835
834
|
const t = this.focus.getNode();
|
|
836
|
-
$isElementNode(t) ||
|
|
835
|
+
$isElementNode(t) || Ze(151);
|
|
837
836
|
$normalizeSelection__EXPERIMENTAL(t.select(0, t.getChildrenSize())).insertNodes(e);
|
|
838
837
|
}
|
|
839
838
|
getShape() {
|
|
840
|
-
const { anchorCell: e, focusCell: t } =
|
|
841
|
-
null === n &&
|
|
842
|
-
const o =
|
|
843
|
-
null === o &&
|
|
839
|
+
const { anchorCell: e, focusCell: t } = Ht(this), n = Lt(e);
|
|
840
|
+
null === n && Ze(153);
|
|
841
|
+
const o = Lt(t);
|
|
842
|
+
null === o && Ze(155);
|
|
844
843
|
const r = Math.min(n.columnIndex, o.columnIndex), l = Math.max(n.columnIndex + n.colSpan - 1, o.columnIndex + o.colSpan - 1), s = Math.min(n.rowIndex, o.rowIndex), i = Math.max(n.rowIndex + n.rowSpan - 1, o.rowIndex + o.rowSpan - 1);
|
|
845
844
|
return {
|
|
846
845
|
fromX: Math.min(r, l),
|
|
@@ -853,22 +852,22 @@ var Rt = class Rt {
|
|
|
853
852
|
if (!this.isValid()) return [];
|
|
854
853
|
const e = this._cachedNodes;
|
|
855
854
|
if (null !== e) return e;
|
|
856
|
-
const { anchorTable: t, anchorCell: n, focusCell: o } =
|
|
855
|
+
const { anchorTable: t, anchorCell: n, focusCell: o } = Ht(this), r = o.getParents()[1];
|
|
857
856
|
if (r !== t) {
|
|
858
857
|
if (t.isParentOf(o)) {
|
|
859
858
|
const e = r.getParent();
|
|
860
|
-
e ??
|
|
859
|
+
e ?? Ze(159), this.set(this.tableKey, o.getKey(), e.getKey());
|
|
861
860
|
} else {
|
|
862
861
|
const e = t.getParent();
|
|
863
|
-
e ??
|
|
862
|
+
e ?? Ze(158), this.set(this.tableKey, e.getKey(), o.getKey());
|
|
864
863
|
}
|
|
865
864
|
return this.getNodes();
|
|
866
865
|
}
|
|
867
|
-
const [l, s, i] =
|
|
866
|
+
const [l, s, i] = Et(t, n, o), { minColumn: c, maxColumn: a, minRow: u, maxRow: h } = $t(l, s, i), d = new Map([[t.getKey(), t]]);
|
|
868
867
|
let f = null;
|
|
869
868
|
for (let e = u; e <= h; e++) for (let t = c; t <= a; t++) {
|
|
870
869
|
const { cell: n } = l[e][t], o = n.getParent();
|
|
871
|
-
|
|
870
|
+
ot(o) || Ze(160), o !== f && (d.set(o.getKey(), o), f = o), d.has(n.getKey()) || Ut(n, (e) => {
|
|
872
871
|
d.set(e.getKey(), e);
|
|
873
872
|
});
|
|
874
873
|
}
|
|
@@ -876,7 +875,7 @@ var Rt = class Rt {
|
|
|
876
875
|
return isCurrentlyReadOnlyMode() || (this._cachedNodes = g), g;
|
|
877
876
|
}
|
|
878
877
|
getTextContent() {
|
|
879
|
-
const e = this.getNodes().filter((e) =>
|
|
878
|
+
const e = this.getNodes().filter((e) => Ge(e));
|
|
880
879
|
let t = "";
|
|
881
880
|
for (let n = 0; n < e.length; n++) {
|
|
882
881
|
const o = e[n], r = o.__parent, l = (e[n + 1] || {}).__parent;
|
|
@@ -885,34 +884,34 @@ var Rt = class Rt {
|
|
|
885
884
|
return t;
|
|
886
885
|
}
|
|
887
886
|
};
|
|
888
|
-
function
|
|
889
|
-
return e instanceof
|
|
887
|
+
function Pt(e) {
|
|
888
|
+
return e instanceof Bt;
|
|
890
889
|
}
|
|
891
|
-
function
|
|
892
|
-
return new
|
|
890
|
+
function Dt() {
|
|
891
|
+
return new Bt("root", $createPoint("root", 0, "element"), $createPoint("root", 0, "element"));
|
|
893
892
|
}
|
|
894
|
-
function
|
|
893
|
+
function It(e, t, n) {
|
|
895
894
|
e.getKey(), t.getKey(), n.getKey();
|
|
896
|
-
const o = $getSelection(), r =
|
|
895
|
+
const o = $getSelection(), r = Pt(o) ? o.clone() : Dt();
|
|
897
896
|
return r.set(e.getKey(), t.getKey(), n.getKey()), r;
|
|
898
897
|
}
|
|
899
|
-
function
|
|
898
|
+
function Ut(e, t) {
|
|
900
899
|
const n = [[e]];
|
|
901
900
|
for (let e = n.at(-1); void 0 !== e && n.length > 0; e = n.at(-1)) {
|
|
902
901
|
const o = e.pop();
|
|
903
902
|
void 0 === o ? n.pop() : !1 !== t(o) && $isElementNode(o) && n.push(o.getChildren());
|
|
904
903
|
}
|
|
905
904
|
}
|
|
906
|
-
function
|
|
905
|
+
function Jt(e, t = $getEditor()) {
|
|
907
906
|
const n = $getNodeByKey(e);
|
|
908
|
-
|
|
909
|
-
const o =
|
|
910
|
-
return null === o &&
|
|
907
|
+
Bn(n) || Ze(231, e);
|
|
908
|
+
const o = Vt(n, t.getElementByKey(e));
|
|
909
|
+
return null === o && Ze(232, e), {
|
|
911
910
|
tableElement: o,
|
|
912
911
|
tableNode: n
|
|
913
912
|
};
|
|
914
913
|
}
|
|
915
|
-
var
|
|
914
|
+
var Xt = class {
|
|
916
915
|
observers;
|
|
917
916
|
nextFocus;
|
|
918
917
|
shouldCheckSelectionForTable;
|
|
@@ -934,7 +933,7 @@ var Mt = class {
|
|
|
934
933
|
return e ? (this.shouldCheckSelectionForTable = null, e) : null;
|
|
935
934
|
}
|
|
936
935
|
};
|
|
937
|
-
var
|
|
936
|
+
var Yt = class {
|
|
938
937
|
focusX;
|
|
939
938
|
focusY;
|
|
940
939
|
listenersToRemove;
|
|
@@ -968,7 +967,7 @@ var $t = class {
|
|
|
968
967
|
this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach((e) => e()), this.listenersToRemove.clear();
|
|
969
968
|
}
|
|
970
969
|
$lookup() {
|
|
971
|
-
return
|
|
970
|
+
return Jt(this.tableNodeKey, this.editor);
|
|
972
971
|
}
|
|
973
972
|
trackTable() {
|
|
974
973
|
const e = new MutationObserver((e) => {
|
|
@@ -983,12 +982,12 @@ var $t = class {
|
|
|
983
982
|
}
|
|
984
983
|
if (!t) return;
|
|
985
984
|
const { tableNode: n, tableElement: o } = this.$lookup();
|
|
986
|
-
this.table =
|
|
985
|
+
this.table = un(n, o);
|
|
987
986
|
}, { editor: this.editor });
|
|
988
987
|
});
|
|
989
988
|
this.editor.getEditorState().read(() => {
|
|
990
989
|
const { tableNode: t, tableElement: n } = this.$lookup();
|
|
991
|
-
this.table =
|
|
990
|
+
this.table = un(t, n), e.observe(n, {
|
|
992
991
|
attributes: !0,
|
|
993
992
|
childList: !0,
|
|
994
993
|
subtree: !0
|
|
@@ -999,7 +998,7 @@ var $t = class {
|
|
|
999
998
|
const t = this.editor;
|
|
1000
999
|
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();
|
|
1001
1000
|
const { tableNode: n, tableElement: o } = this.$lookup();
|
|
1002
|
-
|
|
1001
|
+
hn(t, un(n, o), null), e && null !== $getSelection() && ($setSelection(null), t.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
|
|
1003
1002
|
}
|
|
1004
1003
|
$enableHighlightStyle() {
|
|
1005
1004
|
const e = this.editor, { tableElement: t } = this.$lookup();
|
|
@@ -1011,9 +1010,9 @@ var $t = class {
|
|
|
1011
1010
|
}
|
|
1012
1011
|
$updateTableTableSelection(e) {
|
|
1013
1012
|
if (null !== e) {
|
|
1014
|
-
e.tableKey !== this.tableNodeKey &&
|
|
1013
|
+
e.tableKey !== this.tableNodeKey && Ze(233, e.tableKey, this.tableNodeKey);
|
|
1015
1014
|
const t = this.editor;
|
|
1016
|
-
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(),
|
|
1015
|
+
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), hn(t, this.table, this.tableSelection);
|
|
1017
1016
|
} else this.$clearHighlight();
|
|
1018
1017
|
}
|
|
1019
1018
|
updateDOMSelection() {
|
|
@@ -1027,12 +1026,12 @@ var $t = class {
|
|
|
1027
1026
|
if (this.focusCell = e, !this.isHighlightingCells) (t || this.anchorX !== r || this.anchorY !== l || null != this.tableSelection && null != this.anchorCellNodeKey) && (this.isHighlightingCells = !0, this.$disableHighlightStyle());
|
|
1028
1027
|
if (-1 !== this.focusX && -1 !== this.focusY && r === this.focusX && l === this.focusY) return !1;
|
|
1029
1028
|
if (this.focusX = r, this.focusY = l, this.isHighlightingCells) {
|
|
1030
|
-
const s =
|
|
1029
|
+
const s = An(o, e.elem);
|
|
1031
1030
|
if (null != this.tableSelection && null != this.anchorCellNodeKey) {
|
|
1032
1031
|
let e = s;
|
|
1033
1032
|
if (null === e && t && (e = o.getCellNodeFromCords(r, l, this.table)), null !== e) {
|
|
1034
1033
|
const t = this.$getAnchorTableCellOrThrow();
|
|
1035
|
-
return this.focusCellNodeKey = e.getKey(), this.tableSelection =
|
|
1034
|
+
return this.focusCellNodeKey = e.getKey(), this.tableSelection = It(o, t, e), $setSelection(this.tableSelection), n.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0), hn(n, this.table, this.tableSelection), !0;
|
|
1036
1035
|
}
|
|
1037
1036
|
}
|
|
1038
1037
|
}
|
|
@@ -1043,28 +1042,28 @@ var $t = class {
|
|
|
1043
1042
|
}
|
|
1044
1043
|
$getAnchorTableCellOrThrow() {
|
|
1045
1044
|
const e = this.$getAnchorTableCell();
|
|
1046
|
-
return null === e &&
|
|
1045
|
+
return null === e && Ze(234), e;
|
|
1047
1046
|
}
|
|
1048
1047
|
$getFocusTableCell() {
|
|
1049
1048
|
return this.focusCellNodeKey ? $getNodeByKey(this.focusCellNodeKey) : null;
|
|
1050
1049
|
}
|
|
1051
1050
|
$getFocusTableCellOrThrow() {
|
|
1052
1051
|
const e = this.$getFocusTableCell();
|
|
1053
|
-
return null === e &&
|
|
1052
|
+
return null === e && Ze(235), e;
|
|
1054
1053
|
}
|
|
1055
1054
|
$setAnchorCellForSelection(e) {
|
|
1056
1055
|
this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y, this.focusX = -1, this.focusY = -1, this.focusCell = null, this.focusCellNodeKey = null;
|
|
1057
|
-
const { tableNode: t } = this.$lookup(), n =
|
|
1056
|
+
const { tableNode: t } = this.$lookup(), n = An(t, e.elem);
|
|
1058
1057
|
if (null !== n) {
|
|
1059
1058
|
const e = n.getKey();
|
|
1060
|
-
null != this.tableSelection ? (this.tableSelection = this.tableSelection.clone(), this.tableSelection.set(t.getKey(), e, e)) : this.tableSelection =
|
|
1059
|
+
null != this.tableSelection ? (this.tableSelection = this.tableSelection.clone(), this.tableSelection.set(t.getKey(), e, e)) : this.tableSelection = It(t, n, n), this.anchorCellNodeKey = e;
|
|
1061
1060
|
}
|
|
1062
1061
|
}
|
|
1063
1062
|
$formatCells(e) {
|
|
1064
1063
|
const t = $getSelection();
|
|
1065
|
-
|
|
1066
|
-
const n = $createRangeSelection(), o = n.anchor, r = n.focus, l = t.getNodes().filter(
|
|
1067
|
-
l.length > 0 ||
|
|
1064
|
+
Pt(t) || Ze(236);
|
|
1065
|
+
const n = $createRangeSelection(), o = n.anchor, r = n.focus, l = t.getNodes().filter(Ge);
|
|
1066
|
+
l.length > 0 || Ze(237);
|
|
1068
1067
|
const s = l[0].getFirstChild(), i = $isParagraphNode(s) ? s.getFormatFlags(e, null) : null;
|
|
1069
1068
|
l.forEach((t) => {
|
|
1070
1069
|
o.set(t.getKey(), 0, "element"), r.set(t.getKey(), t.getChildrenSize(), "element"), n.formatText(e, i);
|
|
@@ -1072,11 +1071,11 @@ var $t = class {
|
|
|
1072
1071
|
}
|
|
1073
1072
|
$clearText() {
|
|
1074
1073
|
const { editor: e } = this, t = $getNodeByKey(this.tableNodeKey);
|
|
1075
|
-
if (!
|
|
1074
|
+
if (!Bn(t)) throw new Error("Expected TableNode.");
|
|
1076
1075
|
const n = $getSelection();
|
|
1077
|
-
|
|
1078
|
-
const o = n.getNodes().filter(
|
|
1079
|
-
if (o.length > 0 && null !== r && null !== l &&
|
|
1076
|
+
Pt(n) || Ze(253);
|
|
1077
|
+
const o = n.getNodes().filter(Ge), r = t.getFirstChild(), l = t.getLastChild();
|
|
1078
|
+
if (o.length > 0 && null !== r && null !== l && ot(r) && ot(l) && o[0] === r.getFirstChild() && o[o.length - 1] === l.getLastChild()) {
|
|
1080
1079
|
t.selectPrevious();
|
|
1081
1080
|
const n = t.getParent();
|
|
1082
1081
|
t.remove(), $isRootNode(n) && n.isEmpty() && e.dispatchCommand(INSERT_PARAGRAPH_COMMAND, void 0);
|
|
@@ -1089,165 +1088,168 @@ var $t = class {
|
|
|
1089
1088
|
e !== t && e.remove();
|
|
1090
1089
|
});
|
|
1091
1090
|
}
|
|
1092
|
-
}),
|
|
1091
|
+
}), hn(e, this.table, null), $setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
|
|
1093
1092
|
}
|
|
1094
1093
|
};
|
|
1095
|
-
const
|
|
1096
|
-
function
|
|
1094
|
+
const qt = "__lexicalTableSelection";
|
|
1095
|
+
function jt(e) {
|
|
1097
1096
|
return isHTMLElement(e) && "TABLE" === e.nodeName;
|
|
1098
1097
|
}
|
|
1099
|
-
function
|
|
1098
|
+
function Vt(e, t) {
|
|
1100
1099
|
if (!t) return t;
|
|
1101
|
-
const n =
|
|
1102
|
-
return
|
|
1100
|
+
const n = jt(t) ? t : t.querySelector("table");
|
|
1101
|
+
return jt(n) || Ze(341, e.constructor.name, e.getType(), e.getKey(), t.nodeName), n;
|
|
1103
1102
|
}
|
|
1104
|
-
function
|
|
1103
|
+
function Gt(e) {
|
|
1105
1104
|
return e._window;
|
|
1106
1105
|
}
|
|
1107
|
-
function
|
|
1106
|
+
function Qt(e, t) {
|
|
1108
1107
|
for (let n = t, o = null; null !== n; n = n.getParent()) {
|
|
1109
1108
|
if (e.is(n)) return o;
|
|
1110
|
-
|
|
1109
|
+
Ge(n) && (o = n);
|
|
1111
1110
|
}
|
|
1112
1111
|
return null;
|
|
1113
1112
|
}
|
|
1114
|
-
const
|
|
1113
|
+
const Zt = [
|
|
1115
1114
|
[KEY_ARROW_DOWN_COMMAND, "down"],
|
|
1116
1115
|
[KEY_ARROW_UP_COMMAND, "up"],
|
|
1117
1116
|
[KEY_ARROW_LEFT_COMMAND, "backward"],
|
|
1118
1117
|
[KEY_ARROW_RIGHT_COMMAND, "forward"]
|
|
1119
|
-
],
|
|
1118
|
+
], en = [
|
|
1120
1119
|
DELETE_WORD_COMMAND,
|
|
1121
1120
|
DELETE_LINE_COMMAND,
|
|
1122
1121
|
DELETE_CHARACTER_COMMAND
|
|
1123
|
-
],
|
|
1124
|
-
function
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
}
|
|
1142
|
-
return null;
|
|
1143
|
-
}(r);
|
|
1144
|
-
e.update(() => {
|
|
1145
|
-
if (Ot($getSelection())) {
|
|
1146
|
-
for (const [e] of t.observers.values()) e.$clearHighlight(!1);
|
|
1147
|
-
$setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
|
|
1148
|
-
}
|
|
1149
|
-
if (!l) return;
|
|
1150
|
-
const { tableObserver: n, tableElement: r, cellElement: s } = l;
|
|
1151
|
-
(function(e, t, n, o, r, l) {
|
|
1152
|
-
const s = e._window;
|
|
1153
|
-
if (!s) return;
|
|
1154
|
-
const i = (t) => {
|
|
1155
|
-
if (r.isSelecting) return;
|
|
1156
|
-
r.isSelecting = !0, null !== t && null === r.anchorCell && e.update(() => {
|
|
1157
|
-
r.$setAnchorCellForSelection(t);
|
|
1158
|
-
});
|
|
1159
|
-
const n = () => {
|
|
1160
|
-
r.isSelecting = !1, s.removeEventListener("pointerup", n), s.removeEventListener("pointermove", i);
|
|
1161
|
-
}, i = (t) => {
|
|
1162
|
-
if (!((e) => !(1 & ~e.buttons))(t) && r.isSelecting) return r.isSelecting = !1, s.removeEventListener("pointerup", n), void s.removeEventListener("pointermove", i);
|
|
1163
|
-
if (!isDOMNode(t.target)) return;
|
|
1164
|
-
let c = null;
|
|
1165
|
-
const a = !(Je || o.contains(t.target));
|
|
1166
|
-
if (a) c = Vt(o, t.target);
|
|
1167
|
-
else for (const e of document.elementsFromPoint(t.clientX, t.clientY)) if (c = Vt(o, e), c) break;
|
|
1168
|
-
if (c) {
|
|
1169
|
-
const t = c;
|
|
1170
|
-
null === r.anchorCell && e.update(() => {
|
|
1171
|
-
r.$setAnchorCellForSelection(t);
|
|
1172
|
-
}), null !== r.focusCell && c.elem === r.focusCell.elem || (l.setNextFocus({
|
|
1173
|
-
focusCell: c,
|
|
1174
|
-
override: a,
|
|
1175
|
-
tableKey: r.tableNodeKey
|
|
1176
|
-
}), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
|
|
1177
|
-
}
|
|
1122
|
+
], tn = [KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND];
|
|
1123
|
+
function nn(e, t) {
|
|
1124
|
+
return e.registerRootListener((n) => {
|
|
1125
|
+
if (null === n) return;
|
|
1126
|
+
const o = e._window;
|
|
1127
|
+
if (null === o) return;
|
|
1128
|
+
const r = (o) => {
|
|
1129
|
+
const r = o.target;
|
|
1130
|
+
if (0 !== o.button || !isDOMNode(r) || !n.contains(r)) return;
|
|
1131
|
+
const l = function(e) {
|
|
1132
|
+
const t = cn(e);
|
|
1133
|
+
if (null === t) return null;
|
|
1134
|
+
let n = t.elem;
|
|
1135
|
+
for (; null != n;) {
|
|
1136
|
+
if ("TABLE" === n.nodeName && qt in n && n[qt]) return {
|
|
1137
|
+
cellElement: t,
|
|
1138
|
+
tableElement: n,
|
|
1139
|
+
tableObserver: n[qt]
|
|
1178
1140
|
};
|
|
1179
|
-
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1141
|
+
n = n.parentNode;
|
|
1142
|
+
}
|
|
1143
|
+
return null;
|
|
1144
|
+
}(r);
|
|
1145
|
+
e.update(() => {
|
|
1146
|
+
if (Pt($getSelection())) {
|
|
1147
|
+
for (const [e] of t.observers.values()) e.$clearHighlight(!1);
|
|
1148
|
+
$setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0);
|
|
1149
|
+
}
|
|
1150
|
+
if (!l) return;
|
|
1151
|
+
const { tableObserver: n, tableElement: r, cellElement: s } = l;
|
|
1152
|
+
(function(e, t, n, o, r, l) {
|
|
1153
|
+
const s = e._window;
|
|
1154
|
+
if (!s) return;
|
|
1155
|
+
const i = (t) => {
|
|
1156
|
+
if (r.isSelecting) return;
|
|
1157
|
+
r.isSelecting = !0, null !== t && null === r.anchorCell && e.update(() => {
|
|
1158
|
+
r.$setAnchorCellForSelection(t);
|
|
1159
|
+
});
|
|
1160
|
+
const n = () => {
|
|
1161
|
+
r.isSelecting = !1, s.removeEventListener("pointerup", n), s.removeEventListener("pointermove", i);
|
|
1162
|
+
}, i = (t) => {
|
|
1163
|
+
if (!((e) => !(1 & ~e.buttons))(t) && r.isSelecting) return r.isSelecting = !1, s.removeEventListener("pointerup", n), void s.removeEventListener("pointermove", i);
|
|
1164
|
+
if (!isDOMNode(t.target)) return;
|
|
1165
|
+
let c = null;
|
|
1166
|
+
const a = !(IS_FIREFOX || o.contains(t.target));
|
|
1167
|
+
if (a) c = an(o, t.target);
|
|
1168
|
+
else for (const e of document.elementsFromPoint(t.clientX, t.clientY)) if (c = an(o, e), c) break;
|
|
1169
|
+
if (c) {
|
|
1170
|
+
const t = c;
|
|
1171
|
+
null === r.anchorCell && e.update(() => {
|
|
1172
|
+
r.$setAnchorCellForSelection(t);
|
|
1173
|
+
}), null !== r.focusCell && c.elem === r.focusCell.elem || (l.setNextFocus({
|
|
1174
|
+
focusCell: c,
|
|
1175
|
+
override: a,
|
|
1176
|
+
tableKey: r.tableNodeKey
|
|
1177
|
+
}), e.dispatchCommand(SELECTION_CHANGE_COMMAND, void 0));
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
s.addEventListener("pointerup", n, r.listenerOptions), s.addEventListener("pointermove", i, r.listenerOptions);
|
|
1181
|
+
};
|
|
1182
|
+
r.pointerType = t.pointerType;
|
|
1183
|
+
const c = $getNodeByKeyOrThrow(r.tableNodeKey), a = $getPreviousSelection();
|
|
1184
|
+
if (IS_FIREFOX && t.shiftKey && _n(a, c) && ($isRangeSelection(a) || Pt(a))) {
|
|
1185
|
+
const e = a.anchor.getNode(), o = Qt(c, a.anchor.getNode());
|
|
1186
|
+
if (o) r.$setAnchorCellForSelection(On(r, o)), r.$setFocusCellForSelection(n), Tn(t);
|
|
1187
|
+
else (c.isBefore(e) ? c.selectStart() : c.selectEnd()).anchor.set(a.anchor.key, a.anchor.offset, a.anchor.type);
|
|
1188
|
+
} else "touch" !== t.pointerType && r.$setAnchorCellForSelection(n);
|
|
1189
|
+
i(n);
|
|
1190
|
+
})(e, o, s, r, n, t);
|
|
1191
|
+
});
|
|
1192
|
+
};
|
|
1193
|
+
return o.addEventListener("pointerdown", r), () => {
|
|
1194
|
+
o.removeEventListener("pointerdown", r);
|
|
1195
|
+
};
|
|
1196
|
+
});
|
|
1195
1197
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const i = o.getRootElement(), c =
|
|
1198
|
-
null !== i && null !== c ||
|
|
1199
|
-
const a = new
|
|
1198
|
+
function on(e, t, o, l, s) {
|
|
1199
|
+
const i = o.getRootElement(), c = Gt(o);
|
|
1200
|
+
null !== i && null !== c || Ze(246);
|
|
1201
|
+
const a = new Yt(o, e.getKey()), u = Vt(e, t);
|
|
1200
1202
|
(function(e, t) {
|
|
1201
|
-
null !==
|
|
1202
|
-
e[
|
|
1203
|
+
null !== sn(e) && Ze(205);
|
|
1204
|
+
e[qt] = t;
|
|
1203
1205
|
})(u, a), a.listenersToRemove.add(() => function(e, t) {
|
|
1204
|
-
|
|
1206
|
+
sn(e) === t && delete e[qt];
|
|
1205
1207
|
}(u, a));
|
|
1206
1208
|
const h = (e) => {
|
|
1207
|
-
if (e.detail >= 3 && isDOMNode(e.target)) null !==
|
|
1209
|
+
if (e.detail >= 3 && isDOMNode(e.target)) null !== cn(e.target) && e.preventDefault();
|
|
1208
1210
|
};
|
|
1209
1211
|
u.addEventListener("mousedown", h, a.listenerOptions), a.listenersToRemove.add(() => {
|
|
1210
1212
|
u.removeEventListener("mousedown", h);
|
|
1211
1213
|
});
|
|
1212
|
-
for (const [t, n] of
|
|
1214
|
+
for (const [t, n] of Zt) a.listenersToRemove.add(o.registerCommand(t, (t) => xn(o, t, n, e, a, s), COMMAND_PRIORITY_HIGH));
|
|
1213
1215
|
a.listenersToRemove.add(o.registerCommand(KEY_ESCAPE_COMMAND, (t) => {
|
|
1214
1216
|
const n = $getSelection();
|
|
1215
|
-
if (
|
|
1216
|
-
const o =
|
|
1217
|
-
if (null !== o) return
|
|
1217
|
+
if (Pt(n)) {
|
|
1218
|
+
const o = Qt(e, n.focus.getNode());
|
|
1219
|
+
if (null !== o) return Tn(t), o.selectEnd(), !0;
|
|
1218
1220
|
}
|
|
1219
1221
|
return !1;
|
|
1220
1222
|
}, COMMAND_PRIORITY_HIGH));
|
|
1221
1223
|
const d = (t) => () => {
|
|
1222
1224
|
const o = $getSelection();
|
|
1223
|
-
if (!
|
|
1224
|
-
if (
|
|
1225
|
+
if (!_n(o, e)) return !1;
|
|
1226
|
+
if (Pt(o)) return a.$clearText(), !0;
|
|
1225
1227
|
if ($isRangeSelection(o)) {
|
|
1226
|
-
if (!
|
|
1228
|
+
if (!Ge(Qt(e, o.anchor.getNode()))) return !1;
|
|
1227
1229
|
const r = o.anchor.getNode(), l = o.focus.getNode(), s = e.isParentOf(r), i = e.isParentOf(l);
|
|
1228
1230
|
if (s && !i || i && !s) return a.$clearText(), !0;
|
|
1229
|
-
const c = $findMatchingParent(o.anchor.getNode(), (e) => $isElementNode(e)), u = c && $findMatchingParent(c, (e) => $isElementNode(e) &&
|
|
1231
|
+
const c = $findMatchingParent(o.anchor.getNode(), (e) => $isElementNode(e)), u = c && $findMatchingParent(c, (e) => $isElementNode(e) && Ge(e.getParent()));
|
|
1230
1232
|
if (!$isElementNode(u) || !$isElementNode(c)) return !1;
|
|
1231
1233
|
if (t === DELETE_LINE_COMMAND && null === u.getPreviousSibling()) return !0;
|
|
1232
1234
|
}
|
|
1233
1235
|
return !1;
|
|
1234
1236
|
};
|
|
1235
|
-
for (const e of
|
|
1237
|
+
for (const e of en) a.listenersToRemove.add(o.registerCommand(e, d(e), COMMAND_PRIORITY_HIGH));
|
|
1236
1238
|
const f = (t) => {
|
|
1237
1239
|
const n = $getSelection();
|
|
1238
|
-
if (!
|
|
1240
|
+
if (!Pt(n) && !$isRangeSelection(n)) return !1;
|
|
1239
1241
|
const o = e.isParentOf(n.anchor.getNode());
|
|
1240
1242
|
if (o !== e.isParentOf(n.focus.getNode())) {
|
|
1241
1243
|
const t = o ? "anchor" : "focus", r = o ? "focus" : "anchor", { key: l, offset: s, type: i } = n[r];
|
|
1242
1244
|
return e[n[t].isBefore(n[r]) ? "selectPrevious" : "selectNext"]()[r].set(l, s, i), !1;
|
|
1243
1245
|
}
|
|
1244
|
-
return !!
|
|
1246
|
+
return !!_n(n, e) && !!Pt(n) && (t && (t.preventDefault(), t.stopPropagation()), a.$clearText(), !0);
|
|
1245
1247
|
};
|
|
1246
|
-
for (const e of
|
|
1248
|
+
for (const e of tn) a.listenersToRemove.add(o.registerCommand(e, f, COMMAND_PRIORITY_HIGH));
|
|
1247
1249
|
return a.listenersToRemove.add(o.registerCommand(CUT_COMMAND, (e) => {
|
|
1248
1250
|
const t = $getSelection();
|
|
1249
1251
|
if (t) {
|
|
1250
|
-
if (!
|
|
1252
|
+
if (!Pt(t) && !$isRangeSelection(t)) return !1;
|
|
1251
1253
|
copyToClipboard(o, objectKlassEquals(e, ClipboardEvent) ? e : null, $getClipboardDataFromSelection(t));
|
|
1252
1254
|
const n = f(e);
|
|
1253
1255
|
return $isRangeSelection(t) ? (t.removeText(), !0) : n;
|
|
@@ -1255,28 +1257,28 @@ function Jt(e, t, o, l, s) {
|
|
|
1255
1257
|
return !1;
|
|
1256
1258
|
}, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(FORMAT_TEXT_COMMAND, (t) => {
|
|
1257
1259
|
const o = $getSelection();
|
|
1258
|
-
if (!
|
|
1259
|
-
if (
|
|
1260
|
+
if (!_n(o, e)) return !1;
|
|
1261
|
+
if (Pt(o)) return a.$formatCells(t), !0;
|
|
1260
1262
|
if ($isRangeSelection(o)) {
|
|
1261
|
-
if (!
|
|
1263
|
+
if (!Ge($findMatchingParent(o.anchor.getNode(), (e) => Ge(e)))) return !1;
|
|
1262
1264
|
}
|
|
1263
1265
|
return !1;
|
|
1264
1266
|
}, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(FORMAT_ELEMENT_COMMAND, (t) => {
|
|
1265
1267
|
const n = $getSelection();
|
|
1266
|
-
if (!
|
|
1268
|
+
if (!Pt(n) || !_n(n, e)) return !1;
|
|
1267
1269
|
const o = n.anchor.getNode(), r = n.focus.getNode();
|
|
1268
|
-
if (!
|
|
1270
|
+
if (!Ge(o) || !Ge(r)) return !1;
|
|
1269
1271
|
if (function(e, t) {
|
|
1270
|
-
if (
|
|
1272
|
+
if (Pt(e)) {
|
|
1271
1273
|
const n = e.anchor.getNode(), o = e.focus.getNode();
|
|
1272
1274
|
if (t && n && o) {
|
|
1273
|
-
const [e] =
|
|
1275
|
+
const [e] = Et(t, n, o);
|
|
1274
1276
|
return n.getKey() === e[0][0].cell.getKey() && o.getKey() === e[e.length - 1].at(-1).cell.getKey();
|
|
1275
1277
|
}
|
|
1276
1278
|
}
|
|
1277
1279
|
return !1;
|
|
1278
1280
|
}(n, e)) return e.setFormat(t), !0;
|
|
1279
|
-
const [l, s, i] =
|
|
1281
|
+
const [l, s, i] = Et(e, o, r), c = Math.max(s.startRow + s.cell.__rowSpan - 1, i.startRow + i.cell.__rowSpan - 1), a = Math.max(s.startColumn + s.cell.__colSpan - 1, i.startColumn + i.cell.__colSpan - 1), u = Math.min(s.startRow, i.startRow), h = Math.min(s.startColumn, i.startColumn), d = /* @__PURE__ */ new Set();
|
|
1280
1282
|
for (let e = u; e <= c; e++) for (let n = h; n <= a; n++) {
|
|
1281
1283
|
const o = l[e][n].cell;
|
|
1282
1284
|
if (d.has(o)) continue;
|
|
@@ -1290,59 +1292,59 @@ function Jt(e, t, o, l, s) {
|
|
|
1290
1292
|
return !0;
|
|
1291
1293
|
}, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(CONTROLLED_TEXT_INSERTION_COMMAND, (t) => {
|
|
1292
1294
|
const r = $getSelection();
|
|
1293
|
-
if (!
|
|
1294
|
-
if (
|
|
1295
|
+
if (!_n(r, e)) return !1;
|
|
1296
|
+
if (Pt(r)) return a.$clearHighlight(), !1;
|
|
1295
1297
|
if ($isRangeSelection(r)) {
|
|
1296
|
-
if (!
|
|
1298
|
+
if (!Ge($findMatchingParent(r.anchor.getNode(), (e) => Ge(e)))) return !1;
|
|
1297
1299
|
if ("string" == typeof t) {
|
|
1298
|
-
const n =
|
|
1299
|
-
if (n) return
|
|
1300
|
+
const n = Rn(o, r, e);
|
|
1301
|
+
if (n) return Fn(n, e, [$createTextNode(t)]), !0;
|
|
1300
1302
|
}
|
|
1301
1303
|
}
|
|
1302
1304
|
return !1;
|
|
1303
1305
|
}, COMMAND_PRIORITY_HIGH)), l && a.listenersToRemove.add(o.registerCommand(KEY_TAB_COMMAND, (t) => {
|
|
1304
1306
|
const o = $getSelection();
|
|
1305
|
-
if (!$isRangeSelection(o) || !o.isCollapsed() || !
|
|
1306
|
-
const r =
|
|
1307
|
-
return !(null === r || !e.is(
|
|
1307
|
+
if (!$isRangeSelection(o) || !o.isCollapsed() || !_n(o, e)) return !1;
|
|
1308
|
+
const r = yn(o.anchor.getNode());
|
|
1309
|
+
return !(null === r || !e.is(Nn(r))) && (Tn(t), function(e, t) {
|
|
1308
1310
|
const o = "next" === t ? "getNextSibling" : "getPreviousSibling", r = "next" === t ? "getFirstChild" : "getLastChild", l = e[o]();
|
|
1309
1311
|
if ($isElementNode(l)) return l.selectEnd();
|
|
1310
|
-
const s = $findMatchingParent(e,
|
|
1311
|
-
null === s &&
|
|
1312
|
-
for (let e = s[o]();
|
|
1312
|
+
const s = $findMatchingParent(e, ot);
|
|
1313
|
+
null === s && Ze(247);
|
|
1314
|
+
for (let e = s[o](); ot(e); e = e[o]()) {
|
|
1313
1315
|
const t = e[r]();
|
|
1314
1316
|
if ($isElementNode(t)) return t.selectEnd();
|
|
1315
1317
|
}
|
|
1316
|
-
const i = $findMatchingParent(s,
|
|
1317
|
-
null === i &&
|
|
1318
|
+
const i = $findMatchingParent(s, Bn);
|
|
1319
|
+
null === i && Ze(248);
|
|
1318
1320
|
"next" === t ? i.selectNext() : i.selectPrevious();
|
|
1319
1321
|
}(r, t.shiftKey ? "previous" : "next"), !0);
|
|
1320
1322
|
}, COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(FOCUS_COMMAND, (t) => e.isSelected(), COMMAND_PRIORITY_HIGH)), a.listenersToRemove.add(o.registerCommand(INSERT_PARAGRAPH_COMMAND, () => {
|
|
1321
1323
|
const t = $getSelection();
|
|
1322
|
-
if (!$isRangeSelection(t) || !t.isCollapsed() || !
|
|
1323
|
-
const n =
|
|
1324
|
-
return !!n && (
|
|
1324
|
+
if (!$isRangeSelection(t) || !t.isCollapsed() || !_n(t, e)) return !1;
|
|
1325
|
+
const n = Rn(o, t, e);
|
|
1326
|
+
return !!n && (Fn(n, e), !0);
|
|
1325
1327
|
}, COMMAND_PRIORITY_HIGH)), a;
|
|
1326
1328
|
}
|
|
1327
|
-
function
|
|
1329
|
+
function rn(e, t) {
|
|
1328
1330
|
const o = $getSelection(), r = $getPreviousSelection(), l = e.getAndClearNextFocus();
|
|
1329
1331
|
if (null !== l) {
|
|
1330
1332
|
const { tableKey: t, focusCell: n } = l, r = e.observers.get(t);
|
|
1331
|
-
r ||
|
|
1333
|
+
r || Ze(335, t);
|
|
1332
1334
|
const [s] = r;
|
|
1333
|
-
if (
|
|
1335
|
+
if (Pt(o) && o.tableKey === s.tableNodeKey) return (n.x !== s.focusX || n.y !== s.focusY) && (s.$setFocusCellForSelection(n), !0);
|
|
1334
1336
|
if (null !== s.anchorCell && null !== s.anchorCellNodeKey && n.elem !== s.anchorCell.elem && null !== s.tableSelection) return s.$setFocusCellForSelection(n, !0), !0;
|
|
1335
1337
|
}
|
|
1336
1338
|
const s = e.getAndClearShouldCheckSelectionForTable();
|
|
1337
1339
|
if (s && $isRangeSelection(r) && $isRangeSelection(o) && o.isCollapsed()) {
|
|
1338
|
-
const e = $getNodeByKeyOrThrow(s), t = o.anchor.getNode(), r = e.getFirstChild(), l =
|
|
1339
|
-
if (null !== l &&
|
|
1340
|
+
const e = $getNodeByKeyOrThrow(s), t = o.anchor.getNode(), r = e.getFirstChild(), l = yn(t);
|
|
1341
|
+
if (null !== l && ot(r)) {
|
|
1340
1342
|
const t = r.getFirstChild();
|
|
1341
|
-
if (
|
|
1343
|
+
if (Ge(t) && e.is($findMatchingParent(l, (n) => n.is(e) || n.is(t)))) return t.selectStart(), !0;
|
|
1342
1344
|
}
|
|
1343
1345
|
}
|
|
1344
|
-
|
|
1345
|
-
const n =
|
|
1346
|
+
Pt(o) && function(e, t) {
|
|
1347
|
+
const n = Gt(e), o = $getPreviousSelection();
|
|
1346
1348
|
if (!t.is(o)) return;
|
|
1347
1349
|
const r = $getNodeByKeyOrThrow(t.tableKey), l = getDOMSelection(n);
|
|
1348
1350
|
if (l && l.anchorNode && l.focusNode) {
|
|
@@ -1353,20 +1355,20 @@ function Xt(e, t) {
|
|
|
1353
1355
|
}
|
|
1354
1356
|
}
|
|
1355
1357
|
}(t, o), $isRangeSelection(o) && function(e, t) {
|
|
1356
|
-
const n = $getPreviousSelection(), { anchor: o, focus: r } = e, l = o.getNode(), s = r.getNode(), i =
|
|
1358
|
+
const n = $getPreviousSelection(), { anchor: o, focus: r } = e, l = o.getNode(), s = r.getNode(), i = yn(l), c = yn(s), a = i ? Nn(i) : null, u = c ? Nn(c) : null, h = e.isBackward(), d = i && c && a && u && a.is(u), f = u && (!a || a.isParentOf(u)), g = a && (!u || u.isParentOf(a));
|
|
1357
1359
|
if (f) {
|
|
1358
|
-
const t = e.clone(), [n] =
|
|
1360
|
+
const t = e.clone(), [n] = Et(u, c, c), o = n[0][0].cell, r = n[n.length - 1].at(-1).cell;
|
|
1359
1361
|
t.focus.set(h ? o.getKey() : r.getKey(), h ? 0 : r.getChildrenSize(), "element"), $setSelection(t);
|
|
1360
1362
|
} else if (g) {
|
|
1361
|
-
const t = e.clone(), [n] =
|
|
1363
|
+
const t = e.clone(), [n] = Et(a, i, i), o = n[0][0].cell, r = n[n.length - 1].at(-1).cell;
|
|
1362
1364
|
t.anchor.set(h ? r.getKey() : o.getKey(), h ? r.getChildrenSize() : 0, "element"), $setSelection(t);
|
|
1363
1365
|
} else if (d) {
|
|
1364
1366
|
const o = t.observers.get(a.getKey());
|
|
1365
|
-
o ||
|
|
1367
|
+
o || Ze(335, a.getKey());
|
|
1366
1368
|
const [r] = o;
|
|
1367
|
-
if (i.is(c) || (r.$setAnchorCellForSelection(
|
|
1368
|
-
const e =
|
|
1369
|
-
e && !e.is(c) && (r.$setAnchorCellForSelection(
|
|
1369
|
+
if (i.is(c) || (r.$setAnchorCellForSelection(On(r, i)), r.$setFocusCellForSelection(On(r, c), !0)), "touch" === r.pointerType && r.isSelecting && e.isCollapsed() && $isRangeSelection(n) && n.isCollapsed()) {
|
|
1370
|
+
const e = yn(n.anchor.getNode());
|
|
1371
|
+
e && !e.is(c) && (r.$setAnchorCellForSelection(On(r, e)), r.$setFocusCellForSelection(On(r, c), !0), r.pointerType = null);
|
|
1370
1372
|
}
|
|
1371
1373
|
}
|
|
1372
1374
|
}(o, e);
|
|
@@ -1374,26 +1376,26 @@ function Xt(e, t) {
|
|
|
1374
1376
|
tableNode: $getNodeByKeyOrThrow(e),
|
|
1375
1377
|
tableObserver: t
|
|
1376
1378
|
}));
|
|
1377
|
-
for (const { tableNode: e, tableObserver: n } of i)
|
|
1379
|
+
for (const { tableNode: e, tableObserver: n } of i) ln(t, e, n);
|
|
1378
1380
|
return !1;
|
|
1379
1381
|
}
|
|
1380
|
-
function
|
|
1382
|
+
function ln(e, t, n) {
|
|
1381
1383
|
const o = $getSelection(), r = $getPreviousSelection();
|
|
1382
|
-
o && !o.is(r) && (
|
|
1383
|
-
t.$enableHighlightStyle(),
|
|
1384
|
+
o && !o.is(r) && (Pt(o) || Pt(r)) && n.tableSelection && !n.tableSelection.is(r) && (Pt(o) && o.tableKey === n.tableNodeKey ? n.$updateTableTableSelection(o) : !Pt(o) && Pt(r) && r.tableKey === n.tableNodeKey && n.$updateTableTableSelection(null)), n.hasHijackedSelectionStyles && !t.isSelected() ? function(e, t) {
|
|
1385
|
+
t.$enableHighlightStyle(), dn(t.table, (t) => {
|
|
1384
1386
|
const n = t.elem;
|
|
1385
|
-
t.highlighted = !1,
|
|
1387
|
+
t.highlighted = !1, wn(e, t), n.getAttribute("style") || n.removeAttribute("style");
|
|
1386
1388
|
});
|
|
1387
1389
|
}(e, n) : !n.hasHijackedSelectionStyles && t.isSelected() && function(e, t) {
|
|
1388
|
-
t.$disableHighlightStyle(),
|
|
1389
|
-
t.highlighted = !0,
|
|
1390
|
+
t.$disableHighlightStyle(), dn(t.table, (t) => {
|
|
1391
|
+
t.highlighted = !0, bn(e, t);
|
|
1390
1392
|
});
|
|
1391
1393
|
}(e, n);
|
|
1392
1394
|
}
|
|
1393
|
-
function
|
|
1394
|
-
return e[
|
|
1395
|
+
function sn(e) {
|
|
1396
|
+
return e[qt] || null;
|
|
1395
1397
|
}
|
|
1396
|
-
function
|
|
1398
|
+
function cn(e) {
|
|
1397
1399
|
let t = e;
|
|
1398
1400
|
for (; null != t;) {
|
|
1399
1401
|
const e = t.nodeName;
|
|
@@ -1405,7 +1407,7 @@ function jt(e) {
|
|
|
1405
1407
|
}
|
|
1406
1408
|
return null;
|
|
1407
1409
|
}
|
|
1408
|
-
function
|
|
1410
|
+
function an(e, t) {
|
|
1409
1411
|
if (!e.contains(t)) return null;
|
|
1410
1412
|
let n = null;
|
|
1411
1413
|
for (let o = t; null != o; o = o.parentNode) {
|
|
@@ -1415,13 +1417,13 @@ function Vt(e, t) {
|
|
|
1415
1417
|
}
|
|
1416
1418
|
return null;
|
|
1417
1419
|
}
|
|
1418
|
-
function
|
|
1420
|
+
function un(e, t) {
|
|
1419
1421
|
const n = [], o = {
|
|
1420
1422
|
columns: 0,
|
|
1421
1423
|
domRows: n,
|
|
1422
1424
|
rows: 0
|
|
1423
1425
|
};
|
|
1424
|
-
let r =
|
|
1426
|
+
let r = Vt(e, t).querySelector("tr"), l = 0, s = 0;
|
|
1425
1427
|
for (n.length = 0; null != r;) {
|
|
1426
1428
|
const e = r.nodeName;
|
|
1427
1429
|
if ("TD" === e || "TH" === e) {
|
|
@@ -1456,14 +1458,14 @@ function Gt(e, t) {
|
|
|
1456
1458
|
}
|
|
1457
1459
|
return o.columns = l + 1, o.rows = s + 1, o;
|
|
1458
1460
|
}
|
|
1459
|
-
function
|
|
1461
|
+
function hn(e, t, n) {
|
|
1460
1462
|
const o = new Set(n ? n.getNodes() : []);
|
|
1461
|
-
|
|
1463
|
+
dn(t, (t, n) => {
|
|
1462
1464
|
const r = t.elem;
|
|
1463
|
-
o.has(n) ? (t.highlighted = !0,
|
|
1465
|
+
o.has(n) ? (t.highlighted = !0, bn(e, t)) : (t.highlighted = !1, wn(e, t), r.getAttribute("style") || r.removeAttribute("style"));
|
|
1464
1466
|
});
|
|
1465
1467
|
}
|
|
1466
|
-
function
|
|
1468
|
+
function dn(e, t) {
|
|
1467
1469
|
const { domRows: n } = e;
|
|
1468
1470
|
for (let e = 0; e < n.length; e++) {
|
|
1469
1471
|
const o = n[e];
|
|
@@ -1478,17 +1480,17 @@ function Zt(e, t) {
|
|
|
1478
1480
|
}
|
|
1479
1481
|
}
|
|
1480
1482
|
}
|
|
1481
|
-
const
|
|
1483
|
+
const fn = (e, t, n, o, r) => {
|
|
1482
1484
|
const l = "forward" === r;
|
|
1483
1485
|
switch (r) {
|
|
1484
1486
|
case "backward":
|
|
1485
|
-
case "forward": return n !== (l ? e.table.columns - 1 : 0) ?
|
|
1486
|
-
case "up": return 0 !== o ?
|
|
1487
|
-
case "down": return o !== e.table.rows - 1 ?
|
|
1487
|
+
case "forward": return n !== (l ? e.table.columns - 1 : 0) ? Sn(t.getCellNodeFromCordsOrThrow(n + (l ? 1 : -1), o, e.table), l) : o !== (l ? e.table.rows - 1 : 0) ? Sn(t.getCellNodeFromCordsOrThrow(l ? 0 : e.table.columns - 1, o + (l ? 1 : -1), e.table), l) : l ? t.selectNext() : t.selectPrevious(), !0;
|
|
1488
|
+
case "up": return 0 !== o ? Sn(t.getCellNodeFromCordsOrThrow(n, o - 1, e.table), !1) : t.selectPrevious(), !0;
|
|
1489
|
+
case "down": return o !== e.table.rows - 1 ? Sn(t.getCellNodeFromCordsOrThrow(n, o + 1, e.table), !0) : t.selectNext(), !0;
|
|
1488
1490
|
default: return !1;
|
|
1489
1491
|
}
|
|
1490
1492
|
};
|
|
1491
|
-
function
|
|
1493
|
+
function gn(e, t) {
|
|
1492
1494
|
let n, o;
|
|
1493
1495
|
if (t.startColumn === e.minColumn) n = "minColumn";
|
|
1494
1496
|
else {
|
|
@@ -1502,17 +1504,17 @@ function tn(e, t) {
|
|
|
1502
1504
|
}
|
|
1503
1505
|
return [n, o];
|
|
1504
1506
|
}
|
|
1505
|
-
function
|
|
1507
|
+
function mn([e, t]) {
|
|
1506
1508
|
return ["minColumn" === e ? "maxColumn" : "minColumn", "minRow" === t ? "maxRow" : "minRow"];
|
|
1507
1509
|
}
|
|
1508
|
-
function
|
|
1510
|
+
function pn(e, t, [n, o]) {
|
|
1509
1511
|
const r = t[o], l = e[r];
|
|
1510
|
-
void 0 === l &&
|
|
1512
|
+
void 0 === l && Ze(250, o, String(r));
|
|
1511
1513
|
const s = t[n], i = l[s];
|
|
1512
|
-
return void 0 === i &&
|
|
1514
|
+
return void 0 === i && Ze(250, n, String(s)), i;
|
|
1513
1515
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const l =
|
|
1516
|
+
function Cn(e, t, n, o, r) {
|
|
1517
|
+
const l = $t(t, n, o), { topSpan: i, leftSpan: c, bottomSpan: a, rightSpan: u } = function(e, t) {
|
|
1516
1518
|
const { minColumn: n, maxColumn: o, minRow: r, maxRow: l } = t;
|
|
1517
1519
|
let s = 1, i = 1, c = 1, a = 1;
|
|
1518
1520
|
const u = e[r], h = e[l];
|
|
@@ -1524,9 +1526,9 @@ function rn(e, t, n, o, r) {
|
|
|
1524
1526
|
rightSpan: c,
|
|
1525
1527
|
topSpan: s
|
|
1526
1528
|
};
|
|
1527
|
-
}(t, l), [d, f] =
|
|
1528
|
-
const n =
|
|
1529
|
-
return null === n &&
|
|
1529
|
+
}(t, l), [d, f] = mn(function(e, t) {
|
|
1530
|
+
const n = gn(e, t);
|
|
1531
|
+
return null === n && Ze(249, t.cell.getKey()), n;
|
|
1530
1532
|
}(l, n));
|
|
1531
1533
|
let g = l[d], m = l[f];
|
|
1532
1534
|
"forward" === r ? g += "maxColumn" === d ? 1 : c : "backward" === r ? g -= "minColumn" === d ? 1 : u : "down" === r ? m += "maxRow" === f ? 1 : i : "up" === r && (m -= "minRow" === f ? 1 : a);
|
|
@@ -1535,44 +1537,44 @@ function rn(e, t, n, o, r) {
|
|
|
1535
1537
|
const C = p[g];
|
|
1536
1538
|
if (void 0 === C) return !1;
|
|
1537
1539
|
const [_, S] = function(e, t, n) {
|
|
1538
|
-
const o =
|
|
1539
|
-
if (r) return [
|
|
1540
|
-
const l =
|
|
1541
|
-
if (l) return [
|
|
1540
|
+
const o = $t(e, t, n), r = gn(o, t);
|
|
1541
|
+
if (r) return [pn(e, o, r), pn(e, o, mn(r))];
|
|
1542
|
+
const l = gn(o, n);
|
|
1543
|
+
if (l) return [pn(e, o, mn(l)), pn(e, o, l)];
|
|
1542
1544
|
const s = ["minColumn", "minRow"];
|
|
1543
|
-
return [
|
|
1544
|
-
}(t, n, C),
|
|
1545
|
-
return e.$setAnchorCellForSelection(
|
|
1545
|
+
return [pn(e, o, s), pn(e, o, mn(s))];
|
|
1546
|
+
}(t, n, C), b = On(e, _.cell), w = On(e, S.cell);
|
|
1547
|
+
return e.$setAnchorCellForSelection(b), e.$setFocusCellForSelection(w, !0), !0;
|
|
1546
1548
|
}
|
|
1547
|
-
function
|
|
1548
|
-
if ($isRangeSelection(e) ||
|
|
1549
|
+
function _n(e, t) {
|
|
1550
|
+
if ($isRangeSelection(e) || Pt(e)) {
|
|
1549
1551
|
const n = t.isParentOf(e.anchor.getNode()), o = t.isParentOf(e.focus.getNode());
|
|
1550
1552
|
return n && o;
|
|
1551
1553
|
}
|
|
1552
1554
|
return !1;
|
|
1553
1555
|
}
|
|
1554
|
-
function
|
|
1556
|
+
function Sn(e, t) {
|
|
1555
1557
|
t ? e.selectStart() : e.selectEnd();
|
|
1556
1558
|
}
|
|
1557
|
-
function
|
|
1559
|
+
function bn(t, n) {
|
|
1558
1560
|
const o = n.elem, r = t._config.theme;
|
|
1559
|
-
|
|
1561
|
+
Ge($getNearestNodeFromDOMNode(o)) || Ze(131), addClassNamesToElement(o, r.tableCellSelected);
|
|
1560
1562
|
}
|
|
1561
|
-
function
|
|
1563
|
+
function wn(e, t) {
|
|
1562
1564
|
const n = t.elem;
|
|
1563
|
-
|
|
1565
|
+
Ge($getNearestNodeFromDOMNode(n)) || Ze(131);
|
|
1564
1566
|
const r = e._config.theme;
|
|
1565
1567
|
removeClassNamesFromElement(n, r.tableCellSelected);
|
|
1566
1568
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const t = $findMatchingParent(e,
|
|
1569
|
-
return
|
|
1569
|
+
function yn(e) {
|
|
1570
|
+
const t = $findMatchingParent(e, Ge);
|
|
1571
|
+
return Ge(t) ? t : null;
|
|
1570
1572
|
}
|
|
1571
|
-
function
|
|
1572
|
-
const t = $findMatchingParent(e,
|
|
1573
|
-
return
|
|
1573
|
+
function Nn(e) {
|
|
1574
|
+
const t = $findMatchingParent(e, Bn);
|
|
1575
|
+
return Bn(t) ? t : null;
|
|
1574
1576
|
}
|
|
1575
|
-
function
|
|
1577
|
+
function vn(e, t, o, r, l, s, i) {
|
|
1576
1578
|
const c = $caretFromPoint(o.focus, l ? "previous" : "next");
|
|
1577
1579
|
if ($isExtendableTextPointCaret(c)) return !1;
|
|
1578
1580
|
let a = c;
|
|
@@ -1581,21 +1583,21 @@ function dn(e, t, o, r, l, s, i) {
|
|
|
1581
1583
|
a = e;
|
|
1582
1584
|
}
|
|
1583
1585
|
const u = a.getParentAtCaret();
|
|
1584
|
-
if (!
|
|
1586
|
+
if (!Ge(u)) return !1;
|
|
1585
1587
|
const h = u, d = function(e) {
|
|
1586
1588
|
for (const t of $extendCaretToRange(e).iterNodeCarets("root")) {
|
|
1587
1589
|
const { origin: n } = t;
|
|
1588
|
-
if (
|
|
1590
|
+
if (Ge(n)) {
|
|
1589
1591
|
if ($isChildCaret(t)) return $getChildCaret(n, e.direction);
|
|
1590
|
-
} else if (!
|
|
1592
|
+
} else if (!ot(n)) break;
|
|
1591
1593
|
}
|
|
1592
1594
|
return null;
|
|
1593
|
-
}($getSiblingCaret(h, a.direction)), f = $findMatchingParent(h,
|
|
1595
|
+
}($getSiblingCaret(h, a.direction)), f = $findMatchingParent(h, Bn);
|
|
1594
1596
|
if (!f || !f.is(s)) return !1;
|
|
1595
|
-
const g = e.getElementByKey(h.getKey()), m =
|
|
1597
|
+
const g = e.getElementByKey(h.getKey()), m = cn(g);
|
|
1596
1598
|
if (!g || !m) return !1;
|
|
1597
|
-
if (i.table =
|
|
1598
|
-
const t =
|
|
1599
|
+
if (i.table = zn(e, f), d) if ("extend" === r) {
|
|
1600
|
+
const t = cn(e.getElementByKey(d.origin.getKey()));
|
|
1599
1601
|
if (!t) return !1;
|
|
1600
1602
|
i.$setAnchorCellForSelection(m), i.$setFocusCellForSelection(t, !0);
|
|
1601
1603
|
} else {
|
|
@@ -1610,16 +1612,16 @@ function dn(e, t, o, r, l, s, i) {
|
|
|
1610
1612
|
}($getSiblingCaret(f, c.direction));
|
|
1611
1613
|
$setPointFromCaret(o.anchor, e), $setPointFromCaret(o.focus, e);
|
|
1612
1614
|
}
|
|
1613
|
-
return
|
|
1615
|
+
return Tn(t), !0;
|
|
1614
1616
|
}
|
|
1615
|
-
function
|
|
1617
|
+
function xn(e, t, o, r, l, s) {
|
|
1616
1618
|
if (("up" === o || "down" === o) && function(e) {
|
|
1617
1619
|
const t = e.getRootElement();
|
|
1618
1620
|
if (!t) return !1;
|
|
1619
1621
|
return t.hasAttribute("aria-controls") && "typeahead-menu" === t.getAttribute("aria-controls");
|
|
1620
1622
|
}(e)) return !1;
|
|
1621
1623
|
const i = $getSelection();
|
|
1622
|
-
if (!
|
|
1624
|
+
if (!_n(i, r)) {
|
|
1623
1625
|
if ($isRangeSelection(i)) {
|
|
1624
1626
|
if ("backward" === o) {
|
|
1625
1627
|
if (i.focus.offset > 0) return !1;
|
|
@@ -1632,13 +1634,13 @@ function fn(e, t, o, r, l, s) {
|
|
|
1632
1634
|
}(i.focus.getNode());
|
|
1633
1635
|
if (!e) return !1;
|
|
1634
1636
|
const n = e.getPreviousSibling();
|
|
1635
|
-
return !!
|
|
1637
|
+
return !!Bn(n) && (Tn(t), t.shiftKey ? i.focus.set(n.getParentOrThrow().getKey(), n.getIndexWithinParent(), "element") : n.selectEnd(), !0);
|
|
1636
1638
|
}
|
|
1637
1639
|
if (t.shiftKey && ("up" === o || "down" === o)) {
|
|
1638
1640
|
const e = i.focus.getNode();
|
|
1639
1641
|
if (!i.isCollapsed() && ("up" === o && !i.isBackward() || "down" === o && i.isBackward())) {
|
|
1640
|
-
let l = $findMatchingParent(e, (e) =>
|
|
1641
|
-
if (
|
|
1642
|
+
let l = $findMatchingParent(e, (e) => Bn(e));
|
|
1643
|
+
if (Ge(l) && (l = $findMatchingParent(l, Bn)), l !== r) return !1;
|
|
1642
1644
|
if (!l) return !1;
|
|
1643
1645
|
const s = "down" === o ? l.getNextSibling() : l.getPreviousSibling();
|
|
1644
1646
|
if (!s) return !1;
|
|
@@ -1647,15 +1649,15 @@ function fn(e, t, o, r, l, s) {
|
|
|
1647
1649
|
let a = s;
|
|
1648
1650
|
if ("up" === o && $isElementNode(s)) a = s.getLastChild() || s, c = $isTextNode(a) ? a.getTextContentSize() : 0;
|
|
1649
1651
|
const u = i.clone();
|
|
1650
|
-
return u.focus.set(a.getKey(), c, $isTextNode(a) ? "text" : "element"), $setSelection(u),
|
|
1652
|
+
return u.focus.set(a.getKey(), c, $isTextNode(a) ? "text" : "element"), $setSelection(u), Tn(t), !0;
|
|
1651
1653
|
}
|
|
1652
1654
|
if ($isRootOrShadowRoot(e)) {
|
|
1653
1655
|
const e = "up" === o ? i.getNodes()[i.getNodes().length - 1] : i.getNodes()[0];
|
|
1654
1656
|
if (e) {
|
|
1655
|
-
if (null !==
|
|
1657
|
+
if (null !== Qt(r, e)) {
|
|
1656
1658
|
const e = r.getFirstDescendant(), t = r.getLastDescendant();
|
|
1657
1659
|
if (!e || !t) return !1;
|
|
1658
|
-
const [n] =
|
|
1660
|
+
const [n] = Mt(e), [o] = Mt(t), s = r.getCordsFromCellNode(n, l.table), i = r.getCordsFromCellNode(o, l.table), c = r.getDOMCellFromCordsOrThrow(s.x, s.y, l.table), a = r.getDOMCellFromCordsOrThrow(i.x, i.y, l.table);
|
|
1659
1661
|
return l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(a, !0), !0;
|
|
1660
1662
|
}
|
|
1661
1663
|
}
|
|
@@ -1663,35 +1665,35 @@ function fn(e, t, o, r, l, s) {
|
|
|
1663
1665
|
}
|
|
1664
1666
|
{
|
|
1665
1667
|
let r = $findMatchingParent(e, (e) => $isElementNode(e) && !e.isInline());
|
|
1666
|
-
if (
|
|
1668
|
+
if (Ge(r) && (r = $findMatchingParent(r, Bn)), !r) return !1;
|
|
1667
1669
|
const s = "down" === o ? r.getNextSibling() : r.getPreviousSibling();
|
|
1668
|
-
if (
|
|
1670
|
+
if (Bn(s) && l.tableNodeKey === s.getKey()) {
|
|
1669
1671
|
const e = s.getFirstDescendant(), n = s.getLastDescendant();
|
|
1670
1672
|
if (!e || !n) return !1;
|
|
1671
|
-
const [r] =
|
|
1672
|
-
return c.focus.set(("up" === o ? r : l).getKey(), "up" === o ? 0 : l.getChildrenSize(), "element"),
|
|
1673
|
+
const [r] = Mt(e), [l] = Mt(n), c = i.clone();
|
|
1674
|
+
return c.focus.set(("up" === o ? r : l).getKey(), "up" === o ? 0 : l.getChildrenSize(), "element"), Tn(t), $setSelection(c), !0;
|
|
1673
1675
|
}
|
|
1674
1676
|
}
|
|
1675
1677
|
}
|
|
1676
1678
|
}
|
|
1677
|
-
return "down" === o &&
|
|
1679
|
+
return "down" === o && Mn(e) && s.setShouldCheckSelectionForTable(r.getKey()), !1;
|
|
1678
1680
|
}
|
|
1679
1681
|
if ($isRangeSelection(i)) {
|
|
1680
|
-
if ("backward" === o || "forward" === o) return
|
|
1682
|
+
if ("backward" === o || "forward" === o) return vn(e, t, i, t.shiftKey ? "extend" : "move", "backward" === o, r, l);
|
|
1681
1683
|
if (i.isCollapsed()) {
|
|
1682
|
-
const { anchor: c, focus: a } = i, u = $findMatchingParent(c.getNode(),
|
|
1683
|
-
if (!
|
|
1684
|
-
const d =
|
|
1684
|
+
const { anchor: c, focus: a } = i, u = $findMatchingParent(c.getNode(), Ge), h = $findMatchingParent(a.getNode(), Ge);
|
|
1685
|
+
if (!Ge(u) || !u.is(h)) return !1;
|
|
1686
|
+
const d = Nn(u);
|
|
1685
1687
|
if (d !== r && null != d) {
|
|
1686
|
-
const n =
|
|
1687
|
-
if (null != n) return l.table =
|
|
1688
|
+
const n = Vt(d, e.getElementByKey(d.getKey()));
|
|
1689
|
+
if (null != n) return l.table = un(d, n), xn(e, t, o, d, l, s);
|
|
1688
1690
|
}
|
|
1689
1691
|
const f = e.getElementByKey(u.__key), g = e.getElementByKey(c.key);
|
|
1690
1692
|
if (null == g || null == f) return !1;
|
|
1691
1693
|
let m;
|
|
1692
1694
|
if ("element" === c.type) m = g.getBoundingClientRect();
|
|
1693
1695
|
else {
|
|
1694
|
-
const t = getDOMSelection(
|
|
1696
|
+
const t = getDOMSelection(Gt(e));
|
|
1695
1697
|
if (null === t || 0 === t.rangeCount) return !1;
|
|
1696
1698
|
m = t.getRangeAt(0).getBoundingClientRect();
|
|
1697
1699
|
}
|
|
@@ -1701,9 +1703,9 @@ function fn(e, t, o, r, l, s) {
|
|
|
1701
1703
|
if (null == C) return !1;
|
|
1702
1704
|
const _ = C.getBoundingClientRect();
|
|
1703
1705
|
if ("up" === o ? _.top > m.top - m.height : m.bottom + m.height > _.bottom) {
|
|
1704
|
-
|
|
1706
|
+
Tn(t);
|
|
1705
1707
|
const e = r.getCordsFromCellNode(u, l.table);
|
|
1706
|
-
if (!t.shiftKey) return
|
|
1708
|
+
if (!t.shiftKey) return fn(l, r, e.x, e.y, o);
|
|
1707
1709
|
{
|
|
1708
1710
|
const t = r.getDOMCellFromCordsOrThrow(e.x, e.y, l.table);
|
|
1709
1711
|
l.$setAnchorCellForSelection(t), l.$setFocusCellForSelection(t, !0);
|
|
@@ -1711,50 +1713,52 @@ function fn(e, t, o, r, l, s) {
|
|
|
1711
1713
|
return !0;
|
|
1712
1714
|
}
|
|
1713
1715
|
}
|
|
1714
|
-
} else if (
|
|
1715
|
-
const { anchor: s, focus: c
|
|
1716
|
-
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1716
|
+
} else if (Pt(i)) {
|
|
1717
|
+
const { anchor: s, focus: c, tableKey: a } = i;
|
|
1718
|
+
if (a !== r.getKey()) return !1;
|
|
1719
|
+
const u = $findMatchingParent(s.getNode(), Ge), h = $findMatchingParent(c.getNode(), Ge), [d] = i.getNodes();
|
|
1720
|
+
Bn(d) || Ze(251);
|
|
1721
|
+
const f = Vt(d, e.getElementByKey(d.getKey()));
|
|
1722
|
+
if (!Ge(u) || !Ge(h) || !Bn(d) || null == f) return !1;
|
|
1719
1723
|
l.$updateTableTableSelection(i);
|
|
1720
|
-
const
|
|
1721
|
-
if (l.$setAnchorCellForSelection(
|
|
1722
|
-
const [e, t, n] =
|
|
1723
|
-
return
|
|
1724
|
+
const g = un(d, f), m = r.getCordsFromCellNode(u, g), p = r.getDOMCellFromCordsOrThrow(m.x, m.y, g);
|
|
1725
|
+
if (l.$setAnchorCellForSelection(p), Tn(t), t.shiftKey) {
|
|
1726
|
+
const [e, t, n] = Et(r, u, h);
|
|
1727
|
+
return Cn(l, e, t, n, o);
|
|
1724
1728
|
}
|
|
1725
|
-
return
|
|
1729
|
+
return h.selectEnd(), !0;
|
|
1726
1730
|
}
|
|
1727
1731
|
return !1;
|
|
1728
1732
|
}
|
|
1729
|
-
function
|
|
1733
|
+
function Tn(e) {
|
|
1730
1734
|
e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation();
|
|
1731
1735
|
}
|
|
1732
|
-
function
|
|
1736
|
+
function Fn(e, t, n) {
|
|
1733
1737
|
const o = $createParagraphNode();
|
|
1734
1738
|
"first" === e ? t.insertBefore(o) : t.insertAfter(o), o.append(...n || []), o.selectEnd();
|
|
1735
1739
|
}
|
|
1736
|
-
function
|
|
1740
|
+
function Rn(e, t, o) {
|
|
1737
1741
|
const r = o.getParent();
|
|
1738
1742
|
if (!r) return;
|
|
1739
|
-
const l = getDOMSelection(
|
|
1743
|
+
const l = getDOMSelection(Gt(e));
|
|
1740
1744
|
if (!l) return;
|
|
1741
|
-
const s = l.anchorNode, i = e.getElementByKey(r.getKey()), c =
|
|
1745
|
+
const s = l.anchorNode, i = e.getElementByKey(r.getKey()), c = Vt(o, e.getElementByKey(o.getKey()));
|
|
1742
1746
|
if (!s || !i || !c || !i.contains(s) || c.contains(s)) return;
|
|
1743
|
-
const a = $findMatchingParent(t.anchor.getNode(), (e) =>
|
|
1747
|
+
const a = $findMatchingParent(t.anchor.getNode(), (e) => Ge(e));
|
|
1744
1748
|
if (!a) return;
|
|
1745
|
-
const u = $findMatchingParent(a, (e) =>
|
|
1746
|
-
if (!
|
|
1747
|
-
const [h, d] =
|
|
1749
|
+
const u = $findMatchingParent(a, (e) => Bn(e));
|
|
1750
|
+
if (!Bn(u) || !u.is(o)) return;
|
|
1751
|
+
const [h, d] = Et(o, a, a), f = h[0][0], g = h[h.length - 1][h[0].length - 1], { startRow: m, startColumn: p } = d, C = m === f.startRow && p === f.startColumn, _ = m === g.startRow && p === g.startColumn;
|
|
1748
1752
|
return C ? "first" : _ ? "last" : void 0;
|
|
1749
1753
|
}
|
|
1750
|
-
function
|
|
1754
|
+
function On(e, t) {
|
|
1751
1755
|
const { tableNode: n } = e.$lookup(), o = n.getCordsFromCellNode(t, e.table);
|
|
1752
1756
|
return n.getDOMCellFromCordsOrThrow(o.x, o.y, e.table);
|
|
1753
1757
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return
|
|
1758
|
+
function An(e, t, n) {
|
|
1759
|
+
return Qt(e, $getNearestNodeFromDOMNode(t, n));
|
|
1756
1760
|
}
|
|
1757
|
-
function
|
|
1761
|
+
function Kn(e, t, n) {
|
|
1758
1762
|
const o = e.querySelector("colgroup");
|
|
1759
1763
|
if (!o) return;
|
|
1760
1764
|
const r = [];
|
|
@@ -1764,7 +1768,7 @@ function Sn(e, t, n) {
|
|
|
1764
1768
|
}
|
|
1765
1769
|
o.replaceChildren(...r);
|
|
1766
1770
|
}
|
|
1767
|
-
function
|
|
1771
|
+
function En(t, n, r) {
|
|
1768
1772
|
if (!n.theme.tableAlignment) return;
|
|
1769
1773
|
const l = [], s = [];
|
|
1770
1774
|
for (const e of ["center", "right"]) {
|
|
@@ -1773,14 +1777,14 @@ function wn(t, n, r) {
|
|
|
1773
1777
|
}
|
|
1774
1778
|
removeClassNamesFromElement(t, ...l), addClassNamesToElement(t, ...s);
|
|
1775
1779
|
}
|
|
1776
|
-
const
|
|
1777
|
-
function
|
|
1778
|
-
return
|
|
1780
|
+
const kn = /* @__PURE__ */ new WeakSet();
|
|
1781
|
+
function Mn(e = $getEditor()) {
|
|
1782
|
+
return kn.has(e);
|
|
1779
1783
|
}
|
|
1780
|
-
function
|
|
1781
|
-
t ?
|
|
1784
|
+
function $n(e, t) {
|
|
1785
|
+
t ? kn.add(e) : kn.delete(e);
|
|
1782
1786
|
}
|
|
1783
|
-
var
|
|
1787
|
+
var Wn = class Wn extends ElementNode {
|
|
1784
1788
|
__rowStriping;
|
|
1785
1789
|
__frozenColumnCount;
|
|
1786
1790
|
__frozenRowCount;
|
|
@@ -1796,19 +1800,19 @@ var vn = class vn extends ElementNode {
|
|
|
1796
1800
|
return t.__colWidths = e, t;
|
|
1797
1801
|
}
|
|
1798
1802
|
static clone(e) {
|
|
1799
|
-
return new
|
|
1803
|
+
return new Wn(e.__key);
|
|
1800
1804
|
}
|
|
1801
1805
|
afterCloneFrom(e) {
|
|
1802
1806
|
super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping, this.__frozenColumnCount = e.__frozenColumnCount, this.__frozenRowCount = e.__frozenRowCount;
|
|
1803
1807
|
}
|
|
1804
1808
|
static importDOM() {
|
|
1805
1809
|
return { table: (e) => ({
|
|
1806
|
-
conversion:
|
|
1810
|
+
conversion: Ln,
|
|
1807
1811
|
priority: 1
|
|
1808
1812
|
}) };
|
|
1809
1813
|
}
|
|
1810
1814
|
static importJSON(e) {
|
|
1811
|
-
return
|
|
1815
|
+
return Hn().updateFromJSON(e);
|
|
1812
1816
|
}
|
|
1813
1817
|
updateFromJSON(e) {
|
|
1814
1818
|
return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setFrozenColumns(e.frozenColumnCount || 0).setFrozenRows(e.frozenRowCount || 0).setColWidths(e.colWidths);
|
|
@@ -1829,14 +1833,14 @@ var vn = class vn extends ElementNode {
|
|
|
1829
1833
|
return "html" === n;
|
|
1830
1834
|
}
|
|
1831
1835
|
getDOMSlot(e) {
|
|
1832
|
-
const t =
|
|
1833
|
-
return
|
|
1836
|
+
const t = jt(e) ? e : e.querySelector("table");
|
|
1837
|
+
return jt(t) || Ze(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
|
|
1834
1838
|
}
|
|
1835
1839
|
createDOM(t, n) {
|
|
1836
1840
|
const o = document.createElement("table");
|
|
1837
1841
|
this.__style && setDOMStyleFromCSS(o.style, this.__style);
|
|
1838
1842
|
const r = document.createElement("colgroup");
|
|
1839
|
-
if (o.appendChild(r), setDOMUnmanaged(r), addClassNamesToElement(o, t.theme.table), this.updateTableElement(null, o, t),
|
|
1843
|
+
if (o.appendChild(r), setDOMUnmanaged(r), addClassNamesToElement(o, t.theme.table), this.updateTableElement(null, o, t), Mn(n)) {
|
|
1840
1844
|
const n = document.createElement("div"), r = t.theme.tableScrollableWrapper;
|
|
1841
1845
|
return r ? addClassNamesToElement(n, r) : n.style.overflowX = "auto", n.appendChild(o), this.updateTableWrapper(null, n, o, t), n;
|
|
1842
1846
|
}
|
|
@@ -1854,25 +1858,25 @@ var vn = class vn extends ElementNode {
|
|
|
1854
1858
|
r ? (addClassNamesToElement(t, n.theme.tableRowStriping), t.setAttribute("data-lexical-row-striping", "true")) : (removeClassNamesFromElement(t, n.theme.tableRowStriping), t.removeAttribute("data-lexical-row-striping"));
|
|
1855
1859
|
}(n, r, this.__rowStriping);
|
|
1856
1860
|
const l = t ? t.getColumnCount() : 0, s = t ? t.__colWidths : void 0;
|
|
1857
|
-
this.getColumnCount() === l && this.getColWidths() === s ||
|
|
1861
|
+
this.getColumnCount() === l && this.getColWidths() === s || Kn(n, this.getColumnCount(), this.getColWidths()), En(n, r, this.getFormatType());
|
|
1858
1862
|
}
|
|
1859
1863
|
updateDOM(e, t, n) {
|
|
1860
|
-
const o =
|
|
1861
|
-
return t === o ===
|
|
1864
|
+
const o = Vt(this, t);
|
|
1865
|
+
return t === o === Mn() || (isHTMLElement$1(r = t) && "DIV" === r.nodeName && this.updateTableWrapper(e, t, o, n), this.updateTableElement(e, o, n), !1);
|
|
1862
1866
|
var r;
|
|
1863
1867
|
}
|
|
1864
1868
|
scaleDOMColWidths(e, t) {
|
|
1865
1869
|
const n = this.getColWidths();
|
|
1866
1870
|
if (!n) return;
|
|
1867
|
-
|
|
1871
|
+
Kn(Vt(this, e), this.getColumnCount(), n.map((e) => e * t));
|
|
1868
1872
|
}
|
|
1869
1873
|
exportDOM(e) {
|
|
1870
1874
|
const t = super.exportDOM(e), { element: n } = t;
|
|
1871
1875
|
return {
|
|
1872
1876
|
after: (n) => {
|
|
1873
|
-
if (t.after && (n = t.after(n)), !
|
|
1874
|
-
|
|
1875
|
-
const [o] =
|
|
1877
|
+
if (t.after && (n = t.after(n)), !jt(n) && isHTMLElement$1(n) && (n = n.querySelector("table")), !jt(n)) return null;
|
|
1878
|
+
En(n, e._config, this.getFormatType());
|
|
1879
|
+
const [o] = kt(this, null, null), r = /* @__PURE__ */ new Map();
|
|
1876
1880
|
for (const e of o) for (const t of e) {
|
|
1877
1881
|
const e = t.cell.getKey();
|
|
1878
1882
|
r.has(e) || r.set(e, {
|
|
@@ -1904,7 +1908,7 @@ var vn = class vn extends ElementNode {
|
|
|
1904
1908
|
}
|
|
1905
1909
|
return n;
|
|
1906
1910
|
},
|
|
1907
|
-
element: !
|
|
1911
|
+
element: !jt(n) && isHTMLElement$1(n) ? n.querySelector("table") : n
|
|
1908
1912
|
};
|
|
1909
1913
|
}
|
|
1910
1914
|
canBeEmpty() {
|
|
@@ -1920,7 +1924,7 @@ var vn = class vn extends ElementNode {
|
|
|
1920
1924
|
if (null != n) for (let o = 0; o < n.length; o++) {
|
|
1921
1925
|
const r = n[o];
|
|
1922
1926
|
if (null == r) continue;
|
|
1923
|
-
const { elem: l } = r, s =
|
|
1927
|
+
const { elem: l } = r, s = An(this, l);
|
|
1924
1928
|
if (null !== s && e.is(s)) return {
|
|
1925
1929
|
x: o,
|
|
1926
1930
|
y: t
|
|
@@ -1944,7 +1948,7 @@ var vn = class vn extends ElementNode {
|
|
|
1944
1948
|
const o = this.getDOMCellFromCords(e, t, n);
|
|
1945
1949
|
if (null == o) return null;
|
|
1946
1950
|
const r = $getNearestNodeFromDOMNode(o.elem);
|
|
1947
|
-
return
|
|
1951
|
+
return Ge(r) ? r : null;
|
|
1948
1952
|
}
|
|
1949
1953
|
getCellNodeFromCordsOrThrow(e, t, n) {
|
|
1950
1954
|
const o = this.getCellNodeFromCords(e, t, n);
|
|
@@ -1983,23 +1987,23 @@ var vn = class vn extends ElementNode {
|
|
|
1983
1987
|
if (!e) return 0;
|
|
1984
1988
|
let t = 0;
|
|
1985
1989
|
return e.getChildren().forEach((e) => {
|
|
1986
|
-
|
|
1990
|
+
Ge(e) && (t += e.getColSpan());
|
|
1987
1991
|
}), t;
|
|
1988
1992
|
}
|
|
1989
1993
|
};
|
|
1990
|
-
function
|
|
1994
|
+
function zn(e, t) {
|
|
1991
1995
|
const n = e.getElementByKey(t.getKey());
|
|
1992
|
-
return null === n &&
|
|
1996
|
+
return null === n && Ze(230), un(t, n);
|
|
1993
1997
|
}
|
|
1994
|
-
function
|
|
1995
|
-
const n =
|
|
1998
|
+
function Ln(e) {
|
|
1999
|
+
const n = Hn();
|
|
1996
2000
|
e.hasAttribute("data-lexical-row-striping") && n.setRowStriping(!0), e.hasAttribute("data-lexical-frozen-column") && n.setFrozenColumns(1), e.hasAttribute("data-lexical-frozen-row") && n.setFrozenRows(1);
|
|
1997
2001
|
const o = e.querySelector(":scope > colgroup");
|
|
1998
2002
|
if (o) {
|
|
1999
2003
|
let e = [];
|
|
2000
2004
|
for (const t of o.querySelectorAll(":scope > col")) {
|
|
2001
2005
|
let n = t.style.width || "";
|
|
2002
|
-
if (!
|
|
2006
|
+
if (!Je.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
|
|
2003
2007
|
e = void 0;
|
|
2004
2008
|
break;
|
|
2005
2009
|
}
|
|
@@ -2008,32 +2012,32 @@ function Tn(e) {
|
|
|
2008
2012
|
e && n.setColWidths(e);
|
|
2009
2013
|
}
|
|
2010
2014
|
return {
|
|
2011
|
-
after: (e) => $descendantsMatching(e,
|
|
2015
|
+
after: (e) => $descendantsMatching(e, ot),
|
|
2012
2016
|
node: n
|
|
2013
2017
|
};
|
|
2014
2018
|
}
|
|
2015
|
-
function
|
|
2016
|
-
return $applyNodeReplacement(new
|
|
2019
|
+
function Hn() {
|
|
2020
|
+
return $applyNodeReplacement(new Wn());
|
|
2017
2021
|
}
|
|
2018
|
-
function
|
|
2019
|
-
return e instanceof
|
|
2022
|
+
function Bn(e) {
|
|
2023
|
+
return e instanceof Wn;
|
|
2020
2024
|
}
|
|
2021
|
-
function
|
|
2022
|
-
|
|
2025
|
+
function Pn(e) {
|
|
2026
|
+
ot(e.getParent()) ? e.isEmpty() && e.append($createParagraphNode()) : e.remove();
|
|
2023
2027
|
}
|
|
2024
|
-
function
|
|
2025
|
-
|
|
2028
|
+
function Dn(e) {
|
|
2029
|
+
Bn(e.getParent()) ? $unwrapAndFilterDescendants(e, Ge) : e.remove();
|
|
2026
2030
|
}
|
|
2027
|
-
function
|
|
2028
|
-
$unwrapAndFilterDescendants(e,
|
|
2029
|
-
const [t] =
|
|
2031
|
+
function In(e) {
|
|
2032
|
+
$unwrapAndFilterDescendants(e, ot);
|
|
2033
|
+
const [t] = kt(e, null, null), n = t.reduce((e, t) => Math.max(e, t.length), 0), o = e.getChildren();
|
|
2030
2034
|
for (let e = 0; e < t.length; ++e) {
|
|
2031
2035
|
const r = o[e];
|
|
2032
2036
|
if (!r) continue;
|
|
2033
|
-
|
|
2037
|
+
ot(r) || Ze(254, r.constructor.name, r.getType());
|
|
2034
2038
|
const l = t[e].reduce((e, t) => t ? 1 + e : e, 0);
|
|
2035
2039
|
if (l !== n) for (let e = l; e < n; ++e) {
|
|
2036
|
-
const e =
|
|
2040
|
+
const e = Ve();
|
|
2037
2041
|
e.append($createParagraphNode()), r.append(e);
|
|
2038
2042
|
}
|
|
2039
2043
|
}
|
|
@@ -2048,45 +2052,45 @@ function An(e) {
|
|
|
2048
2052
|
e.setColWidths(t);
|
|
2049
2053
|
}
|
|
2050
2054
|
}
|
|
2051
|
-
function
|
|
2055
|
+
function Un(e) {
|
|
2052
2056
|
if (e.detail < 3 || !isDOMNode(e.target)) return !1;
|
|
2053
2057
|
const t = $getNearestNodeFromDOMNode(e.target);
|
|
2054
2058
|
if (null === t) return !1;
|
|
2055
2059
|
const o = $findMatchingParent(t, (e) => $isElementNode(e) && !e.isInline());
|
|
2056
2060
|
if (null === o) return !1;
|
|
2057
|
-
return !!
|
|
2061
|
+
return !!Ge(o.getParent()) && (o.select(0), !0);
|
|
2058
2062
|
}
|
|
2059
|
-
function
|
|
2063
|
+
function Jn() {
|
|
2060
2064
|
const e = $getSelection();
|
|
2061
2065
|
if (!$isRangeSelection(e)) return !1;
|
|
2062
|
-
const t =
|
|
2066
|
+
const t = Nn(e.anchor.getNode());
|
|
2063
2067
|
if (null === t) return !1;
|
|
2064
2068
|
const n = $getRoot();
|
|
2065
2069
|
if (!n.is(t.getParent()) || 1 !== n.getChildrenSize()) return !1;
|
|
2066
|
-
const [o] =
|
|
2070
|
+
const [o] = kt(t, null, null);
|
|
2067
2071
|
if (0 === o.length || 0 === o[0].length) return !1;
|
|
2068
2072
|
const r = o[0][0];
|
|
2069
2073
|
if (!r || !r.cell) return !1;
|
|
2070
2074
|
const l = o[o.length - 1], s = l[l.length - 1];
|
|
2071
2075
|
if (!s || !s.cell) return !1;
|
|
2072
|
-
return $setSelection(
|
|
2076
|
+
return $setSelection(It(t, r.cell, s.cell)), !0;
|
|
2073
2077
|
}
|
|
2074
|
-
function
|
|
2075
|
-
return e.registerNodeTransform(
|
|
2078
|
+
function Xn(e) {
|
|
2079
|
+
return e.registerNodeTransform(Ye, (e) => {
|
|
2076
2080
|
if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
|
|
2077
|
-
const [, , t] =
|
|
2081
|
+
const [, , t] = Mt(e), [n] = Et(t, e, e), o = n.length, r = n[0].length;
|
|
2078
2082
|
let l = t.getFirstChild();
|
|
2079
|
-
|
|
2083
|
+
ot(l) || Ze(175);
|
|
2080
2084
|
const i = [];
|
|
2081
2085
|
for (let e = 0; e < o; e++) {
|
|
2082
|
-
0 !== e && (l = l.getNextSibling(),
|
|
2086
|
+
0 !== e && (l = l.getNextSibling(), ot(l) || Ze(175));
|
|
2083
2087
|
let t = null;
|
|
2084
2088
|
for (let o = 0; o < r; o++) {
|
|
2085
2089
|
const r = n[e][o], c = r.cell;
|
|
2086
2090
|
if (r.startRow === e && r.startColumn === o) t = c, i.push(c);
|
|
2087
2091
|
else if (c.getColSpan() > 1 || c.getRowSpan() > 1) {
|
|
2088
|
-
|
|
2089
|
-
const e =
|
|
2092
|
+
Ge(c) || Ze(176);
|
|
2093
|
+
const e = Ve(c.__headerState);
|
|
2090
2094
|
null !== t ? t.insertAfter(e) : $insertFirst(l, e);
|
|
2091
2095
|
}
|
|
2092
2096
|
}
|
|
@@ -2095,17 +2099,17 @@ function Mn(e) {
|
|
|
2095
2099
|
}
|
|
2096
2100
|
});
|
|
2097
2101
|
}
|
|
2098
|
-
function
|
|
2099
|
-
const n = new
|
|
2100
|
-
const s =
|
|
2102
|
+
function Yn(e, t = !0) {
|
|
2103
|
+
const n = new Xt(), o = (o, r, l) => {
|
|
2104
|
+
const s = Vt(o, l), i = on(o, s, e, t, n);
|
|
2101
2105
|
n.observers.set(r, [i, s]);
|
|
2102
2106
|
};
|
|
2103
|
-
return mergeRegister(
|
|
2107
|
+
return mergeRegister(nn(e, n), e.registerCommand(SELECTION_CHANGE_COMMAND, () => rn(n, e), COMMAND_PRIORITY_HIGH), e.registerMutationListener(Wn, (t) => {
|
|
2104
2108
|
e.getEditorState().read(() => {
|
|
2105
2109
|
for (const [e, r] of t) {
|
|
2106
2110
|
const t = n.observers.get(e);
|
|
2107
2111
|
if ("created" === r || "updated" === r) {
|
|
2108
|
-
const { tableNode: r, tableElement: l } =
|
|
2112
|
+
const { tableNode: r, tableElement: l } = Jt(e);
|
|
2109
2113
|
void 0 === t ? o(r, e, l) : l !== t[1] && (t[0].removeListeners(), n.observers.delete(e), o(r, e, l));
|
|
2110
2114
|
} else "destroyed" === r && void 0 !== t && (t[0].removeListeners(), n.observers.delete(e));
|
|
2111
2115
|
}
|
|
@@ -2114,56 +2118,56 @@ function $n(e, t = !0) {
|
|
|
2114
2118
|
for (const [, [e]] of n.observers) e.removeListeners();
|
|
2115
2119
|
});
|
|
2116
2120
|
}
|
|
2117
|
-
function
|
|
2118
|
-
e.hasNodes([
|
|
2121
|
+
function qn(e, t) {
|
|
2122
|
+
e.hasNodes([Wn]) || Ze(255);
|
|
2119
2123
|
const { hasNestedTables: o = signal(!1) } = t ?? {};
|
|
2120
|
-
return mergeRegister(e.registerCommand(
|
|
2124
|
+
return mergeRegister(e.registerCommand(Qe, (e) => function({ rows: e, columns: t, includeHeaders: n }, o) {
|
|
2121
2125
|
const r = $getSelection() || $getPreviousSelection();
|
|
2122
2126
|
if (!r || !$isRangeSelection(r)) return !1;
|
|
2123
|
-
if (!o &&
|
|
2124
|
-
const l =
|
|
2127
|
+
if (!o && Nn(r.anchor.getNode())) return !1;
|
|
2128
|
+
const l = rt(Number(e), Number(t), n);
|
|
2125
2129
|
$insertNodeToNearestRoot(l);
|
|
2126
2130
|
const s = l.getFirstDescendant();
|
|
2127
2131
|
return $isTextNode(s) && s.select(), !0;
|
|
2128
2132
|
}(e, o.peek()), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, (t, r) => e === r && function(e, t) {
|
|
2129
2133
|
const { nodes: o, selection: r } = e;
|
|
2130
|
-
if (!o.some((e) =>
|
|
2131
|
-
const l =
|
|
2132
|
-
if (!(s && null !== $findMatchingParent(r.anchor.getNode(), (e) =>
|
|
2133
|
-
if (1 === o.length &&
|
|
2134
|
-
const o = t.getStartEndPoints(), r =
|
|
2134
|
+
if (!o.some((e) => Bn(e) || $dfs(e).some((e) => Bn(e.node)))) return !1;
|
|
2135
|
+
const l = Pt(r), s = $isRangeSelection(r);
|
|
2136
|
+
if (!(s && null !== $findMatchingParent(r.anchor.getNode(), (e) => Ge(e)) && null !== $findMatchingParent(r.focus.getNode(), (e) => Ge(e)) || l)) return !1;
|
|
2137
|
+
if (1 === o.length && Bn(o[0])) return function(e, t) {
|
|
2138
|
+
const o = t.getStartEndPoints(), r = Pt(t);
|
|
2135
2139
|
if (null === o) return !1;
|
|
2136
|
-
const [l, s] = o, [i, c, a] =
|
|
2137
|
-
if (!(
|
|
2138
|
-
const [h, d, f] =
|
|
2139
|
-
let S = d.startRow,
|
|
2140
|
+
const [l, s] = o, [i, c, a] = Mt(l), u = $findMatchingParent(s.getNode(), (e) => Ge(e));
|
|
2141
|
+
if (!(Ge(i) && Ge(u) && ot(c) && Bn(a))) return !1;
|
|
2142
|
+
const [h, d, f] = Et(a, i, u), [m] = kt(e, null, null), C = h.length, _ = C > 0 ? h[0].length : 0;
|
|
2143
|
+
let S = d.startRow, b = d.startColumn, w = m.length, y = w > 0 ? m[0].length : 0;
|
|
2140
2144
|
if (r) {
|
|
2141
|
-
const e =
|
|
2142
|
-
S = e.minRow,
|
|
2145
|
+
const e = $t(h, d, f), t = e.maxRow - e.minRow + 1, n = e.maxColumn - e.minColumn + 1;
|
|
2146
|
+
S = e.minRow, b = e.minColumn, w = Math.min(w, t), y = Math.min(y, n);
|
|
2143
2147
|
}
|
|
2144
2148
|
let N = !1;
|
|
2145
|
-
const v = Math.min(C, S +
|
|
2146
|
-
for (let e = S; e <= v; e++) for (let t =
|
|
2149
|
+
const v = Math.min(C, S + w) - 1, x = Math.min(_, b + y) - 1, T = /* @__PURE__ */ new Set();
|
|
2150
|
+
for (let e = S; e <= v; e++) for (let t = b; t <= x; t++) {
|
|
2147
2151
|
const n = h[e][t];
|
|
2148
|
-
T.has(n.cell.getKey()) || 1 === n.cell.__rowSpan && 1 === n.cell.__colSpan || (
|
|
2152
|
+
T.has(n.cell.getKey()) || 1 === n.cell.__rowSpan && 1 === n.cell.__colSpan || (Kt(n.cell), T.add(n.cell.getKey()), N = !0);
|
|
2149
2153
|
}
|
|
2150
|
-
let [F] =
|
|
2151
|
-
const R =
|
|
2152
|
-
for (let e = 0; e < R; e++)
|
|
2153
|
-
const O = y - _ +
|
|
2154
|
-
for (let e = 0; e < O; e++)
|
|
2155
|
-
[F] =
|
|
2156
|
-
for (let e = S; e < S +
|
|
2157
|
-
const n = e - S, o = t -
|
|
2154
|
+
let [F] = kt(a.getWritable(), null, null);
|
|
2155
|
+
const R = w - C + S;
|
|
2156
|
+
for (let e = 0; e < R; e++) pt(F[C - 1][0].cell);
|
|
2157
|
+
const O = y - _ + b;
|
|
2158
|
+
for (let e = 0; e < O; e++) bt(F[0][_ - 1].cell, !0, !1);
|
|
2159
|
+
[F] = kt(a.getWritable(), null, null);
|
|
2160
|
+
for (let e = S; e < S + w; e++) for (let t = b; t < b + y; t++) {
|
|
2161
|
+
const n = e - S, o = t - b, r = m[n][o];
|
|
2158
2162
|
if (r.startRow !== n || r.startColumn !== o) continue;
|
|
2159
2163
|
const l = r.cell;
|
|
2160
2164
|
if (1 !== l.__rowSpan || 1 !== l.__colSpan) {
|
|
2161
|
-
const n = [], o = Math.min(e + l.__rowSpan, S +
|
|
2165
|
+
const n = [], o = Math.min(e + l.__rowSpan, S + w) - 1, r = Math.min(t + l.__colSpan, b + y) - 1;
|
|
2162
2166
|
for (let l = e; l <= o; l++) for (let e = t; e <= r; e++) {
|
|
2163
2167
|
const t = F[l][e];
|
|
2164
2168
|
n.push(t.cell);
|
|
2165
2169
|
}
|
|
2166
|
-
|
|
2170
|
+
Rt(n), N = !0;
|
|
2167
2171
|
}
|
|
2168
2172
|
const { cell: s } = F[e][t], i = l.getBackgroundColor();
|
|
2169
2173
|
null != i && s.setBackgroundColor(i);
|
|
@@ -2174,20 +2178,20 @@ function Wn(e, t) {
|
|
|
2174
2178
|
}), c.forEach((e) => e.remove());
|
|
2175
2179
|
}
|
|
2176
2180
|
if (r && N) {
|
|
2177
|
-
const [e] =
|
|
2181
|
+
const [e] = kt(a.getWritable(), null, null);
|
|
2178
2182
|
e[d.startRow][d.startColumn].cell.selectEnd();
|
|
2179
2183
|
}
|
|
2180
2184
|
return !0;
|
|
2181
2185
|
}(o[0], r);
|
|
2182
2186
|
if (s && t.peek() && !function(e) {
|
|
2183
|
-
if (
|
|
2184
|
-
if ($isRangeSelection(e) &&
|
|
2187
|
+
if (Pt(e) && !e.focus.getNode().is(e.anchor.getNode())) return !0;
|
|
2188
|
+
if ($isRangeSelection(e) && Ge(e.anchor.getNode()) && !e.anchor.getNode().is(e.focus.getNode())) return !0;
|
|
2185
2189
|
return !1;
|
|
2186
2190
|
}(r)) return !1;
|
|
2187
2191
|
return !0;
|
|
2188
|
-
}(t, o), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECT_ALL_COMMAND,
|
|
2192
|
+
}(t, o), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECT_ALL_COMMAND, Jn, COMMAND_PRIORITY_LOW), e.registerCommand(CLICK_COMMAND, Un, COMMAND_PRIORITY_EDITOR), e.registerNodeTransform(Wn, In), e.registerNodeTransform(et, Dn), e.registerNodeTransform(Ye, Pn));
|
|
2189
2193
|
}
|
|
2190
|
-
const
|
|
2194
|
+
const jn = defineExtension({
|
|
2191
2195
|
build: (e, t, n) => namedSignals(t),
|
|
2192
2196
|
config: safeCast({
|
|
2193
2197
|
hasCellBackgroundColor: !0,
|
|
@@ -2198,19 +2202,110 @@ const zn = defineExtension({
|
|
|
2198
2202
|
}),
|
|
2199
2203
|
name: "@lexical/table/Table",
|
|
2200
2204
|
nodes: () => [
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2205
|
+
Wn,
|
|
2206
|
+
et,
|
|
2207
|
+
Ye
|
|
2204
2208
|
],
|
|
2205
2209
|
register(e, t, n) {
|
|
2206
2210
|
const o = n.getOutput();
|
|
2207
2211
|
return mergeRegister(effect(() => {
|
|
2208
2212
|
const t = o.hasHorizontalScroll.value;
|
|
2209
|
-
|
|
2210
|
-
}),
|
|
2213
|
+
Mn(e) !== t && ($n(e, t), e.update($fullReconcile));
|
|
2214
|
+
}), qn(e, o), effect(() => Yn(e, o.hasTabHandler.value)), effect(() => o.hasCellMerge.value ? void 0 : Xn(e)), effect(() => o.hasCellBackgroundColor.value ? void 0 : e.registerNodeTransform(Ye, (e) => {
|
|
2211
2215
|
null !== e.getBackgroundColor() && e.setBackgroundColor(null);
|
|
2212
2216
|
})));
|
|
2213
2217
|
}
|
|
2214
2218
|
});
|
|
2219
|
+
function Vn(e) {
|
|
2220
|
+
const t = [];
|
|
2221
|
+
let n = null;
|
|
2222
|
+
const o = () => {
|
|
2223
|
+
if (null !== n) {
|
|
2224
|
+
const e = n.getFirstChild();
|
|
2225
|
+
$isLineBreakNode(e) && 1 === n.getChildrenSize() && e.remove();
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
for (const r of e) $isInlineElementOrDecoratorNode(r) || $isTextNode(r) || $isLineBreakNode(r) ? null !== n ? n.append(r) : (n = $createParagraphNode().append(r), t.push(n)) : (o(), t.push(r), n = null);
|
|
2229
|
+
return o(), 0 === t.length && t.push($createParagraphNode()), t;
|
|
2230
|
+
}
|
|
2231
|
+
const Gn = {
|
|
2232
|
+
$accepts: ot,
|
|
2233
|
+
$packageRun: (e) => e.every(Ge) ? [nt().splice(0, 0, e)] : [],
|
|
2234
|
+
name: "TableSchema"
|
|
2235
|
+
}, Qn = {
|
|
2236
|
+
$accepts: Ge,
|
|
2237
|
+
name: "TableRowSchema"
|
|
2238
|
+
}, Zn = [
|
|
2239
|
+
defineImportRule({
|
|
2240
|
+
$import: (e, n) => {
|
|
2241
|
+
const o = Hn();
|
|
2242
|
+
n.hasAttribute("data-lexical-row-striping") && o.setRowStriping(!0), n.hasAttribute("data-lexical-frozen-column") && o.setFrozenColumns(1), n.hasAttribute("data-lexical-frozen-row") && o.setFrozenRows(1);
|
|
2243
|
+
const r = n.querySelector(":scope > colgroup");
|
|
2244
|
+
if (r) {
|
|
2245
|
+
let e = [];
|
|
2246
|
+
for (const t of r.querySelectorAll(":scope > col")) {
|
|
2247
|
+
let n = t.style.width || "";
|
|
2248
|
+
if (!Je.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
|
|
2249
|
+
e = void 0;
|
|
2250
|
+
break;
|
|
2251
|
+
}
|
|
2252
|
+
e.push(parseFloat(n));
|
|
2253
|
+
}
|
|
2254
|
+
e && o.setColWidths(e);
|
|
2255
|
+
}
|
|
2256
|
+
return [o.splice(0, 0, $descendantsMatching(e.$importChildren(n), ot))];
|
|
2257
|
+
},
|
|
2258
|
+
match: sel.tag("table"),
|
|
2259
|
+
name: "@lexical/table/table"
|
|
2260
|
+
}),
|
|
2261
|
+
defineImportRule({
|
|
2262
|
+
$import: (e, n) => [nt(Je.test(n.style.height) ? parseFloat(n.style.height) : void 0).splice(0, 0, $descendantsMatching(e.$importChildren(n), Ge))],
|
|
2263
|
+
match: sel.tag("tr"),
|
|
2264
|
+
name: "@lexical/table/tr"
|
|
2265
|
+
}),
|
|
2266
|
+
defineImportRule({
|
|
2267
|
+
$import: (e, t) => {
|
|
2268
|
+
const n = "TH" === t.nodeName, o = Je.test(t.style.width) ? parseFloat(t.style.width) : void 0;
|
|
2269
|
+
let r = Xe.NO_STATUS;
|
|
2270
|
+
if (n) {
|
|
2271
|
+
const e = t.getAttribute("scope");
|
|
2272
|
+
if ("col" === e) r = Xe.COLUMN;
|
|
2273
|
+
else if ("row" === e) r = Xe.ROW;
|
|
2274
|
+
else {
|
|
2275
|
+
const e = t.parentElement, n = isHTMLTableRowElement(e) && (e.parentElement && "THEAD" === e.parentElement.nodeName || 0 === e.rowIndex), o = 0 === t.cellIndex;
|
|
2276
|
+
n && (r |= Xe.ROW), o && (r |= Xe.COLUMN), r === Xe.NO_STATUS && (r = Xe.ROW);
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
const l = Ve(r, t.colSpan, o);
|
|
2280
|
+
l.__rowSpan = t.rowSpan;
|
|
2281
|
+
const s = t.style.backgroundColor;
|
|
2282
|
+
"" !== s && (l.__backgroundColor = s);
|
|
2283
|
+
const i = t.style.verticalAlign;
|
|
2284
|
+
(function(e) {
|
|
2285
|
+
return "middle" === e || "bottom" === e;
|
|
2286
|
+
})(i) && (l.__verticalAlign = i);
|
|
2287
|
+
const c = e.get(ImportTextFormat), a = c | function(e) {
|
|
2288
|
+
let t = 0;
|
|
2289
|
+
const n = e.fontWeight;
|
|
2290
|
+
"700" !== n && "bold" !== n || (t |= IS_BOLD), "italic" === e.fontStyle && (t |= IS_ITALIC);
|
|
2291
|
+
const o = (e.textDecoration || "").split(" ");
|
|
2292
|
+
return o.includes("underline") && (t |= IS_UNDERLINE), o.includes("line-through") && (t |= IS_STRIKETHROUGH), t;
|
|
2293
|
+
}(t.style), u = e.get(ImportTextStyle), h = t.style.color, d = h ? {
|
|
2294
|
+
...u,
|
|
2295
|
+
color: h
|
|
2296
|
+
} : u, f = [];
|
|
2297
|
+
return a !== c && f.push(contextValue(ImportTextFormat, a)), d !== u && f.push(contextValue(ImportTextStyle, d)), [l.splice(0, 0, Vn(e.$importChildren(t, { context: f })))];
|
|
2298
|
+
},
|
|
2299
|
+
match: sel.tag("td", "th"),
|
|
2300
|
+
name: "@lexical/table/cell"
|
|
2301
|
+
})
|
|
2302
|
+
], eo = defineExtension({
|
|
2303
|
+
dependencies: [
|
|
2304
|
+
CoreImportExtension,
|
|
2305
|
+
jn,
|
|
2306
|
+
configExtension(DOMImportExtension, { rules: Zn })
|
|
2307
|
+
],
|
|
2308
|
+
name: "@lexical/table/Import"
|
|
2309
|
+
});
|
|
2215
2310
|
//#endregion
|
|
2216
|
-
export {
|
|
2311
|
+
export { Et as $computeTableMap, kt as $computeTableMapSkipCellCheck, Ve as $createTableCellNode, Hn as $createTableNode, rt as $createTableNodeWithDimensions, nt as $createTableRowNode, Dt as $createTableSelection, It as $createTableSelectionFrom, wt as $deleteTableColumn, vt as $deleteTableColumnAtSelection, xt as $deleteTableColumn__EXPERIMENTAL, yt as $deleteTableRowAtSelection, Nt as $deleteTableRow__EXPERIMENTAL, yn as $findCellNode, Nn as $findTableNode, zn as $getElementForTableNode, Mt as $getNodeTriplet, Jt as $getTableAndElementByKey, lt as $getTableCellNodeFromLexicalNode, Lt as $getTableCellNodeRect, at as $getTableColumnIndexFromTableCellNode, it as $getTableNodeFromLexicalNodeOrThrow, ct as $getTableRowIndexFromTableCellNode, st as $getTableRowNodeFromTableCellNodeOrThrow, Ct as $insertTableColumn, _t as $insertTableColumnAtSelection, St as $insertTableColumn__EXPERIMENTAL, dt as $insertTableRow, gt as $insertTableRowAtSelection, mt as $insertTableRow__EXPERIMENTAL, Mn as $isScrollableTablesActive, Wt as $isSimpleTable, Ge as $isTableCellNode, Bn as $isTableNode, ot as $isTableRowNode, Pt as $isTableSelection, Rt as $mergeCells, zt as $moveTableColumn, ht as $removeTableRowAtIndex, At as $unmergeCell, Qe as INSERT_TABLE_COMMAND, Xe as TableCellHeaderStates, Ye as TableCellNode, jn as TableExtension, eo as TableImportExtension, Zn as TableImportRules, Wn as TableNode, Yt as TableObserver, et as TableRowNode, Qn as TableRowSchema, Gn as TableSchema, on as applyTableHandlers, cn as getDOMCellFromTarget, Vt as getTableElement, sn as getTableObserverFromTableElement, Xn as registerTableCellUnmergeTransform, qn as registerTablePlugin, Yn as registerTableSelectionObserver, $n as setScrollableTablesActive };
|