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