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