@milkdown/preset-gfm 6.3.2 → 6.4.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.d.ts.map +1 -1
- package/lib/index.es.js +395 -410
- package/lib/index.es.js.map +1 -1
- package/lib/strike-through.d.ts.map +1 -1
- package/lib/table/operator-plugin/index.d.ts +2 -2
- package/lib/table/operator-plugin/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +0 -2
- package/src/strike-through.ts +1 -5
- package/src/table/operator-plugin/index.ts +2 -2
- package/lib/auto-link.d.ts +0 -2
- package/lib/auto-link.d.ts.map +0 -1
- package/src/auto-link.ts +0 -23
package/lib/index.es.js
CHANGED
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import { SupportedKeys as
|
|
2
|
-
import { InsertHardbreak as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { PluginKey as F, NodeSelection as te, Plugin as W, Selection as S, SelectionRange as
|
|
10
|
-
import { toggleMark as
|
|
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 So, WrapInOrderedList as No, 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 be, createPlugin as it, createShortcut as $, createMark as ct, AtomList as at, $remark as dt } from "@milkdown/utils";
|
|
4
|
+
import ft from "remark-gfm";
|
|
5
|
+
import { createCmdKey as R, editorViewCtx as ee, createCmd as N, commandsCtx as Ue, themeManagerCtx as L, ThemeIcon as v, getPalette as ut, ThemeSize as Ne, ThemeBorder as pt, ThemeShadow as ht, schemaCtx as re } from "@milkdown/core";
|
|
6
|
+
import { expectDomTypeError as Ce, missingRootElement as mt } from "@milkdown/exception";
|
|
7
|
+
import { findSelectedNodeOfType as B, findParentNode as gt, cloneTr as Xe, calculateNodePosition as wt, browser as xe } from "@milkdown/prose";
|
|
8
|
+
import { wrappingInputRule as Ve, InputRule as Ge } from "@milkdown/prose/inputrules";
|
|
9
|
+
import { PluginKey as F, NodeSelection as te, Plugin as W, Selection as S, SelectionRange as bt, TextSelection as D } from "@milkdown/prose/state";
|
|
10
|
+
import { toggleMark as Ct, wrapIn as yt } from "@milkdown/prose/commands";
|
|
11
11
|
import { Fragment as E, Slice as O } from "@milkdown/prose/model";
|
|
12
|
-
import { Decoration as
|
|
13
|
-
import { keydownHandler as
|
|
14
|
-
import { Transform as
|
|
15
|
-
import { splitListItem as
|
|
16
|
-
const
|
|
17
|
-
rules: [
|
|
18
|
-
new Ce(Lt, (o, e, t, n) => {
|
|
19
|
-
var a;
|
|
20
|
-
const { schema: l } = o, [s] = e;
|
|
21
|
-
if (!s)
|
|
22
|
-
return null;
|
|
23
|
-
const r = (a = l.marks.link) == null ? void 0 : a.create({ href: s });
|
|
24
|
-
return r ? o.tr.replaceWith(t, n, l.text(s)).addMark(t, s.length + t, r) : null;
|
|
25
|
-
})
|
|
26
|
-
]
|
|
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) => {
|
|
12
|
+
import { Decoration as ye, DecorationSet as ke } from "@milkdown/prose/view";
|
|
13
|
+
import { keydownHandler as kt } from "@milkdown/prose/keymap";
|
|
14
|
+
import { Transform as At } from "@milkdown/prose/transform";
|
|
15
|
+
import { splitListItem as Mt, sinkListItem as St, liftListItem as Nt } from "@milkdown/prose/schema-list";
|
|
16
|
+
const Je = (o) => `footnote-ref-${o}`, Ye = (o) => `footnote-def-${o}`, xt = new F("MILKDOWN_FOOTNOTE_DEF_INPUT"), Re = R("ModifyFootnoteDef"), Rt = be((o) => {
|
|
28
17
|
const e = "footnote_definition", t = "footnoteDefinition";
|
|
29
18
|
return {
|
|
30
19
|
id: e,
|
|
@@ -42,7 +31,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
42
31
|
tag: `div[data-type="${e}"]`,
|
|
43
32
|
getAttrs: (l) => {
|
|
44
33
|
if (!(l instanceof HTMLElement))
|
|
45
|
-
throw
|
|
34
|
+
throw Ce(l);
|
|
46
35
|
return {
|
|
47
36
|
label: l.dataset.label
|
|
48
37
|
};
|
|
@@ -90,7 +79,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
90
79
|
}
|
|
91
80
|
}),
|
|
92
81
|
commands: (n) => [
|
|
93
|
-
N(
|
|
82
|
+
N(Re, (l = "") => (s, r) => {
|
|
94
83
|
const a = B(s.selection, n);
|
|
95
84
|
if (!a)
|
|
96
85
|
return !1;
|
|
@@ -108,29 +97,29 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
108
97
|
],
|
|
109
98
|
prosePlugins: (n, l) => [
|
|
110
99
|
new W({
|
|
111
|
-
key:
|
|
100
|
+
key: xt,
|
|
112
101
|
view: (s) => {
|
|
113
102
|
const r = o.themeManager.get("input-chip", {
|
|
114
103
|
width: "12em",
|
|
115
104
|
placeholder: "Input Footnote Label",
|
|
116
105
|
onUpdate: (d) => {
|
|
117
|
-
l.get(
|
|
106
|
+
l.get(Ue).call(Re, d);
|
|
118
107
|
},
|
|
119
108
|
isBindMode: !0
|
|
120
109
|
});
|
|
121
110
|
if (!r)
|
|
122
111
|
return {};
|
|
123
112
|
const a = (d) => Boolean(n && B(d.state.selection, n)), i = (d) => {
|
|
124
|
-
const
|
|
125
|
-
return
|
|
113
|
+
const f = B(d.state.selection, n);
|
|
114
|
+
return f ? f.node.attrs.label : void 0;
|
|
126
115
|
}, c = (d) => {
|
|
127
116
|
if (!d.editable)
|
|
128
117
|
return;
|
|
129
118
|
a(d) ? (r.show(d), r.update(i(d))) : r.hide();
|
|
130
119
|
};
|
|
131
120
|
return r.init(s), c(s), {
|
|
132
|
-
update: (d,
|
|
133
|
-
(
|
|
121
|
+
update: (d, f) => {
|
|
122
|
+
(f == null ? void 0 : f.doc.eq(d.state.doc)) && f.selection.eq(d.state.selection) || c(d);
|
|
134
123
|
},
|
|
135
124
|
destroy: () => {
|
|
136
125
|
r.destroy();
|
|
@@ -140,7 +129,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
140
129
|
})
|
|
141
130
|
]
|
|
142
131
|
};
|
|
143
|
-
}),
|
|
132
|
+
}), Te = R("ModifyFootnoteRef"), Tt = new F("MILKDOWN_FOOTNOTE_REF_INPUT"), Lt = be((o) => {
|
|
144
133
|
const e = "footnote_reference";
|
|
145
134
|
return {
|
|
146
135
|
id: e,
|
|
@@ -158,7 +147,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
158
147
|
tag: `sup[data-type="${e}"]`,
|
|
159
148
|
getAttrs: (n) => {
|
|
160
149
|
if (!(n instanceof HTMLElement))
|
|
161
|
-
throw
|
|
150
|
+
throw Ce(n);
|
|
162
151
|
return {
|
|
163
152
|
label: n.dataset.label
|
|
164
153
|
};
|
|
@@ -200,7 +189,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
200
189
|
}
|
|
201
190
|
}),
|
|
202
191
|
commands: (t) => [
|
|
203
|
-
N(
|
|
192
|
+
N(Te, (n = "") => (l, s) => {
|
|
204
193
|
const r = B(l.selection, t);
|
|
205
194
|
if (!r)
|
|
206
195
|
return !1;
|
|
@@ -209,7 +198,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
209
198
|
})
|
|
210
199
|
],
|
|
211
200
|
inputRules: (t) => [
|
|
212
|
-
new
|
|
201
|
+
new Ge(/(?:\[\^)([^\]]+)(?:\])$/, (n, l, s, r) => {
|
|
213
202
|
const a = n.doc.resolve(s), i = a.index(), c = n.doc.resolve(r);
|
|
214
203
|
if (!a.parent.canReplaceWith(i, c.index(), t))
|
|
215
204
|
return null;
|
|
@@ -224,7 +213,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
224
213
|
width: "12em",
|
|
225
214
|
placeholder: "Input Footnote Label",
|
|
226
215
|
onUpdate: (i) => {
|
|
227
|
-
n.get(
|
|
216
|
+
n.get(Ue).call(Te, i);
|
|
228
217
|
},
|
|
229
218
|
isBindMode: !0
|
|
230
219
|
});
|
|
@@ -240,7 +229,7 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
240
229
|
};
|
|
241
230
|
return [
|
|
242
231
|
new W({
|
|
243
|
-
key:
|
|
232
|
+
key: Tt,
|
|
244
233
|
view: (i) => (l.init(i), a(i), {
|
|
245
234
|
update: (c, d) => {
|
|
246
235
|
(d == null ? void 0 : d.doc.eq(c.state.doc)) && d.selection.eq(c.state.selection) || a(c);
|
|
@@ -253,8 +242,8 @@ const Lt = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\
|
|
|
253
242
|
];
|
|
254
243
|
}
|
|
255
244
|
};
|
|
256
|
-
}),
|
|
257
|
-
class
|
|
245
|
+
}), Ze = /* @__PURE__ */ new WeakMap(), vt = (o) => Ze.get(o), Et = (o, e) => (Ze.set(o, e), e);
|
|
246
|
+
class Le {
|
|
258
247
|
constructor(e, t, n, l) {
|
|
259
248
|
this.left = e, this.top = t, this.right = n, this.bottom = l;
|
|
260
249
|
}
|
|
@@ -274,7 +263,7 @@ class g {
|
|
|
274
263
|
r++;
|
|
275
264
|
for (let i = 1; a < this.height && this.map[t + this.width * i] == n; i++)
|
|
276
265
|
a++;
|
|
277
|
-
return new
|
|
266
|
+
return new Le(l, s, r, a);
|
|
278
267
|
}
|
|
279
268
|
throw new RangeError("No cell with offset " + e + " found");
|
|
280
269
|
}
|
|
@@ -290,7 +279,7 @@ class g {
|
|
|
290
279
|
}
|
|
291
280
|
rectBetween(e, t) {
|
|
292
281
|
const { left: n, right: l, top: s, bottom: r } = this.findCell(e), { left: a, right: i, top: c, bottom: d } = this.findCell(t);
|
|
293
|
-
return new
|
|
282
|
+
return new Le(Math.min(n, a), Math.min(s, c), Math.max(l, i), Math.max(r, d));
|
|
294
283
|
}
|
|
295
284
|
cellsInRect(e) {
|
|
296
285
|
const t = [], n = {};
|
|
@@ -315,25 +304,25 @@ class g {
|
|
|
315
304
|
}
|
|
316
305
|
}
|
|
317
306
|
static get(e) {
|
|
318
|
-
return
|
|
307
|
+
return vt(e) || Et(e, It(e));
|
|
319
308
|
}
|
|
320
309
|
}
|
|
321
|
-
function
|
|
310
|
+
function It(o) {
|
|
322
311
|
if (o.type.spec.tableRole != "table")
|
|
323
312
|
throw new RangeError("Not a table node: " + o.type.name);
|
|
324
|
-
const e =
|
|
313
|
+
const e = $t(o), t = o.childCount, n = [], l = [];
|
|
325
314
|
let s = 0, r;
|
|
326
315
|
for (let c = 0, d = e * t; c < d; c++)
|
|
327
316
|
n[c] = 0;
|
|
328
317
|
for (let c = 0, d = 0; c < t; c++) {
|
|
329
|
-
const
|
|
318
|
+
const f = o.child(c);
|
|
330
319
|
d++;
|
|
331
320
|
for (let h = 0; ; h++) {
|
|
332
321
|
for (; s < n.length && n[s] != 0; )
|
|
333
322
|
s++;
|
|
334
|
-
if (h ==
|
|
323
|
+
if (h == f.childCount)
|
|
335
324
|
break;
|
|
336
|
-
const b =
|
|
325
|
+
const b = f.child(h), { colspan: w, rowspan: C, colwidth: Se } = b.attrs;
|
|
337
326
|
for (let H = 0; H < C; H++) {
|
|
338
327
|
if (H + c >= t) {
|
|
339
328
|
(r || (r = [])).push({
|
|
@@ -351,7 +340,7 @@ function Ft(o) {
|
|
|
351
340
|
pos: d,
|
|
352
341
|
n: w - _
|
|
353
342
|
});
|
|
354
|
-
const X =
|
|
343
|
+
const X = Se && Se[_];
|
|
355
344
|
if (X) {
|
|
356
345
|
const j = (le + _) % e * 2, se = l[j];
|
|
357
346
|
se == null || se != X && l[j + 1] == 1 ? (l[j] = X, l[j + 1] = 1) : se == X && l[j + 1]++;
|
|
@@ -360,9 +349,9 @@ function Ft(o) {
|
|
|
360
349
|
}
|
|
361
350
|
s += w, d += b.nodeSize;
|
|
362
351
|
}
|
|
363
|
-
const
|
|
352
|
+
const u = (c + 1) * e;
|
|
364
353
|
let p = 0;
|
|
365
|
-
for (; s <
|
|
354
|
+
for (; s < u; )
|
|
366
355
|
n[s++] == 0 && p++;
|
|
367
356
|
p && (r || (r = [])).push({ type: "missing", row: c, n: p }), d++;
|
|
368
357
|
}
|
|
@@ -370,9 +359,9 @@ function Ft(o) {
|
|
|
370
359
|
let i = !1;
|
|
371
360
|
for (let c = 0; !i && c < l.length; c += 2)
|
|
372
361
|
l[c] != null && l[c + 1] < t && (i = !0);
|
|
373
|
-
return i &&
|
|
362
|
+
return i && Dt(a, l, o), a;
|
|
374
363
|
}
|
|
375
|
-
function
|
|
364
|
+
function $t(o) {
|
|
376
365
|
let e = -1, t = !1;
|
|
377
366
|
for (let n = 0; n < o.childCount; n++) {
|
|
378
367
|
const l = o.child(n);
|
|
@@ -393,7 +382,7 @@ function Bt(o) {
|
|
|
393
382
|
}
|
|
394
383
|
return e;
|
|
395
384
|
}
|
|
396
|
-
function
|
|
385
|
+
function Dt(o, e, t) {
|
|
397
386
|
o.problems || (o.problems = []);
|
|
398
387
|
for (let n = 0, l = {}; n < o.map.length; n++) {
|
|
399
388
|
const s = o.map[n];
|
|
@@ -404,7 +393,7 @@ function Pt(o, e, t) {
|
|
|
404
393
|
let a = null;
|
|
405
394
|
for (let i = 0; i < r.attrs.colspan; i++) {
|
|
406
395
|
const c = (n + i) % o.width, d = e[c * 2];
|
|
407
|
-
d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a =
|
|
396
|
+
d != null && (!r.attrs.colwidth || r.attrs.colwidth[i] != d) && ((a || (a = Ot(r.attrs)))[i] = d);
|
|
408
397
|
}
|
|
409
398
|
a && o.problems.unshift({
|
|
410
399
|
type: "colwidth mismatch",
|
|
@@ -413,7 +402,7 @@ function Pt(o, e, t) {
|
|
|
413
402
|
});
|
|
414
403
|
}
|
|
415
404
|
}
|
|
416
|
-
function
|
|
405
|
+
function Ot(o) {
|
|
417
406
|
if (o.colwidth)
|
|
418
407
|
return o.colwidth.slice();
|
|
419
408
|
const e = [];
|
|
@@ -426,14 +415,14 @@ class m extends S {
|
|
|
426
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);
|
|
427
416
|
i.unshift(t.pos - s);
|
|
428
417
|
const c = i.map((d) => {
|
|
429
|
-
const
|
|
430
|
-
return new
|
|
418
|
+
const f = n.nodeAt(d), u = d + s + 1;
|
|
419
|
+
return new bt(a.resolve(u), a.resolve(u + f.content.size));
|
|
431
420
|
});
|
|
432
421
|
super(c[0].$from, c[0].$to, c), this.$anchorCell = e, this.$headCell = t, this.$anchorCell = e, this.$headCell = t;
|
|
433
422
|
}
|
|
434
423
|
map(e, t) {
|
|
435
424
|
const n = e.resolve(t.map(this.$anchorCell.pos)), l = e.resolve(t.map(this.$headCell.pos));
|
|
436
|
-
if (de(n) && de(l) &&
|
|
425
|
+
if (de(n) && de(l) && Me(n, l)) {
|
|
437
426
|
const s = this.$anchorCell.node(-1) != n.node(-1);
|
|
438
427
|
return s && this.isRowSelection() ? m.rowSelection(n, l) : s && this.isColSelection() ? m.colSelection(n, l) : new m(n, l);
|
|
439
428
|
}
|
|
@@ -443,12 +432,12 @@ class m extends S {
|
|
|
443
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 = [];
|
|
444
433
|
for (let i = l.top; i < l.bottom; i++) {
|
|
445
434
|
const c = [];
|
|
446
|
-
for (let d = i * t.width + l.left,
|
|
447
|
-
const
|
|
448
|
-
if (!s[
|
|
449
|
-
s[
|
|
450
|
-
const p = t.findCell(
|
|
451
|
-
let h = e.nodeAt(
|
|
435
|
+
for (let d = i * t.width + l.left, f = l.left; f < l.right; f++, d++) {
|
|
436
|
+
const u = t.map[d];
|
|
437
|
+
if (!s[u]) {
|
|
438
|
+
s[u] = !0;
|
|
439
|
+
const p = t.findCell(u);
|
|
440
|
+
let h = e.nodeAt(u);
|
|
452
441
|
const b = l.left - p.left, w = p.right - l.right;
|
|
453
442
|
if (b > 0 || w > 0) {
|
|
454
443
|
let C = h.attrs;
|
|
@@ -560,32 +549,32 @@ class m extends S {
|
|
|
560
549
|
return new m(e.resolve(t), e.resolve(n));
|
|
561
550
|
}
|
|
562
551
|
getBookmark() {
|
|
563
|
-
return new
|
|
552
|
+
return new Ae(this.$anchorCell.pos, this.$headCell.pos);
|
|
564
553
|
}
|
|
565
554
|
}
|
|
566
555
|
m.prototype.visible = !1;
|
|
567
556
|
S.jsonID("cell", m);
|
|
568
|
-
class
|
|
557
|
+
class Ae {
|
|
569
558
|
constructor(e, t) {
|
|
570
559
|
this.anchor = e, this.head = t, this.anchor = e, this.head = t;
|
|
571
560
|
}
|
|
572
561
|
map(e) {
|
|
573
|
-
return new
|
|
562
|
+
return new Ae(e.map(this.anchor), e.map(this.head));
|
|
574
563
|
}
|
|
575
564
|
resolve(e) {
|
|
576
565
|
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 &&
|
|
566
|
+
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && Me(t, n) ? new m(t, n) : S.near(n, 1);
|
|
578
567
|
}
|
|
579
568
|
}
|
|
580
|
-
function
|
|
569
|
+
function _t(o) {
|
|
581
570
|
if (!(o.selection instanceof m))
|
|
582
571
|
return null;
|
|
583
572
|
const e = [];
|
|
584
573
|
return o.selection.forEachCell((t, n) => {
|
|
585
|
-
e.push(
|
|
586
|
-
}),
|
|
574
|
+
e.push(ye.node(n, n + t.nodeSize, { class: "selectedCell" }));
|
|
575
|
+
}), ke.create(o.doc, e);
|
|
587
576
|
}
|
|
588
|
-
function
|
|
577
|
+
function zt({ $from: o, $to: e }) {
|
|
589
578
|
if (o.pos == e.pos || o.pos < o.pos - 6)
|
|
590
579
|
return !1;
|
|
591
580
|
let t = o.pos, n = e.pos, l = o.depth;
|
|
@@ -595,7 +584,7 @@ function jt({ $from: o, $to: e }) {
|
|
|
595
584
|
;
|
|
596
585
|
return t == n && /row|table/.test(o.node(l).type.spec.tableRole);
|
|
597
586
|
}
|
|
598
|
-
function
|
|
587
|
+
function Ft({ $from: o, $to: e }) {
|
|
599
588
|
let t, n;
|
|
600
589
|
for (let l = o.depth; l > 0; l--) {
|
|
601
590
|
const s = o.node(l);
|
|
@@ -613,7 +602,7 @@ function Kt({ $from: o, $to: e }) {
|
|
|
613
602
|
}
|
|
614
603
|
return t !== n && e.parentOffset === 0;
|
|
615
604
|
}
|
|
616
|
-
function
|
|
605
|
+
function Bt(o, e, t) {
|
|
617
606
|
const n = (e || o).selection, l = (e || o).doc;
|
|
618
607
|
let s, r;
|
|
619
608
|
if (n instanceof te && (r = n.node.type.spec.tableRole)) {
|
|
@@ -627,10 +616,10 @@ function qt(o, e, t) {
|
|
|
627
616
|
s = m.create(l, i + 1, d);
|
|
628
617
|
}
|
|
629
618
|
} else
|
|
630
|
-
n instanceof D &&
|
|
619
|
+
n instanceof D && zt(n) ? s = D.create(l, n.from) : n instanceof D && Ft(n) && (s = D.create(l, n.$from.start(), n.$from.end()));
|
|
631
620
|
return s && (e || (e = o.tr)).setSelection(s), e;
|
|
632
621
|
}
|
|
633
|
-
function
|
|
622
|
+
function ve(o, e) {
|
|
634
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 = {
|
|
635
624
|
colspan: l,
|
|
636
625
|
rowspan: Number(o.getAttribute("rowspan") || 1),
|
|
@@ -642,7 +631,7 @@ function Ie(o, e) {
|
|
|
642
631
|
}
|
|
643
632
|
return s;
|
|
644
633
|
}
|
|
645
|
-
function
|
|
634
|
+
function Ee(o, e) {
|
|
646
635
|
const t = {};
|
|
647
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(","));
|
|
648
637
|
for (const n in e) {
|
|
@@ -651,7 +640,7 @@ function $e(o, e) {
|
|
|
651
640
|
}
|
|
652
641
|
return t;
|
|
653
642
|
}
|
|
654
|
-
function
|
|
643
|
+
function Pt(o) {
|
|
655
644
|
const e = o.cellAttributes || {}, t = {
|
|
656
645
|
colspan: { default: 1 },
|
|
657
646
|
rowspan: { default: 1 },
|
|
@@ -684,9 +673,9 @@ function Ut(o) {
|
|
|
684
673
|
attrs: n,
|
|
685
674
|
tableRole: "cell",
|
|
686
675
|
isolating: !0,
|
|
687
|
-
parseDOM: [{ tag: "td", getAttrs: (s) =>
|
|
676
|
+
parseDOM: [{ tag: "td", getAttrs: (s) => ve(s, e) }],
|
|
688
677
|
toDOM(s) {
|
|
689
|
-
return ["td",
|
|
678
|
+
return ["td", Ee(s, e), 0];
|
|
690
679
|
}
|
|
691
680
|
},
|
|
692
681
|
table_header: {
|
|
@@ -694,9 +683,9 @@ function Ut(o) {
|
|
|
694
683
|
attrs: n,
|
|
695
684
|
tableRole: "header_cell",
|
|
696
685
|
isolating: !0,
|
|
697
|
-
parseDOM: [{ tag: "th", getAttrs: (s) =>
|
|
686
|
+
parseDOM: [{ tag: "th", getAttrs: (s) => ve(s, e) }],
|
|
698
687
|
toDOM(s) {
|
|
699
|
-
return ["th",
|
|
688
|
+
return ["th", Ee(s, e), 0];
|
|
700
689
|
}
|
|
701
690
|
}
|
|
702
691
|
};
|
|
@@ -712,7 +701,7 @@ function A(o) {
|
|
|
712
701
|
}
|
|
713
702
|
return e;
|
|
714
703
|
}
|
|
715
|
-
const V =
|
|
704
|
+
const V = Pt({
|
|
716
705
|
tableGroup: "block",
|
|
717
706
|
cellContent: "paragraph",
|
|
718
707
|
cellAttributes: {
|
|
@@ -733,13 +722,13 @@ function U(o) {
|
|
|
733
722
|
function de(o) {
|
|
734
723
|
return o.parent.type.spec.tableRole == "row" ? o.nodeAfter : null;
|
|
735
724
|
}
|
|
736
|
-
function
|
|
725
|
+
function Wt(o) {
|
|
737
726
|
return o.node(0).resolve(o.pos + o.nodeAfter.nodeSize);
|
|
738
727
|
}
|
|
739
|
-
function
|
|
728
|
+
function Me(o, e) {
|
|
740
729
|
return o.depth == e.depth && o.pos >= e.start(-1) && o.pos <= e.end(-1);
|
|
741
730
|
}
|
|
742
|
-
function
|
|
731
|
+
function Qe(o, e, t) {
|
|
743
732
|
const n = o.start(-1), s = g.get(o.node(-1)).nextCell(o.pos - n, e, t);
|
|
744
733
|
return s == null ? null : o.node(0).resolve(n + s);
|
|
745
734
|
}
|
|
@@ -766,9 +755,9 @@ function M(o) {
|
|
|
766
755
|
}
|
|
767
756
|
function ne(o) {
|
|
768
757
|
const e = o.selection;
|
|
769
|
-
return e instanceof m ? e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell : e.node && e.node.type.spec.tableRole == "cell" ? e.$anchor : U(e.$head) ||
|
|
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 : U(e.$head) || Ht(e.$head);
|
|
770
759
|
}
|
|
771
|
-
function
|
|
760
|
+
function Ht(o) {
|
|
772
761
|
for (let e = o.nodeAfter, t = o.pos; e; e = e.firstChild, t++) {
|
|
773
762
|
const n = e.type.spec.tableRole;
|
|
774
763
|
if (n == "cell" || n == "header_cell")
|
|
@@ -780,7 +769,7 @@ function Vt(o) {
|
|
|
780
769
|
return o.doc.resolve(t - e.nodeSize);
|
|
781
770
|
}
|
|
782
771
|
}
|
|
783
|
-
function
|
|
772
|
+
function jt(o, e, t = 1) {
|
|
784
773
|
const n = y(o, "colspan", o.colspan + t);
|
|
785
774
|
if (n.colwidth) {
|
|
786
775
|
const l = n.colwidth;
|
|
@@ -790,7 +779,7 @@ function Zt(o, e, t = 1) {
|
|
|
790
779
|
}
|
|
791
780
|
return n;
|
|
792
781
|
}
|
|
793
|
-
function
|
|
782
|
+
function Kt(o, e, t) {
|
|
794
783
|
const n = A(e.type.schema).header_cell;
|
|
795
784
|
for (let l = 0; l < o.height; l++) {
|
|
796
785
|
const s = o.map[t + l * o.width];
|
|
@@ -799,7 +788,7 @@ function Gt(o, e, t) {
|
|
|
799
788
|
}
|
|
800
789
|
return !0;
|
|
801
790
|
}
|
|
802
|
-
const
|
|
791
|
+
const qt = (o) => (e, t) => {
|
|
803
792
|
if (!M(e))
|
|
804
793
|
return !1;
|
|
805
794
|
const { $head: n } = e.selection, l = n.after(), s = e.tr.replaceWith(l, l, o.createAndFill());
|
|
@@ -810,15 +799,15 @@ function P(o) {
|
|
|
810
799
|
let r;
|
|
811
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;
|
|
812
801
|
}
|
|
813
|
-
function
|
|
802
|
+
function et(o, { map: e, tableStart: t, table: n }, l) {
|
|
814
803
|
e = e, n = n, t = t;
|
|
815
804
|
let s = l > 0 ? -1 : 0;
|
|
816
|
-
|
|
805
|
+
Kt(e, n, l + s) && (s = l == 0 || l == e.width ? null : 0);
|
|
817
806
|
for (let r = 0; r < e.height; r++) {
|
|
818
807
|
const a = r * e.width + l;
|
|
819
808
|
if (l > 0 && l < e.width && e.map[a - 1] == e.map[a]) {
|
|
820
809
|
const i = e.map[a], c = n.nodeAt(i);
|
|
821
|
-
o.setNodeMarkup(o.mapping.map(t + i), null,
|
|
810
|
+
o.setNodeMarkup(o.mapping.map(t + i), null, jt(c.attrs, l - e.colCount(i))), r += c.attrs.rowspan - 1;
|
|
822
811
|
} else {
|
|
823
812
|
const i = e.map[a + s], c = s == null ? A(n.type.schema).cell : n.nodeAt(i).type, d = e.positionAt(r, l, n);
|
|
824
813
|
o.insert(o.mapping.map(t + d), c.createAndFill());
|
|
@@ -826,24 +815,24 @@ function tt(o, { map: e, tableStart: t, table: n }, l) {
|
|
|
826
815
|
}
|
|
827
816
|
return o;
|
|
828
817
|
}
|
|
829
|
-
const
|
|
818
|
+
const Ut = (o, e) => {
|
|
830
819
|
if (!M(o))
|
|
831
820
|
return !1;
|
|
832
821
|
if (e) {
|
|
833
822
|
const t = P(o);
|
|
834
|
-
e(
|
|
823
|
+
e(et(o.tr, t, t.left));
|
|
835
824
|
}
|
|
836
825
|
return !0;
|
|
837
|
-
},
|
|
826
|
+
}, Xt = (o, e) => {
|
|
838
827
|
if (!M(o))
|
|
839
828
|
return !1;
|
|
840
829
|
if (e) {
|
|
841
830
|
const t = P(o);
|
|
842
|
-
e(
|
|
831
|
+
e(et(o.tr, t, t.right));
|
|
843
832
|
}
|
|
844
833
|
return !0;
|
|
845
834
|
};
|
|
846
|
-
function
|
|
835
|
+
function Vt(o, { map: e, table: t, tableStart: n }, l) {
|
|
847
836
|
e = e, t = t, n = n;
|
|
848
837
|
const s = o.mapping.maps.length;
|
|
849
838
|
for (let r = 0; r < e.height; ) {
|
|
@@ -857,20 +846,20 @@ function en(o, { map: e, table: t, tableStart: n }, l) {
|
|
|
857
846
|
r += c.attrs.rowspan;
|
|
858
847
|
}
|
|
859
848
|
}
|
|
860
|
-
const
|
|
849
|
+
const Gt = (o, e) => {
|
|
861
850
|
if (!M(o))
|
|
862
851
|
return !1;
|
|
863
852
|
if (e) {
|
|
864
853
|
const t = P(o), n = o.tr;
|
|
865
854
|
if (t.left == 0 && t.right == t.map.width)
|
|
866
855
|
return !1;
|
|
867
|
-
for (let l = t.right - 1;
|
|
856
|
+
for (let l = t.right - 1; Vt(n, t, l), l != t.left; l--)
|
|
868
857
|
t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
|
|
869
858
|
e(n);
|
|
870
859
|
}
|
|
871
860
|
return !0;
|
|
872
861
|
};
|
|
873
|
-
function
|
|
862
|
+
function Jt(o, { map: e, tableStart: t, table: n }, l) {
|
|
874
863
|
e = e, n = n, t = t;
|
|
875
864
|
let s = 0;
|
|
876
865
|
for (let i = 0; i < l; i++)
|
|
@@ -880,22 +869,22 @@ function nn(o, { map: e, tableStart: t, table: n }, l) {
|
|
|
880
869
|
for (let i = 0, c = l * e.width; i < e.width; i++, c++) {
|
|
881
870
|
const d = e.map[c];
|
|
882
871
|
if (l > 0 && d == e.map[c - e.width]) {
|
|
883
|
-
const
|
|
884
|
-
o.setNodeMarkup(o.mapping.slice(a).map(d + t), null, y(
|
|
872
|
+
const f = n.nodeAt(d).attrs;
|
|
873
|
+
o.setNodeMarkup(o.mapping.slice(a).map(d + t), null, y(f, "rowspan", f.rowspan - 1)), i += f.colspan - 1;
|
|
885
874
|
} else if (l < e.width && d == e.map[c + e.width]) {
|
|
886
|
-
const
|
|
887
|
-
o.insert(o.mapping.slice(a).map(t + p),
|
|
875
|
+
const f = n.nodeAt(d), u = f.type.create(y(f.attrs, "rowspan", f.attrs.rowspan - 1), f.content), p = e.positionAt(l + 1, i, n);
|
|
876
|
+
o.insert(o.mapping.slice(a).map(t + p), u), i += f.attrs.colspan - 1;
|
|
888
877
|
}
|
|
889
878
|
}
|
|
890
879
|
}
|
|
891
|
-
const
|
|
880
|
+
const Yt = (o, e) => {
|
|
892
881
|
if (!M(o))
|
|
893
882
|
return !1;
|
|
894
883
|
if (e) {
|
|
895
884
|
const t = P(o), n = o.tr;
|
|
896
885
|
if (t.top == 0 && t.bottom == t.map.height)
|
|
897
886
|
return !1;
|
|
898
|
-
for (let l = t.bottom - 1;
|
|
887
|
+
for (let l = t.bottom - 1; Jt(n, t, l), l != t.top; l--)
|
|
899
888
|
t.table = t.tableStart ? n.doc.nodeAt(t.tableStart - 1) : n.doc, t.map = g.get(t.table);
|
|
900
889
|
e(n);
|
|
901
890
|
}
|
|
@@ -917,7 +906,7 @@ function ie(o, e) {
|
|
|
917
906
|
return !0;
|
|
918
907
|
};
|
|
919
908
|
}
|
|
920
|
-
function
|
|
909
|
+
function Zt(o, e) {
|
|
921
910
|
if (e < 0) {
|
|
922
911
|
const t = o.nodeBefore;
|
|
923
912
|
if (t)
|
|
@@ -940,27 +929,27 @@ function ln(o, e) {
|
|
|
940
929
|
}
|
|
941
930
|
}
|
|
942
931
|
}
|
|
943
|
-
function
|
|
932
|
+
function Ie(o) {
|
|
944
933
|
return (e, t) => {
|
|
945
934
|
if (!M(e))
|
|
946
935
|
return !1;
|
|
947
|
-
const n =
|
|
936
|
+
const n = Zt(ne(e), o);
|
|
948
937
|
if (n == null)
|
|
949
938
|
return !1;
|
|
950
939
|
if (t) {
|
|
951
940
|
const l = e.doc.resolve(n);
|
|
952
|
-
t(e.tr.setSelection(D.between(l,
|
|
941
|
+
t(e.tr.setSelection(D.between(l, Wt(l))).scrollIntoView());
|
|
953
942
|
}
|
|
954
943
|
return !0;
|
|
955
944
|
};
|
|
956
945
|
}
|
|
957
|
-
const
|
|
946
|
+
const Qt = (o, e) => {
|
|
958
947
|
const t = o.selection.$anchor;
|
|
959
948
|
for (let n = t.depth; n > 0; n--)
|
|
960
949
|
if (t.node(n).type.spec.tableRole == "table")
|
|
961
950
|
return e && e(o.tr.delete(t.before(n), t.after(n)).scrollIntoView()), !0;
|
|
962
951
|
return !1;
|
|
963
|
-
}, oe = (o) =>
|
|
952
|
+
}, oe = (o) => gt((e) => e.type.spec.tableRole === "table")(o), en = (o) => (e) => {
|
|
964
953
|
const t = oe(e);
|
|
965
954
|
if (!t)
|
|
966
955
|
return;
|
|
@@ -977,7 +966,7 @@ const sn = (o, e) => {
|
|
|
977
966
|
node: s
|
|
978
967
|
};
|
|
979
968
|
}).filter((l) => l != null);
|
|
980
|
-
},
|
|
969
|
+
}, tn = (o) => (e) => {
|
|
981
970
|
const t = oe(e);
|
|
982
971
|
if (!t)
|
|
983
972
|
return;
|
|
@@ -994,20 +983,20 @@ const sn = (o, e) => {
|
|
|
994
983
|
node: s
|
|
995
984
|
};
|
|
996
985
|
}).filter((l) => l != null);
|
|
997
|
-
},
|
|
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,
|
|
986
|
+
}, $e = (o, e = 3, t = 3) => {
|
|
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));
|
|
999
988
|
return r.create(null, c);
|
|
1000
|
-
},
|
|
989
|
+
}, De = (o) => (e) => (t) => {
|
|
1001
990
|
const n = oe(t.selection), l = o === "row";
|
|
1002
991
|
if (n) {
|
|
1003
992
|
const s = g.get(n.node);
|
|
1004
993
|
if (e >= 0 && e < (l ? s.height : s.width)) {
|
|
1005
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);
|
|
1006
|
-
return
|
|
995
|
+
return Xe(t.setSelection(i(a, d)));
|
|
1007
996
|
}
|
|
1008
997
|
}
|
|
1009
998
|
return t;
|
|
1010
|
-
},
|
|
999
|
+
}, nn = (o) => {
|
|
1011
1000
|
const e = oe(o);
|
|
1012
1001
|
if (!e)
|
|
1013
1002
|
return;
|
|
@@ -1021,25 +1010,25 @@ const sn = (o, e) => {
|
|
|
1021
1010
|
const s = e.node.nodeAt(l), r = l + e.start;
|
|
1022
1011
|
return { pos: r, start: r + 1, node: s };
|
|
1023
1012
|
});
|
|
1024
|
-
},
|
|
1025
|
-
const e =
|
|
1013
|
+
}, on = (o) => {
|
|
1014
|
+
const e = nn(o.selection);
|
|
1026
1015
|
if (e && e[0]) {
|
|
1027
1016
|
const t = o.doc.resolve(e[0].pos), n = e[e.length - 1];
|
|
1028
1017
|
if (n) {
|
|
1029
1018
|
const l = o.doc.resolve(n.pos);
|
|
1030
|
-
return
|
|
1019
|
+
return Xe(o.setSelection(new m(l, t)));
|
|
1031
1020
|
}
|
|
1032
1021
|
}
|
|
1033
1022
|
return o;
|
|
1034
1023
|
};
|
|
1035
|
-
function
|
|
1036
|
-
const s = Array(l).fill(0).reduce((c, d,
|
|
1037
|
-
const
|
|
1038
|
-
return r.createAndFill({ alignment:
|
|
1024
|
+
function Oe(o, { map: e, tableStart: t, table: n }, l) {
|
|
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
|
+
const f = n.nodeAt(e.map[d]);
|
|
1027
|
+
return r.createAndFill({ alignment: f == null ? void 0 : f.attrs.alignment });
|
|
1039
1028
|
});
|
|
1040
1029
|
return o.insert(s, a.create(null, i)), o;
|
|
1041
1030
|
}
|
|
1042
|
-
const T = (o) => o.state.selection,
|
|
1031
|
+
const T = (o) => o.state.selection, ln = (o) => {
|
|
1043
1032
|
const e = g.get(o.$anchorCell.node(-1)), t = o.$anchorCell.start(-1), n = e.cellsInRect({
|
|
1044
1033
|
left: 0,
|
|
1045
1034
|
right: e.width,
|
|
@@ -1050,7 +1039,7 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1050
1039
|
if (l.indexOf(n[s]) === -1)
|
|
1051
1040
|
return !1;
|
|
1052
1041
|
return !0;
|
|
1053
|
-
},
|
|
1042
|
+
}, sn = (o, e) => {
|
|
1054
1043
|
Object.values(o).forEach((t) => {
|
|
1055
1044
|
var l;
|
|
1056
1045
|
if ((l = t.disable) == null ? void 0 : l.call(t, e)) {
|
|
@@ -1059,17 +1048,17 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1059
1048
|
}
|
|
1060
1049
|
t.$.classList.remove("hide");
|
|
1061
1050
|
});
|
|
1062
|
-
},
|
|
1051
|
+
}, rn = (o) => {
|
|
1063
1052
|
var e, t, n, l, s, r, a, i;
|
|
1064
1053
|
return {
|
|
1065
1054
|
[0]: {
|
|
1066
1055
|
$: (e = o.get(L).get(v, "leftArrow")) == null ? void 0 : e.dom,
|
|
1067
|
-
command: () =>
|
|
1056
|
+
command: () => Ut,
|
|
1068
1057
|
disable: (c) => !T(c).isColSelection()
|
|
1069
1058
|
},
|
|
1070
1059
|
[1]: {
|
|
1071
1060
|
$: (t = o.get(L).get(v, "rightArrow")) == null ? void 0 : t.dom,
|
|
1072
|
-
command: () =>
|
|
1061
|
+
command: () => Xt,
|
|
1073
1062
|
disable: (c) => !T(c).isColSelection()
|
|
1074
1063
|
},
|
|
1075
1064
|
[2]: {
|
|
@@ -1078,8 +1067,8 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1078
1067
|
if (!M(c))
|
|
1079
1068
|
return !1;
|
|
1080
1069
|
if (d) {
|
|
1081
|
-
const
|
|
1082
|
-
d(
|
|
1070
|
+
const f = P(c);
|
|
1071
|
+
d(Oe(c.tr, f, f.top));
|
|
1083
1072
|
}
|
|
1084
1073
|
return !0;
|
|
1085
1074
|
},
|
|
@@ -1091,8 +1080,8 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1091
1080
|
if (!M(c))
|
|
1092
1081
|
return !1;
|
|
1093
1082
|
if (d) {
|
|
1094
|
-
const
|
|
1095
|
-
d(
|
|
1083
|
+
const f = P(c);
|
|
1084
|
+
d(Oe(c.tr, f, f.bottom));
|
|
1096
1085
|
}
|
|
1097
1086
|
return !0;
|
|
1098
1087
|
},
|
|
@@ -1116,29 +1105,29 @@ const T = (o) => o.state.selection, un = (o) => {
|
|
|
1116
1105
|
[7]: {
|
|
1117
1106
|
$: (i = o.get(L).get(v, "delete")) == null ? void 0 : i.dom,
|
|
1118
1107
|
command: (c, d) => {
|
|
1119
|
-
const
|
|
1120
|
-
return
|
|
1108
|
+
const f = T(d), u = f.isColSelection(), p = f.isRowSelection();
|
|
1109
|
+
return u && p ? Qt : u ? Gt : Yt;
|
|
1121
1110
|
},
|
|
1122
1111
|
disable: (c) => {
|
|
1123
1112
|
const d = T(c);
|
|
1124
|
-
return d.isRowSelection() ? d.isColSelection() ? !1 :
|
|
1113
|
+
return d.isRowSelection() ? d.isColSelection() ? !1 : ln(d) : !1;
|
|
1125
1114
|
}
|
|
1126
1115
|
}
|
|
1127
1116
|
};
|
|
1128
|
-
},
|
|
1117
|
+
}, cn = (o, e) => {
|
|
1129
1118
|
const { selection: t } = o.state, n = t.isColSelection(), l = t.isRowSelection();
|
|
1130
|
-
|
|
1119
|
+
wt(o, e, (s, r, a) => {
|
|
1131
1120
|
const i = e.parentElement;
|
|
1132
1121
|
if (!i)
|
|
1133
|
-
throw
|
|
1122
|
+
throw mt();
|
|
1134
1123
|
let c = l ? s.left - a.left - r.width / 2 - 8 : s.left - a.left + (s.width - r.width) / 2;
|
|
1135
1124
|
const d = s.top - a.top - r.height - (n ? 14 : 0) - 14 + i.scrollTop;
|
|
1136
1125
|
return c < 0 && (c = 0), [d, c];
|
|
1137
1126
|
});
|
|
1138
1127
|
};
|
|
1139
1128
|
var x = /* @__PURE__ */ ((o) => (o.Left = "Left", o.Top = "Top", o.Point = "Point", o))(x || {});
|
|
1140
|
-
const
|
|
1141
|
-
const n =
|
|
1129
|
+
const an = (o, { css: e, injectGlobal: t }) => {
|
|
1130
|
+
const n = ut(o), l = o.get(Ne, "radius"), s = o.get(Ne, "lineWidth");
|
|
1142
1131
|
return t`
|
|
1143
1132
|
.milkdown {
|
|
1144
1133
|
.tableWrapper {
|
|
@@ -1211,8 +1200,8 @@ const mn = (o, { css: e, injectGlobal: t }) => {
|
|
|
1211
1200
|
|
|
1212
1201
|
border-radius: ${l};
|
|
1213
1202
|
|
|
1214
|
-
${o.get(
|
|
1215
|
-
${o.get(
|
|
1203
|
+
${o.get(pt, void 0)};
|
|
1204
|
+
${o.get(ht, void 0)};
|
|
1216
1205
|
|
|
1217
1206
|
overflow: hidden;
|
|
1218
1207
|
background: ${n("surface")};
|
|
@@ -1250,7 +1239,7 @@ const mn = (o, { css: e, injectGlobal: t }) => {
|
|
|
1250
1239
|
display: none;
|
|
1251
1240
|
}
|
|
1252
1241
|
`;
|
|
1253
|
-
},
|
|
1242
|
+
}, dn = (o) => {
|
|
1254
1243
|
switch (o) {
|
|
1255
1244
|
case x.Left:
|
|
1256
1245
|
return "milkdown-cell-left";
|
|
@@ -1262,36 +1251,36 @@ const mn = (o, { css: e, injectGlobal: t }) => {
|
|
|
1262
1251
|
}
|
|
1263
1252
|
};
|
|
1264
1253
|
function ce(o, e, t, n = 0) {
|
|
1265
|
-
return
|
|
1254
|
+
return ye.widget(e.pos + 1, (l) => {
|
|
1266
1255
|
var r;
|
|
1267
1256
|
const s = document.createElement("div");
|
|
1268
|
-
return s.classList.add(
|
|
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) => {
|
|
1269
1258
|
if (!!l)
|
|
1270
1259
|
switch (a.preventDefault(), t) {
|
|
1271
1260
|
case x.Point: {
|
|
1272
|
-
l.dispatch(
|
|
1261
|
+
l.dispatch(on(l.state.tr));
|
|
1273
1262
|
return;
|
|
1274
1263
|
}
|
|
1275
1264
|
case x.Left: {
|
|
1276
|
-
l.dispatch(
|
|
1265
|
+
l.dispatch(De("row")(n)(l.state.tr));
|
|
1277
1266
|
return;
|
|
1278
1267
|
}
|
|
1279
1268
|
case x.Top: {
|
|
1280
|
-
l.dispatch(
|
|
1269
|
+
l.dispatch(De("col")(n)(l.state.tr));
|
|
1281
1270
|
return;
|
|
1282
1271
|
}
|
|
1283
1272
|
}
|
|
1284
1273
|
}), s;
|
|
1285
1274
|
});
|
|
1286
1275
|
}
|
|
1287
|
-
const
|
|
1276
|
+
const fn = (o, e) => new W({
|
|
1288
1277
|
key: new F("MILKDOWN_TABLE_OP"),
|
|
1289
1278
|
props: {
|
|
1290
1279
|
decorations: (t) => {
|
|
1291
|
-
const n = [], l =
|
|
1280
|
+
const n = [], l = en(0)(t.selection);
|
|
1292
1281
|
if (!l)
|
|
1293
1282
|
return null;
|
|
1294
|
-
const s =
|
|
1283
|
+
const s = tn(0)(t.selection);
|
|
1295
1284
|
if (!s)
|
|
1296
1285
|
return null;
|
|
1297
1286
|
const [r] = l;
|
|
@@ -1299,14 +1288,14 @@ const wn = (o, e) => new W({
|
|
|
1299
1288
|
n.push(ce(o, a, x.Left, i));
|
|
1300
1289
|
}), s.forEach((a, i) => {
|
|
1301
1290
|
n.push(ce(o, a, x.Top, i));
|
|
1302
|
-
}),
|
|
1291
|
+
}), ke.create(t.doc, n);
|
|
1303
1292
|
}
|
|
1304
1293
|
},
|
|
1305
1294
|
view: (t) => {
|
|
1306
1295
|
var a;
|
|
1307
|
-
const n = Object.fromEntries(Object.entries(
|
|
1296
|
+
const n = Object.fromEntries(Object.entries(rn(o)).filter(([, i]) => i.$ != null)), l = document.createElement("div");
|
|
1308
1297
|
e.themeManager.onFlush(() => {
|
|
1309
|
-
const i = e.getStyle((c) =>
|
|
1298
|
+
const i = e.getStyle((c) => an(e.themeManager, c));
|
|
1310
1299
|
i && l.classList.add(i);
|
|
1311
1300
|
}), l.classList.add("table-tooltip", "hide"), Object.values(n).forEach(({ $: i }) => l.appendChild(i)), (a = t.dom.parentNode) == null || a.appendChild(l);
|
|
1312
1301
|
const s = (i) => {
|
|
@@ -1325,65 +1314,65 @@ const wn = (o, e) => new W({
|
|
|
1325
1314
|
r();
|
|
1326
1315
|
return;
|
|
1327
1316
|
}
|
|
1328
|
-
if (
|
|
1317
|
+
if (sn(n, i), Object.values(n).every(({ $: u }) => u.classList.contains("hide"))) {
|
|
1329
1318
|
r();
|
|
1330
1319
|
return;
|
|
1331
1320
|
}
|
|
1332
|
-
l.classList.remove("hide"),
|
|
1321
|
+
l.classList.remove("hide"), cn(i, l);
|
|
1333
1322
|
},
|
|
1334
1323
|
destroy: () => {
|
|
1335
1324
|
l.removeEventListener("mousedown", s), l.remove();
|
|
1336
1325
|
}
|
|
1337
1326
|
};
|
|
1338
1327
|
}
|
|
1339
|
-
}),
|
|
1340
|
-
key:
|
|
1328
|
+
}), un = (o) => o.type.name === "paragraph" && o.nodeSize === 2, pn = (o) => o.type.name === "paragraph", hn = new F("plugin_autoInsertZeroSpace"), mn = () => new W({
|
|
1329
|
+
key: hn,
|
|
1341
1330
|
props: {
|
|
1342
1331
|
handleDOMEvents: {
|
|
1343
1332
|
compositionstart(o) {
|
|
1344
1333
|
const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
|
|
1345
|
-
return
|
|
1334
|
+
return xe.safari && M(e) && l.empty && un(s.parent) && t(n.insertText("\u2060", s.start())), !1;
|
|
1346
1335
|
},
|
|
1347
1336
|
compositionend(o) {
|
|
1348
1337
|
const { state: e, dispatch: t } = o, { tr: n, selection: l } = e, { $from: s } = l;
|
|
1349
|
-
return
|
|
1338
|
+
return xe.safari && M(e) && l.empty && pn(s.parent) && s.parent.textContent.startsWith("\u2060") && t(n.delete(s.start(), s.start() + 1)), !1;
|
|
1350
1339
|
}
|
|
1351
1340
|
}
|
|
1352
1341
|
}
|
|
1353
1342
|
});
|
|
1354
|
-
class
|
|
1343
|
+
class gn {
|
|
1355
1344
|
constructor(e, t) {
|
|
1356
|
-
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")), fe(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1357
1346
|
}
|
|
1358
1347
|
update(e) {
|
|
1359
|
-
return e.type != this.node.type ? !1 : (this.node = e,
|
|
1348
|
+
return e.type != this.node.type ? !1 : (this.node = e, fe(e, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
1360
1349
|
}
|
|
1361
1350
|
ignoreMutation(e) {
|
|
1362
1351
|
return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
|
|
1363
1352
|
}
|
|
1364
1353
|
}
|
|
1365
|
-
function
|
|
1354
|
+
function fe(o, e, t, n, l, s) {
|
|
1366
1355
|
var d;
|
|
1367
1356
|
let r = 0, a = !0, i = e.firstChild;
|
|
1368
1357
|
const c = o.firstChild;
|
|
1369
|
-
for (let
|
|
1370
|
-
const { colspan: p, colwidth: h } = c.child(
|
|
1371
|
-
for (let b = 0; b < p; b++,
|
|
1372
|
-
const w = l ==
|
|
1358
|
+
for (let f = 0, u = 0; f < c.childCount; f++) {
|
|
1359
|
+
const { colspan: p, colwidth: h } = c.child(f).attrs;
|
|
1360
|
+
for (let b = 0; b < p; b++, u++) {
|
|
1361
|
+
const w = l == u ? s : h && h[b], C = w ? w + "px" : "";
|
|
1373
1362
|
r += w || n, w || (a = !1), i ? (i.style.width != C && (i.style.width = C), i = i.nextSibling) : e.appendChild(document.createElement("col")).style.width = C;
|
|
1374
1363
|
}
|
|
1375
1364
|
}
|
|
1376
1365
|
for (; i; ) {
|
|
1377
|
-
const
|
|
1378
|
-
(d = i.parentNode) == null || d.removeChild(i), i =
|
|
1366
|
+
const f = i.nextSibling;
|
|
1367
|
+
(d = i.parentNode) == null || d.removeChild(i), i = f;
|
|
1379
1368
|
}
|
|
1380
1369
|
a ? (t.style.width = r + "px", t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = r + "px");
|
|
1381
1370
|
}
|
|
1382
1371
|
const k = new F("tableColumnResizing");
|
|
1383
|
-
function
|
|
1372
|
+
function wn({
|
|
1384
1373
|
handleWidth: o = 5,
|
|
1385
1374
|
cellMinWidth: e = 25,
|
|
1386
|
-
View: t =
|
|
1375
|
+
View: t = gn,
|
|
1387
1376
|
lastColumnResizable: n = !0
|
|
1388
1377
|
} = {}) {
|
|
1389
1378
|
return new W({
|
|
@@ -1402,18 +1391,18 @@ function Mn({
|
|
|
1402
1391
|
},
|
|
1403
1392
|
handleDOMEvents: {
|
|
1404
1393
|
mousemove(s, r) {
|
|
1405
|
-
|
|
1394
|
+
bn(s, r, o, n);
|
|
1406
1395
|
},
|
|
1407
1396
|
mouseleave(s) {
|
|
1408
|
-
|
|
1397
|
+
Cn(s);
|
|
1409
1398
|
},
|
|
1410
1399
|
mousedown(s, r) {
|
|
1411
|
-
|
|
1400
|
+
yn(s, r, e);
|
|
1412
1401
|
}
|
|
1413
1402
|
},
|
|
1414
1403
|
decorations(s) {
|
|
1415
1404
|
const r = k.getState(s);
|
|
1416
|
-
return r.activeHandle > -1 ?
|
|
1405
|
+
return r.activeHandle > -1 ? xn(s, r.activeHandle) : null;
|
|
1417
1406
|
},
|
|
1418
1407
|
nodeViews: {}
|
|
1419
1408
|
}
|
|
@@ -1437,14 +1426,14 @@ class q {
|
|
|
1437
1426
|
return t;
|
|
1438
1427
|
}
|
|
1439
1428
|
}
|
|
1440
|
-
function
|
|
1429
|
+
function bn(o, e, t, n) {
|
|
1441
1430
|
const l = k.getState(o.state);
|
|
1442
1431
|
if (!l.dragging) {
|
|
1443
|
-
const s =
|
|
1432
|
+
const s = An(e.target);
|
|
1444
1433
|
let r = -1;
|
|
1445
1434
|
if (s) {
|
|
1446
1435
|
const { left: a, right: i } = s.getBoundingClientRect();
|
|
1447
|
-
e.clientX - a <= t ? r =
|
|
1436
|
+
e.clientX - a <= t ? r = _e(o, e, "left") : i - e.clientX <= t && (r = _e(o, e, "right"));
|
|
1448
1437
|
}
|
|
1449
1438
|
if (r != l.activeHandle) {
|
|
1450
1439
|
if (!n && r !== -1) {
|
|
@@ -1452,36 +1441,36 @@ function Sn(o, e, t, n) {
|
|
|
1452
1441
|
if (c.colCount(a.pos - d) + a.nodeAfter.attrs.colspan - 1 == c.width - 1)
|
|
1453
1442
|
return;
|
|
1454
1443
|
}
|
|
1455
|
-
|
|
1444
|
+
tt(o, r);
|
|
1456
1445
|
}
|
|
1457
1446
|
}
|
|
1458
1447
|
}
|
|
1459
|
-
function
|
|
1448
|
+
function Cn(o) {
|
|
1460
1449
|
const e = k.getState(o.state);
|
|
1461
|
-
e.activeHandle > -1 && !e.dragging &&
|
|
1450
|
+
e.activeHandle > -1 && !e.dragging && tt(o, -1);
|
|
1462
1451
|
}
|
|
1463
|
-
function
|
|
1452
|
+
function yn(o, e, t) {
|
|
1464
1453
|
const n = k.getState(o.state);
|
|
1465
1454
|
if (n.activeHandle == -1 || n.dragging)
|
|
1466
1455
|
return !1;
|
|
1467
|
-
const l = o.state.doc.nodeAt(n.activeHandle), s =
|
|
1456
|
+
const l = o.state.doc.nodeAt(n.activeHandle), s = kn(o, n.activeHandle, l.attrs);
|
|
1468
1457
|
o.dispatch(o.state.tr.setMeta(k, {
|
|
1469
1458
|
setDragging: { startX: e.clientX, startWidth: s }
|
|
1470
1459
|
}));
|
|
1471
1460
|
function r(i) {
|
|
1472
1461
|
window.removeEventListener("mouseup", r), window.removeEventListener("mousemove", a);
|
|
1473
1462
|
const c = k.getState(o.state);
|
|
1474
|
-
c.dragging && (
|
|
1463
|
+
c.dragging && (Mn(o, c.activeHandle, ze(c.dragging, i, t)), o.dispatch(o.state.tr.setMeta(k, { setDragging: null })));
|
|
1475
1464
|
}
|
|
1476
1465
|
function a(i) {
|
|
1477
1466
|
if (!i.which)
|
|
1478
1467
|
return r(i);
|
|
1479
|
-
const c = k.getState(o.state), d =
|
|
1480
|
-
|
|
1468
|
+
const c = k.getState(o.state), d = ze(c.dragging, i, t);
|
|
1469
|
+
Sn(o, c.activeHandle, d, t);
|
|
1481
1470
|
}
|
|
1482
1471
|
return window.addEventListener("mouseup", r), window.addEventListener("mousemove", a), e.preventDefault(), !0;
|
|
1483
1472
|
}
|
|
1484
|
-
function
|
|
1473
|
+
function kn(o, e, { colspan: t, colwidth: n }) {
|
|
1485
1474
|
const l = n && n[n.length - 1];
|
|
1486
1475
|
if (l)
|
|
1487
1476
|
return l;
|
|
@@ -1492,12 +1481,12 @@ function Rn(o, e, { colspan: t, colwidth: n }) {
|
|
|
1492
1481
|
n[c] && (a -= n[c], i--);
|
|
1493
1482
|
return a / i;
|
|
1494
1483
|
}
|
|
1495
|
-
function
|
|
1484
|
+
function An(o) {
|
|
1496
1485
|
for (; o && o.nodeName != "TD" && o.nodeName != "TH"; )
|
|
1497
1486
|
o = o.classList.contains("ProseMirror") ? null : o.parentNode;
|
|
1498
1487
|
return o;
|
|
1499
1488
|
}
|
|
1500
|
-
function
|
|
1489
|
+
function _e(o, e, t) {
|
|
1501
1490
|
const n = o.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
1502
1491
|
if (!n)
|
|
1503
1492
|
return -1;
|
|
@@ -1509,52 +1498,52 @@ function Fe(o, e, t) {
|
|
|
1509
1498
|
const r = g.get(s.node(-1)), a = s.start(-1), i = r.map.indexOf(s.pos - a);
|
|
1510
1499
|
return i % r.width == 0 ? -1 : a + r.map[i - 1];
|
|
1511
1500
|
}
|
|
1512
|
-
function
|
|
1501
|
+
function ze(o, e, t) {
|
|
1513
1502
|
const n = e.clientX - o.startX;
|
|
1514
1503
|
return Math.max(t, o.startWidth + n);
|
|
1515
1504
|
}
|
|
1516
|
-
function
|
|
1505
|
+
function tt(o, e) {
|
|
1517
1506
|
o.dispatch(o.state.tr.setMeta(k, { setHandle: e }));
|
|
1518
1507
|
}
|
|
1519
|
-
function
|
|
1508
|
+
function Mn(o, e, t) {
|
|
1520
1509
|
const n = o.state.doc.resolve(e), l = n.node(-1), s = g.get(l), r = n.start(-1), a = s.colCount(n.pos - r) + n.nodeAfter.attrs.colspan - 1, i = o.state.tr;
|
|
1521
1510
|
for (let c = 0; c < s.height; c++) {
|
|
1522
1511
|
const d = c * s.width + a;
|
|
1523
1512
|
if (c && s.map[d] == s.map[d - s.width])
|
|
1524
1513
|
continue;
|
|
1525
|
-
const
|
|
1526
|
-
if (
|
|
1514
|
+
const f = s.map[d], { attrs: u } = l.nodeAt(f), p = u.colspan == 1 ? 0 : a - s.colCount(f);
|
|
1515
|
+
if (u.colwidth && u.colwidth[p] == t)
|
|
1527
1516
|
continue;
|
|
1528
|
-
const h =
|
|
1529
|
-
h[p] = t, i.setNodeMarkup(r +
|
|
1517
|
+
const h = u.colwidth ? u.colwidth.slice() : Nn(u.colspan);
|
|
1518
|
+
h[p] = t, i.setNodeMarkup(r + f, null, y(u, "colwidth", h));
|
|
1530
1519
|
}
|
|
1531
1520
|
i.docChanged && o.dispatch(i);
|
|
1532
1521
|
}
|
|
1533
|
-
function
|
|
1522
|
+
function Sn(o, e, t, n) {
|
|
1534
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;
|
|
1535
1524
|
let i = o.domAtPos(l.start(-1)).node;
|
|
1536
1525
|
for (; i.nodeName != "TABLE"; )
|
|
1537
1526
|
i = i.parentNode;
|
|
1538
|
-
|
|
1527
|
+
fe(s, i.firstChild, i, n, a, t);
|
|
1539
1528
|
}
|
|
1540
|
-
function
|
|
1529
|
+
function Nn(o) {
|
|
1541
1530
|
const e = [];
|
|
1542
1531
|
for (let t = 0; t < o; t++)
|
|
1543
1532
|
e.push(0);
|
|
1544
1533
|
return e;
|
|
1545
1534
|
}
|
|
1546
|
-
function
|
|
1535
|
+
function xn(o, e) {
|
|
1547
1536
|
const t = [], n = o.doc.resolve(e), l = n.node(-1), s = g.get(l), r = n.start(-1), a = s.colCount(n.pos - r) + n.nodeAfter.attrs.colspan;
|
|
1548
1537
|
for (let i = 0; i < s.height; i++) {
|
|
1549
1538
|
const c = a + i * s.width - 1;
|
|
1550
1539
|
if ((a == s.width || s.map[c] != s.map[c + 1]) && (i == 0 || s.map[c - 1] != s.map[c - 1 - s.width])) {
|
|
1551
|
-
const d = s.map[c],
|
|
1552
|
-
|
|
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(ye.widget(f, u));
|
|
1553
1542
|
}
|
|
1554
1543
|
}
|
|
1555
|
-
return
|
|
1544
|
+
return ke.create(o.doc, t);
|
|
1556
1545
|
}
|
|
1557
|
-
function
|
|
1546
|
+
function Rn(o) {
|
|
1558
1547
|
if (!o.size)
|
|
1559
1548
|
return null;
|
|
1560
1549
|
let { content: e, openStart: t, openEnd: n } = o;
|
|
@@ -1564,16 +1553,16 @@ function $n(o) {
|
|
|
1564
1553
|
if (s == "row")
|
|
1565
1554
|
for (let i = 0; i < e.childCount; i++) {
|
|
1566
1555
|
let c = e.child(i).content;
|
|
1567
|
-
const d = i ? 0 : Math.max(0, t - 1),
|
|
1568
|
-
(d ||
|
|
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 = ue(A(r).row, new O(c, d, f)).content), a.push(c);
|
|
1569
1558
|
}
|
|
1570
1559
|
else if (s == "cell" || s == "header_cell")
|
|
1571
|
-
a.push(t || n ?
|
|
1560
|
+
a.push(t || n ? ue(A(r).row, new O(e, t, n)).content : e);
|
|
1572
1561
|
else
|
|
1573
1562
|
return null;
|
|
1574
|
-
return
|
|
1563
|
+
return Tn(r, a);
|
|
1575
1564
|
}
|
|
1576
|
-
function
|
|
1565
|
+
function Tn(o, e) {
|
|
1577
1566
|
const t = [];
|
|
1578
1567
|
for (let l = 0; l < e.length; l++) {
|
|
1579
1568
|
const s = e[l];
|
|
@@ -1595,20 +1584,20 @@ function Dn(o, e) {
|
|
|
1595
1584
|
}
|
|
1596
1585
|
return { height: e.length, width: n, rows: e };
|
|
1597
1586
|
}
|
|
1598
|
-
function
|
|
1587
|
+
function ue(o, e) {
|
|
1599
1588
|
const t = o.createAndFill();
|
|
1600
|
-
return new
|
|
1589
|
+
return new At(t).replace(0, t.content.size, e).doc;
|
|
1601
1590
|
}
|
|
1602
|
-
function
|
|
1591
|
+
function Ln({ width: o, height: e, rows: t }, n, l) {
|
|
1603
1592
|
if (o != n) {
|
|
1604
1593
|
const s = [], r = [];
|
|
1605
1594
|
for (let a = 0; a < t.length; a++) {
|
|
1606
1595
|
const i = t[a], c = [];
|
|
1607
|
-
for (let d = s[a] || 0,
|
|
1608
|
-
let
|
|
1609
|
-
d +
|
|
1610
|
-
for (let p = 1; p <
|
|
1611
|
-
s[a + p] = (s[a + p] || 0) +
|
|
1596
|
+
for (let d = s[a] || 0, f = 0; d < n; f++) {
|
|
1597
|
+
let u = i.child(f % i.childCount);
|
|
1598
|
+
d + u.attrs.colspan > n && (u = u.type.create(z(u.attrs, u.attrs.colspan, d + u.attrs.colspan - n), u.content)), c.push(u), d += u.attrs.colspan;
|
|
1599
|
+
for (let p = 1; p < u.attrs.rowspan; p++)
|
|
1600
|
+
s[a + p] = (s[a + p] || 0) + u.attrs.colspan;
|
|
1612
1601
|
}
|
|
1613
1602
|
r.push(E.from(c));
|
|
1614
1603
|
}
|
|
@@ -1619,8 +1608,8 @@ function On({ width: o, height: e, rows: t }, n, l) {
|
|
|
1619
1608
|
for (let r = 0, a = 0; r < l; r++, a++) {
|
|
1620
1609
|
const i = [], c = t[a % e];
|
|
1621
1610
|
for (let d = 0; d < c.childCount; d++) {
|
|
1622
|
-
let
|
|
1623
|
-
r +
|
|
1611
|
+
let f = c.child(d);
|
|
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);
|
|
1624
1613
|
}
|
|
1625
1614
|
s.push(E.from(i));
|
|
1626
1615
|
}
|
|
@@ -1628,77 +1617,77 @@ function On({ width: o, height: e, rows: t }, n, l) {
|
|
|
1628
1617
|
}
|
|
1629
1618
|
return { width: o, height: e, rows: t };
|
|
1630
1619
|
}
|
|
1631
|
-
function
|
|
1620
|
+
function vn(o, e, t, n, l, s, r) {
|
|
1632
1621
|
const a = o.doc.type.schema, i = A(a);
|
|
1633
1622
|
let c, d;
|
|
1634
1623
|
if (l > e.width)
|
|
1635
|
-
for (let
|
|
1636
|
-
const p = t.child(
|
|
1637
|
-
|
|
1624
|
+
for (let f = 0, u = 0; f < e.height; f++) {
|
|
1625
|
+
const p = t.child(f);
|
|
1626
|
+
u += p.nodeSize;
|
|
1638
1627
|
const h = [];
|
|
1639
1628
|
let b;
|
|
1640
1629
|
p.lastChild == null || p.lastChild.type == i.cell ? b = c || (c = i.cell.createAndFill()) : b = d || (d = i.header_cell.createAndFill());
|
|
1641
1630
|
for (let w = e.width; w < l; w++)
|
|
1642
1631
|
h.push(b);
|
|
1643
|
-
o.insert(o.mapping.slice(r).map(
|
|
1632
|
+
o.insert(o.mapping.slice(r).map(u - 1 + n), h);
|
|
1644
1633
|
}
|
|
1645
1634
|
if (s > e.height) {
|
|
1646
|
-
const
|
|
1635
|
+
const f = [];
|
|
1647
1636
|
for (let h = 0, b = (e.height - 1) * e.width; h < Math.max(e.width, l); h++) {
|
|
1648
1637
|
const w = h >= e.width ? !1 : t.nodeAt(e.map[b + h]).type == i.header_cell;
|
|
1649
|
-
|
|
1638
|
+
f.push(w ? d || (d = i.header_cell.createAndFill()) : c || (c = i.cell.createAndFill()));
|
|
1650
1639
|
}
|
|
1651
|
-
const
|
|
1640
|
+
const u = i.row.create(null, E.from(f)), p = [];
|
|
1652
1641
|
for (let h = e.height; h < s; h++)
|
|
1653
|
-
p.push(
|
|
1642
|
+
p.push(u);
|
|
1654
1643
|
o.insert(o.mapping.slice(r).map(n + t.nodeSize - 2), p);
|
|
1655
1644
|
}
|
|
1656
1645
|
return !!(c || d);
|
|
1657
1646
|
}
|
|
1658
|
-
function
|
|
1647
|
+
function Fe(o, e, t, n, l, s, r, a) {
|
|
1659
1648
|
if (r == 0 || r == e.height)
|
|
1660
1649
|
return !1;
|
|
1661
1650
|
let i = !1;
|
|
1662
1651
|
for (let c = l; c < s; c++) {
|
|
1663
|
-
const d = r * e.width + c,
|
|
1664
|
-
if (e.map[d - e.width] ==
|
|
1652
|
+
const d = r * e.width + c, f = e.map[d];
|
|
1653
|
+
if (e.map[d - e.width] == f) {
|
|
1665
1654
|
i = !0;
|
|
1666
|
-
const
|
|
1667
|
-
o.setNodeMarkup(o.mapping.slice(a).map(
|
|
1655
|
+
const u = t.nodeAt(f), { top: p, left: h } = e.findCell(f);
|
|
1656
|
+
o.setNodeMarkup(o.mapping.slice(a).map(f + n), null, y(u.attrs, "rowspan", r - p)), o.insert(o.mapping.slice(a).map(e.positionAt(r, h, t)), u.type.createAndFill(y(u.attrs, "rowspan", p + u.attrs.rowspan - r))), c += u.attrs.colspan - 1;
|
|
1668
1657
|
}
|
|
1669
1658
|
}
|
|
1670
1659
|
return i;
|
|
1671
1660
|
}
|
|
1672
|
-
function
|
|
1661
|
+
function Be(o, e, t, n, l, s, r, a) {
|
|
1673
1662
|
if (r == 0 || r == e.width)
|
|
1674
1663
|
return !1;
|
|
1675
1664
|
let i = !1;
|
|
1676
1665
|
for (let c = l; c < s; c++) {
|
|
1677
|
-
const d = c * e.width + r,
|
|
1678
|
-
if (e.map[d - 1] ==
|
|
1666
|
+
const d = c * e.width + r, f = e.map[d];
|
|
1667
|
+
if (e.map[d - 1] == f) {
|
|
1679
1668
|
i = !0;
|
|
1680
|
-
const
|
|
1681
|
-
o.setNodeMarkup(h, null, z(
|
|
1669
|
+
const u = t.nodeAt(f), p = e.colCount(f), h = o.mapping.slice(a).map(f + n);
|
|
1670
|
+
o.setNodeMarkup(h, null, z(u.attrs, r - p, u.attrs.colspan - (r - p))), o.insert(h + u.nodeSize, u.type.createAndFill(z(u.attrs, 0, r - p))), c += u.attrs.rowspan - 1;
|
|
1682
1671
|
}
|
|
1683
1672
|
}
|
|
1684
1673
|
return i;
|
|
1685
1674
|
}
|
|
1686
|
-
function
|
|
1675
|
+
function Pe(o, e, t, n, l) {
|
|
1687
1676
|
let s = t ? o.doc.nodeAt(t - 1) : o.doc, r = g.get(s);
|
|
1688
|
-
const { top: a, left: i } = n, c = i + l.width, d = a + l.height,
|
|
1689
|
-
let
|
|
1677
|
+
const { top: a, left: i } = n, c = i + l.width, d = a + l.height, f = o.tr;
|
|
1678
|
+
let u = 0;
|
|
1690
1679
|
function p() {
|
|
1691
|
-
s = t ?
|
|
1680
|
+
s = t ? f.doc.nodeAt(t - 1) : f.doc, r = g.get(s), u = f.mapping.maps.length;
|
|
1692
1681
|
}
|
|
1693
|
-
|
|
1682
|
+
vn(f, r, s, t, c, d, u) && p(), Fe(f, r, s, t, i, c, a, u) && p(), Fe(f, r, s, t, i, c, d, u) && p(), Be(f, r, s, t, a, d, i, u) && p(), Be(f, r, s, t, a, d, c, u) && p();
|
|
1694
1683
|
for (let h = a; h < d; h++) {
|
|
1695
1684
|
const b = r.positionAt(h, i, s), w = r.positionAt(h, c, s);
|
|
1696
|
-
|
|
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));
|
|
1697
1686
|
}
|
|
1698
|
-
p(),
|
|
1687
|
+
p(), f.setSelection(new m(f.doc.resolve(t + r.positionAt(a, i, s)), f.doc.resolve(t + r.positionAt(d - 1, c - 1, s)))), e(f);
|
|
1699
1688
|
}
|
|
1700
|
-
const
|
|
1701
|
-
function
|
|
1689
|
+
const En = new F("fix-tables");
|
|
1690
|
+
function nt(o, e, t, n) {
|
|
1702
1691
|
const l = o.childCount, s = e.childCount;
|
|
1703
1692
|
e:
|
|
1704
1693
|
for (let r = 0, a = 0; r < s; r++) {
|
|
@@ -1708,17 +1697,17 @@ function ot(o, e, t, n) {
|
|
|
1708
1697
|
a = c + 1, t += i.nodeSize;
|
|
1709
1698
|
continue e;
|
|
1710
1699
|
}
|
|
1711
|
-
n(i, t), a < l && o.child(a).sameMarkup(i) ?
|
|
1700
|
+
n(i, t), a < l && o.child(a).sameMarkup(i) ? nt(o.child(a), i, t + 1, n) : i.nodesBetween(0, i.content.size, n, t + 1), t += i.nodeSize;
|
|
1712
1701
|
}
|
|
1713
1702
|
}
|
|
1714
|
-
function
|
|
1703
|
+
function In(o, e) {
|
|
1715
1704
|
let t;
|
|
1716
1705
|
const n = (l, s) => {
|
|
1717
|
-
l.type.spec.tableRole == "table" && (t =
|
|
1706
|
+
l.type.spec.tableRole == "table" && (t = $n(o, l, s, t));
|
|
1718
1707
|
};
|
|
1719
|
-
return e ? e.doc != o.doc &&
|
|
1708
|
+
return e ? e.doc != o.doc && nt(e.doc, o.doc, 0, n) : o.doc.descendants(n), t;
|
|
1720
1709
|
}
|
|
1721
|
-
function
|
|
1710
|
+
function $n(o, e, t, n) {
|
|
1722
1711
|
const l = g.get(e);
|
|
1723
1712
|
if (!l.problems)
|
|
1724
1713
|
return n;
|
|
@@ -1730,8 +1719,8 @@ function Bn(o, e, t, n) {
|
|
|
1730
1719
|
const c = l.problems[i];
|
|
1731
1720
|
if (c.type == "collision") {
|
|
1732
1721
|
const d = e.nodeAt(c.pos);
|
|
1733
|
-
for (let
|
|
1734
|
-
s[c.row +
|
|
1722
|
+
for (let f = 0; f < d.attrs.rowspan; f++)
|
|
1723
|
+
s[c.row + f] += c.n;
|
|
1735
1724
|
n.setNodeMarkup(n.mapping.map(t + 1 + c.pos), null, z(d.attrs, d.attrs.colspan - c.n, c.n));
|
|
1736
1725
|
} else if (c.type == "missing")
|
|
1737
1726
|
s[c.row] += c.n;
|
|
@@ -1747,22 +1736,22 @@ function Bn(o, e, t, n) {
|
|
|
1747
1736
|
for (let i = 0; i < s.length; i++)
|
|
1748
1737
|
s[i] && (r == null && (r = i), a = i);
|
|
1749
1738
|
for (let i = 0, c = t + 1; i < l.height; i++) {
|
|
1750
|
-
const d = e.child(i),
|
|
1751
|
-
if (
|
|
1739
|
+
const d = e.child(i), f = c + d.nodeSize, u = s[i];
|
|
1740
|
+
if (u > 0) {
|
|
1752
1741
|
let p = "cell";
|
|
1753
1742
|
d.firstChild && (p = d.firstChild.type.spec.tableRole);
|
|
1754
1743
|
const h = [];
|
|
1755
|
-
for (let w = 0; w <
|
|
1744
|
+
for (let w = 0; w < u; w++)
|
|
1756
1745
|
h.push(A(o.schema)[p].createAndFill());
|
|
1757
|
-
const b = (i == 0 || r == i - 1) && a == i ? c + 1 :
|
|
1746
|
+
const b = (i == 0 || r == i - 1) && a == i ? c + 1 : f - 1;
|
|
1758
1747
|
n.insert(n.mapping.map(b), h);
|
|
1759
1748
|
}
|
|
1760
|
-
c =
|
|
1749
|
+
c = f;
|
|
1761
1750
|
}
|
|
1762
|
-
return n.setMeta(
|
|
1751
|
+
return n.setMeta(En, { fixTables: !0 });
|
|
1763
1752
|
}
|
|
1764
1753
|
const I = new F("selectingCells");
|
|
1765
|
-
function
|
|
1754
|
+
function We(o, e) {
|
|
1766
1755
|
for (; e && e != o.dom; e = e.parentNode)
|
|
1767
1756
|
if (e.nodeName == "TD" || e.nodeName == "TH")
|
|
1768
1757
|
return e;
|
|
@@ -1771,11 +1760,11 @@ function ae(o, e) {
|
|
|
1771
1760
|
const t = o.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
1772
1761
|
return t && t ? U(o.state.doc.resolve(t.pos)) : null;
|
|
1773
1762
|
}
|
|
1774
|
-
function
|
|
1763
|
+
function Dn(o, e) {
|
|
1775
1764
|
const t = e;
|
|
1776
1765
|
if (t.ctrlKey || t.metaKey)
|
|
1777
1766
|
return;
|
|
1778
|
-
const n =
|
|
1767
|
+
const n = We(o, t.target);
|
|
1779
1768
|
let l;
|
|
1780
1769
|
if (t.shiftKey && o.state.selection instanceof m)
|
|
1781
1770
|
s(o.state.selection.$anchorCell, t), t.preventDefault();
|
|
@@ -1785,16 +1774,16 @@ function Pn(o, e) {
|
|
|
1785
1774
|
return;
|
|
1786
1775
|
function s(i, c) {
|
|
1787
1776
|
let d = ae(o, c);
|
|
1788
|
-
const
|
|
1789
|
-
if (!d || !
|
|
1790
|
-
if (
|
|
1777
|
+
const f = I.getState(o.state) == null;
|
|
1778
|
+
if (!d || !Me(i, d))
|
|
1779
|
+
if (f)
|
|
1791
1780
|
d = i;
|
|
1792
1781
|
else
|
|
1793
1782
|
return;
|
|
1794
|
-
const
|
|
1795
|
-
if (
|
|
1796
|
-
const p = o.state.tr.setSelection(
|
|
1797
|
-
|
|
1783
|
+
const u = new m(i, d);
|
|
1784
|
+
if (f || !o.state.selection.eq(u)) {
|
|
1785
|
+
const p = o.state.tr.setSelection(u);
|
|
1786
|
+
f && p.setMeta(I, i.pos), o.dispatch(p);
|
|
1798
1787
|
}
|
|
1799
1788
|
}
|
|
1800
1789
|
function r() {
|
|
@@ -1805,20 +1794,20 @@ function Pn(o, e) {
|
|
|
1805
1794
|
let d;
|
|
1806
1795
|
if (c != null)
|
|
1807
1796
|
d = o.state.doc.resolve(c);
|
|
1808
|
-
else if (
|
|
1797
|
+
else if (We(o, i.target) != n && (d = ae(o, t), !d))
|
|
1809
1798
|
return r();
|
|
1810
1799
|
d && s(d, i);
|
|
1811
1800
|
}
|
|
1812
1801
|
o.root.addEventListener("mouseup", r), o.root.addEventListener("dragstart", r), o.root.addEventListener("mousemove", a);
|
|
1813
1802
|
}
|
|
1814
|
-
function
|
|
1803
|
+
function On(o, e) {
|
|
1815
1804
|
const t = o.state.doc, n = U(t.resolve(e));
|
|
1816
1805
|
return n ? (o.dispatch(o.state.tr.setSelection(new m(n))), !0) : !1;
|
|
1817
1806
|
}
|
|
1818
|
-
function
|
|
1807
|
+
function Z(o, e, t) {
|
|
1819
1808
|
return t.eq(o.selection) ? !1 : (e && e(o.tr.setSelection(t).scrollIntoView()), !0);
|
|
1820
1809
|
}
|
|
1821
|
-
function
|
|
1810
|
+
function ot(o, e, t) {
|
|
1822
1811
|
if (!(o.state.selection instanceof D))
|
|
1823
1812
|
return null;
|
|
1824
1813
|
const { $head: n } = o.state.selection;
|
|
@@ -1833,39 +1822,39 @@ function lt(o, e, t) {
|
|
|
1833
1822
|
}
|
|
1834
1823
|
return null;
|
|
1835
1824
|
}
|
|
1836
|
-
function
|
|
1825
|
+
function G(o, e) {
|
|
1837
1826
|
return (t, n, l) => {
|
|
1838
1827
|
const s = t.selection;
|
|
1839
1828
|
if (s instanceof m)
|
|
1840
|
-
return
|
|
1829
|
+
return Z(t, n, S.near(s.$headCell, e));
|
|
1841
1830
|
if (o != "horiz" && !s.empty)
|
|
1842
1831
|
return !1;
|
|
1843
|
-
const r =
|
|
1832
|
+
const r = ot(l, o, e);
|
|
1844
1833
|
if (r == null)
|
|
1845
1834
|
return !1;
|
|
1846
1835
|
if (o == "horiz")
|
|
1847
|
-
return
|
|
1836
|
+
return Z(t, n, S.near(t.doc.resolve(s.head + e), e));
|
|
1848
1837
|
{
|
|
1849
|
-
const a = t.doc.resolve(r), i =
|
|
1838
|
+
const a = t.doc.resolve(r), i = Qe(a, o, e);
|
|
1850
1839
|
let 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),
|
|
1840
|
+
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), Z(t, n, c);
|
|
1852
1841
|
}
|
|
1853
1842
|
};
|
|
1854
1843
|
}
|
|
1855
|
-
function
|
|
1844
|
+
function J(o, e) {
|
|
1856
1845
|
return (t, n, l) => {
|
|
1857
1846
|
let s = t.selection;
|
|
1858
1847
|
if (!(s instanceof m)) {
|
|
1859
|
-
const a =
|
|
1848
|
+
const a = ot(l, o, e);
|
|
1860
1849
|
if (a == null)
|
|
1861
1850
|
return !1;
|
|
1862
1851
|
s = new m(t.doc.resolve(a));
|
|
1863
1852
|
}
|
|
1864
|
-
const r =
|
|
1865
|
-
return r ?
|
|
1853
|
+
const r = Qe(s.$headCell, o, e);
|
|
1854
|
+
return r ? Z(t, n, new m(s.$anchorCell, r)) : !1;
|
|
1866
1855
|
};
|
|
1867
1856
|
}
|
|
1868
|
-
function
|
|
1857
|
+
function Y(o, e) {
|
|
1869
1858
|
const t = o.selection;
|
|
1870
1859
|
if (!(t instanceof m))
|
|
1871
1860
|
return !1;
|
|
@@ -1877,40 +1866,40 @@ function J(o, e) {
|
|
|
1877
1866
|
}
|
|
1878
1867
|
return !0;
|
|
1879
1868
|
}
|
|
1880
|
-
const
|
|
1881
|
-
ArrowLeft:
|
|
1882
|
-
ArrowRight:
|
|
1883
|
-
ArrowUp:
|
|
1884
|
-
ArrowDown:
|
|
1885
|
-
"Shift-ArrowLeft":
|
|
1886
|
-
"Shift-ArrowRight":
|
|
1887
|
-
"Shift-ArrowUp":
|
|
1888
|
-
"Shift-ArrowDown":
|
|
1889
|
-
Backspace:
|
|
1890
|
-
"Mod-Backspace":
|
|
1891
|
-
Delete:
|
|
1892
|
-
"Mod-Delete":
|
|
1869
|
+
const _n = kt({
|
|
1870
|
+
ArrowLeft: G("horiz", -1),
|
|
1871
|
+
ArrowRight: G("horiz", 1),
|
|
1872
|
+
ArrowUp: G("vert", -1),
|
|
1873
|
+
ArrowDown: G("vert", 1),
|
|
1874
|
+
"Shift-ArrowLeft": J("horiz", -1),
|
|
1875
|
+
"Shift-ArrowRight": J("horiz", 1),
|
|
1876
|
+
"Shift-ArrowUp": J("vert", -1),
|
|
1877
|
+
"Shift-ArrowDown": J("vert", 1),
|
|
1878
|
+
Backspace: Y,
|
|
1879
|
+
"Mod-Backspace": Y,
|
|
1880
|
+
Delete: Y,
|
|
1881
|
+
"Mod-Delete": Y
|
|
1893
1882
|
});
|
|
1894
|
-
function
|
|
1883
|
+
function zn(o, e, t) {
|
|
1895
1884
|
if (!M(o.state))
|
|
1896
1885
|
return !1;
|
|
1897
|
-
let n =
|
|
1886
|
+
let n = Rn(t);
|
|
1898
1887
|
const l = o.state.selection;
|
|
1899
1888
|
if (l instanceof m) {
|
|
1900
1889
|
n || (n = {
|
|
1901
1890
|
width: 1,
|
|
1902
1891
|
height: 1,
|
|
1903
|
-
rows: [E.from(
|
|
1892
|
+
rows: [E.from(ue(A(o.state.schema).cell, t))]
|
|
1904
1893
|
});
|
|
1905
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);
|
|
1906
|
-
return n =
|
|
1895
|
+
return n = Ln(n, a.right - a.left, a.bottom - a.top), Pe(o.state, o.dispatch, r, a, n), !0;
|
|
1907
1896
|
} else if (n) {
|
|
1908
1897
|
const s = ne(o.state), r = s.start(-1);
|
|
1909
|
-
return
|
|
1898
|
+
return Pe(o.state, o.dispatch, r, g.get(s.node(-1)).findCell(s.pos - r), n), !0;
|
|
1910
1899
|
} else
|
|
1911
1900
|
return !1;
|
|
1912
1901
|
}
|
|
1913
|
-
function
|
|
1902
|
+
function Fn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
1914
1903
|
return new W({
|
|
1915
1904
|
key: I,
|
|
1916
1905
|
state: {
|
|
@@ -1928,19 +1917,19 @@ function Kn({ allowTableNodeSelection: o = !1 } = {}) {
|
|
|
1928
1917
|
}
|
|
1929
1918
|
},
|
|
1930
1919
|
props: {
|
|
1931
|
-
decorations:
|
|
1920
|
+
decorations: _t,
|
|
1932
1921
|
handleDOMEvents: {
|
|
1933
|
-
mousedown:
|
|
1922
|
+
mousedown: Dn
|
|
1934
1923
|
},
|
|
1935
1924
|
createSelectionBetween(e) {
|
|
1936
1925
|
return I.getState(e.state) != null ? e.state.selection : null;
|
|
1937
1926
|
},
|
|
1938
|
-
handleTripleClick:
|
|
1939
|
-
handleKeyDown:
|
|
1940
|
-
handlePaste:
|
|
1927
|
+
handleTripleClick: On,
|
|
1928
|
+
handleKeyDown: _n,
|
|
1929
|
+
handlePaste: zn
|
|
1941
1930
|
},
|
|
1942
1931
|
appendTransaction(e, t, n) {
|
|
1943
|
-
return
|
|
1932
|
+
return Bt(n, In(n, t), o);
|
|
1944
1933
|
}
|
|
1945
1934
|
});
|
|
1946
1935
|
}
|
|
@@ -1948,7 +1937,7 @@ const Q = {
|
|
|
1948
1937
|
NextCell: "NextCell",
|
|
1949
1938
|
PrevCell: "PrevCell",
|
|
1950
1939
|
ExitTable: "ExitTable"
|
|
1951
|
-
},
|
|
1940
|
+
}, He = R("PrevCell"), je = R("NextCell"), Ke = R("BreakTable"), Bn = R("InsertTable"), Pn = it((o) => ({
|
|
1952
1941
|
schema: () => ({
|
|
1953
1942
|
node: {
|
|
1954
1943
|
table: {
|
|
@@ -2033,37 +2022,38 @@ const Q = {
|
|
|
2033
2022
|
}
|
|
2034
2023
|
}),
|
|
2035
2024
|
inputRules: (e, t) => [
|
|
2036
|
-
new
|
|
2025
|
+
new Ge(/^\|\|\s$/, (n, l, s, r) => {
|
|
2037
2026
|
const a = n.doc.resolve(s);
|
|
2038
2027
|
if (!a.node(-1).canReplaceWith(a.index(-1), a.indexAfter(-1), e.table))
|
|
2039
2028
|
return null;
|
|
2040
|
-
const i =
|
|
2029
|
+
const i = $e(t.get(re)), c = n.tr.replaceRangeWith(s, r, i).scrollIntoView();
|
|
2041
2030
|
return c.setSelection(D.create(c.doc, s + 3));
|
|
2042
2031
|
})
|
|
2043
2032
|
],
|
|
2044
2033
|
commands: (e, t) => [
|
|
2045
|
-
N(
|
|
2046
|
-
N(
|
|
2047
|
-
N(
|
|
2048
|
-
N(
|
|
2049
|
-
const { selection: s, tr: r } = n, { from: a } = s, i =
|
|
2034
|
+
N(He, () => Ie(-1)),
|
|
2035
|
+
N(je, () => Ie(1)),
|
|
2036
|
+
N(Ke, () => qt(t.get(re).nodes.paragraph)),
|
|
2037
|
+
N(Bn, () => (n, l) => {
|
|
2038
|
+
const { selection: s, tr: r } = n, { from: a } = s, i = $e(t.get(re)), c = r.replaceSelectionWith(i), d = S.findFrom(c.doc.resolve(a), 1, !0);
|
|
2050
2039
|
return d && (l == null || l(c.setSelection(d))), !0;
|
|
2051
2040
|
})
|
|
2052
2041
|
],
|
|
2053
2042
|
shortcuts: {
|
|
2054
|
-
[Q.NextCell]: $(
|
|
2055
|
-
[Q.PrevCell]: $(
|
|
2056
|
-
[Q.ExitTable]: $(
|
|
2043
|
+
[Q.NextCell]: $(je, "Mod-]"),
|
|
2044
|
+
[Q.PrevCell]: $(He, "Mod-["),
|
|
2045
|
+
[Q.ExitTable]: $(Ke, "Mod-Enter")
|
|
2057
2046
|
},
|
|
2058
|
-
prosePlugins: (e, t) => [
|
|
2047
|
+
prosePlugins: (e, t) => [fn(t, o), mn(), wn(), Fn()]
|
|
2059
2048
|
})), K = {
|
|
2060
|
-
...
|
|
2049
|
+
...lt,
|
|
2061
2050
|
...Q,
|
|
2062
2051
|
StrikeThrough: "StrikeThrough",
|
|
2063
2052
|
TaskList: "TaskList"
|
|
2064
|
-
}, pe = R("ToggleStrikeThrough"),
|
|
2065
|
-
id:
|
|
2053
|
+
}, pe = R("ToggleStrikeThrough"), qe = "strike_through", Wn = ct((o) => ({
|
|
2054
|
+
id: qe,
|
|
2066
2055
|
schema: () => ({
|
|
2056
|
+
inclusive: !1,
|
|
2067
2057
|
parseDOM: [
|
|
2068
2058
|
{ tag: "del" },
|
|
2069
2059
|
{ style: "text-decoration", getAttrs: (e) => e === "line-through" }
|
|
@@ -2076,21 +2066,17 @@ const Q = {
|
|
|
2076
2066
|
}
|
|
2077
2067
|
},
|
|
2078
2068
|
toMarkdown: {
|
|
2079
|
-
match: (e) => e.type.name ===
|
|
2069
|
+
match: (e) => e.type.name === qe,
|
|
2080
2070
|
runner: (e, t) => {
|
|
2081
2071
|
e.withMark(t, "delete");
|
|
2082
2072
|
}
|
|
2083
2073
|
}
|
|
2084
2074
|
}),
|
|
2085
|
-
|
|
2086
|
-
Te(/(?:~~)([^~]+)(?:~~)$/, e),
|
|
2087
|
-
Te(/(?:^|[^~])(~([^~]+)~)$/, e)
|
|
2088
|
-
],
|
|
2089
|
-
commands: (e) => [N(pe, () => At(e))],
|
|
2075
|
+
commands: (e) => [N(pe, () => Ct(e))],
|
|
2090
2076
|
shortcuts: {
|
|
2091
2077
|
[K.StrikeThrough]: $(pe, "Mod-Alt-x")
|
|
2092
2078
|
}
|
|
2093
|
-
})), he = R("SplitTaskListItem"), me = R("SinkTaskListItem"), ge = R("LiftTaskListItem"), we = R("TurnIntoTaskList"),
|
|
2079
|
+
})), he = R("SplitTaskListItem"), me = R("SinkTaskListItem"), ge = R("LiftTaskListItem"), we = R("TurnIntoTaskList"), Hn = be((o) => {
|
|
2094
2080
|
const e = "task_list_item";
|
|
2095
2081
|
return {
|
|
2096
2082
|
id: e,
|
|
@@ -2109,7 +2095,7 @@ const Q = {
|
|
|
2109
2095
|
tag: 'li[data-type="task-item"]',
|
|
2110
2096
|
getAttrs: (n) => {
|
|
2111
2097
|
if (!(n instanceof HTMLElement))
|
|
2112
|
-
throw
|
|
2098
|
+
throw Ce(n);
|
|
2113
2099
|
return { checked: n.dataset.checked === "true" };
|
|
2114
2100
|
}
|
|
2115
2101
|
}
|
|
@@ -2128,8 +2114,8 @@ const Q = {
|
|
|
2128
2114
|
const { top: i, left: c } = r.getBoundingClientRect(), d = a.posAtCoords({ top: i, left: c });
|
|
2129
2115
|
if (!d)
|
|
2130
2116
|
return;
|
|
2131
|
-
const { tr:
|
|
2132
|
-
a.dispatch(
|
|
2117
|
+
const { tr: f } = a.state;
|
|
2118
|
+
a.dispatch(f.setNodeMarkup(d.inside, void 0, {
|
|
2133
2119
|
checked: r.checked
|
|
2134
2120
|
}));
|
|
2135
2121
|
}, [
|
|
@@ -2162,10 +2148,10 @@ const Q = {
|
|
|
2162
2148
|
}))
|
|
2163
2149
|
],
|
|
2164
2150
|
commands: (t) => [
|
|
2165
|
-
N(he, () =>
|
|
2166
|
-
N(me, () =>
|
|
2167
|
-
N(ge, () =>
|
|
2168
|
-
N(we, () =>
|
|
2151
|
+
N(he, () => Mt(t)),
|
|
2152
|
+
N(me, () => St(t)),
|
|
2153
|
+
N(ge, () => Nt(t)),
|
|
2154
|
+
N(we, () => yt(t))
|
|
2169
2155
|
],
|
|
2170
2156
|
shortcuts: {
|
|
2171
2157
|
[K.NextListItem]: $(he, "Enter"),
|
|
@@ -2178,8 +2164,8 @@ const Q = {
|
|
|
2178
2164
|
const r = o.themeManager.get("task-list-item", {
|
|
2179
2165
|
editable: () => n.editable,
|
|
2180
2166
|
onChange: (d) => {
|
|
2181
|
-
const { tr:
|
|
2182
|
-
n.dispatch(
|
|
2167
|
+
const { tr: f } = n.state;
|
|
2168
|
+
n.dispatch(f.setNodeMarkup(l(), void 0, {
|
|
2183
2169
|
checked: d
|
|
2184
2170
|
}));
|
|
2185
2171
|
}
|
|
@@ -2194,17 +2180,16 @@ const Q = {
|
|
|
2194
2180
|
};
|
|
2195
2181
|
}
|
|
2196
2182
|
};
|
|
2197
|
-
}),
|
|
2183
|
+
}), oo = at.create([
|
|
2184
|
+
...st,
|
|
2185
|
+
dt(() => ft),
|
|
2186
|
+
Pn(),
|
|
2187
|
+
Wn(),
|
|
2188
|
+
Hn(),
|
|
2189
|
+
Lt(),
|
|
2190
|
+
Rt()
|
|
2191
|
+
]), lo = {
|
|
2198
2192
|
...rt,
|
|
2199
|
-
ft(() => pt),
|
|
2200
|
-
Un(),
|
|
2201
|
-
Et,
|
|
2202
|
-
Xn(),
|
|
2203
|
-
Vn(),
|
|
2204
|
-
Ot(),
|
|
2205
|
-
$t()
|
|
2206
|
-
]), uo = {
|
|
2207
|
-
...it,
|
|
2208
2193
|
ToggleStrikeThrough: pe,
|
|
2209
2194
|
TurnIntoTaskList: we,
|
|
2210
2195
|
SinkTaskListItem: me,
|
|
@@ -2212,62 +2197,62 @@ const Q = {
|
|
|
2212
2197
|
SplitTaskListItem: he
|
|
2213
2198
|
};
|
|
2214
2199
|
export {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2200
|
+
Ke as BreakTable,
|
|
2201
|
+
io as InsertHardbreak,
|
|
2202
|
+
co as InsertHr,
|
|
2203
|
+
ao as InsertImage,
|
|
2204
|
+
Bn as InsertTable,
|
|
2205
|
+
fo as LiftListItem,
|
|
2221
2206
|
ge as LiftTaskListItem,
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2207
|
+
Re as ModifyFootnoteDef,
|
|
2208
|
+
Te as ModifyFootnoteRef,
|
|
2209
|
+
uo as ModifyImage,
|
|
2210
|
+
po as ModifyLink,
|
|
2211
|
+
je as NextCell,
|
|
2212
|
+
He as PrevCell,
|
|
2213
|
+
ho as SinkListItem,
|
|
2229
2214
|
me as SinkTaskListItem,
|
|
2230
|
-
|
|
2215
|
+
mo as SplitListItem,
|
|
2231
2216
|
he as SplitTaskListItem,
|
|
2232
2217
|
K as SupportedKeys,
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2218
|
+
go as ToggleBold,
|
|
2219
|
+
wo as ToggleInlineCode,
|
|
2220
|
+
bo as ToggleItalic,
|
|
2221
|
+
Co as ToggleLink,
|
|
2237
2222
|
pe as ToggleStrikeThrough,
|
|
2238
|
-
|
|
2239
|
-
|
|
2223
|
+
yo as TurnIntoCodeFence,
|
|
2224
|
+
ko as TurnIntoHeading,
|
|
2240
2225
|
we as TurnIntoTaskList,
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2226
|
+
Ao as TurnIntoText,
|
|
2227
|
+
Mo as WrapInBlockquote,
|
|
2228
|
+
So as WrapInBulletList,
|
|
2229
|
+
No as WrapInOrderedList,
|
|
2230
|
+
xo as blockquote,
|
|
2231
|
+
Ro as bulletList,
|
|
2232
|
+
To as codeFence,
|
|
2233
|
+
Lo as codeInline,
|
|
2234
|
+
lo as commands,
|
|
2235
|
+
vo as commonmark,
|
|
2236
|
+
Eo as commonmarkNodes,
|
|
2237
|
+
Io as commonmarkPlugins,
|
|
2238
|
+
$e as createTable,
|
|
2239
|
+
$o as doc,
|
|
2240
|
+
Do as em,
|
|
2241
|
+
Rt as footnoteDefinition,
|
|
2242
|
+
Lt as footnoteReference,
|
|
2243
|
+
oo as gfm,
|
|
2244
|
+
Oo as hardbreak,
|
|
2245
|
+
_o as heading,
|
|
2246
|
+
zo as hr,
|
|
2247
|
+
Fo as image,
|
|
2248
|
+
Bo as link,
|
|
2249
|
+
Po as listItem,
|
|
2250
|
+
Wo as orderedList,
|
|
2251
|
+
Ho as paragraph,
|
|
2252
|
+
Wn as strikeThrough,
|
|
2253
|
+
jo as strong,
|
|
2254
|
+
Pn as table,
|
|
2255
|
+
Hn as taskListItem,
|
|
2256
|
+
Ko as text
|
|
2272
2257
|
};
|
|
2273
2258
|
//# sourceMappingURL=index.es.js.map
|