@milkdown/preset-gfm 7.0.0-next.0 → 7.0.0-next.1
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.map +1 -1
- package/lib/composed/inputrules.d.ts.map +1 -1
- package/lib/composed/keymap.d.ts.map +1 -1
- package/lib/composed/plugins.d.ts.map +1 -1
- package/lib/composed/schema.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +164 -163
- 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/footnote/definition.d.ts.map +1 -1
- package/lib/node/footnote/reference.d.ts.map +1 -1
- package/lib/node/table/index.d.ts.map +1 -1
- package/lib/node/table/utils.d.ts +1 -2
- package/lib/node/table/utils.d.ts.map +1 -1
- package/lib/node/task-list-item.d.ts.map +1 -1
- package/lib/plugin/auto-insert-zero-space-plugin.d.ts.map +1 -1
- package/lib/plugin/column-resizing-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-gfm-plugin.d.ts.map +1 -1
- package/lib/plugin/table-editing-plugin.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/composed/commands.ts +1 -0
- package/src/composed/inputrules.ts +1 -0
- package/src/composed/keymap.ts +1 -0
- package/src/composed/plugins.ts +1 -0
- package/src/composed/schema.ts +3 -1
- package/src/index.ts +1 -0
- package/src/mark/strike-through.ts +10 -3
- package/src/node/footnote/definition.ts +2 -0
- package/src/node/footnote/reference.ts +2 -0
- package/src/node/table/index.ts +35 -0
- package/src/node/table/utils.ts +28 -8
- package/src/node/task-list-item.ts +1 -0
- package/src/plugin/auto-insert-zero-space-plugin.ts +2 -1
- package/src/plugin/column-resizing-plugin.ts +2 -0
- package/src/plugin/remark-gfm-plugin.ts +1 -0
- package/src/plugin/table-editing-plugin.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/composed/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/composed/commands.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;uEAkBpB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputrules.d.ts","sourceRoot":"","sources":["../../src/composed/inputrules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"inputrules.d.ts","sourceRoot":"","sources":["../../src/composed/inputrules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,eAAO,MAAM,UAAU,EAAE,cAAc,EAEtC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/composed/keymap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/composed/keymap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,eAAO,MAAM,MAAM,EAAE,cAAc,EAG3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/composed/plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/composed/plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,eAAO,MAAM,OAAO,EAAE,cAAc,EAKnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composed/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composed/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,eAAO,MAAM,MAAM,EAAE,cAAc,EAa3B,CAAA"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAG1B,eAAO,MAAM,GAAG,0CAAyD,CAAA"}
|
package/lib/index.es.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { expectDomTypeError as $ } from "@milkdown/exception";
|
|
2
|
-
import { paragraphSchema as W, listItemSchema as
|
|
2
|
+
import { paragraphSchema as W, listItemSchema as le } from "@milkdown/preset-commonmark";
|
|
3
3
|
import { commandsCtx as S } from "@milkdown/core";
|
|
4
|
-
import { InputRule as
|
|
5
|
-
import { TextSelection as
|
|
6
|
-
import { TableMap as h, CellSelection as C, tableNodes as
|
|
7
|
-
import { $markSchema as
|
|
8
|
-
import { findParentNode as
|
|
9
|
-
import { toggleMark as
|
|
10
|
-
import
|
|
11
|
-
const j =
|
|
4
|
+
import { InputRule as re } from "@milkdown/prose/inputrules";
|
|
5
|
+
import { TextSelection as se, Selection as K, PluginKey as ce, Plugin as ae } from "@milkdown/prose/state";
|
|
6
|
+
import { TableMap as h, CellSelection as C, tableNodes as ie, goToNextCell as L, isInTable as y, deleteTable as de, deleteColumn as ue, deleteRow as me, addColumnBefore as fe, addColumnAfter as pe, selectedRect as z, setCellAttr as he, columnResizing as ge, tableEditing as be } from "@milkdown/prose/tables";
|
|
7
|
+
import { $markAttr as Ce, $markSchema as we, $command as p, $useKeymap as G, $nodeSchema as w, $inputRule as ke, $prose as _, $remark as ye } from "@milkdown/utils";
|
|
8
|
+
import { findParentNode as Se, cloneTr as A, browser as D } from "@milkdown/prose";
|
|
9
|
+
import { toggleMark as Ae } from "@milkdown/prose/commands";
|
|
10
|
+
import Te from "remark-gfm";
|
|
11
|
+
const j = Ce("strike_through"), V = we("strike_through", (e) => ({
|
|
12
12
|
inclusive: !1,
|
|
13
13
|
parseDOM: [
|
|
14
14
|
{ tag: "del" },
|
|
15
|
-
{ style: "text-decoration", getAttrs: (
|
|
15
|
+
{ style: "text-decoration", getAttrs: (t) => t === "line-through" }
|
|
16
16
|
],
|
|
17
|
-
toDOM: () => ["del"],
|
|
17
|
+
toDOM: (t) => ["del", e.get(j.key)(t)],
|
|
18
18
|
parseMarkdown: {
|
|
19
|
-
match: (
|
|
20
|
-
runner: (
|
|
21
|
-
|
|
19
|
+
match: (t) => t.type === "delete",
|
|
20
|
+
runner: (t, n, o) => {
|
|
21
|
+
t.openMark(o), t.next(n.children), t.closeMark(o);
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
toMarkdown: {
|
|
25
|
-
match: (
|
|
26
|
-
runner: (
|
|
27
|
-
|
|
25
|
+
match: (t) => t.type.name === "strike_through",
|
|
26
|
+
runner: (t, n) => {
|
|
27
|
+
t.withMark(n, "delete");
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
})),
|
|
30
|
+
})), Z = p("ToggleStrikeThrough", () => () => Ae(V.type())), Me = G("strikeThroughKeymap", {
|
|
31
31
|
ToggleStrikethrough: {
|
|
32
32
|
shortcuts: "Mod-Alt-x",
|
|
33
33
|
command: (e) => {
|
|
34
34
|
const t = e.get(S);
|
|
35
|
-
return () => t.call(
|
|
35
|
+
return () => t.call(Z.key);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
39
|
-
const n = Array(t).fill(0).map(() => O.type().createAndFill()), o = Array(t).fill(0).map(() =>
|
|
38
|
+
}), U = (e = 3, t = 3) => {
|
|
39
|
+
const n = Array(t).fill(0).map(() => O.type().createAndFill()), o = Array(t).fill(0).map(() => ee.type().createAndFill()), l = Array(e).fill(0).map((r, s) => I.type().create(null, s === 0 ? o : n));
|
|
40
40
|
return E.type().create(null, l);
|
|
41
|
-
}, k = (e) =>
|
|
41
|
+
}, k = (e) => Se((t) => t.type.spec.tableRole === "table")(e), g = (e, t) => {
|
|
42
42
|
const n = k(t);
|
|
43
43
|
if (!n)
|
|
44
44
|
return;
|
|
@@ -55,7 +55,7 @@ const j = ge("strike_through", () => ({
|
|
|
55
55
|
node: r
|
|
56
56
|
};
|
|
57
57
|
}).filter((l) => l != null);
|
|
58
|
-
},
|
|
58
|
+
}, b = (e, t) => {
|
|
59
59
|
const n = k(t);
|
|
60
60
|
if (!n)
|
|
61
61
|
return;
|
|
@@ -72,7 +72,7 @@ const j = ge("strike_through", () => ({
|
|
|
72
72
|
node: r
|
|
73
73
|
};
|
|
74
74
|
}).filter((l) => l != null);
|
|
75
|
-
},
|
|
75
|
+
}, Re = (e) => {
|
|
76
76
|
const t = k(e);
|
|
77
77
|
if (!t)
|
|
78
78
|
return;
|
|
@@ -86,25 +86,25 @@ const j = ge("strike_through", () => ({
|
|
|
86
86
|
const r = t.node.nodeAt(l), s = l + t.start;
|
|
87
87
|
return { pos: s, start: s + 1, node: r };
|
|
88
88
|
});
|
|
89
|
-
},
|
|
90
|
-
const t =
|
|
89
|
+
}, ve = (e) => {
|
|
90
|
+
const t = Re(e.selection);
|
|
91
91
|
if (t && t[0]) {
|
|
92
92
|
const n = e.doc.resolve(t[0].pos), o = t[t.length - 1];
|
|
93
93
|
if (o) {
|
|
94
94
|
const l = e.doc.resolve(o.pos);
|
|
95
|
-
return
|
|
95
|
+
return A(e.setSelection(new C(l, n)));
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
return e;
|
|
99
99
|
};
|
|
100
|
-
function
|
|
100
|
+
function X(e, { map: t, tableStart: n, table: o }, l) {
|
|
101
101
|
const r = Array(l).fill(0).reduce((i, a, u) => i + o.child(u).nodeSize, n), s = Array(t.width).fill(0).map((i, a) => {
|
|
102
102
|
const u = o.nodeAt(t.map[a]);
|
|
103
103
|
return O.type().createAndFill({ alignment: u == null ? void 0 : u.attrs.alignment });
|
|
104
104
|
});
|
|
105
105
|
return e.insert(r, I.type().create(null, s)), e;
|
|
106
106
|
}
|
|
107
|
-
const
|
|
107
|
+
const q = (e) => (t) => (n) => {
|
|
108
108
|
const o = k(n.selection), l = e === "row";
|
|
109
109
|
if (o) {
|
|
110
110
|
const r = h.get(o.node);
|
|
@@ -114,11 +114,11 @@ const X = (e) => (t) => (n) => {
|
|
|
114
114
|
l ? r.width - 1 : t,
|
|
115
115
|
o.node
|
|
116
116
|
), i = n.doc.resolve(o.start + s), a = l ? C.rowSelection : C.colSelection, u = r.positionAt(l ? t : 0, l ? 0 : t, o.node), c = n.doc.resolve(o.start + u);
|
|
117
|
-
return
|
|
117
|
+
return A(n.setSelection(a(i, c)));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
return n;
|
|
121
|
-
},
|
|
121
|
+
}, Ne = q("row"), xe = q("col"), P = (e) => e[0].map((t, n) => e.map((o) => o[n])), J = (e, t) => {
|
|
122
122
|
const n = [], o = h.get(e);
|
|
123
123
|
for (let r = 0; r < o.height; r++) {
|
|
124
124
|
const s = e.child(r), i = [];
|
|
@@ -139,7 +139,7 @@ const X = (e) => (t) => (n) => {
|
|
|
139
139
|
n,
|
|
140
140
|
e.marks
|
|
141
141
|
);
|
|
142
|
-
},
|
|
142
|
+
}, Q = (e) => {
|
|
143
143
|
const t = h.get(e), n = [];
|
|
144
144
|
for (let o = 0; o < t.height; o++) {
|
|
145
145
|
const l = [], r = {};
|
|
@@ -154,27 +154,27 @@ const X = (e) => (t) => (n) => {
|
|
|
154
154
|
n.push(l);
|
|
155
155
|
}
|
|
156
156
|
return n;
|
|
157
|
-
},
|
|
157
|
+
}, Y = (e, t, n, o) => {
|
|
158
158
|
const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), s = r.length % 2 === 0 ? 1 : 0;
|
|
159
159
|
let i;
|
|
160
160
|
return o === -1 && l === 1 ? i = n[0] - 1 : o === 1 && l === -1 ? i = n[n.length - 1] - s + 1 : i = l === -1 ? n[0] : n[n.length - 1] - s, e.splice(i, 0, ...r), e;
|
|
161
|
-
},
|
|
162
|
-
let l = P(
|
|
163
|
-
return l =
|
|
164
|
-
},
|
|
165
|
-
let l =
|
|
166
|
-
return l =
|
|
161
|
+
}, $e = (e, t, n, o) => {
|
|
162
|
+
let l = P(Q(e.node));
|
|
163
|
+
return l = Y(l, t, n, o), l = P(l), J(e.node, l);
|
|
164
|
+
}, _e = (e, t, n, o) => {
|
|
165
|
+
let l = Q(e.node);
|
|
166
|
+
return l = Y(l, t, n, o), J(e.node, l);
|
|
167
167
|
}, B = (e, t) => {
|
|
168
168
|
let n = e, o = e;
|
|
169
169
|
for (let c = e; c >= 0; c--) {
|
|
170
|
-
const d =
|
|
170
|
+
const d = g(c, t.selection);
|
|
171
171
|
d && d.forEach((m) => {
|
|
172
172
|
const f = m.node.attrs.colspan + c - 1;
|
|
173
173
|
f >= n && (n = c), f > o && (o = f);
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
for (let c = e; c <= o; c++) {
|
|
177
|
-
const d =
|
|
177
|
+
const d = g(c, t.selection);
|
|
178
178
|
d && d.forEach((m) => {
|
|
179
179
|
const f = m.node.attrs.colspan + c - 1;
|
|
180
180
|
m.node.attrs.colspan > 1 && f > o && (o = f);
|
|
@@ -182,16 +182,16 @@ const X = (e) => (t) => (n) => {
|
|
|
182
182
|
}
|
|
183
183
|
const l = [];
|
|
184
184
|
for (let c = n; c <= o; c++) {
|
|
185
|
-
const d =
|
|
185
|
+
const d = g(c, t.selection);
|
|
186
186
|
d && d.length && l.push(c);
|
|
187
187
|
}
|
|
188
188
|
n = l[0], o = l[l.length - 1];
|
|
189
|
-
const r =
|
|
189
|
+
const r = g(n, t.selection), s = b(0, t.selection), i = t.doc.resolve(
|
|
190
190
|
r[r.length - 1].pos
|
|
191
191
|
);
|
|
192
192
|
let a;
|
|
193
193
|
for (let c = o; c >= n; c--) {
|
|
194
|
-
const d =
|
|
194
|
+
const d = g(c, t.selection);
|
|
195
195
|
if (d && d.length) {
|
|
196
196
|
for (let m = s.length - 1; m >= 0; m--)
|
|
197
197
|
if (s[m].pos === d[0].pos) {
|
|
@@ -207,25 +207,25 @@ const X = (e) => (t) => (n) => {
|
|
|
207
207
|
}, F = (e, t) => {
|
|
208
208
|
let n = e, o = e;
|
|
209
209
|
for (let c = e; c >= 0; c--)
|
|
210
|
-
|
|
210
|
+
b(c, t.selection).forEach((m) => {
|
|
211
211
|
const f = m.node.attrs.rowspan + c - 1;
|
|
212
212
|
f >= n && (n = c), f > o && (o = f);
|
|
213
213
|
});
|
|
214
214
|
for (let c = e; c <= o; c++)
|
|
215
|
-
|
|
215
|
+
b(c, t.selection).forEach((m) => {
|
|
216
216
|
const f = m.node.attrs.rowspan + c - 1;
|
|
217
217
|
m.node.attrs.rowspan > 1 && f > o && (o = f);
|
|
218
218
|
});
|
|
219
219
|
const l = [];
|
|
220
220
|
for (let c = n; c <= o; c++) {
|
|
221
|
-
const d =
|
|
221
|
+
const d = b(c, t.selection);
|
|
222
222
|
d && d.length && l.push(c);
|
|
223
223
|
}
|
|
224
224
|
n = l[0], o = l[l.length - 1];
|
|
225
|
-
const r =
|
|
225
|
+
const r = b(n, t.selection), s = g(0, t.selection), i = t.doc.resolve(r[r.length - 1].pos);
|
|
226
226
|
let a;
|
|
227
227
|
for (let c = o; c >= n; c--) {
|
|
228
|
-
const d =
|
|
228
|
+
const d = b(c, t.selection);
|
|
229
229
|
if (d && d.length) {
|
|
230
230
|
for (let m = s.length - 1; m >= 0; m--)
|
|
231
231
|
if (s[m].pos === d[0].pos) {
|
|
@@ -239,51 +239,51 @@ const X = (e) => (t) => (n) => {
|
|
|
239
239
|
const u = t.doc.resolve(a.pos);
|
|
240
240
|
return { $anchor: i, $head: u, indexes: l };
|
|
241
241
|
};
|
|
242
|
-
function
|
|
242
|
+
function Ee(e, t, n, o = !0) {
|
|
243
243
|
const l = k(e.selection);
|
|
244
244
|
if (!l)
|
|
245
245
|
return e;
|
|
246
246
|
const { indexes: r } = B(t, e), { indexes: s } = B(n, e);
|
|
247
247
|
if (r.includes(n))
|
|
248
248
|
return e;
|
|
249
|
-
const i =
|
|
249
|
+
const i = $e(
|
|
250
250
|
l,
|
|
251
251
|
r,
|
|
252
252
|
s,
|
|
253
253
|
0
|
|
254
|
-
), a =
|
|
254
|
+
), a = A(e).replaceWith(
|
|
255
255
|
l.pos,
|
|
256
256
|
l.pos + l.node.nodeSize,
|
|
257
257
|
i
|
|
258
258
|
);
|
|
259
259
|
if (!o)
|
|
260
260
|
return a;
|
|
261
|
-
const u = h.get(i), c = l.start, d = n, m = u.positionAt(u.height - 1, d, i), f = a.doc.resolve(c + m),
|
|
262
|
-
return a.setSelection(
|
|
261
|
+
const u = h.get(i), c = l.start, d = n, m = u.positionAt(u.height - 1, d, i), f = a.doc.resolve(c + m), M = C.colSelection, R = u.positionAt(0, d, i), v = a.doc.resolve(c + R);
|
|
262
|
+
return a.setSelection(M(f, v));
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function Ie(e, t, n, o = !0) {
|
|
265
265
|
const l = k(e.selection);
|
|
266
266
|
if (!l)
|
|
267
267
|
return e;
|
|
268
268
|
const { indexes: r } = F(t, e), { indexes: s } = F(n, e);
|
|
269
269
|
if (r.includes(n))
|
|
270
270
|
return e;
|
|
271
|
-
const i =
|
|
271
|
+
const i = _e(
|
|
272
272
|
l,
|
|
273
273
|
r,
|
|
274
274
|
s,
|
|
275
275
|
0
|
|
276
|
-
), a =
|
|
276
|
+
), a = A(e).replaceWith(
|
|
277
277
|
l.pos,
|
|
278
278
|
l.pos + l.node.nodeSize,
|
|
279
279
|
i
|
|
280
280
|
);
|
|
281
281
|
if (!o)
|
|
282
282
|
return a;
|
|
283
|
-
const u = h.get(i), c = l.start, d = n, m = u.positionAt(d, u.width - 1, i), f = a.doc.resolve(c + m),
|
|
284
|
-
return a.setSelection(
|
|
283
|
+
const u = h.get(i), c = l.start, d = n, m = u.positionAt(d, u.width - 1, i), f = a.doc.resolve(c + m), M = C.rowSelection, R = u.positionAt(d, 0, i), v = a.doc.resolve(c + R);
|
|
284
|
+
return a.setSelection(M(f, v));
|
|
285
285
|
}
|
|
286
|
-
const
|
|
286
|
+
const T = ie({
|
|
287
287
|
tableGroup: "block",
|
|
288
288
|
cellContent: "paragraph",
|
|
289
289
|
cellAttributes: {
|
|
@@ -296,7 +296,7 @@ const M = ae({
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}), E = w("table", () => ({
|
|
299
|
-
...
|
|
299
|
+
...T.table,
|
|
300
300
|
parseMarkdown: {
|
|
301
301
|
match: (e) => e.type === "table",
|
|
302
302
|
runner: (e, t, n) => {
|
|
@@ -322,7 +322,7 @@ const M = ae({
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
})), I = w("table_row", () => ({
|
|
325
|
-
...
|
|
325
|
+
...T.table_row,
|
|
326
326
|
parseMarkdown: {
|
|
327
327
|
match: (e) => e.type === "tableRow",
|
|
328
328
|
runner: (e, t, n) => {
|
|
@@ -341,7 +341,7 @@ const M = ae({
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
})), O = w("table_cell", () => ({
|
|
344
|
-
...
|
|
344
|
+
...T.table_cell,
|
|
345
345
|
parseMarkdown: {
|
|
346
346
|
match: (e) => e.type === "tableCell" && !e.isHeader,
|
|
347
347
|
runner: (e, t, n) => {
|
|
@@ -355,8 +355,8 @@ const M = ae({
|
|
|
355
355
|
e.openNode("tableCell").next(t.content).closeNode();
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
})),
|
|
359
|
-
...
|
|
358
|
+
})), ee = w("table_header", () => ({
|
|
359
|
+
...T.table_header,
|
|
360
360
|
parseMarkdown: {
|
|
361
361
|
match: (e) => e.type === "tableCell" && !!e.isHeader,
|
|
362
362
|
runner: (e, t, n) => {
|
|
@@ -370,87 +370,87 @@ const M = ae({
|
|
|
370
370
|
e.openNode("tableCell"), e.next(t.content), e.closeNode();
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
})),
|
|
373
|
+
})), Oe = ke(() => new re(
|
|
374
374
|
/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
|
|
375
375
|
(e, t, n, o) => {
|
|
376
376
|
var i, a;
|
|
377
377
|
const l = e.doc.resolve(n);
|
|
378
378
|
if (!l.node(-1).canReplaceWith(l.index(-1), l.indexAfter(-1), E.type()))
|
|
379
379
|
return null;
|
|
380
|
-
const r =
|
|
380
|
+
const r = U(
|
|
381
381
|
Number((i = t.groups) == null ? void 0 : i.row),
|
|
382
382
|
Number((a = t.groups) == null ? void 0 : a.col)
|
|
383
383
|
), s = e.tr.replaceRangeWith(n, o, r).scrollIntoView();
|
|
384
|
-
return s.setSelection(
|
|
384
|
+
return s.setSelection(se.create(s.doc, n + 3));
|
|
385
385
|
}
|
|
386
|
-
)),
|
|
386
|
+
)), te = p("GoToPrevTableCell", () => () => L(-1)), oe = p("GoToNextTableCell", () => () => L(1)), ne = p("BreakTable", () => () => (e, t) => {
|
|
387
387
|
if (!y(e))
|
|
388
388
|
return !1;
|
|
389
389
|
const { $head: n } = e.selection, o = n.after(), l = e.tr.replaceWith(o, o, W.type().createAndFill());
|
|
390
390
|
return l.setSelection(K.near(l.doc.resolve(o), 1)).scrollIntoView(), t == null || t(l), !0;
|
|
391
|
-
}),
|
|
392
|
-
const { selection: l, tr: r } = n, { from: s } = l, i =
|
|
391
|
+
}), De = p("InsertTable", () => ({ row: e, col: t } = {}) => (n, o) => {
|
|
392
|
+
const { selection: l, tr: r } = n, { from: s } = l, i = U(e, t), a = r.replaceSelectionWith(i), u = K.findFrom(a.doc.resolve(s), 1, !0);
|
|
393
393
|
return u && (o == null || o(a.setSelection(u))), !0;
|
|
394
|
-
}),
|
|
395
|
-
const { tr: l } = n, r = o == null ? void 0 : o(
|
|
394
|
+
}), Pe = p("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
395
|
+
const { tr: l } = n, r = o == null ? void 0 : o(Ie(l, e ?? 0, t ?? 0, !0));
|
|
396
396
|
return Boolean(r);
|
|
397
|
-
}),
|
|
398
|
-
const { tr: l } = n, r = o == null ? void 0 : o(
|
|
397
|
+
}), Be = p("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
398
|
+
const { tr: l } = n, r = o == null ? void 0 : o(Ee(l, e ?? 0, t ?? 0, !0));
|
|
399
399
|
return Boolean(r);
|
|
400
|
-
}),
|
|
401
|
-
const { tr: o } = t, l = n == null ? void 0 : n(
|
|
400
|
+
}), Fe = p("SelectRow", () => (e = 0) => (t, n) => {
|
|
401
|
+
const { tr: o } = t, l = n == null ? void 0 : n(Ne(e)(o));
|
|
402
402
|
return Boolean(l);
|
|
403
|
-
}),
|
|
404
|
-
const { tr: o } = t, l = n == null ? void 0 : n(
|
|
403
|
+
}), He = p("SelectCol", () => (e = 0) => (t, n) => {
|
|
404
|
+
const { tr: o } = t, l = n == null ? void 0 : n(xe(e)(o));
|
|
405
405
|
return Boolean(l);
|
|
406
|
-
}),
|
|
407
|
-
const { tr: n } = e, o = t == null ? void 0 : t(
|
|
406
|
+
}), We = p("SelectTable", () => () => (e, t) => {
|
|
407
|
+
const { tr: n } = e, o = t == null ? void 0 : t(ve(n));
|
|
408
408
|
return Boolean(o);
|
|
409
|
-
}),
|
|
409
|
+
}), Ke = p("DeleteSelectedCells", () => () => (e, t) => {
|
|
410
410
|
const { selection: n } = e;
|
|
411
411
|
if (!(n instanceof C))
|
|
412
412
|
return !1;
|
|
413
413
|
const o = n.isRowSelection(), l = n.isColSelection();
|
|
414
|
-
return o && l ?
|
|
415
|
-
}),
|
|
414
|
+
return o && l ? de(e, t) : l ? ue(e, t) : me(e, t);
|
|
415
|
+
}), Le = p("AddColBefore", () => () => fe), ze = p("AddColAfter", () => () => pe), Ge = p("AddRowBefore", () => () => (e, t) => {
|
|
416
416
|
if (!y(e))
|
|
417
417
|
return !1;
|
|
418
418
|
if (t) {
|
|
419
419
|
const n = z(e);
|
|
420
|
-
t(
|
|
420
|
+
t(X(e.tr, n, n.top));
|
|
421
421
|
}
|
|
422
422
|
return !0;
|
|
423
|
-
}),
|
|
423
|
+
}), je = p("AddRowAfter", () => () => (e, t) => {
|
|
424
424
|
if (!y(e))
|
|
425
425
|
return !1;
|
|
426
426
|
if (t) {
|
|
427
427
|
const n = z(e);
|
|
428
|
-
t(
|
|
428
|
+
t(X(e.tr, n, n.bottom));
|
|
429
429
|
}
|
|
430
430
|
return !0;
|
|
431
|
-
}),
|
|
431
|
+
}), Ve = p("SetAlign", () => (e = "left") => he("alignment", e)), Ze = G("tableKeymap", {
|
|
432
432
|
NextCell: {
|
|
433
433
|
shortcuts: ["Mod-]", "Tab"],
|
|
434
434
|
command: (e) => {
|
|
435
435
|
const t = e.get(S);
|
|
436
|
-
return () => t.call(
|
|
436
|
+
return () => t.call(oe.key);
|
|
437
437
|
}
|
|
438
438
|
},
|
|
439
439
|
PrevCell: {
|
|
440
440
|
shortcuts: ["Mod-[", "Shift-Tab"],
|
|
441
441
|
command: (e) => {
|
|
442
442
|
const t = e.get(S);
|
|
443
|
-
return () => t.call(
|
|
443
|
+
return () => t.call(te.key);
|
|
444
444
|
}
|
|
445
445
|
},
|
|
446
446
|
ExitTable: {
|
|
447
447
|
shortcuts: ["Mod-Enter"],
|
|
448
448
|
command: (e) => {
|
|
449
449
|
const t = e.get(S);
|
|
450
|
-
return () => t.call(
|
|
450
|
+
return () => t.call(ne.key);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
}), N = "footnote_definition", H = "footnoteDefinition",
|
|
453
|
+
}), N = "footnote_definition", H = "footnoteDefinition", Ue = w("footnote_definition", () => ({
|
|
454
454
|
group: "block",
|
|
455
455
|
content: "block+",
|
|
456
456
|
defining: !0,
|
|
@@ -501,7 +501,7 @@ const M = ae({
|
|
|
501
501
|
}).next(t.content).closeNode();
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
})), x = "footnote_reference",
|
|
504
|
+
})), x = "footnote_reference", Xe = w("footnote_reference", () => ({
|
|
505
505
|
group: "inline",
|
|
506
506
|
inline: !0,
|
|
507
507
|
atom: !0,
|
|
@@ -550,7 +550,7 @@ const M = ae({
|
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
})),
|
|
553
|
+
})), qe = le.extendSchema((e) => (t) => {
|
|
554
554
|
const n = e(t);
|
|
555
555
|
return {
|
|
556
556
|
...n,
|
|
@@ -610,14 +610,14 @@ const M = ae({
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
|
-
}),
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
].flat(),
|
|
617
|
-
|
|
618
|
-
],
|
|
619
|
-
const e = new
|
|
620
|
-
return new
|
|
613
|
+
}), Je = [
|
|
614
|
+
Me,
|
|
615
|
+
Ze
|
|
616
|
+
].flat(), Qe = [
|
|
617
|
+
Oe
|
|
618
|
+
], Ye = _(() => {
|
|
619
|
+
const e = new ce("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), t = (o) => o.type === W.type(), n = (o) => t(o) && o.nodeSize === 2;
|
|
620
|
+
return new ae({
|
|
621
621
|
key: e,
|
|
622
622
|
props: {
|
|
623
623
|
handleDOMEvents: {
|
|
@@ -632,84 +632,85 @@ const M = ae({
|
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
634
|
});
|
|
635
|
-
}),
|
|
636
|
-
Je,
|
|
637
|
-
Qe,
|
|
635
|
+
}), et = _(() => ge({})), tt = _(() => be()), ot = ye(() => Te), nt = [
|
|
638
636
|
Ye,
|
|
639
|
-
et
|
|
640
|
-
|
|
641
|
-
|
|
637
|
+
et,
|
|
638
|
+
tt,
|
|
639
|
+
ot
|
|
640
|
+
], lt = [
|
|
641
|
+
qe,
|
|
642
642
|
E,
|
|
643
643
|
I,
|
|
644
|
-
Y,
|
|
645
|
-
O,
|
|
646
|
-
Ve,
|
|
647
|
-
Ze,
|
|
648
|
-
j
|
|
649
|
-
].flat(), nt = [
|
|
650
|
-
te,
|
|
651
644
|
ee,
|
|
645
|
+
O,
|
|
646
|
+
Ue,
|
|
647
|
+
Xe,
|
|
648
|
+
j,
|
|
649
|
+
V
|
|
650
|
+
].flat(), rt = [
|
|
652
651
|
oe,
|
|
653
|
-
|
|
654
|
-
|
|
652
|
+
te,
|
|
653
|
+
ne,
|
|
655
654
|
De,
|
|
656
655
|
Pe,
|
|
657
656
|
Be,
|
|
658
657
|
Fe,
|
|
659
658
|
He,
|
|
660
|
-
Le,
|
|
661
|
-
ze,
|
|
662
659
|
We,
|
|
663
660
|
Ke,
|
|
664
661
|
Ge,
|
|
665
|
-
|
|
666
|
-
|
|
662
|
+
je,
|
|
663
|
+
Le,
|
|
664
|
+
ze,
|
|
665
|
+
Ve,
|
|
666
|
+
Z
|
|
667
|
+
], gt = [lt, Qe, Je, nt, rt].flat();
|
|
667
668
|
export {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
Ue as extendListItemSchemaForTask,
|
|
669
|
+
ze as addColAfterCommand,
|
|
670
|
+
Le as addColBeforeCommand,
|
|
671
|
+
je as addRowAfterCommand,
|
|
672
|
+
Ge as addRowBeforeCommand,
|
|
673
|
+
X as addRowWithAlignment,
|
|
674
|
+
ne as breakTableCommand,
|
|
675
|
+
rt as commands,
|
|
676
|
+
U as createTable,
|
|
677
|
+
Ke as deleteSelectedCellsCommand,
|
|
678
|
+
qe as extendListItemSchemaForTask,
|
|
679
679
|
k as findTable,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
680
|
+
Ue as footnoteDefinitionSchema,
|
|
681
|
+
Xe as footnoteReferenceSchema,
|
|
682
|
+
Re as getAllCellsInTable,
|
|
683
|
+
g as getCellsInCol,
|
|
684
|
+
b as getCellsInRow,
|
|
685
|
+
gt as gfm,
|
|
686
|
+
oe as goToNextTableCellCommand,
|
|
687
|
+
te as goToPrevTableCellCommand,
|
|
688
|
+
Qe as inputrules,
|
|
689
|
+
De as insertTableCommand,
|
|
690
|
+
Oe as insertTableInputRule,
|
|
691
|
+
Je as keymap,
|
|
692
|
+
Ee as moveCol,
|
|
693
|
+
Be as moveColCommand,
|
|
694
|
+
Ie as moveRow,
|
|
695
|
+
Pe as moveRowCommand,
|
|
696
|
+
nt as plugins,
|
|
697
|
+
lt as schema,
|
|
698
|
+
xe as selectCol,
|
|
699
|
+
He as selectColCommand,
|
|
700
|
+
q as selectLine,
|
|
701
|
+
Ne as selectRow,
|
|
702
|
+
Fe as selectRowCommand,
|
|
703
|
+
ve as selectTable,
|
|
704
|
+
We as selectTableCommand,
|
|
705
|
+
Ve as setAlignCommand,
|
|
706
|
+
j as strikethroughAttr,
|
|
707
|
+
Me as strikethroughKeymap,
|
|
708
|
+
V as strikethroughSchema,
|
|
708
709
|
O as tableCellSchema,
|
|
709
|
-
|
|
710
|
-
|
|
710
|
+
ee as tableHeaderSchema,
|
|
711
|
+
Ze as tableKeymap,
|
|
711
712
|
I as tableRowSchema,
|
|
712
713
|
E as tableSchema,
|
|
713
|
-
|
|
714
|
+
Z as toggleStrikethroughCommand
|
|
714
715
|
};
|
|
715
716
|
//# sourceMappingURL=index.es.js.map
|