@milkdown/preset-commonmark 6.3.0 → 6.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.
package/lib/index.es.js CHANGED
@@ -1,14 +1,14 @@
1
- import { createMark as B, createShortcut as h, createNode as w, createPlugin as He, AtomList as Ne } from "@milkdown/utils";
2
- import { createCmdKey as I, createCmd as M, schemaCtx as A, commandsCtx as we, editorViewCtx as R, getPalette as Te } from "@milkdown/core";
1
+ import { createMark as R, createShortcut as h, createNode as w, createPlugin as He, AtomList as Ne } from "@milkdown/utils";
2
+ import { createCmdKey as I, createCmd as M, schemaCtx as A, commandsCtx as we, editorViewCtx as B, getPalette as Te } from "@milkdown/core";
3
3
  import { markRule as _, calculateTextPosition as Oe, cloneTr as Ae, findSelectedNodeOfType as K, getNodeFromSchema as Ee } from "@milkdown/prose";
4
4
  import { toggleMark as P, wrapIn as de, setBlockType as E } from "@milkdown/prose/commands";
5
5
  import { expectDomTypeError as D, missingRootElement as _e } from "@milkdown/exception";
6
6
  import { InputRule as me, wrappingInputRule as W, textblockTypeInputRule as G } from "@milkdown/prose/inputrules";
7
- import { PluginKey as H, TextSelection as pe, Plugin as T, NodeSelection as ve, Selection as Le } from "@milkdown/prose/state";
7
+ import { PluginKey as T, TextSelection as pe, Plugin as H, NodeSelection as ve, Selection as Le } from "@milkdown/prose/state";
8
8
  import { Fragment as ge } from "@milkdown/prose/model";
9
9
  import { ReplaceStep as $e, AddMarkStep as Se } from "@milkdown/prose/transform";
10
10
  import { DecorationSet as O, Decoration as J } from "@milkdown/prose/view";
11
- import { splitListItem as Be, sinkListItem as Re, liftListItem as Pe } from "@milkdown/prose/schema-list";
11
+ import { splitListItem as Re, sinkListItem as Be, liftListItem as Pe } from "@milkdown/prose/schema-list";
12
12
  import We from "remark-inline-links";
13
13
  import { visit as qe } from "unist-util-visit";
14
14
  const k = {
@@ -31,7 +31,7 @@ const k = {
31
31
  NextListItem: "NextListItem",
32
32
  SinkListItem: "SinkListItem",
33
33
  LiftListItem: "LiftListItem"
34
- }, he = "code_inline", Q = I("ToggleInlineCode"), Ke = B((c) => ({
34
+ }, he = "code_inline", Q = I("ToggleInlineCode"), Ke = R((c) => ({
35
35
  id: he,
36
36
  schema: () => ({
37
37
  priority: 100,
@@ -57,7 +57,7 @@ const k = {
57
57
  shortcuts: {
58
58
  [k.CodeInline]: h(Q, "Mod-e")
59
59
  }
60
- })), F = "em", X = I("ToggleItalic"), Fe = B((c) => ({
60
+ })), F = "em", X = I("ToggleItalic"), Fe = R((c) => ({
61
61
  id: F,
62
62
  schema: () => ({
63
63
  parseDOM: [
@@ -87,7 +87,7 @@ const k = {
87
87
  shortcuts: {
88
88
  [k.Em]: h(X, "Mod-i")
89
89
  }
90
- })), Ue = new H("MILKDOWN_LINK_INPUT"), xe = I("ToggleLink"), Y = I("ModifyLink"), v = "link", Ve = B((c, e) => ({
90
+ })), Ue = new T("MILKDOWN_LINK_INPUT"), xe = I("ToggleLink"), Y = I("ModifyLink"), v = "link", Ve = R((c, e) => ({
91
91
  id: v,
92
92
  schema: () => ({
93
93
  attrs: {
@@ -109,8 +109,8 @@ const k = {
109
109
  parseMarkdown: {
110
110
  match: (t) => t.type === "link",
111
111
  runner: (t, r, n) => {
112
- const s = r.url, a = r.title;
113
- t.openMark(n, { href: s, title: a }), t.next(r.children), t.closeMark(n);
112
+ const o = r.url, a = r.title;
113
+ t.openMark(n, { href: o, title: a }), t.next(r.children), t.closeMark(n);
114
114
  }
115
115
  },
116
116
  toMarkdown: {
@@ -125,94 +125,94 @@ const k = {
125
125
  }),
126
126
  commands: (t) => [
127
127
  M(xe, (r = "") => P(t, { href: r })),
128
- M(Y, (r = "") => (n, s) => {
129
- var b;
130
- if (!s)
128
+ M(Y, (r = "") => (n, o) => {
129
+ var y;
130
+ if (!o)
131
131
  return !1;
132
132
  const { marks: a } = n.schema;
133
- let o, l = -1;
134
- const { selection: i } = n, { from: d, to: m } = i;
135
- if (n.doc.nodesBetween(d, d === m ? m + 1 : m, (y, x) => {
133
+ let s, l = -1;
134
+ const { selection: i } = n, { from: u, to: g } = i;
135
+ if (n.doc.nodesBetween(u, u === g ? g + 1 : g, (N, x) => {
136
136
  var L;
137
- if ((L = a.link) != null && L.isInSet(y.marks))
138
- return o = y, l = x, !1;
139
- }), !o)
137
+ if ((L = a.link) != null && L.isInSet(N.marks))
138
+ return s = N, l = x, !1;
139
+ }), !s)
140
140
  return !1;
141
- const g = o.marks.find(({ type: y }) => y === t);
142
- if (!g)
141
+ const d = s.marks.find(({ type: N }) => N === t);
142
+ if (!d)
143
143
  return !1;
144
- const u = l, f = l + o.nodeSize, { tr: p } = n, N = (b = a.link) == null ? void 0 : b.create({ ...g.attrs, href: r });
145
- return N ? (s(p.removeMark(u, f, g).addMark(u, f, N).setSelection(new pe(p.selection.$anchor)).scrollIntoView()), !0) : !1;
144
+ const m = l, f = l + s.nodeSize, { tr: p } = n, b = (y = a.link) == null ? void 0 : y.create({ ...d.attrs, href: r });
145
+ return b ? (o(p.removeMark(m, f, d).addMark(m, f, b).setSelection(new pe(p.selection.$anchor)).scrollIntoView()), !0) : !1;
146
146
  })
147
147
  ],
148
148
  inputRules: (t, r) => [
149
- new me(/\[(?<text>.*?)]\((?<href>.*?)(?=“|\))"?(?<title>[^"]+)?"?\)/, (n, s, a, o) => {
150
- const [l, i = "", d, m] = s, { tr: g } = n;
149
+ new me(/\[(?<text>.*?)]\((?<href>.*?)(?=“|\))"?(?<title>[^"]+)?"?\)/, (n, o, a, s) => {
150
+ const [l, i = "", u, g] = o, { tr: d } = n;
151
151
  if (l) {
152
- const u = i || "link";
153
- g.replaceWith(a, o, r.get(A).text(u)).addMark(a, u.length + a, t.create({ title: m, href: d }));
152
+ const m = i || "link";
153
+ d.replaceWith(a, s, r.get(A).text(m)).addMark(a, m.length + a, t.create({ title: g, href: u }));
154
154
  }
155
- return g;
155
+ return d;
156
156
  })
157
157
  ],
158
158
  prosePlugins: (t, r) => {
159
159
  let n = !1;
160
160
  return [
161
- new T({
161
+ new H({
162
162
  key: Ue,
163
- view: (s) => {
164
- var d, m, g;
163
+ view: (o) => {
164
+ var u, g, d;
165
165
  const a = c.themeManager.get("input-chip", {
166
- placeholder: (m = (d = e == null ? void 0 : e.input) == null ? void 0 : d.placeholder) != null ? m : "Input Web Link",
167
- buttonText: (g = e == null ? void 0 : e.input) == null ? void 0 : g.buttonText,
168
- onUpdate: (u) => {
169
- r.get(we).call(Y, u);
166
+ placeholder: (g = (u = e == null ? void 0 : e.input) == null ? void 0 : u.placeholder) != null ? g : "Input Web Link",
167
+ buttonText: (d = e == null ? void 0 : e.input) == null ? void 0 : d.buttonText,
168
+ onUpdate: (m) => {
169
+ r.get(we).call(Y, m);
170
170
  },
171
- calculatePosition: (u, f) => {
172
- Oe(u, f, (p, N, b, y) => {
173
- const x = u.dom.parentElement;
171
+ calculatePosition: (m, f) => {
172
+ Oe(m, f, (p, b, y, N) => {
173
+ const x = m.dom.parentElement;
174
174
  if (!x)
175
175
  throw _e();
176
- const L = N.left - p.left;
177
- let q = p.left - y.left - (b.width - L) / 2, fe = p.bottom - y.top + 14 + x.scrollTop;
178
- return n && (fe = p.top - y.top - b.height - 14 + x.scrollTop), q < 0 && (q = 0), [fe, q];
176
+ const L = b.left - p.left;
177
+ let q = p.left - N.left - (y.width - L) / 2, fe = p.bottom - N.top + 14 + x.scrollTop;
178
+ return n && (fe = p.top - N.top - y.height - 14 + x.scrollTop), q < 0 && (q = 0), [fe, q];
179
179
  });
180
180
  }
181
181
  });
182
182
  if (!a)
183
183
  return {};
184
- const o = (u) => {
185
- const { selection: f, doc: p } = u.state, { from: N, to: b } = f;
186
- if (!u.hasFocus())
184
+ const s = (m) => {
185
+ const { selection: f, doc: p } = m.state, { from: b, to: y } = f;
186
+ if (!m.hasFocus())
187
187
  return !1;
188
- if (f.empty && f instanceof pe && b < p.content.size && N < p.content.size && p.rangeHasMark(N, N === b ? b + 1 : b, t))
188
+ if (f.empty && f instanceof pe && y < p.content.size && b < p.content.size && p.rangeHasMark(b, b === y ? y + 1 : y, t))
189
189
  return n = !1, !0;
190
190
  if (f instanceof ve) {
191
- const { node: y } = f;
192
- if (y.type.name === "image" && y.marks.findIndex((x) => x.type.name === v) > -1)
191
+ const { node: N } = f;
192
+ if (N.type.name === "image" && N.marks.findIndex((x) => x.type.name === v) > -1)
193
193
  return n = !0, !0;
194
194
  }
195
195
  return !1;
196
- }, l = (u) => {
197
- const { selection: f } = u.state;
196
+ }, l = (m) => {
197
+ const { selection: f } = m.state;
198
198
  let p;
199
- const { from: N, to: b } = f;
200
- if (u.state.doc.nodesBetween(N, N === b ? b + 1 : b, (L) => {
199
+ const { from: b, to: y } = f;
200
+ if (m.state.doc.nodesBetween(b, b === y ? y + 1 : y, (L) => {
201
201
  if (t.isInSet(L.marks))
202
202
  return p = L, !1;
203
203
  }), !p)
204
204
  return;
205
- const y = p.marks.find((L) => L.type === t);
206
- return y ? y.attrs.href : void 0;
207
- }, i = (u) => {
208
- if (!u.editable)
205
+ const N = p.marks.find((L) => L.type === t);
206
+ return N ? N.attrs.href : void 0;
207
+ }, i = (m) => {
208
+ if (!m.editable)
209
209
  return;
210
- o(u) ? (a.show(u), a.update(l(u))) : a.hide();
210
+ s(m) ? (a.show(m), a.update(l(m))) : a.hide();
211
211
  };
212
- return a.init(s), i(s), {
213
- update: (u, f) => {
214
- (f == null ? void 0 : f.doc.eq(u.state.doc)) && f.selection.eq(u.state.selection) || requestAnimationFrame(() => {
215
- i(u);
212
+ return a.init(o), i(o), {
213
+ update: (m, f) => {
214
+ (f == null ? void 0 : f.doc.eq(m.state.doc)) && f.selection.eq(m.state.selection) || requestAnimationFrame(() => {
215
+ i(m);
216
216
  });
217
217
  },
218
218
  destroy: () => {
@@ -223,7 +223,7 @@ const k = {
223
223
  })
224
224
  ];
225
225
  }
226
- })), U = "strong", Z = I("ToggleBold"), je = B((c) => ({
226
+ })), U = "strong", Z = I("ToggleBold"), je = R((c) => ({
227
227
  id: U,
228
228
  schema: () => ({
229
229
  parseDOM: [
@@ -347,16 +347,16 @@ const k = {
347
347
  tag: "div.code-fence-container",
348
348
  preserveWhitespace: "full",
349
349
  getAttrs: (n) => {
350
- var s;
350
+ var o;
351
351
  if (!(n instanceof HTMLElement))
352
352
  throw D(n);
353
- return { language: (s = n.querySelector("pre")) == null ? void 0 : s.dataset.language };
353
+ return { language: (o = n.querySelector("pre")) == null ? void 0 : o.dataset.language };
354
354
  },
355
- getContent: (n, s) => {
356
- var o, l;
355
+ getContent: (n, o) => {
356
+ var s, l;
357
357
  if (!(n instanceof HTMLElement))
358
358
  throw D(n);
359
- const a = s.text((l = (o = n.querySelector("pre")) == null ? void 0 : o.textContent) != null ? l : "");
359
+ const a = o.text((l = (s = n.querySelector("pre")) == null ? void 0 : s.textContent) != null ? l : "");
360
360
  return ge.from(a);
361
361
  }
362
362
  },
@@ -371,33 +371,33 @@ const k = {
371
371
  }
372
372
  ],
373
373
  toDOM: (n) => {
374
- const s = document.createElement("select");
374
+ const o = document.createElement("select");
375
375
  return t.forEach((a) => {
376
- const o = document.createElement("option");
377
- o.value = a, o.innerText = a || "--", a === n.attrs.language && (o.selected = !0), s.appendChild(o);
378
- }), s.onchange = (a) => {
379
- const o = a.target;
380
- if (!(o instanceof HTMLSelectElement))
376
+ const s = document.createElement("option");
377
+ s.value = a, s.innerText = a || "--", a === n.attrs.language && (s.selected = !0), o.appendChild(s);
378
+ }), o.onchange = (a) => {
379
+ const s = a.target;
380
+ if (!(s instanceof HTMLSelectElement))
381
381
  return;
382
- const l = r.get(R);
382
+ const l = r.get(B);
383
383
  if (!l.editable) {
384
- o.value = n.attrs.language;
384
+ s.value = n.attrs.language;
385
385
  return;
386
386
  }
387
- const { top: i, left: d } = o.getBoundingClientRect(), m = l.posAtCoords({ top: i, left: d });
388
- if (!m)
387
+ const { top: i, left: u } = s.getBoundingClientRect(), g = l.posAtCoords({ top: i, left: u });
388
+ if (!g)
389
389
  return;
390
- const { tr: g } = l.state;
391
- l.dispatch(g.setNodeMarkup(m.inside, void 0, {
390
+ const { tr: d } = l.state;
391
+ l.dispatch(d.setNodeMarkup(g.inside, void 0, {
392
392
  ...n.attrs,
393
- language: o.value
393
+ language: s.value
394
394
  }));
395
395
  }, [
396
396
  "div",
397
397
  {
398
398
  class: "code-fence-container"
399
399
  },
400
- s,
400
+ o,
401
401
  [
402
402
  "pre",
403
403
  {
@@ -410,30 +410,30 @@ const k = {
410
410
  },
411
411
  parseMarkdown: {
412
412
  match: ({ type: n }) => n === "code",
413
- runner: (n, s, a) => {
414
- const o = s.lang, l = s.value;
415
- n.openNode(a, { language: o }), l && n.addText(l), n.closeNode();
413
+ runner: (n, o, a) => {
414
+ const s = o.lang, l = o.value;
415
+ n.openNode(a, { language: s }), l && n.addText(l), n.closeNode();
416
416
  }
417
417
  },
418
418
  toMarkdown: {
419
419
  match: (n) => n.type.name === V,
420
- runner: (n, s) => {
420
+ runner: (n, o) => {
421
421
  var a;
422
- n.addNode("code", void 0, ((a = s.content.firstChild) == null ? void 0 : a.text) || "", {
423
- lang: s.attrs.language
422
+ n.addNode("code", void 0, ((a = o.content.firstChild) == null ? void 0 : a.text) || "", {
423
+ lang: o.attrs.language
424
424
  });
425
425
  }
426
426
  }
427
427
  }),
428
428
  inputRules: (r) => [
429
429
  G(Xe, r, (n) => {
430
- const [s, a] = n;
431
- if (!!s)
430
+ const [o, a] = n;
431
+ if (!!o)
432
432
  return { language: a };
433
433
  }),
434
434
  G(Ye, r, (n) => {
435
- const [s, a] = n;
436
- if (!!s)
435
+ const [o, a] = n;
436
+ if (!!o)
437
437
  return { language: a };
438
438
  })
439
439
  ],
@@ -441,40 +441,40 @@ const k = {
441
441
  shortcuts: {
442
442
  [k.CodeFence]: h(re, "Mod-Alt-c")
443
443
  },
444
- view: () => (r, n, s) => {
444
+ view: () => (r, n, o) => {
445
445
  let a = r;
446
- const o = (p) => {
447
- const { tr: N } = n.state;
448
- n.dispatch(N.setNodeMarkup(s(), void 0, {
446
+ const s = (p) => {
447
+ const { tr: b } = n.state;
448
+ n.dispatch(b.setNodeMarkup(o(), void 0, {
449
449
  fold: !0,
450
450
  language: p
451
451
  }));
452
452
  }, l = () => {
453
453
  const { tr: p } = n.state;
454
- n.dispatch(p.setNodeMarkup(s(), void 0, {
454
+ n.dispatch(p.setNodeMarkup(o(), void 0, {
455
455
  ...a.attrs,
456
456
  fold: !0
457
457
  }));
458
458
  }, i = () => {
459
459
  const { tr: p } = n.state;
460
- n.dispatch(p.setNodeMarkup(s(), void 0, {
460
+ n.dispatch(p.setNodeMarkup(o(), void 0, {
461
461
  ...a.attrs,
462
462
  fold: !1
463
463
  }));
464
- }, d = c.themeManager.get("code-fence", {
464
+ }, u = c.themeManager.get("code-fence", {
465
465
  onBlur: l,
466
466
  onFocus: i,
467
- onSelectLanguage: o,
467
+ onSelectLanguage: s,
468
468
  editable: () => n.editable,
469
469
  languageList: t
470
470
  });
471
- if (!d)
471
+ if (!u)
472
472
  return {};
473
- const { dom: m, contentDOM: g, onUpdate: u, onDestroy: f } = d;
474
- return u(a), {
475
- dom: m,
476
- contentDOM: g,
477
- update: (p) => p.type.name !== V ? !1 : (a = p, u(a), !0),
473
+ const { dom: g, contentDOM: d, onUpdate: m, onDestroy: f } = u;
474
+ return m(a), {
475
+ dom: g,
476
+ contentDOM: d,
477
+ update: (p) => p.type.name !== V ? !1 : (a = p, m(a), !0),
478
478
  destroy: f
479
479
  };
480
480
  }
@@ -496,139 +496,157 @@ const k = {
496
496
  }
497
497
  }
498
498
  })
499
- })), ne = I("InsertHardbreak"), tt = w((c) => ({
500
- id: "hardbreak",
501
- schema: () => ({
502
- inline: !0,
503
- group: "inline",
504
- selectable: !1,
505
- parseDOM: [{ tag: "br" }],
506
- toDOM: (e) => ["br", { class: c.getClassName(e.attrs, "hardbreak") }],
507
- parseMarkdown: {
508
- match: ({ type: e }) => e === "break",
509
- runner: (e, t, r) => {
510
- e.addNode(r);
499
+ })), ne = I("InsertHardbreak"), tt = new T("MILKDOWN_HARDBREAK_FILTER"), rt = w((c, e) => {
500
+ var r;
501
+ const t = (r = e == null ? void 0 : e.notIn) != null ? r : ["table", "fence"];
502
+ return {
503
+ id: "hardbreak",
504
+ schema: () => ({
505
+ inline: !0,
506
+ group: "inline",
507
+ selectable: !1,
508
+ parseDOM: [{ tag: "br" }],
509
+ toDOM: (n) => ["br", { class: c.getClassName(n.attrs, "hardbreak") }],
510
+ parseMarkdown: {
511
+ match: ({ type: n }) => n === "break",
512
+ runner: (n, o, a) => {
513
+ n.addNode(a);
514
+ }
515
+ },
516
+ toMarkdown: {
517
+ match: (n) => n.type.name === "hardbreak",
518
+ runner: (n) => {
519
+ n.addNode("break");
520
+ }
511
521
  }
522
+ }),
523
+ commands: (n) => [
524
+ M(ne, () => (o, a) => {
525
+ var i;
526
+ const { selection: s, tr: l } = o;
527
+ if (s.empty) {
528
+ const u = s.$from.node();
529
+ if (u.childCount > 0 && ((i = u.lastChild) == null ? void 0 : i.type.name) === "hardbreak")
530
+ return a == null || a(l.replaceRangeWith(s.to - 1, s.to, o.schema.node("paragraph")).setSelection(Le.near(l.doc.resolve(s.to))).scrollIntoView()), !0;
531
+ }
532
+ return a == null || a(l.setMeta("hardbreak", !0).replaceSelectionWith(n.create()).scrollIntoView()), !0;
533
+ })
534
+ ],
535
+ shortcuts: {
536
+ [k.HardBreak]: h(ne, "Shift-Enter")
512
537
  },
513
- toMarkdown: {
514
- match: (e) => e.type.name === "hardbreak",
515
- runner: (e) => {
516
- e.addNode("break");
517
- }
518
- }
519
- }),
520
- commands: (e) => [
521
- M(ne, () => (t, r) => {
522
- var a;
523
- const { selection: n, tr: s } = t;
524
- if (n.empty) {
525
- const o = n.$from.node();
526
- if (o.childCount > 0 && ((a = o.lastChild) == null ? void 0 : a.type.name) === "hardbreak")
527
- return r == null || r(s.replaceRangeWith(n.to - 1, n.to, t.schema.node("paragraph")).setSelection(Le.near(s.doc.resolve(n.to))).scrollIntoView()), !0;
528
- }
529
- return r == null || r(s.setMeta("hardbreak", !0).replaceSelectionWith(e.create()).scrollIntoView()), !0;
530
- })
531
- ],
532
- shortcuts: {
533
- [k.HardBreak]: h(ne, "Shift-Enter")
534
- },
535
- prosePlugins: (e) => [
536
- new T({
537
- key: new H("MILKDOWN_HARDBREAK_MARKS"),
538
- appendTransaction: (t, r, n) => {
539
- if (!t.length)
540
- return;
541
- const [s] = t;
542
- if (!s)
543
- return;
544
- const [a] = s.steps;
545
- if (s.getMeta("hardbreak")) {
546
- if (!(a instanceof $e))
547
- return;
548
- const { from: i } = a;
549
- return n.tr.setNodeMarkup(i, e, void 0, []);
538
+ prosePlugins: (n) => [
539
+ new H({
540
+ key: tt,
541
+ filterTransaction: (o, a) => {
542
+ const s = o.getMeta("hardbreak"), [l] = o.steps;
543
+ if (s && l) {
544
+ const { from: i } = l, u = a.doc.resolve(i);
545
+ let g = u.depth, d = !0;
546
+ for (; g > 0; )
547
+ t.includes(u.node(g).type.name) && (d = !1), g--;
548
+ return d;
549
+ }
550
+ return !0;
550
551
  }
551
- if (a instanceof Se) {
552
- let i = n.tr;
553
- const { from: d, to: m } = a;
554
- return n.doc.nodesBetween(d, m, (g, u) => {
555
- g.type === e && (i = i.setNodeMarkup(u, e, void 0, []));
556
- }), i;
552
+ }),
553
+ new H({
554
+ key: new T("MILKDOWN_HARDBREAK_MARKS"),
555
+ appendTransaction: (o, a, s) => {
556
+ if (!o.length)
557
+ return;
558
+ const [l] = o;
559
+ if (!l)
560
+ return;
561
+ const [i] = l.steps;
562
+ if (l.getMeta("hardbreak")) {
563
+ if (!(i instanceof $e))
564
+ return;
565
+ const { from: d } = i;
566
+ return s.tr.setNodeMarkup(d, n, void 0, []);
567
+ }
568
+ if (i instanceof Se) {
569
+ let d = s.tr;
570
+ const { from: m, to: f } = i;
571
+ return s.doc.nodesBetween(m, f, (p, b) => {
572
+ p.type === n && (d = d.setNodeMarkup(b, n, void 0, []));
573
+ }), d;
574
+ }
557
575
  }
558
- }
559
- })
560
- ]
561
- })), ke = Array(6).fill(0).map((c, e) => e + 1), C = I("TurnIntoHeading"), Me = I("DowngradeHeading"), j = new H("MILKDOWN_HEADING_ID"), rt = new H("MILKDOWN_HEADING_HASH"), nt = (c) => c.textContent.replace(/[\p{P}\p{S}]/gu, "").replace(/\s/g, "-").toLowerCase().trim(), st = (c, e, t) => {
576
+ })
577
+ ]
578
+ };
579
+ }), ke = Array(6).fill(0).map((c, e) => e + 1), C = I("TurnIntoHeading"), Me = I("DowngradeHeading"), j = new T("MILKDOWN_HEADING_ID"), nt = new T("MILKDOWN_HEADING_HASH"), st = (c) => c.textContent.replace(/[\p{P}\p{S}]/gu, "").replace(/\s/g, "-").toLowerCase().trim(), ot = (c, e, t) => {
562
580
  let r = !1;
563
- const n = (s, a) => {
564
- const o = s.tr;
565
- s.doc.descendants((l, i) => {
581
+ const n = (o, a) => {
582
+ const s = o.tr;
583
+ o.doc.descendants((l, i) => {
566
584
  if (l.type === e && !r) {
567
585
  if (l.textContent.trim().length === 0)
568
586
  return;
569
- const d = l.attrs, m = t(l);
570
- d.id !== m && o.setMeta(j, !0).setNodeMarkup(i, void 0, {
571
- ...d,
572
- id: m
587
+ const u = l.attrs, g = t(l);
588
+ u.id !== g && s.setMeta(j, !0).setNodeMarkup(i, void 0, {
589
+ ...u,
590
+ id: g
573
591
  });
574
592
  }
575
- }), a(o);
593
+ }), a(s);
576
594
  };
577
- return new T({
595
+ return new H({
578
596
  key: j,
579
597
  props: {
580
598
  handleDOMEvents: {
581
599
  compositionstart: () => (r = !0, !1),
582
600
  compositionend: () => {
583
601
  r = !1;
584
- const s = c.get(R);
602
+ const o = c.get(B);
585
603
  return setTimeout(() => {
586
- n(s.state, (a) => s.dispatch(a));
604
+ n(o.state, (a) => o.dispatch(a));
587
605
  }, 0), !1;
588
606
  }
589
607
  }
590
608
  },
591
- appendTransaction: (s, a, o) => {
609
+ appendTransaction: (o, a, s) => {
592
610
  let l = null;
593
- return s.every((i) => !i.getMeta(j)) && s.some((i) => i.docChanged) && n(o, (i) => {
611
+ return o.every((i) => !i.getMeta(j)) && o.some((i) => i.docChanged) && n(s, (i) => {
594
612
  l = i;
595
613
  }), l;
596
614
  },
597
- view: (s) => {
598
- const a = s.state.doc;
599
- let o = s.state.tr;
615
+ view: (o) => {
616
+ const a = o.state.doc;
617
+ let s = o.state.tr;
600
618
  return a.descendants((l, i) => {
601
- l.type.name === "heading" && l.attrs.level && (l.attrs.id || (o = o.setNodeMarkup(i, void 0, {
619
+ l.type.name === "heading" && l.attrs.level && (l.attrs.id || (s = s.setNodeMarkup(i, void 0, {
602
620
  ...l.attrs,
603
621
  id: t(l)
604
622
  })));
605
- }), s.dispatch(o), {};
623
+ }), o.dispatch(s), {};
606
624
  }
607
625
  });
608
- }, ot = (c, e, t) => new T({
609
- key: rt,
626
+ }, at = (c, e, t) => new H({
627
+ key: nt,
610
628
  state: {
611
629
  init: () => O.empty,
612
630
  apply: (r) => {
613
- const n = c.get(R);
631
+ const n = c.get(B);
614
632
  if (!n.hasFocus || !n.editable)
615
633
  return O.empty;
616
- const { $from: s } = r.selection, a = s.node();
634
+ const { $from: o } = r.selection, a = o.node();
617
635
  if (a.type !== e)
618
636
  return O.empty;
619
- const o = a.attrs.level, l = (m) => Array(m).fill(0).map((g) => "#").join(""), i = document.createElement("span");
620
- i.textContent = l(o), i.contentEditable = "false", t.themeManager.onFlush(() => {
621
- const m = t.getStyle(({ css: g }) => {
622
- const u = Te(t.themeManager);
623
- return g`
637
+ const s = a.attrs.level, l = (g) => Array(g).fill(0).map((d) => "#").join(""), i = document.createElement("span");
638
+ i.textContent = l(s), i.contentEditable = "false", t.themeManager.onFlush(() => {
639
+ const g = t.getStyle(({ css: d }) => {
640
+ const m = Te(t.themeManager);
641
+ return d`
624
642
  margin-right: 4px;
625
- color: ${u("primary")};
643
+ color: ${m("primary")};
626
644
  `;
627
645
  });
628
- m && (i.className = m);
646
+ g && (i.className = g);
629
647
  });
630
- const d = J.widget(s.before() + 1, i, { side: -1 });
631
- return O.create(r.doc, [d]);
648
+ const u = J.widget(o.before() + 1, i, { side: -1 });
649
+ return O.create(r.doc, [u]);
632
650
  }
633
651
  },
634
652
  props: {
@@ -642,9 +660,9 @@ const k = {
642
660
  return this.getState(r);
643
661
  }
644
662
  }
645
- }), at = w((c, e) => {
646
- var s, a;
647
- const t = "heading", r = (s = e == null ? void 0 : e.getId) != null ? s : nt, n = (a = e == null ? void 0 : e.displayHashtag) != null ? a : !0;
663
+ }), lt = w((c, e) => {
664
+ var o, a;
665
+ const t = "heading", r = (o = e == null ? void 0 : e.getId) != null ? o : st, n = (a = e == null ? void 0 : e.displayHashtag) != null ? a : !0;
648
666
  return {
649
667
  id: t,
650
668
  schema: () => ({
@@ -659,67 +677,67 @@ const k = {
659
677
  default: 1
660
678
  }
661
679
  },
662
- parseDOM: ke.map((o) => ({
663
- tag: `h${o}`,
680
+ parseDOM: ke.map((s) => ({
681
+ tag: `h${s}`,
664
682
  getAttrs: (l) => {
665
683
  if (!(l instanceof HTMLElement))
666
684
  throw D(l);
667
- return { level: o, id: l.id };
685
+ return { level: s, id: l.id };
668
686
  }
669
687
  })),
670
- toDOM: (o) => [
671
- `h${o.attrs.level}`,
688
+ toDOM: (s) => [
689
+ `h${s.attrs.level}`,
672
690
  {
673
- id: o.attrs.id || r(o),
674
- class: c.getClassName(o.attrs, `heading h${o.attrs.level}`)
691
+ id: s.attrs.id || r(s),
692
+ class: c.getClassName(s.attrs, `heading h${s.attrs.level}`)
675
693
  },
676
694
  0
677
695
  ],
678
696
  parseMarkdown: {
679
- match: ({ type: o }) => o === t,
680
- runner: (o, l, i) => {
681
- const d = l.depth;
682
- o.openNode(i, { level: d }), o.next(l.children), o.closeNode();
697
+ match: ({ type: s }) => s === t,
698
+ runner: (s, l, i) => {
699
+ const u = l.depth;
700
+ s.openNode(i, { level: u }), s.next(l.children), s.closeNode();
683
701
  }
684
702
  },
685
703
  toMarkdown: {
686
- match: (o) => o.type.name === t,
687
- runner: (o, l) => {
688
- var d;
689
- if (o.openNode("heading", void 0, { depth: l.attrs.level }), l.childCount >= 1 && ((d = l.lastChild) == null ? void 0 : d.type.name) === "hardbreak") {
690
- const m = [];
691
- l.content.forEach((g, u, f) => {
692
- f !== l.childCount - 1 && m.push(g);
693
- }), o.next(ge.fromArray(m));
704
+ match: (s) => s.type.name === t,
705
+ runner: (s, l) => {
706
+ var u;
707
+ if (s.openNode("heading", void 0, { depth: l.attrs.level }), l.childCount >= 1 && ((u = l.lastChild) == null ? void 0 : u.type.name) === "hardbreak") {
708
+ const g = [];
709
+ l.content.forEach((d, m, f) => {
710
+ f !== l.childCount - 1 && g.push(d);
711
+ }), s.next(ge.fromArray(g));
694
712
  } else
695
- o.next(l.content);
696
- o.closeNode();
713
+ s.next(l.content);
714
+ s.closeNode();
697
715
  }
698
716
  }
699
717
  }),
700
- inputRules: (o, l) => ke.map((i) => G(new RegExp(`^(#{1,${i}})\\s$`), o, () => {
701
- const d = l.get(R), { $from: m } = d.state.selection, g = m.node();
702
- if (g.type.name === "heading") {
703
- let u = Number(g.attrs.level) + Number(i);
704
- return u > 6 && (u = 6), {
705
- level: u
718
+ inputRules: (s, l) => ke.map((i) => G(new RegExp(`^(#{1,${i}})\\s$`), s, () => {
719
+ const u = l.get(B), { $from: g } = u.state.selection, d = g.node();
720
+ if (d.type.name === "heading") {
721
+ let m = Number(d.attrs.level) + Number(i);
722
+ return m > 6 && (m = 6), {
723
+ level: m
706
724
  };
707
725
  }
708
726
  return {
709
727
  level: i
710
728
  };
711
729
  })),
712
- commands: (o, l) => [
713
- M(C, (i = 1) => i < 1 ? E(i === 0 && l.get(A).nodes.paragraph || o) : E(i === 0 && l.get(A).nodes.paragraph || o, { level: i })),
714
- M(Me, () => (i, d, m) => {
715
- const { $from: g } = i.selection, u = g.node();
716
- if (u.type !== o || !i.selection.empty || g.parentOffset !== 0)
730
+ commands: (s, l) => [
731
+ M(C, (i = 1) => i < 1 ? E(i === 0 && l.get(A).nodes.paragraph || s) : E(i === 0 && l.get(A).nodes.paragraph || s, { level: i })),
732
+ M(Me, () => (i, u, g) => {
733
+ const { $from: d } = i.selection, m = d.node();
734
+ if (m.type !== s || !i.selection.empty || d.parentOffset !== 0)
717
735
  return !1;
718
- const f = u.attrs.level - 1;
719
- return f ? (d == null || d(i.tr.setNodeMarkup(i.selection.$from.before(), void 0, {
720
- ...u.attrs,
736
+ const f = m.attrs.level - 1;
737
+ return f ? (u == null || u(i.tr.setNodeMarkup(i.selection.$from.before(), void 0, {
738
+ ...m.attrs,
721
739
  level: f
722
- })), !0) : E(l.get(A).nodes.paragraph || o)(i, d, m);
740
+ })), !0) : E(l.get(A).nodes.paragraph || s)(i, u, g);
723
741
  })
724
742
  ],
725
743
  shortcuts: {
@@ -731,12 +749,12 @@ const k = {
731
749
  [k.H6]: h(C, "Mod-Alt-6", 6),
732
750
  [k.DowngradeHeading]: h(Me, ["Backspace", "Delete"])
733
751
  },
734
- prosePlugins: (o, l) => {
735
- const i = [st(l, o, r)];
736
- return n && i.push(ot(l, o, c)), i;
752
+ prosePlugins: (s, l) => {
753
+ const i = [ot(l, s, r)];
754
+ return n && i.push(at(l, s, c)), i;
737
755
  }
738
756
  };
739
- }), z = "hr", Ce = I("InsertHr"), lt = w((c) => ({
757
+ }), z = "hr", Ce = I("InsertHr"), ct = w((c) => ({
740
758
  id: z,
741
759
  schema: () => ({
742
760
  group: "block",
@@ -756,23 +774,23 @@ const k = {
756
774
  }
757
775
  }),
758
776
  inputRules: (e) => [
759
- new me(/^(?:---|___\s|\*\*\*\s)$/, (t, r, n, s) => {
777
+ new me(/^(?:---|___\s|\*\*\*\s)$/, (t, r, n, o) => {
760
778
  const { tr: a } = t;
761
- return r[0] && a.replaceWith(n - 1, s, e.create()), a;
779
+ return r[0] && a.replaceWith(n - 1, o, e.create()), a;
762
780
  })
763
781
  ],
764
782
  commands: (e, t) => [
765
783
  M(Ce, () => (r, n) => {
766
784
  if (!n)
767
785
  return !0;
768
- const s = t.get(A).node("paragraph"), { tr: a, selection: o } = r, { from: l } = o, i = e.create();
786
+ const o = t.get(A).node("paragraph"), { tr: a, selection: s } = r, { from: l } = s, i = e.create();
769
787
  if (!i)
770
788
  return !0;
771
- const d = a.replaceSelectionWith(i).insert(l, s), m = Le.findFrom(d.doc.resolve(l), 1, !0);
772
- return m && n(d.setSelection(m).scrollIntoView()), !0;
789
+ const u = a.replaceSelectionWith(i).insert(l, o), g = Le.findFrom(u.doc.resolve(l), 1, !0);
790
+ return g && n(u.setSelection(g).scrollIntoView()), !0;
773
791
  })
774
792
  ]
775
- })), se = I("ModifyImage"), De = I("InsertImage"), S = "image", ct = new H("MILKDOWN_IMAGE_INPUT"), it = w((c, e) => ({
793
+ })), se = I("ModifyImage"), De = I("InsertImage"), S = "image", it = new T("MILKDOWN_IMAGE_INPUT"), ut = w((c, e) => ({
776
794
  id: "image",
777
795
  schema: () => ({
778
796
  inline: !0,
@@ -813,11 +831,11 @@ const k = {
813
831
  parseMarkdown: {
814
832
  match: ({ type: t }) => t === S,
815
833
  runner: (t, r, n) => {
816
- const s = r.url, a = r.alt, o = r.title;
834
+ const o = r.url, a = r.alt, s = r.title;
817
835
  t.addNode(n, {
818
- src: s,
836
+ src: o,
819
837
  alt: a,
820
- title: o
838
+ title: s
821
839
  });
822
840
  }
823
841
  },
@@ -833,111 +851,111 @@ const k = {
833
851
  }
834
852
  }),
835
853
  commands: (t) => [
836
- M(De, (r = "") => (n, s) => {
837
- if (!s)
838
- return !0;
839
- const { tr: a } = n, o = t.create({ src: r });
854
+ M(De, (r = "") => (n, o) => {
840
855
  if (!o)
841
856
  return !0;
842
- const l = a.replaceSelectionWith(o);
843
- return s(l.scrollIntoView()), !0;
857
+ const { tr: a } = n, s = t.create({ src: r });
858
+ if (!s)
859
+ return !0;
860
+ const l = a.replaceSelectionWith(s);
861
+ return o(l.scrollIntoView()), !0;
844
862
  }),
845
- M(se, (r = "") => (n, s) => {
863
+ M(se, (r = "") => (n, o) => {
846
864
  const a = K(n.selection, t);
847
865
  if (!a)
848
866
  return !1;
849
- const { tr: o } = n;
850
- return s == null || s(o.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, loading: !0, src: r }).scrollIntoView()), !0;
867
+ const { tr: s } = n;
868
+ return o == null || o(s.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, loading: !0, src: r }).scrollIntoView()), !0;
851
869
  })
852
870
  ],
853
871
  inputRules: (t) => [
854
- new me(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/, (r, n, s, a) => {
855
- const [o, l, i = "", d] = n, { tr: m } = r;
856
- return o && m.replaceWith(s, a, t.create({ src: i, alt: l, title: d })), m;
872
+ new me(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/, (r, n, o, a) => {
873
+ const [s, l, i = "", u] = n, { tr: g } = r;
874
+ return s && g.replaceWith(o, a, t.create({ src: i, alt: l, title: u })), g;
857
875
  })
858
876
  ],
859
877
  view: () => (t) => {
860
- var i, d;
878
+ var i, u;
861
879
  let r = t;
862
- const n = (i = e == null ? void 0 : e.placeholder) != null ? i : "Add an Image", s = (d = e == null ? void 0 : e.isBlock) != null ? d : !1, a = c.themeManager.get("image", {
880
+ const n = (i = e == null ? void 0 : e.placeholder) != null ? i : "Add an Image", o = (u = e == null ? void 0 : e.isBlock) != null ? u : !1, a = c.themeManager.get("image", {
863
881
  placeholder: n,
864
- isBlock: s
882
+ isBlock: o
865
883
  });
866
884
  if (!a)
867
885
  return {};
868
- const { dom: o, onUpdate: l } = a;
886
+ const { dom: s, onUpdate: l } = a;
869
887
  return l(r), {
870
- dom: o,
871
- update: (m) => m.type.name !== S ? !1 : (r = m, l(r), !0),
888
+ dom: s,
889
+ update: (g) => g.type.name !== S ? !1 : (r = g, l(r), !0),
872
890
  selectNode: () => {
873
- o.classList.add("ProseMirror-selectednode");
891
+ s.classList.add("ProseMirror-selectednode");
874
892
  },
875
893
  deselectNode: () => {
876
- o.classList.remove("ProseMirror-selectednode");
894
+ s.classList.remove("ProseMirror-selectednode");
877
895
  }
878
896
  };
879
897
  },
880
898
  prosePlugins: (t, r) => [
881
- new T({
882
- key: ct,
899
+ new H({
900
+ key: it,
883
901
  view: (n) => {
884
- var i, d, m;
885
- const s = c.themeManager.get("input-chip", {
886
- placeholder: (d = (i = e == null ? void 0 : e.input) == null ? void 0 : i.placeholder) != null ? d : "Input Image Link",
887
- buttonText: (m = e == null ? void 0 : e.input) == null ? void 0 : m.buttonText,
888
- onUpdate: (g) => {
889
- r.get(we).call(se, g);
902
+ var i, u, g;
903
+ const o = c.themeManager.get("input-chip", {
904
+ placeholder: (u = (i = e == null ? void 0 : e.input) == null ? void 0 : i.placeholder) != null ? u : "Input Image Link",
905
+ buttonText: (g = e == null ? void 0 : e.input) == null ? void 0 : g.buttonText,
906
+ onUpdate: (d) => {
907
+ r.get(we).call(se, d);
890
908
  }
891
909
  });
892
- if (!s)
910
+ if (!o)
893
911
  return {};
894
- const a = (g) => Boolean(g.hasFocus() && t && K(g.state.selection, t)), o = (g) => {
895
- const u = K(g.state.selection, t);
896
- return u ? u.node.attrs.src : void 0;
897
- }, l = (g) => {
898
- if (!g.editable)
912
+ const a = (d) => Boolean(d.hasFocus() && t && K(d.state.selection, t)), s = (d) => {
913
+ const m = K(d.state.selection, t);
914
+ return m ? m.node.attrs.src : void 0;
915
+ }, l = (d) => {
916
+ if (!d.editable)
899
917
  return;
900
- a(g) ? (s.show(g), s.update(o(g))) : s.hide();
918
+ a(d) ? (o.show(d), o.update(s(d))) : o.hide();
901
919
  };
902
- return s.init(n), l(n), {
903
- update: (g, u) => {
904
- (u == null ? void 0 : u.doc.eq(g.state.doc)) && u.selection.eq(g.state.selection) || l(g);
920
+ return o.init(n), l(n), {
921
+ update: (d, m) => {
922
+ (m == null ? void 0 : m.doc.eq(d.state.doc)) && m.selection.eq(d.state.selection) || l(d);
905
923
  },
906
924
  destroy: () => {
907
- s.destroy();
925
+ o.destroy();
908
926
  }
909
927
  };
910
928
  }
911
929
  })
912
930
  ]
913
- })), Ie = "list_item", oe = I("SplitListItem"), ae = I("SinkListItem"), le = I("LiftListItem"), ut = new H("MILKDOWN_KEEP_LIST_ORDER"), dt = (c) => {
931
+ })), Ie = "list_item", oe = I("SplitListItem"), ae = I("SinkListItem"), le = I("LiftListItem"), dt = new T("MILKDOWN_KEEP_LIST_ORDER"), mt = (c) => {
914
932
  const e = (t, r) => {
915
933
  const n = Ee("ordered_list", t.schema);
916
- let s = t.tr;
917
- t.doc.descendants((a, o, l, i) => {
934
+ let o = t.tr;
935
+ t.doc.descendants((a, s, l, i) => {
918
936
  if (a.type === c && (l == null ? void 0 : l.type) === n) {
919
- let d = !1;
920
- const m = { ...a.attrs };
921
- a.attrs.listType !== "ordered" && (m.listType = "ordered", d = !0);
922
- const g = l == null ? void 0 : l.maybeChild(i - 1);
923
- if (g && g.type === c && g.attrs.listType === "ordered") {
924
- const u = g.attrs.label;
925
- m.label = `${Number(u.slice(0, -1)) + 1}.`, d = !0;
937
+ let u = !1;
938
+ const g = { ...a.attrs };
939
+ a.attrs.listType !== "ordered" && (g.listType = "ordered", u = !0);
940
+ const d = l == null ? void 0 : l.maybeChild(i - 1);
941
+ if (d && d.type === c && d.attrs.listType === "ordered") {
942
+ const m = d.attrs.label;
943
+ g.label = `${Number(m.slice(0, -1)) + 1}.`, u = !0;
926
944
  }
927
- a.attrs.label === "\u2022" && (m.label = `${i + 1}.`, d = !0), d && (s = s.setNodeMarkup(o, void 0, m));
945
+ a.attrs.label === "\u2022" && (g.label = `${i + 1}.`, u = !0), u && (o = o.setNodeMarkup(s, void 0, g));
928
946
  }
929
- }), r(s);
947
+ }), r(o);
930
948
  };
931
- return new T({
932
- key: ut,
949
+ return new H({
950
+ key: dt,
933
951
  appendTransaction: (t, r, n) => {
934
- let s = null;
952
+ let o = null;
935
953
  return t.some((a) => a.docChanged) && e(n, (a) => {
936
- s = a;
937
- }), s;
954
+ o = a;
955
+ }), o;
938
956
  }
939
957
  });
940
- }, mt = w((c) => ({
958
+ }, gt = w((c) => ({
941
959
  id: Ie,
942
960
  schema: () => ({
943
961
  group: "listItem",
@@ -979,8 +997,8 @@ const k = {
979
997
  parseMarkdown: {
980
998
  match: ({ type: e, checked: t }) => e === "listItem" && t === null,
981
999
  runner: (e, t, r) => {
982
- const n = t.label != null ? `${t.label}.` : "\u2022", s = t.label != null ? "ordered" : "bullet";
983
- e.openNode(r, { label: n, listType: s }), e.next(t.children), e.closeNode();
1000
+ const n = t.label != null ? `${t.label}.` : "\u2022", o = t.label != null ? "ordered" : "bullet";
1001
+ e.openNode(r, { label: n, listType: o }), e.next(t.children), e.closeNode();
984
1002
  }
985
1003
  },
986
1004
  toMarkdown: {
@@ -992,8 +1010,8 @@ const k = {
992
1010
  }),
993
1011
  inputRules: (e) => [W(/^\s*([-+*])\s$/, e)],
994
1012
  commands: (e) => [
995
- M(oe, () => Be(e)),
996
- M(ae, () => Re(e)),
1013
+ M(oe, () => Re(e)),
1014
+ M(ae, () => Be(e)),
997
1015
  M(le, () => Pe(e))
998
1016
  ],
999
1017
  shortcuts: {
@@ -1001,8 +1019,8 @@ const k = {
1001
1019
  [k.SinkListItem]: h(ae, "Mod-]"),
1002
1020
  [k.LiftListItem]: h(le, "Mod-[")
1003
1021
  },
1004
- prosePlugins: (e) => [dt(e)]
1005
- })), ce = I("WrapInOrderedList"), be = "ordered_list", gt = w((c) => ({
1022
+ prosePlugins: (e) => [mt(e)]
1023
+ })), ce = I("WrapInOrderedList"), be = "ordered_list", ft = w((c) => ({
1006
1024
  id: be,
1007
1025
  schema: () => ({
1008
1026
  content: "listItem+",
@@ -1050,7 +1068,7 @@ const k = {
1050
1068
  shortcuts: {
1051
1069
  [k.OrderedList]: h(ce, "Mod-Alt-7")
1052
1070
  }
1053
- })), ie = I("TurnIntoText"), ye = "paragraph", ft = w((c) => ({
1071
+ })), ie = I("TurnIntoText"), ye = "paragraph", pt = w((c) => ({
1054
1072
  id: ye,
1055
1073
  schema: () => ({
1056
1074
  content: "inline*",
@@ -1068,10 +1086,10 @@ const k = {
1068
1086
  runner: (e, t) => {
1069
1087
  var n;
1070
1088
  if (e.openNode("paragraph"), t.childCount >= 1 && ((n = t.lastChild) == null ? void 0 : n.type.name) === "hardbreak") {
1071
- const s = [];
1072
- t.content.forEach((a, o, l) => {
1073
- l !== t.childCount - 1 && s.push(a);
1074
- }), e.next(ge.fromArray(s));
1089
+ const o = [];
1090
+ t.content.forEach((a, s, l) => {
1091
+ l !== t.childCount - 1 && o.push(a);
1092
+ }), e.next(ge.fromArray(o));
1075
1093
  } else
1076
1094
  e.next(t.content);
1077
1095
  e.closeNode();
@@ -1082,7 +1100,7 @@ const k = {
1082
1100
  shortcuts: {
1083
1101
  [k.Text]: h(ie, "Mod-Alt-0")
1084
1102
  }
1085
- })), pt = w(() => ({
1103
+ })), ht = w(() => ({
1086
1104
  id: "text",
1087
1105
  schema: () => ({
1088
1106
  group: "inline",
@@ -1099,62 +1117,62 @@ const k = {
1099
1117
  }
1100
1118
  }
1101
1119
  })
1102
- })), ht = [
1120
+ })), kt = [
1103
1121
  et(),
1104
- ft(),
1105
- tt(),
1122
+ pt(),
1123
+ rt(),
1106
1124
  Ge(),
1107
1125
  Ze(),
1108
1126
  Je(),
1127
+ ft(),
1109
1128
  gt(),
1110
- mt(),
1111
- at(),
1112
1129
  lt(),
1113
- it(),
1114
- pt()
1115
- ], kt = () => {
1130
+ ct(),
1131
+ ut(),
1132
+ ht()
1133
+ ], Mt = () => {
1116
1134
  function c(e) {
1117
1135
  qe(e, "list", (t) => {
1118
1136
  var r;
1119
1137
  if (t.ordered) {
1120
1138
  const n = (r = t.start) != null ? r : 1;
1121
- t.children.forEach((s, a) => {
1122
- s.label = a + n;
1139
+ t.children.forEach((o, a) => {
1140
+ o.label = a + n;
1123
1141
  });
1124
1142
  return;
1125
1143
  }
1126
1144
  });
1127
1145
  }
1128
1146
  return c;
1129
- }, Mt = (c) => !!c.children, It = (c) => c.type === "html";
1130
- function bt(c, e) {
1147
+ }, It = (c) => !!c.children, bt = (c) => c.type === "html";
1148
+ function yt(c, e) {
1131
1149
  return t(c, 0, null)[0];
1132
- function t(r, n, s) {
1133
- if (Mt(r)) {
1150
+ function t(r, n, o) {
1151
+ if (It(r)) {
1134
1152
  const a = [];
1135
- for (let o = 0, l = r.children.length; o < l; o++) {
1136
- const i = r.children[o];
1153
+ for (let s = 0, l = r.children.length; s < l; s++) {
1154
+ const i = r.children[s];
1137
1155
  if (i) {
1138
- const d = t(i, o, r);
1139
- if (d)
1140
- for (let m = 0, g = d.length; m < g; m++) {
1141
- const u = d[m];
1142
- u && a.push(u);
1156
+ const u = t(i, s, r);
1157
+ if (u)
1158
+ for (let g = 0, d = u.length; g < d; g++) {
1159
+ const m = u[g];
1160
+ m && a.push(m);
1143
1161
  }
1144
1162
  }
1145
1163
  }
1146
1164
  r.children = a;
1147
1165
  }
1148
- return e(r, n, s);
1166
+ return e(r, n, o);
1149
1167
  }
1150
1168
  }
1151
- const yt = () => {
1169
+ const Nt = () => {
1152
1170
  function c(e) {
1153
- bt(e, (t) => It(t) ? [] : [t]);
1171
+ yt(e, (t) => bt(t) ? [] : [t]);
1154
1172
  }
1155
1173
  return c;
1156
- }, Nt = new H("MILKDOWN_INLINE_NODES_CURSOR"), ue = new T({
1157
- key: Nt,
1174
+ }, wt = new T("MILKDOWN_INLINE_NODES_CURSOR"), ue = new H({
1175
+ key: wt,
1158
1176
  state: {
1159
1177
  init() {
1160
1178
  return !1;
@@ -1178,22 +1196,22 @@ const yt = () => {
1178
1196
  },
1179
1197
  decorations(c) {
1180
1198
  if (ue.getState(c)) {
1181
- const r = c.selection.$from.pos, n = document.createElement("span"), s = J.widget(r, n, {
1199
+ const r = c.selection.$from.pos, n = document.createElement("span"), o = J.widget(r, n, {
1182
1200
  side: -1
1183
- }), a = document.createElement("span"), o = J.widget(r, a);
1201
+ }), a = document.createElement("span"), s = J.widget(r, a);
1184
1202
  return setTimeout(() => {
1185
1203
  n.contentEditable = "true", a.contentEditable = "true";
1186
- }), O.create(c.doc, [s, o]);
1204
+ }), O.create(c.doc, [o, s]);
1187
1205
  }
1188
1206
  return O.empty;
1189
1207
  }
1190
1208
  }
1191
- }), wt = [
1209
+ }), Lt = [
1192
1210
  He(() => ({
1193
1211
  prosePlugins: () => [ue],
1194
- remarkPlugins: () => [We, yt, kt]
1212
+ remarkPlugins: () => [We, Nt, Mt]
1195
1213
  }))()
1196
- ], Lt = Ne.create([...ht, ...ze]), Rt = Ne.create([...wt, ...Lt]), Pt = {
1214
+ ], xt = Ne.create([...kt, ...ze]), Pt = Ne.create([...Lt, ...xt]), Wt = {
1197
1215
  ToggleInlineCode: Q,
1198
1216
  ToggleItalic: X,
1199
1217
  ToggleLink: xe,
@@ -1215,6 +1233,7 @@ const yt = () => {
1215
1233
  };
1216
1234
  export {
1217
1235
  Me as DowngradeHeading,
1236
+ tt as HardbreakFilterPluginKey,
1218
1237
  ne as InsertHardbreak,
1219
1238
  Ce as InsertHr,
1220
1239
  De as InsertImage,
@@ -1239,26 +1258,26 @@ export {
1239
1258
  Je as bulletList,
1240
1259
  Ze as codeFence,
1241
1260
  Ke as codeInline,
1242
- Pt as commands,
1243
- Rt as commonmark,
1244
- Lt as commonmarkNodes,
1245
- wt as commonmarkPlugins,
1261
+ Wt as commands,
1262
+ Pt as commonmark,
1263
+ xt as commonmarkNodes,
1264
+ Lt as commonmarkPlugins,
1246
1265
  et as doc,
1247
1266
  Fe as em,
1248
- tt as hardbreak,
1249
- at as heading,
1250
- rt as headingHashPluginKey,
1267
+ rt as hardbreak,
1268
+ lt as heading,
1269
+ nt as headingHashPluginKey,
1251
1270
  j as headingIdPluginKey,
1252
- lt as hr,
1253
- it as image,
1271
+ ct as hr,
1272
+ ut as image,
1254
1273
  Ve as link,
1255
- mt as listItem,
1274
+ gt as listItem,
1256
1275
  ze as marks,
1257
- ht as nodes,
1258
- gt as orderedList,
1259
- ft as paragraph,
1276
+ kt as nodes,
1277
+ ft as orderedList,
1278
+ pt as paragraph,
1260
1279
  je as strong,
1261
- pt as text,
1280
+ ht as text,
1262
1281
  Ye as tildeInputRegex
1263
1282
  };
1264
1283
  //# sourceMappingURL=index.es.js.map