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