@milkdown/preset-gfm 7.5.0 → 7.5.8

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 (35) hide show
  1. package/lib/__internal__/with-meta.d.ts.map +1 -1
  2. package/lib/composed/commands.d.ts +6 -6
  3. package/lib/composed/commands.d.ts.map +1 -1
  4. package/lib/composed/inputrules.d.ts.map +1 -1
  5. package/lib/index.d.ts.map +1 -1
  6. package/lib/index.es.js +407 -323
  7. package/lib/index.es.js.map +1 -1
  8. package/lib/mark/strike-through.d.ts.map +1 -1
  9. package/lib/node/footnote/definition.d.ts.map +1 -1
  10. package/lib/node/footnote/reference.d.ts.map +1 -1
  11. package/lib/node/table/command.d.ts +10 -10
  12. package/lib/node/table/command.d.ts.map +1 -1
  13. package/lib/node/table/input.d.ts.map +1 -1
  14. package/lib/node/table/schema.d.ts.map +1 -1
  15. package/lib/node/table/utils.d.ts.map +1 -1
  16. package/lib/node/task-list-item.d.ts.map +1 -1
  17. package/lib/plugin/keep-table-align-plugin.d.ts.map +1 -1
  18. package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -1
  19. package/lib/plugin/table-editing-plugin.d.ts.map +1 -1
  20. package/package.json +8 -8
  21. package/src/__internal__/with-meta.ts +4 -1
  22. package/src/composed/commands.ts +17 -1
  23. package/src/composed/inputrules.ts +1 -3
  24. package/src/index.ts +16 -2
  25. package/src/mark/strike-through.ts +21 -9
  26. package/src/node/footnote/definition.ts +56 -54
  27. package/src/node/footnote/reference.ts +47 -45
  28. package/src/node/table/command.ts +169 -93
  29. package/src/node/table/input.ts +32 -15
  30. package/src/node/table/schema.ts +12 -13
  31. package/src/node/table/utils.ts +120 -84
  32. package/src/node/task-list-item.ts +100 -88
  33. package/src/plugin/keep-table-align-plugin.ts +7 -14
  34. package/src/plugin/remark-gfm-plugin.ts +2 -1
  35. package/src/plugin/table-editing-plugin.ts +3 -1
package/lib/index.es.js CHANGED
@@ -25,7 +25,10 @@ i(W, {
25
25
  const T = He("strike_through", (e) => ({
26
26
  parseDOM: [
27
27
  { tag: "del" },
28
- { style: "text-decoration", getAttrs: (t) => t === "line-through" }
28
+ {
29
+ style: "text-decoration",
30
+ getAttrs: (t) => t === "line-through"
31
+ }
29
32
  ],
30
33
  toDOM: (t) => ["del", e.get(W.key)(t)],
31
34
  parseMarkdown: {
@@ -49,7 +52,10 @@ i(T.ctx, {
49
52
  displayName: "MarkSchemaCtx<strikethrough>",
50
53
  group: "Strikethrough"
51
54
  });
52
- const z = g("ToggleStrikeThrough", (e) => () => Xe(T.type(e)));
55
+ const z = g(
56
+ "ToggleStrikeThrough",
57
+ (e) => () => Xe(T.type(e))
58
+ );
53
59
  i(z, {
54
60
  displayName: "Command<ToggleStrikethrough>",
55
61
  group: "Strikethrough"
@@ -108,8 +114,7 @@ const S = Le({
108
114
  runner: (e, t) => {
109
115
  var l;
110
116
  const n = (l = t.content.firstChild) == null ? void 0 : l.content;
111
- if (!n)
112
- return;
117
+ if (!n) return;
113
118
  const o = [];
114
119
  n.forEach((r) => {
115
120
  o.push(r.attrs.alignment);
@@ -188,7 +193,7 @@ i(R.ctx, {
188
193
  displayName: "NodeSchemaCtx<tableRow>",
189
194
  group: "Table"
190
195
  });
191
- const M = C("table_cell", () => ({
196
+ const x = C("table_cell", () => ({
192
197
  ...S.table_cell,
193
198
  disableDropCursor: !0,
194
199
  parseMarkdown: {
@@ -205,11 +210,11 @@ const M = C("table_cell", () => ({
205
210
  }
206
211
  }
207
212
  }));
208
- i(M.node, {
213
+ i(x.node, {
209
214
  displayName: "NodeSchema<tableCell>",
210
215
  group: "Table"
211
216
  });
212
- i(M.ctx, {
217
+ i(x.ctx, {
213
218
  displayName: "NodeSchemaCtx<tableCell>",
214
219
  group: "Table"
215
220
  });
@@ -239,22 +244,29 @@ i(I.ctx, {
239
244
  group: "Table"
240
245
  });
241
246
  function de(e, t = 3, n = 3) {
242
- 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) => c === 0 ? $.type(e).create(null, l) : R.type(e).create(null, o));
247
+ const o = Array(n).fill(0).map(() => x.type(e).createAndFill()), l = Array(n).fill(0).map(() => I.type(e).createAndFill()), r = Array(t).fill(0).map(
248
+ (s, c) => c === 0 ? $.type(e).create(null, l) : R.type(e).create(null, o)
249
+ );
243
250
  return N.type(e).create(null, r);
244
251
  }
245
- function x(e) {
246
- return se((t) => t.type.spec.tableRole === "table")(e);
252
+ function M(e) {
253
+ return se(
254
+ (t) => t.type.spec.tableRole === "table"
255
+ )(e);
247
256
  }
248
257
  function y(e, t) {
249
- const n = x(t.$from);
250
- if (!n)
251
- return;
258
+ const n = M(t.$from);
259
+ if (!n) return;
252
260
  const o = h.get(n.node);
253
261
  if (!(e < 0 || e >= o.width))
254
- return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {
262
+ return o.cellsInRect({
263
+ left: e,
264
+ right: e + 1,
265
+ top: 0,
266
+ bottom: o.height
267
+ }).map((l) => {
255
268
  const r = n.node.nodeAt(l);
256
- if (!r)
257
- return;
269
+ if (!r) return;
258
270
  const s = l + n.start;
259
271
  return {
260
272
  pos: s,
@@ -264,15 +276,18 @@ function y(e, t) {
264
276
  }).filter((l) => l != null);
265
277
  }
266
278
  function w(e, t) {
267
- const n = x(t.$from);
268
- if (!n)
269
- return;
279
+ const n = M(t.$from);
280
+ if (!n) return;
270
281
  const o = h.get(n.node);
271
282
  if (!(e < 0 || e >= o.height))
272
- return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {
283
+ return o.cellsInRect({
284
+ left: 0,
285
+ right: o.width,
286
+ top: e,
287
+ bottom: e + 1
288
+ }).map((l) => {
273
289
  const r = n.node.nodeAt(l);
274
- if (!r)
275
- return;
290
+ if (!r) return;
276
291
  const s = l + n.start;
277
292
  return {
278
293
  pos: s,
@@ -282,9 +297,8 @@ function w(e, t) {
282
297
  }).filter((l) => l != null);
283
298
  }
284
299
  function ot(e) {
285
- const t = x(e.$from);
286
- if (!t)
287
- return;
300
+ const t = M(e.$from);
301
+ if (!t) return;
288
302
  const n = h.get(t.node);
289
303
  return n.cellsInRect({
290
304
  left: 0,
@@ -310,14 +324,16 @@ function nt(e) {
310
324
  function me(e, t, { map: n, tableStart: o, table: l }, r) {
311
325
  const s = Array(r).fill(0).reduce((d, p, a) => d + l.child(a).nodeSize, o), c = Array(n.width).fill(0).map((d, p) => {
312
326
  const a = l.nodeAt(n.map[p]);
313
- return M.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
327
+ return x.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
314
328
  });
315
329
  return t.insert(s, R.type(e).create(null, c)), t;
316
330
  }
317
331
  function ue(e) {
318
332
  return (t, n) => (o) => {
319
333
  n = n ?? o.selection.from;
320
- const l = o.doc.resolve(n), r = se((d) => d.type.name === "table")(l), s = r ? {
334
+ const l = o.doc.resolve(n), r = se(
335
+ (d) => d.type.name === "table"
336
+ )(l), s = r ? {
321
337
  node: r.node,
322
338
  from: r.start
323
339
  } : void 0, c = e === "row";
@@ -328,8 +344,16 @@ function ue(e) {
328
344
  c ? t : d.height - 1,
329
345
  c ? d.width - 1 : t,
330
346
  s.node
331
- ), a = o.doc.resolve(s.from + p), m = c ? k.rowSelection : k.colSelection, u = d.positionAt(c ? t : 0, c ? 0 : t, s.node), f = o.doc.resolve(s.from + u);
332
- return _(o.setSelection(m(a, f)));
347
+ ), a = o.doc.resolve(s.from + p), m = c ? k.rowSelection : k.colSelection, u = d.positionAt(
348
+ c ? t : 0,
349
+ c ? 0 : t,
350
+ s.node
351
+ ), f = o.doc.resolve(s.from + u);
352
+ return _(
353
+ o.setSelection(
354
+ m(a, f)
355
+ )
356
+ );
333
357
  }
334
358
  }
335
359
  return o;
@@ -344,8 +368,7 @@ function pe(e, t) {
344
368
  for (let r = 0; r < o.height; r++) {
345
369
  const s = e.child(r), c = [];
346
370
  for (let d = 0; d < o.width; d++) {
347
- if (!t[r][d])
348
- continue;
371
+ if (!t[r][d]) continue;
349
372
  const p = o.map[r * o.width + d], a = t[r][d], u = e.nodeAt(p).type.createChecked(
350
373
  Object.assign({}, a.attrs),
351
374
  a.content,
@@ -380,15 +403,15 @@ function fe(e) {
380
403
  function ge(e, t, n, o) {
381
404
  const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;
382
405
  let c;
383
- 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;
406
+ return c = l === -1 ? n[0] : n[n.length - 1] - s, e.splice(c, 0, ...r), e;
384
407
  }
385
408
  function at(e, t, n, o) {
386
409
  let l = Z(fe(e.node));
387
- return l = ge(l, t, n, o), l = Z(l), pe(e.node, l);
410
+ return l = ge(l, t, n), l = Z(l), pe(e.node, l);
388
411
  }
389
412
  function st(e, t, n, o) {
390
413
  let l = fe(e.node);
391
- return l = ge(l, t, n, o), pe(e.node, l);
414
+ return l = ge(l, t, n), pe(e.node, l);
392
415
  }
393
416
  function ee(e, t) {
394
417
  let n = e, o = e;
@@ -424,8 +447,7 @@ function ee(e, t) {
424
447
  d = m[0];
425
448
  break;
426
449
  }
427
- if (d)
428
- break;
450
+ if (d) break;
429
451
  }
430
452
  }
431
453
  const p = t.doc.resolve(d.pos);
@@ -449,7 +471,9 @@ function te(e, t) {
449
471
  m && m.length && l.push(a);
450
472
  }
451
473
  n = l[0], o = l[l.length - 1];
452
- const r = w(n, t.selection), s = y(0, t.selection), c = t.doc.resolve(r[r.length - 1].pos);
474
+ const r = w(n, t.selection), s = y(0, t.selection), c = t.doc.resolve(
475
+ r[r.length - 1].pos
476
+ );
453
477
  let d;
454
478
  for (let a = o; a >= n; a--) {
455
479
  const m = w(a, t.selection);
@@ -459,195 +483,236 @@ function te(e, t) {
459
483
  d = m[0];
460
484
  break;
461
485
  }
462
- if (d)
463
- break;
486
+ if (d) break;
464
487
  }
465
488
  }
466
489
  const p = t.doc.resolve(d.pos);
467
490
  return { $anchor: c, $head: p, indexes: l };
468
491
  }
469
492
  function ct(e) {
470
- const { tr: t, origin: n, target: o, select: l = !0, pos: r } = e, s = r != null ? t.doc.resolve(r) : t.selection.$from, c = x(s);
471
- if (!c)
472
- return t;
493
+ const { tr: t, origin: n, target: o, select: l = !0, pos: r } = e, s = r != null ? t.doc.resolve(r) : t.selection.$from, c = M(s);
494
+ if (!c) return t;
473
495
  const { indexes: d } = ee(n, t), { indexes: p } = ee(o, t);
474
- if (d.includes(o))
475
- return t;
496
+ if (d.includes(o)) return t;
476
497
  const a = at(
477
498
  c,
478
499
  d,
479
- p,
480
- 0
500
+ p
481
501
  ), m = _(t).replaceWith(
482
502
  c.pos,
483
503
  c.pos + c.node.nodeSize,
484
504
  a
485
505
  );
486
- if (!l)
487
- return m;
506
+ if (!l) return m;
488
507
  const u = h.get(a), f = c.start, b = o, P = u.positionAt(u.height - 1, b, a), D = m.doc.resolve(f + P), E = k.colSelection, O = u.positionAt(0, b, a), H = m.doc.resolve(f + O);
489
508
  return m.setSelection(E(D, H));
490
509
  }
491
510
  function it(e) {
492
- const { tr: t, origin: n, target: o, select: l = !0, pos: r } = e, s = r != null ? t.doc.resolve(r) : t.selection.$from, c = x(s);
493
- if (!c)
494
- return t;
511
+ const { tr: t, origin: n, target: o, select: l = !0, pos: r } = e, s = r != null ? t.doc.resolve(r) : t.selection.$from, c = M(s);
512
+ if (!c) return t;
495
513
  const { indexes: d } = te(n, t), { indexes: p } = te(o, t);
496
- if (d.includes(o))
497
- return t;
498
- const a = st(
499
- c,
500
- d,
501
- p,
502
- 0
503
- ), m = _(t).replaceWith(
514
+ if (d.includes(o)) return t;
515
+ const a = st(c, d, p), m = _(t).replaceWith(
504
516
  c.pos,
505
517
  c.pos + c.node.nodeSize,
506
518
  a
507
519
  );
508
- if (!l)
509
- return m;
520
+ if (!l) return m;
510
521
  const u = h.get(a), f = c.start, b = o, P = u.positionAt(b, u.width - 1, a), D = m.doc.resolve(f + P), E = k.rowSelection, O = u.positionAt(b, 0, a), H = m.doc.resolve(f + O);
511
522
  return m.setSelection(E(D, H));
512
523
  }
513
- const V = g("GoToPrevTableCell", () => () => re(-1));
524
+ const V = g(
525
+ "GoToPrevTableCell",
526
+ () => () => re(-1)
527
+ );
514
528
  i(V, {
515
529
  displayName: "Command<goToPrevTableCellCommand>",
516
530
  group: "Table"
517
531
  });
518
- const U = g("GoToNextTableCell", () => () => re(1));
532
+ const U = g(
533
+ "GoToNextTableCell",
534
+ () => () => re(1)
535
+ );
519
536
  i(U, {
520
537
  displayName: "Command<goToNextTableCellCommand>",
521
538
  group: "Table"
522
539
  });
523
- const X = g("ExitTable", (e) => () => (t, n) => {
524
- if (!G(t))
525
- return !1;
526
- const { $head: o } = t.selection, l = Je(o, N.type(e));
527
- if (!l)
528
- return !1;
529
- const { to: r } = l, s = t.tr.replaceWith(r, r, De.type(e).createAndFill());
530
- return s.setSelection(ce.near(s.doc.resolve(r), 1)).scrollIntoView(), n == null || n(s), !0;
531
- });
540
+ const X = g(
541
+ "ExitTable",
542
+ (e) => () => (t, n) => {
543
+ if (!G(t)) return !1;
544
+ const { $head: o } = t.selection, l = Je(o, N.type(e));
545
+ if (!l) return !1;
546
+ const { to: r } = l, s = t.tr.replaceWith(
547
+ r,
548
+ r,
549
+ De.type(e).createAndFill()
550
+ );
551
+ return s.setSelection(ce.near(s.doc.resolve(r), 1)).scrollIntoView(), n == null || n(s), !0;
552
+ }
553
+ );
532
554
  i(X, {
533
555
  displayName: "Command<breakTableCommand>",
534
556
  group: "Table"
535
557
  });
536
- const he = g("InsertTable", (e) => ({ row: t, col: n } = {}) => (o, l) => {
537
- const { selection: r, tr: s } = o, { from: c } = r, d = de(e, t, n), p = s.replaceSelectionWith(d), a = ce.findFrom(p.doc.resolve(c), 1, !0);
538
- return a && p.setSelection(a), l == null || l(p), !0;
539
- });
558
+ const he = g(
559
+ "InsertTable",
560
+ (e) => ({ row: t, col: n } = {}) => (o, l) => {
561
+ const { selection: r, tr: s } = o, { from: c } = r, d = de(e, t, n), p = s.replaceSelectionWith(d), a = ce.findFrom(p.doc.resolve(c), 1, !0);
562
+ return a && p.setSelection(a), l == null || l(p), !0;
563
+ }
564
+ );
540
565
  i(he, {
541
566
  displayName: "Command<insertTableCommand>",
542
567
  group: "Table"
543
568
  });
544
- const be = g("MoveRow", () => ({ from: e, to: t, pos: n } = {}) => (o, l) => {
545
- const { tr: r } = o;
546
- return !!(l == null ? void 0 : l(it({ tr: r, origin: e ?? 0, target: t ?? 0, pos: n, select: !0 })));
547
- });
569
+ const be = g(
570
+ "MoveRow",
571
+ () => ({ from: e, to: t, pos: n } = {}) => (o, l) => {
572
+ const { tr: r } = o;
573
+ return !!(l == null ? void 0 : l(
574
+ it({ tr: r, origin: e ?? 0, target: t ?? 0, pos: n, select: !0 })
575
+ ));
576
+ }
577
+ );
548
578
  i(be, {
549
579
  displayName: "Command<moveRowCommand>",
550
580
  group: "Table"
551
581
  });
552
- const Ce = g("MoveCol", () => ({ from: e, to: t, pos: n } = {}) => (o, l) => {
553
- const { tr: r } = o;
554
- return !!(l == null ? void 0 : l(ct({ tr: r, origin: e ?? 0, target: t ?? 0, pos: n, select: !0 })));
555
- });
582
+ const Ce = g(
583
+ "MoveCol",
584
+ () => ({ from: e, to: t, pos: n } = {}) => (o, l) => {
585
+ const { tr: r } = o;
586
+ return !!(l == null ? void 0 : l(
587
+ ct({ tr: r, origin: e ?? 0, target: t ?? 0, pos: n, select: !0 })
588
+ ));
589
+ }
590
+ );
556
591
  i(Ce, {
557
592
  displayName: "Command<moveColCommand>",
558
593
  group: "Table"
559
594
  });
560
- const ye = g("SelectRow", () => (e = { index: 0 }) => (t, n) => {
561
- const { tr: o } = t;
562
- return !!(n == null ? void 0 : n(lt(e.index, e.pos)(o)));
563
- });
595
+ const ye = g(
596
+ "SelectRow",
597
+ () => (e = { index: 0 }) => (t, n) => {
598
+ const { tr: o } = t;
599
+ return !!(n == null ? void 0 : n(lt(e.index, e.pos)(o)));
600
+ }
601
+ );
564
602
  i(ye, {
565
603
  displayName: "Command<selectRowCommand>",
566
604
  group: "Table"
567
605
  });
568
- const we = g("SelectCol", () => (e = { index: 0 }) => (t, n) => {
569
- const { tr: o } = t;
570
- return !!(n == null ? void 0 : n(rt(e.index, e.pos)(o)));
571
- });
606
+ const we = g(
607
+ "SelectCol",
608
+ () => (e = { index: 0 }) => (t, n) => {
609
+ const { tr: o } = t;
610
+ return !!(n == null ? void 0 : n(rt(e.index, e.pos)(o)));
611
+ }
612
+ );
572
613
  i(we, {
573
614
  displayName: "Command<selectColCommand>",
574
615
  group: "Table"
575
616
  });
576
- const ke = g("SelectTable", () => () => (e, t) => {
577
- const { tr: n } = e;
578
- return !!(t == null ? void 0 : t(nt(n)));
579
- });
617
+ const ke = g(
618
+ "SelectTable",
619
+ () => () => (e, t) => {
620
+ const { tr: n } = e;
621
+ return !!(t == null ? void 0 : t(nt(n)));
622
+ }
623
+ );
580
624
  i(ke, {
581
625
  displayName: "Command<selectTableCommand>",
582
626
  group: "Table"
583
627
  });
584
- const Ne = g("DeleteSelectedCells", () => () => (e, t) => {
585
- const { selection: n } = e;
586
- if (!(n instanceof k))
587
- return !1;
588
- const o = n.isRowSelection(), l = n.isColSelection();
589
- return o && l ? Ke(e, t) : l ? Fe(e, t) : Ge(e, t);
590
- });
628
+ const Ne = g(
629
+ "DeleteSelectedCells",
630
+ () => () => (e, t) => {
631
+ const { selection: n } = e;
632
+ if (!(n instanceof k)) return !1;
633
+ const o = n.isRowSelection(), l = n.isColSelection();
634
+ return o && l ? Ke(e, t) : l ? Fe(e, t) : Ge(e, t);
635
+ }
636
+ );
591
637
  i(Ne, {
592
638
  displayName: "Command<deleteSelectedCellsCommand>",
593
639
  group: "Table"
594
640
  });
595
- const Te = g("AddColBefore", () => () => We);
641
+ const Te = g(
642
+ "AddColBefore",
643
+ () => () => We
644
+ );
596
645
  i(Te, {
597
646
  displayName: "Command<addColBeforeCommand>",
598
647
  group: "Table"
599
648
  });
600
- const Se = g("AddColAfter", () => () => ze);
649
+ const Se = g(
650
+ "AddColAfter",
651
+ () => () => ze
652
+ );
601
653
  i(Se, {
602
654
  displayName: "Command<addColAfterCommand>",
603
655
  group: "Table"
604
656
  });
605
- const Re = g("AddRowBefore", (e) => () => (t, n) => {
606
- if (!G(t))
607
- return !1;
608
- if (n) {
609
- const o = ae(t);
610
- n(me(e, t.tr, o, o.top));
657
+ const Re = g(
658
+ "AddRowBefore",
659
+ (e) => () => (t, n) => {
660
+ if (!G(t)) return !1;
661
+ if (n) {
662
+ const o = ae(t);
663
+ n(me(e, t.tr, o, o.top));
664
+ }
665
+ return !0;
611
666
  }
612
- return !0;
613
- });
667
+ );
614
668
  i(Re, {
615
669
  displayName: "Command<addRowBeforeCommand>",
616
670
  group: "Table"
617
671
  });
618
- const Me = g("AddRowAfter", (e) => () => (t, n) => {
619
- if (!G(t))
620
- return !1;
621
- if (n) {
622
- const o = ae(t);
623
- n(me(e, t.tr, o, o.bottom));
672
+ const xe = g(
673
+ "AddRowAfter",
674
+ (e) => () => (t, n) => {
675
+ if (!G(t)) return !1;
676
+ if (n) {
677
+ const o = ae(t);
678
+ n(me(e, t.tr, o, o.bottom));
679
+ }
680
+ return !0;
624
681
  }
625
- return !0;
626
- });
627
- i(Me, {
682
+ );
683
+ i(xe, {
628
684
  displayName: "Command<addRowAfterCommand>",
629
685
  group: "Table"
630
686
  });
631
- const xe = g("SetAlign", () => (e = "left") => je("alignment", e));
632
- i(xe, {
687
+ const Me = g(
688
+ "SetAlign",
689
+ () => (e = "left") => je("alignment", e)
690
+ );
691
+ i(Me, {
633
692
  displayName: "Command<setAlignCommand>",
634
693
  group: "Table"
635
694
  });
636
- const Ae = F((e) => new ne(
637
- /^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
638
- (t, n, o, l) => {
639
- var d, p;
640
- const r = t.doc.resolve(o);
641
- if (!r.node(-1).canReplaceWith(r.index(-1), r.indexAfter(-1), N.type(e)))
642
- return null;
643
- const s = de(
644
- e,
645
- Number((d = n.groups) == null ? void 0 : d.row),
646
- Number((p = n.groups) == null ? void 0 : p.col)
647
- ), c = t.tr.replaceRangeWith(o, l, s);
648
- return c.setSelection(Qe.create(c.doc, o + 3)).scrollIntoView();
649
- }
650
- ));
695
+ const Ae = F(
696
+ (e) => new ne(
697
+ /^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
698
+ (t, n, o, l) => {
699
+ var d, p;
700
+ const r = t.doc.resolve(o);
701
+ if (!r.node(-1).canReplaceWith(
702
+ r.index(-1),
703
+ r.indexAfter(-1),
704
+ N.type(e)
705
+ ))
706
+ return null;
707
+ const s = de(
708
+ e,
709
+ Number((d = n.groups) == null ? void 0 : d.row),
710
+ Number((p = n.groups) == null ? void 0 : p.col)
711
+ ), c = t.tr.replaceRangeWith(o, l, s);
712
+ return c.setSelection(Qe.create(c.doc, o + 3)).scrollIntoView();
713
+ }
714
+ )
715
+ );
651
716
  i(Ae, {
652
717
  displayName: "InputRule<insertTableInputRule>",
653
718
  group: "Table"
@@ -683,59 +748,61 @@ i(q.shortcuts, {
683
748
  displayName: "Keymap<table>",
684
749
  group: "Table"
685
750
  });
686
- const B = "footnote_definition", oe = "footnoteDefinition", J = C("footnote_definition", () => ({
687
- group: "block",
688
- content: "block+",
689
- defining: !0,
690
- attrs: {
691
- label: {
692
- default: ""
693
- }
694
- },
695
- parseDOM: [
696
- {
697
- tag: `dl[data-type="${B}"]`,
698
- getAttrs: (e) => {
699
- if (!(e instanceof HTMLElement))
700
- throw K(e);
701
- return {
702
- label: e.dataset.label
703
- };
704
- },
705
- contentElement: "dd"
706
- }
707
- ],
708
- toDOM: (e) => {
709
- const t = e.attrs.label;
710
- return [
711
- "dl",
751
+ const B = "footnote_definition", oe = "footnoteDefinition", J = C(
752
+ "footnote_definition",
753
+ () => ({
754
+ group: "block",
755
+ content: "block+",
756
+ defining: !0,
757
+ attrs: {
758
+ label: {
759
+ default: ""
760
+ }
761
+ },
762
+ parseDOM: [
712
763
  {
713
- // TODO: add a prosemirror plugin to sync label on change
714
- "data-label": t,
715
- "data-type": B
716
- },
717
- ["dt", t],
718
- ["dd", 0]
719
- ];
720
- },
721
- parseMarkdown: {
722
- match: ({ type: e }) => e === oe,
723
- runner: (e, t, n) => {
724
- e.openNode(n, {
725
- label: t.label
726
- }).next(t.children).closeNode();
727
- }
728
- },
729
- toMarkdown: {
730
- match: (e) => e.type.name === B,
731
- runner: (e, t) => {
732
- e.openNode(oe, void 0, {
733
- label: t.attrs.label,
734
- identifier: t.attrs.label
735
- }).next(t.content).closeNode();
764
+ tag: `dl[data-type="${B}"]`,
765
+ getAttrs: (e) => {
766
+ if (!(e instanceof HTMLElement)) throw K(e);
767
+ return {
768
+ label: e.dataset.label
769
+ };
770
+ },
771
+ contentElement: "dd"
772
+ }
773
+ ],
774
+ toDOM: (e) => {
775
+ const t = e.attrs.label;
776
+ return [
777
+ "dl",
778
+ {
779
+ // TODO: add a prosemirror plugin to sync label on change
780
+ "data-label": t,
781
+ "data-type": B
782
+ },
783
+ ["dt", t],
784
+ ["dd", 0]
785
+ ];
786
+ },
787
+ parseMarkdown: {
788
+ match: ({ type: e }) => e === oe,
789
+ runner: (e, t, n) => {
790
+ e.openNode(n, {
791
+ label: t.label
792
+ }).next(t.children).closeNode();
793
+ }
794
+ },
795
+ toMarkdown: {
796
+ match: (e) => e.type.name === B,
797
+ runner: (e, t) => {
798
+ e.openNode(oe, void 0, {
799
+ label: t.attrs.label,
800
+ identifier: t.attrs.label
801
+ }).next(t.content).closeNode();
802
+ }
736
803
  }
737
- }
738
- }));
804
+ })
805
+ );
739
806
  i(J.ctx, {
740
807
  displayName: "NodeSchemaCtx<footnodeDef>",
741
808
  group: "footnote"
@@ -744,141 +811,154 @@ i(J.node, {
744
811
  displayName: "NodeSchema<footnodeDef>",
745
812
  group: "footnote"
746
813
  });
747
- const L = "footnote_reference", Q = C("footnote_reference", () => ({
748
- group: "inline",
749
- inline: !0,
750
- atom: !0,
751
- attrs: {
752
- label: {
753
- default: ""
754
- }
755
- },
756
- parseDOM: [
757
- {
758
- tag: `sup[data-type="${L}"]`,
759
- getAttrs: (e) => {
760
- if (!(e instanceof HTMLElement))
761
- throw K(e);
762
- return {
763
- label: e.dataset.label
764
- };
765
- }
766
- }
767
- ],
768
- toDOM: (e) => {
769
- const t = e.attrs.label;
770
- return [
771
- "sup",
772
- {
773
- // TODO: add a prosemirror plugin to sync label on change
774
- "data-label": t,
775
- "data-type": L
776
- },
777
- t
778
- ];
779
- },
780
- parseMarkdown: {
781
- match: ({ type: e }) => e === "footnoteReference",
782
- runner: (e, t, n) => {
783
- e.addNode(n, {
784
- label: t.label
785
- });
786
- }
787
- },
788
- toMarkdown: {
789
- match: (e) => e.type.name === L,
790
- runner: (e, t) => {
791
- e.addNode("footnoteReference", void 0, void 0, {
792
- label: t.attrs.label,
793
- identifier: t.attrs.label
794
- });
795
- }
796
- }
797
- }));
798
- i(Q.ctx, {
799
- displayName: "NodeSchemaCtx<footnodeRef>",
800
- group: "footnote"
801
- });
802
- i(Q.node, {
803
- displayName: "NodeSchema<footnodeRef>",
804
- group: "footnote"
805
- });
806
- const ve = Ee.extendSchema((e) => (t) => {
807
- const n = e(t);
808
- return {
809
- ...n,
814
+ const L = "footnote_reference", Q = C(
815
+ "footnote_reference",
816
+ () => ({
817
+ group: "inline",
818
+ inline: !0,
819
+ atom: !0,
810
820
  attrs: {
811
- ...n.attrs,
812
- checked: {
813
- default: null
821
+ label: {
822
+ default: ""
814
823
  }
815
824
  },
816
825
  parseDOM: [
817
826
  {
818
- tag: 'li[data-item-type="task"]',
819
- getAttrs: (o) => {
820
- if (!(o instanceof HTMLElement))
821
- throw K(o);
827
+ tag: `sup[data-type="${L}"]`,
828
+ getAttrs: (e) => {
829
+ if (!(e instanceof HTMLElement)) throw K(e);
822
830
  return {
823
- label: o.dataset.label,
824
- listType: o.dataset.listType,
825
- spread: o.dataset.spread,
826
- checked: o.dataset.checked ? o.dataset.checked === "true" : null
831
+ label: e.dataset.label
827
832
  };
828
833
  }
829
- },
830
- ...(n == null ? void 0 : n.parseDOM) || []
831
- ],
832
- toDOM: (o) => n.toDOM && o.attrs.checked == null ? n.toDOM(o) : [
833
- "li",
834
- {
835
- "data-item-type": "task",
836
- "data-label": o.attrs.label,
837
- "data-list-type": o.attrs.listType,
838
- "data-spread": o.attrs.spread,
839
- "data-checked": o.attrs.checked
840
- },
841
- 0
834
+ }
842
835
  ],
836
+ toDOM: (e) => {
837
+ const t = e.attrs.label;
838
+ return [
839
+ "sup",
840
+ {
841
+ // TODO: add a prosemirror plugin to sync label on change
842
+ "data-label": t,
843
+ "data-type": L
844
+ },
845
+ t
846
+ ];
847
+ },
843
848
  parseMarkdown: {
844
- match: ({ type: o }) => o === "listItem",
845
- runner: (o, l, r) => {
846
- if (l.checked == null) {
847
- n.parseMarkdown.runner(o, l, r);
848
- return;
849
- }
850
- const s = l.label != null ? `${l.label}.` : "•", c = l.checked != null ? !!l.checked : null, d = l.label != null ? "ordered" : "bullet", p = l.spread != null ? `${l.spread}` : "true";
851
- o.openNode(r, { label: s, listType: d, spread: p, checked: c }), o.next(l.children), o.closeNode();
849
+ match: ({ type: e }) => e === "footnoteReference",
850
+ runner: (e, t, n) => {
851
+ e.addNode(n, {
852
+ label: t.label
853
+ });
852
854
  }
853
855
  },
854
856
  toMarkdown: {
855
- match: (o) => o.type.name === "list_item",
856
- runner: (o, l) => {
857
- if (l.attrs.checked == null) {
858
- n.toMarkdown.runner(o, l);
859
- return;
860
- }
861
- const r = l.attrs.label, s = l.attrs.listType, c = l.attrs.spread === "true", d = l.attrs.checked;
862
- o.openNode("listItem", void 0, { label: r, listType: s, spread: c, checked: d }), o.next(l.content), o.closeNode();
857
+ match: (e) => e.type.name === L,
858
+ runner: (e, t) => {
859
+ e.addNode("footnoteReference", void 0, void 0, {
860
+ label: t.attrs.label,
861
+ identifier: t.attrs.label
862
+ });
863
863
  }
864
864
  }
865
- };
865
+ })
866
+ );
867
+ i(Q.ctx, {
868
+ displayName: "NodeSchemaCtx<footnodeRef>",
869
+ group: "footnote"
870
+ });
871
+ i(Q.node, {
872
+ displayName: "NodeSchema<footnodeRef>",
873
+ group: "footnote"
866
874
  });
875
+ const ve = Ee.extendSchema(
876
+ (e) => (t) => {
877
+ const n = e(t);
878
+ return {
879
+ ...n,
880
+ attrs: {
881
+ ...n.attrs,
882
+ checked: {
883
+ default: null
884
+ }
885
+ },
886
+ parseDOM: [
887
+ {
888
+ tag: 'li[data-item-type="task"]',
889
+ getAttrs: (o) => {
890
+ if (!(o instanceof HTMLElement)) throw K(o);
891
+ return {
892
+ label: o.dataset.label,
893
+ listType: o.dataset.listType,
894
+ spread: o.dataset.spread,
895
+ checked: o.dataset.checked ? o.dataset.checked === "true" : null
896
+ };
897
+ }
898
+ },
899
+ ...(n == null ? void 0 : n.parseDOM) || []
900
+ ],
901
+ toDOM: (o) => n.toDOM && o.attrs.checked == null ? n.toDOM(o) : [
902
+ "li",
903
+ {
904
+ "data-item-type": "task",
905
+ "data-label": o.attrs.label,
906
+ "data-list-type": o.attrs.listType,
907
+ "data-spread": o.attrs.spread,
908
+ "data-checked": o.attrs.checked
909
+ },
910
+ 0
911
+ ],
912
+ parseMarkdown: {
913
+ match: ({ type: o }) => o === "listItem",
914
+ runner: (o, l, r) => {
915
+ if (l.checked == null) {
916
+ n.parseMarkdown.runner(o, l, r);
917
+ return;
918
+ }
919
+ const s = l.label != null ? `${l.label}.` : "•", c = l.checked != null ? !!l.checked : null, d = l.label != null ? "ordered" : "bullet", p = l.spread != null ? `${l.spread}` : "true";
920
+ o.openNode(r, { label: s, listType: d, spread: p, checked: c }), o.next(l.children), o.closeNode();
921
+ }
922
+ },
923
+ toMarkdown: {
924
+ match: (o) => o.type.name === "list_item",
925
+ runner: (o, l) => {
926
+ if (l.attrs.checked == null) {
927
+ n.toMarkdown.runner(o, l);
928
+ return;
929
+ }
930
+ const r = l.attrs.label, s = l.attrs.listType, c = l.attrs.spread === "true", d = l.attrs.checked;
931
+ o.openNode("listItem", void 0, {
932
+ label: r,
933
+ listType: s,
934
+ spread: c,
935
+ checked: d
936
+ }), o.next(l.content), o.closeNode();
937
+ }
938
+ }
939
+ };
940
+ }
941
+ );
867
942
  i(ve, {
868
943
  displayName: "NodeSchema<listItem>",
869
944
  group: "ListItem"
870
945
  });
871
- const _e = F(() => new ne(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
872
- var a;
873
- const l = e.doc.resolve(n);
874
- let r = 0, s = l.node(r);
875
- for (; s && s.type.name !== "list_item"; )
876
- r--, s = l.node(r);
877
- if (!s || s.attrs.checked != null)
878
- return null;
879
- const c = ((a = t.groups) == null ? void 0 : a.checked) === "x", d = l.before(r), p = e.tr;
880
- return p.deleteRange(n, o).setNodeMarkup(d, void 0, { ...s.attrs, checked: c }), p;
881
- }));
946
+ const _e = F(() => new ne(
947
+ /^\[(?<checked>\s|x)\]\s$/,
948
+ (e, t, n, o) => {
949
+ var a;
950
+ const l = e.doc.resolve(n);
951
+ let r = 0, s = l.node(r);
952
+ for (; s && s.type.name !== "list_item"; )
953
+ r--, s = l.node(r);
954
+ if (!s || s.attrs.checked != null) return null;
955
+ const c = ((a = t.groups) == null ? void 0 : a.checked) === "x", d = l.before(r), p = e.tr;
956
+ return p.deleteRange(n, o).setNodeMarkup(d, void 0, {
957
+ ...s.attrs,
958
+ checked: c
959
+ }), p;
960
+ }
961
+ ));
882
962
  i(_e, {
883
963
  displayName: "InputRule<wrapInTaskListInputRule>",
884
964
  group: "ListItem"
@@ -889,9 +969,7 @@ const dt = [
889
969
  ].flat(), mt = [
890
970
  Ae,
891
971
  _e
892
- ], ut = [
893
- ie
894
- ], $e = v(() => et);
972
+ ], ut = [ie], $e = v(() => et);
895
973
  i($e, {
896
974
  displayName: "Prose<autoInsertSpanPlugin>",
897
975
  group: "Prose"
@@ -901,7 +979,9 @@ i(pt, {
901
979
  displayName: "Prose<columnResizingPlugin>",
902
980
  group: "Prose"
903
981
  });
904
- const Ie = v(() => Ue({ allowTableNodeSelection: !0 }));
982
+ const Ie = v(
983
+ () => Ue({ allowTableNodeSelection: !0 })
984
+ );
905
985
  i(Ie, {
906
986
  displayName: "Prose<tableEditingPlugin>",
907
987
  group: "Prose"
@@ -927,14 +1007,11 @@ const Pe = v(() => new Ze({
927
1007
  appendTransaction: (e, t, n) => {
928
1008
  let o;
929
1009
  const l = (r, s) => {
930
- if (o || (o = n.tr), r.type.name !== "table_cell")
931
- return;
1010
+ if (o || (o = n.tr), r.type.name !== "table_cell") return;
932
1011
  const c = n.doc.resolve(s), d = c.node(c.depth), a = c.node(c.depth - 1).firstChild;
933
- if (!a)
934
- return;
1012
+ if (!a) return;
935
1013
  const m = gt(r, d), u = a.maybeChild(m);
936
- if (!u)
937
- return;
1014
+ if (!u) return;
938
1015
  const f = u.attrs.alignment, b = r.attrs.alignment;
939
1016
  f !== b && o.setNodeMarkup(s, void 0, { ...r.attrs, alignment: f });
940
1017
  };
@@ -956,7 +1033,7 @@ const ht = [
956
1033
  $,
957
1034
  R,
958
1035
  I,
959
- M,
1036
+ x,
960
1037
  J,
961
1038
  Q,
962
1039
  W,
@@ -973,16 +1050,23 @@ const ht = [
973
1050
  ke,
974
1051
  Ne,
975
1052
  Re,
976
- Me,
1053
+ xe,
977
1054
  Te,
978
1055
  Se,
979
- xe,
1056
+ Me,
980
1057
  z
981
- ], _t = [bt, mt, ut, dt, Ct, ht].flat();
1058
+ ], _t = [
1059
+ bt,
1060
+ mt,
1061
+ ut,
1062
+ dt,
1063
+ Ct,
1064
+ ht
1065
+ ].flat();
982
1066
  export {
983
1067
  Se as addColAfterCommand,
984
1068
  Te as addColBeforeCommand,
985
- Me as addRowAfterCommand,
1069
+ xe as addRowAfterCommand,
986
1070
  Re as addRowBeforeCommand,
987
1071
  me as addRowWithAlignment,
988
1072
  $e as autoInsertSpanPlugin,
@@ -992,7 +1076,7 @@ export {
992
1076
  Ne as deleteSelectedCellsCommand,
993
1077
  X as exitTable,
994
1078
  ve as extendListItemSchemaForTask,
995
- x as findTable,
1079
+ M as findTable,
996
1080
  J as footnoteDefinitionSchema,
997
1081
  Q as footnoteReferenceSchema,
998
1082
  ot as getAllCellsInTable,
@@ -1021,12 +1105,12 @@ export {
1021
1105
  ye as selectRowCommand,
1022
1106
  nt as selectTable,
1023
1107
  ke as selectTableCommand,
1024
- xe as setAlignCommand,
1108
+ Me as setAlignCommand,
1025
1109
  W as strikethroughAttr,
1026
1110
  ie as strikethroughInputRule,
1027
1111
  j as strikethroughKeymap,
1028
1112
  T as strikethroughSchema,
1029
- M as tableCellSchema,
1113
+ x as tableCellSchema,
1030
1114
  Ie as tableEditingPlugin,
1031
1115
  $ as tableHeaderRowSchema,
1032
1116
  I as tableHeaderSchema,