@mx-space/cli 0.7.8 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Lexical.dev-rcxzwpir.mjs → Lexical.dev-By5dOKBN.mjs} +1486 -356
- package/dist/{Lexical.node-BUsI9gWr.mjs → Lexical.node-fXM8Jp7p.mjs} +39 -17
- package/dist/{Lexical.prod-C8HtkSD6.mjs → Lexical.prod-BlCvXPGa.mjs} +2279 -1768
- package/dist/LexicalClipboard.dev--HxGoSkO.mjs +915 -0
- package/dist/{LexicalClipboard.node-CO-MCKx5.mjs → LexicalClipboard.node-C3mRbrmW.mjs} +10 -3
- package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +371 -0
- package/dist/LexicalCodeCore.dev-DjSrd4A4.mjs +1109 -0
- package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +642 -0
- package/dist/{LexicalDragon.dev-gBP8WSRS.mjs → LexicalDragon.dev-DwprRH0z.mjs} +3 -3
- package/dist/{LexicalDragon.node-OG6G55nl.mjs → LexicalDragon.node-BVhw4C7s.mjs} +2 -2
- package/dist/{LexicalDragon.prod-DP-_Q8cv.mjs → LexicalDragon.prod-nh4J-8vn.mjs} +3 -3
- package/dist/{LexicalExtension.dev-DVbjljrm.mjs → LexicalExtension.dev-BPNyvGqe.mjs} +335 -6
- package/dist/{LexicalExtension.node-CF3EAPN7.mjs → LexicalExtension.node-BVlcrgOx.mjs} +15 -8
- package/dist/{LexicalExtension.prod-DklHHErZ.mjs → LexicalExtension.prod-DFKbiNt-.mjs} +375 -265
- package/dist/{LexicalHeadless.dev-DdWLM7Nl.mjs → LexicalHeadless.dev-B-cj7Pr5.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-CoiiTDzR.mjs → LexicalHeadless.prod-Byp1vNzT.mjs} +2 -2
- package/dist/LexicalHtml.dev-prBAwszN.mjs +2424 -0
- package/dist/LexicalHtml.node-BvNF96jZ.mjs +56 -0
- package/dist/LexicalHtml.prod-Sz3CW1ht.mjs +1207 -0
- package/dist/{LexicalLink.dev-BS1Bf-yD.mjs → LexicalLink.dev-NySTYhVR.mjs} +42 -8
- package/dist/{LexicalLink.prod-B_crkoHP.mjs → LexicalLink.prod-BuCM8gts.mjs} +209 -191
- package/dist/{LexicalList.dev-OMqmcnQ-.mjs → LexicalList.dev-DIMOvSFD.mjs} +252 -80
- package/dist/{LexicalList.prod-CpL1s8vS.mjs → LexicalList.prod-MVqfA6Vo.mjs} +364 -278
- package/dist/{LexicalMarkdown.dev-BHSdx_Gr.mjs → LexicalMarkdown.dev-C7aylvCG.mjs} +729 -552
- package/dist/LexicalMarkdown.prod-CfQSM406.mjs +868 -0
- package/dist/{LexicalRichText.dev-Bz9A_WbM.mjs → LexicalRichText.dev-DfICq6lU.mjs} +272 -77
- package/dist/{LexicalRichText.node-DDpwfE-P.mjs → LexicalRichText.node-Bg9jND3Q.mjs} +21 -8
- package/dist/LexicalRichText.prod-GsFzCK-o.mjs +550 -0
- package/dist/{LexicalSelection.dev-CQ380fnD.mjs → LexicalSelection.dev-DGjj12wW.mjs} +50 -38
- package/dist/{LexicalSelection.node-DesBMjIE.mjs → LexicalSelection.node-BU5L4193.mjs} +4 -4
- package/dist/{LexicalSelection.prod-D2jivCDB.mjs → LexicalSelection.prod-D-PwRbyK.mjs} +158 -140
- package/dist/{LexicalTable.dev-Ca7mQ7Jk.mjs → LexicalTable.dev-ChP7cugd.mjs} +215 -53
- package/dist/{LexicalTable.prod-DyPAcC7y.mjs → LexicalTable.prod-Bpr9YRXp.mjs} +668 -573
- package/dist/{LexicalUtils.dev-HxM8F0g6.mjs → LexicalUtils.dev-BiFU3789.mjs} +10 -47
- package/dist/{LexicalUtils.node-lCWjRjoG.mjs → LexicalUtils.node-j3Llm7Y3.mjs} +2 -2
- package/dist/{LexicalUtils.prod-Bti5w4ki.mjs → LexicalUtils.prod-DCvrA78p.mjs} +103 -105
- package/dist/bin/mxs.d.mts +1 -1
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-By7trG9K.mjs +2 -0
- package/dist/{esm-CK9m5JKX.mjs → esm-Dg-WhPCe.mjs} +989 -989
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{mxs-BZt1cLW9.mjs → mxs-DT0oYk6U.mjs} +11935 -11866
- package/package.json +15 -14
- package/dist/LexicalClipboard.dev-BpqRwTLP.mjs +0 -494
- package/dist/LexicalClipboard.prod-B_xdeiAC.mjs +0 -291
- package/dist/LexicalCodeCore.dev-7_cexm39.mjs +0 -537
- package/dist/LexicalCodeCore.prod-Bd6WFHcO.mjs +0 -381
- package/dist/LexicalHtml.dev-C3ZSWBFZ.mjs +0 -684
- package/dist/LexicalHtml.node-D0TD152E.mjs +0 -24
- package/dist/LexicalHtml.prod-CX47X0zl.mjs +0 -430
- package/dist/LexicalMarkdown.prod-C-S7Ii6-.mjs +0 -754
- package/dist/LexicalRichText.prod-C8qXACDL.mjs +0 -427
- package/dist/esm-DRbkkY3r.mjs +0 -2
- /package/dist/{mxs-CM8-6uAr.d.mts → mxs-iqJBopvE.d.mts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
//#region ../../node_modules/.pnpm/@lexical+selection@0.
|
|
1
|
+
import { $ as $isElementNode, F as $getEditor, O as $getCharacterOffsets, R as $getNodeByKey, U as $getSelection, V as $getPreviousSelection, X as $isChildCaret, Z as $isDecoratorNode, _ as $createTextNode, a as $cloneWithProperties, bt as $selectAll, ct as $isRootNode, et as $isExtendableTextPointCaret, ft as $isTextNode, i as $caretRangeFromSelection, lt as $isRootOrShadowRoot, mt as $isTokenOrSegmented, nt as $isLeafNode, o as $cloneWithPropertiesEphemeral, pr as getStyleObjectFromCSS, q as $hasAncestor, r as $caretFromPoint, st as $isRangeSelection, un as INTERNAL_$isBlock, v as $extendCaretToRange, wt as $setSelection, y as $findMatchingParent } from "./Lexical.node-fXM8Jp7p.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@lexical+selection@0.45.0/node_modules/@lexical/selection/dist/LexicalSelection.prod.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
5
|
*
|
|
@@ -7,13 +7,13 @@ import { $t as INTERNAL_$isBlock, E as $getCharacterOffsets, K as $isChildCaret,
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
function P(e, ...t) {
|
|
11
11
|
const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
12
12
|
o.append("code", e);
|
|
13
13
|
for (const e of t) o.append("v", e);
|
|
14
14
|
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.`);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function K(e) {
|
|
17
17
|
let t = e;
|
|
18
18
|
for (; null != t;) {
|
|
19
19
|
if (t.nodeType === Node.TEXT_NODE) return t;
|
|
@@ -21,39 +21,39 @@ function P(e) {
|
|
|
21
21
|
}
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function E(e) {
|
|
25
25
|
const t = e.parentNode;
|
|
26
26
|
if (null == t) throw new Error("Should never happen");
|
|
27
27
|
return [t, Array.from(t.childNodes).indexOf(e)];
|
|
28
28
|
}
|
|
29
29
|
function I(t, n, o, l, r) {
|
|
30
|
-
const
|
|
31
|
-
let f = t.getElementByKey(
|
|
32
|
-
if ($isTextNode(n) && (f =
|
|
33
|
-
"BR" === f.nodeName && ([f, g] =
|
|
34
|
-
const
|
|
35
|
-
f === u && null !=
|
|
30
|
+
const i = n.getKey(), s = l.getKey(), c = document.createRange();
|
|
31
|
+
let f = t.getElementByKey(i), u = t.getElementByKey(s), g = o, d = r;
|
|
32
|
+
if ($isTextNode(n) && (f = K(f)), $isTextNode(l) && (u = K(u)), void 0 === n || void 0 === l || null === f || null === u) return null;
|
|
33
|
+
"BR" === f.nodeName && ([f, g] = E(f)), "BR" === u.nodeName && ([u, d] = E(u));
|
|
34
|
+
const a = f.firstChild;
|
|
35
|
+
f === u && null != a && "BR" === a.nodeName && 0 === g && 0 === d && (d = 1);
|
|
36
36
|
try {
|
|
37
|
-
c.setStart(f, g), c.setEnd(u,
|
|
37
|
+
c.setStart(f, g), c.setEnd(u, d);
|
|
38
38
|
} catch (e) {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
|
-
return !c.collapsed || g ===
|
|
41
|
+
return !c.collapsed || g === d && i === s || (c.setStart(u, d), c.setEnd(f, g)), c;
|
|
42
42
|
}
|
|
43
43
|
function B(e, t) {
|
|
44
44
|
const n = e.getRootElement();
|
|
45
45
|
if (null === n) return [];
|
|
46
|
-
const o = n.getBoundingClientRect(), l = getComputedStyle(n), r = parseFloat(l.paddingLeft) + parseFloat(l.paddingRight),
|
|
47
|
-
let
|
|
48
|
-
|
|
46
|
+
const o = n.getBoundingClientRect(), l = getComputedStyle(n), r = parseFloat(l.paddingLeft) + parseFloat(l.paddingRight), i = Array.from(t.getClientRects());
|
|
47
|
+
let s, c = i.length;
|
|
48
|
+
i.sort((e, t) => {
|
|
49
49
|
const n = e.top - t.top;
|
|
50
50
|
return Math.abs(n) <= 3 ? e.left - t.left : n;
|
|
51
51
|
});
|
|
52
52
|
for (let e = 0; e < c; e++) {
|
|
53
|
-
const t =
|
|
54
|
-
n || l ? (
|
|
53
|
+
const t = i[e], n = s && s.top <= t.top && s.top + s.height > t.top && s.left + s.width > t.left, l = t.width + r === o.width;
|
|
54
|
+
n || l ? (i.splice(e--, 1), c--) : s = t;
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return i;
|
|
57
57
|
}
|
|
58
58
|
function F(e) {
|
|
59
59
|
let t = "";
|
|
@@ -66,48 +66,48 @@ function b(e) {
|
|
|
66
66
|
const o = n.ownerDocument.defaultView;
|
|
67
67
|
return null === o ? null : o.getComputedStyle(n);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function k(e) {
|
|
70
70
|
return b($isRootNode(e) ? e : e.getParentOrThrow());
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const t =
|
|
72
|
+
function z(e) {
|
|
73
|
+
const t = k(e);
|
|
74
74
|
return null !== t && "rtl" === t.direction;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function O(e, t, n = "self") {
|
|
77
77
|
const o = e.getStartEndPoints();
|
|
78
78
|
if (t.isSelected(e) && !$isTokenOrSegmented(t) && null !== o) {
|
|
79
|
-
const [l, r] = o,
|
|
80
|
-
if (g ||
|
|
81
|
-
const [o, l] = $getCharacterOffsets(e), r =
|
|
82
|
-
let
|
|
83
|
-
if (r) p = o > l ? l : o,
|
|
84
|
-
else if (g) p =
|
|
85
|
-
else if (
|
|
86
|
-
const h = t.__text.slice(p,
|
|
79
|
+
const [l, r] = o, i = e.isBackward(), s = l.getNode(), u = r.getNode(), g = t.is(s), d = t.is(u);
|
|
80
|
+
if (g || d) {
|
|
81
|
+
const [o, l] = $getCharacterOffsets(e), r = s.is(u), g = t.is(i ? u : s), d = t.is(i ? s : u);
|
|
82
|
+
let a, p = 0;
|
|
83
|
+
if (r) p = o > l ? l : o, a = o > l ? o : l;
|
|
84
|
+
else if (g) p = i ? l : o, a = void 0;
|
|
85
|
+
else if (d) p = 0, a = i ? o : l;
|
|
86
|
+
const h = t.__text.slice(p, a);
|
|
87
87
|
h !== t.__text && ("clone" === n && (t = $cloneWithPropertiesEphemeral(t)), t.__text = h);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
return t;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function R(e) {
|
|
93
93
|
if ("text" === e.type) return e.offset === e.getNode().getTextContentSize();
|
|
94
94
|
const t = e.getNode();
|
|
95
|
-
return $isElementNode(t) ||
|
|
95
|
+
return $isElementNode(t) || P(177), e.offset === t.getChildrenSize();
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
let
|
|
99
|
-
if ($isElementNode(
|
|
100
|
-
const e =
|
|
101
|
-
null !== e && (
|
|
97
|
+
function A(t, o, r) {
|
|
98
|
+
let i = o.getNode(), c = r;
|
|
99
|
+
if ($isElementNode(i)) {
|
|
100
|
+
const e = i.getDescendantByIndex(o.offset);
|
|
101
|
+
null !== e && (i = e);
|
|
102
102
|
}
|
|
103
|
-
for (; c > 0 && null !==
|
|
104
|
-
if ($isElementNode(
|
|
105
|
-
const e =
|
|
106
|
-
null !== e && (
|
|
103
|
+
for (; c > 0 && null !== i;) {
|
|
104
|
+
if ($isElementNode(i)) {
|
|
105
|
+
const e = i.getLastDescendant();
|
|
106
|
+
null !== e && (i = e);
|
|
107
107
|
}
|
|
108
|
-
let r =
|
|
108
|
+
let r = i.getPreviousSibling(), f = 0;
|
|
109
109
|
if (null === r) {
|
|
110
|
-
let e =
|
|
110
|
+
let e = i.getParentOrThrow(), t = e.getPreviousSibling();
|
|
111
111
|
for (; null === t;) {
|
|
112
112
|
if (e = e.getParent(), null === e) {
|
|
113
113
|
r = null;
|
|
@@ -117,63 +117,63 @@ function _(t, o, r) {
|
|
|
117
117
|
}
|
|
118
118
|
null !== e && (f = e.isInline() ? 0 : 2, r = t);
|
|
119
119
|
}
|
|
120
|
-
let
|
|
121
|
-
"" ===
|
|
122
|
-
const p =
|
|
123
|
-
if (!$isTextNode(
|
|
124
|
-
const e =
|
|
125
|
-
|
|
120
|
+
let a = i.getTextContent();
|
|
121
|
+
"" === a && $isElementNode(i) && !i.isInline() && (a = "\n\n");
|
|
122
|
+
const p = a.length;
|
|
123
|
+
if (!$isTextNode(i) || c >= p) {
|
|
124
|
+
const e = i.getParent();
|
|
125
|
+
i.remove(), null == e || 0 !== e.getChildrenSize() || $isRootNode(e) || e.remove(), c -= p + f, i = r;
|
|
126
126
|
} else {
|
|
127
|
-
const n =
|
|
127
|
+
const n = i.getKey(), r = t.getEditorState().read(() => {
|
|
128
128
|
const t = $getNodeByKey(n);
|
|
129
129
|
return $isTextNode(t) && t.isSimpleText() ? t.getTextContent() : null;
|
|
130
|
-
}),
|
|
131
|
-
if (null !== r && r !==
|
|
130
|
+
}), s = p - c, f = a.slice(0, s);
|
|
131
|
+
if (null !== r && r !== a) {
|
|
132
132
|
const e = $getPreviousSelection();
|
|
133
|
-
let t =
|
|
134
|
-
if (
|
|
133
|
+
let t = i;
|
|
134
|
+
if (i.isSimpleText()) i.setTextContent(r);
|
|
135
135
|
else {
|
|
136
136
|
const e = $createTextNode(r);
|
|
137
|
-
|
|
137
|
+
i.replace(e), t = e;
|
|
138
138
|
}
|
|
139
139
|
if ($isRangeSelection(e) && e.isCollapsed()) {
|
|
140
140
|
const n = e.anchor.offset;
|
|
141
141
|
t.select(n, n);
|
|
142
142
|
}
|
|
143
|
-
} else if (
|
|
143
|
+
} else if (i.isSimpleText()) {
|
|
144
144
|
const e = o.key === n;
|
|
145
145
|
let t = o.offset;
|
|
146
146
|
t < c && (t = p);
|
|
147
|
-
const l = e ? t - c : 0, r = e ? t :
|
|
147
|
+
const l = e ? t - c : 0, r = e ? t : s;
|
|
148
148
|
if (e && 0 === l) {
|
|
149
|
-
const [e] =
|
|
149
|
+
const [e] = i.splitText(l, r);
|
|
150
150
|
e.remove();
|
|
151
151
|
} else {
|
|
152
|
-
const [, e] =
|
|
152
|
+
const [, e] = i.splitText(l, r);
|
|
153
153
|
e.remove();
|
|
154
154
|
}
|
|
155
155
|
} else {
|
|
156
156
|
const e = $createTextNode(f);
|
|
157
|
-
|
|
157
|
+
i.replace(e);
|
|
158
158
|
}
|
|
159
159
|
c = 0;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
function
|
|
165
|
-
($isRangeSelection(t) ? t.isCollapsed() : $isTextNode(t) || $isElementNode(t)) ||
|
|
163
|
+
const _ = () => {};
|
|
164
|
+
function L(t, n) {
|
|
165
|
+
($isRangeSelection(t) ? t.isCollapsed() : $isTextNode(t) || $isElementNode(t)) || P(280);
|
|
166
166
|
const o = getStyleObjectFromCSS($isRangeSelection(t) ? t.style : $isTextNode(t) ? t.getStyle() : t.getTextStyle()), r = F(Object.entries(n).reduce((e, [n, l]) => ("function" == typeof l ? e[n] = l(o[n], t) : null === l ? delete e[n] : e[n] = l, e), { ...o }));
|
|
167
167
|
$isRangeSelection(t) || $isTextNode(t) ? t.setStyle(r) : t.setTextStyle(r);
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function M(e, t) {
|
|
170
170
|
if ($isRangeSelection(e) && e.isCollapsed()) {
|
|
171
|
-
|
|
171
|
+
L(e, t);
|
|
172
172
|
const n = e.anchor.getNode();
|
|
173
|
-
$isElementNode(n) && n.isEmpty() &&
|
|
173
|
+
$isElementNode(n) && n.isEmpty() && L(n, t);
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
$((e) => {
|
|
176
|
+
L(e, t);
|
|
177
177
|
});
|
|
178
178
|
const n = e.getNodes();
|
|
179
179
|
if (n.length > 0) {
|
|
@@ -181,15 +181,15 @@ function $(e, t) {
|
|
|
181
181
|
for (const o of n) {
|
|
182
182
|
if (!$isElementNode(o) || !o.canBeEmpty() || 0 !== o.getChildrenSize()) continue;
|
|
183
183
|
const n = o.getKey();
|
|
184
|
-
e.has(n) || (e.add(n),
|
|
184
|
+
e.has(n) || (e.add(n), L(o, t));
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function $(t) {
|
|
189
189
|
const n = $getSelection();
|
|
190
190
|
if (!n) return;
|
|
191
|
-
const
|
|
192
|
-
if ($isRangeSelection(n)) for (const e of $caretRangeFromSelection(n).getTextSlices()) e &&
|
|
191
|
+
const s = /* @__PURE__ */ new Map(), c = (e) => s.get(e.getKey()) || [0, e.getTextContentSize()];
|
|
192
|
+
if ($isRangeSelection(n)) for (const e of $caretRangeFromSelection(n).getTextSlices()) e && s.set(e.caret.origin.getKey(), e.getSliceIndices());
|
|
193
193
|
const f = n.getNodes();
|
|
194
194
|
for (const n of f) {
|
|
195
195
|
if (!$isTextNode(n) || !n.canHaveFormat()) continue;
|
|
@@ -197,82 +197,93 @@ function D(t) {
|
|
|
197
197
|
if (l !== o) if ($isTokenOrSegmented(n) || 0 === o && l === n.getTextContentSize()) t(n);
|
|
198
198
|
else t(n.splitText(o, l)[0 === o ? 0 : 1]);
|
|
199
199
|
}
|
|
200
|
-
$isRangeSelection(n) && "text" === n.anchor.type && "text" === n.focus.type && n.anchor.key === n.focus.key &&
|
|
200
|
+
$isRangeSelection(n) && "text" === n.anchor.type && "text" === n.focus.type && n.anchor.key === n.focus.key && D(n);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function D(e) {
|
|
203
203
|
if (e.isBackward()) {
|
|
204
204
|
const { anchor: t, focus: n } = e, { key: o, offset: l, type: r } = t;
|
|
205
205
|
t.set(n.key, n.offset, n.type), n.set(o, l, r);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function j(e, t) {
|
|
209
209
|
const n = e.getFormatType(), o = e.getIndent();
|
|
210
210
|
n !== t.getFormatType() && t.setFormat(n), o !== t.getIndent() && t.setIndent(o);
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
if (
|
|
214
|
-
const
|
|
215
|
-
let
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
function U(e, t, n = j) {
|
|
213
|
+
if (!e) return;
|
|
214
|
+
const o = e.getStartEndPoints();
|
|
215
|
+
let l = !1, r = null;
|
|
216
|
+
const i = /* @__PURE__ */ new Map();
|
|
217
|
+
if (o) {
|
|
218
|
+
const [e, t] = o, n = $findMatchingParent(e.getNode(), INTERNAL_$isBlock);
|
|
219
|
+
r = $findMatchingParent(t.getNode(), INTERNAL_$isBlock), l = $isElementNode(r) && !r.is(n) && function(e, t) {
|
|
220
|
+
if (0 !== e.offset) return !1;
|
|
221
|
+
let n = e.getNode();
|
|
222
|
+
if ($isElementNode(n) && n.isEmpty()) return !1;
|
|
223
|
+
for (; !n.is(t);) {
|
|
224
|
+
if (null !== n.getPreviousSibling()) return !1;
|
|
225
|
+
const e = n.getParent();
|
|
226
|
+
if (null === e) return !1;
|
|
227
|
+
n = e;
|
|
228
|
+
}
|
|
229
|
+
return !0;
|
|
230
|
+
}(t, r), $isElementNode(n) && i.set(n.getKey(), n), $isElementNode(r) && !l && i.set(r.getKey(), r);
|
|
221
231
|
}
|
|
222
|
-
for (const t of e.getNodes()) if ($isElementNode(t) && INTERNAL_$isBlock(t))
|
|
223
|
-
|
|
232
|
+
for (const t of e.getNodes()) if ($isElementNode(t) && INTERNAL_$isBlock(t)) {
|
|
233
|
+
if (l && t.is(r)) continue;
|
|
234
|
+
i.set(t.getKey(), t);
|
|
235
|
+
} else if (!o) {
|
|
224
236
|
const e = $findMatchingParent(t, INTERNAL_$isBlock);
|
|
225
|
-
$isElementNode(e) &&
|
|
237
|
+
$isElementNode(e) && i.set(e.getKey(), e);
|
|
226
238
|
}
|
|
227
|
-
for (const
|
|
228
|
-
const
|
|
229
|
-
n(
|
|
239
|
+
for (const e of i.values()) {
|
|
240
|
+
const o = t();
|
|
241
|
+
n(e, o), e.replace(o, !0);
|
|
230
242
|
}
|
|
231
|
-
s && e.is($getSelection()) && $setSelection(s);
|
|
232
243
|
}
|
|
233
|
-
function
|
|
244
|
+
function H(e) {
|
|
234
245
|
return e.getNode().isAttached();
|
|
235
246
|
}
|
|
236
|
-
function
|
|
247
|
+
function V(e) {
|
|
237
248
|
let t = e;
|
|
238
249
|
for (; null !== t && !$isRootOrShadowRoot(t);) {
|
|
239
250
|
const e = t.getLatest(), n = t.getParent();
|
|
240
251
|
0 === e.getChildrenSize() && t.remove(!0), t = n;
|
|
241
252
|
}
|
|
242
253
|
}
|
|
243
|
-
function
|
|
244
|
-
const o = e.getStartEndPoints(), l = o ? o[0] : null, r = e.getNodes(),
|
|
245
|
-
if (null !== l && (0 ===
|
|
254
|
+
function W(e, t, n = null) {
|
|
255
|
+
const o = e.getStartEndPoints(), l = o ? o[0] : null, r = e.getNodes(), i = r.length;
|
|
256
|
+
if (null !== l && (0 === i || 1 === i && "element" === l.type && 0 === l.getNode().getChildrenSize())) {
|
|
246
257
|
const e = "text" === l.type ? l.getNode().getParentOrThrow() : l.getNode(), o = e.getChildren();
|
|
247
258
|
let r = t();
|
|
248
259
|
r.setFormat(e.getFormatType()), r.setIndent(e.getIndent()), o.forEach((e) => r.append(e)), n && (r = n.append(r)), e.replace(r);
|
|
249
260
|
return;
|
|
250
261
|
}
|
|
251
|
-
let
|
|
252
|
-
for (let o = 0; o <
|
|
262
|
+
let s = null, c = [];
|
|
263
|
+
for (let o = 0; o < i; o++) {
|
|
253
264
|
const l = r[o];
|
|
254
|
-
$isRootOrShadowRoot(l) ? (
|
|
265
|
+
$isRootOrShadowRoot(l) ? (X(e, c, c.length, t, n), c = [], s = l) : null === s || null !== s && $hasAncestor(l, s) ? c.push(l) : (X(e, c, c.length, t, n), c = [l]);
|
|
255
266
|
}
|
|
256
|
-
|
|
267
|
+
X(e, c, c.length, t, n);
|
|
257
268
|
}
|
|
258
|
-
function
|
|
269
|
+
function X(e, t, n, o, r = null) {
|
|
259
270
|
if (0 === t.length) return;
|
|
260
|
-
const
|
|
261
|
-
let u = $isElementNode(
|
|
271
|
+
const i = t[0], c = /* @__PURE__ */ new Map(), f = [];
|
|
272
|
+
let u = $isElementNode(i) ? i : i.getParentOrThrow();
|
|
262
273
|
u.isInline() && (u = u.getParentOrThrow());
|
|
263
|
-
let
|
|
274
|
+
let d = !1;
|
|
264
275
|
for (; null !== u;) {
|
|
265
276
|
const e = u.getPreviousSibling();
|
|
266
277
|
if (null !== e) {
|
|
267
|
-
u = e,
|
|
278
|
+
u = e, d = !0;
|
|
268
279
|
break;
|
|
269
280
|
}
|
|
270
281
|
if (u = u.getParentOrThrow(), $isRootOrShadowRoot(u)) break;
|
|
271
282
|
}
|
|
272
|
-
const
|
|
283
|
+
const a = /* @__PURE__ */ new Set();
|
|
273
284
|
for (let e = 0; e < n; e++) {
|
|
274
285
|
const n = t[e];
|
|
275
|
-
$isElementNode(n) && 0 === n.getChildrenSize() &&
|
|
286
|
+
$isElementNode(n) && 0 === n.getChildrenSize() && a.add(n.getKey());
|
|
276
287
|
}
|
|
277
288
|
const p = /* @__PURE__ */ new Set();
|
|
278
289
|
for (let e = 0; e < n; e++) {
|
|
@@ -282,12 +293,14 @@ function q(e, t, n, o, r = null) {
|
|
|
282
293
|
const e = l.getKey();
|
|
283
294
|
if (void 0 === c.get(e)) {
|
|
284
295
|
const t = o();
|
|
285
|
-
t.setFormat(l.getFormatType()), t.setIndent(l.getIndent()), f.push(t), c.set(e, t)
|
|
286
|
-
|
|
287
|
-
|
|
296
|
+
t.setFormat(l.getFormatType()), t.setIndent(l.getIndent()), f.push(t), c.set(e, t);
|
|
297
|
+
const n = l.getChildren();
|
|
298
|
+
t.splice(t.getChildrenSize(), 0, n);
|
|
299
|
+
for (const e of n) if (p.add(e.getKey()), $isElementNode(e)) for (const t of e.getChildrenKeys()) p.add(t);
|
|
300
|
+
V(l);
|
|
288
301
|
}
|
|
289
|
-
} else if (
|
|
290
|
-
$isElementNode(n) ||
|
|
302
|
+
} else if (a.has(n.getKey())) {
|
|
303
|
+
$isElementNode(n) || P(179);
|
|
291
304
|
const e = o();
|
|
292
305
|
e.setFormat(n.getFormatType()), e.setIndent(n.getIndent()), f.push(e), n.remove(!0);
|
|
293
306
|
}
|
|
@@ -297,7 +310,7 @@ function q(e, t, n, o, r = null) {
|
|
|
297
310
|
r.append(t);
|
|
298
311
|
}
|
|
299
312
|
let h = null;
|
|
300
|
-
if ($isRootOrShadowRoot(u)) if (
|
|
313
|
+
if ($isRootOrShadowRoot(u)) if (d) if (null !== r) u.insertAfter(r);
|
|
301
314
|
else for (let e = f.length - 1; e >= 0; e--) {
|
|
302
315
|
const t = f[e];
|
|
303
316
|
u.insertAfter(t);
|
|
@@ -321,19 +334,19 @@ function q(e, t, n, o, r = null) {
|
|
|
321
334
|
u.insertAfter(t), h = t;
|
|
322
335
|
}
|
|
323
336
|
const y = $getPreviousSelection();
|
|
324
|
-
$isRangeSelection(y) &&
|
|
337
|
+
$isRangeSelection(y) && H(y.anchor) && H(y.focus) ? $setSelection(y.clone()) : null !== h ? h.selectEnd() : e.dirty = !0;
|
|
325
338
|
}
|
|
326
|
-
function
|
|
327
|
-
const t =
|
|
339
|
+
function q(e) {
|
|
340
|
+
const t = G(e);
|
|
328
341
|
return null !== t && "vertical-rl" === t.writingMode;
|
|
329
342
|
}
|
|
330
|
-
function
|
|
343
|
+
function G(e) {
|
|
331
344
|
const t = e.anchor.getNode();
|
|
332
|
-
return $isElementNode(t) ? b(t) :
|
|
345
|
+
return $isElementNode(t) ? b(t) : k(t);
|
|
333
346
|
}
|
|
334
|
-
function
|
|
335
|
-
let n =
|
|
336
|
-
|
|
347
|
+
function J(e, t) {
|
|
348
|
+
let n = q(e) ? !t : t;
|
|
349
|
+
Y(e) && (n = !n);
|
|
337
350
|
const o = $caretFromPoint(e.focus, n ? "previous" : "next");
|
|
338
351
|
if ($isExtendableTextPointCaret(o)) return !1;
|
|
339
352
|
for (const e of $extendCaretToRange(o)) {
|
|
@@ -345,33 +358,38 @@ function Q(e, t) {
|
|
|
345
358
|
}
|
|
346
359
|
return !1;
|
|
347
360
|
}
|
|
348
|
-
function
|
|
361
|
+
function Q(e, t, n, o) {
|
|
349
362
|
e.modify(t ? "extend" : "move", n, o);
|
|
350
363
|
}
|
|
351
|
-
function
|
|
352
|
-
const t =
|
|
364
|
+
function Y(e) {
|
|
365
|
+
const t = G(e);
|
|
353
366
|
return null !== t && "rtl" === t.direction;
|
|
354
367
|
}
|
|
355
|
-
function
|
|
356
|
-
const o =
|
|
368
|
+
function Z(e, t, n) {
|
|
369
|
+
const o = Y(e);
|
|
357
370
|
let l;
|
|
358
|
-
l =
|
|
371
|
+
l = q(e) || o ? !n : n, Q(e, t, l, "character");
|
|
359
372
|
}
|
|
360
|
-
function
|
|
373
|
+
function ee(e, t, n) {
|
|
361
374
|
const l = getStyleObjectFromCSS(e.getStyle());
|
|
362
375
|
return null !== l && l[t] || n;
|
|
363
376
|
}
|
|
364
|
-
function
|
|
377
|
+
function te(t, n, o = "") {
|
|
365
378
|
let r = null;
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (
|
|
379
|
+
const i = t.getNodes();
|
|
380
|
+
let s, c;
|
|
381
|
+
if ($isRangeSelection(t)) {
|
|
382
|
+
if (t.isCollapsed() && "" !== t.style) {
|
|
383
|
+
const e = getStyleObjectFromCSS(t.style);
|
|
384
|
+
if (null !== e && n in e) return e[n];
|
|
385
|
+
}
|
|
386
|
+
const { anchor: o, focus: l } = t, r = t.isBackward(), i = r ? l.getNode() : o.getNode(), f = r ? o.getNode() : l.getNode(), u = r ? l.offset : o.offset, g = r ? o.offset : l.offset;
|
|
387
|
+
$isTextNode(i) && u === i.getTextContentSize() && (s = i), 0 === g && (c = f);
|
|
370
388
|
}
|
|
371
|
-
for (let t = 0; t <
|
|
372
|
-
const l =
|
|
373
|
-
if (
|
|
374
|
-
const e =
|
|
389
|
+
for (let t = 0; t < i.length; t++) {
|
|
390
|
+
const l = i[t];
|
|
391
|
+
if ($isTextNode(l) && !l.is(0 === t ? s : c)) {
|
|
392
|
+
const e = ee(l, n, o);
|
|
375
393
|
if (null === r) r = e;
|
|
376
394
|
else if (r !== e) {
|
|
377
395
|
r = "";
|
|
@@ -381,6 +399,6 @@ function ne(t, n, o = "") {
|
|
|
381
399
|
}
|
|
382
400
|
return null === r ? o : r;
|
|
383
401
|
}
|
|
384
|
-
const
|
|
402
|
+
const ne = getStyleObjectFromCSS, oe = A;
|
|
385
403
|
//#endregion
|
|
386
|
-
export {
|
|
404
|
+
export { _ as $addNodeStyle, $cloneWithProperties, j as $copyBlockFormatIndent, D as $ensureForwardRangeSelection, $ as $forEachSelectedTextNode, b as $getComputedStyleForElement, k as $getComputedStyleForParent, te as $getSelectionStyleValueForProperty, R as $isAtNodeEnd, Y as $isParentElementRTL, z as $isParentRTL, Q as $moveCaretSelection, Z as $moveCharacter, M as $patchStyleText, $selectAll, U as $setBlocksType, J as $shouldOverrideDefaultCharacterSelection, O as $sliceSelectedTextNodeContent, A as $trimTextContentFromAnchor, W as $wrapNodes, I as createDOMRange, B as createRectsFromDOMRange, F as getCSSFromStyleObject, ne as getStyleObjectFromCSS, oe as trimTextContentFromAnchor };
|