@milkdown/preset-commonmark 7.2.4 → 7.3.1

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