@mx-space/cli 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -11
- package/dist/{Lexical.dev-DTxuYHmG.mjs → Lexical.dev-Cck4n26y.mjs} +998 -584
- package/dist/{Lexical.node-BlCLnfA6.mjs → Lexical.node-D6wf2D5M.mjs} +15 -5
- package/dist/Lexical.prod-DCwS1oTq.mjs +7170 -0
- package/dist/{LexicalClipboard.dev-CdFkLR_D.mjs → LexicalClipboard.dev-CMkPHV7O.mjs} +6 -6
- package/dist/{LexicalClipboard.node-ktUajxsv.mjs → LexicalClipboard.node-m4nZ7IYw.mjs} +2 -2
- package/dist/{LexicalClipboard.prod-DliyLofW.mjs → LexicalClipboard.prod-B_rN1vE1.mjs} +10 -8
- package/dist/{LexicalCodeCore.dev-CL9tHWJX.mjs → LexicalCodeCore.dev-DyJw3i8V.mjs} +62 -72
- package/dist/{LexicalCodeCore.prod-BoMSJc29.mjs → LexicalCodeCore.prod-DPXLHQLF.mjs} +212 -213
- package/dist/{LexicalDragon.dev-CqW7Aq5H.mjs → LexicalDragon.dev-ZkNfMwrE.mjs} +3 -3
- package/dist/{LexicalDragon.node-DLXctJyy.mjs → LexicalDragon.node-Ds9oLUFh.mjs} +2 -2
- package/dist/{LexicalDragon.prod-DHI3T6n5.mjs → LexicalDragon.prod-B58ic2av.mjs} +5 -4
- package/dist/{LexicalExtension.dev-BP-18zns.mjs → LexicalExtension.dev-DvwHs1Xv.mjs} +79 -67
- package/dist/{LexicalExtension.node-BWH6xbzG.mjs → LexicalExtension.node-5OymZQfy.mjs} +4 -2
- package/dist/{LexicalExtension.prod-Cs6OgrDn.mjs → LexicalExtension.prod-Ce0T5smQ.mjs} +372 -358
- package/dist/{LexicalHeadless.dev-DJp__UcP.mjs → LexicalHeadless.dev-DA0WldSR.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-o0v9cIu5.mjs → LexicalHeadless.prod-1kQgKB6c.mjs} +2 -2
- package/dist/{LexicalHtml.dev-DoymwFpG.mjs → LexicalHtml.dev-BDB7CUrx.mjs} +14 -12
- package/dist/{LexicalHtml.node-CVkbWtUA.mjs → LexicalHtml.node-DpVNt7It.mjs} +4 -4
- package/dist/{LexicalHtml.prod-C2b3z99k.mjs → LexicalHtml.prod-HkxM5scw.mjs} +331 -300
- package/dist/{LexicalLink.dev-7cgLOLIe.mjs → LexicalLink.dev-C5zNJlrm.mjs} +65 -59
- package/dist/{LexicalLink.prod-DWFgoXHR.mjs → LexicalLink.prod-Bkt9hQAt.mjs} +196 -201
- package/dist/{LexicalList.dev-Ci2iOxFx.mjs → LexicalList.dev-B7VgME-m.mjs} +55 -82
- package/dist/LexicalList.prod-B8c7TDjH.mjs +951 -0
- package/dist/{LexicalMarkdown.dev-C0ZYCyuR.mjs → LexicalMarkdown.dev-B5z9kLbV.mjs} +62 -42
- package/dist/{LexicalMarkdown.prod-0M-Nc-rh.mjs → LexicalMarkdown.prod-wKzw7FFH.mjs} +255 -202
- package/dist/{LexicalRichText.dev-Cnr1kDym.mjs → LexicalRichText.dev-CUd6Li5F.mjs} +399 -120
- package/dist/{LexicalRichText.node-BUJZAiap.mjs → LexicalRichText.node-BKfaQ-CH.mjs} +12 -8
- package/dist/LexicalRichText.prod-SBewjJHx.mjs +708 -0
- package/dist/{LexicalSelection.dev-C4L7l8OB.mjs → LexicalSelection.dev-D27JOCqj.mjs} +48 -17
- package/dist/{LexicalSelection.node-CLKroUMQ.mjs → LexicalSelection.node-DBEwPjBu.mjs} +5 -4
- package/dist/{LexicalSelection.prod-DzFqpTlw.mjs → LexicalSelection.prod-OaYhXHOL.mjs} +101 -92
- package/dist/{LexicalTable.dev-Cc9-zqKa.mjs → LexicalTable.dev-6IFFOAE0.mjs} +590 -259
- package/dist/LexicalTable.prod-2CaLZ7fH.mjs +2524 -0
- package/dist/{LexicalUtils.dev-BRgK0L6G.mjs → LexicalUtils.dev-DJA7J_7v.mjs} +15 -19
- package/dist/{LexicalUtils.node-BVAwOkL4.mjs → LexicalUtils.node-Df9oPTlA.mjs} +6 -6
- package/dist/{LexicalUtils.prod-C1gtvVDP.mjs → LexicalUtils.prod-Bb7V4Ewg.mjs} +155 -159
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-CDcJmHkG.mjs +2 -0
- package/dist/{esm-BNu4sUWV.mjs → esm-DLzrv7gD.mjs} +1837 -6015
- package/dist/index.d.mts +57 -62
- package/dist/index.mjs +1 -1
- package/dist/{mxs-CMX2yklg.mjs → mxs-BIRW5Axj.mjs} +13579 -8682
- package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
- package/dist/vendor/litexml/cli.mjs +7043 -6207
- package/dist/vendor/litexml/litexml-html-preview-client.css +80 -47
- package/dist/vendor/litexml/litexml-html-preview-client.js +14422 -10838
- package/dist/vendor/litexml/style.css +6 -2
- package/package.json +23 -23
- package/skills/commands-ai.md +45 -12
- package/skills/overview.md +1 -1
- 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-BKfaQ-CH.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-D6wf2D5M.mjs";
|
|
3
|
+
import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-DBEwPjBu.mjs";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@lexical+markdown@0.49.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,25 @@ 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
|
-
|
|
106
|
+
const vt = (t) => (e, o, r, s) => {
|
|
107
|
+
if ($isHeadingNode(e)) return !1;
|
|
108
|
+
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
109
|
if ($isListNode(l) && l.getListType() === t) {
|
|
93
|
-
a && $setState(l,
|
|
110
|
+
a && $setState(l, xt, a);
|
|
94
111
|
const o = l.getFirstChild();
|
|
95
112
|
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,
|
|
113
|
+
} else if ($isListNode(i) && i.getListType() === t) a && $setState(i, xt, a), i.append(c), e.remove();
|
|
97
114
|
else {
|
|
98
115
|
const o = $createListNode(t, "number" === t ? Number(r[2]) : void 0);
|
|
99
|
-
a && $setState(o,
|
|
116
|
+
a && $setState(o, xt, a), o.append(c), e.replace(o);
|
|
100
117
|
}
|
|
101
118
|
c.append(...o), s || c.select(0, 0);
|
|
102
119
|
const u = function(t) {
|
|
@@ -105,38 +122,41 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
105
122
|
return e && (o += e.length), n && (o += Math.floor(n.length / 4)), o;
|
|
106
123
|
}(r[1]);
|
|
107
124
|
u && c.setIndent(u);
|
|
108
|
-
}
|
|
125
|
+
};
|
|
126
|
+
const yt = (t, e, n, o) => {
|
|
109
127
|
const s = [], i = t.getChildren();
|
|
110
128
|
let l = 0;
|
|
111
129
|
for (const c of i) if ($isListItemNode(c)) {
|
|
112
130
|
if (1 === c.getChildrenSize()) {
|
|
113
131
|
const t = c.getFirstChild();
|
|
114
132
|
if ($isListNode(t)) {
|
|
115
|
-
const r =
|
|
133
|
+
const r = yt(t, e, n + 1, o);
|
|
116
134
|
r && s.push(r);
|
|
117
135
|
continue;
|
|
118
136
|
}
|
|
119
137
|
}
|
|
120
138
|
if (o && !c.getChildren().some((t) => t.isSelected(o))) continue;
|
|
121
|
-
const i = " ".repeat(4 * n), f = t.getListType(), a = $getState(t,
|
|
139
|
+
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
140
|
let d = e(c);
|
|
123
141
|
"number" !== f && (d = d.replace(/^(\s{0,3}\d+)(\.\s)/, "$1\\$2")), s.push(i + u + d), l++;
|
|
124
142
|
}
|
|
125
143
|
return s.join("\n");
|
|
126
|
-
}
|
|
144
|
+
};
|
|
145
|
+
const St = {
|
|
127
146
|
dependencies: [HeadingNode],
|
|
128
147
|
export: (t, e) => {
|
|
129
148
|
if (!$isHeadingNode(t)) return null;
|
|
130
149
|
const n = Number(t.getTag().slice(1));
|
|
131
150
|
return "#".repeat(n) + " " + e(t);
|
|
132
151
|
},
|
|
133
|
-
regExp:
|
|
152
|
+
regExp: it,
|
|
134
153
|
replace: Et((t) => {
|
|
135
154
|
return $createHeadingNode("h" + t[1].length);
|
|
136
155
|
}),
|
|
137
156
|
triggerOnEnter: !0,
|
|
138
157
|
type: "element"
|
|
139
|
-
}
|
|
158
|
+
};
|
|
159
|
+
const bt = {
|
|
140
160
|
dependencies: [QuoteNode],
|
|
141
161
|
export: (t, e) => {
|
|
142
162
|
if (!$isQuoteNode(t)) return null;
|
|
@@ -144,23 +164,24 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
144
164
|
for (const t of n) o.push("> " + t);
|
|
145
165
|
return o.join("\n");
|
|
146
166
|
},
|
|
147
|
-
regExp:
|
|
167
|
+
regExp: lt,
|
|
148
168
|
replace: (t, e, n, o) => {
|
|
149
169
|
if (o) {
|
|
150
170
|
const n = t.getPreviousSibling();
|
|
151
|
-
if ($isQuoteNode(n)) return n.splice(n.getChildrenSize(), 0, [
|
|
171
|
+
if ($isQuoteNode(n)) return n.splice(n.getChildrenSize(), 0, [$t(n), ...e]), void t.remove();
|
|
152
172
|
}
|
|
153
173
|
const r = $createQuoteNode();
|
|
154
174
|
r.append(...e), t.replace(r), o || r.select(0, 0);
|
|
155
175
|
},
|
|
156
176
|
triggerOnEnter: !0,
|
|
157
177
|
type: "element"
|
|
158
|
-
}
|
|
178
|
+
};
|
|
179
|
+
const wt = {
|
|
159
180
|
dependencies: [CodeNode],
|
|
160
181
|
export: (t) => {
|
|
161
182
|
if (!$isCodeNode(t)) return null;
|
|
162
183
|
const e = t.getTextContent();
|
|
163
|
-
let n = $getState(t,
|
|
184
|
+
let n = $getState(t, mt);
|
|
164
185
|
if (e.indexOf(n) > -1) {
|
|
165
186
|
const t = e.match(/`{3,}/g);
|
|
166
187
|
if (t) {
|
|
@@ -174,24 +195,24 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
174
195
|
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
196
|
if (f.test(c)) {
|
|
176
197
|
const t = c.match(f), r = c.slice(0, c.lastIndexOf(t[0])), s = [...o];
|
|
177
|
-
return s[2] = "",
|
|
198
|
+
return s[2] = "", wt.replace(e, null, s, t, [r], !0), [!0, n];
|
|
178
199
|
}
|
|
179
200
|
const a = new RegExp(`^[ \\t]*\`{${s},}$`);
|
|
180
201
|
for (let r = n + 1; r < t.length; r++) {
|
|
181
202
|
const s = t[r];
|
|
182
203
|
if (a.test(s)) {
|
|
183
204
|
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),
|
|
205
|
+
return f.length > 0 && c.unshift(f), wt.replace(e, null, o, l, c, !0), [!0, r];
|
|
185
206
|
}
|
|
186
207
|
}
|
|
187
208
|
const u = t.slice(n + 1), d = i.slice(o[0].length);
|
|
188
|
-
return d.length > 0 && u.unshift(d),
|
|
209
|
+
return d.length > 0 && u.unshift(d), wt.replace(e, null, o, null, u, !0), [!0, t.length - 1];
|
|
189
210
|
},
|
|
190
211
|
regExpEnd: {
|
|
191
212
|
optional: !0,
|
|
192
|
-
regExp:
|
|
213
|
+
regExp: ft
|
|
193
214
|
},
|
|
194
|
-
regExpStart:
|
|
215
|
+
regExpStart: ct,
|
|
195
216
|
replace: (t, e, r, s, i, l) => {
|
|
196
217
|
let c, f;
|
|
197
218
|
const a = r[1] ? r[1].trim() : "```", u = r[2] || void 0;
|
|
@@ -201,74 +222,86 @@ const $t = (t) => (e, o, r, s) => {
|
|
|
201
222
|
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
223
|
f = i.join("\n");
|
|
203
224
|
}
|
|
204
|
-
$setState(c,
|
|
225
|
+
$setState(c, mt, a);
|
|
205
226
|
const e = $createTextNode(f);
|
|
206
227
|
c.append(e), t.append(c);
|
|
207
228
|
} else e && Et((t) => $createCodeNode(t ? t[2] : void 0))(t, e, r, l);
|
|
208
229
|
},
|
|
209
230
|
type: "multiline-element"
|
|
210
|
-
}
|
|
231
|
+
};
|
|
232
|
+
const kt = {
|
|
211
233
|
dependencies: [ListNode, ListItemNode],
|
|
212
|
-
export: (t, e, n) => $isListNode(t) ?
|
|
213
|
-
regExp:
|
|
214
|
-
replace:
|
|
234
|
+
export: (t, e, n) => $isListNode(t) ? yt(t, e, 0, n) : null,
|
|
235
|
+
regExp: rt,
|
|
236
|
+
replace: vt("bullet"),
|
|
215
237
|
triggerOnEnter: !0,
|
|
216
238
|
type: "element"
|
|
217
|
-
}
|
|
239
|
+
};
|
|
240
|
+
const Nt = {
|
|
218
241
|
dependencies: [ListNode, ListItemNode],
|
|
219
|
-
export: (t, e, n) => $isListNode(t) ?
|
|
220
|
-
regExp:
|
|
221
|
-
replace:
|
|
242
|
+
export: (t, e, n) => $isListNode(t) ? yt(t, e, 0, n) : null,
|
|
243
|
+
regExp: st,
|
|
244
|
+
replace: vt("check"),
|
|
222
245
|
triggerOnEnter: !0,
|
|
223
246
|
type: "element"
|
|
224
|
-
}
|
|
247
|
+
};
|
|
248
|
+
const Ft = {
|
|
225
249
|
dependencies: [ListNode, ListItemNode],
|
|
226
|
-
export: (t, e, n) => $isListNode(t) ?
|
|
227
|
-
regExp:
|
|
228
|
-
replace:
|
|
250
|
+
export: (t, e, n) => $isListNode(t) ? yt(t, e, 0, n) : null,
|
|
251
|
+
regExp: ot,
|
|
252
|
+
replace: vt("number"),
|
|
229
253
|
triggerOnEnter: !0,
|
|
230
254
|
type: "element"
|
|
231
|
-
}
|
|
255
|
+
};
|
|
256
|
+
const Ot = {
|
|
232
257
|
format: ["code"],
|
|
233
258
|
tag: "`",
|
|
234
259
|
type: "text-format"
|
|
235
260
|
};
|
|
236
|
-
const
|
|
261
|
+
const Mt = {
|
|
237
262
|
format: ["highlight"],
|
|
238
263
|
tag: "==",
|
|
239
264
|
type: "text-format"
|
|
240
|
-
}
|
|
265
|
+
};
|
|
266
|
+
const _t = {
|
|
241
267
|
format: ["bold", "italic"],
|
|
242
268
|
tag: "***",
|
|
243
269
|
type: "text-format"
|
|
244
|
-
}
|
|
270
|
+
};
|
|
271
|
+
const Bt = {
|
|
245
272
|
format: ["bold", "italic"],
|
|
246
273
|
intraword: !1,
|
|
247
274
|
tag: "___",
|
|
248
275
|
type: "text-format"
|
|
249
|
-
}
|
|
276
|
+
};
|
|
277
|
+
const Lt = {
|
|
250
278
|
format: ["bold"],
|
|
251
279
|
tag: "**",
|
|
252
280
|
type: "text-format"
|
|
253
|
-
}
|
|
281
|
+
};
|
|
282
|
+
const Rt = {
|
|
254
283
|
format: ["bold"],
|
|
255
284
|
intraword: !1,
|
|
256
285
|
tag: "__",
|
|
257
286
|
type: "text-format"
|
|
258
|
-
}
|
|
287
|
+
};
|
|
288
|
+
const jt = {
|
|
259
289
|
format: ["strikethrough"],
|
|
260
290
|
tag: "~~",
|
|
261
291
|
type: "text-format"
|
|
262
|
-
}
|
|
292
|
+
};
|
|
293
|
+
const Pt = {
|
|
263
294
|
format: ["italic"],
|
|
264
295
|
tag: "*",
|
|
265
296
|
type: "text-format"
|
|
266
|
-
}
|
|
297
|
+
};
|
|
298
|
+
const At = {
|
|
267
299
|
format: ["italic"],
|
|
268
300
|
intraword: !1,
|
|
269
301
|
tag: "_",
|
|
270
302
|
type: "text-format"
|
|
271
|
-
}
|
|
303
|
+
};
|
|
304
|
+
const Wt = {
|
|
272
305
|
dependencies: [LinkNode],
|
|
273
306
|
export: (t, e, n) => {
|
|
274
307
|
if (!$isLinkNode(t) || $isAutoLinkNode(t)) return null;
|
|
@@ -281,7 +314,7 @@ const Lt = {
|
|
|
281
314
|
regExp: /(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,
|
|
282
315
|
replace: (t, e) => {
|
|
283
316
|
if ($findMatchingParent(t, $isLinkNode)) return;
|
|
284
|
-
const [, n, r, i] = e, f = $createLinkNode(null != r ?
|
|
317
|
+
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
318
|
let d = n, g = "";
|
|
286
319
|
if (a < u) return;
|
|
287
320
|
if (a > u) {
|
|
@@ -293,34 +326,65 @@ const Lt = {
|
|
|
293
326
|
},
|
|
294
327
|
trigger: ")",
|
|
295
328
|
type: "text-match"
|
|
296
|
-
}
|
|
297
|
-
|
|
329
|
+
};
|
|
330
|
+
const zt = [
|
|
298
331
|
St,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
332
|
+
bt,
|
|
333
|
+
kt,
|
|
334
|
+
Ft
|
|
335
|
+
];
|
|
336
|
+
const Ut = [wt];
|
|
337
|
+
const Dt = [
|
|
303
338
|
Ot,
|
|
304
|
-
Mt,
|
|
305
339
|
_t,
|
|
306
340
|
Bt,
|
|
307
341
|
Lt,
|
|
308
|
-
|
|
342
|
+
Rt,
|
|
343
|
+
Mt,
|
|
309
344
|
Pt,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
345
|
+
At,
|
|
346
|
+
jt
|
|
347
|
+
];
|
|
348
|
+
const Ht = [Wt];
|
|
349
|
+
const Kt = [
|
|
313
350
|
...zt,
|
|
314
351
|
...Ut,
|
|
315
|
-
...Dt
|
|
352
|
+
...Dt,
|
|
353
|
+
...Ht
|
|
316
354
|
];
|
|
317
|
-
function
|
|
355
|
+
function qt(t, e = !1) {
|
|
356
|
+
const n = t.split("\n");
|
|
357
|
+
let o = 0;
|
|
358
|
+
const r = [];
|
|
359
|
+
for (let t = 0; t < n.length; t++) {
|
|
360
|
+
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);
|
|
361
|
+
if (at.test(i)) r.push(i);
|
|
362
|
+
else if (0 === o) {
|
|
363
|
+
{
|
|
364
|
+
const t = i.match(ct);
|
|
365
|
+
if (t) {
|
|
366
|
+
o = t[1].trim().length, r.push(i);
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
"" === 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();
|
|
371
|
+
} else {
|
|
372
|
+
if (ft.test(i) && i.trim().length >= o) {
|
|
373
|
+
o = 0, r.push(i);
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
r.push(s);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return r.join("\n");
|
|
380
|
+
}
|
|
381
|
+
function Gt(t, e, n, o, r, s) {
|
|
318
382
|
let i = t.isSelected(e);
|
|
319
383
|
for (const l of n) {
|
|
320
384
|
if (!l.export) continue;
|
|
321
|
-
const n = l.export(t, (t) =>
|
|
385
|
+
const n = l.export(t, (t) => Jt(t, e, o, r, s).markdown, e);
|
|
322
386
|
if (null != n) {
|
|
323
|
-
if (!i && $isElementNode(t))
|
|
387
|
+
if (!i && $isElementNode(t)) Jt(t, e, o, r, s).shouldInclude && (i = !0);
|
|
324
388
|
return {
|
|
325
389
|
markdown: n,
|
|
326
390
|
shouldInclude: i
|
|
@@ -328,7 +392,7 @@ function Kt(t, e, n, o, r, s) {
|
|
|
328
392
|
}
|
|
329
393
|
}
|
|
330
394
|
if ($isElementNode(t)) {
|
|
331
|
-
const n =
|
|
395
|
+
const n = Jt(t, e, o, r, s);
|
|
332
396
|
return {
|
|
333
397
|
markdown: n.markdown,
|
|
334
398
|
shouldInclude: i || n.shouldInclude
|
|
@@ -342,7 +406,7 @@ function Kt(t, e, n, o, r, s) {
|
|
|
342
406
|
shouldInclude: i
|
|
343
407
|
};
|
|
344
408
|
}
|
|
345
|
-
function
|
|
409
|
+
function Jt(t, n, o, r, s, i, l) {
|
|
346
410
|
const f = [], d = t.getChildren();
|
|
347
411
|
let g = !1;
|
|
348
412
|
i || (i = []), l || (l = []);
|
|
@@ -350,20 +414,20 @@ function qt(t, n, o, r, s, i, l) {
|
|
|
350
414
|
let d = t.isSelected(n);
|
|
351
415
|
for (const e of r) {
|
|
352
416
|
if (!e.export) continue;
|
|
353
|
-
const c = e.export(t, (t) =>
|
|
417
|
+
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
418
|
if (null != c) {
|
|
355
419
|
!d && $isElementNode(t) && t.getChildren().some((t) => t.isSelected(n)) && t.extractWithChild(t, n, "html") && (d = !0), d && (f.push(c), g = !0);
|
|
356
420
|
continue t;
|
|
357
421
|
}
|
|
358
422
|
}
|
|
359
|
-
if ($isLineBreakNode(t)) d && (f.push(
|
|
423
|
+
if ($isLineBreakNode(t)) d && (f.push(Xt(t)), g = !0);
|
|
360
424
|
else if ($isTextNode(t)) {
|
|
361
425
|
if (d) {
|
|
362
426
|
const e = $sliceSelectedTextNodeContent(n, t, "clone");
|
|
363
|
-
f.push(
|
|
427
|
+
f.push(Yt(t, e.getTextContent(), o, i, l, s)), g = !0;
|
|
364
428
|
}
|
|
365
429
|
} else if ($isElementNode(t)) {
|
|
366
|
-
const e =
|
|
430
|
+
const e = Jt(t, n, o, r, s, i, l);
|
|
367
431
|
!d && e.shouldInclude && t.extractWithChild(t, n, "html") && (d = !0), (d || e.shouldInclude) && (f.push(e.markdown), g = !0);
|
|
368
432
|
} else $isDecoratorNode(t) && d && (f.push(t.getTextContent()), g = !0);
|
|
369
433
|
}
|
|
@@ -372,34 +436,34 @@ function qt(t, n, o, r, s, i, l) {
|
|
|
372
436
|
shouldInclude: g
|
|
373
437
|
};
|
|
374
438
|
}
|
|
375
|
-
function
|
|
439
|
+
function Qt(t, e, n, o, r) {
|
|
376
440
|
for (const s of e) {
|
|
377
441
|
if (!s.export) continue;
|
|
378
|
-
const e = s.export(t, (t) =>
|
|
442
|
+
const e = s.export(t, (t) => Vt(t, n, o, void 0, void 0, r));
|
|
379
443
|
if (null != e) return e;
|
|
380
444
|
}
|
|
381
|
-
return $isElementNode(t) ?
|
|
445
|
+
return $isElementNode(t) ? Vt(t, n, o, void 0, void 0, r) : $isDecoratorNode(t) ? t.getTextContent() : null;
|
|
382
446
|
}
|
|
383
|
-
function
|
|
447
|
+
function Vt(t, n, o, r, s, i = !1) {
|
|
384
448
|
const l = [], f = t.getChildren();
|
|
385
449
|
r || (r = []), s || (s = []);
|
|
386
450
|
t: for (const t of f) {
|
|
387
451
|
for (const e of o) {
|
|
388
452
|
if (!e.export) continue;
|
|
389
|
-
const c = e.export(t, (t) =>
|
|
453
|
+
const c = e.export(t, (t) => Vt(t, n, o, r, [...s, ...r], i), (t, e) => Yt(t, e, n, r, s, i));
|
|
390
454
|
if (null != c) {
|
|
391
455
|
l.push(c);
|
|
392
456
|
continue t;
|
|
393
457
|
}
|
|
394
458
|
}
|
|
395
|
-
$isLineBreakNode(t) ? l.push(
|
|
459
|
+
$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
460
|
}
|
|
397
461
|
return l.join("");
|
|
398
462
|
}
|
|
399
|
-
function
|
|
400
|
-
return $getState(t,
|
|
463
|
+
function Xt(t) {
|
|
464
|
+
return $getState(t, Ct) + "\n";
|
|
401
465
|
}
|
|
402
|
-
function
|
|
466
|
+
function Yt(t, e, n, o, r, s = !1) {
|
|
403
467
|
const i = t.hasFormat("code");
|
|
404
468
|
let l, c, f, a, u = e;
|
|
405
469
|
if (i || (u = s ? u.replace(/([*_`~])/g, "\\$1") : u.replace(/([*_`~\\])/g, "\\$1")), i) {
|
|
@@ -421,16 +485,16 @@ function Vt(t, e, n, o, r, s = !1) {
|
|
|
421
485
|
l = t[1], c = t[2], f = t[3], a = "" === c;
|
|
422
486
|
}
|
|
423
487
|
let d = "", g = "", h = "";
|
|
424
|
-
const p =
|
|
488
|
+
const p = Zt(t, !0), x = Zt(t, !1), m = /* @__PURE__ */ new Set();
|
|
425
489
|
for (const e of n) {
|
|
426
490
|
const n = e.format[0], r = e.tag;
|
|
427
|
-
"code" !== n &&
|
|
491
|
+
"code" !== n && ee(t, n) && !m.has(n) && (m.add(n), ee(p, n) && o.find((t) => t.tag === r) || (o.push({
|
|
428
492
|
format: n,
|
|
429
493
|
tag: r
|
|
430
494
|
}), d += r));
|
|
431
495
|
}
|
|
432
496
|
for (let e = 0; e < o.length; e++) {
|
|
433
|
-
const n =
|
|
497
|
+
const n = te(t, o[e].format), s = te(x, o[e].format);
|
|
434
498
|
if (n && s) continue;
|
|
435
499
|
const i = [...o];
|
|
436
500
|
for (; i.length > e;) {
|
|
@@ -441,17 +505,17 @@ function Vt(t, e, n, o, r, s = !1) {
|
|
|
441
505
|
}
|
|
442
506
|
return a && !t.hasFormat("code") ? g + u : g + l + d + c + h + f;
|
|
443
507
|
}
|
|
444
|
-
function
|
|
508
|
+
function Zt(t, n) {
|
|
445
509
|
const o = n ? t.getPreviousSibling() : t.getNextSibling();
|
|
446
510
|
return $isTextNode(o) ? o : null;
|
|
447
511
|
}
|
|
448
|
-
function
|
|
512
|
+
function te(t, n) {
|
|
449
513
|
return $isTextNode(t) && t.hasFormat(n);
|
|
450
514
|
}
|
|
451
|
-
function
|
|
452
|
-
return !!
|
|
515
|
+
function ee(t, e) {
|
|
516
|
+
return !!te(t, e) && ("code" === e || !t || !/^\s*$/.test(t.getTextContent()));
|
|
453
517
|
}
|
|
454
|
-
function
|
|
518
|
+
function ne(t, e) {
|
|
455
519
|
const n = t.getTextContent(), o = e.transformersByTag["`"], r = [];
|
|
456
520
|
let s = null;
|
|
457
521
|
if (o) {
|
|
@@ -522,15 +586,14 @@ function te(t, e) {
|
|
|
522
586
|
}
|
|
523
587
|
let n = 1;
|
|
524
588
|
for (; l + n < t.length && t[l + n] === e;) n++;
|
|
525
|
-
const c =
|
|
589
|
+
const c = oe(e, t, l, n, !0), f = oe(e, t, l, n, !1);
|
|
526
590
|
(c || f) && o.push({
|
|
527
591
|
active: !0,
|
|
528
592
|
canClose: f,
|
|
529
593
|
canOpen: c,
|
|
530
594
|
char: e,
|
|
531
595
|
index: l,
|
|
532
|
-
length: n
|
|
533
|
-
originalLength: n
|
|
596
|
+
length: n
|
|
534
597
|
}), l += n;
|
|
535
598
|
}
|
|
536
599
|
return o;
|
|
@@ -543,13 +606,13 @@ function te(t, e) {
|
|
|
543
606
|
r++;
|
|
544
607
|
continue;
|
|
545
608
|
}
|
|
546
|
-
const l = `${i.char}${i.canOpen}`, c = o[l] ?? -1;
|
|
609
|
+
const l = `${i.char}${i.canOpen}${i.length % 3}`, c = o[l] ?? -1;
|
|
547
610
|
let f = !1;
|
|
548
611
|
for (let o = r - 1; o > c; o--) {
|
|
549
612
|
const l = e[o];
|
|
550
613
|
if (!l.active || !l.canOpen || 0 === l.length || l.char !== i.char) continue;
|
|
551
614
|
if (l.canClose || i.canOpen) {
|
|
552
|
-
if ((l.
|
|
615
|
+
if ((l.length + i.length) % 3 == 0 && l.length % 3 != 0 && i.length % 3 != 0) continue;
|
|
553
616
|
}
|
|
554
617
|
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
618
|
if (!a) continue;
|
|
@@ -584,25 +647,25 @@ function te(t, e) {
|
|
|
584
647
|
transformer: f
|
|
585
648
|
};
|
|
586
649
|
}
|
|
587
|
-
function
|
|
588
|
-
if (!
|
|
650
|
+
function oe(t, e, n, o, r) {
|
|
651
|
+
if (!re(e, n, o, r)) return !1;
|
|
589
652
|
if ("*" === t) return !0;
|
|
590
653
|
if ("_" === t) {
|
|
591
|
-
if (!
|
|
654
|
+
if (!re(e, n, o, !r)) return !0;
|
|
592
655
|
const t = r ? e[n - 1] : e[n + o];
|
|
593
|
-
return void 0 !== t &&
|
|
656
|
+
return void 0 !== t && Z.test(t);
|
|
594
657
|
}
|
|
595
658
|
return !0;
|
|
596
659
|
}
|
|
597
|
-
function
|
|
660
|
+
function re(t, e, n, o) {
|
|
598
661
|
const r = t[e - 1], s = t[e + n], [i, l] = o ? [s, r] : [r, s];
|
|
599
|
-
return void 0 !== i && !
|
|
662
|
+
return void 0 !== i && !Y.test(i) && (!Z.test(i) || void 0 === l || Y.test(l) || Z.test(l));
|
|
600
663
|
}
|
|
601
|
-
function
|
|
664
|
+
function se(t) {
|
|
602
665
|
return $isTextNode(t) && !t.hasFormat("code");
|
|
603
666
|
}
|
|
604
|
-
function
|
|
605
|
-
let o =
|
|
667
|
+
function ie(t, e, n) {
|
|
668
|
+
let o = ne(t, e), r = function(t, e) {
|
|
606
669
|
const n = t;
|
|
607
670
|
let o, r, s, i;
|
|
608
671
|
for (const t of e) {
|
|
@@ -630,7 +693,7 @@ function re(t, e, n) {
|
|
|
630
693
|
transformedNode: i
|
|
631
694
|
};
|
|
632
695
|
}(t, o.startIndex, o.endIndex, o.transformer, o.match);
|
|
633
|
-
|
|
696
|
+
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
697
|
} else if (r) {
|
|
635
698
|
const o = function(t, e, n, o, r) {
|
|
636
699
|
let s, i, l;
|
|
@@ -641,13 +704,13 @@ function re(t, e, n) {
|
|
|
641
704
|
} : null;
|
|
642
705
|
}(t, r.startIndex, r.endIndex, r.transformer, r.match);
|
|
643
706
|
if (!o) return;
|
|
644
|
-
|
|
707
|
+
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
708
|
}
|
|
646
|
-
const s =
|
|
709
|
+
const s = nt(t.getTextContent());
|
|
647
710
|
t.setTextContent(s);
|
|
648
711
|
}
|
|
649
|
-
function
|
|
650
|
-
const
|
|
712
|
+
function le(t, e, n, o = !1) {
|
|
713
|
+
const r = V(n), s = function(t) {
|
|
651
714
|
const e = {}, n = {}, o = [];
|
|
652
715
|
for (const r of t) {
|
|
653
716
|
const { tag: t } = r;
|
|
@@ -660,21 +723,16 @@ function se(t, e = !1) {
|
|
|
660
723
|
openTagsRegExp: new RegExp(`(${o.join("|")})`, "g"),
|
|
661
724
|
transformersByTag: e
|
|
662
725
|
};
|
|
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
|
-
};
|
|
726
|
+
}(r.textFormat), i = t.split("\n"), l = i.length;
|
|
727
|
+
for (let t = 0; t < l; t++) {
|
|
728
|
+
const n = i[t], [l, c] = ce(i, t, r.multilineElement, e);
|
|
729
|
+
l ? t = c : fe(n, e, r.element, s, r.textMatch, o);
|
|
730
|
+
}
|
|
731
|
+
const c = e.getChildren();
|
|
732
|
+
for (const t of c) if (!o && et(t) && e.getChildrenSize() > 1) t.remove();
|
|
733
|
+
else if ($isElementNode(t)) for (const e of t.getAllTextNodes()) ae(e);
|
|
676
734
|
}
|
|
677
|
-
function
|
|
735
|
+
function ce(t, e, n, o) {
|
|
678
736
|
for (const r of n) {
|
|
679
737
|
const { handleImportAfterStartMatch: n, regExpEnd: s, regExpStart: i, replace: l } = r, c = t[e].match(i);
|
|
680
738
|
if (!c) continue;
|
|
@@ -717,14 +775,14 @@ function ie(t, e, n, o) {
|
|
|
717
775
|
}
|
|
718
776
|
return [!1, e];
|
|
719
777
|
}
|
|
720
|
-
function
|
|
778
|
+
function fe(e, n, r, i, l, c) {
|
|
721
779
|
const f = $createTextNode(e), a = $createParagraphNode();
|
|
722
780
|
a.append(f), n.append(a);
|
|
723
781
|
for (const { regExp: t, replace: n } of r) {
|
|
724
782
|
const o = e.match(t);
|
|
725
783
|
if (o && (f.setTextContent(e.slice(o[0].length)), !1 !== n(a, [f], o, !0))) break;
|
|
726
784
|
}
|
|
727
|
-
if (
|
|
785
|
+
if (ie(f, i, l), null !== a.getParent() && e.length > 0) {
|
|
728
786
|
const e = a.getPreviousSibling();
|
|
729
787
|
if (!c && ($isParagraphNode(e) || $isQuoteNode(e) || $isListNode(e))) {
|
|
730
788
|
let t = e;
|
|
@@ -732,11 +790,11 @@ function le(e, n, r, i, l, c) {
|
|
|
732
790
|
const n = e.getLastDescendant();
|
|
733
791
|
t = null == n ? null : $findMatchingParent(n, $isListItemNode);
|
|
734
792
|
}
|
|
735
|
-
null != t && t.getTextContentSize() > 0 && (t.splice(t.getChildrenSize(), 0, [
|
|
793
|
+
null != t && t.getTextContentSize() > 0 && (t.splice(t.getChildrenSize(), 0, [$t(t), ...a.getChildren()]), a.remove());
|
|
736
794
|
}
|
|
737
795
|
}
|
|
738
796
|
}
|
|
739
|
-
function
|
|
797
|
+
function ae(t) {
|
|
740
798
|
const e = /* @__PURE__ */ new Set(), n = t.getTextContent();
|
|
741
799
|
let o = n.indexOf(" ");
|
|
742
800
|
for (; -1 !== o;) e.add(o), e.add(o + 1), o = n.indexOf(" ", o + 1);
|
|
@@ -744,13 +802,13 @@ function ce(t) {
|
|
|
744
802
|
" " === t.getTextContent() && t.replace($createTabNode());
|
|
745
803
|
});
|
|
746
804
|
}
|
|
747
|
-
function
|
|
805
|
+
function ue(t, ...e) {
|
|
748
806
|
const n = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
749
807
|
o.append("code", t);
|
|
750
808
|
for (const t of e) o.append("v", t);
|
|
751
809
|
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
810
|
}
|
|
753
|
-
function
|
|
811
|
+
function de(t, e, n, o, r) {
|
|
754
812
|
if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
|
|
755
813
|
const i = e.getTextContent();
|
|
756
814
|
if (!r && " " !== i[n - 1]) return !1;
|
|
@@ -763,7 +821,7 @@ function ae(t, e, n, o, r) {
|
|
|
763
821
|
}
|
|
764
822
|
return !1;
|
|
765
823
|
}
|
|
766
|
-
function
|
|
824
|
+
function ge(t, e, n, o, r) {
|
|
767
825
|
if (!$isRootOrShadowRoot(t.getParent()) || t.getFirstChild() !== e) return !1;
|
|
768
826
|
const i = e.getTextContent();
|
|
769
827
|
if (!r && " " !== i[n - 1]) return !1;
|
|
@@ -779,36 +837,36 @@ function ue(t, e, n, o, r) {
|
|
|
779
837
|
}
|
|
780
838
|
return !1;
|
|
781
839
|
}
|
|
782
|
-
function
|
|
840
|
+
function he(t, e) {
|
|
783
841
|
let n = 0;
|
|
784
842
|
const o = t.getTextContent();
|
|
785
843
|
for (let t = 0; t < e; t++) "`" === o[t] && n++;
|
|
786
844
|
return n % 2 != 0;
|
|
787
845
|
}
|
|
788
|
-
function
|
|
846
|
+
function pe(t, e, n) {
|
|
789
847
|
const o = n.length;
|
|
790
848
|
for (let r = e; r >= o; r--) {
|
|
791
849
|
const e = r - o;
|
|
792
|
-
if (
|
|
850
|
+
if (xe(t, e, n, 0, o) && " " !== t[e + o]) return e;
|
|
793
851
|
}
|
|
794
852
|
return -1;
|
|
795
853
|
}
|
|
796
|
-
function
|
|
854
|
+
function xe(t, e, n, o, r) {
|
|
797
855
|
for (let s = 0; s < r; s++) if (t[e + s] !== n[o + s]) return !1;
|
|
798
856
|
return !0;
|
|
799
857
|
}
|
|
800
|
-
function
|
|
801
|
-
const o =
|
|
858
|
+
function me(t, n = Kt) {
|
|
859
|
+
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
860
|
for (const t of o.textFormat) l.add(t.tag.slice(-1));
|
|
803
861
|
for (const t of o.textMatch) void 0 !== t.trigger && l.add(t.trigger);
|
|
804
862
|
for (const e of n) {
|
|
805
863
|
const n = e.type;
|
|
806
864
|
if ("element" === n || "text-match" === n || "multiline-element" === n) {
|
|
807
865
|
const n = e.dependencies;
|
|
808
|
-
for (const e of n) t.hasNode(e) ||
|
|
866
|
+
for (const e of n) t.hasNode(e) || ue(173, e.getType());
|
|
809
867
|
}
|
|
810
868
|
}
|
|
811
|
-
const f = (t, n, r) => !!
|
|
869
|
+
const f = (t, n, r) => !!de(t, n, r, o.element) || !!ge(t, n, r, o.multilineElement) || !!function(t, e, n) {
|
|
812
870
|
let o = t.getTextContent();
|
|
813
871
|
const r = n[o[e - 1]];
|
|
814
872
|
if (null == r) return !1;
|
|
@@ -827,36 +885,36 @@ function pe(t, n = Ht) {
|
|
|
827
885
|
if (!l) return !1;
|
|
828
886
|
for (const n of l) {
|
|
829
887
|
const { tag: o } = n, l = o.length, f = s - l + 1;
|
|
830
|
-
if (l > 1 && !
|
|
888
|
+
if (l > 1 && !xe(r, f, o, 0, l)) continue;
|
|
831
889
|
if (" " === r[f - 1]) continue;
|
|
832
890
|
const a = r[s + 1];
|
|
833
|
-
if (!1 === n.intraword && a && !
|
|
891
|
+
if (!1 === n.intraword && a && !X.test(a)) continue;
|
|
834
892
|
const u = t;
|
|
835
|
-
let
|
|
836
|
-
for (;
|
|
837
|
-
if (
|
|
838
|
-
const t =
|
|
839
|
-
|
|
893
|
+
let d = u, g = pe(r, f, o), h = d;
|
|
894
|
+
for (; g < 0 && (h = h.getPreviousSibling()) && !$isLineBreakNode(h);) if ($isTextNode(h)) {
|
|
895
|
+
if (h.hasFormat("code")) continue;
|
|
896
|
+
const t = h.getTextContent();
|
|
897
|
+
d = h, g = pe(t, t.length, o);
|
|
840
898
|
}
|
|
841
|
-
if (
|
|
842
|
-
if (
|
|
843
|
-
const
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
if (!1 === n.intraword &&
|
|
847
|
-
if (!n.format.includes("code") &&
|
|
848
|
-
const
|
|
899
|
+
if (g < 0) continue;
|
|
900
|
+
if (d === u && g + l === f) continue;
|
|
901
|
+
const p = d.getTextContent();
|
|
902
|
+
if (g > 0 && p[g - 1] === i) continue;
|
|
903
|
+
const x = p[g - 1];
|
|
904
|
+
if (!1 === n.intraword && x && !X.test(x)) continue;
|
|
905
|
+
if (!n.format.includes("code") && he(d, g)) continue;
|
|
906
|
+
const m = u.getTextContent(), T = m.slice(0, f) + m.slice(s + 1);
|
|
849
907
|
u.setTextContent(T);
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
const
|
|
908
|
+
const $ = d === u ? T : p;
|
|
909
|
+
d.setTextContent($.slice(0, g) + $.slice(g + l));
|
|
910
|
+
const E = $getSelection(), v = $createRangeSelection();
|
|
853
911
|
$setSelection(v);
|
|
854
|
-
const y = s - l * (
|
|
855
|
-
v.anchor.set(
|
|
912
|
+
const y = s - l * (d === u ? 2 : 1) + 1;
|
|
913
|
+
v.anchor.set(d.__key, g, "text"), v.focus.set(u.__key, y, "text");
|
|
856
914
|
for (const t of n.format) v.formatText(t, TEXT_TYPE_TO_FORMAT[t]);
|
|
857
915
|
v.anchor.set(v.focus.key, v.focus.offset, v.focus.type);
|
|
858
916
|
for (const t of n.format) v.hasFormat(t) && v.toggleFormat(t);
|
|
859
|
-
return $isRangeSelection(
|
|
917
|
+
return $isRangeSelection(E) && (v.format = E.format), !0;
|
|
860
918
|
}
|
|
861
919
|
return !1;
|
|
862
920
|
}(n, r, s);
|
|
@@ -865,16 +923,16 @@ function pe(t, n = Ht) {
|
|
|
865
923
|
if (t.isComposing()) return;
|
|
866
924
|
const i = n.has(COMPOSITION_END_TAG), c = r.read($getSelection), a = s.read($getSelection);
|
|
867
925
|
if (!$isRangeSelection(a) || !$isRangeSelection(c) || !c.isCollapsed() || c.is(a) && !i) return;
|
|
868
|
-
const u = c.anchor.key,
|
|
869
|
-
if ($isTextNode(
|
|
926
|
+
const u = c.anchor.key, d = c.anchor.offset, g = r._nodeMap.get(u);
|
|
927
|
+
if ($isTextNode(g) && o.has(u) && (i || 1 === d || !(d > a.anchor.offset + 1))) {
|
|
870
928
|
if (i) {
|
|
871
|
-
const t = r.read(() =>
|
|
929
|
+
const t = r.read(() => g.getTextContent())[d - 1];
|
|
872
930
|
if (!l.has(t)) return;
|
|
873
931
|
}
|
|
874
932
|
t.update(() => {
|
|
875
|
-
if (!
|
|
876
|
-
const t =
|
|
877
|
-
null === t || $isCodeNode(t) || f(t,
|
|
933
|
+
if (!se(g)) return;
|
|
934
|
+
const t = g.getParent();
|
|
935
|
+
null === t || $isCodeNode(t) || f(t, g, c.anchor.offset) && $addUpdateTag(HISTORY_PUSH_TAG);
|
|
878
936
|
});
|
|
879
937
|
}
|
|
880
938
|
}), t.registerCommand(KEY_ENTER_COMMAND, (t) => {
|
|
@@ -882,51 +940,46 @@ function pe(t, n = Ht) {
|
|
|
882
940
|
const n = $getSelection();
|
|
883
941
|
if (!$isRangeSelection(n) || !n.isCollapsed()) return !1;
|
|
884
942
|
const s = n.anchor.offset, i = n.anchor.getNode();
|
|
885
|
-
if (!$isTextNode(i) || !
|
|
943
|
+
if (!$isTextNode(i) || !se(i)) return !1;
|
|
886
944
|
const l = i.getParent();
|
|
887
945
|
if (null === l || $isCodeNode(l)) return !1;
|
|
888
|
-
return s === i.getTextContent().length && !(!
|
|
946
|
+
return s === i.getTextContent().length && !(!ge(l, i, s, o.multilineElement, !0) && !de(l, i, s, r, !0)) && (null !== t && t.preventDefault(), !0);
|
|
889
947
|
}, COMMAND_PRIORITY_LOW));
|
|
890
948
|
}
|
|
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);
|
|
949
|
+
function Ce(t, e = Kt, n, o = !1, r = !1) {
|
|
950
|
+
const s = o ? t : qt(t, r), i = n || $getRoot();
|
|
951
|
+
i.clear(), le(s, i, e, o), null !== $getSelection() && i.selectStart();
|
|
952
|
+
}
|
|
953
|
+
function Ie(t, e = Kt, n = !1, o = !1) {
|
|
954
|
+
const r = n ? t : qt(t, o), s = new ArtificialNode__DO_NOT_USE();
|
|
955
|
+
return le(r, s, e, n), s.getChildren();
|
|
903
956
|
}
|
|
904
|
-
function
|
|
957
|
+
function Te(t = Kt, e, n = !1) {
|
|
905
958
|
return function(t, e = !1) {
|
|
906
|
-
const n =
|
|
959
|
+
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
960
|
return (t) => {
|
|
908
961
|
const i = [], l = (t || $getRoot()).getChildren();
|
|
909
962
|
for (let t = 0; t < l.length; t++) {
|
|
910
|
-
const c = l[t], f =
|
|
911
|
-
null != f && i.push(r && t > 0 && !
|
|
963
|
+
const c = l[t], f = Qt(c, o, s, n.textMatch, e);
|
|
964
|
+
null != f && i.push(r && t > 0 && !et(c) && !et(l[t - 1]) ? "\n".concat(f) : f);
|
|
912
965
|
}
|
|
913
966
|
return i.join("\n");
|
|
914
967
|
};
|
|
915
968
|
}(t, n)(e);
|
|
916
969
|
}
|
|
917
|
-
function
|
|
970
|
+
function $e(t = Kt, e, n = !1) {
|
|
918
971
|
if (!e || $isRangeSelection(e) && e.isCollapsed()) return "";
|
|
919
972
|
return function(t, e = !1) {
|
|
920
|
-
const n =
|
|
973
|
+
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
974
|
return (t) => {
|
|
922
975
|
const i = [], l = $getRoot().getChildren();
|
|
923
976
|
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 && !
|
|
977
|
+
const f = l[c], { shouldInclude: a, markdown: u } = Gt(f, t, o, s, n.textMatch, e);
|
|
978
|
+
a && null != u && i.push(r && c > 0 && !et(f) && !et(l[c - 1]) ? "\n".concat(u) : u);
|
|
926
979
|
}
|
|
927
980
|
return i.join("\n");
|
|
928
981
|
};
|
|
929
982
|
}(t, n)(e);
|
|
930
983
|
}
|
|
931
984
|
//#endregion
|
|
932
|
-
export {
|
|
985
|
+
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 };
|