@milkdown/preset-commonmark 7.2.2 → 7.2.3
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/lib/composed/plugins.d.ts.map +1 -1
- package/lib/index.es.js +462 -429
- package/lib/index.es.js.map +1 -1
- package/lib/mark/emphasis.d.ts.map +1 -1
- package/lib/mark/strong.d.ts.map +1 -1
- package/lib/plugin/index.d.ts +1 -0
- package/lib/plugin/index.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/inline-sync-plugin.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/regexp.d.ts +1 -0
- package/lib/plugin/inline-sync-plugin/regexp.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/replacer.d.ts.map +1 -1
- package/lib/plugin/remark-marker-plugin.d.ts +2 -0
- package/lib/plugin/remark-marker-plugin.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/composed/plugins.ts +2 -1
- package/src/mark/emphasis.ts +16 -6
- package/src/mark/strong.ts +17 -6
- package/src/plugin/index.ts +1 -0
- package/src/plugin/inline-sync-plugin/inline-sync-plugin.ts +0 -2
- package/src/plugin/inline-sync-plugin/regexp.ts +3 -1
- package/src/plugin/inline-sync-plugin/replacer.ts +11 -0
- package/src/plugin/inline-sync-plugin/utils.ts +4 -4
- package/src/plugin/remark-marker-plugin.ts +20 -0
package/lib/index.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { $markAttr as
|
|
2
|
-
import { commandsCtx as h, editorViewCtx as
|
|
3
|
-
import { toggleMark as
|
|
4
|
-
import { Fragment as
|
|
1
|
+
import { $markAttr as j, $markSchema as z, $command as g, $useKeymap as f, $node as Ye, $nodeAttr as N, $nodeSchema as I, $ctx as ee, $inputRule as L, pipe as wt, $prose as H, $remark as $ } from "@milkdown/utils";
|
|
2
|
+
import { remarkStringifyOptionsCtx as U, commandsCtx as h, editorViewCtx as Z, serializerCtx as At, parserCtx as vt } from "@milkdown/core";
|
|
3
|
+
import { toggleMark as Ht, setBlockType as _, wrapIn as te } from "@milkdown/prose/commands";
|
|
4
|
+
import { Fragment as Bt } from "@milkdown/prose/model";
|
|
5
5
|
import { expectDomTypeError as S } from "@milkdown/exception";
|
|
6
|
-
import { textblockTypeInputRule as
|
|
7
|
-
import
|
|
8
|
-
import { TextSelection as
|
|
9
|
-
import { findSelectedNodeOfType as
|
|
10
|
-
import { sinkListItem as
|
|
11
|
-
import { ReplaceStep as
|
|
12
|
-
import { Decoration as
|
|
13
|
-
import { visit as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
6
|
+
import { textblockTypeInputRule as Je, wrappingInputRule as re, InputRule as Qe } from "@milkdown/prose/inputrules";
|
|
7
|
+
import Tt from "@sindresorhus/slugify";
|
|
8
|
+
import { TextSelection as V, Selection as Xe, PluginKey as B, Plugin as T } from "@milkdown/prose/state";
|
|
9
|
+
import { toggleMarkdownMark as Ze, findSelectedNodeOfType as Ot } from "@milkdown/prose";
|
|
10
|
+
import { sinkListItem as Kt, liftListItem as et, splitListItem as Dt } from "@milkdown/prose/schema-list";
|
|
11
|
+
import { ReplaceStep as Rt, AddMarkStep as Pt } from "@milkdown/prose/transform";
|
|
12
|
+
import { Decoration as ze, DecorationSet as Ue } from "@milkdown/prose/view";
|
|
13
|
+
import { visit as ae } from "unist-util-visit";
|
|
14
|
+
import Et from "remark-inline-links";
|
|
15
|
+
const tt = (t, e) => {
|
|
16
16
|
var o;
|
|
17
17
|
if (!(e.childCount >= 1 && ((o = e.lastChild) == null ? void 0 : o.type.name) === "hardbreak")) {
|
|
18
18
|
t.next(e.content);
|
|
@@ -21,135 +21,153 @@ const Ze = (t, e) => {
|
|
|
21
21
|
const a = [];
|
|
22
22
|
e.content.forEach((s, i, l) => {
|
|
23
23
|
l !== e.childCount - 1 && a.push(s);
|
|
24
|
-
}), t.next(
|
|
24
|
+
}), t.next(Bt.fromArray(a));
|
|
25
25
|
}, n = (t, e) => (Object.assign(t, {
|
|
26
26
|
meta: {
|
|
27
27
|
package: "@milkdown/preset-commonmark",
|
|
28
28
|
...e
|
|
29
29
|
}
|
|
30
|
-
}), t),
|
|
31
|
-
n(
|
|
30
|
+
}), t), ne = j("emphasis");
|
|
31
|
+
n(ne, {
|
|
32
32
|
displayName: "Attr<emphasis>",
|
|
33
33
|
group: "Emphasis"
|
|
34
34
|
});
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const Y = z("emphasis", (t) => ({
|
|
36
|
+
attrs: {
|
|
37
|
+
marker: {
|
|
38
|
+
default: t.get(U).emphasis || "*"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
37
41
|
parseDOM: [
|
|
38
42
|
{ tag: "i" },
|
|
39
43
|
{ tag: "em" },
|
|
40
44
|
{ style: "font-style", getAttrs: (e) => e === "italic" }
|
|
41
45
|
],
|
|
42
|
-
toDOM: (e) => ["em", t.get(
|
|
46
|
+
toDOM: (e) => ["em", t.get(ne.key)(e)],
|
|
43
47
|
parseMarkdown: {
|
|
44
48
|
match: (e) => e.type === "emphasis",
|
|
45
49
|
runner: (e, r, a) => {
|
|
46
|
-
e.openMark(a), e.next(r.children), e.closeMark(a);
|
|
50
|
+
e.openMark(a, { marker: r.marker }), e.next(r.children), e.closeMark(a);
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
toMarkdown: {
|
|
50
54
|
match: (e) => e.type.name === "emphasis",
|
|
51
55
|
runner: (e, r) => {
|
|
52
|
-
e.withMark(r, "emphasis"
|
|
56
|
+
e.withMark(r, "emphasis", void 0, {
|
|
57
|
+
marker: r.attrs.marker
|
|
58
|
+
});
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
}));
|
|
56
|
-
n(
|
|
62
|
+
n(Y.mark, {
|
|
57
63
|
displayName: "MarkSchema<emphasis>",
|
|
58
64
|
group: "Emphasis"
|
|
59
65
|
});
|
|
60
|
-
n(
|
|
66
|
+
n(Y.ctx, {
|
|
61
67
|
displayName: "MarkSchemaCtx<emphasis>",
|
|
62
68
|
group: "Emphasis"
|
|
63
69
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
70
|
+
const oe = g("ToggleEmphasis", (t) => () => {
|
|
71
|
+
const e = Y.type(), r = t.get(U).emphasis || "*";
|
|
72
|
+
return Ze(e, r);
|
|
73
|
+
});
|
|
74
|
+
n(oe, {
|
|
66
75
|
displayName: "Command<toggleEmphasisCommand>",
|
|
67
76
|
group: "Emphasis"
|
|
68
77
|
});
|
|
69
|
-
const
|
|
78
|
+
const se = f("emphasisKeymap", {
|
|
70
79
|
ToggleEmphasis: {
|
|
71
80
|
shortcuts: "Mod-i",
|
|
72
81
|
command: (t) => {
|
|
73
82
|
const e = t.get(h);
|
|
74
|
-
return () => e.call(
|
|
83
|
+
return () => e.call(oe.key);
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
});
|
|
78
|
-
n(
|
|
87
|
+
n(se.ctx, {
|
|
79
88
|
displayName: "KeymapCtx<emphasis>",
|
|
80
89
|
group: "Emphasis"
|
|
81
90
|
});
|
|
82
|
-
n(
|
|
91
|
+
n(se.shortcuts, {
|
|
83
92
|
displayName: "Keymap<emphasis>",
|
|
84
93
|
group: "Emphasis"
|
|
85
94
|
});
|
|
86
|
-
const
|
|
87
|
-
n(
|
|
95
|
+
const le = j("strong");
|
|
96
|
+
n(le, {
|
|
88
97
|
displayName: "Attr<strong>",
|
|
89
98
|
group: "Strong"
|
|
90
99
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
100
|
+
const J = z("strong", (t) => ({
|
|
101
|
+
attrs: {
|
|
102
|
+
marker: {
|
|
103
|
+
default: t.get(U).strong || "*"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
93
106
|
parseDOM: [
|
|
94
107
|
{ tag: "b" },
|
|
95
108
|
{ tag: "strong" },
|
|
96
109
|
{ style: "font-style", getAttrs: (e) => e === "bold" }
|
|
97
110
|
],
|
|
98
|
-
toDOM: (e) => ["strong", t.get(
|
|
111
|
+
toDOM: (e) => ["strong", t.get(le.key)(e)],
|
|
99
112
|
parseMarkdown: {
|
|
100
113
|
match: (e) => e.type === "strong",
|
|
101
114
|
runner: (e, r, a) => {
|
|
102
|
-
e.openMark(a), e.next(r.children), e.closeMark(a);
|
|
115
|
+
e.openMark(a, { marker: r.marker }), e.next(r.children), e.closeMark(a);
|
|
103
116
|
}
|
|
104
117
|
},
|
|
105
118
|
toMarkdown: {
|
|
106
119
|
match: (e) => e.type.name === "strong",
|
|
107
120
|
runner: (e, r) => {
|
|
108
|
-
e.withMark(r, "strong"
|
|
121
|
+
e.withMark(r, "strong", void 0, {
|
|
122
|
+
marker: r.attrs.marker
|
|
123
|
+
});
|
|
109
124
|
}
|
|
110
125
|
}
|
|
111
126
|
}));
|
|
112
|
-
n(
|
|
127
|
+
n(J.mark, {
|
|
113
128
|
displayName: "MarkSchema<strong>",
|
|
114
129
|
group: "Strong"
|
|
115
130
|
});
|
|
116
|
-
n(
|
|
131
|
+
n(J.ctx, {
|
|
117
132
|
displayName: "MarkSchemaCtx<strong>",
|
|
118
133
|
group: "Strong"
|
|
119
134
|
});
|
|
120
|
-
const
|
|
121
|
-
|
|
135
|
+
const ie = g("ToggleStrong", (t) => () => {
|
|
136
|
+
const e = J.type(), r = t.get(U).strong || "*", a = r + r;
|
|
137
|
+
return Ze(e, a);
|
|
138
|
+
});
|
|
139
|
+
n(ie, {
|
|
122
140
|
displayName: "Command<toggleStrongCommand>",
|
|
123
141
|
group: "Strong"
|
|
124
142
|
});
|
|
125
|
-
const
|
|
143
|
+
const ce = f("strongKeymap", {
|
|
126
144
|
ToggleBold: {
|
|
127
145
|
shortcuts: ["Mod-b"],
|
|
128
146
|
command: (t) => {
|
|
129
147
|
const e = t.get(h);
|
|
130
|
-
return () => e.call(
|
|
148
|
+
return () => e.call(ie.key);
|
|
131
149
|
}
|
|
132
150
|
}
|
|
133
151
|
});
|
|
134
|
-
n(
|
|
152
|
+
n(ce.ctx, {
|
|
135
153
|
displayName: "KeymapCtx<strong>",
|
|
136
154
|
group: "Strong"
|
|
137
155
|
});
|
|
138
|
-
n(
|
|
156
|
+
n(ce.shortcuts, {
|
|
139
157
|
displayName: "Keymap<strong>",
|
|
140
158
|
group: "Strong"
|
|
141
159
|
});
|
|
142
|
-
const
|
|
143
|
-
n(
|
|
160
|
+
const de = j("inlineCode");
|
|
161
|
+
n(de, {
|
|
144
162
|
displayName: "Attr<inlineCode>",
|
|
145
163
|
group: "InlineCode"
|
|
146
164
|
});
|
|
147
|
-
const b =
|
|
165
|
+
const b = z("inlineCode", (t) => ({
|
|
148
166
|
priority: 100,
|
|
149
167
|
code: !0,
|
|
150
168
|
inclusive: !1,
|
|
151
169
|
parseDOM: [{ tag: "code" }],
|
|
152
|
-
toDOM: (e) => ["code", t.get(
|
|
170
|
+
toDOM: (e) => ["code", t.get(de.key)(e)],
|
|
153
171
|
parseMarkdown: {
|
|
154
172
|
match: (e) => e.type === "inlineCode",
|
|
155
173
|
runner: (e, r, a) => {
|
|
@@ -171,7 +189,7 @@ n(b.ctx, {
|
|
|
171
189
|
displayName: "MarkSchemaCtx<inlineCode>",
|
|
172
190
|
group: "InlineCode"
|
|
173
191
|
});
|
|
174
|
-
const
|
|
192
|
+
const me = g("ToggleInlineCode", () => () => (t, e) => {
|
|
175
193
|
const { selection: r, tr: a } = t;
|
|
176
194
|
if (r.empty)
|
|
177
195
|
return !1;
|
|
@@ -180,33 +198,33 @@ const ie = g("ToggleInlineCode", () => () => (t, e) => {
|
|
|
180
198
|
a.removeMark(o, s, c);
|
|
181
199
|
}), e == null || e(a.addMark(o, s, b.type().create())), !0);
|
|
182
200
|
});
|
|
183
|
-
n(
|
|
201
|
+
n(me, {
|
|
184
202
|
displayName: "Command<toggleInlineCodeCommand>",
|
|
185
203
|
group: "InlineCode"
|
|
186
204
|
});
|
|
187
|
-
const
|
|
205
|
+
const ue = f("inlineCodeKeymap", {
|
|
188
206
|
ToggleInlineCode: {
|
|
189
207
|
shortcuts: "Mod-e",
|
|
190
208
|
command: (t) => {
|
|
191
209
|
const e = t.get(h);
|
|
192
|
-
return () => e.call(
|
|
210
|
+
return () => e.call(me.key);
|
|
193
211
|
}
|
|
194
212
|
}
|
|
195
213
|
});
|
|
196
|
-
n(
|
|
214
|
+
n(ue.ctx, {
|
|
197
215
|
displayName: "KeymapCtx<inlineCode>",
|
|
198
216
|
group: "InlineCode"
|
|
199
217
|
});
|
|
200
|
-
n(
|
|
218
|
+
n(ue.shortcuts, {
|
|
201
219
|
displayName: "Keymap<inlineCode>",
|
|
202
220
|
group: "InlineCode"
|
|
203
221
|
});
|
|
204
|
-
const
|
|
205
|
-
n(
|
|
222
|
+
const pe = j("link");
|
|
223
|
+
n(pe, {
|
|
206
224
|
displayName: "Attr<link>",
|
|
207
225
|
group: "Link"
|
|
208
226
|
});
|
|
209
|
-
const v =
|
|
227
|
+
const v = z("link", (t) => ({
|
|
210
228
|
attrs: {
|
|
211
229
|
href: {},
|
|
212
230
|
title: { default: null }
|
|
@@ -221,7 +239,7 @@ const v = F("link", (t) => ({
|
|
|
221
239
|
}
|
|
222
240
|
}
|
|
223
241
|
],
|
|
224
|
-
toDOM: (e) => ["a", { ...t.get(
|
|
242
|
+
toDOM: (e) => ["a", { ...t.get(pe.key)(e), ...e.attrs }],
|
|
225
243
|
parseMarkdown: {
|
|
226
244
|
match: (e) => e.type === "link",
|
|
227
245
|
runner: (e, r, a) => {
|
|
@@ -243,12 +261,12 @@ n(v.mark, {
|
|
|
243
261
|
displayName: "MarkSchema<link>",
|
|
244
262
|
group: "Link"
|
|
245
263
|
});
|
|
246
|
-
const
|
|
247
|
-
n(
|
|
264
|
+
const rt = g("ToggleLink", () => (t = {}) => Ht(v.type(), t));
|
|
265
|
+
n(rt, {
|
|
248
266
|
displayName: "Command<toggleLinkCommand>",
|
|
249
267
|
group: "Link"
|
|
250
268
|
});
|
|
251
|
-
const
|
|
269
|
+
const at = g("UpdateLink", () => (t = {}) => (e, r) => {
|
|
252
270
|
if (!r)
|
|
253
271
|
return !1;
|
|
254
272
|
let a, o = -1;
|
|
@@ -263,14 +281,14 @@ const tt = g("UpdateLink", () => (t = {}) => (e, r) => {
|
|
|
263
281
|
return !1;
|
|
264
282
|
const d = o, m = o + a.nodeSize, { tr: u } = e, y = v.type().create({ ...c.attrs, ...t });
|
|
265
283
|
return y ? (r(
|
|
266
|
-
u.removeMark(d, m, c).addMark(d, m, y).setSelection(new
|
|
284
|
+
u.removeMark(d, m, c).addMark(d, m, y).setSelection(new V(u.selection.$anchor)).scrollIntoView()
|
|
267
285
|
), !0) : !1;
|
|
268
286
|
});
|
|
269
|
-
n(
|
|
287
|
+
n(at, {
|
|
270
288
|
displayName: "Command<updateLinkCommand>",
|
|
271
289
|
group: "Link"
|
|
272
290
|
});
|
|
273
|
-
const
|
|
291
|
+
const nt = Ye("doc", () => ({
|
|
274
292
|
content: "block+",
|
|
275
293
|
parseMarkdown: {
|
|
276
294
|
match: ({ type: t }) => t === "root",
|
|
@@ -285,12 +303,12 @@ const rt = ze("doc", () => ({
|
|
|
285
303
|
}
|
|
286
304
|
}
|
|
287
305
|
}));
|
|
288
|
-
n(
|
|
306
|
+
n(nt, {
|
|
289
307
|
displayName: "NodeSchema<doc>",
|
|
290
308
|
group: "Doc"
|
|
291
309
|
});
|
|
292
|
-
const
|
|
293
|
-
n(
|
|
310
|
+
const ge = N("paragraph");
|
|
311
|
+
n(ge, {
|
|
294
312
|
displayName: "Attr<paragraph>",
|
|
295
313
|
group: "Paragraph"
|
|
296
314
|
});
|
|
@@ -298,7 +316,7 @@ const w = I("paragraph", (t) => ({
|
|
|
298
316
|
content: "inline*",
|
|
299
317
|
group: "block",
|
|
300
318
|
parseDOM: [{ tag: "p" }],
|
|
301
|
-
toDOM: (e) => ["p", t.get(
|
|
319
|
+
toDOM: (e) => ["p", t.get(ge.key)(e), 0],
|
|
302
320
|
parseMarkdown: {
|
|
303
321
|
match: (e) => e.type === "paragraph",
|
|
304
322
|
runner: (e, r, a) => {
|
|
@@ -308,7 +326,7 @@ const w = I("paragraph", (t) => ({
|
|
|
308
326
|
toMarkdown: {
|
|
309
327
|
match: (e) => e.type.name === "paragraph",
|
|
310
328
|
runner: (e, r) => {
|
|
311
|
-
e.openNode("paragraph"),
|
|
329
|
+
e.openNode("paragraph"), tt(e, r), e.closeNode();
|
|
312
330
|
}
|
|
313
331
|
}
|
|
314
332
|
}));
|
|
@@ -320,40 +338,40 @@ n(w.ctx, {
|
|
|
320
338
|
displayName: "NodeSchemaCtx<paragraph>",
|
|
321
339
|
group: "Paragraph"
|
|
322
340
|
});
|
|
323
|
-
const
|
|
324
|
-
n(
|
|
341
|
+
const he = g("TurnIntoText", () => () => _(w.type()));
|
|
342
|
+
n(he, {
|
|
325
343
|
displayName: "Command<turnIntoTextCommand>",
|
|
326
344
|
group: "Paragraph"
|
|
327
345
|
});
|
|
328
|
-
const
|
|
346
|
+
const ye = f("paragraphKeymap", {
|
|
329
347
|
TurnIntoText: {
|
|
330
348
|
shortcuts: "Mod-Alt-0",
|
|
331
349
|
command: (t) => {
|
|
332
350
|
const e = t.get(h);
|
|
333
|
-
return () => e.call(
|
|
351
|
+
return () => e.call(he.key);
|
|
334
352
|
}
|
|
335
353
|
}
|
|
336
354
|
});
|
|
337
|
-
n(
|
|
355
|
+
n(ye.ctx, {
|
|
338
356
|
displayName: "KeymapCtx<paragraph>",
|
|
339
357
|
group: "Paragraph"
|
|
340
358
|
});
|
|
341
|
-
n(
|
|
359
|
+
n(ye.shortcuts, {
|
|
342
360
|
displayName: "Keymap<paragraph>",
|
|
343
361
|
group: "Paragraph"
|
|
344
362
|
});
|
|
345
|
-
const
|
|
346
|
-
n(
|
|
363
|
+
const _t = Array(6).fill(0).map((t, e) => e + 1), $t = (t) => Tt(t.textContent), Q = ee($t, "headingIdGenerator");
|
|
364
|
+
n(Q, {
|
|
347
365
|
displayName: "Ctx<HeadingIdGenerator>",
|
|
348
366
|
group: "Heading"
|
|
349
367
|
});
|
|
350
|
-
const
|
|
351
|
-
n(
|
|
368
|
+
const ke = N("heading");
|
|
369
|
+
n(ke, {
|
|
352
370
|
displayName: "Attr<heading>",
|
|
353
371
|
group: "Heading"
|
|
354
372
|
});
|
|
355
373
|
const A = I("heading", (t) => {
|
|
356
|
-
const e = t.get(
|
|
374
|
+
const e = t.get(Q.key);
|
|
357
375
|
return {
|
|
358
376
|
content: "inline*",
|
|
359
377
|
group: "block",
|
|
@@ -366,7 +384,7 @@ const A = I("heading", (t) => {
|
|
|
366
384
|
default: 1
|
|
367
385
|
}
|
|
368
386
|
},
|
|
369
|
-
parseDOM:
|
|
387
|
+
parseDOM: _t.map((r) => ({
|
|
370
388
|
tag: `h${r}`,
|
|
371
389
|
getAttrs: (a) => {
|
|
372
390
|
if (!(a instanceof HTMLElement))
|
|
@@ -377,7 +395,7 @@ const A = I("heading", (t) => {
|
|
|
377
395
|
toDOM: (r) => [
|
|
378
396
|
`h${r.attrs.level}`,
|
|
379
397
|
{
|
|
380
|
-
...t.get(
|
|
398
|
+
...t.get(ke.key)(r),
|
|
381
399
|
id: r.attrs.id || e(r)
|
|
382
400
|
},
|
|
383
401
|
0
|
|
@@ -392,7 +410,7 @@ const A = I("heading", (t) => {
|
|
|
392
410
|
toMarkdown: {
|
|
393
411
|
match: (r) => r.type.name === "heading",
|
|
394
412
|
runner: (r, a) => {
|
|
395
|
-
r.openNode("heading", void 0, { depth: a.attrs.level }),
|
|
413
|
+
r.openNode("heading", void 0, { depth: a.attrs.level }), tt(r, a), r.closeNode();
|
|
396
414
|
}
|
|
397
415
|
}
|
|
398
416
|
};
|
|
@@ -405,25 +423,25 @@ n(A.ctx, {
|
|
|
405
423
|
displayName: "NodeSchemaCtx<heading>",
|
|
406
424
|
group: "Heading"
|
|
407
425
|
});
|
|
408
|
-
const
|
|
426
|
+
const ot = L((t) => Je(/^(?<hashes>#+)\s$/, A.type(), (e) => {
|
|
409
427
|
var i, l;
|
|
410
|
-
const r = ((l = (i = e.groups) == null ? void 0 : i.hashes) == null ? void 0 : l.length) || 0, a = t.get(
|
|
428
|
+
const r = ((l = (i = e.groups) == null ? void 0 : i.hashes) == null ? void 0 : l.length) || 0, a = t.get(Z), { $from: o } = a.state.selection, s = o.node();
|
|
411
429
|
if (s.type.name === "heading") {
|
|
412
430
|
let c = Number(s.attrs.level) + Number(r);
|
|
413
431
|
return c > 6 && (c = 6), { level: c };
|
|
414
432
|
}
|
|
415
433
|
return { level: r };
|
|
416
434
|
}));
|
|
417
|
-
n(
|
|
435
|
+
n(ot, {
|
|
418
436
|
displayName: "InputRule<wrapInHeadingInputRule>",
|
|
419
437
|
group: "Heading"
|
|
420
438
|
});
|
|
421
|
-
const M = g("WrapInHeading", () => (t) => (t ?? (t = 1), t < 1 ?
|
|
439
|
+
const M = g("WrapInHeading", () => (t) => (t ?? (t = 1), t < 1 ? _(w.type()) : _(A.type(), { level: t })));
|
|
422
440
|
n(M, {
|
|
423
441
|
displayName: "Command<wrapInHeadingCommand>",
|
|
424
442
|
group: "Heading"
|
|
425
443
|
});
|
|
426
|
-
const
|
|
444
|
+
const fe = g("DowngradeHeading", () => () => (t, e, r) => {
|
|
427
445
|
const { $from: a } = t.selection, o = a.node();
|
|
428
446
|
if (o.type !== A.type() || !t.selection.empty || a.parentOffset !== 0)
|
|
429
447
|
return !1;
|
|
@@ -433,13 +451,13 @@ const he = g("DowngradeHeading", () => () => (t, e, r) => {
|
|
|
433
451
|
...o.attrs,
|
|
434
452
|
level: s
|
|
435
453
|
})
|
|
436
|
-
), !0) :
|
|
454
|
+
), !0) : _(w.type())(t, e, r);
|
|
437
455
|
});
|
|
438
|
-
n(
|
|
456
|
+
n(fe, {
|
|
439
457
|
displayName: "Command<downgradeHeadingCommand>",
|
|
440
458
|
group: "Heading"
|
|
441
459
|
});
|
|
442
|
-
const
|
|
460
|
+
const Ne = f("headingKeymap", {
|
|
443
461
|
TurnIntoH1: {
|
|
444
462
|
shortcuts: "Mod-Alt-1",
|
|
445
463
|
command: (t) => {
|
|
@@ -486,29 +504,29 @@ const ye = f("headingKeymap", {
|
|
|
486
504
|
shortcuts: ["Delete", "Backspace"],
|
|
487
505
|
command: (t) => {
|
|
488
506
|
const e = t.get(h);
|
|
489
|
-
return () => e.call(
|
|
507
|
+
return () => e.call(fe.key);
|
|
490
508
|
}
|
|
491
509
|
}
|
|
492
510
|
});
|
|
493
|
-
n(
|
|
511
|
+
n(Ne.ctx, {
|
|
494
512
|
displayName: "KeymapCtx<heading>",
|
|
495
513
|
group: "Heading"
|
|
496
514
|
});
|
|
497
|
-
n(
|
|
515
|
+
n(Ne.shortcuts, {
|
|
498
516
|
displayName: "Keymap<heading>",
|
|
499
517
|
group: "Heading"
|
|
500
518
|
});
|
|
501
|
-
const
|
|
502
|
-
n(
|
|
519
|
+
const Ie = N("blockquote");
|
|
520
|
+
n(Ie, {
|
|
503
521
|
displayName: "Attr<blockquote>",
|
|
504
522
|
group: "Blockquote"
|
|
505
523
|
});
|
|
506
|
-
const
|
|
524
|
+
const q = I("blockquote", (t) => ({
|
|
507
525
|
content: "block+",
|
|
508
526
|
group: "block",
|
|
509
527
|
defining: !0,
|
|
510
528
|
parseDOM: [{ tag: "blockquote" }],
|
|
511
|
-
toDOM: (e) => ["blockquote", t.get(
|
|
529
|
+
toDOM: (e) => ["blockquote", t.get(Ie.key)(e), 0],
|
|
512
530
|
parseMarkdown: {
|
|
513
531
|
match: ({ type: e }) => e === "blockquote",
|
|
514
532
|
runner: (e, r, a) => {
|
|
@@ -522,50 +540,50 @@ const E = I("blockquote", (t) => ({
|
|
|
522
540
|
}
|
|
523
541
|
}
|
|
524
542
|
}));
|
|
525
|
-
n(
|
|
543
|
+
n(q.node, {
|
|
526
544
|
displayName: "NodeSchema<blockquote>",
|
|
527
545
|
group: "Blockquote"
|
|
528
546
|
});
|
|
529
|
-
n(
|
|
547
|
+
n(q.ctx, {
|
|
530
548
|
displayName: "NodeSchemaCtx<blockquote>",
|
|
531
549
|
group: "Blockquote"
|
|
532
550
|
});
|
|
533
|
-
const
|
|
534
|
-
n(
|
|
551
|
+
const st = L(() => re(/^\s*>\s$/, q.type()));
|
|
552
|
+
n(st, {
|
|
535
553
|
displayName: "InputRule<wrapInBlockquoteInputRule>",
|
|
536
554
|
group: "Blockquote"
|
|
537
555
|
});
|
|
538
|
-
const
|
|
539
|
-
n(
|
|
556
|
+
const Ce = g("WrapInBlockquote", () => () => te(q.type()));
|
|
557
|
+
n(Ce, {
|
|
540
558
|
displayName: "Command<wrapInBlockquoteCommand>",
|
|
541
559
|
group: "Blockquote"
|
|
542
560
|
});
|
|
543
|
-
const
|
|
561
|
+
const Me = f("blockquoteKeymap", {
|
|
544
562
|
WrapInBlockquote: {
|
|
545
563
|
shortcuts: "Mod-Shift-b",
|
|
546
564
|
command: (t) => {
|
|
547
565
|
const e = t.get(h);
|
|
548
|
-
return () => e.call(
|
|
566
|
+
return () => e.call(Ce.key);
|
|
549
567
|
}
|
|
550
568
|
}
|
|
551
569
|
});
|
|
552
|
-
n(
|
|
570
|
+
n(Me.ctx, {
|
|
553
571
|
displayName: "KeymapCtx<blockquote>",
|
|
554
572
|
group: "Blockquote"
|
|
555
573
|
});
|
|
556
|
-
n(
|
|
574
|
+
n(Me.shortcuts, {
|
|
557
575
|
displayName: "Keymap<blockquote>",
|
|
558
576
|
group: "Blockquote"
|
|
559
577
|
});
|
|
560
|
-
const
|
|
578
|
+
const be = N("codeBlock", () => ({
|
|
561
579
|
pre: {},
|
|
562
580
|
code: {}
|
|
563
581
|
}));
|
|
564
|
-
n(
|
|
582
|
+
n(be, {
|
|
565
583
|
displayName: "Attr<codeBlock>",
|
|
566
584
|
group: "CodeBlock"
|
|
567
585
|
});
|
|
568
|
-
const
|
|
586
|
+
const W = I("code_block", (t) => ({
|
|
569
587
|
content: "text*",
|
|
570
588
|
group: "block",
|
|
571
589
|
marks: "",
|
|
@@ -588,7 +606,7 @@ const _ = I("code_block", (t) => ({
|
|
|
588
606
|
}
|
|
589
607
|
],
|
|
590
608
|
toDOM: (e) => {
|
|
591
|
-
const r = t.get(
|
|
609
|
+
const r = t.get(be.key)(e);
|
|
592
610
|
return [
|
|
593
611
|
"pre",
|
|
594
612
|
{
|
|
@@ -615,53 +633,53 @@ const _ = I("code_block", (t) => ({
|
|
|
615
633
|
}
|
|
616
634
|
}
|
|
617
635
|
}));
|
|
618
|
-
n(
|
|
636
|
+
n(W.node, {
|
|
619
637
|
displayName: "NodeSchema<codeBlock>",
|
|
620
638
|
group: "CodeBlock"
|
|
621
639
|
});
|
|
622
|
-
n(
|
|
640
|
+
n(W.ctx, {
|
|
623
641
|
displayName: "NodeSchemaCtx<codeBlock>",
|
|
624
642
|
group: "CodeBlock"
|
|
625
643
|
});
|
|
626
|
-
const
|
|
644
|
+
const lt = L(() => Je(/^```(?<language>[a-z]*)?[\s\n]$/, W.type(), (t) => {
|
|
627
645
|
var e;
|
|
628
646
|
return {
|
|
629
647
|
language: ((e = t.groups) == null ? void 0 : e.language) ?? ""
|
|
630
648
|
};
|
|
631
649
|
}));
|
|
632
|
-
n(
|
|
650
|
+
n(lt, {
|
|
633
651
|
displayName: "InputRule<createCodeBlockInputRule>",
|
|
634
652
|
group: "CodeBlock"
|
|
635
653
|
});
|
|
636
|
-
const
|
|
637
|
-
n(
|
|
654
|
+
const xe = g("CreateCodeBlock", () => (t = "") => _(W.type(), { language: t }));
|
|
655
|
+
n(xe, {
|
|
638
656
|
displayName: "Command<createCodeBlockCommand>",
|
|
639
657
|
group: "CodeBlock"
|
|
640
658
|
});
|
|
641
|
-
const
|
|
642
|
-
n(
|
|
659
|
+
const qt = g("UpdateCodeBlockLanguage", () => ({ pos: t, language: e } = { pos: -1, language: "" }) => (r, a) => t >= 0 ? (a == null || a(r.tr.setNodeAttribute(t, "language", e)), !0) : !1);
|
|
660
|
+
n(qt, {
|
|
643
661
|
displayName: "Command<updateCodeBlockLanguageCommand>",
|
|
644
662
|
group: "CodeBlock"
|
|
645
663
|
});
|
|
646
|
-
const
|
|
664
|
+
const Le = f("codeBlockKeymap", {
|
|
647
665
|
CreateCodeBlock: {
|
|
648
666
|
shortcuts: "Mod-Alt-c",
|
|
649
667
|
command: (t) => {
|
|
650
668
|
const e = t.get(h);
|
|
651
|
-
return () => e.call(
|
|
669
|
+
return () => e.call(xe.key);
|
|
652
670
|
}
|
|
653
671
|
}
|
|
654
672
|
});
|
|
655
|
-
n(
|
|
673
|
+
n(Le.ctx, {
|
|
656
674
|
displayName: "KeymapCtx<codeBlock>",
|
|
657
675
|
group: "CodeBlock"
|
|
658
676
|
});
|
|
659
|
-
n(
|
|
677
|
+
n(Le.shortcuts, {
|
|
660
678
|
displayName: "Keymap<codeBlock>",
|
|
661
679
|
group: "CodeBlock"
|
|
662
680
|
});
|
|
663
|
-
const
|
|
664
|
-
n(
|
|
681
|
+
const Se = N("image");
|
|
682
|
+
n(Se, {
|
|
665
683
|
displayName: "Attr<image>",
|
|
666
684
|
group: "Image"
|
|
667
685
|
});
|
|
@@ -693,7 +711,7 @@ const O = I("image", (t) => ({
|
|
|
693
711
|
}
|
|
694
712
|
}
|
|
695
713
|
],
|
|
696
|
-
toDOM: (e) => ["img", { ...t.get(
|
|
714
|
+
toDOM: (e) => ["img", { ...t.get(Se.key)(e), ...e.attrs }],
|
|
697
715
|
parseMarkdown: {
|
|
698
716
|
match: ({ type: e }) => e === "image",
|
|
699
717
|
runner: (e, r, a) => {
|
|
@@ -724,42 +742,42 @@ n(O.ctx, {
|
|
|
724
742
|
displayName: "NodeSchemaCtx<image>",
|
|
725
743
|
group: "Image"
|
|
726
744
|
});
|
|
727
|
-
const
|
|
745
|
+
const it = g("InsertImage", () => (t = {}) => (e, r) => {
|
|
728
746
|
if (!r)
|
|
729
747
|
return !0;
|
|
730
748
|
const { src: a = "", alt: o = "", title: s = "" } = t, i = O.type().create({ src: a, alt: o, title: s });
|
|
731
749
|
return i && r(e.tr.replaceSelectionWith(i).scrollIntoView()), !0;
|
|
732
750
|
});
|
|
733
|
-
n(
|
|
751
|
+
n(it, {
|
|
734
752
|
displayName: "Command<insertImageCommand>",
|
|
735
753
|
group: "Image"
|
|
736
754
|
});
|
|
737
|
-
const
|
|
738
|
-
const a =
|
|
755
|
+
const ct = g("UpdateImage", () => (t = {}) => (e, r) => {
|
|
756
|
+
const a = Ot(e.selection, O.type());
|
|
739
757
|
if (!a)
|
|
740
758
|
return !1;
|
|
741
759
|
const { node: o, pos: s } = a, i = { ...o.attrs }, { src: l, alt: c, title: d } = t;
|
|
742
760
|
return l !== void 0 && (i.src = l), c !== void 0 && (i.alt = c), d !== void 0 && (i.title = d), r == null || r(e.tr.setNodeMarkup(s, void 0, i).scrollIntoView()), !0;
|
|
743
761
|
});
|
|
744
|
-
n(
|
|
762
|
+
n(ct, {
|
|
745
763
|
displayName: "Command<updateImageCommand>",
|
|
746
764
|
group: "Image"
|
|
747
765
|
});
|
|
748
|
-
const
|
|
766
|
+
const Wt = L(() => new Qe(
|
|
749
767
|
/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,
|
|
750
768
|
(t, e, r, a) => {
|
|
751
769
|
const [o, s, i = "", l] = e;
|
|
752
770
|
return o ? t.tr.replaceWith(r, a, O.type().create({ src: i, alt: s, title: l })) : null;
|
|
753
771
|
}
|
|
754
772
|
));
|
|
755
|
-
n(
|
|
773
|
+
n(Wt, {
|
|
756
774
|
displayName: "InputRule<insertImageInputRule>",
|
|
757
775
|
group: "Image"
|
|
758
776
|
});
|
|
759
|
-
const
|
|
777
|
+
const we = N("hardbreak", (t) => ({
|
|
760
778
|
"data-is-inline": t.attrs.isInline
|
|
761
779
|
}));
|
|
762
|
-
n(
|
|
780
|
+
n(we, {
|
|
763
781
|
displayName: "Attr<hardbreak>",
|
|
764
782
|
group: "Hardbreak"
|
|
765
783
|
});
|
|
@@ -773,7 +791,7 @@ const x = I("hardbreak", (t) => ({
|
|
|
773
791
|
},
|
|
774
792
|
selectable: !1,
|
|
775
793
|
parseDOM: [{ tag: "br" }],
|
|
776
|
-
toDOM: (e) => ["br", t.get(
|
|
794
|
+
toDOM: (e) => ["br", t.get(we.key)(e)],
|
|
777
795
|
parseMarkdown: {
|
|
778
796
|
match: ({ type: e }) => e === "break",
|
|
779
797
|
runner: (e, r, a) => {
|
|
@@ -799,48 +817,48 @@ n(x.ctx, {
|
|
|
799
817
|
displayName: "NodeSchemaCtx<hardbreak>",
|
|
800
818
|
group: "Hardbreak"
|
|
801
819
|
});
|
|
802
|
-
const
|
|
820
|
+
const Ae = g("InsertHardbreak", () => () => (t, e) => {
|
|
803
821
|
var o;
|
|
804
822
|
const { selection: r, tr: a } = t;
|
|
805
823
|
if (r.empty) {
|
|
806
824
|
const s = r.$from.node();
|
|
807
825
|
if (s.childCount > 0 && ((o = s.lastChild) == null ? void 0 : o.type.name) === "hardbreak")
|
|
808
826
|
return e == null || e(
|
|
809
|
-
a.replaceRangeWith(r.to - 1, r.to, t.schema.node("paragraph")).setSelection(
|
|
827
|
+
a.replaceRangeWith(r.to - 1, r.to, t.schema.node("paragraph")).setSelection(Xe.near(a.doc.resolve(r.to))).scrollIntoView()
|
|
810
828
|
), !0;
|
|
811
829
|
}
|
|
812
830
|
return e == null || e(a.setMeta("hardbreak", !0).replaceSelectionWith(x.type().create()).scrollIntoView()), !0;
|
|
813
831
|
});
|
|
814
|
-
n(
|
|
832
|
+
n(Ae, {
|
|
815
833
|
displayName: "Command<insertHardbreakCommand>",
|
|
816
834
|
group: "Hardbreak"
|
|
817
835
|
});
|
|
818
|
-
const
|
|
836
|
+
const ve = f("hardbreakKeymap", {
|
|
819
837
|
InsertHardbreak: {
|
|
820
838
|
shortcuts: "Shift-Enter",
|
|
821
839
|
command: (t) => {
|
|
822
840
|
const e = t.get(h);
|
|
823
|
-
return () => e.call(
|
|
841
|
+
return () => e.call(Ae.key);
|
|
824
842
|
}
|
|
825
843
|
}
|
|
826
844
|
});
|
|
827
|
-
n(
|
|
845
|
+
n(ve.ctx, {
|
|
828
846
|
displayName: "KeymapCtx<hardbreak>",
|
|
829
847
|
group: "Hardbreak"
|
|
830
848
|
});
|
|
831
|
-
n(
|
|
849
|
+
n(ve.shortcuts, {
|
|
832
850
|
displayName: "Keymap<hardbreak>",
|
|
833
851
|
group: "Hardbreak"
|
|
834
852
|
});
|
|
835
|
-
const
|
|
836
|
-
n(
|
|
853
|
+
const He = N("hr");
|
|
854
|
+
n(He, {
|
|
837
855
|
displayName: "Attr<hr>",
|
|
838
856
|
group: "Hr"
|
|
839
857
|
});
|
|
840
|
-
const
|
|
858
|
+
const F = I("hr", (t) => ({
|
|
841
859
|
group: "block",
|
|
842
860
|
parseDOM: [{ tag: "hr" }],
|
|
843
|
-
toDOM: (e) => ["hr", t.get(
|
|
861
|
+
toDOM: (e) => ["hr", t.get(He.key)(e)],
|
|
844
862
|
parseMarkdown: {
|
|
845
863
|
match: ({ type: e }) => e === "thematicBreak",
|
|
846
864
|
runner: (e, r, a) => {
|
|
@@ -854,40 +872,40 @@ const $ = I("hr", (t) => ({
|
|
|
854
872
|
}
|
|
855
873
|
}
|
|
856
874
|
}));
|
|
857
|
-
n(
|
|
875
|
+
n(F.node, {
|
|
858
876
|
displayName: "NodeSchema<hr>",
|
|
859
877
|
group: "Hr"
|
|
860
878
|
});
|
|
861
|
-
n(
|
|
879
|
+
n(F.ctx, {
|
|
862
880
|
displayName: "NodeSchemaCtx<hr>",
|
|
863
881
|
group: "Hr"
|
|
864
882
|
});
|
|
865
|
-
const
|
|
883
|
+
const dt = L(() => new Qe(
|
|
866
884
|
/^(?:---|___\s|\*\*\*\s)$/,
|
|
867
885
|
(t, e, r, a) => {
|
|
868
886
|
const { tr: o } = t;
|
|
869
|
-
return e[0] && o.replaceWith(r - 1, a,
|
|
887
|
+
return e[0] && o.replaceWith(r - 1, a, F.type().create()), o;
|
|
870
888
|
}
|
|
871
889
|
));
|
|
872
|
-
n(
|
|
890
|
+
n(dt, {
|
|
873
891
|
displayName: "InputRule<insertHrInputRule>",
|
|
874
892
|
group: "Hr"
|
|
875
893
|
});
|
|
876
|
-
const
|
|
894
|
+
const mt = g("InsertHr", () => () => (t, e) => {
|
|
877
895
|
if (!e)
|
|
878
896
|
return !0;
|
|
879
|
-
const r = w.node.type().create(), { tr: a, selection: o } = t, { from: s } = o, i =
|
|
897
|
+
const r = w.node.type().create(), { tr: a, selection: o } = t, { from: s } = o, i = F.type().create();
|
|
880
898
|
if (!i)
|
|
881
899
|
return !0;
|
|
882
|
-
const l = a.replaceSelectionWith(i).insert(s, r), c =
|
|
900
|
+
const l = a.replaceSelectionWith(i).insert(s, r), c = Xe.findFrom(l.doc.resolve(s), 1, !0);
|
|
883
901
|
return c && e(l.setSelection(c).scrollIntoView()), !0;
|
|
884
902
|
});
|
|
885
|
-
n(
|
|
903
|
+
n(mt, {
|
|
886
904
|
displayName: "Command<insertHrCommand>",
|
|
887
905
|
group: "Hr"
|
|
888
906
|
});
|
|
889
|
-
const
|
|
890
|
-
n(
|
|
907
|
+
const Be = N("bulletList");
|
|
908
|
+
n(Be, {
|
|
891
909
|
displayName: "Attr<bulletList>",
|
|
892
910
|
group: "BulletList"
|
|
893
911
|
});
|
|
@@ -914,7 +932,7 @@ const K = I("bullet_list", (t) => ({
|
|
|
914
932
|
toDOM: (e) => [
|
|
915
933
|
"ul",
|
|
916
934
|
{
|
|
917
|
-
...t.get(
|
|
935
|
+
...t.get(Be.key)(e),
|
|
918
936
|
"data-spread": e.attrs.spread
|
|
919
937
|
},
|
|
920
938
|
0
|
|
@@ -941,35 +959,35 @@ n(K.ctx, {
|
|
|
941
959
|
displayName: "NodeSchemaCtx<bulletList>",
|
|
942
960
|
group: "BulletList"
|
|
943
961
|
});
|
|
944
|
-
const
|
|
945
|
-
n(
|
|
962
|
+
const ut = L(() => re(/^\s*([-+*])\s$/, K.type()));
|
|
963
|
+
n(ut, {
|
|
946
964
|
displayName: "InputRule<wrapInBulletListInputRule>",
|
|
947
965
|
group: "BulletList"
|
|
948
966
|
});
|
|
949
|
-
const
|
|
950
|
-
n(
|
|
967
|
+
const Te = g("WrapInBulletList", () => () => te(K.type()));
|
|
968
|
+
n(Te, {
|
|
951
969
|
displayName: "Command<wrapInBulletListCommand>",
|
|
952
970
|
group: "BulletList"
|
|
953
971
|
});
|
|
954
|
-
const
|
|
972
|
+
const Oe = f("bulletListKeymap", {
|
|
955
973
|
WrapInBulletList: {
|
|
956
974
|
shortcuts: "Mod-Alt-8",
|
|
957
975
|
command: (t) => {
|
|
958
976
|
const e = t.get(h);
|
|
959
|
-
return () => e.call(
|
|
977
|
+
return () => e.call(Te.key);
|
|
960
978
|
}
|
|
961
979
|
}
|
|
962
980
|
});
|
|
963
|
-
n(
|
|
981
|
+
n(Oe.ctx, {
|
|
964
982
|
displayName: "KeymapCtx<bulletListKeymap>",
|
|
965
983
|
group: "BulletList"
|
|
966
984
|
});
|
|
967
|
-
n(
|
|
985
|
+
n(Oe.shortcuts, {
|
|
968
986
|
displayName: "Keymap<bulletListKeymap>",
|
|
969
987
|
group: "BulletList"
|
|
970
988
|
});
|
|
971
|
-
const
|
|
972
|
-
n(
|
|
989
|
+
const Ke = N("orderedList");
|
|
990
|
+
n(Ke, {
|
|
973
991
|
displayName: "Attr<orderedList>",
|
|
974
992
|
group: "OrderedList"
|
|
975
993
|
});
|
|
@@ -1000,7 +1018,7 @@ const D = I("ordered_list", (t) => ({
|
|
|
1000
1018
|
toDOM: (e) => [
|
|
1001
1019
|
"ol",
|
|
1002
1020
|
{
|
|
1003
|
-
...t.get(
|
|
1021
|
+
...t.get(Ke.key)(e),
|
|
1004
1022
|
...e.attrs.order === 1 ? {} : e.attrs.order,
|
|
1005
1023
|
"data-spread": e.attrs.spread
|
|
1006
1024
|
},
|
|
@@ -1028,40 +1046,40 @@ n(D.ctx, {
|
|
|
1028
1046
|
displayName: "NodeSchemaCtx<orderedList>",
|
|
1029
1047
|
group: "OrderedList"
|
|
1030
1048
|
});
|
|
1031
|
-
const
|
|
1049
|
+
const pt = L(() => re(
|
|
1032
1050
|
/^\s*(\d+)\.\s$/,
|
|
1033
1051
|
D.type(),
|
|
1034
1052
|
(t) => ({ order: Number(t[1]) }),
|
|
1035
1053
|
(t, e) => e.childCount + e.attrs.order === Number(t[1])
|
|
1036
1054
|
));
|
|
1037
|
-
n(
|
|
1055
|
+
n(pt, {
|
|
1038
1056
|
displayName: "InputRule<wrapInOrderedListInputRule>",
|
|
1039
1057
|
group: "OrderedList"
|
|
1040
1058
|
});
|
|
1041
|
-
const
|
|
1042
|
-
n(
|
|
1059
|
+
const De = g("WrapInOrderedList", () => () => te(D.type()));
|
|
1060
|
+
n(De, {
|
|
1043
1061
|
displayName: "Command<wrapInOrderedListCommand>",
|
|
1044
1062
|
group: "OrderedList"
|
|
1045
1063
|
});
|
|
1046
|
-
const
|
|
1064
|
+
const Re = f("orderedListKeymap", {
|
|
1047
1065
|
WrapInOrderedList: {
|
|
1048
1066
|
shortcuts: "Mod-Alt-7",
|
|
1049
1067
|
command: (t) => {
|
|
1050
1068
|
const e = t.get(h);
|
|
1051
|
-
return () => e.call(
|
|
1069
|
+
return () => e.call(De.key);
|
|
1052
1070
|
}
|
|
1053
1071
|
}
|
|
1054
1072
|
});
|
|
1055
|
-
n(
|
|
1073
|
+
n(Re.ctx, {
|
|
1056
1074
|
displayName: "KeymapCtx<orderedList>",
|
|
1057
1075
|
group: "OrderedList"
|
|
1058
1076
|
});
|
|
1059
|
-
n(
|
|
1077
|
+
n(Re.shortcuts, {
|
|
1060
1078
|
displayName: "Keymap<orderedList>",
|
|
1061
1079
|
group: "OrderedList"
|
|
1062
1080
|
});
|
|
1063
|
-
const
|
|
1064
|
-
n(
|
|
1081
|
+
const Pe = N("listItem");
|
|
1082
|
+
n(Pe, {
|
|
1065
1083
|
displayName: "Attr<listItem>",
|
|
1066
1084
|
group: "ListItem"
|
|
1067
1085
|
});
|
|
@@ -1097,7 +1115,7 @@ const C = I("list_item", (t) => ({
|
|
|
1097
1115
|
toDOM: (e) => [
|
|
1098
1116
|
"li",
|
|
1099
1117
|
{
|
|
1100
|
-
...t.get(
|
|
1118
|
+
...t.get(Pe.key)(e),
|
|
1101
1119
|
"data-label": e.attrs.label,
|
|
1102
1120
|
"data-list-type": e.attrs.listType,
|
|
1103
1121
|
"data-spread": e.attrs.spread
|
|
@@ -1126,74 +1144,74 @@ n(C.ctx, {
|
|
|
1126
1144
|
displayName: "NodeSchemaCtx<listItem>",
|
|
1127
1145
|
group: "ListItem"
|
|
1128
1146
|
});
|
|
1129
|
-
const
|
|
1130
|
-
n(
|
|
1147
|
+
const Ee = g("SinkListItem", () => () => Kt(C.type()));
|
|
1148
|
+
n(Ee, {
|
|
1131
1149
|
displayName: "Command<sinkListItemCommand>",
|
|
1132
1150
|
group: "ListItem"
|
|
1133
1151
|
});
|
|
1134
|
-
const
|
|
1135
|
-
n(
|
|
1152
|
+
const _e = g("SplitListItem", () => () => et(C.type()));
|
|
1153
|
+
n(_e, {
|
|
1136
1154
|
displayName: "Command<liftListItemCommand>",
|
|
1137
1155
|
group: "ListItem"
|
|
1138
1156
|
});
|
|
1139
|
-
const
|
|
1140
|
-
n(
|
|
1157
|
+
const $e = g("SplitListItem", () => () => Dt(C.type()));
|
|
1158
|
+
n($e, {
|
|
1141
1159
|
displayName: "Command<splitListItemCommand>",
|
|
1142
1160
|
group: "ListItem"
|
|
1143
1161
|
});
|
|
1144
|
-
const
|
|
1162
|
+
const Ft = (t, e, r) => {
|
|
1145
1163
|
const { selection: a } = t;
|
|
1146
|
-
if (!(a instanceof
|
|
1164
|
+
if (!(a instanceof V))
|
|
1147
1165
|
return !1;
|
|
1148
1166
|
const { empty: o, $from: s } = a;
|
|
1149
1167
|
if (!o || s.parentOffset !== 0)
|
|
1150
1168
|
return !1;
|
|
1151
1169
|
const i = s.node(-1);
|
|
1152
|
-
return i.type !== C.type() || i.firstChild !== s.node() || s.node(-2).childCount > 1 ? !1 :
|
|
1153
|
-
},
|
|
1154
|
-
n(
|
|
1170
|
+
return i.type !== C.type() || i.firstChild !== s.node() || s.node(-2).childCount > 1 ? !1 : et(C.type())(t, e, r);
|
|
1171
|
+
}, qe = g("LiftFirstListItem", () => () => Ft);
|
|
1172
|
+
n(qe, {
|
|
1155
1173
|
displayName: "Command<liftFirstListItemCommand>",
|
|
1156
1174
|
group: "ListItem"
|
|
1157
1175
|
});
|
|
1158
|
-
const
|
|
1176
|
+
const We = f("listItemKeymap", {
|
|
1159
1177
|
NextListItem: {
|
|
1160
1178
|
shortcuts: "Enter",
|
|
1161
1179
|
command: (t) => {
|
|
1162
1180
|
const e = t.get(h);
|
|
1163
|
-
return () => e.call(
|
|
1181
|
+
return () => e.call($e.key);
|
|
1164
1182
|
}
|
|
1165
1183
|
},
|
|
1166
1184
|
SinkListItem: {
|
|
1167
1185
|
shortcuts: ["Tab", "Mod-]"],
|
|
1168
1186
|
command: (t) => {
|
|
1169
1187
|
const e = t.get(h);
|
|
1170
|
-
return () => e.call(
|
|
1188
|
+
return () => e.call(Ee.key);
|
|
1171
1189
|
}
|
|
1172
1190
|
},
|
|
1173
1191
|
LiftListItem: {
|
|
1174
1192
|
shortcuts: ["Shift-Tab", "Mod-["],
|
|
1175
1193
|
command: (t) => {
|
|
1176
1194
|
const e = t.get(h);
|
|
1177
|
-
return () => e.call(
|
|
1195
|
+
return () => e.call(_e.key);
|
|
1178
1196
|
}
|
|
1179
1197
|
},
|
|
1180
1198
|
LiftFirstListItem: {
|
|
1181
1199
|
shortcuts: ["Backspace", "Delete"],
|
|
1182
1200
|
command: (t) => {
|
|
1183
1201
|
const e = t.get(h);
|
|
1184
|
-
return () => e.call(
|
|
1202
|
+
return () => e.call(qe.key);
|
|
1185
1203
|
}
|
|
1186
1204
|
}
|
|
1187
1205
|
});
|
|
1188
|
-
n(
|
|
1206
|
+
n(We.ctx, {
|
|
1189
1207
|
displayName: "KeymapCtx<listItem>",
|
|
1190
1208
|
group: "ListItem"
|
|
1191
1209
|
});
|
|
1192
|
-
n(
|
|
1210
|
+
n(We.shortcuts, {
|
|
1193
1211
|
displayName: "Keymap<listItem>",
|
|
1194
1212
|
group: "ListItem"
|
|
1195
1213
|
});
|
|
1196
|
-
const
|
|
1214
|
+
const gt = Ye("text", () => ({
|
|
1197
1215
|
group: "inline",
|
|
1198
1216
|
parseMarkdown: {
|
|
1199
1217
|
match: ({ type: t }) => t === "text",
|
|
@@ -1208,16 +1226,16 @@ const ut = ze("text", () => ({
|
|
|
1208
1226
|
}
|
|
1209
1227
|
}
|
|
1210
1228
|
}));
|
|
1211
|
-
n(
|
|
1229
|
+
n(gt, {
|
|
1212
1230
|
displayName: "NodeSchema<text>",
|
|
1213
1231
|
group: "Text"
|
|
1214
1232
|
});
|
|
1215
|
-
const
|
|
1216
|
-
n(
|
|
1233
|
+
const Fe = N("html");
|
|
1234
|
+
n(Fe, {
|
|
1217
1235
|
displayName: "Attr<html>",
|
|
1218
1236
|
group: "Html"
|
|
1219
1237
|
});
|
|
1220
|
-
const
|
|
1238
|
+
const Ge = I("html", (t) => ({
|
|
1221
1239
|
atom: !0,
|
|
1222
1240
|
group: "inline",
|
|
1223
1241
|
inline: !0,
|
|
@@ -1228,7 +1246,7 @@ const qe = I("html", (t) => ({
|
|
|
1228
1246
|
},
|
|
1229
1247
|
toDOM: (e) => {
|
|
1230
1248
|
const r = document.createElement("span"), a = {
|
|
1231
|
-
...t.get(
|
|
1249
|
+
...t.get(Fe.key)(e),
|
|
1232
1250
|
"data-value": e.attrs.value,
|
|
1233
1251
|
"data-type": "html"
|
|
1234
1252
|
};
|
|
@@ -1253,102 +1271,102 @@ const qe = I("html", (t) => ({
|
|
|
1253
1271
|
}
|
|
1254
1272
|
}
|
|
1255
1273
|
}));
|
|
1256
|
-
n(
|
|
1274
|
+
n(Ge.node, {
|
|
1257
1275
|
displayName: "NodeSchema<html>",
|
|
1258
1276
|
group: "Html"
|
|
1259
1277
|
});
|
|
1260
|
-
n(
|
|
1278
|
+
n(Ge.ctx, {
|
|
1261
1279
|
displayName: "NodeSchemaCtx<html>",
|
|
1262
1280
|
group: "Html"
|
|
1263
1281
|
});
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
me,
|
|
1267
|
-
w,
|
|
1268
|
-
z,
|
|
1282
|
+
const Gt = [
|
|
1283
|
+
nt,
|
|
1269
1284
|
ge,
|
|
1285
|
+
w,
|
|
1286
|
+
Q,
|
|
1287
|
+
ke,
|
|
1270
1288
|
A,
|
|
1271
|
-
|
|
1289
|
+
we,
|
|
1272
1290
|
x,
|
|
1273
|
-
ke,
|
|
1274
|
-
E,
|
|
1275
1291
|
Ie,
|
|
1276
|
-
|
|
1277
|
-
we,
|
|
1278
|
-
$,
|
|
1292
|
+
q,
|
|
1279
1293
|
be,
|
|
1294
|
+
W,
|
|
1295
|
+
He,
|
|
1296
|
+
F,
|
|
1297
|
+
Se,
|
|
1280
1298
|
O,
|
|
1281
|
-
Ae,
|
|
1282
|
-
K,
|
|
1283
1299
|
Be,
|
|
1284
|
-
|
|
1300
|
+
K,
|
|
1285
1301
|
Ke,
|
|
1302
|
+
D,
|
|
1303
|
+
Pe,
|
|
1286
1304
|
C,
|
|
1287
|
-
te,
|
|
1288
|
-
V,
|
|
1289
1305
|
ne,
|
|
1290
|
-
|
|
1306
|
+
Y,
|
|
1291
1307
|
le,
|
|
1292
|
-
|
|
1308
|
+
J,
|
|
1293
1309
|
de,
|
|
1310
|
+
b,
|
|
1311
|
+
pe,
|
|
1294
1312
|
v,
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
].flat(),
|
|
1299
|
-
|
|
1313
|
+
Fe,
|
|
1314
|
+
Ge,
|
|
1315
|
+
gt
|
|
1316
|
+
].flat(), Vt = [
|
|
1317
|
+
st,
|
|
1318
|
+
ut,
|
|
1319
|
+
pt,
|
|
1320
|
+
lt,
|
|
1300
1321
|
dt,
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
it,
|
|
1304
|
-
at
|
|
1305
|
-
].flat(), Ft = [
|
|
1306
|
-
ue,
|
|
1307
|
-
fe,
|
|
1308
|
-
M,
|
|
1322
|
+
ot
|
|
1323
|
+
].flat(), jt = [
|
|
1309
1324
|
he,
|
|
1310
1325
|
Ce,
|
|
1311
|
-
|
|
1326
|
+
M,
|
|
1327
|
+
fe,
|
|
1328
|
+
xe,
|
|
1329
|
+
Ae,
|
|
1330
|
+
mt,
|
|
1331
|
+
it,
|
|
1312
1332
|
ct,
|
|
1313
|
-
st,
|
|
1314
|
-
lt,
|
|
1315
|
-
Te,
|
|
1316
|
-
ve,
|
|
1317
1333
|
De,
|
|
1318
|
-
|
|
1319
|
-
Pe,
|
|
1334
|
+
Te,
|
|
1320
1335
|
Ee,
|
|
1321
|
-
|
|
1322
|
-
|
|
1336
|
+
$e,
|
|
1337
|
+
_e,
|
|
1338
|
+
qe,
|
|
1323
1339
|
oe,
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1340
|
+
me,
|
|
1341
|
+
ie,
|
|
1342
|
+
rt,
|
|
1343
|
+
at
|
|
1344
|
+
], zt = [
|
|
1328
1345
|
Me,
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1346
|
+
Le,
|
|
1347
|
+
ve,
|
|
1348
|
+
Ne,
|
|
1349
|
+
We,
|
|
1350
|
+
Re,
|
|
1332
1351
|
Oe,
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
ce
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
let e = t, r = e.match(U);
|
|
1352
|
+
ye,
|
|
1353
|
+
se,
|
|
1354
|
+
ue,
|
|
1355
|
+
ce
|
|
1356
|
+
].flat(), Ut = /\[([^\]]+)]\([^\s\]]+\)/, X = /\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/, Yt = (t) => new RegExp(`\\\\(?=[^\\w\\s${t}\\\\]|_)`, "g"), Jt = (t) => {
|
|
1357
|
+
let e = t, r = e.match(X);
|
|
1340
1358
|
for (; r && r.groups; ) {
|
|
1341
1359
|
const { span: a } = r.groups;
|
|
1342
|
-
e = e.replace(
|
|
1360
|
+
e = e.replace(X, a), r = e.match(X);
|
|
1343
1361
|
}
|
|
1344
1362
|
return e;
|
|
1345
|
-
},
|
|
1363
|
+
}, Qt = (t, e, r) => {
|
|
1346
1364
|
const a = t.split(""), o = a[e];
|
|
1347
1365
|
return a[e] && a[r] && (a[e] = a[r], a[r] = o), a.join("").toString();
|
|
1348
|
-
},
|
|
1366
|
+
}, Xt = (t) => (e) => e.replace(Yt(t), ""), Zt = (t) => (e) => {
|
|
1349
1367
|
const r = e.indexOf(t.hole), a = e.charAt(r - 1), o = e.charAt(r + 1), s = /[^\w]|_/;
|
|
1350
1368
|
return o ? a && s.test(a) && s.test(o) ? t.punctuation : t.char : t.punctuation;
|
|
1351
|
-
},
|
|
1369
|
+
}, er = (t, e, r) => {
|
|
1352
1370
|
let a = e, o = !1;
|
|
1353
1371
|
return t.descendants((s) => {
|
|
1354
1372
|
var i;
|
|
@@ -1363,7 +1381,7 @@ const qt = [
|
|
|
1363
1381
|
}
|
|
1364
1382
|
return a += 1, !0;
|
|
1365
1383
|
}), a;
|
|
1366
|
-
},
|
|
1384
|
+
}, tr = {
|
|
1367
1385
|
placeholderConfig: {
|
|
1368
1386
|
hole: "∅",
|
|
1369
1387
|
punctuation: "⁂",
|
|
@@ -1375,46 +1393,46 @@ const qt = [
|
|
|
1375
1393
|
const r = ["*", "_"];
|
|
1376
1394
|
let a = e.indexOf(t);
|
|
1377
1395
|
for (; r.includes(e[a - 1] || "") && r.includes(e[a + 1] || ""); )
|
|
1378
|
-
e =
|
|
1396
|
+
e = Qt(e, a, a + 1), a = a + 1;
|
|
1379
1397
|
return e;
|
|
1380
1398
|
}
|
|
1381
|
-
},
|
|
1382
|
-
n(
|
|
1399
|
+
}, R = ee(tr, "inlineSyncConfig");
|
|
1400
|
+
n(R, {
|
|
1383
1401
|
displayName: "Ctx<inlineSyncConfig>",
|
|
1384
1402
|
group: "Prose"
|
|
1385
1403
|
});
|
|
1386
|
-
const
|
|
1387
|
-
const o = t.get(
|
|
1404
|
+
const rr = (t) => t.selection.$from.node(), ar = (t, e, r, a) => {
|
|
1405
|
+
const o = t.get(At), s = e.schema.topNodeType.create(void 0, [r, ...a]);
|
|
1388
1406
|
return o(s);
|
|
1389
|
-
},
|
|
1390
|
-
const r = t.get(
|
|
1407
|
+
}, nr = (t, e) => {
|
|
1408
|
+
const r = t.get(R.key), a = r.placeholderConfig.hole, [o = "", ...s] = e.split(`
|
|
1391
1409
|
|
|
1392
1410
|
`), i = (m) => r.movePlaceholder(a, m);
|
|
1393
|
-
let c =
|
|
1394
|
-
const d =
|
|
1411
|
+
let c = wt(Xt(a), i, Jt)(o);
|
|
1412
|
+
const d = Zt(r.placeholderConfig)(c);
|
|
1395
1413
|
return c = c.replace(a, d), c = [c, ...s].join(`
|
|
1396
1414
|
|
|
1397
1415
|
`), [c, d];
|
|
1398
|
-
},
|
|
1399
|
-
const a = t.get(
|
|
1416
|
+
}, or = (t, e) => {
|
|
1417
|
+
const a = t.get(vt)(e);
|
|
1400
1418
|
return a ? a.firstChild : null;
|
|
1401
|
-
},
|
|
1402
|
-
const { globalNodes: r } = t.get(
|
|
1419
|
+
}, sr = (t, e) => {
|
|
1420
|
+
const { globalNodes: r } = t.get(R.key), a = [];
|
|
1403
1421
|
return e.doc.descendants((o) => {
|
|
1404
1422
|
if (r.includes(o.type.name) || r.includes(o.type))
|
|
1405
1423
|
return a.push(o), !1;
|
|
1406
1424
|
}), a;
|
|
1407
|
-
},
|
|
1425
|
+
}, lr = (t) => t.split(`
|
|
1408
1426
|
|
|
1409
|
-
`)[0] || "",
|
|
1427
|
+
`)[0] || "", ir = (t) => t.childCount === 1 && t.child(0).type.name === "html", ht = (t, e) => {
|
|
1410
1428
|
try {
|
|
1411
|
-
const r =
|
|
1412
|
-
return !l || a.type !== l.type ||
|
|
1429
|
+
const r = sr(t, e), a = rr(e), o = ar(t, e, a, r), [s, i] = nr(t, o), l = or(t, s);
|
|
1430
|
+
return !l || a.type !== l.type || ir(l) ? null : (l.attrs = { ...a.attrs }, l.descendants((c) => {
|
|
1413
1431
|
var u;
|
|
1414
1432
|
const m = c.marks.find((y) => y.type.name === "link");
|
|
1415
1433
|
m && ((u = c.text) != null && u.includes(i)) && m.attrs.href.includes(i) && (m.attrs.href = m.attrs.href.replace(i, ""));
|
|
1416
1434
|
}), {
|
|
1417
|
-
text:
|
|
1435
|
+
text: lr(s),
|
|
1418
1436
|
prevNode: a,
|
|
1419
1437
|
nextNode: l,
|
|
1420
1438
|
placeholder: i
|
|
@@ -1422,15 +1440,18 @@ const Xt = (t) => t.selection.$from.node(), Zt = (t, e, r, a) => {
|
|
|
1422
1440
|
} catch {
|
|
1423
1441
|
return null;
|
|
1424
1442
|
}
|
|
1425
|
-
},
|
|
1426
|
-
|
|
1443
|
+
}, cr = (t, e, r, a, o) => {
|
|
1444
|
+
var E;
|
|
1445
|
+
const { placeholderConfig: s } = t.get(R.key), i = s.hole;
|
|
1427
1446
|
let l = r.tr.setMeta(e, !0).insertText(i, r.selection.from);
|
|
1428
|
-
const c = r.apply(l), d =
|
|
1447
|
+
const c = r.apply(l), d = ht(t, c);
|
|
1429
1448
|
if (!d)
|
|
1430
1449
|
return;
|
|
1431
|
-
const { $from:
|
|
1432
|
-
l = l.replaceWith(
|
|
1433
|
-
|
|
1450
|
+
const m = d.text.slice(0, d.text.indexOf(d.placeholder)), { $from: u } = c.selection, y = u.before(), p = u.after(), k = er(d.nextNode, y, d.placeholder);
|
|
1451
|
+
l = l.replaceWith(y, p, d.nextNode).setNodeMarkup(y, void 0, o).delete(k + 1, k + 2), l = l.setSelection(V.near(l.doc.resolve(k + 1))), (Ut.test(m) || ["*", "_", "~"].includes(m.at(-1) || "")) && l.selection instanceof V && (((E = l.selection.$cursor) == null ? void 0 : E.marks()) ?? []).forEach((G) => {
|
|
1452
|
+
l = l.removeStoredMark(G.type);
|
|
1453
|
+
}), a(l);
|
|
1454
|
+
}, yt = H((t) => {
|
|
1434
1455
|
let e = null;
|
|
1435
1456
|
const r = new B("MILKDOWN_INLINE_SYNC");
|
|
1436
1457
|
return new T({
|
|
@@ -1439,29 +1460,29 @@ const Xt = (t) => t.selection.$from.node(), Zt = (t, e, r, a) => {
|
|
|
1439
1460
|
init: () => null,
|
|
1440
1461
|
apply: (a, o, s, i) => {
|
|
1441
1462
|
var k;
|
|
1442
|
-
const l = t.get(
|
|
1463
|
+
const l = t.get(Z);
|
|
1443
1464
|
if (!((k = l.hasFocus) != null && k.call(l)) || !l.editable || !a.docChanged || a.getMeta(r))
|
|
1444
1465
|
return null;
|
|
1445
|
-
const d =
|
|
1466
|
+
const d = ht(t, i);
|
|
1446
1467
|
if (!d)
|
|
1447
1468
|
return null;
|
|
1448
1469
|
e && (cancelAnimationFrame(e), e = null);
|
|
1449
|
-
const { prevNode: m, nextNode: u, text: y } = d, { shouldSyncNode: p } = t.get(
|
|
1470
|
+
const { prevNode: m, nextNode: u, text: y } = d, { shouldSyncNode: p } = t.get(R.key);
|
|
1450
1471
|
return p({ prevNode: m, nextNode: u, ctx: t, tr: a, text: y }) && (e = requestAnimationFrame(() => {
|
|
1451
1472
|
e = null;
|
|
1452
|
-
const { dispatch:
|
|
1453
|
-
|
|
1454
|
-
})
|
|
1473
|
+
const { dispatch: P, state: E } = t.get(Z);
|
|
1474
|
+
cr(t, r, E, P, m.attrs);
|
|
1475
|
+
})), null;
|
|
1455
1476
|
}
|
|
1456
1477
|
}
|
|
1457
1478
|
});
|
|
1458
1479
|
});
|
|
1459
|
-
n(
|
|
1480
|
+
n(yt, {
|
|
1460
1481
|
displayName: "Prose<inlineSyncPlugin>",
|
|
1461
1482
|
group: "Prose"
|
|
1462
1483
|
});
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1484
|
+
const kt = $(() => () => (t) => {
|
|
1485
|
+
ae(t, "list", (e) => {
|
|
1465
1486
|
if (e.ordered) {
|
|
1466
1487
|
const r = e.start ?? 1;
|
|
1467
1488
|
e.children.forEach((a, o) => {
|
|
@@ -1470,13 +1491,13 @@ const ht = G(() => () => (t) => {
|
|
|
1470
1491
|
}
|
|
1471
1492
|
});
|
|
1472
1493
|
});
|
|
1473
|
-
n(
|
|
1494
|
+
n(kt, {
|
|
1474
1495
|
displayName: "Remark<remarkAddOrderInListPlugin>",
|
|
1475
1496
|
group: "Remark"
|
|
1476
1497
|
});
|
|
1477
|
-
const
|
|
1498
|
+
const ft = $(() => () => (t) => {
|
|
1478
1499
|
const e = /[\t ]*(?:\r?\n|\r)/g;
|
|
1479
|
-
|
|
1500
|
+
ae(t, "text", (r, a, o) => {
|
|
1480
1501
|
if (!r.value || typeof r.value != "string")
|
|
1481
1502
|
return;
|
|
1482
1503
|
const s = [];
|
|
@@ -1491,20 +1512,20 @@ const yt = G(() => () => (t) => {
|
|
|
1491
1512
|
return i < r.value.length && s.push({ type: "text", value: r.value.slice(i) }), o.children.splice(a, 1, ...s), a + s.length;
|
|
1492
1513
|
});
|
|
1493
1514
|
});
|
|
1494
|
-
n(
|
|
1515
|
+
n(ft, {
|
|
1495
1516
|
displayName: "Remark<remarkLineBreak>",
|
|
1496
1517
|
group: "Remark"
|
|
1497
1518
|
});
|
|
1498
|
-
const
|
|
1499
|
-
n(
|
|
1519
|
+
const Nt = $(() => Et);
|
|
1520
|
+
n(Nt, {
|
|
1500
1521
|
displayName: "Remark<remarkInlineLinkPlugin>",
|
|
1501
1522
|
group: "Remark"
|
|
1502
1523
|
});
|
|
1503
|
-
const
|
|
1504
|
-
function
|
|
1524
|
+
const dr = (t) => !!t.children, mr = (t) => t.type === "html";
|
|
1525
|
+
function ur(t, e) {
|
|
1505
1526
|
return r(t, 0, null)[0];
|
|
1506
1527
|
function r(a, o, s) {
|
|
1507
|
-
if (
|
|
1528
|
+
if (dr(a)) {
|
|
1508
1529
|
const i = [];
|
|
1509
1530
|
for (let l = 0, c = a.children.length; l < c; l++) {
|
|
1510
1531
|
const d = a.children[l];
|
|
@@ -1522,14 +1543,24 @@ function ir(t, e) {
|
|
|
1522
1543
|
return e(a, o, s);
|
|
1523
1544
|
}
|
|
1524
1545
|
}
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1546
|
+
const It = $(() => () => (t) => {
|
|
1547
|
+
ur(t, (e, r, a) => mr(e) ? ((a == null ? void 0 : a.type) === "root" && (e.children = [{ ...e }], delete e.value, e.type = "paragraph"), [e]) : [e]);
|
|
1527
1548
|
});
|
|
1528
|
-
n(
|
|
1549
|
+
n(It, {
|
|
1529
1550
|
displayName: "Remark<remarkHtmlTransformer>",
|
|
1530
1551
|
group: "Remark"
|
|
1531
1552
|
});
|
|
1532
|
-
const
|
|
1553
|
+
const Ct = $(() => () => (t, e) => {
|
|
1554
|
+
const r = (a) => e.value.charAt(a.position.start.offset);
|
|
1555
|
+
ae(t, (a) => ["strong", "emphasis"].includes(a.type), (a) => {
|
|
1556
|
+
a.marker = r(a);
|
|
1557
|
+
});
|
|
1558
|
+
});
|
|
1559
|
+
n(Ct, {
|
|
1560
|
+
displayName: "Remark<remarkMarker>",
|
|
1561
|
+
group: "Remark"
|
|
1562
|
+
});
|
|
1563
|
+
const Mt = H(() => {
|
|
1533
1564
|
let t = !1;
|
|
1534
1565
|
const e = new B("MILKDOWN_INLINE_NODES_CURSOR"), r = new T({
|
|
1535
1566
|
key: e,
|
|
@@ -1563,24 +1594,24 @@ const Nt = H(() => {
|
|
|
1563
1594
|
},
|
|
1564
1595
|
decorations(a) {
|
|
1565
1596
|
if (r.getState(a)) {
|
|
1566
|
-
const i = a.selection.$from.pos, l = document.createElement("span"), c =
|
|
1597
|
+
const i = a.selection.$from.pos, l = document.createElement("span"), c = ze.widget(i, l, {
|
|
1567
1598
|
side: -1
|
|
1568
|
-
}), d = document.createElement("span"), m =
|
|
1599
|
+
}), d = document.createElement("span"), m = ze.widget(i, d);
|
|
1569
1600
|
return setTimeout(() => {
|
|
1570
1601
|
l.contentEditable = "true", d.contentEditable = "true";
|
|
1571
|
-
}),
|
|
1602
|
+
}), Ue.create(a.doc, [c, m]);
|
|
1572
1603
|
}
|
|
1573
|
-
return
|
|
1604
|
+
return Ue.empty;
|
|
1574
1605
|
}
|
|
1575
1606
|
}
|
|
1576
1607
|
});
|
|
1577
1608
|
return r;
|
|
1578
1609
|
});
|
|
1579
|
-
n(
|
|
1610
|
+
n(Mt, {
|
|
1580
1611
|
displayName: "Prose<inlineNodesCursorPlugin>",
|
|
1581
1612
|
group: "Prose"
|
|
1582
1613
|
});
|
|
1583
|
-
const
|
|
1614
|
+
const bt = H(() => new T({
|
|
1584
1615
|
key: new B("MILKDOWN_HARDBREAK_MARKS"),
|
|
1585
1616
|
appendTransaction: (t, e, r) => {
|
|
1586
1617
|
if (!t.length)
|
|
@@ -1590,12 +1621,12 @@ const It = H(() => new T({
|
|
|
1590
1621
|
return;
|
|
1591
1622
|
const [o] = a.steps;
|
|
1592
1623
|
if (a.getMeta("hardbreak")) {
|
|
1593
|
-
if (!(o instanceof
|
|
1624
|
+
if (!(o instanceof Rt))
|
|
1594
1625
|
return;
|
|
1595
1626
|
const { from: l } = o;
|
|
1596
1627
|
return r.tr.setNodeMarkup(l, x.type(), void 0, []);
|
|
1597
1628
|
}
|
|
1598
|
-
if (o instanceof
|
|
1629
|
+
if (o instanceof Pt) {
|
|
1599
1630
|
let l = r.tr;
|
|
1600
1631
|
const { from: c, to: d } = o;
|
|
1601
1632
|
return r.doc.nodesBetween(c, d, (m, u) => {
|
|
@@ -1604,17 +1635,17 @@ const It = H(() => new T({
|
|
|
1604
1635
|
}
|
|
1605
1636
|
}
|
|
1606
1637
|
}));
|
|
1607
|
-
n(
|
|
1638
|
+
n(bt, {
|
|
1608
1639
|
displayName: "Prose<hardbreakClearMarkPlugin>",
|
|
1609
1640
|
group: "Prose"
|
|
1610
1641
|
});
|
|
1611
|
-
const
|
|
1612
|
-
n(
|
|
1642
|
+
const Ve = ee(["table", "code_block"], "hardbreakFilterNodes");
|
|
1643
|
+
n(Ve, {
|
|
1613
1644
|
displayName: "Ctx<hardbreakFilterNodes>",
|
|
1614
1645
|
group: "Prose"
|
|
1615
1646
|
});
|
|
1616
|
-
const
|
|
1617
|
-
const e = t.get(
|
|
1647
|
+
const xt = H((t) => {
|
|
1648
|
+
const e = t.get(Ve.key);
|
|
1618
1649
|
return new T({
|
|
1619
1650
|
key: new B("MILKDOWN_HARDBREAK_FILTER"),
|
|
1620
1651
|
filterTransaction: (r, a) => {
|
|
@@ -1630,15 +1661,15 @@ const Ct = H((t) => {
|
|
|
1630
1661
|
}
|
|
1631
1662
|
});
|
|
1632
1663
|
});
|
|
1633
|
-
n(
|
|
1664
|
+
n(xt, {
|
|
1634
1665
|
displayName: "Prose<hardbreakFilterPlugin>",
|
|
1635
1666
|
group: "Prose"
|
|
1636
1667
|
});
|
|
1637
|
-
const
|
|
1668
|
+
const Lt = H((t) => {
|
|
1638
1669
|
const e = new B("MILKDOWN_HEADING_ID"), r = (a) => {
|
|
1639
1670
|
if (a.composing || !a.editable)
|
|
1640
1671
|
return;
|
|
1641
|
-
const o = t.get(
|
|
1672
|
+
const o = t.get(Q.key), s = a.state.tr.setMeta("addToHistory", !1);
|
|
1642
1673
|
let i = !1;
|
|
1643
1674
|
a.state.doc.descendants((l, c) => {
|
|
1644
1675
|
if (l.type === A.type()) {
|
|
@@ -1661,11 +1692,11 @@ const Mt = H((t) => {
|
|
|
1661
1692
|
})
|
|
1662
1693
|
});
|
|
1663
1694
|
});
|
|
1664
|
-
n(
|
|
1695
|
+
n(Lt, {
|
|
1665
1696
|
displayName: "Prose<syncHeadingIdPlugin>",
|
|
1666
1697
|
group: "Prose"
|
|
1667
1698
|
});
|
|
1668
|
-
const
|
|
1699
|
+
const St = H(() => {
|
|
1669
1700
|
const t = (e) => {
|
|
1670
1701
|
if (e.composing || !e.editable)
|
|
1671
1702
|
return;
|
|
@@ -1678,10 +1709,10 @@ const bt = H(() => {
|
|
|
1678
1709
|
s.doc.descendants((d, m, u, y) => {
|
|
1679
1710
|
if (d.type === a) {
|
|
1680
1711
|
const p = d.maybeChild(0);
|
|
1681
|
-
(p == null ? void 0 : p.type) === o && p.attrs.listType === "ordered" && (c = !0, l.setNodeMarkup(m, r, { spread: "true" }), d.descendants((k,
|
|
1712
|
+
(p == null ? void 0 : p.type) === o && p.attrs.listType === "ordered" && (c = !0, l.setNodeMarkup(m, r, { spread: "true" }), d.descendants((k, P, E, je) => {
|
|
1682
1713
|
if (k.type === o) {
|
|
1683
|
-
const
|
|
1684
|
-
i(
|
|
1714
|
+
const G = { ...k.attrs };
|
|
1715
|
+
i(G, je) && (l = l.setNodeMarkup(P, void 0, G));
|
|
1685
1716
|
}
|
|
1686
1717
|
return !1;
|
|
1687
1718
|
}));
|
|
@@ -1701,115 +1732,117 @@ const bt = H(() => {
|
|
|
1701
1732
|
})
|
|
1702
1733
|
});
|
|
1703
1734
|
});
|
|
1704
|
-
n(
|
|
1735
|
+
n(St, {
|
|
1705
1736
|
displayName: "Prose<syncListOrderPlugin>",
|
|
1706
1737
|
group: "Prose"
|
|
1707
1738
|
});
|
|
1708
|
-
const
|
|
1709
|
-
|
|
1710
|
-
gt,
|
|
1711
|
-
It,
|
|
1712
|
-
We,
|
|
1713
|
-
Ct,
|
|
1714
|
-
Nt,
|
|
1715
|
-
ht,
|
|
1716
|
-
kt,
|
|
1739
|
+
const pr = [
|
|
1740
|
+
R,
|
|
1717
1741
|
yt,
|
|
1718
|
-
|
|
1742
|
+
bt,
|
|
1743
|
+
Ve,
|
|
1744
|
+
xt,
|
|
1719
1745
|
Mt,
|
|
1720
|
-
|
|
1721
|
-
|
|
1746
|
+
kt,
|
|
1747
|
+
Nt,
|
|
1748
|
+
ft,
|
|
1749
|
+
It,
|
|
1750
|
+
Ct,
|
|
1751
|
+
Lt,
|
|
1752
|
+
St
|
|
1753
|
+
], vr = [Gt, Vt, jt, zt, pr].flat();
|
|
1722
1754
|
export {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1755
|
+
Ie as blockquoteAttr,
|
|
1756
|
+
Me as blockquoteKeymap,
|
|
1757
|
+
q as blockquoteSchema,
|
|
1758
|
+
Be as bulletListAttr,
|
|
1759
|
+
Oe as bulletListKeymap,
|
|
1728
1760
|
K as bulletListSchema,
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1761
|
+
be as codeBlockAttr,
|
|
1762
|
+
Le as codeBlockKeymap,
|
|
1763
|
+
W as codeBlockSchema,
|
|
1764
|
+
jt as commands,
|
|
1765
|
+
vr as commonmark,
|
|
1766
|
+
xe as createCodeBlockCommand,
|
|
1767
|
+
lt as createCodeBlockInputRule,
|
|
1768
|
+
tr as defaultConfig,
|
|
1769
|
+
nt as docSchema,
|
|
1770
|
+
fe as downgradeHeadingCommand,
|
|
1771
|
+
ne as emphasisAttr,
|
|
1772
|
+
se as emphasisKeymap,
|
|
1773
|
+
Y as emphasisSchema,
|
|
1774
|
+
we as hardbreakAttr,
|
|
1775
|
+
bt as hardbreakClearMarkPlugin,
|
|
1776
|
+
Ve as hardbreakFilterNodes,
|
|
1777
|
+
xt as hardbreakFilterPlugin,
|
|
1778
|
+
ve as hardbreakKeymap,
|
|
1747
1779
|
x as hardbreakSchema,
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1780
|
+
ke as headingAttr,
|
|
1781
|
+
Q as headingIdGenerator,
|
|
1782
|
+
Ne as headingKeymap,
|
|
1751
1783
|
A as headingSchema,
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1784
|
+
He as hrAttr,
|
|
1785
|
+
F as hrSchema,
|
|
1786
|
+
Fe as htmlAttr,
|
|
1787
|
+
Ge as htmlSchema,
|
|
1788
|
+
Se as imageAttr,
|
|
1757
1789
|
O as imageSchema,
|
|
1758
|
-
|
|
1759
|
-
|
|
1790
|
+
de as inlineCodeAttr,
|
|
1791
|
+
ue as inlineCodeKeymap,
|
|
1760
1792
|
b as inlineCodeSchema,
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1793
|
+
Mt as inlineNodesCursorPlugin,
|
|
1794
|
+
R as inlineSyncConfig,
|
|
1795
|
+
yt as inlineSyncPlugin,
|
|
1796
|
+
Vt as inputrules,
|
|
1797
|
+
Ae as insertHardbreakCommand,
|
|
1798
|
+
mt as insertHrCommand,
|
|
1799
|
+
dt as insertHrInputRule,
|
|
1800
|
+
it as insertImageCommand,
|
|
1801
|
+
Wt as insertImageInputRule,
|
|
1802
|
+
zt as keymap,
|
|
1803
|
+
qe as liftFirstListItemCommand,
|
|
1804
|
+
_e as liftListItemCommand,
|
|
1805
|
+
pe as linkAttr,
|
|
1774
1806
|
v as linkSchema,
|
|
1775
|
-
|
|
1776
|
-
|
|
1807
|
+
Pe as listItemAttr,
|
|
1808
|
+
We as listItemKeymap,
|
|
1777
1809
|
C as listItemSchema,
|
|
1778
|
-
|
|
1779
|
-
|
|
1810
|
+
Ke as orderedListAttr,
|
|
1811
|
+
Re as orderedListKeymap,
|
|
1780
1812
|
D as orderedListSchema,
|
|
1781
|
-
|
|
1782
|
-
|
|
1813
|
+
ge as paragraphAttr,
|
|
1814
|
+
ye as paragraphKeymap,
|
|
1783
1815
|
w as paragraphSchema,
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1816
|
+
pr as plugins,
|
|
1817
|
+
kt as remarkAddOrderInListPlugin,
|
|
1818
|
+
It as remarkHtmlTransformer,
|
|
1819
|
+
Nt as remarkInlineLinkPlugin,
|
|
1820
|
+
ft as remarkLineBreak,
|
|
1821
|
+
Ct as remarkMarker,
|
|
1822
|
+
Gt as schema,
|
|
1823
|
+
Ee as sinkListItemCommand,
|
|
1824
|
+
$e as splitListItemCommand,
|
|
1825
|
+
le as strongAttr,
|
|
1826
|
+
ce as strongKeymap,
|
|
1827
|
+
J as strongSchema,
|
|
1828
|
+
Lt as syncHeadingIdPlugin,
|
|
1829
|
+
St as syncListOrderPlugin,
|
|
1830
|
+
gt as textSchema,
|
|
1831
|
+
oe as toggleEmphasisCommand,
|
|
1832
|
+
me as toggleInlineCodeCommand,
|
|
1833
|
+
rt as toggleLinkCommand,
|
|
1834
|
+
ie as toggleStrongCommand,
|
|
1835
|
+
he as turnIntoTextCommand,
|
|
1836
|
+
qt as updateCodeBlockLanguageCommand,
|
|
1837
|
+
ct as updateImageCommand,
|
|
1838
|
+
at as updateLinkCommand,
|
|
1839
|
+
Ce as wrapInBlockquoteCommand,
|
|
1840
|
+
st as wrapInBlockquoteInputRule,
|
|
1841
|
+
Te as wrapInBulletListCommand,
|
|
1842
|
+
ut as wrapInBulletListInputRule,
|
|
1810
1843
|
M as wrapInHeadingCommand,
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1844
|
+
ot as wrapInHeadingInputRule,
|
|
1845
|
+
De as wrapInOrderedListCommand,
|
|
1846
|
+
pt as wrapInOrderedListInputRule
|
|
1814
1847
|
};
|
|
1815
1848
|
//# sourceMappingURL=index.es.js.map
|