@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/__internal__/with-meta.d.ts +1 -1
- package/lib/__internal__/with-meta.d.ts.map +1 -1
- package/lib/composed/commands.d.ts +1 -1
- package/lib/composed/inputrules.d.ts +2 -1
- package/lib/composed/inputrules.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +272 -240
- package/lib/index.es.js.map +1 -1
- package/lib/mark/strike-through.d.ts +1 -0
- package/lib/mark/strike-through.d.ts.map +1 -1
- package/lib/node/table/index.d.ts.map +1 -1
- package/lib/node/table/utils.d.ts +7 -7
- package/lib/node/table/utils.d.ts.map +1 -1
- package/lib/plugin/remark-gfm-plugin.d.ts +3 -1
- package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/__internal__/with-meta.ts +1 -4
- package/src/composed/inputrules.ts +6 -1
- package/src/index.ts +2 -2
- package/src/mark/strike-through.ts +12 -1
- package/src/node/table/index.ts +6 -5
- package/src/node/table/utils.ts +39 -51
- package/src/plugin/auto-insert-zero-space-plugin.ts +4 -4
- package/src/plugin/remark-gfm-plugin.ts +3 -1
package/lib/index.es.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import { expectDomTypeError as O } from "@milkdown/exception";
|
|
2
|
-
import { paragraphSchema as
|
|
3
|
-
import { InputRule as
|
|
4
|
-
import { $markAttr as
|
|
5
|
-
import { commandsCtx as
|
|
6
|
-
import { TextSelection as
|
|
7
|
-
import { TableMap as
|
|
8
|
-
import { findParentNode as
|
|
9
|
-
import { toggleMark as
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
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
|
|
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(
|
|
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(
|
|
43
|
+
d(T.mark, {
|
|
41
44
|
displayName: "MarkSchema<strikethrough>",
|
|
42
45
|
group: "Strikethrough"
|
|
43
46
|
});
|
|
44
|
-
d(
|
|
47
|
+
d(T.ctx, {
|
|
45
48
|
displayName: "MarkSchemaCtx<strikethrough>",
|
|
46
49
|
group: "Strikethrough"
|
|
47
50
|
});
|
|
48
|
-
const
|
|
49
|
-
d(
|
|
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
|
|
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(
|
|
58
|
-
return () => t.call(
|
|
65
|
+
const t = e.get(A);
|
|
66
|
+
return () => t.call(H.key);
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
});
|
|
62
|
-
d(
|
|
70
|
+
d(L.ctx, {
|
|
63
71
|
displayName: "KeymapCtx<strikethrough>",
|
|
64
72
|
group: "Strikethrough"
|
|
65
73
|
});
|
|
66
|
-
d(
|
|
74
|
+
d(L.shortcuts, {
|
|
67
75
|
displayName: "Keymap<strikethrough>",
|
|
68
76
|
group: "Strikethrough"
|
|
69
77
|
});
|
|
70
|
-
|
|
71
|
-
const o = Array(n).fill(0).map(() =>
|
|
72
|
-
return
|
|
73
|
-
}
|
|
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 =
|
|
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
|
-
}
|
|
102
|
+
}
|
|
103
|
+
function C(e, t) {
|
|
91
104
|
const n = w(t);
|
|
92
105
|
if (!n)
|
|
93
106
|
return;
|
|
94
|
-
const o =
|
|
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
|
-
}
|
|
120
|
+
}
|
|
121
|
+
function Je(e) {
|
|
108
122
|
const t = w(e);
|
|
109
123
|
if (!t)
|
|
110
124
|
return;
|
|
111
|
-
const n =
|
|
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
|
-
}
|
|
122
|
-
|
|
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
|
|
142
|
+
return x(e.setSelection(new y(l, n)));
|
|
128
143
|
}
|
|
129
144
|
}
|
|
130
145
|
return e;
|
|
131
|
-
}
|
|
132
|
-
function
|
|
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
|
|
150
|
+
return M.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
|
|
136
151
|
});
|
|
137
|
-
return t.insert(s,
|
|
152
|
+
return t.insert(s, R.type(e).create(null, c)), t;
|
|
138
153
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
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
|
-
}
|
|
175
|
-
|
|
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
|
-
}
|
|
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
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
}
|
|
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
|
|
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 } =
|
|
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 =
|
|
309
|
+
const c = tt(
|
|
282
310
|
l,
|
|
283
311
|
r,
|
|
284
312
|
s,
|
|
285
313
|
0
|
|
286
|
-
), i =
|
|
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 =
|
|
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
|
|
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 } =
|
|
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 =
|
|
331
|
+
const c = ot(
|
|
304
332
|
l,
|
|
305
333
|
r,
|
|
306
334
|
s,
|
|
307
335
|
0
|
|
308
|
-
), i =
|
|
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 =
|
|
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 =
|
|
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
|
-
}),
|
|
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(
|
|
385
|
+
d(S.node, {
|
|
358
386
|
displayName: "NodeSchema<table>",
|
|
359
387
|
group: "Table"
|
|
360
388
|
});
|
|
361
|
-
d(
|
|
389
|
+
d(S.ctx, {
|
|
362
390
|
displayName: "NodeSchemaCtx<table>",
|
|
363
391
|
group: "Table"
|
|
364
392
|
});
|
|
365
|
-
const
|
|
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(
|
|
413
|
+
d(R.node, {
|
|
386
414
|
displayName: "NodeSchema<tableRow>",
|
|
387
415
|
group: "Table"
|
|
388
416
|
});
|
|
389
|
-
d(
|
|
417
|
+
d(R.ctx, {
|
|
390
418
|
displayName: "NodeSchemaCtx<tableRow>",
|
|
391
419
|
group: "Table"
|
|
392
420
|
});
|
|
393
|
-
const
|
|
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(
|
|
437
|
+
d(M.node, {
|
|
410
438
|
displayName: "NodeSchema<tableCell>",
|
|
411
439
|
group: "Table"
|
|
412
440
|
});
|
|
413
|
-
d(
|
|
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
|
|
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),
|
|
474
|
+
if (!r.node(-1).canReplaceWith(r.index(-1), r.indexAfter(-1), S.type(e)))
|
|
447
475
|
return null;
|
|
448
|
-
const s =
|
|
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(
|
|
481
|
+
return c.setSelection(De.create(c.doc, o + 3)).scrollIntoView();
|
|
454
482
|
}
|
|
455
483
|
));
|
|
456
|
-
d(
|
|
484
|
+
d(pe, {
|
|
457
485
|
displayName: "InputRule<insertTableInputRule>",
|
|
458
486
|
group: "Table"
|
|
459
487
|
});
|
|
460
|
-
const
|
|
461
|
-
d(
|
|
488
|
+
const W = h("GoToPrevTableCell", () => () => le(-1));
|
|
489
|
+
d(W, {
|
|
462
490
|
displayName: "Command<goToPrevTableCellCommand>",
|
|
463
491
|
group: "Table"
|
|
464
492
|
});
|
|
465
|
-
const
|
|
466
|
-
d(
|
|
493
|
+
const G = h("GoToNextTableCell", () => () => le(1));
|
|
494
|
+
d(G, {
|
|
467
495
|
displayName: "Command<goToNextTableCellCommand>",
|
|
468
496
|
group: "Table"
|
|
469
497
|
});
|
|
470
|
-
const
|
|
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,
|
|
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(
|
|
504
|
+
d(z, {
|
|
477
505
|
displayName: "Command<breakTableCommand>",
|
|
478
506
|
group: "Table"
|
|
479
507
|
});
|
|
480
|
-
const
|
|
481
|
-
const { selection: r, tr: s } = o, { from: c } = r, i =
|
|
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(
|
|
512
|
+
d(fe, {
|
|
485
513
|
displayName: "Command<insertTableCommand>",
|
|
486
514
|
group: "Table"
|
|
487
515
|
});
|
|
488
|
-
const
|
|
516
|
+
const he = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
489
517
|
const { tr: l } = n;
|
|
490
|
-
return !!(o == null ? void 0 : o(
|
|
518
|
+
return !!(o == null ? void 0 : o(lt(l, e ?? 0, t ?? 0, !0)));
|
|
491
519
|
});
|
|
492
|
-
d(
|
|
520
|
+
d(he, {
|
|
493
521
|
displayName: "Command<moveRowCommand>",
|
|
494
522
|
group: "Table"
|
|
495
523
|
});
|
|
496
|
-
const ge =
|
|
524
|
+
const ge = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
497
525
|
const { tr: l } = n;
|
|
498
|
-
return !!(o == null ? void 0 : o(
|
|
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
|
|
532
|
+
const be = h("SelectRow", () => (e = 0) => (t, n) => {
|
|
505
533
|
const { tr: o } = t;
|
|
506
|
-
return !!(n == null ? void 0 : n(
|
|
534
|
+
return !!(n == null ? void 0 : n(Ye(e)(o)));
|
|
507
535
|
});
|
|
508
|
-
d(
|
|
536
|
+
d(be, {
|
|
509
537
|
displayName: "Command<selectRowCommand>",
|
|
510
538
|
group: "Table"
|
|
511
539
|
});
|
|
512
|
-
const
|
|
540
|
+
const Ce = h("SelectCol", () => (e = 0) => (t, n) => {
|
|
513
541
|
const { tr: o } = t;
|
|
514
|
-
return !!(n == null ? void 0 : n(
|
|
542
|
+
return !!(n == null ? void 0 : n(et(e)(o)));
|
|
515
543
|
});
|
|
516
|
-
d(
|
|
544
|
+
d(Ce, {
|
|
517
545
|
displayName: "Command<selectColCommand>",
|
|
518
546
|
group: "Table"
|
|
519
547
|
});
|
|
520
|
-
const
|
|
548
|
+
const ye = h("SelectTable", () => () => (e, t) => {
|
|
521
549
|
const { tr: n } = e;
|
|
522
|
-
return !!(t == null ? void 0 : t(
|
|
550
|
+
return !!(t == null ? void 0 : t(Qe(n)));
|
|
523
551
|
});
|
|
524
|
-
d(
|
|
552
|
+
d(ye, {
|
|
525
553
|
displayName: "Command<selectTableCommand>",
|
|
526
554
|
group: "Table"
|
|
527
555
|
});
|
|
528
|
-
const
|
|
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 ?
|
|
561
|
+
return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
|
|
534
562
|
});
|
|
535
|
-
d(
|
|
563
|
+
d(ke, {
|
|
536
564
|
displayName: "Command<deleteSelectedCellsCommand>",
|
|
537
565
|
group: "Table"
|
|
538
566
|
});
|
|
539
|
-
const
|
|
540
|
-
d(
|
|
567
|
+
const we = h("AddColBefore", () => () => We);
|
|
568
|
+
d(we, {
|
|
541
569
|
displayName: "Command<addColBeforeCommand>",
|
|
542
570
|
group: "Table"
|
|
543
571
|
});
|
|
544
|
-
const
|
|
545
|
-
d(
|
|
572
|
+
const Ne = h("AddColAfter", () => () => Ge);
|
|
573
|
+
d(Ne, {
|
|
546
574
|
displayName: "Command<addColAfterCommand>",
|
|
547
575
|
group: "Table"
|
|
548
576
|
});
|
|
549
|
-
const
|
|
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(
|
|
582
|
+
n(ce(e, t.tr, o, o.top));
|
|
555
583
|
}
|
|
556
584
|
return !0;
|
|
557
585
|
});
|
|
558
|
-
d(
|
|
586
|
+
d(Te, {
|
|
559
587
|
displayName: "Command<addRowBeforeCommand>",
|
|
560
588
|
group: "Table"
|
|
561
589
|
});
|
|
562
|
-
const
|
|
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(
|
|
595
|
+
n(ce(e, t.tr, o, o.bottom));
|
|
568
596
|
}
|
|
569
597
|
return !0;
|
|
570
598
|
});
|
|
571
|
-
d(
|
|
599
|
+
d(Se, {
|
|
572
600
|
displayName: "Command<addRowAfterCommand>",
|
|
573
601
|
group: "Table"
|
|
574
602
|
});
|
|
575
|
-
const
|
|
576
|
-
d(
|
|
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
|
|
608
|
+
const j = oe("tableKeymap", {
|
|
581
609
|
NextCell: {
|
|
582
610
|
shortcuts: ["Mod-]", "Tab"],
|
|
583
611
|
command: (e) => {
|
|
584
|
-
const t = e.get(
|
|
585
|
-
return () => t.call(
|
|
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(
|
|
592
|
-
return () => t.call(
|
|
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(
|
|
599
|
-
return () => t.call(
|
|
626
|
+
const t = e.get(A);
|
|
627
|
+
return () => t.call(z.key);
|
|
600
628
|
}
|
|
601
629
|
}
|
|
602
630
|
});
|
|
603
|
-
d(
|
|
631
|
+
d(j.ctx, {
|
|
604
632
|
displayName: "KeymapCtx<table>",
|
|
605
633
|
group: "Table"
|
|
606
634
|
});
|
|
607
|
-
d(
|
|
635
|
+
d(j.shortcuts, {
|
|
608
636
|
displayName: "Keymap<table>",
|
|
609
637
|
group: "Table"
|
|
610
638
|
});
|
|
611
|
-
const E = "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 ===
|
|
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(
|
|
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(
|
|
692
|
+
d(Z.ctx, {
|
|
665
693
|
displayName: "NodeSchemaCtx<footnodeDef>",
|
|
666
694
|
group: "footnote"
|
|
667
695
|
});
|
|
668
|
-
d(
|
|
696
|
+
d(Z.node, {
|
|
669
697
|
displayName: "NodeSchema<footnodeDef>",
|
|
670
698
|
group: "footnote"
|
|
671
699
|
});
|
|
672
|
-
const D = "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(
|
|
751
|
+
d(V.ctx, {
|
|
724
752
|
displayName: "NodeSchemaCtx<footnodeRef>",
|
|
725
753
|
group: "footnote"
|
|
726
754
|
});
|
|
727
|
-
d(
|
|
755
|
+
d(V.node, {
|
|
728
756
|
displayName: "NodeSchema<footnodeRef>",
|
|
729
757
|
group: "footnote"
|
|
730
758
|
});
|
|
731
|
-
const
|
|
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(
|
|
820
|
+
d(Me, {
|
|
793
821
|
displayName: "NodeSchema<listItem>",
|
|
794
822
|
group: "ListItem"
|
|
795
823
|
});
|
|
796
|
-
const
|
|
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(
|
|
835
|
+
d(Ae, {
|
|
808
836
|
displayName: "InputRule<wrapInTaskListInputRule>",
|
|
809
837
|
group: "ListItem"
|
|
810
838
|
});
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
].flat(),
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
],
|
|
818
|
-
|
|
819
|
-
|
|
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
|
|
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
|
|
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(
|
|
865
|
+
d(xe, {
|
|
836
866
|
displayName: "Prose<autoInsertZeroSpaceInTablePlugin>",
|
|
837
867
|
group: "Prose"
|
|
838
868
|
});
|
|
839
|
-
const
|
|
840
|
-
d(
|
|
869
|
+
const ve = F(() => je({}));
|
|
870
|
+
d(ve, {
|
|
841
871
|
displayName: "Prose<columnResizingPlugin>",
|
|
842
872
|
group: "Prose"
|
|
843
873
|
});
|
|
844
|
-
const
|
|
845
|
-
d(
|
|
874
|
+
const Ie = F(() => Ze());
|
|
875
|
+
d(Ie, {
|
|
846
876
|
displayName: "Prose<tableEditingPlugin>",
|
|
847
877
|
group: "Prose"
|
|
848
878
|
});
|
|
849
|
-
const
|
|
850
|
-
d(
|
|
879
|
+
const U = Ee("remarkGFM", () => qe);
|
|
880
|
+
d(U.plugin, {
|
|
851
881
|
displayName: "Remark<remarkGFMPlugin>",
|
|
852
882
|
group: "Remark"
|
|
853
883
|
});
|
|
854
|
-
d(
|
|
884
|
+
d(U.options, {
|
|
855
885
|
displayName: "RemarkConfig<remarkGFMPlugin>",
|
|
856
886
|
group: "Remark"
|
|
857
887
|
});
|
|
858
|
-
const
|
|
859
|
-
Ae,
|
|
888
|
+
const ct = [
|
|
860
889
|
xe,
|
|
861
890
|
ve,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
891
|
+
Ie,
|
|
892
|
+
U
|
|
893
|
+
].flat(), it = [
|
|
894
|
+
Me,
|
|
866
895
|
S,
|
|
867
|
-
I,
|
|
868
896
|
R,
|
|
869
|
-
|
|
897
|
+
I,
|
|
898
|
+
M,
|
|
870
899
|
Z,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
L,
|
|
900
|
+
V,
|
|
901
|
+
K,
|
|
902
|
+
T
|
|
903
|
+
].flat(), dt = [
|
|
876
904
|
G,
|
|
877
|
-
|
|
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
|
-
|
|
914
|
+
Te,
|
|
888
915
|
Se,
|
|
889
|
-
|
|
890
|
-
|
|
916
|
+
we,
|
|
917
|
+
Ne,
|
|
918
|
+
Re,
|
|
919
|
+
H
|
|
920
|
+
], wt = [it, at, st, rt, ct, dt].flat();
|
|
891
921
|
export {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
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
|
-
|
|
906
|
-
|
|
907
|
-
|
|
935
|
+
Z as footnoteDefinitionSchema,
|
|
936
|
+
V as footnoteReferenceSchema,
|
|
937
|
+
Je as getAllCellsInTable,
|
|
908
938
|
b as getCellsInCol,
|
|
909
939
|
C as getCellsInRow,
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
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
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
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
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
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
|