@mx-space/cli 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +33 -0
- package/README.md +35 -11
- package/dist/{Lexical.dev-CtGmYDoh.mjs → Lexical.dev-Cck4n26y.mjs} +240 -325
- package/dist/{Lexical.node-8sRFmq2X.mjs → Lexical.node-D6wf2D5M.mjs} +2 -2
- package/dist/{Lexical.prod-D-VfeKDz.mjs → Lexical.prod-DCwS1oTq.mjs} +1753 -1783
- package/dist/{LexicalClipboard.dev-CzQ15z6E.mjs → LexicalClipboard.dev-CMkPHV7O.mjs} +6 -6
- package/dist/{LexicalClipboard.node-D4gMGws6.mjs → LexicalClipboard.node-m4nZ7IYw.mjs} +2 -2
- package/dist/{LexicalClipboard.prod-CltkQpzS.mjs → LexicalClipboard.prod-B_rN1vE1.mjs} +6 -6
- package/dist/{LexicalCodeCore.dev-DkYBZRGB.mjs → LexicalCodeCore.dev-DyJw3i8V.mjs} +56 -68
- package/dist/{LexicalCodeCore.prod-COc3_QL8.mjs → LexicalCodeCore.prod-DPXLHQLF.mjs} +144 -156
- package/dist/{LexicalDragon.dev-Dv5_WUae.mjs → LexicalDragon.dev-ZkNfMwrE.mjs} +3 -3
- package/dist/{LexicalDragon.node-DgjrmWkd.mjs → LexicalDragon.node-Ds9oLUFh.mjs} +2 -2
- package/dist/{LexicalDragon.prod-DnpbDe-_.mjs → LexicalDragon.prod-B58ic2av.mjs} +3 -3
- package/dist/{LexicalExtension.dev-JMH_6-OZ.mjs → LexicalExtension.dev-DvwHs1Xv.mjs} +10 -19
- package/dist/{LexicalExtension.node-BUozzx4t.mjs → LexicalExtension.node-5OymZQfy.mjs} +2 -2
- package/dist/{LexicalExtension.prod-UiyDgmou.mjs → LexicalExtension.prod-Ce0T5smQ.mjs} +73 -82
- package/dist/{LexicalHeadless.dev-BfLGciiX.mjs → LexicalHeadless.dev-DA0WldSR.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-CWF7edmQ.mjs → LexicalHeadless.prod-1kQgKB6c.mjs} +2 -2
- package/dist/{LexicalHtml.dev-D5EF5PGW.mjs → LexicalHtml.dev-BDB7CUrx.mjs} +6 -6
- package/dist/{LexicalHtml.node-BYbzHNVe.mjs → LexicalHtml.node-DpVNt7It.mjs} +2 -2
- package/dist/{LexicalHtml.prod-D_FfkvVD.mjs → LexicalHtml.prod-HkxM5scw.mjs} +6 -6
- package/dist/{LexicalLink.dev-D3Pgh6ik.mjs → LexicalLink.dev-C5zNJlrm.mjs} +17 -41
- package/dist/{LexicalLink.prod-XZoAYVYD.mjs → LexicalLink.prod-Bkt9hQAt.mjs} +113 -137
- package/dist/{LexicalList.dev-B5d3ObhB.mjs → LexicalList.dev-B7VgME-m.mjs} +15 -47
- package/dist/{LexicalList.prod-OQDpVAEb.mjs → LexicalList.prod-B8c7TDjH.mjs} +208 -224
- package/dist/{LexicalMarkdown.dev-BkM8G3DG.mjs → LexicalMarkdown.dev-B5z9kLbV.mjs} +5 -4
- package/dist/{LexicalMarkdown.prod-DcVXCex6.mjs → LexicalMarkdown.prod-wKzw7FFH.mjs} +5 -4
- package/dist/{LexicalRichText.dev-DppD7IrA.mjs → LexicalRichText.dev-CUd6Li5F.mjs} +76 -82
- package/dist/{LexicalRichText.node-CPSn7dkg.mjs → LexicalRichText.node-BKfaQ-CH.mjs} +8 -8
- package/dist/{LexicalRichText.prod-h7JPxFNp.mjs → LexicalRichText.prod-SBewjJHx.mjs} +86 -96
- package/dist/{LexicalSelection.dev-CD0SLbxP.mjs → LexicalSelection.dev-D27JOCqj.mjs} +2 -2
- package/dist/{LexicalSelection.node-CGlJgUlZ.mjs → LexicalSelection.node-DBEwPjBu.mjs} +2 -2
- package/dist/{LexicalSelection.prod-DbVZN5AV.mjs → LexicalSelection.prod-OaYhXHOL.mjs} +2 -2
- package/dist/{LexicalTable.dev-D0HU14UV.mjs → LexicalTable.dev-6IFFOAE0.mjs} +260 -131
- package/dist/{LexicalTable.prod-BcPNSrxP.mjs → LexicalTable.prod-2CaLZ7fH.mjs} +686 -630
- package/dist/{LexicalUtils.dev-iKy_TrRT.mjs → LexicalUtils.dev-DJA7J_7v.mjs} +3 -3
- package/dist/{LexicalUtils.node-CIgMS8cG.mjs → LexicalUtils.node-Df9oPTlA.mjs} +2 -2
- package/dist/{LexicalUtils.prod-DIAsKJzu.mjs → LexicalUtils.prod-Bb7V4Ewg.mjs} +3 -3
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-CDcJmHkG.mjs +2 -0
- package/dist/{esm-CwXl1N0a.mjs → esm-DLzrv7gD.mjs} +165 -131
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +1 -1
- package/dist/{mxs-iW9DgqSZ.mjs → mxs-BIRW5Axj.mjs} +1434 -2233
- package/dist/vendor/litexml/cli.mjs +2462 -2557
- package/dist/vendor/litexml/litexml-html-preview-client.css +80 -47
- package/dist/vendor/litexml/litexml-html-preview-client.js +5276 -4906
- package/dist/vendor/litexml/style.css +6 -2
- package/package.json +31 -32
- package/skills/commands-ai.md +45 -12
- package/skills/overview.md +1 -1
- package/dist/esm-CH7CrOvh.mjs +0 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { f as namedSignals, l as effect, p as signal } from "./LexicalExtension.node-
|
|
2
|
-
import { $r as isHTMLElement, $t as COMMAND_PRIORITY_LOW, A as $getChildCaret, Ar as getComposedEventTarget, B as $getNodeByKey, Dt as $normalizeSelection__EXPERIMENTAL, Et as $normalizeCaret, Ft as $setSelection, G as $getSelection, Gn as KEY_ARROW_RIGHT_COMMAND, Gr as isCurrentlyReadOnlyMode, Hn as IS_UNDERLINE, I as $getDocument, Jn as KEY_DELETE_COMMAND, Jr as isDOMShadowRoot, K as $getSiblingCaret, Kn as KEY_ARROW_UP_COMMAND, Kr as isDOMDocumentNode, Kt as CLICK_COMMAND, L as $getEditor, Ln as IS_ITALIC, Mr as getDOMSelectionPoints, Nr as getDOMSelectionRange, Or as getActiveElement, Pn as IS_FIREFOX, Pt as $setPointFromCaret, Qn as KEY_TAB_COMMAND, Qt as COMMAND_PRIORITY_HIGH, S as $fullReconcile, St as $isTextNode, Tr as defineExtension, U as $getPreviousSelection, Un as KEY_ARROW_DOWN_COMMAND, V as $getNodeByKeyOrThrow, W as $getRoot, Wn as KEY_ARROW_LEFT_COMMAND, Xn as KEY_ESCAPE_COMMAND, Zt as COMMAND_PRIORITY_EDITOR, _n as FORMAT_ELEMENT_COMMAND, an as CUT_COMMAND, b as $findMatchingParent, br as configExtension, ci as mergeRegister, cn as DELETE_CHARACTER_COMMAND, cr as SELECTION_CHANGE_COMMAND, ct as $isInlineElementOrDecoratorNode, dt as $isLineBreakNode, ei as isHTMLTableRowElement, fi as removeClassNamesFromElement, g as $createRangeSelectionFromDom, gn as FOCUS_COMMAND, gt as $isRootOrShadowRoot, h as $createRangeSelection, hi as setDOMUnmanaged, hn as ElementNode, hr as TEXT_TYPE_TO_FORMAT, ht as $isRootNode, i as $caretFromPoint, in as COPY_COMMAND, jn as IS_BOLD, jr as getDOMSelection, ln as DELETE_LINE_COMMAND, lr as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, m as $createPoint, mi as setDOMStyleFromCSS, mt as $isRangeSelection, n as $applyNodeReplacement, ot as $isElementNode, p as $createParagraphNode, pi as safeCast, pt as $isParagraphNode, qn as KEY_BACKSPACE_COMMAND, qr as isDOMNode, rn as CONTROLLED_TEXT_INSERTION_COMMAND, rr as PASTE_COMMAND, rt as $isChildCaret, st as $isExtendableTextPointCaret, ui as registerEventListener, un as DELETE_WORD_COMMAND, ur as SELECT_ALL_COMMAND, v as $createTextNode, vn as FORMAT_TEXT_COMMAND, vr as addClassNamesToElement, w as $getAdjacentChildCaret, wn as INSERT_PARAGRAPH_COMMAND, xr as createCommand, y as $extendCaretToRange, yt as $isSiblingCaret, z as $getNearestNodeFromDOMNode, zn as IS_STRIKETHROUGH } from "./Lexical.node-
|
|
3
|
-
import { c as CoreImportExtension, g as defineImportRule, h as contextValue, l as DOMImportExtension, m as ImportTextStyle, o as $propagateTextAlignToBlockChildren, p as ImportTextFormat, y as sel } from "./LexicalHtml.node-
|
|
4
|
-
import { d as $unwrapAndFilterDescendants, m as objectKlassEquals, n as $dfs, o as $insertFirst, s as $insertNodeToNearestRoot, t as $descendantsMatching } from "./LexicalUtils.node-
|
|
5
|
-
import { o as copyToClipboard, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-
|
|
6
|
-
//#region ../../node_modules/.pnpm/@lexical+table@0.
|
|
1
|
+
import { d as getPeerDependencyFromEditor, f as namedSignals, l as effect, p as signal } from "./LexicalExtension.node-5OymZQfy.mjs";
|
|
2
|
+
import { $r as isHTMLElement, $t as COMMAND_PRIORITY_LOW, A as $getChildCaret, Ar as getComposedEventTarget, B as $getNodeByKey, Dt as $normalizeSelection__EXPERIMENTAL, Et as $normalizeCaret, Ft as $setSelection, G as $getSelection, Gn as KEY_ARROW_RIGHT_COMMAND, Gr as isCurrentlyReadOnlyMode, Hn as IS_UNDERLINE, I as $getDocument, Jn as KEY_DELETE_COMMAND, Jr as isDOMShadowRoot, K as $getSiblingCaret, Kn as KEY_ARROW_UP_COMMAND, Kr as isDOMDocumentNode, Kt as CLICK_COMMAND, L as $getEditor, Ln as IS_ITALIC, Mr as getDOMSelectionPoints, Nr as getDOMSelectionRange, Or as getActiveElement, Pn as IS_FIREFOX, Pt as $setPointFromCaret, Qn as KEY_TAB_COMMAND, Qt as COMMAND_PRIORITY_HIGH, S as $fullReconcile, St as $isTextNode, Tr as defineExtension, U as $getPreviousSelection, Un as KEY_ARROW_DOWN_COMMAND, V as $getNodeByKeyOrThrow, W as $getRoot, Wn as KEY_ARROW_LEFT_COMMAND, Xn as KEY_ESCAPE_COMMAND, Zt as COMMAND_PRIORITY_EDITOR, _n as FORMAT_ELEMENT_COMMAND, an as CUT_COMMAND, b as $findMatchingParent, br as configExtension, ci as mergeRegister, cn as DELETE_CHARACTER_COMMAND, cr as SELECTION_CHANGE_COMMAND, ct as $isInlineElementOrDecoratorNode, dt as $isLineBreakNode, ei as isHTMLTableRowElement, fi as removeClassNamesFromElement, g as $createRangeSelectionFromDom, gn as FOCUS_COMMAND, gt as $isRootOrShadowRoot, h as $createRangeSelection, hi as setDOMUnmanaged, hn as ElementNode, hr as TEXT_TYPE_TO_FORMAT, ht as $isRootNode, i as $caretFromPoint, in as COPY_COMMAND, jn as IS_BOLD, jr as getDOMSelection, ln as DELETE_LINE_COMMAND, lr as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, m as $createPoint, mi as setDOMStyleFromCSS, mt as $isRangeSelection, n as $applyNodeReplacement, ot as $isElementNode, p as $createParagraphNode, pi as safeCast, pt as $isParagraphNode, qn as KEY_BACKSPACE_COMMAND, qr as isDOMNode, rn as CONTROLLED_TEXT_INSERTION_COMMAND, rr as PASTE_COMMAND, rt as $isChildCaret, st as $isExtendableTextPointCaret, ui as registerEventListener, un as DELETE_WORD_COMMAND, ur as SELECT_ALL_COMMAND, v as $createTextNode, vn as FORMAT_TEXT_COMMAND, vr as addClassNamesToElement, w as $getAdjacentChildCaret, wn as INSERT_PARAGRAPH_COMMAND, xr as createCommand, y as $extendCaretToRange, yt as $isSiblingCaret, z as $getNearestNodeFromDOMNode, zn as IS_STRIKETHROUGH } from "./Lexical.node-D6wf2D5M.mjs";
|
|
3
|
+
import { c as CoreImportExtension, g as defineImportRule, h as contextValue, l as DOMImportExtension, m as ImportTextStyle, o as $propagateTextAlignToBlockChildren, p as ImportTextFormat, y as sel } from "./LexicalHtml.node-DpVNt7It.mjs";
|
|
4
|
+
import { d as $unwrapAndFilterDescendants, m as objectKlassEquals, n as $dfs, o as $insertFirst, s as $insertNodeToNearestRoot, t as $descendantsMatching } from "./LexicalUtils.node-Df9oPTlA.mjs";
|
|
5
|
+
import { o as copyToClipboard, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-m4nZ7IYw.mjs";
|
|
6
|
+
//#region ../../node_modules/.pnpm/@lexical+table@0.49.0_typescript@6.0.3/node_modules/@lexical/table/dist/LexicalTable.prod.mjs
|
|
7
7
|
/**
|
|
8
8
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
9
|
*
|
|
@@ -11,53 +11,47 @@ import { o as copyToClipboard, t as $getClipboardDataFromSelection } from "./Lex
|
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const nt = /^(\d+(?:\.\d+)?)px$/;
|
|
15
|
+
const ot = {
|
|
16
16
|
BOTH: 3,
|
|
17
17
|
COLUMN: 2,
|
|
18
18
|
NO_STATUS: 0,
|
|
19
19
|
ROW: 1
|
|
20
20
|
};
|
|
21
|
-
var
|
|
21
|
+
var lt = class extends ElementNode {
|
|
22
22
|
__colSpan;
|
|
23
23
|
__rowSpan;
|
|
24
24
|
__headerState;
|
|
25
25
|
__width;
|
|
26
26
|
__backgroundColor;
|
|
27
27
|
__verticalAlign;
|
|
28
|
-
|
|
29
|
-
return "tablecell"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
$config() {
|
|
29
|
+
return this.config("tablecell", {
|
|
30
|
+
extends: ElementNode,
|
|
31
|
+
importDOM: {
|
|
32
|
+
td: () => ({
|
|
33
|
+
conversion: st,
|
|
34
|
+
priority: 0
|
|
35
|
+
}),
|
|
36
|
+
th: () => ({
|
|
37
|
+
conversion: st,
|
|
38
|
+
priority: 0
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
});
|
|
33
42
|
}
|
|
34
43
|
afterCloneFrom(e) {
|
|
35
44
|
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;
|
|
36
45
|
}
|
|
37
|
-
static importDOM() {
|
|
38
|
-
return {
|
|
39
|
-
td: (e) => ({
|
|
40
|
-
conversion: rt,
|
|
41
|
-
priority: 0
|
|
42
|
-
}),
|
|
43
|
-
th: (e) => ({
|
|
44
|
-
conversion: rt,
|
|
45
|
-
priority: 0
|
|
46
|
-
})
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
static importJSON(e) {
|
|
50
|
-
return st().updateFromJSON(e);
|
|
51
|
-
}
|
|
52
46
|
updateFromJSON(e) {
|
|
53
47
|
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);
|
|
54
48
|
}
|
|
55
|
-
constructor(e =
|
|
49
|
+
constructor(e = ot.NO_STATUS, t = 1, n, o) {
|
|
56
50
|
super(o), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = n, this.__backgroundColor = null, this.__verticalAlign = void 0;
|
|
57
51
|
}
|
|
58
52
|
createDOM(e) {
|
|
59
53
|
const o = $getDocument().createElement(this.getTag());
|
|
60
|
-
return this.__width && (o.style.width = `${this.__width}px`), this.__colSpan > 1 && (o.colSpan = this.__colSpan), this.__rowSpan > 1 && (o.rowSpan = this.__rowSpan), null !== this.__backgroundColor && (o.style.backgroundColor = this.__backgroundColor),
|
|
54
|
+
return this.__width && (o.style.width = `${this.__width}px`), this.__colSpan > 1 && (o.colSpan = this.__colSpan), this.__rowSpan > 1 && (o.rowSpan = this.__rowSpan), null !== this.__backgroundColor && (o.style.backgroundColor = this.__backgroundColor), rt(this.__verticalAlign) && (o.style.verticalAlign = this.__verticalAlign), addClassNamesToElement(o, e.theme.tableCell, this.hasHeader() && e.theme.tableCellHeader), o;
|
|
61
55
|
}
|
|
62
56
|
exportDOM(e) {
|
|
63
57
|
const t = super.exportDOM(e);
|
|
@@ -70,7 +64,7 @@ var ot = class ot extends ElementNode {
|
|
|
70
64
|
exportJSON() {
|
|
71
65
|
return {
|
|
72
66
|
...super.exportJSON(),
|
|
73
|
-
...
|
|
67
|
+
...rt(this.__verticalAlign) && { verticalAlign: this.__verticalAlign },
|
|
74
68
|
backgroundColor: this.getBackgroundColor(),
|
|
75
69
|
colSpan: this.__colSpan,
|
|
76
70
|
headerState: this.__headerState,
|
|
@@ -95,7 +89,7 @@ var ot = class ot extends ElementNode {
|
|
|
95
89
|
getTag() {
|
|
96
90
|
return this.hasHeader() ? "th" : "td";
|
|
97
91
|
}
|
|
98
|
-
setHeaderStyles(e, t =
|
|
92
|
+
setHeaderStyles(e, t = ot.BOTH) {
|
|
99
93
|
const n = this.getWritable();
|
|
100
94
|
return n.__headerState = e & t | n.__headerState & ~t, n;
|
|
101
95
|
}
|
|
@@ -131,7 +125,7 @@ var ot = class ot extends ElementNode {
|
|
|
131
125
|
return (this.getHeaderStyles() & e) === e;
|
|
132
126
|
}
|
|
133
127
|
hasHeader() {
|
|
134
|
-
return this.getLatest().__headerState !==
|
|
128
|
+
return this.getLatest().__headerState !== ot.NO_STATUS;
|
|
135
129
|
}
|
|
136
130
|
updateDOM(e) {
|
|
137
131
|
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;
|
|
@@ -149,30 +143,30 @@ var ot = class ot extends ElementNode {
|
|
|
149
143
|
return !1;
|
|
150
144
|
}
|
|
151
145
|
};
|
|
152
|
-
function
|
|
146
|
+
function rt(e) {
|
|
153
147
|
return "middle" === e || "bottom" === e;
|
|
154
148
|
}
|
|
155
|
-
function
|
|
149
|
+
function st(e) {
|
|
156
150
|
const t = e, n = e.nodeName.toLowerCase();
|
|
157
151
|
let c;
|
|
158
|
-
|
|
159
|
-
let a =
|
|
152
|
+
nt.test(t.style.width) && (c = parseFloat(t.style.width));
|
|
153
|
+
let a = ot.NO_STATUS;
|
|
160
154
|
if ("th" === n) {
|
|
161
155
|
const e = t.getAttribute("scope");
|
|
162
|
-
if ("col" === e) a =
|
|
163
|
-
else if ("row" === e) a =
|
|
156
|
+
if ("col" === e) a = ot.COLUMN;
|
|
157
|
+
else if ("row" === e) a = ot.ROW;
|
|
164
158
|
else {
|
|
165
159
|
const e = t.parentElement, n = isHTMLElement(e) && "tr" === e.nodeName.toLowerCase() && isHTMLElement(e.parentElement) && ("thead" === e.parentElement.nodeName.toLowerCase() || 0 === e.rowIndex), l = 0 === t.cellIndex;
|
|
166
|
-
n && (a |=
|
|
160
|
+
n && (a |= ot.ROW), l && (a |= ot.COLUMN), a === ot.NO_STATUS && (a = ot.ROW);
|
|
167
161
|
}
|
|
168
162
|
}
|
|
169
|
-
const u =
|
|
163
|
+
const u = it(a, t.colSpan, c);
|
|
170
164
|
u.__rowSpan = t.rowSpan;
|
|
171
165
|
const h = t.style.backgroundColor;
|
|
172
166
|
"" !== h && (u.__backgroundColor = h);
|
|
173
167
|
const d = t.style.verticalAlign;
|
|
174
|
-
|
|
175
|
-
const f = t.style, g = (f && f.textDecoration || "").split(" "),
|
|
168
|
+
rt(d) && (u.__verticalAlign = d);
|
|
169
|
+
const f = t.style, g = (f && f.textDecoration || "").split(" "), p = "700" === f.fontWeight || "bold" === f.fontWeight, m = g.includes("line-through"), C = "italic" === f.fontStyle, _ = g.includes("underline"), S = f.color;
|
|
176
170
|
return {
|
|
177
171
|
after: (e) => {
|
|
178
172
|
const t = [];
|
|
@@ -184,7 +178,7 @@ function rt(e) {
|
|
|
184
178
|
}
|
|
185
179
|
};
|
|
186
180
|
for (const c of e) if ($isInlineElementOrDecoratorNode(c) || $isTextNode(c) || $isLineBreakNode(c)) {
|
|
187
|
-
if ($isTextNode(c) && (
|
|
181
|
+
if ($isTextNode(c) && (p && c.toggleFormat("bold"), m && c.toggleFormat("strikethrough"), C && c.toggleFormat("italic"), _ && c.toggleFormat("underline"), S)) {
|
|
188
182
|
const e = c.getStyle();
|
|
189
183
|
e.includes("color:") || c.setStyle(e + `color: ${S};`);
|
|
190
184
|
}
|
|
@@ -195,43 +189,37 @@ function rt(e) {
|
|
|
195
189
|
node: u
|
|
196
190
|
};
|
|
197
191
|
}
|
|
198
|
-
function
|
|
199
|
-
return $applyNodeReplacement(new
|
|
192
|
+
function it(e = ot.NO_STATUS, t = 1, n) {
|
|
193
|
+
return $applyNodeReplacement(new lt(e, t, n));
|
|
200
194
|
}
|
|
201
|
-
function
|
|
202
|
-
return e instanceof
|
|
195
|
+
function ct(e) {
|
|
196
|
+
return e instanceof lt;
|
|
203
197
|
}
|
|
204
|
-
const
|
|
205
|
-
function
|
|
198
|
+
const at = /* @__PURE__ */ createCommand("INSERT_TABLE_COMMAND");
|
|
199
|
+
function ut(e, ...t) {
|
|
206
200
|
const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
207
201
|
o.append("code", e);
|
|
208
202
|
for (const e of t) o.append("v", e);
|
|
209
203
|
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.`);
|
|
210
204
|
}
|
|
211
|
-
var
|
|
205
|
+
var ht = class extends ElementNode {
|
|
212
206
|
__height;
|
|
213
|
-
|
|
214
|
-
return "tablerow"
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
207
|
+
$config() {
|
|
208
|
+
return this.config("tablerow", {
|
|
209
|
+
extends: ElementNode,
|
|
210
|
+
importDOM: { tr: () => ({
|
|
211
|
+
conversion: dt,
|
|
212
|
+
priority: 0
|
|
213
|
+
}) }
|
|
214
|
+
});
|
|
218
215
|
}
|
|
219
216
|
afterCloneFrom(e) {
|
|
220
217
|
super.afterCloneFrom(e), this.__height = e.__height;
|
|
221
218
|
}
|
|
222
|
-
static importDOM() {
|
|
223
|
-
return { tr: (e) => ({
|
|
224
|
-
conversion: ht,
|
|
225
|
-
priority: 0
|
|
226
|
-
}) };
|
|
227
|
-
}
|
|
228
|
-
static importJSON(e) {
|
|
229
|
-
return dt().updateFromJSON(e);
|
|
230
|
-
}
|
|
231
219
|
updateFromJSON(e) {
|
|
232
220
|
return super.updateFromJSON(e).setHeight(e.height);
|
|
233
221
|
}
|
|
234
|
-
constructor(e, t) {
|
|
222
|
+
constructor(e = void 0, t) {
|
|
235
223
|
super(t), this.__height = e;
|
|
236
224
|
}
|
|
237
225
|
exportJSON() {
|
|
@@ -268,28 +256,28 @@ var ut = class ut extends ElementNode {
|
|
|
268
256
|
return !1;
|
|
269
257
|
}
|
|
270
258
|
};
|
|
271
|
-
function
|
|
259
|
+
function dt(e) {
|
|
272
260
|
const t = e;
|
|
273
261
|
let n;
|
|
274
|
-
return
|
|
275
|
-
after: (e) => $descendantsMatching(e,
|
|
276
|
-
node:
|
|
262
|
+
return nt.test(t.style.height) && (n = parseFloat(t.style.height)), {
|
|
263
|
+
after: (e) => $descendantsMatching(e, ct),
|
|
264
|
+
node: ft(n)
|
|
277
265
|
};
|
|
278
266
|
}
|
|
279
|
-
function dt(e) {
|
|
280
|
-
return $applyNodeReplacement(new ut(e));
|
|
281
|
-
}
|
|
282
267
|
function ft(e) {
|
|
283
|
-
return e
|
|
268
|
+
return $applyNodeReplacement(new ht(e));
|
|
269
|
+
}
|
|
270
|
+
function gt(e) {
|
|
271
|
+
return e instanceof ht;
|
|
284
272
|
}
|
|
285
|
-
function
|
|
286
|
-
const o =
|
|
273
|
+
function pt(e, t, n = !0) {
|
|
274
|
+
const o = ao();
|
|
287
275
|
for (let l = 0; l < e; l++) {
|
|
288
|
-
const e =
|
|
276
|
+
const e = ft();
|
|
289
277
|
for (let o = 0; o < t; o++) {
|
|
290
|
-
let t =
|
|
291
|
-
"object" == typeof n ? (0 === l && n.rows && (t |=
|
|
292
|
-
const r =
|
|
278
|
+
let t = ot.NO_STATUS;
|
|
279
|
+
"object" == typeof n ? (0 === l && n.rows && (t |= ot.ROW), 0 === o && n.columns && (t |= ot.COLUMN)) : n && (0 === l && (t |= ot.ROW), 0 === o && (t |= ot.COLUMN));
|
|
280
|
+
const r = it(t), s = $createParagraphNode();
|
|
293
281
|
s.append($createTextNode()), r.append(s), e.append(r);
|
|
294
282
|
}
|
|
295
283
|
o.append(e);
|
|
@@ -297,28 +285,28 @@ function gt(e, t, n = !0) {
|
|
|
297
285
|
return o;
|
|
298
286
|
}
|
|
299
287
|
function mt(e) {
|
|
300
|
-
const t = $findMatchingParent(e, (e) =>
|
|
301
|
-
return
|
|
302
|
-
}
|
|
303
|
-
function pt(e) {
|
|
304
|
-
const t = $findMatchingParent(e, (e) => ft(e));
|
|
305
|
-
if (ft(t)) return t;
|
|
306
|
-
throw new Error("Expected table cell to be inside of table row.");
|
|
288
|
+
const t = $findMatchingParent(e, (e) => ct(e));
|
|
289
|
+
return ct(t) ? t : null;
|
|
307
290
|
}
|
|
308
291
|
function Ct(e) {
|
|
309
|
-
const t = $findMatchingParent(e, (e) =>
|
|
310
|
-
if (
|
|
311
|
-
throw new Error("Expected table cell to be inside of table.");
|
|
292
|
+
const t = $findMatchingParent(e, (e) => gt(e));
|
|
293
|
+
if (gt(t)) return t;
|
|
294
|
+
throw new Error("Expected table cell to be inside of table row.");
|
|
312
295
|
}
|
|
313
296
|
function _t(e) {
|
|
314
|
-
const t =
|
|
315
|
-
|
|
297
|
+
const t = $findMatchingParent(e, (e) => uo(e));
|
|
298
|
+
if (uo(t)) return t;
|
|
299
|
+
throw new Error("Expected table cell to be inside of table.");
|
|
316
300
|
}
|
|
317
301
|
function St(e) {
|
|
318
|
-
|
|
302
|
+
const t = Ct(e);
|
|
303
|
+
return _t(t).getChildren().findIndex((e) => e.is(t));
|
|
304
|
+
}
|
|
305
|
+
function bt(e) {
|
|
306
|
+
return Ct(e).getChildren().findIndex((t) => t.is(e));
|
|
319
307
|
}
|
|
320
|
-
function
|
|
321
|
-
const n =
|
|
308
|
+
function wt(e, t) {
|
|
309
|
+
const n = _t(e), { x: o, y: l } = n.getCordsFromCellNode(e, t);
|
|
322
310
|
return {
|
|
323
311
|
above: n.getCellNodeFromCords(o, l - 1, t),
|
|
324
312
|
below: n.getCellNodeFromCords(o, l + 1, t),
|
|
@@ -326,81 +314,81 @@ function bt(e, t) {
|
|
|
326
314
|
right: n.getCellNodeFromCords(o + 1, l, t)
|
|
327
315
|
};
|
|
328
316
|
}
|
|
329
|
-
function
|
|
317
|
+
function yt(e, t) {
|
|
330
318
|
const n = e.getChildren();
|
|
331
319
|
if (t >= n.length || t < 0) throw new Error("Expected table cell to be inside of table row.");
|
|
332
320
|
return n[t].remove(), e;
|
|
333
321
|
}
|
|
334
|
-
function
|
|
322
|
+
function Nt(e, t, n = !0, o, l) {
|
|
335
323
|
const r = e.getChildren();
|
|
336
324
|
if (t >= r.length || t < 0) throw new Error("Table row target index out of range");
|
|
337
325
|
const s = r[t];
|
|
338
|
-
if (!
|
|
326
|
+
if (!gt(s)) throw new Error("Row before insertion index does not exist.");
|
|
339
327
|
for (let e = 0; e < o; e++) {
|
|
340
|
-
const e = s.getChildren(), t = e.length, o =
|
|
328
|
+
const e = s.getChildren(), t = e.length, o = ft();
|
|
341
329
|
for (let n = 0; n < t; n++) {
|
|
342
330
|
const t = e[n];
|
|
343
|
-
|
|
344
|
-
const { above: r, below: s } =
|
|
345
|
-
let c =
|
|
331
|
+
ct(t) || ut(12);
|
|
332
|
+
const { above: r, below: s } = wt(t, l);
|
|
333
|
+
let c = ot.NO_STATUS;
|
|
346
334
|
const a = r && r.getWidth() || s && s.getWidth() || void 0;
|
|
347
|
-
(r && r.hasHeaderState(
|
|
348
|
-
const u =
|
|
335
|
+
(r && r.hasHeaderState(ot.COLUMN) || s && s.hasHeaderState(ot.COLUMN)) && (c |= ot.COLUMN);
|
|
336
|
+
const u = it(c, 1, a);
|
|
349
337
|
u.append($createParagraphNode()), o.append(u);
|
|
350
338
|
}
|
|
351
339
|
n ? s.insertAfter(o) : s.insertBefore(o);
|
|
352
340
|
}
|
|
353
341
|
return e;
|
|
354
342
|
}
|
|
355
|
-
const
|
|
343
|
+
const vt = (e, t) => e === ot.BOTH || e === t ? t : ot.NO_STATUS;
|
|
356
344
|
function xt(e = !0) {
|
|
357
345
|
const t = $getSelection();
|
|
358
|
-
$isRangeSelection(t) ||
|
|
359
|
-
const n = t.anchor.getNode(), o = t.focus.getNode(), [l] =
|
|
360
|
-
return e ?
|
|
346
|
+
$isRangeSelection(t) || nn(t) || ut(188);
|
|
347
|
+
const n = t.anchor.getNode(), o = t.focus.getNode(), [l] = Xt(n), [r, , s] = Xt(o), [, i, c] = It(s, r, l), { startRow: a } = c, { startRow: u } = i;
|
|
348
|
+
return e ? Rt(a + l.__rowSpan > u + r.__rowSpan ? l : r, !0) : Rt(u < a ? r : l, !1);
|
|
361
349
|
}
|
|
362
|
-
const
|
|
363
|
-
function
|
|
364
|
-
const [, , n] =
|
|
350
|
+
const Tt = xt;
|
|
351
|
+
function Rt(e, t = !0) {
|
|
352
|
+
const [, , n] = Xt(e), [o, l] = It(n, e, e), r = o[0].length, { startRow: s } = l;
|
|
365
353
|
let c = null;
|
|
366
354
|
if (t) {
|
|
367
|
-
const t = s + e.__rowSpan - 1, l = o[t], a =
|
|
355
|
+
const t = s + e.__rowSpan - 1, l = o[t], a = ft();
|
|
368
356
|
for (let e = 0; e < r; e++) {
|
|
369
357
|
const { cell: n, startRow: o } = l[e];
|
|
370
358
|
if (o + n.__rowSpan - 1 <= t) {
|
|
371
|
-
const t = l[e].cell.__headerState, n =
|
|
372
|
-
a.append(
|
|
359
|
+
const t = l[e].cell.__headerState, n = vt(t, ot.COLUMN);
|
|
360
|
+
a.append(it(n).append($createParagraphNode()));
|
|
373
361
|
} else n.setRowSpan(n.__rowSpan + 1);
|
|
374
362
|
}
|
|
375
363
|
const u = n.getChildAtIndex(t);
|
|
376
|
-
|
|
364
|
+
gt(u) || ut(256), u.insertAfter(a), c = a;
|
|
377
365
|
} else {
|
|
378
|
-
const e = s, t = o[e], l =
|
|
366
|
+
const e = s, t = o[e], l = ft();
|
|
379
367
|
for (let n = 0; n < r; n++) {
|
|
380
368
|
const { cell: o, startRow: r } = t[n];
|
|
381
369
|
if (r === e) {
|
|
382
|
-
const e = t[n].cell.__headerState, o =
|
|
383
|
-
l.append(
|
|
370
|
+
const e = t[n].cell.__headerState, o = vt(e, ot.COLUMN);
|
|
371
|
+
l.append(it(o).append($createParagraphNode()));
|
|
384
372
|
} else o.setRowSpan(o.__rowSpan + 1);
|
|
385
373
|
}
|
|
386
374
|
const a = n.getChildAtIndex(e);
|
|
387
|
-
|
|
375
|
+
gt(a) || ut(257), a.insertBefore(l), c = l;
|
|
388
376
|
}
|
|
389
377
|
return c;
|
|
390
378
|
}
|
|
391
|
-
function
|
|
379
|
+
function Ft(e, t, n = !0, o, l) {
|
|
392
380
|
const r = e.getChildren(), s = [];
|
|
393
381
|
for (let e = 0; e < r.length; e++) {
|
|
394
382
|
const n = r[e];
|
|
395
|
-
if (
|
|
383
|
+
if (gt(n)) for (let e = 0; e < o; e++) {
|
|
396
384
|
const e = n.getChildren();
|
|
397
385
|
if (t >= e.length || t < 0) throw new Error("Table column target index out of range");
|
|
398
386
|
const o = e[t];
|
|
399
|
-
|
|
400
|
-
const { left: r, right: c } =
|
|
401
|
-
let a =
|
|
402
|
-
(r && r.hasHeaderState(
|
|
403
|
-
const u =
|
|
387
|
+
ct(o) || ut(12);
|
|
388
|
+
const { left: r, right: c } = wt(o, l);
|
|
389
|
+
let a = ot.NO_STATUS;
|
|
390
|
+
(r && r.hasHeaderState(ot.ROW) || c && c.hasHeaderState(ot.ROW)) && (a |= ot.ROW);
|
|
391
|
+
const u = it(a);
|
|
404
392
|
u.append($createParagraphNode()), s.push({
|
|
405
393
|
newTableCell: u,
|
|
406
394
|
targetCell: o
|
|
@@ -411,28 +399,28 @@ function Rt(e, t, n = !0, o, l) {
|
|
|
411
399
|
n ? t.insertAfter(e) : t.insertBefore(e);
|
|
412
400
|
}), e;
|
|
413
401
|
}
|
|
414
|
-
function
|
|
402
|
+
function At(e = !0) {
|
|
415
403
|
const t = $getSelection();
|
|
416
|
-
$isRangeSelection(t) ||
|
|
417
|
-
const n = t.anchor.getNode(), o = t.focus.getNode(), [l] =
|
|
418
|
-
return e ?
|
|
419
|
-
}
|
|
420
|
-
const Ot =
|
|
421
|
-
function
|
|
422
|
-
const [, , o] =
|
|
423
|
-
|
|
404
|
+
$isRangeSelection(t) || nn(t) || ut(188);
|
|
405
|
+
const n = t.anchor.getNode(), o = t.focus.getNode(), [l] = Xt(n), [r, , s] = Xt(o), [, i, c] = It(s, r, l), { startColumn: a } = c, { startColumn: u } = i;
|
|
406
|
+
return e ? Et(a + l.__colSpan > u + r.__colSpan ? l : r, !0) : Et(u < a ? r : l, !1);
|
|
407
|
+
}
|
|
408
|
+
const Ot = At;
|
|
409
|
+
function Et(e, t = !0, n = !0) {
|
|
410
|
+
const [, , o] = Xt(e), [l, r] = It(o, e, e), s = l.length, { startColumn: c } = r, a = t ? c + e.__colSpan - 1 : c - 1, u = o.getFirstChild();
|
|
411
|
+
gt(u) || ut(120);
|
|
424
412
|
let h = null;
|
|
425
|
-
function d(e =
|
|
426
|
-
const t =
|
|
413
|
+
function d(e = ot.NO_STATUS) {
|
|
414
|
+
const t = it(e).append($createParagraphNode());
|
|
427
415
|
return null === h && (h = t), t;
|
|
428
416
|
}
|
|
429
417
|
let f = u;
|
|
430
418
|
e: for (let e = 0; e < s; e++) {
|
|
431
419
|
if (0 !== e) {
|
|
432
420
|
const e = f.getNextSibling();
|
|
433
|
-
|
|
421
|
+
gt(e) || ut(121), f = e;
|
|
434
422
|
}
|
|
435
|
-
const t = l[e], n = t[a < 0 ? 0 : a].cell.__headerState, o =
|
|
423
|
+
const t = l[e], n = t[a < 0 ? 0 : a].cell.__headerState, o = vt(n, ot.ROW);
|
|
436
424
|
if (a < 0) {
|
|
437
425
|
zt(f, d(o));
|
|
438
426
|
continue;
|
|
@@ -453,7 +441,7 @@ function At(e, t = !0, n = !0) {
|
|
|
453
441
|
n.insertAfter(d(o));
|
|
454
442
|
} else r.setColSpan(r.__colSpan + 1);
|
|
455
443
|
}
|
|
456
|
-
null !== h && n &&
|
|
444
|
+
null !== h && n && Lt(h);
|
|
457
445
|
const g = o.getColWidths();
|
|
458
446
|
if (g) {
|
|
459
447
|
const e = [...g], t = a < 0 ? 0 : a, n = e[t];
|
|
@@ -465,7 +453,7 @@ function Kt(e, t) {
|
|
|
465
453
|
const n = e.getChildren();
|
|
466
454
|
for (let e = 0; e < n.length; e++) {
|
|
467
455
|
const o = n[e];
|
|
468
|
-
if (
|
|
456
|
+
if (gt(o)) {
|
|
469
457
|
const e = o.getChildren();
|
|
470
458
|
if (t >= e.length || t < 0) throw new Error("Table column target index out of range");
|
|
471
459
|
e[t].remove();
|
|
@@ -475,10 +463,10 @@ function Kt(e, t) {
|
|
|
475
463
|
}
|
|
476
464
|
function kt() {
|
|
477
465
|
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, , l] =
|
|
466
|
+
$isRangeSelection(e) || nn(e) || ut(188);
|
|
467
|
+
const [t, n] = e.isBackward() ? [e.focus.getNode(), e.anchor.getNode()] : [e.anchor.getNode(), e.focus.getNode()], [o, , l] = Xt(t), [r] = Xt(n), [s, i, c] = It(l, o, r), { startRow: a } = i, { startRow: u } = c, f = u + r.__rowSpan - 1;
|
|
480
468
|
if (s.length === f - a + 1) return void l.remove();
|
|
481
|
-
const g = s[0].length,
|
|
469
|
+
const g = s[0].length, p = s[f + 1], m = l.getChildAtIndex(f + 1);
|
|
482
470
|
for (let e = f; e >= a; e--) {
|
|
483
471
|
for (let t = g - 1; t >= 0; t--) {
|
|
484
472
|
const { cell: n, startRow: o, startColumn: l } = s[e][t];
|
|
@@ -488,44 +476,44 @@ function kt() {
|
|
|
488
476
|
n.setRowSpan(n.__rowSpan - l);
|
|
489
477
|
}
|
|
490
478
|
if (o >= a && o + n.__rowSpan - 1 > f && e === f) {
|
|
491
|
-
|
|
479
|
+
gt(m) || ut(387);
|
|
492
480
|
let o = null;
|
|
493
481
|
for (let n = 0; n < t; n++) {
|
|
494
|
-
const t =
|
|
482
|
+
const t = p[n], l = t.cell;
|
|
495
483
|
t.startRow === e + 1 && (o = l), l.__colSpan > 1 && (n += l.__colSpan - 1);
|
|
496
484
|
}
|
|
497
|
-
null === o ? zt(
|
|
485
|
+
null === o ? zt(m, n) : o.insertAfter(n);
|
|
498
486
|
}
|
|
499
487
|
}
|
|
500
488
|
}
|
|
501
489
|
const t = l.getChildAtIndex(e);
|
|
502
|
-
|
|
490
|
+
gt(t) || ut(206, String(e)), t.remove();
|
|
503
491
|
}
|
|
504
|
-
if (void 0 !==
|
|
505
|
-
const { cell: e } =
|
|
506
|
-
|
|
492
|
+
if (void 0 !== p) {
|
|
493
|
+
const { cell: e } = p[0];
|
|
494
|
+
Lt(e);
|
|
507
495
|
} else {
|
|
508
496
|
const { cell: t } = s[a - 1][0];
|
|
509
|
-
|
|
497
|
+
Lt(t);
|
|
510
498
|
}
|
|
511
499
|
}
|
|
512
500
|
const Mt = kt;
|
|
513
|
-
function
|
|
501
|
+
function Wt() {
|
|
514
502
|
const e = $getSelection();
|
|
515
|
-
$isRangeSelection(e) ||
|
|
516
|
-
const t = e.anchor.getNode(), n = e.focus.getNode(), [o, , l] =
|
|
517
|
-
if (s[0].length ===
|
|
503
|
+
$isRangeSelection(e) || nn(e) || ut(188);
|
|
504
|
+
const t = e.anchor.getNode(), n = e.focus.getNode(), [o, , l] = Xt(t), [r] = Xt(n), [s, i, c] = It(l, o, r), { startColumn: a } = i, { startRow: u, startColumn: f } = c, g = Math.min(a, f), p = Math.max(a + o.__colSpan - 1, f + r.__colSpan - 1), m = p - g + 1;
|
|
505
|
+
if (s[0].length === p - g + 1) return l.selectPrevious(), void l.remove();
|
|
518
506
|
const C = s.length;
|
|
519
|
-
for (let e = 0; e < C; e++) for (let t = g; t <=
|
|
507
|
+
for (let e = 0; e < C; e++) for (let t = g; t <= p; t++) {
|
|
520
508
|
const { cell: n, startColumn: o } = s[e][t];
|
|
521
509
|
if (o < g) {
|
|
522
510
|
if (t === g) {
|
|
523
511
|
const e = g - o;
|
|
524
|
-
n.setColSpan(n.__colSpan - Math.min(
|
|
512
|
+
n.setColSpan(n.__colSpan - Math.min(m, n.__colSpan - e));
|
|
525
513
|
}
|
|
526
|
-
} else if (o + n.__colSpan - 1 >
|
|
527
|
-
if (t ===
|
|
528
|
-
const e =
|
|
514
|
+
} else if (o + n.__colSpan - 1 > p) {
|
|
515
|
+
if (t === p) {
|
|
516
|
+
const e = p - o + 1;
|
|
529
517
|
n.setColSpan(n.__colSpan - e);
|
|
530
518
|
}
|
|
531
519
|
} else n.remove();
|
|
@@ -533,19 +521,19 @@ function Et() {
|
|
|
533
521
|
const _ = s[u], S = a > f ? _[a + o.__colSpan] : _[f + r.__colSpan];
|
|
534
522
|
if (void 0 !== S) {
|
|
535
523
|
const { cell: e } = S;
|
|
536
|
-
|
|
524
|
+
Lt(e);
|
|
537
525
|
} else {
|
|
538
526
|
const { cell: t } = f < a ? _[f - 1] : _[a - 1];
|
|
539
|
-
|
|
527
|
+
Lt(t);
|
|
540
528
|
}
|
|
541
529
|
const b = l.getColWidths();
|
|
542
530
|
if (b) {
|
|
543
531
|
const e = [...b];
|
|
544
|
-
e.splice(g,
|
|
532
|
+
e.splice(g, m), l.setColWidths(e);
|
|
545
533
|
}
|
|
546
534
|
}
|
|
547
|
-
const $t =
|
|
548
|
-
function
|
|
535
|
+
const $t = Wt;
|
|
536
|
+
function Lt(e) {
|
|
549
537
|
const t = e.getFirstDescendant();
|
|
550
538
|
null == t ? e.selectStart() : t.getParentOrThrow().selectStart();
|
|
551
539
|
}
|
|
@@ -555,7 +543,7 @@ function zt(e, t) {
|
|
|
555
543
|
}
|
|
556
544
|
function Ht(e) {
|
|
557
545
|
if (0 === e.length) return null;
|
|
558
|
-
const [n] =
|
|
546
|
+
const [n] = Ut(_t(e[0]), null, null);
|
|
559
547
|
let o = Infinity, l = -Infinity, r = Infinity, s = -Infinity;
|
|
560
548
|
const c = /* @__PURE__ */ new Set();
|
|
561
549
|
for (const t of n) for (const n of t) {
|
|
@@ -589,53 +577,53 @@ function Bt(e) {
|
|
|
589
577
|
const t = e.getFirstChildOrThrow();
|
|
590
578
|
return !(!$isParagraphNode(t) || !t.isEmpty());
|
|
591
579
|
}
|
|
592
|
-
function
|
|
580
|
+
function Dt() {
|
|
593
581
|
const e = $getSelection();
|
|
594
|
-
$isRangeSelection(e) ||
|
|
595
|
-
const n = $findMatchingParent(e.anchor.getNode(),
|
|
596
|
-
return
|
|
582
|
+
$isRangeSelection(e) || nn(e) || ut(188);
|
|
583
|
+
const n = $findMatchingParent(e.anchor.getNode(), ct);
|
|
584
|
+
return ct(n) || ut(148), Pt(n);
|
|
597
585
|
}
|
|
598
586
|
function Pt(e) {
|
|
599
|
-
const [t, n, o] =
|
|
587
|
+
const [t, n, o] = Xt(e), l = t.__colSpan, r = t.__rowSpan;
|
|
600
588
|
if (1 === l && 1 === r) return;
|
|
601
|
-
const [s, c] =
|
|
589
|
+
const [s, c] = It(o, t, t), { startColumn: a, startRow: u } = c, h = t.__headerState & ot.COLUMN, d = Array.from({ length: l }, (e, t) => {
|
|
602
590
|
let n = h;
|
|
603
591
|
for (let e = 0; 0 !== n && e < s.length; e++) n &= s[e][t + a].cell.__headerState;
|
|
604
592
|
return n;
|
|
605
|
-
}), f = t.__headerState &
|
|
593
|
+
}), f = t.__headerState & ot.ROW, g = Array.from({ length: r }, (e, t) => {
|
|
606
594
|
let n = f;
|
|
607
595
|
for (let e = 0; 0 !== n && e < s[0].length; e++) n &= s[t + u][e].cell.__headerState;
|
|
608
596
|
return n;
|
|
609
597
|
});
|
|
610
598
|
if (l > 1) {
|
|
611
|
-
for (let e = 1; e < l; e++) t.insertAfter(
|
|
599
|
+
for (let e = 1; e < l; e++) t.insertAfter(it(d[e] | g[0]).append($createParagraphNode()));
|
|
612
600
|
t.setColSpan(1);
|
|
613
601
|
}
|
|
614
602
|
if (r > 1) {
|
|
615
603
|
let e;
|
|
616
604
|
for (let t = 1; t < r; t++) {
|
|
617
605
|
const o = u + t, r = s[o];
|
|
618
|
-
e = (e || n).getNextSibling(),
|
|
606
|
+
e = (e || n).getNextSibling(), gt(e) || ut(125);
|
|
619
607
|
let c = null;
|
|
620
608
|
for (let e = 0; e < a; e++) {
|
|
621
609
|
const t = r[e], n = t.cell;
|
|
622
610
|
t.startRow === o && (c = n), n.__colSpan > 1 && (e += n.__colSpan - 1);
|
|
623
611
|
}
|
|
624
|
-
if (null === c) for (let n = l - 1; n >= 0; n--) zt(e,
|
|
625
|
-
else for (let e = l - 1; e >= 0; e--) c.insertAfter(
|
|
612
|
+
if (null === c) for (let n = l - 1; n >= 0; n--) zt(e, it(d[n] | g[t]).append($createParagraphNode()));
|
|
613
|
+
else for (let e = l - 1; e >= 0; e--) c.insertAfter(it(d[e] | g[t]).append($createParagraphNode()));
|
|
626
614
|
}
|
|
627
615
|
t.setRowSpan(1);
|
|
628
616
|
}
|
|
629
617
|
}
|
|
630
|
-
function
|
|
631
|
-
const [o, l, r] =
|
|
632
|
-
return null === l &&
|
|
618
|
+
function It(e, t, n) {
|
|
619
|
+
const [o, l, r] = Ut(e, t, n);
|
|
620
|
+
return null === l && ut(207), null === r && ut(208), [
|
|
633
621
|
o,
|
|
634
622
|
l,
|
|
635
623
|
r
|
|
636
624
|
];
|
|
637
625
|
}
|
|
638
|
-
function
|
|
626
|
+
function Ut(e, t, n) {
|
|
639
627
|
const o = [];
|
|
640
628
|
let l = null, r = null;
|
|
641
629
|
function s(e) {
|
|
@@ -645,10 +633,10 @@ function It(e, t, n) {
|
|
|
645
633
|
const i = e.getChildren();
|
|
646
634
|
for (let e = 0; e < i.length; e++) {
|
|
647
635
|
const o = i[e];
|
|
648
|
-
|
|
636
|
+
gt(o) || ut(209);
|
|
649
637
|
const c = s(e);
|
|
650
638
|
for (let a = o.getFirstChild(), u = 0; null != a; a = a.getNextSibling()) {
|
|
651
|
-
for (
|
|
639
|
+
for (ct(a) || ut(147); void 0 !== c[u];) u++;
|
|
652
640
|
const o = {
|
|
653
641
|
cell: a,
|
|
654
642
|
startColumn: u,
|
|
@@ -667,26 +655,26 @@ function It(e, t, n) {
|
|
|
667
655
|
r
|
|
668
656
|
];
|
|
669
657
|
}
|
|
670
|
-
function
|
|
658
|
+
function Xt(e) {
|
|
671
659
|
let t;
|
|
672
|
-
if (e instanceof
|
|
660
|
+
if (e instanceof lt) t = e;
|
|
673
661
|
else if ("__type" in e) {
|
|
674
|
-
const n = $findMatchingParent(e,
|
|
675
|
-
|
|
662
|
+
const n = $findMatchingParent(e, ct);
|
|
663
|
+
ct(n) || ut(148), t = n;
|
|
676
664
|
} else {
|
|
677
|
-
const n = $findMatchingParent(e.getNode(),
|
|
678
|
-
|
|
665
|
+
const n = $findMatchingParent(e.getNode(), ct);
|
|
666
|
+
ct(n) || ut(148), t = n;
|
|
679
667
|
}
|
|
680
668
|
const n = t.getParent();
|
|
681
|
-
|
|
669
|
+
gt(n) || ut(149);
|
|
682
670
|
const o = n.getParent();
|
|
683
|
-
return
|
|
671
|
+
return uo(o) || ut(210), [
|
|
684
672
|
t,
|
|
685
673
|
n,
|
|
686
674
|
o
|
|
687
675
|
];
|
|
688
676
|
}
|
|
689
|
-
function
|
|
677
|
+
function Yt(e, t, n) {
|
|
690
678
|
let o, l = Math.min(t.startColumn, n.startColumn), r = 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
679
|
do {
|
|
692
680
|
o = !1;
|
|
@@ -707,14 +695,14 @@ function Xt(e, t, n) {
|
|
|
707
695
|
minRow: r
|
|
708
696
|
};
|
|
709
697
|
}
|
|
710
|
-
function
|
|
698
|
+
function qt(e) {
|
|
711
699
|
const t = e.getChildren();
|
|
712
700
|
let n = null;
|
|
713
701
|
for (const e of t) {
|
|
714
|
-
if (!
|
|
702
|
+
if (!gt(e)) return !1;
|
|
715
703
|
if (null === n && (n = e.getChildrenSize()), e.getChildrenSize() !== n) return !1;
|
|
716
704
|
const t = e.getChildren();
|
|
717
|
-
for (const e of t) if (!
|
|
705
|
+
for (const e of t) if (!ct(e) || 1 !== e.getRowSpan() || 1 !== e.getColSpan()) return !1;
|
|
718
706
|
}
|
|
719
707
|
return (n || 0) > 0;
|
|
720
708
|
}
|
|
@@ -722,8 +710,8 @@ function Jt(e, t, n) {
|
|
|
722
710
|
if (t === n) return;
|
|
723
711
|
const o = e.getColumnCount();
|
|
724
712
|
if (t < 0 || t >= o || n < 0 || n >= o) return;
|
|
725
|
-
if (!
|
|
726
|
-
e.getChildren().filter(
|
|
713
|
+
if (!qt(e)) return;
|
|
714
|
+
e.getChildren().filter(gt).forEach((e) => {
|
|
727
715
|
const o = e.getChildren(), [l] = o.splice(t, 1);
|
|
728
716
|
o.splice(n, 0, l), e.splice(0, o.length, o);
|
|
729
717
|
});
|
|
@@ -733,19 +721,19 @@ function Jt(e, t, n) {
|
|
|
733
721
|
o.splice(n, 0, r), e.setColWidths(o);
|
|
734
722
|
}
|
|
735
723
|
}
|
|
736
|
-
function
|
|
724
|
+
function jt(e, t, n) {
|
|
737
725
|
if (t === n) return;
|
|
738
|
-
const o = e.getChildren().filter(
|
|
726
|
+
const o = e.getChildren().filter(gt), l = o.length;
|
|
739
727
|
if (t < 0 || t >= l || n < 0 || n >= l) return;
|
|
740
|
-
if (!
|
|
728
|
+
if (!qt(e)) return;
|
|
741
729
|
const r = o[t], s = o[n];
|
|
742
730
|
n > t ? s.insertAfter(r) : s.insertBefore(r);
|
|
743
731
|
}
|
|
744
|
-
function
|
|
745
|
-
const [t, , n] =
|
|
732
|
+
function Vt(e) {
|
|
733
|
+
const [t, , n] = Xt(e), o = n.getChildren().filter(gt), l = o.length, r = o[0].getChildren().length, s = new Array(l);
|
|
746
734
|
for (let e = 0; e < l; e++) s[e] = new Array(r);
|
|
747
735
|
for (let e = 0; e < l; e++) {
|
|
748
|
-
const n = o[e].getChildren().filter(
|
|
736
|
+
const n = o[e].getChildren().filter(ct);
|
|
749
737
|
let l = 0;
|
|
750
738
|
for (let o = 0; o < n.length; o++) {
|
|
751
739
|
for (; s[e][l];) l++;
|
|
@@ -762,31 +750,31 @@ function jt(e) {
|
|
|
762
750
|
}
|
|
763
751
|
return null;
|
|
764
752
|
}
|
|
765
|
-
function
|
|
766
|
-
const n = t.getStartEndPoints(), o =
|
|
753
|
+
function Gt(e, t) {
|
|
754
|
+
const n = t.getStartEndPoints(), o = nn(t);
|
|
767
755
|
if (null === n) return !1;
|
|
768
|
-
const [l, s] = n, [c, a, u] =
|
|
769
|
-
if (!(
|
|
770
|
-
const [d, g,
|
|
771
|
-
let S = g.startRow, b = g.startColumn, w =
|
|
756
|
+
const [l, s] = n, [c, a, u] = Xt(l), h = $findMatchingParent(s.getNode(), (e) => ct(e));
|
|
757
|
+
if (!(ct(c) && ct(h) && gt(a) && uo(u))) return !1;
|
|
758
|
+
const [d, g, p] = It(u, c, h), [m] = Ut(e, null, null), C = d.length, _ = C > 0 ? d[0].length : 0;
|
|
759
|
+
let S = g.startRow, b = g.startColumn, w = m.length, y = w > 0 ? m[0].length : 0;
|
|
772
760
|
if (o) {
|
|
773
|
-
const e =
|
|
761
|
+
const e = Yt(d, g, p), t = e.maxRow - e.minRow + 1, n = e.maxColumn - e.minColumn + 1;
|
|
774
762
|
S = e.minRow, b = e.minColumn, w = Math.min(w, t), y = Math.min(y, n);
|
|
775
763
|
}
|
|
776
764
|
let N = !1;
|
|
777
|
-
const
|
|
778
|
-
for (let e = S; e <=
|
|
765
|
+
const v = Math.min(C, S + w) - 1, x = Math.min(_, b + y) - 1, T = /* @__PURE__ */ new Set();
|
|
766
|
+
for (let e = S; e <= v; e++) for (let t = b; t <= x; t++) {
|
|
779
767
|
const n = d[e][t];
|
|
780
768
|
T.has(n.cell.getKey()) || 1 === n.cell.__rowSpan && 1 === n.cell.__colSpan || (Pt(n.cell), T.add(n.cell.getKey()), N = !0);
|
|
781
769
|
}
|
|
782
|
-
let [R] =
|
|
770
|
+
let [R] = Ut(u.getWritable(), null, null);
|
|
783
771
|
const F = w - C + S;
|
|
784
|
-
for (let e = 0; e < F; e++)
|
|
785
|
-
const
|
|
786
|
-
for (let e = 0; e <
|
|
787
|
-
[R] =
|
|
772
|
+
for (let e = 0; e < F; e++) Rt(R[C - 1][0].cell);
|
|
773
|
+
const A = y - _ + b;
|
|
774
|
+
for (let e = 0; e < A; e++) Et(R[0][_ - 1].cell, !0, !1);
|
|
775
|
+
[R] = Ut(u.getWritable(), null, null);
|
|
788
776
|
for (let e = S; e < S + w; e++) for (let t = b; t < b + y; t++) {
|
|
789
|
-
const n = e - S, o = t - b, l =
|
|
777
|
+
const n = e - S, o = t - b, l = m[n][o];
|
|
790
778
|
if (l.startRow !== n || l.startColumn !== o) continue;
|
|
791
779
|
const s = l.cell;
|
|
792
780
|
if (1 !== s.__rowSpan || 1 !== s.__colSpan) {
|
|
@@ -806,44 +794,44 @@ function Vt(e, t) {
|
|
|
806
794
|
}), u.forEach((e) => e.remove());
|
|
807
795
|
}
|
|
808
796
|
if (o && N) {
|
|
809
|
-
const [e] =
|
|
797
|
+
const [e] = Ut(u.getWritable(), null, null);
|
|
810
798
|
e[g.startRow][g.startColumn].cell.selectEnd();
|
|
811
799
|
}
|
|
812
800
|
return !0;
|
|
813
801
|
}
|
|
814
|
-
function
|
|
815
|
-
const [o] =
|
|
816
|
-
t >= 0 && t < o.length ||
|
|
817
|
-
const l = o[t], r = n ?
|
|
802
|
+
function Qt(e, t, n) {
|
|
803
|
+
const [o] = Ut(e, null, null);
|
|
804
|
+
t >= 0 && t < o.length || ut(396, String(t));
|
|
805
|
+
const l = o[t], r = n ? ot.ROW : ot.NO_STATUS, s = /* @__PURE__ */ new Set();
|
|
818
806
|
for (let e = 0; e < l.length; e++) {
|
|
819
807
|
const t = l[e];
|
|
820
|
-
null != t && (s.has(t.cell) || (s.add(t.cell), t.cell.setHeaderStyles(r,
|
|
808
|
+
null != t && (s.has(t.cell) || (s.add(t.cell), t.cell.setHeaderStyles(r, ot.ROW)));
|
|
821
809
|
}
|
|
822
810
|
}
|
|
823
|
-
function
|
|
824
|
-
const [o] =
|
|
825
|
-
o.length > 0 && t >= 0 && t < o[0].length ||
|
|
826
|
-
const l = n ?
|
|
811
|
+
function Zt(e, t, n) {
|
|
812
|
+
const [o] = Ut(e, null, null);
|
|
813
|
+
o.length > 0 && t >= 0 && t < o[0].length || ut(397, String(t));
|
|
814
|
+
const l = n ? ot.COLUMN : ot.NO_STATUS, r = /* @__PURE__ */ new Set();
|
|
827
815
|
for (let e = 0; e < o.length; e++) {
|
|
828
816
|
const n = o[e][t];
|
|
829
|
-
null != n && (r.has(n.cell) || (r.add(n.cell), n.cell.setHeaderStyles(l,
|
|
817
|
+
null != n && (r.has(n.cell) || (r.add(n.cell), n.cell.setHeaderStyles(l, ot.COLUMN)));
|
|
830
818
|
}
|
|
831
819
|
}
|
|
832
|
-
function
|
|
820
|
+
function en(e) {
|
|
833
821
|
const [[t, n, o, l], [r, s, i, c]] = ["anchor", "focus"].map((t) => {
|
|
834
|
-
const n = e[t].getNode(), o = $findMatchingParent(n,
|
|
835
|
-
|
|
822
|
+
const n = e[t].getNode(), o = $findMatchingParent(n, ct);
|
|
823
|
+
ct(o) || ut(238, t, n.getKey(), n.getType());
|
|
836
824
|
const l = o.getParent();
|
|
837
|
-
|
|
825
|
+
gt(l) || ut(239, t);
|
|
838
826
|
const r = l.getParent();
|
|
839
|
-
return
|
|
827
|
+
return uo(r) || ut(240, t), [
|
|
840
828
|
n,
|
|
841
829
|
o,
|
|
842
830
|
l,
|
|
843
831
|
r
|
|
844
832
|
];
|
|
845
833
|
});
|
|
846
|
-
return l.is(c) ||
|
|
834
|
+
return l.is(c) || ut(241), {
|
|
847
835
|
anchorCell: n,
|
|
848
836
|
anchorNode: t,
|
|
849
837
|
anchorRow: o,
|
|
@@ -854,7 +842,7 @@ function Zt(e) {
|
|
|
854
842
|
focusTable: c
|
|
855
843
|
};
|
|
856
844
|
}
|
|
857
|
-
var
|
|
845
|
+
var tn = class tn {
|
|
858
846
|
tableKey;
|
|
859
847
|
anchor;
|
|
860
848
|
focus;
|
|
@@ -881,13 +869,13 @@ var en = class en {
|
|
|
881
869
|
this._cachedNodes = e;
|
|
882
870
|
}
|
|
883
871
|
is(e) {
|
|
884
|
-
return
|
|
872
|
+
return nn(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
|
|
885
873
|
}
|
|
886
874
|
set(e, t, n) {
|
|
887
875
|
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;
|
|
888
876
|
}
|
|
889
877
|
clone() {
|
|
890
|
-
return new
|
|
878
|
+
return new tn(this.tableKey, $createPoint(this.anchor.key, this.anchor.offset, this.anchor.type), $createPoint(this.focus.key, this.focus.offset, this.focus.type));
|
|
891
879
|
}
|
|
892
880
|
isCollapsed() {
|
|
893
881
|
return !1;
|
|
@@ -897,22 +885,22 @@ var en = class en {
|
|
|
897
885
|
}
|
|
898
886
|
insertRawText(e) {
|
|
899
887
|
if ("" === e) return;
|
|
900
|
-
const t = (e.endsWith("\n") ? e.slice(0, -1) : e).split("\n").map((e) => e.split(" ")), n =
|
|
888
|
+
const t = (e.endsWith("\n") ? e.slice(0, -1) : e).split("\n").map((e) => e.split(" ")), n = ao();
|
|
901
889
|
for (const e of t) {
|
|
902
|
-
const t =
|
|
890
|
+
const t = ft();
|
|
903
891
|
for (const n of e) {
|
|
904
|
-
const e =
|
|
892
|
+
const e = it(ot.NO_STATUS), o = $createParagraphNode();
|
|
905
893
|
n && o.append($createTextNode(n)), e.append(o), t.append(e);
|
|
906
894
|
}
|
|
907
895
|
n.append(t);
|
|
908
896
|
}
|
|
909
|
-
const { anchorCell: o } =
|
|
910
|
-
|
|
897
|
+
const { anchorCell: o } = en(this);
|
|
898
|
+
Gt(n, o.select(0, o.getChildrenSize()));
|
|
911
899
|
}
|
|
912
900
|
insertText() {}
|
|
913
901
|
hasFormat(e) {
|
|
914
902
|
let t = 0;
|
|
915
|
-
this.getNodes().filter(
|
|
903
|
+
this.getNodes().filter(ct).forEach((e) => {
|
|
916
904
|
const n = e.getFirstChild();
|
|
917
905
|
$isParagraphNode(n) && (t |= n.getTextFormat());
|
|
918
906
|
});
|
|
@@ -921,14 +909,14 @@ var en = class en {
|
|
|
921
909
|
}
|
|
922
910
|
insertNodes(e) {
|
|
923
911
|
const t = this.focus.getNode();
|
|
924
|
-
$isElementNode(t) ||
|
|
912
|
+
$isElementNode(t) || ut(151);
|
|
925
913
|
$normalizeSelection__EXPERIMENTAL(t.select(0, t.getChildrenSize())).insertNodes(e);
|
|
926
914
|
}
|
|
927
915
|
getShape() {
|
|
928
|
-
const { anchorCell: e, focusCell: t } =
|
|
929
|
-
null === n &&
|
|
930
|
-
const o =
|
|
931
|
-
null === o &&
|
|
916
|
+
const { anchorCell: e, focusCell: t } = en(this), n = Vt(e);
|
|
917
|
+
null === n && ut(153);
|
|
918
|
+
const o = Vt(t);
|
|
919
|
+
null === o && ut(155);
|
|
932
920
|
const l = Math.min(n.columnIndex, o.columnIndex), r = 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);
|
|
933
921
|
return {
|
|
934
922
|
fromX: Math.min(l, r),
|
|
@@ -941,22 +929,22 @@ var en = class en {
|
|
|
941
929
|
if (!this.isValid()) return [];
|
|
942
930
|
const e = this._cachedNodes;
|
|
943
931
|
if (null !== e) return e;
|
|
944
|
-
const { anchorTable: t, anchorCell: n, focusCell: o } =
|
|
932
|
+
const { anchorTable: t, anchorCell: n, focusCell: o } = en(this), l = o.getParents()[1];
|
|
945
933
|
if (l !== t) {
|
|
946
934
|
if (t.isParentOf(o)) {
|
|
947
935
|
const e = l.getParent();
|
|
948
|
-
e ??
|
|
936
|
+
e ?? ut(159), this.set(this.tableKey, o.getKey(), e.getKey());
|
|
949
937
|
} else {
|
|
950
938
|
const e = t.getParent();
|
|
951
|
-
e ??
|
|
939
|
+
e ?? ut(158), this.set(this.tableKey, e.getKey(), o.getKey());
|
|
952
940
|
}
|
|
953
941
|
return this.getNodes();
|
|
954
942
|
}
|
|
955
|
-
const [r, s, i] =
|
|
943
|
+
const [r, s, i] = It(t, n, o), { minColumn: c, maxColumn: a, minRow: u, maxRow: h } = Yt(r, s, i), d = /* @__PURE__ */ new Map([[t.getKey(), t]]);
|
|
956
944
|
let f = null;
|
|
957
945
|
for (let e = u; e <= h; e++) for (let t = c; t <= a; t++) {
|
|
958
946
|
const { cell: n } = r[e][t], o = n.getParent();
|
|
959
|
-
|
|
947
|
+
gt(o) || ut(160), o !== f && (d.set(o.getKey(), o), f = o), d.has(n.getKey()) || rn(n, (e) => {
|
|
960
948
|
d.set(e.getKey(), e);
|
|
961
949
|
});
|
|
962
950
|
}
|
|
@@ -964,7 +952,7 @@ var en = class en {
|
|
|
964
952
|
return isCurrentlyReadOnlyMode() || (this._cachedNodes = g), g;
|
|
965
953
|
}
|
|
966
954
|
getTextContent() {
|
|
967
|
-
const e = this.getNodes().filter((e) =>
|
|
955
|
+
const e = this.getNodes().filter((e) => ct(e));
|
|
968
956
|
let t = "";
|
|
969
957
|
for (let n = 0; n < e.length; n++) {
|
|
970
958
|
const o = e[n], l = o.__parent, r = (e[n + 1] || {}).__parent;
|
|
@@ -973,34 +961,34 @@ var en = class en {
|
|
|
973
961
|
return t;
|
|
974
962
|
}
|
|
975
963
|
};
|
|
976
|
-
function
|
|
977
|
-
return e instanceof
|
|
964
|
+
function nn(e) {
|
|
965
|
+
return e instanceof tn;
|
|
978
966
|
}
|
|
979
|
-
function
|
|
980
|
-
return new
|
|
967
|
+
function on() {
|
|
968
|
+
return new tn("root", $createPoint("root", 0, "element"), $createPoint("root", 0, "element"));
|
|
981
969
|
}
|
|
982
|
-
function
|
|
970
|
+
function ln(e, t, n) {
|
|
983
971
|
e.getKey(), t.getKey(), n.getKey();
|
|
984
|
-
const o = $getSelection(), l =
|
|
972
|
+
const o = $getSelection(), l = nn(o) ? o.clone() : new tn("root", $createPoint("root", 0, "element"), $createPoint("root", 0, "element"));
|
|
985
973
|
return l.set(e.getKey(), t.getKey(), n.getKey()), l;
|
|
986
974
|
}
|
|
987
|
-
function
|
|
975
|
+
function rn(e, t) {
|
|
988
976
|
const n = [[e]];
|
|
989
977
|
for (let e = n.at(-1); void 0 !== e && n.length > 0; e = n.at(-1)) {
|
|
990
978
|
const o = e.pop();
|
|
991
979
|
void 0 === o ? n.pop() : !1 !== t(o) && $isElementNode(o) && n.push(o.getChildren());
|
|
992
980
|
}
|
|
993
981
|
}
|
|
994
|
-
function
|
|
982
|
+
function sn(e, t = $getEditor()) {
|
|
995
983
|
const n = $getNodeByKey(e);
|
|
996
|
-
|
|
997
|
-
const o =
|
|
998
|
-
return null === o &&
|
|
984
|
+
uo(n) || ut(231, e);
|
|
985
|
+
const o = pn(n, t.getElementByKey(e));
|
|
986
|
+
return null === o && ut(232, e), {
|
|
999
987
|
tableElement: o,
|
|
1000
988
|
tableNode: n
|
|
1001
989
|
};
|
|
1002
990
|
}
|
|
1003
|
-
var
|
|
991
|
+
var cn = class {
|
|
1004
992
|
observers;
|
|
1005
993
|
nextFocus;
|
|
1006
994
|
shouldCheckSelectionForTable;
|
|
@@ -1032,12 +1020,12 @@ var sn = class {
|
|
|
1032
1020
|
const e = [];
|
|
1033
1021
|
for (const [t, [n]] of Array.from(this.observers.entries())) {
|
|
1034
1022
|
const o = $getNodeByKey(t);
|
|
1035
|
-
|
|
1023
|
+
uo(o) ? e.push([o, n]) : this.removeObserver(t);
|
|
1036
1024
|
}
|
|
1037
1025
|
return e;
|
|
1038
1026
|
}
|
|
1039
1027
|
};
|
|
1040
|
-
var
|
|
1028
|
+
var an = class {
|
|
1041
1029
|
focusX;
|
|
1042
1030
|
focusY;
|
|
1043
1031
|
listenersToRemove;
|
|
@@ -1071,7 +1059,7 @@ var cn = class {
|
|
|
1071
1059
|
this.abortController.abort("removeListeners"), Array.from(this.listenersToRemove).forEach((e) => e()), this.listenersToRemove.clear();
|
|
1072
1060
|
}
|
|
1073
1061
|
$lookup() {
|
|
1074
|
-
return
|
|
1062
|
+
return sn(this.tableNodeKey, this.editor);
|
|
1075
1063
|
}
|
|
1076
1064
|
trackTable() {
|
|
1077
1065
|
const e = new MutationObserver((e) => {
|
|
@@ -1086,12 +1074,12 @@ var cn = class {
|
|
|
1086
1074
|
}
|
|
1087
1075
|
if (!t) return;
|
|
1088
1076
|
const { tableNode: n, tableElement: o } = this.$lookup();
|
|
1089
|
-
this.table =
|
|
1077
|
+
this.table = Fn(n, o);
|
|
1090
1078
|
});
|
|
1091
1079
|
});
|
|
1092
1080
|
this.editor.read("latest", () => {
|
|
1093
1081
|
const { tableNode: t, tableElement: n } = this.$lookup();
|
|
1094
|
-
this.table =
|
|
1082
|
+
this.table = Fn(t, n), e.observe(n, {
|
|
1095
1083
|
attributes: !0,
|
|
1096
1084
|
childList: !0,
|
|
1097
1085
|
subtree: !0
|
|
@@ -1102,7 +1090,7 @@ var cn = class {
|
|
|
1102
1090
|
const t = this.editor;
|
|
1103
1091
|
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();
|
|
1104
1092
|
const { tableNode: n, tableElement: o } = this.$lookup();
|
|
1105
|
-
|
|
1093
|
+
An(t, Fn(n, o), null), e && null !== $getSelection() && ($setSelection(null), t.dispatchCommand(SELECTION_CHANGE_COMMAND));
|
|
1106
1094
|
}
|
|
1107
1095
|
$enableHighlightStyle() {
|
|
1108
1096
|
const e = this.editor, { tableElement: t } = this.$lookup();
|
|
@@ -1114,9 +1102,9 @@ var cn = class {
|
|
|
1114
1102
|
}
|
|
1115
1103
|
$updateTableTableSelection(e) {
|
|
1116
1104
|
if (null !== e) {
|
|
1117
|
-
e.tableKey !== this.tableNodeKey &&
|
|
1105
|
+
e.tableKey !== this.tableNodeKey && ut(233, e.tableKey, this.tableNodeKey);
|
|
1118
1106
|
const t = this.editor;
|
|
1119
|
-
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(),
|
|
1107
|
+
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), An(t, this.table, this.tableSelection);
|
|
1120
1108
|
} else this.$clearHighlight();
|
|
1121
1109
|
}
|
|
1122
1110
|
updateDOMSelection() {
|
|
@@ -1135,7 +1123,7 @@ var cn = class {
|
|
|
1135
1123
|
let e = s;
|
|
1136
1124
|
if (null === e && t && (e = o.getCellNodeFromCords(l, r, this.table)), null !== e) {
|
|
1137
1125
|
const t = this.$getAnchorTableCellOrThrow();
|
|
1138
|
-
return this.focusCellNodeKey = e.getKey(), this.tableSelection =
|
|
1126
|
+
return this.focusCellNodeKey = e.getKey(), this.tableSelection = ln(o, t, e), $setSelection(this.tableSelection), n.dispatchCommand(SELECTION_CHANGE_COMMAND), An(n, this.table, this.tableSelection), !0;
|
|
1139
1127
|
}
|
|
1140
1128
|
}
|
|
1141
1129
|
}
|
|
@@ -1143,48 +1131,48 @@ var cn = class {
|
|
|
1143
1131
|
}
|
|
1144
1132
|
$getAnchorTableCell() {
|
|
1145
1133
|
const e = this.anchorCellNodeKey ? $getNodeByKey(this.anchorCellNodeKey) : null;
|
|
1146
|
-
return
|
|
1134
|
+
return ct(e) ? e : null;
|
|
1147
1135
|
}
|
|
1148
1136
|
$getAnchorTableCellOrThrow() {
|
|
1149
1137
|
const e = this.$getAnchorTableCell();
|
|
1150
|
-
return null === e &&
|
|
1138
|
+
return null === e && ut(234), e;
|
|
1151
1139
|
}
|
|
1152
1140
|
$getFocusTableCell() {
|
|
1153
1141
|
const e = this.focusCellNodeKey ? $getNodeByKey(this.focusCellNodeKey) : null;
|
|
1154
|
-
return
|
|
1142
|
+
return ct(e) ? e : null;
|
|
1155
1143
|
}
|
|
1156
1144
|
$getFocusTableCellOrThrow() {
|
|
1157
1145
|
const e = this.$getFocusTableCell();
|
|
1158
|
-
return null === e &&
|
|
1146
|
+
return null === e && ut(235), e;
|
|
1159
1147
|
}
|
|
1160
1148
|
$setAnchorCellForSelection(e) {
|
|
1161
1149
|
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;
|
|
1162
1150
|
const { tableNode: t } = this.$lookup(), n = Jn(t, e.elem);
|
|
1163
1151
|
if (null !== n) {
|
|
1164
1152
|
const e = n.getKey();
|
|
1165
|
-
null != this.tableSelection ? (this.tableSelection = this.tableSelection.clone(), this.tableSelection.set(t.getKey(), e, e)) : this.tableSelection =
|
|
1153
|
+
null != this.tableSelection ? (this.tableSelection = this.tableSelection.clone(), this.tableSelection.set(t.getKey(), e, e)) : this.tableSelection = ln(t, n, n), this.anchorCellNodeKey = e;
|
|
1166
1154
|
}
|
|
1167
1155
|
}
|
|
1168
1156
|
$formatCells(e) {
|
|
1169
1157
|
const t = $getSelection();
|
|
1170
|
-
|
|
1171
|
-
const n = $createRangeSelection(), o = n.anchor, l = n.focus, r = t.getNodes().filter(
|
|
1172
|
-
r.length > 0 ||
|
|
1158
|
+
nn(t) || ut(236);
|
|
1159
|
+
const n = $createRangeSelection(), o = n.anchor, l = n.focus, r = t.getNodes().filter(ct);
|
|
1160
|
+
r.length > 0 || ut(237);
|
|
1173
1161
|
const s = r[0].getFirstChild(), i = $isParagraphNode(s) ? s.getFormatFlags(e, null) : null;
|
|
1174
1162
|
r.forEach((t) => {
|
|
1175
1163
|
o.set(t.getKey(), 0, "element"), l.set(t.getKey(), t.getChildrenSize(), "element"), n.formatText(e, i);
|
|
1176
|
-
}), $setSelection(t), this.editor.dispatchCommand(SELECTION_CHANGE_COMMAND
|
|
1164
|
+
}), $setSelection(t), this.editor.dispatchCommand(SELECTION_CHANGE_COMMAND);
|
|
1177
1165
|
}
|
|
1178
1166
|
$clearText() {
|
|
1179
1167
|
const { editor: e } = this, t = $getNodeByKey(this.tableNodeKey);
|
|
1180
|
-
if (!
|
|
1168
|
+
if (!uo(t)) throw new Error("Expected TableNode.");
|
|
1181
1169
|
const n = $getSelection();
|
|
1182
|
-
|
|
1183
|
-
const o = n.getNodes().filter(
|
|
1184
|
-
if (o.length > 0 && null !== l && null !== r &&
|
|
1170
|
+
nn(n) || ut(253);
|
|
1171
|
+
const o = n.getNodes().filter(ct), l = t.getFirstChild(), r = t.getLastChild();
|
|
1172
|
+
if (o.length > 0 && null !== l && null !== r && gt(l) && gt(r) && o[0] === l.getFirstChild() && o[o.length - 1] === r.getLastChild()) {
|
|
1185
1173
|
t.selectPrevious();
|
|
1186
1174
|
const n = t.getParent();
|
|
1187
|
-
t.remove(), $isRootNode(n) && n.isEmpty() && e.dispatchCommand(INSERT_PARAGRAPH_COMMAND
|
|
1175
|
+
t.remove(), $isRootNode(n) && n.isEmpty() && e.dispatchCommand(INSERT_PARAGRAPH_COMMAND);
|
|
1188
1176
|
return;
|
|
1189
1177
|
}
|
|
1190
1178
|
o.forEach((e) => {
|
|
@@ -1194,50 +1182,50 @@ var cn = class {
|
|
|
1194
1182
|
e !== t && e.remove();
|
|
1195
1183
|
});
|
|
1196
1184
|
}
|
|
1197
|
-
}),
|
|
1185
|
+
}), An(e, this.table, null), $setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND);
|
|
1198
1186
|
}
|
|
1199
1187
|
};
|
|
1200
|
-
const
|
|
1201
|
-
function
|
|
1188
|
+
const un = "__lexicalTableSelection";
|
|
1189
|
+
function hn(e) {
|
|
1202
1190
|
const t = $getNodeByKeyOrThrow(e);
|
|
1203
|
-
return
|
|
1191
|
+
return uo(t) || ut(386, e), t;
|
|
1204
1192
|
}
|
|
1205
|
-
const
|
|
1206
|
-
function
|
|
1207
|
-
const o = (e) => Math.max(1, Math.ceil(Math.min(
|
|
1208
|
-
return e <= t +
|
|
1193
|
+
const dn = 40;
|
|
1194
|
+
function fn(e, t, n) {
|
|
1195
|
+
const o = (e) => Math.max(1, Math.ceil(Math.min(dn, e) / dn * 18));
|
|
1196
|
+
return e <= t + dn ? -o(t + dn - e) : e >= n - dn ? o(e - (n - dn)) : 0;
|
|
1209
1197
|
}
|
|
1210
|
-
function
|
|
1198
|
+
function gn(e) {
|
|
1211
1199
|
return isHTMLElement(e) && "TABLE" === e.nodeName;
|
|
1212
1200
|
}
|
|
1213
|
-
function
|
|
1201
|
+
function pn(e, t) {
|
|
1214
1202
|
if (!t) return t;
|
|
1215
|
-
const n =
|
|
1216
|
-
return
|
|
1203
|
+
const n = gn(t) ? t : t.querySelector("table");
|
|
1204
|
+
return gn(n) || ut(341, e.constructor.name, e.getType(), e.getKey(), t.nodeName), n;
|
|
1217
1205
|
}
|
|
1218
1206
|
function mn(e) {
|
|
1219
1207
|
return e._window;
|
|
1220
1208
|
}
|
|
1221
|
-
function
|
|
1209
|
+
function Cn(e, t) {
|
|
1222
1210
|
for (let n = t, o = null; null !== n; n = n.getParent()) {
|
|
1223
1211
|
if (e.is(n)) return o;
|
|
1224
|
-
|
|
1212
|
+
ct(n) && (o = n);
|
|
1225
1213
|
}
|
|
1226
1214
|
return null;
|
|
1227
1215
|
}
|
|
1228
|
-
const
|
|
1216
|
+
const _n = [
|
|
1229
1217
|
[KEY_ARROW_DOWN_COMMAND, "down"],
|
|
1230
1218
|
[KEY_ARROW_UP_COMMAND, "up"],
|
|
1231
1219
|
[KEY_ARROW_LEFT_COMMAND, "backward"],
|
|
1232
1220
|
[KEY_ARROW_RIGHT_COMMAND, "forward"]
|
|
1233
1221
|
];
|
|
1234
|
-
const
|
|
1222
|
+
const Sn = [
|
|
1235
1223
|
DELETE_WORD_COMMAND,
|
|
1236
1224
|
DELETE_LINE_COMMAND,
|
|
1237
1225
|
DELETE_CHARACTER_COMMAND
|
|
1238
1226
|
];
|
|
1239
|
-
const
|
|
1240
|
-
function
|
|
1227
|
+
const bn = [KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND];
|
|
1228
|
+
function wn(e, t) {
|
|
1241
1229
|
return e.registerRootListener((n) => {
|
|
1242
1230
|
if (null === n) return;
|
|
1243
1231
|
const o = e._window;
|
|
@@ -1246,23 +1234,23 @@ function bn(e, t) {
|
|
|
1246
1234
|
const l = getComposedEventTarget(o);
|
|
1247
1235
|
if (0 !== o.button || !isDOMNode(l) || !n.contains(l)) return;
|
|
1248
1236
|
const r = function(e) {
|
|
1249
|
-
const t =
|
|
1237
|
+
const t = Tn(e);
|
|
1250
1238
|
if (null === t) return null;
|
|
1251
1239
|
let n = t.elem;
|
|
1252
1240
|
for (; null != n;) {
|
|
1253
|
-
if ("TABLE" === n.nodeName &&
|
|
1241
|
+
if ("TABLE" === n.nodeName && un in n && n[un]) return {
|
|
1254
1242
|
cellElement: t,
|
|
1255
1243
|
tableElement: n,
|
|
1256
|
-
tableObserver: n[
|
|
1244
|
+
tableObserver: n[un]
|
|
1257
1245
|
};
|
|
1258
1246
|
n = n.parentNode;
|
|
1259
1247
|
}
|
|
1260
1248
|
return null;
|
|
1261
1249
|
}(l);
|
|
1262
1250
|
e.update(() => {
|
|
1263
|
-
if (
|
|
1251
|
+
if (nn($getSelection())) {
|
|
1264
1252
|
for (const [e] of t.observers.values()) e.$clearHighlight(!1);
|
|
1265
|
-
$setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND
|
|
1253
|
+
$setSelection(null), e.dispatchCommand(SELECTION_CHANGE_COMMAND);
|
|
1266
1254
|
}
|
|
1267
1255
|
if (!r) return;
|
|
1268
1256
|
const { tableObserver: n, tableElement: l, cellElement: s } = r;
|
|
@@ -1281,7 +1269,7 @@ function bn(e, t) {
|
|
|
1281
1269
|
const n = o.getRootNode();
|
|
1282
1270
|
if (!isDOMDocumentNode(n) && !isDOMShadowRoot(n)) return null;
|
|
1283
1271
|
for (const l of n.elementsFromPoint(e, t)) {
|
|
1284
|
-
const e =
|
|
1272
|
+
const e = Rn(o, l);
|
|
1285
1273
|
if (e) return e;
|
|
1286
1274
|
}
|
|
1287
1275
|
return null;
|
|
@@ -1292,7 +1280,7 @@ function bn(e, t) {
|
|
|
1292
1280
|
focusCell: t,
|
|
1293
1281
|
override: n,
|
|
1294
1282
|
tableKey: l.tableNodeKey
|
|
1295
|
-
}), e.dispatchCommand(SELECTION_CHANGE_COMMAND
|
|
1283
|
+
}), e.dispatchCommand(SELECTION_CHANGE_COMMAND));
|
|
1296
1284
|
}, f = (e) => {
|
|
1297
1285
|
for (let t = o.parentElement; t; t = t.parentElement) if ("x" === e ? t.scrollWidth > t.clientWidth : t.scrollHeight > t.clientHeight) {
|
|
1298
1286
|
const n = s.getComputedStyle(t), o = "x" === e ? n.overflowX : n.overflowY;
|
|
@@ -1306,7 +1294,7 @@ function bn(e, t) {
|
|
|
1306
1294
|
const t = e.getBoundingClientRect();
|
|
1307
1295
|
o = "x" === n ? t.left : t.top, l = "x" === n ? t.right : t.bottom;
|
|
1308
1296
|
}
|
|
1309
|
-
const r =
|
|
1297
|
+
const r = fn(t, o, l);
|
|
1310
1298
|
if (0 === r) return !1;
|
|
1311
1299
|
if (null === e) {
|
|
1312
1300
|
const e = "x" === n ? s.scrollX : s.scrollY;
|
|
@@ -1318,7 +1306,7 @@ function bn(e, t) {
|
|
|
1318
1306
|
}
|
|
1319
1307
|
const i = e.scrollTop;
|
|
1320
1308
|
return e.scrollTop += r, e.scrollTop !== i;
|
|
1321
|
-
},
|
|
1309
|
+
}, p = (e, t) => {
|
|
1322
1310
|
let n = i, o = c;
|
|
1323
1311
|
if (null === e) n = Math.min(Math.max(n, 1), s.innerWidth - 1);
|
|
1324
1312
|
else {
|
|
@@ -1331,23 +1319,23 @@ function bn(e, t) {
|
|
|
1331
1319
|
o = Math.min(Math.max(o, e.top + 1), e.bottom - 1);
|
|
1332
1320
|
}
|
|
1333
1321
|
return [n, o];
|
|
1334
|
-
},
|
|
1322
|
+
}, m = () => {
|
|
1335
1323
|
const e = f("x");
|
|
1336
1324
|
if (null !== e) {
|
|
1337
1325
|
const t = e.getBoundingClientRect();
|
|
1338
|
-
if (0 !==
|
|
1326
|
+
if (0 !== fn(i, t.left, t.right)) return !0;
|
|
1339
1327
|
}
|
|
1340
1328
|
const t = f("y"), n = null === t ? 0 : t.getBoundingClientRect().top, o = null === t ? s.innerHeight : t.getBoundingClientRect().bottom;
|
|
1341
|
-
return 0 !==
|
|
1329
|
+
return 0 !== fn(c, n, o);
|
|
1342
1330
|
}, C = () => {
|
|
1343
1331
|
if (a = null, !l.isSelecting) return;
|
|
1344
1332
|
const e = f("x"), t = f("y"), n = null !== e && g(e, i, "x"), o = g(t, c, "y");
|
|
1345
1333
|
if (n || o) {
|
|
1346
|
-
const [n, o] =
|
|
1334
|
+
const [n, o] = p(e, t), l = h(n, o);
|
|
1347
1335
|
l && d(l, !1), a = s.requestAnimationFrame(C);
|
|
1348
1336
|
}
|
|
1349
1337
|
}, _ = () => {
|
|
1350
|
-
null === a && "touch" !== l.pointerType &&
|
|
1338
|
+
null === a && "touch" !== l.pointerType && m() && (a = s.requestAnimationFrame(C));
|
|
1351
1339
|
}, S = () => {
|
|
1352
1340
|
u();
|
|
1353
1341
|
}, b = (e) => {
|
|
@@ -1357,15 +1345,15 @@ function bn(e, t) {
|
|
|
1357
1345
|
i = e.clientX, c = e.clientY;
|
|
1358
1346
|
let n = null;
|
|
1359
1347
|
const r = !(IS_FIREFOX || o.contains(t));
|
|
1360
|
-
n = r ?
|
|
1348
|
+
n = r ? Rn(o, t) : h(e.clientX, e.clientY), n && d(n, r), _();
|
|
1361
1349
|
};
|
|
1362
1350
|
s.addEventListener("pointerup", S, l.listenerOptions), s.addEventListener("pointermove", b, l.listenerOptions);
|
|
1363
1351
|
};
|
|
1364
1352
|
l.pointerType = t.pointerType;
|
|
1365
|
-
const c =
|
|
1366
|
-
if (IS_FIREFOX && t.shiftKey && $n(a, c) && ($isRangeSelection(a) ||
|
|
1367
|
-
const e = a.anchor.getNode(), o =
|
|
1368
|
-
if (o) l.$setAnchorCellForSelection(
|
|
1353
|
+
const c = hn(l.tableNodeKey), a = $getPreviousSelection();
|
|
1354
|
+
if (IS_FIREFOX && t.shiftKey && $n(a, c) && ($isRangeSelection(a) || nn(a))) {
|
|
1355
|
+
const e = a.anchor.getNode(), o = Cn(c, a.anchor.getNode());
|
|
1356
|
+
if (o) l.$setAnchorCellForSelection(qn(l, o)), l.$setFocusCellForSelection(n), Un(t);
|
|
1369
1357
|
else (c.isBefore(e) ? c.selectStart() : c.selectEnd()).anchor.set(a.anchor.key, a.anchor.offset, a.anchor.type);
|
|
1370
1358
|
} else "touch" !== t.pointerType && l.$setAnchorCellForSelection(n);
|
|
1371
1359
|
i(n);
|
|
@@ -1374,104 +1362,81 @@ function bn(e, t) {
|
|
|
1374
1362
|
});
|
|
1375
1363
|
});
|
|
1376
1364
|
}
|
|
1377
|
-
function
|
|
1365
|
+
function yn(e, t, n, o, l) {
|
|
1378
1366
|
const r = n.getRootElement(), s = mn(n);
|
|
1379
|
-
null !== r && null !== s ||
|
|
1380
|
-
const i = new
|
|
1367
|
+
null !== r && null !== s || ut(246);
|
|
1368
|
+
const i = new an(n, e.getKey()), c = pn(e, t);
|
|
1381
1369
|
(function(e, t) {
|
|
1382
|
-
null !== xn(e) &&
|
|
1383
|
-
e[
|
|
1370
|
+
null !== xn(e) && ut(205);
|
|
1371
|
+
e[un] = t;
|
|
1384
1372
|
})(c, i), i.listenersToRemove.add(() => function(e, t) {
|
|
1385
|
-
xn(e) === t && delete e[
|
|
1373
|
+
xn(e) === t && delete e[un];
|
|
1386
1374
|
}(c, i));
|
|
1387
1375
|
i.listenersToRemove.add(registerEventListener(c, "mousedown", (e) => {
|
|
1388
1376
|
const t = getComposedEventTarget(e);
|
|
1389
|
-
if (e.detail >= 3 && isDOMNode(t)) null !==
|
|
1377
|
+
if (e.detail >= 3 && isDOMNode(t)) null !== Tn(t) && e.preventDefault();
|
|
1390
1378
|
}, i.listenerOptions));
|
|
1391
|
-
for (const [t, o] of
|
|
1379
|
+
for (const [t, o] of _n) i.listenersToRemove.add(n.registerCommand(t, (t) => In(n, t, o, e, i, l), COMMAND_PRIORITY_HIGH));
|
|
1392
1380
|
i.listenersToRemove.add(n.registerCommand(KEY_ESCAPE_COMMAND, (t) => {
|
|
1393
1381
|
const n = $getSelection();
|
|
1394
|
-
if (
|
|
1395
|
-
const o =
|
|
1396
|
-
if (null !== o) return
|
|
1382
|
+
if (nn(n)) {
|
|
1383
|
+
const o = Cn(e, n.focus.getNode());
|
|
1384
|
+
if (null !== o) return Un(t), o.selectEnd(), !0;
|
|
1397
1385
|
}
|
|
1398
1386
|
return !1;
|
|
1399
1387
|
}, COMMAND_PRIORITY_HIGH));
|
|
1400
|
-
const a = (
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1403
|
-
if (tn(n)) return i.$clearText(), !0;
|
|
1404
|
-
if ($isRangeSelection(n)) {
|
|
1405
|
-
if (!it(pn(e, n.anchor.getNode()))) return !1;
|
|
1406
|
-
const o = n.anchor.getNode(), l = n.focus.getNode(), r = e.isParentOf(o), s = e.isParentOf(l);
|
|
1407
|
-
if (r && !s || s && !r) return i.$clearText(), !0;
|
|
1408
|
-
const c = $findMatchingParent(n.anchor.getNode(), (e) => $isElementNode(e)), a = c && $findMatchingParent(c, (e) => $isElementNode(e) && it(e.getParent()));
|
|
1409
|
-
if (!$isElementNode(a) || !$isElementNode(c)) return !1;
|
|
1410
|
-
if (t === DELETE_LINE_COMMAND && null === a.getPreviousSibling()) return !0;
|
|
1411
|
-
}
|
|
1412
|
-
return !1;
|
|
1388
|
+
const a = () => {
|
|
1389
|
+
const t = $getSelection();
|
|
1390
|
+
return !!$n(t, e) && !!nn(t) && (i.$clearText(), !0);
|
|
1413
1391
|
};
|
|
1414
|
-
for (const e of
|
|
1392
|
+
for (const e of Sn) i.listenersToRemove.add(n.registerCommand(e, a, COMMAND_PRIORITY_HIGH));
|
|
1415
1393
|
const g = (t) => {
|
|
1416
1394
|
const n = $getSelection();
|
|
1417
|
-
if (!
|
|
1395
|
+
if (!nn(n) && !$isRangeSelection(n)) return !1;
|
|
1418
1396
|
const o = e.isParentOf(n.anchor.getNode());
|
|
1419
1397
|
if (o !== e.isParentOf(n.focus.getNode())) {
|
|
1420
1398
|
const t = o ? "anchor" : "focus", l = o ? "focus" : "anchor", { key: r, offset: s, type: i } = n[l];
|
|
1421
1399
|
return e[n[t].isBefore(n[l]) ? "selectPrevious" : "selectNext"]()[l].set(r, s, i), !1;
|
|
1422
1400
|
}
|
|
1423
|
-
return !!$n(n, e) && !!
|
|
1401
|
+
return !!$n(n, e) && !!nn(n) && (t && (t.preventDefault(), t.stopPropagation()), i.$clearText(), !0);
|
|
1424
1402
|
};
|
|
1425
|
-
for (const e of
|
|
1403
|
+
for (const e of bn) i.listenersToRemove.add(n.registerCommand(e, g, COMMAND_PRIORITY_HIGH));
|
|
1426
1404
|
i.listenersToRemove.add(n.registerCommand(CUT_COMMAND, (e) => {
|
|
1427
1405
|
const t = $getSelection();
|
|
1428
1406
|
if (t) {
|
|
1429
|
-
if (!
|
|
1407
|
+
if (!nn(t) && !$isRangeSelection(t)) return !1;
|
|
1430
1408
|
copyToClipboard(n, objectKlassEquals(e, ClipboardEvent) ? e : null, $getClipboardDataFromSelection(t));
|
|
1431
1409
|
const o = g(e);
|
|
1432
1410
|
return $isRangeSelection(t) ? (t.removeText(), !0) : o;
|
|
1433
1411
|
}
|
|
1434
1412
|
return !1;
|
|
1435
1413
|
}, COMMAND_PRIORITY_HIGH));
|
|
1436
|
-
const
|
|
1437
|
-
return i.listenersToRemove.add(registerEventListener(
|
|
1414
|
+
const p = r.ownerDocument;
|
|
1415
|
+
return i.listenersToRemove.add(registerEventListener(p, "paste", (t) => {
|
|
1438
1416
|
if (t.defaultPrevented) return;
|
|
1439
1417
|
n.read("latest", () => {
|
|
1440
1418
|
const t = $getSelection();
|
|
1441
|
-
return r.contains(
|
|
1419
|
+
return r.contains(p.activeElement) && nn(t) && $n(t, e);
|
|
1442
1420
|
}) && (t.preventDefault(), n.dispatchCommand(PASTE_COMMAND, t));
|
|
1443
|
-
})), i.listenersToRemove.add(registerEventListener(
|
|
1421
|
+
})), i.listenersToRemove.add(registerEventListener(p, "copy", (t) => {
|
|
1444
1422
|
if (t.defaultPrevented) return;
|
|
1445
1423
|
const o = getComposedEventTarget(t);
|
|
1446
1424
|
if (o === r || isDOMNode(o) && r.contains(o)) return;
|
|
1447
1425
|
n.read("latest", () => {
|
|
1448
1426
|
const t = $getSelection();
|
|
1449
|
-
return r.contains(getActiveElement(r)) &&
|
|
1427
|
+
return r.contains(getActiveElement(r)) && nn(t) && $n(t, e);
|
|
1450
1428
|
}) && (t.preventDefault(), n.dispatchCommand(COPY_COMMAND, t));
|
|
1451
1429
|
})), i.listenersToRemove.add(n.registerCommand(FORMAT_TEXT_COMMAND, (t) => {
|
|
1452
1430
|
const n = $getSelection();
|
|
1453
|
-
|
|
1454
|
-
if (tn(n)) return i.$formatCells(t), !0;
|
|
1455
|
-
if ($isRangeSelection(n)) {
|
|
1456
|
-
if (!it($findMatchingParent(n.anchor.getNode(), (e) => it(e)))) return !1;
|
|
1457
|
-
}
|
|
1458
|
-
return !1;
|
|
1431
|
+
return !!$n(n, e) && !!nn(n) && (i.$formatCells(t), !0);
|
|
1459
1432
|
}, COMMAND_PRIORITY_HIGH)), i.listenersToRemove.add(n.registerCommand(FORMAT_ELEMENT_COMMAND, (t) => {
|
|
1460
1433
|
const n = $getSelection();
|
|
1461
|
-
if (!
|
|
1434
|
+
if (!nn(n) || !$n(n, e)) return !1;
|
|
1462
1435
|
const o = n.anchor.getNode(), l = n.focus.getNode();
|
|
1463
|
-
if (!
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
if (t && n && o) {
|
|
1468
|
-
const [e] = Dt(t, n, o);
|
|
1469
|
-
return n.getKey() === e[0][0].cell.getKey() && o.getKey() === e[e.length - 1].at(-1).cell.getKey();
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
return !1;
|
|
1473
|
-
}(n, e)) return e.setFormat(t), !0;
|
|
1474
|
-
const [r, s, i] = Dt(e, o, l), 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), d = Math.min(s.startColumn, i.startColumn), f = /* @__PURE__ */ new Set();
|
|
1436
|
+
if (!ct(o) || !ct(l)) return !1;
|
|
1437
|
+
const [r, s, i] = It(e, o, l), 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), d = Math.min(s.startColumn, i.startColumn);
|
|
1438
|
+
if (0 === u && 0 === d && c === r.length - 1 && a === r[0].length - 1) return e.setFormat(t), !0;
|
|
1439
|
+
const f = /* @__PURE__ */ new Set();
|
|
1475
1440
|
for (let e = u; e <= c; e++) for (let n = d; n <= a; n++) {
|
|
1476
1441
|
const o = r[e][n].cell;
|
|
1477
1442
|
if (f.has(o)) continue;
|
|
@@ -1486,12 +1451,12 @@ function wn(e, t, n, o, l) {
|
|
|
1486
1451
|
}, COMMAND_PRIORITY_HIGH)), i.listenersToRemove.add(n.registerCommand(CONTROLLED_TEXT_INSERTION_COMMAND, (t) => {
|
|
1487
1452
|
const o = $getSelection();
|
|
1488
1453
|
if (!$n(o, e)) return !1;
|
|
1489
|
-
if (
|
|
1454
|
+
if (nn(o)) return i.$clearHighlight(), !1;
|
|
1490
1455
|
if ($isRangeSelection(o)) {
|
|
1491
|
-
if (!
|
|
1456
|
+
if (!ct($findMatchingParent(o.anchor.getNode(), (e) => ct(e)))) return !1;
|
|
1492
1457
|
if ("string" == typeof t) {
|
|
1493
|
-
const l =
|
|
1494
|
-
if (l) return
|
|
1458
|
+
const l = Yn(n, o, e);
|
|
1459
|
+
if (l) return Xn(l, e, [$createTextNode(t)]), !0;
|
|
1495
1460
|
}
|
|
1496
1461
|
}
|
|
1497
1462
|
return !1;
|
|
@@ -1499,50 +1464,50 @@ function wn(e, t, n, o, l) {
|
|
|
1499
1464
|
const n = $getSelection();
|
|
1500
1465
|
if (!$isRangeSelection(n) || !n.isCollapsed() || !$n(n, e)) return !1;
|
|
1501
1466
|
const o = Bn(n.anchor.getNode());
|
|
1502
|
-
return !(null === o || !e.is(
|
|
1467
|
+
return !(null === o || !e.is(Dn(o))) && (Un(t), function(e, t) {
|
|
1503
1468
|
const n = "next" === t ? "getNextSibling" : "getPreviousSibling", o = "next" === t ? "getFirstChild" : "getLastChild", l = e[n]();
|
|
1504
1469
|
if ($isElementNode(l)) return l.selectEnd();
|
|
1505
|
-
const r = $findMatchingParent(e,
|
|
1506
|
-
null === r &&
|
|
1507
|
-
for (let e = r[n]();
|
|
1470
|
+
const r = $findMatchingParent(e, gt);
|
|
1471
|
+
null === r && ut(247);
|
|
1472
|
+
for (let e = r[n](); gt(e); e = e[n]()) {
|
|
1508
1473
|
const t = e[o]();
|
|
1509
1474
|
if ($isElementNode(t)) return t.selectEnd();
|
|
1510
1475
|
}
|
|
1511
|
-
const s = $findMatchingParent(r,
|
|
1512
|
-
null === s &&
|
|
1476
|
+
const s = $findMatchingParent(r, uo);
|
|
1477
|
+
null === s && ut(248);
|
|
1513
1478
|
"next" === t ? s.selectNext() : s.selectPrevious();
|
|
1514
1479
|
}(o, t.shiftKey ? "previous" : "next"), !0);
|
|
1515
1480
|
}, COMMAND_PRIORITY_HIGH)), i.listenersToRemove.add(n.registerCommand(FOCUS_COMMAND, (t) => e.isSelected(), COMMAND_PRIORITY_HIGH)), i.listenersToRemove.add(n.registerCommand(INSERT_PARAGRAPH_COMMAND, () => {
|
|
1516
1481
|
const t = $getSelection();
|
|
1517
1482
|
if (!$isRangeSelection(t) || !t.isCollapsed() || !$n(t, e)) return !1;
|
|
1518
|
-
const o =
|
|
1519
|
-
return !!o && (
|
|
1483
|
+
const o = Yn(n, t, e);
|
|
1484
|
+
return !!o && (Xn(o, e), !0);
|
|
1520
1485
|
}, COMMAND_PRIORITY_HIGH)), i;
|
|
1521
1486
|
}
|
|
1522
|
-
function
|
|
1487
|
+
function Nn(e, t) {
|
|
1523
1488
|
const n = $getSelection(), o = $getPreviousSelection(), l = e.getAndClearNextFocus();
|
|
1524
1489
|
if (null !== l) {
|
|
1525
1490
|
const { tableKey: t, focusCell: o } = l, r = e.observers.get(t);
|
|
1526
|
-
r ||
|
|
1491
|
+
r || ut(335, t);
|
|
1527
1492
|
const [s] = r;
|
|
1528
|
-
if (
|
|
1493
|
+
if (nn(n) && n.tableKey === s.tableNodeKey) return (o.x !== s.focusX || o.y !== s.focusY) && (s.$setFocusCellForSelection(o), !0);
|
|
1529
1494
|
if (null !== s.anchorCell && null !== s.anchorCellNodeKey && o.elem !== s.anchorCell.elem && null !== s.tableSelection) return s.$setFocusCellForSelection(o, !0), !0;
|
|
1530
1495
|
}
|
|
1531
1496
|
const r = e.getAndClearShouldCheckSelectionForTable();
|
|
1532
1497
|
if (r && $isRangeSelection(o) && $isRangeSelection(n) && n.isCollapsed()) {
|
|
1533
1498
|
const e = $getNodeByKey(r);
|
|
1534
|
-
if (
|
|
1499
|
+
if (uo(e)) {
|
|
1535
1500
|
const t = n.anchor.getNode(), o = e.getFirstChild(), l = Bn(t);
|
|
1536
|
-
if (null !== l &&
|
|
1501
|
+
if (null !== l && gt(o)) {
|
|
1537
1502
|
const t = o.getFirstChild();
|
|
1538
|
-
if (
|
|
1503
|
+
if (ct(t) && e.is($findMatchingParent(l, (n) => n.is(e) || n.is(t)))) return t.selectStart(), !0;
|
|
1539
1504
|
}
|
|
1540
1505
|
}
|
|
1541
1506
|
}
|
|
1542
|
-
|
|
1507
|
+
nn(n) && function(e, t) {
|
|
1543
1508
|
const n = mn(e), o = $getPreviousSelection();
|
|
1544
1509
|
if (!t.is(o)) return;
|
|
1545
|
-
const l =
|
|
1510
|
+
const l = hn(t.tableKey), r = getDOMSelection(n), s = r && getDOMSelectionPoints(r, e.getRootElement());
|
|
1546
1511
|
if (r && s && s.anchorNode && s.focusNode) {
|
|
1547
1512
|
const n = $getNearestNodeFromDOMNode(s.focusNode), o = n && !l.isParentOf(n), i = $getNearestNodeFromDOMNode(s.anchorNode), c = i && l.isParentOf(i);
|
|
1548
1513
|
if (o && c && r.rangeCount > 0) {
|
|
@@ -1551,29 +1516,29 @@ function yn(e, t) {
|
|
|
1551
1516
|
}
|
|
1552
1517
|
}
|
|
1553
1518
|
}(t, n), $isRangeSelection(n) && function(e, t) {
|
|
1554
|
-
const n = $getPreviousSelection(), { anchor: o, focus: l } = e, r = o.getNode(), s = l.getNode(), i = Bn(r), c = Bn(s), a = i ?
|
|
1519
|
+
const n = $getPreviousSelection(), { anchor: o, focus: l } = e, r = o.getNode(), s = l.getNode(), i = Bn(r), c = Bn(s), a = i ? Dn(i) : null, u = c ? Dn(c) : null, h = e.isBackward(), f = i && c && a && u && a.is(u), g = u && (!a || a.isParentOf(u)), p = a && (!u || u.isParentOf(a));
|
|
1555
1520
|
if (g) {
|
|
1556
|
-
const t = e.clone(), [n] =
|
|
1521
|
+
const t = e.clone(), [n] = It(u, c, c), o = n[0][0].cell, l = n[n.length - 1].at(-1).cell;
|
|
1557
1522
|
t.focus.set(h ? o.getKey() : l.getKey(), h ? 0 : l.getChildrenSize(), "element"), $setSelection(t);
|
|
1558
|
-
} else if (
|
|
1559
|
-
const t = e.clone(), [n] =
|
|
1523
|
+
} else if (p) {
|
|
1524
|
+
const t = e.clone(), [n] = It(a, i, i), o = n[0][0].cell, l = n[n.length - 1].at(-1).cell;
|
|
1560
1525
|
t.anchor.set(h ? l.getKey() : o.getKey(), h ? l.getChildrenSize() : 0, "element"), $setSelection(t);
|
|
1561
1526
|
} else if (f) {
|
|
1562
1527
|
const o = t.observers.get(a.getKey());
|
|
1563
|
-
o ||
|
|
1528
|
+
o || ut(335, a.getKey());
|
|
1564
1529
|
const [l] = o;
|
|
1565
|
-
if (i.is(c) || (l.$setAnchorCellForSelection(
|
|
1530
|
+
if (i.is(c) || (l.$setAnchorCellForSelection(qn(l, i)), l.$setFocusCellForSelection(qn(l, c), !0)), "touch" === l.pointerType && l.isSelecting && e.isCollapsed() && $isRangeSelection(n) && n.isCollapsed()) {
|
|
1566
1531
|
const e = Bn(n.anchor.getNode());
|
|
1567
|
-
e && !e.is(c) && (l.$setAnchorCellForSelection(
|
|
1532
|
+
e && !e.is(c) && (l.$setAnchorCellForSelection(qn(l, e)), l.$setFocusCellForSelection(qn(l, c), !0), l.pointerType = null);
|
|
1568
1533
|
}
|
|
1569
1534
|
}
|
|
1570
1535
|
}(n, e);
|
|
1571
|
-
for (const [n, o] of e.$getTableNodesAndObservers())
|
|
1536
|
+
for (const [n, o] of e.$getTableNodesAndObservers()) vn(t, n, o);
|
|
1572
1537
|
return !1;
|
|
1573
1538
|
}
|
|
1574
|
-
function
|
|
1539
|
+
function vn(e, t, n) {
|
|
1575
1540
|
const o = $getSelection(), l = $getPreviousSelection();
|
|
1576
|
-
o && !o.is(l) && (
|
|
1541
|
+
o && !o.is(l) && (nn(o) || nn(l)) && n.tableSelection && !n.tableSelection.is(l) && (nn(o) && o.tableKey === n.tableNodeKey ? n.$updateTableTableSelection(o) : !nn(o) && nn(l) && l.tableKey === n.tableNodeKey && n.$updateTableTableSelection(null)), n.hasHijackedSelectionStyles && !t.isSelected() ? function(e, t) {
|
|
1577
1542
|
t.$enableHighlightStyle(), On(t.table, (t) => {
|
|
1578
1543
|
const n = t.elem;
|
|
1579
1544
|
t.highlighted = !1, Hn(e, t), n.getAttribute("style") || n.removeAttribute("style");
|
|
@@ -1585,9 +1550,9 @@ function Nn(e, t, n) {
|
|
|
1585
1550
|
}(e, n);
|
|
1586
1551
|
}
|
|
1587
1552
|
function xn(e) {
|
|
1588
|
-
return e[
|
|
1553
|
+
return e[un] || null;
|
|
1589
1554
|
}
|
|
1590
|
-
function
|
|
1555
|
+
function Tn(e) {
|
|
1591
1556
|
let t = e;
|
|
1592
1557
|
for (; null != t;) {
|
|
1593
1558
|
const e = t.nodeName;
|
|
@@ -1599,7 +1564,7 @@ function vn(e) {
|
|
|
1599
1564
|
}
|
|
1600
1565
|
return null;
|
|
1601
1566
|
}
|
|
1602
|
-
function
|
|
1567
|
+
function Rn(e, t) {
|
|
1603
1568
|
if (!e.contains(t)) return null;
|
|
1604
1569
|
let n = null;
|
|
1605
1570
|
for (let o = t; null != o; o = o.parentNode) {
|
|
@@ -1609,13 +1574,13 @@ function Tn(e, t) {
|
|
|
1609
1574
|
}
|
|
1610
1575
|
return null;
|
|
1611
1576
|
}
|
|
1612
|
-
function
|
|
1577
|
+
function Fn(e, t) {
|
|
1613
1578
|
const n = [], o = {
|
|
1614
1579
|
columns: 0,
|
|
1615
1580
|
domRows: n,
|
|
1616
1581
|
rows: 0
|
|
1617
1582
|
};
|
|
1618
|
-
let l =
|
|
1583
|
+
let l = pn(e, t).querySelector("tr"), r = 0, s = 0;
|
|
1619
1584
|
for (n.length = 0; null != l;) {
|
|
1620
1585
|
const e = l.nodeName;
|
|
1621
1586
|
if ("TD" === e || "TH" === e) {
|
|
@@ -1650,7 +1615,7 @@ function Rn(e, t) {
|
|
|
1650
1615
|
}
|
|
1651
1616
|
return o.columns = r + 1, o.rows = s + 1, o;
|
|
1652
1617
|
}
|
|
1653
|
-
function
|
|
1618
|
+
function An(e, t, n) {
|
|
1654
1619
|
const o = new Set(n ? n.getNodes() : []);
|
|
1655
1620
|
On(t, (t, n) => {
|
|
1656
1621
|
const l = t.elem;
|
|
@@ -1672,13 +1637,13 @@ function On(e, t) {
|
|
|
1672
1637
|
}
|
|
1673
1638
|
}
|
|
1674
1639
|
}
|
|
1675
|
-
const
|
|
1640
|
+
const En = (e, t, n, o, l) => {
|
|
1676
1641
|
const r = "forward" === l;
|
|
1677
1642
|
switch (l) {
|
|
1678
1643
|
case "backward":
|
|
1679
|
-
case "forward": return n !== (r ? e.table.columns - 1 : 0) ?
|
|
1680
|
-
case "up": return 0 !== o ?
|
|
1681
|
-
case "down": return o !== e.table.rows - 1 ?
|
|
1644
|
+
case "forward": return n !== (r ? e.table.columns - 1 : 0) ? Ln(t.getCellNodeFromCordsOrThrow(n + (r ? 1 : -1), o, e.table), r) : o !== (r ? e.table.rows - 1 : 0) ? Ln(t.getCellNodeFromCordsOrThrow(r ? 0 : e.table.columns - 1, o + (r ? 1 : -1), e.table), r) : r ? t.selectNext() : t.selectPrevious(), !0;
|
|
1645
|
+
case "up": return 0 !== o ? Ln(t.getCellNodeFromCordsOrThrow(n, o - 1, e.table), !1) : t.selectPrevious(), !0;
|
|
1646
|
+
case "down": return o !== e.table.rows - 1 ? Ln(t.getCellNodeFromCordsOrThrow(n, o + 1, e.table), !0) : t.selectNext(), !0;
|
|
1682
1647
|
default: return !1;
|
|
1683
1648
|
}
|
|
1684
1649
|
};
|
|
@@ -1701,12 +1666,12 @@ function kn([e, t]) {
|
|
|
1701
1666
|
}
|
|
1702
1667
|
function Mn(e, t, [n, o]) {
|
|
1703
1668
|
const l = t[o], r = e[l];
|
|
1704
|
-
void 0 === r &&
|
|
1669
|
+
void 0 === r && ut(250, o, String(l));
|
|
1705
1670
|
const s = t[n], i = r[s];
|
|
1706
|
-
return void 0 === i &&
|
|
1671
|
+
return void 0 === i && ut(250, n, String(s)), i;
|
|
1707
1672
|
}
|
|
1708
|
-
function
|
|
1709
|
-
const r =
|
|
1673
|
+
function Wn(e, t, n, o, l) {
|
|
1674
|
+
const r = Yt(t, n, o), { topSpan: i, leftSpan: c, bottomSpan: a, rightSpan: u } = function(e, t) {
|
|
1710
1675
|
const { minColumn: n, maxColumn: o, minRow: l, maxRow: r } = t;
|
|
1711
1676
|
let s = 1, i = 1, c = 1, a = 1;
|
|
1712
1677
|
const u = e[l], h = e[r];
|
|
@@ -1720,51 +1685,51 @@ function En(e, t, n, o, l) {
|
|
|
1720
1685
|
};
|
|
1721
1686
|
}(t, r), [d, f] = kn(function(e, t) {
|
|
1722
1687
|
const n = Kn(e, t);
|
|
1723
|
-
return null === n &&
|
|
1688
|
+
return null === n && ut(249, t.cell.getKey()), n;
|
|
1724
1689
|
}(r, n));
|
|
1725
|
-
let g = r[d],
|
|
1726
|
-
"forward" === l ? g += "maxColumn" === d ? 1 : c : "backward" === l ? g -= "minColumn" === d ? 1 : u : "down" === l ?
|
|
1727
|
-
const
|
|
1728
|
-
if (void 0 ===
|
|
1729
|
-
const C =
|
|
1690
|
+
let g = r[d], p = r[f];
|
|
1691
|
+
"forward" === l ? g += "maxColumn" === d ? 1 : c : "backward" === l ? g -= "minColumn" === d ? 1 : u : "down" === l ? p += "maxRow" === f ? 1 : i : "up" === l && (p -= "minRow" === f ? 1 : a);
|
|
1692
|
+
const m = t[p];
|
|
1693
|
+
if (void 0 === m) return !1;
|
|
1694
|
+
const C = m[g];
|
|
1730
1695
|
if (void 0 === C) return !1;
|
|
1731
1696
|
const [_, S] = function(e, t, n) {
|
|
1732
|
-
const o =
|
|
1697
|
+
const o = Yt(e, t, n), l = Kn(o, t);
|
|
1733
1698
|
if (l) return [Mn(e, o, l), Mn(e, o, kn(l))];
|
|
1734
1699
|
const r = Kn(o, n);
|
|
1735
1700
|
if (r) return [Mn(e, o, kn(r)), Mn(e, o, r)];
|
|
1736
1701
|
const s = ["minColumn", "minRow"];
|
|
1737
1702
|
return [Mn(e, o, s), Mn(e, o, kn(s))];
|
|
1738
|
-
}(t, n, C), b =
|
|
1703
|
+
}(t, n, C), b = qn(e, _.cell), w = qn(e, S.cell);
|
|
1739
1704
|
return e.$setAnchorCellForSelection(b), e.$setFocusCellForSelection(w, !0), !0;
|
|
1740
1705
|
}
|
|
1741
1706
|
function $n(e, t) {
|
|
1742
|
-
if ($isRangeSelection(e) ||
|
|
1707
|
+
if ($isRangeSelection(e) || nn(e)) {
|
|
1743
1708
|
const n = t.isParentOf(e.anchor.getNode()), o = t.isParentOf(e.focus.getNode());
|
|
1744
1709
|
return n && o;
|
|
1745
1710
|
}
|
|
1746
1711
|
return !1;
|
|
1747
1712
|
}
|
|
1748
|
-
function
|
|
1713
|
+
function Ln(e, t) {
|
|
1749
1714
|
t ? e.selectStart() : e.selectEnd();
|
|
1750
1715
|
}
|
|
1751
1716
|
function zn(e, t) {
|
|
1752
1717
|
const o = t.elem, l = e._config.theme;
|
|
1753
|
-
|
|
1718
|
+
ct($getNearestNodeFromDOMNode(o)) || ut(131), addClassNamesToElement(o, l.tableCellSelected);
|
|
1754
1719
|
}
|
|
1755
1720
|
function Hn(e, t) {
|
|
1756
1721
|
const n = t.elem;
|
|
1757
|
-
|
|
1722
|
+
ct($getNearestNodeFromDOMNode(n)) || ut(131);
|
|
1758
1723
|
const o = e._config.theme;
|
|
1759
1724
|
removeClassNamesFromElement(n, o.tableCellSelected);
|
|
1760
1725
|
}
|
|
1761
1726
|
function Bn(e) {
|
|
1762
|
-
const t = $findMatchingParent(e,
|
|
1763
|
-
return
|
|
1727
|
+
const t = $findMatchingParent(e, ct);
|
|
1728
|
+
return ct(t) ? t : null;
|
|
1764
1729
|
}
|
|
1765
|
-
function
|
|
1766
|
-
const t = $findMatchingParent(e,
|
|
1767
|
-
return
|
|
1730
|
+
function Dn(e) {
|
|
1731
|
+
const t = $findMatchingParent(e, uo);
|
|
1732
|
+
return uo(t) ? t : null;
|
|
1768
1733
|
}
|
|
1769
1734
|
function Pn(e, t, n, o, l, r, s) {
|
|
1770
1735
|
const i = $caretFromPoint(n.focus, l ? "previous" : "next");
|
|
@@ -1775,28 +1740,28 @@ function Pn(e, t, n, o, l, r, s) {
|
|
|
1775
1740
|
c = e;
|
|
1776
1741
|
}
|
|
1777
1742
|
const a = c.getParentAtCaret();
|
|
1778
|
-
if (!
|
|
1743
|
+
if (!ct(a)) return !1;
|
|
1779
1744
|
const u = a, h = function(e) {
|
|
1780
1745
|
for (const t of $extendCaretToRange(e).iterNodeCarets("root")) {
|
|
1781
1746
|
const { origin: n } = t;
|
|
1782
|
-
if (
|
|
1747
|
+
if (ct(n)) {
|
|
1783
1748
|
if ($isChildCaret(t)) return $getChildCaret(n, e.direction);
|
|
1784
|
-
} else if (!
|
|
1749
|
+
} else if (!gt(n)) break;
|
|
1785
1750
|
}
|
|
1786
1751
|
return null;
|
|
1787
|
-
}($getSiblingCaret(u, c.direction)), d = $findMatchingParent(u,
|
|
1752
|
+
}($getSiblingCaret(u, c.direction)), d = $findMatchingParent(u, uo);
|
|
1788
1753
|
if (!d || !d.is(r)) return !1;
|
|
1789
|
-
const g = e.getElementByKey(u.getKey()),
|
|
1790
|
-
if (!g || !
|
|
1791
|
-
if (s.table =
|
|
1792
|
-
const t =
|
|
1754
|
+
const g = e.getElementByKey(u.getKey()), p = Tn(g);
|
|
1755
|
+
if (!g || !p) return !1;
|
|
1756
|
+
if (s.table = io(e, d), h) if ("extend" === o) {
|
|
1757
|
+
const t = Tn(e.getElementByKey(h.origin.getKey()));
|
|
1793
1758
|
if (!t) return !1;
|
|
1794
|
-
s.$setAnchorCellForSelection(
|
|
1759
|
+
s.$setAnchorCellForSelection(p), s.$setFocusCellForSelection(t, !0);
|
|
1795
1760
|
} else {
|
|
1796
1761
|
const e = $normalizeCaret(h);
|
|
1797
1762
|
$setPointFromCaret(n.anchor, e), $setPointFromCaret(n.focus, e);
|
|
1798
1763
|
}
|
|
1799
|
-
else if ("extend" === o) s.$setAnchorCellForSelection(
|
|
1764
|
+
else if ("extend" === o) s.$setAnchorCellForSelection(p), s.$setFocusCellForSelection(p, !0);
|
|
1800
1765
|
else {
|
|
1801
1766
|
const e = function(e) {
|
|
1802
1767
|
const t = $getAdjacentChildCaret(e);
|
|
@@ -1804,9 +1769,9 @@ function Pn(e, t, n, o, l, r, s) {
|
|
|
1804
1769
|
}($getSiblingCaret(d, i.direction));
|
|
1805
1770
|
$setPointFromCaret(n.anchor, e), $setPointFromCaret(n.focus, e);
|
|
1806
1771
|
}
|
|
1807
|
-
return
|
|
1772
|
+
return Un(t), !0;
|
|
1808
1773
|
}
|
|
1809
|
-
function
|
|
1774
|
+
function In(e, t, n, o, l, s) {
|
|
1810
1775
|
if (("up" === n || "down" === n) && function(e) {
|
|
1811
1776
|
const t = e.getRootElement();
|
|
1812
1777
|
if (!t) return !1;
|
|
@@ -1826,13 +1791,13 @@ function Dn(e, t, n, o, l, s) {
|
|
|
1826
1791
|
}(i.focus.getNode());
|
|
1827
1792
|
if (!e) return !1;
|
|
1828
1793
|
const n = e.getPreviousSibling();
|
|
1829
|
-
return !!
|
|
1794
|
+
return !!uo(n) && (Un(t), t.shiftKey ? i.focus.set(n.getParentOrThrow().getKey(), n.getIndexWithinParent(), "element") : n.selectEnd(), !0);
|
|
1830
1795
|
}
|
|
1831
1796
|
if (t.shiftKey && ("up" === n || "down" === n)) {
|
|
1832
1797
|
const e = i.focus.getNode();
|
|
1833
1798
|
if (!i.isCollapsed() && ("up" === n && !i.isBackward() || "down" === n && i.isBackward())) {
|
|
1834
|
-
let l = $findMatchingParent(e, (e) =>
|
|
1835
|
-
if (
|
|
1799
|
+
let l = $findMatchingParent(e, (e) => uo(e));
|
|
1800
|
+
if (ct(l) && (l = $findMatchingParent(l, uo)), l !== o) return !1;
|
|
1836
1801
|
if (!l) return !1;
|
|
1837
1802
|
const s = "down" === n ? l.getNextSibling() : l.getPreviousSibling();
|
|
1838
1803
|
if (!s) return !1;
|
|
@@ -1841,15 +1806,15 @@ function Dn(e, t, n, o, l, s) {
|
|
|
1841
1806
|
let a = s;
|
|
1842
1807
|
if ("up" === n && $isElementNode(s)) a = s.getLastChild() || s, c = $isTextNode(a) ? a.getTextContentSize() : 0;
|
|
1843
1808
|
const u = i.clone();
|
|
1844
|
-
return u.focus.set(a.getKey(), c, $isTextNode(a) ? "text" : "element"), $setSelection(u),
|
|
1809
|
+
return u.focus.set(a.getKey(), c, $isTextNode(a) ? "text" : "element"), $setSelection(u), Un(t), !0;
|
|
1845
1810
|
}
|
|
1846
1811
|
if ($isRootOrShadowRoot(e)) {
|
|
1847
1812
|
const e = "up" === n ? i.getNodes()[i.getNodes().length - 1] : i.getNodes()[0];
|
|
1848
1813
|
if (e) {
|
|
1849
|
-
if (null !==
|
|
1814
|
+
if (null !== Cn(o, e)) {
|
|
1850
1815
|
const e = o.getFirstDescendant(), t = o.getLastDescendant();
|
|
1851
1816
|
if (!e || !t) return !1;
|
|
1852
|
-
const [n] =
|
|
1817
|
+
const [n] = Xt(e), [r] = Xt(t), s = o.getCordsFromCellNode(n, l.table), i = o.getCordsFromCellNode(r, l.table), c = o.getDOMCellFromCordsOrThrow(s.x, s.y, l.table), a = o.getDOMCellFromCordsOrThrow(i.x, i.y, l.table);
|
|
1853
1818
|
return l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(a, !0), !0;
|
|
1854
1819
|
}
|
|
1855
1820
|
}
|
|
@@ -1857,49 +1822,49 @@ function Dn(e, t, n, o, l, s) {
|
|
|
1857
1822
|
}
|
|
1858
1823
|
{
|
|
1859
1824
|
let o = $findMatchingParent(e, (e) => $isElementNode(e) && !e.isInline());
|
|
1860
|
-
if (
|
|
1825
|
+
if (ct(o) && (o = $findMatchingParent(o, uo)), !o) return !1;
|
|
1861
1826
|
const r = "down" === n ? o.getNextSibling() : o.getPreviousSibling();
|
|
1862
|
-
if (
|
|
1827
|
+
if (uo(r) && l.tableNodeKey === r.getKey()) {
|
|
1863
1828
|
const e = r.getFirstDescendant(), o = r.getLastDescendant();
|
|
1864
1829
|
if (!e || !o) return !1;
|
|
1865
|
-
const [l] =
|
|
1866
|
-
return c.focus.set(("up" === n ? l : s).getKey(), "up" === n ? 0 : s.getChildrenSize(), "element"),
|
|
1830
|
+
const [l] = Xt(e), [s] = Xt(o), c = i.clone();
|
|
1831
|
+
return c.focus.set(("up" === n ? l : s).getKey(), "up" === n ? 0 : s.getChildrenSize(), "element"), Un(t), $setSelection(c), !0;
|
|
1867
1832
|
}
|
|
1868
1833
|
}
|
|
1869
1834
|
}
|
|
1870
1835
|
}
|
|
1871
|
-
return "down" === n &&
|
|
1836
|
+
return "down" === n && oo(e) && s.setShouldCheckSelectionForTable(o.getKey()), !1;
|
|
1872
1837
|
}
|
|
1873
1838
|
if ($isRangeSelection(i)) {
|
|
1874
1839
|
if ("backward" === n || "forward" === n) return Pn(e, t, i, t.shiftKey ? "extend" : "move", "backward" === n, o, l);
|
|
1875
1840
|
if (i.isCollapsed()) {
|
|
1876
|
-
const { anchor: r, focus: c } = i, a = $findMatchingParent(r.getNode(),
|
|
1877
|
-
if (!
|
|
1878
|
-
const h =
|
|
1841
|
+
const { anchor: r, focus: c } = i, a = $findMatchingParent(r.getNode(), ct), u = $findMatchingParent(c.getNode(), ct);
|
|
1842
|
+
if (!ct(a) || !a.is(u)) return !1;
|
|
1843
|
+
const h = Dn(a);
|
|
1879
1844
|
if (h !== o && null != h) {
|
|
1880
|
-
const o =
|
|
1881
|
-
if (null != o) return l.table =
|
|
1845
|
+
const o = pn(h, e.getElementByKey(h.getKey()));
|
|
1846
|
+
if (null != o) return l.table = Fn(h, o), In(e, t, n, h, l, s);
|
|
1882
1847
|
}
|
|
1883
1848
|
const d = e.getElementByKey(a.__key), g = e.getElementByKey(r.key);
|
|
1884
1849
|
if (null == g || null == d) return !1;
|
|
1885
|
-
let
|
|
1886
|
-
if ("element" === r.type)
|
|
1850
|
+
let p;
|
|
1851
|
+
if ("element" === r.type) p = g.getBoundingClientRect();
|
|
1887
1852
|
else {
|
|
1888
1853
|
const t = getDOMSelection(mn(e));
|
|
1889
1854
|
if (null === t || 0 === t.rangeCount) return !1;
|
|
1890
1855
|
const n = getDOMSelectionRange(t, e.getRootElement());
|
|
1891
1856
|
if (null === n) return !1;
|
|
1892
|
-
|
|
1857
|
+
p = n.getBoundingClientRect();
|
|
1893
1858
|
}
|
|
1894
|
-
const
|
|
1895
|
-
if (null ==
|
|
1896
|
-
const C = e.getElementByKey(
|
|
1859
|
+
const m = "up" === n ? a.getFirstChild() : a.getLastChild();
|
|
1860
|
+
if (null == m) return !1;
|
|
1861
|
+
const C = e.getElementByKey(m.__key);
|
|
1897
1862
|
if (null == C) return !1;
|
|
1898
1863
|
const _ = C.getBoundingClientRect();
|
|
1899
|
-
if ("up" === n ? _.top >
|
|
1900
|
-
|
|
1864
|
+
if ("up" === n ? _.top > p.top - p.height : p.bottom + p.height > _.bottom) {
|
|
1865
|
+
Un(t);
|
|
1901
1866
|
const e = o.getCordsFromCellNode(a, l.table);
|
|
1902
|
-
if (!t.shiftKey) return
|
|
1867
|
+
if (!t.shiftKey) return En(l, o, e.x, e.y, n);
|
|
1903
1868
|
{
|
|
1904
1869
|
const t = o.getDOMCellFromCordsOrThrow(e.x, e.y, l.table);
|
|
1905
1870
|
l.$setAnchorCellForSelection(t), l.$setFocusCellForSelection(t, !0);
|
|
@@ -1907,62 +1872,66 @@ function Dn(e, t, n, o, l, s) {
|
|
|
1907
1872
|
return !0;
|
|
1908
1873
|
}
|
|
1909
1874
|
}
|
|
1910
|
-
} else if (
|
|
1875
|
+
} else if (nn(i)) {
|
|
1911
1876
|
const { anchor: r, focus: s, tableKey: c } = i;
|
|
1912
1877
|
if (c !== o.getKey()) return !1;
|
|
1913
|
-
const a = $findMatchingParent(r.getNode(),
|
|
1914
|
-
|
|
1915
|
-
const d =
|
|
1916
|
-
if (!
|
|
1878
|
+
const a = $findMatchingParent(r.getNode(), ct), u = $findMatchingParent(s.getNode(), ct), [h] = i.getNodes();
|
|
1879
|
+
uo(h) || ut(251);
|
|
1880
|
+
const d = pn(h, e.getElementByKey(h.getKey()));
|
|
1881
|
+
if (!ct(a) || !ct(u) || !uo(h) || null == d) return !1;
|
|
1917
1882
|
l.$updateTableTableSelection(i);
|
|
1918
|
-
const g =
|
|
1919
|
-
if (l.$setAnchorCellForSelection(
|
|
1920
|
-
const [e, t, r] =
|
|
1921
|
-
return
|
|
1883
|
+
const g = Fn(h, d), p = o.getCordsFromCellNode(a, g), m = o.getDOMCellFromCordsOrThrow(p.x, p.y, g);
|
|
1884
|
+
if (l.$setAnchorCellForSelection(m), Un(t), t.shiftKey) {
|
|
1885
|
+
const [e, t, r] = It(o, a, u);
|
|
1886
|
+
return Wn(l, e, t, r, n);
|
|
1922
1887
|
}
|
|
1923
1888
|
return u.selectEnd(), !0;
|
|
1924
1889
|
}
|
|
1925
1890
|
return !1;
|
|
1926
1891
|
}
|
|
1927
|
-
function
|
|
1892
|
+
function Un(e) {
|
|
1928
1893
|
e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation();
|
|
1929
1894
|
}
|
|
1930
|
-
function
|
|
1895
|
+
function Xn(e, t, n) {
|
|
1931
1896
|
const o = $createParagraphNode();
|
|
1932
1897
|
"first" === e ? t.insertBefore(o) : t.insertAfter(o), o.append(...n || []), o.selectEnd();
|
|
1933
1898
|
}
|
|
1934
|
-
function
|
|
1899
|
+
function Yn(e, t, n) {
|
|
1935
1900
|
const o = n.getParent();
|
|
1936
1901
|
if (!o) return;
|
|
1937
1902
|
const l = getDOMSelection(mn(e));
|
|
1938
1903
|
if (!l) return;
|
|
1939
|
-
const r = getDOMSelectionPoints(l, e.getRootElement()).anchorNode, s = e.getElementByKey(o.getKey()), i =
|
|
1904
|
+
const r = getDOMSelectionPoints(l, e.getRootElement()).anchorNode, s = e.getElementByKey(o.getKey()), i = pn(n, e.getElementByKey(n.getKey()));
|
|
1940
1905
|
if (!r || !s || !i || !s.contains(r) || i.contains(r)) return;
|
|
1941
|
-
const c = $findMatchingParent(t.anchor.getNode(), (e) =>
|
|
1906
|
+
const c = $findMatchingParent(t.anchor.getNode(), (e) => ct(e));
|
|
1942
1907
|
if (!c) return;
|
|
1943
|
-
const a = $findMatchingParent(c, (e) =>
|
|
1944
|
-
if (!
|
|
1945
|
-
const [u, h] =
|
|
1908
|
+
const a = $findMatchingParent(c, (e) => uo(e));
|
|
1909
|
+
if (!uo(a) || !a.is(n)) return;
|
|
1910
|
+
const [u, h] = It(n, c, c), d = u[0][0], g = u[u.length - 1][u[0].length - 1], { startRow: p, startColumn: m } = h, C = p === d.startRow && m === d.startColumn, _ = p === g.startRow && m === g.startColumn;
|
|
1946
1911
|
return C ? "first" : _ ? "last" : void 0;
|
|
1947
1912
|
}
|
|
1948
|
-
function
|
|
1913
|
+
function qn(e, t) {
|
|
1949
1914
|
const { tableNode: n } = e.$lookup(), o = n.getCordsFromCellNode(t, e.table);
|
|
1950
1915
|
return n.getDOMCellFromCordsOrThrow(o.x, o.y, e.table);
|
|
1951
1916
|
}
|
|
1952
1917
|
function Jn(e, t, n) {
|
|
1953
|
-
return
|
|
1918
|
+
return Cn(e, $getNearestNodeFromDOMNode(t, n));
|
|
1954
1919
|
}
|
|
1955
|
-
function
|
|
1956
|
-
|
|
1957
|
-
|
|
1920
|
+
function jn(e) {
|
|
1921
|
+
return isHTMLElement(e) && "DIV" === e.nodeName;
|
|
1922
|
+
}
|
|
1923
|
+
function Vn(e, n, o) {
|
|
1924
|
+
let l = e.querySelector(":scope > colgroup");
|
|
1925
|
+
if (!o) return void (l && l.remove());
|
|
1926
|
+
l || (l = $getDocument().createElement("colgroup"), setDOMUnmanaged(l), e.insertBefore(l, e.firstChild));
|
|
1958
1927
|
const r = [];
|
|
1959
1928
|
for (let e = 0; e < n; e++) {
|
|
1960
|
-
const n = $getDocument().createElement("col"), l = o
|
|
1929
|
+
const n = $getDocument().createElement("col"), l = o[e];
|
|
1961
1930
|
l && (n.style.width = `${l}px`), r.push(n);
|
|
1962
1931
|
}
|
|
1963
1932
|
l.replaceChildren(...r);
|
|
1964
1933
|
}
|
|
1965
|
-
function
|
|
1934
|
+
function Gn(e, t, o) {
|
|
1966
1935
|
if (!t.theme.tableAlignment) return;
|
|
1967
1936
|
const l = [], r = [];
|
|
1968
1937
|
for (const e of ["center", "right"]) {
|
|
@@ -1971,20 +1940,77 @@ function jn(e, t, o) {
|
|
|
1971
1940
|
}
|
|
1972
1941
|
removeClassNamesFromElement(e, ...l), addClassNamesToElement(e, ...r);
|
|
1973
1942
|
}
|
|
1974
|
-
const
|
|
1975
|
-
function
|
|
1976
|
-
|
|
1943
|
+
const Qn = /* @__PURE__ */ new WeakSet();
|
|
1944
|
+
function Zn(e) {
|
|
1945
|
+
const { scrollable: t, scrollbar: n, tableElement: o } = e;
|
|
1946
|
+
if (0 === n.classList.length && 0 === function(e) {
|
|
1947
|
+
const t = e.style.display;
|
|
1948
|
+
e.style.display = "";
|
|
1949
|
+
const n = e.offsetHeight - e.clientHeight;
|
|
1950
|
+
return e.style.display = t, n;
|
|
1951
|
+
}(n)) return Qn.add(n), n.style.display = "none", t.style.scrollbarWidth = "auto", () => {};
|
|
1952
|
+
const l = () => {
|
|
1953
|
+
n.scrollLeft !== t.scrollLeft && (n.scrollLeft = t.scrollLeft);
|
|
1954
|
+
}, r = () => {
|
|
1955
|
+
t.scrollLeft !== n.scrollLeft && (t.scrollLeft = n.scrollLeft);
|
|
1956
|
+
};
|
|
1957
|
+
t.addEventListener("scroll", l, { passive: !0 }), n.addEventListener("scroll", r, { passive: !0 });
|
|
1958
|
+
let s = null;
|
|
1959
|
+
"undefined" != typeof ResizeObserver && (s = new ResizeObserver(() => {
|
|
1960
|
+
eo(t, n);
|
|
1961
|
+
}), s.observe(t), s.observe(o));
|
|
1962
|
+
return eo(t, n), () => {
|
|
1963
|
+
t.removeEventListener("scroll", l), n.removeEventListener("scroll", r), s && s.disconnect();
|
|
1964
|
+
};
|
|
1977
1965
|
}
|
|
1978
|
-
function
|
|
1979
|
-
|
|
1966
|
+
function eo(e, t) {
|
|
1967
|
+
if (Qn.has(t)) return;
|
|
1968
|
+
const n = t.firstElementChild;
|
|
1969
|
+
if (!n || !isHTMLElement(n) || !e.isConnected) return;
|
|
1970
|
+
const l = e.ownerDocument.defaultView;
|
|
1971
|
+
if (!l) return void (t.style.display = "none");
|
|
1972
|
+
const r = l.getComputedStyle(e).overflowX, s = "auto" === r || "scroll" === r, i = e.scrollWidth, c = e.clientWidth, a = i + "px";
|
|
1973
|
+
n.style.width !== a && (n.style.width = a);
|
|
1974
|
+
const u = s && i > c;
|
|
1975
|
+
t.style.display = u ? "" : "none";
|
|
1980
1976
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1977
|
+
function to(e) {
|
|
1978
|
+
if (!e.hasAttribute("data-lexical-sticky-scrollbar")) return null;
|
|
1979
|
+
const t = e.firstElementChild;
|
|
1980
|
+
if (!jn(t)) return null;
|
|
1981
|
+
const n = t.querySelector(":scope > table");
|
|
1982
|
+
if (!gn(n)) return null;
|
|
1983
|
+
const o = t.nextElementSibling;
|
|
1984
|
+
return jn(o) ? {
|
|
1985
|
+
scrollable: t,
|
|
1986
|
+
scrollbar: o,
|
|
1987
|
+
tableElement: n
|
|
1988
|
+
} : null;
|
|
1989
|
+
}
|
|
1990
|
+
const no = /* @__PURE__ */ new WeakSet();
|
|
1991
|
+
function oo(e = $getEditor()) {
|
|
1992
|
+
return no.has(e);
|
|
1993
|
+
}
|
|
1994
|
+
function lo(e = $getEditor()) {
|
|
1995
|
+
const t = getPeerDependencyFromEditor(e, "@lexical/table/Table");
|
|
1996
|
+
return !!t && t.output.hasStickyScrollbar.peek() && t.output.hasHorizontalScroll.peek();
|
|
1997
|
+
}
|
|
1998
|
+
function ro(e, t) {
|
|
1999
|
+
t ? no.add(e) : no.delete(e);
|
|
2000
|
+
}
|
|
2001
|
+
var so = class extends ElementNode {
|
|
2002
|
+
__rowStriping = !1;
|
|
2003
|
+
__frozenColumnCount = 0;
|
|
2004
|
+
__frozenRowCount = 0;
|
|
2005
|
+
__colWidths = void 0;
|
|
2006
|
+
$config() {
|
|
2007
|
+
return this.config("table", {
|
|
2008
|
+
extends: ElementNode,
|
|
2009
|
+
importDOM: { table: () => ({
|
|
2010
|
+
conversion: co,
|
|
2011
|
+
priority: 1
|
|
2012
|
+
}) }
|
|
2013
|
+
});
|
|
1988
2014
|
}
|
|
1989
2015
|
getColWidths() {
|
|
1990
2016
|
return this.getLatest().__colWidths;
|
|
@@ -1993,27 +2019,12 @@ var Zn = class Zn extends ElementNode {
|
|
|
1993
2019
|
const t = this.getWritable();
|
|
1994
2020
|
return t.__colWidths = e, t;
|
|
1995
2021
|
}
|
|
1996
|
-
static clone(e) {
|
|
1997
|
-
return new Zn(e.__key);
|
|
1998
|
-
}
|
|
1999
2022
|
afterCloneFrom(e) {
|
|
2000
2023
|
super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping, this.__frozenColumnCount = e.__frozenColumnCount, this.__frozenRowCount = e.__frozenRowCount;
|
|
2001
2024
|
}
|
|
2002
|
-
static importDOM() {
|
|
2003
|
-
return { table: (e) => ({
|
|
2004
|
-
conversion: to,
|
|
2005
|
-
priority: 1
|
|
2006
|
-
}) };
|
|
2007
|
-
}
|
|
2008
|
-
static importJSON(e) {
|
|
2009
|
-
return no().updateFromJSON(e);
|
|
2010
|
-
}
|
|
2011
2025
|
updateFromJSON(e) {
|
|
2012
2026
|
return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setFrozenColumns(e.frozenColumnCount || 0).setFrozenRows(e.frozenRowCount || 0).setColWidths(e.colWidths);
|
|
2013
2027
|
}
|
|
2014
|
-
constructor(e) {
|
|
2015
|
-
super(e), this.__rowStriping = !1, this.__frozenColumnCount = 0, this.__frozenRowCount = 0, this.__colWidths = void 0;
|
|
2016
|
-
}
|
|
2017
2028
|
exportJSON() {
|
|
2018
2029
|
return {
|
|
2019
2030
|
...super.exportJSON(),
|
|
@@ -2027,16 +2038,31 @@ var Zn = class Zn extends ElementNode {
|
|
|
2027
2038
|
return "html" === n;
|
|
2028
2039
|
}
|
|
2029
2040
|
getDOMSlot(e) {
|
|
2030
|
-
const t =
|
|
2031
|
-
return
|
|
2041
|
+
const t = gn(e) ? e : e.querySelector("table");
|
|
2042
|
+
return gn(t) || ut(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector(":scope > colgroup"));
|
|
2032
2043
|
}
|
|
2033
2044
|
createDOM(e, o) {
|
|
2034
2045
|
const l = $getDocument().createElement("table");
|
|
2035
2046
|
this.__style && setDOMStyleFromCSS(l.style, this.__style);
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2047
|
+
if (this.getColWidths()) {
|
|
2048
|
+
const e = $getDocument().createElement("colgroup");
|
|
2049
|
+
l.appendChild(e), setDOMUnmanaged(e);
|
|
2050
|
+
}
|
|
2051
|
+
if (addClassNamesToElement(l, e.theme.table), this.updateTableElement(null, l, e), oo(o)) {
|
|
2052
|
+
const r = lo(o), s = function(e, o, l) {
|
|
2053
|
+
const r = $getDocument().createElement("div"), s = o.theme.tableScrollableWrapper;
|
|
2054
|
+
return s ? addClassNamesToElement(r, s) : r.style.overflowX = "auto", l && (r.style.scrollbarWidth = "none"), r.appendChild(e), r;
|
|
2055
|
+
}(l, e, r);
|
|
2056
|
+
if (this.updateTableWrapper(null, s, l, e), r) {
|
|
2057
|
+
const o = function(e) {
|
|
2058
|
+
const o = $getDocument(), l = o.createElement("div"), r = e.theme.tableStickyScrollbar;
|
|
2059
|
+
r ? addClassNamesToElement(l, r) : (l.style.position = "sticky", l.style.bottom = "0", l.style.overflowX = "scroll", l.style.overflowY = "hidden"), l.style.display = "none", l.setAttribute("aria-hidden", "true"), l.tabIndex = -1;
|
|
2060
|
+
const s = o.createElement("div");
|
|
2061
|
+
return s.style.height = "1px", s.style.width = "0px", l.appendChild(s), l;
|
|
2062
|
+
}(e), l = $getDocument().createElement("div");
|
|
2063
|
+
return l.setAttribute("data-lexical-sticky-scrollbar", "true"), l.appendChild(s), l.appendChild(o), setDOMUnmanaged(o), l;
|
|
2064
|
+
}
|
|
2065
|
+
return s;
|
|
2040
2066
|
}
|
|
2041
2067
|
return l;
|
|
2042
2068
|
}
|
|
@@ -2052,25 +2078,30 @@ var Zn = class Zn extends ElementNode {
|
|
|
2052
2078
|
o ? (addClassNamesToElement(e, t.theme.tableRowStriping), e.setAttribute("data-lexical-row-striping", "true")) : (removeClassNamesFromElement(e, t.theme.tableRowStriping), e.removeAttribute("data-lexical-row-striping"));
|
|
2053
2079
|
}(t, o, this.__rowStriping);
|
|
2054
2080
|
const l = e ? e.getColumnCount() : 0, r = e ? e.__colWidths : void 0;
|
|
2055
|
-
this.getColumnCount() === l && this.getColWidths() === r ||
|
|
2081
|
+
this.getColumnCount() === l && this.getColWidths() === r || Vn(t, this.getColumnCount(), this.getColWidths()), Gn(t, o, this.getFormatType());
|
|
2056
2082
|
}
|
|
2057
2083
|
updateDOM(e, t, n) {
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2060
|
-
|
|
2084
|
+
const o = pn(this, t);
|
|
2085
|
+
if (t === o === oo()) return !0;
|
|
2086
|
+
if (jn(t)) {
|
|
2087
|
+
if (t.hasAttribute("data-lexical-sticky-scrollbar") !== lo()) return !0;
|
|
2088
|
+
const l = o.parentElement;
|
|
2089
|
+
jn(l) && this.updateTableWrapper(e, l, o, n);
|
|
2090
|
+
}
|
|
2091
|
+
return this.updateTableElement(e, o, n), !1;
|
|
2061
2092
|
}
|
|
2062
2093
|
scaleDOMColWidths(e, t) {
|
|
2063
2094
|
const n = this.getColWidths();
|
|
2064
2095
|
if (!n) return;
|
|
2065
|
-
|
|
2096
|
+
Vn(pn(this, e), this.getColumnCount(), n.map((e) => e * t));
|
|
2066
2097
|
}
|
|
2067
2098
|
exportDOM(e) {
|
|
2068
2099
|
const n = super.exportDOM(e), { element: l } = n;
|
|
2069
2100
|
return {
|
|
2070
2101
|
after: (l) => {
|
|
2071
|
-
if (n.after && (l = n.after(l)), !
|
|
2072
|
-
|
|
2073
|
-
const [r] =
|
|
2102
|
+
if (n.after && (l = n.after(l)), !gn(l) && isHTMLElement(l) && (l = l.querySelector("table")), !gn(l)) return null;
|
|
2103
|
+
Gn(l, e._config, this.getFormatType());
|
|
2104
|
+
const [r] = Ut(this, null, null), s = /* @__PURE__ */ new Map();
|
|
2074
2105
|
for (const e of r) for (const t of e) {
|
|
2075
2106
|
const e = t.cell.getKey();
|
|
2076
2107
|
s.has(e) || s.set(e, {
|
|
@@ -2102,7 +2133,7 @@ var Zn = class Zn extends ElementNode {
|
|
|
2102
2133
|
}
|
|
2103
2134
|
return l;
|
|
2104
2135
|
},
|
|
2105
|
-
element: !
|
|
2136
|
+
element: !gn(l) && isHTMLElement(l) ? l.querySelector("table") : l
|
|
2106
2137
|
};
|
|
2107
2138
|
}
|
|
2108
2139
|
canBeEmpty() {
|
|
@@ -2142,7 +2173,7 @@ var Zn = class Zn extends ElementNode {
|
|
|
2142
2173
|
const o = this.getDOMCellFromCords(e, t, n);
|
|
2143
2174
|
if (null == o) return null;
|
|
2144
2175
|
const l = $getNearestNodeFromDOMNode(o.elem);
|
|
2145
|
-
return
|
|
2176
|
+
return ct(l) ? l : null;
|
|
2146
2177
|
}
|
|
2147
2178
|
getCellNodeFromCordsOrThrow(e, t, n) {
|
|
2148
2179
|
const o = this.getCellNodeFromCords(e, t, n);
|
|
@@ -2178,26 +2209,26 @@ var Zn = class Zn extends ElementNode {
|
|
|
2178
2209
|
}
|
|
2179
2210
|
getColumnCount() {
|
|
2180
2211
|
const e = this.getFirstChild();
|
|
2181
|
-
if (!
|
|
2212
|
+
if (!gt(e)) return 0;
|
|
2182
2213
|
let t = 0;
|
|
2183
2214
|
return e.getChildren().forEach((e) => {
|
|
2184
|
-
|
|
2215
|
+
ct(e) && (t += e.getColSpan());
|
|
2185
2216
|
}), t;
|
|
2186
2217
|
}
|
|
2187
2218
|
};
|
|
2188
|
-
function
|
|
2219
|
+
function io(e, t) {
|
|
2189
2220
|
const n = e.getElementByKey(t.getKey());
|
|
2190
|
-
return null === n &&
|
|
2221
|
+
return null === n && ut(230), Fn(t, n);
|
|
2191
2222
|
}
|
|
2192
|
-
function
|
|
2193
|
-
const t =
|
|
2223
|
+
function co(e) {
|
|
2224
|
+
const t = ao();
|
|
2194
2225
|
e.hasAttribute("data-lexical-row-striping") && t.setRowStriping(!0), e.hasAttribute("data-lexical-frozen-column") && t.setFrozenColumns(1), e.hasAttribute("data-lexical-frozen-row") && t.setFrozenRows(1);
|
|
2195
2226
|
const n = e.querySelector(":scope > colgroup");
|
|
2196
2227
|
if (n) {
|
|
2197
2228
|
let e = [];
|
|
2198
2229
|
for (const t of n.querySelectorAll(":scope > col")) {
|
|
2199
2230
|
let n = t.style.width || "";
|
|
2200
|
-
if (!
|
|
2231
|
+
if (!nt.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
|
|
2201
2232
|
e = void 0;
|
|
2202
2233
|
break;
|
|
2203
2234
|
}
|
|
@@ -2206,32 +2237,32 @@ function to(e) {
|
|
|
2206
2237
|
e && t.setColWidths(e);
|
|
2207
2238
|
}
|
|
2208
2239
|
return {
|
|
2209
|
-
after: (e) => $descendantsMatching(e,
|
|
2240
|
+
after: (e) => $descendantsMatching(e, gt),
|
|
2210
2241
|
node: t
|
|
2211
2242
|
};
|
|
2212
2243
|
}
|
|
2213
|
-
function
|
|
2214
|
-
return $applyNodeReplacement(new
|
|
2244
|
+
function ao() {
|
|
2245
|
+
return $applyNodeReplacement(new so());
|
|
2215
2246
|
}
|
|
2216
|
-
function
|
|
2217
|
-
return e instanceof
|
|
2247
|
+
function uo(e) {
|
|
2248
|
+
return e instanceof so;
|
|
2218
2249
|
}
|
|
2219
|
-
function
|
|
2220
|
-
|
|
2250
|
+
function ho(e) {
|
|
2251
|
+
gt(e.getParent()) ? e.isEmpty() && e.append($createParagraphNode()) : e.remove();
|
|
2221
2252
|
}
|
|
2222
|
-
function
|
|
2223
|
-
|
|
2253
|
+
function fo(e) {
|
|
2254
|
+
uo(e.getParent()) ? $unwrapAndFilterDescendants(e, ct) : e.remove();
|
|
2224
2255
|
}
|
|
2225
|
-
function
|
|
2226
|
-
$unwrapAndFilterDescendants(e,
|
|
2227
|
-
const [t] =
|
|
2256
|
+
function go(e) {
|
|
2257
|
+
$unwrapAndFilterDescendants(e, gt);
|
|
2258
|
+
const [t] = Ut(e, null, null), n = t.reduce((e, t) => Math.max(e, t.length), 0), o = e.getChildren();
|
|
2228
2259
|
for (let e = 0; e < t.length; ++e) {
|
|
2229
2260
|
const l = o[e];
|
|
2230
2261
|
if (!l) continue;
|
|
2231
|
-
|
|
2262
|
+
gt(l) || ut(254, l.constructor.name, l.getType());
|
|
2232
2263
|
const r = t[e].reduce((e, t) => t ? 1 + e : e, 0);
|
|
2233
2264
|
if (r !== n) for (let e = r; e < n; ++e) {
|
|
2234
|
-
const e =
|
|
2265
|
+
const e = it();
|
|
2235
2266
|
e.append($createParagraphNode()), l.append(e);
|
|
2236
2267
|
}
|
|
2237
2268
|
}
|
|
@@ -2246,45 +2277,45 @@ function so(e) {
|
|
|
2246
2277
|
e.setColWidths(t);
|
|
2247
2278
|
}
|
|
2248
2279
|
}
|
|
2249
|
-
function
|
|
2280
|
+
function po(e) {
|
|
2250
2281
|
if (e.detail < 3 || !isDOMNode(e.target)) return !1;
|
|
2251
2282
|
const t = $getNearestNodeFromDOMNode(e.target);
|
|
2252
2283
|
if (null === t) return !1;
|
|
2253
2284
|
const n = $findMatchingParent(t, (e) => $isElementNode(e) && !e.isInline());
|
|
2254
2285
|
if (null === n) return !1;
|
|
2255
|
-
return !!
|
|
2286
|
+
return !!ct(n.getParent()) && (n.select(0), !0);
|
|
2256
2287
|
}
|
|
2257
|
-
function
|
|
2288
|
+
function mo() {
|
|
2258
2289
|
const e = $getSelection();
|
|
2259
2290
|
if (!$isRangeSelection(e)) return !1;
|
|
2260
|
-
const t =
|
|
2291
|
+
const t = Dn(e.anchor.getNode());
|
|
2261
2292
|
if (null === t) return !1;
|
|
2262
2293
|
const n = $getRoot();
|
|
2263
2294
|
if (!n.is(t.getParent()) || 1 !== n.getChildrenSize()) return !1;
|
|
2264
|
-
const [o] =
|
|
2295
|
+
const [o] = Ut(t, null, null);
|
|
2265
2296
|
if (0 === o.length || 0 === o[0].length) return !1;
|
|
2266
2297
|
const l = o[0][0];
|
|
2267
2298
|
if (!l || !l.cell) return !1;
|
|
2268
2299
|
const r = o[o.length - 1], s = r[r.length - 1];
|
|
2269
2300
|
if (!s || !s.cell) return !1;
|
|
2270
|
-
return $setSelection(
|
|
2301
|
+
return $setSelection(ln(t, l.cell, s.cell)), !0;
|
|
2271
2302
|
}
|
|
2272
|
-
function
|
|
2273
|
-
return e.registerNodeTransform(
|
|
2303
|
+
function Co(e) {
|
|
2304
|
+
return e.registerNodeTransform(lt, (e) => {
|
|
2274
2305
|
if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
|
|
2275
|
-
const [, , t] =
|
|
2306
|
+
const [, , t] = Xt(e), [n] = It(t, e, e), o = n.length, l = n[0].length;
|
|
2276
2307
|
let r = t.getFirstChild();
|
|
2277
|
-
|
|
2308
|
+
gt(r) || ut(175);
|
|
2278
2309
|
const s = [];
|
|
2279
2310
|
for (let e = 0; e < o; e++) {
|
|
2280
|
-
0 !== e && (r = r.getNextSibling(),
|
|
2311
|
+
0 !== e && (r = r.getNextSibling(), gt(r) || ut(175));
|
|
2281
2312
|
let t = null;
|
|
2282
2313
|
for (let o = 0; o < l; o++) {
|
|
2283
2314
|
const l = n[e][o], i = l.cell;
|
|
2284
2315
|
if (l.startRow === e && l.startColumn === o) t = i, s.push(i);
|
|
2285
2316
|
else if (i.getColSpan() > 1 || i.getRowSpan() > 1) {
|
|
2286
|
-
|
|
2287
|
-
const e =
|
|
2317
|
+
ct(i) || ut(176);
|
|
2318
|
+
const e = it(i.__headerState);
|
|
2288
2319
|
null !== t ? t.insertAfter(e) : $insertFirst(r, e);
|
|
2289
2320
|
}
|
|
2290
2321
|
}
|
|
@@ -2293,17 +2324,17 @@ function ao(e) {
|
|
|
2293
2324
|
}
|
|
2294
2325
|
});
|
|
2295
2326
|
}
|
|
2296
|
-
function
|
|
2297
|
-
const n = new
|
|
2298
|
-
const s =
|
|
2327
|
+
function _o(e, t = !0) {
|
|
2328
|
+
const n = new cn(), o = (o, l, r) => {
|
|
2329
|
+
const s = pn(o, r), i = yn(o, s, e, t, n);
|
|
2299
2330
|
n.observers.set(l, [i, s]);
|
|
2300
2331
|
};
|
|
2301
|
-
return mergeRegister(
|
|
2332
|
+
return mergeRegister(wn(e, n), e.registerCommand(SELECTION_CHANGE_COMMAND, () => Nn(n, e), COMMAND_PRIORITY_HIGH), e.registerMutationListener(so, (t) => {
|
|
2302
2333
|
e.read("latest", () => {
|
|
2303
2334
|
for (const [e, l] of t) {
|
|
2304
2335
|
const t = n.observers.get(e);
|
|
2305
2336
|
if ("created" === l || "updated" === l) {
|
|
2306
|
-
const { tableNode: l, tableElement: r } =
|
|
2337
|
+
const { tableNode: l, tableElement: r } = sn(e);
|
|
2307
2338
|
void 0 === t ? o(l, e, r) : r !== t[1] && (n.removeObserver(e), o(l, e, r));
|
|
2308
2339
|
} else "destroyed" === l && n.removeObserver(e);
|
|
2309
2340
|
}
|
|
@@ -2312,21 +2343,21 @@ function uo(e, t = !0) {
|
|
|
2312
2343
|
n.removeAllObservers();
|
|
2313
2344
|
});
|
|
2314
2345
|
}
|
|
2315
|
-
function
|
|
2316
|
-
e.hasNodes([
|
|
2346
|
+
function So(e, t) {
|
|
2347
|
+
e.hasNodes([so]) || ut(255);
|
|
2317
2348
|
const { hasNestedTables: n = signal(!1) } = t ?? {};
|
|
2318
|
-
return mergeRegister(e.registerCommand(
|
|
2349
|
+
return mergeRegister(e.registerCommand(at, (e) => function({ rows: e, columns: t, includeHeaders: n }, o) {
|
|
2319
2350
|
const l = $getSelection() || $getPreviousSelection();
|
|
2320
2351
|
if (!l || !$isRangeSelection(l)) return !1;
|
|
2321
|
-
if (!o &&
|
|
2322
|
-
const s =
|
|
2352
|
+
if (!o && Dn(l.anchor.getNode())) return !1;
|
|
2353
|
+
const s = pt(Number(e), Number(t), n);
|
|
2323
2354
|
$insertNodeToNearestRoot(s);
|
|
2324
2355
|
const i = s.getFirstDescendant();
|
|
2325
2356
|
return $isTextNode(i) && i.select(), !0;
|
|
2326
2357
|
}(e, n.peek()), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, (t, o) => e === o && function(e, t) {
|
|
2327
2358
|
const { nodes: n, selection: o } = e;
|
|
2328
|
-
if (!n.some((e) =>
|
|
2329
|
-
if (
|
|
2359
|
+
if (!n.some((e) => uo(e) || $dfs(e).some((e) => uo(e.node)))) {
|
|
2360
|
+
if (nn(o)) {
|
|
2330
2361
|
let e = "", t = !1;
|
|
2331
2362
|
for (const o of n) {
|
|
2332
2363
|
const n = $isElementNode(o) && !o.isInline();
|
|
@@ -2336,37 +2367,37 @@ function ho(e, t) {
|
|
|
2336
2367
|
}
|
|
2337
2368
|
return !1;
|
|
2338
2369
|
}
|
|
2339
|
-
const l =
|
|
2340
|
-
if (!(r && null !== $findMatchingParent(o.anchor.getNode(), (e) =>
|
|
2341
|
-
if (1 === n.length &&
|
|
2370
|
+
const l = nn(o), r = $isRangeSelection(o);
|
|
2371
|
+
if (!(r && null !== $findMatchingParent(o.anchor.getNode(), (e) => ct(e)) && null !== $findMatchingParent(o.focus.getNode(), (e) => ct(e)) || l)) return !1;
|
|
2372
|
+
if (1 === n.length && uo(n[0])) return Gt(n[0], o);
|
|
2342
2373
|
if (r && t.peek() && !function(e) {
|
|
2343
|
-
if (
|
|
2344
|
-
if ($isRangeSelection(e) &&
|
|
2374
|
+
if (nn(e) && !e.focus.getNode().is(e.anchor.getNode())) return !0;
|
|
2375
|
+
if ($isRangeSelection(e) && ct(e.anchor.getNode()) && !e.anchor.getNode().is(e.focus.getNode())) return !0;
|
|
2345
2376
|
return !1;
|
|
2346
2377
|
}(o)) return !1;
|
|
2347
2378
|
return !0;
|
|
2348
|
-
}(t, n), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECT_ALL_COMMAND,
|
|
2379
|
+
}(t, n), COMMAND_PRIORITY_EDITOR), e.registerCommand(SELECT_ALL_COMMAND, mo, COMMAND_PRIORITY_LOW), e.registerCommand(CLICK_COMMAND, po, COMMAND_PRIORITY_EDITOR), e.registerNodeTransform(so, go), e.registerNodeTransform(ht, fo), e.registerNodeTransform(lt, ho));
|
|
2349
2380
|
}
|
|
2350
|
-
const
|
|
2351
|
-
$accepts:
|
|
2352
|
-
$packageRun: (e) => e.every(
|
|
2381
|
+
const bo = {
|
|
2382
|
+
$accepts: gt,
|
|
2383
|
+
$packageRun: (e) => e.every(ct) ? [ft().splice(0, 0, e)] : [],
|
|
2353
2384
|
name: "TableSchema"
|
|
2354
2385
|
};
|
|
2355
|
-
const
|
|
2356
|
-
$accepts:
|
|
2386
|
+
const wo = {
|
|
2387
|
+
$accepts: ct,
|
|
2357
2388
|
name: "TableRowSchema"
|
|
2358
2389
|
};
|
|
2359
|
-
const
|
|
2390
|
+
const yo = [
|
|
2360
2391
|
/* @__PURE__ */ defineImportRule({
|
|
2361
2392
|
$import: (e, t) => {
|
|
2362
|
-
const n =
|
|
2393
|
+
const n = ao();
|
|
2363
2394
|
t.hasAttribute("data-lexical-row-striping") && n.setRowStriping(!0), t.hasAttribute("data-lexical-frozen-column") && n.setFrozenColumns(1), t.hasAttribute("data-lexical-frozen-row") && n.setFrozenRows(1);
|
|
2364
2395
|
const o = t.querySelector(":scope > colgroup");
|
|
2365
2396
|
if (o) {
|
|
2366
2397
|
let e = [];
|
|
2367
2398
|
for (const t of o.querySelectorAll(":scope > col")) {
|
|
2368
2399
|
let n = t.style.width || "";
|
|
2369
|
-
if (!
|
|
2400
|
+
if (!nt.test(n) && (n = t.getAttribute("width") || "", !/^\d+$/.test(n))) {
|
|
2370
2401
|
e = void 0;
|
|
2371
2402
|
break;
|
|
2372
2403
|
}
|
|
@@ -2374,30 +2405,30 @@ const mo = [
|
|
|
2374
2405
|
}
|
|
2375
2406
|
e && n.setColWidths(e);
|
|
2376
2407
|
}
|
|
2377
|
-
return [n.splice(0, 0, $descendantsMatching(e.$importChildren(t),
|
|
2408
|
+
return [n.splice(0, 0, $descendantsMatching(e.$importChildren(t), gt))];
|
|
2378
2409
|
},
|
|
2379
2410
|
match: sel.tag("table"),
|
|
2380
2411
|
name: "@lexical/table/table"
|
|
2381
2412
|
}),
|
|
2382
2413
|
/* @__PURE__ */ defineImportRule({
|
|
2383
|
-
$import: (e, t) => [
|
|
2414
|
+
$import: (e, t) => [ft(nt.test(t.style.height) ? parseFloat(t.style.height) : void 0).splice(0, 0, $descendantsMatching(e.$importChildren(t), ct))],
|
|
2384
2415
|
match: sel.tag("tr"),
|
|
2385
2416
|
name: "@lexical/table/tr"
|
|
2386
2417
|
}),
|
|
2387
2418
|
/* @__PURE__ */ defineImportRule({
|
|
2388
2419
|
$import: (e, t) => {
|
|
2389
|
-
const n = "TH" === t.nodeName, o =
|
|
2390
|
-
let c =
|
|
2420
|
+
const n = "TH" === t.nodeName, o = nt.test(t.style.width) ? parseFloat(t.style.width) : void 0;
|
|
2421
|
+
let c = ot.NO_STATUS;
|
|
2391
2422
|
if (n) {
|
|
2392
2423
|
const e = t.getAttribute("scope");
|
|
2393
|
-
if ("col" === e) c =
|
|
2394
|
-
else if ("row" === e) c =
|
|
2424
|
+
if ("col" === e) c = ot.COLUMN;
|
|
2425
|
+
else if ("row" === e) c = ot.ROW;
|
|
2395
2426
|
else {
|
|
2396
2427
|
const e = t.parentElement, n = isHTMLTableRowElement(e) && (e.parentElement && "THEAD" === e.parentElement.nodeName || 0 === e.rowIndex), o = 0 === t.cellIndex;
|
|
2397
|
-
n && (c |=
|
|
2428
|
+
n && (c |= ot.ROW), o && (c |= ot.COLUMN), c === ot.NO_STATUS && (c = ot.ROW);
|
|
2398
2429
|
}
|
|
2399
2430
|
}
|
|
2400
|
-
const a =
|
|
2431
|
+
const a = it(c, t.colSpan, o);
|
|
2401
2432
|
a.__rowSpan = t.rowSpan;
|
|
2402
2433
|
const u = t.style.backgroundColor;
|
|
2403
2434
|
"" !== u && (a.__backgroundColor = u);
|
|
@@ -2411,11 +2442,11 @@ const mo = [
|
|
|
2411
2442
|
"700" !== n && "bold" !== n || (t |= IS_BOLD), "italic" === e.fontStyle && (t |= IS_ITALIC);
|
|
2412
2443
|
const o = (e.textDecoration || "").split(" ");
|
|
2413
2444
|
return o.includes("underline") && (t |= IS_UNDERLINE), o.includes("line-through") && (t |= IS_STRIKETHROUGH), t;
|
|
2414
|
-
}(t.style), g = e.get(ImportTextStyle),
|
|
2445
|
+
}(t.style), g = e.get(ImportTextStyle), p = t.style.color, m = p ? {
|
|
2415
2446
|
...g,
|
|
2416
|
-
color:
|
|
2447
|
+
color: p
|
|
2417
2448
|
} : g, C = [];
|
|
2418
|
-
f !== d && C.push(contextValue(ImportTextFormat, f)),
|
|
2449
|
+
f !== d && C.push(contextValue(ImportTextFormat, f)), m !== g && C.push(contextValue(ImportTextStyle, m));
|
|
2419
2450
|
const _ = function(e) {
|
|
2420
2451
|
const t = [];
|
|
2421
2452
|
let n = null;
|
|
@@ -2434,35 +2465,60 @@ const mo = [
|
|
|
2434
2465
|
name: "@lexical/table/cell"
|
|
2435
2466
|
})
|
|
2436
2467
|
];
|
|
2437
|
-
const
|
|
2468
|
+
const No = /* @__PURE__ */ defineExtension({
|
|
2438
2469
|
build: (e, t, n) => namedSignals(t),
|
|
2439
2470
|
config: /* @__PURE__ */ safeCast({
|
|
2440
2471
|
hasCellBackgroundColor: !0,
|
|
2441
2472
|
hasCellMerge: !0,
|
|
2442
2473
|
hasHorizontalScroll: !0,
|
|
2443
2474
|
hasNestedTables: !1,
|
|
2475
|
+
hasStickyScrollbar: !1,
|
|
2444
2476
|
hasTabHandler: !0
|
|
2445
2477
|
}),
|
|
2446
|
-
dependencies: [CoreImportExtension, /* @__PURE__ */ configExtension(DOMImportExtension, { rules:
|
|
2478
|
+
dependencies: [CoreImportExtension, /* @__PURE__ */ configExtension(DOMImportExtension, { rules: yo })],
|
|
2447
2479
|
name: "@lexical/table/Table",
|
|
2448
2480
|
nodes: () => [
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2481
|
+
so,
|
|
2482
|
+
ht,
|
|
2483
|
+
lt
|
|
2452
2484
|
],
|
|
2453
2485
|
register(e, t, n) {
|
|
2454
|
-
const
|
|
2486
|
+
const l = n.getOutput();
|
|
2487
|
+
let r = !1;
|
|
2455
2488
|
return mergeRegister(effect(() => {
|
|
2456
|
-
const t =
|
|
2457
|
-
|
|
2458
|
-
}),
|
|
2489
|
+
const t = l.hasHorizontalScroll.value, n = l.hasStickyScrollbar.value && t, o = oo(e);
|
|
2490
|
+
o !== t && ro(e, t), o === t && r === n || e.update($fullReconcile), r = n;
|
|
2491
|
+
}), So(e, l), effect(() => _o(e, l.hasTabHandler.value)), effect(() => {
|
|
2492
|
+
if (l.hasStickyScrollbar.value && l.hasHorizontalScroll.value) return e.registerRootListener((t) => {
|
|
2493
|
+
if (t) return function(e) {
|
|
2494
|
+
const t = /* @__PURE__ */ new Map();
|
|
2495
|
+
return mergeRegister(() => {
|
|
2496
|
+
for (const { cleanup: e } of t.values()) e();
|
|
2497
|
+
t.clear();
|
|
2498
|
+
}, e.registerMutationListener(so, (n) => {
|
|
2499
|
+
for (const [l, r] of n) {
|
|
2500
|
+
const n = t.get(l);
|
|
2501
|
+
if ("destroyed" === r) {
|
|
2502
|
+
n && (n.cleanup(), t.delete(l));
|
|
2503
|
+
continue;
|
|
2504
|
+
}
|
|
2505
|
+
const s = e.getElementByKey(l), i = s && isHTMLElement(s) ? to(s) : null;
|
|
2506
|
+
n && i && n.parts.scrollable === i.scrollable && n.parts.scrollbar === i.scrollbar && n.parts.tableElement === i.tableElement ? eo(i.scrollable, i.scrollbar) : (n && (n.cleanup(), t.delete(l)), i && t.set(l, {
|
|
2507
|
+
cleanup: Zn(i),
|
|
2508
|
+
parts: i
|
|
2509
|
+
}));
|
|
2510
|
+
}
|
|
2511
|
+
}, { skipInitialization: !1 }));
|
|
2512
|
+
}(e);
|
|
2513
|
+
});
|
|
2514
|
+
}), effect(() => l.hasCellMerge.value ? void 0 : Co(e)), effect(() => l.hasCellBackgroundColor.value ? void 0 : e.registerNodeTransform(lt, (e) => {
|
|
2459
2515
|
null !== e.getBackgroundColor() && e.setBackgroundColor(null);
|
|
2460
2516
|
})));
|
|
2461
2517
|
}
|
|
2462
2518
|
});
|
|
2463
|
-
const
|
|
2464
|
-
dependencies: [
|
|
2519
|
+
const vo = /* @__PURE__ */ defineExtension({
|
|
2520
|
+
dependencies: [No],
|
|
2465
2521
|
name: "@lexical/table/Import"
|
|
2466
2522
|
});
|
|
2467
2523
|
//#endregion
|
|
2468
|
-
export {
|
|
2524
|
+
export { Yt as $computeTableCellRectBoundary, It as $computeTableMap, Ut as $computeTableMapSkipCellCheck, it as $createTableCellNode, ao as $createTableNode, pt as $createTableNodeWithDimensions, ft as $createTableRowNode, on as $createTableSelection, ln as $createTableSelectionFrom, Kt as $deleteTableColumn, Wt as $deleteTableColumnAtSelection, $t as $deleteTableColumn__EXPERIMENTAL, kt as $deleteTableRowAtSelection, Mt as $deleteTableRow__EXPERIMENTAL, Bn as $findCellNode, Dn as $findTableNode, io as $getElementForTableNode, Xt as $getNodeTriplet, sn as $getTableAndElementByKey, mt as $getTableCellNodeFromLexicalNode, Vt as $getTableCellNodeRect, bt as $getTableColumnIndexFromTableCellNode, _t as $getTableNodeFromLexicalNodeOrThrow, St as $getTableRowIndexFromTableCellNode, Ct as $getTableRowNodeFromTableCellNodeOrThrow, Ft as $insertTableColumn, Et as $insertTableColumnAtNode, At as $insertTableColumnAtSelection, Ot as $insertTableColumn__EXPERIMENTAL, Nt as $insertTableRow, Rt as $insertTableRowAtNode, xt as $insertTableRowAtSelection, Tt as $insertTableRow__EXPERIMENTAL, oo as $isScrollableTablesActive, qt as $isSimpleTable, lo as $isStickyScrollbarActive, ct as $isTableCellNode, uo as $isTableNode, gt as $isTableRowNode, nn as $isTableSelection, Ht as $mergeCells, Jt as $moveTableColumn, jt as $moveTableRow, yt as $removeTableRowAtIndex, Zt as $setTableColumnIsHeader, Qt as $setTableRowIsHeader, Dt as $unmergeCell, Pt as $unmergeCellNode, at as INSERT_TABLE_COMMAND, ot as TableCellHeaderStates, lt as TableCellNode, No as TableExtension, vo as TableImportExtension, yo as TableImportRules, so as TableNode, an as TableObserver, ht as TableRowNode, wo as TableRowSchema, bo as TableSchema, yn as applyTableHandlers, Tn as getDOMCellFromTarget, pn as getTableElement, xn as getTableObserverFromTableElement, Co as registerTableCellUnmergeTransform, So as registerTablePlugin, _o as registerTableSelectionObserver, ro as setScrollableTablesActive };
|