@mx-space/cli 0.14.0 → 0.14.2
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-DTxuYHmG.mjs → Lexical.dev-CtGmYDoh.mjs} +770 -271
- package/dist/{Lexical.node-BlCLnfA6.mjs → Lexical.node-8sRFmq2X.mjs} +15 -5
- package/dist/Lexical.prod-D-VfeKDz.mjs +7200 -0
- package/dist/{LexicalClipboard.dev-CdFkLR_D.mjs → LexicalClipboard.dev-CzQ15z6E.mjs} +6 -6
- package/dist/{LexicalClipboard.node-ktUajxsv.mjs → LexicalClipboard.node-D4gMGws6.mjs} +2 -2
- package/dist/{LexicalClipboard.prod-DliyLofW.mjs → LexicalClipboard.prod-CltkQpzS.mjs} +10 -8
- package/dist/{LexicalCodeCore.dev-CL9tHWJX.mjs → LexicalCodeCore.dev-DkYBZRGB.mjs} +11 -9
- package/dist/{LexicalCodeCore.prod-BoMSJc29.mjs → LexicalCodeCore.prod-COc3_QL8.mjs} +178 -167
- package/dist/{LexicalDragon.dev-CqW7Aq5H.mjs → LexicalDragon.dev-Dv5_WUae.mjs} +3 -3
- package/dist/{LexicalDragon.node-DLXctJyy.mjs → LexicalDragon.node-DgjrmWkd.mjs} +2 -2
- package/dist/{LexicalDragon.prod-DHI3T6n5.mjs → LexicalDragon.prod-DnpbDe-_.mjs} +5 -4
- package/dist/{LexicalExtension.dev-BP-18zns.mjs → LexicalExtension.dev-JMH_6-OZ.mjs} +73 -52
- package/dist/{LexicalExtension.node-BWH6xbzG.mjs → LexicalExtension.node-BUozzx4t.mjs} +4 -2
- package/dist/{LexicalExtension.prod-Cs6OgrDn.mjs → LexicalExtension.prod-UiyDgmou.mjs} +370 -347
- package/dist/{LexicalHeadless.dev-DJp__UcP.mjs → LexicalHeadless.dev-BfLGciiX.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-o0v9cIu5.mjs → LexicalHeadless.prod-CWF7edmQ.mjs} +2 -2
- package/dist/{LexicalHtml.dev-DoymwFpG.mjs → LexicalHtml.dev-D5EF5PGW.mjs} +13 -11
- package/dist/{LexicalHtml.node-CVkbWtUA.mjs → LexicalHtml.node-BYbzHNVe.mjs} +4 -4
- package/dist/{LexicalHtml.prod-C2b3z99k.mjs → LexicalHtml.prod-D_FfkvVD.mjs} +330 -299
- package/dist/{LexicalLink.dev-7cgLOLIe.mjs → LexicalLink.dev-D3Pgh6ik.mjs} +53 -23
- package/dist/{LexicalLink.prod-DWFgoXHR.mjs → LexicalLink.prod-XZoAYVYD.mjs} +217 -198
- package/dist/{LexicalList.dev-Ci2iOxFx.mjs → LexicalList.dev-B5d3ObhB.mjs} +49 -44
- package/dist/LexicalList.prod-OQDpVAEb.mjs +967 -0
- package/dist/{LexicalMarkdown.dev-C0ZYCyuR.mjs → LexicalMarkdown.dev-BkM8G3DG.mjs} +61 -42
- package/dist/{LexicalMarkdown.prod-0M-Nc-rh.mjs → LexicalMarkdown.prod-DcVXCex6.mjs} +254 -202
- package/dist/{LexicalRichText.dev-Cnr1kDym.mjs → LexicalRichText.dev-DppD7IrA.mjs} +337 -52
- package/dist/{LexicalRichText.node-BUJZAiap.mjs → LexicalRichText.node-CPSn7dkg.mjs} +12 -8
- package/dist/LexicalRichText.prod-h7JPxFNp.mjs +718 -0
- package/dist/{LexicalSelection.dev-C4L7l8OB.mjs → LexicalSelection.dev-CD0SLbxP.mjs} +48 -17
- package/dist/{LexicalSelection.node-CLKroUMQ.mjs → LexicalSelection.node-CGlJgUlZ.mjs} +5 -4
- package/dist/{LexicalSelection.prod-DzFqpTlw.mjs → LexicalSelection.prod-DbVZN5AV.mjs} +101 -92
- package/dist/{LexicalTable.dev-Cc9-zqKa.mjs → LexicalTable.dev-D0HU14UV.mjs} +340 -138
- package/dist/LexicalTable.prod-BcPNSrxP.mjs +2468 -0
- package/dist/{LexicalUtils.dev-BRgK0L6G.mjs → LexicalUtils.dev-iKy_TrRT.mjs} +15 -19
- package/dist/{LexicalUtils.node-BVAwOkL4.mjs → LexicalUtils.node-CIgMS8cG.mjs} +6 -6
- package/dist/{LexicalUtils.prod-C1gtvVDP.mjs → LexicalUtils.prod-DIAsKJzu.mjs} +155 -159
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-CH7CrOvh.mjs +2 -0
- package/dist/{esm-BNu4sUWV.mjs → esm-CwXl1N0a.mjs} +1801 -6013
- package/dist/index.d.mts +57 -62
- package/dist/index.mjs +1 -1
- package/dist/{mxs-BUqt-N3N.mjs → mxs-iW9DgqSZ.mjs} +14960 -9235
- package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
- package/dist/vendor/litexml/cli.mjs +6693 -5762
- package/dist/vendor/litexml/litexml-html-preview-client.js +11912 -8698
- package/package.json +31 -30
- package/LICENSE +0 -33
- package/dist/Lexical.prod-CeB9UQuo.mjs +0 -6816
- package/dist/LexicalList.prod-D0xX5d3G.mjs +0 -944
- package/dist/LexicalRichText.prod-BfbMQ9uM.mjs +0 -538
- package/dist/LexicalTable.prod-BgO4nCxy.mjs +0 -2336
- package/dist/esm-jbwcVZth.mjs +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
-
import {
|
|
3
|
-
import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-
|
|
4
|
-
//#region ../../node_modules/.pnpm/@lexical+markdown@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-CPSn7dkg.mjs";
|
|
2
|
+
import { $t as COMMAND_PRIORITY_LOW, Cr as createState, Ft as $setSelection, G as $getSelection, Ht as ArtificialNode__DO_NOT_USE, Lt as $setState, St as $isTextNode, W as $getRoot, Yn as KEY_ENTER_COMMAND, Z as $getState, _ as $createTabNode, b as $findMatchingParent, ci as mergeRegister, d as $createLineBreakNode, dt as $isLineBreakNode, en as COMPOSITION_END_TAG, gt as $isRootOrShadowRoot, h as $createRangeSelection, hr as TEXT_TYPE_TO_FORMAT, it as $isDecoratorNode, mt as $isRangeSelection, ot as $isElementNode, p as $createParagraphNode, pt as $isParagraphNode, qt as COLLABORATION_TAG, t as $addUpdateTag, v as $createTextNode, xn as HISTORY_PUSH_TAG, yn as HISTORIC_TAG } from "./Lexical.node-8sRFmq2X.mjs";
|
|
3
|
+
import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-CGlJgUlZ.mjs";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@lexical+markdown@0.48.0_typescript@6.0.3/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
7
|
*
|
|
@@ -9,7 +9,7 @@ import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-CLKr
|
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
function
|
|
12
|
+
function Q(t, e) {
|
|
13
13
|
const n = {};
|
|
14
14
|
for (const o of t) {
|
|
15
15
|
const t = e(o);
|
|
@@ -17,8 +17,8 @@ function J(t, e) {
|
|
|
17
17
|
}
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const e =
|
|
20
|
+
function V(t) {
|
|
21
|
+
const e = Q(t, (t) => t.type);
|
|
22
22
|
return {
|
|
23
23
|
element: e.element || [],
|
|
24
24
|
multilineElement: e["multiline-element"] || [],
|
|
@@ -26,17 +26,28 @@ function Q(t) {
|
|
|
26
26
|
textMatch: e["text-match"] || []
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const X = /[!-/:-@[-`{-~\s]/;
|
|
30
|
+
const Y = /\s/;
|
|
31
|
+
const Z = /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/;
|
|
32
|
+
const tt = /^\s{0,3}$/;
|
|
33
|
+
function et(n) {
|
|
31
34
|
if (!$isParagraphNode(n)) return !1;
|
|
32
35
|
const o = n.getFirstChild();
|
|
33
|
-
return null == o || 1 === n.getChildrenSize() && $isTextNode(o) &&
|
|
36
|
+
return null == o || 1 === n.getChildrenSize() && $isTextNode(o) && tt.test(o.getTextContent());
|
|
34
37
|
}
|
|
35
|
-
function
|
|
38
|
+
function nt(t) {
|
|
36
39
|
return t.replace(/\\([!-/:-@[-`{-~])/g, "$1").replace(/&#(\d+);/g, (t, e) => String.fromCodePoint(Number(e)));
|
|
37
40
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
41
|
+
const ot = /^(\s*)(\d{1,})\.\s/;
|
|
42
|
+
const rt = /^(\s*)[-*+]\s/;
|
|
43
|
+
const st = /^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i;
|
|
44
|
+
const it = /^(#{1,6})\s/;
|
|
45
|
+
const lt = /^>\s/;
|
|
46
|
+
const ct = /^([ \t]*`{3,})([\w-]+)?[ \t]?/;
|
|
47
|
+
const ft = /^[ \t]*`{3,}$/;
|
|
48
|
+
const at = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/;
|
|
49
|
+
const ut = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
50
|
+
function dt(t) {
|
|
40
51
|
if ("|" !== t[0]) return !1;
|
|
41
52
|
const { length: e } = t;
|
|
42
53
|
let n = 1, o = 0;
|
|
@@ -48,25 +59,30 @@ function ut(t) {
|
|
|
48
59
|
}
|
|
49
60
|
return o > 0 && (n === e || n === e - 1 && /\s/.test(t[n]));
|
|
50
61
|
}
|
|
51
|
-
const
|
|
62
|
+
const gt = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i;
|
|
63
|
+
const ht = /^<\/[a-z_][\w-]*\s*>/i;
|
|
64
|
+
const pt = (t) => new RegExp(`(?:${t.source})$`, t.flags);
|
|
65
|
+
const xt = /* @__PURE__ */ createState("mdListMarker", {
|
|
52
66
|
parse: (t) => "string" == typeof t && /^[-*+]$/.test(t) ? t : "-",
|
|
53
67
|
resetOnCopyNode: !0
|
|
54
|
-
})
|
|
68
|
+
});
|
|
69
|
+
const mt = /* @__PURE__ */ createState("mdCodeFence", {
|
|
55
70
|
parse: (t) => "string" == typeof t && /^`{3,}$/.test(t) ? t : "```",
|
|
56
71
|
resetOnCopyNode: !0
|
|
57
|
-
})
|
|
72
|
+
});
|
|
73
|
+
const Ct = /* @__PURE__ */ createState("mdHardLineBreak", {
|
|
58
74
|
parse: (t) => "string" == typeof t && /^(\\| {2,})$/.test(t) ? t : "",
|
|
59
75
|
resetOnCopyNode: !0
|
|
60
76
|
});
|
|
61
|
-
function
|
|
77
|
+
function It(t) {
|
|
62
78
|
if (t.endsWith("\\")) return [t.slice(0, -1), "\\"];
|
|
63
79
|
const e = t.match(/^(.*?\S)( {2,})$/);
|
|
64
80
|
return e ? [e[1], e[2]] : null;
|
|
65
81
|
}
|
|
66
|
-
function
|
|
82
|
+
function Tt(t) {
|
|
67
83
|
const n = t.getChildren(), o = n.length - 1, r = n[o];
|
|
68
84
|
if (!$isTextNode(r)) return null;
|
|
69
|
-
const s = r.getTextContent(), i =
|
|
85
|
+
const s = r.getTextContent(), i = It(s);
|
|
70
86
|
if (null !== i) {
|
|
71
87
|
const [t, e] = i;
|
|
72
88
|
return r.setTextContent(t), e;
|
|
@@ -79,24 +95,24 @@ function It(t) {
|
|
|
79
95
|
return !1;
|
|
80
96
|
}(n, o) ? (r.setTextContent(""), s) : null;
|
|
81
97
|
}
|
|
82
|
-
function
|
|
83
|
-
const e = $createLineBreakNode(), o =
|
|
84
|
-
return null !== o && $setState(e,
|
|
98
|
+
function $t(t) {
|
|
99
|
+
const e = $createLineBreakNode(), o = Tt(t);
|
|
100
|
+
return null !== o && $setState(e, Ct, o), e;
|
|
85
101
|
}
|
|
86
102
|
const Et = (t) => (e, n, o, r) => {
|
|
87
103
|
const s = t(o);
|
|
88
104
|
s.append(...n), e.replace(s), r || s.select(0, 0);
|
|
89
105
|
};
|
|
90
|
-
const
|
|
91
|
-
const i = e.getPreviousSibling(), l = e.getNextSibling(), c = $createListItemNode("check" === t ? "x" === r[3] : void 0), f = r[0].trim()[0], a = "bullet" !== t && "check" !== t || f !==
|
|
106
|
+
const vt = (t) => (e, o, r, s) => {
|
|
107
|
+
const i = e.getPreviousSibling(), l = e.getNextSibling(), c = $createListItemNode("check" === t ? "x" === r[3] : void 0), f = r[0].trim()[0], a = "bullet" !== t && "check" !== t || f !== xt.parse(f) ? void 0 : f;
|
|
92
108
|
if ($isListNode(l) && l.getListType() === t) {
|
|
93
|
-
a && $setState(l,
|
|
109
|
+
a && $setState(l, xt, a);
|
|
94
110
|
const o = l.getFirstChild();
|
|
95
111
|
null !== o ? o.insertBefore(c) : l.append(c), "number" === t && l.setStart(Number(r[2])), e.remove();
|
|
96
|
-
} else if ($isListNode(i) && i.getListType() === t) a && $setState(i,
|
|
112
|
+
} else if ($isListNode(i) && i.getListType() === t) a && $setState(i, xt, a), i.append(c), e.remove();
|
|
97
113
|
else {
|
|
98
114
|
const o = $createListNode(t, "number" === t ? Number(r[2]) : void 0);
|
|
99
|
-
a && $setState(o,
|
|
115
|
+
a && $setState(o, xt, a), o.append(c), e.replace(o);
|
|
100
116
|
}
|
|
101
117
|
c.append(...o), s || c.select(0, 0);
|
|
102
118
|
const u = function(t) {
|
|
@@ -105,38 +121,41 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
105
121
|
return e && (o += e.length), n && (o += Math.floor(n.length / 4)), o;
|
|
106
122
|
}(r[1]);
|
|
107
123
|
u && c.setIndent(u);
|
|
108
|
-
}
|
|
124
|
+
};
|
|
125
|
+
const yt = (t, e, n, o) => {
|
|
109
126
|
const s = [], i = t.getChildren();
|
|
110
127
|
let l = 0;
|
|
111
128
|
for (const c of i) if ($isListItemNode(c)) {
|
|
112
129
|
if (1 === c.getChildrenSize()) {
|
|
113
130
|
const t = c.getFirstChild();
|
|
114
131
|
if ($isListNode(t)) {
|
|
115
|
-
const r =
|
|
132
|
+
const r = yt(t, e, n + 1, o);
|
|
116
133
|
r && s.push(r);
|
|
117
134
|
continue;
|
|
118
135
|
}
|
|
119
136
|
}
|
|
120
137
|
if (o && !c.getChildren().some((t) => t.isSelected(o))) continue;
|
|
121
|
-
const i = " ".repeat(4 * n), f = t.getListType(), a = $getState(t,
|
|
138
|
+
const i = " ".repeat(4 * n), f = t.getListType(), a = $getState(t, xt), u = "number" === f ? `${t.getStart() + l}. ` : "check" === f ? `${a} [${c.getChecked() ? "x" : " "}] ` : a + " ";
|
|
122
139
|
let d = e(c);
|
|
123
140
|
"number" !== f && (d = d.replace(/^(\s{0,3}\d+)(\.\s)/, "$1\\$2")), s.push(i + u + d), l++;
|
|
124
141
|
}
|
|
125
142
|
return s.join("\n");
|
|
126
|
-
}
|
|
143
|
+
};
|
|
144
|
+
const St = {
|
|
127
145
|
dependencies: [HeadingNode],
|
|
128
146
|
export: (t, e) => {
|
|
129
147
|
if (!$isHeadingNode(t)) return null;
|
|
130
148
|
const n = Number(t.getTag().slice(1));
|
|
131
149
|
return "#".repeat(n) + " " + e(t);
|
|
132
150
|
},
|
|
133
|
-
regExp:
|
|
151
|
+
regExp: it,
|
|
134
152
|
replace: Et((t) => {
|
|
135
153
|
return $createHeadingNode("h" + t[1].length);
|
|
136
154
|
}),
|
|
137
155
|
triggerOnEnter: !0,
|
|
138
156
|
type: "element"
|
|
139
|
-
}
|
|
157
|
+
};
|
|
158
|
+
const bt = {
|
|
140
159
|
dependencies: [QuoteNode],
|
|
141
160
|
export: (t, e) => {
|
|
142
161
|
if (!$isQuoteNode(t)) return null;
|
|
@@ -144,23 +163,24 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
144
163
|
for (const t of n) o.push("> " + t);
|
|
145
164
|
return o.join("\n");
|
|
146
165
|
},
|
|
147
|
-
regExp:
|
|
166
|
+
regExp: lt,
|
|
148
167
|
replace: (t, e, n, o) => {
|
|
149
168
|
if (o) {
|
|
150
169
|
const n = t.getPreviousSibling();
|
|
151
|
-
if ($isQuoteNode(n)) return n.splice(n.getChildrenSize(), 0, [
|
|
170
|
+
if ($isQuoteNode(n)) return n.splice(n.getChildrenSize(), 0, [$t(n), ...e]), void t.remove();
|
|
152
171
|
}
|
|
153
172
|
const r = $createQuoteNode();
|
|
154
173
|
r.append(...e), t.replace(r), o || r.select(0, 0);
|
|
155
174
|
},
|
|
156
175
|
triggerOnEnter: !0,
|
|
157
176
|
type: "element"
|
|
158
|
-
}
|
|
177
|
+
};
|
|
178
|
+
const wt = {
|
|
159
179
|
dependencies: [CodeNode],
|
|
160
180
|
export: (t) => {
|
|
161
181
|
if (!$isCodeNode(t)) return null;
|
|
162
182
|
const e = t.getTextContent();
|
|
163
|
-
let n = $getState(t,
|
|
183
|
+
let n = $getState(t, mt);
|
|
164
184
|
if (e.indexOf(n) > -1) {
|
|
165
185
|
const t = e.match(/`{3,}/g);
|
|
166
186
|
if (t) {
|
|
@@ -174,24 +194,24 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
174
194
|
const r = o[1], s = r.trim().length, i = t[n], l = o.index + r.length, c = i.slice(l), f = new RegExp(`\`{${s},}$`);
|
|
175
195
|
if (f.test(c)) {
|
|
176
196
|
const t = c.match(f), r = c.slice(0, c.lastIndexOf(t[0])), s = [...o];
|
|
177
|
-
return s[2] = "",
|
|
197
|
+
return s[2] = "", wt.replace(e, null, s, t, [r], !0), [!0, n];
|
|
178
198
|
}
|
|
179
199
|
const a = new RegExp(`^[ \\t]*\`{${s},}$`);
|
|
180
200
|
for (let r = n + 1; r < t.length; r++) {
|
|
181
201
|
const s = t[r];
|
|
182
202
|
if (a.test(s)) {
|
|
183
203
|
const l = s.match(a), c = t.slice(n + 1, r), f = i.slice(o[0].length);
|
|
184
|
-
return f.length > 0 && c.unshift(f),
|
|
204
|
+
return f.length > 0 && c.unshift(f), wt.replace(e, null, o, l, c, !0), [!0, r];
|
|
185
205
|
}
|
|
186
206
|
}
|
|
187
207
|
const u = t.slice(n + 1), d = i.slice(o[0].length);
|
|
188
|
-
return d.length > 0 && u.unshift(d),
|
|
208
|
+
return d.length > 0 && u.unshift(d), wt.replace(e, null, o, null, u, !0), [!0, t.length - 1];
|
|
189
209
|
},
|
|
190
210
|
regExpEnd: {
|
|
191
211
|
optional: !0,
|
|
192
|
-
regExp:
|
|
212
|
+
regExp: ft
|
|
193
213
|
},
|
|
194
|
-
regExpStart:
|
|
214
|
+
regExpStart: ct,
|
|
195
215
|
replace: (t, e, r, s, i, l) => {
|
|
196
216
|
let c, f;
|
|
197
217
|
const a = r[1] ? r[1].trim() : "```", u = r[2] || void 0;
|
|
@@ -201,74 +221,86 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
201
221
|
for (c = $createCodeNode(u), i.length > 0 && (0 === i[0].trim().length ? i.shift() : i[0].startsWith(" ") && (i[0] = i[0].slice(1))); i.length > 0 && !i[i.length - 1].length;) i.pop();
|
|
202
222
|
f = i.join("\n");
|
|
203
223
|
}
|
|
204
|
-
$setState(c,
|
|
224
|
+
$setState(c, mt, a);
|
|
205
225
|
const e = $createTextNode(f);
|
|
206
226
|
c.append(e), t.append(c);
|
|
207
227
|
} else e && Et((t) => $createCodeNode(t ? t[2] : void 0))(t, e, r, l);
|
|
208
228
|
},
|
|
209
229
|
type: "multiline-element"
|
|
210
|
-
}
|
|
230
|
+
};
|
|
231
|
+
const kt = {
|
|
211
232
|
dependencies: [ListNode, ListItemNode],
|
|
212
|
-
export: (t, e, n) => $isListNode(t) ?
|
|
213
|
-
regExp:
|
|
214
|
-
replace:
|
|
233
|
+
export: (t, e, n) => $isListNode(t) ? yt(t, e, 0, n) : null,
|
|
234
|
+
regExp: rt,
|
|
235
|
+
replace: vt("bullet"),
|
|
215
236
|
triggerOnEnter: !0,
|
|
216
237
|
type: "element"
|
|
217
|
-
}
|
|
238
|
+
};
|
|
239
|
+
const Nt = {
|
|
218
240
|
dependencies: [ListNode, ListItemNode],
|
|
219
|
-
export: (t, e, n) => $isListNode(t) ?
|
|
220
|
-
regExp:
|
|
221
|
-
replace:
|
|
241
|
+
export: (t, e, n) => $isListNode(t) ? yt(t, e, 0, n) : null,
|
|
242
|
+
regExp: st,
|
|
243
|
+
replace: vt("check"),
|
|
222
244
|
triggerOnEnter: !0,
|
|
223
245
|
type: "element"
|
|
224
|
-
}
|
|
246
|
+
};
|
|
247
|
+
const Ft = {
|
|
225
248
|
dependencies: [ListNode, ListItemNode],
|
|
226
|
-
export: (t, e, n) => $isListNode(t) ?
|
|
227
|
-
regExp:
|
|
228
|
-
replace:
|
|
249
|
+
export: (t, e, n) => $isListNode(t) ? yt(t, e, 0, n) : null,
|
|
250
|
+
regExp: ot,
|
|
251
|
+
replace: vt("number"),
|
|
229
252
|
triggerOnEnter: !0,
|
|
230
253
|
type: "element"
|
|
231
|
-
}
|
|
254
|
+
};
|
|
255
|
+
const Ot = {
|
|
232
256
|
format: ["code"],
|
|
233
257
|
tag: "`",
|
|
234
258
|
type: "text-format"
|
|
235
259
|
};
|
|
236
|
-
const
|
|
260
|
+
const Mt = {
|
|
237
261
|
format: ["highlight"],
|
|
238
262
|
tag: "==",
|
|
239
263
|
type: "text-format"
|
|
240
|
-
}
|
|
264
|
+
};
|
|
265
|
+
const _t = {
|
|
241
266
|
format: ["bold", "italic"],
|
|
242
267
|
tag: "***",
|
|
243
268
|
type: "text-format"
|
|
244
|
-
}
|
|
269
|
+
};
|
|
270
|
+
const Bt = {
|
|
245
271
|
format: ["bold", "italic"],
|
|
246
272
|
intraword: !1,
|
|
247
273
|
tag: "___",
|
|
248
274
|
type: "text-format"
|
|
249
|
-
}
|
|
275
|
+
};
|
|
276
|
+
const Lt = {
|
|
250
277
|
format: ["bold"],
|
|
251
278
|
tag: "**",
|
|
252
279
|
type: "text-format"
|
|
253
|
-
}
|
|
280
|
+
};
|
|
281
|
+
const Rt = {
|
|
254
282
|
format: ["bold"],
|
|
255
283
|
intraword: !1,
|
|
256
284
|
tag: "__",
|
|
257
285
|
type: "text-format"
|
|
258
|
-
}
|
|
286
|
+
};
|
|
287
|
+
const jt = {
|
|
259
288
|
format: ["strikethrough"],
|
|
260
289
|
tag: "~~",
|
|
261
290
|
type: "text-format"
|
|
262
|
-
}
|
|
291
|
+
};
|
|
292
|
+
const Pt = {
|
|
263
293
|
format: ["italic"],
|
|
264
294
|
tag: "*",
|
|
265
295
|
type: "text-format"
|
|
266
|
-
}
|
|
296
|
+
};
|
|
297
|
+
const At = {
|
|
267
298
|
format: ["italic"],
|
|
268
299
|
intraword: !1,
|
|
269
300
|
tag: "_",
|
|
270
301
|
type: "text-format"
|
|
271
|
-
}
|
|
302
|
+
};
|
|
303
|
+
const Wt = {
|
|
272
304
|
dependencies: [LinkNode],
|
|
273
305
|
export: (t, e, n) => {
|
|
274
306
|
if (!$isLinkNode(t) || $isAutoLinkNode(t)) return null;
|
|
@@ -281,7 +313,7 @@ const Lt = {
|
|
|
281
313
|
regExp: /(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,
|
|
282
314
|
replace: (t, e) => {
|
|
283
315
|
if ($findMatchingParent(t, $isLinkNode)) return;
|
|
284
|
-
const [, n, r, i] = e, f = $createLinkNode(null != r ?
|
|
316
|
+
const [, n, r, i] = e, f = $createLinkNode(null != r ? nt(r) : void 0, { title: null != i ? nt(i) : void 0 }), a = n.split("[").length - 1, u = n.split("]").length - 1;
|
|
285
317
|
let d = n, g = "";
|
|
286
318
|
if (a < u) return;
|
|
287
319
|
if (a > u) {
|
|
@@ -293,34 +325,65 @@ const Lt = {
|
|
|
293
325
|
},
|
|
294
326
|
trigger: ")",
|
|
295
327
|
type: "text-match"
|
|
296
|
-
}
|
|
297
|
-
|
|
328
|
+
};
|
|
329
|
+
const zt = [
|
|
298
330
|
St,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
331
|
+
bt,
|
|
332
|
+
kt,
|
|
333
|
+
Ft
|
|
334
|
+
];
|
|
335
|
+
const Ut = [wt];
|
|
336
|
+
const Dt = [
|
|
303
337
|
Ot,
|
|
304
|
-
Mt,
|
|
305
338
|
_t,
|
|
306
339
|
Bt,
|
|
307
340
|
Lt,
|
|
308
|
-
|
|
341
|
+
Rt,
|
|
342
|
+
Mt,
|
|
309
343
|
Pt,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
344
|
+
At,
|
|
345
|
+
jt
|
|
346
|
+
];
|
|
347
|
+
const Ht = [Wt];
|
|
348
|
+
const Kt = [
|
|
313
349
|
...zt,
|
|
314
350
|
...Ut,
|
|
315
|
-
...Dt
|
|
351
|
+
...Dt,
|
|
352
|
+
...Ht
|
|
316
353
|
];
|
|
317
|
-
function
|
|
354
|
+
function qt(t, e = !1) {
|
|
355
|
+
const n = t.split("\n");
|
|
356
|
+
let o = 0;
|
|
357
|
+
const r = [];
|
|
358
|
+
for (let t = 0; t < n.length; t++) {
|
|
359
|
+
const s = n[t], i = s.trimEnd(), l = r[r.length - 1], c = t < n.length - 1 ? It(s) : null, f = void 0 !== l && null !== It(l);
|
|
360
|
+
if (at.test(i)) r.push(i);
|
|
361
|
+
else if (0 === o) {
|
|
362
|
+
{
|
|
363
|
+
const t = i.match(ct);
|
|
364
|
+
if (t) {
|
|
365
|
+
o = t[1].trim().length, r.push(i);
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
"" === i || "" === l || !l || it.test(l) || it.test(i) || lt.test(i) || ot.test(i) || rt.test(i) || st.test(i) || ut.test(i) || dt(i) || f || !e || gt.test(i) || ht.test(i) || pt(ht).test(l) || pt(gt).test(l) || ft.test(l) ? r.push(!e && "" !== i || null !== c ? s : i) : r[r.length - 1] = l + " " + (null === c ? i : s).trimStart();
|
|
370
|
+
} else {
|
|
371
|
+
if (ft.test(i) && i.trim().length >= o) {
|
|
372
|
+
o = 0, r.push(i);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
r.push(s);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return r.join("\n");
|
|
379
|
+
}
|
|
380
|
+
function Gt(t, e, n, o, r, s) {
|
|
318
381
|
let i = t.isSelected(e);
|
|
319
382
|
for (const l of n) {
|
|
320
383
|
if (!l.export) continue;
|
|
321
|
-
const n = l.export(t, (t) =>
|
|
384
|
+
const n = l.export(t, (t) => Jt(t, e, o, r, s).markdown, e);
|
|
322
385
|
if (null != n) {
|
|
323
|
-
if (!i && $isElementNode(t))
|
|
386
|
+
if (!i && $isElementNode(t)) Jt(t, e, o, r, s).shouldInclude && (i = !0);
|
|
324
387
|
return {
|
|
325
388
|
markdown: n,
|
|
326
389
|
shouldInclude: i
|
|
@@ -328,7 +391,7 @@ function Kt(t, e, n, o, r, s) {
|
|
|
328
391
|
}
|
|
329
392
|
}
|
|
330
393
|
if ($isElementNode(t)) {
|
|
331
|
-
const n =
|
|
394
|
+
const n = Jt(t, e, o, r, s);
|
|
332
395
|
return {
|
|
333
396
|
markdown: n.markdown,
|
|
334
397
|
shouldInclude: i || n.shouldInclude
|
|
@@ -342,7 +405,7 @@ function Kt(t, e, n, o, r, s) {
|
|
|
342
405
|
shouldInclude: i
|
|
343
406
|
};
|
|
344
407
|
}
|
|
345
|
-
function
|
|
408
|
+
function Jt(t, n, o, r, s, i, l) {
|
|
346
409
|
const f = [], d = t.getChildren();
|
|
347
410
|
let g = !1;
|
|
348
411
|
i || (i = []), l || (l = []);
|
|
@@ -350,20 +413,20 @@ function qt(t, n, o, r, s, i, l) {
|
|
|
350
413
|
let d = t.isSelected(n);
|
|
351
414
|
for (const e of r) {
|
|
352
415
|
if (!e.export) continue;
|
|
353
|
-
const c = e.export(t, (t) =>
|
|
416
|
+
const c = e.export(t, (t) => Jt(t, n, o, r, s, i, [...l, ...i]).markdown, (t, e) => Yt(t, $sliceSelectedTextNodeContent(n, t, "clone").getTextContent(), o, i, l, s));
|
|
354
417
|
if (null != c) {
|
|
355
418
|
!d && $isElementNode(t) && t.getChildren().some((t) => t.isSelected(n)) && t.extractWithChild(t, n, "html") && (d = !0), d && (f.push(c), g = !0);
|
|
356
419
|
continue t;
|
|
357
420
|
}
|
|
358
421
|
}
|
|
359
|
-
if ($isLineBreakNode(t)) d && (f.push(
|
|
422
|
+
if ($isLineBreakNode(t)) d && (f.push(Xt(t)), g = !0);
|
|
360
423
|
else if ($isTextNode(t)) {
|
|
361
424
|
if (d) {
|
|
362
425
|
const e = $sliceSelectedTextNodeContent(n, t, "clone");
|
|
363
|
-
f.push(
|
|
426
|
+
f.push(Yt(t, e.getTextContent(), o, i, l, s)), g = !0;
|
|
364
427
|
}
|
|
365
428
|
} else if ($isElementNode(t)) {
|
|
366
|
-
const e =
|
|
429
|
+
const e = Jt(t, n, o, r, s, i, l);
|
|
367
430
|
!d && e.shouldInclude && t.extractWithChild(t, n, "html") && (d = !0), (d || e.shouldInclude) && (f.push(e.markdown), g = !0);
|
|
368
431
|
} else $isDecoratorNode(t) && d && (f.push(t.getTextContent()), g = !0);
|
|
369
432
|
}
|
|
@@ -372,34 +435,34 @@ function qt(t, n, o, r, s, i, l) {
|
|
|
372
435
|
shouldInclude: g
|
|
373
436
|
};
|
|
374
437
|
}
|
|
375
|
-
function
|
|
438
|
+
function Qt(t, e, n, o, r) {
|
|
376
439
|
for (const s of e) {
|
|
377
440
|
if (!s.export) continue;
|
|
378
|
-
const e = s.export(t, (t) =>
|
|
441
|
+
const e = s.export(t, (t) => Vt(t, n, o, void 0, void 0, r));
|
|
379
442
|
if (null != e) return e;
|
|
380
443
|
}
|
|
381
|
-
return $isElementNode(t) ?
|
|
444
|
+
return $isElementNode(t) ? Vt(t, n, o, void 0, void 0, r) : $isDecoratorNode(t) ? t.getTextContent() : null;
|
|
382
445
|
}
|
|
383
|
-
function
|
|
446
|
+
function Vt(t, n, o, r, s, i = !1) {
|
|
384
447
|
const l = [], f = t.getChildren();
|
|
385
448
|
r || (r = []), s || (s = []);
|
|
386
449
|
t: for (const t of f) {
|
|
387
450
|
for (const e of o) {
|
|
388
451
|
if (!e.export) continue;
|
|
389
|
-
const c = e.export(t, (t) =>
|
|
452
|
+
const c = e.export(t, (t) => Vt(t, n, o, r, [...s, ...r], i), (t, e) => Yt(t, e, n, r, s, i));
|
|
390
453
|
if (null != c) {
|
|
391
454
|
l.push(c);
|
|
392
455
|
continue t;
|
|
393
456
|
}
|
|
394
457
|
}
|
|
395
|
-
$isLineBreakNode(t) ? l.push(
|
|
458
|
+
$isLineBreakNode(t) ? l.push(Xt(t)) : $isTextNode(t) ? l.push(Yt(t, t.getTextContent(), n, r, s, i)) : $isElementNode(t) ? l.push(Vt(t, n, o, r, s, i)) : $isDecoratorNode(t) && l.push(t.getTextContent());
|
|
396
459
|
}
|
|
397
460
|
return l.join("");
|
|
398
461
|
}
|
|
399
|
-
function
|
|
400
|
-
return $getState(t,
|
|
462
|
+
function Xt(t) {
|
|
463
|
+
return $getState(t, Ct) + "\n";
|
|
401
464
|
}
|
|
402
|
-
function
|
|
465
|
+
function Yt(t, e, n, o, r, s = !1) {
|
|
403
466
|
const i = t.hasFormat("code");
|
|
404
467
|
let l, c, f, a, u = e;
|
|
405
468
|
if (i || (u = s ? u.replace(/([*_`~])/g, "\\$1") : u.replace(/([*_`~\\])/g, "\\$1")), i) {
|
|
@@ -421,16 +484,16 @@ function Vt(t, e, n, o, r, s = !1) {
|
|
|
421
484
|
l = t[1], c = t[2], f = t[3], a = "" === c;
|
|
422
485
|
}
|
|
423
486
|
let d = "", g = "", h = "";
|
|
424
|
-
const p =
|
|
487
|
+
const p = Zt(t, !0), x = Zt(t, !1), m = /* @__PURE__ */ new Set();
|
|
425
488
|
for (const e of n) {
|
|
426
489
|
const n = e.format[0], r = e.tag;
|
|
427
|
-
"code" !== n &&
|
|
490
|
+
"code" !== n && ee(t, n) && !m.has(n) && (m.add(n), ee(p, n) && o.find((t) => t.tag === r) || (o.push({
|
|
428
491
|
format: n,
|
|
429
492
|
tag: r
|
|
430
493
|
}), d += r));
|
|
431
494
|
}
|
|
432
495
|
for (let e = 0; e < o.length; e++) {
|
|
433
|
-
const n =
|
|
496
|
+
const n = te(t, o[e].format), s = te(x, o[e].format);
|
|
434
497
|
if (n && s) continue;
|
|
435
498
|
const i = [...o];
|
|
436
499
|
for (; i.length > e;) {
|
|
@@ -441,17 +504,17 @@ function Vt(t, e, n, o, r, s = !1) {
|
|
|
441
504
|
}
|
|
442
505
|
return a && !t.hasFormat("code") ? g + u : g + l + d + c + h + f;
|
|
443
506
|
}
|
|
444
|
-
function
|
|
507
|
+
function Zt(t, n) {
|
|
445
508
|
const o = n ? t.getPreviousSibling() : t.getNextSibling();
|
|
446
509
|
return $isTextNode(o) ? o : null;
|
|
447
510
|
}
|
|
448
|
-
function
|
|
511
|
+
function te(t, n) {
|
|
449
512
|
return $isTextNode(t) && t.hasFormat(n);
|
|
450
513
|
}
|
|
451
|
-
function
|
|
452
|
-
return !!
|
|
514
|
+
function ee(t, e) {
|
|
515
|
+
return !!te(t, e) && ("code" === e || !t || !/^\s*$/.test(t.getTextContent()));
|
|
453
516
|
}
|
|
454
|
-
function
|
|
517
|
+
function ne(t, e) {
|
|
455
518
|
const n = t.getTextContent(), o = e.transformersByTag["`"], r = [];
|
|
456
519
|
let s = null;
|
|
457
520
|
if (o) {
|
|
@@ -522,15 +585,14 @@ function te(t, e) {
|
|
|
522
585
|
}
|
|
523
586
|
let n = 1;
|
|
524
587
|
for (; l + n < t.length && t[l + n] === e;) n++;
|
|
525
|
-
const c =
|
|
588
|
+
const c = oe(e, t, l, n, !0), f = oe(e, t, l, n, !1);
|
|
526
589
|
(c || f) && o.push({
|
|
527
590
|
active: !0,
|
|
528
591
|
canClose: f,
|
|
529
592
|
canOpen: c,
|
|
530
593
|
char: e,
|
|
531
594
|
index: l,
|
|
532
|
-
length: n
|
|
533
|
-
originalLength: n
|
|
595
|
+
length: n
|
|
534
596
|
}), l += n;
|
|
535
597
|
}
|
|
536
598
|
return o;
|
|
@@ -543,13 +605,13 @@ function te(t, e) {
|
|
|
543
605
|
r++;
|
|
544
606
|
continue;
|
|
545
607
|
}
|
|
546
|
-
const l = `${i.char}${i.canOpen}`, c = o[l] ?? -1;
|
|
608
|
+
const l = `${i.char}${i.canOpen}${i.length % 3}`, c = o[l] ?? -1;
|
|
547
609
|
let f = !1;
|
|
548
610
|
for (let o = r - 1; o > c; o--) {
|
|
549
611
|
const l = e[o];
|
|
550
612
|
if (!l.active || !l.canOpen || 0 === l.length || l.char !== i.char) continue;
|
|
551
613
|
if (l.canClose || i.canOpen) {
|
|
552
|
-
if ((l.
|
|
614
|
+
if ((l.length + i.length) % 3 == 0 && l.length % 3 != 0 && i.length % 3 != 0) continue;
|
|
553
615
|
}
|
|
554
616
|
const c = Math.min(l.length, i.length), a = Object.keys(n.transformersByTag).filter((t) => t[0] === l.char && t.length <= c).sort((t, e) => e.length - t.length)[0];
|
|
555
617
|
if (!a) continue;
|
|
@@ -584,25 +646,25 @@ function te(t, e) {
|
|
|
584
646
|
transformer: f
|
|
585
647
|
};
|
|
586
648
|
}
|
|
587
|
-
function
|
|
588
|
-
if (!
|
|
649
|
+
function oe(t, e, n, o, r) {
|
|
650
|
+
if (!re(e, n, o, r)) return !1;
|
|
589
651
|
if ("*" === t) return !0;
|
|
590
652
|
if ("_" === t) {
|
|
591
|
-
if (!
|
|
653
|
+
if (!re(e, n, o, !r)) return !0;
|
|
592
654
|
const t = r ? e[n - 1] : e[n + o];
|
|
593
|
-
return void 0 !== t &&
|
|
655
|
+
return void 0 !== t && Z.test(t);
|
|
594
656
|
}
|
|
595
657
|
return !0;
|
|
596
658
|
}
|
|
597
|
-
function
|
|
659
|
+
function re(t, e, n, o) {
|
|
598
660
|
const r = t[e - 1], s = t[e + n], [i, l] = o ? [s, r] : [r, s];
|
|
599
|
-
return void 0 !== i && !
|
|
661
|
+
return void 0 !== i && !Y.test(i) && (!Z.test(i) || void 0 === l || Y.test(l) || Z.test(l));
|
|
600
662
|
}
|
|
601
|
-
function
|
|
663
|
+
function se(t) {
|
|
602
664
|
return $isTextNode(t) && !t.hasFormat("code");
|
|
603
665
|
}
|
|
604
|
-
function
|
|
605
|
-
let o =
|
|
666
|
+
function ie(t, e, n) {
|
|
667
|
+
let o = ne(t, e), r = function(t, e) {
|
|
606
668
|
const n = t;
|
|
607
669
|
let o, r, s, i;
|
|
608
670
|
for (const t of e) {
|
|
@@ -630,7 +692,7 @@ function re(t, e, n) {
|
|
|
630
692
|
transformedNode: i
|
|
631
693
|
};
|
|
632
694
|
}(t, o.startIndex, o.endIndex, o.transformer, o.match);
|
|
633
|
-
|
|
695
|
+
se(r.nodeAfter) && ie(r.nodeAfter, e, n), se(r.nodeBefore) && ie(r.nodeBefore, e, n), se(r.transformedNode) && ie(r.transformedNode, e, n);
|
|
634
696
|
} else if (r) {
|
|
635
697
|
const o = function(t, e, n, o, r) {
|
|
636
698
|
let s, i, l;
|
|
@@ -641,13 +703,13 @@ function re(t, e, n) {
|
|
|
641
703
|
} : null;
|
|
642
704
|
}(t, r.startIndex, r.endIndex, r.transformer, r.match);
|
|
643
705
|
if (!o) return;
|
|
644
|
-
|
|
706
|
+
se(o.nodeAfter) && ie(o.nodeAfter, e, n), se(o.nodeBefore) && ie(o.nodeBefore, e, n), se(o.transformedNode) && ie(o.transformedNode, e, n);
|
|
645
707
|
}
|
|
646
|
-
const s =
|
|
708
|
+
const s = nt(t.getTextContent());
|
|
647
709
|
t.setTextContent(s);
|
|
648
710
|
}
|
|
649
|
-
function
|
|
650
|
-
const
|
|
711
|
+
function le(t, e, n, o = !1) {
|
|
712
|
+
const r = V(n), s = function(t) {
|
|
651
713
|
const e = {}, n = {}, o = [];
|
|
652
714
|
for (const r of t) {
|
|
653
715
|
const { tag: t } = r;
|
|
@@ -660,21 +722,16 @@ function se(t, e = !1) {
|
|
|
660
722
|
openTagsRegExp: new RegExp(`(${o.join("|")})`, "g"),
|
|
661
723
|
transformersByTag: e
|
|
662
724
|
};
|
|
663
|
-
}(
|
|
664
|
-
|
|
665
|
-
const
|
|
666
|
-
l.
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const c = l.getChildren();
|
|
672
|
-
for (const t of c) if (!e && tt(t) && l.getChildrenSize() > 1) t.remove();
|
|
673
|
-
else if ($isElementNode(t)) for (const e of t.getAllTextNodes()) ce(e);
|
|
674
|
-
null !== $getSelection() && l.selectStart();
|
|
675
|
-
};
|
|
725
|
+
}(r.textFormat), i = t.split("\n"), l = i.length;
|
|
726
|
+
for (let t = 0; t < l; t++) {
|
|
727
|
+
const n = i[t], [l, c] = ce(i, t, r.multilineElement, e);
|
|
728
|
+
l ? t = c : fe(n, e, r.element, s, r.textMatch, o);
|
|
729
|
+
}
|
|
730
|
+
const c = e.getChildren();
|
|
731
|
+
for (const t of c) if (!o && et(t) && e.getChildrenSize() > 1) t.remove();
|
|
732
|
+
else if ($isElementNode(t)) for (const e of t.getAllTextNodes()) ae(e);
|
|
676
733
|
}
|
|
677
|
-
function
|
|
734
|
+
function ce(t, e, n, o) {
|
|
678
735
|
for (const r of n) {
|
|
679
736
|
const { handleImportAfterStartMatch: n, regExpEnd: s, regExpStart: i, replace: l } = r, c = t[e].match(i);
|
|
680
737
|
if (!c) continue;
|
|
@@ -717,14 +774,14 @@ function ie(t, e, n, o) {
|
|
|
717
774
|
}
|
|
718
775
|
return [!1, e];
|
|
719
776
|
}
|
|
720
|
-
function
|
|
777
|
+
function fe(e, n, r, i, l, c) {
|
|
721
778
|
const f = $createTextNode(e), a = $createParagraphNode();
|
|
722
779
|
a.append(f), n.append(a);
|
|
723
780
|
for (const { regExp: t, replace: n } of r) {
|
|
724
781
|
const o = e.match(t);
|
|
725
782
|
if (o && (f.setTextContent(e.slice(o[0].length)), !1 !== n(a, [f], o, !0))) break;
|
|
726
783
|
}
|
|
727
|
-
if (
|
|
784
|
+
if (ie(f, i, l), null !== a.getParent() && e.length > 0) {
|
|
728
785
|
const e = a.getPreviousSibling();
|
|
729
786
|
if (!c && ($isParagraphNode(e) || $isQuoteNode(e) || $isListNode(e))) {
|
|
730
787
|
let t = e;
|
|
@@ -732,11 +789,11 @@ function le(e, n, r, i, l, c) {
|
|
|
732
789
|
const n = e.getLastDescendant();
|
|
733
790
|
t = null == n ? null : $findMatchingParent(n, $isListItemNode);
|
|
734
791
|
}
|
|
735
|
-
null != t && t.getTextContentSize() > 0 && (t.splice(t.getChildrenSize(), 0, [
|
|
792
|
+
null != t && t.getTextContentSize() > 0 && (t.splice(t.getChildrenSize(), 0, [$t(t), ...a.getChildren()]), a.remove());
|
|
736
793
|
}
|
|
737
794
|
}
|
|
738
795
|
}
|
|
739
|
-
function
|
|
796
|
+
function ae(t) {
|
|
740
797
|
const e = /* @__PURE__ */ new Set(), n = t.getTextContent();
|
|
741
798
|
let o = n.indexOf(" ");
|
|
742
799
|
for (; -1 !== o;) e.add(o), e.add(o + 1), o = n.indexOf(" ", o + 1);
|
|
@@ -744,13 +801,13 @@ function ce(t) {
|
|
|
744
801
|
" " === t.getTextContent() && t.replace($createTabNode());
|
|
745
802
|
});
|
|
746
803
|
}
|
|
747
|
-
function
|
|
804
|
+
function ue(t, ...e) {
|
|
748
805
|
const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
749
806
|
o.append("code", t);
|
|
750
807
|
for (const t of e) o.append("v", t);
|
|
751
808
|
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.`);
|
|
752
809
|
}
|
|
753
|
-
function
|
|
810
|
+
function de(t, e, n, o, r) {
|
|
754
811
|
if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
|
|
755
812
|
const i = e.getTextContent();
|
|
756
813
|
if (!r && " " !== i[n - 1]) return !1;
|
|
@@ -763,7 +820,7 @@ function ae(t, e, n, o, r) {
|
|
|
763
820
|
}
|
|
764
821
|
return !1;
|
|
765
822
|
}
|
|
766
|
-
function
|
|
823
|
+
function ge(t, e, n, o, r) {
|
|
767
824
|
if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
|
|
768
825
|
const i = e.getTextContent();
|
|
769
826
|
if (!r && " " !== i[n - 1]) return !1;
|
|
@@ -779,36 +836,36 @@ function ue(t, e, n, o, r) {
|
|
|
779
836
|
}
|
|
780
837
|
return !1;
|
|
781
838
|
}
|
|
782
|
-
function
|
|
839
|
+
function he(t, e) {
|
|
783
840
|
let n = 0;
|
|
784
841
|
const o = t.getTextContent();
|
|
785
842
|
for (let t = 0; t < e; t++) "`" === o[t] && n++;
|
|
786
843
|
return n % 2 != 0;
|
|
787
844
|
}
|
|
788
|
-
function
|
|
845
|
+
function pe(t, e, n) {
|
|
789
846
|
const o = n.length;
|
|
790
847
|
for (let r = e; r >= o; r--) {
|
|
791
848
|
const e = r - o;
|
|
792
|
-
if (
|
|
849
|
+
if (xe(t, e, n, 0, o) && " " !== t[e + o]) return e;
|
|
793
850
|
}
|
|
794
851
|
return -1;
|
|
795
852
|
}
|
|
796
|
-
function
|
|
853
|
+
function xe(t, e, n, o, r) {
|
|
797
854
|
for (let s = 0; s < r; s++) if (t[e + s] !== n[o + s]) return !1;
|
|
798
855
|
return !0;
|
|
799
856
|
}
|
|
800
|
-
function
|
|
801
|
-
const o =
|
|
857
|
+
function me(t, n = Kt) {
|
|
858
|
+
const o = V(n), r = o.element.filter((t) => t.triggerOnEnter), s = Q(o.textFormat, ({ tag: t }) => t[t.length - 1]), i = Q(o.textMatch, ({ trigger: t }) => t), l = /* @__PURE__ */ new Set([" "]);
|
|
802
859
|
for (const t of o.textFormat) l.add(t.tag.slice(-1));
|
|
803
860
|
for (const t of o.textMatch) void 0 !== t.trigger && l.add(t.trigger);
|
|
804
861
|
for (const e of n) {
|
|
805
862
|
const n = e.type;
|
|
806
863
|
if ("element" === n || "text-match" === n || "multiline-element" === n) {
|
|
807
864
|
const n = e.dependencies;
|
|
808
|
-
for (const e of n) t.hasNode(e) ||
|
|
865
|
+
for (const e of n) t.hasNode(e) || ue(173, e.getType());
|
|
809
866
|
}
|
|
810
867
|
}
|
|
811
|
-
const f = (t, n, r) => !!
|
|
868
|
+
const f = (t, n, r) => !!de(t, n, r, o.element) || !!ge(t, n, r, o.multilineElement) || !!function(t, e, n) {
|
|
812
869
|
let o = t.getTextContent();
|
|
813
870
|
const r = n[o[e - 1]];
|
|
814
871
|
if (null == r) return !1;
|
|
@@ -827,36 +884,36 @@ function pe(t, n = Ht) {
|
|
|
827
884
|
if (!l) return !1;
|
|
828
885
|
for (const n of l) {
|
|
829
886
|
const { tag: o } = n, l = o.length, f = s - l + 1;
|
|
830
|
-
if (l > 1 && !
|
|
887
|
+
if (l > 1 && !xe(r, f, o, 0, l)) continue;
|
|
831
888
|
if (" " === r[f - 1]) continue;
|
|
832
889
|
const a = r[s + 1];
|
|
833
|
-
if (!1 === n.intraword && a && !
|
|
890
|
+
if (!1 === n.intraword && a && !X.test(a)) continue;
|
|
834
891
|
const u = t;
|
|
835
|
-
let
|
|
836
|
-
for (;
|
|
837
|
-
if (
|
|
838
|
-
const t =
|
|
839
|
-
|
|
892
|
+
let d = u, g = pe(r, f, o), h = d;
|
|
893
|
+
for (; g < 0 && (h = h.getPreviousSibling()) && !$isLineBreakNode(h);) if ($isTextNode(h)) {
|
|
894
|
+
if (h.hasFormat("code")) continue;
|
|
895
|
+
const t = h.getTextContent();
|
|
896
|
+
d = h, g = pe(t, t.length, o);
|
|
840
897
|
}
|
|
841
|
-
if (
|
|
842
|
-
if (
|
|
843
|
-
const
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
if (!1 === n.intraword &&
|
|
847
|
-
if (!n.format.includes("code") &&
|
|
848
|
-
const
|
|
898
|
+
if (g < 0) continue;
|
|
899
|
+
if (d === u && g + l === f) continue;
|
|
900
|
+
const p = d.getTextContent();
|
|
901
|
+
if (g > 0 && p[g - 1] === i) continue;
|
|
902
|
+
const x = p[g - 1];
|
|
903
|
+
if (!1 === n.intraword && x && !X.test(x)) continue;
|
|
904
|
+
if (!n.format.includes("code") && he(d, g)) continue;
|
|
905
|
+
const m = u.getTextContent(), T = m.slice(0, f) + m.slice(s + 1);
|
|
849
906
|
u.setTextContent(T);
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
const
|
|
907
|
+
const $ = d === u ? T : p;
|
|
908
|
+
d.setTextContent($.slice(0, g) + $.slice(g + l));
|
|
909
|
+
const E = $getSelection(), v = $createRangeSelection();
|
|
853
910
|
$setSelection(v);
|
|
854
|
-
const y = s - l * (
|
|
855
|
-
v.anchor.set(
|
|
911
|
+
const y = s - l * (d === u ? 2 : 1) + 1;
|
|
912
|
+
v.anchor.set(d.__key, g, "text"), v.focus.set(u.__key, y, "text");
|
|
856
913
|
for (const t of n.format) v.formatText(t, TEXT_TYPE_TO_FORMAT[t]);
|
|
857
914
|
v.anchor.set(v.focus.key, v.focus.offset, v.focus.type);
|
|
858
915
|
for (const t of n.format) v.hasFormat(t) && v.toggleFormat(t);
|
|
859
|
-
return $isRangeSelection(
|
|
916
|
+
return $isRangeSelection(E) && (v.format = E.format), !0;
|
|
860
917
|
}
|
|
861
918
|
return !1;
|
|
862
919
|
}(n, r, s);
|
|
@@ -865,16 +922,16 @@ function pe(t, n = Ht) {
|
|
|
865
922
|
if (t.isComposing()) return;
|
|
866
923
|
const i = n.has(COMPOSITION_END_TAG), c = r.read($getSelection), a = s.read($getSelection);
|
|
867
924
|
if (!$isRangeSelection(a) || !$isRangeSelection(c) || !c.isCollapsed() || c.is(a) && !i) return;
|
|
868
|
-
const u = c.anchor.key,
|
|
869
|
-
if ($isTextNode(
|
|
925
|
+
const u = c.anchor.key, d = c.anchor.offset, g = r._nodeMap.get(u);
|
|
926
|
+
if ($isTextNode(g) && o.has(u) && (i || 1 === d || !(d > a.anchor.offset + 1))) {
|
|
870
927
|
if (i) {
|
|
871
|
-
const t = r.read(() =>
|
|
928
|
+
const t = r.read(() => g.getTextContent())[d - 1];
|
|
872
929
|
if (!l.has(t)) return;
|
|
873
930
|
}
|
|
874
931
|
t.update(() => {
|
|
875
|
-
if (!
|
|
876
|
-
const t =
|
|
877
|
-
null === t || $isCodeNode(t) || f(t,
|
|
932
|
+
if (!se(g)) return;
|
|
933
|
+
const t = g.getParent();
|
|
934
|
+
null === t || $isCodeNode(t) || f(t, g, c.anchor.offset) && $addUpdateTag(HISTORY_PUSH_TAG);
|
|
878
935
|
});
|
|
879
936
|
}
|
|
880
937
|
}), t.registerCommand(KEY_ENTER_COMMAND, (t) => {
|
|
@@ -882,51 +939,46 @@ function pe(t, n = Ht) {
|
|
|
882
939
|
const n = $getSelection();
|
|
883
940
|
if (!$isRangeSelection(n) || !n.isCollapsed()) return !1;
|
|
884
941
|
const s = n.anchor.offset, i = n.anchor.getNode();
|
|
885
|
-
if (!$isTextNode(i) || !
|
|
942
|
+
if (!$isTextNode(i) || !se(i)) return !1;
|
|
886
943
|
const l = i.getParent();
|
|
887
944
|
if (null === l || $isCodeNode(l)) return !1;
|
|
888
|
-
return s === i.getTextContent().length && !(!
|
|
945
|
+
return s === i.getTextContent().length && !(!ge(l, i, s, o.multilineElement, !0) && !de(l, i, s, r, !0)) && (null !== t && t.preventDefault(), !0);
|
|
889
946
|
}, COMMAND_PRIORITY_LOW));
|
|
890
947
|
}
|
|
891
|
-
function
|
|
892
|
-
const s = o ? t :
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
ft.test(i) ? r.push(i) : lt.test(i) || ct.test(i) ? (o = !o, r.push(i)) : o ? r.push(s) : "" === i || "" === l || !l || st.test(l) || st.test(i) || it.test(i) || nt.test(i) || ot.test(i) || rt.test(i) || at.test(i) || ut(i) || f || !e || dt.test(i) || gt.test(i) || ht(gt).test(l) || ht(dt).test(l) || ct.test(l) ? r.push(!e && "" !== i || null !== c ? s : i) : r[r.length - 1] = l + " " + (null === c ? i : s).trimStart();
|
|
899
|
-
}
|
|
900
|
-
return r.join("\n");
|
|
901
|
-
}(t, r);
|
|
902
|
-
return se(e, o)(s, n);
|
|
948
|
+
function Ce(t, e = Kt, n, o = !1, r = !1) {
|
|
949
|
+
const s = o ? t : qt(t, r), i = n || $getRoot();
|
|
950
|
+
i.clear(), le(s, i, e, o), null !== $getSelection() && i.selectStart();
|
|
951
|
+
}
|
|
952
|
+
function Ie(t, e = Kt, n = !1, o = !1) {
|
|
953
|
+
const r = n ? t : qt(t, o), s = new ArtificialNode__DO_NOT_USE();
|
|
954
|
+
return le(r, s, e, n), s.getChildren();
|
|
903
955
|
}
|
|
904
|
-
function
|
|
956
|
+
function Te(t = Kt, e, n = !1) {
|
|
905
957
|
return function(t, e = !1) {
|
|
906
|
-
const n =
|
|
958
|
+
const n = V(t), o = [...n.multilineElement, ...n.element], r = !e, s = n.textFormat.filter((t) => 1 === t.format.length).sort((t, e) => Number(t.format.includes("code")) - Number(e.format.includes("code")));
|
|
907
959
|
return (t) => {
|
|
908
960
|
const i = [], l = (t || $getRoot()).getChildren();
|
|
909
961
|
for (let t = 0; t < l.length; t++) {
|
|
910
|
-
const c = l[t], f =
|
|
911
|
-
null != f && i.push(r && t > 0 && !
|
|
962
|
+
const c = l[t], f = Qt(c, o, s, n.textMatch, e);
|
|
963
|
+
null != f && i.push(r && t > 0 && !et(c) && !et(l[t - 1]) ? "\n".concat(f) : f);
|
|
912
964
|
}
|
|
913
965
|
return i.join("\n");
|
|
914
966
|
};
|
|
915
967
|
}(t, n)(e);
|
|
916
968
|
}
|
|
917
|
-
function
|
|
969
|
+
function $e(t = Kt, e, n = !1) {
|
|
918
970
|
if (!e || $isRangeSelection(e) && e.isCollapsed()) return "";
|
|
919
971
|
return function(t, e = !1) {
|
|
920
|
-
const n =
|
|
972
|
+
const n = V(t), o = [...n.multilineElement, ...n.element], r = !e, s = n.textFormat.filter((t) => 1 === t.format.length).sort((t, e) => Number(t.format.includes("code")) - Number(e.format.includes("code")));
|
|
921
973
|
return (t) => {
|
|
922
974
|
const i = [], l = $getRoot().getChildren();
|
|
923
975
|
for (let c = 0; c < l.length; c++) {
|
|
924
|
-
const f = l[c], { shouldInclude: a, markdown: u } =
|
|
925
|
-
a && null != u && i.push(r && c > 0 && !
|
|
976
|
+
const f = l[c], { shouldInclude: a, markdown: u } = Gt(f, t, o, s, n.textMatch, e);
|
|
977
|
+
a && null != u && i.push(r && c > 0 && !et(f) && !et(l[c - 1]) ? "\n".concat(u) : u);
|
|
926
978
|
}
|
|
927
979
|
return i.join("\n");
|
|
928
980
|
};
|
|
929
981
|
}(t, n)(e);
|
|
930
982
|
}
|
|
931
983
|
//#endregion
|
|
932
|
-
export {
|
|
984
|
+
export { Ce as $convertFromMarkdownString, $e as $convertSelectionToMarkdownString, Te as $convertToMarkdownString, Ie as $generateNodesFromMarkdownString, _t as BOLD_ITALIC_STAR, Bt as BOLD_ITALIC_UNDERSCORE, Lt as BOLD_STAR, Rt as BOLD_UNDERSCORE, Nt as CHECK_LIST, wt as CODE, zt as ELEMENT_TRANSFORMERS, St as HEADING, Mt as HIGHLIGHT, Ot as INLINE_CODE, Pt as ITALIC_STAR, At as ITALIC_UNDERSCORE, Wt as LINK, Ut as MULTILINE_ELEMENT_TRANSFORMERS, Ft as ORDERED_LIST, bt as QUOTE, jt as STRIKETHROUGH, Dt as TEXT_FORMAT_TRANSFORMERS, Ht as TEXT_MATCH_TRANSFORMERS, Kt as TRANSFORMERS, kt as UNORDERED_LIST, dt as isTableRowDivider, me as registerMarkdownShortcuts };
|