@opengis/form 0.1.32 → 0.1.34
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-sa_Wbgbt.js → index-B1Lyq79o.js} +4135 -4133
- package/dist/{index-Bh8_Wx51.js → index-B1zV9Aax.js} +477 -434
- package/dist/{index-DQur75TQ.js → index-B3op5uFx.js} +28 -29
- package/dist/index-BIES3-my.js +3085 -0
- package/dist/index-CkUvn8lm.js +153 -0
- package/dist/index-D49VHc9h.js +237 -0
- package/dist/index-DZ7xh8lh.js +50 -0
- package/dist/index-MfTTOwHR.js +89 -0
- package/dist/{index-CQZi4RyF.js → index-RwV1hx3A.js} +19 -21
- package/dist/{index-CMmJu2Ql.js → index-W4UOw8lU.js} +505 -428
- package/dist/index-pYkcVgEL.js +12134 -0
- package/dist/{index-DspmCbXc.js → index-qhd_7MCX.js} +20 -16
- package/dist/{index-DsT4tZvp.js → index-sFkGqyu8.js} +20 -16
- 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/components/inputs/select/vs-select-control.vue.d.ts.map +1 -1
- package/dist/src/components/inputs/select/vs-select-dropdown.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/{vs-richtext-BJeMF-be.js → vs-richtext-_Wtyoi3t.js} +22 -22
- package/locales/en.json +39 -39
- package/locales/uk.json +39 -39
- package/package.json +93 -93
- package/dist/index-B9CEJ-PZ.js +0 -187
- package/dist/index-CHHagWDa.js +0 -2794
- package/dist/index-C_6bjz0U.js +0 -138
- package/dist/index-D3gVZYzr.js +0 -78
- package/dist/index-DJVijc0x.js +0 -47
- package/dist/index-z-RdtcIQ.js +0 -11862
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Re, d as se, S as
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import { P as Re, d as se, k as Be, S as k, e as Pe, T as E, D as Q, f as Z, h as Ie, i as _e, N as q, E as Oe, j as Fe, l as je, m as P, o as X } from "./index-pYkcVgEL.js";
|
|
2
|
+
import { Fragment as M, Slice as L } 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 p = 0; ; p++) {
|
|
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 (p == f.childCount) break;
|
|
88
|
+
const g = f.child(p), { colspan: w, rowspan: m, colwidth: y } = g.attrs;
|
|
89
|
+
for (let S = 0; S < m; 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: m - S
|
|
95
95
|
});
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
const N = l + S * e;
|
|
99
|
-
for (let
|
|
100
|
-
o[N +
|
|
99
|
+
for (let T = 0; T < w; T++) {
|
|
100
|
+
o[N + T] == 0 ? o[N + T] = d : (r || (r = [])).push({
|
|
101
101
|
type: "collision",
|
|
102
102
|
row: a,
|
|
103
103
|
pos: d,
|
|
104
|
-
n:
|
|
104
|
+
n: w - T
|
|
105
105
|
});
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
Y == null || Y !=
|
|
106
|
+
const B = y && y[T];
|
|
107
|
+
if (B) {
|
|
108
|
+
const $ = (N + T) % e * 2, Y = s[$];
|
|
109
|
+
Y == null || Y != B && s[$ + 1] == 1 ? (s[$] = B, s[$ + 1] = 1) : Y == B && s[$ + 1]++;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
l +=
|
|
113
|
+
l += w, d += g.nodeSize;
|
|
114
114
|
}
|
|
115
115
|
const u = (a + 1) * e;
|
|
116
|
-
let
|
|
117
|
-
for (; l < u; ) o[l++] == 0 &&
|
|
118
|
-
|
|
116
|
+
let h = 0;
|
|
117
|
+
for (; l < u; ) o[l++] == 0 && h++;
|
|
118
|
+
h && (r || (r = [])).push({
|
|
119
119
|
type: "missing",
|
|
120
120
|
row: a,
|
|
121
|
-
n:
|
|
121
|
+
n: h
|
|
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 = Ue(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 Ue(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 A(t) {
|
|
179
179
|
let e = t.cached.tableNodeTypes;
|
|
180
180
|
if (!e) {
|
|
181
181
|
e = t.cached.tableNodeTypes = {};
|
|
@@ -186,12 +186,12 @@ function y(t) {
|
|
|
186
186
|
}
|
|
187
187
|
return e;
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
function
|
|
189
|
+
const H = new se("selectingCells");
|
|
190
|
+
function W(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 qe(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 = W(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 Te(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 D(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 xe(t, e, n = 1) {
|
|
245
245
|
const o = {
|
|
246
246
|
...t,
|
|
247
247
|
colspan: t.colspan + n
|
|
@@ -253,11 +253,11 @@ function Te(t, e, n = 1) {
|
|
|
253
253
|
return o;
|
|
254
254
|
}
|
|
255
255
|
function Ge(t, e, n) {
|
|
256
|
-
const o =
|
|
256
|
+
const o = A(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 k {
|
|
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 E {
|
|
|
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 Pe(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 E {
|
|
|
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 E.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 E {
|
|
|
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 h = n.findCell(u);
|
|
289
|
+
let p = e.nodeAt(u);
|
|
290
|
+
if (!p) throw new RangeError(`No cell with offset ${u} found`);
|
|
291
|
+
const g = l.left - h.left, w = h.right - l.right;
|
|
292
|
+
if (g > 0 || w > 0) {
|
|
293
|
+
let m = p.attrs;
|
|
294
|
+
if (g > 0 && (m = D(m, 0, g)), w > 0 && (m = D(m, m.colspan - w, w)), h.left < l.left) {
|
|
295
|
+
if (p = p.type.createAndFill(m), !p) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(m)}`);
|
|
296
|
+
} else p = p.type.create(m, p.content);
|
|
297
297
|
}
|
|
298
|
-
if (
|
|
299
|
-
const
|
|
300
|
-
...
|
|
301
|
-
rowspan: Math.min(
|
|
298
|
+
if (h.top < l.top || h.bottom > l.bottom) {
|
|
299
|
+
const m = {
|
|
300
|
+
...p.attrs,
|
|
301
|
+
rowspan: Math.min(h.bottom, l.bottom) - Math.max(h.top, l.top)
|
|
302
302
|
};
|
|
303
|
-
|
|
303
|
+
h.top < l.top ? p = p.type.createAndFill(m) : p = p.type.create(m, p.content);
|
|
304
304
|
}
|
|
305
|
-
a.push(
|
|
305
|
+
a.push(p);
|
|
306
306
|
}
|
|
307
|
-
s.push(e.child(i).copy(
|
|
307
|
+
s.push(e.child(i).copy(M.from(a)));
|
|
308
308
|
}
|
|
309
309
|
const c = this.isColSelection() && this.isRowSelection() ? e : s;
|
|
310
|
-
return new
|
|
310
|
+
return new L(M.from(c), 1, 1);
|
|
311
311
|
}
|
|
312
|
-
replace(e, n =
|
|
312
|
+
replace(e, n = L.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 ? L.empty : n);
|
|
317
317
|
}
|
|
318
|
-
const r =
|
|
318
|
+
const r = k.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 L(M.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 E {
|
|
|
366
366
|
}
|
|
367
367
|
};
|
|
368
368
|
b.prototype.visible = !1;
|
|
369
|
-
|
|
370
|
-
var Qe = class
|
|
369
|
+
k.jsonID("cell", b);
|
|
370
|
+
var Qe = class Me {
|
|
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 Me(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) : k.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 E && et(o) ? r = E.create(l, o.from) : o instanceof E && tt(o) && (r = E.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 ve(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 Me(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) ? ve(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 && ve(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, D(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 h = "cell";
|
|
488
|
+
d.firstChild && (h = d.firstChild.type.spec.tableRole);
|
|
489
|
+
const p = [];
|
|
490
|
+
for (let w = 0; w < u; w++) {
|
|
491
|
+
const m = A(t.schema)[h].createAndFill();
|
|
492
|
+
m && p.push(m);
|
|
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), p);
|
|
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, xe(a.attrs, l - e.colCount(i))), s += a.attrs.rowspan - 1;
|
|
518
518
|
} else {
|
|
519
|
-
const i = r == null ?
|
|
519
|
+
const i = r == null ? A(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, D(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 = A(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 ke(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 Ee(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 ? A(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, A(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(ke(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(ke(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), h = u.attrs, p = u.type.create({
|
|
625
|
+
...h,
|
|
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), p), a += h.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 = M.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], h = o.table.nodeAt(u);
|
|
673
|
+
if (!(s[u] || !h))
|
|
674
674
|
if (s[u] = !0, i == null)
|
|
675
|
-
i = u, a =
|
|
675
|
+
i = u, a = h;
|
|
676
676
|
else {
|
|
677
|
-
ce(
|
|
678
|
-
const
|
|
679
|
-
r.delete(
|
|
677
|
+
ce(h) || (c = c.append(h.content));
|
|
678
|
+
const p = r.mapping.map(u + o.tableStart);
|
|
679
|
+
r.delete(p, p + h.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
|
+
...xe(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 = A(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 = qe(o.$from), !l) return !1;
|
|
708
|
+
r = (s = W(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 h = 0; h < d.right - d.left; h++) i.push(a ? {
|
|
723
723
|
...c,
|
|
724
|
-
colwidth: a && a[
|
|
724
|
+
colwidth: a && a[h] ? [a[h]] : 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 h = d.top; h < d.bottom; h++) {
|
|
728
|
+
let p = d.map.positionAt(h, d.left, d.table);
|
|
729
|
+
h == d.top && (p += l.nodeSize);
|
|
730
|
+
for (let g = d.left, w = 0; g < d.right; g++, w++)
|
|
731
|
+
g == d.left && h == d.top || f.insert(u = f.mapping.map(p + d.tableStart, 1), t({
|
|
732
732
|
node: l,
|
|
733
|
-
row:
|
|
733
|
+
row: h,
|
|
734
734
|
col: g
|
|
735
|
-
}).createAndFill(i[
|
|
735
|
+
}).createAndFill(i[w]));
|
|
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 = A(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 I(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 = A(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 P(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 h = u + r.tableStart, p = s.doc.nodeAt(h);
|
|
818
|
+
p && s.setNodeMarkup(h, f, p.attrs);
|
|
819
819
|
}), o(s);
|
|
820
820
|
}
|
|
821
821
|
return !0;
|
|
822
822
|
};
|
|
823
823
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
const bt =
|
|
824
|
+
I("row", { useDeprecatedLogic: !0 });
|
|
825
|
+
I("column", { useDeprecatedLogic: !0 });
|
|
826
|
+
const bt = I("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(E.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 _(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 = A(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 L(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(A(s).row, new L(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(A(s).row, new L(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(M.empty), n[l] < o) {
|
|
904
|
+
const r = A(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(M.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 _e(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(D(u.attrs, u.attrs.colspan, d + u.attrs.colspan - o), u.content)), a.push(u), d += u.attrs.colspan;
|
|
926
|
+
for (let h = 1; h < u.attrs.rowspan; h++) r[c + h] = (r[c + h] || 0) + u.attrs.colspan;
|
|
927
927
|
}
|
|
928
|
-
s.push(
|
|
928
|
+
s.push(M.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(M.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 Tt(t, e, n, o, l, r, s) {
|
|
954
|
+
const c = t.doc.type.schema, i = A(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 h = n.child(f);
|
|
958
|
+
u += h.nodeSize;
|
|
959
|
+
const p = [];
|
|
960
960
|
let g;
|
|
961
|
-
|
|
962
|
-
for (let
|
|
963
|
-
t.insert(t.mapping.slice(s).map(u - 1 + o),
|
|
961
|
+
h.lastChild == null || h.lastChild.type == i.cell ? g = a || (a = i.cell.createAndFill()) : g = d || (d = i.header_cell.createAndFill());
|
|
962
|
+
for (let w = e.width; w < l; w++) p.push(g);
|
|
963
|
+
t.insert(t.mapping.slice(s).map(u - 1 + o), p);
|
|
964
964
|
}
|
|
965
965
|
if (r > e.height) {
|
|
966
966
|
const f = [];
|
|
967
|
-
for (let
|
|
968
|
-
const
|
|
969
|
-
f.push(
|
|
967
|
+
for (let p = 0, g = (e.height - 1) * e.width; p < Math.max(e.width, l); p++) {
|
|
968
|
+
const w = p >= e.width ? !1 : n.nodeAt(e.map[g + p]).type == i.header_cell;
|
|
969
|
+
f.push(w ? 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, M.from(f)), h = [];
|
|
972
|
+
for (let p = e.height; p < r; p++) h.push(u);
|
|
973
|
+
t.insert(t.mapping.slice(s).map(o + n.nodeSize - 2), h);
|
|
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: h, left: p } = 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 - h
|
|
988
|
+
}), t.insert(t.mapping.slice(c).map(e.positionAt(s, p, n)), u.type.createAndFill({
|
|
989
989
|
...u.attrs,
|
|
990
|
-
rowspan:
|
|
990
|
+
rowspan: h + 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), h = e.colCount(f), p = t.mapping.slice(c).map(f + o);
|
|
1004
|
+
t.setNodeMarkup(p, null, D(u.attrs, s - h, u.attrs.colspan - (s - h))), t.insert(p + u.nodeSize, u.type.createAndFill(D(u.attrs, 0, s - h))), 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 h() {
|
|
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
|
+
Tt(f, s, r, n, a, d, u) && h(), he(f, s, r, n, i, a, c, u) && h(), he(f, s, r, n, i, a, d, u) && h(), pe(f, s, r, n, c, d, i, u) && h(), pe(f, s, r, n, c, d, a, u) && h();
|
|
1020
|
+
for (let p = c; p < d; p++) {
|
|
1021
|
+
const g = s.positionAt(p, i, r), w = s.positionAt(p, a, r);
|
|
1022
|
+
f.replace(f.mapping.slice(u).map(g + n), f.mapping.slice(u).map(w + n), new L(l.rows[p - c], 0, 0));
|
|
1023
1023
|
}
|
|
1024
|
-
|
|
1024
|
+
h(), 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 xt = Be({
|
|
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": F("horiz", -1),
|
|
1032
|
+
"Shift-ArrowRight": F("horiz", 1),
|
|
1033
|
+
"Shift-ArrowUp": F("vert", -1),
|
|
1034
|
+
"Shift-ArrowDown": F("vert", 1),
|
|
1035
|
+
Backspace: _,
|
|
1036
|
+
"Mod-Backspace": _,
|
|
1037
|
+
Delete: _,
|
|
1038
|
+
"Mod-Delete": _
|
|
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, k.near(r.$headCell, e));
|
|
1048
1048
|
if (t != "horiz" && !r.empty) return !1;
|
|
1049
|
-
const s =
|
|
1049
|
+
const s = Ee(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, k.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 = Te(c, t, e);
|
|
1054
1054
|
let a;
|
|
1055
|
-
return i ? a =
|
|
1055
|
+
return i ? a = k.near(i, 1) : e < 0 ? a = k.near(n.doc.resolve(c.before(-1)), -1) : a = k.near(n.doc.resolve(c.after(-1)), 1), V(n, o, a);
|
|
1056
1056
|
}
|
|
1057
1057
|
};
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function F(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 = Ee(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 = Te(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 Mt(t, e) {
|
|
1075
|
+
const n = t.state.doc, o = W(n.resolve(e));
|
|
1076
1076
|
return o ? (t.dispatch(t.state.tr.setSelection(new b(o))), !0) : !1;
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function vt(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 Mt(t, e, n) {
|
|
|
1083
1083
|
o || (o = {
|
|
1084
1084
|
width: 1,
|
|
1085
1085
|
height: 1,
|
|
1086
|
-
rows: [
|
|
1086
|
+
rows: [M.from(oe(A(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 = W(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 = H.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 h = t.state.tr.setSelection(u);
|
|
1113
|
+
f && h.setMeta(H, i.pos), t.dispatch(h);
|
|
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), H.getState(t.state) != null && t.dispatch(t.state.tr.setMeta(H, -1));
|
|
1118
1118
|
}
|
|
1119
1119
|
function c(i) {
|
|
1120
|
-
const a = i, d =
|
|
1120
|
+
const a = i, d = H.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 Ee(t, e, n) {
|
|
1130
|
+
if (!(t.state.selection instanceof E)) 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 && W(t.state.doc.resolve(o)) || W(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: h, colwidth: p } = a.child(f).attrs;
|
|
1172
|
+
for (let g = 0; g < h; g++, u++) {
|
|
1173
|
+
const w = l == u ? r : p && p[g], m = w ? w + "px" : "";
|
|
1174
|
+
if (s += w || o, w || (c = !1), i)
|
|
1175
|
+
i.style.width != m && (i.style.width = m), i = i.nextSibling;
|
|
1176
1176
|
else {
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1177
|
+
const y = document.createElement("col");
|
|
1178
|
+
y.style.width = m, e.appendChild(y);
|
|
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 R = new se("tableColumnResizing");
|
|
1191
|
+
function kt({ 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: R,
|
|
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 = A(c.schema).table.name;
|
|
1198
|
+
return o && a && (a[d] = (f, u) => new o(f, n, u)), new Et(-1, !1);
|
|
1199
1199
|
},
|
|
1200
1200
|
apply(s, c) {
|
|
1201
1201
|
return c.apply(s);
|
|
@@ -1203,22 +1203,22 @@ function Et({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: n =
|
|
|
1203
1203
|
},
|
|
1204
1204
|
props: {
|
|
1205
1205
|
attributes: (s) => {
|
|
1206
|
-
const c =
|
|
1206
|
+
const c = R.getState(s);
|
|
1207
1207
|
return c && c.activeHandle > -1 ? { class: "resize-cursor" } : {};
|
|
1208
1208
|
},
|
|
1209
1209
|
handleDOMEvents: {
|
|
1210
1210
|
mousemove: (s, c) => {
|
|
1211
|
-
|
|
1211
|
+
Ht(s, c, t, l);
|
|
1212
1212
|
},
|
|
1213
1213
|
mouseleave: (s) => {
|
|
1214
|
-
|
|
1214
|
+
Lt(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 = R.getState(s);
|
|
1222
1222
|
if (c && c.activeHandle > -1) return It(s, c.activeHandle);
|
|
1223
1223
|
},
|
|
1224
1224
|
nodeViews: {}
|
|
@@ -1226,12 +1226,12 @@ function Et({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: n =
|
|
|
1226
1226
|
});
|
|
1227
1227
|
return r;
|
|
1228
1228
|
}
|
|
1229
|
-
var
|
|
1229
|
+
var Et = 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(R);
|
|
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 kt = class K {
|
|
|
1241
1241
|
return n;
|
|
1242
1242
|
}
|
|
1243
1243
|
};
|
|
1244
|
-
function
|
|
1244
|
+
function Ht(t, e, n, o) {
|
|
1245
1245
|
if (!t.editable) return;
|
|
1246
|
-
const l =
|
|
1246
|
+
const l = R.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 Lt(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
|
+
He(t, s);
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function Lt(t) {
|
|
1264
1264
|
if (!t.editable) return;
|
|
1265
|
-
const e =
|
|
1266
|
-
e && e.activeHandle > -1 && !e.dragging &&
|
|
1265
|
+
const e = R.getState(t.state);
|
|
1266
|
+
e && e.activeHandle > -1 && !e.dragging && He(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 = R.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(R, { 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 = R.getState(t.state);
|
|
1281
|
+
u?.dragging && (Bt(t, u.activeHandle, be(u.dragging, f, n)), t.dispatch(t.state.tr.setMeta(R, { setDragging: null })));
|
|
1282
1282
|
}
|
|
1283
1283
|
function d(f) {
|
|
1284
1284
|
if (!f.which) return a(f);
|
|
1285
|
-
const u =
|
|
1285
|
+
const u = R.getState(t.state);
|
|
1286
1286
|
if (u && u.dragging) {
|
|
1287
|
-
const
|
|
1288
|
-
Ce(t, u.activeHandle,
|
|
1287
|
+
const h = be(u.dragging, f, n);
|
|
1288
|
+
Ce(t, u.activeHandle, h, 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 = W(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 He(t, e) {
|
|
1323
|
+
t.dispatch(t.state.tr.setMeta(R, { 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
|
-
h
|
|
1330
|
+
const f = r.map[d], u = l.nodeAt(f).attrs, h = u.colspan == 1 ? 0 : c - r.colCount(f);
|
|
1331
|
+
if (u.colwidth && u.colwidth[h] == n) continue;
|
|
1332
|
+
const p = u.colwidth ? u.colwidth.slice() : Pt(u.colspan);
|
|
1333
|
+
p[h] = n, i.setNodeMarkup(s + f, null, {
|
|
1334
1334
|
...u,
|
|
1335
|
-
colwidth:
|
|
1335
|
+
colwidth: p
|
|
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, h = document.createElement("div");
|
|
1358
|
+
h.className = "column-resize-handle", !((i = R.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, h));
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
1361
|
return Q.create(t.doc, n);
|
|
1362
1362
|
}
|
|
1363
|
-
function
|
|
1363
|
+
function _t({ allowTableNodeSelection: t = !1 } = {}) {
|
|
1364
1364
|
return new Re({
|
|
1365
|
-
key:
|
|
1365
|
+
key: H,
|
|
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(H);
|
|
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,125 +1379,143 @@ function Ft({ allowTableNodeSelection: t = !1 } = {}) {
|
|
|
1379
1379
|
decorations: Ze,
|
|
1380
1380
|
handleDOMEvents: { mousedown: Nt },
|
|
1381
1381
|
createSelectionBetween(e) {
|
|
1382
|
-
return
|
|
1382
|
+
return H.getState(e.state) != null ? e.state.selection : null;
|
|
1383
1383
|
},
|
|
1384
|
-
handleTripleClick:
|
|
1385
|
-
handleKeyDown:
|
|
1386
|
-
handlePaste:
|
|
1384
|
+
handleTripleClick: Mt,
|
|
1385
|
+
handleKeyDown: xt,
|
|
1386
|
+
handlePaste: vt
|
|
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 U(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 U(e || n);
|
|
1399
1399
|
}
|
|
1400
|
-
function
|
|
1401
|
-
return
|
|
1400
|
+
function Ft(t) {
|
|
1401
|
+
return U(t?.align);
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1403
|
+
function Le() {
|
|
1404
1404
|
return {
|
|
1405
1405
|
default: null,
|
|
1406
1406
|
parseHTML: (t) => Ot(t),
|
|
1407
|
-
renderHTML: (t) => t.align ? {
|
|
1407
|
+
renderHTML: (t) => t.align ? {
|
|
1408
|
+
style: `text-align: ${t.align}`
|
|
1409
|
+
} : {}
|
|
1408
1410
|
};
|
|
1409
1411
|
}
|
|
1410
|
-
function
|
|
1412
|
+
function jt(t) {
|
|
1411
1413
|
var e;
|
|
1412
1414
|
const n = t.parentElement, o = t.closest("table");
|
|
1413
|
-
if (!n || !o)
|
|
1414
|
-
|
|
1415
|
+
if (!n || !o)
|
|
1416
|
+
return null;
|
|
1417
|
+
const l = Array.from(n.children).indexOf(t), r = (e = o.querySelectorAll("colgroup > col")[l]) == null ? void 0 : e.getAttribute("width");
|
|
1415
1418
|
return r ? [parseInt(r, 10)] : null;
|
|
1416
1419
|
}
|
|
1417
1420
|
function $e(t) {
|
|
1418
1421
|
const e = t.getAttribute("colwidth");
|
|
1419
|
-
return e ? e.split(",").map((n) => parseInt(n, 10)) :
|
|
1422
|
+
return e ? e.split(",").map((n) => parseInt(n, 10)) : jt(t);
|
|
1420
1423
|
}
|
|
1421
|
-
|
|
1424
|
+
var Vt = /[ \t\r\n\f]+/g;
|
|
1422
1425
|
function We(t) {
|
|
1423
1426
|
var e;
|
|
1424
|
-
return t.children.length > 0 ? !1 : ((e = t.textContent)
|
|
1427
|
+
return t.children.length > 0 ? !1 : ((e = t.textContent) != null ? e : "").replace(Vt, "") === "";
|
|
1425
1428
|
}
|
|
1426
1429
|
function De(t) {
|
|
1427
1430
|
const e = t.createAndFill();
|
|
1428
|
-
if (!e)
|
|
1431
|
+
if (!e)
|
|
1432
|
+
throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);
|
|
1429
1433
|
return e.content;
|
|
1430
1434
|
}
|
|
1431
|
-
|
|
1435
|
+
var Kt = q.create({
|
|
1432
1436
|
name: "tableCell",
|
|
1433
1437
|
addOptions() {
|
|
1434
|
-
return {
|
|
1438
|
+
return {
|
|
1439
|
+
HTMLAttributes: {}
|
|
1440
|
+
};
|
|
1435
1441
|
},
|
|
1436
1442
|
content: "block+",
|
|
1437
1443
|
addAttributes() {
|
|
1438
1444
|
return {
|
|
1439
|
-
colspan: {
|
|
1440
|
-
|
|
1445
|
+
colspan: {
|
|
1446
|
+
default: 1
|
|
1447
|
+
},
|
|
1448
|
+
rowspan: {
|
|
1449
|
+
default: 1
|
|
1450
|
+
},
|
|
1441
1451
|
colwidth: {
|
|
1442
1452
|
default: null,
|
|
1443
1453
|
parseHTML: $e
|
|
1444
1454
|
},
|
|
1445
|
-
align:
|
|
1455
|
+
align: Le()
|
|
1446
1456
|
};
|
|
1447
1457
|
},
|
|
1448
1458
|
tableRole: "cell",
|
|
1449
1459
|
isolating: !0,
|
|
1450
1460
|
parseHTML() {
|
|
1451
|
-
return [{
|
|
1452
|
-
tag: "td",
|
|
1453
|
-
getAttrs: (t) => We(t) ? {} : !1,
|
|
1454
|
-
getContent: (t, e) => De(e.nodes[this.name])
|
|
1455
|
-
}, { tag: "td" }];
|
|
1456
|
-
},
|
|
1457
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
1458
1461
|
return [
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
+
{
|
|
1463
|
+
// Backfill empty cells; non-empty cells fall through to the rule below.
|
|
1464
|
+
tag: "td",
|
|
1465
|
+
getAttrs: (t) => We(t) ? {} : !1,
|
|
1466
|
+
getContent: (t, e) => De(e.nodes[this.name])
|
|
1467
|
+
},
|
|
1468
|
+
{ tag: "td" }
|
|
1462
1469
|
];
|
|
1470
|
+
},
|
|
1471
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1472
|
+
return ["td", P(this.options.HTMLAttributes, t), 0];
|
|
1463
1473
|
}
|
|
1464
|
-
}), Xt =
|
|
1474
|
+
}), Xt = q.create({
|
|
1465
1475
|
name: "tableHeader",
|
|
1466
1476
|
addOptions() {
|
|
1467
|
-
return {
|
|
1477
|
+
return {
|
|
1478
|
+
HTMLAttributes: {}
|
|
1479
|
+
};
|
|
1468
1480
|
},
|
|
1469
1481
|
content: "block+",
|
|
1470
1482
|
addAttributes() {
|
|
1471
1483
|
return {
|
|
1472
|
-
colspan: {
|
|
1473
|
-
|
|
1484
|
+
colspan: {
|
|
1485
|
+
default: 1
|
|
1486
|
+
},
|
|
1487
|
+
rowspan: {
|
|
1488
|
+
default: 1
|
|
1489
|
+
},
|
|
1474
1490
|
colwidth: {
|
|
1475
1491
|
default: null,
|
|
1476
1492
|
parseHTML: $e
|
|
1477
1493
|
},
|
|
1478
|
-
align:
|
|
1494
|
+
align: Le()
|
|
1479
1495
|
};
|
|
1480
1496
|
},
|
|
1481
1497
|
tableRole: "header_cell",
|
|
1482
1498
|
isolating: !0,
|
|
1483
1499
|
parseHTML() {
|
|
1484
|
-
return [{
|
|
1485
|
-
tag: "th",
|
|
1486
|
-
getAttrs: (t) => We(t) ? {} : !1,
|
|
1487
|
-
getContent: (t, e) => De(e.nodes[this.name])
|
|
1488
|
-
}, { tag: "th" }];
|
|
1489
|
-
},
|
|
1490
|
-
renderHTML({ HTMLAttributes: t }) {
|
|
1491
1500
|
return [
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1501
|
+
{
|
|
1502
|
+
// Backfill empty cells; non-empty cells fall through to the rule below.
|
|
1503
|
+
tag: "th",
|
|
1504
|
+
getAttrs: (t) => We(t) ? {} : !1,
|
|
1505
|
+
getContent: (t, e) => De(e.nodes[this.name])
|
|
1506
|
+
},
|
|
1507
|
+
{ tag: "th" }
|
|
1495
1508
|
];
|
|
1509
|
+
},
|
|
1510
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1511
|
+
return ["th", P(this.options.HTMLAttributes, t), 0];
|
|
1496
1512
|
}
|
|
1497
|
-
}),
|
|
1513
|
+
}), Ut = q.create({
|
|
1498
1514
|
name: "tableRow",
|
|
1499
1515
|
addOptions() {
|
|
1500
|
-
return {
|
|
1516
|
+
return {
|
|
1517
|
+
HTMLAttributes: {}
|
|
1518
|
+
};
|
|
1501
1519
|
},
|
|
1502
1520
|
content: "(tableCell | tableHeader)*",
|
|
1503
1521
|
tableRole: "row",
|
|
@@ -1505,47 +1523,45 @@ const Kt = U.create({
|
|
|
1505
1523
|
return [{ tag: "tr" }];
|
|
1506
1524
|
},
|
|
1507
1525
|
renderHTML({ HTMLAttributes: t }) {
|
|
1508
|
-
return [
|
|
1509
|
-
"tr",
|
|
1510
|
-
B(this.options.HTMLAttributes, t),
|
|
1511
|
-
0
|
|
1512
|
-
];
|
|
1526
|
+
return ["tr", P(this.options.HTMLAttributes, t), 0];
|
|
1513
1527
|
}
|
|
1514
1528
|
});
|
|
1515
1529
|
function re(t, e) {
|
|
1516
1530
|
return e ? ["width", `${Math.max(e, t)}px`] : ["min-width", `${t}px`];
|
|
1517
1531
|
}
|
|
1518
1532
|
function ye(t, e, n, o, l, r) {
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
for (let
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1533
|
+
var s;
|
|
1534
|
+
let c = 0, i = !0, a = e.firstChild;
|
|
1535
|
+
const d = t.firstChild;
|
|
1536
|
+
if (d !== null)
|
|
1537
|
+
for (let u = 0, h = 0; u < d.childCount; u += 1) {
|
|
1538
|
+
const { colspan: p, colwidth: g } = d.child(u).attrs;
|
|
1539
|
+
for (let w = 0; w < p; w += 1, h += 1) {
|
|
1540
|
+
const m = l === h ? r : g && g[w], y = m ? `${m}px` : "";
|
|
1541
|
+
if (c += m || o, m || (i = !1), a) {
|
|
1542
|
+
if (a.style.width !== y) {
|
|
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);
|
|
1529
1550
|
}
|
|
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);
|
|
1534
1551
|
}
|
|
1535
1552
|
}
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
const u = i.nextSibling;
|
|
1540
|
-
(d = i.parentNode) === null || d === void 0 || d.removeChild(i), i = u;
|
|
1553
|
+
for (; a; ) {
|
|
1554
|
+
const u = a.nextSibling;
|
|
1555
|
+
(s = a.parentNode) == null || s.removeChild(a), a = u;
|
|
1541
1556
|
}
|
|
1542
1557
|
const f = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
|
|
1543
|
-
|
|
1558
|
+
i && !f ? (n.style.width = `${c}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${c}px`);
|
|
1544
1559
|
}
|
|
1545
|
-
var
|
|
1560
|
+
var qt = class {
|
|
1546
1561
|
constructor(t, e, n, o = {}) {
|
|
1547
1562
|
this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table"));
|
|
1548
|
-
for (const [l, r] of Object.entries(o))
|
|
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)));
|
|
1549
1565
|
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"));
|
|
1550
1566
|
}
|
|
1551
1567
|
update(t) {
|
|
@@ -1559,32 +1575,26 @@ var Ut = class {
|
|
|
1559
1575
|
function Jt(t, e, n, o) {
|
|
1560
1576
|
let l = 0, r = !0;
|
|
1561
1577
|
const s = [], c = t.firstChild;
|
|
1562
|
-
if (!c)
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1578
|
+
if (!c)
|
|
1579
|
+
return {};
|
|
1580
|
+
for (let f = 0, u = 0; f < c.childCount; f += 1) {
|
|
1581
|
+
const { colspan: h, colwidth: p } = c.child(f).attrs;
|
|
1582
|
+
for (let g = 0; g < h; g += 1, u += 1) {
|
|
1583
|
+
const w = n === u ? o : p && p[g];
|
|
1584
|
+
l += w || e, w || (r = !1);
|
|
1585
|
+
const [m, y] = re(e, w);
|
|
1586
|
+
s.push(["col", { style: `${m}: ${y}` }]);
|
|
1570
1587
|
}
|
|
1571
1588
|
}
|
|
1572
1589
|
const i = r ? `${l}px` : "", a = r ? "" : `${l}px`;
|
|
1573
|
-
return {
|
|
1574
|
-
colgroup: [
|
|
1575
|
-
"colgroup",
|
|
1576
|
-
{},
|
|
1577
|
-
...s
|
|
1578
|
-
],
|
|
1579
|
-
tableWidth: i,
|
|
1580
|
-
tableMinWidth: a
|
|
1581
|
-
};
|
|
1590
|
+
return { colgroup: ["colgroup", {}, ...s], tableWidth: i, tableMinWidth: a };
|
|
1582
1591
|
}
|
|
1583
1592
|
function Ae(t, e) {
|
|
1584
1593
|
return e ? t.createChecked(null, e) : t.createAndFill();
|
|
1585
1594
|
}
|
|
1586
1595
|
function Yt(t) {
|
|
1587
|
-
if (t.cached.tableNodeTypes)
|
|
1596
|
+
if (t.cached.tableNodeTypes)
|
|
1597
|
+
return t.cached.tableNodeTypes;
|
|
1588
1598
|
const e = {};
|
|
1589
1599
|
return Object.keys(t.nodes).forEach((n) => {
|
|
1590
1600
|
const o = t.nodes[n];
|
|
@@ -1601,32 +1611,40 @@ function Gt(t, e, n, o, l) {
|
|
|
1601
1611
|
}
|
|
1602
1612
|
}
|
|
1603
1613
|
const i = [];
|
|
1604
|
-
for (let a = 0; a < e; a += 1)
|
|
1614
|
+
for (let a = 0; a < e; a += 1)
|
|
1615
|
+
i.push(r.row.createChecked(null, o && a === 0 ? s : c));
|
|
1605
1616
|
return r.table.createChecked(null, i);
|
|
1606
1617
|
}
|
|
1607
1618
|
function Qt(t) {
|
|
1608
1619
|
return t instanceof b;
|
|
1609
1620
|
}
|
|
1610
|
-
|
|
1621
|
+
var j = ({ editor: t }) => {
|
|
1611
1622
|
const { selection: e } = t.state;
|
|
1612
|
-
if (!Qt(e))
|
|
1623
|
+
if (!Qt(e))
|
|
1624
|
+
return !1;
|
|
1613
1625
|
let n = 0;
|
|
1614
|
-
const o = X(e.ranges[0].$from, (
|
|
1615
|
-
return o?.node.descendants((
|
|
1616
|
-
if (
|
|
1617
|
-
|
|
1618
|
-
|
|
1626
|
+
const o = X(e.ranges[0].$from, (r) => r.type.name === "table");
|
|
1627
|
+
return o?.node.descendants((r) => {
|
|
1628
|
+
if (r.type.name === "table")
|
|
1629
|
+
return !1;
|
|
1630
|
+
["tableCell", "tableHeader"].includes(r.type.name) && (n += 1);
|
|
1631
|
+
}), n === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
1619
1632
|
};
|
|
1620
1633
|
function Se(t, e) {
|
|
1621
|
-
const n = t.mapping.map(e), o = X(
|
|
1622
|
-
|
|
1634
|
+
const n = t.mapping.map(e), o = X(
|
|
1635
|
+
t.selection.$from,
|
|
1636
|
+
(s) => s.type.name === "table"
|
|
1637
|
+
);
|
|
1638
|
+
if (o?.pos === n)
|
|
1639
|
+
return;
|
|
1623
1640
|
const l = t.doc.nodeAt(n);
|
|
1624
|
-
if (!l)
|
|
1641
|
+
if (!l)
|
|
1642
|
+
return;
|
|
1625
1643
|
const r = n + l.nodeSize - 1;
|
|
1626
|
-
t.setSelection(
|
|
1644
|
+
t.setSelection(E.near(t.doc.resolve(r), -1));
|
|
1627
1645
|
}
|
|
1628
|
-
|
|
1629
|
-
function
|
|
1646
|
+
var Zt = "";
|
|
1647
|
+
function en(t) {
|
|
1630
1648
|
let e = "", n = 0;
|
|
1631
1649
|
for (; n < t.length; ) {
|
|
1632
1650
|
if (t[n] === "\\" && n + 1 < t.length) {
|
|
@@ -1649,7 +1667,7 @@ function Zt(t) {
|
|
|
1649
1667
|
for (; l + s < t.length && t[l + s] === "`"; ) s += 1;
|
|
1650
1668
|
if (s === o) {
|
|
1651
1669
|
const c = t.slice(n + o, l);
|
|
1652
|
-
e += t.slice(n, n + o) + c.replace(
|
|
1670
|
+
e += t.slice(n, n + o) + c.replace(new RegExp("(?<!\\\\)\\|", "g"), "\\|") + t.slice(l, l + o), n = l + o, r = !0;
|
|
1653
1671
|
break;
|
|
1654
1672
|
}
|
|
1655
1673
|
l += s;
|
|
@@ -1658,65 +1676,71 @@ function Zt(t) {
|
|
|
1658
1676
|
}
|
|
1659
1677
|
return e;
|
|
1660
1678
|
}
|
|
1661
|
-
function
|
|
1679
|
+
function tn(t) {
|
|
1662
1680
|
return t.split(`
|
|
1663
|
-
`).map((e) => !e.includes("|") || !e.includes("`") ? e :
|
|
1681
|
+
`).map((e) => !e.includes("|") || !e.includes("`") ? e : en(e)).join(`
|
|
1664
1682
|
`);
|
|
1665
1683
|
}
|
|
1666
|
-
function
|
|
1684
|
+
function nn(t) {
|
|
1667
1685
|
return (t || "").replace(/\s+/g, " ").trim();
|
|
1668
1686
|
}
|
|
1669
|
-
function
|
|
1687
|
+
function on(t, e, n = {}) {
|
|
1670
1688
|
var o;
|
|
1671
|
-
const l = (o = n.cellLineSeparator)
|
|
1672
|
-
if (!t || !t.content || t.content.length === 0)
|
|
1689
|
+
const l = (o = n.cellLineSeparator) != null ? o : Zt;
|
|
1690
|
+
if (!t || !t.content || t.content.length === 0)
|
|
1691
|
+
return "";
|
|
1673
1692
|
const r = [];
|
|
1674
|
-
t.content.forEach((
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1677
|
-
let
|
|
1678
|
-
m.content && Array.isArray(m.content) && m.content.length > 1 ?
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
});
|
|
1686
|
-
}), r.push(
|
|
1693
|
+
t.content.forEach((g) => {
|
|
1694
|
+
const w = [];
|
|
1695
|
+
g.content && g.content.forEach((m) => {
|
|
1696
|
+
let y = "";
|
|
1697
|
+
m.content && Array.isArray(m.content) && m.content.length > 1 ? y = m.content.map(
|
|
1698
|
+
($) => e.renderChildren($)
|
|
1699
|
+
).join(l) : y = m.content ? e.renderChildren(m.content) : "";
|
|
1700
|
+
const S = nn(
|
|
1701
|
+
y.split(l).join(`
|
|
1702
|
+
`).replace(/[ \t]*\r?\n[ \t]*/g, "<br>")
|
|
1703
|
+
), N = m.type === "tableHeader", T = Ft(m.attrs);
|
|
1704
|
+
w.push({ text: S, isHeader: N, align: T });
|
|
1705
|
+
}), r.push(w);
|
|
1687
1706
|
});
|
|
1688
|
-
const s = r.reduce((
|
|
1689
|
-
if (s === 0)
|
|
1707
|
+
const s = r.reduce((g, w) => Math.max(g, w.length), 0);
|
|
1708
|
+
if (s === 0)
|
|
1709
|
+
return "";
|
|
1690
1710
|
const c = Array.from({ length: s }).fill(0);
|
|
1691
|
-
r.forEach((
|
|
1711
|
+
r.forEach((g) => {
|
|
1712
|
+
var w;
|
|
1692
1713
|
for (let m = 0; m < s; m += 1) {
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
w > c[m] && (c[m] = w), c[m] < 3 && (c[m] = 3);
|
|
1714
|
+
const S = (((w = g[m]) == null ? void 0 : w.text) || "").length;
|
|
1715
|
+
S > c[m] && (c[m] = S), c[m] < 3 && (c[m] = 3);
|
|
1696
1716
|
}
|
|
1697
1717
|
});
|
|
1698
|
-
const i = (
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1718
|
+
const i = (g, w) => g + " ".repeat(Math.max(0, w - g.length)), a = r[0], d = a.some((g) => g.isHeader), f = Array.from({
|
|
1719
|
+
length: s
|
|
1720
|
+
}).fill(null);
|
|
1721
|
+
r.forEach((g) => {
|
|
1722
|
+
var w;
|
|
1723
|
+
for (let m = 0; m < s; m += 1)
|
|
1724
|
+
!f[m] && ((w = g[m]) != null && w.align) && (f[m] = g[m].align);
|
|
1704
1725
|
});
|
|
1705
1726
|
let u = `
|
|
1706
1727
|
`;
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1728
|
+
const h = Array.from({ length: s }).map(
|
|
1729
|
+
(g, w) => d && a[w] && a[w].text || ""
|
|
1730
|
+
);
|
|
1731
|
+
return u += `| ${h.map((g, w) => i(g, c[w])).join(" | ")} |
|
|
1732
|
+
`, u += `| ${c.map((g, w) => {
|
|
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);
|
|
1712
1735
|
}).join(" | ")} |
|
|
1713
|
-
`, (d ? r.slice(1) : r).forEach((
|
|
1714
|
-
u += `| ${Array.from({ length: s }).fill(0).map((
|
|
1736
|
+
`, (d ? r.slice(1) : r).forEach((g) => {
|
|
1737
|
+
u += `| ${Array.from({ length: s }).fill(0).map((w, m) => i(g[m] && g[m].text || "", c[m])).join(" | ")} |
|
|
1715
1738
|
`;
|
|
1716
1739
|
}), u;
|
|
1717
1740
|
}
|
|
1718
|
-
|
|
1741
|
+
var ln = on, rn = q.create({
|
|
1719
1742
|
name: "table",
|
|
1743
|
+
// @ts-ignore
|
|
1720
1744
|
addOptions() {
|
|
1721
1745
|
return {
|
|
1722
1746
|
HTMLAttributes: {},
|
|
@@ -1724,7 +1748,8 @@ const on = U.create({
|
|
|
1724
1748
|
renderWrapper: !1,
|
|
1725
1749
|
handleWidth: 5,
|
|
1726
1750
|
cellMinWidth: 25,
|
|
1727
|
-
|
|
1751
|
+
// TODO: fix
|
|
1752
|
+
View: qt,
|
|
1728
1753
|
lastColumnResizable: !0,
|
|
1729
1754
|
allowTableNodeSelection: !1
|
|
1730
1755
|
};
|
|
@@ -1743,15 +1768,13 @@ const on = U.create({
|
|
|
1743
1768
|
}
|
|
1744
1769
|
const c = [
|
|
1745
1770
|
"table",
|
|
1746
|
-
|
|
1771
|
+
P(this.options.HTMLAttributes, e, {
|
|
1772
|
+
style: s()
|
|
1773
|
+
}),
|
|
1747
1774
|
n,
|
|
1748
1775
|
["tbody", 0]
|
|
1749
1776
|
];
|
|
1750
|
-
return this.options.renderWrapper ? [
|
|
1751
|
-
"div",
|
|
1752
|
-
{ class: "tableWrapper" },
|
|
1753
|
-
c
|
|
1754
|
-
] : c;
|
|
1777
|
+
return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, c] : c;
|
|
1755
1778
|
},
|
|
1756
1779
|
parseMarkdown: (t, e) => {
|
|
1757
1780
|
const n = [], o = Array.isArray(t.align) ? t.align : [];
|
|
@@ -1759,26 +1782,28 @@ const on = U.create({
|
|
|
1759
1782
|
const l = [];
|
|
1760
1783
|
t.header.forEach((r, s) => {
|
|
1761
1784
|
var c;
|
|
1762
|
-
const i =
|
|
1763
|
-
l.push(
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1785
|
+
const i = U((c = o[s]) != null ? c : r.align), a = i ? { align: i } : {};
|
|
1786
|
+
l.push(
|
|
1787
|
+
e.createNode("tableHeader", a, [
|
|
1788
|
+
{ type: "paragraph", content: e.parseInline(r.tokens) }
|
|
1789
|
+
])
|
|
1790
|
+
);
|
|
1767
1791
|
}), n.push(e.createNode("tableRow", {}, l));
|
|
1768
1792
|
}
|
|
1769
1793
|
return t.rows && t.rows.forEach((l) => {
|
|
1770
1794
|
const r = [];
|
|
1771
1795
|
l.forEach((s, c) => {
|
|
1772
1796
|
var i;
|
|
1773
|
-
const a =
|
|
1774
|
-
r.push(
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1797
|
+
const a = U((i = o[c]) != null ? i : s.align), d = a ? { align: a } : {};
|
|
1798
|
+
r.push(
|
|
1799
|
+
e.createNode("tableCell", d, [
|
|
1800
|
+
{ type: "paragraph", content: e.parseInline(s.tokens) }
|
|
1801
|
+
])
|
|
1802
|
+
);
|
|
1778
1803
|
}), n.push(e.createNode("tableRow", {}, r));
|
|
1779
1804
|
}), e.createNode("table", void 0, n);
|
|
1780
1805
|
},
|
|
1781
|
-
renderMarkdown: (t, e) =>
|
|
1806
|
+
renderMarkdown: (t, e) => ln(t, e),
|
|
1782
1807
|
markdownTokenizer: {
|
|
1783
1808
|
name: "table",
|
|
1784
1809
|
level: "block",
|
|
@@ -1797,18 +1822,15 @@ const on = U.create({
|
|
|
1797
1822
|
if (r.length < 2) return;
|
|
1798
1823
|
const s = r[1];
|
|
1799
1824
|
if (!/^[ \t|:]*-[ \t|:-]*$/.test(s) || !s.includes("|")) return;
|
|
1800
|
-
const c =
|
|
1825
|
+
const c = tn(l);
|
|
1801
1826
|
if (c === l) return;
|
|
1802
|
-
const
|
|
1803
|
-
if (
|
|
1804
|
-
const
|
|
1805
|
-
`).length,
|
|
1806
|
-
`).slice(0,
|
|
1827
|
+
const a = n.blockTokens(c)[0];
|
|
1828
|
+
if (a?.type !== "table" || !a.raw) return;
|
|
1829
|
+
const d = a.raw.split(`
|
|
1830
|
+
`).length, f = t.split(`
|
|
1831
|
+
`).slice(0, d).join(`
|
|
1807
1832
|
`);
|
|
1808
|
-
return {
|
|
1809
|
-
...i,
|
|
1810
|
-
raw: d
|
|
1811
|
-
};
|
|
1833
|
+
return { ...a, raw: f };
|
|
1812
1834
|
}
|
|
1813
1835
|
},
|
|
1814
1836
|
addCommands() {
|
|
@@ -1817,31 +1839,43 @@ const on = U.create({
|
|
|
1817
1839
|
const s = Gt(r.schema, t, e, n);
|
|
1818
1840
|
if (l) {
|
|
1819
1841
|
const c = o.selection.from + 1;
|
|
1820
|
-
o.replaceSelectionWith(s).scrollIntoView().setSelection(
|
|
1842
|
+
o.replaceSelectionWith(s).scrollIntoView().setSelection(E.near(o.doc.resolve(c)));
|
|
1821
1843
|
}
|
|
1822
1844
|
return !0;
|
|
1823
1845
|
},
|
|
1824
1846
|
addColumnBefore: () => ({ state: t, dispatch: e }) => rt(t, e),
|
|
1825
1847
|
addColumnAfter: () => ({ state: t, dispatch: e }) => st(t, e),
|
|
1826
1848
|
deleteColumn: () => ({ state: t, dispatch: e }) => {
|
|
1827
|
-
const n = X(
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1849
|
+
const n = X(
|
|
1850
|
+
t.selection.$from,
|
|
1851
|
+
(o) => o.type.name === "table"
|
|
1852
|
+
);
|
|
1853
|
+
return ct(
|
|
1854
|
+
t,
|
|
1855
|
+
e && ((o) => {
|
|
1856
|
+
n && Se(o, n.pos), e(o);
|
|
1857
|
+
})
|
|
1858
|
+
);
|
|
1831
1859
|
},
|
|
1832
1860
|
addRowBefore: () => ({ state: t, dispatch: e }) => dt(t, e),
|
|
1833
1861
|
addRowAfter: () => ({ state: t, dispatch: e }) => ft(t, e),
|
|
1834
1862
|
deleteRow: () => ({ state: t, dispatch: e }) => {
|
|
1835
|
-
const n = X(
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1863
|
+
const n = X(
|
|
1864
|
+
t.selection.$from,
|
|
1865
|
+
(o) => o.type.name === "table"
|
|
1866
|
+
);
|
|
1867
|
+
return ht(
|
|
1868
|
+
t,
|
|
1869
|
+
e && ((o) => {
|
|
1870
|
+
n && Se(o, n.pos), e(o);
|
|
1871
|
+
})
|
|
1872
|
+
);
|
|
1839
1873
|
},
|
|
1840
1874
|
deleteTable: () => ({ state: t, dispatch: e }) => yt(t, e),
|
|
1841
1875
|
mergeCells: () => ({ state: t, dispatch: e }) => ae(t, e),
|
|
1842
1876
|
splitCell: () => ({ state: t, dispatch: e }) => de(t, e),
|
|
1843
|
-
toggleHeaderColumn: () => ({ state: t, dispatch: e }) =>
|
|
1844
|
-
toggleHeaderRow: () => ({ state: t, dispatch: e }) =>
|
|
1877
|
+
toggleHeaderColumn: () => ({ state: t, dispatch: e }) => I("column")(t, e),
|
|
1878
|
+
toggleHeaderRow: () => ({ state: t, dispatch: e }) => I("row")(t, e),
|
|
1845
1879
|
toggleHeaderCell: () => ({ state: t, dispatch: e }) => bt(t, e),
|
|
1846
1880
|
mergeOrSplit: () => ({ state: t, dispatch: e }) => ae(t, e) ? !0 : de(t, e),
|
|
1847
1881
|
setCellAttribute: (t, e) => ({ state: n, dispatch: o }) => gt(t, e)(n, o),
|
|
@@ -1861,25 +1895,32 @@ const on = U.create({
|
|
|
1861
1895
|
return {
|
|
1862
1896
|
Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
|
|
1863
1897
|
"Shift-Tab": () => this.editor.commands.goToPreviousCell(),
|
|
1864
|
-
Backspace:
|
|
1865
|
-
"Mod-Backspace":
|
|
1866
|
-
Delete:
|
|
1867
|
-
"Mod-Delete":
|
|
1898
|
+
Backspace: j,
|
|
1899
|
+
"Mod-Backspace": j,
|
|
1900
|
+
Delete: j,
|
|
1901
|
+
"Mod-Delete": j
|
|
1868
1902
|
};
|
|
1869
1903
|
},
|
|
1870
1904
|
addProseMirrorPlugins() {
|
|
1871
|
-
return [
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1905
|
+
return [
|
|
1906
|
+
...this.options.resizable && this.editor.isEditable ? [
|
|
1907
|
+
kt({
|
|
1908
|
+
handleWidth: this.options.handleWidth,
|
|
1909
|
+
cellMinWidth: this.options.cellMinWidth,
|
|
1910
|
+
defaultCellMinWidth: this.options.cellMinWidth,
|
|
1911
|
+
View: this.options.View,
|
|
1912
|
+
lastColumnResizable: this.options.lastColumnResizable
|
|
1913
|
+
})
|
|
1914
|
+
] : [],
|
|
1915
|
+
_t({
|
|
1916
|
+
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
1917
|
+
})
|
|
1918
|
+
];
|
|
1878
1919
|
},
|
|
1879
1920
|
addNodeView() {
|
|
1880
1921
|
const t = this.options.resizable && this.editor.isEditable, e = this.options.View;
|
|
1881
1922
|
return t || !e ? null : ({ node: n, view: o, HTMLAttributes: l }) => {
|
|
1882
|
-
const r =
|
|
1923
|
+
const r = P(this.options.HTMLAttributes, l);
|
|
1883
1924
|
return new e(n, this.options.cellMinWidth, o, r);
|
|
1884
1925
|
};
|
|
1885
1926
|
},
|
|
@@ -1889,27 +1930,29 @@ const on = U.create({
|
|
|
1889
1930
|
options: t.options,
|
|
1890
1931
|
storage: t.storage
|
|
1891
1932
|
};
|
|
1892
|
-
return {
|
|
1933
|
+
return {
|
|
1934
|
+
tableRole: Fe(je(t, "tableRole", e))
|
|
1935
|
+
};
|
|
1893
1936
|
}
|
|
1894
|
-
}),
|
|
1937
|
+
}), dn = Oe.create({
|
|
1895
1938
|
name: "tableKit",
|
|
1896
1939
|
addExtensions() {
|
|
1897
1940
|
const t = [];
|
|
1898
|
-
return this.options.table !== !1 && t.push(
|
|
1941
|
+
return this.options.table !== !1 && t.push(rn.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(Ut.configure(this.options.tableRow)), t;
|
|
1899
1942
|
}
|
|
1900
1943
|
});
|
|
1901
1944
|
export {
|
|
1902
|
-
|
|
1903
|
-
|
|
1945
|
+
Zt as DEFAULT_CELL_LINE_SEPARATOR,
|
|
1946
|
+
rn as Table,
|
|
1904
1947
|
Kt as TableCell,
|
|
1905
1948
|
Xt as TableHeader,
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1949
|
+
dn as TableKit,
|
|
1950
|
+
Ut as TableRow,
|
|
1951
|
+
qt as TableView,
|
|
1909
1952
|
Jt as createColGroup,
|
|
1910
1953
|
Gt as createTable,
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1954
|
+
en as escapeTableCellPipes,
|
|
1955
|
+
tn as preprocessTablePipes,
|
|
1956
|
+
on as renderTableToMarkdown,
|
|
1914
1957
|
ye as updateColumns
|
|
1915
1958
|
};
|