@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,754 +0,0 @@
|
|
|
1
|
-
import { _ as LinkNode, a as HeadingNode, c as $createListNode, d as ListItemNode, f as ListNode, h as $isLinkNode, i as $isQuoteNode, l as $isListItemNode, m as $isAutoLinkNode, n as $createQuoteNode, o as QuoteNode, p as $createLinkNode, r as $isHeadingNode, s as $createListItemNode, t as $createHeadingNode, u as $isListNode, v as $createCodeNode, x as CodeNode, y as $isCodeNode } from "./LexicalRichText.node-DDpwfE-P.mjs";
|
|
2
|
-
import { An as createState, At as COMMAND_PRIORITY_LOW, Et as COLLABORATION_TAG, Jt as HISTORY_PUSH_TAG, Kt as HISTORIC_TAG, R as $getRoot, V as $getState, Xn as mergeRegister, Y as $isElementNode, _ as $createTextNode, at as $isRootOrShadowRoot, bt as $setState, ct as $isTextNode, et as $isLineBreakNode, f as $createParagraphNode, g as $createTabNode, m as $createRangeSelection, nt as $isParagraphNode, on as KEY_ENTER_COMMAND, q as $isDecoratorNode, rt as $isRangeSelection, t as $addUpdateTag, u as $createLineBreakNode, vt as $setSelection, y as $findMatchingParent, z as $getSelection } from "./Lexical.node-BUsI9gWr.mjs";
|
|
3
|
-
import { r as $findMatchingParent$1 } from "./LexicalUtils.node-lCWjRjoG.mjs";
|
|
4
|
-
//#region ../../node_modules/.pnpm/@lexical+markdown@0.44.0/node_modules/@lexical/markdown/LexicalMarkdown.prod.mjs
|
|
5
|
-
/**
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
function G(t, e) {
|
|
13
|
-
const n = {};
|
|
14
|
-
for (const o of t) {
|
|
15
|
-
const t = e(o);
|
|
16
|
-
t && (n[t] ? n[t].push(o) : n[t] = [o]);
|
|
17
|
-
}
|
|
18
|
-
return n;
|
|
19
|
-
}
|
|
20
|
-
function H(t) {
|
|
21
|
-
const e = G(t, (t) => t.type);
|
|
22
|
-
return {
|
|
23
|
-
element: e.element || [],
|
|
24
|
-
multilineElement: e["multiline-element"] || [],
|
|
25
|
-
textFormat: e["text-format"] || [],
|
|
26
|
-
textMatch: e["text-match"] || []
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const J = /[!-/:-@[-`{-~\s]/, Q = /[ \t\n\r\f]/, V = /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/, X = /^\s{0,3}$/;
|
|
30
|
-
function Y(n) {
|
|
31
|
-
if (!$isParagraphNode(n)) return !1;
|
|
32
|
-
const o = n.getFirstChild();
|
|
33
|
-
return null == o || 1 === n.getChildrenSize() && $isTextNode(o) && X.test(o.getTextContent());
|
|
34
|
-
}
|
|
35
|
-
function Z(t) {
|
|
36
|
-
return t.replace(/\\([!-/:-@[-`{-~])/g, "$1").replace(/&#(\d+);/g, (t, e) => String.fromCodePoint(Number(e)));
|
|
37
|
-
}
|
|
38
|
-
function tt(t, e, n, s, i) {
|
|
39
|
-
for (const o of e) {
|
|
40
|
-
if (!o.export) continue;
|
|
41
|
-
const e = o.export(t, (t) => et(t, n, s, void 0, void 0, i));
|
|
42
|
-
if (null != e) return e;
|
|
43
|
-
}
|
|
44
|
-
return $isElementNode(t) ? et(t, n, s, void 0, void 0, i) : $isDecoratorNode(t) ? t.getTextContent() : null;
|
|
45
|
-
}
|
|
46
|
-
function et(t, n, i, l, c, a = !1) {
|
|
47
|
-
const f = [], u = t.getChildren();
|
|
48
|
-
l || (l = []), c || (c = []);
|
|
49
|
-
t: for (const t of u) {
|
|
50
|
-
for (const e of i) {
|
|
51
|
-
if (!e.export) continue;
|
|
52
|
-
const o = e.export(t, (t) => et(t, n, i, l, [...c, ...l], a), (t, e) => nt(t, e, n, l, c, a));
|
|
53
|
-
if (null != o) {
|
|
54
|
-
f.push(o);
|
|
55
|
-
continue t;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
$isLineBreakNode(t) ? f.push("\n") : $isTextNode(t) ? f.push(nt(t, t.getTextContent(), n, l, c, a)) : $isElementNode(t) ? f.push(et(t, n, i, l, c, a)) : $isDecoratorNode(t) && f.push(t.getTextContent());
|
|
59
|
-
}
|
|
60
|
-
return f.join("");
|
|
61
|
-
}
|
|
62
|
-
function nt(t, e, n, o, r, s = !1) {
|
|
63
|
-
let i = e;
|
|
64
|
-
t.hasFormat("code") || (i = s ? i.replace(/([*_`~])/g, "\\$1") : i.replace(/([*_`~\\])/g, "\\$1"));
|
|
65
|
-
const l = i.match(/^(\s*)(.*?)(\s*)$/s) || [
|
|
66
|
-
"",
|
|
67
|
-
"",
|
|
68
|
-
i,
|
|
69
|
-
""
|
|
70
|
-
], c = l[1], a = l[2], f = l[3], u = "" === a;
|
|
71
|
-
let g = "", d = "", p = "";
|
|
72
|
-
const h = ot(t, !0), x = ot(t, !1), m = /* @__PURE__ */ new Set();
|
|
73
|
-
for (const e of n) {
|
|
74
|
-
const n = e.format[0], r = e.tag;
|
|
75
|
-
st(t, n) && !m.has(n) && (m.add(n), st(h, n) && o.find((t) => t.tag === r) || (o.push({
|
|
76
|
-
format: n,
|
|
77
|
-
tag: r
|
|
78
|
-
}), g += r));
|
|
79
|
-
}
|
|
80
|
-
for (let e = 0; e < o.length; e++) {
|
|
81
|
-
const n = rt(t, o[e].format), s = rt(x, o[e].format);
|
|
82
|
-
if (n && s) continue;
|
|
83
|
-
const i = [...o];
|
|
84
|
-
for (; i.length > e;) {
|
|
85
|
-
const t = i.pop();
|
|
86
|
-
r && t && r.find((e) => e.tag === t.tag) || (t && "string" == typeof t.tag && (n ? s || (p += t.tag) : d += t.tag), o.pop());
|
|
87
|
-
}
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
return u && !t.hasFormat("code") ? d + i : d + c + g + a + p + f;
|
|
91
|
-
}
|
|
92
|
-
function ot(t, n) {
|
|
93
|
-
const o = n ? t.getPreviousSibling() : t.getNextSibling();
|
|
94
|
-
return $isTextNode(o) ? o : null;
|
|
95
|
-
}
|
|
96
|
-
function rt(t, n) {
|
|
97
|
-
return $isTextNode(t) && t.hasFormat(n);
|
|
98
|
-
}
|
|
99
|
-
function st(t, e) {
|
|
100
|
-
return !!rt(t, e) && ("code" === e || !t || !/^\s*$/.test(t.getTextContent()));
|
|
101
|
-
}
|
|
102
|
-
function it(t, e) {
|
|
103
|
-
const n = t.getTextContent(), o = e.fullMatchRegExpByTag["`"], r = e.transformersByTag["`"], s = [];
|
|
104
|
-
let i = null;
|
|
105
|
-
if (o && r) {
|
|
106
|
-
const t = new RegExp(o.source, "g"), e = Array.from(n.matchAll(t));
|
|
107
|
-
for (const t of e) {
|
|
108
|
-
const e = t.index + t[1].length, n = t.index + t[0].length;
|
|
109
|
-
i || (i = {
|
|
110
|
-
content: t[3],
|
|
111
|
-
endIndex: n,
|
|
112
|
-
startIndex: e,
|
|
113
|
-
tag: "`"
|
|
114
|
-
}), s.push({
|
|
115
|
-
end: n,
|
|
116
|
-
start: e
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const l = function(t, e, n = []) {
|
|
121
|
-
const o = [], r = new Set(Object.keys(e.transformersByTag).filter((t) => "`" !== t[0]).map((t) => t[0])), s = (e) => {
|
|
122
|
-
let n = 0;
|
|
123
|
-
for (let o = e - 1; o >= 0 && "\\" === t[o]; o--) n++;
|
|
124
|
-
return n % 2 == 1;
|
|
125
|
-
}, i = (t) => n.some((e) => t >= e.start && t < e.end);
|
|
126
|
-
let l = 0;
|
|
127
|
-
for (; l < t.length;) {
|
|
128
|
-
const e = t[l];
|
|
129
|
-
if (!r.has(e) || s(l) || i(l)) {
|
|
130
|
-
l++;
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
let n = 1;
|
|
134
|
-
for (; l + n < t.length && t[l + n] === e;) n++;
|
|
135
|
-
const c = lt(e, t, l, n, !0), a = lt(e, t, l, n, !1);
|
|
136
|
-
(c || a) && o.push({
|
|
137
|
-
active: !0,
|
|
138
|
-
canClose: a,
|
|
139
|
-
canOpen: c,
|
|
140
|
-
char: e,
|
|
141
|
-
index: l,
|
|
142
|
-
length: n,
|
|
143
|
-
originalLength: n
|
|
144
|
-
}), l += n;
|
|
145
|
-
}
|
|
146
|
-
return o;
|
|
147
|
-
}(n, e, s), c = l.length > 0 ? function(t, e, n) {
|
|
148
|
-
const o = {};
|
|
149
|
-
let r = 0, s = null;
|
|
150
|
-
for (; r < e.length;) {
|
|
151
|
-
const i = e[r];
|
|
152
|
-
if (!i.active || !i.canClose || 0 === i.length) {
|
|
153
|
-
r++;
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
const l = `${i.char}${i.canOpen}`, c = o[l] ?? -1;
|
|
157
|
-
let a = !1;
|
|
158
|
-
for (let o = r - 1; o > c; o--) {
|
|
159
|
-
const l = e[o];
|
|
160
|
-
if (!l.active || !l.canOpen || 0 === l.length || l.char !== i.char) continue;
|
|
161
|
-
if (l.canClose || i.canOpen) {
|
|
162
|
-
if ((l.originalLength + i.originalLength) % 3 == 0 && l.originalLength % 3 != 0 && i.originalLength % 3 != 0) continue;
|
|
163
|
-
}
|
|
164
|
-
const c = Math.min(l.length, i.length), f = Object.keys(n.transformersByTag).filter((t) => t[0] === l.char && t.length <= c).sort((t, e) => e.length - t.length)[0];
|
|
165
|
-
if (!f) continue;
|
|
166
|
-
a = !0;
|
|
167
|
-
const u = f.length, g = {
|
|
168
|
-
content: t.slice(l.index + l.length, i.index),
|
|
169
|
-
endIndex: i.index + u,
|
|
170
|
-
startIndex: l.index + (l.length - u),
|
|
171
|
-
tag: f
|
|
172
|
-
};
|
|
173
|
-
(!s || g.startIndex < s.startIndex || g.startIndex === s.startIndex && g.endIndex > s.endIndex) && (s = g);
|
|
174
|
-
for (let t = o + 1; t < r; t++) e[t].active = !1;
|
|
175
|
-
l.length -= u, i.length -= u, l.active = l.length > 0, i.length > 0 ? i.index += u : (i.active = !1, r++);
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
a || (o[l] = r - 1, i.canOpen || (i.active = !1), r++);
|
|
179
|
-
}
|
|
180
|
-
return s;
|
|
181
|
-
}(n, l, e) : null;
|
|
182
|
-
let a = null, f = null;
|
|
183
|
-
if (i && c ? c.startIndex <= i.startIndex && c.endIndex >= i.endIndex ? (a = c, f = e.transformersByTag[c.tag]) : (a = i, f = r) : i ? (a = i, f = r) : c && (a = c, f = e.transformersByTag[c.tag]), !a || !f) return null;
|
|
184
|
-
const u = [
|
|
185
|
-
n.slice(a.startIndex, a.endIndex),
|
|
186
|
-
a.tag,
|
|
187
|
-
a.content
|
|
188
|
-
];
|
|
189
|
-
return u.index = a.startIndex, u.input = n, {
|
|
190
|
-
endIndex: a.endIndex,
|
|
191
|
-
match: u,
|
|
192
|
-
startIndex: a.startIndex,
|
|
193
|
-
transformer: f
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function lt(t, e, n, o, r) {
|
|
197
|
-
if (!ct(e, n, o, r)) return !1;
|
|
198
|
-
if ("*" === t) return !0;
|
|
199
|
-
if ("_" === t) {
|
|
200
|
-
if (!ct(e, n, o, !r)) return !0;
|
|
201
|
-
const t = r ? e[n - 1] : e[n + o];
|
|
202
|
-
return void 0 !== t && V.test(t);
|
|
203
|
-
}
|
|
204
|
-
return !0;
|
|
205
|
-
}
|
|
206
|
-
function ct(t, e, n, o) {
|
|
207
|
-
const r = t[e - 1], s = t[e + n], [i, l] = o ? [s, r] : [r, s];
|
|
208
|
-
return void 0 !== i && !Q.test(i) && (!V.test(i) || void 0 === l || Q.test(l) || V.test(l));
|
|
209
|
-
}
|
|
210
|
-
function at(t) {
|
|
211
|
-
return $isTextNode(t) && !t.hasFormat("code");
|
|
212
|
-
}
|
|
213
|
-
function ft(t, e, n) {
|
|
214
|
-
let o = it(t, e), r = function(t, e) {
|
|
215
|
-
const n = t;
|
|
216
|
-
let o, r, s, i;
|
|
217
|
-
for (const t of e) {
|
|
218
|
-
if (!t.replace || !t.importRegExp) continue;
|
|
219
|
-
const e = n.getTextContent().match(t.importRegExp);
|
|
220
|
-
if (!e) continue;
|
|
221
|
-
const l = e.index || 0, c = t.getEndIndex ? t.getEndIndex(n, e) : l + e[0].length;
|
|
222
|
-
!1 !== c && (void 0 === o || void 0 === r || l < o && (c > r || c <= o)) && (o = l, r = c, s = t, i = e);
|
|
223
|
-
}
|
|
224
|
-
return void 0 === o || void 0 === r || void 0 === s || void 0 === i ? null : {
|
|
225
|
-
endIndex: r,
|
|
226
|
-
match: i,
|
|
227
|
-
startIndex: o,
|
|
228
|
-
transformer: s
|
|
229
|
-
};
|
|
230
|
-
}(t, n);
|
|
231
|
-
if (o && r && (o.startIndex <= r.startIndex && o.endIndex >= r.endIndex || r.startIndex > o.endIndex ? r = null : o = null), o) {
|
|
232
|
-
const r = function(t, e, n, o, r) {
|
|
233
|
-
const s = t.getTextContent();
|
|
234
|
-
let i, l, c;
|
|
235
|
-
if (r[0] === s ? i = t : 0 === e ? [i, l] = t.splitText(n) : [c, i, l] = t.splitText(e, n), i.setTextContent(r[2]), o) for (const t of o.format) i.hasFormat(t) || i.toggleFormat(t);
|
|
236
|
-
return {
|
|
237
|
-
nodeAfter: l,
|
|
238
|
-
nodeBefore: c,
|
|
239
|
-
transformedNode: i
|
|
240
|
-
};
|
|
241
|
-
}(t, o.startIndex, o.endIndex, o.transformer, o.match);
|
|
242
|
-
at(r.nodeAfter) && ft(r.nodeAfter, e, n), at(r.nodeBefore) && ft(r.nodeBefore, e, n), at(r.transformedNode) && ft(r.transformedNode, e, n);
|
|
243
|
-
} else if (r) {
|
|
244
|
-
const o = function(t, e, n, o, r) {
|
|
245
|
-
let s, i, l;
|
|
246
|
-
return 0 === e ? [s, i] = t.splitText(n) : [l, s, i] = t.splitText(e, n), o.replace ? {
|
|
247
|
-
nodeAfter: i,
|
|
248
|
-
nodeBefore: l,
|
|
249
|
-
transformedNode: o.replace(s, r) || void 0
|
|
250
|
-
} : null;
|
|
251
|
-
}(t, r.startIndex, r.endIndex, r.transformer, r.match);
|
|
252
|
-
if (!o) return;
|
|
253
|
-
at(o.nodeAfter) && ft(o.nodeAfter, e, n), at(o.nodeBefore) && ft(o.nodeBefore, e, n), at(o.transformedNode) && ft(o.transformedNode, e, n);
|
|
254
|
-
}
|
|
255
|
-
const s = Z(t.getTextContent());
|
|
256
|
-
t.setTextContent(s);
|
|
257
|
-
}
|
|
258
|
-
function ut(t, e = !1) {
|
|
259
|
-
const r = H(t), s = function(t) {
|
|
260
|
-
const e = {}, n = {}, o = [];
|
|
261
|
-
for (const r of t) {
|
|
262
|
-
const { tag: t } = r;
|
|
263
|
-
e[t] = r;
|
|
264
|
-
const s = t.replace(/(\*|\^|\+)/g, "\\$1");
|
|
265
|
-
o.push(s), 1 === t.length ? n[t] = "`" === t ? /* @__PURE__ */ new RegExp("(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)") : new RegExp(`(^|[^\\\\${s}])(${s})((\\\\${s})?.*?[^${s}\\s](\\\\${s})?)(${s})(?![\\\\${s}])`) : n[t] = new RegExp(`(^|[^\\\\])(${s})((\\\\${s})?.*?[^\\s](\\\\${s})?)(${s})(?!\\\\)`);
|
|
266
|
-
}
|
|
267
|
-
return {
|
|
268
|
-
fullMatchRegExpByTag: n,
|
|
269
|
-
openTagsRegExp: new RegExp(`(${o.join("|")})`, "g"),
|
|
270
|
-
transformersByTag: e
|
|
271
|
-
};
|
|
272
|
-
}(r.textFormat);
|
|
273
|
-
return (t, l) => {
|
|
274
|
-
const c = t.split("\n"), a = c.length, f = l || $getRoot();
|
|
275
|
-
f.clear();
|
|
276
|
-
for (let t = 0; t < a; t++) {
|
|
277
|
-
const n = c[t], [o, i] = gt(c, t, r.multilineElement, f);
|
|
278
|
-
o ? t = i : dt(n, f, r.element, s, r.textMatch, e);
|
|
279
|
-
}
|
|
280
|
-
const u = f.getChildren();
|
|
281
|
-
for (const t of u) if (!e && Y(t) && f.getChildrenSize() > 1) t.remove();
|
|
282
|
-
else if ($isElementNode(t)) for (const e of t.getAllTextNodes()) pt(e);
|
|
283
|
-
null !== $getSelection() && f.selectStart();
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
function gt(t, e, n, o) {
|
|
287
|
-
for (const r of n) {
|
|
288
|
-
const { handleImportAfterStartMatch: n, regExpEnd: s, regExpStart: i, replace: l } = r, c = t[e].match(i);
|
|
289
|
-
if (!c) continue;
|
|
290
|
-
if (n) {
|
|
291
|
-
const s = n({
|
|
292
|
-
lines: t,
|
|
293
|
-
rootNode: o,
|
|
294
|
-
startLineIndex: e,
|
|
295
|
-
startMatch: c,
|
|
296
|
-
transformer: r
|
|
297
|
-
});
|
|
298
|
-
if (null === s) continue;
|
|
299
|
-
if (s) return s;
|
|
300
|
-
}
|
|
301
|
-
const a = "object" == typeof s && "regExp" in s ? s.regExp : s, f = s && "object" == typeof s && "optional" in s ? s.optional : !s;
|
|
302
|
-
let u = e;
|
|
303
|
-
const g = t.length;
|
|
304
|
-
for (; u < g;) {
|
|
305
|
-
const n = a ? t[u].match(a) : null;
|
|
306
|
-
if (!n && (!f || f && u < g - 1)) {
|
|
307
|
-
u++;
|
|
308
|
-
continue;
|
|
309
|
-
}
|
|
310
|
-
if (n && e === u && n.index === c.index) {
|
|
311
|
-
u++;
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
const r = [];
|
|
315
|
-
if (n && e === u) r.push(t[e].slice(c[0].length, -n[0].length));
|
|
316
|
-
else for (let o = e; o <= u; o++) if (o === e) {
|
|
317
|
-
const e = t[o].slice(c[0].length);
|
|
318
|
-
r.push(e);
|
|
319
|
-
} else if (o === u && n) {
|
|
320
|
-
const e = t[o].slice(0, -n[0].length);
|
|
321
|
-
r.push(e);
|
|
322
|
-
} else r.push(t[o]);
|
|
323
|
-
if (!1 !== l(o, null, c, n, r, !0)) return [!0, u];
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return [!1, e];
|
|
328
|
-
}
|
|
329
|
-
function dt(n, o, r, s, i, f) {
|
|
330
|
-
const u = $createTextNode(n), g = $createParagraphNode();
|
|
331
|
-
g.append(u), o.append(g);
|
|
332
|
-
for (const { regExp: t, replace: e } of r) {
|
|
333
|
-
const o = n.match(t);
|
|
334
|
-
if (o && (u.setTextContent(n.slice(o[0].length)), !1 !== e(g, [u], o, !0))) break;
|
|
335
|
-
}
|
|
336
|
-
if (ft(u, s, i), g.isAttached() && n.length > 0) {
|
|
337
|
-
const n = g.getPreviousSibling();
|
|
338
|
-
if (!f && ($isParagraphNode(n) || $isQuoteNode(n) || $isListNode(n))) {
|
|
339
|
-
let t = n;
|
|
340
|
-
if ($isListNode(n)) {
|
|
341
|
-
const e = n.getLastDescendant();
|
|
342
|
-
t = null == e ? null : $findMatchingParent$1(e, $isListItemNode);
|
|
343
|
-
}
|
|
344
|
-
if (null != t && t.getTextContentSize() > 0) {
|
|
345
|
-
const n = t.getLastChild();
|
|
346
|
-
if ($isTextNode(n)) {
|
|
347
|
-
const t = n.getTextContent();
|
|
348
|
-
t.endsWith("\\") ? n.setTextContent(t.slice(0, -1)) : / {2,}$/.test(t) && n.setTextContent(t.replace(/ {2,}$/, ""));
|
|
349
|
-
}
|
|
350
|
-
t.splice(t.getChildrenSize(), 0, [$createLineBreakNode(), ...g.getChildren()]), g.remove();
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
function pt(t) {
|
|
356
|
-
const e = /* @__PURE__ */ new Set(), n = t.getTextContent();
|
|
357
|
-
let o = n.indexOf(" ");
|
|
358
|
-
for (; -1 !== o;) e.add(o), e.add(o + 1), o = n.indexOf(" ", o + 1);
|
|
359
|
-
t.splitText(...e).forEach((t) => {
|
|
360
|
-
" " === t.getTextContent() && t.replace($createTabNode());
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
function ht(t, ...e) {
|
|
364
|
-
const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
365
|
-
o.append("code", t);
|
|
366
|
-
for (const t of e) o.append("v", t);
|
|
367
|
-
throw n.search = o.toString(), Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
368
|
-
}
|
|
369
|
-
const xt = /^(\s*)(\d{1,})\.\s/, mt = /^(\s*)[-*+]\s/, Ct = /^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i, Tt = /^(#{1,6})\s/, $t = /^>\s/, vt = /^([ \t]*`{3,})([\w-]+)?[ \t]?/, yt = /^[ \t]*`{3,}$/, Et = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/, It = /^(?:\|)(.+)(?:\|)\s?$/, bt = /^(\| ?:?-*:? ?)+\|\s?$/, St = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i, wt = /^<\/[a-z_][\w-]*\s*>/i, Nt = (t) => new RegExp(`(?:${t.source})$`, t.flags), Ft = createState("mdListMarker", {
|
|
370
|
-
parse: (t) => "string" == typeof t && /^[-*+]$/.test(t) ? t : "-",
|
|
371
|
-
resetOnCopyNode: !0
|
|
372
|
-
}), Lt = createState("mdCodeFence", {
|
|
373
|
-
parse: (t) => "string" == typeof t && /^`{3,}$/.test(t) ? t : "```",
|
|
374
|
-
resetOnCopyNode: !0
|
|
375
|
-
}), kt = (t) => (e, n, o, r) => {
|
|
376
|
-
const s = t(o);
|
|
377
|
-
s.append(...n), e.replace(s), r || s.select(0, 0);
|
|
378
|
-
};
|
|
379
|
-
const Rt = (t) => (e, n, o, r) => {
|
|
380
|
-
const s = e.getPreviousSibling(), i = e.getNextSibling(), l = $createListItemNode("check" === t ? "x" === o[3] : void 0), c = o[0].trim()[0], a = "bullet" !== t && "check" !== t || c !== Ft.parse(c) ? void 0 : c;
|
|
381
|
-
if ($isListNode(i) && i.getListType() === t) {
|
|
382
|
-
a && $setState(i, Ft, a);
|
|
383
|
-
const t = i.getFirstChild();
|
|
384
|
-
null !== t ? t.insertBefore(l) : i.append(l), e.remove();
|
|
385
|
-
} else if ($isListNode(s) && s.getListType() === t) a && $setState(s, Ft, a), s.append(l), e.remove();
|
|
386
|
-
else {
|
|
387
|
-
const n = $createListNode(t, "number" === t ? Number(o[2]) : void 0);
|
|
388
|
-
a && $setState(n, Ft, a), n.append(l), e.replace(n);
|
|
389
|
-
}
|
|
390
|
-
l.append(...n), r || l.select(0, 0);
|
|
391
|
-
const f = function(t) {
|
|
392
|
-
const e = t.match(/\t/g), n = t.match(/ /g);
|
|
393
|
-
let o = 0;
|
|
394
|
-
return e && (o += e.length), n && (o += Math.floor(n.length / 4)), o;
|
|
395
|
-
}(o[1]);
|
|
396
|
-
f && l.setIndent(f);
|
|
397
|
-
}, Mt = (t, e, n) => {
|
|
398
|
-
const o = [], r = t.getChildren();
|
|
399
|
-
let s = 0;
|
|
400
|
-
for (const i of r) if ($isListItemNode(i)) {
|
|
401
|
-
if (1 === i.getChildrenSize()) {
|
|
402
|
-
const t = i.getFirstChild();
|
|
403
|
-
if ($isListNode(t)) {
|
|
404
|
-
o.push(Mt(t, e, n + 1));
|
|
405
|
-
continue;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
const r = " ".repeat(4 * n), l = t.getListType(), c = $getState(t, Ft), a = "number" === l ? `${t.getStart() + s}. ` : "check" === l ? `${c} [${i.getChecked() ? "x" : " "}] ` : c + " ";
|
|
409
|
-
let f = e(i);
|
|
410
|
-
"number" !== l && (f = f.replace(/^(\s{0,3}\d+)(\.\s)/, "$1\\$2")), o.push(r + a + f), s++;
|
|
411
|
-
}
|
|
412
|
-
return o.join("\n");
|
|
413
|
-
}, _t = {
|
|
414
|
-
dependencies: [HeadingNode],
|
|
415
|
-
export: (t, e) => {
|
|
416
|
-
if (!$isHeadingNode(t)) return null;
|
|
417
|
-
const n = Number(t.getTag().slice(1));
|
|
418
|
-
return "#".repeat(n) + " " + e(t);
|
|
419
|
-
},
|
|
420
|
-
regExp: Tt,
|
|
421
|
-
replace: kt((t) => {
|
|
422
|
-
return $createHeadingNode("h" + t[1].length);
|
|
423
|
-
}),
|
|
424
|
-
type: "element"
|
|
425
|
-
}, Bt = {
|
|
426
|
-
dependencies: [QuoteNode],
|
|
427
|
-
export: (t, e) => {
|
|
428
|
-
if (!$isQuoteNode(t)) return null;
|
|
429
|
-
const n = e(t).split("\n"), o = [];
|
|
430
|
-
for (const t of n) o.push("> " + t);
|
|
431
|
-
return o.join("\n");
|
|
432
|
-
},
|
|
433
|
-
regExp: $t,
|
|
434
|
-
replace: (t, e, n, o) => {
|
|
435
|
-
if (o) {
|
|
436
|
-
const n = t.getPreviousSibling();
|
|
437
|
-
if ($isQuoteNode(n)) return n.splice(n.getChildrenSize(), 0, [$createLineBreakNode(), ...e]), void t.remove();
|
|
438
|
-
}
|
|
439
|
-
const r = $createQuoteNode();
|
|
440
|
-
r.append(...e), t.replace(r), o || r.select(0, 0);
|
|
441
|
-
},
|
|
442
|
-
type: "element"
|
|
443
|
-
}, Ot = {
|
|
444
|
-
dependencies: [CodeNode],
|
|
445
|
-
export: (t) => {
|
|
446
|
-
if (!$isCodeNode(t)) return null;
|
|
447
|
-
const e = t.getTextContent();
|
|
448
|
-
let n = $getState(t, Lt);
|
|
449
|
-
if (e.indexOf(n) > -1) {
|
|
450
|
-
const t = e.match(/`{3,}/g);
|
|
451
|
-
if (t) {
|
|
452
|
-
const e = Math.max(...t.map((t) => t.length));
|
|
453
|
-
n = "`".repeat(e + 1);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
return n + (t.getLanguage() || "") + (e ? "\n" + e : "") + "\n" + n;
|
|
457
|
-
},
|
|
458
|
-
handleImportAfterStartMatch: ({ lines: t, rootNode: e, startLineIndex: n, startMatch: o }) => {
|
|
459
|
-
const r = o[1], s = r.trim().length, i = t[n], l = o.index + r.length, c = i.slice(l), a = new RegExp(`\`{${s},}$`);
|
|
460
|
-
if (a.test(c)) {
|
|
461
|
-
const t = c.match(a), r = c.slice(0, c.lastIndexOf(t[0])), s = [...o];
|
|
462
|
-
return s[2] = "", Ot.replace(e, null, s, t, [r], !0), [!0, n];
|
|
463
|
-
}
|
|
464
|
-
const f = new RegExp(`^[ \\t]*\`{${s},}$`);
|
|
465
|
-
for (let r = n + 1; r < t.length; r++) {
|
|
466
|
-
const s = t[r];
|
|
467
|
-
if (f.test(s)) {
|
|
468
|
-
const l = s.match(f), c = t.slice(n + 1, r), a = i.slice(o[0].length);
|
|
469
|
-
return a.length > 0 && c.unshift(a), Ot.replace(e, null, o, l, c, !0), [!0, r];
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
const u = t.slice(n + 1), g = i.slice(o[0].length);
|
|
473
|
-
return g.length > 0 && u.unshift(g), Ot.replace(e, null, o, null, u, !0), [!0, t.length - 1];
|
|
474
|
-
},
|
|
475
|
-
regExpEnd: {
|
|
476
|
-
optional: !0,
|
|
477
|
-
regExp: yt
|
|
478
|
-
},
|
|
479
|
-
regExpStart: vt,
|
|
480
|
-
replace: (t, e, n, o, r, s) => {
|
|
481
|
-
let i, c;
|
|
482
|
-
const a = n[1] ? n[1].trim() : "```", f = n[2] || void 0;
|
|
483
|
-
if (!e && r) {
|
|
484
|
-
if (1 === r.length) o ? (i = $createCodeNode(f), c = r[0]) : (i = $createCodeNode(f), c = r[0].startsWith(" ") ? r[0].slice(1) : r[0]);
|
|
485
|
-
else {
|
|
486
|
-
for (i = $createCodeNode(f), r.length > 0 && (0 === r[0].trim().length ? r.shift() : r[0].startsWith(" ") && (r[0] = r[0].slice(1))); r.length > 0 && !r[r.length - 1].length;) r.pop();
|
|
487
|
-
c = r.join("\n");
|
|
488
|
-
}
|
|
489
|
-
$setState(i, Lt, a);
|
|
490
|
-
const e = $createTextNode(c);
|
|
491
|
-
i.append(e), t.append(i);
|
|
492
|
-
} else e && kt((t) => $createCodeNode(t ? t[2] : void 0))(t, e, n, s);
|
|
493
|
-
},
|
|
494
|
-
type: "multiline-element"
|
|
495
|
-
}, jt = {
|
|
496
|
-
dependencies: [ListNode, ListItemNode],
|
|
497
|
-
export: (t, e) => $isListNode(t) ? Mt(t, e, 0) : null,
|
|
498
|
-
regExp: mt,
|
|
499
|
-
replace: Rt("bullet"),
|
|
500
|
-
type: "element"
|
|
501
|
-
}, At = {
|
|
502
|
-
dependencies: [ListNode, ListItemNode],
|
|
503
|
-
export: (t, e) => $isListNode(t) ? Mt(t, e, 0) : null,
|
|
504
|
-
regExp: Ct,
|
|
505
|
-
replace: Rt("check"),
|
|
506
|
-
type: "element"
|
|
507
|
-
}, Pt = {
|
|
508
|
-
dependencies: [ListNode, ListItemNode],
|
|
509
|
-
export: (t, e) => $isListNode(t) ? Mt(t, e, 0) : null,
|
|
510
|
-
regExp: xt,
|
|
511
|
-
replace: Rt("number"),
|
|
512
|
-
type: "element"
|
|
513
|
-
}, zt = {
|
|
514
|
-
format: ["code"],
|
|
515
|
-
tag: "`",
|
|
516
|
-
type: "text-format"
|
|
517
|
-
}, Ut = {
|
|
518
|
-
format: ["highlight"],
|
|
519
|
-
tag: "==",
|
|
520
|
-
type: "text-format"
|
|
521
|
-
}, Wt = {
|
|
522
|
-
format: ["bold", "italic"],
|
|
523
|
-
tag: "***",
|
|
524
|
-
type: "text-format"
|
|
525
|
-
}, Dt = {
|
|
526
|
-
format: ["bold", "italic"],
|
|
527
|
-
intraword: !1,
|
|
528
|
-
tag: "___",
|
|
529
|
-
type: "text-format"
|
|
530
|
-
}, Kt = {
|
|
531
|
-
format: ["bold"],
|
|
532
|
-
tag: "**",
|
|
533
|
-
type: "text-format"
|
|
534
|
-
}, qt = {
|
|
535
|
-
format: ["bold"],
|
|
536
|
-
intraword: !1,
|
|
537
|
-
tag: "__",
|
|
538
|
-
type: "text-format"
|
|
539
|
-
}, Gt = {
|
|
540
|
-
format: ["strikethrough"],
|
|
541
|
-
tag: "~~",
|
|
542
|
-
type: "text-format"
|
|
543
|
-
}, Ht = {
|
|
544
|
-
format: ["italic"],
|
|
545
|
-
tag: "*",
|
|
546
|
-
type: "text-format"
|
|
547
|
-
}, Jt = {
|
|
548
|
-
format: ["italic"],
|
|
549
|
-
intraword: !1,
|
|
550
|
-
tag: "_",
|
|
551
|
-
type: "text-format"
|
|
552
|
-
}, Qt = {
|
|
553
|
-
dependencies: [LinkNode],
|
|
554
|
-
export: (t, e, n) => {
|
|
555
|
-
if (!$isLinkNode(t) || $isAutoLinkNode(t)) return null;
|
|
556
|
-
const o = e(t);
|
|
557
|
-
let r = t.getTitle();
|
|
558
|
-
null != r && (r = r.replace(/([\\"])/g, "\\$1"));
|
|
559
|
-
return r ? `[${o}](${t.getURL()} "${r}")` : `[${o}](${t.getURL()})`;
|
|
560
|
-
},
|
|
561
|
-
importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,
|
|
562
|
-
regExp: /(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,
|
|
563
|
-
replace: (t, e) => {
|
|
564
|
-
if ($findMatchingParent(t, $isLinkNode)) return;
|
|
565
|
-
const [, n, o, r] = e, c = $createLinkNode(null != o ? Z(o) : void 0, { title: null != r ? Z(r) : void 0 }), a = n.split("[").length - 1, f = n.split("]").length - 1;
|
|
566
|
-
let u = n, g = "";
|
|
567
|
-
if (a < f) return;
|
|
568
|
-
if (a > f) {
|
|
569
|
-
const t = n.split("[");
|
|
570
|
-
g = "[" + t[0], u = t.slice(1).join("[");
|
|
571
|
-
}
|
|
572
|
-
const d = $createTextNode(u);
|
|
573
|
-
return d.setFormat(t.getFormat()), c.append(d), t.replace(c), g && c.insertBefore($createTextNode(g)), d;
|
|
574
|
-
},
|
|
575
|
-
trigger: ")",
|
|
576
|
-
type: "text-match"
|
|
577
|
-
}, Vt = [
|
|
578
|
-
_t,
|
|
579
|
-
Bt,
|
|
580
|
-
jt,
|
|
581
|
-
Pt
|
|
582
|
-
], Xt = [Ot], Yt = [
|
|
583
|
-
zt,
|
|
584
|
-
Wt,
|
|
585
|
-
Dt,
|
|
586
|
-
Kt,
|
|
587
|
-
qt,
|
|
588
|
-
Ut,
|
|
589
|
-
Ht,
|
|
590
|
-
Jt,
|
|
591
|
-
Gt
|
|
592
|
-
], Zt = [Qt], te = [
|
|
593
|
-
...Vt,
|
|
594
|
-
...Xt,
|
|
595
|
-
...Yt,
|
|
596
|
-
...Zt
|
|
597
|
-
];
|
|
598
|
-
function ee(t, e, n, o, r) {
|
|
599
|
-
if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
|
|
600
|
-
const i = e.getTextContent();
|
|
601
|
-
if (!r && " " !== i[n - 1]) return !1;
|
|
602
|
-
for (const { regExpStart: s, replace: l, regExpEnd: c } of o) {
|
|
603
|
-
if (c && !("optional" in c) || c && "optional" in c && !c.optional) continue;
|
|
604
|
-
const o = i.match(s);
|
|
605
|
-
if (o) {
|
|
606
|
-
const s = r || o[0].endsWith(" ") ? n : n - 1;
|
|
607
|
-
if (o[0].length !== s) continue;
|
|
608
|
-
const i = e.getNextSiblings(), [c, a] = e.splitText(n);
|
|
609
|
-
if (!1 !== l(t, a ? [a, ...i] : i, o, null, null, !1)) return c.remove(), !0;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
return !1;
|
|
613
|
-
}
|
|
614
|
-
function ne(t, e) {
|
|
615
|
-
let n = 0;
|
|
616
|
-
const o = t.getTextContent();
|
|
617
|
-
for (let t = 0; t < e; t++) "`" === o[t] && n++;
|
|
618
|
-
return n % 2 != 0;
|
|
619
|
-
}
|
|
620
|
-
function oe(t, e, n) {
|
|
621
|
-
const o = n.length;
|
|
622
|
-
for (let r = e; r >= o; r--) {
|
|
623
|
-
const e = r - o;
|
|
624
|
-
if (re(t, e, n, 0, o) && " " !== t[e + o]) return e;
|
|
625
|
-
}
|
|
626
|
-
return -1;
|
|
627
|
-
}
|
|
628
|
-
function re(t, e, n, o, r) {
|
|
629
|
-
for (let s = 0; s < r; s++) if (t[e + s] !== n[o + s]) return !1;
|
|
630
|
-
return !0;
|
|
631
|
-
}
|
|
632
|
-
function se(t, n = te) {
|
|
633
|
-
const o = H(n), r = G(o.textFormat, ({ tag: t }) => t[t.length - 1]), l = G(o.textMatch, ({ trigger: t }) => t);
|
|
634
|
-
for (const e of n) {
|
|
635
|
-
const n = e.type;
|
|
636
|
-
if ("element" === n || "text-match" === n || "multiline-element" === n) {
|
|
637
|
-
const n = e.dependencies;
|
|
638
|
-
for (const e of n) t.hasNode(e) || ht(173, e.getType());
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
const c = (t, n, c) => !!function(t, e, n, o) {
|
|
642
|
-
if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
|
|
643
|
-
const s = e.getTextContent();
|
|
644
|
-
if (" " !== s[n - 1]) return !1;
|
|
645
|
-
for (const { regExp: r, replace: i } of o) {
|
|
646
|
-
const o = s.match(r);
|
|
647
|
-
if (o && o[0].length === (o[0].endsWith(" ") ? n : n - 1)) {
|
|
648
|
-
const r = e.getNextSiblings(), [s, l] = e.splitText(n);
|
|
649
|
-
if (!1 !== i(t, l ? [l, ...r] : r, o, !1)) return s.remove(), !0;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
return !1;
|
|
653
|
-
}(t, n, c, o.element) || !!ee(t, n, c, o.multilineElement) || !!function(t, e, n) {
|
|
654
|
-
let o = t.getTextContent();
|
|
655
|
-
const r = n[o[e - 1]];
|
|
656
|
-
if (null == r) return !1;
|
|
657
|
-
e < o.length && (o = o.slice(0, e));
|
|
658
|
-
for (const e of r) {
|
|
659
|
-
if (!e.replace || !e.regExp) continue;
|
|
660
|
-
const n = o.match(e.regExp);
|
|
661
|
-
if (null === n) continue;
|
|
662
|
-
const r = n.index || 0, s = r + n[0].length;
|
|
663
|
-
let i;
|
|
664
|
-
return 0 === r ? [i] = t.splitText(s) : [, i] = t.splitText(r, s), i.selectNext(0, 0), e.replace(i, n), !0;
|
|
665
|
-
}
|
|
666
|
-
return !1;
|
|
667
|
-
}(n, c, l) || !!function(t, n, o) {
|
|
668
|
-
const r = t.getTextContent(), l = n - 1, c = r[l], a = o[c];
|
|
669
|
-
if (!a) return !1;
|
|
670
|
-
for (const n of a) {
|
|
671
|
-
const { tag: o } = n, a = o.length, f = l - a + 1;
|
|
672
|
-
if (a > 1 && !re(r, f, o, 0, a)) continue;
|
|
673
|
-
if (" " === r[f - 1]) continue;
|
|
674
|
-
const u = r[l + 1];
|
|
675
|
-
if (!1 === n.intraword && u && !J.test(u)) continue;
|
|
676
|
-
const g = t;
|
|
677
|
-
let d = g, p = oe(r, f, o), h = d;
|
|
678
|
-
for (; p < 0 && (h = h.getPreviousSibling()) && !$isLineBreakNode(h);) if ($isTextNode(h)) {
|
|
679
|
-
if (h.hasFormat("code")) continue;
|
|
680
|
-
const t = h.getTextContent();
|
|
681
|
-
d = h, p = oe(t, t.length, o);
|
|
682
|
-
}
|
|
683
|
-
if (p < 0) continue;
|
|
684
|
-
if (d === g && p + a === f) continue;
|
|
685
|
-
const x = d.getTextContent();
|
|
686
|
-
if (p > 0 && x[p - 1] === c) continue;
|
|
687
|
-
const m = x[p - 1];
|
|
688
|
-
if (!1 === n.intraword && m && !J.test(m)) continue;
|
|
689
|
-
if (!n.format.includes("code") && ne(d, p)) continue;
|
|
690
|
-
const T = g.getTextContent(), $ = T.slice(0, f) + T.slice(l + 1);
|
|
691
|
-
g.setTextContent($);
|
|
692
|
-
const v = d === g ? $ : x;
|
|
693
|
-
d.setTextContent(v.slice(0, p) + v.slice(p + a));
|
|
694
|
-
const y = $getSelection(), E = $createRangeSelection();
|
|
695
|
-
$setSelection(E);
|
|
696
|
-
const S = l - a * (d === g ? 2 : 1) + 1;
|
|
697
|
-
E.anchor.set(d.__key, p, "text"), E.focus.set(g.__key, S, "text");
|
|
698
|
-
for (const t of n.format) E.hasFormat(t) || E.formatText(t);
|
|
699
|
-
E.anchor.set(E.focus.key, E.focus.offset, E.focus.type);
|
|
700
|
-
for (const t of n.format) E.hasFormat(t) && E.toggleFormat(t);
|
|
701
|
-
return $isRangeSelection(y) && (E.format = y.format), !0;
|
|
702
|
-
}
|
|
703
|
-
return !1;
|
|
704
|
-
}(n, c, r);
|
|
705
|
-
return mergeRegister(t.registerUpdateListener(({ tags: n, dirtyLeaves: o, editorState: r, prevEditorState: s }) => {
|
|
706
|
-
if (n.has(COLLABORATION_TAG) || n.has(HISTORIC_TAG)) return;
|
|
707
|
-
if (t.isComposing()) return;
|
|
708
|
-
const l = r.read($getSelection), a = s.read($getSelection);
|
|
709
|
-
if (!$isRangeSelection(a) || !$isRangeSelection(l) || !l.isCollapsed() || l.is(a)) return;
|
|
710
|
-
const f = l.anchor.key, u = l.anchor.offset, g = r._nodeMap.get(f);
|
|
711
|
-
!$isTextNode(g) || !o.has(f) || 1 !== u && u > a.anchor.offset + 1 || t.update(() => {
|
|
712
|
-
if (!at(g)) return;
|
|
713
|
-
const t = g.getParent();
|
|
714
|
-
null === t || $isCodeNode(t) || c(t, g, l.anchor.offset) && $addUpdateTag(HISTORY_PUSH_TAG);
|
|
715
|
-
});
|
|
716
|
-
}), t.registerCommand(KEY_ENTER_COMMAND, (t) => {
|
|
717
|
-
if (null !== t && t.shiftKey) return !1;
|
|
718
|
-
const n = $getSelection();
|
|
719
|
-
if (!$isRangeSelection(n) || !n.isCollapsed()) return !1;
|
|
720
|
-
const r = n.anchor.offset, s = n.anchor.getNode();
|
|
721
|
-
if (!$isTextNode(s) || !at(s)) return !1;
|
|
722
|
-
const l = s.getParent();
|
|
723
|
-
if (null === l || $isCodeNode(l)) return !1;
|
|
724
|
-
return r === s.getTextContent().length && !!ee(l, s, r, o.multilineElement, !0) && (null !== t && t.preventDefault(), !0);
|
|
725
|
-
}, COMMAND_PRIORITY_LOW));
|
|
726
|
-
}
|
|
727
|
-
function ie(t, e = te, n, o = !1, r = !1) {
|
|
728
|
-
const s = o ? t : function(t, e = !1) {
|
|
729
|
-
const n = t.split("\n");
|
|
730
|
-
let o = !1;
|
|
731
|
-
const r = [];
|
|
732
|
-
for (let t = 0; t < n.length; t++) {
|
|
733
|
-
const s = n[t], i = s.trimEnd(), l = r[r.length - 1];
|
|
734
|
-
Et.test(i) ? r.push(i) : vt.test(i) || yt.test(i) ? (o = !o, r.push(i)) : o ? r.push(s) : "" === i || "" === l || !l || Tt.test(l) || Tt.test(i) || $t.test(i) || xt.test(i) || mt.test(i) || Ct.test(i) || It.test(i) || bt.test(i) || !e || St.test(i) || wt.test(i) || Nt(wt).test(l) || Nt(St).test(l) || yt.test(l) ? r.push(e || "" === i ? i : s) : r[r.length - 1] = l + " " + i.trimStart();
|
|
735
|
-
}
|
|
736
|
-
return r.join("\n");
|
|
737
|
-
}(t, r);
|
|
738
|
-
return ut(e, o)(s, n);
|
|
739
|
-
}
|
|
740
|
-
function le(t = te, e, o = !1) {
|
|
741
|
-
return function(t, e = !1) {
|
|
742
|
-
const o = H(t), r = [...o.multilineElement, ...o.element], s = !e, i = o.textFormat.filter((t) => 1 === t.format.length).sort((t, e) => Number(t.format.includes("code")) - Number(e.format.includes("code")));
|
|
743
|
-
return (t) => {
|
|
744
|
-
const l = [], c = (t || $getRoot()).getChildren();
|
|
745
|
-
for (let t = 0; t < c.length; t++) {
|
|
746
|
-
const n = c[t], a = tt(n, r, i, o.textMatch, e);
|
|
747
|
-
null != a && l.push(s && t > 0 && !Y(n) && !Y(c[t - 1]) ? "\n".concat(a) : a);
|
|
748
|
-
}
|
|
749
|
-
return l.join("\n");
|
|
750
|
-
};
|
|
751
|
-
}(t, o)(e);
|
|
752
|
-
}
|
|
753
|
-
//#endregion
|
|
754
|
-
export { ie as $convertFromMarkdownString, le as $convertToMarkdownString, Wt as BOLD_ITALIC_STAR, Dt as BOLD_ITALIC_UNDERSCORE, Kt as BOLD_STAR, qt as BOLD_UNDERSCORE, At as CHECK_LIST, Ot as CODE, Vt as ELEMENT_TRANSFORMERS, _t as HEADING, Ut as HIGHLIGHT, zt as INLINE_CODE, Ht as ITALIC_STAR, Jt as ITALIC_UNDERSCORE, Qt as LINK, Xt as MULTILINE_ELEMENT_TRANSFORMERS, Pt as ORDERED_LIST, Bt as QUOTE, Gt as STRIKETHROUGH, Yt as TEXT_FORMAT_TRANSFORMERS, Zt as TEXT_MATCH_TRANSFORMERS, te as TRANSFORMERS, jt as UNORDERED_LIST, se as registerMarkdownShortcuts };
|