@milkdown/preset-gfm 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.es.js +228 -220
- package/lib/index.es.js.map +1 -1
- package/lib/table/nodes/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/table/nodes/index.ts +13 -0
package/lib/index.es.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { SupportedKeys as lt, commonmark as st, commands as rt } from "@milkdown/preset-commonmark";
|
|
2
|
-
import { InsertHardbreak as io, InsertHr as co, InsertImage as ao, LiftListItem as fo, ModifyImage as uo, ModifyLink as po, SinkListItem as ho, SplitListItem as mo, ToggleBold as go, ToggleInlineCode as wo, ToggleItalic as bo, ToggleLink as Co, TurnIntoCodeFence as yo, TurnIntoHeading as ko, TurnIntoText as Ao, WrapInBlockquote as Mo, WrapInBulletList as
|
|
3
|
-
import { createNode as
|
|
2
|
+
import { InsertHardbreak as io, InsertHr as co, InsertImage as ao, LiftListItem as fo, ModifyImage as uo, ModifyLink as po, SinkListItem as ho, SplitListItem as mo, ToggleBold as go, ToggleInlineCode as wo, ToggleItalic as bo, ToggleLink as Co, TurnIntoCodeFence as yo, TurnIntoHeading as ko, TurnIntoText as Ao, WrapInBlockquote as Mo, WrapInBulletList as No, WrapInOrderedList as So, blockquote as xo, bulletList as Ro, codeFence as To, codeInline as Lo, commonmark as vo, commonmarkNodes as Eo, commonmarkPlugins as Io, doc as $o, em as Do, HardbreakFilterPluginKey as Oo, heading as _o, hr as zo, image as Fo, link as Bo, listItem as Po, orderedList as Wo, paragraph as Ho, strong as jo, text as Ko } from "@milkdown/preset-commonmark";
|
|
3
|
+
import { createNode as ye, createPlugin as it, createShortcut as D, createMark as ct, AtomList as at, $remark as dt } from "@milkdown/utils";
|
|
4
4
|
import ft from "remark-gfm";
|
|
5
|
-
import { createCmdKey as R, editorViewCtx as
|
|
6
|
-
import { expectDomTypeError as
|
|
7
|
-
import { findSelectedNodeOfType as B, findParentNode as gt, cloneTr as
|
|
8
|
-
import { wrappingInputRule as
|
|
9
|
-
import { PluginKey as F, NodeSelection as
|
|
5
|
+
import { createCmdKey as R, editorViewCtx as te, createCmd as S, commandsCtx as Ue, themeManagerCtx as L, ThemeIcon as v, getPalette as ut, ThemeSize as Re, ThemeBorder as pt, ThemeShadow as ht, schemaCtx as V } from "@milkdown/core";
|
|
6
|
+
import { expectDomTypeError as ke, missingRootElement as mt } from "@milkdown/exception";
|
|
7
|
+
import { findSelectedNodeOfType as B, findParentNode as gt, cloneTr as Ve, calculateNodePosition as wt, browser as Te } from "@milkdown/prose";
|
|
8
|
+
import { wrappingInputRule as Ge, InputRule as fe } from "@milkdown/prose/inputrules";
|
|
9
|
+
import { PluginKey as F, NodeSelection as ne, Plugin as W, Selection as N, SelectionRange as bt, TextSelection as E } from "@milkdown/prose/state";
|
|
10
10
|
import { toggleMark as Ct, wrapIn as yt } from "@milkdown/prose/commands";
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { Decoration as
|
|
11
|
+
import { Fragment as I, Slice as O } from "@milkdown/prose/model";
|
|
12
|
+
import { Decoration as Ae, DecorationSet as Me } from "@milkdown/prose/view";
|
|
13
13
|
import { keydownHandler as kt } from "@milkdown/prose/keymap";
|
|
14
14
|
import { Transform as At } from "@milkdown/prose/transform";
|
|
15
|
-
import { splitListItem as Mt, sinkListItem as
|
|
16
|
-
const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new F("MILKDOWN_FOOTNOTE_DEF_INPUT"),
|
|
15
|
+
import { splitListItem as Mt, sinkListItem as Nt, liftListItem as St } from "@milkdown/prose/schema-list";
|
|
16
|
+
const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new F("MILKDOWN_FOOTNOTE_DEF_INPUT"), Le = R("ModifyFootnoteDef"), Rt = ye((o) => {
|
|
17
17
|
const e = "footnote_definition", t = "footnoteDefinition";
|
|
18
18
|
return {
|
|
19
19
|
id: e,
|
|
@@ -31,7 +31,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
31
31
|
tag: `div[data-type="${e}"]`,
|
|
32
32
|
getAttrs: (l) => {
|
|
33
33
|
if (!(l instanceof HTMLElement))
|
|
34
|
-
throw
|
|
34
|
+
throw ke(l);
|
|
35
35
|
return {
|
|
36
36
|
label: l.dataset.label
|
|
37
37
|
};
|
|
@@ -42,7 +42,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
42
42
|
toDOM: (l) => {
|
|
43
43
|
const s = l.attrs.label, r = o.getClassName(l.attrs, "footnote-definition"), a = document.createElement("dt");
|
|
44
44
|
a.textContent = `[${s}]:`, a.onclick = () => {
|
|
45
|
-
const c = n.get(
|
|
45
|
+
const c = n.get(te), d = ne.create(c.state.doc, c.state.selection.from - 2);
|
|
46
46
|
c.dispatch(c.state.tr.setSelection(d));
|
|
47
47
|
};
|
|
48
48
|
const i = document.createElement("a");
|
|
@@ -79,16 +79,16 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
79
79
|
}
|
|
80
80
|
}),
|
|
81
81
|
commands: (n) => [
|
|
82
|
-
|
|
82
|
+
S(Le, (l = "") => (s, r) => {
|
|
83
83
|
const a = B(s.selection, n);
|
|
84
84
|
if (!a)
|
|
85
85
|
return !1;
|
|
86
86
|
const { tr: i } = s, c = i.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, label: l });
|
|
87
|
-
return r == null || r(c.setSelection(
|
|
87
|
+
return r == null || r(c.setSelection(ne.create(c.doc, a.pos))), !0;
|
|
88
88
|
})
|
|
89
89
|
],
|
|
90
90
|
inputRules: (n) => [
|
|
91
|
-
|
|
91
|
+
Ge(/(?:\[\^)([^:]+)(?::)$/, n, (l) => {
|
|
92
92
|
var r;
|
|
93
93
|
return {
|
|
94
94
|
label: (r = l[1]) != null ? r : "footnote"
|
|
@@ -103,7 +103,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
103
103
|
width: "12em",
|
|
104
104
|
placeholder: "Input Footnote Label",
|
|
105
105
|
onUpdate: (d) => {
|
|
106
|
-
l.get(Ue).call(
|
|
106
|
+
l.get(Ue).call(Le, d);
|
|
107
107
|
},
|
|
108
108
|
isBindMode: !0
|
|
109
109
|
});
|
|
@@ -129,7 +129,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
129
129
|
})
|
|
130
130
|
]
|
|
131
131
|
};
|
|
132
|
-
}),
|
|
132
|
+
}), ve = R("ModifyFootnoteRef"), Tt = new F("MILKDOWN_FOOTNOTE_REF_INPUT"), Lt = ye((o) => {
|
|
133
133
|
const e = "footnote_reference";
|
|
134
134
|
return {
|
|
135
135
|
id: e,
|
|
@@ -147,7 +147,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
147
147
|
tag: `sup[data-type="${e}"]`,
|
|
148
148
|
getAttrs: (n) => {
|
|
149
149
|
if (!(n instanceof HTMLElement))
|
|
150
|
-
throw
|
|
150
|
+
throw ke(n);
|
|
151
151
|
return {
|
|
152
152
|
label: n.dataset.label
|
|
153
153
|
};
|
|
@@ -157,9 +157,9 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
157
157
|
toDOM: (n) => {
|
|
158
158
|
const l = n.attrs.label, s = document.createElement("a"), r = `#${Ye(l)}`;
|
|
159
159
|
return s.href = r, s.textContent = `[${l}]`, s.onclick = (a) => {
|
|
160
|
-
t.get(
|
|
160
|
+
t.get(te).editable && a.preventDefault();
|
|
161
161
|
}, s.ondblclick = () => {
|
|
162
|
-
t.get(
|
|
162
|
+
t.get(te).editable && (window.location.href = r);
|
|
163
163
|
}, [
|
|
164
164
|
"sup",
|
|
165
165
|
{
|
|
@@ -189,16 +189,16 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
189
189
|
}
|
|
190
190
|
}),
|
|
191
191
|
commands: (t) => [
|
|
192
|
-
|
|
192
|
+
S(ve, (n = "") => (l, s) => {
|
|
193
193
|
const r = B(l.selection, t);
|
|
194
194
|
if (!r)
|
|
195
195
|
return !1;
|
|
196
196
|
const { tr: a } = l, i = a.setNodeMarkup(r.pos, void 0, { ...r.node.attrs, label: n });
|
|
197
|
-
return s == null || s(i.setSelection(
|
|
197
|
+
return s == null || s(i.setSelection(ne.create(i.doc, r.pos))), !0;
|
|
198
198
|
})
|
|
199
199
|
],
|
|
200
200
|
inputRules: (t) => [
|
|
201
|
-
new
|
|
201
|
+
new fe(/(?:\[\^)([^\]]+)(?:\])$/, (n, l, s, r) => {
|
|
202
202
|
const a = n.doc.resolve(s), i = a.index(), c = n.doc.resolve(r);
|
|
203
203
|
if (!a.parent.canReplaceWith(i, c.index(), t))
|
|
204
204
|
return null;
|
|
@@ -213,7 +213,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
213
213
|
width: "12em",
|
|
214
214
|
placeholder: "Input Footnote Label",
|
|
215
215
|
onUpdate: (i) => {
|
|
216
|
-
n.get(Ue).call(
|
|
216
|
+
n.get(Ue).call(ve, i);
|
|
217
217
|
},
|
|
218
218
|
isBindMode: !0
|
|
219
219
|
});
|
|
@@ -243,7 +243,7 @@ const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new
|
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
}), Ze = /* @__PURE__ */ new WeakMap(), vt = (o) => Ze.get(o), Et = (o, e) => (Ze.set(o, e), e);
|
|
246
|
-
class
|
|
246
|
+
class Ee {
|
|
247
247
|
constructor(e, t, n, l) {
|
|
248
248
|
this.left = e, this.top = t, this.right = n, this.bottom = l;
|
|
249
249
|
}
|
|
@@ -263,7 +263,7 @@ class g {
|
|
|
263
263
|
r++;
|
|
264
264
|
for (let i = 1; a < this.height && this.map[t + this.width * i] == n; i++)
|
|
265
265
|
a++;
|
|
266
|
-
return new
|
|
266
|
+
return new Ee(l, s, r, a);
|
|
267
267
|
}
|
|
268
268
|
throw new RangeError("No cell with offset " + e + " found");
|
|
269
269
|
}
|
|
@@ -279,7 +279,7 @@ class g {
|
|
|
279
279
|
}
|
|
280
280
|
rectBetween(e, t) {
|
|
281
281
|
const { left: n, right: l, top: s, bottom: r } = this.findCell(e), { left: a, right: i, top: c, bottom: d } = this.findCell(t);
|
|
282
|
-
return new
|
|
282
|
+
return new Ee(Math.min(n, a), Math.min(s, c), Math.max(l, i), Math.max(r, d));
|
|
283
283
|
}
|
|
284
284
|
cellsInRect(e) {
|
|
285
285
|
const t = [], n = {};
|
|
@@ -322,7 +322,7 @@ function It(o) {
|
|
|
322
322
|
s++;
|
|
323
323
|
if (h == f.childCount)
|
|
324
324
|
break;
|
|
325
|
-
const b = f.child(h), { colspan: w, rowspan: C, colwidth:
|
|
325
|
+
const b = f.child(h), { colspan: w, rowspan: C, colwidth: xe } = b.attrs;
|
|
326
326
|
for (let H = 0; H < C; H++) {
|
|
327
327
|
if (H + c >= t) {
|
|
328
328
|
(r || (r = [])).push({
|
|
@@ -332,18 +332,18 @@ function It(o) {
|
|
|
332
332
|
});
|
|
333
333
|
break;
|
|
334
334
|
}
|
|
335
|
-
const
|
|
335
|
+
const se = s + H * e;
|
|
336
336
|
for (let _ = 0; _ < w; _++) {
|
|
337
|
-
n[
|
|
337
|
+
n[se + _] == 0 ? n[se + _] = d : (r || (r = [])).push({
|
|
338
338
|
type: "collision",
|
|
339
339
|
row: c,
|
|
340
340
|
pos: d,
|
|
341
341
|
n: w - _
|
|
342
342
|
});
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
const j = (
|
|
346
|
-
|
|
343
|
+
const U = xe && xe[_];
|
|
344
|
+
if (U) {
|
|
345
|
+
const j = (se + _) % e * 2, re = l[j];
|
|
346
|
+
re == null || re != U && l[j + 1] == 1 ? (l[j] = U, l[j + 1] = 1) : re == U && l[j + 1]++;
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
}
|
|
@@ -410,7 +410,7 @@ function Ot(o) {
|
|
|
410
410
|
e.push(0);
|
|
411
411
|
return e;
|
|
412
412
|
}
|
|
413
|
-
class m extends
|
|
413
|
+
class m extends N {
|
|
414
414
|
constructor(e, t = e) {
|
|
415
415
|
const n = e.node(-1), l = g.get(n), s = e.start(-1), r = l.rectBetween(e.pos - s, t.pos - s), a = e.node(0), i = l.cellsInRect(r).filter((d) => d != t.pos - s);
|
|
416
416
|
i.unshift(t.pos - s);
|
|
@@ -422,11 +422,11 @@ class m extends S {
|
|
|
422
422
|
}
|
|
423
423
|
map(e, t) {
|
|
424
424
|
const n = e.resolve(t.map(this.$anchorCell.pos)), l = e.resolve(t.map(this.$headCell.pos));
|
|
425
|
-
if (
|
|
425
|
+
if (ue(n) && ue(l) && Se(n, l)) {
|
|
426
426
|
const s = this.$anchorCell.node(-1) != n.node(-1);
|
|
427
427
|
return s && this.isRowSelection() ? m.rowSelection(n, l) : s && this.isColSelection() ? m.colSelection(n, l) : new m(n, l);
|
|
428
428
|
}
|
|
429
|
-
return
|
|
429
|
+
return E.between(n, l);
|
|
430
430
|
}
|
|
431
431
|
content() {
|
|
432
432
|
const e = this.$anchorCell.node(-1), t = g.get(e), n = this.$anchorCell.start(-1), l = t.rectBetween(this.$anchorCell.pos - n, this.$headCell.pos - n), s = {}, r = [];
|
|
@@ -450,10 +450,10 @@ class m extends S {
|
|
|
450
450
|
c.push(h);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
r.push(e.child(i).copy(
|
|
453
|
+
r.push(e.child(i).copy(I.from(c)));
|
|
454
454
|
}
|
|
455
455
|
const a = this.isColSelection() && this.isRowSelection() ? e : r;
|
|
456
|
-
return new O(
|
|
456
|
+
return new O(I.from(a), 1, 1);
|
|
457
457
|
}
|
|
458
458
|
replace(e, t = O.empty) {
|
|
459
459
|
const n = e.steps.length, l = this.ranges;
|
|
@@ -461,11 +461,11 @@ class m extends S {
|
|
|
461
461
|
const { $from: a, $to: i } = l[r], c = e.mapping.slice(n);
|
|
462
462
|
e.replace(c.map(a.pos), c.map(i.pos), r ? O.empty : t);
|
|
463
463
|
}
|
|
464
|
-
const s =
|
|
464
|
+
const s = N.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
|
|
465
465
|
s && e.setSelection(s);
|
|
466
466
|
}
|
|
467
467
|
replaceWith(e, t) {
|
|
468
|
-
this.replace(e, new O(
|
|
468
|
+
this.replace(e, new O(I.from(t), 0, 0));
|
|
469
469
|
}
|
|
470
470
|
forEachCell(e) {
|
|
471
471
|
const t = this.$anchorCell.node(-1), n = g.get(t), l = this.$anchorCell.start(-1), s = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - l, this.$headCell.pos - l));
|
|
@@ -549,21 +549,21 @@ class m extends S {
|
|
|
549
549
|
return new m(e.resolve(t), e.resolve(n));
|
|
550
550
|
}
|
|
551
551
|
getBookmark() {
|
|
552
|
-
return new
|
|
552
|
+
return new Ne(this.$anchorCell.pos, this.$headCell.pos);
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
m.prototype.visible = !1;
|
|
556
|
-
|
|
557
|
-
class
|
|
556
|
+
N.jsonID("cell", m);
|
|
557
|
+
class Ne {
|
|
558
558
|
constructor(e, t) {
|
|
559
559
|
this.anchor = e, this.head = t, this.anchor = e, this.head = t;
|
|
560
560
|
}
|
|
561
561
|
map(e) {
|
|
562
|
-
return new
|
|
562
|
+
return new Ne(e.map(this.anchor), e.map(this.head));
|
|
563
563
|
}
|
|
564
564
|
resolve(e) {
|
|
565
565
|
const t = e.resolve(this.anchor), n = e.resolve(this.head);
|
|
566
|
-
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount &&
|
|
566
|
+
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && Se(t, n) ? new m(t, n) : N.near(n, 1);
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
function _t(o) {
|
|
@@ -571,8 +571,8 @@ function _t(o) {
|
|
|
571
571
|
return null;
|
|
572
572
|
const e = [];
|
|
573
573
|
return o.selection.forEachCell((t, n) => {
|
|
574
|
-
e.push(
|
|
575
|
-
}),
|
|
574
|
+
e.push(Ae.node(n, n + t.nodeSize, { class: "selectedCell" }));
|
|
575
|
+
}), Me.create(o.doc, e);
|
|
576
576
|
}
|
|
577
577
|
function zt({ $from: o, $to: e }) {
|
|
578
578
|
if (o.pos == e.pos || o.pos < o.pos - 6)
|
|
@@ -605,7 +605,7 @@ function Ft({ $from: o, $to: e }) {
|
|
|
605
605
|
function Bt(o, e, t) {
|
|
606
606
|
const n = (e || o).selection, l = (e || o).doc;
|
|
607
607
|
let s, r;
|
|
608
|
-
if (n instanceof
|
|
608
|
+
if (n instanceof ne && (r = n.node.type.spec.tableRole)) {
|
|
609
609
|
if (r == "cell" || r == "header_cell")
|
|
610
610
|
s = m.create(l, n.from);
|
|
611
611
|
else if (r == "row") {
|
|
@@ -616,10 +616,10 @@ function Bt(o, e, t) {
|
|
|
616
616
|
s = m.create(l, i + 1, d);
|
|
617
617
|
}
|
|
618
618
|
} else
|
|
619
|
-
n instanceof
|
|
619
|
+
n instanceof E && zt(n) ? s = E.create(l, n.from) : n instanceof E && Ft(n) && (s = E.create(l, n.$from.start(), n.$from.end()));
|
|
620
620
|
return s && (e || (e = o.tr)).setSelection(s), e;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function Ie(o, e) {
|
|
623
623
|
const t = o.getAttribute("data-colwidth"), n = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((r) => Number(r)) : null, l = Number(o.getAttribute("colspan") || 1), s = {
|
|
624
624
|
colspan: l,
|
|
625
625
|
rowspan: Number(o.getAttribute("rowspan") || 1),
|
|
@@ -631,7 +631,7 @@ function ve(o, e) {
|
|
|
631
631
|
}
|
|
632
632
|
return s;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function $e(o, e) {
|
|
635
635
|
const t = {};
|
|
636
636
|
o.attrs.colspan != 1 && (t.colspan = o.attrs.colspan), o.attrs.rowspan != 1 && (t.rowspan = o.attrs.rowspan), o.attrs.colwidth && (t["data-colwidth"] = o.attrs.colwidth.join(","));
|
|
637
637
|
for (const n in e) {
|
|
@@ -673,9 +673,9 @@ function Pt(o) {
|
|
|
673
673
|
attrs: n,
|
|
674
674
|
tableRole: "cell",
|
|
675
675
|
isolating: !0,
|
|
676
|
-
parseDOM: [{ tag: "td", getAttrs: (s) =>
|
|
676
|
+
parseDOM: [{ tag: "td", getAttrs: (s) => Ie(s, e) }],
|
|
677
677
|
toDOM(s) {
|
|
678
|
-
return ["td",
|
|
678
|
+
return ["td", $e(s, e), 0];
|
|
679
679
|
}
|
|
680
680
|
},
|
|
681
681
|
table_header: {
|
|
@@ -683,9 +683,9 @@ function Pt(o) {
|
|
|
683
683
|
attrs: n,
|
|
684
684
|
tableRole: "header_cell",
|
|
685
685
|
isolating: !0,
|
|
686
|
-
parseDOM: [{ tag: "th", getAttrs: (s) =>
|
|
686
|
+
parseDOM: [{ tag: "th", getAttrs: (s) => Ie(s, e) }],
|
|
687
687
|
toDOM(s) {
|
|
688
|
-
return ["th",
|
|
688
|
+
return ["th", $e(s, e), 0];
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
};
|
|
@@ -701,7 +701,7 @@ function A(o) {
|
|
|
701
701
|
}
|
|
702
702
|
return e;
|
|
703
703
|
}
|
|
704
|
-
const
|
|
704
|
+
const G = Pt({
|
|
705
705
|
tableGroup: "block",
|
|
706
706
|
cellContent: "paragraph",
|
|
707
707
|
cellAttributes: {
|
|
@@ -714,18 +714,18 @@ const V = Pt({
|
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
});
|
|
717
|
-
function
|
|
717
|
+
function X(o) {
|
|
718
718
|
for (let e = o.depth - 1; e > 0; e--)
|
|
719
719
|
if (o.node(e).type.spec.tableRole == "row")
|
|
720
720
|
return o.node(0).resolve(o.before(e + 1));
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function ue(o) {
|
|
723
723
|
return o.parent.type.spec.tableRole == "row" ? o.nodeAfter : null;
|
|
724
724
|
}
|
|
725
725
|
function Wt(o) {
|
|
726
726
|
return o.node(0).resolve(o.pos + o.nodeAfter.nodeSize);
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function Se(o, e) {
|
|
729
729
|
return o.depth == e.depth && o.pos >= e.start(-1) && o.pos <= e.end(-1);
|
|
730
730
|
}
|
|
731
731
|
function Qe(o, e, t) {
|
|
@@ -753,9 +753,9 @@ function M(o) {
|
|
|
753
753
|
return !0;
|
|
754
754
|
return !1;
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function oe(o) {
|
|
757
757
|
const e = o.selection;
|
|
758
|
-
return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor :
|
|
758
|
+
return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : X(e.$head) || Ht(e.$head);
|
|
759
759
|
}
|
|
760
760
|
function Ht(o) {
|
|
761
761
|
for (let e = o.nodeAfter, t = o.pos; e; e = e.firstChild, t++) {
|
|
@@ -792,10 +792,10 @@ const qt = (o) => (e, t) => {
|
|
|
792
792
|
if (!M(e))
|
|
793
793
|
return !1;
|
|
794
794
|
const { $head: n } = e.selection, l = n.after(), s = e.tr.replaceWith(l, l, o.createAndFill());
|
|
795
|
-
return s.setSelection(
|
|
795
|
+
return s.setSelection(N.near(s.doc.resolve(l), 1)), t == null || t(s.scrollIntoView()), !0;
|
|
796
796
|
};
|
|
797
797
|
function P(o) {
|
|
798
|
-
const e = o.selection, t =
|
|
798
|
+
const e = o.selection, t = oe(o), n = t.node(-1), l = t.start(-1), s = g.get(n);
|
|
799
799
|
let r;
|
|
800
800
|
return e instanceof m ? r = s.rectBetween(e.$anchorCell.pos - l, e.$headCell.pos - l) : r = s.findCell(t.pos - l), r.tableStart = l, r.map = s, r.table = n, r;
|
|
801
801
|
}
|
|
@@ -815,7 +815,7 @@ function et(o, { map: e, tableStart: t, table: n }, l) {
|
|
|
815
815
|
}
|
|
816
816
|
return o;
|
|
817
817
|
}
|
|
818
|
-
const
|
|
818
|
+
const Xt = (o, e) => {
|
|
819
819
|
if (!M(o))
|
|
820
820
|
return !1;
|
|
821
821
|
if (e) {
|
|
@@ -823,7 +823,7 @@ const Ut = (o, e) => {
|
|
|
823
823
|
e(et(o.tr, t, t.left));
|
|
824
824
|
}
|
|
825
825
|
return !0;
|
|
826
|
-
},
|
|
826
|
+
}, Ut = (o, e) => {
|
|
827
827
|
if (!M(o))
|
|
828
828
|
return !1;
|
|
829
829
|
if (e) {
|
|
@@ -894,7 +894,7 @@ function ie(o, e) {
|
|
|
894
894
|
return (t, n) => {
|
|
895
895
|
if (!M(t))
|
|
896
896
|
return !1;
|
|
897
|
-
const l =
|
|
897
|
+
const l = oe(t);
|
|
898
898
|
if (l.nodeAfter.attrs[o] === e)
|
|
899
899
|
return !1;
|
|
900
900
|
if (n) {
|
|
@@ -929,16 +929,16 @@ function Zt(o, e) {
|
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function De(o) {
|
|
933
933
|
return (e, t) => {
|
|
934
934
|
if (!M(e))
|
|
935
935
|
return !1;
|
|
936
|
-
const n = Zt(
|
|
936
|
+
const n = Zt(oe(e), o);
|
|
937
937
|
if (n == null)
|
|
938
938
|
return !1;
|
|
939
939
|
if (t) {
|
|
940
940
|
const l = e.doc.resolve(n);
|
|
941
|
-
t(e.tr.setSelection(
|
|
941
|
+
t(e.tr.setSelection(E.between(l, Wt(l))).scrollIntoView());
|
|
942
942
|
}
|
|
943
943
|
return !0;
|
|
944
944
|
};
|
|
@@ -949,8 +949,8 @@ const Qt = (o, e) => {
|
|
|
949
949
|
if (t.node(n).type.spec.tableRole == "table")
|
|
950
950
|
return e && e(o.tr.delete(t.before(n), t.after(n)).scrollIntoView()), !0;
|
|
951
951
|
return !1;
|
|
952
|
-
},
|
|
953
|
-
const t =
|
|
952
|
+
}, le = (o) => gt((e) => e.type.spec.tableRole === "table")(o), en = (o) => (e) => {
|
|
953
|
+
const t = le(e);
|
|
954
954
|
if (!t)
|
|
955
955
|
return;
|
|
956
956
|
const n = g.get(t.node);
|
|
@@ -967,7 +967,7 @@ const Qt = (o, e) => {
|
|
|
967
967
|
};
|
|
968
968
|
}).filter((l) => l != null);
|
|
969
969
|
}, tn = (o) => (e) => {
|
|
970
|
-
const t =
|
|
970
|
+
const t = le(e);
|
|
971
971
|
if (!t)
|
|
972
972
|
return;
|
|
973
973
|
const n = g.get(t.node);
|
|
@@ -983,21 +983,21 @@ const Qt = (o, e) => {
|
|
|
983
983
|
node: s
|
|
984
984
|
};
|
|
985
985
|
}).filter((l) => l != null);
|
|
986
|
-
},
|
|
986
|
+
}, ce = (o, e = 3, t = 3) => {
|
|
987
987
|
const { cell: n, header_cell: l, row: s, table: r } = A(o), a = Array(t).fill(0).map(() => n.createAndFill(null)), i = Array(t).fill(0).map(() => l.createAndFill(null)), c = Array(e).fill(0).map((d, f) => s.create(null, f === 0 ? i : a));
|
|
988
988
|
return r.create(null, c);
|
|
989
|
-
},
|
|
990
|
-
const n =
|
|
989
|
+
}, Oe = (o) => (e) => (t) => {
|
|
990
|
+
const n = le(t.selection), l = o === "row";
|
|
991
991
|
if (n) {
|
|
992
992
|
const s = g.get(n.node);
|
|
993
993
|
if (e >= 0 && e < (l ? s.height : s.width)) {
|
|
994
994
|
const r = s.positionAt(l ? e : s.height - 1, l ? s.width - 1 : e, n.node), a = t.doc.resolve(n.start + r), i = l ? m.rowSelection : m.colSelection, c = s.positionAt(l ? e : 0, l ? 0 : e, n.node), d = t.doc.resolve(n.start + c);
|
|
995
|
-
return
|
|
995
|
+
return Ve(t.setSelection(i(a, d)));
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
return t;
|
|
999
999
|
}, nn = (o) => {
|
|
1000
|
-
const e =
|
|
1000
|
+
const e = le(o);
|
|
1001
1001
|
if (!e)
|
|
1002
1002
|
return;
|
|
1003
1003
|
const t = g.get(e.node);
|
|
@@ -1016,12 +1016,12 @@ const Qt = (o, e) => {
|
|
|
1016
1016
|
const t = o.doc.resolve(e[0].pos), n = e[e.length - 1];
|
|
1017
1017
|
if (n) {
|
|
1018
1018
|
const l = o.doc.resolve(n.pos);
|
|
1019
|
-
return
|
|
1019
|
+
return Ve(o.setSelection(new m(l, t)));
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
return o;
|
|
1023
1023
|
};
|
|
1024
|
-
function
|
|
1024
|
+
function _e(o, { map: e, tableStart: t, table: n }, l) {
|
|
1025
1025
|
const s = Array(l).fill(0).reduce((c, d, f) => c + n.child(f).nodeSize, t), { cell: r, row: a } = A(n.type.schema), i = Array(e.width).fill(0).map((c, d) => {
|
|
1026
1026
|
const f = n.nodeAt(e.map[d]);
|
|
1027
1027
|
return r.createAndFill({ alignment: f == null ? void 0 : f.attrs.alignment });
|
|
@@ -1053,12 +1053,12 @@ const T = (o) => o.state.selection, ln = (o) => {
|
|
|
1053
1053
|
return {
|
|
1054
1054
|
[0]: {
|
|
1055
1055
|
$: (e = o.get(L).get(v, "leftArrow")) == null ? void 0 : e.dom,
|
|
1056
|
-
command: () =>
|
|
1056
|
+
command: () => Xt,
|
|
1057
1057
|
disable: (c) => !T(c).isColSelection()
|
|
1058
1058
|
},
|
|
1059
1059
|
[1]: {
|
|
1060
1060
|
$: (t = o.get(L).get(v, "rightArrow")) == null ? void 0 : t.dom,
|
|
1061
|
-
command: () =>
|
|
1061
|
+
command: () => Ut,
|
|
1062
1062
|
disable: (c) => !T(c).isColSelection()
|
|
1063
1063
|
},
|
|
1064
1064
|
[2]: {
|
|
@@ -1068,7 +1068,7 @@ const T = (o) => o.state.selection, ln = (o) => {
|
|
|
1068
1068
|
return !1;
|
|
1069
1069
|
if (d) {
|
|
1070
1070
|
const f = P(c);
|
|
1071
|
-
d(
|
|
1071
|
+
d(_e(c.tr, f, f.top));
|
|
1072
1072
|
}
|
|
1073
1073
|
return !0;
|
|
1074
1074
|
},
|
|
@@ -1081,7 +1081,7 @@ const T = (o) => o.state.selection, ln = (o) => {
|
|
|
1081
1081
|
return !1;
|
|
1082
1082
|
if (d) {
|
|
1083
1083
|
const f = P(c);
|
|
1084
|
-
d(
|
|
1084
|
+
d(_e(c.tr, f, f.bottom));
|
|
1085
1085
|
}
|
|
1086
1086
|
return !0;
|
|
1087
1087
|
},
|
|
@@ -1127,7 +1127,7 @@ const T = (o) => o.state.selection, ln = (o) => {
|
|
|
1127
1127
|
};
|
|
1128
1128
|
var x = /* @__PURE__ */ ((o) => (o.Left = "Left", o.Top = "Top", o.Point = "Point", o))(x || {});
|
|
1129
1129
|
const an = (o, { css: e, injectGlobal: t }) => {
|
|
1130
|
-
const n = ut(o), l = o.get(
|
|
1130
|
+
const n = ut(o), l = o.get(Re, "radius"), s = o.get(Re, "lineWidth");
|
|
1131
1131
|
return t`
|
|
1132
1132
|
.milkdown {
|
|
1133
1133
|
.tableWrapper {
|
|
@@ -1250,8 +1250,8 @@ const an = (o, { css: e, injectGlobal: t }) => {
|
|
|
1250
1250
|
return "milkdown-cell-point";
|
|
1251
1251
|
}
|
|
1252
1252
|
};
|
|
1253
|
-
function
|
|
1254
|
-
return
|
|
1253
|
+
function ae(o, e, t, n = 0) {
|
|
1254
|
+
return Ae.widget(e.pos + 1, (l) => {
|
|
1255
1255
|
var r;
|
|
1256
1256
|
const s = document.createElement("div");
|
|
1257
1257
|
return s.classList.add(dn(t)), t === x.Point && s.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), s.addEventListener("mousedown", (a) => {
|
|
@@ -1262,11 +1262,11 @@ function ce(o, e, t, n = 0) {
|
|
|
1262
1262
|
return;
|
|
1263
1263
|
}
|
|
1264
1264
|
case x.Left: {
|
|
1265
|
-
l.dispatch(
|
|
1265
|
+
l.dispatch(Oe("row")(n)(l.state.tr));
|
|
1266
1266
|
return;
|
|
1267
1267
|
}
|
|
1268
1268
|
case x.Top: {
|
|
1269
|
-
l.dispatch(
|
|
1269
|
+
l.dispatch(Oe("col")(n)(l.state.tr));
|
|
1270
1270
|
return;
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
@@ -1284,11 +1284,11 @@ const fn = (o, e) => new W({
|
|
|
1284
1284
|
if (!s)
|
|
1285
1285
|
return null;
|
|
1286
1286
|
const [r] = l;
|
|
1287
|
-
return n.push(
|
|
1288
|
-
n.push(
|
|
1287
|
+
return n.push(ae(o, r, x.Point)), l.forEach((a, i) => {
|
|
1288
|
+
n.push(ae(o, a, x.Left, i));
|
|
1289
1289
|
}), s.forEach((a, i) => {
|
|
1290
|
-
n.push(
|
|
1291
|
-
}),
|
|
1290
|
+
n.push(ae(o, a, x.Top, i));
|
|
1291
|
+
}), Me.create(t.doc, n);
|
|
1292
1292
|
}
|
|
1293
1293
|
},
|
|
1294
1294
|
view: (t) => {
|
|
@@ -1331,27 +1331,27 @@ const fn = (o, e) => new W({
|
|
|
1331
1331
|
handleDOMEvents: {
|
|
1332
1332
|
compositionstart(o) {
|
|
1333
1333
|
const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
|
|
1334
|
-
return
|
|
1334
|
+
return Te.safari && M(e) && l.empty && un(s.parent) && t(n.insertText("\u2060", s.start())), !1;
|
|
1335
1335
|
},
|
|
1336
1336
|
compositionend(o) {
|
|
1337
1337
|
const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
|
|
1338
|
-
return
|
|
1338
|
+
return Te.safari && M(e) && l.empty && pn(s.parent) && s.parent.textContent.startsWith("\u2060") && t(n.delete(s.start(), s.start() + 1)), !1;
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
1342
|
});
|
|
1343
1343
|
class gn {
|
|
1344
1344
|
constructor(e, t) {
|
|
1345
|
-
this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
1345
|
+
this.node = e, this.cellMinWidth = t, this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), pe(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1346
1346
|
}
|
|
1347
1347
|
update(e) {
|
|
1348
|
-
return e.type != this.node.type ? !1 : (this.node = e,
|
|
1348
|
+
return e.type != this.node.type ? !1 : (this.node = e, pe(e, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
1349
1349
|
}
|
|
1350
1350
|
ignoreMutation(e) {
|
|
1351
1351
|
return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function pe(o, e, t, n, l, s) {
|
|
1355
1355
|
var d;
|
|
1356
1356
|
let r = 0, a = !0, i = e.firstChild;
|
|
1357
1357
|
const c = o.firstChild;
|
|
@@ -1421,7 +1421,7 @@ class q {
|
|
|
1421
1421
|
return new q(t.activeHandle, n.setDragging);
|
|
1422
1422
|
if (t.activeHandle > -1 && e.docChanged) {
|
|
1423
1423
|
let l = e.mapping.map(t.activeHandle, -1);
|
|
1424
|
-
|
|
1424
|
+
ue(e.doc.resolve(l)) || (l = 0), t = new q(l, t.dragging);
|
|
1425
1425
|
}
|
|
1426
1426
|
return t;
|
|
1427
1427
|
}
|
|
@@ -1433,7 +1433,7 @@ function bn(o, e, t, n) {
|
|
|
1433
1433
|
let r = -1;
|
|
1434
1434
|
if (s) {
|
|
1435
1435
|
const { left: a, right: i } = s.getBoundingClientRect();
|
|
1436
|
-
e.clientX - a <= t ? r =
|
|
1436
|
+
e.clientX - a <= t ? r = ze(o, e, "left") : i - e.clientX <= t && (r = ze(o, e, "right"));
|
|
1437
1437
|
}
|
|
1438
1438
|
if (r != l.activeHandle) {
|
|
1439
1439
|
if (!n && r !== -1) {
|
|
@@ -1460,13 +1460,13 @@ function yn(o, e, t) {
|
|
|
1460
1460
|
function r(i) {
|
|
1461
1461
|
window.removeEventListener("mouseup", r), window.removeEventListener("mousemove", a);
|
|
1462
1462
|
const c = k.getState(o.state);
|
|
1463
|
-
c.dragging && (Mn(o, c.activeHandle,
|
|
1463
|
+
c.dragging && (Mn(o, c.activeHandle, Fe(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
|
|
1464
1464
|
}
|
|
1465
1465
|
function a(i) {
|
|
1466
1466
|
if (!i.which)
|
|
1467
1467
|
return r(i);
|
|
1468
|
-
const c = k.getState(o.state), d =
|
|
1469
|
-
|
|
1468
|
+
const c = k.getState(o.state), d = Fe(c.dragging, i, t);
|
|
1469
|
+
Nn(o, c.activeHandle, d, t);
|
|
1470
1470
|
}
|
|
1471
1471
|
return window.addEventListener("mouseup", r), window.addEventListener("mousemove", a), e.preventDefault(), !0;
|
|
1472
1472
|
}
|
|
@@ -1486,11 +1486,11 @@ function An(o) {
|
|
|
1486
1486
|
o = o.classList.contains("ProseMirror") ? null : o.parentNode;
|
|
1487
1487
|
return o;
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function ze(o, e, t) {
|
|
1490
1490
|
const n = o.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
1491
1491
|
if (!n)
|
|
1492
1492
|
return -1;
|
|
1493
|
-
const { pos: l } = n, s =
|
|
1493
|
+
const { pos: l } = n, s = X(o.state.doc.resolve(l));
|
|
1494
1494
|
if (!s)
|
|
1495
1495
|
return -1;
|
|
1496
1496
|
if (t == "right")
|
|
@@ -1498,7 +1498,7 @@ function _e(o, e, t) {
|
|
|
1498
1498
|
const r = g.get(s.node(-1)), a = s.start(-1), i = r.map.indexOf(s.pos - a);
|
|
1499
1499
|
return i % r.width == 0 ? -1 : a + r.map[i - 1];
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1501
|
+
function Fe(o, e, t) {
|
|
1502
1502
|
const n = e.clientX - o.startX;
|
|
1503
1503
|
return Math.max(t, o.startWidth + n);
|
|
1504
1504
|
}
|
|
@@ -1514,19 +1514,19 @@ function Mn(o, e, t) {
|
|
|
1514
1514
|
const f = s.map[d], { attrs: u } = l.nodeAt(f), p = u.colspan == 1 ? 0 : a - s.colCount(f);
|
|
1515
1515
|
if (u.colwidth && u.colwidth[p] == t)
|
|
1516
1516
|
continue;
|
|
1517
|
-
const h = u.colwidth ? u.colwidth.slice() :
|
|
1517
|
+
const h = u.colwidth ? u.colwidth.slice() : Sn(u.colspan);
|
|
1518
1518
|
h[p] = t, i.setNodeMarkup(r + f, null, y(u, "colwidth", h));
|
|
1519
1519
|
}
|
|
1520
1520
|
i.docChanged && o.dispatch(i);
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function Nn(o, e, t, n) {
|
|
1523
1523
|
const l = o.state.doc.resolve(e), s = l.node(-1), r = l.start(-1), a = g.get(s).colCount(l.pos - r) + l.nodeAfter.attrs.colspan - 1;
|
|
1524
1524
|
let i = o.domAtPos(l.start(-1)).node;
|
|
1525
1525
|
for (; i.nodeName != "TABLE"; )
|
|
1526
1526
|
i = i.parentNode;
|
|
1527
|
-
|
|
1527
|
+
pe(s, i.firstChild, i, n, a, t);
|
|
1528
1528
|
}
|
|
1529
|
-
function
|
|
1529
|
+
function Sn(o) {
|
|
1530
1530
|
const e = [];
|
|
1531
1531
|
for (let t = 0; t < o; t++)
|
|
1532
1532
|
e.push(0);
|
|
@@ -1538,10 +1538,10 @@ function xn(o, e) {
|
|
|
1538
1538
|
const c = a + i * s.width - 1;
|
|
1539
1539
|
if ((a == s.width || s.map[c] != s.map[c + 1]) && (i == 0 || s.map[c - 1] != s.map[c - 1 - s.width])) {
|
|
1540
1540
|
const d = s.map[c], f = r + d + l.nodeAt(d).nodeSize - 1, u = document.createElement("div");
|
|
1541
|
-
u.className = "column-resize-handle", t.push(
|
|
1541
|
+
u.className = "column-resize-handle", t.push(Ae.widget(f, u));
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
|
-
return
|
|
1544
|
+
return Me.create(o.doc, t);
|
|
1545
1545
|
}
|
|
1546
1546
|
function Rn(o) {
|
|
1547
1547
|
if (!o.size)
|
|
@@ -1554,10 +1554,10 @@ function Rn(o) {
|
|
|
1554
1554
|
for (let i = 0; i < e.childCount; i++) {
|
|
1555
1555
|
let c = e.child(i).content;
|
|
1556
1556
|
const d = i ? 0 : Math.max(0, t - 1), f = i < e.childCount - 1 ? 0 : Math.max(0, n - 1);
|
|
1557
|
-
(d || f) && (c =
|
|
1557
|
+
(d || f) && (c = he(A(r).row, new O(c, d, f)).content), a.push(c);
|
|
1558
1558
|
}
|
|
1559
1559
|
else if (s == "cell" || s == "header_cell")
|
|
1560
|
-
a.push(t || n ?
|
|
1560
|
+
a.push(t || n ? he(A(r).row, new O(e, t, n)).content : e);
|
|
1561
1561
|
else
|
|
1562
1562
|
return null;
|
|
1563
1563
|
return Tn(r, a);
|
|
@@ -1576,15 +1576,15 @@ function Tn(o, e) {
|
|
|
1576
1576
|
for (let l = 0; l < t.length; l++)
|
|
1577
1577
|
n = Math.max(n, t[l]);
|
|
1578
1578
|
for (let l = 0; l < t.length; l++)
|
|
1579
|
-
if (l >= e.length && e.push(
|
|
1579
|
+
if (l >= e.length && e.push(I.empty), t[l] < n) {
|
|
1580
1580
|
const s = A(o).cell.createAndFill(), r = [];
|
|
1581
1581
|
for (let a = t[l]; a < n; a++)
|
|
1582
1582
|
r.push(s);
|
|
1583
|
-
e[l] = e[l].append(
|
|
1583
|
+
e[l] = e[l].append(I.from(r));
|
|
1584
1584
|
}
|
|
1585
1585
|
return { height: e.length, width: n, rows: e };
|
|
1586
1586
|
}
|
|
1587
|
-
function
|
|
1587
|
+
function he(o, e) {
|
|
1588
1588
|
const t = o.createAndFill();
|
|
1589
1589
|
return new At(t).replace(0, t.content.size, e).doc;
|
|
1590
1590
|
}
|
|
@@ -1599,7 +1599,7 @@ function Ln({ width: o, height: e, rows: t }, n, l) {
|
|
|
1599
1599
|
for (let p = 1; p < u.attrs.rowspan; p++)
|
|
1600
1600
|
s[a + p] = (s[a + p] || 0) + u.attrs.colspan;
|
|
1601
1601
|
}
|
|
1602
|
-
r.push(
|
|
1602
|
+
r.push(I.from(c));
|
|
1603
1603
|
}
|
|
1604
1604
|
t = r, o = n;
|
|
1605
1605
|
}
|
|
@@ -1611,7 +1611,7 @@ function Ln({ width: o, height: e, rows: t }, n, l) {
|
|
|
1611
1611
|
let f = c.child(d);
|
|
1612
1612
|
r + f.attrs.rowspan > l && (f = f.type.create(y(f.attrs, "rowspan", Math.max(1, l - f.attrs.rowspan)), f.content)), i.push(f);
|
|
1613
1613
|
}
|
|
1614
|
-
s.push(
|
|
1614
|
+
s.push(I.from(i));
|
|
1615
1615
|
}
|
|
1616
1616
|
t = s, e = l;
|
|
1617
1617
|
}
|
|
@@ -1637,14 +1637,14 @@ function vn(o, e, t, n, l, s, r) {
|
|
|
1637
1637
|
const w = h >= e.width ? !1 : t.nodeAt(e.map[b + h]).type == i.header_cell;
|
|
1638
1638
|
f.push(w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill()));
|
|
1639
1639
|
}
|
|
1640
|
-
const u = i.row.create(null,
|
|
1640
|
+
const u = i.row.create(null, I.from(f)), p = [];
|
|
1641
1641
|
for (let h = e.height; h < s; h++)
|
|
1642
1642
|
p.push(u);
|
|
1643
1643
|
o.insert(o.mapping.slice(r).map(n + t.nodeSize - 2), p);
|
|
1644
1644
|
}
|
|
1645
1645
|
return !!(c || d);
|
|
1646
1646
|
}
|
|
1647
|
-
function
|
|
1647
|
+
function Be(o, e, t, n, l, s, r, a) {
|
|
1648
1648
|
if (r == 0 || r == e.height)
|
|
1649
1649
|
return !1;
|
|
1650
1650
|
let i = !1;
|
|
@@ -1658,7 +1658,7 @@ function Fe(o, e, t, n, l, s, r, a) {
|
|
|
1658
1658
|
}
|
|
1659
1659
|
return i;
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1661
|
+
function Pe(o, e, t, n, l, s, r, a) {
|
|
1662
1662
|
if (r == 0 || r == e.width)
|
|
1663
1663
|
return !1;
|
|
1664
1664
|
let i = !1;
|
|
@@ -1672,14 +1672,14 @@ function Be(o, e, t, n, l, s, r, a) {
|
|
|
1672
1672
|
}
|
|
1673
1673
|
return i;
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function We(o, e, t, n, l) {
|
|
1676
1676
|
let s = t ? o.doc.nodeAt(t - 1) : o.doc, r = g.get(s);
|
|
1677
1677
|
const { top: a, left: i } = n, c = i + l.width, d = a + l.height, f = o.tr;
|
|
1678
1678
|
let u = 0;
|
|
1679
1679
|
function p() {
|
|
1680
1680
|
s = t ? f.doc.nodeAt(t - 1) : f.doc, r = g.get(s), u = f.mapping.maps.length;
|
|
1681
1681
|
}
|
|
1682
|
-
vn(f, r, s, t, c, d, u) && p(),
|
|
1682
|
+
vn(f, r, s, t, c, d, u) && p(), Be(f, r, s, t, i, c, a, u) && p(), Be(f, r, s, t, i, c, d, u) && p(), Pe(f, r, s, t, a, d, i, u) && p(), Pe(f, r, s, t, a, d, c, u) && p();
|
|
1683
1683
|
for (let h = a; h < d; h++) {
|
|
1684
1684
|
const b = r.positionAt(h, i, s), w = r.positionAt(h, c, s);
|
|
1685
1685
|
f.replace(f.mapping.slice(u).map(b + t), f.mapping.slice(u).map(w + t), new O(l.rows[h - a], 0, 0));
|
|
@@ -1750,32 +1750,32 @@ function $n(o, e, t, n) {
|
|
|
1750
1750
|
}
|
|
1751
1751
|
return n.setMeta(En, { fixTables: !0 });
|
|
1752
1752
|
}
|
|
1753
|
-
const
|
|
1754
|
-
function
|
|
1753
|
+
const $ = new F("selectingCells");
|
|
1754
|
+
function He(o, e) {
|
|
1755
1755
|
for (; e && e != o.dom; e = e.parentNode)
|
|
1756
1756
|
if (e.nodeName == "TD" || e.nodeName == "TH")
|
|
1757
1757
|
return e;
|
|
1758
1758
|
}
|
|
1759
|
-
function
|
|
1759
|
+
function de(o, e) {
|
|
1760
1760
|
const t = o.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
1761
|
-
return t && t ?
|
|
1761
|
+
return t && t ? X(o.state.doc.resolve(t.pos)) : null;
|
|
1762
1762
|
}
|
|
1763
1763
|
function Dn(o, e) {
|
|
1764
1764
|
const t = e;
|
|
1765
1765
|
if (t.ctrlKey || t.metaKey)
|
|
1766
1766
|
return;
|
|
1767
|
-
const n =
|
|
1767
|
+
const n = He(o, t.target);
|
|
1768
1768
|
let l;
|
|
1769
1769
|
if (t.shiftKey && o.state.selection instanceof m)
|
|
1770
1770
|
s(o.state.selection.$anchorCell, t), t.preventDefault();
|
|
1771
|
-
else if (t.shiftKey && n && (l =
|
|
1771
|
+
else if (t.shiftKey && n && (l = X(o.state.selection.$anchor)) != null && de(o, t).pos != l.pos)
|
|
1772
1772
|
s(l, t), t.preventDefault();
|
|
1773
1773
|
else if (!n)
|
|
1774
1774
|
return;
|
|
1775
1775
|
function s(i, c) {
|
|
1776
|
-
let d =
|
|
1777
|
-
const f =
|
|
1778
|
-
if (!d || !
|
|
1776
|
+
let d = de(o, c);
|
|
1777
|
+
const f = $.getState(o.state) == null;
|
|
1778
|
+
if (!d || !Se(i, d))
|
|
1779
1779
|
if (f)
|
|
1780
1780
|
d = i;
|
|
1781
1781
|
else
|
|
@@ -1783,32 +1783,32 @@ function Dn(o, e) {
|
|
|
1783
1783
|
const u = new m(i, d);
|
|
1784
1784
|
if (f || !o.state.selection.eq(u)) {
|
|
1785
1785
|
const p = o.state.tr.setSelection(u);
|
|
1786
|
-
f && p.setMeta(
|
|
1786
|
+
f && p.setMeta($, i.pos), o.dispatch(p);
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
1789
|
function r() {
|
|
1790
|
-
o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a),
|
|
1790
|
+
o.root.removeEventListener("mouseup", r), o.root.removeEventListener("dragstart", r), o.root.removeEventListener("mousemove", a), $.getState(o.state) != null && o.dispatch(o.state.tr.setMeta($, -1));
|
|
1791
1791
|
}
|
|
1792
1792
|
function a(i) {
|
|
1793
|
-
const c =
|
|
1793
|
+
const c = $.getState(o.state);
|
|
1794
1794
|
let d;
|
|
1795
1795
|
if (c != null)
|
|
1796
1796
|
d = o.state.doc.resolve(c);
|
|
1797
|
-
else if (
|
|
1797
|
+
else if (He(o, i.target) != n && (d = de(o, t), !d))
|
|
1798
1798
|
return r();
|
|
1799
1799
|
d && s(d, i);
|
|
1800
1800
|
}
|
|
1801
1801
|
o.root.addEventListener("mouseup", r), o.root.addEventListener("dragstart", r), o.root.addEventListener("mousemove", a);
|
|
1802
1802
|
}
|
|
1803
1803
|
function On(o, e) {
|
|
1804
|
-
const t = o.state.doc, n =
|
|
1804
|
+
const t = o.state.doc, n = X(t.resolve(e));
|
|
1805
1805
|
return n ? (o.dispatch(o.state.tr.setSelection(new m(n))), !0) : !1;
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function Q(o, e, t) {
|
|
1808
1808
|
return t.eq(o.selection) ? !1 : (e && e(o.tr.setSelection(t).scrollIntoView()), !0);
|
|
1809
1809
|
}
|
|
1810
1810
|
function ot(o, e, t) {
|
|
1811
|
-
if (!(o.state.selection instanceof
|
|
1811
|
+
if (!(o.state.selection instanceof E))
|
|
1812
1812
|
return null;
|
|
1813
1813
|
const { $head: n } = o.state.selection;
|
|
1814
1814
|
for (let l = n.depth - 1; l >= 0; l--) {
|
|
@@ -1822,26 +1822,26 @@ function ot(o, e, t) {
|
|
|
1822
1822
|
}
|
|
1823
1823
|
return null;
|
|
1824
1824
|
}
|
|
1825
|
-
function
|
|
1825
|
+
function J(o, e) {
|
|
1826
1826
|
return (t, n, l) => {
|
|
1827
1827
|
const s = t.selection;
|
|
1828
1828
|
if (s instanceof m)
|
|
1829
|
-
return
|
|
1829
|
+
return Q(t, n, N.near(s.$headCell, e));
|
|
1830
1830
|
if (o != "horiz" && !s.empty)
|
|
1831
1831
|
return !1;
|
|
1832
1832
|
const r = ot(l, o, e);
|
|
1833
1833
|
if (r == null)
|
|
1834
1834
|
return !1;
|
|
1835
1835
|
if (o == "horiz")
|
|
1836
|
-
return
|
|
1836
|
+
return Q(t, n, N.near(t.doc.resolve(s.head + e), e));
|
|
1837
1837
|
{
|
|
1838
1838
|
const a = t.doc.resolve(r), i = Qe(a, o, e);
|
|
1839
1839
|
let c;
|
|
1840
|
-
return i ? c =
|
|
1840
|
+
return i ? c = N.near(i, 1) : e < 0 ? c = N.near(t.doc.resolve(a.before(-1)), -1) : c = N.near(t.doc.resolve(a.after(-1)), 1), Q(t, n, c);
|
|
1841
1841
|
}
|
|
1842
1842
|
};
|
|
1843
1843
|
}
|
|
1844
|
-
function
|
|
1844
|
+
function Y(o, e) {
|
|
1845
1845
|
return (t, n, l) => {
|
|
1846
1846
|
let s = t.selection;
|
|
1847
1847
|
if (!(s instanceof m)) {
|
|
@@ -1851,10 +1851,10 @@ function J(o, e) {
|
|
|
1851
1851
|
s = new m(t.doc.resolve(a));
|
|
1852
1852
|
}
|
|
1853
1853
|
const r = Qe(s.$headCell, o, e);
|
|
1854
|
-
return r ?
|
|
1854
|
+
return r ? Q(t, n, new m(s.$anchorCell, r)) : !1;
|
|
1855
1855
|
};
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function Z(o, e) {
|
|
1858
1858
|
const t = o.selection;
|
|
1859
1859
|
if (!(t instanceof m))
|
|
1860
1860
|
return !1;
|
|
@@ -1867,18 +1867,18 @@ function Y(o, e) {
|
|
|
1867
1867
|
return !0;
|
|
1868
1868
|
}
|
|
1869
1869
|
const _n = kt({
|
|
1870
|
-
ArrowLeft:
|
|
1871
|
-
ArrowRight:
|
|
1872
|
-
ArrowUp:
|
|
1873
|
-
ArrowDown:
|
|
1874
|
-
"Shift-ArrowLeft":
|
|
1875
|
-
"Shift-ArrowRight":
|
|
1876
|
-
"Shift-ArrowUp":
|
|
1877
|
-
"Shift-ArrowDown":
|
|
1878
|
-
Backspace:
|
|
1879
|
-
"Mod-Backspace":
|
|
1880
|
-
Delete:
|
|
1881
|
-
"Mod-Delete":
|
|
1870
|
+
ArrowLeft: J("horiz", -1),
|
|
1871
|
+
ArrowRight: J("horiz", 1),
|
|
1872
|
+
ArrowUp: J("vert", -1),
|
|
1873
|
+
ArrowDown: J("vert", 1),
|
|
1874
|
+
"Shift-ArrowLeft": Y("horiz", -1),
|
|
1875
|
+
"Shift-ArrowRight": Y("horiz", 1),
|
|
1876
|
+
"Shift-ArrowUp": Y("vert", -1),
|
|
1877
|
+
"Shift-ArrowDown": Y("vert", 1),
|
|
1878
|
+
Backspace: Z,
|
|
1879
|
+
"Mod-Backspace": Z,
|
|
1880
|
+
Delete: Z,
|
|
1881
|
+
"Mod-Delete": Z
|
|
1882
1882
|
});
|
|
1883
1883
|
function zn(o, e, t) {
|
|
1884
1884
|
if (!M(o.state))
|
|
@@ -1889,25 +1889,25 @@ function zn(o, e, t) {
|
|
|
1889
1889
|
n || (n = {
|
|
1890
1890
|
width: 1,
|
|
1891
1891
|
height: 1,
|
|
1892
|
-
rows: [
|
|
1892
|
+
rows: [I.from(he(A(o.state.schema).cell, t))]
|
|
1893
1893
|
});
|
|
1894
1894
|
const s = l.$anchorCell.node(-1), r = l.$anchorCell.start(-1), a = g.get(s).rectBetween(l.$anchorCell.pos - r, l.$headCell.pos - r);
|
|
1895
|
-
return n = Ln(n, a.right - a.left, a.bottom - a.top),
|
|
1895
|
+
return n = Ln(n, a.right - a.left, a.bottom - a.top), We(o.state, o.dispatch, r, a, n), !0;
|
|
1896
1896
|
} else if (n) {
|
|
1897
|
-
const s =
|
|
1898
|
-
return
|
|
1897
|
+
const s = oe(o.state), r = s.start(-1);
|
|
1898
|
+
return We(o.state, o.dispatch, r, g.get(s.node(-1)).findCell(s.pos - r), n), !0;
|
|
1899
1899
|
} else
|
|
1900
1900
|
return !1;
|
|
1901
1901
|
}
|
|
1902
1902
|
function Fn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
1903
1903
|
return new W({
|
|
1904
|
-
key:
|
|
1904
|
+
key: $,
|
|
1905
1905
|
state: {
|
|
1906
1906
|
init() {
|
|
1907
1907
|
return null;
|
|
1908
1908
|
},
|
|
1909
1909
|
apply(e, t) {
|
|
1910
|
-
const n = e.getMeta(
|
|
1910
|
+
const n = e.getMeta($);
|
|
1911
1911
|
if (n != null)
|
|
1912
1912
|
return n == -1 ? null : n;
|
|
1913
1913
|
if (t == null || !e.docChanged)
|
|
@@ -1922,7 +1922,7 @@ function Fn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
|
1922
1922
|
mousedown: Dn
|
|
1923
1923
|
},
|
|
1924
1924
|
createSelectionBetween(e) {
|
|
1925
|
-
return
|
|
1925
|
+
return $.getState(e.state) != null ? e.state.selection : null;
|
|
1926
1926
|
},
|
|
1927
1927
|
handleTripleClick: On,
|
|
1928
1928
|
handleKeyDown: _n,
|
|
@@ -1933,15 +1933,15 @@ function Fn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
|
1933
1933
|
}
|
|
1934
1934
|
});
|
|
1935
1935
|
}
|
|
1936
|
-
const
|
|
1936
|
+
const ee = {
|
|
1937
1937
|
NextCell: "NextCell",
|
|
1938
1938
|
PrevCell: "PrevCell",
|
|
1939
1939
|
ExitTable: "ExitTable"
|
|
1940
|
-
},
|
|
1940
|
+
}, je = R("PrevCell"), Ke = R("NextCell"), qe = R("BreakTable"), Bn = R("InsertTable"), Pn = it((o) => ({
|
|
1941
1941
|
schema: () => ({
|
|
1942
1942
|
node: {
|
|
1943
1943
|
table: {
|
|
1944
|
-
...
|
|
1944
|
+
...G.table,
|
|
1945
1945
|
parseMarkdown: {
|
|
1946
1946
|
match: (e) => e.type === "table",
|
|
1947
1947
|
runner: (e, t, n) => {
|
|
@@ -1968,7 +1968,7 @@ const Q = {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
},
|
|
1970
1970
|
table_row: {
|
|
1971
|
-
...
|
|
1971
|
+
...G.table_row,
|
|
1972
1972
|
parseMarkdown: {
|
|
1973
1973
|
match: (e) => e.type === "tableRow",
|
|
1974
1974
|
runner: (e, t, n) => {
|
|
@@ -1988,7 +1988,7 @@ const Q = {
|
|
|
1988
1988
|
}
|
|
1989
1989
|
},
|
|
1990
1990
|
table_cell: {
|
|
1991
|
-
...
|
|
1991
|
+
...G.table_cell,
|
|
1992
1992
|
parseMarkdown: {
|
|
1993
1993
|
match: (e) => e.type === "tableCell" && !e.isHeader,
|
|
1994
1994
|
runner: (e, t, n) => {
|
|
@@ -2004,7 +2004,7 @@ const Q = {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
},
|
|
2006
2006
|
table_header: {
|
|
2007
|
-
...
|
|
2007
|
+
...G.table_header,
|
|
2008
2008
|
parseMarkdown: {
|
|
2009
2009
|
match: (e) => e.type === "tableCell" && !!e.isHeader,
|
|
2010
2010
|
runner: (e, t, n) => {
|
|
@@ -2022,36 +2022,44 @@ const Q = {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
}),
|
|
2024
2024
|
inputRules: (e, t) => [
|
|
2025
|
-
new
|
|
2025
|
+
new fe(/^\|\|\s$/, (n, l, s, r) => {
|
|
2026
|
+
const a = n.doc.resolve(s);
|
|
2027
|
+
if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
|
|
2028
|
+
return null;
|
|
2029
|
+
const i = ce(t.get(V)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
|
|
2030
|
+
return c.setSelection(E.create(c.doc, s + 3));
|
|
2031
|
+
}),
|
|
2032
|
+
new fe(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/, (n, l, s, r) => {
|
|
2033
|
+
var d, f;
|
|
2026
2034
|
const a = n.doc.resolve(s);
|
|
2027
2035
|
if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
|
|
2028
2036
|
return null;
|
|
2029
|
-
const i =
|
|
2030
|
-
return c.setSelection(
|
|
2037
|
+
const i = ce(t.get(V), Number((d = l.groups) == null ? void 0 : d.row), Number((f = l.groups) == null ? void 0 : f.col)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
|
|
2038
|
+
return c.setSelection(E.create(c.doc, s + 3));
|
|
2031
2039
|
})
|
|
2032
2040
|
],
|
|
2033
2041
|
commands: (e, t) => [
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
const { selection: s, tr: r } = n, { from: a } = s, i =
|
|
2042
|
+
S(je, () => De(-1)),
|
|
2043
|
+
S(Ke, () => De(1)),
|
|
2044
|
+
S(qe, () => qt(t.get(V).nodes.paragraph)),
|
|
2045
|
+
S(Bn, () => (n, l) => {
|
|
2046
|
+
const { selection: s, tr: r } = n, { from: a } = s, i = ce(t.get(V)), c = r.replaceSelectionWith(i), d = N.findFrom(c.doc.resolve(a), 1, !0);
|
|
2039
2047
|
return d && (l == null || l(c.setSelection(d))), !0;
|
|
2040
2048
|
})
|
|
2041
2049
|
],
|
|
2042
2050
|
shortcuts: {
|
|
2043
|
-
[
|
|
2044
|
-
[
|
|
2045
|
-
[
|
|
2051
|
+
[ee.NextCell]: D(Ke, "Mod-]"),
|
|
2052
|
+
[ee.PrevCell]: D(je, "Mod-["),
|
|
2053
|
+
[ee.ExitTable]: D(qe, "Mod-Enter")
|
|
2046
2054
|
},
|
|
2047
2055
|
prosePlugins: (e, t) => [fn(t, o), mn(), wn(), Fn()]
|
|
2048
2056
|
})), K = {
|
|
2049
2057
|
...lt,
|
|
2050
|
-
...
|
|
2058
|
+
...ee,
|
|
2051
2059
|
StrikeThrough: "StrikeThrough",
|
|
2052
2060
|
TaskList: "TaskList"
|
|
2053
|
-
},
|
|
2054
|
-
id:
|
|
2061
|
+
}, me = R("ToggleStrikeThrough"), Xe = "strike_through", Wn = ct((o) => ({
|
|
2062
|
+
id: Xe,
|
|
2055
2063
|
schema: () => ({
|
|
2056
2064
|
inclusive: !1,
|
|
2057
2065
|
parseDOM: [
|
|
@@ -2066,17 +2074,17 @@ const Q = {
|
|
|
2066
2074
|
}
|
|
2067
2075
|
},
|
|
2068
2076
|
toMarkdown: {
|
|
2069
|
-
match: (e) => e.type.name ===
|
|
2077
|
+
match: (e) => e.type.name === Xe,
|
|
2070
2078
|
runner: (e, t) => {
|
|
2071
2079
|
e.withMark(t, "delete");
|
|
2072
2080
|
}
|
|
2073
2081
|
}
|
|
2074
2082
|
}),
|
|
2075
|
-
commands: (e) => [
|
|
2083
|
+
commands: (e) => [S(me, () => Ct(e))],
|
|
2076
2084
|
shortcuts: {
|
|
2077
|
-
[K.StrikeThrough]:
|
|
2085
|
+
[K.StrikeThrough]: D(me, "Mod-Alt-x")
|
|
2078
2086
|
}
|
|
2079
|
-
})),
|
|
2087
|
+
})), ge = R("SplitTaskListItem"), we = R("SinkTaskListItem"), be = R("LiftTaskListItem"), Ce = R("TurnIntoTaskList"), Hn = ye((o) => {
|
|
2080
2088
|
const e = "task_list_item";
|
|
2081
2089
|
return {
|
|
2082
2090
|
id: e,
|
|
@@ -2095,7 +2103,7 @@ const Q = {
|
|
|
2095
2103
|
tag: 'li[data-type="task-item"]',
|
|
2096
2104
|
getAttrs: (n) => {
|
|
2097
2105
|
if (!(n instanceof HTMLElement))
|
|
2098
|
-
throw
|
|
2106
|
+
throw ke(n);
|
|
2099
2107
|
return { checked: n.dataset.checked === "true" };
|
|
2100
2108
|
}
|
|
2101
2109
|
}
|
|
@@ -2106,7 +2114,7 @@ const Q = {
|
|
|
2106
2114
|
const r = s.target;
|
|
2107
2115
|
if (!(r instanceof HTMLInputElement))
|
|
2108
2116
|
return;
|
|
2109
|
-
const a = t.get(
|
|
2117
|
+
const a = t.get(te);
|
|
2110
2118
|
if (!a.editable) {
|
|
2111
2119
|
l.checked = !l.checked;
|
|
2112
2120
|
return;
|
|
@@ -2143,21 +2151,21 @@ const Q = {
|
|
|
2143
2151
|
}
|
|
2144
2152
|
}),
|
|
2145
2153
|
inputRules: (t) => [
|
|
2146
|
-
|
|
2154
|
+
Ge(/^\s*(\[([ |x])\])\s$/, t, (n) => ({
|
|
2147
2155
|
checked: n[n.length - 1] === "x"
|
|
2148
2156
|
}))
|
|
2149
2157
|
],
|
|
2150
2158
|
commands: (t) => [
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2159
|
+
S(ge, () => Mt(t)),
|
|
2160
|
+
S(we, () => Nt(t)),
|
|
2161
|
+
S(be, () => St(t)),
|
|
2162
|
+
S(Ce, () => yt(t))
|
|
2155
2163
|
],
|
|
2156
2164
|
shortcuts: {
|
|
2157
|
-
[K.NextListItem]:
|
|
2158
|
-
[K.SinkListItem]:
|
|
2159
|
-
[K.LiftListItem]:
|
|
2160
|
-
[K.TaskList]:
|
|
2165
|
+
[K.NextListItem]: D(ge, "Enter"),
|
|
2166
|
+
[K.SinkListItem]: D(we, "Mod-]"),
|
|
2167
|
+
[K.LiftListItem]: D(be, "Mod-["),
|
|
2168
|
+
[K.TaskList]: D(Ce, "Mod-Alt-9")
|
|
2161
2169
|
},
|
|
2162
2170
|
view: () => (t, n, l) => {
|
|
2163
2171
|
let s = t;
|
|
@@ -2190,43 +2198,43 @@ const Q = {
|
|
|
2190
2198
|
Rt()
|
|
2191
2199
|
]), lo = {
|
|
2192
2200
|
...rt,
|
|
2193
|
-
ToggleStrikeThrough:
|
|
2194
|
-
TurnIntoTaskList:
|
|
2195
|
-
SinkTaskListItem:
|
|
2196
|
-
LiftTaskListItem:
|
|
2197
|
-
SplitTaskListItem:
|
|
2201
|
+
ToggleStrikeThrough: me,
|
|
2202
|
+
TurnIntoTaskList: Ce,
|
|
2203
|
+
SinkTaskListItem: we,
|
|
2204
|
+
LiftTaskListItem: be,
|
|
2205
|
+
SplitTaskListItem: ge
|
|
2198
2206
|
};
|
|
2199
2207
|
export {
|
|
2200
|
-
|
|
2208
|
+
qe as BreakTable,
|
|
2201
2209
|
io as InsertHardbreak,
|
|
2202
2210
|
co as InsertHr,
|
|
2203
2211
|
ao as InsertImage,
|
|
2204
2212
|
Bn as InsertTable,
|
|
2205
2213
|
fo as LiftListItem,
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2214
|
+
be as LiftTaskListItem,
|
|
2215
|
+
Le as ModifyFootnoteDef,
|
|
2216
|
+
ve as ModifyFootnoteRef,
|
|
2209
2217
|
uo as ModifyImage,
|
|
2210
2218
|
po as ModifyLink,
|
|
2211
|
-
|
|
2212
|
-
|
|
2219
|
+
Ke as NextCell,
|
|
2220
|
+
je as PrevCell,
|
|
2213
2221
|
ho as SinkListItem,
|
|
2214
|
-
|
|
2222
|
+
we as SinkTaskListItem,
|
|
2215
2223
|
mo as SplitListItem,
|
|
2216
|
-
|
|
2224
|
+
ge as SplitTaskListItem,
|
|
2217
2225
|
K as SupportedKeys,
|
|
2218
2226
|
go as ToggleBold,
|
|
2219
2227
|
wo as ToggleInlineCode,
|
|
2220
2228
|
bo as ToggleItalic,
|
|
2221
2229
|
Co as ToggleLink,
|
|
2222
|
-
|
|
2230
|
+
me as ToggleStrikeThrough,
|
|
2223
2231
|
yo as TurnIntoCodeFence,
|
|
2224
2232
|
ko as TurnIntoHeading,
|
|
2225
|
-
|
|
2233
|
+
Ce as TurnIntoTaskList,
|
|
2226
2234
|
Ao as TurnIntoText,
|
|
2227
2235
|
Mo as WrapInBlockquote,
|
|
2228
|
-
|
|
2229
|
-
|
|
2236
|
+
No as WrapInBulletList,
|
|
2237
|
+
So as WrapInOrderedList,
|
|
2230
2238
|
xo as blockquote,
|
|
2231
2239
|
Ro as bulletList,
|
|
2232
2240
|
To as codeFence,
|
|
@@ -2235,7 +2243,7 @@ export {
|
|
|
2235
2243
|
vo as commonmark,
|
|
2236
2244
|
Eo as commonmarkNodes,
|
|
2237
2245
|
Io as commonmarkPlugins,
|
|
2238
|
-
|
|
2246
|
+
ce as createTable,
|
|
2239
2247
|
$o as doc,
|
|
2240
2248
|
Do as em,
|
|
2241
2249
|
Rt as footnoteDefinition,
|