@milkdown/preset-gfm 7.2.3 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.es.js CHANGED
@@ -1,28 +1,29 @@
1
1
  import { expectDomTypeError as O } from "@milkdown/exception";
2
- import { paragraphSchema as Q, listItemSchema as Ie } from "@milkdown/preset-commonmark";
3
- import { InputRule as Y } from "@milkdown/prose/inputrules";
4
- import { $markAttr as $e, $markSchema as _e, $command as h, $useKeymap as ee, $nodeSchema as k, $inputRule as te, $prose as B, $remark as Pe } from "@milkdown/utils";
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
5
  import { commandsCtx as M } from "@milkdown/core";
6
- import { TextSelection as Ee, Selection as oe, PluginKey as De, Plugin as Oe } from "@milkdown/prose/state";
7
- import { TableMap as g, CellSelection as y, tableNodes as Be, goToNextCell as ne, isInTable as N, deleteTable as Ke, deleteColumn as He, deleteRow as Le, addColumnBefore as Fe, addColumnAfter as We, selectedRect as le, setCellAttr as ze, columnResizing as Ge, tableEditing as je } from "@milkdown/prose/tables";
8
- import { toggleMarkdownMark as Ze, findParentNode as Ve, cloneTr as A, browser as V } from "@milkdown/prose";
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";
9
10
  import Ue from "remark-gfm";
10
11
  const d = (e, t) => (Object.assign(e, {
11
12
  meta: {
12
13
  package: "@milkdown/preset-gfm",
13
14
  ...t
14
15
  }
15
- }), e), K = $e("strike_through");
16
- d(K, {
16
+ }), e), F = $e("strike_through");
17
+ d(F, {
17
18
  displayName: "Attr<strikethrough>",
18
19
  group: "Strikethrough"
19
20
  });
20
- const x = _e("strike_through", (e) => ({
21
+ const x = Pe("strike_through", (e) => ({
21
22
  parseDOM: [
22
23
  { tag: "del" },
23
24
  { style: "text-decoration", getAttrs: (t) => t === "line-through" }
24
25
  ],
25
- toDOM: (t) => ["del", e.get(K.key)(t)],
26
+ toDOM: (t) => ["del", e.get(F.key)(t)],
26
27
  parseMarkdown: {
27
28
  match: (t) => t.type === "delete",
28
29
  runner: (t, n, o) => {
@@ -44,48 +45,45 @@ d(x.ctx, {
44
45
  displayName: "MarkSchemaCtx<strikethrough>",
45
46
  group: "Strikethrough"
46
47
  });
47
- const H = h("ToggleStrikeThrough", () => () => {
48
- const e = x.type();
49
- return Ze(e, "~~");
50
- });
51
- d(H, {
48
+ const K = g("ToggleStrikeThrough", (e) => () => Ve(x.type(e)));
49
+ d(K, {
52
50
  displayName: "Command<ToggleStrikethrough>",
53
51
  group: "Strikethrough"
54
52
  });
55
- const L = ee("strikeThroughKeymap", {
53
+ const H = te("strikeThroughKeymap", {
56
54
  ToggleStrikethrough: {
57
55
  shortcuts: "Mod-Alt-x",
58
56
  command: (e) => {
59
57
  const t = e.get(M);
60
- return () => t.call(H.key);
58
+ return () => t.call(K.key);
61
59
  }
62
60
  }
63
61
  });
64
- d(L.ctx, {
62
+ d(H.ctx, {
65
63
  displayName: "KeymapCtx<strikethrough>",
66
64
  group: "Strikethrough"
67
65
  });
68
- d(L.shortcuts, {
66
+ d(H.shortcuts, {
69
67
  displayName: "Keymap<strikethrough>",
70
68
  group: "Strikethrough"
71
69
  });
72
- const re = (e = 3, t = 3) => {
73
- const n = Array(t).fill(0).map(() => R.type().createAndFill()), o = Array(t).fill(0).map(() => I.type().createAndFill()), l = Array(e).fill(0).map((r, a) => S.type().create(null, a === 0 ? o : n));
74
- return T.type().create(null, l);
75
- }, w = (e) => Ve((t) => t.type.spec.tableRole === "table")(e), b = (e, t) => {
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) => {
76
74
  const n = w(t);
77
75
  if (!n)
78
76
  return;
79
- const o = g.get(n.node);
77
+ const o = h.get(n.node);
80
78
  if (!(e < 0 || e >= o.width))
81
79
  return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {
82
80
  const r = n.node.nodeAt(l);
83
81
  if (!r)
84
82
  return;
85
- const a = l + n.start;
83
+ const s = l + n.start;
86
84
  return {
87
- pos: a,
88
- start: a + 1,
85
+ pos: s,
86
+ start: s + 1,
89
87
  node: r
90
88
  };
91
89
  }).filter((l) => l != null);
@@ -93,16 +91,16 @@ const re = (e = 3, t = 3) => {
93
91
  const n = w(t);
94
92
  if (!n)
95
93
  return;
96
- const o = g.get(n.node);
94
+ const o = h.get(n.node);
97
95
  if (!(e < 0 || e >= o.height))
98
96
  return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {
99
97
  const r = n.node.nodeAt(l);
100
98
  if (!r)
101
99
  return;
102
- const a = l + n.start;
100
+ const s = l + n.start;
103
101
  return {
104
- pos: a,
105
- start: a + 1,
102
+ pos: s,
103
+ start: s + 1,
106
104
  node: r
107
105
  };
108
106
  }).filter((l) => l != null);
@@ -110,15 +108,15 @@ const re = (e = 3, t = 3) => {
110
108
  const t = w(e);
111
109
  if (!t)
112
110
  return;
113
- const n = g.get(t.node);
111
+ const n = h.get(t.node);
114
112
  return n.cellsInRect({
115
113
  left: 0,
116
114
  right: n.width,
117
115
  top: 0,
118
116
  bottom: n.height
119
117
  }).map((l) => {
120
- const r = t.node.nodeAt(l), a = l + t.start;
121
- return { pos: a, start: a + 1, node: r };
118
+ const r = t.node.nodeAt(l), s = l + t.start;
119
+ return { pos: s, start: s + 1, node: r };
122
120
  });
123
121
  }, qe = (e) => {
124
122
  const t = Xe(e.selection);
@@ -131,191 +129,191 @@ const re = (e = 3, t = 3) => {
131
129
  }
132
130
  return e;
133
131
  };
134
- function ae(e, { map: t, tableStart: n, table: o }, l) {
135
- const r = Array(l).fill(0).reduce((i, c, m) => i + o.child(m).nodeSize, n), a = Array(t.width).fill(0).map((i, c) => {
136
- const m = o.nodeAt(t.map[c]);
137
- return R.type().createAndFill({ alignment: m == null ? void 0 : m.attrs.alignment });
132
+ function se(e, t, { map: n, tableStart: o, table: l }, r) {
133
+ 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
+ const a = l.nodeAt(n.map[m]);
135
+ return R.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
138
136
  });
139
- return e.insert(r, S.type().create(null, a)), e;
137
+ return t.insert(s, S.type(e).create(null, c)), t;
140
138
  }
141
- const se = (e) => (t) => (n) => {
139
+ const ce = (e) => (t) => (n) => {
142
140
  const o = w(n.selection), l = e === "row";
143
141
  if (o) {
144
- const r = g.get(o.node);
142
+ const r = h.get(o.node);
145
143
  if (t >= 0 && t < (l ? r.height : r.width)) {
146
- const a = r.positionAt(
144
+ const s = r.positionAt(
147
145
  l ? t : r.height - 1,
148
146
  l ? r.width - 1 : t,
149
147
  o.node
150
- ), i = n.doc.resolve(o.start + a), c = l ? y.rowSelection : y.colSelection, m = r.positionAt(l ? t : 0, l ? 0 : t, o.node), s = n.doc.resolve(o.start + m);
151
- return A(n.setSelection(c(i, s)));
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)));
152
150
  }
153
151
  }
154
152
  return n;
155
- }, Je = se("row"), Qe = se("col"), U = (e) => e[0].map((t, n) => e.map((o) => o[n])), ce = (e, t) => {
156
- const n = [], o = g.get(e);
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);
157
155
  for (let r = 0; r < o.height; r++) {
158
- const a = e.child(r), i = [];
159
- for (let c = 0; c < o.width; c++) {
160
- if (!t[r][c])
156
+ const s = e.child(r), c = [];
157
+ for (let i = 0; i < o.width; i++) {
158
+ if (!t[r][i])
161
159
  continue;
162
- const m = o.map[r * o.width + c], s = t[r][c], p = e.nodeAt(m).type.createChecked(
163
- Object.assign({}, s.attrs),
164
- s.content,
165
- s.marks
160
+ const m = o.map[r * o.width + i], a = t[r][i], p = e.nodeAt(m).type.createChecked(
161
+ Object.assign({}, a.attrs),
162
+ a.content,
163
+ a.marks
166
164
  );
167
- i.push(p);
165
+ c.push(p);
168
166
  }
169
- n.push(a.type.createChecked(a.attrs, i, a.marks));
167
+ n.push(s.type.createChecked(s.attrs, c, s.marks));
170
168
  }
171
169
  return e.type.createChecked(
172
170
  e.attrs,
173
171
  n,
174
172
  e.marks
175
173
  );
176
- }, ie = (e) => {
177
- const t = g.get(e), n = [];
174
+ }, de = (e) => {
175
+ const t = h.get(e), n = [];
178
176
  for (let o = 0; o < t.height; o++) {
179
177
  const l = [], r = {};
180
- for (let a = 0; a < t.width; a++) {
181
- const i = t.map[o * t.width + a], c = e.nodeAt(i), m = t.findCell(i);
182
- if (r[i] || m.top !== o) {
178
+ for (let s = 0; s < t.width; s++) {
179
+ const c = t.map[o * t.width + s], i = e.nodeAt(c), m = t.findCell(c);
180
+ if (r[c] || m.top !== o) {
183
181
  l.push(null);
184
182
  continue;
185
183
  }
186
- r[i] = !0, l.push(c);
184
+ r[c] = !0, l.push(i);
187
185
  }
188
186
  n.push(l);
189
187
  }
190
188
  return n;
191
- }, de = (e, t, n, o) => {
192
- const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), a = r.length % 2 === 0 ? 1 : 0;
193
- let i;
194
- return o === -1 && l === 1 ? i = n[0] - 1 : o === 1 && l === -1 ? i = n[n.length - 1] - a + 1 : i = l === -1 ? n[0] : n[n.length - 1] - a, e.splice(i, 0, ...r), e;
189
+ }, me = (e, t, n, o) => {
190
+ const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;
191
+ let c;
192
+ 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;
195
193
  }, Ye = (e, t, n, o) => {
196
- let l = U(ie(e.node));
197
- return l = de(l, t, n, o), l = U(l), ce(e.node, l);
194
+ let l = X(de(e.node));
195
+ return l = me(l, t, n, o), l = X(l), ie(e.node, l);
198
196
  }, et = (e, t, n, o) => {
199
- let l = ie(e.node);
200
- return l = de(l, t, n, o), ce(e.node, l);
201
- }, X = (e, t) => {
197
+ let l = de(e.node);
198
+ return l = me(l, t, n, o), ie(e.node, l);
199
+ }, q = (e, t) => {
202
200
  let n = e, o = e;
203
- for (let s = e; s >= 0; s--) {
204
- const u = b(s, t.selection);
201
+ for (let a = e; a >= 0; a--) {
202
+ const u = b(a, t.selection);
205
203
  u && u.forEach((p) => {
206
- const f = p.node.attrs.colspan + s - 1;
207
- f >= n && (n = s), f > o && (o = f);
204
+ const f = p.node.attrs.colspan + a - 1;
205
+ f >= n && (n = a), f > o && (o = f);
208
206
  });
209
207
  }
210
- for (let s = e; s <= o; s++) {
211
- const u = b(s, t.selection);
208
+ for (let a = e; a <= o; a++) {
209
+ const u = b(a, t.selection);
212
210
  u && u.forEach((p) => {
213
- const f = p.node.attrs.colspan + s - 1;
211
+ const f = p.node.attrs.colspan + a - 1;
214
212
  p.node.attrs.colspan > 1 && f > o && (o = f);
215
213
  });
216
214
  }
217
215
  const l = [];
218
- for (let s = n; s <= o; s++) {
219
- const u = b(s, t.selection);
220
- u && u.length && l.push(s);
216
+ for (let a = n; a <= o; a++) {
217
+ const u = b(a, t.selection);
218
+ u && u.length && l.push(a);
221
219
  }
222
220
  n = l[0], o = l[l.length - 1];
223
- const r = b(n, t.selection), a = C(0, t.selection), i = t.doc.resolve(
221
+ const r = b(n, t.selection), s = C(0, t.selection), c = t.doc.resolve(
224
222
  r[r.length - 1].pos
225
223
  );
226
- let c;
227
- for (let s = o; s >= n; s--) {
228
- const u = b(s, t.selection);
224
+ let i;
225
+ for (let a = o; a >= n; a--) {
226
+ const u = b(a, t.selection);
229
227
  if (u && u.length) {
230
- for (let p = a.length - 1; p >= 0; p--)
231
- if (a[p].pos === u[0].pos) {
232
- c = u[0];
228
+ for (let p = s.length - 1; p >= 0; p--)
229
+ if (s[p].pos === u[0].pos) {
230
+ i = u[0];
233
231
  break;
234
232
  }
235
- if (c)
233
+ if (i)
236
234
  break;
237
235
  }
238
236
  }
239
- const m = t.doc.resolve(c.pos);
240
- return { $anchor: i, $head: m, indexes: l };
241
- }, q = (e, t) => {
237
+ const m = t.doc.resolve(i.pos);
238
+ return { $anchor: c, $head: m, indexes: l };
239
+ }, J = (e, t) => {
242
240
  let n = e, o = e;
243
- for (let s = e; s >= 0; s--)
244
- C(s, t.selection).forEach((p) => {
245
- const f = p.node.attrs.rowspan + s - 1;
246
- f >= n && (n = s), f > o && (o = f);
241
+ for (let a = e; a >= 0; a--)
242
+ C(a, t.selection).forEach((p) => {
243
+ const f = p.node.attrs.rowspan + a - 1;
244
+ f >= n && (n = a), f > o && (o = f);
247
245
  });
248
- for (let s = e; s <= o; s++)
249
- C(s, t.selection).forEach((p) => {
250
- const f = p.node.attrs.rowspan + s - 1;
246
+ for (let a = e; a <= o; a++)
247
+ C(a, t.selection).forEach((p) => {
248
+ const f = p.node.attrs.rowspan + a - 1;
251
249
  p.node.attrs.rowspan > 1 && f > o && (o = f);
252
250
  });
253
251
  const l = [];
254
- for (let s = n; s <= o; s++) {
255
- const u = C(s, t.selection);
256
- u && u.length && l.push(s);
252
+ for (let a = n; a <= o; a++) {
253
+ const u = C(a, t.selection);
254
+ u && u.length && l.push(a);
257
255
  }
258
256
  n = l[0], o = l[l.length - 1];
259
- const r = C(n, t.selection), a = b(0, t.selection), i = t.doc.resolve(r[r.length - 1].pos);
260
- let c;
261
- for (let s = o; s >= n; s--) {
262
- const u = C(s, t.selection);
257
+ const r = C(n, t.selection), s = b(0, t.selection), c = t.doc.resolve(r[r.length - 1].pos);
258
+ let i;
259
+ for (let a = o; a >= n; a--) {
260
+ const u = C(a, t.selection);
263
261
  if (u && u.length) {
264
- for (let p = a.length - 1; p >= 0; p--)
265
- if (a[p].pos === u[0].pos) {
266
- c = u[0];
262
+ for (let p = s.length - 1; p >= 0; p--)
263
+ if (s[p].pos === u[0].pos) {
264
+ i = u[0];
267
265
  break;
268
266
  }
269
- if (c)
267
+ if (i)
270
268
  break;
271
269
  }
272
270
  }
273
- const m = t.doc.resolve(c.pos);
274
- return { $anchor: i, $head: m, indexes: l };
271
+ const m = t.doc.resolve(i.pos);
272
+ return { $anchor: c, $head: m, indexes: l };
275
273
  };
276
274
  function tt(e, t, n, o = !0) {
277
275
  const l = w(e.selection);
278
276
  if (!l)
279
277
  return e;
280
- const { indexes: r } = X(t, e), { indexes: a } = X(n, e);
278
+ const { indexes: r } = q(t, e), { indexes: s } = q(n, e);
281
279
  if (r.includes(n))
282
280
  return e;
283
- const i = Ye(
281
+ const c = Ye(
284
282
  l,
285
283
  r,
286
- a,
284
+ s,
287
285
  0
288
- ), c = A(e).replaceWith(
286
+ ), i = A(e).replaceWith(
289
287
  l.pos,
290
288
  l.pos + l.node.nodeSize,
291
- i
289
+ c
292
290
  );
293
291
  if (!o)
294
- return c;
295
- const m = g.get(i), s = l.start, u = n, p = m.positionAt(m.height - 1, u, i), f = c.doc.resolve(s + p), $ = y.colSelection, _ = m.positionAt(0, u, i), P = c.doc.resolve(s + _);
296
- return c.setSelection($(f, P));
292
+ 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);
294
+ return i.setSelection($(f, _));
297
295
  }
298
296
  function ot(e, t, n, o = !0) {
299
297
  const l = w(e.selection);
300
298
  if (!l)
301
299
  return e;
302
- const { indexes: r } = q(t, e), { indexes: a } = q(n, e);
300
+ const { indexes: r } = J(t, e), { indexes: s } = J(n, e);
303
301
  if (r.includes(n))
304
302
  return e;
305
- const i = et(
303
+ const c = et(
306
304
  l,
307
305
  r,
308
- a,
306
+ s,
309
307
  0
310
- ), c = A(e).replaceWith(
308
+ ), i = A(e).replaceWith(
311
309
  l.pos,
312
310
  l.pos + l.node.nodeSize,
313
- i
311
+ c
314
312
  );
315
313
  if (!o)
316
- return c;
317
- const m = g.get(i), s = l.start, u = n, p = m.positionAt(u, m.width - 1, i), f = c.doc.resolve(s + p), $ = y.rowSelection, _ = m.positionAt(u, 0, i), P = c.doc.resolve(s + _);
318
- return c.setSelection($(f, P));
314
+ 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);
316
+ return i.setSelection($(f, _));
319
317
  }
320
318
  const v = Be({
321
319
  tableGroup: "block",
@@ -334,10 +332,10 @@ const v = Be({
334
332
  parseMarkdown: {
335
333
  match: (e) => e.type === "table",
336
334
  runner: (e, t, n) => {
337
- const o = t.align, l = t.children.map((r, a) => ({
335
+ const o = t.align, l = t.children.map((r, s) => ({
338
336
  ...r,
339
337
  align: o,
340
- isHeader: a === 0
338
+ isHeader: s === 0
341
339
  }));
342
340
  e.openNode(n), e.next(l), e.closeNode();
343
341
  }
@@ -369,9 +367,9 @@ const S = k("table_row", () => ({
369
367
  parseMarkdown: {
370
368
  match: (e) => e.type === "tableRow",
371
369
  runner: (e, t, n) => {
372
- const o = t.align, l = t.children.map((r, a) => ({
370
+ const o = t.align, l = t.children.map((r, s) => ({
373
371
  ...r,
374
- align: o[a],
372
+ align: o[s],
375
373
  isHeader: t.isHeader
376
374
  }));
377
375
  e.openNode(n), e.next(l), e.closeNode();
@@ -440,69 +438,70 @@ d(I.ctx, {
440
438
  displayName: "NodeSchemaCtx<tableHeader>",
441
439
  group: "Table"
442
440
  });
443
- const me = te(() => new Y(
441
+ const ue = oe((e) => new ee(
444
442
  /^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
445
- (e, t, n, o) => {
446
- var i, c;
447
- const l = e.doc.resolve(n);
448
- if (!l.node(-1).canReplaceWith(l.index(-1), l.indexAfter(-1), T.type()))
443
+ (t, n, o, l) => {
444
+ var i, m;
445
+ const r = t.doc.resolve(o);
446
+ if (!r.node(-1).canReplaceWith(r.index(-1), r.indexAfter(-1), T.type(e)))
449
447
  return null;
450
- const r = re(
451
- Number((i = t.groups) == null ? void 0 : i.row),
452
- Number((c = t.groups) == null ? void 0 : c.col)
453
- ), a = e.tr.replaceRangeWith(n, o, r).scrollIntoView();
454
- return a.setSelection(Ee.create(a.doc, n + 3));
448
+ const s = ae(
449
+ e,
450
+ Number((i = n.groups) == null ? void 0 : i.row),
451
+ Number((m = n.groups) == null ? void 0 : m.col)
452
+ ), c = t.tr.replaceRangeWith(o, l, s);
453
+ return c.setSelection(Ee.create(c.doc, o + 3)).scrollIntoView();
455
454
  }
456
455
  ));
457
- d(me, {
456
+ d(ue, {
458
457
  displayName: "InputRule<insertTableInputRule>",
459
458
  group: "Table"
460
459
  });
461
- const F = h("GoToPrevTableCell", () => () => ne(-1));
462
- d(F, {
460
+ const L = g("GoToPrevTableCell", () => () => le(-1));
461
+ d(L, {
463
462
  displayName: "Command<goToPrevTableCellCommand>",
464
463
  group: "Table"
465
464
  });
466
- const W = h("GoToNextTableCell", () => () => ne(1));
465
+ const W = g("GoToNextTableCell", () => () => le(1));
467
466
  d(W, {
468
467
  displayName: "Command<goToNextTableCellCommand>",
469
468
  group: "Table"
470
469
  });
471
- const z = h("BreakTable", () => () => (e, t) => {
472
- if (!N(e))
470
+ const G = g("BreakTable", (e) => () => (t, n) => {
471
+ if (!N(t))
473
472
  return !1;
474
- const { $head: n } = e.selection, o = n.after(), l = e.tr.replaceWith(o, o, Q.type().createAndFill());
475
- return l.setSelection(oe.near(l.doc.resolve(o), 1)).scrollIntoView(), t == null || t(l), !0;
473
+ const { $head: o } = t.selection, l = o.after(), r = t.tr.replaceWith(l, l, Y.type(e).createAndFill());
474
+ return r.setSelection(ne.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
476
475
  });
477
- d(z, {
476
+ d(G, {
478
477
  displayName: "Command<breakTableCommand>",
479
478
  group: "Table"
480
479
  });
481
- const ue = h("InsertTable", () => ({ row: e, col: t } = {}) => (n, o) => {
482
- const { selection: l, tr: r } = n, { from: a } = l, i = re(e, t), c = r.replaceSelectionWith(i), m = oe.findFrom(c.doc.resolve(a), 1, !0);
483
- return m && (o == null || o(c.setSelection(m))), !0;
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);
482
+ return a && m.setSelection(a), l == null || l(m), !0;
484
483
  });
485
- d(ue, {
484
+ d(pe, {
486
485
  displayName: "Command<insertTableCommand>",
487
486
  group: "Table"
488
487
  });
489
- const pe = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
488
+ const fe = g("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
490
489
  const { tr: l } = n;
491
490
  return !!(o == null ? void 0 : o(ot(l, e ?? 0, t ?? 0, !0)));
492
491
  });
493
- d(pe, {
492
+ d(fe, {
494
493
  displayName: "Command<moveRowCommand>",
495
494
  group: "Table"
496
495
  });
497
- const fe = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
496
+ const ge = g("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
498
497
  const { tr: l } = n;
499
498
  return !!(o == null ? void 0 : o(tt(l, e ?? 0, t ?? 0, !0)));
500
499
  });
501
- d(fe, {
500
+ d(ge, {
502
501
  displayName: "Command<moveColCommand>",
503
502
  group: "Table"
504
503
  });
505
- const he = h("SelectRow", () => (e = 0) => (t, n) => {
504
+ const he = g("SelectRow", () => (e = 0) => (t, n) => {
506
505
  const { tr: o } = t;
507
506
  return !!(n == null ? void 0 : n(Je(e)(o)));
508
507
  });
@@ -510,75 +509,75 @@ d(he, {
510
509
  displayName: "Command<selectRowCommand>",
511
510
  group: "Table"
512
511
  });
513
- const ge = h("SelectCol", () => (e = 0) => (t, n) => {
512
+ const be = g("SelectCol", () => (e = 0) => (t, n) => {
514
513
  const { tr: o } = t;
515
514
  return !!(n == null ? void 0 : n(Qe(e)(o)));
516
515
  });
517
- d(ge, {
516
+ d(be, {
518
517
  displayName: "Command<selectColCommand>",
519
518
  group: "Table"
520
519
  });
521
- const be = h("SelectTable", () => () => (e, t) => {
520
+ const Ce = g("SelectTable", () => () => (e, t) => {
522
521
  const { tr: n } = e;
523
522
  return !!(t == null ? void 0 : t(qe(n)));
524
523
  });
525
- d(be, {
524
+ d(Ce, {
526
525
  displayName: "Command<selectTableCommand>",
527
526
  group: "Table"
528
527
  });
529
- const Ce = h("DeleteSelectedCells", () => () => (e, t) => {
528
+ const ye = g("DeleteSelectedCells", () => () => (e, t) => {
530
529
  const { selection: n } = e;
531
530
  if (!(n instanceof y))
532
531
  return !1;
533
532
  const o = n.isRowSelection(), l = n.isColSelection();
534
- return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
533
+ return o && l ? Fe(e, t) : l ? Ke(e, t) : He(e, t);
535
534
  });
536
- d(Ce, {
535
+ d(ye, {
537
536
  displayName: "Command<deleteSelectedCellsCommand>",
538
537
  group: "Table"
539
538
  });
540
- const ye = h("AddColBefore", () => () => Fe);
541
- d(ye, {
539
+ const ke = g("AddColBefore", () => () => Le);
540
+ d(ke, {
542
541
  displayName: "Command<addColBeforeCommand>",
543
542
  group: "Table"
544
543
  });
545
- const ke = h("AddColAfter", () => () => We);
546
- d(ke, {
544
+ const we = g("AddColAfter", () => () => We);
545
+ d(we, {
547
546
  displayName: "Command<addColAfterCommand>",
548
547
  group: "Table"
549
548
  });
550
- const we = h("AddRowBefore", () => () => (e, t) => {
551
- if (!N(e))
549
+ const Ne = g("AddRowBefore", (e) => () => (t, n) => {
550
+ if (!N(t))
552
551
  return !1;
553
- if (t) {
554
- const n = le(e);
555
- t(ae(e.tr, n, n.top));
552
+ if (n) {
553
+ const o = re(t);
554
+ n(se(e, t.tr, o, o.top));
556
555
  }
557
556
  return !0;
558
557
  });
559
- d(we, {
558
+ d(Ne, {
560
559
  displayName: "Command<addRowBeforeCommand>",
561
560
  group: "Table"
562
561
  });
563
- const Ne = h("AddRowAfter", () => () => (e, t) => {
564
- if (!N(e))
562
+ const Te = g("AddRowAfter", (e) => () => (t, n) => {
563
+ if (!N(t))
565
564
  return !1;
566
- if (t) {
567
- const n = le(e);
568
- t(ae(e.tr, n, n.bottom));
565
+ if (n) {
566
+ const o = re(t);
567
+ n(se(e, t.tr, o, o.bottom));
569
568
  }
570
569
  return !0;
571
570
  });
572
- d(Ne, {
571
+ d(Te, {
573
572
  displayName: "Command<addRowAfterCommand>",
574
573
  group: "Table"
575
574
  });
576
- const Te = h("SetAlign", () => (e = "left") => ze("alignment", e));
577
- d(Te, {
575
+ const Se = g("SetAlign", () => (e = "left") => Ge("alignment", e));
576
+ d(Se, {
578
577
  displayName: "Command<setAlignCommand>",
579
578
  group: "Table"
580
579
  });
581
- const G = ee("tableKeymap", {
580
+ const z = te("tableKeymap", {
582
581
  NextCell: {
583
582
  shortcuts: ["Mod-]", "Tab"],
584
583
  command: (e) => {
@@ -590,26 +589,26 @@ const G = ee("tableKeymap", {
590
589
  shortcuts: ["Mod-[", "Shift-Tab"],
591
590
  command: (e) => {
592
591
  const t = e.get(M);
593
- return () => t.call(F.key);
592
+ return () => t.call(L.key);
594
593
  }
595
594
  },
596
595
  ExitTable: {
597
596
  shortcuts: ["Mod-Enter"],
598
597
  command: (e) => {
599
598
  const t = e.get(M);
600
- return () => t.call(z.key);
599
+ return () => t.call(G.key);
601
600
  }
602
601
  }
603
602
  });
604
- d(G.ctx, {
603
+ d(z.ctx, {
605
604
  displayName: "KeymapCtx<table>",
606
605
  group: "Table"
607
606
  });
608
- d(G.shortcuts, {
607
+ d(z.shortcuts, {
609
608
  displayName: "Keymap<table>",
610
609
  group: "Table"
611
610
  });
612
- const E = "footnote_definition", J = "footnoteDefinition", j = k("footnote_definition", () => ({
611
+ const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_definition", () => ({
613
612
  group: "block",
614
613
  content: "block+",
615
614
  defining: !0,
@@ -645,7 +644,7 @@ const E = "footnote_definition", J = "footnoteDefinition", j = k("footnote_defin
645
644
  ];
646
645
  },
647
646
  parseMarkdown: {
648
- match: ({ type: e }) => e === J,
647
+ match: ({ type: e }) => e === Q,
649
648
  runner: (e, t, n) => {
650
649
  e.openNode(n, {
651
650
  label: t.label
@@ -655,7 +654,7 @@ const E = "footnote_definition", J = "footnoteDefinition", j = k("footnote_defin
655
654
  toMarkdown: {
656
655
  match: (e) => e.type.name === E,
657
656
  runner: (e, t) => {
658
- e.openNode(J, void 0, {
657
+ e.openNode(Q, void 0, {
659
658
  label: t.attrs.label,
660
659
  identifier: t.attrs.label
661
660
  }).next(t.content).closeNode();
@@ -729,7 +728,7 @@ d(Z.node, {
729
728
  displayName: "NodeSchema<footnodeRef>",
730
729
  group: "footnote"
731
730
  });
732
- const Se = Ie.extendSchema((e) => (t) => {
731
+ const Re = Ie.extendSchema((e) => (t) => {
733
732
  const n = e(t);
734
733
  return {
735
734
  ...n,
@@ -773,8 +772,8 @@ const Se = Ie.extendSchema((e) => (t) => {
773
772
  n.parseMarkdown.runner(o, l, r);
774
773
  return;
775
774
  }
776
- const a = l.label != null ? `${l.label}.` : "•", i = l.checked != null ? !!l.checked : null, c = l.label != null ? "ordered" : "bullet", m = l.spread != null ? `${l.spread}` : "true";
777
- o.openNode(r, { label: a, listType: c, spread: m, checked: i }), o.next(l.children), o.closeNode();
775
+ const s = l.label != null ? `${l.label}.` : "•", c = l.checked != null ? !!l.checked : null, i = l.label != null ? "ordered" : "bullet", m = l.spread != null ? `${l.spread}` : "true";
776
+ o.openNode(r, { label: s, listType: i, spread: m, checked: c }), o.next(l.children), o.closeNode();
778
777
  }
779
778
  },
780
779
  toMarkdown: {
@@ -784,154 +783,162 @@ const Se = Ie.extendSchema((e) => (t) => {
784
783
  n.toMarkdown.runner(o, l);
785
784
  return;
786
785
  }
787
- const r = l.attrs.label, a = l.attrs.listType, i = l.attrs.spread === "true", c = l.attrs.checked;
788
- o.openNode("listItem", void 0, { label: r, listType: a, spread: i, checked: c }), o.next(l.content), o.closeNode();
786
+ const r = l.attrs.label, s = l.attrs.listType, c = l.attrs.spread === "true", i = l.attrs.checked;
787
+ o.openNode("listItem", void 0, { label: r, listType: s, spread: c, checked: i }), o.next(l.content), o.closeNode();
789
788
  }
790
789
  }
791
790
  };
792
791
  });
793
- d(Se, {
792
+ d(Re, {
794
793
  displayName: "NodeSchema<listItem>",
795
794
  group: "ListItem"
796
795
  });
797
- const Re = te(() => new Y(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
798
- var s;
796
+ const Me = oe(() => new ee(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
797
+ var a;
799
798
  const l = e.doc.resolve(n);
800
- let r = 0, a = l.node(r);
801
- for (; a && a.type.name !== "list_item"; )
802
- r--, a = l.node(r);
803
- if (!a || a.attrs.checked != null)
799
+ let r = 0, s = l.node(r);
800
+ for (; s && s.type.name !== "list_item"; )
801
+ r--, s = l.node(r);
802
+ if (!s || s.attrs.checked != null)
804
803
  return null;
805
- const i = ((s = t.groups) == null ? void 0 : s.checked) === "x", c = l.before(r), m = e.tr;
806
- return m.deleteRange(n, o).setNodeMarkup(c, void 0, { ...a.attrs, checked: i }), m;
804
+ const c = ((a = t.groups) == null ? void 0 : a.checked) === "x", i = l.before(r), m = e.tr;
805
+ return m.deleteRange(n, o).setNodeMarkup(i, void 0, { ...s.attrs, checked: c }), m;
807
806
  }));
808
- d(Re, {
807
+ d(Me, {
809
808
  displayName: "InputRule<wrapInTaskListInputRule>",
810
809
  group: "ListItem"
811
810
  });
812
811
  const nt = [
813
- L,
814
- G
812
+ H,
813
+ z
815
814
  ].flat(), lt = [
816
- me,
817
- Re
818
- ], Me = B(() => {
819
- const e = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), t = (o) => o.type === Q.type(), n = (o) => t(o) && o.nodeSize === 2;
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;
820
819
  return new Oe({
821
- key: e,
820
+ key: t,
822
821
  props: {
823
822
  handleDOMEvents: {
824
- compositionstart(o) {
825
- const { state: l, dispatch: r } = o, { tr: a, selection: i } = l, { $from: c } = i;
826
- return V.safari && N(l) && i.empty && n(c.parent) && r(a.insertText("⁠", c.start())), !1;
823
+ compositionstart(l) {
824
+ 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;
827
826
  },
828
- compositionend(o) {
829
- const { state: l, dispatch: r } = o, { tr: a, selection: i } = l, { $from: c } = i;
830
- return V.safari && N(l) && i.empty && t(c.parent) && c.parent.textContent.startsWith("⁠") && r(a.delete(c.start(), c.start() + 1)), !1;
827
+ compositionend(l) {
828
+ 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;
831
830
  }
832
831
  }
833
832
  }
834
833
  });
835
834
  });
836
- d(Me, {
835
+ d(Ae, {
837
836
  displayName: "Prose<autoInsertZeroSpaceInTablePlugin>",
838
837
  group: "Prose"
839
838
  });
840
- const Ae = B(() => Ge({}));
841
- d(Ae, {
839
+ const xe = B(() => ze({}));
840
+ d(xe, {
842
841
  displayName: "Prose<columnResizingPlugin>",
843
842
  group: "Prose"
844
843
  });
845
- const xe = B(() => je());
846
- d(xe, {
844
+ const ve = B(() => je());
845
+ d(ve, {
847
846
  displayName: "Prose<tableEditingPlugin>",
848
847
  group: "Prose"
849
848
  });
850
- const ve = Pe(() => Ue);
851
- d(ve, {
849
+ const V = _e("remarkGFM", () => Ue);
850
+ d(V.plugin, {
852
851
  displayName: "Remark<remarkGFMPlugin>",
853
852
  group: "Remark"
854
853
  });
854
+ d(V.options, {
855
+ displayName: "RemarkConfig<remarkGFMPlugin>",
856
+ group: "Remark"
857
+ });
855
858
  const rt = [
856
- Me,
857
859
  Ae,
858
860
  xe,
859
- ve
860
- ], at = [
861
- Se,
861
+ ve,
862
+ V
863
+ ].flat(), at = [
864
+ Re,
862
865
  T,
863
866
  S,
864
867
  I,
865
868
  R,
866
869
  j,
867
870
  Z,
868
- K,
871
+ F,
869
872
  x
870
873
  ].flat(), st = [
871
874
  W,
872
- F,
873
- z,
874
- ue,
875
+ L,
876
+ G,
875
877
  pe,
876
878
  fe,
877
- he,
878
879
  ge,
880
+ he,
879
881
  be,
880
882
  Ce,
881
- we,
882
- Ne,
883
883
  ye,
884
- ke,
884
+ Ne,
885
885
  Te,
886
- H
887
- ], bt = [at, lt, nt, rt, st].flat();
886
+ ke,
887
+ we,
888
+ Se,
889
+ K
890
+ ], Ct = [at, lt, nt, rt, st].flat();
888
891
  export {
889
- ke as addColAfterCommand,
890
- ye as addColBeforeCommand,
891
- Ne as addRowAfterCommand,
892
- we as addRowBeforeCommand,
893
- ae as addRowWithAlignment,
894
- z as breakTableCommand,
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,
895
900
  st as commands,
896
- re as createTable,
897
- Ce as deleteSelectedCellsCommand,
898
- Se as extendListItemSchemaForTask,
901
+ ae as createTable,
902
+ ye as deleteSelectedCellsCommand,
903
+ Re as extendListItemSchemaForTask,
899
904
  w as findTable,
900
905
  j as footnoteDefinitionSchema,
901
906
  Z as footnoteReferenceSchema,
902
907
  Xe as getAllCellsInTable,
903
908
  b as getCellsInCol,
904
909
  C as getCellsInRow,
905
- bt as gfm,
910
+ Ct as gfm,
906
911
  W as goToNextTableCellCommand,
907
- F as goToPrevTableCellCommand,
912
+ L as goToPrevTableCellCommand,
908
913
  lt as inputrules,
909
- ue as insertTableCommand,
910
- me as insertTableInputRule,
914
+ pe as insertTableCommand,
915
+ ue as insertTableInputRule,
911
916
  nt as keymap,
912
917
  tt as moveCol,
913
- fe as moveColCommand,
918
+ ge as moveColCommand,
914
919
  ot as moveRow,
915
- pe as moveRowCommand,
920
+ fe as moveRowCommand,
916
921
  rt as plugins,
922
+ V as remarkGFMPlugin,
917
923
  at as schema,
918
924
  Qe as selectCol,
919
- ge as selectColCommand,
920
- se as selectLine,
925
+ be as selectColCommand,
926
+ ce as selectLine,
921
927
  Je as selectRow,
922
928
  he as selectRowCommand,
923
929
  qe as selectTable,
924
- be as selectTableCommand,
925
- Te as setAlignCommand,
926
- K as strikethroughAttr,
927
- L as strikethroughKeymap,
930
+ Ce as selectTableCommand,
931
+ Se as setAlignCommand,
932
+ F as strikethroughAttr,
933
+ H as strikethroughKeymap,
928
934
  x as strikethroughSchema,
929
935
  R as tableCellSchema,
936
+ ve as tableEditingPlugin,
930
937
  I as tableHeaderSchema,
931
- G as tableKeymap,
938
+ z as tableKeymap,
932
939
  S as tableRowSchema,
933
940
  T as tableSchema,
934
- H as toggleStrikethroughCommand,
935
- Re as wrapInTaskListInputRule
941
+ K as toggleStrikethroughCommand,
942
+ Me as wrapInTaskListInputRule
936
943
  };
937
944
  //# sourceMappingURL=index.es.js.map