@milkdown/preset-commonmark 7.1.0 → 7.1.2-next.0

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