@milkdown/preset-gfm 7.3.2 → 7.3.4
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/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 +233 -224
- 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/plugin/remark-gfm-plugin.d.ts +3 -1
- package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -1
- package/package.json +16 -10
- package/src/composed/inputrules.ts +6 -1
- package/src/index.ts +2 -2
- package/src/mark/strike-through.ts +12 -1
- package/src/plugin/remark-gfm-plugin.ts +3 -1
package/lib/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
|
|
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
11
|
function d(e, t) {
|
|
12
12
|
return Object.assign(e, {
|
|
13
13
|
meta: {
|
|
@@ -16,17 +16,17 @@ function d(e, t) {
|
|
|
16
16
|
}
|
|
17
17
|
}), e;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
d(
|
|
19
|
+
const K = Pe("strike_through");
|
|
20
|
+
d(K, {
|
|
21
21
|
displayName: "Attr<strikethrough>",
|
|
22
22
|
group: "Strikethrough"
|
|
23
23
|
});
|
|
24
|
-
const
|
|
24
|
+
const T = _e("strike_through", (e) => ({
|
|
25
25
|
parseDOM: [
|
|
26
26
|
{ tag: "del" },
|
|
27
27
|
{ style: "text-decoration", getAttrs: (t) => t === "line-through" }
|
|
28
28
|
],
|
|
29
|
-
toDOM: (t) => ["del", e.get(
|
|
29
|
+
toDOM: (t) => ["del", e.get(K.key)(t)],
|
|
30
30
|
parseMarkdown: {
|
|
31
31
|
match: (t) => t.type === "delete",
|
|
32
32
|
runner: (t, n, o) => {
|
|
@@ -40,48 +40,53 @@ const x = Pe("strike_through", (e) => ({
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}));
|
|
43
|
-
d(
|
|
43
|
+
d(T.mark, {
|
|
44
44
|
displayName: "MarkSchema<strikethrough>",
|
|
45
45
|
group: "Strikethrough"
|
|
46
46
|
});
|
|
47
|
-
d(
|
|
47
|
+
d(T.ctx, {
|
|
48
48
|
displayName: "MarkSchemaCtx<strikethrough>",
|
|
49
49
|
group: "Strikethrough"
|
|
50
50
|
});
|
|
51
|
-
const
|
|
52
|
-
d(
|
|
51
|
+
const H = h("ToggleStrikeThrough", (e) => () => Xe(T.type(e)));
|
|
52
|
+
d(H, {
|
|
53
53
|
displayName: "Command<ToggleStrikethrough>",
|
|
54
54
|
group: "Strikethrough"
|
|
55
55
|
});
|
|
56
|
-
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", {
|
|
57
62
|
ToggleStrikethrough: {
|
|
58
63
|
shortcuts: "Mod-Alt-x",
|
|
59
64
|
command: (e) => {
|
|
60
|
-
const t = e.get(
|
|
61
|
-
return () => t.call(
|
|
65
|
+
const t = e.get(A);
|
|
66
|
+
return () => t.call(H.key);
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
});
|
|
65
|
-
d(
|
|
70
|
+
d(L.ctx, {
|
|
66
71
|
displayName: "KeymapCtx<strikethrough>",
|
|
67
72
|
group: "Strikethrough"
|
|
68
73
|
});
|
|
69
|
-
d(
|
|
74
|
+
d(L.shortcuts, {
|
|
70
75
|
displayName: "Keymap<strikethrough>",
|
|
71
76
|
group: "Strikethrough"
|
|
72
77
|
});
|
|
73
|
-
function
|
|
74
|
-
const o = Array(n).fill(0).map(() =>
|
|
75
|
-
return
|
|
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);
|
|
76
81
|
}
|
|
77
82
|
function w(e) {
|
|
78
|
-
return
|
|
83
|
+
return Ue((t) => t.type.spec.tableRole === "table")(e);
|
|
79
84
|
}
|
|
80
85
|
function b(e, t) {
|
|
81
86
|
const n = w(t);
|
|
82
87
|
if (!n)
|
|
83
88
|
return;
|
|
84
|
-
const o =
|
|
89
|
+
const o = g.get(n.node);
|
|
85
90
|
if (!(e < 0 || e >= o.width))
|
|
86
91
|
return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {
|
|
87
92
|
const r = n.node.nodeAt(l);
|
|
@@ -99,7 +104,7 @@ function C(e, t) {
|
|
|
99
104
|
const n = w(t);
|
|
100
105
|
if (!n)
|
|
101
106
|
return;
|
|
102
|
-
const o =
|
|
107
|
+
const o = g.get(n.node);
|
|
103
108
|
if (!(e < 0 || e >= o.height))
|
|
104
109
|
return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {
|
|
105
110
|
const r = n.node.nodeAt(l);
|
|
@@ -113,11 +118,11 @@ function C(e, t) {
|
|
|
113
118
|
};
|
|
114
119
|
}).filter((l) => l != null);
|
|
115
120
|
}
|
|
116
|
-
function
|
|
121
|
+
function Je(e) {
|
|
117
122
|
const t = w(e);
|
|
118
123
|
if (!t)
|
|
119
124
|
return;
|
|
120
|
-
const n =
|
|
125
|
+
const n = g.get(t.node);
|
|
121
126
|
return n.cellsInRect({
|
|
122
127
|
left: 0,
|
|
123
128
|
right: n.width,
|
|
@@ -128,47 +133,47 @@ function Xe(e) {
|
|
|
128
133
|
return { pos: s, start: s + 1, node: r };
|
|
129
134
|
});
|
|
130
135
|
}
|
|
131
|
-
function
|
|
132
|
-
const t =
|
|
136
|
+
function Qe(e) {
|
|
137
|
+
const t = Je(e.selection);
|
|
133
138
|
if (t && t[0]) {
|
|
134
139
|
const n = e.doc.resolve(t[0].pos), o = t[t.length - 1];
|
|
135
140
|
if (o) {
|
|
136
141
|
const l = e.doc.resolve(o.pos);
|
|
137
|
-
return
|
|
142
|
+
return x(e.setSelection(new y(l, n)));
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
return e;
|
|
141
146
|
}
|
|
142
|
-
function
|
|
147
|
+
function ce(e, t, { map: n, tableStart: o, table: l }, r) {
|
|
143
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) => {
|
|
144
149
|
const a = l.nodeAt(n.map[m]);
|
|
145
|
-
return
|
|
150
|
+
return M.type(e).createAndFill({ alignment: a == null ? void 0 : a.attrs.alignment });
|
|
146
151
|
});
|
|
147
|
-
return t.insert(s,
|
|
152
|
+
return t.insert(s, R.type(e).create(null, c)), t;
|
|
148
153
|
}
|
|
149
|
-
function
|
|
154
|
+
function ie(e) {
|
|
150
155
|
return (t) => (n) => {
|
|
151
156
|
const o = w(n.selection), l = e === "row";
|
|
152
157
|
if (o) {
|
|
153
|
-
const r =
|
|
158
|
+
const r = g.get(o.node);
|
|
154
159
|
if (t >= 0 && t < (l ? r.height : r.width)) {
|
|
155
160
|
const s = r.positionAt(
|
|
156
161
|
l ? t : r.height - 1,
|
|
157
162
|
l ? r.width - 1 : t,
|
|
158
163
|
o.node
|
|
159
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);
|
|
160
|
-
return
|
|
165
|
+
return x(n.setSelection(i(c, a)));
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
return n;
|
|
164
169
|
};
|
|
165
170
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
171
|
+
const Ye = ie("row"), et = ie("col");
|
|
172
|
+
function q(e) {
|
|
168
173
|
return e[0].map((t, n) => e.map((o) => o[n]));
|
|
169
174
|
}
|
|
170
|
-
function
|
|
171
|
-
const n = [], o =
|
|
175
|
+
function de(e, t) {
|
|
176
|
+
const n = [], o = g.get(e);
|
|
172
177
|
for (let r = 0; r < o.height; r++) {
|
|
173
178
|
const s = e.child(r), c = [];
|
|
174
179
|
for (let i = 0; i < o.width; i++) {
|
|
@@ -189,8 +194,8 @@ function ie(e, t) {
|
|
|
189
194
|
e.marks
|
|
190
195
|
);
|
|
191
196
|
}
|
|
192
|
-
function
|
|
193
|
-
const t =
|
|
197
|
+
function me(e) {
|
|
198
|
+
const t = g.get(e), n = [];
|
|
194
199
|
for (let o = 0; o < t.height; o++) {
|
|
195
200
|
const l = [], r = {};
|
|
196
201
|
for (let s = 0; s < t.width; s++) {
|
|
@@ -205,20 +210,20 @@ function de(e) {
|
|
|
205
210
|
}
|
|
206
211
|
return n;
|
|
207
212
|
}
|
|
208
|
-
function
|
|
213
|
+
function ue(e, t, n, o) {
|
|
209
214
|
const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;
|
|
210
215
|
let c;
|
|
211
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;
|
|
212
217
|
}
|
|
213
|
-
function
|
|
214
|
-
let l =
|
|
215
|
-
return l =
|
|
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);
|
|
216
221
|
}
|
|
217
|
-
function
|
|
218
|
-
let l =
|
|
219
|
-
return l =
|
|
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);
|
|
220
225
|
}
|
|
221
|
-
function
|
|
226
|
+
function J(e, t) {
|
|
222
227
|
let n = e, o = e;
|
|
223
228
|
for (let a = e; a >= 0; a--) {
|
|
224
229
|
const u = b(a, t.selection);
|
|
@@ -259,7 +264,7 @@ function q(e, t) {
|
|
|
259
264
|
const m = t.doc.resolve(i.pos);
|
|
260
265
|
return { $anchor: c, $head: m, indexes: l };
|
|
261
266
|
}
|
|
262
|
-
function
|
|
267
|
+
function Q(e, t) {
|
|
263
268
|
let n = e, o = e;
|
|
264
269
|
for (let a = e; a >= 0; a--)
|
|
265
270
|
C(a, t.selection).forEach((p) => {
|
|
@@ -294,51 +299,51 @@ function J(e, t) {
|
|
|
294
299
|
const m = t.doc.resolve(i.pos);
|
|
295
300
|
return { $anchor: c, $head: m, indexes: l };
|
|
296
301
|
}
|
|
297
|
-
function
|
|
302
|
+
function nt(e, t, n, o = !0) {
|
|
298
303
|
const l = w(e.selection);
|
|
299
304
|
if (!l)
|
|
300
305
|
return e;
|
|
301
|
-
const { indexes: r } =
|
|
306
|
+
const { indexes: r } = J(t, e), { indexes: s } = J(n, e);
|
|
302
307
|
if (r.includes(n))
|
|
303
308
|
return e;
|
|
304
|
-
const c =
|
|
309
|
+
const c = tt(
|
|
305
310
|
l,
|
|
306
311
|
r,
|
|
307
312
|
s,
|
|
308
313
|
0
|
|
309
|
-
), i =
|
|
314
|
+
), i = x(e).replaceWith(
|
|
310
315
|
l.pos,
|
|
311
316
|
l.pos + l.node.nodeSize,
|
|
312
317
|
c
|
|
313
318
|
);
|
|
314
319
|
if (!o)
|
|
315
320
|
return i;
|
|
316
|
-
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);
|
|
317
322
|
return i.setSelection($(f, _));
|
|
318
323
|
}
|
|
319
|
-
function
|
|
324
|
+
function lt(e, t, n, o = !0) {
|
|
320
325
|
const l = w(e.selection);
|
|
321
326
|
if (!l)
|
|
322
327
|
return e;
|
|
323
|
-
const { indexes: r } =
|
|
328
|
+
const { indexes: r } = Q(t, e), { indexes: s } = Q(n, e);
|
|
324
329
|
if (r.includes(n))
|
|
325
330
|
return e;
|
|
326
|
-
const c =
|
|
331
|
+
const c = ot(
|
|
327
332
|
l,
|
|
328
333
|
r,
|
|
329
334
|
s,
|
|
330
335
|
0
|
|
331
|
-
), i =
|
|
336
|
+
), i = x(e).replaceWith(
|
|
332
337
|
l.pos,
|
|
333
338
|
l.pos + l.node.nodeSize,
|
|
334
339
|
c
|
|
335
340
|
);
|
|
336
341
|
if (!o)
|
|
337
342
|
return i;
|
|
338
|
-
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);
|
|
339
344
|
return i.setSelection($(f, _));
|
|
340
345
|
}
|
|
341
|
-
const v =
|
|
346
|
+
const v = Fe({
|
|
342
347
|
tableGroup: "block",
|
|
343
348
|
cellContent: "paragraph",
|
|
344
349
|
cellAttributes: {
|
|
@@ -350,7 +355,7 @@ const v = Be({
|
|
|
350
355
|
}
|
|
351
356
|
}
|
|
352
357
|
}
|
|
353
|
-
}),
|
|
358
|
+
}), S = k("table", () => ({
|
|
354
359
|
...v.table,
|
|
355
360
|
parseMarkdown: {
|
|
356
361
|
match: (e) => e.type === "table",
|
|
@@ -377,15 +382,15 @@ const v = Be({
|
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
384
|
}));
|
|
380
|
-
d(
|
|
385
|
+
d(S.node, {
|
|
381
386
|
displayName: "NodeSchema<table>",
|
|
382
387
|
group: "Table"
|
|
383
388
|
});
|
|
384
|
-
d(
|
|
389
|
+
d(S.ctx, {
|
|
385
390
|
displayName: "NodeSchemaCtx<table>",
|
|
386
391
|
group: "Table"
|
|
387
392
|
});
|
|
388
|
-
const
|
|
393
|
+
const R = k("table_row", () => ({
|
|
389
394
|
...v.table_row,
|
|
390
395
|
parseMarkdown: {
|
|
391
396
|
match: (e) => e.type === "tableRow",
|
|
@@ -405,15 +410,15 @@ const S = k("table_row", () => ({
|
|
|
405
410
|
}
|
|
406
411
|
}
|
|
407
412
|
}));
|
|
408
|
-
d(
|
|
413
|
+
d(R.node, {
|
|
409
414
|
displayName: "NodeSchema<tableRow>",
|
|
410
415
|
group: "Table"
|
|
411
416
|
});
|
|
412
|
-
d(
|
|
417
|
+
d(R.ctx, {
|
|
413
418
|
displayName: "NodeSchemaCtx<tableRow>",
|
|
414
419
|
group: "Table"
|
|
415
420
|
});
|
|
416
|
-
const
|
|
421
|
+
const M = k("table_cell", () => ({
|
|
417
422
|
...v.table_cell,
|
|
418
423
|
parseMarkdown: {
|
|
419
424
|
match: (e) => e.type === "tableCell" && !e.isHeader,
|
|
@@ -429,11 +434,11 @@ const R = k("table_cell", () => ({
|
|
|
429
434
|
}
|
|
430
435
|
}
|
|
431
436
|
}));
|
|
432
|
-
d(
|
|
437
|
+
d(M.node, {
|
|
433
438
|
displayName: "NodeSchema<tableCell>",
|
|
434
439
|
group: "Table"
|
|
435
440
|
});
|
|
436
|
-
d(
|
|
441
|
+
d(M.ctx, {
|
|
437
442
|
displayName: "NodeSchemaCtx<tableCell>",
|
|
438
443
|
group: "Table"
|
|
439
444
|
});
|
|
@@ -461,177 +466,177 @@ d(I.ctx, {
|
|
|
461
466
|
displayName: "NodeSchemaCtx<tableHeader>",
|
|
462
467
|
group: "Table"
|
|
463
468
|
});
|
|
464
|
-
const
|
|
469
|
+
const pe = B((e) => new te(
|
|
465
470
|
/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
|
|
466
471
|
(t, n, o, l) => {
|
|
467
472
|
var i, m;
|
|
468
473
|
const r = t.doc.resolve(o);
|
|
469
|
-
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)))
|
|
470
475
|
return null;
|
|
471
|
-
const s =
|
|
476
|
+
const s = se(
|
|
472
477
|
e,
|
|
473
478
|
Number((i = n.groups) == null ? void 0 : i.row),
|
|
474
479
|
Number((m = n.groups) == null ? void 0 : m.col)
|
|
475
480
|
), c = t.tr.replaceRangeWith(o, l, s);
|
|
476
|
-
return c.setSelection(
|
|
481
|
+
return c.setSelection(De.create(c.doc, o + 3)).scrollIntoView();
|
|
477
482
|
}
|
|
478
483
|
));
|
|
479
|
-
d(
|
|
484
|
+
d(pe, {
|
|
480
485
|
displayName: "InputRule<insertTableInputRule>",
|
|
481
486
|
group: "Table"
|
|
482
487
|
});
|
|
483
|
-
const
|
|
484
|
-
d(
|
|
488
|
+
const W = h("GoToPrevTableCell", () => () => le(-1));
|
|
489
|
+
d(W, {
|
|
485
490
|
displayName: "Command<goToPrevTableCellCommand>",
|
|
486
491
|
group: "Table"
|
|
487
492
|
});
|
|
488
|
-
const
|
|
489
|
-
d(
|
|
493
|
+
const G = h("GoToNextTableCell", () => () => le(1));
|
|
494
|
+
d(G, {
|
|
490
495
|
displayName: "Command<goToNextTableCellCommand>",
|
|
491
496
|
group: "Table"
|
|
492
497
|
});
|
|
493
|
-
const
|
|
498
|
+
const z = h("BreakTable", (e) => () => (t, n) => {
|
|
494
499
|
if (!N(t))
|
|
495
500
|
return !1;
|
|
496
|
-
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());
|
|
497
502
|
return r.setSelection(ne.near(r.doc.resolve(l), 1)).scrollIntoView(), n == null || n(r), !0;
|
|
498
503
|
});
|
|
499
|
-
d(
|
|
504
|
+
d(z, {
|
|
500
505
|
displayName: "Command<breakTableCommand>",
|
|
501
506
|
group: "Table"
|
|
502
507
|
});
|
|
503
|
-
const
|
|
504
|
-
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);
|
|
505
510
|
return a && m.setSelection(a), l == null || l(m), !0;
|
|
506
511
|
});
|
|
507
|
-
d(
|
|
512
|
+
d(fe, {
|
|
508
513
|
displayName: "Command<insertTableCommand>",
|
|
509
514
|
group: "Table"
|
|
510
515
|
});
|
|
511
|
-
const
|
|
516
|
+
const he = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
512
517
|
const { tr: l } = n;
|
|
513
|
-
return !!(o == null ? void 0 : o(
|
|
518
|
+
return !!(o == null ? void 0 : o(lt(l, e ?? 0, t ?? 0, !0)));
|
|
514
519
|
});
|
|
515
|
-
d(
|
|
520
|
+
d(he, {
|
|
516
521
|
displayName: "Command<moveRowCommand>",
|
|
517
522
|
group: "Table"
|
|
518
523
|
});
|
|
519
|
-
const ge =
|
|
524
|
+
const ge = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
520
525
|
const { tr: l } = n;
|
|
521
|
-
return !!(o == null ? void 0 : o(
|
|
526
|
+
return !!(o == null ? void 0 : o(nt(l, e ?? 0, t ?? 0, !0)));
|
|
522
527
|
});
|
|
523
528
|
d(ge, {
|
|
524
529
|
displayName: "Command<moveColCommand>",
|
|
525
530
|
group: "Table"
|
|
526
531
|
});
|
|
527
|
-
const
|
|
532
|
+
const be = h("SelectRow", () => (e = 0) => (t, n) => {
|
|
528
533
|
const { tr: o } = t;
|
|
529
|
-
return !!(n == null ? void 0 : n(
|
|
534
|
+
return !!(n == null ? void 0 : n(Ye(e)(o)));
|
|
530
535
|
});
|
|
531
|
-
d(
|
|
536
|
+
d(be, {
|
|
532
537
|
displayName: "Command<selectRowCommand>",
|
|
533
538
|
group: "Table"
|
|
534
539
|
});
|
|
535
|
-
const
|
|
540
|
+
const Ce = h("SelectCol", () => (e = 0) => (t, n) => {
|
|
536
541
|
const { tr: o } = t;
|
|
537
|
-
return !!(n == null ? void 0 : n(
|
|
542
|
+
return !!(n == null ? void 0 : n(et(e)(o)));
|
|
538
543
|
});
|
|
539
|
-
d(
|
|
544
|
+
d(Ce, {
|
|
540
545
|
displayName: "Command<selectColCommand>",
|
|
541
546
|
group: "Table"
|
|
542
547
|
});
|
|
543
|
-
const
|
|
548
|
+
const ye = h("SelectTable", () => () => (e, t) => {
|
|
544
549
|
const { tr: n } = e;
|
|
545
|
-
return !!(t == null ? void 0 : t(
|
|
550
|
+
return !!(t == null ? void 0 : t(Qe(n)));
|
|
546
551
|
});
|
|
547
|
-
d(
|
|
552
|
+
d(ye, {
|
|
548
553
|
displayName: "Command<selectTableCommand>",
|
|
549
554
|
group: "Table"
|
|
550
555
|
});
|
|
551
|
-
const
|
|
556
|
+
const ke = h("DeleteSelectedCells", () => () => (e, t) => {
|
|
552
557
|
const { selection: n } = e;
|
|
553
558
|
if (!(n instanceof y))
|
|
554
559
|
return !1;
|
|
555
560
|
const o = n.isRowSelection(), l = n.isColSelection();
|
|
556
|
-
return o && l ?
|
|
561
|
+
return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
|
|
557
562
|
});
|
|
558
|
-
d(
|
|
563
|
+
d(ke, {
|
|
559
564
|
displayName: "Command<deleteSelectedCellsCommand>",
|
|
560
565
|
group: "Table"
|
|
561
566
|
});
|
|
562
|
-
const
|
|
563
|
-
d(
|
|
567
|
+
const we = h("AddColBefore", () => () => We);
|
|
568
|
+
d(we, {
|
|
564
569
|
displayName: "Command<addColBeforeCommand>",
|
|
565
570
|
group: "Table"
|
|
566
571
|
});
|
|
567
|
-
const
|
|
568
|
-
d(
|
|
572
|
+
const Ne = h("AddColAfter", () => () => Ge);
|
|
573
|
+
d(Ne, {
|
|
569
574
|
displayName: "Command<addColAfterCommand>",
|
|
570
575
|
group: "Table"
|
|
571
576
|
});
|
|
572
|
-
const
|
|
577
|
+
const Te = h("AddRowBefore", (e) => () => (t, n) => {
|
|
573
578
|
if (!N(t))
|
|
574
579
|
return !1;
|
|
575
580
|
if (n) {
|
|
576
581
|
const o = re(t);
|
|
577
|
-
n(
|
|
582
|
+
n(ce(e, t.tr, o, o.top));
|
|
578
583
|
}
|
|
579
584
|
return !0;
|
|
580
585
|
});
|
|
581
|
-
d(
|
|
586
|
+
d(Te, {
|
|
582
587
|
displayName: "Command<addRowBeforeCommand>",
|
|
583
588
|
group: "Table"
|
|
584
589
|
});
|
|
585
|
-
const
|
|
590
|
+
const Se = h("AddRowAfter", (e) => () => (t, n) => {
|
|
586
591
|
if (!N(t))
|
|
587
592
|
return !1;
|
|
588
593
|
if (n) {
|
|
589
594
|
const o = re(t);
|
|
590
|
-
n(
|
|
595
|
+
n(ce(e, t.tr, o, o.bottom));
|
|
591
596
|
}
|
|
592
597
|
return !0;
|
|
593
598
|
});
|
|
594
|
-
d(
|
|
599
|
+
d(Se, {
|
|
595
600
|
displayName: "Command<addRowAfterCommand>",
|
|
596
601
|
group: "Table"
|
|
597
602
|
});
|
|
598
|
-
const
|
|
599
|
-
d(
|
|
603
|
+
const Re = h("SetAlign", () => (e = "left") => ze("alignment", e));
|
|
604
|
+
d(Re, {
|
|
600
605
|
displayName: "Command<setAlignCommand>",
|
|
601
606
|
group: "Table"
|
|
602
607
|
});
|
|
603
|
-
const
|
|
608
|
+
const j = oe("tableKeymap", {
|
|
604
609
|
NextCell: {
|
|
605
610
|
shortcuts: ["Mod-]", "Tab"],
|
|
606
611
|
command: (e) => {
|
|
607
|
-
const t = e.get(
|
|
608
|
-
return () => t.call(
|
|
612
|
+
const t = e.get(A);
|
|
613
|
+
return () => t.call(G.key);
|
|
609
614
|
}
|
|
610
615
|
},
|
|
611
616
|
PrevCell: {
|
|
612
617
|
shortcuts: ["Mod-[", "Shift-Tab"],
|
|
613
618
|
command: (e) => {
|
|
614
|
-
const t = e.get(
|
|
615
|
-
return () => t.call(
|
|
619
|
+
const t = e.get(A);
|
|
620
|
+
return () => t.call(W.key);
|
|
616
621
|
}
|
|
617
622
|
},
|
|
618
623
|
ExitTable: {
|
|
619
624
|
shortcuts: ["Mod-Enter"],
|
|
620
625
|
command: (e) => {
|
|
621
|
-
const t = e.get(
|
|
622
|
-
return () => t.call(
|
|
626
|
+
const t = e.get(A);
|
|
627
|
+
return () => t.call(z.key);
|
|
623
628
|
}
|
|
624
629
|
}
|
|
625
630
|
});
|
|
626
|
-
d(
|
|
631
|
+
d(j.ctx, {
|
|
627
632
|
displayName: "KeymapCtx<table>",
|
|
628
633
|
group: "Table"
|
|
629
634
|
});
|
|
630
|
-
d(
|
|
635
|
+
d(j.shortcuts, {
|
|
631
636
|
displayName: "Keymap<table>",
|
|
632
637
|
group: "Table"
|
|
633
638
|
});
|
|
634
|
-
const E = "footnote_definition",
|
|
639
|
+
const E = "footnote_definition", Y = "footnoteDefinition", Z = k("footnote_definition", () => ({
|
|
635
640
|
group: "block",
|
|
636
641
|
content: "block+",
|
|
637
642
|
defining: !0,
|
|
@@ -667,7 +672,7 @@ const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_defin
|
|
|
667
672
|
];
|
|
668
673
|
},
|
|
669
674
|
parseMarkdown: {
|
|
670
|
-
match: ({ type: e }) => e ===
|
|
675
|
+
match: ({ type: e }) => e === Y,
|
|
671
676
|
runner: (e, t, n) => {
|
|
672
677
|
e.openNode(n, {
|
|
673
678
|
label: t.label
|
|
@@ -677,22 +682,22 @@ const E = "footnote_definition", Q = "footnoteDefinition", j = k("footnote_defin
|
|
|
677
682
|
toMarkdown: {
|
|
678
683
|
match: (e) => e.type.name === E,
|
|
679
684
|
runner: (e, t) => {
|
|
680
|
-
e.openNode(
|
|
685
|
+
e.openNode(Y, void 0, {
|
|
681
686
|
label: t.attrs.label,
|
|
682
687
|
identifier: t.attrs.label
|
|
683
688
|
}).next(t.content).closeNode();
|
|
684
689
|
}
|
|
685
690
|
}
|
|
686
691
|
}));
|
|
687
|
-
d(
|
|
692
|
+
d(Z.ctx, {
|
|
688
693
|
displayName: "NodeSchemaCtx<footnodeDef>",
|
|
689
694
|
group: "footnote"
|
|
690
695
|
});
|
|
691
|
-
d(
|
|
696
|
+
d(Z.node, {
|
|
692
697
|
displayName: "NodeSchema<footnodeDef>",
|
|
693
698
|
group: "footnote"
|
|
694
699
|
});
|
|
695
|
-
const D = "footnote_reference",
|
|
700
|
+
const D = "footnote_reference", V = k("footnote_reference", () => ({
|
|
696
701
|
group: "inline",
|
|
697
702
|
inline: !0,
|
|
698
703
|
atom: !0,
|
|
@@ -743,15 +748,15 @@ const D = "footnote_reference", Z = k("footnote_reference", () => ({
|
|
|
743
748
|
}
|
|
744
749
|
}
|
|
745
750
|
}));
|
|
746
|
-
d(
|
|
751
|
+
d(V.ctx, {
|
|
747
752
|
displayName: "NodeSchemaCtx<footnodeRef>",
|
|
748
753
|
group: "footnote"
|
|
749
754
|
});
|
|
750
|
-
d(
|
|
755
|
+
d(V.node, {
|
|
751
756
|
displayName: "NodeSchema<footnodeRef>",
|
|
752
757
|
group: "footnote"
|
|
753
758
|
});
|
|
754
|
-
const
|
|
759
|
+
const Me = $e.extendSchema((e) => (t) => {
|
|
755
760
|
const n = e(t);
|
|
756
761
|
return {
|
|
757
762
|
...n,
|
|
@@ -812,11 +817,11 @@ const Re = Ie.extendSchema((e) => (t) => {
|
|
|
812
817
|
}
|
|
813
818
|
};
|
|
814
819
|
});
|
|
815
|
-
d(
|
|
820
|
+
d(Me, {
|
|
816
821
|
displayName: "NodeSchema<listItem>",
|
|
817
822
|
group: "ListItem"
|
|
818
823
|
});
|
|
819
|
-
const
|
|
824
|
+
const Ae = B(() => new te(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
|
|
820
825
|
var a;
|
|
821
826
|
const l = e.doc.resolve(n);
|
|
822
827
|
let r = 0, s = l.node(r);
|
|
@@ -827,141 +832,145 @@ const Me = oe(() => new ee(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
|
|
|
827
832
|
const c = ((a = t.groups) == null ? void 0 : a.checked) === "x", i = l.before(r), m = e.tr;
|
|
828
833
|
return m.deleteRange(n, o).setNodeMarkup(i, void 0, { ...s.attrs, checked: c }), m;
|
|
829
834
|
}));
|
|
830
|
-
d(
|
|
835
|
+
d(Ae, {
|
|
831
836
|
displayName: "InputRule<wrapInTaskListInputRule>",
|
|
832
837
|
group: "ListItem"
|
|
833
838
|
});
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
].flat(),
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
],
|
|
841
|
-
|
|
842
|
-
|
|
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({
|
|
843
850
|
key: t,
|
|
844
851
|
props: {
|
|
845
852
|
handleDOMEvents: {
|
|
846
853
|
compositionstart(l) {
|
|
847
854
|
const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
|
|
848
|
-
return
|
|
855
|
+
return X.safari && N(r) && i.empty && o(m.parent) && s(c.insertText("", m.start())), !1;
|
|
849
856
|
},
|
|
850
857
|
compositionend(l) {
|
|
851
858
|
const { state: r, dispatch: s } = l, { tr: c, selection: i } = r, { $from: m } = i;
|
|
852
|
-
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;
|
|
853
860
|
}
|
|
854
861
|
}
|
|
855
862
|
}
|
|
856
863
|
});
|
|
857
864
|
});
|
|
858
|
-
d(
|
|
865
|
+
d(xe, {
|
|
859
866
|
displayName: "Prose<autoInsertZeroSpaceInTablePlugin>",
|
|
860
867
|
group: "Prose"
|
|
861
868
|
});
|
|
862
|
-
const
|
|
863
|
-
d(
|
|
869
|
+
const ve = F(() => je({}));
|
|
870
|
+
d(ve, {
|
|
864
871
|
displayName: "Prose<columnResizingPlugin>",
|
|
865
872
|
group: "Prose"
|
|
866
873
|
});
|
|
867
|
-
const
|
|
868
|
-
d(
|
|
874
|
+
const Ie = F(() => Ze());
|
|
875
|
+
d(Ie, {
|
|
869
876
|
displayName: "Prose<tableEditingPlugin>",
|
|
870
877
|
group: "Prose"
|
|
871
878
|
});
|
|
872
|
-
const
|
|
873
|
-
d(
|
|
879
|
+
const U = Ee("remarkGFM", () => qe);
|
|
880
|
+
d(U.plugin, {
|
|
874
881
|
displayName: "Remark<remarkGFMPlugin>",
|
|
875
882
|
group: "Remark"
|
|
876
883
|
});
|
|
877
|
-
d(
|
|
884
|
+
d(U.options, {
|
|
878
885
|
displayName: "RemarkConfig<remarkGFMPlugin>",
|
|
879
886
|
group: "Remark"
|
|
880
887
|
});
|
|
881
|
-
const
|
|
882
|
-
Ae,
|
|
888
|
+
const ct = [
|
|
883
889
|
xe,
|
|
884
890
|
ve,
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
891
|
+
Ie,
|
|
892
|
+
U
|
|
893
|
+
].flat(), it = [
|
|
894
|
+
Me,
|
|
889
895
|
S,
|
|
890
|
-
I,
|
|
891
896
|
R,
|
|
892
|
-
|
|
897
|
+
I,
|
|
898
|
+
M,
|
|
893
899
|
Z,
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
L,
|
|
900
|
+
V,
|
|
901
|
+
K,
|
|
902
|
+
T
|
|
903
|
+
].flat(), dt = [
|
|
899
904
|
G,
|
|
900
|
-
|
|
905
|
+
W,
|
|
906
|
+
z,
|
|
901
907
|
fe,
|
|
902
|
-
ge,
|
|
903
908
|
he,
|
|
909
|
+
ge,
|
|
904
910
|
be,
|
|
905
911
|
Ce,
|
|
906
912
|
ye,
|
|
907
|
-
Ne,
|
|
908
|
-
Te,
|
|
909
913
|
ke,
|
|
910
|
-
|
|
914
|
+
Te,
|
|
911
915
|
Se,
|
|
912
|
-
|
|
913
|
-
|
|
916
|
+
we,
|
|
917
|
+
Ne,
|
|
918
|
+
Re,
|
|
919
|
+
H
|
|
920
|
+
], wt = [it, at, st, rt, ct, dt].flat();
|
|
914
921
|
export {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
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,
|
|
927
934
|
w as findTable,
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
935
|
+
Z as footnoteDefinitionSchema,
|
|
936
|
+
V as footnoteReferenceSchema,
|
|
937
|
+
Je as getAllCellsInTable,
|
|
931
938
|
b as getCellsInCol,
|
|
932
939
|
C as getCellsInRow,
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
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,
|
|
941
949
|
ge as moveColCommand,
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
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,
|
|
960
969
|
I as tableHeaderSchema,
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
970
|
+
j as tableKeymap,
|
|
971
|
+
R as tableRowSchema,
|
|
972
|
+
S as tableSchema,
|
|
973
|
+
H as toggleStrikethroughCommand,
|
|
974
|
+
Ae as wrapInTaskListInputRule
|
|
966
975
|
};
|
|
967
976
|
//# sourceMappingURL=index.es.js.map
|