@milkdown/preset-gfm 7.1.1 → 7.1.2-next.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/__internal__/index.d.ts +2 -0
- package/lib/__internal__/index.d.ts.map +1 -0
- package/lib/__internal__/with-meta.d.ts +3 -0
- package/lib/__internal__/with-meta.d.ts.map +1 -0
- package/lib/index.es.js +515 -309
- package/lib/index.es.js.map +1 -1
- package/lib/mark/strike-through.d.ts +1 -1
- 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/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 +13 -13
- package/src/__internal__/index.ts +3 -0
- package/src/__internal__/with-meta.ts +16 -0
- package/src/mark/strike-through.ts +31 -0
- package/src/node/footnote/definition.ts +11 -0
- package/src/node/footnote/reference.ts +11 -0
- package/src/node/table/index.ts +131 -1
- package/src/node/task-list-item.ts +11 -0
- package/src/plugin/auto-insert-zero-space-plugin.ts +6 -0
- package/src/plugin/column-resizing-plugin.ts +6 -0
- package/src/plugin/remark-gfm-plugin.ts +6 -0
- package/src/plugin/table-editing-plugin.ts +6 -0
package/lib/index.es.js
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import { expectDomTypeError as
|
|
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
|
-
const
|
|
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";
|
|
5
|
+
import { commandsCtx as A } 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 { findParentNode as Ze, cloneTr as M, browser as V } from "@milkdown/prose";
|
|
9
|
+
import { toggleMark as Ve } from "@milkdown/prose/commands";
|
|
10
|
+
import Ue from "remark-gfm";
|
|
11
|
+
const d = (e, t) => (Object.assign(e, {
|
|
12
|
+
meta: {
|
|
13
|
+
package: "@milkdown/preset-gfm",
|
|
14
|
+
...t
|
|
15
|
+
}
|
|
16
|
+
}), e), K = $e("strike_through");
|
|
17
|
+
d(K, {
|
|
18
|
+
displayName: "Attr<strikethrough>",
|
|
19
|
+
group: "Strikethrough"
|
|
20
|
+
});
|
|
21
|
+
const x = _e("strike_through", (e) => ({
|
|
12
22
|
inclusive: !1,
|
|
13
23
|
parseDOM: [
|
|
14
24
|
{ tag: "del" },
|
|
15
25
|
{ style: "text-decoration", getAttrs: (t) => t === "line-through" }
|
|
16
26
|
],
|
|
17
|
-
toDOM: (t) => ["del", e.get(
|
|
27
|
+
toDOM: (t) => ["del", e.get(K.key)(t)],
|
|
18
28
|
parseMarkdown: {
|
|
19
29
|
match: (t) => t.type === "delete",
|
|
20
30
|
runner: (t, n, o) => {
|
|
@@ -27,263 +37,286 @@ const Z = ce("strike_through"), U = ae("strike_through", (e) => ({
|
|
|
27
37
|
t.withMark(n, "delete");
|
|
28
38
|
}
|
|
29
39
|
}
|
|
30
|
-
}))
|
|
40
|
+
}));
|
|
41
|
+
d(x.mark, {
|
|
42
|
+
displayName: "MarkSchema<strikethrough>",
|
|
43
|
+
group: "Strikethrough"
|
|
44
|
+
});
|
|
45
|
+
d(x.ctx, {
|
|
46
|
+
displayName: "MarkSchemaCtx<strikethrough>",
|
|
47
|
+
group: "Strikethrough"
|
|
48
|
+
});
|
|
49
|
+
const H = h("ToggleStrikeThrough", () => () => Ve(x.type()));
|
|
50
|
+
d(H, {
|
|
51
|
+
displayName: "Command<ToggleStrikethrough>",
|
|
52
|
+
group: "Strikethrough"
|
|
53
|
+
});
|
|
54
|
+
const L = ee("strikeThroughKeymap", {
|
|
31
55
|
ToggleStrikethrough: {
|
|
32
56
|
shortcuts: "Mod-Alt-x",
|
|
33
57
|
command: (e) => {
|
|
34
|
-
const t = e.get(
|
|
35
|
-
return () => t.call(
|
|
58
|
+
const t = e.get(A);
|
|
59
|
+
return () => t.call(H.key);
|
|
36
60
|
}
|
|
37
61
|
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
});
|
|
63
|
+
d(L.ctx, {
|
|
64
|
+
displayName: "KeymapCtx<strikethrough>",
|
|
65
|
+
group: "Strikethrough"
|
|
66
|
+
});
|
|
67
|
+
d(L.shortcuts, {
|
|
68
|
+
displayName: "Keymap<strikethrough>",
|
|
69
|
+
group: "Strikethrough"
|
|
70
|
+
});
|
|
71
|
+
const re = (e = 3, t = 3) => {
|
|
72
|
+
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));
|
|
73
|
+
return T.type().create(null, l);
|
|
74
|
+
}, w = (e) => Ze((t) => t.type.spec.tableRole === "table")(e), b = (e, t) => {
|
|
75
|
+
const n = w(t);
|
|
43
76
|
if (!n)
|
|
44
77
|
return;
|
|
45
|
-
const o =
|
|
78
|
+
const o = g.get(n.node);
|
|
46
79
|
if (!(e < 0 || e >= o.width))
|
|
47
80
|
return o.cellsInRect({ left: e, right: e + 1, top: 0, bottom: o.height }).map((l) => {
|
|
48
81
|
const r = n.node.nodeAt(l);
|
|
49
82
|
if (!r)
|
|
50
83
|
return;
|
|
51
|
-
const
|
|
84
|
+
const a = l + n.start;
|
|
52
85
|
return {
|
|
53
|
-
pos:
|
|
54
|
-
start:
|
|
86
|
+
pos: a,
|
|
87
|
+
start: a + 1,
|
|
55
88
|
node: r
|
|
56
89
|
};
|
|
57
90
|
}).filter((l) => l != null);
|
|
58
|
-
},
|
|
59
|
-
const n =
|
|
91
|
+
}, C = (e, t) => {
|
|
92
|
+
const n = w(t);
|
|
60
93
|
if (!n)
|
|
61
94
|
return;
|
|
62
|
-
const o =
|
|
95
|
+
const o = g.get(n.node);
|
|
63
96
|
if (!(e < 0 || e >= o.height))
|
|
64
97
|
return o.cellsInRect({ left: 0, right: o.width, top: e, bottom: e + 1 }).map((l) => {
|
|
65
98
|
const r = n.node.nodeAt(l);
|
|
66
99
|
if (!r)
|
|
67
100
|
return;
|
|
68
|
-
const
|
|
101
|
+
const a = l + n.start;
|
|
69
102
|
return {
|
|
70
|
-
pos:
|
|
71
|
-
start:
|
|
103
|
+
pos: a,
|
|
104
|
+
start: a + 1,
|
|
72
105
|
node: r
|
|
73
106
|
};
|
|
74
107
|
}).filter((l) => l != null);
|
|
75
|
-
},
|
|
76
|
-
const t =
|
|
108
|
+
}, Xe = (e) => {
|
|
109
|
+
const t = w(e);
|
|
77
110
|
if (!t)
|
|
78
111
|
return;
|
|
79
|
-
const n =
|
|
112
|
+
const n = g.get(t.node);
|
|
80
113
|
return n.cellsInRect({
|
|
81
114
|
left: 0,
|
|
82
115
|
right: n.width,
|
|
83
116
|
top: 0,
|
|
84
117
|
bottom: n.height
|
|
85
118
|
}).map((l) => {
|
|
86
|
-
const r = t.node.nodeAt(l),
|
|
87
|
-
return { pos:
|
|
119
|
+
const r = t.node.nodeAt(l), a = l + t.start;
|
|
120
|
+
return { pos: a, start: a + 1, node: r };
|
|
88
121
|
});
|
|
89
|
-
},
|
|
90
|
-
const t =
|
|
122
|
+
}, qe = (e) => {
|
|
123
|
+
const t = Xe(e.selection);
|
|
91
124
|
if (t && t[0]) {
|
|
92
125
|
const n = e.doc.resolve(t[0].pos), o = t[t.length - 1];
|
|
93
126
|
if (o) {
|
|
94
127
|
const l = e.doc.resolve(o.pos);
|
|
95
|
-
return
|
|
128
|
+
return M(e.setSelection(new y(l, n)));
|
|
96
129
|
}
|
|
97
130
|
}
|
|
98
131
|
return e;
|
|
99
132
|
};
|
|
100
|
-
function
|
|
101
|
-
const r = Array(l).fill(0).reduce((i,
|
|
102
|
-
const
|
|
103
|
-
return
|
|
133
|
+
function ae(e, { map: t, tableStart: n, table: o }, l) {
|
|
134
|
+
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) => {
|
|
135
|
+
const m = o.nodeAt(t.map[c]);
|
|
136
|
+
return R.type().createAndFill({ alignment: m == null ? void 0 : m.attrs.alignment });
|
|
104
137
|
});
|
|
105
|
-
return e.insert(r,
|
|
138
|
+
return e.insert(r, S.type().create(null, a)), e;
|
|
106
139
|
}
|
|
107
|
-
const
|
|
108
|
-
const o =
|
|
140
|
+
const se = (e) => (t) => (n) => {
|
|
141
|
+
const o = w(n.selection), l = e === "row";
|
|
109
142
|
if (o) {
|
|
110
|
-
const r =
|
|
143
|
+
const r = g.get(o.node);
|
|
111
144
|
if (t >= 0 && t < (l ? r.height : r.width)) {
|
|
112
|
-
const
|
|
145
|
+
const a = r.positionAt(
|
|
113
146
|
l ? t : r.height - 1,
|
|
114
147
|
l ? r.width - 1 : t,
|
|
115
148
|
o.node
|
|
116
|
-
), i = n.doc.resolve(o.start +
|
|
117
|
-
return
|
|
149
|
+
), 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);
|
|
150
|
+
return M(n.setSelection(c(i, s)));
|
|
118
151
|
}
|
|
119
152
|
}
|
|
120
153
|
return n;
|
|
121
|
-
},
|
|
122
|
-
const n = [], o =
|
|
154
|
+
}, Je = se("row"), Qe = se("col"), U = (e) => e[0].map((t, n) => e.map((o) => o[n])), ce = (e, t) => {
|
|
155
|
+
const n = [], o = g.get(e);
|
|
123
156
|
for (let r = 0; r < o.height; r++) {
|
|
124
|
-
const
|
|
125
|
-
for (let
|
|
126
|
-
if (!t[r][
|
|
157
|
+
const a = e.child(r), i = [];
|
|
158
|
+
for (let c = 0; c < o.width; c++) {
|
|
159
|
+
if (!t[r][c])
|
|
127
160
|
continue;
|
|
128
|
-
const
|
|
129
|
-
Object.assign({},
|
|
130
|
-
|
|
131
|
-
|
|
161
|
+
const m = o.map[r * o.width + c], s = t[r][c], p = e.nodeAt(m).type.createChecked(
|
|
162
|
+
Object.assign({}, s.attrs),
|
|
163
|
+
s.content,
|
|
164
|
+
s.marks
|
|
132
165
|
);
|
|
133
|
-
i.push(
|
|
166
|
+
i.push(p);
|
|
134
167
|
}
|
|
135
|
-
n.push(
|
|
168
|
+
n.push(a.type.createChecked(a.attrs, i, a.marks));
|
|
136
169
|
}
|
|
137
170
|
return e.type.createChecked(
|
|
138
171
|
e.attrs,
|
|
139
172
|
n,
|
|
140
173
|
e.marks
|
|
141
174
|
);
|
|
142
|
-
},
|
|
143
|
-
const t =
|
|
175
|
+
}, ie = (e) => {
|
|
176
|
+
const t = g.get(e), n = [];
|
|
144
177
|
for (let o = 0; o < t.height; o++) {
|
|
145
178
|
const l = [], r = {};
|
|
146
|
-
for (let
|
|
147
|
-
const i = t.map[o * t.width +
|
|
148
|
-
if (r[i] ||
|
|
179
|
+
for (let a = 0; a < t.width; a++) {
|
|
180
|
+
const i = t.map[o * t.width + a], c = e.nodeAt(i), m = t.findCell(i);
|
|
181
|
+
if (r[i] || m.top !== o) {
|
|
149
182
|
l.push(null);
|
|
150
183
|
continue;
|
|
151
184
|
}
|
|
152
|
-
r[i] = !0, l.push(
|
|
185
|
+
r[i] = !0, l.push(c);
|
|
153
186
|
}
|
|
154
187
|
n.push(l);
|
|
155
188
|
}
|
|
156
189
|
return n;
|
|
157
|
-
},
|
|
158
|
-
const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length),
|
|
190
|
+
}, de = (e, t, n, o) => {
|
|
191
|
+
const l = t[0] > n[0] ? -1 : 1, r = e.splice(t[0], t.length), a = r.length % 2 === 0 ? 1 : 0;
|
|
159
192
|
let i;
|
|
160
|
-
return o === -1 && l === 1 ? i = n[0] - 1 : o === 1 && l === -1 ? i = n[n.length - 1] -
|
|
161
|
-
},
|
|
162
|
-
let l =
|
|
163
|
-
return l =
|
|
164
|
-
},
|
|
165
|
-
let l =
|
|
166
|
-
return l =
|
|
167
|
-
},
|
|
193
|
+
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;
|
|
194
|
+
}, Ye = (e, t, n, o) => {
|
|
195
|
+
let l = U(ie(e.node));
|
|
196
|
+
return l = de(l, t, n, o), l = U(l), ce(e.node, l);
|
|
197
|
+
}, et = (e, t, n, o) => {
|
|
198
|
+
let l = ie(e.node);
|
|
199
|
+
return l = de(l, t, n, o), ce(e.node, l);
|
|
200
|
+
}, X = (e, t) => {
|
|
168
201
|
let n = e, o = e;
|
|
169
|
-
for (let
|
|
170
|
-
const u =
|
|
171
|
-
u && u.forEach((
|
|
172
|
-
const f =
|
|
173
|
-
f >= n && (n =
|
|
202
|
+
for (let s = e; s >= 0; s--) {
|
|
203
|
+
const u = b(s, t.selection);
|
|
204
|
+
u && u.forEach((p) => {
|
|
205
|
+
const f = p.node.attrs.colspan + s - 1;
|
|
206
|
+
f >= n && (n = s), f > o && (o = f);
|
|
174
207
|
});
|
|
175
208
|
}
|
|
176
|
-
for (let
|
|
177
|
-
const u =
|
|
178
|
-
u && u.forEach((
|
|
179
|
-
const f =
|
|
180
|
-
|
|
209
|
+
for (let s = e; s <= o; s++) {
|
|
210
|
+
const u = b(s, t.selection);
|
|
211
|
+
u && u.forEach((p) => {
|
|
212
|
+
const f = p.node.attrs.colspan + s - 1;
|
|
213
|
+
p.node.attrs.colspan > 1 && f > o && (o = f);
|
|
181
214
|
});
|
|
182
215
|
}
|
|
183
216
|
const l = [];
|
|
184
|
-
for (let
|
|
185
|
-
const u =
|
|
186
|
-
u && u.length && l.push(
|
|
217
|
+
for (let s = n; s <= o; s++) {
|
|
218
|
+
const u = b(s, t.selection);
|
|
219
|
+
u && u.length && l.push(s);
|
|
187
220
|
}
|
|
188
221
|
n = l[0], o = l[l.length - 1];
|
|
189
|
-
const r =
|
|
222
|
+
const r = b(n, t.selection), a = C(0, t.selection), i = t.doc.resolve(
|
|
190
223
|
r[r.length - 1].pos
|
|
191
224
|
);
|
|
192
|
-
let
|
|
193
|
-
for (let
|
|
194
|
-
const u =
|
|
225
|
+
let c;
|
|
226
|
+
for (let s = o; s >= n; s--) {
|
|
227
|
+
const u = b(s, t.selection);
|
|
195
228
|
if (u && u.length) {
|
|
196
|
-
for (let
|
|
197
|
-
if (
|
|
198
|
-
|
|
229
|
+
for (let p = a.length - 1; p >= 0; p--)
|
|
230
|
+
if (a[p].pos === u[0].pos) {
|
|
231
|
+
c = u[0];
|
|
199
232
|
break;
|
|
200
233
|
}
|
|
201
|
-
if (
|
|
234
|
+
if (c)
|
|
202
235
|
break;
|
|
203
236
|
}
|
|
204
237
|
}
|
|
205
|
-
const
|
|
206
|
-
return { $anchor: i, $head:
|
|
207
|
-
},
|
|
238
|
+
const m = t.doc.resolve(c.pos);
|
|
239
|
+
return { $anchor: i, $head: m, indexes: l };
|
|
240
|
+
}, q = (e, t) => {
|
|
208
241
|
let n = e, o = e;
|
|
209
|
-
for (let
|
|
210
|
-
|
|
211
|
-
const f =
|
|
212
|
-
f >= n && (n =
|
|
242
|
+
for (let s = e; s >= 0; s--)
|
|
243
|
+
C(s, t.selection).forEach((p) => {
|
|
244
|
+
const f = p.node.attrs.rowspan + s - 1;
|
|
245
|
+
f >= n && (n = s), f > o && (o = f);
|
|
213
246
|
});
|
|
214
|
-
for (let
|
|
215
|
-
|
|
216
|
-
const f =
|
|
217
|
-
|
|
247
|
+
for (let s = e; s <= o; s++)
|
|
248
|
+
C(s, t.selection).forEach((p) => {
|
|
249
|
+
const f = p.node.attrs.rowspan + s - 1;
|
|
250
|
+
p.node.attrs.rowspan > 1 && f > o && (o = f);
|
|
218
251
|
});
|
|
219
252
|
const l = [];
|
|
220
|
-
for (let
|
|
221
|
-
const u =
|
|
222
|
-
u && u.length && l.push(
|
|
253
|
+
for (let s = n; s <= o; s++) {
|
|
254
|
+
const u = C(s, t.selection);
|
|
255
|
+
u && u.length && l.push(s);
|
|
223
256
|
}
|
|
224
257
|
n = l[0], o = l[l.length - 1];
|
|
225
|
-
const r =
|
|
226
|
-
let
|
|
227
|
-
for (let
|
|
228
|
-
const u =
|
|
258
|
+
const r = C(n, t.selection), a = b(0, t.selection), i = t.doc.resolve(r[r.length - 1].pos);
|
|
259
|
+
let c;
|
|
260
|
+
for (let s = o; s >= n; s--) {
|
|
261
|
+
const u = C(s, t.selection);
|
|
229
262
|
if (u && u.length) {
|
|
230
|
-
for (let
|
|
231
|
-
if (
|
|
232
|
-
|
|
263
|
+
for (let p = a.length - 1; p >= 0; p--)
|
|
264
|
+
if (a[p].pos === u[0].pos) {
|
|
265
|
+
c = u[0];
|
|
233
266
|
break;
|
|
234
267
|
}
|
|
235
|
-
if (
|
|
268
|
+
if (c)
|
|
236
269
|
break;
|
|
237
270
|
}
|
|
238
271
|
}
|
|
239
|
-
const
|
|
240
|
-
return { $anchor: i, $head:
|
|
272
|
+
const m = t.doc.resolve(c.pos);
|
|
273
|
+
return { $anchor: i, $head: m, indexes: l };
|
|
241
274
|
};
|
|
242
|
-
function
|
|
243
|
-
const l =
|
|
275
|
+
function tt(e, t, n, o = !0) {
|
|
276
|
+
const l = w(e.selection);
|
|
244
277
|
if (!l)
|
|
245
278
|
return e;
|
|
246
|
-
const { indexes: r } =
|
|
279
|
+
const { indexes: r } = X(t, e), { indexes: a } = X(n, e);
|
|
247
280
|
if (r.includes(n))
|
|
248
281
|
return e;
|
|
249
|
-
const i =
|
|
282
|
+
const i = Ye(
|
|
250
283
|
l,
|
|
251
284
|
r,
|
|
252
|
-
|
|
285
|
+
a,
|
|
253
286
|
0
|
|
254
|
-
),
|
|
287
|
+
), c = M(e).replaceWith(
|
|
255
288
|
l.pos,
|
|
256
289
|
l.pos + l.node.nodeSize,
|
|
257
290
|
i
|
|
258
291
|
);
|
|
259
292
|
if (!o)
|
|
260
|
-
return
|
|
261
|
-
const
|
|
262
|
-
return
|
|
293
|
+
return c;
|
|
294
|
+
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 + _);
|
|
295
|
+
return c.setSelection($(f, P));
|
|
263
296
|
}
|
|
264
|
-
function
|
|
265
|
-
const l =
|
|
297
|
+
function ot(e, t, n, o = !0) {
|
|
298
|
+
const l = w(e.selection);
|
|
266
299
|
if (!l)
|
|
267
300
|
return e;
|
|
268
|
-
const { indexes: r } =
|
|
301
|
+
const { indexes: r } = q(t, e), { indexes: a } = q(n, e);
|
|
269
302
|
if (r.includes(n))
|
|
270
303
|
return e;
|
|
271
|
-
const i =
|
|
304
|
+
const i = et(
|
|
272
305
|
l,
|
|
273
306
|
r,
|
|
274
|
-
|
|
307
|
+
a,
|
|
275
308
|
0
|
|
276
|
-
),
|
|
309
|
+
), c = M(e).replaceWith(
|
|
277
310
|
l.pos,
|
|
278
311
|
l.pos + l.node.nodeSize,
|
|
279
312
|
i
|
|
280
313
|
);
|
|
281
314
|
if (!o)
|
|
282
|
-
return
|
|
283
|
-
const
|
|
284
|
-
return
|
|
315
|
+
return c;
|
|
316
|
+
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 + _);
|
|
317
|
+
return c.setSelection($(f, P));
|
|
285
318
|
}
|
|
286
|
-
const
|
|
319
|
+
const v = Be({
|
|
287
320
|
tableGroup: "block",
|
|
288
321
|
cellContent: "paragraph",
|
|
289
322
|
cellAttributes: {
|
|
@@ -295,15 +328,15 @@ const A = fe({
|
|
|
295
328
|
}
|
|
296
329
|
}
|
|
297
330
|
}
|
|
298
|
-
}),
|
|
299
|
-
...
|
|
331
|
+
}), T = k("table", () => ({
|
|
332
|
+
...v.table,
|
|
300
333
|
parseMarkdown: {
|
|
301
334
|
match: (e) => e.type === "table",
|
|
302
335
|
runner: (e, t, n) => {
|
|
303
|
-
const o = t.align, l = t.children.map((r,
|
|
336
|
+
const o = t.align, l = t.children.map((r, a) => ({
|
|
304
337
|
...r,
|
|
305
338
|
align: o,
|
|
306
|
-
isHeader:
|
|
339
|
+
isHeader: a === 0
|
|
307
340
|
}));
|
|
308
341
|
e.openNode(n), e.next(l), e.closeNode();
|
|
309
342
|
}
|
|
@@ -321,14 +354,23 @@ const A = fe({
|
|
|
321
354
|
}), e.openNode("table", void 0, { align: o }), e.next(t.content), e.closeNode();
|
|
322
355
|
}
|
|
323
356
|
}
|
|
324
|
-
}))
|
|
325
|
-
|
|
357
|
+
}));
|
|
358
|
+
d(T.node, {
|
|
359
|
+
displayName: "NodeSchema<table>",
|
|
360
|
+
group: "Table"
|
|
361
|
+
});
|
|
362
|
+
d(T.ctx, {
|
|
363
|
+
displayName: "NodeSchemaCtx<table>",
|
|
364
|
+
group: "Table"
|
|
365
|
+
});
|
|
366
|
+
const S = k("table_row", () => ({
|
|
367
|
+
...v.table_row,
|
|
326
368
|
parseMarkdown: {
|
|
327
369
|
match: (e) => e.type === "tableRow",
|
|
328
370
|
runner: (e, t, n) => {
|
|
329
|
-
const o = t.align, l = t.children.map((r,
|
|
371
|
+
const o = t.align, l = t.children.map((r, a) => ({
|
|
330
372
|
...r,
|
|
331
|
-
align: o[
|
|
373
|
+
align: o[a],
|
|
332
374
|
isHeader: t.isHeader
|
|
333
375
|
}));
|
|
334
376
|
e.openNode(n), e.next(l), e.closeNode();
|
|
@@ -340,8 +382,17 @@ const A = fe({
|
|
|
340
382
|
e.openNode("tableRow"), e.next(t.content), e.closeNode();
|
|
341
383
|
}
|
|
342
384
|
}
|
|
343
|
-
}))
|
|
344
|
-
|
|
385
|
+
}));
|
|
386
|
+
d(S.node, {
|
|
387
|
+
displayName: "NodeSchema<tableRow>",
|
|
388
|
+
group: "Table"
|
|
389
|
+
});
|
|
390
|
+
d(S.ctx, {
|
|
391
|
+
displayName: "NodeSchemaCtx<tableRow>",
|
|
392
|
+
group: "Table"
|
|
393
|
+
});
|
|
394
|
+
const R = k("table_cell", () => ({
|
|
395
|
+
...v.table_cell,
|
|
345
396
|
parseMarkdown: {
|
|
346
397
|
match: (e) => e.type === "tableCell" && !e.isHeader,
|
|
347
398
|
runner: (e, t, n) => {
|
|
@@ -355,8 +406,17 @@ const A = fe({
|
|
|
355
406
|
e.openNode("tableCell").next(t.content).closeNode();
|
|
356
407
|
}
|
|
357
408
|
}
|
|
358
|
-
}))
|
|
359
|
-
|
|
409
|
+
}));
|
|
410
|
+
d(R.node, {
|
|
411
|
+
displayName: "NodeSchema<tableCell>",
|
|
412
|
+
group: "Table"
|
|
413
|
+
});
|
|
414
|
+
d(R.ctx, {
|
|
415
|
+
displayName: "NodeSchemaCtx<tableCell>",
|
|
416
|
+
group: "Table"
|
|
417
|
+
});
|
|
418
|
+
const I = k("table_header", () => ({
|
|
419
|
+
...v.table_header,
|
|
360
420
|
parseMarkdown: {
|
|
361
421
|
match: (e) => e.type === "tableCell" && !!e.isHeader,
|
|
362
422
|
runner: (e, t, n) => {
|
|
@@ -370,87 +430,185 @@ const A = fe({
|
|
|
370
430
|
e.openNode("tableCell"), e.next(t.content), e.closeNode();
|
|
371
431
|
}
|
|
372
432
|
}
|
|
373
|
-
}))
|
|
433
|
+
}));
|
|
434
|
+
d(I.node, {
|
|
435
|
+
displayName: "NodeSchema<tableHeader>",
|
|
436
|
+
group: "Table"
|
|
437
|
+
});
|
|
438
|
+
d(I.ctx, {
|
|
439
|
+
displayName: "NodeSchemaCtx<tableHeader>",
|
|
440
|
+
group: "Table"
|
|
441
|
+
});
|
|
442
|
+
const me = te(() => new Y(
|
|
374
443
|
/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,
|
|
375
444
|
(e, t, n, o) => {
|
|
376
|
-
var i,
|
|
445
|
+
var i, c;
|
|
377
446
|
const l = e.doc.resolve(n);
|
|
378
|
-
if (!l.node(-1).canReplaceWith(l.index(-1), l.indexAfter(-1),
|
|
447
|
+
if (!l.node(-1).canReplaceWith(l.index(-1), l.indexAfter(-1), T.type()))
|
|
379
448
|
return null;
|
|
380
|
-
const r =
|
|
449
|
+
const r = re(
|
|
381
450
|
Number((i = t.groups) == null ? void 0 : i.row),
|
|
382
|
-
Number((
|
|
383
|
-
),
|
|
384
|
-
return
|
|
451
|
+
Number((c = t.groups) == null ? void 0 : c.col)
|
|
452
|
+
), a = e.tr.replaceRangeWith(n, o, r).scrollIntoView();
|
|
453
|
+
return a.setSelection(Ee.create(a.doc, n + 3));
|
|
385
454
|
}
|
|
386
|
-
))
|
|
387
|
-
|
|
455
|
+
));
|
|
456
|
+
d(me, {
|
|
457
|
+
displayName: "InputRule<insertTableInputRule>",
|
|
458
|
+
group: "Table"
|
|
459
|
+
});
|
|
460
|
+
const F = h("GoToPrevTableCell", () => () => ne(-1));
|
|
461
|
+
d(F, {
|
|
462
|
+
displayName: "Command<goToPrevTableCellCommand>",
|
|
463
|
+
group: "Table"
|
|
464
|
+
});
|
|
465
|
+
const W = h("GoToNextTableCell", () => () => ne(1));
|
|
466
|
+
d(W, {
|
|
467
|
+
displayName: "Command<goToNextTableCellCommand>",
|
|
468
|
+
group: "Table"
|
|
469
|
+
});
|
|
470
|
+
const z = h("BreakTable", () => () => (e, t) => {
|
|
471
|
+
if (!N(e))
|
|
388
472
|
return !1;
|
|
389
|
-
const { $head: n } = e.selection, o = n.after(), l = e.tr.replaceWith(o, o,
|
|
390
|
-
return l.setSelection(
|
|
391
|
-
})
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
473
|
+
const { $head: n } = e.selection, o = n.after(), l = e.tr.replaceWith(o, o, Q.type().createAndFill());
|
|
474
|
+
return l.setSelection(oe.near(l.doc.resolve(o), 1)).scrollIntoView(), t == null || t(l), !0;
|
|
475
|
+
});
|
|
476
|
+
d(z, {
|
|
477
|
+
displayName: "Command<breakTableCommand>",
|
|
478
|
+
group: "Table"
|
|
479
|
+
});
|
|
480
|
+
const ue = h("InsertTable", () => ({ row: e, col: t } = {}) => (n, o) => {
|
|
481
|
+
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);
|
|
482
|
+
return m && (o == null || o(c.setSelection(m))), !0;
|
|
483
|
+
});
|
|
484
|
+
d(ue, {
|
|
485
|
+
displayName: "Command<insertTableCommand>",
|
|
486
|
+
group: "Table"
|
|
487
|
+
});
|
|
488
|
+
const pe = h("MoveRow", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
489
|
+
const { tr: l } = n, r = o == null ? void 0 : o(ot(l, e ?? 0, t ?? 0, !0));
|
|
396
490
|
return Boolean(r);
|
|
397
|
-
})
|
|
398
|
-
|
|
491
|
+
});
|
|
492
|
+
d(pe, {
|
|
493
|
+
displayName: "Command<moveRowCommand>",
|
|
494
|
+
group: "Table"
|
|
495
|
+
});
|
|
496
|
+
const fe = h("MoveCol", () => ({ from: e, to: t } = {}) => (n, o) => {
|
|
497
|
+
const { tr: l } = n, r = o == null ? void 0 : o(tt(l, e ?? 0, t ?? 0, !0));
|
|
399
498
|
return Boolean(r);
|
|
400
|
-
})
|
|
401
|
-
|
|
499
|
+
});
|
|
500
|
+
d(fe, {
|
|
501
|
+
displayName: "Command<moveColCommand>",
|
|
502
|
+
group: "Table"
|
|
503
|
+
});
|
|
504
|
+
const he = h("SelectRow", () => (e = 0) => (t, n) => {
|
|
505
|
+
const { tr: o } = t, l = n == null ? void 0 : n(Je(e)(o));
|
|
402
506
|
return Boolean(l);
|
|
403
|
-
})
|
|
404
|
-
|
|
507
|
+
});
|
|
508
|
+
d(he, {
|
|
509
|
+
displayName: "Command<selectRowCommand>",
|
|
510
|
+
group: "Table"
|
|
511
|
+
});
|
|
512
|
+
const ge = h("SelectCol", () => (e = 0) => (t, n) => {
|
|
513
|
+
const { tr: o } = t, l = n == null ? void 0 : n(Qe(e)(o));
|
|
405
514
|
return Boolean(l);
|
|
406
|
-
})
|
|
407
|
-
|
|
515
|
+
});
|
|
516
|
+
d(ge, {
|
|
517
|
+
displayName: "Command<selectColCommand>",
|
|
518
|
+
group: "Table"
|
|
519
|
+
});
|
|
520
|
+
const be = h("SelectTable", () => () => (e, t) => {
|
|
521
|
+
const { tr: n } = e, o = t == null ? void 0 : t(qe(n));
|
|
408
522
|
return Boolean(o);
|
|
409
|
-
})
|
|
523
|
+
});
|
|
524
|
+
d(be, {
|
|
525
|
+
displayName: "Command<selectTableCommand>",
|
|
526
|
+
group: "Table"
|
|
527
|
+
});
|
|
528
|
+
const Ce = h("DeleteSelectedCells", () => () => (e, t) => {
|
|
410
529
|
const { selection: n } = e;
|
|
411
|
-
if (!(n instanceof
|
|
530
|
+
if (!(n instanceof y))
|
|
412
531
|
return !1;
|
|
413
532
|
const o = n.isRowSelection(), l = n.isColSelection();
|
|
414
|
-
return o && l ?
|
|
415
|
-
})
|
|
416
|
-
|
|
533
|
+
return o && l ? Ke(e, t) : l ? He(e, t) : Le(e, t);
|
|
534
|
+
});
|
|
535
|
+
d(Ce, {
|
|
536
|
+
displayName: "Command<deleteSelectedCellsCommand>",
|
|
537
|
+
group: "Table"
|
|
538
|
+
});
|
|
539
|
+
const ye = h("AddColBefore", () => () => Fe);
|
|
540
|
+
d(ye, {
|
|
541
|
+
displayName: "Command<addColBeforeCommand>",
|
|
542
|
+
group: "Table"
|
|
543
|
+
});
|
|
544
|
+
const ke = h("AddColAfter", () => () => We);
|
|
545
|
+
d(ke, {
|
|
546
|
+
displayName: "Command<addColAfterCommand>",
|
|
547
|
+
group: "Table"
|
|
548
|
+
});
|
|
549
|
+
const we = h("AddRowBefore", () => () => (e, t) => {
|
|
550
|
+
if (!N(e))
|
|
417
551
|
return !1;
|
|
418
552
|
if (t) {
|
|
419
|
-
const n =
|
|
420
|
-
t(
|
|
553
|
+
const n = le(e);
|
|
554
|
+
t(ae(e.tr, n, n.top));
|
|
421
555
|
}
|
|
422
556
|
return !0;
|
|
423
|
-
})
|
|
424
|
-
|
|
557
|
+
});
|
|
558
|
+
d(we, {
|
|
559
|
+
displayName: "Command<addRowBeforeCommand>",
|
|
560
|
+
group: "Table"
|
|
561
|
+
});
|
|
562
|
+
const Ne = h("AddRowAfter", () => () => (e, t) => {
|
|
563
|
+
if (!N(e))
|
|
425
564
|
return !1;
|
|
426
565
|
if (t) {
|
|
427
|
-
const n =
|
|
428
|
-
t(
|
|
566
|
+
const n = le(e);
|
|
567
|
+
t(ae(e.tr, n, n.bottom));
|
|
429
568
|
}
|
|
430
569
|
return !0;
|
|
431
|
-
})
|
|
570
|
+
});
|
|
571
|
+
d(Ne, {
|
|
572
|
+
displayName: "Command<addRowAfterCommand>",
|
|
573
|
+
group: "Table"
|
|
574
|
+
});
|
|
575
|
+
const Te = h("SetAlign", () => (e = "left") => ze("alignment", e));
|
|
576
|
+
d(Te, {
|
|
577
|
+
displayName: "Command<setAlignCommand>",
|
|
578
|
+
group: "Table"
|
|
579
|
+
});
|
|
580
|
+
const G = ee("tableKeymap", {
|
|
432
581
|
NextCell: {
|
|
433
582
|
shortcuts: ["Mod-]", "Tab"],
|
|
434
583
|
command: (e) => {
|
|
435
|
-
const t = e.get(
|
|
436
|
-
return () => t.call(
|
|
584
|
+
const t = e.get(A);
|
|
585
|
+
return () => t.call(W.key);
|
|
437
586
|
}
|
|
438
587
|
},
|
|
439
588
|
PrevCell: {
|
|
440
589
|
shortcuts: ["Mod-[", "Shift-Tab"],
|
|
441
590
|
command: (e) => {
|
|
442
|
-
const t = e.get(
|
|
443
|
-
return () => t.call(
|
|
591
|
+
const t = e.get(A);
|
|
592
|
+
return () => t.call(F.key);
|
|
444
593
|
}
|
|
445
594
|
},
|
|
446
595
|
ExitTable: {
|
|
447
596
|
shortcuts: ["Mod-Enter"],
|
|
448
597
|
command: (e) => {
|
|
449
|
-
const t = e.get(
|
|
450
|
-
return () => t.call(
|
|
598
|
+
const t = e.get(A);
|
|
599
|
+
return () => t.call(z.key);
|
|
451
600
|
}
|
|
452
601
|
}
|
|
453
|
-
})
|
|
602
|
+
});
|
|
603
|
+
d(G.ctx, {
|
|
604
|
+
displayName: "KeymapCtx<table>",
|
|
605
|
+
group: "Table"
|
|
606
|
+
});
|
|
607
|
+
d(G.shortcuts, {
|
|
608
|
+
displayName: "Keymap<table>",
|
|
609
|
+
group: "Table"
|
|
610
|
+
});
|
|
611
|
+
const E = "footnote_definition", J = "footnoteDefinition", j = k("footnote_definition", () => ({
|
|
454
612
|
group: "block",
|
|
455
613
|
content: "block+",
|
|
456
614
|
defining: !0,
|
|
@@ -461,10 +619,10 @@ const A = fe({
|
|
|
461
619
|
},
|
|
462
620
|
parseDOM: [
|
|
463
621
|
{
|
|
464
|
-
tag: `dl[data-type="${
|
|
622
|
+
tag: `dl[data-type="${E}"]`,
|
|
465
623
|
getAttrs: (e) => {
|
|
466
624
|
if (!(e instanceof HTMLElement))
|
|
467
|
-
throw
|
|
625
|
+
throw O(e);
|
|
468
626
|
return {
|
|
469
627
|
label: e.dataset.label
|
|
470
628
|
};
|
|
@@ -478,14 +636,14 @@ const A = fe({
|
|
|
478
636
|
"dl",
|
|
479
637
|
{
|
|
480
638
|
"data-label": t,
|
|
481
|
-
"data-type":
|
|
639
|
+
"data-type": E
|
|
482
640
|
},
|
|
483
641
|
["dt", t],
|
|
484
642
|
["dd", 0]
|
|
485
643
|
];
|
|
486
644
|
},
|
|
487
645
|
parseMarkdown: {
|
|
488
|
-
match: ({ type: e }) => e ===
|
|
646
|
+
match: ({ type: e }) => e === J,
|
|
489
647
|
runner: (e, t, n) => {
|
|
490
648
|
e.openNode(n, {
|
|
491
649
|
label: t.label
|
|
@@ -493,15 +651,24 @@ const A = fe({
|
|
|
493
651
|
}
|
|
494
652
|
},
|
|
495
653
|
toMarkdown: {
|
|
496
|
-
match: (e) => e.type.name ===
|
|
654
|
+
match: (e) => e.type.name === E,
|
|
497
655
|
runner: (e, t) => {
|
|
498
|
-
e.openNode(
|
|
656
|
+
e.openNode(J, void 0, {
|
|
499
657
|
label: t.attrs.label,
|
|
500
658
|
identifier: t.attrs.label
|
|
501
659
|
}).next(t.content).closeNode();
|
|
502
660
|
}
|
|
503
661
|
}
|
|
504
|
-
}))
|
|
662
|
+
}));
|
|
663
|
+
d(j.ctx, {
|
|
664
|
+
displayName: "NodeSchemaCtx<footnodeDef>",
|
|
665
|
+
group: "footnote"
|
|
666
|
+
});
|
|
667
|
+
d(j.node, {
|
|
668
|
+
displayName: "NodeSchema<footnodeDef>",
|
|
669
|
+
group: "footnote"
|
|
670
|
+
});
|
|
671
|
+
const D = "footnote_reference", Z = k("footnote_reference", () => ({
|
|
505
672
|
group: "inline",
|
|
506
673
|
inline: !0,
|
|
507
674
|
atom: !0,
|
|
@@ -512,10 +679,10 @@ const A = fe({
|
|
|
512
679
|
},
|
|
513
680
|
parseDOM: [
|
|
514
681
|
{
|
|
515
|
-
tag: `sup[data-type="${
|
|
682
|
+
tag: `sup[data-type="${D}"]`,
|
|
516
683
|
getAttrs: (e) => {
|
|
517
684
|
if (!(e instanceof HTMLElement))
|
|
518
|
-
throw
|
|
685
|
+
throw O(e);
|
|
519
686
|
return {
|
|
520
687
|
label: e.dataset.label
|
|
521
688
|
};
|
|
@@ -528,7 +695,7 @@ const A = fe({
|
|
|
528
695
|
"sup",
|
|
529
696
|
{
|
|
530
697
|
"data-label": t,
|
|
531
|
-
"data-type":
|
|
698
|
+
"data-type": D
|
|
532
699
|
},
|
|
533
700
|
t
|
|
534
701
|
];
|
|
@@ -542,7 +709,7 @@ const A = fe({
|
|
|
542
709
|
}
|
|
543
710
|
},
|
|
544
711
|
toMarkdown: {
|
|
545
|
-
match: (e) => e.type.name ===
|
|
712
|
+
match: (e) => e.type.name === D,
|
|
546
713
|
runner: (e, t) => {
|
|
547
714
|
e.addNode("footnoteReference", void 0, void 0, {
|
|
548
715
|
label: t.attrs.label,
|
|
@@ -550,7 +717,16 @@ const A = fe({
|
|
|
550
717
|
});
|
|
551
718
|
}
|
|
552
719
|
}
|
|
553
|
-
}))
|
|
720
|
+
}));
|
|
721
|
+
d(Z.ctx, {
|
|
722
|
+
displayName: "NodeSchemaCtx<footnodeRef>",
|
|
723
|
+
group: "footnote"
|
|
724
|
+
});
|
|
725
|
+
d(Z.node, {
|
|
726
|
+
displayName: "NodeSchema<footnodeRef>",
|
|
727
|
+
group: "footnote"
|
|
728
|
+
});
|
|
729
|
+
const Se = Ie.extendSchema((e) => (t) => {
|
|
554
730
|
const n = e(t);
|
|
555
731
|
return {
|
|
556
732
|
...n,
|
|
@@ -565,7 +741,7 @@ const A = fe({
|
|
|
565
741
|
tag: 'li[data-item-type="task"]',
|
|
566
742
|
getAttrs: (o) => {
|
|
567
743
|
if (!(o instanceof HTMLElement))
|
|
568
|
-
throw
|
|
744
|
+
throw O(o);
|
|
569
745
|
return {
|
|
570
746
|
label: o.dataset.label,
|
|
571
747
|
listType: o.dataset["list-type"],
|
|
@@ -594,8 +770,8 @@ const A = fe({
|
|
|
594
770
|
n.parseMarkdown.runner(o, l, r);
|
|
595
771
|
return;
|
|
596
772
|
}
|
|
597
|
-
const
|
|
598
|
-
o.openNode(r, { label:
|
|
773
|
+
const a = l.label != null ? `${l.label}.` : "•", i = l.checked != null ? Boolean(l.checked) : null, c = l.label != null ? "ordered" : "bullet", m = l.spread != null ? `${l.spread}` : "true";
|
|
774
|
+
o.openNode(r, { label: a, listType: c, spread: m, checked: i }), o.next(l.children), o.closeNode();
|
|
599
775
|
}
|
|
600
776
|
},
|
|
601
777
|
toMarkdown: {
|
|
@@ -605,124 +781,154 @@ const A = fe({
|
|
|
605
781
|
n.toMarkdown.runner(o, l);
|
|
606
782
|
return;
|
|
607
783
|
}
|
|
608
|
-
const r = l.attrs.label,
|
|
609
|
-
o.openNode("listItem", void 0, { label: r, listType:
|
|
784
|
+
const r = l.attrs.label, a = l.attrs.listType, i = l.attrs.spread === "true", c = l.attrs.checked;
|
|
785
|
+
o.openNode("listItem", void 0, { label: r, listType: a, spread: i, checked: c }), o.next(l.content), o.closeNode();
|
|
610
786
|
}
|
|
611
787
|
}
|
|
612
788
|
};
|
|
613
|
-
})
|
|
614
|
-
|
|
789
|
+
});
|
|
790
|
+
d(Se, {
|
|
791
|
+
displayName: "NodeSchema<listItem>",
|
|
792
|
+
group: "ListItem"
|
|
793
|
+
});
|
|
794
|
+
const Re = te(() => new Y(/^\[(?<checked>\s|x)\]\s$/, (e, t, n, o) => {
|
|
795
|
+
var s;
|
|
615
796
|
const l = e.doc.resolve(n);
|
|
616
|
-
let r = 0,
|
|
617
|
-
for (;
|
|
618
|
-
r--,
|
|
619
|
-
if (!
|
|
797
|
+
let r = 0, a = l.node(r);
|
|
798
|
+
for (; a && a.type.name !== "list_item"; )
|
|
799
|
+
r--, a = l.node(r);
|
|
800
|
+
if (!a || a.attrs.checked != null)
|
|
620
801
|
return null;
|
|
621
|
-
const i = Boolean(((
|
|
622
|
-
return
|
|
623
|
-
}))
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
802
|
+
const i = Boolean(((s = t.groups) == null ? void 0 : s.checked) === "x"), c = l.before(r), m = e.tr;
|
|
803
|
+
return m.deleteRange(n, o).setNodeMarkup(c, void 0, { ...a.attrs, checked: i }), m;
|
|
804
|
+
}));
|
|
805
|
+
d(Re, {
|
|
806
|
+
displayName: "InputRule<wrapInTaskListInputRule>",
|
|
807
|
+
group: "ListItem"
|
|
808
|
+
});
|
|
809
|
+
const nt = [
|
|
810
|
+
L,
|
|
811
|
+
G
|
|
812
|
+
].flat(), lt = [
|
|
813
|
+
me,
|
|
814
|
+
Re
|
|
815
|
+
], Ae = B(() => {
|
|
816
|
+
const e = new De("MILKDOWN_AUTO_INSERT_ZERO_SPACE"), t = (o) => o.type === Q.type(), n = (o) => t(o) && o.nodeSize === 2;
|
|
817
|
+
return new Oe({
|
|
632
818
|
key: e,
|
|
633
819
|
props: {
|
|
634
820
|
handleDOMEvents: {
|
|
635
821
|
compositionstart(o) {
|
|
636
|
-
const { state: l, dispatch: r } = o, { tr:
|
|
637
|
-
return
|
|
822
|
+
const { state: l, dispatch: r } = o, { tr: a, selection: i } = l, { $from: c } = i;
|
|
823
|
+
return V.safari && N(l) && i.empty && n(c.parent) && r(a.insertText("", c.start())), !1;
|
|
638
824
|
},
|
|
639
825
|
compositionend(o) {
|
|
640
|
-
const { state: l, dispatch: r } = o, { tr:
|
|
641
|
-
return
|
|
826
|
+
const { state: l, dispatch: r } = o, { tr: a, selection: i } = l, { $from: c } = i;
|
|
827
|
+
return V.safari && N(l) && i.empty && t(c.parent) && c.parent.textContent.startsWith("") && r(a.delete(c.start(), c.start() + 1)), !1;
|
|
642
828
|
}
|
|
643
829
|
}
|
|
644
830
|
}
|
|
645
831
|
});
|
|
646
|
-
})
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
832
|
+
});
|
|
833
|
+
d(Ae, {
|
|
834
|
+
displayName: "Prose<autoInsertZeroSpaceInTablePlugin>",
|
|
835
|
+
group: "Prose"
|
|
836
|
+
});
|
|
837
|
+
const Me = B(() => Ge({}));
|
|
838
|
+
d(Me, {
|
|
839
|
+
displayName: "Prose<columnResizingPlugin>",
|
|
840
|
+
group: "Prose"
|
|
841
|
+
});
|
|
842
|
+
const xe = B(() => je());
|
|
843
|
+
d(xe, {
|
|
844
|
+
displayName: "Prose<tableEditingPlugin>",
|
|
845
|
+
group: "Prose"
|
|
846
|
+
});
|
|
847
|
+
const ve = Pe(() => Ue);
|
|
848
|
+
d(ve, {
|
|
849
|
+
displayName: "Remark<remarkGFMPlugin>",
|
|
850
|
+
group: "Remark"
|
|
851
|
+
});
|
|
852
|
+
const rt = [
|
|
853
|
+
Ae,
|
|
854
|
+
Me,
|
|
855
|
+
xe,
|
|
856
|
+
ve
|
|
857
|
+
], at = [
|
|
858
|
+
Se,
|
|
859
|
+
T,
|
|
860
|
+
S,
|
|
653
861
|
I,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
O,
|
|
657
|
-
Ue,
|
|
658
|
-
Xe,
|
|
862
|
+
R,
|
|
863
|
+
j,
|
|
659
864
|
Z,
|
|
660
|
-
|
|
865
|
+
K,
|
|
866
|
+
x
|
|
661
867
|
].flat(), st = [
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
],
|
|
868
|
+
W,
|
|
869
|
+
F,
|
|
870
|
+
z,
|
|
871
|
+
ue,
|
|
872
|
+
pe,
|
|
873
|
+
fe,
|
|
874
|
+
he,
|
|
875
|
+
ge,
|
|
876
|
+
be,
|
|
877
|
+
Ce,
|
|
878
|
+
we,
|
|
879
|
+
Ne,
|
|
880
|
+
ye,
|
|
881
|
+
ke,
|
|
882
|
+
Te,
|
|
883
|
+
H
|
|
884
|
+
], Ct = [at, lt, nt, rt, st].flat();
|
|
679
885
|
export {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
886
|
+
ke as addColAfterCommand,
|
|
887
|
+
ye as addColBeforeCommand,
|
|
888
|
+
Ne as addRowAfterCommand,
|
|
889
|
+
we as addRowBeforeCommand,
|
|
890
|
+
ae as addRowWithAlignment,
|
|
891
|
+
z as breakTableCommand,
|
|
686
892
|
st as commands,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
893
|
+
re as createTable,
|
|
894
|
+
Ce as deleteSelectedCellsCommand,
|
|
895
|
+
Se as extendListItemSchemaForTask,
|
|
896
|
+
w as findTable,
|
|
897
|
+
j as footnoteDefinitionSchema,
|
|
898
|
+
Z as footnoteReferenceSchema,
|
|
899
|
+
Xe as getAllCellsInTable,
|
|
900
|
+
b as getCellsInCol,
|
|
901
|
+
C as getCellsInRow,
|
|
902
|
+
Ct as gfm,
|
|
903
|
+
W as goToNextTableCellCommand,
|
|
904
|
+
F as goToPrevTableCellCommand,
|
|
905
|
+
lt as inputrules,
|
|
906
|
+
ue as insertTableCommand,
|
|
907
|
+
me as insertTableInputRule,
|
|
908
|
+
nt as keymap,
|
|
909
|
+
tt as moveCol,
|
|
910
|
+
fe as moveColCommand,
|
|
911
|
+
ot as moveRow,
|
|
912
|
+
pe as moveRowCommand,
|
|
913
|
+
rt as plugins,
|
|
914
|
+
at as schema,
|
|
915
|
+
Qe as selectCol,
|
|
916
|
+
ge as selectColCommand,
|
|
917
|
+
se as selectLine,
|
|
918
|
+
Je as selectRow,
|
|
919
|
+
he as selectRowCommand,
|
|
920
|
+
qe as selectTable,
|
|
921
|
+
be as selectTableCommand,
|
|
922
|
+
Te as setAlignCommand,
|
|
923
|
+
K as strikethroughAttr,
|
|
924
|
+
L as strikethroughKeymap,
|
|
925
|
+
x as strikethroughSchema,
|
|
926
|
+
R as tableCellSchema,
|
|
927
|
+
I as tableHeaderSchema,
|
|
928
|
+
G as tableKeymap,
|
|
929
|
+
S as tableRowSchema,
|
|
930
|
+
T as tableSchema,
|
|
931
|
+
H as toggleStrikethroughCommand,
|
|
932
|
+
Re as wrapInTaskListInputRule
|
|
727
933
|
};
|
|
728
934
|
//# sourceMappingURL=index.es.js.map
|