@milkdown/preset-gfm 6.3.0 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +173 -192
- package/lib/index.es.js.map +1 -1
- package/lib/table/nodes/index.d.ts +0 -2
- package/lib/table/nodes/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +1 -1
- package/src/table/nodes/index.ts +2 -30
- package/src/table/operator-plugin/style.ts +12 -12
package/lib/index.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { SupportedKeys as st, commonmark as rt, commands as it } from "@milkdown/preset-commonmark";
|
|
2
|
-
import { InsertHardbreak as
|
|
2
|
+
import { InsertHardbreak as ho, InsertHr as mo, InsertImage as go, LiftListItem as wo, ModifyImage as bo, ModifyLink as Co, SinkListItem as yo, SplitListItem as ko, ToggleBold as Ao, ToggleInlineCode as Mo, ToggleItalic as So, ToggleLink as No, TurnIntoCodeFence as xo, TurnIntoHeading as Ro, TurnIntoText as To, WrapInBlockquote as Lo, WrapInBulletList as vo, WrapInOrderedList as Eo, blockquote as Io, bulletList as $o, codeFence as Do, codeInline as Oo, commonmark as _o, commonmarkNodes as zo, commonmarkPlugins as Fo, doc as Bo, em as Po, HardbreakFilterPluginKey as Wo, heading as Ho, hr as jo, image as Ko, link as qo, listItem as Uo, orderedList as Xo, paragraph as Vo, strong as Zo, text as Go } from "@milkdown/preset-commonmark";
|
|
3
3
|
import { $prose as ct, createNode as be, createPlugin as at, createShortcut as $, createMark as dt, AtomList as ut, $remark as ft } from "@milkdown/utils";
|
|
4
4
|
import pt from "remark-gfm";
|
|
5
5
|
import { inputRules as ht, InputRule as Ce, wrappingInputRule as Ve } from "@milkdown/prose/inputrules";
|
|
6
|
-
import { createCmdKey as
|
|
6
|
+
import { createCmdKey as R, editorViewCtx as ee, createCmd as N, commandsCtx as Ze, themeManagerCtx as L, ThemeIcon as v, ThemeBorder as mt, ThemeShadow as gt, getPalette as wt, ThemeSize as xe, schemaCtx as re } from "@milkdown/core";
|
|
7
7
|
import { expectDomTypeError as ye, missingRootElement as bt } from "@milkdown/exception";
|
|
8
|
-
import { findSelectedNodeOfType as
|
|
9
|
-
import { PluginKey as
|
|
8
|
+
import { findSelectedNodeOfType as B, findParentNode as Ct, cloneTr as Ge, calculateNodePosition as yt, browser as Re, markRule as Te } from "@milkdown/prose";
|
|
9
|
+
import { PluginKey as F, NodeSelection as te, Plugin as W, Selection as S, SelectionRange as kt, TextSelection as D } from "@milkdown/prose/state";
|
|
10
10
|
import { toggleMark as At, wrapIn as Mt } from "@milkdown/prose/commands";
|
|
11
|
-
import { Fragment as E, Slice as
|
|
11
|
+
import { Fragment as E, Slice as O } from "@milkdown/prose/model";
|
|
12
12
|
import { Decoration as ke, DecorationSet as Ae } from "@milkdown/prose/view";
|
|
13
|
-
import { keydownHandler as
|
|
14
|
-
import { Transform as
|
|
15
|
-
import { splitListItem as
|
|
13
|
+
import { keydownHandler as St } from "@milkdown/prose/keymap";
|
|
14
|
+
import { Transform as Nt } from "@milkdown/prose/transform";
|
|
15
|
+
import { splitListItem as xt, sinkListItem as Rt, liftListItem as Tt } from "@milkdown/prose/schema-list";
|
|
16
16
|
const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/, vt = () => ht({
|
|
17
17
|
rules: [
|
|
18
18
|
new Ce(Lt, (o, e, t, n) => {
|
|
@@ -24,7 +24,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
24
24
|
return r ? o.tr.replaceWith(t, n, l.text(s)).addMark(t, s.length + t, r) : null;
|
|
25
25
|
})
|
|
26
26
|
]
|
|
27
|
-
}), Et = ct(() => vt()), Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, It = new
|
|
27
|
+
}), Et = ct(() => vt()), Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, It = new F("MILKDOWN_FOOTNOTE_DEF_INPUT"), Le = R("ModifyFootnoteDef"), $t = be((o) => {
|
|
28
28
|
const e = "footnote_definition", t = "footnoteDefinition";
|
|
29
29
|
return {
|
|
30
30
|
id: e,
|
|
@@ -90,8 +90,8 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
90
90
|
}
|
|
91
91
|
}),
|
|
92
92
|
commands: (n) => [
|
|
93
|
-
|
|
94
|
-
const a =
|
|
93
|
+
N(Le, (l = "") => (s, r) => {
|
|
94
|
+
const a = B(s.selection, n);
|
|
95
95
|
if (!a)
|
|
96
96
|
return !1;
|
|
97
97
|
const { tr: i } = s, c = i.setNodeMarkup(a.pos, void 0, { ...a.node.attrs, label: l });
|
|
@@ -107,7 +107,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
107
107
|
}, () => !1)
|
|
108
108
|
],
|
|
109
109
|
prosePlugins: (n, l) => [
|
|
110
|
-
new
|
|
110
|
+
new W({
|
|
111
111
|
key: It,
|
|
112
112
|
view: (s) => {
|
|
113
113
|
const r = o.themeManager.get("input-chip", {
|
|
@@ -120,8 +120,8 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
120
120
|
});
|
|
121
121
|
if (!r)
|
|
122
122
|
return {};
|
|
123
|
-
const a = (d) => Boolean(n &&
|
|
124
|
-
const u =
|
|
123
|
+
const a = (d) => Boolean(n && B(d.state.selection, n)), i = (d) => {
|
|
124
|
+
const u = B(d.state.selection, n);
|
|
125
125
|
return u ? u.node.attrs.label : void 0;
|
|
126
126
|
}, c = (d) => {
|
|
127
127
|
if (!d.editable)
|
|
@@ -140,7 +140,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
142
|
};
|
|
143
|
-
}), ve =
|
|
143
|
+
}), ve = R("ModifyFootnoteRef"), Dt = new F("MILKDOWN_FOOTNOTE_REF_INPUT"), Ot = be((o) => {
|
|
144
144
|
const e = "footnote_reference";
|
|
145
145
|
return {
|
|
146
146
|
id: e,
|
|
@@ -200,8 +200,8 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
200
200
|
}
|
|
201
201
|
}),
|
|
202
202
|
commands: (t) => [
|
|
203
|
-
|
|
204
|
-
const r =
|
|
203
|
+
N(ve, (n = "") => (l, s) => {
|
|
204
|
+
const r = B(l.selection, t);
|
|
205
205
|
if (!r)
|
|
206
206
|
return !1;
|
|
207
207
|
const { tr: a } = l, i = a.setNodeMarkup(r.pos, void 0, { ...r.node.attrs, label: n });
|
|
@@ -230,8 +230,8 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
230
230
|
});
|
|
231
231
|
if (!l)
|
|
232
232
|
return [];
|
|
233
|
-
const s = (i) => Boolean(t &&
|
|
234
|
-
const c =
|
|
233
|
+
const s = (i) => Boolean(t && B(i.state.selection, t)), r = (i) => {
|
|
234
|
+
const c = B(i.state.selection, t);
|
|
235
235
|
return c ? c.node.attrs.label : void 0;
|
|
236
236
|
}, a = (i) => {
|
|
237
237
|
if (!i.editable)
|
|
@@ -239,7 +239,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
239
239
|
s(i) ? (l.show(i), l.update(r(i))) : l.hide();
|
|
240
240
|
};
|
|
241
241
|
return [
|
|
242
|
-
new
|
|
242
|
+
new W({
|
|
243
243
|
key: Dt,
|
|
244
244
|
view: (i) => (l.init(i), a(i), {
|
|
245
245
|
update: (c, d) => {
|
|
@@ -253,7 +253,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
253
253
|
];
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
|
-
}), Qe = /* @__PURE__ */ new WeakMap(),
|
|
256
|
+
}), Qe = /* @__PURE__ */ new WeakMap(), _t = (o) => Qe.get(o), zt = (o, e) => (Qe.set(o, e), e);
|
|
257
257
|
class Ee {
|
|
258
258
|
constructor(e, t, n, l) {
|
|
259
259
|
this.left = e, this.top = t, this.right = n, this.bottom = l;
|
|
@@ -315,7 +315,7 @@ class g {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
static get(e) {
|
|
318
|
-
return
|
|
318
|
+
return _t(e) || zt(e, Ft(e));
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
function Ft(o) {
|
|
@@ -333,7 +333,7 @@ function Ft(o) {
|
|
|
333
333
|
s++;
|
|
334
334
|
if (h == u.childCount)
|
|
335
335
|
break;
|
|
336
|
-
const b = u.child(h), { colspan: w, rowspan: C, colwidth:
|
|
336
|
+
const b = u.child(h), { colspan: w, rowspan: C, colwidth: Ne } = b.attrs;
|
|
337
337
|
for (let H = 0; H < C; H++) {
|
|
338
338
|
if (H + c >= t) {
|
|
339
339
|
(r || (r = [])).push({
|
|
@@ -344,16 +344,16 @@ function Ft(o) {
|
|
|
344
344
|
break;
|
|
345
345
|
}
|
|
346
346
|
const le = s + H * e;
|
|
347
|
-
for (let
|
|
348
|
-
n[le +
|
|
347
|
+
for (let _ = 0; _ < w; _++) {
|
|
348
|
+
n[le + _] == 0 ? n[le + _] = d : (r || (r = [])).push({
|
|
349
349
|
type: "collision",
|
|
350
350
|
row: c,
|
|
351
351
|
pos: d,
|
|
352
|
-
n: w -
|
|
352
|
+
n: w - _
|
|
353
353
|
});
|
|
354
|
-
const X =
|
|
354
|
+
const X = Ne && Ne[_];
|
|
355
355
|
if (X) {
|
|
356
|
-
const j = (le +
|
|
356
|
+
const j = (le + _) % e * 2, se = l[j];
|
|
357
357
|
se == null || se != X && l[j + 1] == 1 ? (l[j] = X, l[j + 1] = 1) : se == X && l[j + 1]++;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
@@ -421,7 +421,7 @@ function Wt(o) {
|
|
|
421
421
|
e.push(0);
|
|
422
422
|
return e;
|
|
423
423
|
}
|
|
424
|
-
class m extends
|
|
424
|
+
class m extends S {
|
|
425
425
|
constructor(e, t = e) {
|
|
426
426
|
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);
|
|
427
427
|
i.unshift(t.pos - s);
|
|
@@ -433,7 +433,7 @@ class m extends N {
|
|
|
433
433
|
}
|
|
434
434
|
map(e, t) {
|
|
435
435
|
const n = e.resolve(t.map(this.$anchorCell.pos)), l = e.resolve(t.map(this.$headCell.pos));
|
|
436
|
-
if (de(n) && de(l) &&
|
|
436
|
+
if (de(n) && de(l) && Se(n, l)) {
|
|
437
437
|
const s = this.$anchorCell.node(-1) != n.node(-1);
|
|
438
438
|
return s && this.isRowSelection() ? m.rowSelection(n, l) : s && this.isColSelection() ? m.colSelection(n, l) : new m(n, l);
|
|
439
439
|
}
|
|
@@ -452,7 +452,7 @@ class m extends N {
|
|
|
452
452
|
const b = l.left - p.left, w = p.right - l.right;
|
|
453
453
|
if (b > 0 || w > 0) {
|
|
454
454
|
let C = h.attrs;
|
|
455
|
-
b > 0 && (C =
|
|
455
|
+
b > 0 && (C = z(C, 0, b)), w > 0 && (C = z(C, C.colspan - w, w)), p.left < l.left ? h = h.type.createAndFill(C) : h = h.type.create(C, h.content);
|
|
456
456
|
}
|
|
457
457
|
if (p.top < l.top || p.bottom > l.bottom) {
|
|
458
458
|
const C = y(h.attrs, "rowspan", Math.min(p.bottom, l.bottom) - Math.max(p.top, l.top));
|
|
@@ -464,19 +464,19 @@ class m extends N {
|
|
|
464
464
|
r.push(e.child(i).copy(E.from(c)));
|
|
465
465
|
}
|
|
466
466
|
const a = this.isColSelection() && this.isRowSelection() ? e : r;
|
|
467
|
-
return new
|
|
467
|
+
return new O(E.from(a), 1, 1);
|
|
468
468
|
}
|
|
469
|
-
replace(e, t =
|
|
469
|
+
replace(e, t = O.empty) {
|
|
470
470
|
const n = e.steps.length, l = this.ranges;
|
|
471
471
|
for (let r = 0; r < l.length; r++) {
|
|
472
472
|
const { $from: a, $to: i } = l[r], c = e.mapping.slice(n);
|
|
473
|
-
e.replace(c.map(a.pos), c.map(i.pos), r ?
|
|
473
|
+
e.replace(c.map(a.pos), c.map(i.pos), r ? O.empty : t);
|
|
474
474
|
}
|
|
475
|
-
const s =
|
|
475
|
+
const s = S.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
|
|
476
476
|
s && e.setSelection(s);
|
|
477
477
|
}
|
|
478
478
|
replaceWith(e, t) {
|
|
479
|
-
this.replace(e, new
|
|
479
|
+
this.replace(e, new O(E.from(t), 0, 0));
|
|
480
480
|
}
|
|
481
481
|
forEachCell(e) {
|
|
482
482
|
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));
|
|
@@ -564,7 +564,7 @@ class m extends N {
|
|
|
564
564
|
}
|
|
565
565
|
}
|
|
566
566
|
m.prototype.visible = !1;
|
|
567
|
-
|
|
567
|
+
S.jsonID("cell", m);
|
|
568
568
|
class Me {
|
|
569
569
|
constructor(e, t) {
|
|
570
570
|
this.anchor = e, this.head = t, this.anchor = e, this.head = t;
|
|
@@ -574,7 +574,7 @@ class Me {
|
|
|
574
574
|
}
|
|
575
575
|
resolve(e) {
|
|
576
576
|
const t = e.resolve(this.anchor), n = e.resolve(this.head);
|
|
577
|
-
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount &&
|
|
577
|
+
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) : S.near(n, 1);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
function Ht(o) {
|
|
@@ -736,7 +736,7 @@ function de(o) {
|
|
|
736
736
|
function Xt(o) {
|
|
737
737
|
return o.node(0).resolve(o.pos + o.nodeAfter.nodeSize);
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function Se(o, e) {
|
|
740
740
|
return o.depth == e.depth && o.pos >= e.start(-1) && o.pos <= e.end(-1);
|
|
741
741
|
}
|
|
742
742
|
function et(o, e, t) {
|
|
@@ -749,7 +749,7 @@ function y(o, e, t) {
|
|
|
749
749
|
n[l] = o[l];
|
|
750
750
|
return n[e] = t, n;
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function z(o, e, t = 1) {
|
|
753
753
|
const n = y(o, "colspan", o.colspan - t);
|
|
754
754
|
if (n.colwidth) {
|
|
755
755
|
const l = n.colwidth;
|
|
@@ -803,9 +803,9 @@ const Jt = (o) => (e, t) => {
|
|
|
803
803
|
if (!M(e))
|
|
804
804
|
return !1;
|
|
805
805
|
const { $head: n } = e.selection, l = n.after(), s = e.tr.replaceWith(l, l, o.createAndFill());
|
|
806
|
-
return s.setSelection(
|
|
806
|
+
return s.setSelection(S.near(s.doc.resolve(l), 1)), t == null || t(s.scrollIntoView()), !0;
|
|
807
807
|
};
|
|
808
|
-
function
|
|
808
|
+
function P(o) {
|
|
809
809
|
const e = o.selection, t = ne(o), n = t.node(-1), l = t.start(-1), s = g.get(n);
|
|
810
810
|
let r;
|
|
811
811
|
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;
|
|
@@ -830,7 +830,7 @@ const Yt = (o, e) => {
|
|
|
830
830
|
if (!M(o))
|
|
831
831
|
return !1;
|
|
832
832
|
if (e) {
|
|
833
|
-
const t =
|
|
833
|
+
const t = P(o);
|
|
834
834
|
e(tt(o.tr, t, t.left));
|
|
835
835
|
}
|
|
836
836
|
return !0;
|
|
@@ -838,7 +838,7 @@ const Yt = (o, e) => {
|
|
|
838
838
|
if (!M(o))
|
|
839
839
|
return !1;
|
|
840
840
|
if (e) {
|
|
841
|
-
const t =
|
|
841
|
+
const t = P(o);
|
|
842
842
|
e(tt(o.tr, t, t.right));
|
|
843
843
|
}
|
|
844
844
|
return !0;
|
|
@@ -849,7 +849,7 @@ function en(o, { map: e, table: t, tableStart: n }, l) {
|
|
|
849
849
|
for (let r = 0; r < e.height; ) {
|
|
850
850
|
const a = r * e.width + l, i = e.map[a], c = t.nodeAt(i);
|
|
851
851
|
if (l > 0 && e.map[a - 1] == i || l < e.width - 1 && e.map[a + 1] == i)
|
|
852
|
-
o.setNodeMarkup(o.mapping.slice(s).map(n + i), null,
|
|
852
|
+
o.setNodeMarkup(o.mapping.slice(s).map(n + i), null, z(c.attrs, l - e.colCount(i)));
|
|
853
853
|
else {
|
|
854
854
|
const d = o.mapping.slice(s).map(n + i);
|
|
855
855
|
o.delete(d, d + c.nodeSize);
|
|
@@ -861,7 +861,7 @@ const tn = (o, e) => {
|
|
|
861
861
|
if (!M(o))
|
|
862
862
|
return !1;
|
|
863
863
|
if (e) {
|
|
864
|
-
const t =
|
|
864
|
+
const t = P(o), n = o.tr;
|
|
865
865
|
if (t.left == 0 && t.right == t.map.width)
|
|
866
866
|
return !1;
|
|
867
867
|
for (let l = t.right - 1; en(n, t, l), l != t.left; l--)
|
|
@@ -892,7 +892,7 @@ const on = (o, e) => {
|
|
|
892
892
|
if (!M(o))
|
|
893
893
|
return !1;
|
|
894
894
|
if (e) {
|
|
895
|
-
const t =
|
|
895
|
+
const t = P(o), n = o.tr;
|
|
896
896
|
if (t.top == 0 && t.bottom == t.map.height)
|
|
897
897
|
return !1;
|
|
898
898
|
for (let l = t.bottom - 1; nn(n, t, l), l != t.top; l--)
|
|
@@ -994,10 +994,10 @@ const sn = (o, e) => {
|
|
|
994
994
|
node: s
|
|
995
995
|
};
|
|
996
996
|
}).filter((l) => l != null);
|
|
997
|
-
},
|
|
997
|
+
}, Oe = (o, e = 3, t = 3) => {
|
|
998
998
|
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, u) => s.create(null, u === 0 ? i : a));
|
|
999
999
|
return r.create(null, c);
|
|
1000
|
-
},
|
|
1000
|
+
}, _e = (o) => (e) => (t) => {
|
|
1001
1001
|
const n = oe(t.selection), l = o === "row";
|
|
1002
1002
|
if (n) {
|
|
1003
1003
|
const s = g.get(n.node);
|
|
@@ -1078,7 +1078,7 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1078
1078
|
if (!M(c))
|
|
1079
1079
|
return !1;
|
|
1080
1080
|
if (d) {
|
|
1081
|
-
const u =
|
|
1081
|
+
const u = P(c);
|
|
1082
1082
|
d(ze(c.tr, u, u.top));
|
|
1083
1083
|
}
|
|
1084
1084
|
return !0;
|
|
@@ -1091,7 +1091,7 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1091
1091
|
if (!M(c))
|
|
1092
1092
|
return !1;
|
|
1093
1093
|
if (d) {
|
|
1094
|
-
const u =
|
|
1094
|
+
const u = P(c);
|
|
1095
1095
|
d(ze(c.tr, u, u.bottom));
|
|
1096
1096
|
}
|
|
1097
1097
|
return !0;
|
|
@@ -1136,15 +1136,15 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1136
1136
|
return c < 0 && (c = 0), [d, c];
|
|
1137
1137
|
});
|
|
1138
1138
|
};
|
|
1139
|
-
var
|
|
1139
|
+
var x = /* @__PURE__ */ ((o) => (o.Left = "Left", o.Top = "Top", o.Point = "Point", o))(x || {});
|
|
1140
1140
|
const mn = (o, { css: e, injectGlobal: t }) => {
|
|
1141
|
-
const n = wt(o), l = o.get(
|
|
1141
|
+
const n = wt(o), l = o.get(xe, "radius"), s = o.get(xe, "lineWidth");
|
|
1142
1142
|
return t`
|
|
1143
1143
|
.milkdown {
|
|
1144
1144
|
.tableWrapper {
|
|
1145
1145
|
table {
|
|
1146
|
-
width: calc(100% -
|
|
1147
|
-
margin:
|
|
1146
|
+
width: calc(100% - 32px) !important;
|
|
1147
|
+
margin: 16px 0 16px 16px !important;
|
|
1148
1148
|
|
|
1149
1149
|
.milkdown-cell-left,
|
|
1150
1150
|
.milkdown-cell-point,
|
|
@@ -1170,24 +1170,24 @@ const mn = (o, { css: e, injectGlobal: t }) => {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
1172
|
.milkdown-cell-left {
|
|
1173
|
-
left:
|
|
1173
|
+
left: -14px;
|
|
1174
1174
|
top: 0;
|
|
1175
1175
|
bottom: 0;
|
|
1176
|
-
width:
|
|
1176
|
+
width: 8px;
|
|
1177
1177
|
}
|
|
1178
1178
|
|
|
1179
1179
|
.milkdown-cell-top {
|
|
1180
1180
|
left: 0;
|
|
1181
1181
|
right: 0;
|
|
1182
|
-
top:
|
|
1183
|
-
height:
|
|
1182
|
+
top: -14px;
|
|
1183
|
+
height: 8px;
|
|
1184
1184
|
}
|
|
1185
1185
|
|
|
1186
1186
|
.milkdown-cell-point {
|
|
1187
|
-
left:
|
|
1188
|
-
top:
|
|
1189
|
-
width:
|
|
1190
|
-
height:
|
|
1187
|
+
left: -18px;
|
|
1188
|
+
top: -18px;
|
|
1189
|
+
width: 16px;
|
|
1190
|
+
height: 16px;
|
|
1191
1191
|
|
|
1192
1192
|
.icon {
|
|
1193
1193
|
position: absolute;
|
|
@@ -1221,8 +1221,8 @@ const mn = (o, { css: e, injectGlobal: t }) => {
|
|
|
1221
1221
|
position: relative;
|
|
1222
1222
|
color: ${n("solid", 0.87)};
|
|
1223
1223
|
|
|
1224
|
-
width:
|
|
1225
|
-
line-height:
|
|
1224
|
+
width: 48px;
|
|
1225
|
+
line-height: 48px;
|
|
1226
1226
|
text-align: center;
|
|
1227
1227
|
transition: all 0.4s ease-in-out;
|
|
1228
1228
|
|
|
@@ -1252,11 +1252,11 @@ const mn = (o, { css: e, injectGlobal: t }) => {
|
|
|
1252
1252
|
`;
|
|
1253
1253
|
}, gn = (o) => {
|
|
1254
1254
|
switch (o) {
|
|
1255
|
-
case
|
|
1255
|
+
case x.Left:
|
|
1256
1256
|
return "milkdown-cell-left";
|
|
1257
|
-
case
|
|
1257
|
+
case x.Top:
|
|
1258
1258
|
return "milkdown-cell-top";
|
|
1259
|
-
case
|
|
1259
|
+
case x.Point:
|
|
1260
1260
|
default:
|
|
1261
1261
|
return "milkdown-cell-point";
|
|
1262
1262
|
}
|
|
@@ -1265,27 +1265,27 @@ function ce(o, e, t, n = 0) {
|
|
|
1265
1265
|
return ke.widget(e.pos + 1, (l) => {
|
|
1266
1266
|
var r;
|
|
1267
1267
|
const s = document.createElement("div");
|
|
1268
|
-
return s.classList.add(gn(t)), t ===
|
|
1268
|
+
return s.classList.add(gn(t)), t === x.Point && s.appendChild((r = o.get(L).get(v, "select")) == null ? void 0 : r.dom), s.addEventListener("mousedown", (a) => {
|
|
1269
1269
|
if (!!l)
|
|
1270
1270
|
switch (a.preventDefault(), t) {
|
|
1271
|
-
case
|
|
1271
|
+
case x.Point: {
|
|
1272
1272
|
l.dispatch(dn(l.state.tr));
|
|
1273
1273
|
return;
|
|
1274
1274
|
}
|
|
1275
|
-
case
|
|
1276
|
-
l.dispatch(
|
|
1275
|
+
case x.Left: {
|
|
1276
|
+
l.dispatch(_e("row")(n)(l.state.tr));
|
|
1277
1277
|
return;
|
|
1278
1278
|
}
|
|
1279
|
-
case
|
|
1280
|
-
l.dispatch(
|
|
1279
|
+
case x.Top: {
|
|
1280
|
+
l.dispatch(_e("col")(n)(l.state.tr));
|
|
1281
1281
|
return;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
1284
|
}), s;
|
|
1285
1285
|
});
|
|
1286
1286
|
}
|
|
1287
|
-
const wn = (o, e) => new
|
|
1288
|
-
key: new
|
|
1287
|
+
const wn = (o, e) => new W({
|
|
1288
|
+
key: new F("MILKDOWN_TABLE_OP"),
|
|
1289
1289
|
props: {
|
|
1290
1290
|
decorations: (t) => {
|
|
1291
1291
|
const n = [], l = rn(0)(t.selection);
|
|
@@ -1295,10 +1295,10 @@ const wn = (o, e) => new B({
|
|
|
1295
1295
|
if (!s)
|
|
1296
1296
|
return null;
|
|
1297
1297
|
const [r] = l;
|
|
1298
|
-
return n.push(ce(o, r,
|
|
1299
|
-
n.push(ce(o, a,
|
|
1298
|
+
return n.push(ce(o, r, x.Point)), l.forEach((a, i) => {
|
|
1299
|
+
n.push(ce(o, a, x.Left, i));
|
|
1300
1300
|
}), s.forEach((a, i) => {
|
|
1301
|
-
n.push(ce(o, a,
|
|
1301
|
+
n.push(ce(o, a, x.Top, i));
|
|
1302
1302
|
}), Ae.create(t.doc, n);
|
|
1303
1303
|
}
|
|
1304
1304
|
},
|
|
@@ -1336,17 +1336,17 @@ const wn = (o, e) => new B({
|
|
|
1336
1336
|
}
|
|
1337
1337
|
};
|
|
1338
1338
|
}
|
|
1339
|
-
}), bn = (o) => o.type.name === "paragraph" && o.nodeSize === 2, Cn = (o) => o.type.name === "paragraph", yn = new
|
|
1339
|
+
}), bn = (o) => o.type.name === "paragraph" && o.nodeSize === 2, Cn = (o) => o.type.name === "paragraph", yn = new F("plugin_autoInsertZeroSpace"), kn = () => new W({
|
|
1340
1340
|
key: yn,
|
|
1341
1341
|
props: {
|
|
1342
1342
|
handleDOMEvents: {
|
|
1343
1343
|
compositionstart(o) {
|
|
1344
1344
|
const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
|
|
1345
|
-
return
|
|
1345
|
+
return Re.safari && M(e) && l.empty && bn(s.parent) && t(n.insertText("\u2060", s.start())), !1;
|
|
1346
1346
|
},
|
|
1347
1347
|
compositionend(o) {
|
|
1348
1348
|
const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
|
|
1349
|
-
return
|
|
1349
|
+
return Re.safari && M(e) && l.empty && Cn(s.parent) && s.parent.textContent.startsWith("\u2060") && t(n.delete(s.start(), s.start() + 1)), !1;
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
@@ -1379,14 +1379,14 @@ function ue(o, e, t, n, l, s) {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
a ? (t.style.width = r + "px", t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = r + "px");
|
|
1381
1381
|
}
|
|
1382
|
-
const k = new
|
|
1382
|
+
const k = new F("tableColumnResizing");
|
|
1383
1383
|
function Mn({
|
|
1384
1384
|
handleWidth: o = 5,
|
|
1385
1385
|
cellMinWidth: e = 25,
|
|
1386
1386
|
View: t = An,
|
|
1387
1387
|
lastColumnResizable: n = !0
|
|
1388
1388
|
} = {}) {
|
|
1389
|
-
return new
|
|
1389
|
+
return new W({
|
|
1390
1390
|
key: k,
|
|
1391
1391
|
state: {
|
|
1392
1392
|
init(s, r) {
|
|
@@ -1402,13 +1402,13 @@ function Mn({
|
|
|
1402
1402
|
},
|
|
1403
1403
|
handleDOMEvents: {
|
|
1404
1404
|
mousemove(s, r) {
|
|
1405
|
-
|
|
1405
|
+
Sn(s, r, o, n);
|
|
1406
1406
|
},
|
|
1407
1407
|
mouseleave(s) {
|
|
1408
|
-
|
|
1408
|
+
Nn(s);
|
|
1409
1409
|
},
|
|
1410
1410
|
mousedown(s, r) {
|
|
1411
|
-
|
|
1411
|
+
xn(s, r, e);
|
|
1412
1412
|
}
|
|
1413
1413
|
},
|
|
1414
1414
|
decorations(s) {
|
|
@@ -1437,7 +1437,7 @@ class q {
|
|
|
1437
1437
|
return t;
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1440
|
+
function Sn(o, e, t, n) {
|
|
1441
1441
|
const l = k.getState(o.state);
|
|
1442
1442
|
if (!l.dragging) {
|
|
1443
1443
|
const s = Tn(e.target);
|
|
@@ -1456,15 +1456,15 @@ function Nn(o, e, t, n) {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1459
|
+
function Nn(o) {
|
|
1460
1460
|
const e = k.getState(o.state);
|
|
1461
1461
|
e.activeHandle > -1 && !e.dragging && nt(o, -1);
|
|
1462
1462
|
}
|
|
1463
|
-
function
|
|
1463
|
+
function xn(o, e, t) {
|
|
1464
1464
|
const n = k.getState(o.state);
|
|
1465
1465
|
if (n.activeHandle == -1 || n.dragging)
|
|
1466
1466
|
return !1;
|
|
1467
|
-
const l = o.state.doc.nodeAt(n.activeHandle), s =
|
|
1467
|
+
const l = o.state.doc.nodeAt(n.activeHandle), s = Rn(o, n.activeHandle, l.attrs);
|
|
1468
1468
|
o.dispatch(o.state.tr.setMeta(k, {
|
|
1469
1469
|
setDragging: { startX: e.clientX, startWidth: s }
|
|
1470
1470
|
}));
|
|
@@ -1481,7 +1481,7 @@ function Rn(o, e, t) {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
return window.addEventListener("mouseup", r), window.addEventListener("mousemove", a), e.preventDefault(), !0;
|
|
1483
1483
|
}
|
|
1484
|
-
function
|
|
1484
|
+
function Rn(o, e, { colspan: t, colwidth: n }) {
|
|
1485
1485
|
const l = n && n[n.length - 1];
|
|
1486
1486
|
if (l)
|
|
1487
1487
|
return l;
|
|
@@ -1565,10 +1565,10 @@ function $n(o) {
|
|
|
1565
1565
|
for (let i = 0; i < e.childCount; i++) {
|
|
1566
1566
|
let c = e.child(i).content;
|
|
1567
1567
|
const d = i ? 0 : Math.max(0, t - 1), u = i < e.childCount - 1 ? 0 : Math.max(0, n - 1);
|
|
1568
|
-
(d || u) && (c = fe(A(r).row, new
|
|
1568
|
+
(d || u) && (c = fe(A(r).row, new O(c, d, u)).content), a.push(c);
|
|
1569
1569
|
}
|
|
1570
1570
|
else if (s == "cell" || s == "header_cell")
|
|
1571
|
-
a.push(t || n ? fe(A(r).row, new
|
|
1571
|
+
a.push(t || n ? fe(A(r).row, new O(e, t, n)).content : e);
|
|
1572
1572
|
else
|
|
1573
1573
|
return null;
|
|
1574
1574
|
return Dn(r, a);
|
|
@@ -1597,16 +1597,16 @@ function Dn(o, e) {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
function fe(o, e) {
|
|
1599
1599
|
const t = o.createAndFill();
|
|
1600
|
-
return new
|
|
1600
|
+
return new Nt(t).replace(0, t.content.size, e).doc;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function On({ width: o, height: e, rows: t }, n, l) {
|
|
1603
1603
|
if (o != n) {
|
|
1604
1604
|
const s = [], r = [];
|
|
1605
1605
|
for (let a = 0; a < t.length; a++) {
|
|
1606
1606
|
const i = t[a], c = [];
|
|
1607
1607
|
for (let d = s[a] || 0, u = 0; d < n; u++) {
|
|
1608
1608
|
let f = i.child(u % i.childCount);
|
|
1609
|
-
d + f.attrs.colspan > n && (f = f.type.create(
|
|
1609
|
+
d + f.attrs.colspan > n && (f = f.type.create(z(f.attrs, f.attrs.colspan, d + f.attrs.colspan - n), f.content)), c.push(f), d += f.attrs.colspan;
|
|
1610
1610
|
for (let p = 1; p < f.attrs.rowspan; p++)
|
|
1611
1611
|
s[a + p] = (s[a + p] || 0) + f.attrs.colspan;
|
|
1612
1612
|
}
|
|
@@ -1628,7 +1628,7 @@ function _n({ width: o, height: e, rows: t }, n, l) {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
return { width: o, height: e, rows: t };
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1631
|
+
function _n(o, e, t, n, l, s, r) {
|
|
1632
1632
|
const a = o.doc.type.schema, i = A(a);
|
|
1633
1633
|
let c, d;
|
|
1634
1634
|
if (l > e.width)
|
|
@@ -1678,7 +1678,7 @@ function We(o, e, t, n, l, s, r, a) {
|
|
|
1678
1678
|
if (e.map[d - 1] == u) {
|
|
1679
1679
|
i = !0;
|
|
1680
1680
|
const f = t.nodeAt(u), p = e.colCount(u), h = o.mapping.slice(a).map(u + n);
|
|
1681
|
-
o.setNodeMarkup(h, null,
|
|
1681
|
+
o.setNodeMarkup(h, null, z(f.attrs, r - p, f.attrs.colspan - (r - p))), o.insert(h + f.nodeSize, f.type.createAndFill(z(f.attrs, 0, r - p))), c += f.attrs.rowspan - 1;
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
1684
|
return i;
|
|
@@ -1690,14 +1690,14 @@ function He(o, e, t, n, l) {
|
|
|
1690
1690
|
function p() {
|
|
1691
1691
|
s = t ? u.doc.nodeAt(t - 1) : u.doc, r = g.get(s), f = u.mapping.maps.length;
|
|
1692
1692
|
}
|
|
1693
|
-
|
|
1693
|
+
_n(u, r, s, t, c, d, f) && p(), Pe(u, r, s, t, i, c, a, f) && p(), Pe(u, r, s, t, i, c, d, f) && p(), We(u, r, s, t, a, d, i, f) && p(), We(u, r, s, t, a, d, c, f) && p();
|
|
1694
1694
|
for (let h = a; h < d; h++) {
|
|
1695
1695
|
const b = r.positionAt(h, i, s), w = r.positionAt(h, c, s);
|
|
1696
|
-
u.replace(u.mapping.slice(f).map(b + t), u.mapping.slice(f).map(w + t), new
|
|
1696
|
+
u.replace(u.mapping.slice(f).map(b + t), u.mapping.slice(f).map(w + t), new O(l.rows[h - a], 0, 0));
|
|
1697
1697
|
}
|
|
1698
1698
|
p(), u.setSelection(new m(u.doc.resolve(t + r.positionAt(a, i, s)), u.doc.resolve(t + r.positionAt(d - 1, c - 1, s)))), e(u);
|
|
1699
1699
|
}
|
|
1700
|
-
const zn = new
|
|
1700
|
+
const zn = new F("fix-tables");
|
|
1701
1701
|
function ot(o, e, t, n) {
|
|
1702
1702
|
const l = o.childCount, s = e.childCount;
|
|
1703
1703
|
e:
|
|
@@ -1732,7 +1732,7 @@ function Bn(o, e, t, n) {
|
|
|
1732
1732
|
const d = e.nodeAt(c.pos);
|
|
1733
1733
|
for (let u = 0; u < d.attrs.rowspan; u++)
|
|
1734
1734
|
s[c.row + u] += c.n;
|
|
1735
|
-
n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null,
|
|
1735
|
+
n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, z(d.attrs, d.attrs.colspan - c.n, c.n));
|
|
1736
1736
|
} else if (c.type == "missing")
|
|
1737
1737
|
s[c.row] += c.n;
|
|
1738
1738
|
else if (c.type == "overlong_rowspan") {
|
|
@@ -1761,7 +1761,7 @@ function Bn(o, e, t, n) {
|
|
|
1761
1761
|
}
|
|
1762
1762
|
return n.setMeta(zn, { fixTables: !0 });
|
|
1763
1763
|
}
|
|
1764
|
-
const I = new
|
|
1764
|
+
const I = new F("selectingCells");
|
|
1765
1765
|
function je(o, e) {
|
|
1766
1766
|
for (; e && e != o.dom; e = e.parentNode)
|
|
1767
1767
|
if (e.nodeName == "TD" || e.nodeName == "TH")
|
|
@@ -1786,7 +1786,7 @@ function Pn(o, e) {
|
|
|
1786
1786
|
function s(i, c) {
|
|
1787
1787
|
let d = ae(o, c);
|
|
1788
1788
|
const u = I.getState(o.state) == null;
|
|
1789
|
-
if (!d || !
|
|
1789
|
+
if (!d || !Se(i, d))
|
|
1790
1790
|
if (u)
|
|
1791
1791
|
d = i;
|
|
1792
1792
|
else
|
|
@@ -1837,18 +1837,18 @@ function Z(o, e) {
|
|
|
1837
1837
|
return (t, n, l) => {
|
|
1838
1838
|
const s = t.selection;
|
|
1839
1839
|
if (s instanceof m)
|
|
1840
|
-
return Y(t, n,
|
|
1840
|
+
return Y(t, n, S.near(s.$headCell, e));
|
|
1841
1841
|
if (o != "horiz" && !s.empty)
|
|
1842
1842
|
return !1;
|
|
1843
1843
|
const r = lt(l, o, e);
|
|
1844
1844
|
if (r == null)
|
|
1845
1845
|
return !1;
|
|
1846
1846
|
if (o == "horiz")
|
|
1847
|
-
return Y(t, n,
|
|
1847
|
+
return Y(t, n, S.near(t.doc.resolve(s.head + e), e));
|
|
1848
1848
|
{
|
|
1849
1849
|
const a = t.doc.resolve(r), i = et(a, o, e);
|
|
1850
1850
|
let c;
|
|
1851
|
-
return i ? c =
|
|
1851
|
+
return i ? c = S.near(i, 1) : e < 0 ? c = S.near(t.doc.resolve(a.before(-1)), -1) : c = S.near(t.doc.resolve(a.after(-1)), 1), Y(t, n, c);
|
|
1852
1852
|
}
|
|
1853
1853
|
};
|
|
1854
1854
|
}
|
|
@@ -1872,12 +1872,12 @@ function J(o, e) {
|
|
|
1872
1872
|
if (e) {
|
|
1873
1873
|
const n = o.tr, l = A(o.schema).cell.createAndFill().content;
|
|
1874
1874
|
t.forEachCell((s, r) => {
|
|
1875
|
-
s.content.eq(l) || n.replace(n.mapping.map(r + 1), n.mapping.map(r + s.nodeSize - 1), new
|
|
1875
|
+
s.content.eq(l) || n.replace(n.mapping.map(r + 1), n.mapping.map(r + s.nodeSize - 1), new O(l, 0, 0));
|
|
1876
1876
|
}), n.docChanged && e(n);
|
|
1877
1877
|
}
|
|
1878
1878
|
return !0;
|
|
1879
1879
|
}
|
|
1880
|
-
const Hn =
|
|
1880
|
+
const Hn = St({
|
|
1881
1881
|
ArrowLeft: Z("horiz", -1),
|
|
1882
1882
|
ArrowRight: Z("horiz", 1),
|
|
1883
1883
|
ArrowUp: Z("vert", -1),
|
|
@@ -1903,7 +1903,7 @@ function jn(o, e, t) {
|
|
|
1903
1903
|
rows: [E.from(fe(A(o.state.schema).cell, t))]
|
|
1904
1904
|
});
|
|
1905
1905
|
const s = l.$anchorCell.node(-1), r = l.$anchorCell.start(-1), a = g.get(s).rectBetween(l.$anchorCell.pos - r, l.$headCell.pos - r);
|
|
1906
|
-
return n =
|
|
1906
|
+
return n = On(n, a.right - a.left, a.bottom - a.top), He(o.state, o.dispatch, r, a, n), !0;
|
|
1907
1907
|
} else if (n) {
|
|
1908
1908
|
const s = ne(o.state), r = s.start(-1);
|
|
1909
1909
|
return He(o.state, o.dispatch, r, g.get(s.node(-1)).findCell(s.pos - r), n), !0;
|
|
@@ -1911,7 +1911,7 @@ function jn(o, e, t) {
|
|
|
1911
1911
|
return !1;
|
|
1912
1912
|
}
|
|
1913
1913
|
function Kn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
1914
|
-
return new
|
|
1914
|
+
return new W({
|
|
1915
1915
|
key: I,
|
|
1916
1916
|
state: {
|
|
1917
1917
|
init() {
|
|
@@ -1948,7 +1948,7 @@ const Q = {
|
|
|
1948
1948
|
NextCell: "NextCell",
|
|
1949
1949
|
PrevCell: "PrevCell",
|
|
1950
1950
|
ExitTable: "ExitTable"
|
|
1951
|
-
}, Ke =
|
|
1951
|
+
}, Ke = R("PrevCell"), qe = R("NextCell"), Ue = R("BreakTable"), qn = R("InsertTable"), Un = at((o) => ({
|
|
1952
1952
|
schema: () => ({
|
|
1953
1953
|
node: {
|
|
1954
1954
|
table: {
|
|
@@ -2037,16 +2037,16 @@ const Q = {
|
|
|
2037
2037
|
const a = n.doc.resolve(s);
|
|
2038
2038
|
if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
|
|
2039
2039
|
return null;
|
|
2040
|
-
const i =
|
|
2040
|
+
const i = Oe(t.get(re)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
|
|
2041
2041
|
return c.setSelection(D.create(c.doc, s + 3));
|
|
2042
2042
|
})
|
|
2043
2043
|
],
|
|
2044
2044
|
commands: (e, t) => [
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
const { selection: s, tr: r } = n, { from: a } = s, i =
|
|
2045
|
+
N(Ke, () => De(-1)),
|
|
2046
|
+
N(qe, () => De(1)),
|
|
2047
|
+
N(Ue, () => Jt(t.get(re).nodes.paragraph)),
|
|
2048
|
+
N(qn, () => (n, l) => {
|
|
2049
|
+
const { selection: s, tr: r } = n, { from: a } = s, i = Oe(t.get(re)), c = r.replaceSelectionWith(i), d = S.findFrom(c.doc.resolve(a), 1, !0);
|
|
2050
2050
|
return d && (l == null || l(c.setSelection(d))), !0;
|
|
2051
2051
|
})
|
|
2052
2052
|
],
|
|
@@ -2055,32 +2055,13 @@ const Q = {
|
|
|
2055
2055
|
[Q.PrevCell]: $(Ke, "Mod-["),
|
|
2056
2056
|
[Q.ExitTable]: $(Ue, "Mod-Enter")
|
|
2057
2057
|
},
|
|
2058
|
-
prosePlugins: (e, t) => [
|
|
2059
|
-
wn(t, o),
|
|
2060
|
-
kn(),
|
|
2061
|
-
Mn(),
|
|
2062
|
-
Kn(),
|
|
2063
|
-
new B({
|
|
2064
|
-
key: Un,
|
|
2065
|
-
filterTransaction: (n, l) => {
|
|
2066
|
-
const s = n.getMeta("hardbreak"), [r] = n.steps;
|
|
2067
|
-
if (s && r) {
|
|
2068
|
-
const { from: a } = r, i = l.doc.resolve(a);
|
|
2069
|
-
let c = i.depth, d = !0;
|
|
2070
|
-
for (; c > 0; )
|
|
2071
|
-
i.node(c).type.name === "table" && (d = !1), c--;
|
|
2072
|
-
return d;
|
|
2073
|
-
}
|
|
2074
|
-
return !0;
|
|
2075
|
-
}
|
|
2076
|
-
})
|
|
2077
|
-
]
|
|
2058
|
+
prosePlugins: (e, t) => [wn(t, o), kn(), Mn(), Kn()]
|
|
2078
2059
|
})), K = {
|
|
2079
2060
|
...st,
|
|
2080
2061
|
...Q,
|
|
2081
2062
|
StrikeThrough: "StrikeThrough",
|
|
2082
2063
|
TaskList: "TaskList"
|
|
2083
|
-
}, pe =
|
|
2064
|
+
}, pe = R("ToggleStrikeThrough"), Xe = "strike_through", Xn = dt((o) => ({
|
|
2084
2065
|
id: Xe,
|
|
2085
2066
|
schema: () => ({
|
|
2086
2067
|
parseDOM: [
|
|
@@ -2105,11 +2086,11 @@ const Q = {
|
|
|
2105
2086
|
Te(/(?:~~)([^~]+)(?:~~)$/, e),
|
|
2106
2087
|
Te(/(?:^|[^~])(~([^~]+)~)$/, e)
|
|
2107
2088
|
],
|
|
2108
|
-
commands: (e) => [
|
|
2089
|
+
commands: (e) => [N(pe, () => At(e))],
|
|
2109
2090
|
shortcuts: {
|
|
2110
2091
|
[K.StrikeThrough]: $(pe, "Mod-Alt-x")
|
|
2111
2092
|
}
|
|
2112
|
-
})), he =
|
|
2093
|
+
})), he = R("SplitTaskListItem"), me = R("SinkTaskListItem"), ge = R("LiftTaskListItem"), we = R("TurnIntoTaskList"), Vn = be((o) => {
|
|
2113
2094
|
const e = "task_list_item";
|
|
2114
2095
|
return {
|
|
2115
2096
|
id: e,
|
|
@@ -2181,10 +2162,10 @@ const Q = {
|
|
|
2181
2162
|
}))
|
|
2182
2163
|
],
|
|
2183
2164
|
commands: (t) => [
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2165
|
+
N(he, () => xt(t)),
|
|
2166
|
+
N(me, () => Rt(t)),
|
|
2167
|
+
N(ge, () => Tt(t)),
|
|
2168
|
+
N(we, () => Mt(t))
|
|
2188
2169
|
],
|
|
2189
2170
|
shortcuts: {
|
|
2190
2171
|
[K.NextListItem]: $(he, "Enter"),
|
|
@@ -2213,16 +2194,16 @@ const Q = {
|
|
|
2213
2194
|
};
|
|
2214
2195
|
}
|
|
2215
2196
|
};
|
|
2216
|
-
}),
|
|
2197
|
+
}), ao = ut.create([
|
|
2217
2198
|
...rt,
|
|
2218
2199
|
ft(() => pt),
|
|
2219
|
-
|
|
2200
|
+
Un(),
|
|
2220
2201
|
Et,
|
|
2202
|
+
Xn(),
|
|
2221
2203
|
Vn(),
|
|
2222
|
-
|
|
2223
|
-
_t(),
|
|
2204
|
+
Ot(),
|
|
2224
2205
|
$t()
|
|
2225
|
-
]),
|
|
2206
|
+
]), uo = {
|
|
2226
2207
|
...it,
|
|
2227
2208
|
ToggleStrikeThrough: pe,
|
|
2228
2209
|
TurnIntoTaskList: we,
|
|
@@ -2232,61 +2213,61 @@ const Q = {
|
|
|
2232
2213
|
};
|
|
2233
2214
|
export {
|
|
2234
2215
|
Ue as BreakTable,
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2216
|
+
ho as InsertHardbreak,
|
|
2217
|
+
mo as InsertHr,
|
|
2218
|
+
go as InsertImage,
|
|
2238
2219
|
qn as InsertTable,
|
|
2239
|
-
|
|
2220
|
+
wo as LiftListItem,
|
|
2240
2221
|
ge as LiftTaskListItem,
|
|
2241
2222
|
Le as ModifyFootnoteDef,
|
|
2242
2223
|
ve as ModifyFootnoteRef,
|
|
2243
|
-
|
|
2244
|
-
|
|
2224
|
+
bo as ModifyImage,
|
|
2225
|
+
Co as ModifyLink,
|
|
2245
2226
|
qe as NextCell,
|
|
2246
2227
|
Ke as PrevCell,
|
|
2247
|
-
|
|
2228
|
+
yo as SinkListItem,
|
|
2248
2229
|
me as SinkTaskListItem,
|
|
2249
|
-
|
|
2230
|
+
ko as SplitListItem,
|
|
2250
2231
|
he as SplitTaskListItem,
|
|
2251
2232
|
K as SupportedKeys,
|
|
2252
|
-
|
|
2253
|
-
|
|
2233
|
+
Ao as ToggleBold,
|
|
2234
|
+
Mo as ToggleInlineCode,
|
|
2254
2235
|
So as ToggleItalic,
|
|
2255
|
-
|
|
2236
|
+
No as ToggleLink,
|
|
2256
2237
|
pe as ToggleStrikeThrough,
|
|
2257
2238
|
xo as TurnIntoCodeFence,
|
|
2258
|
-
|
|
2239
|
+
Ro as TurnIntoHeading,
|
|
2259
2240
|
we as TurnIntoTaskList,
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2241
|
+
To as TurnIntoText,
|
|
2242
|
+
Lo as WrapInBlockquote,
|
|
2243
|
+
vo as WrapInBulletList,
|
|
2244
|
+
Eo as WrapInOrderedList,
|
|
2245
|
+
Io as blockquote,
|
|
2246
|
+
$o as bulletList,
|
|
2247
|
+
Do as codeFence,
|
|
2267
2248
|
Oo as codeInline,
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2249
|
+
uo as commands,
|
|
2250
|
+
_o as commonmark,
|
|
2251
|
+
zo as commonmarkNodes,
|
|
2252
|
+
Fo as commonmarkPlugins,
|
|
2253
|
+
Oe as createTable,
|
|
2254
|
+
Bo as doc,
|
|
2255
|
+
Po as em,
|
|
2275
2256
|
$t as footnoteDefinition,
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2257
|
+
Ot as footnoteReference,
|
|
2258
|
+
ao as gfm,
|
|
2259
|
+
Wo as hardbreak,
|
|
2260
|
+
Ho as heading,
|
|
2261
|
+
jo as hr,
|
|
2262
|
+
Ko as image,
|
|
2263
|
+
qo as link,
|
|
2264
|
+
Uo as listItem,
|
|
2265
|
+
Xo as orderedList,
|
|
2266
|
+
Vo as paragraph,
|
|
2267
|
+
Xn as strikeThrough,
|
|
2268
|
+
Zo as strong,
|
|
2269
|
+
Un as table,
|
|
2270
|
+
Vn as taskListItem,
|
|
2271
|
+
Go as text
|
|
2291
2272
|
};
|
|
2292
2273
|
//# sourceMappingURL=index.es.js.map
|