@opengis/form 0.1.34 → 0.1.36
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/README.md +61 -61
- package/dist/api/suggest/suggestions_list.json +7 -7
- package/dist/{index-B1Lyq79o.js → index-B3dhJa9_.js} +4052 -4052
- package/dist/index-B9CEJ-PZ.js +187 -0
- package/dist/{index-B1zV9Aax.js → index-Bh8_Wx51.js} +434 -477
- package/dist/index-CHHagWDa.js +2794 -0
- package/dist/{index-W4UOw8lU.js → index-CMmJu2Ql.js} +428 -505
- package/dist/{index-RwV1hx3A.js → index-CQZi4RyF.js} +21 -19
- package/dist/index-C_6bjz0U.js +138 -0
- package/dist/index-D3gVZYzr.js +78 -0
- package/dist/index-DJVijc0x.js +47 -0
- package/dist/{index-B3op5uFx.js → index-DQur75TQ.js} +29 -28
- package/dist/{index-sFkGqyu8.js → index-DsT4tZvp.js} +16 -20
- package/dist/{index-qhd_7MCX.js → index-DspmCbXc.js} +16 -20
- package/dist/index-z-RdtcIQ.js +11862 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +86 -86
- package/dist/src/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +1 -1
- package/dist/src/composables/useInputOptions.d.ts +2 -2
- package/dist/src/composables/useInputOptions.d.ts.map +1 -1
- package/dist/src/utils/file.api.d.ts.map +1 -1
- package/dist/{vs-richtext-_Wtyoi3t.js → vs-richtext-K83Az119.js} +22 -22
- package/locales/en.json +39 -39
- package/locales/uk.json +39 -39
- package/package.json +93 -93
- package/dist/index-BIES3-my.js +0 -3085
- package/dist/index-CkUvn8lm.js +0 -153
- package/dist/index-D49VHc9h.js +0 -237
- package/dist/index-DZ7xh8lh.js +0 -50
- package/dist/index-MfTTOwHR.js +0 -89
- package/dist/index-pYkcVgEL.js +0 -12134
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Re, d as se,
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import { P as Re, d as se, S as E, e as Be, T as k, D as Q, f as Z, k as Pe, h as Ie, i as Fe, N as U, j as Oe, l as je, m as B, o as X, E as _e } from "./index-z-RdtcIQ.js";
|
|
2
|
+
import { Fragment as T, Slice as H } from "./index-ietpNeqa.js";
|
|
3
3
|
let ee, te;
|
|
4
4
|
if (typeof WeakMap < "u") {
|
|
5
5
|
let t = /* @__PURE__ */ new WeakMap();
|
|
@@ -82,43 +82,43 @@ function Ve(t) {
|
|
|
82
82
|
for (let a = 0, d = 0; a < n; a++) {
|
|
83
83
|
const f = t.child(a);
|
|
84
84
|
d++;
|
|
85
|
-
for (let
|
|
85
|
+
for (let h = 0; ; h++) {
|
|
86
86
|
for (; l < o.length && o[l] != 0; ) l++;
|
|
87
|
-
if (
|
|
88
|
-
const g = f.child(
|
|
89
|
-
for (let S = 0; S <
|
|
87
|
+
if (h == f.childCount) break;
|
|
88
|
+
const g = f.child(h), { colspan: m, rowspan: w, colwidth: M } = g.attrs;
|
|
89
|
+
for (let S = 0; S < w; S++) {
|
|
90
90
|
if (S + a >= n) {
|
|
91
91
|
(r || (r = [])).push({
|
|
92
92
|
type: "overlong_rowspan",
|
|
93
93
|
pos: d,
|
|
94
|
-
n:
|
|
94
|
+
n: w - S
|
|
95
95
|
});
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
const N = l + S * e;
|
|
99
|
-
for (let
|
|
100
|
-
o[N +
|
|
99
|
+
for (let R = 0; R < m; R++) {
|
|
100
|
+
o[N + R] == 0 ? o[N + R] = d : (r || (r = [])).push({
|
|
101
101
|
type: "collision",
|
|
102
102
|
row: a,
|
|
103
103
|
pos: d,
|
|
104
|
-
n:
|
|
104
|
+
n: m - R
|
|
105
105
|
});
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
Y == null || Y !=
|
|
106
|
+
const I = M && M[R];
|
|
107
|
+
if (I) {
|
|
108
|
+
const D = (N + R) % e * 2, Y = s[D];
|
|
109
|
+
Y == null || Y != I && s[D + 1] == 1 ? (s[D] = I, s[D + 1] = 1) : Y == I && s[D + 1]++;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
l +=
|
|
113
|
+
l += m, d += g.nodeSize;
|
|
114
114
|
}
|
|
115
115
|
const u = (a + 1) * e;
|
|
116
|
-
let
|
|
117
|
-
for (; l < u; ) o[l++] == 0 &&
|
|
118
|
-
|
|
116
|
+
let p = 0;
|
|
117
|
+
for (; l < u; ) o[l++] == 0 && p++;
|
|
118
|
+
p && (r || (r = [])).push({
|
|
119
119
|
type: "missing",
|
|
120
120
|
row: a,
|
|
121
|
-
n:
|
|
121
|
+
n: p
|
|
122
122
|
}), d++;
|
|
123
123
|
}
|
|
124
124
|
(e === 0 || n === 0) && (r || (r = [])).push({ type: "zero_sized" });
|
|
@@ -160,7 +160,7 @@ function Xe(t, e, n) {
|
|
|
160
160
|
const i = s.attrs;
|
|
161
161
|
for (let a = 0; a < i.colspan; a++) {
|
|
162
162
|
const d = e[(l + a) % t.width * 2];
|
|
163
|
-
d != null && (!i.colwidth || i.colwidth[a] != d) && ((c || (c =
|
|
163
|
+
d != null && (!i.colwidth || i.colwidth[a] != d) && ((c || (c = qe(i)))[a] = d);
|
|
164
164
|
}
|
|
165
165
|
c && t.problems.unshift({
|
|
166
166
|
type: "colwidth mismatch",
|
|
@@ -169,13 +169,13 @@ function Xe(t, e, n) {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function qe(t) {
|
|
173
173
|
if (t.colwidth) return t.colwidth.slice();
|
|
174
174
|
const e = [];
|
|
175
175
|
for (let n = 0; n < t.colspan; n++) e.push(0);
|
|
176
176
|
return e;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function y(t) {
|
|
179
179
|
let e = t.cached.tableNodeTypes;
|
|
180
180
|
if (!e) {
|
|
181
181
|
e = t.cached.tableNodeTypes = {};
|
|
@@ -186,12 +186,12 @@ function A(t) {
|
|
|
186
186
|
}
|
|
187
187
|
return e;
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
function
|
|
189
|
+
const L = new se("selectingCells");
|
|
190
|
+
function $(t) {
|
|
191
191
|
for (let e = t.depth - 1; e > 0; e--) if (t.node(e).type.spec.tableRole == "row") return t.node(0).resolve(t.before(e + 1));
|
|
192
192
|
return null;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Ue(t) {
|
|
195
195
|
for (let e = t.depth; e > 0; e--) {
|
|
196
196
|
const n = t.node(e).type.spec.tableRole;
|
|
197
197
|
if (n === "cell" || n === "header_cell") return t.node(e);
|
|
@@ -207,7 +207,7 @@ function J(t) {
|
|
|
207
207
|
const e = t.selection;
|
|
208
208
|
if ("$anchorCell" in e && e.$anchorCell) return e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell;
|
|
209
209
|
if ("node" in e && e.node && e.node.type.spec.tableRole == "cell") return e.$anchor;
|
|
210
|
-
const n =
|
|
210
|
+
const n = $(e.$head) || Je(e.$head);
|
|
211
211
|
if (n) return n;
|
|
212
212
|
throw new RangeError(`No cell found around position ${e.head}`);
|
|
213
213
|
}
|
|
@@ -230,18 +230,18 @@ function Ye(t) {
|
|
|
230
230
|
function ie(t, e) {
|
|
231
231
|
return t.depth == e.depth && t.pos >= e.start(-1) && t.pos <= e.end(-1);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function xe(t, e, n) {
|
|
234
234
|
const o = t.node(-1), l = C.get(o), r = t.start(-1), s = l.nextCell(t.pos - r, e, n);
|
|
235
235
|
return s == null ? null : t.node(0).resolve(r + s);
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function W(t, e, n = 1) {
|
|
238
238
|
const o = {
|
|
239
239
|
...t,
|
|
240
240
|
colspan: t.colspan - n
|
|
241
241
|
};
|
|
242
242
|
return o.colwidth && (o.colwidth = o.colwidth.slice(), o.colwidth.splice(e, n), o.colwidth.some((l) => l > 0) || (o.colwidth = null)), o;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Te(t, e, n = 1) {
|
|
245
245
|
const o = {
|
|
246
246
|
...t,
|
|
247
247
|
colspan: t.colspan + n
|
|
@@ -253,11 +253,11 @@ function xe(t, e, n = 1) {
|
|
|
253
253
|
return o;
|
|
254
254
|
}
|
|
255
255
|
function Ge(t, e, n) {
|
|
256
|
-
const o =
|
|
256
|
+
const o = y(e.type.schema).header_cell;
|
|
257
257
|
for (let l = 0; l < t.height; l++) if (e.nodeAt(t.map[n + l * t.width]).type != o) return !1;
|
|
258
258
|
return !0;
|
|
259
259
|
}
|
|
260
|
-
var b = class z extends
|
|
260
|
+
var b = class z extends E {
|
|
261
261
|
constructor(e, n = e) {
|
|
262
262
|
const o = e.node(-1), l = C.get(o), r = e.start(-1), s = l.rectBetween(e.pos - r, n.pos - r), c = e.node(0), i = l.cellsInRect(s).filter((d) => d != n.pos - r);
|
|
263
263
|
i.unshift(n.pos - r);
|
|
@@ -265,7 +265,7 @@ var b = class z extends k {
|
|
|
265
265
|
const f = o.nodeAt(d);
|
|
266
266
|
if (!f) throw new RangeError(`No cell with offset ${d} found`);
|
|
267
267
|
const u = r + d + 1;
|
|
268
|
-
return new
|
|
268
|
+
return new Be(c.resolve(u), c.resolve(u + f.content.size));
|
|
269
269
|
});
|
|
270
270
|
super(a[0].$from, a[0].$to, a), this.$anchorCell = e, this.$headCell = n;
|
|
271
271
|
}
|
|
@@ -275,7 +275,7 @@ var b = class z extends k {
|
|
|
275
275
|
const r = this.$anchorCell.node(-1) != o.node(-1);
|
|
276
276
|
return r && this.isRowSelection() ? z.rowSelection(o, l) : r && this.isColSelection() ? z.colSelection(o, l) : new z(o, l);
|
|
277
277
|
}
|
|
278
|
-
return
|
|
278
|
+
return k.between(o, l);
|
|
279
279
|
}
|
|
280
280
|
content() {
|
|
281
281
|
const e = this.$anchorCell.node(-1), n = C.get(e), o = this.$anchorCell.start(-1), l = n.rectBetween(this.$anchorCell.pos - o, this.$headCell.pos - o), r = {}, s = [];
|
|
@@ -285,41 +285,41 @@ var b = class z extends k {
|
|
|
285
285
|
const u = n.map[d];
|
|
286
286
|
if (r[u]) continue;
|
|
287
287
|
r[u] = !0;
|
|
288
|
-
const
|
|
289
|
-
let
|
|
290
|
-
if (!
|
|
291
|
-
const g = l.left -
|
|
292
|
-
if (g > 0 ||
|
|
293
|
-
let
|
|
294
|
-
if (g > 0 && (
|
|
295
|
-
if (
|
|
296
|
-
} else
|
|
288
|
+
const p = n.findCell(u);
|
|
289
|
+
let h = e.nodeAt(u);
|
|
290
|
+
if (!h) throw new RangeError(`No cell with offset ${u} found`);
|
|
291
|
+
const g = l.left - p.left, m = p.right - l.right;
|
|
292
|
+
if (g > 0 || m > 0) {
|
|
293
|
+
let w = h.attrs;
|
|
294
|
+
if (g > 0 && (w = W(w, 0, g)), m > 0 && (w = W(w, w.colspan - m, m)), p.left < l.left) {
|
|
295
|
+
if (h = h.type.createAndFill(w), !h) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`);
|
|
296
|
+
} else h = h.type.create(w, h.content);
|
|
297
297
|
}
|
|
298
|
-
if (
|
|
299
|
-
const
|
|
300
|
-
...
|
|
301
|
-
rowspan: Math.min(
|
|
298
|
+
if (p.top < l.top || p.bottom > l.bottom) {
|
|
299
|
+
const w = {
|
|
300
|
+
...h.attrs,
|
|
301
|
+
rowspan: Math.min(p.bottom, l.bottom) - Math.max(p.top, l.top)
|
|
302
302
|
};
|
|
303
|
-
|
|
303
|
+
p.top < l.top ? h = h.type.createAndFill(w) : h = h.type.create(w, h.content);
|
|
304
304
|
}
|
|
305
|
-
a.push(
|
|
305
|
+
a.push(h);
|
|
306
306
|
}
|
|
307
|
-
s.push(e.child(i).copy(
|
|
307
|
+
s.push(e.child(i).copy(T.from(a)));
|
|
308
308
|
}
|
|
309
309
|
const c = this.isColSelection() && this.isRowSelection() ? e : s;
|
|
310
|
-
return new
|
|
310
|
+
return new H(T.from(c), 1, 1);
|
|
311
311
|
}
|
|
312
|
-
replace(e, n =
|
|
312
|
+
replace(e, n = H.empty) {
|
|
313
313
|
const o = e.steps.length, l = this.ranges;
|
|
314
314
|
for (let s = 0; s < l.length; s++) {
|
|
315
315
|
const { $from: c, $to: i } = l[s], a = e.mapping.slice(o);
|
|
316
|
-
e.replace(a.map(c.pos), a.map(i.pos), s ?
|
|
316
|
+
e.replace(a.map(c.pos), a.map(i.pos), s ? H.empty : n);
|
|
317
317
|
}
|
|
318
|
-
const r =
|
|
318
|
+
const r = E.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)), -1);
|
|
319
319
|
r && e.setSelection(r);
|
|
320
320
|
}
|
|
321
321
|
replaceWith(e, n) {
|
|
322
|
-
this.replace(e, new
|
|
322
|
+
this.replace(e, new H(T.from(n), 0, 0));
|
|
323
323
|
}
|
|
324
324
|
forEachCell(e) {
|
|
325
325
|
const n = this.$anchorCell.node(-1), o = C.get(n), l = this.$anchorCell.start(-1), r = o.cellsInRect(o.rectBetween(this.$anchorCell.pos - l, this.$headCell.pos - l));
|
|
@@ -366,17 +366,17 @@ var b = class z extends k {
|
|
|
366
366
|
}
|
|
367
367
|
};
|
|
368
368
|
b.prototype.visible = !1;
|
|
369
|
-
|
|
370
|
-
var Qe = class
|
|
369
|
+
E.jsonID("cell", b);
|
|
370
|
+
var Qe = class ve {
|
|
371
371
|
constructor(e, n) {
|
|
372
372
|
this.anchor = e, this.head = n;
|
|
373
373
|
}
|
|
374
374
|
map(e) {
|
|
375
|
-
return new
|
|
375
|
+
return new ve(e.map(this.anchor), e.map(this.head));
|
|
376
376
|
}
|
|
377
377
|
resolve(e) {
|
|
378
378
|
const n = e.resolve(this.anchor), o = e.resolve(this.head);
|
|
379
|
-
return n.parent.type.spec.tableRole == "row" && o.parent.type.spec.tableRole == "row" && n.index() < n.parent.childCount && o.index() < o.parent.childCount && ie(n, o) ? new b(n, o) :
|
|
379
|
+
return n.parent.type.spec.tableRole == "row" && o.parent.type.spec.tableRole == "row" && n.index() < n.parent.childCount && o.index() < o.parent.childCount && ie(n, o) ? new b(n, o) : E.near(o, 1);
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
function Ze(t) {
|
|
@@ -423,11 +423,11 @@ function nt(t, e, n) {
|
|
|
423
423
|
const c = C.get(o.node), i = o.from + 1, a = i + c.map[c.width * c.height - 1];
|
|
424
424
|
r = b.create(l, i + 1, a);
|
|
425
425
|
}
|
|
426
|
-
} else o instanceof
|
|
426
|
+
} else o instanceof k && et(o) ? r = k.create(l, o.from) : o instanceof k && tt(o) && (r = k.create(l, o.$from.start(), o.$from.end()));
|
|
427
427
|
return r && (e || (e = t.tr)).setSelection(r), e;
|
|
428
428
|
}
|
|
429
429
|
const ot = new se("fix-tables");
|
|
430
|
-
function
|
|
430
|
+
function Me(t, e, n, o) {
|
|
431
431
|
const l = t.childCount, r = e.childCount;
|
|
432
432
|
e: for (let s = 0, c = 0; s < r; s++) {
|
|
433
433
|
const i = e.child(s);
|
|
@@ -435,7 +435,7 @@ function ve(t, e, n, o) {
|
|
|
435
435
|
c = a + 1, n += i.nodeSize;
|
|
436
436
|
continue e;
|
|
437
437
|
}
|
|
438
|
-
o(i, n), c < l && t.child(c).sameMarkup(i) ?
|
|
438
|
+
o(i, n), c < l && t.child(c).sameMarkup(i) ? Me(t.child(c), i, n + 1, o) : i.nodesBetween(0, i.content.size, o, n + 1), n += i.nodeSize;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
function Ne(t, e) {
|
|
@@ -443,7 +443,7 @@ function Ne(t, e) {
|
|
|
443
443
|
const o = (l, r) => {
|
|
444
444
|
l.type.spec.tableRole == "table" && (n = lt(t, l, r, n));
|
|
445
445
|
};
|
|
446
|
-
return e ? e.doc != t.doc &&
|
|
446
|
+
return e ? e.doc != t.doc && Me(e.doc, t.doc, 0, o) : t.doc.descendants(o), n;
|
|
447
447
|
}
|
|
448
448
|
function lt(t, e, n, o) {
|
|
449
449
|
const l = C.get(e);
|
|
@@ -458,7 +458,7 @@ function lt(t, e, n, o) {
|
|
|
458
458
|
if (!d) continue;
|
|
459
459
|
const f = d.attrs;
|
|
460
460
|
for (let u = 0; u < f.rowspan; u++) r[a.row + u] += a.n;
|
|
461
|
-
o.setNodeMarkup(o.mapping.map(n + 1 + a.pos), null,
|
|
461
|
+
o.setNodeMarkup(o.mapping.map(n + 1 + a.pos), null, W(f, f.colspan - a.n, a.n));
|
|
462
462
|
} else if (a.type == "missing") r[a.row] += a.n;
|
|
463
463
|
else if (a.type == "overlong_rowspan") {
|
|
464
464
|
const d = e.nodeAt(a.pos);
|
|
@@ -484,15 +484,15 @@ function lt(t, e, n, o) {
|
|
|
484
484
|
for (let i = 0, a = n + 1; i < l.height; i++) {
|
|
485
485
|
const d = e.child(i), f = a + d.nodeSize, u = r[i];
|
|
486
486
|
if (u > 0) {
|
|
487
|
-
let
|
|
488
|
-
d.firstChild && (
|
|
489
|
-
const
|
|
490
|
-
for (let
|
|
491
|
-
const
|
|
492
|
-
|
|
487
|
+
let p = "cell";
|
|
488
|
+
d.firstChild && (p = d.firstChild.type.spec.tableRole);
|
|
489
|
+
const h = [];
|
|
490
|
+
for (let m = 0; m < u; m++) {
|
|
491
|
+
const w = y(t.schema)[p].createAndFill();
|
|
492
|
+
w && h.push(w);
|
|
493
493
|
}
|
|
494
494
|
const g = (i == 0 || s == i - 1) && c == i ? a + 1 : f - 1;
|
|
495
|
-
o.insert(o.mapping.map(g),
|
|
495
|
+
o.insert(o.mapping.map(g), h);
|
|
496
496
|
}
|
|
497
497
|
a = f;
|
|
498
498
|
}
|
|
@@ -514,9 +514,9 @@ function ze(t, { map: e, tableStart: n, table: o }, l) {
|
|
|
514
514
|
const c = s * e.width + l;
|
|
515
515
|
if (l > 0 && l < e.width && e.map[c - 1] == e.map[c]) {
|
|
516
516
|
const i = e.map[c], a = o.nodeAt(i);
|
|
517
|
-
t.setNodeMarkup(t.mapping.map(n + i), null,
|
|
517
|
+
t.setNodeMarkup(t.mapping.map(n + i), null, Te(a.attrs, l - e.colCount(i))), s += a.attrs.rowspan - 1;
|
|
518
518
|
} else {
|
|
519
|
-
const i = r == null ?
|
|
519
|
+
const i = r == null ? y(o.type.schema).cell : o.nodeAt(e.map[c + r]).type, a = e.positionAt(s, l, o);
|
|
520
520
|
t.insert(t.mapping.map(n + a), i.createAndFill());
|
|
521
521
|
}
|
|
522
522
|
}
|
|
@@ -542,7 +542,7 @@ function it(t, { map: e, table: n, tableStart: o }, l) {
|
|
|
542
542
|
const r = t.mapping.maps.length;
|
|
543
543
|
for (let s = 0; s < e.height; ) {
|
|
544
544
|
const c = s * e.width + l, i = e.map[c], a = n.nodeAt(i), d = a.attrs;
|
|
545
|
-
if (l > 0 && e.map[c - 1] == i || l < e.width - 1 && e.map[c + 1] == i) t.setNodeMarkup(t.mapping.slice(r).map(o + i), null,
|
|
545
|
+
if (l > 0 && e.map[c - 1] == i || l < e.width - 1 && e.map[c + 1] == i) t.setNodeMarkup(t.mapping.slice(r).map(o + i), null, W(d, l - e.colCount(i)));
|
|
546
546
|
else {
|
|
547
547
|
const f = t.mapping.slice(r).map(o + i);
|
|
548
548
|
t.delete(f, f + a.nodeSize);
|
|
@@ -566,11 +566,11 @@ function ct(t, e) {
|
|
|
566
566
|
}
|
|
567
567
|
function at(t, e, n) {
|
|
568
568
|
var o;
|
|
569
|
-
const l =
|
|
569
|
+
const l = y(e.type.schema).header_cell;
|
|
570
570
|
for (let r = 0; r < t.width; r++) if (((o = e.nodeAt(t.map[r + n * t.width])) === null || o === void 0 ? void 0 : o.type) != l) return !1;
|
|
571
571
|
return !0;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Ee(t, { map: e, tableStart: n, table: o }, l) {
|
|
574
574
|
let r = n;
|
|
575
575
|
for (let a = 0; a < l; a++) r += o.child(a).nodeSize;
|
|
576
576
|
const s = [];
|
|
@@ -584,16 +584,16 @@ function ke(t, { map: e, tableStart: n, table: o }, l) {
|
|
|
584
584
|
}), a += u.colspan - 1;
|
|
585
585
|
} else {
|
|
586
586
|
var i;
|
|
587
|
-
const f = c == null ?
|
|
587
|
+
const f = c == null ? y(o.type.schema).cell : (i = o.nodeAt(e.map[d + c * e.width])) === null || i === void 0 ? void 0 : i.type, u = f?.createAndFill();
|
|
588
588
|
u && s.push(u);
|
|
589
589
|
}
|
|
590
|
-
return t.insert(r,
|
|
590
|
+
return t.insert(r, y(o.type.schema).row.create(null, s)), t;
|
|
591
591
|
}
|
|
592
592
|
function dt(t, e) {
|
|
593
593
|
if (!x(t)) return !1;
|
|
594
594
|
if (e) {
|
|
595
595
|
const n = v(t);
|
|
596
|
-
e(
|
|
596
|
+
e(Ee(t.tr, n, n.top));
|
|
597
597
|
}
|
|
598
598
|
return !0;
|
|
599
599
|
}
|
|
@@ -601,7 +601,7 @@ function ft(t, e) {
|
|
|
601
601
|
if (!x(t)) return !1;
|
|
602
602
|
if (e) {
|
|
603
603
|
const n = v(t);
|
|
604
|
-
e(
|
|
604
|
+
e(Ee(t.tr, n, n.bottom));
|
|
605
605
|
}
|
|
606
606
|
return !0;
|
|
607
607
|
}
|
|
@@ -621,11 +621,11 @@ function ut(t, { map: e, table: n, tableStart: o }, l) {
|
|
|
621
621
|
rowspan: u.rowspan - 1
|
|
622
622
|
}), a += u.colspan - 1;
|
|
623
623
|
} else if (l < e.height && f == e.map[d + e.width]) {
|
|
624
|
-
const u = n.nodeAt(f),
|
|
625
|
-
...
|
|
624
|
+
const u = n.nodeAt(f), p = u.attrs, h = u.type.create({
|
|
625
|
+
...p,
|
|
626
626
|
rowspan: u.attrs.rowspan - 1
|
|
627
627
|
}, u.content), g = e.positionAt(l + 1, a, n);
|
|
628
|
-
t.insert(t.mapping.slice(c).map(o + g),
|
|
628
|
+
t.insert(t.mapping.slice(c).map(o + g), h), a += p.colspan - 1;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
631
|
}
|
|
@@ -667,21 +667,21 @@ function ae(t, e) {
|
|
|
667
667
|
if (pt(l, o)) return !1;
|
|
668
668
|
if (e) {
|
|
669
669
|
const r = t.tr, s = {};
|
|
670
|
-
let c =
|
|
670
|
+
let c = T.empty, i, a;
|
|
671
671
|
for (let d = o.top; d < o.bottom; d++) for (let f = o.left; f < o.right; f++) {
|
|
672
|
-
const u = l.map[d * l.width + f],
|
|
673
|
-
if (!(s[u] || !
|
|
672
|
+
const u = l.map[d * l.width + f], p = o.table.nodeAt(u);
|
|
673
|
+
if (!(s[u] || !p))
|
|
674
674
|
if (s[u] = !0, i == null)
|
|
675
|
-
i = u, a =
|
|
675
|
+
i = u, a = p;
|
|
676
676
|
else {
|
|
677
|
-
ce(
|
|
678
|
-
const
|
|
679
|
-
r.delete(
|
|
677
|
+
ce(p) || (c = c.append(p.content));
|
|
678
|
+
const h = r.mapping.map(u + o.tableStart);
|
|
679
|
+
r.delete(h, h + p.nodeSize);
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
if (i == null || a == null) return !0;
|
|
683
683
|
if (r.setNodeMarkup(i + o.tableStart, null, {
|
|
684
|
-
...
|
|
684
|
+
...Te(a.attrs, a.attrs.colspan, o.right - o.left - a.attrs.colspan),
|
|
685
685
|
rowspan: o.bottom - o.top
|
|
686
686
|
}), c.size > 0) {
|
|
687
687
|
const d = i + 1 + a.content.size, f = ce(a) ? i + 1 : d;
|
|
@@ -692,7 +692,7 @@ function ae(t, e) {
|
|
|
692
692
|
return !0;
|
|
693
693
|
}
|
|
694
694
|
function de(t, e) {
|
|
695
|
-
const n =
|
|
695
|
+
const n = y(t.schema);
|
|
696
696
|
return mt(({ node: o }) => n[o.type.spec.tableRole])(t, e);
|
|
697
697
|
}
|
|
698
698
|
function mt(t) {
|
|
@@ -704,8 +704,8 @@ function mt(t) {
|
|
|
704
704
|
l = o.$anchorCell.nodeAfter, r = o.$anchorCell.pos;
|
|
705
705
|
} else {
|
|
706
706
|
var s;
|
|
707
|
-
if (l =
|
|
708
|
-
r = (s =
|
|
707
|
+
if (l = Ue(o.$from), !l) return !1;
|
|
708
|
+
r = (s = $(o.$from)) === null || s === void 0 ? void 0 : s.pos;
|
|
709
709
|
}
|
|
710
710
|
if (l == null || r == null || l.attrs.colspan == 1 && l.attrs.rowspan == 1) return !1;
|
|
711
711
|
if (n) {
|
|
@@ -719,20 +719,20 @@ function mt(t) {
|
|
|
719
719
|
colspan: 1
|
|
720
720
|
});
|
|
721
721
|
const d = v(e), f = e.tr;
|
|
722
|
-
for (let
|
|
722
|
+
for (let p = 0; p < d.right - d.left; p++) i.push(a ? {
|
|
723
723
|
...c,
|
|
724
|
-
colwidth: a && a[
|
|
724
|
+
colwidth: a && a[p] ? [a[p]] : null
|
|
725
725
|
} : c);
|
|
726
726
|
let u;
|
|
727
|
-
for (let
|
|
728
|
-
let
|
|
729
|
-
|
|
730
|
-
for (let g = d.left,
|
|
731
|
-
g == d.left &&
|
|
727
|
+
for (let p = d.top; p < d.bottom; p++) {
|
|
728
|
+
let h = d.map.positionAt(p, d.left, d.table);
|
|
729
|
+
p == d.top && (h += l.nodeSize);
|
|
730
|
+
for (let g = d.left, m = 0; g < d.right; g++, m++)
|
|
731
|
+
g == d.left && p == d.top || f.insert(u = f.mapping.map(h + d.tableStart, 1), t({
|
|
732
732
|
node: l,
|
|
733
|
-
row:
|
|
733
|
+
row: p,
|
|
734
734
|
col: g
|
|
735
|
-
}).createAndFill(i[
|
|
735
|
+
}).createAndFill(i[m]));
|
|
736
736
|
}
|
|
737
737
|
f.setNodeMarkup(r, t({
|
|
738
738
|
node: l,
|
|
@@ -767,7 +767,7 @@ function wt(t) {
|
|
|
767
767
|
return function(e, n) {
|
|
768
768
|
if (!x(e)) return !1;
|
|
769
769
|
if (n) {
|
|
770
|
-
const o =
|
|
770
|
+
const o = y(e.schema), l = v(e), r = e.tr, s = l.map.cellsInRect(t == "column" ? {
|
|
771
771
|
left: l.left,
|
|
772
772
|
top: 0,
|
|
773
773
|
right: l.right,
|
|
@@ -798,11 +798,11 @@ function fe(t, e, n) {
|
|
|
798
798
|
}
|
|
799
799
|
return !0;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function P(t, e) {
|
|
802
802
|
return e = e || { useDeprecatedLogic: !1 }, e.useDeprecatedLogic ? wt(t) : function(n, o) {
|
|
803
803
|
if (!x(n)) return !1;
|
|
804
804
|
if (o) {
|
|
805
|
-
const l =
|
|
805
|
+
const l = y(n.schema), r = v(n), s = n.tr, c = fe("row", r, l), i = fe("column", r, l), a = (t === "column" ? c : t === "row" && i) ? 1 : 0, d = t == "column" ? {
|
|
806
806
|
left: 0,
|
|
807
807
|
top: a,
|
|
808
808
|
right: 1,
|
|
@@ -814,16 +814,16 @@ function I(t, e) {
|
|
|
814
814
|
bottom: 1
|
|
815
815
|
} : r, f = t == "column" ? i ? l.cell : l.header_cell : t == "row" ? c ? l.cell : l.header_cell : l.cell;
|
|
816
816
|
r.map.cellsInRect(d).forEach((u) => {
|
|
817
|
-
const
|
|
818
|
-
|
|
817
|
+
const p = u + r.tableStart, h = s.doc.nodeAt(p);
|
|
818
|
+
h && s.setNodeMarkup(p, f, h.attrs);
|
|
819
819
|
}), o(s);
|
|
820
820
|
}
|
|
821
821
|
return !0;
|
|
822
822
|
};
|
|
823
823
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
const bt =
|
|
824
|
+
P("row", { useDeprecatedLogic: !0 });
|
|
825
|
+
P("column", { useDeprecatedLogic: !0 });
|
|
826
|
+
const bt = P("cell", { useDeprecatedLogic: !0 });
|
|
827
827
|
function Ct(t, e) {
|
|
828
828
|
if (e < 0) {
|
|
829
829
|
const n = t.nodeBefore;
|
|
@@ -851,7 +851,7 @@ function ue(t) {
|
|
|
851
851
|
if (o == null) return !1;
|
|
852
852
|
if (n) {
|
|
853
853
|
const l = e.doc.resolve(o);
|
|
854
|
-
n(e.tr.setSelection(
|
|
854
|
+
n(e.tr.setSelection(k.between(l, Ye(l))).scrollIntoView());
|
|
855
855
|
}
|
|
856
856
|
return !0;
|
|
857
857
|
};
|
|
@@ -862,13 +862,13 @@ function yt(t, e) {
|
|
|
862
862
|
return e && e(t.tr.delete(n.before(o), n.after(o)).scrollIntoView()), !0;
|
|
863
863
|
return !1;
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function F(t, e) {
|
|
866
866
|
const n = t.selection;
|
|
867
867
|
if (!(n instanceof b)) return !1;
|
|
868
868
|
if (e) {
|
|
869
|
-
const o = t.tr, l =
|
|
869
|
+
const o = t.tr, l = y(t.schema).cell.createAndFill().content;
|
|
870
870
|
n.forEachCell((r, s) => {
|
|
871
|
-
r.content.eq(l) || o.replace(o.mapping.map(s + 1), o.mapping.map(s + r.nodeSize - 1), new
|
|
871
|
+
r.content.eq(l) || o.replace(o.mapping.map(s + 1), o.mapping.map(s + r.nodeSize - 1), new H(l, 0, 0));
|
|
872
872
|
}), o.docChanged && e(o);
|
|
873
873
|
}
|
|
874
874
|
return !0;
|
|
@@ -882,9 +882,9 @@ function At(t) {
|
|
|
882
882
|
if (r == "row") for (let i = 0; i < e.childCount; i++) {
|
|
883
883
|
let a = e.child(i).content;
|
|
884
884
|
const d = i ? 0 : Math.max(0, n - 1), f = i < e.childCount - 1 ? 0 : Math.max(0, o - 1);
|
|
885
|
-
(d || f) && (a = oe(
|
|
885
|
+
(d || f) && (a = oe(y(s).row, new H(a, d, f)).content), c.push(a);
|
|
886
886
|
}
|
|
887
|
-
else if (r == "cell" || r == "header_cell") c.push(n || o ? oe(
|
|
887
|
+
else if (r == "cell" || r == "header_cell") c.push(n || o ? oe(y(s).row, new H(e, n, o)).content : e);
|
|
888
888
|
else return null;
|
|
889
889
|
return St(s, c);
|
|
890
890
|
}
|
|
@@ -900,10 +900,10 @@ function St(t, e) {
|
|
|
900
900
|
let o = 0;
|
|
901
901
|
for (let l = 0; l < n.length; l++) o = Math.max(o, n[l]);
|
|
902
902
|
for (let l = 0; l < n.length; l++)
|
|
903
|
-
if (l >= e.length && e.push(
|
|
904
|
-
const r =
|
|
903
|
+
if (l >= e.length && e.push(T.empty), n[l] < o) {
|
|
904
|
+
const r = y(t).cell.createAndFill(), s = [];
|
|
905
905
|
for (let c = n[l]; c < o; c++) s.push(r);
|
|
906
|
-
e[l] = e[l].append(
|
|
906
|
+
e[l] = e[l].append(T.from(s));
|
|
907
907
|
}
|
|
908
908
|
return {
|
|
909
909
|
height: e.length,
|
|
@@ -913,7 +913,7 @@ function St(t, e) {
|
|
|
913
913
|
}
|
|
914
914
|
function oe(t, e) {
|
|
915
915
|
const n = t.createAndFill();
|
|
916
|
-
return new
|
|
916
|
+
return new Fe(n).replace(0, n.content.size, e).doc;
|
|
917
917
|
}
|
|
918
918
|
function Rt({ width: t, height: e, rows: n }, o, l) {
|
|
919
919
|
if (t != o) {
|
|
@@ -922,10 +922,10 @@ function Rt({ width: t, height: e, rows: n }, o, l) {
|
|
|
922
922
|
const i = n[c], a = [];
|
|
923
923
|
for (let d = r[c] || 0, f = 0; d < o; f++) {
|
|
924
924
|
let u = i.child(f % i.childCount);
|
|
925
|
-
d + u.attrs.colspan > o && (u = u.type.createChecked(
|
|
926
|
-
for (let
|
|
925
|
+
d + u.attrs.colspan > o && (u = u.type.createChecked(W(u.attrs, u.attrs.colspan, d + u.attrs.colspan - o), u.content)), a.push(u), d += u.attrs.colspan;
|
|
926
|
+
for (let p = 1; p < u.attrs.rowspan; p++) r[c + p] = (r[c + p] || 0) + u.attrs.colspan;
|
|
927
927
|
}
|
|
928
|
-
s.push(
|
|
928
|
+
s.push(T.from(a));
|
|
929
929
|
}
|
|
930
930
|
n = s, t = o;
|
|
931
931
|
}
|
|
@@ -940,7 +940,7 @@ function Rt({ width: t, height: e, rows: n }, o, l) {
|
|
|
940
940
|
rowspan: Math.max(1, l - f.attrs.rowspan)
|
|
941
941
|
}, f.content)), i.push(f);
|
|
942
942
|
}
|
|
943
|
-
r.push(
|
|
943
|
+
r.push(T.from(i));
|
|
944
944
|
}
|
|
945
945
|
n = r, e = l;
|
|
946
946
|
}
|
|
@@ -950,27 +950,27 @@ function Rt({ width: t, height: e, rows: n }, o, l) {
|
|
|
950
950
|
rows: n
|
|
951
951
|
};
|
|
952
952
|
}
|
|
953
|
-
function
|
|
954
|
-
const c = t.doc.type.schema, i =
|
|
953
|
+
function xt(t, e, n, o, l, r, s) {
|
|
954
|
+
const c = t.doc.type.schema, i = y(c);
|
|
955
955
|
let a, d;
|
|
956
956
|
if (l > e.width) for (let f = 0, u = 0; f < e.height; f++) {
|
|
957
|
-
const
|
|
958
|
-
u +=
|
|
959
|
-
const
|
|
957
|
+
const p = n.child(f);
|
|
958
|
+
u += p.nodeSize;
|
|
959
|
+
const h = [];
|
|
960
960
|
let g;
|
|
961
|
-
|
|
962
|
-
for (let
|
|
963
|
-
t.insert(t.mapping.slice(s).map(u - 1 + o),
|
|
961
|
+
p.lastChild == null || p.lastChild.type == i.cell ? g = a || (a = i.cell.createAndFill()) : g = d || (d = i.header_cell.createAndFill());
|
|
962
|
+
for (let m = e.width; m < l; m++) h.push(g);
|
|
963
|
+
t.insert(t.mapping.slice(s).map(u - 1 + o), h);
|
|
964
964
|
}
|
|
965
965
|
if (r > e.height) {
|
|
966
966
|
const f = [];
|
|
967
|
-
for (let
|
|
968
|
-
const
|
|
969
|
-
f.push(
|
|
967
|
+
for (let h = 0, g = (e.height - 1) * e.width; h < Math.max(e.width, l); h++) {
|
|
968
|
+
const m = h >= e.width ? !1 : n.nodeAt(e.map[g + h]).type == i.header_cell;
|
|
969
|
+
f.push(m ? d || (d = i.header_cell.createAndFill()) : a || (a = i.cell.createAndFill()));
|
|
970
970
|
}
|
|
971
|
-
const u = i.row.create(null,
|
|
972
|
-
for (let
|
|
973
|
-
t.insert(t.mapping.slice(s).map(o + n.nodeSize - 2),
|
|
971
|
+
const u = i.row.create(null, T.from(f)), p = [];
|
|
972
|
+
for (let h = e.height; h < r; h++) p.push(u);
|
|
973
|
+
t.insert(t.mapping.slice(s).map(o + n.nodeSize - 2), p);
|
|
974
974
|
}
|
|
975
975
|
return !!(a || d);
|
|
976
976
|
}
|
|
@@ -981,13 +981,13 @@ function he(t, e, n, o, l, r, s, c) {
|
|
|
981
981
|
const d = s * e.width + a, f = e.map[d];
|
|
982
982
|
if (e.map[d - e.width] == f) {
|
|
983
983
|
i = !0;
|
|
984
|
-
const u = n.nodeAt(f), { top:
|
|
984
|
+
const u = n.nodeAt(f), { top: p, left: h } = e.findCell(f);
|
|
985
985
|
t.setNodeMarkup(t.mapping.slice(c).map(f + o), null, {
|
|
986
986
|
...u.attrs,
|
|
987
|
-
rowspan: s -
|
|
988
|
-
}), t.insert(t.mapping.slice(c).map(e.positionAt(s,
|
|
987
|
+
rowspan: s - p
|
|
988
|
+
}), t.insert(t.mapping.slice(c).map(e.positionAt(s, h, n)), u.type.createAndFill({
|
|
989
989
|
...u.attrs,
|
|
990
|
-
rowspan:
|
|
990
|
+
rowspan: p + u.attrs.rowspan - s
|
|
991
991
|
})), a += u.attrs.colspan - 1;
|
|
992
992
|
}
|
|
993
993
|
}
|
|
@@ -1000,8 +1000,8 @@ function pe(t, e, n, o, l, r, s, c) {
|
|
|
1000
1000
|
const d = a * e.width + s, f = e.map[d];
|
|
1001
1001
|
if (e.map[d - 1] == f) {
|
|
1002
1002
|
i = !0;
|
|
1003
|
-
const u = n.nodeAt(f),
|
|
1004
|
-
t.setNodeMarkup(
|
|
1003
|
+
const u = n.nodeAt(f), p = e.colCount(f), h = t.mapping.slice(c).map(f + o);
|
|
1004
|
+
t.setNodeMarkup(h, null, W(u.attrs, s - p, u.attrs.colspan - (s - p))), t.insert(h + u.nodeSize, u.type.createAndFill(W(u.attrs, 0, s - p))), a += u.attrs.rowspan - 1;
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
return i;
|
|
@@ -1012,30 +1012,30 @@ function me(t, e, n, o, l) {
|
|
|
1012
1012
|
let s = C.get(r);
|
|
1013
1013
|
const { top: c, left: i } = o, a = i + l.width, d = c + l.height, f = t.tr;
|
|
1014
1014
|
let u = 0;
|
|
1015
|
-
function
|
|
1015
|
+
function p() {
|
|
1016
1016
|
if (r = n ? f.doc.nodeAt(n - 1) : f.doc, !r) throw new Error("No table found");
|
|
1017
1017
|
s = C.get(r), u = f.mapping.maps.length;
|
|
1018
1018
|
}
|
|
1019
|
-
|
|
1020
|
-
for (let
|
|
1021
|
-
const g = s.positionAt(
|
|
1022
|
-
f.replace(f.mapping.slice(u).map(g + n), f.mapping.slice(u).map(
|
|
1019
|
+
xt(f, s, r, n, a, d, u) && p(), he(f, s, r, n, i, a, c, u) && p(), he(f, s, r, n, i, a, d, u) && p(), pe(f, s, r, n, c, d, i, u) && p(), pe(f, s, r, n, c, d, a, u) && p();
|
|
1020
|
+
for (let h = c; h < d; h++) {
|
|
1021
|
+
const g = s.positionAt(h, i, r), m = s.positionAt(h, a, r);
|
|
1022
|
+
f.replace(f.mapping.slice(u).map(g + n), f.mapping.slice(u).map(m + n), new H(l.rows[h - c], 0, 0));
|
|
1023
1023
|
}
|
|
1024
|
-
|
|
1024
|
+
p(), f.setSelection(new b(f.doc.resolve(n + s.positionAt(c, i, r)), f.doc.resolve(n + s.positionAt(d - 1, a - 1, r)))), e(f);
|
|
1025
1025
|
}
|
|
1026
|
-
const
|
|
1026
|
+
const Tt = Pe({
|
|
1027
1027
|
ArrowLeft: O("horiz", -1),
|
|
1028
1028
|
ArrowRight: O("horiz", 1),
|
|
1029
1029
|
ArrowUp: O("vert", -1),
|
|
1030
1030
|
ArrowDown: O("vert", 1),
|
|
1031
|
-
"Shift-ArrowLeft":
|
|
1032
|
-
"Shift-ArrowRight":
|
|
1033
|
-
"Shift-ArrowUp":
|
|
1034
|
-
"Shift-ArrowDown":
|
|
1035
|
-
Backspace:
|
|
1036
|
-
"Mod-Backspace":
|
|
1037
|
-
Delete:
|
|
1038
|
-
"Mod-Delete":
|
|
1031
|
+
"Shift-ArrowLeft": j("horiz", -1),
|
|
1032
|
+
"Shift-ArrowRight": j("horiz", 1),
|
|
1033
|
+
"Shift-ArrowUp": j("vert", -1),
|
|
1034
|
+
"Shift-ArrowDown": j("vert", 1),
|
|
1035
|
+
Backspace: F,
|
|
1036
|
+
"Mod-Backspace": F,
|
|
1037
|
+
Delete: F,
|
|
1038
|
+
"Mod-Delete": F
|
|
1039
1039
|
});
|
|
1040
1040
|
function V(t, e, n) {
|
|
1041
1041
|
return n.eq(t.selection) ? !1 : (e && e(t.tr.setSelection(n).scrollIntoView()), !0);
|
|
@@ -1044,38 +1044,38 @@ function O(t, e) {
|
|
|
1044
1044
|
return (n, o, l) => {
|
|
1045
1045
|
if (!l) return !1;
|
|
1046
1046
|
const r = n.selection;
|
|
1047
|
-
if (r instanceof b) return V(n, o,
|
|
1047
|
+
if (r instanceof b) return V(n, o, E.near(r.$headCell, e));
|
|
1048
1048
|
if (t != "horiz" && !r.empty) return !1;
|
|
1049
|
-
const s =
|
|
1049
|
+
const s = ke(l, t, e);
|
|
1050
1050
|
if (s == null) return !1;
|
|
1051
|
-
if (t == "horiz") return V(n, o,
|
|
1051
|
+
if (t == "horiz") return V(n, o, E.near(n.doc.resolve(r.head + e), e));
|
|
1052
1052
|
{
|
|
1053
|
-
const c = n.doc.resolve(s), i =
|
|
1053
|
+
const c = n.doc.resolve(s), i = xe(c, t, e);
|
|
1054
1054
|
let a;
|
|
1055
|
-
return i ? a =
|
|
1055
|
+
return i ? a = E.near(i, 1) : e < 0 ? a = E.near(n.doc.resolve(c.before(-1)), -1) : a = E.near(n.doc.resolve(c.after(-1)), 1), V(n, o, a);
|
|
1056
1056
|
}
|
|
1057
1057
|
};
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function j(t, e) {
|
|
1060
1060
|
return (n, o, l) => {
|
|
1061
1061
|
if (!l) return !1;
|
|
1062
1062
|
const r = n.selection;
|
|
1063
1063
|
let s;
|
|
1064
1064
|
if (r instanceof b) s = r;
|
|
1065
1065
|
else {
|
|
1066
|
-
const i =
|
|
1066
|
+
const i = ke(l, t, e);
|
|
1067
1067
|
if (i == null) return !1;
|
|
1068
1068
|
s = new b(n.doc.resolve(i));
|
|
1069
1069
|
}
|
|
1070
|
-
const c =
|
|
1070
|
+
const c = xe(s.$headCell, t, e);
|
|
1071
1071
|
return c ? V(n, o, new b(s.$anchorCell, c)) : !1;
|
|
1072
1072
|
};
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const n = t.state.doc, o =
|
|
1074
|
+
function vt(t, e) {
|
|
1075
|
+
const n = t.state.doc, o = $(n.resolve(e));
|
|
1076
1076
|
return o ? (t.dispatch(t.state.tr.setSelection(new b(o))), !0) : !1;
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Mt(t, e, n) {
|
|
1079
1079
|
if (!x(t.state)) return !1;
|
|
1080
1080
|
let o = At(n);
|
|
1081
1081
|
const l = t.state.selection;
|
|
@@ -1083,7 +1083,7 @@ function vt(t, e, n) {
|
|
|
1083
1083
|
o || (o = {
|
|
1084
1084
|
width: 1,
|
|
1085
1085
|
height: 1,
|
|
1086
|
-
rows: [
|
|
1086
|
+
rows: [T.from(oe(y(t.state.schema).cell, n))]
|
|
1087
1087
|
});
|
|
1088
1088
|
const r = l.$anchorCell.node(-1), s = l.$anchorCell.start(-1), c = C.get(r).rectBetween(l.$anchorCell.pos - s, l.$headCell.pos - s);
|
|
1089
1089
|
return o = Rt(o, c.right - c.left, c.bottom - c.top), me(t.state, t.dispatch, s, c, o), !0;
|
|
@@ -1099,25 +1099,25 @@ function Nt(t, e) {
|
|
|
1099
1099
|
let l;
|
|
1100
1100
|
if (e.shiftKey && t.state.selection instanceof b)
|
|
1101
1101
|
r(t.state.selection.$anchorCell, e), e.preventDefault();
|
|
1102
|
-
else if (e.shiftKey && o && (l =
|
|
1102
|
+
else if (e.shiftKey && o && (l = $(t.state.selection.$anchor)) != null && ((n = G(t, e)) === null || n === void 0 ? void 0 : n.pos) != l.pos)
|
|
1103
1103
|
r(l, e), e.preventDefault();
|
|
1104
1104
|
else if (!o) return;
|
|
1105
1105
|
function r(i, a) {
|
|
1106
1106
|
let d = G(t, a);
|
|
1107
|
-
const f =
|
|
1107
|
+
const f = L.getState(t.state) == null;
|
|
1108
1108
|
if (!d || !ie(i, d)) if (f) d = i;
|
|
1109
1109
|
else return;
|
|
1110
1110
|
const u = new b(i, d);
|
|
1111
1111
|
if (f || !t.state.selection.eq(u)) {
|
|
1112
|
-
const
|
|
1113
|
-
f &&
|
|
1112
|
+
const p = t.state.tr.setSelection(u);
|
|
1113
|
+
f && p.setMeta(L, i.pos), t.dispatch(p);
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
1116
|
function s() {
|
|
1117
|
-
t.root.removeEventListener("mouseup", s), t.root.removeEventListener("dragstart", s), t.root.removeEventListener("mousemove", c),
|
|
1117
|
+
t.root.removeEventListener("mouseup", s), t.root.removeEventListener("dragstart", s), t.root.removeEventListener("mousemove", c), L.getState(t.state) != null && t.dispatch(t.state.tr.setMeta(L, -1));
|
|
1118
1118
|
}
|
|
1119
1119
|
function c(i) {
|
|
1120
|
-
const a = i, d =
|
|
1120
|
+
const a = i, d = L.getState(t.state);
|
|
1121
1121
|
let f;
|
|
1122
1122
|
if (d != null) f = t.state.doc.resolve(d);
|
|
1123
1123
|
else if (ge(t, a.target) != o && (f = G(t, e), !f))
|
|
@@ -1126,8 +1126,8 @@ function Nt(t, e) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
t.root.addEventListener("mouseup", s), t.root.addEventListener("dragstart", s), t.root.addEventListener("mousemove", c);
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
if (!(t.state.selection instanceof
|
|
1129
|
+
function ke(t, e, n) {
|
|
1130
|
+
if (!(t.state.selection instanceof k)) return null;
|
|
1131
1131
|
const { $head: o } = t.state.selection;
|
|
1132
1132
|
for (let l = o.depth - 1; l >= 0; l--) {
|
|
1133
1133
|
const r = o.node(l);
|
|
@@ -1150,7 +1150,7 @@ function G(t, e) {
|
|
|
1150
1150
|
});
|
|
1151
1151
|
if (!n) return null;
|
|
1152
1152
|
let { inside: o, pos: l } = n;
|
|
1153
|
-
return o >= 0 &&
|
|
1153
|
+
return o >= 0 && $(t.state.doc.resolve(o)) || $(t.state.doc.resolve(l));
|
|
1154
1154
|
}
|
|
1155
1155
|
var zt = class {
|
|
1156
1156
|
constructor(e, n) {
|
|
@@ -1168,14 +1168,14 @@ function le(t, e, n, o, l, r) {
|
|
|
1168
1168
|
const a = t.firstChild;
|
|
1169
1169
|
if (a) {
|
|
1170
1170
|
for (let f = 0, u = 0; f < a.childCount; f++) {
|
|
1171
|
-
const { colspan:
|
|
1172
|
-
for (let g = 0; g <
|
|
1173
|
-
const
|
|
1174
|
-
if (s +=
|
|
1175
|
-
i.style.width !=
|
|
1171
|
+
const { colspan: p, colwidth: h } = a.child(f).attrs;
|
|
1172
|
+
for (let g = 0; g < p; g++, u++) {
|
|
1173
|
+
const m = l == u ? r : h && h[g], w = m ? m + "px" : "";
|
|
1174
|
+
if (s += m || o, m || (c = !1), i)
|
|
1175
|
+
i.style.width != w && (i.style.width = w), i = i.nextSibling;
|
|
1176
1176
|
else {
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1177
|
+
const M = document.createElement("col");
|
|
1178
|
+
M.style.width = w, e.appendChild(M);
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
@@ -1187,15 +1187,15 @@ function le(t, e, n, o, l, r) {
|
|
|
1187
1187
|
c ? (n.style.width = s + "px", n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = s + "px");
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
|
-
const
|
|
1191
|
-
function
|
|
1190
|
+
const A = new se("tableColumnResizing");
|
|
1191
|
+
function Et({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: n = 100, View: o = zt, lastColumnResizable: l = !0 } = {}) {
|
|
1192
1192
|
const r = new Re({
|
|
1193
|
-
key:
|
|
1193
|
+
key: A,
|
|
1194
1194
|
state: {
|
|
1195
1195
|
init(s, c) {
|
|
1196
1196
|
var i;
|
|
1197
|
-
const a = (i = r.spec) === null || i === void 0 || (i = i.props) === null || i === void 0 ? void 0 : i.nodeViews, d =
|
|
1198
|
-
return o && a && (a[d] = (f, u) => new o(f, n, u)), new
|
|
1197
|
+
const a = (i = r.spec) === null || i === void 0 || (i = i.props) === null || i === void 0 ? void 0 : i.nodeViews, d = y(c.schema).table.name;
|
|
1198
|
+
return o && a && (a[d] = (f, u) => new o(f, n, u)), new kt(-1, !1);
|
|
1199
1199
|
},
|
|
1200
1200
|
apply(s, c) {
|
|
1201
1201
|
return c.apply(s);
|
|
@@ -1203,22 +1203,22 @@ function kt({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: n =
|
|
|
1203
1203
|
},
|
|
1204
1204
|
props: {
|
|
1205
1205
|
attributes: (s) => {
|
|
1206
|
-
const c =
|
|
1206
|
+
const c = A.getState(s);
|
|
1207
1207
|
return c && c.activeHandle > -1 ? { class: "resize-cursor" } : {};
|
|
1208
1208
|
},
|
|
1209
1209
|
handleDOMEvents: {
|
|
1210
1210
|
mousemove: (s, c) => {
|
|
1211
|
-
|
|
1211
|
+
Lt(s, c, t, l);
|
|
1212
1212
|
},
|
|
1213
1213
|
mouseleave: (s) => {
|
|
1214
|
-
|
|
1214
|
+
Ht(s);
|
|
1215
1215
|
},
|
|
1216
1216
|
mousedown: (s, c) => {
|
|
1217
1217
|
$t(s, c, e, n);
|
|
1218
1218
|
}
|
|
1219
1219
|
},
|
|
1220
1220
|
decorations: (s) => {
|
|
1221
|
-
const c =
|
|
1221
|
+
const c = A.getState(s);
|
|
1222
1222
|
if (c && c.activeHandle > -1) return It(s, c.activeHandle);
|
|
1223
1223
|
},
|
|
1224
1224
|
nodeViews: {}
|
|
@@ -1226,12 +1226,12 @@ function kt({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: n =
|
|
|
1226
1226
|
});
|
|
1227
1227
|
return r;
|
|
1228
1228
|
}
|
|
1229
|
-
var
|
|
1229
|
+
var kt = class K {
|
|
1230
1230
|
constructor(e, n) {
|
|
1231
1231
|
this.activeHandle = e, this.dragging = n;
|
|
1232
1232
|
}
|
|
1233
1233
|
apply(e) {
|
|
1234
|
-
const n = this, o = e.getMeta(
|
|
1234
|
+
const n = this, o = e.getMeta(A);
|
|
1235
1235
|
if (o && o.setHandle != null) return new K(o.setHandle, !1);
|
|
1236
1236
|
if (o && o.setDragging !== void 0) return new K(n.activeHandle, o.setDragging);
|
|
1237
1237
|
if (n.activeHandle > -1 && e.docChanged) {
|
|
@@ -1241,9 +1241,9 @@ var Et = class K {
|
|
|
1241
1241
|
return n;
|
|
1242
1242
|
}
|
|
1243
1243
|
};
|
|
1244
|
-
function
|
|
1244
|
+
function Lt(t, e, n, o) {
|
|
1245
1245
|
if (!t.editable) return;
|
|
1246
|
-
const l =
|
|
1246
|
+
const l = A.getState(t.state);
|
|
1247
1247
|
if (l && !l.dragging) {
|
|
1248
1248
|
const r = Dt(e.target);
|
|
1249
1249
|
let s = -1;
|
|
@@ -1256,36 +1256,36 @@ function Ht(t, e, n, o) {
|
|
|
1256
1256
|
const c = t.state.doc.resolve(s), i = c.node(-1), a = C.get(i), d = c.start(-1);
|
|
1257
1257
|
if (a.colCount(c.pos - d) + c.nodeAfter.attrs.colspan - 1 == a.width - 1) return;
|
|
1258
1258
|
}
|
|
1259
|
-
|
|
1259
|
+
Le(t, s);
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function Ht(t) {
|
|
1264
1264
|
if (!t.editable) return;
|
|
1265
|
-
const e =
|
|
1266
|
-
e && e.activeHandle > -1 && !e.dragging &&
|
|
1265
|
+
const e = A.getState(t.state);
|
|
1266
|
+
e && e.activeHandle > -1 && !e.dragging && Le(t, -1);
|
|
1267
1267
|
}
|
|
1268
1268
|
function $t(t, e, n, o) {
|
|
1269
1269
|
var l;
|
|
1270
1270
|
if (!t.editable) return !1;
|
|
1271
|
-
const r = (l = t.dom.ownerDocument.defaultView) !== null && l !== void 0 ? l : window, s =
|
|
1271
|
+
const r = (l = t.dom.ownerDocument.defaultView) !== null && l !== void 0 ? l : window, s = A.getState(t.state);
|
|
1272
1272
|
if (!s || s.activeHandle == -1 || s.dragging) return !1;
|
|
1273
1273
|
const c = t.state.doc.nodeAt(s.activeHandle), i = Wt(t, s.activeHandle, c.attrs);
|
|
1274
|
-
t.dispatch(t.state.tr.setMeta(
|
|
1274
|
+
t.dispatch(t.state.tr.setMeta(A, { setDragging: {
|
|
1275
1275
|
startX: e.clientX,
|
|
1276
1276
|
startWidth: i
|
|
1277
1277
|
} }));
|
|
1278
1278
|
function a(f) {
|
|
1279
1279
|
r.removeEventListener("mouseup", a), r.removeEventListener("mousemove", d);
|
|
1280
|
-
const u =
|
|
1281
|
-
u?.dragging && (Bt(t, u.activeHandle, be(u.dragging, f, n)), t.dispatch(t.state.tr.setMeta(
|
|
1280
|
+
const u = A.getState(t.state);
|
|
1281
|
+
u?.dragging && (Bt(t, u.activeHandle, be(u.dragging, f, n)), t.dispatch(t.state.tr.setMeta(A, { setDragging: null })));
|
|
1282
1282
|
}
|
|
1283
1283
|
function d(f) {
|
|
1284
1284
|
if (!f.which) return a(f);
|
|
1285
|
-
const u =
|
|
1285
|
+
const u = A.getState(t.state);
|
|
1286
1286
|
if (u && u.dragging) {
|
|
1287
|
-
const
|
|
1288
|
-
Ce(t, u.activeHandle,
|
|
1287
|
+
const p = be(u.dragging, f, n);
|
|
1288
|
+
Ce(t, u.activeHandle, p, o);
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
return Ce(t, s.activeHandle, i, o), r.addEventListener("mouseup", a), r.addEventListener("mousemove", d), e.preventDefault(), !0;
|
|
@@ -1309,7 +1309,7 @@ function we(t, e, n, o) {
|
|
|
1309
1309
|
top: e.clientY
|
|
1310
1310
|
});
|
|
1311
1311
|
if (!r) return -1;
|
|
1312
|
-
const { pos: s } = r, c =
|
|
1312
|
+
const { pos: s } = r, c = $(t.state.doc.resolve(s));
|
|
1313
1313
|
if (!c) return -1;
|
|
1314
1314
|
if (n == "right") return c.pos;
|
|
1315
1315
|
const i = C.get(c.node(-1)), a = c.start(-1), d = i.map.indexOf(c.pos - a);
|
|
@@ -1319,20 +1319,20 @@ function be(t, e, n) {
|
|
|
1319
1319
|
const o = e.clientX - t.startX;
|
|
1320
1320
|
return Math.max(n, t.startWidth + o);
|
|
1321
1321
|
}
|
|
1322
|
-
function
|
|
1323
|
-
t.dispatch(t.state.tr.setMeta(
|
|
1322
|
+
function Le(t, e) {
|
|
1323
|
+
t.dispatch(t.state.tr.setMeta(A, { setHandle: e }));
|
|
1324
1324
|
}
|
|
1325
1325
|
function Bt(t, e, n) {
|
|
1326
1326
|
const o = t.state.doc.resolve(e), l = o.node(-1), r = C.get(l), s = o.start(-1), c = r.colCount(o.pos - s) + o.nodeAfter.attrs.colspan - 1, i = t.state.tr;
|
|
1327
1327
|
for (let a = 0; a < r.height; a++) {
|
|
1328
1328
|
const d = a * r.width + c;
|
|
1329
1329
|
if (a && r.map[d] == r.map[d - r.width]) continue;
|
|
1330
|
-
const f = r.map[d], u = l.nodeAt(f).attrs,
|
|
1331
|
-
if (u.colwidth && u.colwidth[
|
|
1332
|
-
const
|
|
1333
|
-
p
|
|
1330
|
+
const f = r.map[d], u = l.nodeAt(f).attrs, p = u.colspan == 1 ? 0 : c - r.colCount(f);
|
|
1331
|
+
if (u.colwidth && u.colwidth[p] == n) continue;
|
|
1332
|
+
const h = u.colwidth ? u.colwidth.slice() : Pt(u.colspan);
|
|
1333
|
+
h[p] = n, i.setNodeMarkup(s + f, null, {
|
|
1334
1334
|
...u,
|
|
1335
|
-
colwidth:
|
|
1335
|
+
colwidth: h
|
|
1336
1336
|
});
|
|
1337
1337
|
}
|
|
1338
1338
|
i.docChanged && t.dispatch(i);
|
|
@@ -1354,21 +1354,21 @@ function It(t, e) {
|
|
|
1354
1354
|
const d = c + a * r.width;
|
|
1355
1355
|
if ((c == r.width - 1 || r.map[d] != r.map[d + 1]) && (a == 0 || r.map[d] != r.map[d - r.width])) {
|
|
1356
1356
|
var i;
|
|
1357
|
-
const f = r.map[d], u = s + f + l.nodeAt(f).nodeSize - 1,
|
|
1358
|
-
|
|
1357
|
+
const f = r.map[d], u = s + f + l.nodeAt(f).nodeSize - 1, p = document.createElement("div");
|
|
1358
|
+
p.className = "column-resize-handle", !((i = A.getState(t)) === null || i === void 0) && i.dragging && n.push(Z.node(s + f, s + f + l.nodeAt(f).nodeSize, { class: "column-resize-dragging" })), n.push(Z.widget(u, p));
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
1361
|
return Q.create(t.doc, n);
|
|
1362
1362
|
}
|
|
1363
|
-
function
|
|
1363
|
+
function Ft({ allowTableNodeSelection: t = !1 } = {}) {
|
|
1364
1364
|
return new Re({
|
|
1365
|
-
key:
|
|
1365
|
+
key: L,
|
|
1366
1366
|
state: {
|
|
1367
1367
|
init() {
|
|
1368
1368
|
return null;
|
|
1369
1369
|
},
|
|
1370
1370
|
apply(e, n) {
|
|
1371
|
-
const o = e.getMeta(
|
|
1371
|
+
const o = e.getMeta(L);
|
|
1372
1372
|
if (o != null) return o == -1 ? null : o;
|
|
1373
1373
|
if (n == null || !e.docChanged) return n;
|
|
1374
1374
|
const { deleted: l, pos: r } = e.mapping.mapResult(n);
|
|
@@ -1379,143 +1379,125 @@ function _t({ allowTableNodeSelection: t = !1 } = {}) {
|
|
|
1379
1379
|
decorations: Ze,
|
|
1380
1380
|
handleDOMEvents: { mousedown: Nt },
|
|
1381
1381
|
createSelectionBetween(e) {
|
|
1382
|
-
return
|
|
1382
|
+
return L.getState(e.state) != null ? e.state.selection : null;
|
|
1383
1383
|
},
|
|
1384
|
-
handleTripleClick:
|
|
1385
|
-
handleKeyDown:
|
|
1386
|
-
handlePaste:
|
|
1384
|
+
handleTripleClick: vt,
|
|
1385
|
+
handleKeyDown: Tt,
|
|
1386
|
+
handlePaste: Mt
|
|
1387
1387
|
},
|
|
1388
1388
|
appendTransaction(e, n, o) {
|
|
1389
1389
|
return nt(o, Ne(o, n), t);
|
|
1390
1390
|
}
|
|
1391
1391
|
});
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1393
|
+
function q(t) {
|
|
1394
1394
|
return t === "left" || t === "right" || t === "center" ? t : null;
|
|
1395
1395
|
}
|
|
1396
1396
|
function Ot(t) {
|
|
1397
1397
|
const e = (t.style.textAlign || "").trim().toLowerCase(), n = (t.getAttribute("align") || "").trim().toLowerCase();
|
|
1398
|
-
return
|
|
1398
|
+
return q(e || n);
|
|
1399
1399
|
}
|
|
1400
|
-
function
|
|
1401
|
-
return
|
|
1400
|
+
function jt(t) {
|
|
1401
|
+
return q(t?.align);
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1403
|
+
function He() {
|
|
1404
1404
|
return {
|
|
1405
1405
|
default: null,
|
|
1406
1406
|
parseHTML: (t) => Ot(t),
|
|
1407
|
-
renderHTML: (t) => t.align ? {
|
|
1408
|
-
style: `text-align: ${t.align}`
|
|
1409
|
-
} : {}
|
|
1407
|
+
renderHTML: (t) => t.align ? { style: `text-align: ${t.align}` } : {}
|
|
1410
1408
|
};
|
|
1411
1409
|
}
|
|
1412
|
-
function
|
|
1410
|
+
function _t(t) {
|
|
1413
1411
|
var e;
|
|
1414
1412
|
const n = t.parentElement, o = t.closest("table");
|
|
1415
|
-
if (!n || !o)
|
|
1416
|
-
|
|
1417
|
-
const l = Array.from(n.children).indexOf(t), r = (e = o.querySelectorAll("colgroup > col")[l]) == null ? void 0 : e.getAttribute("width");
|
|
1413
|
+
if (!n || !o) return null;
|
|
1414
|
+
const l = Array.from(n.children).indexOf(t), r = (e = o.querySelectorAll("colgroup > col")[l]) === null || e === void 0 ? void 0 : e.getAttribute("width");
|
|
1418
1415
|
return r ? [parseInt(r, 10)] : null;
|
|
1419
1416
|
}
|
|
1420
1417
|
function $e(t) {
|
|
1421
1418
|
const e = t.getAttribute("colwidth");
|
|
1422
|
-
return e ? e.split(",").map((n) => parseInt(n, 10)) :
|
|
1419
|
+
return e ? e.split(",").map((n) => parseInt(n, 10)) : _t(t);
|
|
1423
1420
|
}
|
|
1424
|
-
|
|
1421
|
+
const Vt = /[ \t\r\n\f]+/g;
|
|
1425
1422
|
function We(t) {
|
|
1426
1423
|
var e;
|
|
1427
|
-
return t.children.length > 0 ? !1 : ((e = t.textContent)
|
|
1424
|
+
return t.children.length > 0 ? !1 : ((e = t.textContent) !== null && e !== void 0 ? e : "").replace(Vt, "") === "";
|
|
1428
1425
|
}
|
|
1429
1426
|
function De(t) {
|
|
1430
1427
|
const e = t.createAndFill();
|
|
1431
|
-
if (!e)
|
|
1432
|
-
throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);
|
|
1428
|
+
if (!e) throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);
|
|
1433
1429
|
return e.content;
|
|
1434
1430
|
}
|
|
1435
|
-
|
|
1431
|
+
const Kt = U.create({
|
|
1436
1432
|
name: "tableCell",
|
|
1437
1433
|
addOptions() {
|
|
1438
|
-
return {
|
|
1439
|
-
HTMLAttributes: {}
|
|
1440
|
-
};
|
|
1434
|
+
return { HTMLAttributes: {} };
|
|
1441
1435
|
},
|
|
1442
1436
|
content: "block+",
|
|
1443
1437
|
addAttributes() {
|
|
1444
1438
|
return {
|
|
1445
|
-
colspan: {
|
|
1446
|
-
|
|
1447
|
-
},
|
|
1448
|
-
rowspan: {
|
|
1449
|
-
default: 1
|
|
1450
|
-
},
|
|
1439
|
+
colspan: { default: 1 },
|
|
1440
|
+
rowspan: { default: 1 },
|
|
1451
1441
|
colwidth: {
|
|
1452
1442
|
default: null,
|
|
1453
1443
|
parseHTML: $e
|
|
1454
1444
|
},
|
|
1455
|
-
align:
|
|
1445
|
+
align: He()
|
|
1456
1446
|
};
|
|
1457
1447
|
},
|
|
1458
1448
|
tableRole: "cell",
|
|
1459
1449
|
isolating: !0,
|
|
1460
1450
|
parseHTML() {
|
|
1461
|
-
return [
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
getContent: (t, e) => De(e.nodes[this.name])
|
|
1467
|
-
},
|
|
1468
|
-
{ tag: "td" }
|
|
1469
|
-
];
|
|
1451
|
+
return [{
|
|
1452
|
+
tag: "td",
|
|
1453
|
+
getAttrs: (t) => We(t) ? {} : !1,
|
|
1454
|
+
getContent: (t, e) => De(e.nodes[this.name])
|
|
1455
|
+
}, { tag: "td" }];
|
|
1470
1456
|
},
|
|
1471
1457
|
renderHTML({ HTMLAttributes: t }) {
|
|
1472
|
-
return [
|
|
1458
|
+
return [
|
|
1459
|
+
"td",
|
|
1460
|
+
B(this.options.HTMLAttributes, t),
|
|
1461
|
+
0
|
|
1462
|
+
];
|
|
1473
1463
|
}
|
|
1474
|
-
}), Xt =
|
|
1464
|
+
}), Xt = U.create({
|
|
1475
1465
|
name: "tableHeader",
|
|
1476
1466
|
addOptions() {
|
|
1477
|
-
return {
|
|
1478
|
-
HTMLAttributes: {}
|
|
1479
|
-
};
|
|
1467
|
+
return { HTMLAttributes: {} };
|
|
1480
1468
|
},
|
|
1481
1469
|
content: "block+",
|
|
1482
1470
|
addAttributes() {
|
|
1483
1471
|
return {
|
|
1484
|
-
colspan: {
|
|
1485
|
-
|
|
1486
|
-
},
|
|
1487
|
-
rowspan: {
|
|
1488
|
-
default: 1
|
|
1489
|
-
},
|
|
1472
|
+
colspan: { default: 1 },
|
|
1473
|
+
rowspan: { default: 1 },
|
|
1490
1474
|
colwidth: {
|
|
1491
1475
|
default: null,
|
|
1492
1476
|
parseHTML: $e
|
|
1493
1477
|
},
|
|
1494
|
-
align:
|
|
1478
|
+
align: He()
|
|
1495
1479
|
};
|
|
1496
1480
|
},
|
|
1497
1481
|
tableRole: "header_cell",
|
|
1498
1482
|
isolating: !0,
|
|
1499
1483
|
parseHTML() {
|
|
1500
|
-
return [
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
getContent: (t, e) => De(e.nodes[this.name])
|
|
1506
|
-
},
|
|
1507
|
-
{ tag: "th" }
|
|
1508
|
-
];
|
|
1484
|
+
return [{
|
|
1485
|
+
tag: "th",
|
|
1486
|
+
getAttrs: (t) => We(t) ? {} : !1,
|
|
1487
|
+
getContent: (t, e) => De(e.nodes[this.name])
|
|
1488
|
+
}, { tag: "th" }];
|
|
1509
1489
|
},
|
|
1510
1490
|
renderHTML({ HTMLAttributes: t }) {
|
|
1511
|
-
return [
|
|
1491
|
+
return [
|
|
1492
|
+
"th",
|
|
1493
|
+
B(this.options.HTMLAttributes, t),
|
|
1494
|
+
0
|
|
1495
|
+
];
|
|
1512
1496
|
}
|
|
1513
|
-
}),
|
|
1497
|
+
}), qt = U.create({
|
|
1514
1498
|
name: "tableRow",
|
|
1515
1499
|
addOptions() {
|
|
1516
|
-
return {
|
|
1517
|
-
HTMLAttributes: {}
|
|
1518
|
-
};
|
|
1500
|
+
return { HTMLAttributes: {} };
|
|
1519
1501
|
},
|
|
1520
1502
|
content: "(tableCell | tableHeader)*",
|
|
1521
1503
|
tableRole: "row",
|
|
@@ -1523,45 +1505,47 @@ var Kt = q.create({
|
|
|
1523
1505
|
return [{ tag: "tr" }];
|
|
1524
1506
|
},
|
|
1525
1507
|
renderHTML({ HTMLAttributes: t }) {
|
|
1526
|
-
return [
|
|
1508
|
+
return [
|
|
1509
|
+
"tr",
|
|
1510
|
+
B(this.options.HTMLAttributes, t),
|
|
1511
|
+
0
|
|
1512
|
+
];
|
|
1527
1513
|
}
|
|
1528
1514
|
});
|
|
1529
1515
|
function re(t, e) {
|
|
1530
1516
|
return e ? ["width", `${Math.max(e, t)}px`] : ["min-width", `${t}px`];
|
|
1531
1517
|
}
|
|
1532
1518
|
function ye(t, e, n, o, l, r) {
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
for (let
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
const [S, N] = re(o, m);
|
|
1544
|
-
a.style.setProperty(S, N);
|
|
1545
|
-
}
|
|
1546
|
-
a = a.nextSibling;
|
|
1547
|
-
} else {
|
|
1548
|
-
const S = document.createElement("col"), [N, T] = re(o, m);
|
|
1549
|
-
S.style.setProperty(N, T), e.appendChild(S);
|
|
1519
|
+
let s = 0, c = !0, i = e.firstChild;
|
|
1520
|
+
const a = t.firstChild;
|
|
1521
|
+
if (a !== null) for (let u = 0, p = 0; u < a.childCount; u += 1) {
|
|
1522
|
+
const { colspan: h, colwidth: g } = a.child(u).attrs;
|
|
1523
|
+
for (let m = 0; m < h; m += 1, p += 1) {
|
|
1524
|
+
const w = l === p ? r : g && g[m], M = w ? `${w}px` : "";
|
|
1525
|
+
if (s += w || o, w || (c = !1), i) {
|
|
1526
|
+
if (i.style.width !== M) {
|
|
1527
|
+
const [S, N] = re(o, w);
|
|
1528
|
+
i.style.setProperty(S, N);
|
|
1550
1529
|
}
|
|
1530
|
+
i = i.nextSibling;
|
|
1531
|
+
} else {
|
|
1532
|
+
const S = document.createElement("col"), [N, R] = re(o, w);
|
|
1533
|
+
S.style.setProperty(N, R), e.appendChild(S);
|
|
1551
1534
|
}
|
|
1552
1535
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1536
|
+
}
|
|
1537
|
+
for (; i; ) {
|
|
1538
|
+
var d;
|
|
1539
|
+
const u = i.nextSibling;
|
|
1540
|
+
(d = i.parentNode) === null || d === void 0 || d.removeChild(i), i = u;
|
|
1556
1541
|
}
|
|
1557
1542
|
const f = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
|
|
1558
|
-
|
|
1543
|
+
c && !f ? (n.style.width = `${s}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${s}px`);
|
|
1559
1544
|
}
|
|
1560
|
-
var
|
|
1545
|
+
var Ut = class {
|
|
1561
1546
|
constructor(t, e, n, o = {}) {
|
|
1562
1547
|
this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table"));
|
|
1563
|
-
for (const [l, r] of Object.entries(o))
|
|
1564
|
-
r != null && (l === "style" ? this.table.style.cssText = String(r) : this.table.setAttribute(l, String(r)));
|
|
1548
|
+
for (const [l, r] of Object.entries(o)) r != null && (l === "style" ? this.table.style.cssText = String(r) : this.table.setAttribute(l, String(r)));
|
|
1565
1549
|
t.attrs.style && (this.table.style.cssText = t.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), ye(t, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1566
1550
|
}
|
|
1567
1551
|
update(t) {
|
|
@@ -1575,26 +1559,32 @@ var qt = class {
|
|
|
1575
1559
|
function Jt(t, e, n, o) {
|
|
1576
1560
|
let l = 0, r = !0;
|
|
1577
1561
|
const s = [], c = t.firstChild;
|
|
1578
|
-
if (!c)
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
s.push(["col", { style: `${m}: ${y}` }]);
|
|
1562
|
+
if (!c) return {};
|
|
1563
|
+
for (let d = 0, f = 0; d < c.childCount; d += 1) {
|
|
1564
|
+
const { colspan: u, colwidth: p } = c.child(d).attrs;
|
|
1565
|
+
for (let h = 0; h < u; h += 1, f += 1) {
|
|
1566
|
+
const g = n === f ? o : p && p[h];
|
|
1567
|
+
l += g || e, g || (r = !1);
|
|
1568
|
+
const [m, w] = re(e, g);
|
|
1569
|
+
s.push(["col", { style: `${m}: ${w}` }]);
|
|
1587
1570
|
}
|
|
1588
1571
|
}
|
|
1589
1572
|
const i = r ? `${l}px` : "", a = r ? "" : `${l}px`;
|
|
1590
|
-
return {
|
|
1573
|
+
return {
|
|
1574
|
+
colgroup: [
|
|
1575
|
+
"colgroup",
|
|
1576
|
+
{},
|
|
1577
|
+
...s
|
|
1578
|
+
],
|
|
1579
|
+
tableWidth: i,
|
|
1580
|
+
tableMinWidth: a
|
|
1581
|
+
};
|
|
1591
1582
|
}
|
|
1592
1583
|
function Ae(t, e) {
|
|
1593
1584
|
return e ? t.createChecked(null, e) : t.createAndFill();
|
|
1594
1585
|
}
|
|
1595
1586
|
function Yt(t) {
|
|
1596
|
-
if (t.cached.tableNodeTypes)
|
|
1597
|
-
return t.cached.tableNodeTypes;
|
|
1587
|
+
if (t.cached.tableNodeTypes) return t.cached.tableNodeTypes;
|
|
1598
1588
|
const e = {};
|
|
1599
1589
|
return Object.keys(t.nodes).forEach((n) => {
|
|
1600
1590
|
const o = t.nodes[n];
|
|
@@ -1611,40 +1601,32 @@ function Gt(t, e, n, o, l) {
|
|
|
1611
1601
|
}
|
|
1612
1602
|
}
|
|
1613
1603
|
const i = [];
|
|
1614
|
-
for (let a = 0; a < e; a += 1)
|
|
1615
|
-
i.push(r.row.createChecked(null, o && a === 0 ? s : c));
|
|
1604
|
+
for (let a = 0; a < e; a += 1) i.push(r.row.createChecked(null, o && a === 0 ? s : c));
|
|
1616
1605
|
return r.table.createChecked(null, i);
|
|
1617
1606
|
}
|
|
1618
1607
|
function Qt(t) {
|
|
1619
1608
|
return t instanceof b;
|
|
1620
1609
|
}
|
|
1621
|
-
|
|
1610
|
+
const _ = ({ editor: t }) => {
|
|
1622
1611
|
const { selection: e } = t.state;
|
|
1623
|
-
if (!Qt(e))
|
|
1624
|
-
return !1;
|
|
1612
|
+
if (!Qt(e)) return !1;
|
|
1625
1613
|
let n = 0;
|
|
1626
|
-
const o = X(e.ranges[0].$from, (
|
|
1627
|
-
return o?.node.descendants((
|
|
1628
|
-
if (
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
}), n === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
1614
|
+
const o = X(e.ranges[0].$from, (l) => l.type.name === "table");
|
|
1615
|
+
return o?.node.descendants((l) => {
|
|
1616
|
+
if (l.type.name === "table") return !1;
|
|
1617
|
+
["tableCell", "tableHeader"].includes(l.type.name) && (n += 1);
|
|
1618
|
+
}), n !== e.ranges.length ? !1 : (t.commands.deleteTable(), !0);
|
|
1632
1619
|
};
|
|
1633
1620
|
function Se(t, e) {
|
|
1634
|
-
const n = t.mapping.map(e), o = X(
|
|
1635
|
-
|
|
1636
|
-
(s) => s.type.name === "table"
|
|
1637
|
-
);
|
|
1638
|
-
if (o?.pos === n)
|
|
1639
|
-
return;
|
|
1621
|
+
const n = t.mapping.map(e), o = X(t.selection.$from, (s) => s.type.name === "table");
|
|
1622
|
+
if (o?.pos === n) return;
|
|
1640
1623
|
const l = t.doc.nodeAt(n);
|
|
1641
|
-
if (!l)
|
|
1642
|
-
return;
|
|
1624
|
+
if (!l) return;
|
|
1643
1625
|
const r = n + l.nodeSize - 1;
|
|
1644
|
-
t.setSelection(
|
|
1626
|
+
t.setSelection(k.near(t.doc.resolve(r), -1));
|
|
1645
1627
|
}
|
|
1646
|
-
|
|
1647
|
-
function
|
|
1628
|
+
const cn = "";
|
|
1629
|
+
function Zt(t) {
|
|
1648
1630
|
let e = "", n = 0;
|
|
1649
1631
|
for (; n < t.length; ) {
|
|
1650
1632
|
if (t[n] === "\\" && n + 1 < t.length) {
|
|
@@ -1667,7 +1649,7 @@ function en(t) {
|
|
|
1667
1649
|
for (; l + s < t.length && t[l + s] === "`"; ) s += 1;
|
|
1668
1650
|
if (s === o) {
|
|
1669
1651
|
const c = t.slice(n + o, l);
|
|
1670
|
-
e += t.slice(n, n + o) + c.replace(
|
|
1652
|
+
e += t.slice(n, n + o) + c.replace(/\\\||\|/g, (i) => i === "|" ? "\\|" : i) + t.slice(l, l + o), n = l + o, r = !0;
|
|
1671
1653
|
break;
|
|
1672
1654
|
}
|
|
1673
1655
|
l += s;
|
|
@@ -1676,71 +1658,65 @@ function en(t) {
|
|
|
1676
1658
|
}
|
|
1677
1659
|
return e;
|
|
1678
1660
|
}
|
|
1679
|
-
function
|
|
1661
|
+
function en(t) {
|
|
1680
1662
|
return t.split(`
|
|
1681
|
-
`).map((e) => !e.includes("|") || !e.includes("`") ? e :
|
|
1663
|
+
`).map((e) => !e.includes("|") || !e.includes("`") ? e : Zt(e)).join(`
|
|
1682
1664
|
`);
|
|
1683
1665
|
}
|
|
1684
|
-
function
|
|
1666
|
+
function tn(t) {
|
|
1685
1667
|
return (t || "").replace(/\s+/g, " ").trim();
|
|
1686
1668
|
}
|
|
1687
|
-
function
|
|
1669
|
+
function nn(t, e, n = {}) {
|
|
1688
1670
|
var o;
|
|
1689
|
-
const l = (o = n.cellLineSeparator)
|
|
1690
|
-
if (!t || !t.content || t.content.length === 0)
|
|
1691
|
-
return "";
|
|
1671
|
+
const l = (o = n.cellLineSeparator) !== null && o !== void 0 ? o : "";
|
|
1672
|
+
if (!t || !t.content || t.content.length === 0) return "";
|
|
1692
1673
|
const r = [];
|
|
1693
|
-
t.content.forEach((
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
let
|
|
1697
|
-
m.content && Array.isArray(m.content) && m.content.length > 1 ?
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
}), r.push(
|
|
1674
|
+
t.content.forEach((h) => {
|
|
1675
|
+
const g = [];
|
|
1676
|
+
h.content && h.content.forEach((m) => {
|
|
1677
|
+
let w = "";
|
|
1678
|
+
m.content && Array.isArray(m.content) && m.content.length > 1 ? w = m.content.map((R) => e.renderChildren(R)).join(l) : w = m.content ? e.renderChildren(m.content) : "";
|
|
1679
|
+
const M = tn(w.split(l).join(`
|
|
1680
|
+
`).replace(/[ \t]*\r?\n[ \t]*/g, "<br>")), S = m.type === "tableHeader", N = jt(m.attrs);
|
|
1681
|
+
g.push({
|
|
1682
|
+
text: M,
|
|
1683
|
+
isHeader: S,
|
|
1684
|
+
align: N
|
|
1685
|
+
});
|
|
1686
|
+
}), r.push(g);
|
|
1706
1687
|
});
|
|
1707
|
-
const s = r.reduce((
|
|
1708
|
-
if (s === 0)
|
|
1709
|
-
return "";
|
|
1688
|
+
const s = r.reduce((h, g) => Math.max(h, g.length), 0);
|
|
1689
|
+
if (s === 0) return "";
|
|
1710
1690
|
const c = Array.from({ length: s }).fill(0);
|
|
1711
|
-
r.forEach((
|
|
1712
|
-
var w;
|
|
1691
|
+
r.forEach((h) => {
|
|
1713
1692
|
for (let m = 0; m < s; m += 1) {
|
|
1714
|
-
|
|
1715
|
-
|
|
1693
|
+
var g;
|
|
1694
|
+
const w = (((g = h[m]) === null || g === void 0 ? void 0 : g.text) || "").length;
|
|
1695
|
+
w > c[m] && (c[m] = w), c[m] < 3 && (c[m] = 3);
|
|
1716
1696
|
}
|
|
1717
1697
|
});
|
|
1718
|
-
const i = (
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
!f[m] && ((w = g[m]) != null && w.align) && (f[m] = g[m].align);
|
|
1698
|
+
const i = (h, g) => h + " ".repeat(Math.max(0, g - h.length)), a = r[0], d = a.some((h) => h.isHeader), f = Array.from({ length: s }).fill(null);
|
|
1699
|
+
r.forEach((h) => {
|
|
1700
|
+
for (let m = 0; m < s; m += 1) {
|
|
1701
|
+
var g;
|
|
1702
|
+
!f[m] && (!((g = h[m]) === null || g === void 0) && g.align) && (f[m] = h[m].align);
|
|
1703
|
+
}
|
|
1725
1704
|
});
|
|
1726
1705
|
let u = `
|
|
1727
1706
|
`;
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
const m = Math.max(3, g), y = f[w];
|
|
1734
|
-
return y === "left" ? `:${"-".repeat(m)}` : y === "right" ? `${"-".repeat(m)}:` : y === "center" ? `:${"-".repeat(m)}:` : "-".repeat(m);
|
|
1707
|
+
const p = Array.from({ length: s }).map((h, g) => d && a[g] && a[g].text || "");
|
|
1708
|
+
return u += `| ${p.map((h, g) => i(h, c[g])).join(" | ")} |
|
|
1709
|
+
`, u += `| ${c.map((h, g) => {
|
|
1710
|
+
const m = Math.max(3, h), w = f[g];
|
|
1711
|
+
return w === "left" ? `:${"-".repeat(m)}` : w === "right" ? `${"-".repeat(m)}:` : w === "center" ? `:${"-".repeat(m)}:` : "-".repeat(m);
|
|
1735
1712
|
}).join(" | ")} |
|
|
1736
|
-
`, (d ? r.slice(1) : r).forEach((
|
|
1737
|
-
u += `| ${Array.from({ length: s }).fill(0).map((
|
|
1713
|
+
`, (d ? r.slice(1) : r).forEach((h) => {
|
|
1714
|
+
u += `| ${Array.from({ length: s }).fill(0).map((g, m) => i(h[m] && h[m].text || "", c[m])).join(" | ")} |
|
|
1738
1715
|
`;
|
|
1739
1716
|
}), u;
|
|
1740
1717
|
}
|
|
1741
|
-
|
|
1718
|
+
const on = U.create({
|
|
1742
1719
|
name: "table",
|
|
1743
|
-
// @ts-ignore
|
|
1744
1720
|
addOptions() {
|
|
1745
1721
|
return {
|
|
1746
1722
|
HTMLAttributes: {},
|
|
@@ -1748,8 +1724,7 @@ var ln = on, rn = q.create({
|
|
|
1748
1724
|
renderWrapper: !1,
|
|
1749
1725
|
handleWidth: 5,
|
|
1750
1726
|
cellMinWidth: 25,
|
|
1751
|
-
|
|
1752
|
-
View: qt,
|
|
1727
|
+
View: Ut,
|
|
1753
1728
|
lastColumnResizable: !0,
|
|
1754
1729
|
allowTableNodeSelection: !1
|
|
1755
1730
|
};
|
|
@@ -1768,13 +1743,15 @@ var ln = on, rn = q.create({
|
|
|
1768
1743
|
}
|
|
1769
1744
|
const c = [
|
|
1770
1745
|
"table",
|
|
1771
|
-
|
|
1772
|
-
style: s()
|
|
1773
|
-
}),
|
|
1746
|
+
B(this.options.HTMLAttributes, e, { style: s() }),
|
|
1774
1747
|
n,
|
|
1775
1748
|
["tbody", 0]
|
|
1776
1749
|
];
|
|
1777
|
-
return this.options.renderWrapper ? [
|
|
1750
|
+
return this.options.renderWrapper ? [
|
|
1751
|
+
"div",
|
|
1752
|
+
{ class: "tableWrapper" },
|
|
1753
|
+
c
|
|
1754
|
+
] : c;
|
|
1778
1755
|
},
|
|
1779
1756
|
parseMarkdown: (t, e) => {
|
|
1780
1757
|
const n = [], o = Array.isArray(t.align) ? t.align : [];
|
|
@@ -1782,28 +1759,26 @@ var ln = on, rn = q.create({
|
|
|
1782
1759
|
const l = [];
|
|
1783
1760
|
t.header.forEach((r, s) => {
|
|
1784
1761
|
var c;
|
|
1785
|
-
const i =
|
|
1786
|
-
l.push(
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
);
|
|
1762
|
+
const i = q((c = o[s]) !== null && c !== void 0 ? c : r.align), a = i ? { align: i } : {};
|
|
1763
|
+
l.push(e.createNode("tableHeader", a, [{
|
|
1764
|
+
type: "paragraph",
|
|
1765
|
+
content: e.parseInline(r.tokens)
|
|
1766
|
+
}]));
|
|
1791
1767
|
}), n.push(e.createNode("tableRow", {}, l));
|
|
1792
1768
|
}
|
|
1793
1769
|
return t.rows && t.rows.forEach((l) => {
|
|
1794
1770
|
const r = [];
|
|
1795
1771
|
l.forEach((s, c) => {
|
|
1796
1772
|
var i;
|
|
1797
|
-
const a =
|
|
1798
|
-
r.push(
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
);
|
|
1773
|
+
const a = q((i = o[c]) !== null && i !== void 0 ? i : s.align), d = a ? { align: a } : {};
|
|
1774
|
+
r.push(e.createNode("tableCell", d, [{
|
|
1775
|
+
type: "paragraph",
|
|
1776
|
+
content: e.parseInline(s.tokens)
|
|
1777
|
+
}]));
|
|
1803
1778
|
}), n.push(e.createNode("tableRow", {}, r));
|
|
1804
1779
|
}), e.createNode("table", void 0, n);
|
|
1805
1780
|
},
|
|
1806
|
-
renderMarkdown: (t, e) =>
|
|
1781
|
+
renderMarkdown: (t, e) => nn(t, e),
|
|
1807
1782
|
markdownTokenizer: {
|
|
1808
1783
|
name: "table",
|
|
1809
1784
|
level: "block",
|
|
@@ -1822,15 +1797,18 @@ var ln = on, rn = q.create({
|
|
|
1822
1797
|
if (r.length < 2) return;
|
|
1823
1798
|
const s = r[1];
|
|
1824
1799
|
if (!/^[ \t|:]*-[ \t|:-]*$/.test(s) || !s.includes("|")) return;
|
|
1825
|
-
const c =
|
|
1800
|
+
const c = en(l);
|
|
1826
1801
|
if (c === l) return;
|
|
1827
|
-
const
|
|
1828
|
-
if (
|
|
1829
|
-
const
|
|
1830
|
-
`).length,
|
|
1831
|
-
`).slice(0,
|
|
1802
|
+
const i = n.blockTokens(c)[0];
|
|
1803
|
+
if (i?.type !== "table" || !i.raw) return;
|
|
1804
|
+
const a = i.raw.split(`
|
|
1805
|
+
`).length, d = t.split(`
|
|
1806
|
+
`).slice(0, a).join(`
|
|
1832
1807
|
`);
|
|
1833
|
-
return {
|
|
1808
|
+
return {
|
|
1809
|
+
...i,
|
|
1810
|
+
raw: d
|
|
1811
|
+
};
|
|
1834
1812
|
}
|
|
1835
1813
|
},
|
|
1836
1814
|
addCommands() {
|
|
@@ -1839,43 +1817,31 @@ var ln = on, rn = q.create({
|
|
|
1839
1817
|
const s = Gt(r.schema, t, e, n);
|
|
1840
1818
|
if (l) {
|
|
1841
1819
|
const c = o.selection.from + 1;
|
|
1842
|
-
o.replaceSelectionWith(s).scrollIntoView().setSelection(
|
|
1820
|
+
o.replaceSelectionWith(s).scrollIntoView().setSelection(k.near(o.doc.resolve(c)));
|
|
1843
1821
|
}
|
|
1844
1822
|
return !0;
|
|
1845
1823
|
},
|
|
1846
1824
|
addColumnBefore: () => ({ state: t, dispatch: e }) => rt(t, e),
|
|
1847
1825
|
addColumnAfter: () => ({ state: t, dispatch: e }) => st(t, e),
|
|
1848
1826
|
deleteColumn: () => ({ state: t, dispatch: e }) => {
|
|
1849
|
-
const n = X(
|
|
1850
|
-
|
|
1851
|
-
(o)
|
|
1852
|
-
);
|
|
1853
|
-
return ct(
|
|
1854
|
-
t,
|
|
1855
|
-
e && ((o) => {
|
|
1856
|
-
n && Se(o, n.pos), e(o);
|
|
1857
|
-
})
|
|
1858
|
-
);
|
|
1827
|
+
const n = X(t.selection.$from, (o) => o.type.name === "table");
|
|
1828
|
+
return ct(t, e && ((o) => {
|
|
1829
|
+
n && Se(o, n.pos), e(o);
|
|
1830
|
+
}));
|
|
1859
1831
|
},
|
|
1860
1832
|
addRowBefore: () => ({ state: t, dispatch: e }) => dt(t, e),
|
|
1861
1833
|
addRowAfter: () => ({ state: t, dispatch: e }) => ft(t, e),
|
|
1862
1834
|
deleteRow: () => ({ state: t, dispatch: e }) => {
|
|
1863
|
-
const n = X(
|
|
1864
|
-
|
|
1865
|
-
(o)
|
|
1866
|
-
);
|
|
1867
|
-
return ht(
|
|
1868
|
-
t,
|
|
1869
|
-
e && ((o) => {
|
|
1870
|
-
n && Se(o, n.pos), e(o);
|
|
1871
|
-
})
|
|
1872
|
-
);
|
|
1835
|
+
const n = X(t.selection.$from, (o) => o.type.name === "table");
|
|
1836
|
+
return ht(t, e && ((o) => {
|
|
1837
|
+
n && Se(o, n.pos), e(o);
|
|
1838
|
+
}));
|
|
1873
1839
|
},
|
|
1874
1840
|
deleteTable: () => ({ state: t, dispatch: e }) => yt(t, e),
|
|
1875
1841
|
mergeCells: () => ({ state: t, dispatch: e }) => ae(t, e),
|
|
1876
1842
|
splitCell: () => ({ state: t, dispatch: e }) => de(t, e),
|
|
1877
|
-
toggleHeaderColumn: () => ({ state: t, dispatch: e }) =>
|
|
1878
|
-
toggleHeaderRow: () => ({ state: t, dispatch: e }) =>
|
|
1843
|
+
toggleHeaderColumn: () => ({ state: t, dispatch: e }) => P("column")(t, e),
|
|
1844
|
+
toggleHeaderRow: () => ({ state: t, dispatch: e }) => P("row")(t, e),
|
|
1879
1845
|
toggleHeaderCell: () => ({ state: t, dispatch: e }) => bt(t, e),
|
|
1880
1846
|
mergeOrSplit: () => ({ state: t, dispatch: e }) => ae(t, e) ? !0 : de(t, e),
|
|
1881
1847
|
setCellAttribute: (t, e) => ({ state: n, dispatch: o }) => gt(t, e)(n, o),
|
|
@@ -1895,32 +1861,25 @@ var ln = on, rn = q.create({
|
|
|
1895
1861
|
return {
|
|
1896
1862
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
1897
1863
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
1898
|
-
Backspace:
|
|
1899
|
-
"Mod-Backspace":
|
|
1900
|
-
Delete:
|
|
1901
|
-
"Mod-Delete":
|
|
1864
|
+
Backspace: _,
|
|
1865
|
+
"Mod-Backspace": _,
|
|
1866
|
+
Delete: _,
|
|
1867
|
+
"Mod-Delete": _
|
|
1902
1868
|
};
|
|
1903
1869
|
},
|
|
1904
1870
|
addProseMirrorPlugins() {
|
|
1905
|
-
return [
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
lastColumnResizable: this.options.lastColumnResizable
|
|
1913
|
-
})
|
|
1914
|
-
] : [],
|
|
1915
|
-
_t({
|
|
1916
|
-
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
1917
|
-
})
|
|
1918
|
-
];
|
|
1871
|
+
return [...this.options.resizable && this.editor.isEditable ? [Et({
|
|
1872
|
+
handleWidth: this.options.handleWidth,
|
|
1873
|
+
cellMinWidth: this.options.cellMinWidth,
|
|
1874
|
+
defaultCellMinWidth: this.options.cellMinWidth,
|
|
1875
|
+
View: this.options.View,
|
|
1876
|
+
lastColumnResizable: this.options.lastColumnResizable
|
|
1877
|
+
})] : [], Ft({ allowTableNodeSelection: this.options.allowTableNodeSelection })];
|
|
1919
1878
|
},
|
|
1920
1879
|
addNodeView() {
|
|
1921
1880
|
const t = this.options.resizable && this.editor.isEditable, e = this.options.View;
|
|
1922
1881
|
return t || !e ? null : ({ node: n, view: o, HTMLAttributes: l }) => {
|
|
1923
|
-
const r =
|
|
1882
|
+
const r = B(this.options.HTMLAttributes, l);
|
|
1924
1883
|
return new e(n, this.options.cellMinWidth, o, r);
|
|
1925
1884
|
};
|
|
1926
1885
|
},
|
|
@@ -1930,29 +1889,27 @@ var ln = on, rn = q.create({
|
|
|
1930
1889
|
options: t.options,
|
|
1931
1890
|
storage: t.storage
|
|
1932
1891
|
};
|
|
1933
|
-
return {
|
|
1934
|
-
tableRole: Fe(je(t, "tableRole", e))
|
|
1935
|
-
};
|
|
1892
|
+
return { tableRole: Oe(je(t, "tableRole", e)) };
|
|
1936
1893
|
}
|
|
1937
|
-
}),
|
|
1894
|
+
}), an = _e.create({
|
|
1938
1895
|
name: "tableKit",
|
|
1939
1896
|
addExtensions() {
|
|
1940
1897
|
const t = [];
|
|
1941
|
-
return this.options.table !== !1 && t.push(
|
|
1898
|
+
return this.options.table !== !1 && t.push(on.configure(this.options.table)), this.options.tableCell !== !1 && t.push(Kt.configure(this.options.tableCell)), this.options.tableHeader !== !1 && t.push(Xt.configure(this.options.tableHeader)), this.options.tableRow !== !1 && t.push(qt.configure(this.options.tableRow)), t;
|
|
1942
1899
|
}
|
|
1943
1900
|
});
|
|
1944
1901
|
export {
|
|
1945
|
-
|
|
1946
|
-
|
|
1902
|
+
cn as DEFAULT_CELL_LINE_SEPARATOR,
|
|
1903
|
+
on as Table,
|
|
1947
1904
|
Kt as TableCell,
|
|
1948
1905
|
Xt as TableHeader,
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1906
|
+
an as TableKit,
|
|
1907
|
+
qt as TableRow,
|
|
1908
|
+
Ut as TableView,
|
|
1952
1909
|
Jt as createColGroup,
|
|
1953
1910
|
Gt as createTable,
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1911
|
+
Zt as escapeTableCellPipes,
|
|
1912
|
+
en as preprocessTablePipes,
|
|
1913
|
+
nn as renderTableToMarkdown,
|
|
1957
1914
|
ye as updateColumns
|
|
1958
1915
|
};
|