@milkdown/preset-gfm 7.3.1 → 7.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.es.js CHANGED
@@ -1,29 +1,32 @@
1
1
  import { expectDomTypeError as O } from "@milkdown/exception";
2
- import { paragraphSchema as Y, listItemSchema as Ie } from "@milkdown/preset-commonmark";
3
- import { InputRule as ee } from "@milkdown/prose/inputrules";
4
- import { $markAttr as $e, $markSchema as Pe, $command as g, $useKeymap as te, $nodeSchema as k, $inputRule as oe, $prose as B, $remark as _e } from "@milkdown/utils";
5
- import { commandsCtx as M } from "@milkdown/core";
6
- import { TextSelection as Ee, Selection as ne, PluginKey as De, Plugin as Oe } from "@milkdown/prose/state";
7
- import { TableMap as h, CellSelection as y, tableNodes as Be, goToNextCell as le, isInTable as N, deleteTable as Fe, deleteColumn as Ke, deleteRow as He, addColumnBefore as Le, addColumnAfter as We, selectedRect as re, setCellAttr as Ge, columnResizing as ze, tableEditing as je } from "@milkdown/prose/tables";
8
- import { findParentNode as Ze, cloneTr as A, browser as U } from "@milkdown/prose";
9
- import { toggleMark as Ve } from "@milkdown/prose/commands";
10
- import Ue from "remark-gfm";
11
- const d = (e, t) => (Object.assign(e, {
12
- meta: {
13
- package: "@milkdown/preset-gfm",
14
- ...t
15
- }
16
- }), e), F = $e("strike_through");
17
- d(F, {
2
+ import { paragraphSchema as ee, listItemSchema as $e } from "@milkdown/preset-commonmark";
3
+ import { InputRule as te } from "@milkdown/prose/inputrules";
4
+ import { $markAttr as Pe, $markSchema as _e, $command as h, $inputRule as B, $useKeymap as oe, $nodeSchema as k, $prose as F, $remark as Ee } from "@milkdown/utils";
5
+ import { commandsCtx as A } from "@milkdown/core";
6
+ import { TextSelection as De, Selection as ne, PluginKey as Oe, Plugin as Be } from "@milkdown/prose/state";
7
+ import { TableMap as g, CellSelection as y, tableNodes as Fe, goToNextCell as le, isInTable as N, deleteTable as Ke, deleteColumn as He, deleteRow as Le, addColumnBefore as We, addColumnAfter as Ge, selectedRect as re, setCellAttr as ze, columnResizing as je, tableEditing as Ze } from "@milkdown/prose/tables";
8
+ import { markRule as Ve, findParentNode as Ue, cloneTr as x, browser as X } from "@milkdown/prose";
9
+ import { toggleMark as Xe } from "@milkdown/prose/commands";
10
+ import qe from "remark-gfm";
11
+ function d(e, t) {
12
+ return Object.assign(e, {
13
+ meta: {
14
+ package: "@milkdown/preset-gfm",
15
+ ...t
16
+ }
17
+ }), e;
18
+ }
19
+ const K = Pe("strike_through");
20
+ d(K, {
18
21
  displayName: "Attr<strikethrough>",
19
22
  group: "Strikethrough"
20
23
  });
21
- const x = Pe("strike_through", (e) => ({
24
+ const T = _e("strike_through", (e) => ({
22
25
  parseDOM: [
23
26
  { tag: "del" },
24
27
  { style: "text-decoration", getAttrs: (t) => t === "line-through" }
25
28
  ],
26
- toDOM: (t) => ["del", e.get(F.key)(t)],
29
+ toDOM: (t) => ["del", e.get(K.key)(t)],
27
30
  parseMarkdown: {
28
31
  match: (t) => t.type === "delete",
29
32
  runner: (t, n, o) => {
@@ -37,44 +40,53 @@ const x = Pe("strike_through", (e) => ({
37
40
  }
38
41
  }
39
42
  }));
40
- d(x.mark, {
43
+ d(T.mark, {
41
44
  displayName: "MarkSchema<strikethrough>",
42
45
  group: "Strikethrough"
43
46
  });
44
- d(x.ctx, {
47
+ d(T.ctx, {
45
48
  displayName: "MarkSchemaCtx<strikethrough>",
46
49
  group: "Strikethrough"
47
50
  });
48
- const K = g("ToggleStrikeThrough", (e) => () => Ve(x.type(e)));
49
- d(K, {
51
+ const H = h("ToggleStrikeThrough", (e) => () => Xe(T.type(e)));
52
+ d(H, {
50
53
  displayName: "Command<ToggleStrikethrough>",
51
54
  group: "Strikethrough"
52
55
  });
53
- const H = te("strikeThroughKeymap", {
56
+ const ae = B((e) => Ve(/~([^~]+)~$/, T.type(e)));
57
+ d(ae, {
58
+ displayName: "InputRule<strikethrough>",
59
+ group: "Strikethrough"
60
+ });
61
+ const L = oe("strikeThroughKeymap", {
54
62
  ToggleStrikethrough: {
55
63
  shortcuts: "Mod-Alt-x",
56
64
  command: (e) => {
57
- const t = e.get(M);
58
- return () => t.call(K.key);
65
+ const t = e.get(A);
66
+ return () => t.call(H.key);
59
67
  }
60
68
  }
61
69
  });
62
- d(H.ctx, {
70
+ d(L.ctx, {
63
71
  displayName: "KeymapCtx<strikethrough>",
64
72
  group: "Strikethrough"
65
73
  });
66
- d(H.shortcuts, {
74
+ d(L.shortcuts, {
67
75
  displayName: "Keymap<strikethrough>",
68
76
  group: "Strikethrough"
69
77
  });
70
- const ae = (e, t = 3, n = 3) => {
71
- const o = Array(n).fill(0).map(() => R.type(e).createAndFill()), l = Array(n).fill(0).map(() => I.type(e).createAndFill()), r = Array(t).fill(0).map((s, c) => S.type(e).create(null, c === 0 ? l : o));
72
- return T.type(e).create(null, r);
73
- }, w = (e) => Ze((t) => t.type.spec.tableRole === "table")(e), b = (e, t) => {
78
+ function se(e, t = 3, n = 3) {
79
+ const o = Array(n).fill(0).map(() => M.type(e).createAndFill()), l = Array(n).fill(0).map(() => I.type(e).createAndFill()), r = Array(t).fill(0).map((s, c) => R.type(e).create(null, c === 0 ? l : o));
80
+ return S.type(e).create(null, r);
81
+ }
82
+ function w(e) {
83
+ return Ue((t) => t.type.spec.tableRole === "table")(e);
84
+ }
85
+ function b(e, t) {
74
86
  const n = w(t);
75
87
  if (!n)
76
88
  return;
77
- const o = h.get(n.node);
89
+ const o = g.get(n.node);
78
90
  if (!(e < 0 || e >= o.width))
79
91
  return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {
80
92
  const r = n.node.nodeAt(l);
@@ -87,11 +99,12 @@ const ae = (e, t = 3, n = 3) => {
87
99
  node: r
88
100
  };
89
101
  }).filter((l) => l != null);
90
- }, C = (e, t) => {
102
+ }
103
+ function C(e, t) {
91
104
  const n = w(t);
92
105
  if (!n)
93
106
  return;
94
- const o = h.get(n.node);
107
+ const o = g.get(n.node);
95
108
  if (!(e < 0 || e >= o.height))
96
109
  return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {
97
110
  const r = n.node.nodeAt(l);
@@ -104,11 +117,12 @@ const ae = (e, t = 3, n = 3) => {
104
117
  node: r
105
118
  };
106
119
  }).filter((l) => l != null);
107
- }, Xe = (e) => {
120
+ }
121
+ function Je(e) {
108
122
  const t = w(e);
109
123
  if (!t)
110
124
  return;
111
- const n = h.get(t.node);
125
+ const n = g.get(t.node);
112
126
  return n.cellsInRect({
113
127
  left: 0,
114
128
  right: n.width,
@@ -118,40 +132,48 @@ const ae = (e, t = 3, n = 3) => {
118
132
  const r = t.node.nodeAt(l), s = l + t.start;
119
133
  return { pos: s, start: s + 1, node: r };
120
134
  });
121
- }, qe = (e) => {
122
- const t = Xe(e.selection);
135
+ }
136
+ function Qe(e) {
137
+ const t = Je(e.selection);
123
138
  if (t && t[0]) {
124
139
  const n = e.doc.resolve(t[0].pos), o = t[t.length - 1];
125
140
  if (o) {
126
141
  const l = e.doc.resolve(o.pos);
127
- return A(e.setSelection(new y(l, n)));
142
+ return x(e.setSelection(new y(l, n)));
128
143
  }
129
144
  }
130
145
  return e;
131
- };
132
- function se(e, t, { map: n, tableStart: o, table: l }, r) {
146
+ }
147
+ function ce(e, t, { map: n, tableStart: o, table: l }, r) {
133
148
  const s = Array(r).fill(0).reduce((i, m, a) => i + l.child(a).nodeSize, o), c = Array(n.width).fill(0).map((i, m) => {
134
149
  const a = l.nodeAt(n.map[m]);
135
- return R.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
150
+ return M.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
136
151
  });
137
- return t.insert(s, S.type(e).create(null, c)), t;
152
+ return t.insert(s, R.type(e).create(null, c)), t;
138
153
  }
139
- const ce = (e) => (t) => (n) => {
140
- const o = w(n.selection), l = e === "row";
141
- if (o) {
142
- const r = h.get(o.node);
143
- if (t >= 0 && t < (l ? r.height : r.width)) {
144
- const s = r.positionAt(
145
- l ? t : r.height - 1,
146
- l ? r.width - 1 : t,
147
- o.node
148
- ), c = n.doc.resolve(o.start + s), i = l ? y.rowSelection : y.colSelection, m = r.positionAt(l ? t : 0, l ? 0 : t, o.node), a = n.doc.resolve(o.start + m);
149
- return A(n.setSelection(i(c, a)));
154
+ function ie(e) {
155
+ return (t) => (n) => {
156
+ const o = w(n.selection), l = e === "row";
157
+ if (o) {
158
+ const r = g.get(o.node);
159
+ if (t >= 0 && t < (l ? r.height : r.width)) {
160
+ const s = r.positionAt(
161
+ l ? t : r.height - 1,
162
+ l ? r.width - 1 : t,
163
+ o.node
164
+ ), c = n.doc.resolve(o.start + s), i = l ? y.rowSelection : y.colSelection, m = r.positionAt(l ? t : 0, l ? 0 : t, o.node), a = n.doc.resolve(o.start + m);
165
+ return x(n.setSelection(i(c, a)));
166
+ }
150
167
  }
151
- }
152
- return n;
153
- }, Je = ce("row"), Qe = ce("col"), X = (e) => e[0].map((t, n) => e.map((o) => o[n])), ie = (e, t) => {
154
- const n = [], o = h.get(e);
168
+ return n;
169
+ };
170
+ }
171
+ const Ye = ie("row"), et = ie("col");
172
+ function q(e) {
173
+ return e[0].map((t, n) => e.map((o) => o[n]));
174
+ }
175
+ function de(e, t) {
176
+ const n = [], o = g.get(e);
155
177
  for (let r = 0; r < o.height; r++) {
156
178
  const s = e.child(r), c = [];
157
179
  for (let i = 0; i < o.width; i++) {
@@ -171,8 +193,9 @@ const ce = (e) => (t) => (n) => {
171
193
  n,
172
194
  e.marks
173
195
  );
174
- }, de = (e) => {
175
- const t = h.get(e), n = [];
196
+ }
197
+ function me(e) {
198
+ const t = g.get(e), n = [];
176
199
  for (let o = 0; o < t.height; o++) {
177
200
  const l = [], r = {};
178
201
  for (let s = 0; s < t.width; s++) {
@@ -186,17 +209,21 @@ const ce = (e) => (t) => (n) => {
186
209
  n.push(l);
187
210
  }
188
211
  return n;
189
- }, me = (e, t, n, o) => {
212
+ }
213
+ function ue(e, t, n, o) {
190
214
  const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;
191
215
  let c;
192
216
  return o === -1 && l === 1 ? c = n[0] - 1 : o === 1 && l === -1 ? c = n[n.length - 1] - s + 1 : c = l === -1 ? n[0] : n[n.length - 1] - s, e.splice(c, 0, ...r), e;
193
- }, Ye = (e, t, n, o) => {
194
- let l = X(de(e.node));
195
- return l = me(l, t, n, o), l = X(l), ie(e.node, l);
196
- }, et = (e, t, n, o) => {
197
- let l = de(e.node);
198
- return l = me(l, t, n, o), ie(e.node, l);
199
- }, q = (e, t) => {
217
+ }
218
+ function tt(e, t, n, o) {
219
+ let l = q(me(e.node));
220
+ return l = ue(l, t, n, o), l = q(l), de(e.node, l);
221
+ }
222
+ function ot(e, t, n, o) {
223
+ let l = me(e.node);
224
+ return l = ue(l, t, n, o), de(e.node, l);
225
+ }
226
+ function J(e, t) {
200
227
  let n = e, o = e;
201
228
  for (let a = e; a >= 0; a--) {
202
229
  const u = b(a, t.selection);
@@ -236,7 +263,8 @@ const ce = (e) => (t) => (n) => {
236
263
  }
237
264
  const m = t.doc.resolve(i.pos);
238
265
  return { $anchor: c, $head: m, indexes: l };
239
- }, J = (e, t) => {
266
+ }
267
+ function Q(e, t) {
240
268
  let n = e, o = e;
241
269
  for (let a = e; a >= 0; a--)
242
270
  C(a, t.selection).forEach((p) => {
@@ -270,52 +298,52 @@ const ce = (e) => (t) => (n) => {
270
298
  }
271
299
  const m = t.doc.resolve(i.pos);
272
300
  return { $anchor: c, $head: m, indexes: l };
273
- };
274
- function tt(e, t, n, o = !0) {
301
+ }
302
+ function nt(e, t, n, o = !0) {
275
303
  const l = w(e.selection);
276
304
  if (!l)
277
305
  return e;
278
- const { indexes: r } = q(t, e), { indexes: s } = q(n, e);
306
+ const { indexes: r } = J(t, e), { indexes: s } = J(n, e);
279
307
  if (r.includes(n))
280
308
  return e;
281
- const c = Ye(
309
+ const c = tt(
282
310
  l,
283
311
  r,
284
312
  s,
285
313
  0
286
- ), i = A(e).replaceWith(
314
+ ), i = x(e).replaceWith(
287
315
  l.pos,
288
316
  l.pos + l.node.nodeSize,
289
317
  c
290
318
  );
291
319
  if (!o)
292
320
  return i;
293
- const m = h.get(c), a = l.start, u = n, p = m.positionAt(m.height - 1, u, c), f = i.doc.resolve(a + p), $ = y.colSelection, P = m.positionAt(0, u, c), _ = i.doc.resolve(a + P);
321
+ const m = g.get(c), a = l.start, u = n, p = m.positionAt(m.height - 1, u, c), f = i.doc.resolve(a + p), $ = y.colSelection, P = m.positionAt(0, u, c), _ = i.doc.resolve(a + P);
294
322
  return i.setSelection($(f, _));
295
323
  }
296
- function ot(e, t, n, o = !0) {
324
+ function lt(e, t, n, o = !0) {
297
325
  const l = w(e.selection);
298
326
  if (!l)
299
327
  return e;
300
- const { indexes: r } = J(t, e), { indexes: s } = J(n, e);
328
+ const { indexes: r } = Q(t, e), { indexes: s } = Q(n, e);
301
329
  if (r.includes(n))
302
330
  return e;
303
- const c = et(
331
+ const c = ot(
304
332
  l,
305
333
  r,
306
334
  s,
307
335
  0
308
- ), i = A(e).replaceWith(
336
+ ), i = x(e).replaceWith(
309
337
  l.pos,
310
338
  l.pos + l.node.nodeSize,
311
339
  c
312
340
  );
313
341
  if (!o)
314
342
  return i;
315
- const m = h.get(c), a = l.start, u = n, p = m.positionAt(u, m.width - 1, c), f = i.doc.resolve(a + p), $ = y.rowSelection, P = m.positionAt(u, 0, c), _ = i.doc.resolve(a + P);
343
+ const m = g.get(c), a = l.start, u = n, p = m.positionAt(u, m.width - 1, c), f = i.doc.resolve(a + p), $ = y.rowSelection, P = m.positionAt(u, 0, c), _ = i.doc.resolve(a + P);
316
344
  return i.setSelection($(f, _));
317
345
  }
318
- const v = Be({
346
+ const v = Fe({
319
347
  tableGroup: "block",
320
348
  cellContent: "paragraph",
321
349
  cellAttributes: {
@@ -327,7 +355,7 @@ const v = Be({
327
355
  }
328
356
  }
329
357
  }
330
- }), T = k("table", () => ({
358
+ }), S = k("table", () => ({
331
359
  ...v.table,
332
360
  parseMarkdown: {
333
361
  match: (e) => e.type === "table",
@@ -354,15 +382,15 @@ const v = Be({
354
382
  }
355
383
  }
356
384
  }));
357
- d(T.node, {
385
+ d(S.node, {
358
386
  displayName: "NodeSchema<table>",
359
387
  group: "Table"
360
388
  });
361
- d(T.ctx, {
389
+ d(S.ctx, {
362
390
  displayName: "NodeSchemaCtx<table>",
363
391
  group: "Table"
364
392
  });
365
- const S = k("table_row", () => ({
393
+ const R = k("table_row", () => ({
366
394
  ...v.table_row,
367
395
  parseMarkdown: {
368
396
  match: (e) => e.type === "tableRow",
@@ -382,15 +410,15 @@ const S = k("table_row", () => ({
382
410
  }
383
411
  }
384
412
  }));
385
- d(S.node, {
413
+ d(R.node, {
386
414
  displayName: "NodeSchema<tableRow>",
387
415
  group: "Table"
388
416
  });
389
- d(S.ctx, {
417
+ d(R.ctx, {
390
418
  displayName: "NodeSchemaCtx<tableRow>",
391
419
  group: "Table"
392
420
  });
393
- const R = k("table_cell", () => ({
421
+ const M = k("table_cell", () => ({
394
422
  ...v.table_cell,
395
423
  parseMarkdown: {
396
424
  match: (e) => e.type === "tableCell" && !e.isHeader,
@@ -406,11 +434,11 @@ const R = k("table_cell", () => ({
406
434
  }
407
435
  }
408
436
  }));
409
- d(R.node, {
437
+ d(M.node, {
410
438
  displayName: "NodeSchema<tableCell>",
411
439
  group: "Table"
412
440
  });
413
- d(R.ctx, {
441
+ d(M.ctx, {
414
442
  displayName: "NodeSchemaCtx<tableCell>",
415
443
  group: "Table"
416
444
  });
@@ -438,177 +466,177 @@ d(I.ctx, {
438
466
  displayName: "NodeSchemaCtx<tableHeader>",
439
467
  group: "Table"
440
468
  });
441
- const ue = oe((e) => new ee(
469
+ const pe = B((e) => new te(
442
470
  /^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
443
471
  (t, n, o, l) => {
444
472
  var i, m;
445
473
  const r = t.doc.resolve(o);
446
- if (!r.node(-1).canReplaceWith(r.index(-1), r.indexAfter(-1), T.type(e)))
474
+ if (!r.node(-1).canReplaceWith(r.index(-1), r.indexAfter(-1), S.type(e)))
447
475
  return null;
448
- const s = ae(
476
+ const s = se(
449
477
  e,
450
478
  Number((i = n.groups) == null ? void 0 : i.row),
451
479
  Number((m = n.groups) == null ? void 0 : m.col)
452
480
  ), c = t.tr.replaceRangeWith(o, l, s);
453
- return c.setSelection(Ee.create(c.doc, o + 3)).scrollIntoView();
481
+ return c.setSelection(De.create(c.doc, o + 3)).scrollIntoView();
454
482
  }
455
483
  ));
456
- d(ue, {
484
+ d(pe, {
457
485
  displayName: "InputRule<insertTableInputRule>",
458
486
  group: "Table"
459
487
  });
460
- const L = g("GoToPrevTableCell", () => () => le(-1));
461
- d(L, {
488
+ const W = h("GoToPrevTableCell", () => () => le(-1));
489
+ d(W, {
462
490
  displayName: "Command<goToPrevTableCellCommand>",
463
491
  group: "Table"
464
492
  });
465
- const W = g("GoToNextTableCell", () => () => le(1));
466
- d(W, {
493
+ const G = h("GoToNextTableCell", () => () => le(1));
494
+ d(G, {
467
495
  displayName: "Command<goToNextTableCellCommand>",
468
496
  group: "Table"
469
497
  });
470
- const G = g("BreakTable", (e) => () => (t, n) => {
498
+ const z = h("BreakTable", (e) => () => (t, n) => {
471
499
  if (!N(t))
472
500
  return !1;
473
- const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, Y.type(e).createAndFill());
501
+ const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, ee.type(e).createAndFill());
474
502
  return r.setSelection(ne.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
475
503
  });
476
- d(G, {
504
+ d(z, {
477
505
  displayName: "Command<breakTableCommand>",
478
506
  group: "Table"
479
507
  });
480
- const pe = g("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
481
- const { selection: r, tr: s } = o, { from: c } = r, i = ae(e, t, n), m = s.replaceSelectionWith(i), a = ne.findFrom(m.doc.resolve(c), 1, !0);
508
+ const fe = h("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
509
+ const { selection: r, tr: s } = o, { from: c } = r, i = se(e, t, n), m = s.replaceSelectionWith(i), a = ne.findFrom(m.doc.resolve(c), 1, !0);
482
510
  return a && m.setSelection(a), l == null || l(m), !0;
483
511
  });
484
- d(pe, {
512
+ d(fe, {
485
513
  displayName: "Command<insertTableCommand>",
486
514
  group: "Table"
487
515
  });
488
- const fe = g("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
516
+ const he = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
489
517
  const { tr: l } = n;
490
- return !!(o == null ? void 0 : o(ot(l, e ?? 0, t ?? 0, !0)));
518
+ return !!(o == null ? void 0 : o(lt(l, e ?? 0, t ?? 0, !0)));
491
519
  });
492
- d(fe, {
520
+ d(he, {
493
521
  displayName: "Command<moveRowCommand>",
494
522
  group: "Table"
495
523
  });
496
- const ge = g("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
524
+ const ge = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
497
525
  const { tr: l } = n;
498
- return !!(o == null ? void 0 : o(tt(l, e ?? 0, t ?? 0, !0)));
526
+ return !!(o == null ? void 0 : o(nt(l, e ?? 0, t ?? 0, !0)));
499
527
  });
500
528
  d(ge, {
501
529
  displayName: "Command<moveColCommand>",
502
530
  group: "Table"
503
531
  });
504
- const he = g("SelectRow", () => (e = 0) => (t, n) => {
532
+ const be = h("SelectRow", () => (e = 0) => (t, n) => {
505
533
  const { tr: o } = t;
506
- return !!(n == null ? void 0 : n(Je(e)(o)));
534
+ return !!(n == null ? void 0 : n(Ye(e)(o)));
507
535
  });
508
- d(he, {
536
+ d(be, {
509
537
  displayName: "Command<selectRowCommand>",
510
538
  group: "Table"
511
539
  });
512
- const be = g("SelectCol", () => (e = 0) => (t, n) => {
540
+ const Ce = h("SelectCol", () => (e = 0) => (t, n) => {
513
541
  const { tr: o } = t;
514
- return !!(n == null ? void 0 : n(Qe(e)(o)));
542
+ return !!(n == null ? void 0 : n(et(e)(o)));
515
543
  });
516
- d(be, {
544
+ d(Ce, {
517
545
  displayName: "Command<selectColCommand>",
518
546
  group: "Table"
519
547
  });
520
- const Ce = g("SelectTable", () => () => (e, t) => {
548
+ const ye = h("SelectTable", () => () => (e, t) => {
521
549
  const { tr: n } = e;
522
- return !!(t == null ? void 0 : t(qe(n)));
550
+ return !!(t == null ? void 0 : t(Qe(n)));
523
551
  });
524
- d(Ce, {
552
+ d(ye, {
525
553
  displayName: "Command<selectTableCommand>",
526
554
  group: "Table"
527
555
  });
528
- const ye = g("DeleteSelectedCells", () => () => (e, t) => {
556
+ const ke = h("DeleteSelectedCells", () => () => (e, t) => {
529
557
  const { selection: n } = e;
530
558
  if (!(n instanceof y))
531
559
  return !1;
532
560
  const o = n.isRowSelection(), l = n.isColSelection();
533
- return o && l ? Fe(e, t) : l ? Ke(e, t) : He(e, t);
561
+ return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
534
562
  });
535
- d(ye, {
563
+ d(ke, {
536
564
  displayName: "Command<deleteSelectedCellsCommand>",
537
565
  group: "Table"
538
566
  });
539
- const ke = g("AddColBefore", () => () => Le);
540
- d(ke, {
567
+ const we = h("AddColBefore", () => () => We);
568
+ d(we, {
541
569
  displayName: "Command<addColBeforeCommand>",
542
570
  group: "Table"
543
571
  });
544
- const we = g("AddColAfter", () => () => We);
545
- d(we, {
572
+ const Ne = h("AddColAfter", () => () => Ge);
573
+ d(Ne, {
546
574
  displayName: "Command<addColAfterCommand>",
547
575
  group: "Table"
548
576
  });
549
- const Ne = g("AddRowBefore", (e) => () => (t, n) => {
577
+ const Te = h("AddRowBefore", (e) => () => (t, n) => {
550
578
  if (!N(t))
551
579
  return !1;
552
580
  if (n) {
553
581
  const o = re(t);
554
- n(se(e, t.tr, o, o.top));
582
+ n(ce(e, t.tr, o, o.top));
555
583
  }
556
584
  return !0;
557
585
  });
558
- d(Ne, {
586
+ d(Te, {
559
587
  displayName: "Command<addRowBeforeCommand>",
560
588
  group: "Table"
561
589
  });
562
- const Te = g("AddRowAfter", (e) => () => (t, n) => {
590
+ const Se = h("AddRowAfter", (e) => () => (t, n) => {
563
591
  if (!N(t))
564
592
  return !1;
565
593
  if (n) {
566
594
  const o = re(t);
567
- n(se(e, t.tr, o, o.bottom));
595
+ n(ce(e, t.tr, o, o.bottom));
568
596
  }
569
597
  return !0;
570
598
  });
571
- d(Te, {
599
+ d(Se, {
572
600
  displayName: "Command<addRowAfterCommand>",
573
601
  group: "Table"
574
602
  });
575
- const Se = g("SetAlign", () => (e = "left") => Ge("alignment", e));
576
- d(Se, {
603
+ const Re = h("SetAlign", () => (e = "left") => ze("alignment", e));
604
+ d(Re, {
577
605
  displayName: "Command<setAlignCommand>",
578
606
  group: "Table"
579
607
  });
580
- const z = te("tableKeymap", {
608
+ const j = oe("tableKeymap", {
581
609
  NextCell: {
582
610
  shortcuts: ["Mod-]", "Tab"],
583
611
  command: (e) => {
584
- const t = e.get(M);
585
- return () => t.call(W.key);
612
+ const t = e.get(A);
613
+ return () => t.call(G.key);
586
614
  }
587
615
  },
588
616
  PrevCell: {
589
617
  shortcuts: ["Mod-[", "Shift-Tab"],
590
618
  command: (e) => {
591
- const t = e.get(M);
592
- return () => t.call(L.key);
619
+ const t = e.get(A);
620
+ return () => t.call(W.key);
593
621
  }
594
622
  },
595
623
  ExitTable: {
596
624
  shortcuts: ["Mod-Enter"],
597
625
  command: (e) => {
598
- const t = e.get(M);
599
- return () => t.call(G.key);
626
+ const t = e.get(A);
627
+ return () => t.call(z.key);
600
628
  }
601
629
  }
602
630
  });
603
- d(z.ctx, {
631
+ d(j.ctx, {
604
632
  displayName: "KeymapCtx<table>",
605
633
  group: "Table"
606
634
  });
607
- d(z.shortcuts, {
635
+ d(j.shortcuts, {
608
636
  displayName: "Keymap<table>",
609
637
  group: "Table"
610
638
  });
611
- const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_definition", () => ({
639
+ const E = "footnote_definition", Y = "footnoteDefinition", Z = k("footnote_definition", () => ({
612
640
  group: "block",
613
641
  content: "block+",
614
642
  defining: !0,
@@ -644,7 +672,7 @@ const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_defin
644
672
  ];
645
673
  },
646
674
  parseMarkdown: {
647
- match: ({ type: e }) => e === Q,
675
+ match: ({ type: e }) => e === Y,
648
676
  runner: (e, t, n) => {
649
677
  e.openNode(n, {
650
678
  label: t.label
@@ -654,22 +682,22 @@ const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_defin
654
682
  toMarkdown: {
655
683
  match: (e) => e.type.name === E,
656
684
  runner: (e, t) => {
657
- e.openNode(Q, void 0, {
685
+ e.openNode(Y, void 0, {
658
686
  label: t.attrs.label,
659
687
  identifier: t.attrs.label
660
688
  }).next(t.content).closeNode();
661
689
  }
662
690
  }
663
691
  }));
664
- d(j.ctx, {
692
+ d(Z.ctx, {
665
693
  displayName: "NodeSchemaCtx<footnodeDef>",
666
694
  group: "footnote"
667
695
  });
668
- d(j.node, {
696
+ d(Z.node, {
669
697
  displayName: "NodeSchema<footnodeDef>",
670
698
  group: "footnote"
671
699
  });
672
- const D = "footnote_reference", Z = k("footnote_reference", () => ({
700
+ const D = "footnote_reference", V = k("footnote_reference", () => ({
673
701
  group: "inline",
674
702
  inline: !0,
675
703
  atom: !0,
@@ -720,15 +748,15 @@ const D = "footnote_reference", Z = k("footnote_reference", () => ({
720
748
  }
721
749
  }
722
750
  }));
723
- d(Z.ctx, {
751
+ d(V.ctx, {
724
752
  displayName: "NodeSchemaCtx<footnodeRef>",
725
753
  group: "footnote"
726
754
  });
727
- d(Z.node, {
755
+ d(V.node, {
728
756
  displayName: "NodeSchema<footnodeRef>",
729
757
  group: "footnote"
730
758
  });
731
- const Re = Ie.extendSchema((e) => (t) => {
759
+ const Me = $e.extendSchema((e) => (t) => {
732
760
  const n = e(t);
733
761
  return {
734
762
  ...n,
@@ -789,11 +817,11 @@ const Re = Ie.extendSchema((e) => (t) => {
789
817
  }
790
818
  };
791
819
  });
792
- d(Re, {
820
+ d(Me, {
793
821
  displayName: "NodeSchema<listItem>",
794
822
  group: "ListItem"
795
823
  });
796
- const Me = oe(() => new ee(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
824
+ const Ae = B(() => new te(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
797
825
  var a;
798
826
  const l = e.doc.resolve(n);
799
827
  let r = 0, s = l.node(r);
@@ -804,141 +832,145 @@ const Me = oe(() => new ee(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
804
832
  const c = ((a = t.groups) == null ? void 0 : a.checked) === "x", i = l.before(r), m = e.tr;
805
833
  return m.deleteRange(n, o).setNodeMarkup(i, void 0, { ...s.attrs, checked: c }), m;
806
834
  }));
807
- d(Me, {
835
+ d(Ae, {
808
836
  displayName: "InputRule<wrapInTaskListInputRule>",
809
837
  group: "ListItem"
810
838
  });
811
- const nt = [
812
- H,
813
- z
814
- ].flat(), lt = [
815
- ue,
816
- Me
817
- ], Ae = B((e) => {
818
- const t = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n = (l) => l.type === Y.type(e), o = (l) => n(l) && l.nodeSize === 2;
819
- return new Oe({
839
+ const rt = [
840
+ L,
841
+ j
842
+ ].flat(), at = [
843
+ pe,
844
+ Ae
845
+ ], st = [
846
+ ae
847
+ ], xe = F((e) => {
848
+ const t = new Oe("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), n = (l) => l.type === ee.type(e), o = (l) => n(l) && l.nodeSize === 2;
849
+ return new Be({
820
850
  key: t,
821
851
  props: {
822
852
  handleDOMEvents: {
823
853
  compositionstart(l) {
824
854
  const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
825
- return U.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("⁠", m.start())), !1;
855
+ return X.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("⁠", m.start())), !1;
826
856
  },
827
857
  compositionend(l) {
828
858
  const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
829
- return U.safari && N(r) && i.empty && n(m.parent) && m.parent.textContent.startsWith("⁠") && s(c.delete(m.start(), m.start() + 1)), !1;
859
+ return X.safari && N(r) && i.empty && n(m.parent) && m.parent.textContent.startsWith("⁠") && s(c.delete(m.start(), m.start() + 1)), !1;
830
860
  }
831
861
  }
832
862
  }
833
863
  });
834
864
  });
835
- d(Ae, {
865
+ d(xe, {
836
866
  displayName: "Prose<autoInsertZeroSpaceInTablePlugin>",
837
867
  group: "Prose"
838
868
  });
839
- const xe = B(() => ze({}));
840
- d(xe, {
869
+ const ve = F(() => je({}));
870
+ d(ve, {
841
871
  displayName: "Prose<columnResizingPlugin>",
842
872
  group: "Prose"
843
873
  });
844
- const ve = B(() => je());
845
- d(ve, {
874
+ const Ie = F(() => Ze());
875
+ d(Ie, {
846
876
  displayName: "Prose<tableEditingPlugin>",
847
877
  group: "Prose"
848
878
  });
849
- const V = _e("remarkGFM", () => Ue);
850
- d(V.plugin, {
879
+ const U = Ee("remarkGFM", () => qe);
880
+ d(U.plugin, {
851
881
  displayName: "Remark<remarkGFMPlugin>",
852
882
  group: "Remark"
853
883
  });
854
- d(V.options, {
884
+ d(U.options, {
855
885
  displayName: "RemarkConfig<remarkGFMPlugin>",
856
886
  group: "Remark"
857
887
  });
858
- const rt = [
859
- Ae,
888
+ const ct = [
860
889
  xe,
861
890
  ve,
862
- V
863
- ].flat(), at = [
864
- Re,
865
- T,
891
+ Ie,
892
+ U
893
+ ].flat(), it = [
894
+ Me,
866
895
  S,
867
- I,
868
896
  R,
869
- j,
897
+ I,
898
+ M,
870
899
  Z,
871
- F,
872
- x
873
- ].flat(), st = [
874
- W,
875
- L,
900
+ V,
901
+ K,
902
+ T
903
+ ].flat(), dt = [
876
904
  G,
877
- pe,
905
+ W,
906
+ z,
878
907
  fe,
879
- ge,
880
908
  he,
909
+ ge,
881
910
  be,
882
911
  Ce,
883
912
  ye,
884
- Ne,
885
- Te,
886
913
  ke,
887
- we,
914
+ Te,
888
915
  Se,
889
- K
890
- ], Ct = [at, lt, nt, rt, st].flat();
916
+ we,
917
+ Ne,
918
+ Re,
919
+ H
920
+ ], wt = [it, at, st, rt, ct, dt].flat();
891
921
  export {
892
- we as addColAfterCommand,
893
- ke as addColBeforeCommand,
894
- Te as addRowAfterCommand,
895
- Ne as addRowBeforeCommand,
896
- se as addRowWithAlignment,
897
- Ae as autoInsertZeroSpaceInTablePlugin,
898
- G as breakTableCommand,
899
- xe as columnResizingPlugin,
900
- st as commands,
901
- ae as createTable,
902
- ye as deleteSelectedCellsCommand,
903
- Re as extendListItemSchemaForTask,
922
+ Ne as addColAfterCommand,
923
+ we as addColBeforeCommand,
924
+ Se as addRowAfterCommand,
925
+ Te as addRowBeforeCommand,
926
+ ce as addRowWithAlignment,
927
+ xe as autoInsertZeroSpaceInTablePlugin,
928
+ z as breakTableCommand,
929
+ ve as columnResizingPlugin,
930
+ dt as commands,
931
+ se as createTable,
932
+ ke as deleteSelectedCellsCommand,
933
+ Me as extendListItemSchemaForTask,
904
934
  w as findTable,
905
- j as footnoteDefinitionSchema,
906
- Z as footnoteReferenceSchema,
907
- Xe as getAllCellsInTable,
935
+ Z as footnoteDefinitionSchema,
936
+ V as footnoteReferenceSchema,
937
+ Je as getAllCellsInTable,
908
938
  b as getCellsInCol,
909
939
  C as getCellsInRow,
910
- Ct as gfm,
911
- W as goToNextTableCellCommand,
912
- L as goToPrevTableCellCommand,
913
- lt as inputrules,
914
- pe as insertTableCommand,
915
- ue as insertTableInputRule,
916
- nt as keymap,
917
- tt as moveCol,
940
+ wt as gfm,
941
+ G as goToNextTableCellCommand,
942
+ W as goToPrevTableCellCommand,
943
+ at as inputRules,
944
+ fe as insertTableCommand,
945
+ pe as insertTableInputRule,
946
+ rt as keymap,
947
+ st as markInputRules,
948
+ nt as moveCol,
918
949
  ge as moveColCommand,
919
- ot as moveRow,
920
- fe as moveRowCommand,
921
- rt as plugins,
922
- V as remarkGFMPlugin,
923
- at as schema,
924
- Qe as selectCol,
925
- be as selectColCommand,
926
- ce as selectLine,
927
- Je as selectRow,
928
- he as selectRowCommand,
929
- qe as selectTable,
930
- Ce as selectTableCommand,
931
- Se as setAlignCommand,
932
- F as strikethroughAttr,
933
- H as strikethroughKeymap,
934
- x as strikethroughSchema,
935
- R as tableCellSchema,
936
- ve as tableEditingPlugin,
950
+ lt as moveRow,
951
+ he as moveRowCommand,
952
+ ct as plugins,
953
+ U as remarkGFMPlugin,
954
+ it as schema,
955
+ et as selectCol,
956
+ Ce as selectColCommand,
957
+ ie as selectLine,
958
+ Ye as selectRow,
959
+ be as selectRowCommand,
960
+ Qe as selectTable,
961
+ ye as selectTableCommand,
962
+ Re as setAlignCommand,
963
+ K as strikethroughAttr,
964
+ ae as strikethroughInputRule,
965
+ L as strikethroughKeymap,
966
+ T as strikethroughSchema,
967
+ M as tableCellSchema,
968
+ Ie as tableEditingPlugin,
937
969
  I as tableHeaderSchema,
938
- z as tableKeymap,
939
- S as tableRowSchema,
940
- T as tableSchema,
941
- K as toggleStrikethroughCommand,
942
- Me as wrapInTaskListInputRule
970
+ j as tableKeymap,
971
+ R as tableRowSchema,
972
+ S as tableSchema,
973
+ H as toggleStrikethroughCommand,
974
+ Ae as wrapInTaskListInputRule
943
975
  };
944
976
  //# sourceMappingURL=index.es.js.map